/* ============================================================
   Quote System · 商务浅色 (Business Light · Blue Grid)
   ------------------------------------------------------------
   - 背景: 浅蓝底 #eef4fb + 淡蓝细网格, 干净有层次
   - 卡片: 纯白 + 1px 浅灰描边 + 极轻投影
   - 主色: 商务蓝 #2563eb (按钮 / 焦点 / 链接)
   - 文本: 深蓝黑 #1f2937 (主) / #64748b (副)
   - 字体: 界面用无衬线 (Noto Sans SC), 数字等宽
   ============================================================ */
:root {
  /* 背景 */
  --bg:             #eef4fb;
  --bg-card:        #ffffff;
  --bg-card-2:      #f7fafd;
  --bg-hover:       #f1f6fc;

  /* 墨色 */
  --ink:            #1f2937;
  --ink-2:          #4b5a6e;
  --ink-3:          #8494a8;
  --ink-on-dark:    #ffffff;

  /* 线条 */
  --line:           #dbe5f0;
  --line-2:         #e8eef6;
  --line-3:         #f2f6fb;

  /* 主色 - 商务蓝 */
  --accent:         #2563eb;
  --accent-deep:    #1d4fc0;
  --accent-soft:    #e3edfb;
  --accent-tint:    #eef4fe;

  /* 表头 */
  --steel:          #2563eb;
  --steel-deep:     #1e3a5f;
  --steel-soft:     #edf2f8;

  /* 状态 */
  --good:           #16a34a;
  --warn:           #d97706;
  --bad:            #dc2626;

  /* 字体 */
  --serif-en: 'Fraunces', 'Times New Roman', serif;
  --serif-cn: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --mono:    'JetBrains Mono', 'IBM Plex Mono', Consolas, monospace;
  --sans:    'Noto Sans SC', system-ui, -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .04);
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}
body {
  /* 浅蓝渐变底 + 淡蓝网格 (对比柔和, 仅在留白处可见) */
  background:
    radial-gradient(ellipse 90% 60% at 50% -8%, #ffffff 0%, rgba(255,255,255,0) 60%),
    linear-gradient(180deg, #f2f7fd 0%, #e9f1fa 55%, #e3edf8 100%);
  background-attachment: fixed;
}
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    linear-gradient(rgba(37, 99, 235, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 99, 235, .045) 1px, transparent 1px);
  background-size: 30px 30px;
  pointer-events: none;
  z-index: 0;
  mask-image: radial-gradient(ellipse 110% 85% at 50% 40%, rgba(0,0,0,.85) 0%, transparent 92%);
  -webkit-mask-image: radial-gradient(ellipse 110% 85% at 50% 40%, rgba(0,0,0,.85) 0%, transparent 92%);
}
.topbar, .page, .toast-zone, .login-bg { position: relative; z-index: 1; }

body:not(.logged-in) .topbar,
body:not(.logged-in) .page,
body:not(.logged-in) .toast-zone { display: none; }

.mono    { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.serif-en{ font-family: var(--serif-en); font-feature-settings: "ss01","ss02"; }
.serif-cn{ font-family: var(--serif-cn); }
.sans    { font-family: var(--sans); }

/* ====== 通用控件 ====== */
input[type="text"], input[type="password"], input[type="number"],
input[type="date"], select, textarea {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid #d6dde7;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: #a8b4c4; }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
input[readonly] { background: var(--bg-card-2); color: var(--ink-2); }
input[type="checkbox"] {
  width: 15px; height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}
select { cursor: pointer; }

/* ====== 按钮 ====== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid #d6dde7;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, color .15s;
}
.btn:hover { background: var(--bg-hover); border-color: #c3cddb; }
.btn:active { background: #e8edf4; }
.btn.primary, .btn.accent-solid {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.primary:hover, .btn.accent-solid:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-2);
}
.btn.ghost:hover { background: var(--bg-hover); border-color: transparent; color: var(--ink); }
.btn.danger {
  background: #fff;
  border-color: #f3c1c1;
  color: var(--bad);
}
.btn.danger:hover { background: #fdf2f2; border-color: var(--bad); }
.btn.icon { width: 30px; height: 30px; padding: 0; }
.btn .k {
  font-family: var(--mono);
  font-size: 10px;
  opacity: .75;
  border: 1px solid rgba(255,255,255,.45);
  border-radius: 4px;
  padding: 0 4px;
}

/* ====== TOP NAV ====== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: 52px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center;
  padding: 0 20px;
  gap: 22px;
}
.brand { display: flex; align-items: center; gap: 9px; }
.brand .mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: .5px;
}
.brand .cn { font-size: 16px; font-weight: 700; color: var(--ink); }
.brand .en { font-size: 11px; color: var(--ink-3); letter-spacing: .4px; margin-top: 3px; }
.topbar nav { display: flex; gap: 4px; }
.tab {
  padding: 6px 14px;
  border-radius: 7px;
  font-size: 13.5px;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
  transition: background .15s, color .15s;
}
.tab:hover { background: var(--bg-hover); color: var(--ink); }
.tab.active { background: var(--accent-soft); color: var(--accent-deep); font-weight: 600; }
.topbar .actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.server-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--ink-3);
}
.server-status .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, .15);
}
.server-status .dot.bad { background: var(--bad); box-shadow: 0 0 0 3px rgba(220, 38, 38, .15); }
.user-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 12.5px; color: var(--ink-2);
  cursor: pointer;
}
.user-chip:hover { border-color: #c3cddb; }
.user-chip .av {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-deep);
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ====== LOGIN ====== */
.login-bg {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.login-bg.hide { display: none; }
.login-card {
  width: 400px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 4px 24px rgba(15, 23, 42, .08);
  overflow: hidden;
}
.login-head {
  text-align: center;
  padding: 30px 0 22px;
  border-bottom: 1px solid var(--line-2);
}
.login-head .logo {
  width: 52px; height: 52px;
  margin: 0 auto 12px;
  border-radius: 13px;
  background: var(--accent);
  color: #fff;
  font-size: 19px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  content: "QB";
}
.login-head .logo::after { content: "QB"; }
.login-head .cn { font-size: 21px; font-weight: 700; color: var(--ink); }
.login-head .en { font-size: 12px; color: var(--ink-3); margin-top: 4px; letter-spacing: .4px; }
.login-form { padding: 24px 30px 8px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.login-form label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12.5px; color: var(--ink-2); margin-bottom: 6px;
}
.login-form .en { font-size: 11px; color: var(--ink-3); font-style: italic; }
.login-btn { grid-column: 1 / -1; width: auto; align-self: stretch; justify-self: stretch; display: flex; height: 40px; font-size: 14px; margin-top: 4px; align-items: center; justify-content: center; text-align: center; }
.login-hint {
  text-align: center;
  font-size: 12px; color: var(--ink-3);
  padding: 6px 0 18px;
}
.login-hint:empty { display: none; }
.login-hint code, code {
  font-family: var(--mono);
  font-size: 11.5px;
  background: var(--bg-card-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--ink-2);
}
.login-foot {
  background: var(--bg-card-2);
  border-top: 1px solid var(--line-2);
  text-align: center;
  font-size: 11.5px; color: var(--ink-3);
  padding: 10px;
}
.req { color: var(--bad); margin-left: 2px; }

/* ====== PAGE LAYOUT ====== */
.page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 14px;
  padding: 16px 20px 40px;
  max-width: 1560px;
  margin: 0 auto;
}
.page .main {
  display: flex; flex-direction: column; gap: 14px;
  min-width: 0;
}
.page .side {
  display: flex; flex-direction: column; gap: 14px;
  min-width: 0;
}

/* ====== SECTION CARDS ====== */
.section, .side-card, .total-block {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.section-head {
  display: flex; align-items: baseline; gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line-2);
}
.section-head .cn { font-size: 14.5px; font-weight: 700; color: var(--ink); }
.section-head .en { font-size: 11.5px; color: var(--ink-3); letter-spacing: .3px; }
.section-head .hint { margin-left: auto; font-size: 11.5px; color: var(--ink-3); }
.section-body { padding: 16px 18px; }

/* ====== FORM GRID ====== */
.field-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 12px 14px; }
.field { display: flex; flex-direction: column; min-width: 0; }
.field label {
  font-size: 12.5px;
  color: var(--ink-2);
  margin-bottom: 5px;
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
}
.field label .en { font-size: 10.5px; color: var(--ink-3); font-style: italic; }
/* col-* 仅在 .field-grid 网格内生效, 避免渗透到登录表单等其它 grid 容器 */
.field-grid .col-3 { grid-column: span 3; }
.field-grid .col-4 { grid-column: span 4; }
.field-grid .col-6 { grid-column: span 6; }
.field-grid .col-8 { grid-column: span 8; }
.field-grid .col-9 { grid-column: span 9; }
.field-grid .col-12 { grid-column: span 12; }

/* ====== TOTALS (淡红色底, 突出金额区) ====== */
.total-block {
  padding: 4px 18px;
  background: linear-gradient(180deg, #fff7f6 0%, #fdeeed 100%);
  border-color: #f5d9d6;
}
.total-line {
  display: grid;
  grid-template-columns: 130px 200px 1fr;
  align-items: center; gap: 14px;
  padding: 11px 0;
}
.total-line + .total-line { border-top: 1px dashed var(--line-2); }
.total-line .lbl { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.total-line .num { font-size: 21px; font-weight: 700; color: var(--ink); letter-spacing: .3px; }
.total-line .cn { font-size: 12.5px; color: var(--ink-2); }
.total-line .cn .en { font-size: 10.5px; color: var(--ink-3); font-style: italic; margin-right: 8px; }

/* ====== NOTICE ====== */
.notice-list { display: grid; gap: 8px; }

/* ====== META 单行紧凑条 (报价日期与项目) ====== */
.meta-bar {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr .7fr .7fr .8fr;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 14px;
}
.meta-bar .mi { display: flex; flex-direction: column; min-width: 0; }
.meta-bar .mi label {
  font-size: 11px; color: var(--ink-3);
  margin-bottom: 3px;
  white-space: nowrap;
  display: flex; justify-content: space-between; align-items: baseline;
}
.meta-bar .mi label .en { font-size: 9.5px; font-style: italic; }
.meta-bar .mi input {
  height: 30px; font-size: 12.5px; padding: 0 8px;
}
.notice-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--bg-card-2);
  color: var(--ink-3);
  font-size: 13px;
  transition: border-color .15s, background .15s, color .15s;
}
.notice-row.active { background: #fff; border-color: var(--line); color: var(--ink); }
.notice-row .check { padding-top: 2px; }
.notice-row .body { line-height: 1.9; }
.notice-row .fill input, .notice-row .fill select {
  display: inline-block;
  width: auto;
  min-width: 60px;
  height: 28px;
  margin: 0 3px;
  border: none;
  border-bottom: 1px dashed var(--accent);
  border-radius: 4px 4px 0 0;
  background: var(--accent-tint);
  color: var(--accent-deep);
  font-weight: 600;
  text-align: center;
}
.notice-row .fill input.days { width: 64px; }
.notice-row .fill input.date { width: 140px; }
.notice-row .fill input.long { width: 220px; text-align: left; }
.notice-row:not(.active) .fill input,
.notice-row:not(.active) .fill select {
  border-bottom-color: var(--line);
  background: var(--line-3);
  color: var(--ink-3);
  font-weight: 400;
}

/* ====== 甲方与乙方 (左右各半, 虚线分隔) ====== */
.party-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.party {
  padding: 14px 18px;
  display: flex; flex-direction: column; gap: 12px;
}
.party-buyer {
  background: var(--bg-card-2);
  border-radius: 8px 0 0 8px;
}
.party-supplier {
  background: var(--accent-tint);
  border-left: 1px dashed #b9c8dd;
  border-radius: 0 8px 8px 0;
}
.party-head {
  font-size: 13px; font-weight: 700; color: var(--ink);
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--line);
}
.party-head .en { font-size: 10.5px; color: var(--ink-3); font-weight: 400; font-style: italic; margin-left: 6px; }
.party .field label { margin-bottom: 4px; }
.party-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}

/* ====== SIDE CARDS ====== */
.side-card-head {
  display: flex; align-items: center;
  padding: 11px 15px;
  border-bottom: 1px solid var(--line-2);
  font-size: 13.5px; font-weight: 700; color: var(--ink);
}
.side-card-body { padding: 13px 15px; }
.summary-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 4px 0;
  font-size: 12.5px;
}
.summary-row .l { color: var(--ink-3); }
.summary-row .v { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.summary-row .v.big { font-size: 15px; color: var(--accent-deep); }

/* ====== TIMELINE ====== */
.timeline {
  max-height: 300px;
  overflow-y: auto;
  display: grid; gap: 0;
}
.timeline .empty, .empty {
  color: var(--ink-3);
  font-size: 12.5px;
  text-align: center;
  padding: 18px 6px;
}
.timeline-item {
  position: relative;
  padding: 7px 0 7px 16px;
  border-left: 2px solid var(--line);
  margin-left: 4px;
}
.timeline-item::before {
  content: '';
  position: absolute; left: -5px; top: 13px;
  width: 8px; height: 8px; border-radius: 50%;
  background: #fff;
  border: 2px solid var(--ink-3);
}
.timeline-item.is-exported::before { border-color: var(--good); }
.timeline-item.is-exported .what { color: var(--good); }
.timeline-item .t { font-size: 10.5px; color: var(--ink-3); }
.timeline-item .t .who { margin-left: 5px; }
.timeline-item .what { font-size: 12.5px; color: var(--ink-2); }

/* ====== ITEMS TABLE (列序与 xlsx 模板一致: 序号/编码/基本规格/单位/数量/未税单价/税率/税额/含税单价/含税总价/备注) ====== */
/* 明细清单位于 main 列内, 页面顺序与模板一致: 报价信息 → 明细 → 总计 → 须知 → 甲乙方 */
/* 明细清单: 淡绿色背景 (客户要求) */
.items-wrap.full-width {
  grid-column: auto;
  background: linear-gradient(180deg, #f4faf5 0%, #ecf7ee 100%);
  border-color: #d8ead9;
}
.items-head, .items-body .row, .items-foot {
  display: grid;
  grid-template-columns:
    40px 92px minmax(140px, 1.4fr) 44px 70px 80px 62px 72px 78px 90px minmax(60px, .65fr) 28px;
  gap: 0;
  align-items: center;
  padding: 0 10px 0 26px;  /* 整体右移 */
}
/* 列网格分隔线: 每列右缘浅色竖线 (最后一列删除按钮除外) */
.items-head > div, .items-body .row > .cell, .items-foot > div {
  border-right: 1px solid var(--line-2);
  height: 100%;
  display: flex; align-items: center;
}
.items-head > div { flex-direction: column; justify-content: center; }
.items-body .row > .cell, .items-foot > div { padding: 0 4px; }
.items-head > div:nth-last-child(-n+2),
.items-body .row > .cell:nth-last-child(-n+2),
.items-foot > div:nth-last-child(-n+2) { border-right: none; }
.items-head {
  padding-top: 8px; padding-bottom: 8px;
  background: #e2f1e4;
  border-bottom: 1px solid #d3e6d5;
  border-radius: var(--radius) var(--radius) 0 0;
}
.items-head > div {
  display: flex; flex-direction: column; align-items: center; line-height: 1.25;
  white-space: nowrap;
}
.items-head .cn { font-size: 11.5px; font-weight: 600; color: var(--ink-2); }
.items-head .en { font-size: 9.5px; color: var(--ink-3); white-space: nowrap; }
.items-body { display: block; padding: 4px 0; }
.items-body .row {
  padding-top: 2px; padding-bottom: 2px;
  border-radius: 8px;
}
.items-body .row + .row { border-top: 1px solid var(--line-3); }
.items-body .row:hover { background: rgba(255,255,255,.75); }
.items-body .cell { min-width: 0; }
.items-body .cell.no {
  text-align: center;
  color: var(--ink-3);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
/* number 输入框去 spinner, 省空间 */
.items-body .cell input[type="number"]::-webkit-outer-spin-button,
.items-body .cell input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none; margin: 0;
}
.items-body .cell input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

/* 单元格输入框: 小字 + 单行不换行 (过长自动缩字号, 由 JS shrink 处理) */
.items-body .cell input, .items-body .cell select {
  height: 28px;
  font-size: 12px;
  padding: 0 4px;
  border-color: transparent;
  background: transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}
.items-body .cell input:hover { border-color: #d6dde7; background: #fff; }
.items-body .cell input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}
.items-body .cell select { cursor: pointer; }
.items-body .cell.is-locked { background: transparent; }
.items-body .money { text-align: right; }
.items-body .tax-rate { text-align: center; }
.items-body .cell input[data-k="remark"] { font-size: 11px; }
.items-body .locked-val {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  text-align: right;
  padding: 0 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex; align-items: center; justify-content: flex-end;
  width: 100%; height: 28px;
}
.row-del {
  width: 26px; height: 26px;
  border: none; border-radius: 6px;
  background: transparent;
  color: var(--ink-3);
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.row-del:hover { background: #fdf2f2; color: var(--bad); }
.items-foot {
  padding-top: 8px; padding-bottom: 8px;
  border-top: 1px solid #d3e6d5;
  background: #e2f1e4;
  border-radius: 0 0 var(--radius) var(--radius);
  font-size: 12px;
  white-space: nowrap;
}
.items-foot .tot-qty { text-align: right; color: var(--ink); font-weight: 600; }
.items-foot .tot-net-label { text-align: center; color: var(--ink-2); }
.items-foot .tot-net-value { text-align: right; color: var(--accent-deep); font-weight: 700; font-size: 13.5px; }
.add-row-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--line-2);
}
.add-row-bar .grow { flex: 1; }
.add-row-bar .info { font-size: 11.5px; color: var(--ink-3); }
.kbd {
  font-family: var(--mono);
  font-size: 10.5px;
  background: var(--bg-card-2);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 5px;
  color: var(--ink-2);
}

/* ====== TOAST / SPINNER ====== */
.toast-zone {
  position: fixed; right: 18px; top: 62px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  min-width: 220px; max-width: 380px;
  background: #243041;
  color: #fff;
  font-size: 13px;
  border-radius: 9px;
  padding: 10px 14px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, .25);
  opacity: 1;
  transition: opacity .25s, transform .25s;
  border-left: 3px solid var(--ink-3);
}
.toast.good { border-left-color: var(--good); }
.toast.warn { border-left-color: var(--warn); }
.toast.bad  { border-left-color: var(--bad); }
.spinner-zone {
  position: fixed; inset: 0; z-index: 300;
  display: none;
  align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .45);
  backdrop-filter: blur(1.5px);
}
.spinner-zone.on { display: flex; }
.spin {
  width: 34px; height: 34px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: qspin .8s linear infinite;
}
@keyframes qspin { to { transform: rotate(360deg); } }

