/* =========================================================
   LanChat 管理后台 · 样式
   ========================================================= */
:root {
  --ink: #0f172a;
  --ink-2: #1e293b;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e5eaf2;
  --line-2: #eef2f7;
  --bg: #f3f6fb;
  --card: #ffffff;
  --brand: #1565c0;
  --brand-2: #2563eb;
  --brand-dark: #0d3b72;
  --brand-soft: #e8f1fd;
  --ok: #059669;
  --ok-soft: #ecfdf5;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warn: #d97706;
  --warn-soft: #fff7ed;
  --purple: #7c3aed;
  --purple-soft: #f3e8ff;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow: 0 10px 30px rgba(15, 23, 42, .07);
  --sidebar: 236px;
  --font: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
code {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: .92em;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  padding: 1px 5px;
}
.hidden { display: none !important; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  flex: 0 0 auto;
}

/* ============ 登录 ============ */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background:
    radial-gradient(900px 500px at 12% 6%, rgba(37, 99, 235, .28), transparent 60%),
    radial-gradient(800px 520px at 92% 92%, rgba(124, 58, 237, .18), transparent 60%),
    #0b1220;
}
.login-card {
  width: min(980px, 100%);
  min-height: 590px;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  border-radius: 22px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 40px 100px rgba(0, 0, 0, .4);
}
.login-brand {
  position: relative;
  padding: 52px 48px;
  color: #fff;
  background:
    radial-gradient(500px 300px at 10% 0%, rgba(96, 165, 250, .35), transparent 60%),
    linear-gradient(150deg, #0d3b72 0%, #1565c0 55%, #1e40af 100%);
  display: flex;
  flex-direction: column;
}
.login-brand::after {
  content: "";
  position: absolute;
  right: -80px; bottom: -100px;
  width: 320px; height: 320px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .18);
  box-shadow: 0 0 0 40px rgba(255, 255, 255, .04), 0 0 0 90px rgba(255, 255, 255, .03);
}
.brand-mark {
  width: 46px; height: 46px;
  border-radius: 13px;
  background: #fff;
  color: var(--brand);
  display: grid; place-items: center;
  font-weight: 900; font-size: 24px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .18);
}
.brand-mark.small { width: 34px; height: 34px; border-radius: 10px; font-size: 18px; }
.brand-name { margin-top: 16px; font-size: 22px; font-weight: 800; letter-spacing: .3px; }
.login-brand h2 { margin: 26px 0 10px; font-size: 34px; line-height: 1.2; }
.login-brand p { margin: 0; color: rgba(255, 255, 255, .78); line-height: 1.9; font-size: 14px; }
.brand-points { list-style: none; padding: 0; margin: 30px 0 0; display: grid; gap: 13px; font-size: 13.5px; color: rgba(255, 255, 255, .9); }
.brand-points .dot { width: 7px; height: 7px; border-radius: 50%; background: #7dd3fc; display: inline-block; margin-right: 10px; box-shadow: 0 0 0 4px rgba(125, 211, 252, .16); }
.brand-foot { margin-top: auto; padding-top: 30px; font-size: 12px; color: rgba(255, 255, 255, .55); }
.login-panel { padding: 58px 52px; display: flex; flex-direction: column; justify-content: center; }
.login-head h1 { margin: 8px 0 6px; font-size: 30px; }
.login-head p { margin: 0 0 26px; color: var(--muted); font-size: 14px; }
.eyebrow { font-size: 11px; font-weight: 800; letter-spacing: 1.6px; color: var(--brand); text-transform: uppercase; }
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 13px; font-weight: 700; margin-bottom: 7px; color: var(--ink-2); }
.field input, .input, .select, .textarea {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 0 13px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 90px; padding: 11px 13px; resize: vertical; }
.field input:focus, .input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}
.form-error { min-height: 20px; color: var(--danger); font-size: 12.5px; margin: -4px 0 10px; }
.login-hint { margin-top: 22px; padding: 12px 14px; border-radius: 10px; background: #f8fafc; border: 1px dashed #dbe3ee; color: var(--muted); font-size: 12.5px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 15px;
  border: 1px solid transparent; border-radius: 10px;
  background: #fff; font-size: 13px; font-weight: 700;
  transition: .15s; white-space: nowrap;
}
.btn .icon { width: 16px; height: 16px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand-2); color: #fff; box-shadow: 0 6px 16px rgba(37, 99, 235, .24); }
.btn-primary:hover { background: #1d4ed8; }
.btn-ghost { border-color: var(--line); color: var(--ink-2); background: #fff; }
.btn-ghost:hover { border-color: #cbd5e1; background: #f8fafc; }
.btn-soft { background: var(--brand-soft); color: var(--brand); }
.btn-soft:hover { background: #dbeafe; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger); }
.btn-sm { height: 32px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; height: 46px; }

/* ============ 应用骨架 ============ */
.app { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0;
  width: var(--sidebar);
  background: linear-gradient(180deg, #0b1220 0%, #0f1a2d 100%);
  color: #cbd5e1;
  display: flex; flex-direction: column;
  padding: 22px 16px 12px;
  z-index: 20;
}
.side-brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 22px; }
.side-name { color: #fff; font-weight: 800; font-size: 16px; line-height: 1.1; }
.side-sub { color: #64748b; font-size: 11px; margin-top: 4px; letter-spacing: .6px; }
.side-nav { display: grid; gap: 5px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  height: 42px; padding: 0 12px;
  border: 0; background: transparent;
  border-radius: 10px; color: #94a3b8;
  font-size: 13.5px; font-weight: 600; text-align: left;
  transition: .15s;
}
.nav-item:hover { color: #e2e8f0; background: rgba(255, 255, 255, .05); }
.nav-item.active { color: #fff; background: rgba(37, 99, 235, .22); box-shadow: inset 3px 0 0 #60a5fa; }
.nav-item.active .icon { color: #93c5fd; }
.side-bottom { margin-top: auto; display: grid; gap: 10px; padding-bottom: 4px; }
.server-card {
  border: 1px solid rgba(148, 163, 184, .14);
  background: rgba(255, 255, 255, .035);
  border-radius: 12px; padding: 12px;
}
.server-line { display: flex; align-items: center; gap: 8px; color: #e2e8f0; font-size: 12.5px; }
.pulse {
  width: 8px; height: 8px; border-radius: 50%; background: #34d399;
  box-shadow: 0 0 0 4px rgba(52, 211, 153, .12);
  animation: pulse 2.2s infinite;
}
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(52, 211, 153, .03); } }
.server-meta { margin-top: 7px; color: #64748b; font-size: 11px; }
.logout-btn { color: #94a3b8; width: 100%; }
.logout-btn:hover { color: #fca5a5; background: rgba(220, 38, 38, .1); }

.main {
  margin-left: var(--sidebar);
  min-height: 100vh;
  padding: 26px 30px 46px;
  max-width: 1560px;
}
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.topbar h1 { margin: 6px 0 4px; font-size: 26px; letter-spacing: -.3px; }
.topbar p { margin: 0; color: var(--muted); font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 11px; border-radius: 999px;
  background: var(--ok-soft); color: var(--ok); font-size: 12px; font-weight: 700;
  border: 1px solid #d1fae5;
}
.status-pill .icon { width: 14px; height: 14px; }
.admin-chip { display: flex; align-items: center; gap: 10px; padding-left: 14px; border-left: 1px solid var(--line); }
.admin-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #1565c0, #7c3aed);
  color: #fff; font-weight: 800; font-size: 13px;
}
.admin-meta { display: grid; line-height: 1.25; }
.admin-meta strong { font-size: 12.5px; }
.admin-meta small { color: var(--muted); font-size: 10.5px; }

/* ============ 通用 ============ */
.view { display: grid; gap: 18px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 17px 19px; border-bottom: 1px solid var(--line-2); }
.card-head h2 { margin: 0; font-size: 14.5px; }
.card-head p { margin: 3px 0 0; font-size: 12px; color: var(--muted); }
.card-body { padding: 18px 19px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, Consolas, monospace; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.stack { display: grid; gap: 14px; }
.grid-2 { display: grid; grid-template-columns: 1.35fr .85fr; gap: 18px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: start; }
.section-title { margin: 0 0 12px; font-size: 14px; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.empty .icon { width: 30px; height: 30px; color: #cbd5e1; margin-bottom: 8px; }

/* 统计卡 */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat {
  position: relative; overflow: hidden;
  padding: 17px 18px;
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.stat::after { content: ""; position: absolute; right: -24px; top: -24px; width: 92px; height: 92px; border-radius: 50%; background: var(--tint, #eff6ff); }
.stat-ico {
  position: relative; z-index: 1;
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--tint, #eff6ff); color: var(--tone, var(--brand));
  margin-bottom: 14px;
}
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value { margin-top: 3px; font-size: 27px; font-weight: 800; letter-spacing: -.5px; }
.stat-sub { margin-top: 5px; font-size: 11.5px; color: var(--muted-2); }
.stat-sub b { color: var(--ok); }

/* 仪表盘 */
.dash-grid { display: grid; grid-template-columns: 1.3fr .7fr; gap: 18px; align-items: start; }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick {
  display: flex; flex-direction: column; gap: 8px; align-items: flex-start;
  padding: 14px; border: 1px solid var(--line); border-radius: 11px;
  background: #fff; text-align: left; transition: .15s;
}
.quick:hover { border-color: #bfdbfe; background: #f8fbff; transform: translateY(-1px); }
.quick .icon { color: var(--brand); }
.quick strong { font-size: 12.5px; }
.quick small { color: var(--muted); font-size: 11px; line-height: 1.5; }

.theme-mini { display: flex; align-items: center; gap: 14px; }
.theme-swatch { width: 58px; height: 58px; border-radius: 15px; border: 1px solid rgba(15, 23, 42, .08); position: relative; overflow: hidden; }
.theme-swatch span { position: absolute; border-radius: 50%; }
.theme-swatch .s1 { width: 28px; height: 28px; left: 8px; top: 9px; }
.theme-swatch .s2 { width: 18px; height: 18px; right: 8px; bottom: 9px; }
.theme-name { font-weight: 800; font-size: 14px; }
.theme-meta { color: var(--muted); font-size: 11.5px; margin-top: 4px; }

.audit-list { display: grid; gap: 0; }
.audit-row { display: grid; grid-template-columns: 32px 1fr auto; gap: 11px; align-items: center; padding: 11px 0; border-top: 1px solid var(--line-2); }
.audit-row:first-child { border-top: 0; }
.audit-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: #f1f5f9; color: var(--muted); }
.audit-ico .icon { width: 15px; height: 15px; }
.audit-main { min-width: 0; }
.audit-main strong { display: block; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audit-main small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audit-time { color: var(--muted-2); font-size: 11px; white-space: nowrap; }

/* 表格 */
.table-wrap { overflow: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.table th {
  text-align: left; font-size: 11px; letter-spacing: .5px; text-transform: uppercase;
  color: var(--muted); background: #f8fafc; padding: 11px 14px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fbfdff; }
.user-cell { display: flex; align-items: center; gap: 10px; min-width: 170px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; font-size: 13px; font-weight: 800;
  flex: 0 0 auto;
}
.user-name { font-weight: 700; }
.user-id { color: var(--muted-2); font-size: 10.5px; margin-top: 2px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 23px; padding: 0 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; white-space: nowrap;
}
.chip .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-danger { background: var(--danger-soft); color: var(--danger); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-gray { background: #f1f5f9; color: var(--muted); }
.chip-brand { background: var(--brand-soft); color: var(--brand); }
.chip-purple { background: var(--purple-soft); color: var(--purple); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; display: grid; place-items: center; color: var(--muted);
}
.icon-btn:hover { color: var(--brand); border-color: #bfdbfe; background: #f8fbff; }
.icon-btn.danger:hover { color: var(--danger); border-color: #fecaca; background: var(--danger-soft); }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.search { position: relative; }
.search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted-2); }
.search input { height: 36px; padding-left: 34px; width: 240px; border: 1px solid var(--line); border-radius: 9px; outline: none; }
.search input:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }
.select { height: 36px; width: auto; min-width: 120px; padding: 0 10px; border-radius: 9px; }
.form-row { display: grid; gap: 7px; margin-bottom: 15px; }
.form-row > label, .form-row > span.lbl { font-size: 12.5px; font-weight: 700; }
.form-row .hint { font-size: 11.5px; color: var(--muted); line-height: 1.6; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 42px; height: 24px; border-radius: 999px; background: #e2e8f0; transition: .18s; position: relative; }
.switch .track::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; background: #fff; left: 3px; top: 3px; transition: .18s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.switch input:checked + .track { background: var(--brand-2); }
.switch input:checked + .track::after { transform: translateX(18px); }
.setting-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 15px 0; border-top: 1px solid var(--line-2); }
.setting-row:first-child { border-top: 0; padding-top: 0; }
.setting-row strong { display: block; font-size: 13px; }
.setting-row p { margin: 4px 0 0; color: var(--muted); font-size: 11.5px; line-height: 1.6; max-width: 520px; }
.setting-row .control { flex: 0 0 auto; }

/* ============ 主题编辑器 ============ */
.theme-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr) 200px; gap: 16px; align-items: start; }
.theme-list, .theme-history { position: sticky; top: 18px; }
.theme-list .card-body, .theme-history .card-body { padding: 10px; }
.theme-items { display: grid; gap: 6px; max-height: 560px; overflow: auto; }
.theme-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px; border: 1px solid transparent; border-radius: 10px;
  background: transparent; text-align: left; transition: .15s;
}
.theme-item:hover { background: #f8fafc; }
.theme-item.active { border-color: #bfdbfe; background: #eff6ff; }
.theme-thumb { width: 38px; height: 38px; border-radius: 10px; flex: 0 0 auto; border: 1px solid rgba(15, 23, 42, .08); position: relative; overflow: hidden; }
.theme-thumb i { position: absolute; border-radius: 50%; }
.theme-thumb i:nth-child(1) { width: 20px; height: 20px; left: 6px; top: 6px; }
.theme-thumb i:nth-child(2) { width: 12px; height: 12px; right: 6px; bottom: 6px; }
.theme-item-main { min-width: 0; flex: 1; }
.theme-item-name { font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.theme-item-meta { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.theme-item .chip { height: 18px; font-size: 9.5px; padding: 0 6px; }
.editor-card { overflow: hidden; }
.editor-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.editor-title { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 220px; }
.editor-title .input { height: 36px; width: 180px; font-weight: 700; }
.editor-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.editor-body { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 20px; padding: 20px; }
.preview-pane { display: flex; justify-content: center; align-items: flex-start; padding: 8px 0 14px; }
.controls-pane { display: grid; gap: 18px; align-content: start; }
.control-block { border-top: 1px solid var(--line-2); padding-top: 16px; }
.control-block:first-child { border-top: 0; padding-top: 0; }
.control-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px; }
.control-title h3 { margin: 0; font-size: 12.5px; }
.control-title span { color: var(--muted); font-size: 10.5px; }
.presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.preset {
  border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 7px;
  display: flex; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 700;
}
.preset:hover { border-color: #bfdbfe; background: #f8fbff; }
.preset .sw { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .08); flex: 0 0 auto; }
.color-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.color-row { display: flex; align-items: center; gap: 8px; }
.color-row label { font-size: 11px; color: var(--muted); flex: 0 0 52px; }
.color-row input[type="color"] { width: 30px; height: 26px; padding: 2px; border: 1px solid var(--line); border-radius: 7px; background: #fff; cursor: pointer; flex: 0 0 auto; }
.color-row .hex { flex: 1; width: auto; min-width: 70px; height: 26px; padding: 0 6px; border: 1px solid var(--line); border-radius: 7px; font-family: ui-monospace, Consolas, monospace; font-size: 10.5px; text-transform: uppercase; }
.range-row { display: grid; grid-template-columns: 1fr 42px; gap: 10px; align-items: center; }
input[type="range"] { width: 100%; accent-color: var(--brand-2); }
.range-val { text-align: right; font-size: 11px; color: var(--muted); font-family: ui-monospace, Consolas, monospace; }
.seg { display: inline-flex; padding: 3px; background: #f1f5f9; border-radius: 9px; gap: 2px; }
.seg button { border: 0; background: transparent; height: 28px; padding: 0 10px; border-radius: 7px; font-size: 11px; color: var(--muted); font-weight: 600; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(15, 23, 42, .08); }
.tab-order { display: grid; gap: 6px; }
.tab-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 11.5px; }
.tab-row .icon-btn { width: 26px; height: 26px; }
.version-list { display: grid; gap: 7px; max-height: 420px; overflow: auto; }
.version {
  padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font-size: 11.5px;
}
.version.active { border-color: #bbf7d0; background: var(--ok-soft); }
.version .v-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.version .v-top strong { font-size: 12px; }
.version .v-meta { color: var(--muted); font-size: 10.5px; margin-top: 3px; }
.version .v-actions { margin-top: 7px; display: flex; gap: 6px; }

/* 手机预览 */
.phone {
  width: 300px; height: 610px;
  border-radius: 42px; border: 9px solid #101418;
  background: #101418;
  box-shadow: 0 30px 60px rgba(15, 23, 42, .22), inset 0 0 0 1px rgba(255, 255, 255, .08);
  position: relative; overflow: hidden;
  --tp-primary: #1565c0; --tp-bg: #f4f7fb; --tp-surface: #fff; --tp-text: #172033;
  --tp-bo: #d6e4ff; --tp-bi: #fff; --tp-corner: 16px; --tp-avatar: 50%;
}
.phone-notch {
  position: absolute; z-index: 5; top: 8px; left: 50%; transform: translateX(-50%);
  width: 86px; height: 20px; border-radius: 999px; background: #101418;
}
.phone-status {
  height: 34px; padding: 0 18px;
  display: flex; align-items: flex-end; justify-content: space-between;
  background: var(--tp-surface); color: var(--tp-text); font-size: 9px; font-weight: 700;
}
.phone-screen { height: 100%; display: flex; flex-direction: column; background: var(--tp-bg); color: var(--tp-text); overflow: hidden; }
.phone-head {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 13px 10px; background: var(--tp-surface);
  border-bottom: 1px solid rgba(15, 23, 42, .06);
}
.phone-avatar {
  width: 27px; height: 27px; border-radius: var(--tp-avatar);
  display: grid; place-items: center; color: #fff; font-size: 10px; font-weight: 800;
  background: var(--tp-primary);
}
.phone-head-main { flex: 1; min-width: 0; }
.phone-head-name { font-size: 11px; font-weight: 800; }
.phone-head-sub { font-size: 8px; color: var(--tp-primary); margin-top: 1px; }
.phone-head .dots { color: var(--tp-text); opacity: .45; font-size: 14px; letter-spacing: 1px; }
.phone-chat { flex: 1; padding: 12px 11px; overflow: hidden; position: relative; }
.phone-chat.wp-grid {
  background-image: linear-gradient(rgba(15, 23, 42, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(15, 23, 42, .045) 1px, transparent 1px);
  background-size: 18px 18px;
}
.phone-chat.wp-dots {
  background-image: radial-gradient(rgba(15, 23, 42, .10) 1px, transparent 1px);
  background-size: 14px 14px;
}
.phone-chat.wp-gradient { background: linear-gradient(180deg, rgba(21, 101, 192, .13), transparent 55%); }
.bubble-row { display: flex; gap: 6px; margin-bottom: 9px; align-items: flex-end; }
.bubble-row.out { justify-content: flex-end; }
.mini-avatar { width: 20px; height: 20px; border-radius: var(--tp-avatar); background: #94a3b8; color: #fff; display: grid; place-items: center; font-size: 8px; font-weight: 800; flex: 0 0 auto; }
.bubble {
  max-width: 196px; padding: 8px 10px; font-size: 10.5px; line-height: 1.5;
  border-radius: var(--tp-corner); background: var(--tp-bi); color: var(--tp-text);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
}
.bubble-row.out .bubble { background: var(--tp-bo); }
.bubble .time { display: block; margin-top: 3px; font-size: 7px; opacity: .45; text-align: right; }
.bubble-img {
  width: 128px; height: 78px; border-radius: calc(var(--tp-corner) - 4px);
  background: linear-gradient(135deg, #93c5fd, #c4b5fd 60%, #fbcfe8);
  margin-bottom: 5px; position: relative;
}
.bubble-img::after { content: "照片"; position: absolute; right: 6px; bottom: 4px; color: rgba(255,255,255,.9); font-size: 7px; }
.phone-input {
  display: flex; align-items: center; gap: 6px; padding: 8px 10px;
  background: var(--tp-surface); border-top: 1px solid rgba(15, 23, 42, .06);
}
.phone-input .fake-input {
  flex: 1; height: 28px; border-radius: 999px; background: var(--tp-bg);
  color: var(--tp-text); opacity: .55; font-size: 9px; display: flex; align-items: center; padding: 0 10px;
}
.phone-send { width: 28px; height: 28px; border-radius: 50%; background: var(--tp-primary); color: #fff; display: grid; place-items: center; font-size: 11px; }
.phone-tabs {
  display: flex; justify-content: space-around; padding: 7px 4px 12px;
  background: var(--tp-surface); border-top: 1px solid rgba(15, 23, 42, .06);
}
.phone-tab { font-size: 8px; color: var(--tp-text); opacity: .4; display: grid; justify-items: center; gap: 2px; }
.phone-tab.on { opacity: 1; color: var(--tp-primary); font-weight: 800; }
.phone-tab i { width: 13px; height: 13px; border-radius: 4px; border: 1.5px solid currentColor; display: block; }
.phone[data-font="serif"] .phone-screen { font-family: Georgia, "Times New Roman", "Songti SC", serif; }
.phone[data-font="mono"] .phone-screen { font-family: ui-monospace, Consolas, monospace; }

/* ============ 弹窗 / Toast ============ */
.modal-root { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .48); backdrop-filter: blur(3px); }
.modal-panel {
  position: relative; z-index: 1; width: min(440px, 100%);
  background: #fff; border-radius: 16px; box-shadow: 0 30px 80px rgba(15, 23, 42, .3);
  overflow: hidden; animation: pop .16s ease-out;
}
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: .6; } }
.modal-head { padding: 18px 20px 6px; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.modal-body { padding: 14px 20px 4px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 16px 20px 18px; }
.toast-root { position: fixed; right: 22px; top: 20px; z-index: 100; display: grid; gap: 9px; }
.toast {
  min-width: 220px; max-width: 360px;
  display: flex; align-items: flex-start; gap: 9px;
  padding: 11px 13px; border-radius: 11px;
  background: #0f172a; color: #fff; font-size: 12.5px; line-height: 1.5;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .28);
  animation: toastIn .18s ease-out;
}
.toast.ok { background: #064e3b; }
.toast.err { background: #7f1d1d; }
.toast .icon { width: 16px; height: 16px; margin-top: 1px; }
@keyframes toastIn { from { transform: translateY(-6px); opacity: 0; } }

/* ============ 响应式 ============ */
@media (max-width: 1260px) {
  .theme-layout { grid-template-columns: 190px minmax(0, 1fr); }
  .theme-history { grid-column: 1 / -1; position: static; }
  .version-list { grid-template-columns: repeat(2, minmax(0, 1fr)); display: grid; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
  :root { --sidebar: 72px; }
  .sidebar { padding: 18px 10px; }
  .side-brand { justify-content: center; padding-bottom: 18px; }
  .side-brand > div:last-child { display: none; }
  .side-nav .nav-item { justify-content: center; padding: 0; }
  .side-nav .nav-item span { display: none; }
  .side-nav .nav-item .icon { width: 20px; height: 20px; }
  .server-card { display: none; }
  .logout-btn span { display: none; }
  .dash-grid, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .editor-body { grid-template-columns: 1fr; }
  .preview-pane { order: -1; }
  .theme-layout { grid-template-columns: 1fr; }
  .theme-list { position: static; }
  .theme-items { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .theme-history { position: static; }
}
@media (max-width: 760px) {
  .login-card { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-panel { padding: 36px 26px; }
  .main { padding: 18px 16px 34px; }
  .topbar { flex-direction: column; gap: 14px; }
  .topbar-actions { width: 100%; justify-content: space-between; }
  .stat-grid, .form-grid { grid-template-columns: 1fr; }
  .toolbar .search input { width: 100%; }
  .toolbar .search { flex: 1; min-width: 160px; }
  .theme-items { grid-template-columns: 1fr; }
  .version-list { grid-template-columns: 1fr; }
  .color-grid { grid-template-columns: 1fr; }
  .phone { transform: scale(.92); transform-origin: top center; margin-bottom: -48px; }
}
