/* ============================================================
   民和 AI · 样式 v2 —— 移植 stock-insight 设计系统
   iOS Liquid Glass：毛玻璃面板 · 发丝线 · 胶囊徽章 · 页面渐入动画
   红涨绿跌（铜价语境：涨=成本压力=红）
   ============================================================ */

@font-face { font-family: "Inter"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/inter-400.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/inter-500.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/inter-600.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/inter-700.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 800; font-style: normal; font-display: swap; src: url("fonts/inter-800.woff2") format("woff2"); }

/* 整站放大 125%（stock 同款）。vh 尺寸须除以 --zoom 折算，防双滚动条 */
:root { --zoom: 1.25; }
html { zoom: var(--zoom); }

:root {
  --background: #f2f2f7;
  --card: #ffffff;
  --page: #eef0f4;                 /* 面板内的输入/井面 */
  --surface: #ffffff;              /* 实心面板（tooltip/打印等） */
  --ink: #1c1c1e;
  --foreground: var(--ink);
  --ink2: #48484a;
  --muted: #8e8e93;
  --secondary: var(--muted);
  --grid: #e3e3e8;
  --hairline: #e5e5ea;
  --baseline: #c7c7cc;
  --border: rgba(28, 28, 30, 0.08);
  --green: #34c759;
  --red: #ff3b30;
  --blue: #007aff;
  --up: var(--red);                /* 涨=红（成本压力） */
  --down: var(--green);
  --accent: var(--blue);
  --accent-deep: #0060d1;
  --accent-wash: rgba(0, 122, 255, 0.10);
  --good: #34c759;
  --good-text: #1f8a3b;
  --warn: #ff9f0a;
  --warn-deep: #c27400;
  --serious: #ff9f0a;
  --crit: #ff3b30;
  --f1: #a8cdf9; --f2: #6fabf3; --f3: #3d8bff; --f4: #0a6cf0; --f5: #0353c4;
  --glass: rgba(255, 255, 255, 0.66);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --shadow: 0 1px 2px rgba(28, 28, 30, 0.05), 0 8px 24px -18px rgba(28, 28, 30, 0.25);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --background: #000000;
    --card: #1c1c1e;
    --page: #131315;
    --surface: #1c1c1e;
    --ink: #ffffff;
    --ink2: #d1d1d6;
    --muted: #8e8e93;
    --grid: #2c2c2e;
    --hairline: #2c2c2e;
    --baseline: #48484a;
    --border: rgba(255, 255, 255, 0.09);
    --green: #30d158;
    --red: #ff453a;
    --blue: #0a84ff;
    --accent-deep: #64a8ff;
    --accent-wash: rgba(10, 132, 255, 0.16);
    --good-text: #30d158;
    --warn-deep: #ffb340;
    --f1: #b5d5fb; --f2: #7cb3f5; --f3: #4a94ff; --f4: #1d78f2; --f5: #0a5cc8;
    --glass: rgba(28, 28, 30, 0.62);
    --glass-strong: rgba(28, 28, 30, 0.8);
    --shadow: none;
    color-scheme: dark;
  }
}
/* 手动切换（stock 同款 data-theme 覆盖，优先于系统偏好） */
:root[data-theme="dark"] {
  --background: #000000;
  --card: #1c1c1e;
  --page: #131315;
  --surface: #1c1c1e;
  --ink: #ffffff;
  --ink2: #d1d1d6;
  --muted: #8e8e93;
  --grid: #2c2c2e;
  --hairline: #2c2c2e;
  --baseline: #48484a;
  --border: rgba(255, 255, 255, 0.09);
  --green: #30d158;
  --red: #ff453a;
  --blue: #0a84ff;
  --accent-deep: #64a8ff;
  --accent-wash: rgba(10, 132, 255, 0.16);
  --good-text: #30d158;
  --warn-deep: #ffb340;
  --f1: #b5d5fb; --f2: #7cb3f5; --f3: #4a94ff; --f4: #1d78f2; --f5: #0a5cc8;
  --glass: rgba(28, 28, 30, 0.62);
  --glass-strong: rgba(28, 28, 30, 0.8);
  --shadow: none;
  color-scheme: dark;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "PingFang SC", "Helvetica Neue", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--background); color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
::selection { background: rgba(10, 132, 255, 0.35); }
input::placeholder, textarea::placeholder { color: var(--muted); }

/* ---------- 动画基元（stock 同款） ---------- */

