/* ============================================================
   漫剧工坊 · 激活码签发中心
   设计基准：移动优先，浅色/深色自适应
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

:root {
  color-scheme: light;
  --bg: #f2f5f9;
  --bg-soft: #e9eff6;
  --topbar-bg: rgba(242, 245, 249, .86);
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --surface-3: #edf2f7;
  --line: #e3e9f1;
  --line-strong: #cbd5e1;
  --text: #0b1b2b;
  --text-2: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --primary: #0d9488;
  --primary-2: #0f766e;
  --primary-soft: #e6f7f4;
  --primary-ring: rgba(13, 148, 136, .16);
  --indigo: #6366f1;
  --indigo-soft: #eef0ff;
  --amber: #d97706;
  --amber-2: #b45309;
  --amber-soft: #fef3c7;
  --danger: #dc2626;
  --danger-2: #b91c1c;
  --danger-soft: #fee2e2;
  --ok: #16a34a;
  --ok-2: #15803d;
  --ok-soft: #dcfce7;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-md: 0 1px 2px rgba(15, 23, 42, .04), 0 16px 36px -22px rgba(15, 23, 42, .35);
  --shadow-lg: 0 24px 60px -28px rgba(15, 23, 42, .45);
  --radius: 16px;
  --radius-sm: 11px;
  --sidebar: 248px;
  --font: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0a101c;
    --bg-soft: #0c1422;
    --topbar-bg: rgba(10, 16, 28, .84);
    --surface: #111a29;
    --surface-2: #0e1725;
    --surface-3: #182438;
    --line: #1f2c3f;
    --line-strong: #2c3c53;
    --text: #e8eff8;
    --text-2: #c7d3e1;
    --muted: #93a3b8;
    --faint: #64748b;
    --primary: #2dd4bf;
    --primary-2: #14b8a6;
    --primary-soft: rgba(45, 212, 191, .12);
    --primary-ring: rgba(45, 212, 191, .2);
    --indigo: #818cf8;
    --indigo-soft: rgba(129, 140, 248, .14);
    --amber: #fbbf24;
    --amber-2: #f59e0b;
    --amber-soft: rgba(251, 191, 36, .14);
    --danger: #f87171;
    --danger-2: #ef4444;
    --danger-soft: rgba(248, 113, 113, .14);
    --ok: #4ade80;
    --ok-2: #22c55e;
    --ok-soft: rgba(74, 222, 128, .13);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-md: 0 1px 2px rgba(0, 0, 0, .3), 0 18px 40px -24px rgba(0, 0, 0, .8);
    --shadow-lg: 0 28px 70px -30px rgba(0, 0, 0, .9);
  }
}

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--primary); color: #fff; }

body.modal-open { overflow: hidden; }

.hidden { display: none !important; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------- 按钮 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, transform .06s ease, box-shadow .15s ease;
}
.btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn:disabled, .btn.loading { opacity: .62; cursor: not-allowed; transform: none; }

.btn.primary {
  background: linear-gradient(180deg, var(--primary), var(--primary-2));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 1px 2px rgba(13, 148, 136, .35), 0 12px 24px -14px rgba(13, 148, 136, .8);
}
.btn.primary:hover { filter: brightness(1.06); background: linear-gradient(180deg, var(--primary), var(--primary-2)); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--danger); background: transparent; border-color: transparent; }
.btn.danger:hover { background: var(--danger); color: #fff; }
.modal .btn.danger { background: var(--danger-soft); }
.btn.lg { height: 48px; border-radius: 12px; font-size: 15px; }
.btn.sm { height: 32px; padding: 0 10px; border-radius: 8px; font-size: 12.5px; gap: 6px; }
.btn.sm .icon { width: 15px; height: 15px; }
.btn.block { width: 100%; }
.btn .spinner { display: none; }
.btn.loading .spinner { display: inline-block; }
.btn.loading .icon { display: none; }

.btn-row { display: flex; flex-wrap: wrap; gap: 9px; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* ---------------------------------------------------------- 表单 */

