:root {
  --bg: #f3f5f9;
  --card: #ffffff;
  --ink: #1b2434;
  --ink2: #3d4a5e;
  --muted: #74809a;
  --line: #e5e9f1;
  --line2: #eef1f6;
  --brand: #1e3050;
  --accent: #2f6bff;
  --in: #0f9d6b;
  --in-bg: #e8f7f0;
  --out: #e07338;
  --out-bg: #fdf0e7;
  --ret: #8a63d2;
  --ret-bg: #f2edfb;
  --warn: #d64545;
  --warn-bg: #fdeaea;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 32, 56, .04), 0 6px 18px rgba(20, 32, 56, .05);
}

* { box-sizing: border-box; }

html { height: 100%; }

body {
  margin: 0; padding: 0; min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 13px/1.55 -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  -webkit-font-smoothing: antialiased;
  display: flex;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cdd5e3; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #aab6cb; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- 侧栏 ---------------- */
.side {
  width: 216px; flex: 0 0 216px;
  background: linear-gradient(180deg, #2358d8 0%, #1b3f9f 48%, #16306f 100%);
  color: #dbe7ff;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  box-shadow: 2px 0 16px rgba(22, 48, 111, .18);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px 16px; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 10px; flex: 0 0 34px;
  background: #ffffff;
  color: #1d4ed8; font-weight: 800; font-size: 16px;
  display: grid; place-items: center; letter-spacing: -1px;
  box-shadow: 0 4px 14px rgba(10, 30, 80, .28);
}
.brand b { display: block; color: #fff; font-size: 14px; letter-spacing: .5px; }
.brand small { color: #a9c1f0; font-size: 11px; }

nav { padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  color: #ffffff; text-decoration: none; font-size: 13px; font-weight: 600;
  cursor: pointer; position: relative; transition: background .15s, color .15s;
}
nav a svg {
  width: 17px; height: 17px; stroke: currentColor; fill: none;
  stroke-width: 2; opacity: 1; stroke-linecap: round; stroke-linejoin: round;
}
nav a:hover { background: rgba(255, 255, 255, .16); color: #fff; }
nav a.on { background: rgba(255, 255, 255, .24); color: #fff; font-weight: 700; }
nav a.on::before {
  content: ""; position: absolute; left: -10px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: #ffffff;
}
.side-foot {
  margin-top: auto; padding: 12px 12px 16px;
  font-size: 11px; line-height: 1.8;
}
.side-foot #dbinfo {
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .26);
  border-radius: 10px;
  padding: 10px 12px;
  color: #e8f0ff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14);
}
.side-foot .live {
  display: flex; align-items: center; gap: 6px;
  color: #b6f5d6; font-weight: 600; letter-spacing: .3px;
  margin-bottom: 5px; font-size: 11.5px;
}
.side-foot .dot-live {
  width: 6px; height: 6px; border-radius: 50%; flex: 0 0 6px;
  background: #4ade80; box-shadow: 0 0 0 3px rgba(74, 222, 128, .22);
}
.side-foot b { color: #ffffff; font-weight: 600; }
.side-foot .k { color: #c6d8fb; }

/* ---------------- 主区 ---------------- */
main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 14px 26px; background: rgba(243, 245, 249, .88);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 600; letter-spacing: .3px; }
.topbar .sub { color: var(--muted); font-size: 12px; margin-left: -6px; }
.topright { margin-left: auto; display: flex; align-items: center; gap: 10px; }

#view { padding: 20px 26px 60px; }

input, select, textarea, button { font-family: inherit; font-size: 13px; }
input[type=text], input[type=number], input[type=date], input[type=month], input[type=search], select, textarea {
  height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; padding: 8px 10px; width: 100%; resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus { border-color: #9db6ee; box-shadow: 0 0 0 3px rgba(47, 107, 255, .1); }
input::placeholder { color: #a9b3c6; }
select { padding-right: 6px; cursor: pointer; }
button {
  height: 32px; padding: 0 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink2);
  transition: all .15s; white-space: nowrap; display: inline-flex; align-items: center; gap: 5px;
}
button:hover { border-color: #c3cee4; background: #fafbfe; }
button:active { transform: translateY(1px); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500; }
button.primary:hover { background: #1f5bf0; border-color: #1f5bf0; }
/* 蓝色实心（次级动作，如「导入表格」） */
button.blue {
  background: linear-gradient(180deg, #3f7cf7 0%, #2f6bff 100%);
  border: 1px solid #2f6bff; color: #fff; font-weight: 600;
  box-shadow: 0 2px 6px rgba(47, 107, 255, .28);
}
button.blue:hover { background: linear-gradient(180deg, #2f6bff 0%, #1f5bf0 100%); border-color: #1f5bf0; }
button.blue:active { transform: translateY(1px); }
button.blue:disabled { opacity: .55; }
button.primary:disabled, button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); padding: 0 8px; }
button.ghost:hover { background: #eef2f9; color: var(--ink); }
button.danger { color: var(--warn); }
button.danger:hover { background: var(--warn-bg); border-color: #f3c9c9; }
button.sm { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 6px; }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden;
}
.card > head, .card-h {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 18px; border-bottom: 1px solid var(--line2);
}
.card-h h2, .card h2 { font-size: 13.5px; margin: 0; font-weight: 600; letter-spacing: .2px; }
.card-h .right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.card-b { padding: 16px 18px; }
.card-b.tight { padding: 0; }
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 19px; padding: 0 6px; border-radius: 20px;
  background: #eef2f9; color: var(--muted); font-size: 11px; font-weight: 600;
}
.badge.in { background: var(--in-bg); color: var(--in); }
.badge.out { background: var(--out-bg); color: var(--out); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }

/* ---------------- KPI ---------------- */
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px 13px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: #dfe5f0;
}
.kpi.in::after { background: var(--in); }
.kpi.out::after { background: var(--out); }
.kpi.net::after { background: var(--accent); }
.kpi.stock::after { background: #6b7f9e; }
.kpi.warn::after { background: var(--warn); }
.kpi .lab { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.kpi .val { font-size: 27px; font-weight: 650; line-height: 1.25; letter-spacing: -.5px; font-variant-numeric: tabular-nums; margin-top: 3px; }
.kpi .val small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.kpi .foot { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.kpi .val.neg { color: var(--warn); }
.kpi .val.pos { color: var(--in); }

/* ---------------- 表格 ---------------- */
.tw { overflow: auto; }
table { border-collapse: separate; border-spacing: 0; width: 100%; }
th, td { padding: 7px 12px; text-align: left; white-space: nowrap; }
thead th {
  position: sticky; top: 0; z-index: 2;
  background: #f8fafd; color: var(--muted); font-size: 11.5px; font-weight: 600;
  border-bottom: 1px solid var(--line); letter-spacing: .3px;
}
tbody td { border-bottom: 1px solid var(--line2); color: var(--ink2); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fafcff; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.mono { font-variant-numeric: tabular-nums; }
tfoot td { background: #f8fafd; font-weight: 600; border-top: 1px solid var(--line); color: var(--ink); }
.pname { font-weight: 500; color: var(--ink); }
.muted { color: var(--muted); }
.tiny { font-size: 11.5px; }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.dot.in { background: var(--in); }
.dot.out { background: var(--out); }
.dot.ret { background: var(--ret); }
.qty-in { color: var(--in); font-weight: 600; }
.qty-out { color: var(--out); font-weight: 600; }
.qty-ret { color: var(--ret); font-weight: 600; }
.qty-neg { color: var(--warn); font-weight: 600; }

.pill {
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px;
  border-radius: 20px; font-size: 11.5px; font-weight: 500;
}
.pill.ok { background: var(--in-bg); color: var(--in); }
.pill.warn { background: var(--out-bg); color: var(--out); }
.pill.bad { background: var(--warn-bg); color: var(--warn); }
.pill.mute { background: #eef2f9; color: var(--muted); }
.pill.ret { background: var(--ret-bg); color: var(--ret); }

.empty { padding: 34px 20px; text-align: center; color: #9aa5ba; font-size: 12.5px; }
.empty svg { display: block; margin: 0 auto 8px; opacity: .5; }

/* ---------------- 栅格 ---------------- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.grid2.w37 { grid-template-columns: 3fr 2fr; }
.grid2.w73 { grid-template-columns: 2fr 3fr; }

/* ---------------- 表单 ---------------- */
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 11.5px; color: var(--muted); }
.field.grow { flex: 1 1 160px; min-width: 120px; }
.field input, .field select { width: 100%; }

/* ---------------- 进货页 ---------------- */
.stage-list { border: 1px dashed #cdd7e8; border-radius: 10px; background: #fbfcff; }
.hint { color: var(--muted); font-size: 11.5px; margin-top: 9px; line-height: 1.7; }
.hint b { color: var(--ink2); font-weight: 600; }

/* ---------------- 上传区 ---------------- */
.drop {
  border: 1.6px dashed #c2cee3; border-radius: 14px; background: #fbfcff;
  padding: 34px 20px; text-align: center; transition: all .15s; cursor: pointer;
}
.drop:hover, .drop.over { border-color: var(--accent); background: #f4f8ff; }
.drop .ic { width: 42px; height: 42px; margin: 0 auto 10px; border-radius: 12px; background: #eaf0ff; display: grid; place-items: center; }
.drop .ic svg { width: 22px; height: 22px; stroke: var(--accent); fill: none; stroke-width: 1.8; }
.drop b { font-size: 14px; font-weight: 600; }
.drop p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }

/* ---------------- 分段控件 ---------------- */
.seg { display: inline-flex; background: #eaeef6; border-radius: 9px; padding: 3px; gap: 2px; }
.seg button {
  height: 26px; border: 0; background: transparent; color: var(--muted);
  border-radius: 7px; padding: 0 12px; font-size: 12.5px;
}
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(20, 32, 56, .1); font-weight: 500; }

.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }

/* ---------------- 矩阵表 ---------------- */
.matrix th, .matrix td { padding: 5px 6px; font-size: 11.5px; }
.matrix thead th { background: #f2f5fb; }
.matrix thead tr:nth-child(2) th { top: 28px; }
.matrix .stick {
  position: sticky; background: #fff; z-index: 3;
}
.matrix thead .stick { z-index: 4; background: #f2f5fb; }
.matrix tbody tr:hover .stick { background: #fafcff; }
.matrix tfoot .stick { background: #f8fafd; }
.matrix td.zero { color: #d3dae7; }
.matrix .col-day { border-left: 1px solid var(--line); }

/* ---------------- 弹窗 ---------------- */
.modal {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .45);
  display: grid; place-items: center; z-index: 100; padding: 20px;
  backdrop-filter: blur(2px);
}
.modal.hidden { display: none; }
.modal .box {
  background: #fff; border-radius: 14px; width: 100%; max-width: 460px;
  box-shadow: 0 24px 60px rgba(16, 24, 40, .25); overflow: hidden;
  animation: pop .16s ease-out;
}
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.modal .box-h { padding: 16px 18px 10px; font-weight: 600; font-size: 14px; }
.modal .box-b { padding: 4px 18px 6px; display: flex; flex-direction: column; gap: 12px; }
.modal .box-f { padding: 14px 18px 16px; display: flex; justify-content: flex-end; gap: 8px; }

/* ---------------- 提示 ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 20px);
  background: #1b2434; color: #fff; padding: 9px 16px; border-radius: 9px;
  font-size: 12.5px; opacity: 0; pointer-events: none; transition: all .22s; z-index: 200;
  box-shadow: 0 10px 30px rgba(16, 24, 40, .3); max-width: 70vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: #b93b3b; }

/* ---------------- 杂项 ---------------- */
.row { display: flex; align-items: center; gap: 8px; }
.mt8 { margin-top: 8px; }
.mt12 { margin-top: 12px; }
.mt16 { margin-top: 16px; }
.hidden { display: none !important; }
.spin {
  width: 14px; height: 14px; border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #fff; border-radius: 50%; animation: sp .7s linear infinite;
}
@keyframes sp { to { transform: rotate(360deg); } }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .grid2, .grid2.w37, .grid2.w73 { grid-template-columns: 1fr; }
}

/* ---- tr.sub td ---- */
tr.sub td { background: #fbfcff; font-size: 12px; color: var(--ink2); }
tr.sub:hover td { background: #f5f9ff; }


/* ---- .thumbcol ---- */
.thumbcol { width: 62px; }
.thumbcell { width: 62px; padding: 4px 2px 4px 10px; vertical-align: middle; }
.thumb {
  width: 46px; height: 46px; border-radius: 9px; overflow: hidden;
  background: #f4f7fc; border: 1.4px dashed #ccd6e6;
  display: grid; place-items: center; cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}
.thumb:hover { border-color: var(--accent); background: #eef4ff; transform: translateY(-1px); }
.thumb.has { border-style: solid; border-color: #dfe6f1; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .plus { color: #a9b3c6; font-size: 17px; line-height: 1; }
.thumb.sm {
  width: 26px; height: 26px; border-radius: 6px; border-width: 1px;
  display: inline-grid; vertical-align: -8px; margin-right: 8px;
}
.thumb.sm .plus { font-size: 12px; }
td.pname .thumb.sm { flex: 0 0 auto; }

/* ---- .chk ---- */
.chk {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted); cursor: pointer; user-select: none;
  padding: 0 2px;
}
.chk input { width: 13px; height: 13px; accent-color: var(--accent); cursor: pointer; }
.chk:hover { color: var(--ink2); }

/* ---- .grid2.same ---- */
.grid2.same { align-items: stretch; }
.card.fixed {
  height: 380px;
  display: flex; flex-direction: column; overflow: hidden;
}
.card.fixed > .card-h { flex: 0 0 auto; }
.card.fixed > .card-b {
  flex: 1 1 auto; min-height: 0; overflow: auto;
}
.card.fixed > .card-b > .tw { max-height: none !important; overflow: visible; }
.card.fixed > .card-b > table { width: 100%; }

/* 内容少的时候垂直居中，别都挤在顶部 */
.card.fixed > .card-b.center {
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; padding: 10px 16px;
}
.card.fixed > .card-b.center > table { width: 100%; }
.card.fixed > .card-b.center > svg { width: 100%; height: auto; max-height: 100%; }
.card.fixed tfoot td { position: sticky; bottom: 0; }

/* ---- .card.fixed .toplist th ---- */
.card.fixed .toplist th { padding: 6px 12px; }
.card.fixed .toplist td { padding: 4px 12px; font-size: 12.5px; }
.card.fixed .toplist .pname { max-width: 130px; overflow: hidden; text-overflow: ellipsis; }

/* ---- .card.tone-in ---- */
.card.tone-in   { --tone: #199a6b; }
.card.tone-out  { --tone: #dd7736; }
.card.tone-top  { --tone: #3f6bd2; }
.card.tone-warn { --tone: #d3524d; }
.card.tone-ret  { --tone: #8a5cd0; }

.card[class*="tone-"] > .card-h:not(.sub) {
  background: var(--tone);                    /* 老浏览器兜底 */
  background: linear-gradient(180deg, var(--tone) 0%, color-mix(in srgb, var(--tone) 86%, #000) 100%);
  border-bottom: 1px solid var(--tone);
}
.card[class*="tone-"] > .card-h.sub {
  background: #f8fafd;
  border-top: 1px solid var(--line2);
}
.card[class*="tone-"] > .card-h:not(.sub) h2 { color: #fff; letter-spacing: .3px; }
.card[class*="tone-"] > .card-h:not(.sub) .dot { background: rgba(255, 255, 255, .92) !important; }
.card[class*="tone-"] > .card-h:not(.sub) .badge {
  background: rgba(255, 255, 255, .22); color: #fff; font-weight: 600;
}
.card[class*="tone-"] > .card-h:not(.sub) .muted,
.card[class*="tone-"] > .card-h:not(.sub) .tiny { color: rgba(255, 255, 255, .85) !important; }

/* 进货页的「退货录入」：页头改成浅紫，和下面的表头同色系 */
.card.tone-ret > .card-h:not(.sub) {
  background: linear-gradient(180deg, #f7f2fd 0%, #f0e9fb 100%);
  border-bottom: 1px solid #e3d8f7;
}
.card.tone-ret > .card-h:not(.sub) h2 { color: #5f3fa8; }
.card.tone-ret > .card-h:not(.sub) .muted,
.card.tone-ret > .card-h:not(.sub) .tiny { color: #8b72c0 !important; }

/* 左列两张卡竖着叠 */
.stack { display: flex; flex-direction: column; }
.stack > .card:last-child { margin-bottom: 0; }

/* 右列卡片拉满整行高度，列表在卡片内滚动 */
.grid2.stretch { align-items: stretch; }
.card.stretch { display: flex; flex-direction: column; }
.card.stretch > .card-h { flex: 0 0 auto; }
.card.stretch > .card-b { flex: 1 1 auto; min-height: 0; overflow: auto; }
.card.stretch > .card-b > .tw { max-height: none !important; overflow: visible; }

/* 表头跟着卡片主题上色 */
.card.tbl-in > .card-b thead th {
  background: #e9f7f1; color: #0d7a55;
  border-bottom: 1px solid #cbe9db;
}
.card.tone-ret > .card-b thead th {
  background: #f3eefc; color: #6b46b8;
  border-bottom: 1px solid #ded0f5;
}
.card.tbl-in > .card-b tbody tr:hover td { background: #f7fcfa; }
.card.tone-ret > .card-b tbody tr:hover td { background: #faf7ff; }

/* ---- 导入表头提示 ---- */
.import-hint { margin-top: 7px; }
.import-hint code {
  display: inline-block; margin: 0 2px; padding: 1px 7px;
  background: #eef2f9; border: 1px solid #e2e8f2; border-radius: 5px;
  font-family: inherit; font-size: 11px; color: var(--ink2); font-weight: 500;
}
/* 空清单里的表头示例 */
.demo-box { padding: 16px 18px; text-align: left; }
.demo-table {
  width: auto; border-collapse: separate; border-spacing: 0;
  border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
  background: #fff;
}
.demo-table th, .demo-table td { padding: 6px 16px; font-size: 12px; }
.demo-table th {
  background: #eef2f9; color: var(--ink2); font-weight: 600;
  border-bottom: 1px solid var(--line);
}
.demo-table td { border-bottom: 1px solid var(--line2); color: var(--ink2); }
.demo-table tbody tr:last-child td { border-bottom: none; }

/* ---------------- 可搜索的产品下拉 ---------------- */
.combo { position: relative; }
.combo > .combo-in {
  width: 100%; height: 32px; padding: 0 26px 0 10px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s;
}
.combo > .combo-in:focus { border-color: #9db6ee; box-shadow: 0 0 0 3px rgba(47, 107, 255, .1); }
.combo > .combo-in::placeholder { color: #a9b3c6; font-size: 12px; }
.combo > .caret {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  font-size: 9px; color: #a9b3c6; pointer-events: none;
}
.combo-pop {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 60;
  max-height: 268px; overflow: auto; background: #fff;
  border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 12px 30px rgba(20, 32, 56, .16);
}
.combo-pop.hidden { display: none; }
.combo-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; cursor: pointer; font-size: 12.5px; line-height: 1.4;
}
.combo-item:hover, .combo-item.active { background: #eef4ff; }
.combo-item .ci-name {
  flex: 1; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.combo-item .ci-py { color: #b3bccd; font-size: 11px; letter-spacing: .3px; }
.combo-item .ci-sub { color: var(--muted); font-size: 11.5px; min-width: 40px; text-align: right; }
.combo-item.none { color: #9aa5ba; cursor: default; }
.combo-item.none:hover { background: #fff; }

/* ---------------- 可点击的 KPI 卡 ---------------- */
.kpi.clickable { cursor: pointer; transition: box-shadow .16s, transform .16s; }
.kpi.clickable:hover {
  box-shadow: 0 8px 22px rgba(20, 32, 56, .12);
  transform: translateY(-2px);
}
.kpi.clickable:active { transform: translateY(0); }
.kpi.clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.kpi .more {
  margin-left: auto; font-size: 11px; color: var(--accent);
  opacity: 0; transform: translateX(-4px); transition: all .16s;
}
.kpi.clickable:hover .more { opacity: 1; transform: translateX(0); }

/* 明细弹窗 */
.modal .box.lg { max-width: 780px; }
.modal .box.lg .box-h { border-bottom: 1px solid var(--line2); padding-bottom: 12px; }
.modal .box.lg .box-b { padding: 0; }
.modal .box.lg .tw { border-radius: 0 0 14px 14px; }
.modal .box.lg .empty { padding: 40px 20px; }

/* 弹窗标题栏：导出按钮靠右 */
.modal .box-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.modal .box-h b { font-size: 14px; }
.modal .box-h .tiny { flex: 1 1 auto; }


/* ---------------- 登录页 ---------------- */
.auth-mask {
  position: fixed; inset: 0; z-index: 500;
  background: linear-gradient(160deg, #2358d8 0%, #1b3f9f 45%, #142a66 100%);
  display: grid; place-items: center; padding: 20px;
}
.auth-box {
  width: 100%; max-width: 360px; background: #fff; border-radius: 16px;
  padding: 26px 26px 22px; box-shadow: 0 24px 60px rgba(8, 24, 60, .35);
}
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.auth-brand .logo {
  width: 38px; height: 38px; border-radius: 11px; flex: 0 0 38px;
  background: linear-gradient(135deg, #3f7cf7, #2f6bff); color: #fff;
  font-weight: 800; font-size: 17px; display: grid; place-items: center;
  box-shadow: 0 6px 16px rgba(47, 107, 255, .35);
}
.auth-brand b { display: block; font-size: 15px; color: var(--ink); }
.auth-brand small { color: var(--muted); font-size: 11.5px; }
.auth-box h3 { font-size: 13.5px; font-weight: 600; color: var(--ink2); margin: 0 0 14px; }
.auth-box .field { margin-bottom: 12px; }
.auth-box .field label { font-size: 11.5px; color: var(--muted); }
.auth-box input { width: 100%; height: 36px; }
.auth-box button { width: 100%; height: 38px; margin-top: 4px; }
.auth-err { color: var(--warn); font-size: 12px; min-height: 16px; margin-bottom: 6px; }
.auth-tip { margin-top: 12px; font-size: 11px; color: #9aa5ba; line-height: 1.6; }

/* 侧栏里的当前用户 */
.side-user {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 2px 10px; margin-bottom: 8px;
  border-bottom: 1px dashed rgba(255, 255, 255, .18);
}
.side-user .avatar {
  width: 26px; height: 26px; border-radius: 50%; flex: 0 0 26px;
  background: rgba(255, 255, 255, .9); color: #1d4ed8;
  font-weight: 700; font-size: 12px; display: grid; place-items: center;
}
.side-user .uinfo { flex: 1; min-width: 0; line-height: 1.3; }
.side-user .uinfo b {
  display: block; color: #fff; font-size: 12px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.side-user .uinfo em { font-style: normal; font-size: 10.5px; color: #b9cdf5; }
.side-user .logout {
  height: 22px; padding: 0 8px; font-size: 11px; border-radius: 6px;
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .28);
  color: #fff; cursor: pointer;
}
.side-user .logout:hover { background: rgba(255, 255, 255, .28); }


/* ---------------- 从 Excel 更新数据 ---------------- */
.card.tone-sync { --tone: #2f6bff; }
.sync-table { width: auto; min-width: 320px; border: 1px solid var(--line); border-radius: 8px; }
.sync-table th, .sync-table td { padding: 6px 16px; font-size: 12.5px; }
.sync-table thead th { background: #f8fafd; color: var(--muted); }
.sync-table tbody tr:last-child td { border-bottom: none; }
.sync-table td:first-child { color: var(--ink); font-weight: 500; }


/* 登录验证开关 */
.auth-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 12px 18px; border-bottom: 1px solid var(--line2); background: #fafcff;
}
.auth-row b { font-size: 12.5px; }
.noauth { font-style: normal; font-size: 10.5px; color: #ffd7a8; }


/* 访问密钥行 */
.auth-row.key-row { background: #f7faff; }
.auth-row code {
  background: #eef2f9; border: 1px solid #e2e8f2; border-radius: 6px;
  padding: 2px 10px; font-family: Consolas, monospace; font-size: 13px;
  letter-spacing: 1.5px; color: #1d4ed8;
}

/* 备案号页脚 */
.icp { padding: 16px 12px 28px; text-align: center; font-size: 12px; color: #8a94a6; }
.icp a { color: #8a94a6; text-decoration: none; }
.icp a:hover { color: #1d4ed8; text-decoration: underline; }