@keyframes page-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.page-fade { animation: page-in 0.32s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes pulse-soft { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
.animate-pulse-soft { animation: pulse-soft 1.4s ease-in-out infinite; }
@keyframes rise { from { transform: translateY(40px); opacity: 0.4; } to { transform: none; opacity: 1; } }
@keyframes toast-in { from { transform: translateX(-50%) translateY(10px); opacity: 0; } to { transform: translateX(-50%) translateY(0); opacity: 1; } }
@keyframes msg-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.flip { animation: msg-in 0.45s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes k-bob { 0%, 100% { transform: scaleY(0.7); } 50% { transform: scaleY(1); } }
@keyframes k-sweep { to { left: 102%; } }
@media (prefers-reduced-motion: reduce) {
  .page-fade, .flip, .modal-box, #toast { animation: none !important; }
  .k-candles i, .k-beam { animation: none !important; }
  .k-beam { display: none; }
}

/* ---------- 布局 ---------- */

.layout { display: flex; min-height: calc(100vh / var(--zoom)); }

#sidebar {
  width: 224px; flex-shrink: 0;
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-right: 1px solid var(--hairline);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: calc(100vh / var(--zoom));
}
.brand { padding: 20px 18px 14px; border-bottom: 1px solid var(--hairline); }
.brand-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.brand-btns { display: flex; gap: 6px; }
.icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%; color: var(--muted);
  background: color-mix(in srgb, var(--card) 72%, transparent);
  border: 1px solid var(--border); cursor: pointer; font-family: inherit;
  backdrop-filter: blur(12px) saturate(160%); -webkit-backdrop-filter: blur(12px) saturate(160%);
  transition: color 0.15s, transform 0.12s ease, border-color 0.15s;
}
.icon-btn:hover { color: var(--ink); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.icon-btn:active { transform: scale(0.9); }
.icon-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.brand-logo { display: inline-block; }
.brand-logo img { height: 26px; display: block; transition: transform 0.15s ease; }
.brand-logo:hover img { transform: scale(1.04); }
.brand h1 { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; }
.brand h1 span { color: var(--accent); }
.brand p { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.6; }

/* 产品线卡（官网真实产品图） */
.prod-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.prod-card {
  position: relative; border-radius: 18px; overflow: hidden; cursor: pointer;
  border: 1px solid var(--border); background: var(--glass); box-shadow: var(--shadow);
  transition: transform 0.18s ease, outline-color 0.15s ease;
}
.prod-card:hover { transform: translateY(-3px); }
.prod-card:active { transform: scale(0.97); }
.prod-card.active { outline: 2px solid var(--accent); }
.prod-card img { width: 100%; height: 92px; object-fit: cover; display: block; }
.prod-card .pc-n {
  position: absolute; top: 8px; right: 8px; font-size: 11px; font-weight: 700;
  background: rgba(0, 0, 0, 0.55); color: #fff; padding: 2px 10px; border-radius: 999px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.prod-card .pc-body { padding: 9px 12px 11px; }
.prod-card .pc-name { font-size: 13px; font-weight: 700; }
.prod-card .pc-sub { font-size: 11px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 980px) { .prod-strip { grid-template-columns: repeat(2, 1fr); } }

nav { padding: 10px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin-bottom: 3px; border-radius: 12px;
  color: var(--muted); text-decoration: none; font-size: 13.5px; font-weight: 600;
  transition: color 0.15s, background 0.2s ease, transform 0.1s ease;
}
.nav-item svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; flex-shrink: 0; }
.nav-item:hover { color: var(--ink); background: color-mix(in srgb, var(--card) 70%, transparent); }
.nav-item:active { transform: scale(0.97); }
.nav-item.active {
  background: var(--card); color: var(--ink);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12), 0 0 0 0.5px var(--border);
}
.nav-item.active svg { color: var(--accent); stroke: var(--accent); }
.nav-badge {
  margin-left: auto; min-width: 20px; text-align: center;
  background: var(--accent); color: #fff; border-radius: 999px;
  font-size: 11px; font-weight: 700; padding: 1px 7px;
  box-shadow: 0 2px 6px color-mix(in srgb, var(--accent) 45%, transparent);
  animation: pulse-soft 2.2s ease-in-out infinite;
}

.compliance {
  padding: 12px 16px 16px; border-top: 1px solid var(--hairline);
  font-size: 11px; color: var(--muted); line-height: 1.75;
}

main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

#topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 26px; border-bottom: 1px solid var(--hairline);
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
  position: sticky; top: 0; z-index: 5;
}
#topbar-title { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; }
#topbar-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.topbar-right { display: flex; gap: 8px; align-items: center; }
.env-chip {
  font-size: 11.5px; font-weight: 600; padding: 4px 12px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--ink2);
  background: color-mix(in srgb, var(--card) 72%, transparent);
}
.env-chip.demo { color: var(--warn-deep); border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: color-mix(in srgb, var(--warn) 9%, transparent); }
.env-chip.ok { color: var(--good-text); border-color: color-mix(in srgb, var(--good) 45%, transparent); background: color-mix(in srgb, var(--good) 9%, transparent); }
.op-select {
  font-family: inherit; font-size: 11.5px; font-weight: 600; color: var(--ink2);
  background: color-mix(in srgb, var(--card) 72%, transparent);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 10px; max-width: 150px;
}
.op-select:focus { outline: 2px solid var(--accent); }

#view { padding: 22px 26px 48px; flex: 1; }

/* ---------- 卡片（Liquid Glass 面板） ---------- */

