:root {
  --bg: #f4f2ee;
  --surface: #fffefb;
  --surface-2: #faf8f4;
  --surface-3: #f1eee7;
  --line: #e6e2da;
  --line-strong: #d5cfc3;
  --ink: #242320;
  --ink-2: #4e4a44;
  --muted: #8b857a;
  --faint: #b4aea3;
  --accent: #2d2b28;
  --accent-ink: #fbfaf7;
  --ok: #5f7a5c;
  --ok-bg: #eef2ec;
  --warn: #9a7338;
  --warn-bg: #f6f0e4;
  --bad: #96544b;
  --bad-bg: #f6ecea;
  --info: #5a6b78;
  --info-bg: #edf1f3;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(35, 34, 32, .04), 0 10px 30px rgba(35, 34, 32, .07);
  --fs-12: 12px;
  --fs-13: 13px;
  --fs-14: 14px;
  --fs-16: 16px;
  --fs-20: 20px;
  --fs-26: 26px;
  --sidebar-w: 220px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
  font-size: var(--fs-14);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; opacity: .5; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }

::selection { background: #e4ded1; }

:focus-visible { outline: 2px solid #b9a884; outline-offset: 2px; }

/* ---------- 布局 ---------- */
.app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 22px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand-mark {
  width: 20px; height: 20px; border-radius: 6px; flex: 0 0 20px;
  background: var(--accent);
  position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 5px; border-radius: 2px;
  border: 1.5px solid var(--accent-ink); border-right-color: transparent;
}
.brand-mark.large { width: 30px; height: 30px; flex-basis: 30px; border-radius: 9px; }
.brand-mark.large::after { inset: 8px; border-radius: 3px; }
.brand-text { font-size: var(--fs-16); font-weight: 600; letter-spacing: .02em; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { margin-top: 14px; display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  font-size: var(--fs-12); color: var(--faint); padding: 6px 10px 4px;
  letter-spacing: .08em;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--ink-2); font-size: var(--fs-14); text-align: left;
  transition: background .16s ease-out, color .16s ease-out;
}
.nav-item svg { width: 17px; height: 17px; color: var(--muted); }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--surface-3); color: var(--ink); font-weight: 500; }
.nav-item.active svg { color: var(--ink); }

