/* WorkBuddy 控制台设计系统 */
:root {
  --brand: #4f46e5;
  --brand-600: #4338ca;
  --brand-soft: #eef2ff;
  --brand-grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --chart-1: #4f46e5;
  --ok: #0ca30c;
  --ok-soft: #e8f7e8;
  --danger: #d03b3b;
  --danger-soft: #fdeeee;
  --warn: #b45309;
  --warn-soft: #fef3e2;
  --bg: #f4f5fa;
  --surface: #ffffff;
  --text: #16181d;
  --text-2: #52525e;
  --text-3: #8b8d98;
  --line: #e7e8ef;
  --grid: #eceef4;
  --sidebar-bg: #14162b;
  --sidebar-text: #a7abc4;
  --sidebar-active: #ffffff;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(20, 22, 43, .05);
  --shadow-md: 0 4px 16px rgba(20, 22, 43, .08);
  --shadow-lg: 0 16px 48px rgba(20, 22, 43, .18);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }
input, select { font-family: inherit; }
a { color: var(--brand); text-decoration: none; }

/* ---------- 应用外壳 ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 236px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: width .22s ease, transform .25s ease;
  z-index: 40;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
}
.brand-logo {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--brand-grad);
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 15px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(99, 102, 241, .45);
}
.company-logo {
  display: block;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  object-position: left center;
}
.sidebar-company-logo {
  width: 50px;
  height: 54px;
  max-width: 50px;
  object-fit: cover;
  object-position: left center;
  border-radius: 15px;
  flex-shrink: 0;
}
.auth-company-logo {
  width: min(620px, 100%);
  height: auto;
  clip-path: polygon(0 0, 100% 0, 100% 70%, 28% 70%, 28% 100%, 0 100%);
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, .18));
}
.brand-name { display: flex; flex-direction: column; white-space: nowrap; overflow: hidden; }
.brand-name b { color: #fff; font-size: 15px; letter-spacing: .2px; }
.brand-name span { font-size: 11px; color: var(--sidebar-text); }

.side-nav { flex: 1; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.side-nav .nav-label {
  font-size: 11px; color: #6b6f8d; padding: 14px 10px 6px;
  text-transform: uppercase; letter-spacing: .08em; white-space: nowrap; overflow: hidden;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--sidebar-text);
  background: none; border: 0; width: 100%;
  font-size: 13.5px; cursor: pointer;
  text-align: left;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #e3e5f2; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(99, 102, 241, .28), rgba(99, 102, 241, .10));
  color: var(--sidebar-active);
  box-shadow: inset 2.5px 0 0 var(--brand);
}
.nav-item .nav-text { overflow: hidden; }

.side-footer { padding: 12px; border-top: 1px solid rgba(255, 255, 255, .07); }
.side-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px 10px;
  white-space: nowrap; overflow: hidden;
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-grad);
  color: #fff; font-size: 13px; font-weight: 700;
  display: grid; place-items: center; flex-shrink: 0;
}
.side-user .u-name { color: #fff; font-size: 13px; font-weight: 600; }
.side-user .u-role { color: var(--sidebar-text); font-size: 11px; }
.btn-logout {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 9px;
  border-radius: 10px; border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .04); color: #d6d8e8;
  font-size: 13px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.btn-logout:hover { background: rgba(224, 82, 82, .18); border-color: rgba(224, 82, 82, .5); color: #ffb4b4; }
.btn-logout svg { width: 15px; height: 15px; flex-shrink: 0; }

/* 收起态 */
.shell.collapsed .sidebar { width: 74px; }
.shell.collapsed .brand-name,
.shell.collapsed .nav-text,
.shell.collapsed .nav-label,
.shell.collapsed .side-user .u-meta,
.shell.collapsed .btn-logout .nav-text { display: none; }
.shell.collapsed .nav-item { justify-content: center; padding: 11px 0; }
.shell.collapsed .sidebar-brand { justify-content: center; padding-left: 0; padding-right: 0; }
.shell.collapsed .sidebar-company-logo { width: 37px; height: 40px; max-width: 37px; }
.shell.collapsed .side-user { justify-content: center; padding-left: 0; padding-right: 0; }
.shell.collapsed .btn-logout { padding: 10px 0; }