.card {
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: 18px; padding: 16px 18px; box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; gap: 10px; }
.card-head h3 { font-size: 14.5px; font-weight: 700; letter-spacing: -0.01em; }
.card-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.link-btn {
  background: none; border: none; color: var(--accent); font-size: 12.5px; font-weight: 600;
  cursor: pointer; padding: 2px 0; font-family: inherit; white-space: nowrap;
  transition: transform 0.1s ease;
}
.link-btn:hover { text-decoration: underline; }
.link-btn:active { transform: scale(0.95); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 { margin-bottom: 16px; }
.grid-32 { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; margin-bottom: 16px; }
.grid-32 > .card { margin-bottom: 0; }

/* ---------- KPI（stat tile） ---------- */

.kpi-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px; margin-bottom: 16px;
}
.kpi { margin-bottom: 0; padding: 14px 16px; }
.kpi.clickable { cursor: pointer; transition: transform 0.15s ease, border-color 0.15s ease; }
.kpi.clickable:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.kpi.clickable:active { transform: scale(0.97); }
.kpi.clickable:hover .kpi-more { opacity: 1; }
.kpi-more { float: right; font-size: 11px; font-weight: 700; color: var(--accent); opacity: 0.55; transition: opacity 0.15s; }
.kpi-label { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0.01em; }
@keyframes flash-ring { 0% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 60%, transparent); } 100% { box-shadow: 0 0 0 3px transparent; } }
.card.flash { animation: flash-ring 1.5s ease-out; }
.kpi-main { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin: 7px 0 4px; }
.kpi-value { font-size: 27px; font-weight: 700; line-height: 1.05; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.kpi-unit { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.kpi-delta { font-size: 12px; font-weight: 700; }
.delta-good { color: var(--good-text); }
.delta-bad { color: var(--crit); }
.delta-flat { color: var(--muted); }
.kpi-note { color: var(--muted); font-weight: 400; }
.spark { flex-shrink: 0; }

/* ---------- 待办速览条 ---------- */

.agent-strip { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 11px 18px; }
.strip-title { font-weight: 700; font-size: 13px; }
.strip-item { font-size: 13px; color: var(--ink2); }
.strip-item strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.strip-dot { color: var(--baseline); }
.agent-strip .btn { margin-left: auto; }

/* ---------- 图表 ---------- */

.chart-body { min-height: 200px; }
.chart-svg { display: block; width: 100%; height: auto; }
.axis-txt { font-size: 11px; fill: var(--muted); font-family: inherit; font-variant-numeric: tabular-nums; }
.bar-val { font-size: 11.5px; font-weight: 600; fill: var(--ink2); font-variant-numeric: tabular-nums; }

.chart-tip {
  display: none; position: fixed; z-index: 50; pointer-events: none;
  background: var(--glass-strong);
  backdrop-filter: blur(28px) saturate(180%); -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 8px 12px; font-size: 12.5px; color: var(--ink);
  box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.25); max-width: 300px;
  font-variant-numeric: tabular-nums;
}
.tip-sub { color: var(--muted); font-size: 11.5px; }

/* 漏斗 */
.funnel { display: flex; flex-direction: column; gap: 2px; padding: 4px 0; }
.funnel-row { display: flex; align-items: center; gap: 10px; padding: 3px 0; border-radius: 8px; }
.funnel-row:hover { background: var(--accent-wash); }
.funnel-label { width: 74px; font-size: 12.5px; color: var(--ink2); text-align: right; flex-shrink: 0; }
.funnel-track { flex: 1; }
.funnel-bar { display: block; height: 18px; border-radius: 0 999px 999px 0; min-width: 8px; }
.funnel-val { width: 40px; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.funnel-conv { font-size: 11px; color: var(--muted); padding-left: 90px; line-height: 1.2; }
.funnel-total { margin-top: 10px; font-size: 12.5px; color: var(--ink2); border-top: 1px solid var(--hairline); padding-top: 9px; }
.funnel-total strong { color: var(--ink); }

/* ---------- 表格（发丝线列表） ---------- */

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted);
  padding: 7px 10px; border-bottom: 1px solid var(--hairline); white-space: nowrap;
}
.tbl td { padding: 10px; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl th.num { text-align: right; }
.td-sub { display: block; font-size: 11.5px; color: var(--muted); }
.row-link { cursor: pointer; transition: background 0.15s ease; }
.row-link:hover td { background: color-mix(in srgb, var(--card) 55%, transparent); }
.row-link:active td { opacity: 0.7; }
.empty { color: var(--muted); text-align: center; padding: 22px 0; font-size: 13px; }
.tbl-note { font-size: 11.5px; color: var(--muted); margin-top: 9px; line-height: 1.7; }
.cell-warn { color: var(--warn-deep); font-weight: 600; }
.cell-crit { color: var(--crit); font-weight: 600; }
.tbl tr.sum-row td { border-top: 1.5px solid var(--baseline); font-weight: 700; }

/* ---------- 徽标（胶囊） ---------- */

.badge, .chip {
  display: inline-block; font-size: 11.5px; font-weight: 600;
  padding: 2px 10px; border-radius: 999px; white-space: nowrap;
}
.chip { font-weight: 600; }
.s-draft   { background: color-mix(in srgb, var(--muted) 14%, transparent); color: var(--ink2); }
.s-pending { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn-deep); }
.s-sent    { background: var(--accent-wash); color: var(--accent-deep); }
.s-won     { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good-text); }
.s-lost    { background: color-mix(in srgb, var(--muted) 13%, transparent); color: var(--muted); }
.s-risk    { background: color-mix(in srgb, var(--crit) 14%, transparent); color: var(--crit); }
.chip.good { background: color-mix(in srgb, var(--up) 15%, transparent); color: var(--up); }
.chip.bad  { background: color-mix(in srgb, var(--down) 15%, transparent); color: var(--down); }
.chip.mid  { background: var(--hairline); color: var(--muted); }

.txt-crit { color: var(--crit); font-weight: 700; }
.txt-warn { color: var(--warn-deep); font-weight: 700; }
.txt-good { color: var(--good-text); font-weight: 700; }