.field { display: block; margin-bottom: 16px; }

.field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
}
.field-label .opt { font-weight: 400; color: var(--faint); font-size: 11.5px; }

.input {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.input > .icon { color: var(--faint); }
.input input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14px;
}
.input input::placeholder { color: var(--faint); }

.input-action {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--faint);
}
.input-action:hover { background: var(--surface-2); color: var(--text); }

textarea {
  width: 100%;
  min-height: 104px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 13.5px;
  line-height: 1.6;
  resize: vertical;
  outline: 0;
  transition: border-color .15s, box-shadow .15s;
}
textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
textarea.mono { font-family: var(--mono); font-size: 12.5px; }

.hint { margin-top: 6px; font-size: 12px; color: var(--faint); min-height: 17px; }
.hint.good { color: var(--ok-2); }
.hint.bad { color: var(--danger-2); }

.form-error {
  margin: 0 0 12px;
  padding: 9px 12px;
  border-radius: 9px;
  background: var(--danger-soft);
  color: var(--danger-2);
  font-size: 12.5px;
  font-weight: 500;
}

.notice {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 11px 13px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}
.notice .icon { margin-top: 2px; width: 16px; height: 16px; }
.notice.warn { background: var(--amber-soft); border-color: transparent; color: var(--amber-2); }
.notice.bad { background: var(--danger-soft); border-color: transparent; color: var(--danger-2); }

.note { font-size: 12px; color: var(--faint); line-height: 1.65; }

/* ---------------------------------------------------------- 登录页 */

.login-screen {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 28px 16px;
  overflow: hidden;
  background: var(--bg);
}

.login-bg { position: absolute; inset: 0; pointer-events: none; }

.grid-lines {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(13, 148, 136, .07) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(13, 148, 136, .07) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 30%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 30%, transparent 78%);
}

.orb { position: absolute; border-radius: 50%; filter: blur(72px); opacity: .5; }
.orb-1 { width: 440px; height: 440px; top: -170px; right: -110px; background: radial-gradient(circle, #5eead4, transparent 66%); }
.orb-2 { width: 400px; height: 400px; bottom: -190px; left: -130px; background: radial-gradient(circle, #c7d2fe, transparent 66%); }
.orb-3 { width: 300px; height: 300px; top: 40%; left: 58%; background: radial-gradient(circle, #99f6e4, transparent 68%); opacity: .32; }

@media (prefers-color-scheme: dark) {
  .orb { opacity: .22; }
  .grid-lines { opacity: .55; }
}

.login-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 22px;
  width: 100%;
  max-width: 412px;
}

.login-brand { display: flex; align-items: center; justify-content: center; gap: 12px; }

.login-card {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(6px);
}

.login-head { margin-bottom: 22px; }
.lock-chip {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 14px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
}
.lock-chip .icon { width: 20px; height: 20px; }
.login-head h1 { font-size: 22px; font-weight: 800; letter-spacing: -.4px; }
.login-head p { margin-top: 6px; font-size: 13px; color: var(--muted); }

.login-hint {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--faint);
  text-align: center;
  text-wrap: balance;
}
.login-hint code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface-3);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-2);
}

.login-foot { text-align: center; font-size: 11.5px; color: var(--faint); letter-spacing: .3px; }

.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, #14b8a6, #0f766e);
  color: #fff;
  box-shadow: 0 8px 18px -10px rgba(13, 148, 136, .9);
  flex: none;
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-mark.lg { width: 46px; height: 46px; border-radius: 13px; }
.brand-mark.lg svg { width: 26px; height: 26px; }
.brand-name { font-size: 15px; font-weight: 800; letter-spacing: .2px; line-height: 1.25; }
.brand-sub { font-size: 10.5px; font-weight: 600; letter-spacing: 1.1px; color: var(--faint); }

/* ---------------------------------------------------------- 布局 */

.app { display: flex; min-height: 100dvh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: var(--sidebar);
  padding: 20px 16px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.nav { display: flex; flex-direction: column; gap: 3px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary-2); }
.nav-item.active .icon { color: var(--primary); }
.nav-item:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

.sidebar-foot { display: flex; flex-direction: column; gap: 12px; margin-top: auto; }

.key-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  text-align: left;
  transition: border-color .15s, background .15s;
}
.key-card:hover { border-color: var(--line-strong); background: var(--surface-3); }
.key-card-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.key-card-text b { font-size: 12px; font-weight: 700; }
.key-card-text small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 10.5px; color: var(--muted); }
.key-refresh { width: 15px; height: 15px; color: var(--faint); }