/* ---------- 主区域 ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 26px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--text-2);
  cursor: pointer; transition: all .15s;
  flex-shrink: 0;
}
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }
.icon-btn svg { width: 17px; height: 17px; }
.topbar h1 { font-size: 17px; font-weight: 700; }
.topbar .spacer { flex: 1; }
.top-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--line);
  padding: 6px 12px; border-radius: 999px;
}
.top-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }

.content { padding: 26px; max-width: 1200px; width: 100%; margin: 0 auto; }
.page { display: none; }
.page.active { display: block; animation: fadein .25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 22px 0;
}
.card-head h2 { font-size: 15px; font-weight: 700; }
.card-head .sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.card-head .spacer { flex: 1; }
.card-body { padding: 18px 22px 22px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
  display: flex; align-items: flex-start; gap: 14px;
  transition: box-shadow .2s, transform .2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-ico {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center; flex-shrink: 0;
}
.stat-ico svg { width: 20px; height: 20px; }
.stat-ico.i1 { background: var(--brand-soft); color: var(--brand); }
.stat-ico.i2 { background: #e6f4fd; color: #0369a1; }
.stat-ico.i3 { background: #f3e8ff; color: #7e22ce; }
.stat-ico.i4 { background: var(--ok-soft); color: #047857; }
.stat-meta .lbl { font-size: 12.5px; color: var(--text-3); }
.stat-meta .val { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; }
.stat-meta .hint { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

/* ---------- 图表 ---------- */
.chart-wrap { position: relative; }
.chart-svg { display: block; width: 100%; height: auto; }
.chart-svg .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart-svg .axis-text { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.chart-svg .bar { fill: var(--chart-1); transition: opacity .12s; }
.chart-svg .bar.dim { opacity: .35; }
.chart-tip {
  position: absolute;
  pointer-events: none;
  background: #1c1e2e; color: #fff;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(4px);
  transition: opacity .12s, transform .12s;
  white-space: nowrap; z-index: 5;
}
.chart-tip.show { opacity: 1; transform: translateY(0); }
.chart-tip .t-date { color: #a9adc7; font-size: 11px; }
.chart-tip .t-row { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.chart-tip .t-swatch { width: 8px; height: 8px; border-radius: 2px; background: var(--chart-1); }
.chart-empty {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: var(--text-3); font-size: 13px;
}

/* ---------- 接入信息条（总览顶部） ---------- */
.api-strip { margin-bottom: 20px; }
.api-strip .card-body {
  display: flex; flex-wrap: wrap; gap: 12px 32px; align-items: center;
  padding: 14px 22px;
}
.api-strip .as-item { display: flex; align-items: center; gap: 9px; min-width: 0; }
.api-strip .as-label { font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.api-strip .mono { padding: 5px 10px; font-size: 12.5px; }

/* ---------- 快速生成 API Key ---------- */
.quick-bar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin: 16px 22px 0;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px dashed var(--line);
  border-radius: 12px;
}
.quick-bar .qb-title {
  font-size: 13px; font-weight: 700; margin-right: 4px;
  display: flex; align-items: center; gap: 7px;
}
.quick-bar .qb-title svg { width: 15px; height: 15px; color: var(--brand); }
.quick-bar .input { width: 200px; background: var(--surface); }
.quick-bar .qb-quota { width: 110px; }
.quick-bar .qb-hint { font-size: 12px; color: var(--text-3); }
@media (max-width: 820px) {
  .quick-bar { margin: 14px 14px 0; }
  .quick-bar .input { width: 100%; }
  .quick-bar .qb-quota { width: 100%; }
  .quick-bar .btn { width: 100%; }
}

/* ---------- 防火墙 / 安全监控 ---------- */
.fw-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.fw-head .dot { background: var(--ok); animation: pulse 1.6s ease-in-out infinite; }
.fw-hint { font-size: 12.5px; color: var(--text-3); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.fw-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .fw-grid { grid-template-columns: 1fr; } }

.port-list { display: flex; flex-direction: column; gap: 8px; }
.port-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: #fafbfe;
}
.port-badge {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-weight: 700; font-size: 13px; color: var(--brand-600);
  background: var(--brand-soft); padding: 3px 10px; border-radius: 7px;
  min-width: 56px; text-align: center;
}
.port-row .p-proc { font-weight: 600; font-size: 13px; }
.port-row .p-addr { font-size: 12px; color: var(--text-3); font-family: ui-monospace, monospace; }
.port-row .spacer { flex: 1; }

.rule-block {
  background: #14162b; color: #d6d9ea;
  border-radius: 12px; padding: 14px 16px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px; line-height: 1.7;
  overflow-x: auto; white-space: pre; margin: 0;
}
.fw-unavailable {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--warn-soft); color: var(--warn);
  border-radius: 10px; padding: 13px 15px; font-size: 13px;
}
.fw-unavailable svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; }