.proc-chip {
  display: inline-block; font-size: 11px; font-weight: 600; color: var(--ink2);
  border: 1px solid var(--border); border-radius: 999px; padding: 1px 9px; margin-right: 4px;
  background: color-mix(in srgb, var(--card) 78%, transparent); white-space: nowrap;
}
.stage-on { background: var(--accent); color: #fff; border-color: transparent; box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 35%, transparent); }

/* ---------- 筛选行 ---------- */

.filter-row { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; padding: 13px 18px; }
.filter-row label { font-size: 11.5px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.filter-row select, .filter-row input {
  font-family: inherit; font-size: 13px; color: var(--ink);
  background: var(--page); border: 1px solid var(--border); border-radius: 12px;
  padding: 7px 12px; min-width: 110px;
}
.filter-search input { min-width: 190px; }
.filter-row select:focus, .filter-row input:focus { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); border-color: transparent; }
.filter-count { margin-left: auto; font-size: 12.5px; color: var(--muted); padding-bottom: 8px; font-variant-numeric: tabular-nums; }

/* ---------- 按钮（iOS 渐变主按钮 + 玻璃次按钮） ---------- */

.btn {
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  background: color-mix(in srgb, var(--card) 80%, transparent); color: var(--ink2);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 7px 15px; text-decoration: none; display: inline-block;
  transition: transform 0.12s ease, opacity 0.12s ease, color 0.15s, border-color 0.15s;
}
.btn:hover { border-color: color-mix(in srgb, var(--accent) 50%, transparent); color: var(--accent-deep); }
.btn:active { opacity: 0.75; transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 92%, white 12%), var(--accent));
  border-color: transparent; color: #fff;
  box-shadow: 0 1px 3px color-mix(in srgb, var(--accent) 45%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn-primary:hover { color: #fff; filter: brightness(1.05); }
.btn-danger { color: var(--crit); }
.btn-danger:hover { border-color: var(--crit); color: var(--crit); }
.btn-sm { font-size: 12px; padding: 5px 12px; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn:disabled:active { transform: none; }

/* ---------- 详情页 ---------- */

.back-link { font-size: 13px; font-weight: 600; color: var(--accent); text-decoration: none; display: inline-block; margin-bottom: 12px; }
.back-link:hover { text-decoration: underline; }

.detail-head { padding: 18px 20px; }
.detail-id { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.avatar {
  width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0;
  background: var(--accent-wash); color: var(--accent-deep);
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 800;
}
.detail-id h2 { font-size: 18px; font-weight: 800; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; letter-spacing: -0.01em; }
.detail-meta { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.detail-price { margin-left: auto; text-align: right; }
.detail-price .p { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.detail-price .l { font-size: 11.5px; color: var(--muted); }

.detail-grid { align-items: start; }
.detail-grid .col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.detail-grid .col .card { margin-bottom: 0; }

.ai-badge {
  font-size: 10.5px; font-weight: 700; color: var(--accent-deep);
  background: var(--accent-wash); border-radius: 999px; padding: 2px 9px;
  margin-left: 6px; vertical-align: 1px;
}

.ai-box {
  font-size: 13px; color: var(--ink2); background: color-mix(in srgb, var(--accent) 7%, transparent);
  border: 1px dashed color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 14px; padding: 12px 15px; line-height: 1.75;
}
.ai-box strong { color: var(--ink); }

/* 阈值标尺 */
.gauge { margin: 14px 2px 6px; }
.gauge-track { position: relative; height: 8px; border-radius: 999px; background: var(--hairline); }
.gauge-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; }
.gauge-mark { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink2); opacity: .55; border-radius: 1px; }
.gauge-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 7px; }
.gauge-verdict { font-size: 13px; margin-top: 10px; }

/* 时间线 / 审批链 */
.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 12px; padding: 7px 6px; position: relative; border-radius: 10px; }
.tl-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--baseline); margin-top: 6px; flex-shrink: 0; }
.tl-done .tl-dot { background: var(--good); }
.tl-doing .tl-dot { background: var(--warn); animation: pulse-soft 1.6s ease-in-out infinite; }
.tl-warn .tl-dot { background: var(--crit); animation: pulse-soft 1.6s ease-in-out infinite; }
.tl-todo .tl-dot { background: var(--baseline); }
.tl-time { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-event { font-size: 13px; }
.tl-note { font-size: 12px; color: var(--muted); }
.tl-click { cursor: pointer; transition: background 0.15s ease; }
.tl-click:hover { background: var(--accent-wash); }
.tl-click:active { opacity: 0.7; }

/* ---------- 审批卡 ---------- */

.ap-card { padding: 16px 18px; }
.ap-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ap-head h3 { font-size: 15px; font-weight: 800; }
.ap-ask {
  font-size: 12px; font-weight: 800; color: var(--crit);
  background: color-mix(in srgb, var(--crit) 13%, transparent); border-radius: 999px; padding: 3px 11px;
}
.ap-margin { display: flex; gap: 18px; margin: 10px 0; font-size: 13px; flex-wrap: wrap; }
.ap-margin b { font-variant-numeric: tabular-nums; }
.ap-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* ---------- PO 链路 ---------- */

.pipe { display: flex; align-items: stretch; gap: 0; flex-wrap: wrap; padding: 6px 2px; }
.pipe-step { display: flex; align-items: center; }
.pipe-node {
  text-align: center; padding: 10px 15px; border-radius: 14px; cursor: pointer;
  background: color-mix(in srgb, var(--card) 78%, transparent);
  border: 1px solid var(--border); min-width: 94px;
  transition: transform 0.15s ease, outline-color 0.15s ease;
}
.pipe-node:hover { transform: translateY(-2px); }
.pipe-node:active { transform: scale(0.96); }
.pipe-node.active {
  outline: 2px solid var(--accent); border-color: transparent;
  background: var(--accent-wash);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 30%, transparent);
}
.pipe-node .n { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.pipe-node .l { font-size: 11.5px; color: var(--ink2); font-weight: 600; }
.pipe-node.hot { border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: var(--accent-wash); }
.pipe-node.bad .n { color: var(--crit); }
.pipe-arrow { color: var(--baseline); padding: 0 7px; font-size: 15px; align-self: center; }
.pipe-rate { margin-left: auto; align-self: center; font-size: 12.5px; color: var(--ink2); }
.pipe-rate strong { font-size: 17px; color: var(--ink); font-variant-numeric: tabular-nums; }

.conf { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.conf-hi { color: var(--good-text); }
.conf-mid { color: var(--warn-deep); }

/* PDF 原文框 */
.pdfbox {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 11.8px; line-height: 1.75; color: var(--ink2);
  background: var(--page); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px 16px; overflow-x: auto; white-space: pre;
}
.pdf-tag { font-size: 11px; color: var(--muted); margin-bottom: 8px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pdf-badge { border: 1px solid var(--border); border-radius: 999px; padding: 2px 9px; background: color-mix(in srgb, var(--card) 78%, transparent); font-weight: 600; }

.issue { display: flex; gap: 9px; padding: 9px 0; border-bottom: 1px solid var(--hairline); font-size: 13px; }
.issue:last-child { border-bottom: none; }
.issue-ico { flex-shrink: 0; }

/* ---------- 预测与排程 ---------- */

.tab-row { display: flex; gap: 7px; margin-bottom: 14px; flex-wrap: wrap; }
.tab {
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  padding: 6px 14px; border-radius: 999px;
  background: color-mix(in srgb, var(--card) 72%, transparent);
  border: 1px solid var(--border); color: var(--muted);
  transition: transform 0.12s ease, background 0.15s ease, color 0.15s ease;
}
.tab:hover { color: var(--ink); }
.tab:active { transform: scale(0.95); }
.tab.active {
  background: var(--accent); border-color: transparent; color: #fff; font-weight: 700;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 38%, transparent);
}

.load-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--hairline); }
.load-row:last-child { border-bottom: none; }
.load-name { width: 130px; flex-shrink: 0; font-size: 13px; font-weight: 600; }
.load-pct { width: 52px; text-align: right; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.load-note { font-size: 11.5px; color: var(--muted); width: 165px; flex-shrink: 0; }

.meter { flex: 1; height: 7px; border-radius: 999px; overflow: hidden; background: var(--hairline); display: inline-block; }
.meter-fill { display: block; height: 100%; border-radius: 999px; transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1); }

.sug-card { border-left: 3px solid var(--warn); }
.sug-card.adopted { border-left-color: var(--good); }
.sug-tag {
  font-size: 11px; font-weight: 700; color: var(--warn-deep); background: color-mix(in srgb, var(--warn) 13%, transparent);
  border-radius: 999px; padding: 2px 9px; display: inline-block; margin-left: 8px; vertical-align: 1px;
}
.opt {
  display: flex; gap: 10px; align-items: flex-start;
  background: color-mix(in srgb, var(--card) 82%, transparent); border: 1px solid var(--border); border-radius: 14px;
  padding: 11px 14px; margin-top: 9px; font-size: 13px;
  transition: transform 0.15s ease;
}
.opt:hover { transform: translateY(-1px); }
.opt-k {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 999px; text-align: center; line-height: 24px;
  background: var(--accent-wash); color: var(--accent-deep); font-weight: 800; font-size: 12.5px;
}
.opt-rec { font-size: 10.5px; font-weight: 800; color: var(--good-text); background: color-mix(in srgb, var(--good) 13%, transparent); border-radius: 999px; padding: 1px 8px; margin-left: 6px; }
.opt-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.risk-line { font-size: 12.5px; color: var(--warn-deep); margin-top: 10px; font-weight: 600; }
.sug-actions { display: flex; gap: 8px; margin-top: 12px; }
.log-item { font-size: 12.5px; color: var(--ink2); padding: 8px 0; border-bottom: 1px solid var(--hairline); }
.log-item:last-child { border-bottom: none; }
.log-time { color: var(--muted); font-size: 11.5px; margin-right: 8px; font-variant-numeric: tabular-nums; }

/* ---------- 飞书接入 / 配置 ---------- */

.cfg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.cfg-field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 600; }
.cfg-field input, .cfg-field select, .cfg-field textarea {
  font-family: inherit; font-size: 13px; font-weight: 400; color: var(--ink);
  background: var(--page); border: 1px solid var(--border); border-radius: 12px;
  padding: 9px 12px; width: 100%;
}
.cfg-field textarea { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; resize: vertical; white-space: pre; }
.cfg-field input:focus, .cfg-field select:focus, .cfg-field textarea:focus {
  outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); border-color: transparent;
}
.cfg-full { grid-column: 1 / -1; }
.cfg-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink2); grid-column: 1 / -1; font-weight: 500; }
.cfg-check input { width: auto; accent-color: var(--accent); }
.cfg-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--baseline); margin-right: 7px; vertical-align: 1px; }
.dot.on { background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 22%, transparent); }
.dot.off { background: var(--crit); box-shadow: 0 0 0 3px color-mix(in srgb, var(--crit) 22%, transparent); }

