/* ===================================================================
   令牌刷新面板 · 设计系统 v2（侧边栏 + 仪表盘）
   性能要点：无固定大渐变背景、无全局颜色过渡、无 backdrop-filter，
   切换明暗为瞬时重绘（不卡）。过渡仅施加于少量可交互元素。
   =================================================================== */
:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f5f7fb;
  --surface-3: #eef1f7;
  --border: #e5e9f0;
  --border-strong: #d7dded;
  --text: #10131a;
  --text-2: #58627a;
  --muted: #949cb0;
  --primary: #5457e5;
  --primary-2: #7c5cff;
  --primary-soft: #ecedfe;
  --grad: linear-gradient(135deg, #5457e5, #7c5cff);
  --green:#12a150; --green-bg:#e7f7ee;
  --amber:#c77700; --amber-bg:#fdf0d9;
  --red:#e0342b;   --red-bg:#fce8e7;
  --gray:#8b95a8;  --gray-bg:#eef1f6;
  --sh-1: 0 1px 2px rgba(16,24,45,.05);
  --sh-2: 0 4px 16px rgba(16,24,45,.08);
  --sh-3: 0 16px 48px rgba(16,24,45,.16);
  --r: 14px; --r-sm: 10px; --r-lg: 20px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Cascadia Code", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, Arial, sans-serif;
  --side-w: 236px;
}
:root[data-theme="dark"] {
  --bg: #0b0d12;
  --surface: #14171f;
  --surface-2: #1a1e28;
  --surface-3: #20252f;
  --border: #262b36;
  --border-strong: #333a48;
  --text: #eaedf3;
  --text-2: #a4adbf;
  --muted: #6f7889;
  --primary: #7f83ff;
  --primary-2: #9a86ff;
  --primary-soft: #1d2138;
  --grad: linear-gradient(135deg, #6a6ef0, #9a86ff);
  --green:#33d17a; --green-bg:#0f2a1c;
  --amber:#f0a833; --amber-bg:#2c2210;
  --red:#f36a62;   --red-bg:#2c1615;
  --gray:#7a8497;  --gray-bg:#1c212b;
  --sh-1: 0 1px 2px rgba(0,0,0,.4);
  --sh-2: 0 6px 20px rgba(0,0,0,.5);
  --sh-3: 0 20px 56px rgba(0,0,0,.65);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--sans); background: var(--bg); color: var(--text);
  font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.link { color: var(--primary); font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; }
.link:hover { text-decoration: underline; }
.ic { display: inline-flex; }
.ic svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- 按钮 ---------- */
.btn {
  appearance: none; border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); padding: 8px 14px; border-radius: var(--r-sm); font: inherit;
  font-size: 13px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center;
  gap: 7px; white-space: nowrap; box-shadow: var(--sh-1);
  transition: background-color .15s, border-color .15s, color .15s, transform .05s, box-shadow .15s, filter .15s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .ic svg { width: 16px; height: 16px; }
.btn-primary { background: var(--grad); color: #fff; border-color: transparent; }
.btn-primary:hover { color: #fff; filter: brightness(1.07); }
.btn-accent { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.btn-accent:hover { color: var(--primary); }
.btn-danger { background: var(--red); color: #fff; border-color: transparent; }
.btn-ghost-danger { color: var(--red); }
.btn-ghost-danger:hover { border-color: var(--red); color: var(--red); background: var(--red-bg); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; padding: 11px; margin-top: 4px; }

.icon-btn {
  width: 38px; height: 38px; min-width: 38px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background-color .15s, border-color .15s, color .15s;
}
.icon-btn:hover { color: var(--primary); border-color: var(--primary); }
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(900px 500px at 50% -10%, var(--primary-soft), transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 372px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 40px 34px; box-shadow: var(--sh-3); text-align: center; }
.login-theme { position: fixed; top: 20px; right: 20px; }
.login-card h1 { margin: 16px 0 2px; font-size: 22px; }
.login-card .sub { color: var(--muted); margin: 0; font-size: 13px; }
.login-card form { text-align: left; margin-top: 24px; display: grid; gap: 14px; }
.login-card label { display: grid; gap: 6px; font-size: 12.5px; color: var(--text-2); font-weight: 600; }
input, select, textarea { border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  padding: 10px 12px; border-radius: var(--r-sm); font: inherit; font-size: 14px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
.form-err { color: var(--red); font-size: 12.5px; min-height: 16px; text-align: center; }
.brand-badge { width: 60px; height: 60px; border-radius: 17px; margin: 0 auto; display: grid; place-items: center;
  font-size: 30px; background: var(--grad); box-shadow: var(--sh-2); }
.brand-badge.sm { width: 34px; height: 34px; border-radius: 10px; font-size: 18px; box-shadow: none; }

/* ---------- 布局 ---------- */
.layout { min-height: 100vh; }
.sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: var(--side-w); background: var(--surface);
  border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 18px 14px; z-index: 40; }
.side-brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 18px; }
.brand-name { font-weight: 800; font-size: 16px; letter-spacing: .3px; }
.side-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 11px;
  color: var(--text-2); cursor: pointer; font-weight: 600; font-size: 14px; text-decoration: none;
  transition: background-color .15s, color .15s; }
.nav-item .ic svg { width: 19px; height: 19px; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); }
.side-foot { padding: 12px 10px 4px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); }
.side-mask { display: none; }

.main { margin-left: var(--side-w); min-height: 100vh; display: flex; flex-direction: column; }
.main-head { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
  padding: 14px 26px; background: var(--surface); border-bottom: 1px solid var(--border); }
.main-head h2 { margin: 0; font-size: 18px; font-weight: 800; flex-shrink: 0; }
.menu-btn { display: none; }
.head-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.search-box { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 11px; padding: 0 12px; height: 38px; color: var(--muted); }
.search-box input { border: none; background: none; padding: 0; width: 210px; height: 100%; }
.search-box input:focus { box-shadow: none; }
.content { padding: 24px 26px 60px; }
.page { animation: fade .18s ease; }

.ic-moon, .ic-eye-off { display: none; }
:root[data-theme="dark"] .ic-sun { display: none; }
:root[data-theme="dark"] .ic-moon { display: block; }
body.privacy .ic-eye { display: none; }
body.privacy .ic-eye-off { display: block; }
body.privacy #privacy-toggle { color: var(--primary); border-color: var(--primary); }
body.privacy .sensitive { filter: blur(6px); user-select: none; }
body.privacy .sensitive:hover { filter: none; }

/* 用户菜单 */
.user-menu { position: relative; }
.dropdown { position: absolute; right: 0; top: 46px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--sh-3); min-width: 176px; padding: 6px; display: grid; gap: 2px; z-index: 50; }
.dropdown-head { padding: 8px 12px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.dropdown button { text-align: left; background: none; border: none; color: var(--text); padding: 9px 12px;
  border-radius: 8px; cursor: pointer; font: inherit; font-size: 13.5px; }
.dropdown button:hover { background: var(--surface-2); color: var(--primary); }

/* ---------- 统计卡 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 18px 20px;
  box-shadow: var(--sh-1); cursor: pointer; position: relative; overflow: hidden;
  transition: transform .1s, box-shadow .15s, border-color .15s; }
.stat:hover { transform: translateY(-2px); box-shadow: var(--sh-2); border-color: var(--border-strong); }
.stat .stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat .dot { width: 9px; height: 9px; border-radius: 50%; }
.stat .num { font-size: 30px; font-weight: 800; letter-spacing: -1px; margin-top: 8px; }
.stat .lbl { font-size: 12.5px; color: var(--text-2); margin-top: 1px; }
.d-total{background:var(--primary)} .d-active{background:var(--green)} .d-expiring{background:var(--amber)}
.d-expired{background:var(--red)} .d-failed{background:var(--red)}

/* ---------- 仪表盘网格 ---------- */
.dash-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 20px; box-shadow: var(--sh-1); }
.card.span-2 { grid-column: span 2; } .card.span-3 { grid-column: span 3; } .card.span-4 { grid-column: span 4; }
.card.narrow { max-width: 620px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 700; }

