:root {
  --bg: #f2f5f9;
  --panel: #fff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e5e9f0;
  --brand: #1d4ed8;
  --brand-2: #3b82f6;
  --brand-soft: #eff4ff;
  --green: #15803d;
  --green-soft: #e9f7ef;
  --amber: #b45309;
  --amber-soft: #fef3e2;
  --red: #b91c1c;
  --red-soft: #feecec;
  --sidebar: #0e1726;
  --sidebar-2: #16233a;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 14px rgba(15, 23, 42, .05);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  -webkit-tap-highlight-color: transparent; overscroll-behavior-y: contain;
  font: 13px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; background-clip: content-box; }

/* ============ 登录 ============ */
.login-wrap {
  min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr;
  background: linear-gradient(135deg, #0b1220 0%, #14233d 55%, #1b3a6b 100%);
}
.login-left { color: #e2e8f0; padding: 64px 72px; display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; }
.login-left::after {
  content: ""; position: absolute; width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle, rgba(59,130,246,.35), transparent 65%); right: -160px; bottom: -180px;
}
.login-left h1 { font-size: 34px; margin: 0 0 10px; letter-spacing: 1px; }
.login-left .sub { color: #93c5fd; font-size: 15px; margin-bottom: 40px; letter-spacing: 3px; }
.login-feat { display: grid; gap: 16px; max-width: 460px; position: relative; z-index: 1; }
.login-feat > div { display: flex; gap: 12px; align-items: flex-start; color: #cbd5e1; font-size: 13.5px; }
.login-feat > div > div { flex: 1; min-width: 0; }
.login-feat b { display: block; color: #f1f5f9; font-size: 13.5px; margin-bottom: 2px; }
.login-feat i {
  flex: 0 0 22px; height: 22px; border-radius: 6px; background: rgba(59,130,246,.25);
  color: #93c5fd; display: grid; place-items: center; font-style: normal; font-size: 12px; font-weight: 700;
}
.login-right { background: #fff; display: grid; place-items: center; padding: 40px; }
.login-card { width: 340px; }
.login-card h2 { margin: 0 0 6px; font-size: 22px; }
.login-logo { width: 168px; height: auto; display: block; margin: 0 0 22px; }
.login-card .tip { color: var(--muted); margin-bottom: 28px; font-size: 12.5px; }
.login-card label { display: block; font-size: 12.5px; color: var(--ink-2); margin: 0 0 6px; font-weight: 600; }
.login-card input {
  width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px;
  margin-bottom: 16px; background: #fbfcfe; transition: .15s;
}
.login-card input:focus { outline: none; border-color: var(--brand-2); background: #fff; box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.login-btn {
  width: 100%; height: 44px; border: 0; border-radius: 8px; color: #fff; font-size: 14px; font-weight: 600;
  background: linear-gradient(135deg, #2563eb, #1e40af); cursor: pointer; margin-top: 6px;
  box-shadow: 0 6px 16px rgba(37, 99, 235, .28);
}
.login-btn:hover { filter: brightness(1.06); }
.login-hint { margin-top: 20px; padding: 10px 12px; background: #f8fafc; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.login-err { color: var(--red); font-size: 12.5px; min-height: 18px; margin-bottom: 6px; }

/* ============ 布局 ============ */
.app { display: grid; grid-template-columns: 226px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--sidebar); color: #cbd5e1; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow: hidden;
}
.brand { padding: 18px 18px 14px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand-mark {
  width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center;
  background: #fff; padding: 3px; flex: 0 0 44px;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-txt b { display: block; color: #f1f5f9; font-size: 13px; letter-spacing: .2px; white-space: nowrap; }
.brand-txt span { font-size: 8px; color: #64748b; letter-spacing: .2px; white-space: nowrap; display: block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.nav { flex: 1; overflow-y: auto; padding: 10px 8px 20px; }
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: #334155; }
.nav-group { margin-bottom: 2px; }
.nav-title {
  display: flex; align-items: center; gap: 8px; padding: 9px 10px; font-size: 12px; color: #94a3b8;
  cursor: pointer; border-radius: 7px; user-select: none; font-weight: 600;
}
.nav-title:hover { color: #e2e8f0; background: rgba(255,255,255,.04); }
.nav-title .ico { font-size: 14px; width: 16px; text-align: center; opacity: .9; }
.nav-title .arw { margin-left: auto; font-size: 9px; transition: .2s; opacity: .5; }
.nav-group.open .nav-title .arw { transform: rotate(90deg); }
.nav-items { display: none; padding: 2px 0 6px; }
.nav-group.open .nav-items { display: block; }
.nav-item {
  display: block; padding: 7px 10px 7px 34px; color: #94a3b8; border-radius: 7px; font-size: 12.5px;
  cursor: pointer; position: relative; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nav-item:hover { color: #e2e8f0; background: rgba(255,255,255,.05); }
.nav-item.active { color: #fff; background: linear-gradient(90deg, rgba(37,99,235,.9), rgba(37,99,235,.55)); font-weight: 600; }
.nav-item.active::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; background: #60a5fa; border-radius: 0 3px 3px 0; }
.nav-item .dot { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 6px; height: 6px; border-radius: 50%; background: #f59e0b; }
.side-foot { padding: 12px 14px; border-top: 1px solid rgba(255,255,255,.06); font-size: 11px; color: #64748b; display: flex; justify-content: space-between; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 56px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center;
  padding: 0 22px; gap: 16px; position: sticky; top: 0; z-index: 30;
}
.topbar .crumb { color: var(--muted); font-size: 12.5px; }
.topbar .crumb b { color: var(--ink); font-weight: 600; }
.topbar .spacer { flex: 1; }
.topbar .date { color: var(--muted); font-size: 12.5px; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 5px 10px 5px 5px; border-radius: 20px; background: #f8fafc; border: 1px solid var(--line); cursor: pointer; }
.user-chip .av { width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(135deg,#3b82f6,#1d4ed8); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.user-chip .nm { font-size: 12.5px; line-height: 1.2; }
.user-chip .rl { font-size: 10.5px; color: var(--muted); }
.content { padding: 18px 22px 40px; flex: 1; }

/* ============ 通用组件 ============ */
.page-head { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 19px; margin: 0; letter-spacing: .3px; }
.page-head .desc { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.page-head .spacer { flex: 1; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.card-h h3 { margin: 0; font-size: 13.5px; font-weight: 650; }
.card-h .spacer { flex: 1; }
.card-b { padding: 14px 16px; }
.card-b.flush { padding: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 13px;
  border-radius: 7px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); cursor: pointer;
  font-size: 12.5px; font-weight: 550; white-space: nowrap; transition: .13s;
}
.btn:hover { border-color: #cbd5e1; background: #f8fafc; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 2px 8px rgba(29,78,216,.22); }
.btn.primary:hover { background: #1e40af; }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.amber { background: #d97706; border-color: #d97706; color: #fff; }
.btn.danger { color: var(--red); border-color: #fecaca; background: #fff; }
.btn.danger:hover { background: var(--red-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: #f1f5f9; }
.btn.sm { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-group { display: inline-flex; gap: 8px; flex-wrap: wrap; }

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

/* 搜索框 */
.search { position: relative; }
.search input {
  height: 34px; width: 246px; padding: 0 12px 0 33px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  font-size: 13px; color: var(--ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.search input::placeholder { color: #9aa6b6; }
.search input:hover { border-color: #cbd5e1; }
.search input:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(59, 130, 246, .12); }
.search::before {
  content: ""; position: absolute; left: 11px; top: 50%; width: 14px; height: 14px;
  transform: translateY(-50%); pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") center / 14px no-repeat;
}

/* 下拉选择 */
.toolbar select, select.filter, .date-range select {
  appearance: none; -webkit-appearance: none;
  height: 34px; padding: 0 30px 0 12px;
  border: 1px solid var(--line); border-radius: 8px; background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  font-size: 12.5px; color: var(--ink-2); cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.toolbar select:hover, select.filter:hover, .date-range select:hover {
  border-color: #cbd5e1; background-color: #f8fafc;
}
.toolbar select:focus, select.filter:focus, .date-range select:focus {
  outline: none; border-color: var(--brand-2); background-color: #fff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .12);
}

/* 日期输入 */
input[type="date"] {
  height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
  font-size: 12.5px; color: var(--ink-2); box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  transition: border-color .15s, box-shadow .15s;
}
input[type="date"]:hover { border-color: #cbd5e1; }
input[type="date"]:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(59, 130, 246, .12); }
input[type="date"]::-webkit-calendar-picker-indicator { opacity: .45; cursor: pointer; transition: opacity .15s; }
input[type="date"]::-webkit-calendar-picker-indicator:hover { opacity: .85; }

/* 表格 */
.table-wrap { overflow: auto; border-radius: 0 0 var(--radius) var(--radius); }
table.dt { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; font-feature-settings: "tnum"; }
table.dt thead th {
  position: sticky; top: 0; z-index: 2; background: #fbfcfe; color: #6b7a90;
  font-weight: 600; font-size: 12px; letter-spacing: .4px;
  text-align: left; padding: 9px 8px; border-bottom: 1px solid #e7edf5; white-space: nowrap;
}
table.dt tbody td {
  padding: 8px 8px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; color: #1f2937;
  letter-spacing: .01em; white-space: nowrap;
}
table.dt tbody tr:last-child td { border-bottom: 0; }
table.dt tbody tr.clickable { cursor: pointer; }
table.dt tbody tr.clickable:hover td,
table.dt tbody tr:hover td { background: #f8fafc; }
table.dt tbody td:first-child { color: #0f172a; font-weight: 500; }
table.dt td.num, table.dt th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.dt tbody td.num { color: #0f172a; font-weight: 500; }
table.dt td.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; font-weight: 500; color: #0f172a; letter-spacing: -.02em; }
table.dt tfoot td { padding: 9px 12px; background: #fbfcfe; font-weight: 650; border-top: 1px solid #e7edf5; color: #0f172a; }
.t-right { text-align: right; }
.t-center { text-align: center; }
.nowrap { white-space: nowrap; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11.5px; line-height: 1.6;
  background: #f1f5f9; color: #475569; white-space: nowrap; font-weight: 550;
}
.badge.b-blue { background: var(--brand-soft); color: #1d4ed8; }
.badge.b-green { background: var(--green-soft); color: var(--green); }
.badge.b-amber { background: var(--amber-soft); color: var(--amber); }
.badge.b-red { background: var(--red-soft); color: var(--red); }
.badge.b-gray { background: #f1f5f9; color: #64748b; }
.badge.b-purple { background: #f3e8ff; color: #7e22ce; }

.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty .ico { font-size: 30px; opacity: .35; margin-bottom: 8px; }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.kpi {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi .lbl { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.kpi .val { font-size: 23px; font-weight: 700; margin-top: 6px; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.kpi .val small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.kpi .sub { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.kpi .bar { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand-2); }
.kpi.k-green .bar { background: var(--green); }
.kpi.k-amber .bar { background: #f59e0b; }
.kpi.k-red .bar { background: #ef4444; }
.kpi.k-purple .bar { background: #8b5cf6; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-2-1 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; }

/* 简易柱状图 */
.chart-bars { display: flex; align-items: flex-end; gap: 14px; height: 170px; padding: 10px 4px 0; }
.chart-bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart-bar .bar {
  width: 100%; max-width: 46px; border-radius: 5px 5px 2px 2px; background: linear-gradient(180deg, #60a5fa, #2563eb);
  min-height: 3px; transition: .3s; position: relative;
}
.chart-bar .bar:hover { filter: brightness(1.1); }
.chart-bar .bar span { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.chart-bar .lb { font-size: 11px; color: var(--muted); }

.rank-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 8px 0; align-items: center; }
.rank-row .nm { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row .vl { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rank-row .track { grid-column: 1 / -1; height: 6px; border-radius: 4px; background: #f1f5f9; overflow: hidden; }
.rank-row .fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg,#60a5fa,#2563eb); }

.list-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed #eef2f7; }
.list-row:last-child { border-bottom: 0; }
.list-row .main { flex: 1; min-width: 0; }
.list-row .t1 { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .t2 { font-size: 11px; color: var(--muted); margin-top: 1px; }
.list-row .end { text-align: right; font-size: 12px; white-space: nowrap; }

.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.quick {
  border: 1px dashed var(--line); border-radius: 10px; padding: 20px 12px; text-align: center; cursor: pointer;
  transition: .15s; background: #fcfdff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 9px; min-height: 98px;
}
.quick:hover { border-color: var(--brand-2); background: var(--brand-soft); transform: translateY(-1px); }
.quick .ico { font-size: 20px; line-height: 1; }
.quick .tx { font-size: 12.5px; margin-top: 0; color: var(--ink-2); }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 100; display: flex;
  align-items: flex-start; justify-content: center; padding: 48px 20px; overflow-y: auto;
  animation: fadeIn .14s ease;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  background: #fff; border-radius: 12px; box-shadow: 0 24px 60px rgba(15,23,42,.3); width: 640px; max-width: 100%;
  animation: pop .16s ease; display: flex; flex-direction: column; max-height: calc(100vh - 96px);
}
@keyframes pop { from { transform: translateY(8px) scale(.99); opacity: 0; } }
.modal-h { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-h h3 { margin: 0; font-size: 15px; }
.modal-h .x { margin-left: auto; border: 0; background: transparent; font-size: 20px; color: var(--muted); cursor: pointer; line-height: 1; padding: 0 4px; }
.modal-h .x:hover { color: var(--ink); }
.modal-b { padding: 18px 20px; overflow-y: auto; flex: 1; }
.modal-f { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; background: #fbfcfe; border-radius: 0 0 12px 12px; }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.fld label { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 5px; font-weight: 600; }
.fld label .req { color: var(--red); margin-left: 2px; }
.fld input, .fld select, .fld textarea {
  width: 100%; height: 36px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
  font-size: 13px; color: var(--ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.fld input::placeholder, .fld textarea::placeholder { color: #9aa6b6; }
.fld input:hover:not(:disabled), .fld select:hover, .fld textarea:hover { border-color: #cbd5e1; }
.fld select {
  appearance: none; -webkit-appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 12px;
}
.fld textarea { height: 68px; padding: 9px 11px; resize: vertical; }
.fld input:focus, .fld select:focus, .fld textarea:focus {
  outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(59, 130, 246, .12);
}
.fld input:disabled, .fld select:disabled { background: #f8fafc; color: var(--muted); box-shadow: none; cursor: not-allowed; }
.fld .hint { font-size: 11px; color: var(--muted); margin-top: 4px; }
.fld.check { display: flex; align-items: center; gap: 8px; padding-top: 22px; }
.fld.check input { width: 16px; height: 16px; }
.fld.check label { margin: 0; }

.detail-head { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 20px; margin-bottom: 16px; }
.detail-head .it .k { font-size: 11px; color: var(--muted); }
.detail-head .it .v { font-size: 13px; font-weight: 550; margin-top: 1px; }
.detail-head .it.full { grid-column: 1 / -1; }

.line-editor { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.line-editor th { background: #f8fafc; padding: 7px 8px; text-align: left; font-size: 11.5px; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); }
.line-editor td { padding: 5px 8px; border-bottom: 1px solid #f1f5f9; }
.line-editor input, .line-editor select {
  width: 100%; height: 30px; border: 1px solid var(--line); border-radius: 7px; padding: 0 9px; background: #fff;
  font-size: 12.5px; transition: border-color .15s, box-shadow .15s;
}
.line-editor input:hover:not(:disabled), .line-editor select:hover { border-color: #cbd5e1; }
.line-editor select {
  appearance: none; -webkit-appearance: none; padding-right: 24px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 7px center; background-size: 11px;
}
.line-editor input:focus, .line-editor select:focus {
  outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(59, 130, 246, .1);
}
.line-editor input:disabled { background: #f8fafc; color: var(--muted); }
.line-editor .del { color: var(--red); cursor: pointer; border: 0; background: transparent; font-size: 15px; }
.line-editor tfoot td { background: #fbfcfe; font-weight: 600; padding: 9px 8px; }
.line-total { text-align: right; font-size: 13px; padding: 10px 4px 0; color: var(--ink-2); }
.line-total b { color: var(--ink); font-size: 16px; font-variant-numeric: tabular-nums; }

.toast-wrap { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #0f172a; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 12.5px;
  box-shadow: 0 10px 30px rgba(15,23,42,.3); animation: slideIn .18s ease; max-width: 420px;
}
.toast.ok { background: #14532d; }
.toast.err { background: #7f1d1d; }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab { padding: 8px 14px; font-size: 12.5px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

.stat-line { display: flex; gap: 22px; flex-wrap: wrap; padding: 10px 0; }
.stat-line .s .k { font-size: 11.5px; color: var(--muted); }
.stat-line .s .v { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }

.alert { padding: 9px 12px; border-radius: 8px; font-size: 12.5px; background: var(--amber-soft); color: var(--amber); border: 1px solid #fde68a; }
.alert.red { background: var(--red-soft); color: var(--red); border-color: #fecaca; }
.alert.blue { background: var(--brand-soft); color: var(--brand); border-color: #bfdbfe; }

.progress { height: 6px; background: #f1f5f9; border-radius: 4px; overflow: hidden; min-width: 60px; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg,#34d399,#059669); border-radius: 4px; }
.progress.amber i { background: linear-gradient(90deg,#fbbf24,#d97706); }

.section-title { font-size: 12px; color: var(--muted); font-weight: 600; margin: 18px 0 8px; letter-spacing: .5px; }

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2-1 { grid-template-columns: 1fr; }
}
/* 手机端遮罩 */
.nav-mask { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 80; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -240px; z-index: 90; transition: left .2s ease; width: 226px; height: 100dvh; }
  .sidebar.open { left: 0; box-shadow: 8px 0 30px rgba(0, 0, 0, .35); }
  body.nav-open .nav-mask { display: block; }
  .mob-menu { display: block !important; }

  .topbar { padding: 0 12px; gap: 10px; height: 52px; }
  .topbar .date { display: none; }
  .content { padding: 12px 12px calc(26px + env(safe-area-inset-bottom)); }
  .page-head { gap: 10px; margin-bottom: 12px; }
  .page-head h1 { font-size: 17px; }
  .btn { height: 36px; padding: 0 12px; }
  .btn.sm { height: 30px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 12px; }
  .kpi .val { font-size: 19px; }
  .quick-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr !important; }
  .detail-head { grid-template-columns: 1fr 1fr; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-left { display: none; }

  .modal-mask { padding: 12px 8px; }
  .modal { max-height: calc(100dvh - 24px); }
  .modal-h { padding: 12px 14px; }
  .modal-b { padding: 14px; }
  .modal-f { padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
  .toolbar .search { flex: 1; }
  .search input { width: 100%; }
  table.dt thead th, table.dt tbody td { padding: 8px 10px; }
  .line-editor input, .line-editor select { height: 34px; }
}

/* 手机端：表格改为卡片，一行一条记录 */
@media (max-width: 700px) {
  table.dt thead { display: none; }
  table.dt, table.dt tbody, table.dt tr, table.dt td { display: block; width: 100%; }
  table.dt tr { padding: 12px 14px; border-bottom: 8px solid #eef2f7; }
  table.dt tbody tr:last-child { border-bottom: 0; }
  table.dt tbody tr.clickable:hover td { background: transparent; }
  table.dt tbody td {
    display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
    padding: 4px 0; border: 0; text-align: right; white-space: normal; font-size: 13px;
  }
  table.dt tbody td:first-child { font-weight: 650; font-size: 14px; }
  table.dt tbody td::before {
    content: attr(data-label); color: var(--muted); font-size: 12px;
    text-align: left; flex: 0 0 auto; font-weight: 400;
  }
  table.dt tbody td.no-label { justify-content: flex-end; padding-top: 10px; }
  table.dt tbody td.no-label::before { display: none; }
  table.dt tfoot td { display: block; text-align: right; padding: 8px 14px; border: 0; }
  .table-wrap { overflow: visible; }
}

/* 工作台头部：手机上标题占满一行，按钮平分 */
.dash-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.dash-head .spacer { flex: 1; }
@media (max-width: 860px) {
  .dash-head .dash-greet { flex: 1 1 100%; }
  .dash-head .spacer { display: none; }
  .dash-head .btn { flex: 1 1 0; }
}

/* 安装成 App 后（独立窗口），顶部避开刘海 */
@media (display-mode: standalone) {
  .topbar { padding-top: env(safe-area-inset-top); height: calc(56px + env(safe-area-inset-top)); }
}
@media print {
  .sidebar, .topbar, .page-head .btn-group, .toolbar { display: none !important; }
  .app { grid-template-columns: 1fr; }
  .content { padding: 0; }
  .card { box-shadow: none; border: 0; }
}


/* ============ 生产流转卡打印 ============ */
#print-card { display: none; }
@media print {
  body > *:not(#print-card) { display: none !important; }
  #print-card { display: block !important; }
  @page { size: A5 portrait; margin: 8mm; }
}

/* 日期区间筛选 */
.date-range { display: inline-flex; align-items: center; gap: 6px; }
.date-range .dr-label { font-size: 12px; color: var(--muted); }
.date-range .dr-sep { font-size: 12px; color: #94a3b8; }

@media (max-width: 860px) {
  .date-range { flex-wrap: wrap; }
}

/* ============ 可搜索下拉（物料选择） ============ */
.ss { position: relative; }
.ss-input {
  width: 100%; height: 30px; padding: 0 26px 0 9px;
  border: 1px solid var(--line); border-radius: 7px; background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 11px;
  font-size: 12.5px; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.fld .ss-input { height: 36px; padding: 0 30px 0 11px; border-radius: 8px; font-size: 13px; }
.ss-input::placeholder { color: #9aa6b6; }
.ss-input:hover { border-color: #cbd5e1; }
.ss-input:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(59, 130, 246, .12); }
.ss-panel {
  display: none; position: fixed; z-index: 600;
  min-width: 300px; max-height: 264px; overflow-y: auto;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 9px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, .16); padding: 4px;
}
.ss-item {
  display: flex; align-items: baseline; gap: 8px;
  padding: 6px 9px; border-radius: 6px; cursor: pointer; font-size: 12.5px; color: var(--ink);
  white-space: nowrap; overflow: hidden;
}
.ss-item.active, .ss-item:hover { background: #eff6ff; }
.ss-item.cur { font-weight: 600; }
.ss-item.muted { color: #94a3b8; }
.ss-label { overflow: hidden; text-overflow: ellipsis; }
.ss-sub { margin-left: auto; color: #94a3b8; font-size: 11.5px; flex: 0 0 auto; }
.ss-empty { padding: 12px; color: #94a3b8; font-size: 12px; text-align: center; }

/* ============ 左侧分类树 ============ */
.side-tree {
  width: 196px; flex: 0 0 196px; align-self: flex-start;
  position: sticky; top: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); overflow: hidden;
}
.st-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 12px 9px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfdff, #f6f9ff);
}
.st-title { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .4px; }
.st-total {
  font-size: 11px; color: var(--muted); background: var(--brand-soft);
  color: var(--brand); padding: 1px 7px; border-radius: 999px; font-weight: 600;
}
.st-list { padding: 6px; max-height: calc(100vh - 240px); overflow: auto; }
.st-list::-webkit-scrollbar { width: 6px; }
.st-list::-webkit-scrollbar-thumb { background: #dbe3ee; border-radius: 6px; }
.st-row {
  display: flex; align-items: center; gap: 6px; justify-content: space-between;
  padding: 6px 8px; margin-bottom: 1px; border-radius: 8px; cursor: pointer;
  color: var(--ink-2); font-size: 12.5px; line-height: 1.35;
  transition: background .12s ease, color .12s ease;
}
.st-row:hover { background: #f4f7fd; }
.st-row .st-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-row .st-count { font-size: 11px; color: #9aa7b8; flex: 0 0 auto; }
.st-all { font-weight: 600; color: var(--ink); }
.st-cat { font-weight: 600; margin-top: 4px; }
.st-cat .st-label::before { content: none; }
.st-cat { align-items: center; }
.st-sub { padding-left: 22px; color: var(--muted); }
.st-sub .st-label::before {
  content: ""; display: inline-block; width: 4px; height: 4px; border-radius: 50%;
  background: #cbd5e1; margin-right: 8px; vertical-align: 2px;
}
.st-row.active {
  background: var(--brand-soft); color: var(--brand); font-weight: 600;
  box-shadow: inset 3px 0 0 var(--brand);
}
.st-row.active .st-count { color: var(--brand); }
.st-row.active .st-label::before { background: var(--brand); }
.st-sub.active::before { content: ""; position: absolute; left: 0; width: 3px; }
.st-sub { position: relative; }

/* 分类树：二级用正常字色、一级可折叠 */
.st-sub { color: var(--ink-2); font-weight: 400; }
.st-chevron, .st-chevron-empty {
  position: absolute; left: 7px; top: 50%; width: 14px; text-align: center;
  font-size: 12px; line-height: 1; transform: translateY(-50%);
}
.st-chevron {
  color: #7c8da6; transition: transform .15s ease, color .15s ease; cursor: pointer; user-select: none;
}
.st-chevron.open { transform: translateY(-50%) rotate(90deg); }
.st-row:hover .st-chevron { color: var(--brand); }

.st-cat, .st-all { position: relative; padding-left: 26px; }

/* 名称列过长时省略 */
table.dt td.ellipsis { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.dt th.ellipsis { white-space: nowrap; }

/* 名称列：尽量拉宽，超长才省略 */
table.dt td.name-col { max-width: 250px; }

table.dt td.batch-col { max-width: 96px; }
table.dt td.ref-col { max-width: 132px; }

/* 报价单明细：紧凑输入框 */
.modal .line-editor td { padding: 6px 4px; }
.modal .line-editor th { padding: 6px 4px; font-size: 11px; }
.modal .line-editor input { width: 100%; min-width: 46px; }

/* AI 助手 */
.ai-fab { position: fixed; right: 22px; bottom: 22px; width: 54px; height: 54px; border-radius: 50%;
  background: #fff; border: 1px solid #e2e8f0; padding: 0; cursor: pointer; z-index: 60;
  display: grid; place-items: center; box-shadow: 0 6px 18px rgba(15,23,42,.14), 0 1px 3px rgba(15,23,42,.10);
  transition: transform .18s ease, box-shadow .18s ease; }
.ai-fab:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 12px 26px rgba(15,23,42,.20); }
.ai-fab-logo { width: 32px; height: 32px; object-fit: contain; }
.ai-fab-dot { position: absolute; right: 6px; bottom: 6px; width: 10px; height: 10px; border-radius: 50%;
  background: linear-gradient(135deg,#22c55e,#16a34a); border: 2px solid #fff; }
.ai-panel { position: fixed; right: 22px; bottom: 88px; width: 380px; height: 520px; background: #fff;
  border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 40px rgba(15,23,42,.18);
  display: flex; flex-direction: column; overflow: hidden; z-index: 61; }
.ai-panel.hidden { display: none; }
.ai-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.ai-head b { font-size: 13px; }
.ai-close { margin-left: auto; border: 0; background: none; font-size: 18px; color: #94a3b8; cursor: pointer; }
.ai-list { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: #f8fafc; }
.ai-msg { max-width: 86%; padding: 8px 10px; border-radius: 10px; font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.ai-msg.me { align-self: flex-end; background: #2563eb; color: #fff; }
.ai-msg.bot { align-self: flex-start; background: #fff; border: 1px solid var(--line); }
.ai-msg.err { color: #b91c1c; border-color: #fecaca; background: #fef2f2; }
.ai-foot { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.ai-input { flex: 1; resize: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 12.5px; font-family: inherit; }
.ai-send { align-self: flex-end; }
.ai-table { border-collapse: collapse; width: 100%; margin: 4px 0; font-size: 11.5px; }
.ai-table th, .ai-table td { border: 1px solid var(--line); padding: 3px 5px; text-align: left; }
.ai-table th { background: #f1f5f9; font-weight: 600; }
.md { font-size: 13px; line-height: 1.75; }
.md-h { font-weight: 700; font-size: 13.5px; margin: 10px 0 4px; color: #0f172a; }
.md-ul { margin: 4px 0 6px 18px; padding: 0; }
.md-ul li { margin: 2px 0; }
.ai-draft { margin-top: 8px; padding: 9px 10px; border: 1px solid #bfdbfe; border-radius: 9px;
  background: #eff6ff; white-space: normal; }
.ai-draft-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 12.5px; color: #1e3a8a; }
.ai-draft-badge { padding: 1px 5px; border-radius: 4px; background: #2563eb; color: #fff; font-size: 10px; font-weight: 600; }
.ai-draft-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  padding: 1px 0; font-size: 11.5px; color: #475569; line-height: 1.5; }
.ai-draft-row b { font-weight: 600; color: #0f172a; text-align: right; word-break: break-all; }
.ai-draft-k { flex: 0 0 auto; color: #64748b; }
.ai-draft-total { margin-top: 6px; padding-top: 6px; border-top: 1px dashed #bfdbfe; font-size: 11.5px; color: #1e3a8a; }
.ai-draft-open { width: 100%; margin-top: 8px; }

/* 日志筛选栏 */
.log-filters { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.lf-search { position: relative; flex: 0 0 300px; display: flex; align-items: center; }
.lf-ico { position: absolute; left: 10px; font-size: 12px; opacity: .55; pointer-events: none; }
.lf-search input[type=search] { width: 100%; height: 34px; border: 1px solid #e2e8f0; border-radius: 9px;
  padding: 0 12px 0 30px; font-size: 12.5px; background: #f8fafc; outline: none; transition: .15s; }
.lf-search input[type=search]:focus { background: #fff; border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.lf-dates { display: flex; align-items: center; gap: 8px; }
.lf-field { display: flex; align-items: center; gap: 6px; }
.lf-field > span { font-size: 11.5px; color: #94a3b8; }
.lf-field input[type=date] { height: 34px; border: 1px solid #e2e8f0; border-radius: 9px; padding: 0 10px;
  font-size: 12.5px; color: #334155; background: #f8fafc; outline: none; }
.lf-field input[type=date]:focus { background: #fff; border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.lf-sep { color: #cbd5e1; font-size: 12px; }
.lf-reset { height: 34px; padding: 0 14px; border-radius: 9px; border: 1px solid #e2e8f0; background: #fff;
  color: #475569; font-size: 12.5px; cursor: pointer; transition: .15s; }
.lf-reset:hover { background: #f1f5f9; border-color: #cbd5e1; color: #0f172a; }
.lf-count { margin-left: auto; font-size: 12px; color: #64748b; background: #f1f5f9; border-radius: 999px; padding: 4px 12px; }

/* 工具栏重置按钮 */
.btn-reset { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 12px;
  border: 1px solid transparent; border-radius: 8px; background: transparent; color: #64748b;
  font-size: 12.5px; cursor: pointer; transition: .15s; }
.btn-reset:hover { background: #eef2f7; color: #0f172a; border-color: #e2e8f0; }
.btn-reset:active { transform: translateY(1px); }
.btn-reset .ico { font-size: 13px; line-height: 1; }
.toolbar-count { font-size: 12px; color: #64748b; background: #f1f5f9; border-radius: 999px; padding: 4px 12px; }
.filter-sep { color: #cbd5e1; font-size: 12px; }

table.dt td.detail-col { max-width: 520px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.dt tbody tr { cursor: pointer; }
.lg-card { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.lg-row { display: flex; gap: 12px; padding: 4px 0; font-size: 13px; }
.lg-k { width: 60px; color: #94a3b8; flex: none; }
.lg-v { color: #0f172a; }
.lg-list { margin: 6px 0 0 18px; padding: 0; }
.lg-list li { font-size: 13px; line-height: 1.9; color: #334155; }
.lg-detail { font-size: 13px; line-height: 1.8; color: #334155; white-space: pre-wrap; }

/* 报价单总成分组 */
.q-group-head td { background: #eef2f7; border-top: 1px solid #cbd5e1; border-bottom: 1px solid #cbd5e1; padding: 7px 8px !important; }
.q-chevron { display: inline-block; width: 16px; cursor: pointer; color: #475569; font-size: 12px; }
.q-gname { margin-left: 8px; color: #475569; font-size: 12px; }
.q-gmeta { margin-left: 10px; color: #64748b; font-size: 11.5px; }
.q-gtotal { margin-left: 12px; color: #1d4ed8; font-size: 12px; }
.q-gadd { margin-left: 12px; }

/* 报价单：分组表头 + 粘性表头 */
.quote-table-wrap { max-height: 60vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.quote-table-wrap table.line-editor { border-collapse: separate; border-spacing: 0; }
.quote-table-wrap thead th { position: sticky; top: 0; z-index: 3; background: #f1f5f9; }
.quote-table-wrap thead tr.q-groups th { top: 0; height: 26px; font-size: 11px; color: #475569; background: #e2e8f0; border-bottom: 1px solid #cbd5e1; }
.quote-table-wrap thead tr:nth-child(2) th { top: 26px; z-index: 2; }
.quote-table-wrap td { background: #fff; }

/* 报价单行内展开明细 */
.q-detail-row td { background: #f8fafc !important; padding: 8px 10px !important; }
.q-detail-grid { display: grid; grid-template-columns: repeat(4, minmax(180px, 1fr)); gap: 12px; }
.q-detail-title { font-size: 12px; font-weight: 600; color: #334155; margin-bottom: 4px; }
.q-detail-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.q-detail-table th, .q-detail-table td { border: 1px solid #e2e8f0; padding: 2px 4px; text-align: left; }
.q-detail-table th { background: #eef2f7; color: #475569; font-weight: 600; }
.q-detail-empty { font-size: 11.5px; color: #94a3b8; }

/* 报价单行首展开按钮 + 列宽拖拽 */
.q-expand-col { width: 30px; }
.q-td-toggle { width: 30px; text-align: center; padding: 0 !important; }
.q-row-toggle { border: none; background: transparent; cursor: pointer; color: #475569; font-size: 12px; padding: 2px 4px; }
.q-row-toggle:hover { color: #1d4ed8; }
.quote-table-wrap thead th { cursor: col-resize; }
.quote-table-wrap thead th:hover { background: #e2e8f0; }

/* 展开明细不撑宽弹窗 */
.q-detail-row > td { max-width: 0; }
.q-detail-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1.5fr); min-width: 0; }
.q-detail-sec { min-width: 0; overflow-x: auto; }
.q-detail-sec > div:last-child { margin-top: 6px; }

/* 行首展开按钮更醒目 */
.q-td-toggle { width: 34px; padding: 0 4px !important; }
.q-row-toggle {
  width: 23px; height: 23px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid #94a3b8; border-radius: 6px;
  background: #fff; color: #1d4ed8; font-size: 13px; font-weight: 700;
  cursor: pointer; transition: all .12s ease;
}
.q-row-toggle:hover { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }

/* 登录验证码 */
.cap-row { display: flex; gap: 10px; align-items: center; }
.cap-img { cursor: pointer; border: 1px solid #d7dde7; border-radius: 8px; overflow: hidden; background: #f4f6fa; line-height: 0; }
.cap-img svg { display: block; }
.cap-row input { flex: 1; letter-spacing: 3px; text-transform: uppercase; }

/* 验证码行对齐修正 */
.login-card .cap-row { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.login-card .cap-row .cap-img { flex: 0 0 auto; height: 42px; display: flex; align-items: center; border-radius: 8px; }
.login-card .cap-row .cap-img svg { height: 42px; width: auto; display: block; }
.login-card .cap-row input { flex: 1 1 auto; width: auto; height: 42px; margin-bottom: 0; }

/* 滑块/点选验证码 */
.cap-hint { font-size: 12px; color: #64748b; margin-bottom: 6px; }
.cap-stage { position: relative; border: 1px solid #d7dde7; border-radius: 8px; overflow: hidden; line-height: 0; user-select: none; }
.cap-stage svg { display: block; width: 100%; height: auto; }
.cap-line { position: absolute; top: 0; bottom: 0; width: 2px; background: #c8102e; box-shadow: 0 0 0 1px rgba(255,255,255,.7); pointer-events: none; }
.cap-range { width: 100%; margin: 10px 0 4px; }
.cap-dots { font-size: 12px; color: #64748b; min-height: 16px; }
.cap-dot { position: absolute; width: 20px; height: 20px; margin-left: -10px; margin-top: -10px; border-radius: 50%; background: #1d4ed8; color: #fff; font-size: 11px; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.cap-refresh { display: inline-block; margin-top: 6px; font-size: 12px; color: #1d4ed8; cursor: pointer; }

/* 记住我 */
.remember-row { display: flex; align-items: center; gap: 6px; margin: 4px 0 12px; font-size: 12.5px; color: #475569; cursor: pointer; font-weight: 400; }
.remember-row input { width: 14px; height: 14px; margin: 0; }

/* 记住我 与上方元素留白 */
.remember-row { margin-top: 10px; }
.cap-refresh { margin-bottom: 2px; }

/* 滑块拼图块 */
.cap-piece { position: absolute; border: 2px solid rgba(255,255,255,.95); border-radius: 6px; background: rgba(37,99,235,.35); box-shadow: 0 0 0 2px rgba(15,23,42,.25), 0 2px 6px rgba(0,0,0,.25); pointer-events: none; transition: left .04s linear; }

/* 验证码卡片与滑块外观 */
.cap-card { background: #fff; border: 1px solid #e6ebf3; border-radius: 14px; padding: 12px 12px 10px; box-shadow: 0 4px 14px rgba(15,23,42,.05); margin-bottom: 14px; }
.cap-card .cap-hint { font-size: 12px; color: #64748b; margin: 0 0 8px; }
.cap-card .cap-stage { border-radius: 10px; border-color: #e2e8f0; }
.cap-slider { position: relative; margin: 12px 0 6px; }
.cap-slider input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 40px; background: #eef2f8; border-radius: 10px; outline: none; margin: 0; cursor: pointer; }
.cap-slider input[type=range]::-webkit-slider-runnable-track { height: 40px; border-radius: 10px; background: linear-gradient(90deg,#e8eefb,#eef2f8); border: 1px solid #e2e8f0; }
.cap-slider input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 46px; height: 40px; border-radius: 10px; background: linear-gradient(135deg,#3b82f6,#1d4ed8); border: 1px solid #1e40af; box-shadow: 0 2px 6px rgba(29,78,216,.35); margin-top: -1px; background-image: linear-gradient(135deg,#3b82f6,#1d4ed8), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 6l6 6-6 6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: center, center; background-size: auto, 18px 18px; }
.cap-slider input[type=range]::-moz-range-track { height: 40px; border-radius: 10px; background: #eef2f8; border: 1px solid #e2e8f0; }
.cap-slider input[type=range]::-moz-range-thumb { width: 46px; height: 40px; border-radius: 10px; background: #1d4ed8; border: 1px solid #1e40af; }
.cap-slider-text { position: absolute; left: 54px; right: 12px; top: 0; height: 40px; display: flex; align-items: center; justify-content: center; font-size: 12.5px; color: #64748b; pointer-events: none; transition: opacity .15s; }
.cap-slider.slid .cap-slider-text { opacity: 0; }
.cap-card .cap-dots { margin-top: 4px; }
.cap-foot { display: flex; justify-content: flex-end; margin-top: 6px; }
.cap-card .cap-refresh { font-size: 12px; color: #1d4ed8; }

/* 滑块细节修正：箭头图标置顶、压缩空白 */
.cap-slider input[type=range]::-webkit-slider-thumb {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%23ffffff' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 5l7 7-7 7'/%3E%3C/svg%3E"), linear-gradient(135deg,#3b82f6,#1d4ed8);
  background-repeat: no-repeat, no-repeat;
  background-position: center, center;
  background-size: 18px 18px, auto;
}
.cap-card .cap-dots { min-height: 0; margin: 2px 0 0; }
.cap-card .cap-foot { margin-top: 2px; }
.cap-slider { margin: 10px 0 2px; }

/* 手机端登录页适配 */
@media (max-width: 860px) {
  .login-wrap { padding: 18px 14px calc(20px + env(safe-area-inset-bottom)); }
  .login-card { padding: 20px 16px !important; border-radius: 14px; }
  .login-logo { width: 112px !important; margin-bottom: 6px !important; }
  .login-card h2 { font-size: 20px; }
  .cap-card { padding: 10px !important; }
  .cap-stage { width: 100% !important; max-width: 100% !important; }
  .cap-stage svg { width: 100% !important; height: auto !important; }
  .cap-hint { font-size: 11.5px; }
  .cap-slider-text { font-size: 11.5px; left: 50px; }
  .login-hint { font-size: 11.5px; }
  .remember-row { font-size: 12px; }
  .login-btn { height: 46px; }
}

/* 手机端禁止横向溢出 */
@media (max-width: 860px) {
  html, body { overflow-x: hidden; max-width: 100%; }
  .login-wrap, .login-right, .login-card { width: 100%; max-width: 100%; box-sizing: border-box; }
  .cap-stage { width: 100% !important; box-sizing: border-box; }
}

/* 拼图块与 SVG 缺口保持同尺寸（含边框） */
.cap-piece { box-sizing: border-box; }

/* ===== 手机端：抽屉导航与安全区适配（iOS/Android 通用） ===== */
.side-close { display: none; }
@media (max-width: 860px) {
  .sidebar { width: 82vw; max-width: 320px; left: -100vw; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .sidebar.open { left: 0; }
  .side-close {
    display: flex; align-items: center; justify-content: center;
    position: absolute; right: 10px; top: calc(10px + env(safe-area-inset-top));
    width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,.12);
    color: #e2e8f0; font-size: 15px; z-index: 5; cursor: pointer;
  }
  .side-close:active { background: rgba(255,255,255,.22); }
  .brand { padding: 16px 18px 12px; }
  .topbar {
    height: calc(52px + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
    background: rgba(255,255,255,.98);
    -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  .nav-mask { z-index: 85; }
  .sidebar { z-index: 90; }
  /* 防止 iOS 聚焦输入框时自动放大 */
  input, select, textarea { font-size: 16px !important; }
  .line-editor input, .line-editor select { font-size: 14px !important; }
  /* 触摸手感 */
  button, .btn, .nav-item, .nav-title, .tab { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
  .content { -webkit-overflow-scrolling: touch; }
}

/* 滑块拼图块去掉过渡，拖动零延迟 */
.cap-piece { transition: none !important; }

/* 独立窗口：状态栏改为不透明，避免顶部内容透出模糊 */
@media (display-mode: standalone) {
  html { background: #fff; }
  .topbar { background: #fff !important; }
}

/* 独立窗口：状态栏区域铺白，彻底盖住透出的内容 */
@media (display-mode: standalone) {
  html, body { background: #fff !important; }
  body::before {
    content: ''; position: fixed; top: 0; left: 0; right: 0;
    height: env(safe-area-inset-top); background: #fff; z-index: 9999; pointer-events: none;
  }
}

/* 独立窗口：整体下移一个安全区，登录页也不与状态栏重叠 */
@media (display-mode: standalone) {
  body { padding-top: env(safe-area-inset-top); }
  body::before { height: env(safe-area-inset-top); }
  .topbar { padding-top: 0 !important; height: 52px !important; }
  .login-wrap { padding-top: 0 !important; }
}

/* 手机端登录页：纯白全屏，去掉深色背景与卡片阴影（避免边缘发暗/发糊） */
@media (max-width: 860px) {
  .login-wrap { background: #fff !important; display: block !important; min-height: 100dvh; }
  .login-right { background: #fff !important; padding: 0 !important; display: block !important; }
  .login-card {
    width: 100% !important; max-width: 100% !important; margin: 0 !important;
    border: 0 !important; border-radius: 0 !important; box-shadow: none !important;
    padding: 22px 20px calc(26px + env(safe-area-inset-bottom)) !important;
  }
  body { background: #fff !important; }
}

/* ===== 全局手机适配：带分类树的页面、双栏卡片 ===== */
@media (max-width: 860px) {
  /* 左侧分类树 → 顶部横向滚动条 */
  div:has(> .side-tree) { display: block !important; }
  .side-tree {
    width: 100% !important; flex: 0 0 auto !important; position: static !important;
    margin: 0 0 10px !important; border-radius: 10px; overflow: visible;
  }
  .side-tree .st-head { padding: 8px 10px; }
  .side-tree .st-list {
    display: flex !important; gap: 6px; overflow-x: auto !important;
    max-height: none !important; padding: 8px !important; -webkit-overflow-scrolling: touch;
  }
  .side-tree .st-list::-webkit-scrollbar { height: 0; }
  .side-tree .st-row {
    flex: 0 0 auto; white-space: nowrap; padding: 6px 10px;
    border: 1px solid var(--line); border-radius: 999px; margin: 0;
  }
  .side-tree .st-sub { padding-left: 10px; }
  .side-tree .st-cat { margin-top: 0; }

  /* 双栏卡片改单列 */
  .grid-2, .grid-2-1 { grid-template-columns: 1fr !important; }
  .card { overflow: hidden; }
  .card-h, .card-b { padding-left: 14px; padding-right: 14px; }

  /* 列表行内容换行处理 */
  .list-row { flex-wrap: wrap; gap: 6px 10px; }
  .list-row .main { min-width: 0; }
  .list-row .end { margin-left: auto; }

  /* 详情页两列信息 */
  .detail-head { grid-template-columns: 1fr 1fr !important; }
  .info-grid, .kv-grid { grid-template-columns: 1fr !important; }
}

/* ===== 手机端页面头部压缩：减少滚动 ===== */
@media (max-width: 860px) {
  .content { padding-top: 8px !important; }
  .page-head { margin-bottom: 8px !important; }
  .page-head h1 { font-size: 18px !important; margin: 0 0 4px !important; }
  .page-head .sub { display: none !important; }      /* 隐藏副标题说明 */
  .page-head .btn { height: 32px; padding: 0 10px; font-size: 12.5px; }

  /* KPI 卡片改为一行横向滑动 */
  .kpi-grid {
    display: flex !important; gap: 8px; overflow-x: auto; grid-template-columns: none !important;
    padding: 2px 2px 8px; -webkit-overflow-scrolling: touch;
  }
  .kpi-grid::-webkit-scrollbar { height: 0; }
  .kpi-grid .kpi { flex: 0 0 44vw; padding: 10px 12px !important; }
  .kpi-grid .kpi .val { font-size: 18px !important; margin: 2px 0 !important; }
  .kpi-grid .kpi .lbl { font-size: 11.5px; }
  .kpi-grid .kpi .sub { font-size: 11px; }

  /* 筛选/工具栏紧凑 */
  .toolbar { gap: 8px !important; margin-bottom: 8px !important; }
  .toolbar .btn, .toolbar select { height: 32px !important; font-size: 12.5px; }
  .side-tree { margin-bottom: 6px !important; }
  .side-tree .st-head { padding: 6px 10px !important; }
  .side-tree .st-list { padding: 6px !important; }
  .side-tree .st-row { padding: 5px 9px !important; font-size: 12px; }
}

/* ===== 手机端：分类树改为下拉筛选 ===== */
@media (max-width: 860px) {
  .side-tree { position: relative !important; padding: 0 !important; }
  .side-tree .st-head { cursor: pointer; user-select: none; }
  .side-tree .st-head::after {
    content: '▾'; margin-left: auto; font-size: 12px; color: var(--muted);
    transition: transform .15s;
  }
  .side-tree.open .st-head::after { transform: rotate(180deg); }
  .side-tree .st-list {
    display: none !important; position: absolute; left: 0; right: 0; top: 100%;
    z-index: 60; margin-top: 4px; background: #fff; border: 1px solid var(--line);
    border-radius: 10px; box-shadow: 0 10px 30px rgba(15,23,42,.15);
    max-height: 60vh; overflow: auto !important; flex-direction: column !important;
    padding: 6px !important; gap: 0 !important;
  }
  .side-tree.open .st-list { display: block !important; }
  .side-tree .st-row {
    border: 0 !important; border-radius: 8px !important; padding: 9px 10px !important;
    margin: 0 0 2px !important; white-space: normal !important;
  }
  .side-tree .st-row.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
}

/* 手机端分类下拉：做成与筛选下拉一致的样式 */
@media (max-width: 860px) {
  .side-tree {
    background: transparent !important; border: 0 !important; box-shadow: none !important;
    margin: 0 0 8px !important; padding: 0 !important;
  }
  .side-tree .st-head {
    background: #fff; border: 1px solid var(--line); border-radius: 10px;
    height: 40px; padding: 0 12px; display: flex; align-items: center; gap: 8px;
    box-shadow: 0 1px 2px rgba(15,23,42,.04);
  }
  .side-tree .st-title { font-size: 13px; font-weight: 500; color: var(--ink); letter-spacing: 0; }
  .side-tree .st-total { margin-left: auto; background: #f1f5f9; color: #64748b; font-size: 11px; padding: 1px 8px; }
  .side-tree .st-head::after { margin-left: 2px; font-size: 11px; color: #94a3b8; }
  .side-tree.open .st-head { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(59,130,246,.10); }
}

/* 手机端：分类下拉与下方标题拉开间距 */
@media (max-width: 860px) {
  .side-tree { margin-bottom: 16px !important; }
  .side-tree + * { margin-top: 2px; }
}
