:root {
  /* 核心配色 */
  --primary: #002b49;        
  --primary-light: #f0f4f8; 
  --accent: #c5a065;        
  --text-main: #111827;
  --text-sub: #4b5563;
  --border: #e5e7eb;
  --white: #ffffff;
  --danger: #dc2626;
  --success: #10b981;
  --warning: #f59e0b;
  --info: #3b82f6;
  --font-stack: "Inter", "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  --shadow-paper: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
  
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-stack);
  background: #f3f4f6;
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.app-container { display: flex; height: 100vh; width: 100vw; }

/* Icons */
svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* Preview Area */
.pane-preview { flex: 1; background: #e5e7eb; display: flex; flex-direction: column; border-right: 1px solid var(--border); }

/* ========================================
   工具栏 - 重新设计
======================================== */
.toolbar { 
  display: flex; 
  justify-content: space-between; 
  align-items: center;
  padding: 0 20px;
  height: 56px;
  background: white;
  border-bottom: 1px solid #e2e8f0;
  gap: 24px;
}

/* 左侧：用户状态区 */
.toolbar-left {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.user-status-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: #f8fafc;
  border-radius: 20px;
  border: 1px solid #e2e8f0;
  position: relative;
  transition: all 0.2s ease;
}

.user-status-wrap:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.user-status-wrap:hover .btn-logout-mini {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

/* 中间：模式切换 */
.toolbar-center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}

/* 右侧：语言 + 操作按钮 */
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}
.preview-scroll-area { flex: 1; overflow-y: auto; padding: 40px; display: flex; justify-content: center; background-image: radial-gradient(#9ca3af 1px, transparent 1px); background-size: 20px 20px; }
.paper { width: 210mm; min-height: 297mm; background: white; box-shadow: var(--shadow-paper); padding: 40px; display: flex; flex-direction: column; position: relative; }

/* Form Area */
.pane-form { width: 640px; background: var(--white); display: flex; flex-direction: column; box-shadow: -5px 0 15px rgba(0,0,0,0.03); z-index: 20; }
.form-header { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.form-header h2 { margin: 0; font-size: 18px; }
.form-scroll-area { flex: 1; overflow-y: auto; padding: 20px; padding-bottom: 150px; }
.form-group { background: var(--primary-light); border: 1px solid #dae2ed; border-radius: 8px; padding: 16px; margin-bottom: 16px; transition: all 0.3s; }
.form-title { font-size: 12px; font-weight: 700; color: var(--primary); text-transform: uppercase; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }

/* 开票信息折叠区域 */
.invoice-info-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #d1d5db;
}

.invoice-info-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  transition: all 0.2s ease;
}

.invoice-info-toggle:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: var(--primary);
}

.invoice-info-toggle .toggle-icon {
  font-size: 10px;
  color: #94a3b8;
  transition: transform 0.2s ease;
}

.invoice-info-toggle .toggle-hint {
  font-weight: 400;
  color: #94a3b8;
  font-size: 11px;
  margin-left: auto;
}

.invoice-info-content {
  margin-top: 12px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}

/* 联系方式显示样式 */
.contact-line {
  color: #64748b;
  font-size: 11px;
  margin-top: 2px;
}
.row { display: flex; gap: 10px; margin-bottom: 10px; }
.col { flex: 1; min-width: 0; }
.col-sm { flex: 0 0 80px; }
label { display: block; font-size: 11px; color: var(--text-sub); margin-bottom: 4px; font-weight: 600; }
  
/* --- Unified Input Group Style --- */
.input-group { display: flex; width: 100%; align-items: stretch; position: relative; }
.input-group .input-box { flex: 1; position: relative; }
.input-group .input-box input { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: none; width: 100%; padding-right: 26px; }
.input-group select { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: none; width: 100%; flex: 1; }

/* The Button on the right (Grouped) */
.group-btn {
  width: 38px; background-color: #f9fafb; border: 1px solid var(--border); border-left: 1px solid #e5e7eb;
  border-top-right-radius: 6px; border-bottom-right-radius: 6px;
  display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative; color: #64748b;
}
.group-btn:hover { background-color: #e0f2fe; color: var(--primary); border-color: #d1d5db; }
.group-btn svg { width: 15px; height: 15px; }

/* Delete button specific styles */
.group-btn[onclick*="deleteClient"]:hover { 
  background-color: #fee2e2 !important; 
  color: #dc2626 !important; 
  border-color: #fca5a5 !important; 
}

/* Merged Group (Same style) */
.merged-group { display: flex; width: 100%; align-items: stretch; }
.merged-group .input-box { flex: 1; }
.merged-group .input-box input { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: none; }
.merged-trigger {
  width: 38px; background-color: #f9fafb; border: 1px solid var(--border); border-left: 1px solid #e5e7eb;
  border-top-right-radius: 6px; border-bottom-right-radius: 6px;
  display: flex; align-items: center; justify-content: center; cursor: pointer; color: #64748b;
  position: relative; overflow: hidden; 
}
.merged-trigger:hover { background-color: #eff6ff; color: var(--info); }

/* Standard Inputs */
input, textarea, select { width: 100%; font-family: inherit; font-size: 13px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--white); }
textarea { resize: vertical; min-height: 60px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); }
input[readonly], textarea[readonly] { background-color: #e5e7eb; color: #6b7280; cursor: not-allowed; border-color: #d1d5db; }

/* Clear X Button */
.input-box { position: relative; }
.input-box input[type="text"], .input-box textarea { padding-right: 26px; }
.clear-x {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  font-size: 12px; color: #9ca3af; cursor: pointer; display: none; z-index: 5;
  width: 16px; height: 16px; line-height: 15px; text-align: center; background: rgba(255,255,255,0.8); border-radius: 50%; font-weight: bold;
}
.clear-x:hover { color: #ef4444; background: #fee2e2; }
.input-box.has-val .clear-x { display: block; }
textarea + .clear-x { top: 12px; transform: none; }

/* --- Date Picker Fix --- */
.input-box.date-box input[type="text"] { padding-right: 26px; } 
  
/* Independent Button Style (Price Save) */
.btn-icon-separate {
  width: 36px; height: 35px; flex: 0 0 36px;
  background-color: #f9fafb; border: 1px solid var(--border); border-radius: 6px;
  display: flex; align-items: center; justify-content: center; cursor: pointer; color: #64748b;
}
.btn-icon-separate:hover { background-color: #e0f2fe; color: var(--primary); border-color: #d1d5db; }

/* Hidden Date Input */
.hidden-date-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; }

/* Buttons */
.btn { border: none; border-radius: 4px; padding: 8px 12px; font-size: 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-family: inherit; white-space: nowrap; }
.btn svg { width: 14px; height: 14px; }
.btn-primary { background: var(--primary); color: white; }
.btn-outline { background: white; border: 1px solid var(--border); color: var(--text-main); }
.btn-sm { padding: 4px 8px; font-size: 11px; }
.btn-save { background: var(--success); color: white; border: 1px solid #059669; }
.btn-del { background: #fee2e2; color: var(--danger); border: 1px solid #f87171; }
.btn-edit { background: #eff6ff; color: var(--info); border: 1px solid #bfdbfe; }
.btn-backup { background: var(--warning); color: white; margin-right: 4px; }
.btn-restore { background: #9ca3af; color: white; }
.btn-addon { background: #e0f2fe; color: var(--primary); border: 1px solid #bae6fd; font-size: 11px; padding: 3px 8px; }
.btn-toggle { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-toggle:hover { background: var(--primary); color: white; }

/* ========================================
   语言切换按钮
======================================== */
.lang-switcher { 
  display: flex; 
  gap: 4px;
  padding: 3px;
  background: #f1f5f9;
  border-radius: 8px;
}

.btn-lang { 
  width: 32px;
  height: 28px;
  padding: 0;
  font-size: 12px; 
  font-weight: 600;
  background: transparent; 
  color: #64748b; 
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-lang:hover { 
  background: white;
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-lang.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* ========================================
   模式切换按钮
======================================== */
.mode-switcher {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: #f1f5f9;
  border-radius: 10px;
}

.btn-mode {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  color: #64748b;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-family: inherit;
}

.btn-mode svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

.btn-mode:hover:not(.active) {
  background: white;
  color: var(--primary);
  border-color: #e2e8f0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.btn-mode.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 43, 73, 0.25);
}

.btn-mode.active svg {
  stroke: white;
}

/* ========================================
   操作按钮（重置/打印）
======================================== */
.action-buttons {
  display: flex;
  gap: 8px;
}

.btn-action {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  white-space: nowrap;
}

.btn-action svg {
  width: 15px;
  height: 15px;
  stroke-width: 2;
}

.btn-reset {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.btn-reset:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

.btn-save-db {
  background: #059669;
  color: white;
}

.btn-save-db:hover {
  background: #047857;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
}

.btn-save-db svg {
  stroke: white;
}

.btn-print {
  background: var(--primary);
  color: white;
}

.btn-print:hover {
  background: #001d33;
  box-shadow: 0 2px 8px rgba(0, 43, 73, 0.3);
}

.btn-print svg {
  stroke: white;
}

/* ========================================
   退出按钮（迷你版）
======================================== */
.btn-logout-mini {
  width: 28px;
  height: 28px;
  padding: 0;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateX(-8px);
  pointer-events: none;
  transition: all 0.2s ease;
}

.btn-logout-mini svg {
  width: 14px;
  height: 14px;
  stroke: #dc2626;
  stroke-width: 2;
  fill: none;
}

.btn-logout-mini:hover {
  background: #fee2e2;
  border-color: #f87171;
  transform: translateX(0) scale(1.05);
}

/* 报价模式下隐藏的元素 */
.quote-mode .bill-only {
  display: none !important;
}

/* 报价模式下显示的元素 */
.quote-mode .quote-only {
  display: flex !important;
}

/* 票据模式下隐藏的元素 */
.ticket-mode .bill-only {
  display: none !important;
}

/* 报价模式表格列宽由 HTML 内联样式控制，此处仅添加数字列不换行 */
.quote-mode .inv-table td.num {
  white-space: nowrap;
}

/* 票据模式下调整表格列宽，让表头横条占满整行 */
.ticket-mode .inv-table th:nth-child(1) { width: 45% !important; }
.ticket-mode .inv-table th:nth-child(2) { width: 12% !important; }
.ticket-mode .inv-table th:nth-child(3) { width: 15% !important; }
.ticket-mode .inv-table th:nth-child(6) { width: 14% !important; }
.ticket-mode .inv-table th:nth-child(7) { width: 14% !important; }

.ticket-mode .inv-table td:nth-child(1) { width: 45% !important; }
.ticket-mode .inv-table td:nth-child(2) { width: 12% !important; }
.ticket-mode .inv-table td:nth-child(3) { width: 15% !important; }
.ticket-mode .inv-table td:nth-child(6) { width: 14% !important; }
.ticket-mode .inv-table td:nth-child(7) { width: 14% !important; }

/* Icon Only Button (Plain) */
.btn-icon { padding: 6px; border-radius: 4px; background: transparent; color: #64748b; border: 1px solid transparent; }
.btn-icon:hover { background: #f3f4f6; color: var(--text-main); border-color: #e5e7eb; }

#client-details-wrapper, #payment-wrapper { display: none; margin-top: 12px; padding-top: 12px; border-top: 1px dashed #cbd5e1; }
.status-msg { font-size: 10px; margin-top: 2px; height: 14px; display: block; }
.status-saved { color: #059669; } .status-exist { color: #d97706; }

.db-row { display: flex; gap: 0px; align-items: center; width: 100%; }
.db-row .input-box { flex: 1; }
.db-row .input-box input { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: 0; }
.db-row button { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 1px solid #bfdbfe; }

.item-grid-top { display: grid; grid-template-columns: 1fr 1fr 1.1fr; gap: 6px; margin-bottom: 6px; }
.item-grid-btm { display: grid; grid-template-columns: 0.8fr 1.5fr 1.1fr 1.1fr 0.9fr 1fr; gap: 6px; align-items: end; }
.item-grid-btm > div { display: flex; flex-direction: column; }
.item-grid-btm > div > label { min-height: 16px; line-height: 1.2; margin-bottom: 4px; }
.item-grid-btm > div > .input-box { flex: 1; }
.item-grid-btm > div > .input-box input { height: 32px; }

.addon-row-wrap { margin-top: 6px; padding-left: 12px; border-left: 2px solid #bae6fd; }
.addon-item { display: flex; gap: 6px; align-items: center; margin-bottom: 4px; background: #f0f9ff; padding: 4px; border-radius: 4px; width: 100%; }
.addon-item .addon-desc-wrapper { flex: 1; min-width: 0; } 
.addon-item .addon-num-wrapper { flex: 0 0 60px; } 
.addon-item .addon-num-wrapper.wide { flex: 0 0 80px; } 
.addon-item input { width: 100%; font-size: 11px; padding: 4px 6px; height: 28px; }
.addon-item .input-box { width: 100%; }
.addon-item input[type="number"] { padding-right: 4px; }
.addon-item .clear-x { right: 24px; }

/* --- Bill Style --- */
.meta-val, .inv-box-content, .inv-table td, .info-text, .trade-name, .legal-name, .tax-id-line { text-transform: uppercase; }
.inv-header { display: flex; justify-content: space-between; margin-bottom: 30px; border-bottom: 3px solid var(--primary); padding-bottom: 20px; align-items: flex-end; }
.inv-logo-text { font-size: 26px; font-weight: 800; color: var(--primary); display: flex; align-items: center; gap: 10px; }
.inv-addr { font-size: 12px; color: var(--text-sub); margin-top: 6px; line-height: 1.5; font-weight: 500; }
.inv-right { text-align: right; }
.inv-title { font-size: 36px; font-weight: 900; color: #e5e7eb; letter-spacing: 2px; line-height: 1; margin-bottom: 4px; }

/* 西班牙语模式下标题字体缩小 */
body[lang="es"] .inv-title { font-size: 28px; }
.inv-subtitle { font-size: 14px; color: var(--text-sub); letter-spacing: 2px; text-transform: uppercase; font-weight: 700; margin-bottom: 15px; }
.meta-horizontal { display: flex; gap: 24px; justify-content: flex-end; align-items: flex-end; }
.meta-group { text-align: right; }
.meta-label { font-size: 11px; color: var(--text-sub); font-weight: 600; text-transform: uppercase; margin-bottom: 2px; }
.meta-val { font-size: 14px; font-weight: 700; color: var(--text-main); }
.box-container { display: flex; gap: 24px; margin-bottom: 30px; }
.inv-box { flex: 1; border: 1px solid #e5e7eb; border-radius: 6px; padding: 16px; position: relative; background: #f9fafb; }
.inv-box.left { border-left: 5px solid var(--primary); }
.inv-box.right { border-left: 5px solid var(--accent); }
.box-label { font-size: 12px; font-weight: 700; color: var(--text-sub); margin-bottom: 10px; letter-spacing: 0.5px; }
.box-label .en-sub { font-size: 10px; font-weight: 400; opacity: 0.8; margin-left: 4px; text-transform: uppercase; }
.box-content { font-size: 12px; line-height: 1.6; color: var(--text-main); }
.trade-name { font-size: 14px; font-weight: 800; color: var(--primary); margin-bottom: 4px; }
.legal-name { font-size: 12px; color: var(--text-main); font-weight: 600; margin-bottom: 4px; }
.legal-name.is-sub { font-size: 11px; color: var(--text-sub); font-weight: 400; }
.tax-id-line { font-size: 11px; color: var(--text-main); margin-bottom: 6px; }
.label-main { color: var(--text-sub); font-size: 11px; margin-right: 2px; font-weight: 600; }
.label-sub { color: #9ca3af; font-size: 9px; margin-right: 6px; }

.inv-table { width: 100%; border-collapse: collapse; margin-bottom: 30px; table-layout: fixed; }
.inv-table th { background: var(--primary); color: white; padding: 12px 4px; font-size: 11px; text-align: right; font-weight: 700; overflow:hidden; }
.inv-table th:first-child { text-align: left; }
.inv-table th .th-sub { display: block; font-size: 8px; opacity: 0.7; font-weight: 400; text-transform: uppercase; margin-top: 2px; white-space:nowrap; }
.inv-table td { border-bottom: 1px solid #e5e7eb; padding: 10px 4px; font-size: 11px; vertical-align: top; line-height: 1.4; overflow-wrap: break-word; }
.inv-table .num { text-align: right; font-feature-settings: "tnum"; font-weight: 500; }
.inv-table tr:last-child td { border-bottom: 2px solid var(--primary); }
  
/* ADDON STYLE (Italic + Gray) */
.row-addon td { 
  border-bottom: 1px solid #f3f4f6; 
  background: #fcfcfc; 
  color: var(--text-sub);
  font-style: italic; 
}
.inv-table tr.row-addon td.addon-desc { padding-left: 55px; position: relative; }
.inv-table tr.row-addon td.addon-desc::before { content: "↳"; position: absolute; left: 12px; opacity: 0.5; font-family: sans-serif; font-style: normal; }
  
.text-red { color: var(--danger); }
.text-bold { font-weight: 700; color: #000; }
.comm-detail { font-size: 9px; color: #9ca3af; margin-top: 2px; line-height: 1; }

.inv-footer { display: flex; flex-direction: column; gap: 20px; margin-top: 10px; }
.footer-top { display: flex; gap: 40px; }
.footer-left { flex: 1; }
.footer-right {
  width: 100%;  /* 改为100%，让它自适应 */
  max-width: 400px;  /* 最大宽度 */
  display: flex;
  flex-direction: column;
}
.footer-bottom { 
  width: 100%; 
  display: none; /* 默认隐藏，由模式CSS控制 */
}
.info-block { margin-bottom: 20px; border-left: 3px solid #e5e7eb; padding-left: 12px; }
.info-block-full { 
  width: 100%; 
  margin-bottom: 16px; 
  border-left: 3px solid #e5e7eb; 
  padding-left: 12px; 
}
.info-title { font-size: 12px; font-weight: 700; color: var(--text-main); margin-bottom: 6px; }
.info-title .en-sub { font-size: 10px; font-weight: 400; color: var(--text-sub); margin-left: 4px; text-transform: uppercase; }
.info-text { font-size: 11px; line-height: 1.5; color: var(--text-main); white-space: pre-wrap; }

.total-row { 
  display: flex; 
  justify-content: space-between; 
  align-items: center;
  padding: 6px 0; 
  font-size: 12px; 
  color: var(--text-sub);
  gap: 10px;
}
.total-label { 
  font-weight: 600; 
  color: var(--text-sub);
}
.total-label span { 
  display: block; 
}
.total-label .en { 
  font-size: 10px; 
  opacity: 0.7; 
  font-weight: 400; 
  margin-top: 1px; 
}
.total-amount { 
  font-weight: 600; 
  color: var(--text-main); 
  text-align: right; 
  white-space: nowrap;
  margin-left: auto;  /* 自动推到右边 */
}
.total-row.gross { border-top: 1px solid #e5e7eb; margin-top: 8px; padding-top: 10px; color: var(--text-main); }
.total-row.gross .total-label { font-weight: 700; color: var(--text-main); font-size: 13px; }
.total-row.comm { color: var(--danger); font-weight: 500; }
.total-row.comm .total-label { color: var(--danger); }
.total-row.comm .total-amount { color: var(--danger); }
.net-box { 
  background: var(--primary); 
  color: white; 
  padding: 14px 16px; 
  border-radius: 6px; 
  margin-top: 16px; 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  width: 100%;  /* 确保占据整行 */
}
.net-title { font-size: 12px; font-weight: 700; text-transform: uppercase; }
.net-title .en { display: block; font-size: 10px; opacity: 0.8; text-transform: uppercase; font-weight: 400; margin-top: 2px; }
.net-val { font-size: 20px; font-weight: 800; letter-spacing: 0.5px; }

/* 报价模式总价框 */
.total-box {
  background: var(--primary);
  color: white;
  padding: 14px 16px;
  border-radius: 6px;
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.total-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
.total-title .en {
  display: block;
  font-size: 10px;
  opacity: 0.8;
  text-transform: uppercase;
  font-weight: 400;
  margin-top: 2px;
}
.total-value {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.5px;
}
.quote-only {
  display: none !important;
}

/* 票据模式总价框 */
.ticket-only {
  display: none !important;
}
.ticket-mode .ticket-only {
  display: flex !important;
}

/* 票据模式输入区默认隐藏 */
.ticket-inputs {
  display: none !important;
}
.ticket-mode .ticket-inputs {
  display: block !important;
}


/* 对比模式表单：只显示 compare-inputs，隐藏其他录入 */
.pane-form.compare-mode .form-group:not(.compare-inputs) { display: none !important; }
.pane-form.compare-mode .compare-inputs { display: block !important; }

/* 
 * 注意：对比模式的详细样式已迁移至 compare-mode.css
 * 包括：compare-grid, compare-box, compare-preview, calc-row, profit-* 等
 * 请勿在此文件中添加对比模式专属样式
 */

/* ========================================
   同步指示器
======================================== */
.sync-indicator { 
  display: flex; 
  align-items: center;
  flex-shrink: 0;
}

.dot { 
  width: 8px; 
  height: 8px; 
  border-radius: 50%; 
  display: inline-block;
  transition: all 0.3s ease;
}

.dot.connected { 
  background: #10b981; 
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.dot.connecting { 
  background: #f59e0b;
  animation: pulse 1.5s infinite;
}

.dot.offline { 
  background: #ef4444; 
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@media print {
  @page { size: A4; margin: 0; }
  html, body { width: 100%; height: 100%; margin: 0; padding: 0; background: white; }
  .pane-form, .toolbar { display: none !important; }
  .pane-preview { border: none; height: auto; display: block; background: white; position: relative; width: 100%; }
  .preview-scroll-area { padding: 0; margin: 0; background: white; overflow: visible; display: block; }
  .paper { width: 100% !important; max-width: none !important; height: auto !important; box-shadow: none !important; padding: 30px 40px !important; margin: 0 !important; transform: none !important; border: none !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .edit-indicator { display: none !important; }
}

/* ========================================
   列表按钮
======================================== */
.btn-list {
  background: #6366f1;
  color: white;
}

.btn-list:hover {
  background: #4f46e5;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.btn-list svg {
  stroke: white;
}

/* ========================================
   账单列表 Drawer
======================================== */
.drawer {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  visibility: hidden;
  opacity: 0;
  transition: visibility 0s 0.3s, opacity 0.3s;
}

.drawer.open {
  visibility: visible;
  opacity: 1;
  transition: visibility 0s, opacity 0.3s;
}

.drawer-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.drawer-content {
  position: absolute;
  top: 0;
  right: -400px;
  width: 400px;
  max-width: 90vw;
  height: 100%;
  background: white;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  transition: right 0.3s ease;
}

.drawer.open .drawer-content {
  right: 0;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
}

.drawer-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
}

.drawer-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drawer-close:hover {
  background: #e5e7eb;
}

.drawer-close svg {
  width: 18px;
  height: 18px;
  stroke: #6b7280;
  stroke-width: 2;
  fill: none;
}

.drawer-search {
  padding: 12px 20px;
  border-bottom: 1px solid #e5e7eb;
}

.drawer-search input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.drawer-search input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

/* 账单列表项 */
.bills-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bills-loading,
.bills-empty,
.bills-error {
  text-align: center;
  padding: 40px 20px;
  color: #9ca3af;
  font-size: 14px;
}

.bills-error {
  color: #ef4444;
}

.bill-item {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.bill-item:hover {
  background: #eff6ff;
  border-color: #6366f1;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
}

.bill-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.bill-no {
  font-weight: 700;
  color: #6366f1;
  font-size: 15px;
}

.bill-date {
  font-size: 12px;
  color: #9ca3af;
}

.bill-item-body {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.bill-customer {
  font-size: 14px;
  color: #374151;
  font-weight: 500;
}

.bill-amount {
  font-size: 14px;
  font-weight: 600;
  color: #059669;
}

.bill-item-footer {
  display: flex;
  gap: 8px;
  font-size: 12px;
  color: #9ca3af;
}

.bill-ship,
.bill-route {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

/* ========================================
   编辑状态指示器
======================================== */
.edit-indicator {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.edit-indicator-text {
  display: flex;
  align-items: center;
  gap: 4px;
}

.edit-indicator strong {
  font-weight: 700;
}

.btn-copy-new,
.btn-clear-edit,
.btn-delete-bill {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background 0.2s;
}

.btn-copy-new:hover,
.btn-clear-edit:hover {
  background: rgba(255, 255, 255, 0.3);
}

.btn-delete-bill {
  background: rgba(239, 68, 68, 0.3);
}

.btn-delete-bill:hover {
  background: rgba(239, 68, 68, 0.5);
}

.btn-copy-new svg,
.btn-clear-edit svg,
.btn-delete-bill svg {
  width: 14px;
  height: 14px;
  stroke: white;
  stroke-width: 2;
  fill: none;
}

/* ========================================
   客户搜索区域
======================================== */
.customer-search-bar {
  position: relative;
  margin-bottom: 10px;
}

.customer-search-input-wrap {
  display: flex;
  align-items: center;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0 12px;
  transition: all 0.2s;
}

.customer-search-input-wrap:focus-within {
  border-color: #6366f1;
  background: white;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.customer-search-input-wrap .search-icon {
  width: 18px;
  height: 18px;
  stroke: #9ca3af;
  stroke-width: 2;
  fill: none;
  flex-shrink: 0;
}

.customer-search-input-wrap input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 8px;
  font-size: 14px;
  outline: none;
}

.customer-search-input-wrap .clear-x {
  opacity: 0;
  transition: opacity 0.2s;
}

.customer-search-input-wrap:focus-within .clear-x,
.customer-search-input-wrap input:not(:placeholder-shown) + .clear-x {
  opacity: 1;
}

/* 客户下拉列表 */
.customer-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  max-height: 280px;
  overflow-y: auto;
  z-index: 100;
  margin-top: 4px;
}

.customer-dropdown-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.15s;
}

.customer-dropdown-item:last-child {
  border-bottom: none;
}

.customer-dropdown-item:hover {
  background: #f0f9ff;
}

.customer-dropdown-item .item-icon {
  font-size: 16px;
  margin-right: 10px;
}

.customer-dropdown-item .item-info {
  flex: 1;
}

.customer-dropdown-item .item-name {
  font-weight: 500;
  color: #1f2937;
  font-size: 14px;
}

.customer-dropdown-item .item-contact {
  font-size: 12px;
  color: #6b7280;
  margin-top: 2px;
}

.customer-dropdown-empty {
  padding: 20px;
  text-align: center;
  color: #9ca3af;
  font-size: 13px;
}

/* 操作按钮组 */
.customer-action-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.btn-customer-action {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: white;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-customer-action svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.btn-customer-action.btn-new {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #2563eb;
}

.btn-customer-action.btn-new:hover {
  background: #dbeafe;
}

.btn-customer-action.btn-edit {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #16a34a;
}

.btn-customer-action.btn-edit:hover {
  background: #dcfce7;
}

.btn-customer-action.btn-delete {
  background: #fef2f2;
  border-color: #fecaca;
  color: #dc2626;
}

.btn-customer-action.btn-delete:hover {
  background: #fee2e2;
}

/* 选中客户徽章 */
.selected-customer-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  margin-bottom: 12px;
}

.selected-customer-badge .badge-icon {
  font-size: 18px;
}

.selected-customer-badge .badge-name {
  flex: 1;
  font-weight: 600;
  color: #1f2937;
  font-size: 14px;
}

.selected-customer-badge .badge-type {
  font-size: 11px;
  padding: 2px 8px;
  background: white;
  border-radius: 10px;
  color: #6b7280;
}

.selected-customer-badge .badge-clear {
  width: 20px;
  height: 20px;
  border: none;
  background: rgba(0,0,0,0.1);
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
}

.selected-customer-badge .badge-clear:hover {
  background: rgba(0,0,0,0.2);
}

.group-btn.btn-danger {
  border-left: 1px solid #fee2e2;
  background-color: #fef2f2;
  color: #dc2626;
}

.group-btn.btn-danger:hover {
  background-color: #fee2e2;
}

.group-btn.btn-small {
  padding: 6px 10px;
}

/* 客户类型选择器 */
.customer-type-selector {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.customer-type-selector .type-option {
  flex: 1;
  cursor: pointer;
}

.customer-type-selector .type-option input {
  display: none;
}

.customer-type-selector .type-label {
  display: block;
  text-align: center;
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  transition: all 0.2s;
  background: #f9fafb;
}

.customer-type-selector .type-option input:checked + .type-label {
  background: #eff6ff;
  border-color: #6366f1;
  color: #4f46e5;
  font-weight: 500;
}

.customer-type-selector .type-label:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

/* 重复客户提醒 */
.duplicate-warning {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}

.duplicate-warning-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #92400e;
  margin-bottom: 8px;
}

.duplicate-warning-header svg {
  width: 18px;
  height: 18px;
  stroke: #f59e0b;
  stroke-width: 2;
  fill: none;
}

.duplicate-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.duplicate-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: white;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}

.duplicate-item:hover {
  background: #fef9c3;
}

.duplicate-item.exact-match {
  border: 1px solid #ef4444;
  background: #fef2f2;
}

.duplicate-item.exact-match:hover {
  background: #fee2e2;
}

.duplicate-item-name {
  font-weight: 500;
  color: #1f2937;
}

.duplicate-item-contact {
  font-size: 12px;
  color: #6b7280;
}

.duplicate-item-badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #ef4444;
  color: white;
}

/* 开票信息区域 */
.invoice-info-section {
  margin-top: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}

.invoice-info-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #f9fafb;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s;
}

.invoice-info-toggle:hover {
  background: #f3f4f6;
}

.toggle-icon {
  font-size: 10px;
  transition: transform 0.2s;
}

.toggle-icon.expanded {
  transform: rotate(90deg);
}

.toggle-hint {
  color: #9ca3af;
  font-size: 12px;
}

.invoice-info-content {
  padding: 12px;
  border-top: 1px solid #e5e7eb;
}

/* Checkbox 样式 */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: #4b5563;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}