.health-bar { display: flex; height: 16px; border-radius: 999px; overflow: hidden; background: var(--surface-3); }
.health-bar .seg { height: 100%; transition: width .3s; }
.health-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; }
.health-legend .lg { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); }
.health-legend .lg i { width: 9px; height: 9px; border-radius: 3px; }

.quick-actions { display: flex; flex-direction: column; gap: 10px; }
.quick-actions .btn { justify-content: flex-start; }

/* 一键下载卡片 */
.dl-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dl-btn { height: auto; padding: 15px 16px; justify-content: flex-start; align-items: center; gap: 12px; }
.dl-btn .ic svg { width: 22px; height: 22px; }
.dl-btn span { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.35; }
.dl-btn b { font-size: 14px; font-weight: 700; }
.dl-btn small { font-weight: 500; font-size: 11px; opacity: .82; margin-top: 1px; }
@media (max-width: 620px) { .dl-actions { grid-template-columns: 1fr; } }
.mini-list { display: grid; gap: 9px; }
.mini-list .row { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px;
  background: var(--surface-2); border-radius: 10px; font-size: 13px; }
.mini-list .row b { font-weight: 700; }

.domain-bars { display: grid; gap: 9px; }
.domain-bars .drow { display: grid; grid-template-columns: 130px 1fr 42px; align-items: center; gap: 10px; font-size: 12.5px; }
.domain-bars .dname { color: var(--text-2); font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.domain-bars .dtrack { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.domain-bars .dfill { height: 100%; background: var(--grad); border-radius: 999px; }
.domain-bars .dcount { text-align: right; color: var(--muted); }

/* ---------- 过滤 chips ---------- */
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip { border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); padding: 7px 13px;
  border-radius: 999px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; display: inline-flex; gap: 7px;
  transition: background-color .15s, color .15s, border-color .15s; }
.chip b { color: var(--muted); font-weight: 700; }
.chip:hover { border-color: var(--primary); }
.chip.active { background: var(--primary); color: #fff; border-color: transparent; }
.chip.active b { color: rgba(255,255,255,.85); }

/* ---------- 工具栏 ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; margin-bottom: 16px; }
.tb-left, .tb-right { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- 表格 ---------- */
.table-card { padding: 0; overflow: hidden; }
.table-scroll { overflow-x: auto; }
.acc-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.acc-table thead th { text-align: left; padding: 13px 16px; font-size: 12px; font-weight: 700; color: var(--muted);
  background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.acc-table th.sortable { cursor: pointer; user-select: none; }
.acc-table th.sortable:hover { color: var(--primary); }
.acc-table th .arrow { opacity: .5; font-size: 10px; }
.acc-table tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.acc-table tbody tr:last-child td { border-bottom: none; }
.acc-table tbody tr { transition: background-color .12s; }
.acc-table tbody tr:hover { background: var(--surface-2); }
.col-check { width: 42px; } .col-op { text-align: right; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.email-cell { font-family: var(--mono); font-size: 12.5px; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.badge::before { content:""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-active{color:var(--green);background:var(--green-bg)} .b-expiring{color:var(--amber);background:var(--amber-bg)}
.b-expired,.b-failed{color:var(--red);background:var(--red-bg)} .b-never{color:var(--gray);background:var(--gray-bg)}
.days-warn { color: var(--amber); font-weight: 700; } .days-bad { color: var(--red); font-weight: 700; }

.op-btn { background: none; border: none; cursor: pointer; color: var(--text-2); padding: 5px 8px; border-radius: 7px;
  font: inherit; font-size: 12.5px; transition: background-color .12s, color .12s; }
.op-btn:hover { background: var(--primary-soft); color: var(--primary); }
.op-btn.del:hover { background: var(--red-bg); color: var(--red); }
.empty { padding: 64px 20px; text-align: center; color: var(--muted); }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pager .range { color: var(--muted); font-size: 12.5px; margin-right: auto; }
.pager select { width: auto; padding: 6px 8px; font-size: 12.5px; }
.pg-btn { min-width: 32px; height: 32px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  border-radius: 8px; cursor: pointer; font: inherit; font-size: 12.5px; padding: 0 8px; transition: background-color .12s, color .12s, border-color .12s; }
.pg-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pg-btn.active { background: var(--primary); color: #fff; border-color: transparent; }
.pg-btn:disabled { opacity: .4; cursor: not-allowed; }
.pg-jump { width: 56px; text-align: center; padding: 6px; }

/* ---------- 定时 / 设置 ---------- */
.sched-block { display: grid; gap: 12px; margin: 16px 0; }
.switch-row { display: flex; align-items: center; justify-content: space-between; padding: 13px 15px; background: var(--surface-2); border-radius: 11px; font-weight: 600; }
.switch { width: 44px; height: 24px; appearance: none; background: var(--gray); border-radius: 999px; position: relative; cursor: pointer; transition: background-color .2s; }
.switch:checked { background: var(--primary); }
.switch::after { content:""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: transform .2s; }
.switch:checked::after { transform: translateX(20px); }
.cron-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--text-2); font-size: 13px; padding-left: 4px; }
.cron-lbl { color: var(--muted); }
.cron-in { width: 130px; } .cron-in.sm { width: 58px; } .cron-in.xs { width: 52px; text-align: center; }
.sched-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.next-runs { margin-top: 16px; display: grid; gap: 6px; }
.next-runs .nr { padding: 10px 14px; background: var(--surface-2); border-radius: 10px; font-size: 13px; color: var(--text-2); }
.form-grid { display: grid; gap: 14px; max-width: 380px; }
.form-grid label { display: grid; gap: 6px; font-size: 12.5px; color: var(--text-2); font-weight: 600; }

/* ---------- 报告 / 告警 ---------- */
.report-list, .alert-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; max-height: 440px; overflow: auto; }
.report-list.mini, .alert-list.mini { max-height: 220px; }
.report-list li { padding: 10px 13px; background: var(--surface-2); border-radius: 9px; cursor: pointer; font-family: var(--mono); font-size: 12.5px; transition: background-color .12s, color .12s; }
.report-list li:hover { background: var(--primary-soft); color: var(--primary); }
.alert-list li { padding: 9px 13px; background: var(--surface-2); border-radius: 9px; font-size: 12.5px; color: var(--text-2); }
.report-content { background: var(--surface-2); border-radius: 11px; padding: 16px; overflow: auto; max-height: 500px; font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; margin: 0; }

/* ---------- 浮动进度 ---------- */
.progress-float { position: fixed; right: 24px; bottom: 24px; width: 320px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--sh-3); padding: 16px 18px; z-index: 60; animation: slideup .2s ease; }
.pf-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
#pf-note { font-weight: 700; font-size: 13.5px; }
.pf-stop { background: var(--red-bg); color: var(--red); border: none; padding: 4px 12px; border-radius: 8px; cursor: pointer; font: inherit; font-size: 12px; font-weight: 700; }
.pf-track { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.pf-fill { height: 100%; width: 0; background: var(--grad); border-radius: 999px; transition: width .25s; }
.pf-count { margin-top: 8px; font-size: 12px; color: var(--text-2); }
#pf-note::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -1px;
  border: 2px solid var(--primary-soft); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 确认弹窗文案 */
.confirm-msg { font-size: 14px; line-height: 1.75; color: var(--text); margin: 0; }
.confirm-msg b { color: var(--primary); }

/* 任务运行中：禁用会冲突的操作，避免叠加任务 */
body.busy [data-act="refresh-all"], body.busy [data-act="check"], body.busy [data-act="refresh-selected"],
body.busy [data-act="run-full"], body.busy [data-act="run-check"] { opacity: .5; pointer-events: none; }

/* 选中行高亮 */
.acc-table tbody tr:has(.row-check:checked) { background: var(--primary-soft); }
.acc-table tbody tr:has(.row-check:checked):hover { background: var(--primary-soft); }

/* 键盘可达性：焦点可见 */
.btn:focus-visible, .icon-btn:focus-visible, .chip:focus-visible, .nav-item:focus-visible,
.pg-btn:focus-visible, .op-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(8,12,22,.55); display: grid; place-items: center; z-index: 100; padding: 20px; animation: fade .18s; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-3);
  width: 100%; max-width: 560px; max-height: 88vh; overflow: auto; animation: pop .2s; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 22px; display: grid; gap: 14px; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.modal label { display: grid; gap: 6px; font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.modal textarea { min-height: 120px; resize: vertical; font-family: var(--mono); font-size: 12.5px; }
.dropzone { border: 2px dashed var(--border-strong); border-radius: 12px; padding: 30px; text-align: center; color: var(--muted); cursor: pointer; transition: border-color .15s, color .15s, background-color .15s; }
.dropzone.drag { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 9px 12px; font-size: 13px; align-items: center; }
.kv .k { color: var(--muted); } .kv .v { font-family: var(--mono); font-size: 12px; word-break: break-all; background: var(--surface-2); padding: 6px 9px; border-radius: 7px; }
.copy-line { display: flex; gap: 8px; flex-wrap: wrap; }
.mail-item { padding: 12px 14px; background: var(--surface-2); border-radius: 11px; }
.mail-item .subj { font-weight: 700; }
.mail-item .meta { font-size: 12px; color: var(--muted); margin: 3px 0; }
.mail-item .code { display: inline-block; font-family: var(--mono); font-weight: 800; font-size: 16px; color: var(--primary); background: var(--primary-soft); padding: 2px 10px; border-radius: 8px; letter-spacing: 2px; }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--surface);
  padding: 11px 20px; border-radius: 12px; font-size: 13.5px; font-weight: 600; box-shadow: var(--sh-3); z-index: 200; animation: fade .18s; max-width: 90vw; }
.toast.err { background: var(--red); color: #fff; } .toast.ok { background: var(--green); color: #fff; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes slideup { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) { .stat-grid { grid-template-columns: repeat(3, 1fr); } .dash-grid { grid-template-columns: repeat(2, 1fr); } .card.span-3, .card.span-4 { grid-column: span 2; } }
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s; box-shadow: var(--sh-3); }
  body.side-open .sidebar { transform: none; }
  body.side-open .side-mask { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 39; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-flex; }
  .content { padding: 18px 16px 50px; } .main-head { padding: 12px 16px; }
  .search-box input { width: 130px; }
}
@media (max-width: 620px) {
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .dash-grid { grid-template-columns: 1fr; } .card.span-2, .card.span-3, .card.span-4 { grid-column: span 1; }
  .hide-md { display: none; }
  .head-actions { gap: 6px; } .main-head h2 { font-size: 16px; }
}