.guide-step { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--hairline); font-size: 13px; color: var(--ink2); }
.guide-step:last-child { border-bottom: none; }
.guide-num {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 999px; text-align: center; line-height: 22px;
  background: var(--accent-wash); color: var(--accent-deep); font-weight: 800; font-size: 12px;
}
.guide-step code {
  font-family: ui-monospace, Consolas, monospace; font-size: 12px;
  background: var(--page); border: 1px solid var(--border); border-radius: 7px; padding: 1px 6px;
}

/* ---------- 项目生产 · 扫码报工 ---------- */

.bg-wrap { max-width: 500px; margin: 0 auto; }
.bg-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bg-btn {
  font-family: inherit; padding: 24px 10px; font-size: 17px; font-weight: 800;
  border-radius: 18px; text-align: center; cursor: pointer;
  border: 1px solid var(--border);
  background: var(--glass); color: var(--ink);
  backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: var(--shadow);
  transition: transform 0.12s ease, border-color 0.15s;
}
.bg-btn:hover { border-color: color-mix(in srgb, var(--accent) 55%, transparent); color: var(--accent-deep); }
.bg-btn:active { transform: scale(0.95); }
.bg-issue { color: var(--crit); }
.bg-issue:hover { border-color: var(--crit); color: var(--crit); }

/* ---------- 铜价深度分析（stock 深度分析同款组件） ---------- */