.sidebar-meta { font-size: 10.5px; color: var(--faint); text-align: center; letter-spacing: .2px; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.warn { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.dot.bad { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

.shell { display: flex; flex-direction: column; flex: 1; min-width: 0; margin-left: var(--sidebar); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 30px 12px;
  background: var(--topbar-bg);
  backdrop-filter: blur(14px);
}
.topbar-title h1 { font-size: 20px; font-weight: 800; letter-spacing: -.35px; line-height: 1.3; }
.topbar-title p { margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.key-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.key-pill.ok { color: var(--ok-2); border-color: transparent; background: var(--ok-soft); }
.key-pill.warn { color: var(--amber-2); border-color: transparent; background: var(--amber-soft); }
.key-pill.bad { color: var(--danger-2); border-color: transparent; background: var(--danger-soft); }

.view {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 6px 30px 56px;
  outline: none;
}
.view-enter { animation: fade-up .28s cubic-bezier(.2, .7, .3, 1); }

.stack { display: flex; flex-direction: column; gap: 16px; }

/* ---------------------------------------------------------- 卡片与统计 */

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.panel-head.plain { border-bottom: 0; padding-bottom: 4px; }
.panel-title { display: flex; align-items: center; gap: 8px; font-size: 14.5px; font-weight: 750; letter-spacing: -.1px; }
.panel-title .icon { width: 17px; height: 17px; color: var(--primary); }
.panel-sub { margin-top: 3px; font-size: 12px; font-weight: 400; color: var(--muted); }
.panel-body { padding: 18px 20px 20px; }

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(90% 140% at 100% 0%, var(--primary-soft) 0%, transparent 58%),
    var(--surface);
  box-shadow: var(--shadow-sm);
}
.hero h2 { font-size: 22px; font-weight: 800; letter-spacing: -.45px; }
.hero p { margin-top: 5px; font-size: 13px; color: var(--muted); }
.hero .btn { flex: none; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
  margin: 16px 0;
}

.stat {
  position: relative;
  padding: 16px 17px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.stat-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.stat-value { margin-top: 3px; font-size: 29px; font-weight: 800; letter-spacing: -1px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat-foot { margin-top: 3px; font-size: 11.5px; color: var(--faint); }
.stat-icon {
  position: absolute;
  top: 15px;
  right: 15px;
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
}
.stat-icon .icon { width: 17px; height: 17px; }
.stat.indigo .stat-icon { background: var(--indigo-soft); color: var(--indigo); }
.stat.amber .stat-icon { background: var(--amber-soft); color: var(--amber); }
.stat.rose .stat-icon { background: var(--danger-soft); color: var(--danger); }

.split { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr); gap: 16px; align-items: start; }

.list { display: flex; flex-direction: column; }

.rec-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 20px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  text-align: left;
  transition: background .12s;
}
.rec-row:first-child { border-top: 0; }
.rec-row:hover { background: var(--surface-2); }
.rec-main { flex: 1; min-width: 0; }
.rec-title { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 650; }
.rec-title .mono { letter-spacing: .02em; }
.rec-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 3px; font-size: 11.5px; color: var(--faint); }
.rec-side { display: flex; align-items: center; gap: 8px; flex: none; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 21px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok-2); }
.badge.soon { background: var(--amber-soft); color: var(--amber-2); }
.badge.bad { background: var(--danger-soft); color: var(--danger-2); }
.badge.info { background: var(--primary-soft); color: var(--primary-2); }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 42px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
}
.empty .icon { width: 26px; height: 26px; color: var(--faint); }
.empty b { font-size: 13.5px; font-weight: 700; color: var(--text-2); }
.empty .btn { margin-top: 4px; }