/* ====== MODAL ====== */
.modal-bg {
  position: fixed; inset: 0; z-index: 100;
  display: none;
  align-items: flex-start; justify-content: center;
  background: rgba(24, 33, 48, .42);
  padding: 60px 20px 30px;
  overflow-y: auto;
}
.modal-bg.open { display: flex; }
.modal {
  width: 640px; max-width: 96vw;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, .22);
  overflow: hidden;
}
.modal-head {
  display: flex; align-items: baseline; gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line-2);
}
.modal-head .cn { font-size: 15px; font-weight: 700; color: var(--ink); }
.modal-head .en { font-size: 11.5px; color: var(--ink-3); }
.modal-head .x { margin-left: auto; align-self: center; }
.modal-body { padding: 18px 20px; max-height: 68vh; overflow-y: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--line-2);
  background: var(--bg-card-2);
}

/* ====== HISTORY / COMPANY CARDS ====== */
.history-card {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  margin-bottom: 8px;
  transition: border-color .15s, box-shadow .15s;
}
.history-card:hover { border-color: #c9d5e4; box-shadow: var(--shadow); }
.history-card .info { flex: 1; min-width: 0; }
.history-card > div:not(.info) { flex-shrink: 0; }
.history-card .title {
  font-size: 13px; font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.history-card .meta { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.history-card .amt {
  font-family: var(--mono);
  font-size: 14.5px; font-weight: 700; color: var(--accent-deep);
  text-align: right; white-space: nowrap;
}
.history-card .ops { display: flex; gap: 6px; align-items: center; flex-basis: 100%; }

/* ====== 历史存档报表页 ====== */
.archive-toolbar {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 14px;
}
.archive-toolbar input, .archive-toolbar select { height: 32px; font-size: 12.5px; }
.archive-toolbar #ar-q { flex: 0 1 260px; }
.archive-toolbar #ar-from, .archive-toolbar #ar-to { width: 140px; }
.archive-toolbar .sep { color: var(--ink-3); font-size: 12px; }
.archive-toolbar .grow { flex: 1; }
.archive-toolbar .ar-count { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.archive-report {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.ar-table-head, .ar-row {
  display: grid;
  grid-template-columns: 130px 92px 150px minmax(0,1fr) 52px 110px 120px 218px;
  gap: 8px; align-items: center;
  padding: 0 14px;
}
.ar-table-head {
  padding-top: 9px; padding-bottom: 9px;
  background: var(--bg-card-2);
  border-bottom: 1px solid var(--line);
  font-size: 12px; font-weight: 600; color: var(--ink-2);
}
.ar-row { padding-top: 7px; padding-bottom: 7px; border-bottom: 1px solid var(--line-3); }
.ar-row:hover { background: var(--bg-card-2); }
.ar-row .ar-time { font-size: 11.5px; color: var(--ink-2); white-space: nowrap; }
.ar-row .ar-no { font-weight: 600; color: var(--ink); font-size: 12.5px; }
.ar-row .ar-parties {
  font-size: 12px; color: var(--ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ar-row .num { text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--ink); }
.ar-row .num.strong { font-weight: 700; color: var(--accent-deep); }
.ar-row .ar-ops { display: flex; gap: 5px; justify-content: flex-end; }
.ar-row .ar-ops .btn { height: 26px; padding: 0 10px; font-size: 11.5px; }
.ar-detail {
  grid-column: 1 / -1;
  background: var(--bg-card-2);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 4px 0 8px;
}
.ar-d-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12px; color: var(--ink-2); margin-bottom: 8px; }
.ar-d-meta b { color: var(--ink); font-weight: 600; }
.ar-d-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.ar-d-table th, .ar-d-table td {
  border: 1px solid var(--line-2);
  padding: 4px 8px; text-align: left; white-space: nowrap;
}
.ar-d-table th { background: var(--bg-card-2); color: var(--ink-2); font-weight: 600; }
.ar-d-table td.num, .ar-d-table th.num { text-align: right; }

/* ====== 历史存档(旧卡片样式, 弹窗内不再使用) ====== */
.archive-card {
  display: grid;
  grid-template-columns: auto 1fr 150px auto;
  gap: 12px; align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  margin-bottom: 8px;
}
.archive-card:hover { border-color: #c9d5e4; box-shadow: var(--shadow); }
.archive-card .info { min-width: 0; }
.archive-card .title {
  font-size: 13px; font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.archive-card .meta { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.archive-card .amt {
  font-family: var(--mono);
  font-size: 14px; font-weight: 700; color: var(--accent-deep); white-space: nowrap;
}
.archive-card .ops { display: flex; gap: 6px; }
.act-badge { white-space: nowrap; font-weight: 600; }
.act-badge.save { background: #64748b; }
.act-badge.pdf { background: var(--accent); }
.act-badge.stamped { background: var(--bad); }
.act-badge.scanned { background: var(--warn); }
.act-badge.xlsx { background: var(--good); }

/* ====== IMPORT TEMPLATE MODAL ====== */
.template-drop {
  border: 2px dashed #c9d5e4;
  border-radius: 10px;
  background: var(--bg-card-2);
  text-align: center;
  padding: 44px 20px;
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.template-drop:hover, .template-drop.drag {
  border-color: var(--accent);
  background: var(--accent-tint);
}
.template-drop .big { font-size: 14px; font-weight: 600; color: var(--ink); }
.template-drop .sub { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.preview-card {
  border: 1px solid var(--line);
  border-radius: 9px;
  margin-bottom: 12px;
  overflow: hidden;
}
.preview-card .head {
  display: flex; align-items: center;
  padding: 9px 14px;
  background: var(--bg-card-2);
  border-bottom: 1px solid var(--line-2);
  font-size: 13px; font-weight: 600; color: var(--ink);
}
.preview-grid { padding: 10px 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; }
.preview-grid .row {
  display: grid; grid-template-columns: 92px 1fr; gap: 10px;
  font-size: 12.5px;
  padding: 3px 0;
  border-bottom: 1px dashed var(--line-3);
}
.preview-grid .row .k { color: var(--ink-3); }
.preview-grid .row .v { color: var(--ink); word-break: break-all; }
.preview-grid .row.empty-v .v { color: var(--ink-3); font-style: italic; }
.items-preview { padding: 6px 14px; }
.item-row {
  display: grid;
  grid-template-columns: 34px 1fr 110px 90px 50px;
  gap: 10px; align-items: center;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line-3);
  font-size: 12.5px;
}
.item-row .no { color: var(--ink-3); }
.item-row .desc { color: var(--ink); min-width: 0; }
.item-row .num { text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.item-row.missing-net .num { color: var(--warn); }
.preview-summary {
  display: flex; align-items: center; gap: 14px;
  padding: 9px 14px;
  background: var(--bg-card-2);
  border-top: 1px solid var(--line-2);
  font-size: 12px; color: var(--ink-2);
}
.preview-summary .grow { flex: 1; }
.badge {
  display: inline-block;
  font-size: 11px;
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--good);
  color: #fff;
}
.badge.partial { background: var(--warn); }
.badge.empty { background: #94a3b8; }
.muted { color: var(--ink-3); }

/* 滚动条 */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 5px; border: 2px solid #fff; }
::-webkit-scrollbar-track { background: transparent; }