.a-quote { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.a-price { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.a-meta { font-size: 12px; color: var(--muted); }
.a-chg { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; border-radius: 999px; padding: 3px 12px; color: #fff; }
.a-chg.up { background: var(--up); box-shadow: 0 3px 10px color-mix(in srgb, var(--up) 35%, transparent); }
.a-chg.down { background: var(--down); box-shadow: 0 3px 10px color-mix(in srgb, var(--down) 35%, transparent); }

.score-bar { position: relative; height: 8px; border-radius: 999px; margin: 14px 0 4px;
  background: linear-gradient(90deg, var(--down), var(--grid) 50%, var(--up)); }
/* 分数越高越好的场景（绩效、评分）。默认那条是给涨跌语义用的——
   右端是 --up（成本语境下为红），直接拿来放绩效分会让 99 分的人显示在红区。 */
.score-bar.asc { background: linear-gradient(90deg, var(--up), var(--grid) 50%, var(--down)); }
.score-dot {
  position: absolute; top: -4px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; border: 3px solid var(--ink2); transform: translateX(-50%);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  transition: left 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.score-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }

.fct { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, var(--card) 70%, transparent); border: 1px solid var(--border); }
.fct-title { font-size: 12px; font-weight: 800; color: var(--muted); letter-spacing: 0.04em; margin-bottom: 4px; }
.fct-row { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
.fct-name { flex: none; width: 62px; font-size: 13px; font-weight: 700; }
.fct-bar { flex: 1; height: 8px; border-radius: 999px; background: var(--hairline); overflow: hidden; }
.fct-bar i { display: block; height: 100%; border-radius: 999px; background: var(--muted); transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1); }
.fct-bar i.hi { background: var(--up); }
.fct-bar i.lo { background: var(--down); }
.fct-row b { flex: none; width: 26px; text-align: right; font-size: 13px; font-variant-numeric: tabular-nums; }
.fct-w { flex: none; width: 40px; font-size: 11px; color: var(--muted); }
.fct-detail { margin: 3px 0 0 70px; font-size: 11px; line-height: 1.65; color: var(--muted); }

.kv-line { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.kv-line .pill {
  border-radius: 999px; background: color-mix(in srgb, var(--card) 85%, transparent);
  border: 1px solid var(--border); padding: 6px 13px; font-size: 12.5px; font-variant-numeric: tabular-nums;
}
.kv-line .pill b { font-weight: 700; }

.a-action {
  margin-top: 14px; border-radius: 16px; padding: 13px 15px; font-size: 13.5px; line-height: 1.8;
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.a-action.lv-high { background: color-mix(in srgb, var(--crit) 8%, transparent); border-color: color-mix(in srgb, var(--crit) 35%, transparent); }
.a-action.lv-low { background: color-mix(in srgb, var(--good) 8%, transparent); border-color: color-mix(in srgb, var(--good) 35%, transparent); }
.a-action b { font-weight: 800; }
.a-disclaim { margin-top: 12px; text-align: center; font-size: 11.5px; color: var(--muted); }

/* K线扫描等待动画（stock 同款） */
.ana-load { padding: 30px 0 24px; text-align: center; }
.ana-msg { margin-top: 18px; font-size: 14px; font-weight: 700; }
.kload { position: relative; width: 200px; height: 96px; margin: 0 auto; overflow: hidden; }
.k-candles { display: flex; align-items: flex-end; justify-content: center; gap: 13px; height: 100%; padding-bottom: 10px; box-sizing: border-box; }
.k-candles i {
  position: relative; width: 9px; height: var(--h); border-radius: 3px;
  background: var(--up); transform-origin: bottom;
  animation: k-bob 1.6s ease-in-out var(--d) infinite;
}
.k-candles i.down { background: var(--down); }
.k-candles i::before {
  content: ""; position: absolute; left: 50%; top: -9px; bottom: -7px; width: 1.5px;
  transform: translateX(-50%); background: inherit; opacity: 0.6; border-radius: 1px;
}
.k-beam {
  position: absolute; top: 0; bottom: 0; left: -20%; width: 18%;
  border-right: 1.5px solid var(--accent);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 28%, transparent));
  animation: k-sweep 2.4s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}
.spinner {
  width: 32px; height: 32px; margin: 0 auto 14px; border-radius: 50%;
  border: 3px solid var(--hairline); border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

/* ---------- 弹窗 & Toast ---------- */

.overlay {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: var(--glass-strong);
  backdrop-filter: blur(36px) saturate(180%); -webkit-backdrop-filter: blur(36px) saturate(180%);
  border-radius: 24px; border: 1px solid var(--border);
  padding: 20px 22px; width: 580px; max-width: 100%; max-height: calc(84vh / var(--zoom)); overflow-y: auto;
  box-shadow: 0 24px 64px -12px rgba(0, 0, 0, 0.35);
  animation: rise 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}
.modal h3 { font-size: 16px; font-weight: 800; margin-bottom: 4px; }
.modal .card-sub { margin-bottom: 10px; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; }

#toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%) translateY(16px);
  background: color-mix(in srgb, var(--ink) 92%, transparent); color: var(--background);
  backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%);
  font-size: 13.5px; font-weight: 600; padding: 11px 22px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s;
  z-index: 60; max-width: 90vw; text-align: center;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.3);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 报价单打印 ---------- */

.print-sheet { display: none; }
@media print {
  html { zoom: 1; }
  body.printing .layout, body.printing #toast, body.printing #modal-root { display: none !important; }
  body.printing .print-sheet { display: block; }
}
.print-sheet { font-size: 13px; color: #000; padding: 24px 8px; max-width: 720px; margin: 0 auto; font-family: "SimSun", "PingFang SC", serif; }
.print-sheet .ps-co { text-align: center; font-size: 18px; font-weight: 700; letter-spacing: 2px; }
.print-sheet .ps-co span { font-size: 11px; font-weight: 400; letter-spacing: 0.5px; }
.print-sheet h1 { text-align: center; font-size: 22px; margin: 14px 0 4px; letter-spacing: 8px; }
.print-sheet h1 span { display: block; font-size: 11px; letter-spacing: 3px; font-weight: 400; }
.print-sheet table { width: 100%; border-collapse: collapse; margin-top: 14px; }
.print-sheet .ps-meta td { padding: 6px 4px; font-size: 12.5px; border-bottom: 1px solid #000; }
.print-sheet .ps-items th, .print-sheet .ps-items td { border: 1px solid #000; padding: 8px 10px; text-align: center; font-size: 12.5px; }
.print-sheet .ps-terms { margin-top: 16px; font-size: 12px; line-height: 2; }
.print-sheet .ps-sign td { width: 50%; padding: 18px 10px 30px; font-size: 12.5px; vertical-align: top; }

/* ---------- 响应式 ---------- */

@media (max-width: 1160px) {
  .grid-32 { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .grid-2 { grid-template-columns: 1fr; }
  .pipe-rate { margin-left: 0; width: 100%; padding-top: 8px; }
}
@media (max-width: 860px) {
  /* 手机取消整站 125% 放大：1:1 信息密度 + 触控命中（vh 折算自动跟随 --zoom） */
  :root { --zoom: 1; }
  .layout { flex-direction: column; }
  #sidebar { width: 100%; height: auto; position: static; }
  .brand { padding: 14px 16px 10px; }
  nav { display: flex; overflow-x: auto; padding: 6px 10px; scrollbar-width: none; }
  nav::-webkit-scrollbar { display: none; }
  .nav-item { white-space: nowrap; }
  .compliance { display: none; }
  #view { padding: 16px 12px calc(36px + env(safe-area-inset-bottom)); }
  .load-note { display: none; }
  .fct-detail { margin-left: 0; }

  /* 顶栏压缩、允许换行 */
  #topbar { padding: 10px 14px; flex-wrap: wrap; gap: 6px 10px; }
  #topbar-title { font-size: 17px; }

  /* KPI 双列（iOS 桌面小组件式） */
  .kpi-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 12px 13px; }
  .kpi-value { font-size: 23px; }

  /* 宽表格：卡片内横向滚动，单元格不折行 */
  .card { overflow-x: auto; }
  .tbl td { white-space: nowrap; }

  /* 配置/筛选表单单列，输入 16px 防 iOS 聚焦自动放大 */
  .cfg-grid { grid-template-columns: 1fr; }
  .filter-row { padding: 11px 14px; gap: 10px; }
  .filter-row label { flex: 1 1 44%; }
  .filter-row select, .filter-row input { min-width: 0; width: 100%; font-size: 16px; }
  .filter-search input { min-width: 0; }
  .cfg-field input, .cfg-field select, .cfg-field textarea { font-size: 16px; }
  .filter-count { margin-left: 0; padding-bottom: 0; }

  /* PO 管线节点均分收窄 */
  .pipe-node { min-width: 70px; padding: 8px 10px; flex: 1; }
  .pipe-step { flex: 1; }
  .pipe-arrow { padding: 0 4px; }

  /* 详情头价格块换行后左对齐 */
  .detail-price { margin-left: 0; text-align: left; width: 100%; }

  /* 弹窗改底部抽屉：动作栏吸底常显，长表单不再"找不到提交按钮" */
  .overlay { padding: 0; align-items: flex-end; }
  .modal {
    width: 100%; max-width: 100%;
    border-radius: 20px 20px 0 0;
    padding: 16px 16px 0;
    max-height: 92vh; max-height: 92dvh;
  }
  .modal > :last-child:not(.modal-actions) { margin-bottom: 16px; }
  .modal-actions {
    position: sticky; bottom: 0; z-index: 2;
    margin: 14px -16px 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: var(--glass-strong);
    backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid var(--hairline);
  }
  .modal-actions .btn { flex: 1 1 auto; padding: 11px 12px; font-size: 14.5px; text-align: center; }

  /* 筛选行主操作按钮置顶通栏（新建报价 / 导入 PO 一眼可见） */
  .filter-row .btn-primary { order: -1; flex: 1 1 100%; text-align: center; padding: 10px 15px; font-size: 14.5px; margin-bottom: 0; }

  .prod-strip { gap: 10px; }
  .prod-card img { height: 76px; }
  .funnel-label { width: 60px; }
  .funnel-conv { padding-left: 74px; }
  .a-price { font-size: 26px; }
  #toast { bottom: calc(24px + env(safe-area-inset-bottom)); }
}

/* ============================================================
   品牌可配 + 精简精修（苹果风：克制、留白、发丝线）
   —— 追加在最后，靠层叠覆盖前面的通用值，不动原有结构
   ============================================================ */

:root {
  /* 品牌原色：只用于标志本身。#C89A56 在白底作文字仅 2.56:1，不能当交互色 */
  --brand-gold: #C89A56;
  --brand-ink: #443F3D;

  /* 交互主色取深青铜：白字按钮 5.30:1、白底文字 5.30:1，两个方向都过 AA */
  --accent: #8A6520;
  --accent-deep: #6E501A;
  --accent-wash: rgba(138, 101, 32, 0.10);
  --on-accent: #ffffff;                 /* 主色面上的文字色 */
  --f1: #E7D2A8; --f2: #D3B274; --f3: #C89A56; --f4: #A67C2E; --f5: #7A5A1C;

  /* 更克制的阴影与发丝线：苹果风靠边界和留白分层，不靠投影 */
  --hairline: #e6e6ea;
  --border: rgba(28, 28, 30, 0.07);
  --shadow: 0 0.5px 1px rgba(28, 28, 30, 0.04), 0 6px 20px -16px rgba(28, 28, 30, 0.18);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand-gold: #D9AC63;
    --brand-ink: #C9C4C1;
    --accent: #D4A85F;                  /* 深色底上的金 */
    --accent-deep: #E0B978;
    --accent-wash: rgba(212, 168, 95, 0.14);
    --on-accent: #1f1a10;               /* 金面上用深色字：7.75:1 */
    --f1: #4A3C22; --f2: #7A6230; --f3: #A6813C; --f4: #C89A56; --f5: #E0B978;
  }
}
:root[data-theme="dark"] {
  --brand-gold: #D9AC63;
  --brand-ink: #C9C4C1;
  --accent: #D4A85F;
  --accent-deep: #E0B978;
  --accent-wash: rgba(212, 168, 95, 0.14);
  --on-accent: #1f1a10;
  --f1: #4A3C22; --f2: #7A6230; --f3: #A6813C; --f4: #C89A56; --f5: #E0B978;
}

/* 主色面上的文字统一走 --on-accent，深色主题下才不会白字压浅金 */
.btn-primary, .nav-badge, .tab.active { color: var(--on-accent); }

/* ---- 品牌区 ---- */
.brand-logo svg, .brand-logo img { height: 30px; width: auto; display: block; }
.brand h1 { font-size: 19px; font-weight: 700; letter-spacing: -0.015em; }
.brand h1 span { color: var(--brand-gold); }
.brand p { font-size: 10.5px; letter-spacing: 0.02em; }

/* ---- 侧栏：降低视觉重量 ---- */
#sidebar { width: 218px; }
.nav-item { font-weight: 500; font-size: 13px; padding: 8px 11px; margin-bottom: 1px; }
.nav-item.active { font-weight: 600; box-shadow: none; background: var(--accent-wash); color: var(--ink); }
.nav-item.active svg { color: var(--accent); stroke: var(--accent); }
/* 活动项左侧的细指示条，比整块填色安静 */
.nav-item.active { position: relative; }
.nav-item.active::before {
  content: ''; position: absolute; left: -11px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 16px; border-radius: 999px; background: var(--brand-gold);
}

/* ---- 顶栏与卡片：更大留白、更轻的线 ---- */
#topbar { padding: 15px 28px; }
#topbar-title { font-weight: 700; letter-spacing: -0.015em; }
.card { box-shadow: var(--shadow); }
.card-head h3 { letter-spacing: -0.01em; }

/* ---- 数字：等宽 + 收紧字距，报表更好读 ---- */
.kpi-value, .num, .tbl .num, .detail-price {
  font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
}
.kpi-value { font-weight: 700; }

/* ============================================================
   手机端：把导航整块移出内容流
   —— 改造前实测 844px 首屏有 394px（47%）是壳：
      品牌 120 + 横滚导航 54 + 标题栏 101 + 授权横幅 107。
      横滚导航还有个隐性问题：菜单看不全，靠盲滑。
   ============================================================ */
#appbar, #scrim, .drawer-foot { display: none; }

@media (max-width: 860px) {
  #appbar {
    display: flex; align-items: center; gap: 4px;
    position: fixed; top: 0; left: 0; right: 0; z-index: 40;
    height: calc(52px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 6px 0;
    background: var(--glass-strong);
    backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--hairline);
  }
  .ab-btn {
    flex-shrink: 0; width: 44px; height: 44px;      /* 触控 44px */
    display: flex; align-items: center; justify-content: center;
    background: none; border: 0; color: var(--ink); cursor: pointer; position: relative;
    border-radius: 12px;
  }
  .ab-btn:active { background: var(--accent-wash); }
  .ab-btn svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 1.9; }
  .ab-btn svg circle { fill: currentColor; stroke: none; }
  .ab-dot {
    position: absolute; top: 9px; right: 10px; width: 8px; height: 8px;
    border-radius: 50%; background: var(--crit); border: 1.5px solid var(--glass-strong);
  }
  .ab-title { flex: 1; min-width: 0; padding: 0 2px; }
  #ab-name {
    font-size: 16px; font-weight: 700; letter-spacing: -0.01em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }

  /* 侧栏变抽屉：脱离文档流，不再占首屏 */
  #sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 50;
    width: 272px; max-width: 84vw; height: 100%;
    background: var(--glass-strong);
    backdrop-filter: blur(28px) saturate(180%); -webkit-backdrop-filter: blur(28px) saturate(180%);
    border-right: 1px solid var(--hairline);
    transform: translateX(-100%); transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
    overflow-y: auto; overscroll-behavior: contain;
    padding-top: env(safe-area-inset-top);
  }
  #sidebar.open { transform: none; }
  #scrim {
    display: block; position: fixed; inset: 0; z-index: 45;
    background: rgba(0, 0, 0, 0.36); opacity: 0; pointer-events: none;
    transition: opacity 0.26s ease;
    backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  }
  #scrim.show { opacity: 1; pointer-events: auto; }

  /* 抽屉里导航恢复竖排，一眼看全（原来横滚要盲滑） */
  nav { display: block; overflow: visible; padding: 8px 10px; }
  .nav-item { white-space: normal; padding: 11px 12px; font-size: 14.5px; margin-bottom: 2px; }
  .nav-item.active::before { left: -10px; }
  .compliance { display: block; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); font-size: 10.5px; }
  .drawer-foot {
    display: flex; flex-wrap: wrap; gap: 8px;
    padding: 12px 12px 4px; margin-top: 6px; border-top: 1px solid var(--hairline);
  }
  .drawer-foot .btn { flex: 1 1 40%; justify-content: center; }

  /* 正文让出固定顶栏的高度；原顶栏在手机上退化为副标题一行 */
  main { padding-top: calc(52px + env(safe-area-inset-top)); }
  #topbar {
    position: static; padding: 10px 14px 0; border-bottom: 0;
    background: none; backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  #topbar-title { display: none; }          /* 页名已在顶栏上，不重复 */
  #topbar-sub { font-size: 12px; margin: 0; }
  .topbar-right { display: none; }          /* 四个按钮挪进抽屉 */
  #view { padding-top: 12px; }

  /* 授权横幅折叠成一行，点开看全文——原来占 107px */
  #lic-banner {
    padding: 9px 12px; font-size: 12.5px; gap: 8px; align-items: center;
    cursor: pointer; margin: 0 0 10px;
  }
  #lic-banner .lic-msg {
    flex: 1 1 auto; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  #lic-banner.expanded .lic-msg { white-space: normal; overflow: visible; }
  #lic-banner .btn { flex-shrink: 0; }

  /* 筛选区默认折叠：设备页 6 个筛选字段就占掉半屏 */
  .filter-row.collapsible > *:not(.filter-search):not(.filter-toggle):not(.filter-count) { display: none; }
  .filter-row.collapsible.open > * { display: flex; }
  .filter-row.collapsible.open > .filter-count { display: block; }
  .filter-toggle {
    display: inline-flex; align-items: center; gap: 4px;
    background: none; border: 0; color: var(--accent); font: inherit;
    font-size: 13px; font-weight: 600; cursor: pointer; padding: 6px 2px;
  }
}
@media (min-width: 861px) { .filter-toggle { display: none; } }