.skeleton { position: relative; overflow: hidden; border-radius: 8px; background: var(--surface-3); }
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .5), transparent);
  animation: shimmer 1.4s infinite;
}
@media (prefers-color-scheme: dark) {
  .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .06), transparent); }
}
.skeleton-row { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--line); }
.skeleton-row:first-child { border-top: 0; }
.skeleton-row .skeleton:first-child { width: 138px; height: 13px; }
.skeleton-row .skeleton:nth-child(2) { width: 64px; height: 13px; }
.skeleton-row .skeleton:last-child { margin-left: auto; width: 56px; height: 20px; border-radius: 999px; }

/* ---------------------------------------------------------- 签发页 */

.issue-grid { display: grid; grid-template-columns: minmax(0, 1.04fr) minmax(0, .96fr); gap: 16px; align-items: start; }

.device-input {
  height: 50px !important;
  font-family: var(--mono);
  font-size: 19px !important;
  font-weight: 700;
  letter-spacing: .13em;
  text-align: center;
  text-transform: uppercase;
}
.device-input::placeholder { letter-spacing: .1em; font-weight: 500; }

.month-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.month-opt {
  padding: 10px 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  text-align: center;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.month-opt b { display: block; font-size: 17px; font-weight: 800; line-height: 1.25; }
.month-opt small { font-size: 10.5px; color: var(--faint); }
.month-opt:hover { border-color: var(--line-strong); }
.month-opt.on {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px var(--primary);
}
.month-opt.on b { color: var(--primary-2); }
.month-opt.on small { color: var(--primary-2); }

.quick-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.quick-label { margin-right: 2px; font-size: 11px; color: var(--faint); }
.tag-chip {
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
  transition: background .15s, border-color .15s, color .15s;
}
.tag-chip:hover { border-color: var(--primary); color: var(--primary-2); }
.tag-chip.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-2); }
.tag-chip:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

.result {
  border: 1px solid var(--line);
  border-color: color-mix(in srgb, var(--primary) 30%, var(--line));
  border-radius: 14px;
  background: var(--primary-soft);
  padding: 15px;
}
.result-title { display: flex; align-items: center; gap: 7px; margin-bottom: 10px; font-size: 13px; font-weight: 750; color: var(--primary-2); }
.result-title .icon { width: 17px; height: 17px; }
.result-meta { margin: 9px 0 12px; font-size: 11.5px; color: var(--text-2); }
.result-meta b { font-weight: 700; }
.result .btn-row { margin-top: 10px; }

.code-box {
  padding: 11px 12px;
  max-height: 132px;
  overflow: auto;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.65;
  word-break: break-all;
  user-select: all;
  color: var(--text-2);
}

.steps { display: flex; flex-direction: column; gap: 13px; }
.step { display: flex; gap: 11px; }
.step-num {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  flex: none;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-2);
  font-size: 11.5px;
  font-weight: 800;
}
.step-body b { display: block; font-size: 12.5px; font-weight: 700; }
.step-body span { font-size: 11.5px; color: var(--muted); }

.key-state { display: flex; gap: 9px; align-items: flex-start; }
.key-state .dot { margin-top: 6px; }
.key-state b { display: block; font-size: 12.5px; font-weight: 700; }
.key-state span { display: block; font-size: 11.5px; color: var(--muted); word-break: break-all; }

/* ---------------------------------------------------------- 记录页 */

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.search { position: relative; flex: 1; min-width: 190px; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); width: 16px; height: 16px; }
.search input {
  width: 100%;
  height: 40px;
  padding: 0 12px 0 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 13px;
  outline: 0;
  transition: border-color .15s, box-shadow .15s;
}
.search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }

.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-3); }
.seg button {
  height: 32px;
  padding: 0 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.list-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 10px 18px; border-bottom: 1px solid var(--line); font-size: 11.5px; color: var(--faint); }
.list-meta b { color: var(--text-2); font-weight: 700; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table-wrap table { min-width: 860px; }
th {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-align: left;
  white-space: nowrap;
  position: sticky;
  top: 0;
}
td { padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
td.actions { white-space: nowrap; text-align: right; }
td .btn.sm + .btn.sm { margin-left: 5px; }
.cell-strong { font-weight: 650; }
.cell-sub { margin-top: 2px; font-size: 11px; color: var(--faint); }

.rec-cards { display: none; padding: 10px 12px 14px; }

.rec-card {
  padding: 13px 14px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
}
.rec-card:last-child { margin-bottom: 0; }
.rec-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.rec-card-title { font-family: var(--mono); font-size: 14px; font-weight: 700; letter-spacing: .04em; }
.rec-card-sub { margin-top: 2px; font-size: 11.5px; color: var(--muted); }
.rec-card-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 12px; margin: 11px 0; font-size: 11.5px; color: var(--faint); }
.rec-card-meta b { display: block; margin-top: 1px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.rec-card-actions { display: flex; gap: 7px; padding-top: 10px; border-top: 1px dashed var(--line); }
.rec-card-actions .btn { flex: 1; padding: 0 6px; }

.load-more { padding: 14px; text-align: center; border-top: 1px solid var(--line); }

/* ---------------------------------------------------------- 校验页 */

.check-grid { display: grid; grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); gap: 16px; align-items: start; }

.verdict { display: flex; gap: 12px; align-items: flex-start; }
.verdict-icon { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 12px; }
.verdict-icon .icon { width: 21px; height: 21px; }
.verdict.ok .verdict-icon { background: var(--ok-soft); color: var(--ok-2); }
.verdict.bad .verdict-icon { background: var(--danger-soft); color: var(--danger-2); }
.verdict.warn .verdict-icon { background: var(--amber-soft); color: var(--amber-2); }
.verdict-body b { display: block; font-size: 14px; font-weight: 750; }
.verdict-body span { display: block; margin-top: 3px; font-size: 12.5px; color: var(--muted); }

.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(134px, 1fr)); gap: 9px; margin-top: 16px; }
.kv > div { padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.kv dt { font-size: 10.5px; font-weight: 600; color: var(--faint); }
.kv dd { margin: 3px 0 0; font-size: 12.5px; font-weight: 650; word-break: break-all; }

.record-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--primary-soft);
  font-size: 12px;
  color: var(--text-2);
}

/* ---------------------------------------------------------- 设置页 */

.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }

.setting-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
}
.setting-row:first-child { border-top: 0; padding-top: 0; }
.setting-row .k { color: var(--muted); flex: none; }
.setting-row .v { font-weight: 600; text-align: right; word-break: break-all; }
.setting-row .v.mono { font-size: 11.5px; font-weight: 500; }

.settings-block { margin-top: 14px; }
.settings-block:first-child { margin-top: 0; }