.ip-cell { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-weight: 600; }
.share-bar { height: 5px; border-radius: 3px; background: var(--grid); margin-top: 5px; overflow: hidden; min-width: 90px; }
.share-bar i { display: block; height: 100%; border-radius: 3px; background: var(--brand); }

/* ---------- 表格 ---------- */
.table-scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; min-width: 760px; }
table.data th {
  text-align: left; font-size: 12px; color: var(--text-3); font-weight: 600;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data td {
  padding: 13px 14px; border-bottom: 1px solid var(--grid);
  font-size: 13.5px; vertical-align: middle; white-space: nowrap;
}
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: #f8f9fd; }
table.data tbody tr:last-child td { border-bottom: 0; }
.num { font-variant-numeric: tabular-nums; }
.cell-user { display: flex; align-items: center; gap: 10px; }
.cell-user .avatar { width: 30px; height: 30px; font-size: 12px; }
.cell-user .cu-name { font-weight: 600; }
.cell-user .cu-sub { font-size: 11.5px; color: var(--text-3); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px;
}
.badge .b-dot { width: 6px; height: 6px; border-radius: 50%; }
.badge.on { background: var(--ok-soft); color: #047857; }
.badge.on .b-dot { background: var(--ok); }
.badge.off { background: var(--danger-soft); color: var(--danger); }
.badge.off .b-dot { background: var(--danger); }

.diagnostic-card { margin-bottom: 18px; }
.diagnostic-body { display: flex; align-items: center; gap: 22px; }
.admin-diagnostic-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: 16px;
}
.diag-main { flex: 1; min-width: 0; }
.diag-title {
  font-size: 16px; font-weight: 650; color: var(--text); margin-bottom: 9px;
  overflow-wrap: anywhere;
}
.diag-meta { display: flex; flex-wrap: wrap; gap: 8px 22px; color: var(--text-2); font-size: 12.5px; }
.diag-meta span { min-width: 0; }
.diag-meta b { color: var(--text); font-weight: 600; }
.diag-note { margin-top: 10px; color: var(--text-3); font-size: 12px; line-height: 1.55; }
.diag-controls {
  width: 100%; min-width: 0;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--grid);
}
.diag-controls .input { min-width: 0; }
.diag-controls .btn { white-space: nowrap; }
.mono-plain { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.diag-log-hero { margin-bottom: 18px; border-top: 3px solid var(--brand); }
.diag-kicker { color: var(--brand); font-size: 10px; font-weight: 750; letter-spacing: .12em; margin-bottom: 7px; }
.diag-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.method-grid { display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)); gap: 10px; }
.method-item { min-height: 88px; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: #fafbfe; }
.method-item b { display: block; font-size: 13px; margin-bottom: 7px; }
.method-item span { color: var(--text-3); font-size: 12px; line-height: 1.5; }
.privacy-line { margin-top: 14px; padding: 10px 12px; border-radius: 9px; background: var(--ok-soft); color: #047857; font-size: 12px; }
.report-event { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 10px; }
.report-event:last-child { margin-bottom: 0; }
.report-event summary { display: flex; align-items: center; gap: 10px; padding: 13px 15px; cursor: pointer; list-style: none; background: #fbfcfe; }
.report-event summary::-webkit-details-marker { display: none; }
.report-event summary b { font-size: 13px; }
.report-event summary time { margin-left: auto; color: var(--text-3); font-size: 12px; }
.report-state { border-radius: 999px; padding: 3px 9px; font-size: 11px; font-weight: 700; }
.report-state.ok { color: #047857; background: var(--ok-soft); }
.report-state.bad { color: var(--danger); background: var(--danger-soft); }
.report-model { color: var(--text-3); font-size: 12px; font-family: ui-monospace, monospace; }
.report-steps { padding: 7px 15px 13px; border-top: 1px solid var(--grid); }
.report-step { display: grid; grid-template-columns: 8px 130px 1fr; gap: 8px; align-items: center; padding: 8px 0; font-size: 12.5px; }
.report-step span:last-child { color: var(--text-2); }
.step-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.report-step.bad .step-dot { background: var(--danger); }
.empty-report { padding: 28px; text-align: center; color: var(--text-3); font-size: 13px; }
@media (max-width: 980px) { .method-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 680px) {
  .diagnostic-body { align-items: stretch; flex-direction: column; }
  .diagnostic-body .btn { width: 100%; }
  .diag-controls { grid-template-columns: 1fr 1fr; }
  .diag-controls .input { grid-column: 1 / -1; }
  .diag-actions { flex-direction: column; }
  .method-grid { grid-template-columns: 1fr; }
  .report-event summary { align-items: flex-start; flex-wrap: wrap; }
  .report-event summary time { width: 100%; margin-left: 0; }
  .report-step { grid-template-columns: 8px 1fr; }
  .report-step span:last-child { grid-column: 2; }
}

.quota-cell { min-width: 130px; }
.quota-bar { height: 5px; border-radius: 3px; background: var(--grid); margin-top: 5px; overflow: hidden; }
.quota-bar i { display: block; height: 100%; border-radius: 3px; background: var(--brand); }
.quota-bar i.q-warn { background: #eda100; }
.quota-bar i.q-full { background: var(--danger); }

.row-actions { display: flex; gap: 6px; }
.mini-btn {
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 8px; padding: 5px 10px;
  font-size: 12px; color: var(--text-2); cursor: pointer;
  transition: all .13s; white-space: nowrap;
}
.mini-btn:hover { border-color: var(--brand); color: var(--brand); }
.mini-btn.danger:hover { border-color: var(--danger); color: var(--danger); }

/* ---------- 按钮 / 表单 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px;
  border-radius: 10px; border: 0;
  background: var(--brand); color: #fff;
  font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: background .15s, box-shadow .15s, transform .1s;
  box-shadow: 0 2px 8px rgba(79, 70, 229, .3);
}
.btn:hover { background: var(--brand-600); box-shadow: 0 4px 14px rgba(79, 70, 229, .4); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn.ghost {
  background: var(--surface); color: var(--text-2);
  border: 1px solid var(--line); box-shadow: none;
}
.btn.ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn.danger { background: var(--danger); box-shadow: 0 2px 8px rgba(208, 59, 59, .3); }
.btn.danger:hover { background: #b32f2f; }
.btn.block { width: 100%; }
.btn svg { width: 16px; height: 16px; }
.btn .spin {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff;
  animation: rot .7s linear infinite; display: none;
}
.btn.loading .spin { display: inline-block; }
@keyframes rot { to { transform: rotate(360deg); } }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field .tip { font-size: 12px; color: var(--text-3); margin-top: 5px; }
.input {
  width: 100%; padding: 10px 13px;
  border: 1px solid var(--line); border-radius: 10px;
  font-size: 14px; background: var(--surface); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79, 70, 229, .14); }
.input::placeholder { color: #b3b5c2; }

.form-error {
  display: none;
  background: var(--danger-soft); color: var(--danger);
  border: 1px solid #f5cdcd; border-radius: 10px;
  padding: 10px 13px; font-size: 13px;
  margin-bottom: 14px;
  align-items: flex-start; gap: 8px;
}
.form-error.show { display: flex; }
.form-error svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 2px; }

/* ---------- 代码块 / 密钥展示 ---------- */
.kv-list { display: flex; flex-direction: column; gap: 0; }
.kv-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0; border-bottom: 1px solid var(--grid);
  flex-wrap: wrap;
}
.kv-row:last-child { border-bottom: 0; }
.kv-row .k { width: 110px; flex-shrink: 0; color: var(--text-3); font-size: 13px; }
.kv-row .v { flex: 1; min-width: 200px; display: flex; align-items: center; gap: 10px; }
.mono {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  background: #f6f7fb; border: 1px solid var(--line);
  padding: 7px 12px; border-radius: 8px;
  word-break: break-all;
}
.copy-btn {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 8px; padding: 6px 11px;
  font-size: 12px; color: var(--text-2); cursor: pointer;
  transition: all .13s; flex-shrink: 0;
}
.copy-btn:hover { border-color: var(--brand); color: var(--brand); }
.copy-btn svg { width: 13px; height: 13px; }

pre.code {
  background: #14162b; color: #d6d9ea;
  border-radius: 12px; padding: 16px 18px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px; line-height: 1.7;
  overflow-x: auto;
}
pre.code .c-key { color: #8ea6f8; }
pre.code .c-str { color: #9ce0a8; }

/* ---------- 模态框 ---------- */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(18, 20, 38, .5);
  backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center;
  padding: 20px; z-index: 100;
}
.modal-mask.show { display: flex; animation: fadein .18s ease; }
.modal {
  background: var(--surface); border-radius: 18px;
  width: 100%; max-width: 440px;
  box-shadow: var(--shadow-lg);
  animation: pop .2s ease;
  max-height: 90vh; overflow-y: auto;
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 0;
}
.modal-head h3 { font-size: 16px; font-weight: 700; }
.modal-close {
  border: 0; background: none; cursor: pointer;
  color: var(--text-3); width: 30px; height: 30px;
  display: grid; place-items: center; border-radius: 8px;
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 16px 24px 24px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

.key-reveal {
  background: linear-gradient(135deg, #f5f3ff, #eef2ff);
  border: 1px dashed #c7c9f5;
  border-radius: 12px; padding: 16px;
  margin: 12px 0;
}
.key-reveal .kr-label { font-size: 12px; color: var(--brand-600); font-weight: 600; margin-bottom: 8px; }
.key-reveal .mono { background: #fff; display: block; margin-bottom: 10px; }
.key-warning {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 12.5px; color: var(--warn);
  background: var(--warn-soft); border-radius: 10px; padding: 10px 12px;
}
.key-warning svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }

/* ---------- Toast ---------- */
.toast-zone {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px;
  z-index: 200; pointer-events: none;
  width: min(92vw, 420px); align-items: center;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  background: #1c1e2e; color: #fff;
  padding: 11px 18px; border-radius: 12px;
  font-size: 13.5px; box-shadow: var(--shadow-lg);
  animation: toast-in .25s ease;
  max-width: 100%;
}
.toast svg { width: 16px; height: 16px; flex-shrink: 0; }
.toast.ok svg { color: #4ade80; }
.toast.err svg { color: #f87171; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; } }
.toast.hide { opacity: 0; transition: opacity .3s; }

/* ---------- 登录页 ---------- */
.auth-page {
  min-height: 100vh;
  display: flex;
  background: var(--bg);
}
.auth-hero {
  flex: 1;
  background:
    radial-gradient(1000px 600px at 15% -10%, rgba(139, 92, 246, .35), transparent 60%),
    radial-gradient(900px 700px at 110% 110%, rgba(56, 130, 246, .3), transparent 55%),
    #14162b;
  color: #fff;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 48px;
  position: relative; overflow: hidden;
}
.auth-hero .hero-brand { display: flex; align-items: center; gap: 12px; }
.auth-hero .hero-brand b { font-size: 17px; }
.auth-hero .hero-copy h2 { font-size: 30px; line-height: 1.35; font-weight: 800; letter-spacing: -.01em; }
.auth-hero .hero-copy p { color: #b9bdd6; margin-top: 14px; max-width: 420px; font-size: 14.5px; }
.hero-points { margin-top: 28px; display: flex; flex-direction: column; gap: 12px; }
.hero-points .pt { display: flex; align-items: center; gap: 10px; color: #d5d8ea; font-size: 13.5px; }
.hero-points .pt svg { width: 16px; height: 16px; color: #8b9cf8; flex-shrink: 0; }
.auth-hero .hero-foot { color: #6f7392; font-size: 12px; }

.auth-side {
  width: min(480px, 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 40px 28px;
  background: var(--surface);
}
.auth-box { width: 100%; max-width: 360px; }
.auth-box .a-title { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.auth-box .a-sub { color: var(--text-3); font-size: 13.5px; margin: 6px 0 24px; }
.auth-tabs {
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--bg); border-radius: 11px; padding: 4px;
  margin-bottom: 22px;
}
.auth-tabs button {
  border: 0; background: none; padding: 9px;
  border-radius: 8px; font-size: 13.5px; font-weight: 600;
  color: var(--text-3); cursor: pointer; transition: all .15s;
}
.auth-tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.auth-foot { margin-top: 22px; text-align: center; font-size: 12.5px; color: var(--text-3); }

/* ---------- 响应式 ---------- */
.backdrop {
  position: fixed; inset: 0; background: rgba(18, 20, 38, .45);
  z-index: 35; display: none;
}
.only-mobile { display: none !important; }

@media (max-width: 960px) {
  .auth-hero { display: none; }
  .auth-side { width: 100%; }
}

@media (max-width: 820px) {
  .sidebar {
    position: fixed; left: 0; top: 0;
    transform: translateX(-100%);
    width: 250px !important;
  }
  .shell.nav-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .shell.nav-open .backdrop { display: block; }
  .shell.collapsed .brand-name, .shell.collapsed .nav-text,
  .shell.collapsed .nav-label, .shell.collapsed .side-user .u-meta { display: block; }
  .shell.collapsed .nav-item { justify-content: flex-start; padding: 10px 12px; }
  .only-mobile { display: grid !important; }
  .only-desktop { display: none !important; }
  .content { padding: 18px 14px; }
  .topbar { padding: 12px 14px; }
  .kv-row .k { width: 100%; }
}