/* 授权横幅：布局写在样式里，不用行内 style——
   行内样式优先级高于媒体查询，手机端的单行折叠会被它压掉 */
.lic-banner { margin: 0 0 12px; display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.lic-banner .lic-msg { flex: 1 1 220px; min-width: 0; }
@media (max-width: 860px) {
  .lic-banner { flex-wrap: nowrap; align-items: center; }
  .lic-banner.expanded { flex-wrap: wrap; align-items: flex-start; }
}

/* 抽屉头部的铃铛/主题按钮在手机上是重复的：顶栏已有铃铛，抽屉底部已有切换主题 */
@media (max-width: 860px) { .brand-btns { display: none; } }

/* ============================================================
   侧栏滚动
   —— 菜单加到 16 项后，224×720 的侧栏装不下：底部的「系统设置」
      和合规小字被切掉，而且**滚不动**（父容器 flex 列没给 overflow）。
      让品牌区和底部固定、中间导航区滚动；滚动条隐藏，靠触控/滚轮拉。
   ============================================================ */
@media (min-width: 861px) {
  #sidebar { overflow: hidden; }        /* 外层不滚，避免品牌区被拉走 */
  #sidebar > nav {
    flex: 1 1 auto;
    /* flex 列里的子项默认 min-height:auto，不加这行它不会收缩，
       overflow-y 就永远不触发——这是 flexbox 最常见的溢出坑 */
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;       /* 滚到底不带着整页一起滚 */
  }
  .brand, .compliance, .drawer-foot { flex-shrink: 0; }
}

/* 隐藏滚动条但保留滚动能力（桌面侧栏与手机抽屉都适用） */
#sidebar, #sidebar > nav {
  scrollbar-width: none;                /* Firefox */
  -ms-overflow-style: none;             /* 旧 Edge */
}
#sidebar::-webkit-scrollbar,
#sidebar > nav::-webkit-scrollbar { width: 0; height: 0; display: none; }

/* 滚动到边缘时给一点淡出提示，否则看不出还有内容
   （滚动条藏了，需要别的线索告诉用户「下面还有」） */
@media (min-width: 861px) {
  #sidebar > nav {
    mask-image: linear-gradient(to bottom, transparent 0, #000 10px,
                #000 calc(100% - 14px), transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 10px,
                #000 calc(100% - 14px), transparent 100%);
  }
}