/* ---------------------------------------------------------- 详情 / 模态框 */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(8, 15, 25, .52);
  backdrop-filter: blur(4px);
  animation: fade .16s ease;
}
.modal {
  width: 100%;
  max-width: 452px;
  max-height: calc(100dvh - 32px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: pop .2s cubic-bezier(.2, .8, .3, 1);
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 20px 0; }
.modal-title { font-size: 16px; font-weight: 800; letter-spacing: -.2px; }
.modal-sub { margin-top: 4px; font-size: 12px; color: var(--muted); }
.modal-body { display: flex; flex-direction: column; gap: 13px; padding: 16px 20px 20px; }
.modal-body .field { margin-bottom: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding-top: 4px; }

.detail-list { display: flex; flex-direction: column; gap: 0; }
.detail-row { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-top: 1px dashed var(--line); font-size: 12.5px; }
.detail-row:first-child { border-top: 0; padding-top: 0; }
.detail-row .k { color: var(--muted); flex: none; }
.detail-row .v { text-align: right; font-weight: 600; word-break: break-all; }

.detail-code { margin-top: 2px; }

/* ---------------------------------------------------------- 提示条 */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 200;
  max-width: calc(100vw - 32px);
  padding: 11px 18px;
  border-radius: 12px;
  background: #0f172a;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .6);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: #b91c1c; }
.toast.ok { background: #115e59; }

@media (max-width: 900px) {
  .toast { bottom: calc(78px + env(safe-area-inset-bottom)); }
}

/* ---------------------------------------------------------- 底部导航（移动端） */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: none;
  padding: 5px 6px calc(5px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 -10px 30px -24px rgba(15, 23, 42, .5);
}
.tabbar a {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 5px 0;
  border-radius: 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  text-decoration: none;
}
.tabbar a .icon { width: 20px; height: 20px; }
.tabbar a.active { color: var(--primary); }

/* ---------------------------------------------------------- 响应式 */

@media (max-width: 1120px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .issue-grid, .check-grid, .settings-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .sidebar { display: none; }
  .shell { margin-left: 0; }
  .tabbar { display: flex; }
  .topbar { padding: calc(13px + env(safe-area-inset-top)) 16px 10px; }
  .input input, .search input, textarea { font-size: 16px; }
  .topbar-title h1 { font-size: 18px; }
  .topbar-title p { font-size: 11.5px; }
  .view { padding: 4px 16px calc(88px + env(safe-area-inset-bottom)); }
  .hero { flex-direction: column; align-items: stretch; padding: 18px; }
  .hero h2 { font-size: 19px; }
  .hero .btn { width: 100%; }
  .panel-head { padding: 14px 16px; }
  .panel-body { padding: 15px 16px 17px; }
  .key-pill { display: inline-flex; padding: 0 10px; }
  .key-pill > span:not(.dot) { display: none; }
  .logout-text { display: none; }
  .stats { gap: 10px; }
  .stat { padding: 13px 14px; }
  .stat-value { font-size: 25px; }
  .stat-icon { width: 29px; height: 29px; top: 12px; right: 12px; }
  .toolbar { padding: 12px; }
  .seg { width: 100%; overflow-x: auto; scrollbar-width: none; }
  .seg::-webkit-scrollbar { display: none; }
  .seg button { flex: 1; }
  .search { flex-basis: 100%; }
}

@media (max-width: 760px) {
  .table-wrap { display: none; }
  .rec-cards { display: block; }
  .list-meta { padding: 9px 14px; }
  .modal { max-width: 100%; }
  .rec-card-actions .btn.danger { flex: 0 0 46px; border: 1px solid var(--line); }
  .toolbar > .btn { margin-left: auto; }
}

@media (max-width: 560px) {
  .login-screen { padding: calc(20px + env(safe-area-inset-top)) 14px calc(20px + env(safe-area-inset-bottom)); align-items: center; }
  .login-card { padding: 22px 18px; border-radius: 18px; }
  .login-panel { gap: 18px; }
  .login-foot { font-size: 10.5px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-value { font-size: 22px; }
  .stat-icon { display: none; }
  .month-opt b { font-size: 15px; }
  .device-input { font-size: 16px !important; height: 46px !important; }
  .rec-card-actions .btn { font-size: 12px; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { max-width: 100%; border-radius: 18px 18px 0 0; max-height: 92dvh; padding-bottom: env(safe-area-inset-bottom); animation: sheet .22s cubic-bezier(.2, .8, .3, 1); }
}

@media (max-width: 380px) {
  .stats { grid-template-columns: minmax(0, 1fr); }
  .month-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------------------------------------------------------- 动画 */

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes sheet { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { 100% { transform: translateX(100%); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