.sidebar-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; display: flex; align-items: center; gap: 8px; }
.user-chip { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: 0 0 28px;
  background: var(--surface-3); color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--fs-12); font-weight: 600; text-transform: uppercase;
}
.user-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.user-name { font-size: var(--fs-13); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: var(--fs-12); color: var(--muted); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 56px; flex: 0 0 56px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 254, 251, .82);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
}
.topbar-left { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.page-title { font-size: var(--fs-16); font-weight: 600; }
.topbar-sub { font-size: var(--fs-12); color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.conn-hint { font-size: var(--fs-12); color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.conn-hint::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }

.content { flex: 1; overflow: auto; padding: 22px 24px 40px; }
.page { max-width: 1560px; margin: 0 auto; }

/* ---------- 通用控件 ---------- */
.primary-btn, .ghost-btn, .danger-btn, .text-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  font-size: var(--fs-13); white-space: nowrap;
  transition: background .16s ease-out, border-color .16s ease-out, transform .16s ease-out;
}
.primary-btn { background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); }
.primary-btn:hover { background: #1c1b19; }
.primary-btn:active { transform: scale(.985); }
.ghost-btn { border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); }
.ghost-btn:hover { background: var(--surface-2); border-color: var(--faint); }
.danger-btn { background: var(--bad); border: 1px solid var(--bad); color: #fff; }
.danger-btn:hover { background: #83443c; }
.text-btn { height: auto; padding: 0; color: var(--ink-2); font-size: var(--fs-13); border-radius: 4px; }
.text-btn:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.text-btn.danger { color: var(--bad); }
.small { height: 30px; padding: 0 10px; font-size: var(--fs-12); }
.block { width: 100%; }
.icon-btn {
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center; color: var(--muted);
  transition: background .16s ease-out;
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }

.input, .textarea {
  width: 100%; height: 38px; padding: 0 11px;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); font-size: var(--fs-14); color: var(--ink);
  transition: border-color .16s ease-out, box-shadow .16s ease-out;
}
.textarea { height: auto; min-height: 82px; padding: 9px 11px; resize: vertical; line-height: 1.6; }
.input:hover, .textarea:hover { border-color: var(--faint); }
.input:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(45, 43, 40, .08); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input.invalid, .textarea.invalid { border-color: var(--bad); box-shadow: 0 0 0 3px rgba(150, 84, 75, .1); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: var(--fs-12); color: var(--muted); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.field-hint { font-size: var(--fs-12); color: var(--bad); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

.switch { display: inline-flex; align-items: center; gap: 9px; height: 38px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
  width: 38px; height: 22px; border-radius: 999px; background: var(--surface-3);
  border: 1px solid var(--line-strong); position: relative;
  transition: background .16s ease-out, border-color .16s ease-out;
}
.switch-thumb {
  position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .14);
  transition: transform .16s ease-out;
}
.switch input:checked + .switch-track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(16px); }
.switch-text { font-size: var(--fs-13); color: var(--ink-2); }

/* ---------- 自定义下拉 ---------- */
.select { position: relative; width: 100%; }
.select-trigger {
  width: 100%; height: 38px; padding: 0 32px 0 11px;
  display: flex; align-items: center;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); font-size: var(--fs-14); text-align: left;
  transition: border-color .16s ease-out, box-shadow .16s ease-out;
}
.select-trigger:hover { border-color: var(--faint); }
.select-trigger.open { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(45, 43, 40, .08); }
.select-trigger .select-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-trigger .select-value.placeholder { color: var(--faint); }
.select-caret { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.select-caret svg { width: 14px; height: 14px; }
.select-pop {
  position: fixed; z-index: 1200;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 10px; box-shadow: var(--shadow);
  padding: 5px; max-height: 260px; overflow: auto;
  animation: pop .16s ease-out;
}
.select-option {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 10px; border-radius: 6px; font-size: var(--fs-13); color: var(--ink-2);
  cursor: pointer; white-space: nowrap;
}
.select-option:hover { background: var(--surface-2); color: var(--ink); }
.select-option.selected { background: var(--surface-3); color: var(--ink); font-weight: 500; }
.select-option .check { color: var(--ink); font-size: var(--fs-12); }

/* ---------- 自定义日期 ---------- */
.date-field { position: relative; }
.date-field .input { padding-right: 34px; cursor: pointer; }
.date-field .cal-icon { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.date-field .cal-icon svg { width: 15px; height: 15px; }
.date-pop {
  position: fixed; z-index: 1200; width: 272px;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 12px; box-shadow: var(--shadow); padding: 12px;
  animation: pop .16s ease-out;
}
.date-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.date-title { font-size: var(--fs-13); font-weight: 600; }
.date-nav { display: flex; gap: 2px; }
.date-nav button { width: 26px; height: 26px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.date-nav button:hover { background: var(--surface-3); color: var(--ink); }
.date-nav svg { width: 14px; height: 14px; }
.date-week, .date-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.date-week span { text-align: center; font-size: var(--fs-12); color: var(--faint); padding: 4px 0; }
.date-day {
  height: 30px; border-radius: 7px; font-size: var(--fs-13); color: var(--ink-2);
  display: flex; align-items: center; justify-content: center;
  font-variant-numeric: tabular-nums;
}
.date-day:hover { background: var(--surface-2); }
.date-day.muted { color: var(--faint); }
.date-day.today { box-shadow: inset 0 0 0 1px var(--line-strong); }
.date-day.selected { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.date-time { display: flex; align-items: center; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.date-time label { font-size: var(--fs-12); color: var(--muted); }
.time-input {
  width: 46px; height: 30px; text-align: center; border: 1px solid var(--line-strong);
  border-radius: 6px; background: var(--surface); font-size: var(--fs-13);
}
.date-actions { display: flex; justify-content: space-between; margin-top: 10px; }

/* ---------- 页面头 / 页签 / 筛选 ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-head h2 { margin: 0; font-size: var(--fs-20); font-weight: 600; letter-spacing: -.01em; }
.page-head p { margin: 4px 0 0; font-size: var(--fs-13); color: var(--muted); }
.head-actions { display: flex; align-items: center; gap: 8px; }

.tabs { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs-caption { font-size: var(--fs-12); color: var(--muted); margin-right: 8px; letter-spacing: .04em; }
.tab {
  position: relative; padding: 9px 12px 11px; font-size: var(--fs-13); color: var(--muted);
  display: inline-flex; align-items: center; gap: 7px;
  transition: color .16s ease-out;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); font-weight: 600; }
.tab.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--accent); border-radius: 2px; }
.tab-count {
  min-width: 20px; height: 18px; padding: 0 6px; border-radius: 999px;
  background: var(--surface-3); color: var(--muted);
  font-size: var(--fs-12); font-weight: 400; display: inline-flex; align-items: center; justify-content: center;
  font-variant-numeric: tabular-nums;
}
.tab.active .tab-count { background: var(--accent); color: var(--accent-ink); }

.filters {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px;
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px;
  margin-bottom: 14px;
}
.filter-item { display: flex; flex-direction: column; gap: 5px; }
.filter-item > span { font-size: var(--fs-12); color: var(--muted); }
.filter-item.w-search { flex: 1 1 220px; min-width: 200px; }
.filter-item.w-dept { flex: 0 0 150px; }
.filter-item.w-owner { flex: 0 0 140px; }
.filter-item.w-date { flex: 0 0 140px; }
.filter-item.w-price { flex: 0 0 96px; }
.filter-item.w-key { flex: 0 0 110px; }
.filter-item .input, .filter-item .select-trigger { height: 34px; font-size: var(--fs-13); }
.filter-item .date-field .input { height: 34px; }
.filter-reset { margin-left: auto; }

/* ---------- 表格 ---------- */
.table-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table-scroll { overflow: auto; max-height: calc(100vh - 330px); }
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 1180px; }
.grid th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-2); text-align: left;
  font-size: var(--fs-12); font-weight: 500; color: var(--muted);
  padding: 9px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap; user-select: none;
}
.grid th.sortable { cursor: pointer; }
.grid th.sortable:hover { color: var(--ink); }
.grid th .sort-mark { display: inline-block; margin-left: 5px; color: var(--faint); font-size: 10px; }
.grid th.sorted .sort-mark { color: var(--ink); }
.grid td {
  padding: 10px 12px; border-bottom: 1px solid var(--line);
  font-size: var(--fs-13); color: var(--ink-2); vertical-align: middle;
}
.grid tbody tr { transition: background .16s ease-out; cursor: pointer; }
.grid tbody tr:hover { background: var(--surface-2); }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid .name-cell { max-width: 300px; }
.grid .name-cell strong { display: block; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid .name-cell small { display: block; font-size: var(--fs-12); color: var(--muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid .nowrap { white-space: nowrap; }
.grid .muted { color: var(--muted); }
.grid .actions { white-space: nowrap; text-align: right; }
.grid .actions button { margin-left: 10px; font-size: var(--fs-12); }
.grid .key-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); margin-right: 6px; vertical-align: 1px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: var(--fs-12); white-space: nowrap;
  background: var(--surface-3); color: var(--ink-2);
}
.badge.tender { background: var(--info-bg); color: var(--info); }
.badge.not_participating { background: var(--surface-3); color: var(--muted); }
.badge.progress { background: var(--warn-bg); color: var(--warn); }
.badge.won { background: var(--ok-bg); color: var(--ok); }
.badge.lost { background: var(--bad-bg); color: var(--bad); }
.badge.outline { background: transparent; border: 1px solid var(--line-strong); color: var(--muted); }
.badge.dot::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.empty { padding: 56px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink-2); font-weight: 500; margin-bottom: 4px; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 12px; border-top: 1px solid var(--line); }
.pager-info { font-size: var(--fs-12); color: var(--muted); }
.pager-btns { display: flex; align-items: center; gap: 4px; }
.pager-btn {
  min-width: 28px; height: 28px; padding: 0 8px; border-radius: 6px;
  font-size: var(--fs-12); color: var(--ink-2); border: 1px solid transparent;
}
.pager-btn:hover { background: var(--surface-2); }
.pager-btn.active { background: var(--accent); color: var(--accent-ink); }
.pager-btn:disabled { opacity: .35; }
.pager-size { width: 96px; }

/* ---------- 抽屉 / 弹窗 ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(36, 35, 32, .24);
  z-index: 800; opacity: 0; transition: opacity .16s ease-out;
}
.overlay.show { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 540px; max-width: 94vw;
  background: var(--surface); z-index: 810; box-shadow: -12px 0 40px rgba(35, 34, 32, .10);
  display: flex; flex-direction: column;
  transform: translateX(24px); opacity: 0;
  transition: transform .16s ease-out, opacity .16s ease-out;
}
.drawer.show { transform: none; opacity: 1; }
.drawer-head {
  padding: 18px 22px 14px; border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.drawer-head h3 { margin: 0; font-size: var(--fs-16); font-weight: 600; line-height: 1.4; }
.drawer-head p { margin: 3px 0 0; font-size: var(--fs-12); color: var(--muted); }
.drawer-body { flex: 1; overflow: auto; padding: 18px 22px; }
.drawer-foot { padding: 12px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface); }

.modal {
  position: fixed; z-index: 820; top: 50%; left: 50%; transform: translate(-50%, -48%);
  width: 440px; max-width: 92vw; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
  opacity: 0; transition: opacity .16s ease-out, transform .16s ease-out;
}
.modal.show { opacity: 1; transform: translate(-50%, -50%); }
.modal-head { padding: 16px 20px 10px; }
.modal-head h3 { margin: 0; font-size: var(--fs-16); font-weight: 600; }
.modal-head p { margin: 5px 0 0; font-size: var(--fs-13); color: var(--muted); }
.modal-body { padding: 6px 20px 16px; display: flex; flex-direction: column; gap: 14px; max-height: 62vh; overflow: auto; }
.modal-foot { padding: 12px 20px 16px; display: flex; justify-content: flex-end; gap: 8px; }

.form-section { margin-bottom: 22px; }
.form-section h4 {
  margin: 0 0 12px; font-size: var(--fs-12); color: var(--muted);
  font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
}
.form-section .field + .field { margin-top: 14px; }
.form-section .field-row + .field { margin-top: 14px; }
.form-section .field-row .field + .field { margin-top: 0; }
.stage-line { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.stage-line span:first-child { font-size: var(--fs-13); color: var(--muted); }

.detail-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; margin-bottom: 20px; }
.detail-meta div { padding: 9px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.detail-meta dt { font-size: var(--fs-12); color: var(--muted); margin: 0 0 2px; }
.detail-meta dd { margin: 0; font-size: var(--fs-13); color: var(--ink); word-break: break-word; }
.detail-meta .full { grid-column: 1 / -1; }

.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { position: relative; padding: 0 0 16px 18px; border-left: 1px solid var(--line); margin-left: 4px; }
.timeline-item::before {
  content: ""; position: absolute; left: -4px; top: 5px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--surface);
  border: 1.5px solid var(--line-strong);
}
.timeline-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.timeline-top strong { font-size: var(--fs-13); font-weight: 500; }
.timeline-top time { font-size: var(--fs-12); color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline-desc { margin: 3px 0 0; font-size: var(--fs-12); color: var(--muted); word-break: break-word; }
.timeline-desc code { background: var(--surface-3); border-radius: 4px; padding: 1px 4px; font-size: 11px; }

/* ---------- Toast ---------- */
.toast-root { position: fixed; z-index: 1500; top: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  min-width: 220px; max-width: 380px;
  background: var(--accent); color: var(--accent-ink);
  padding: 10px 14px; border-radius: 10px; font-size: var(--fs-13);
  box-shadow: var(--shadow); animation: toastIn .16s ease-out;
  display: flex; align-items: flex-start; gap: 8px;
}
.toast.error { background: var(--bad); }
.toast.ok { background: #3c4a3a; }
.toast .toast-text { flex: 1; }

/* ---------- 看板 ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 16px; cursor: pointer; transition: border-color .16s ease-out, transform .16s ease-out;
}
.kpi-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.kpi-card .kpi-label { font-size: var(--fs-12); color: var(--muted); }
.kpi-card .kpi-value { font-size: var(--fs-26); font-weight: 600; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi-card .kpi-foot { font-size: var(--fs-12); color: var(--muted); margin-top: 2px; }
.kpi-card.won .kpi-value { color: var(--ok); }
.kpi-card.lost .kpi-value { color: var(--bad); }
.kpi-card.progress .kpi-value { color: var(--warn); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head h3 { margin: 0; font-size: var(--fs-14); font-weight: 600; }
.panel-head span { font-size: var(--fs-12); color: var(--muted); }
.dash-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 14px; margin-bottom: 14px; }
.funnel-row { display: grid; grid-template-columns: 64px 1fr 54px; align-items: center; gap: 10px; margin-bottom: 12px; }
.funnel-row:last-child { margin-bottom: 0; }
.funnel-label { font-size: var(--fs-12); color: var(--muted); }
.funnel-track { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.funnel-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width .16s ease-out; }
.funnel-fill.progress { background: #b09a6e; }
.funnel-fill.won { background: var(--ok); }
.funnel-fill.lost { background: var(--bad); }
.funnel-count { text-align: right; font-size: var(--fs-13); font-variant-numeric: tabular-nums; }

.mini-table { width: 100%; border-collapse: collapse; }
.mini-table th { text-align: right; font-size: var(--fs-12); color: var(--muted); font-weight: 400; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.mini-table th:first-child, .mini-table td:first-child { text-align: left; }
.mini-table td { padding: 8px; border-bottom: 1px solid var(--line); font-size: var(--fs-13); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mini-table tr:last-child td { border-bottom: 0; }
.mini-table .bar-cell { width: 90px; }
.mini-bar { height: 5px; background: var(--accent); border-radius: 999px; min-width: 2px; }
.trend-row { display: grid; grid-template-columns: 64px 1fr 40px 40px; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: var(--fs-12); }
.trend-row:last-child { border-bottom: 0; }
.trend-row .label { color: var(--muted); font-variant-numeric: tabular-nums; }
.trend-bars { display: flex; flex-direction: column; gap: 3px; }
.trend-bars i { display: block; height: 4px; border-radius: 999px; background: var(--line-strong); }
.trend-bars i.won { background: var(--ok); }
.trend-num { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }

/* ---------- 登录 ---------- */
.login-body { background: var(--bg); }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  width: 380px; max-width: 100%; background: var(--surface);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  padding: 30px 28px 22px;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-brand h1 { margin: 0; font-size: var(--fs-16); font-weight: 600; }
.login-brand p { margin: 2px 0 0; font-size: var(--fs-12); color: var(--muted); }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-form .input { height: 40px; }
.login-error { font-size: var(--fs-13); color: var(--bad); background: var(--bad-bg); border-radius: 8px; padding: 8px 10px; }
.login-foot { margin: 20px 0 0; text-align: center; font-size: var(--fs-12); color: var(--faint); }

/* ---------- 其它 ---------- */
.section-title { font-size: var(--fs-13); font-weight: 600; color: var(--ink); margin: 0 0 10px; }
.hint-line { font-size: var(--fs-12); color: var(--muted); margin: 8px 0 0; }
.code-text { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: var(--fs-12); color: var(--ink-2); }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.check-list { margin: 0; padding-left: 18px; font-size: var(--fs-13); color: var(--ink-2); }
.check-list li { margin: 4px 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.one-col { display: grid; grid-template-columns: 1fr; gap: 14px; }

/* ---------- 数据看板（复刻旧版版式） ---------- */
.dash-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.dash-tabs { display: inline-flex; align-items: center; gap: 2px; padding: 3px; background: var(--surface-3); border: 1px solid var(--line); border-radius: 999px; }
.dash-tab { height: 28px; padding: 0 14px; border-radius: 999px; font-size: var(--fs-13); color: var(--muted); transition: background .16s ease-out, color .16s ease-out; }
.dash-tab:hover { color: var(--ink); }
.dash-tab.active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(35, 34, 32, .1); }
.dash-period { display: flex; align-items: center; gap: 8px; }
.dash-period .input { height: 34px; padding: 0 10px; }
.dash-month { width: 150px; }
.dash-year { width: 112px; }
.dash-sep { color: var(--faint); }
.dash-all-hint { padding: 0 4px; font-size: var(--fs-13); color: var(--muted); }
.dash-query { margin-left: auto; font-size: var(--fs-13); color: var(--muted); white-space: nowrap; }
.dash-query b { margin: 0 4px; font-size: var(--fs-16); color: var(--ink); font-variant-numeric: tabular-nums; }
.dash-range-hint { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; padding: 10px 14px; background: var(--warn-bg); border: 1px solid #eadfca; border-radius: var(--radius-sm); font-size: var(--fs-13); }
.dash-range-hint strong { font-weight: 600; color: var(--ink); }
.dash-range-hint span { color: var(--muted); }
.dash-kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.dash-kpi { position: relative; display: flex; flex-direction: column; gap: 4px; min-height: 118px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.dash-kpi.actual { flex-direction: row; align-items: center; justify-content: space-between; gap: 14px; }
.dash-kpi-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dash-kpi-label { font-size: var(--fs-12); color: var(--muted); }
.dash-kpi-value { font-size: 28px; font-weight: 600; line-height: 1.15; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.dash-kpi-unit { margin-left: 4px; font-size: var(--fs-12); font-weight: 400; color: var(--muted); }
.dash-kpi-foot { font-size: var(--fs-12); color: var(--muted); }
.dash-kpi-edit { align-self: flex-start; margin-top: auto; font-size: var(--fs-12); color: var(--warn); }
.dash-ring { position: relative; flex: none; display: flex; align-items: center; justify-content: center; width: 62px; height: 62px; border-radius: 50%; }
.dash-ring::before { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--surface); }
.dash-ring b { position: relative; font-size: var(--fs-12); font-weight: 600; font-variant-numeric: tabular-nums; }
.dash-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.dash-card { display: flex; flex-direction: column; padding: 14px 16px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.dash-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.dash-card-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dash-card-title h3 { margin: 0; font-size: var(--fs-14); font-weight: 600; }
.dash-card-note { font-size: 11px; color: var(--faint); }
.dash-card-metrics { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; white-space: nowrap; }
.dash-card-count { font-size: var(--fs-16); font-weight: 600; font-variant-numeric: tabular-nums; }
.dash-card-amount { font-size: var(--fs-12); color: var(--muted); font-variant-numeric: tabular-nums; }
.dash-card-list { display: flex; flex-direction: column; min-height: 96px; padding: 4px 0; }
.dash-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) 76px 34px; align-items: center; gap: 8px; width: 100%; padding: 5px 4px; border-radius: 6px; text-align: left; font-size: var(--fs-13); }
.dash-row:hover { background: var(--surface-2); }
.dash-row-date { font-size: var(--fs-12); color: var(--muted); font-variant-numeric: tabular-nums; }
.dash-row-name { overflow: hidden; color: var(--ink-2); text-overflow: ellipsis; white-space: nowrap; }
.dash-row-amount { text-align: right; font-variant-numeric: tabular-nums; }
.dash-row-point { text-align: right; font-size: var(--fs-12); color: var(--muted); }
.dash-empty { padding: 34px 0; text-align: center; font-size: var(--fs-12); color: var(--faint); }
.dash-more { align-self: flex-end; height: 30px; margin-top: 6px; padding: 0 12px; font-size: var(--fs-12); }
.dash-card.won .dash-card-count { color: var(--ok); }
.dash-card.progress .dash-card-count { color: var(--warn); }
.dash-card.lost .dash-card-count { color: var(--bad); }
.dash-target-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.dash-target-cell { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-12); color: var(--muted); }
.dash-target-cell .input { height: 34px; }

@media (max-width: 1280px) {
  .dash-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .dash-card-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .dash-kpi-grid { grid-template-columns: 1fr; }
  .dash-query { margin-left: 0; }
  .dash-target-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@keyframes pop { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar { width: 64px; flex-basis: 64px; padding: 18px 8px; }
  .brand-text, .nav-item span, .nav-label, .user-meta, .sidebar-foot .ghost-btn { display: none; }
  .nav-item { justify-content: center; }
  .sidebar-foot { justify-content: center; }
  .content { padding: 16px; }
  .field-row, .field-row-3 { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- 提醒中心 ---------- */
.bell-btn { position: relative; width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; color: var(--ink-2); }
.bell-btn:hover { background: var(--surface-2); }
.bell-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.bell-badge { position: absolute; top: -3px; right: -3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--bad); color: #fff; font-size: 10px; line-height: 16px; text-align: center; }
.key-badge { display: inline-flex; align-items: center; height: 18px; padding: 0 5px; margin-right: 6px; border-radius: 4px; background: var(--warn-bg); color: var(--warn); font-size: 11px; vertical-align: 1px; }
.alert-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.summary-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); font-size: var(--fs-12); color: var(--ink-2); }
.summary-chip b { font-weight: 600; color: var(--ink); }
.alert-list { display: flex; flex-direction: column; }
.alert-row { position: relative; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.alert-row:last-child { border-bottom: none; }
.alert-row.unread { background: #fbfaf6; }
.alert-row.unread::before { content: ""; position: absolute; left: 5px; top: 19px; width: 5px; height: 5px; border-radius: 50%; background: var(--bad); }
.alert-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.alert-title { font-weight: 600; color: var(--ink); text-align: left; font-size: var(--fs-14); }
.alert-title:hover { text-decoration: underline; }
.alert-date { margin-left: auto; font-size: var(--fs-12); color: var(--muted); }
.alert-chip { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 4px; font-size: 11px; background: var(--surface-3); color: var(--ink-2); }
.alert-chip.participate_pending { background: var(--info-bg); color: var(--info); }
.alert-chip.bid_soon { background: var(--warn-bg); color: var(--warn); }
.alert-chip.result_pending { background: var(--bad-bg); color: var(--bad); }
.alert-msg { margin: 6px 0 4px; font-size: var(--fs-13); color: var(--ink-2); }
.alert-meta { font-size: var(--fs-12); color: var(--muted); }
.alert-count { font-size: var(--fs-12); color: var(--muted); }
.detail-alert { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 0; font-size: var(--fs-12); }
.detail-alert-text { color: var(--ink-2); }
.detail-alert time { margin-left: auto; color: var(--muted); }
.check-line { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-12); color: var(--ink-2); cursor: pointer; }
.alert-quality { margin-top: 16px; padding: 14px; }
.quality-list { display: flex; flex-direction: column; }
.quality-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: var(--fs-12); }
.quality-row:last-child { border-bottom: none; }
.quality-name { color: var(--ink); font-weight: 500; }
.quality-name:hover { text-decoration: underline; }
.quality-meta { color: var(--muted); }
.quality-row time { margin-left: auto; color: var(--muted); }
.pager-text { margin: 0 10px; font-size: var(--fs-12); color: var(--muted); }
