/* =========================================================
   星枢 NEXUS · Interface System
   Deep-space glass / orbital telemetry / Chinese-first
   ========================================================= */

:root {
  --bg: #05070c;
  --bg-2: #070b13;
  --bg-3: #0a101a;
  --panel: rgba(13, 19, 30, 0.72);
  --panel-solid: #0b111b;
  --panel-2: rgba(20, 29, 45, 0.74);
  --panel-3: rgba(26, 37, 55, 0.9);
  --line: rgba(138, 178, 235, 0.12);
  --line-soft: rgba(138, 178, 235, 0.07);
  --line-strong: rgba(150, 205, 255, 0.26);
  --text: #eaf2ff;
  --text-soft: #c3d1e6;
  --muted: #8798b1;
  --dim: #5b6b83;
  --accent: #4de1ff;
  --accent-2: #8b7cff;
  --accent-rgb: 77, 225, 255;
  --accent-2-rgb: 139, 124, 255;
  --success: #42f5c5;
  --success-rgb: 66, 245, 197;
  --warning: #ffc857;
  --danger: #ff6b85;
  --danger-rgb: 255, 107, 133;
  --violet: #a78bfa;
  --amber: #f2b36b;
  --radius-xl: 26px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 18px 44px rgba(0, 0, 0, 0.32);
  --font: "Segoe UI Variable Display", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --sidebar-w: 286px;
  --inspector-w: 306px;
}

[data-accent="violet"] {
  --accent: #a78bfa;
  --accent-2: #4de1ff;
  --accent-rgb: 167, 139, 250;
  --accent-2-rgb: 77, 225, 255;
}

[data-accent="emerald"] {
  --accent: #42f5c5;
  --accent-2: #4db8ff;
  --accent-rgb: 66, 245, 197;
  --accent-2-rgb: 77, 184, 255;
}

[data-theme="light"] {
  --bg: #e9eff8;
  --bg-2: #e3ebf5;
  --bg-3: #f8fbff;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-solid: #ffffff;
  --panel-2: rgba(255, 255, 255, 0.93);
  --panel-3: #ffffff;
  --line: rgba(21, 57, 96, 0.14);
  --line-soft: rgba(21, 57, 96, 0.08);
  --line-strong: rgba(20, 90, 160, 0.27);
  --text: #071425;
  --text-soft: #213750;
  --muted: #4d617b;
  --dim: #6d7f96;
  --success: #0a9a75;
  --success-rgb: 10, 154, 117;
  --warning: #a86b05;
  --danger: #ca3451;
  --danger-rgb: 202, 52, 81;
  --violet: #6f50e0;
  --shadow-lg: 0 30px 80px rgba(25, 54, 92, 0.16);
  --shadow-md: 0 18px 44px rgba(25, 54, 92, 0.11);
  color-scheme: light;
}

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

[hidden] { display: none !important; }

html {
  height: 100%;
  background: var(--bg);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

[data-theme="light"] html { color-scheme: light; }

body {
  margin: 0;
  min-height: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: var(--accent); text-decoration: none; }
img, svg { display: block; }
::selection { background: rgba(var(--accent-rgb), 0.28); color: #fff; }
[data-theme="light"] ::selection { color: #061018; }

:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.72);
  outline-offset: 2px;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(140, 170, 210, 0.19);
  border: 2px solid transparent;
  background-clip: content-box;
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(140, 190, 240, 0.34); background-clip: content-box; }

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.svg-sprite symbol { fill: none; }

.hidden { display: none !important; }
.mobile-only { display: none !important; }
.mono { font-family: var(--mono); }
.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.19em;
  text-transform: uppercase;
}
.eyebrow > span {
  width: 18px;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
}
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--dim);
  flex: 0 0 auto;
}
.dot.live {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(var(--success-rgb), 0.08), 0 0 12px rgba(var(--success-rgb), 0.8);
  animation: breathe 2.6s ease-in-out infinite;
}
.dot.warn { background: var(--warning); box-shadow: 0 0 10px rgba(255, 200, 87, 0.7); }
.dot.error { background: var(--danger); box-shadow: 0 0 10px rgba(var(--danger-rgb), 0.7); }

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-bottom-color: var(--line-strong);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}
[data-theme="light"] kbd { background: rgba(15, 40, 70, 0.04); }

/* ---------- Ambient background ---------- */

.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 55% at 18% -12%, rgba(var(--accent-rgb), 0.08), transparent 62%),
    radial-gradient(ellipse 70% 50% at 92% 8%, rgba(var(--accent-2-rgb), 0.09), transparent 64%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}
.ambient-grid {
  position: absolute;
  inset: -20%;
  background-image:
    linear-gradient(rgba(130, 175, 230, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(130, 175, 230, 0.045) 1px, transparent 1px);
  background-size: 58px 58px;
  transform: perspective(900px) rotateX(58deg) translateY(-12%);
  transform-origin: center top;
  mask-image: radial-gradient(ellipse 62% 64% at 50% 38%, #000 12%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 62% 64% at 50% 38%, #000 12%, transparent 78%);
  opacity: 0.8;
}
[data-theme="light"] .ambient-grid { opacity: 0.32; }
.ambient-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
}
.glow-a { width: 40vw; height: 40vw; left: -14vw; top: 12vh; background: rgba(var(--accent-rgb), 0.12); }
.glow-b { width: 36vw; height: 36vw; right: -12vw; top: -10vh; background: rgba(var(--accent-2-rgb), 0.13); }
.glow-c { width: 34vw; height: 34vw; right: 22vw; bottom: -24vw; background: rgba(80, 130, 255, 0.08); }
[data-theme="light"] .ambient-glow { opacity: 0.5; filter: blur(110px); }
.ambient-noise {
  position: absolute;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 140 140' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

/* ---------- Brand glyph / orb ---------- */

.brand-glyph {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 12px;
  border: 1px solid rgba(var(--accent-rgb), 0.28);
  background:
    radial-gradient(circle at 30% 22%, rgba(var(--accent-rgb), 0.3), transparent 55%),
    linear-gradient(145deg, rgba(20, 30, 47, 0.95), rgba(7, 11, 19, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 8px 24px rgba(0, 0, 0, 0.32), 0 0 24px rgba(var(--accent-rgb), 0.08);
  overflow: hidden;
}
.brand-glyph::before {
  content: "";
  width: 15px;
  height: 15px;
  border: 1.4px solid rgba(var(--accent-rgb), 0.85);
  border-radius: 5px;
  transform: rotate(45deg);
  box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.55), inset 0 0 8px rgba(var(--accent-rgb), 0.16);
}
.brand-glyph::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 10px var(--accent-2);
  transform: translate(9px, -9px);
}
.brand-glyph i {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  transform: translate(-10px, 9px);
}
[data-theme="light"] .brand-glyph {
  background: linear-gradient(145deg, #fff, #eaf2ff);
  box-shadow: inset 0 1px 0 #fff, 0 8px 20px rgba(20, 60, 100, 0.12);
}
.glyph-md { width: 38px; height: 38px; }
.glyph-lg { width: 58px; height: 58px; border-radius: 17px; }
.glyph-lg::before { width: 23px; height: 23px; }
.glyph-xl { width: 76px; height: 76px; border-radius: 22px; }
.glyph-xl::before { width: 30px; height: 30px; }

.orb {
  position: relative;
  border-radius: 50%;
  background: conic-gradient(from 210deg, rgba(var(--accent-rgb), 0.08), var(--accent), var(--accent-2), rgba(var(--accent-2-rgb), 0.12), var(--accent));
  box-shadow: 0 0 50px rgba(var(--accent-rgb), 0.34), inset 0 0 26px rgba(255, 255, 255, 0.18);
  animation: orb-spin 18s linear infinite;
}
.orb::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.28), transparent 16%),
    radial-gradient(circle at 34% 26%, rgba(255, 255, 255, 0.24), transparent 22%),
    radial-gradient(circle at 68% 70%, rgba(var(--accent-2-rgb), 0.3), transparent 54%),
    radial-gradient(circle at 44% 54%, rgba(var(--accent-rgb), 0.14), transparent 65%),
    #070b13;
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.72);
}
.orb::after {
  content: "";
  position: absolute;
  inset: -9px;
  border-radius: 50%;
  border: 1px solid rgba(var(--accent-rgb), 0.16);
  border-top-color: rgba(var(--accent-rgb), 0.66);
  animation: orb-spin 8s linear infinite reverse;
}
[data-theme="light"] .orb::before { background: radial-gradient(circle at 34% 28%, #fff, #dfeaff 42%, #f7fbff 76%); }

@keyframes orb-spin { to { transform: rotate(360deg); } }
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@keyframes float-soft { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes fade-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes scale-in { from { opacity: 0; transform: scale(0.97) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes shimmer { 0% { background-position: -220% 0; } 100% { background-position: 220% 0; } }
@keyframes ring-pulse { 0% { transform: scale(0.92); opacity: 0.7; } 70% { transform: scale(1.18); opacity: 0; } 100% { opacity: 0; } }
@keyframes blink { 0%, 45% { opacity: 1; } 50%, 100% { opacity: 0.05; } }
@keyframes slide-in-right { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ---------- Common controls ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: transform 0.18s var(--ease), background 0.18s, border-color 0.18s, box-shadow 0.18s, opacity 0.18s;
  white-space: nowrap;
}
.btn svg { width: 17px; height: 17px; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #041017;
  border-color: transparent;
  box-shadow: 0 8px 26px rgba(var(--accent-rgb), 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.btn-primary:hover { box-shadow: 0 12px 32px rgba(var(--accent-rgb), 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.45); }
.btn-primary:disabled { filter: grayscale(0.4); opacity: 0.55; }
.btn-ghost {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-soft);
}
.btn-ghost:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.05); color: var(--text); }
.btn-danger { border-color: rgba(var(--danger-rgb), 0.3); background: rgba(var(--danger-rgb), 0.09); color: var(--danger); }
.btn-danger:hover { background: rgba(var(--danger-rgb), 0.15); }
.btn-sm { min-height: 36px; padding: 0 13px; font-size: 12.5px; border-radius: 9px; }
.btn-sm svg { width: 15px; height: 15px; }
.btn-lg { min-height: 50px; font-size: 15px; border-radius: 13px; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  transition: color 0.18s, background 0.18s, border-color 0.18s, transform 0.18s;
  flex: 0 0 auto;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.055); border-color: var(--line); }
.icon-btn:active { transform: scale(0.96); }
.icon-btn.tiny { width: 30px; height: 30px; border-radius: 8px; }
.icon-btn.tiny svg { width: 15px; height: 15px; }

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  transition: color 0.18s;
}
.link-btn svg { width: 13px; height: 13px; }
.link-btn:hover { color: var(--accent); }
.tiny-link { font-size: 11px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.badge-emerald { border-color: rgba(var(--success-rgb), 0.22); background: rgba(var(--success-rgb), 0.08); color: var(--success); }
.badge-cyan { border-color: rgba(var(--accent-rgb), 0.24); background: rgba(var(--accent-rgb), 0.08); color: var(--accent); }
.badge-violet { border-color: rgba(167, 139, 250, 0.24); background: rgba(167, 139, 250, 0.09); color: var(--violet); }
.badge-amber { border-color: rgba(255, 200, 87, 0.24); background: rgba(255, 200, 87, 0.08); color: var(--warning); }

.field { display: flex; flex-direction: column; gap: 8px; }
.field-label { color: var(--text-soft); font-size: 12.5px; font-weight: 600; }
.field-hint { color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(6, 10, 17, 0.52);
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
[data-theme="light"] .input-wrap { background: rgba(255, 255, 255, 0.66); }
.input-wrap:focus-within {
  border-color: rgba(var(--accent-rgb), 0.55);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.08);
  background: rgba(6, 10, 17, 0.72);
}
[data-theme="light"] .input-wrap:focus-within { background: #fff; }
.input-wrap .input-icon { width: 17px; height: 17px; color: var(--dim); flex: 0 0 auto; }
.input-wrap input,
.input-wrap textarea {
  width: 100%;
  min-width: 0;
  height: 44px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
}
.input-wrap textarea { height: auto; min-height: 84px; padding: 12px 0; resize: vertical; line-height: 1.6; }
.input-wrap input::placeholder, .input-wrap textarea::placeholder { color: var(--dim); }
.input-action { width: 28px; height: 28px; }
.input-action svg { width: 15px; height: 15px; }
input[type="search"] { -webkit-appearance: none; appearance: none; }
input[type="search"]::-webkit-search-cancel-button { display: none; }
select {
  width: 100%;
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: 0;
  background: var(--panel-solid);
  color: var(--text);
}
.form-error {
  padding: 10px 12px;
  border: 1px solid rgba(var(--danger-rgb), 0.24);
  border-radius: 9px;
  background: rgba(var(--danger-rgb), 0.08);
  color: var(--danger);
  font-size: 12px;
  line-height: 1.5;
}
.form-success {
  padding: 10px 12px;
  border: 1px solid rgba(var(--success-rgb), 0.22);
  border-radius: 9px;
  background: rgba(var(--success-rgb), 0.07);
  color: var(--success);
  font-size: 12px;
}

.switch {
  position: relative;
  width: 38px;
  height: 22px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid rgba(150, 190, 235, 0.22);
  border-radius: 99px;
  background: rgba(150, 190, 235, 0.13);
  transition: background 0.2s, border-color 0.2s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #8798b1;
  transition: transform 0.22s var(--ease), background 0.2s, box-shadow 0.2s;
}
.switch.on { background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.72), rgba(var(--accent-2-rgb), 0.68)); border-color: rgba(var(--accent-rgb), 0.9); box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.15), 0 0 12px rgba(var(--accent-rgb), 0.18); }
.switch.on::after { transform: translateX(16px); background: #fff; box-shadow: 0 0 8px rgba(255, 255, 255, 0.65); }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.status-pill.bad { color: var(--danger); border-color: rgba(var(--danger-rgb), 0.22); }
.status-pill.bad .dot { background: var(--danger); box-shadow: 0 0 10px rgba(var(--danger-rgb), 0.7); }

/* ---------- Boot ---------- */

.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: var(--bg);
  transition: opacity 0.5s ease, visibility 0.5s;
}
.boot-screen.done { opacity: 0; visibility: hidden; }
.boot-mark { position: relative; display: grid; place-items: center; width: 100px; height: 100px; }
.boot-ring {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(var(--accent-rgb), 0.24);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: orb-spin 1.6s linear infinite;
}
.boot-ring::before {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1px dashed rgba(var(--accent-2-rgb), 0.26);
  border-radius: 50%;
  animation: orb-spin 4s linear infinite reverse;
}
.boot-name { font-size: 20px; font-weight: 300; letter-spacing: 0.16em; }
.boot-name b { font-weight: 700; color: var(--accent); }
.boot-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; }
.boot-bar { width: 180px; height: 2px; overflow: hidden; border-radius: 99px; background: rgba(255, 255, 255, 0.07); }
.boot-bar i { display: block; width: 40%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent); animation: boot-load 1.4s ease-in-out infinite; }
@keyframes boot-load { 0% { transform: translateX(-110%); } 100% { transform: translateX(360%); } }

/* ---------- Auth ---------- */

.auth-screen {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(460px, 0.92fr);
  gap: 22px;
  min-height: 100dvh;
  padding: 24px;
  overflow: auto;
}
.auth-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 640px;
  padding: 38px 44px 30px;
  border: 1px solid var(--line);
  border-radius: 28px;
  overflow: hidden;
  background:
    radial-gradient(circle at 68% 42%, rgba(var(--accent-rgb), 0.07), transparent 36%),
    radial-gradient(circle at 20% 90%, rgba(var(--accent-2-rgb), 0.08), transparent 46%),
    linear-gradient(155deg, rgba(12, 19, 31, 0.92), rgba(5, 8, 14, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), var(--shadow-lg);
}
[data-theme="light"] .auth-visual {
  background:
    radial-gradient(circle at 68% 42%, rgba(var(--accent-rgb), 0.14), transparent 36%),
    radial-gradient(circle at 20% 90%, rgba(var(--accent-2-rgb), 0.11), transparent 46%),
    linear-gradient(155deg, #ffffff, #eaf2fc);
}
.auth-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(130, 175, 230, 0.04) 1px, transparent 1px), linear-gradient(90deg, rgba(130, 175, 230, 0.04) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse 70% 70% at 55% 48%, #000, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 55% 48%, #000, transparent 78%);
  pointer-events: none;
}
.auth-brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 15px; }
.brand-name { font-size: 19px; font-weight: 300; letter-spacing: 0.08em; white-space: nowrap; }
.brand-name b { font-weight: 700; color: var(--text); }
.brand-sub { margin-top: 2px; color: var(--dim); font-family: var(--mono); font-size: 8px; font-weight: 600; letter-spacing: 0.22em; white-space: nowrap; }
.auth-orb-wrap {
  position: relative;
  flex: 1;
  min-height: 280px;
  display: grid;
  place-items: center;
  z-index: 1;
}
.auth-orb { width: clamp(130px, 15vw, 190px); height: clamp(130px, 15vw, 190px); animation-duration: 22s; }
.auth-orb::before { inset: 13px; }
.auth-orb::after { inset: -20px; }
.auth-orbit {
  position: absolute;
  border: 1px solid rgba(var(--accent-rgb), 0.13);
  border-radius: 50%;
  transform: rotate(-22deg) scaleY(0.42);
  pointer-events: none;
}
.orbit-one { width: 76%; height: 76%; border-top-color: rgba(var(--accent-rgb), 0.4); animation: orbit-rotate 16s linear infinite; }
.orbit-two { width: 92%; height: 92%; border-right-color: rgba(var(--accent-2-rgb), 0.38); transform: rotate(32deg) scaleY(0.36); animation: orbit-rotate 24s linear infinite reverse; }
.orbit-three { width: 60%; height: 60%; border-bottom-color: rgba(var(--accent-rgb), 0.3); transform: rotate(70deg) scaleY(0.48); animation: orbit-rotate 12s linear infinite; }
.orbit-node { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 14px var(--accent); }
.node-a { transform: translate(-150px, -72px); }
.node-b { transform: translate(142px, 70px); background: var(--accent-2); box-shadow: 0 0 14px var(--accent-2); }
@keyframes orbit-rotate { to { rotate: 360deg; } }
.auth-copy { position: relative; z-index: 1; max-width: 540px; }
.auth-copy h2 {
  margin: 15px 0 13px;
  font-size: clamp(36px, 4.2vw, 58px);
  font-weight: 600;
  line-height: 1.13;
  letter-spacing: -0.055em;
  background: linear-gradient(120deg, var(--text) 34%, rgba(var(--accent-rgb), 0.9) 78%, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.auth-copy > p:not(.eyebrow) { max-width: 440px; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.85; }
.auth-feature-row { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 24px; }
.auth-feature-row span { display: flex; align-items: center; gap: 7px; color: var(--text-soft); font-size: 11.5px; font-weight: 600; }
.auth-feature-row svg { width: 15px; height: 15px; color: var(--accent); }
.auth-foot { position: relative; z-index: 1; color: var(--dim); font-family: var(--mono); font-size: 8px; letter-spacing: 0.24em; }

.auth-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; }
.auth-card {
  width: 100%;
  max-width: 446px;
  padding: 34px 34px 26px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(160deg, rgba(17, 25, 39, 0.86), rgba(8, 12, 20, 0.9));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), var(--shadow-lg);
  backdrop-filter: blur(28px);
  animation: scale-in 0.55s var(--ease);
}
[data-theme="light"] .auth-card { background: rgba(255, 255, 255, 0.86); }
.auth-card-head .eyebrow { margin-bottom: 13px; }
.auth-card-head h1 { margin: 0 0 10px; font-size: 25px; font-weight: 650; letter-spacing: -0.035em; }
.auth-card-head > p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.75; }
.auth-mobile-brand { display: none; align-items: center; gap: 10px; margin-bottom: 24px; font-size: 16px; }
.auth-mobile-brand b { color: var(--accent); }
.auth-form { display: flex; flex-direction: column; gap: 15px; margin-top: 26px; }
.strength { padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255, 255, 255, 0.02); }
.strength-head { display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; font-weight: 600; }
.strength-head b { color: var(--text-soft); font-family: var(--mono); font-size: 9px; letter-spacing: 0.08em; }
.strength-bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 7px; }
.strength-bars i { height: 3px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); transition: background 0.2s; }
.strength[data-score="1"] .strength-bars i:nth-child(1) { background: var(--danger); }
.strength[data-score="2"] .strength-bars i:nth-child(-n+2) { background: var(--warning); }
.strength[data-score="3"] .strength-bars i:nth-child(-n+3) { background: var(--accent); }
.strength[data-score="4"] .strength-bars i { background: var(--success); }
.auth-note, .auth-demo-note { display: flex; align-items: flex-start; gap: 8px; margin-top: 18px; color: var(--dim); font-size: 10.5px; line-height: 1.55; }
.auth-note svg { width: 14px; height: 14px; flex: 0 0 auto; margin-top: 1px; color: var(--muted); }
.auth-demo-note { align-items: center; margin-top: 14px; color: var(--muted); }
.auth-panel-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; margin-top: 24px; color: var(--dim); font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.09em; }
.auth-panel-foot span { display: flex; align-items: center; gap: 5px; }
.auth-panel-foot svg { width: 12px; height: 12px; }

/* ---------- App shell ---------- */

.app-shell {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--inspector-w);
  height: 100dvh;
  min-height: 0;
}
.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 18px 14px 14px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(9, 14, 22, 0.7), rgba(6, 9, 15, 0.62));
  backdrop-filter: blur(26px);
}
[data-theme="light"] .sidebar { background: linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(244, 248, 255, 0.6)); }
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 2px 6px 20px; }
.brand-copy { min-width: 0; }
.brand-copy .brand-name { font-size: 16px; }
.brand-copy .brand-sub { font-size: 7px; }
.sidebar-close { display: none; margin-left: auto; }
.new-chat-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  height: 48px;
  padding: 0 12px;
  border: 1px solid rgba(var(--accent-rgb), 0.22);
  border-radius: 13px;
  background: linear-gradient(110deg, rgba(var(--accent-rgb), 0.1), rgba(var(--accent-2-rgb), 0.06));
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  transition: border-color 0.18s, background 0.18s, transform 0.18s;
}
.new-chat-btn:hover { border-color: rgba(var(--accent-rgb), 0.45); background: linear-gradient(110deg, rgba(var(--accent-rgb), 0.15), rgba(var(--accent-2-rgb), 0.1)); transform: translateY(-1px); }
.new-chat-btn kbd { margin-left: auto; border-color: rgba(var(--accent-rgb), 0.16); color: var(--accent); background: rgba(var(--accent-rgb), 0.06); }
.plus-ring { display: grid; place-items: center; width: 26px; height: 26px; border: 1px solid rgba(var(--accent-rgb), 0.3); border-radius: 8px; background: rgba(var(--accent-rgb), 0.09); color: var(--accent); }
.plus-ring svg { width: 14px; height: 14px; }
.nav-list { display: flex; flex-direction: column; gap: 3px; margin-top: 18px; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  height: 40px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  transition: color 0.16s, background 0.16s, border-color 0.16s;
}
.nav-item svg { width: 17px; height: 17px; flex: 0 0 auto; }
.nav-item:hover { color: var(--text); background: rgba(255, 255, 255, 0.035); }
.nav-item.active { color: var(--text); background: rgba(var(--accent-rgb), 0.075); border-color: rgba(var(--accent-rgb), 0.13); }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  border-radius: 0 2px 2px 0;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.65);
}
.nav-item.active svg { color: var(--accent); }
.nav-pulse { margin-left: auto; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.nav-badge { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 5px; background: rgba(var(--accent-rgb), 0.1); color: var(--accent); font-family: var(--mono); font-size: 9px; line-height: 18px; text-align: center; }
.sidebar-section { display: flex; flex-direction: column; min-height: 0; flex: 1; margin-top: 22px; }
.sidebar-section-head { display: flex; align-items: center; justify-content: space-between; padding: 0 7px 8px; color: var(--dim); font-family: var(--mono); font-size: 9px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; }
.history-search { display: flex; align-items: center; gap: 7px; height: 36px; margin: 0 4px 8px; padding: 0 8px; border: 1px solid var(--line); border-radius: 9px; background: rgba(0, 0, 0, 0.16); }
.history-search > svg { width: 14px; height: 14px; color: var(--dim); flex: 0 0 auto; }
.history-search input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 11.5px; }
.history-list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 2px 8px; }
.history-empty { display: flex; flex-direction: column; gap: 9px; padding: 12px 8px; }
.skeleton-line { height: 9px; width: 78%; border-radius: 99px; background: linear-gradient(90deg, rgba(255,255,255,.04), rgba(255,255,255,.09), rgba(255,255,255,.04)); background-size: 220% 100%; animation: shimmer 1.6s linear infinite; }
.skeleton-line.short { width: 48%; }
.history-group-label { padding: 12px 8px 5px; color: var(--dim); font-family: var(--mono); font-size: 8.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; }
.history-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 38px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}
.history-item:hover { background: rgba(255, 255, 255, 0.035); color: var(--text); }
.history-item.active { background: rgba(255, 255, 255, 0.045); border-color: var(--line); color: var(--text); }
.history-item .hi-icon { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: rgba(var(--accent-rgb), 0.06); color: var(--dim); flex: 0 0 auto; }
.history-item .hi-icon svg { width: 12px; height: 12px; }
.history-item.active .hi-icon { background: rgba(var(--accent-rgb), 0.11); color: var(--accent); }
.history-item .hi-copy { min-width: 0; flex: 1; }
.history-item .hi-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; font-weight: 500; }
.history-item .hi-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); font-size: 9px; }
.history-item .hi-more { width: 24px; height: 24px; opacity: 0; }
.history-item:hover .hi-more, .history-item.active .hi-more { opacity: 1; }
.history-item .hi-more svg { width: 13px; height: 13px; }
.pin-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; }
.sidebar-foot { padding-top: 10px; border-top: 1px solid var(--line-soft); }
.security-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid rgba(var(--success-rgb), 0.1);
  border-radius: 11px;
  background: linear-gradient(120deg, rgba(var(--success-rgb), 0.045), rgba(var(--accent-rgb), 0.03));
}
.shield-orb { display: grid; place-items: center; width: 27px; height: 27px; border: 1px solid rgba(var(--success-rgb), 0.2); border-radius: 8px; background: rgba(var(--success-rgb), 0.06); color: var(--success); flex: 0 0 auto; }
.shield-orb svg { width: 14px; height: 14px; }
.security-chip > div { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.security-chip b { font-size: 10.5px; }
.security-chip span:not(.dot):not(.shield-orb) { color: var(--dim); font-size: 8.5px; }
.profile-btn { display: flex; align-items: center; gap: 9px; width: 100%; margin-top: 8px; padding: 7px 7px; border: 0; border-radius: 10px; background: transparent; text-align: left; }
.profile-btn:hover { background: rgba(255, 255, 255, 0.035); }
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; flex: 0 0 auto; font-size: 12px; font-weight: 700; }
.avatar-self { background: linear-gradient(145deg, rgba(var(--accent-rgb), 0.26), rgba(var(--accent-2-rgb), 0.2)); border: 1px solid rgba(var(--accent-rgb), 0.3); color: var(--text); box-shadow: inset 0 1px 0 rgba(255,255,255,.14); }
.profile-copy { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.profile-copy b { font-size: 10.5px; }
.profile-copy span { color: var(--dim); font-size: 8.5px; }
.profile-chevron { width: 14px; height: 14px; color: var(--dim); }

/* ---------- Main / topbar ---------- */

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  height: 76px;
  padding: 0 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 11, 18, 0.42);
  backdrop-filter: blur(18px);
  flex: 0 0 auto;
  z-index: 10;
}
[data-theme="light"] .topbar { background: rgba(255, 255, 255, 0.44); }
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.view-heading { min-width: 0; }
.view-heading .eyebrow { font-size: 8px; }
.view-heading h1 { margin: 1px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.topbar-center { display: flex; justify-content: center; }
.model-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 212px;
  max-width: 360px;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  text-align: left;
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
}
.model-trigger:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.055); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16); }
.provider-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.8); flex: 0 0 auto; }
.model-trigger-copy { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.model-trigger-copy b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; font-weight: 600; }
.model-trigger-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); font-family: var(--mono); font-size: 8.5px; }
.model-trigger > svg { width: 13px; height: 13px; color: var(--dim); flex: 0 0 auto; }
.topbar-right { display: flex; align-items: center; justify-content: flex-end; gap: 6px; min-width: 0; }
.command-trigger { width: 58px; gap: 4px; }
.command-trigger kbd { height: 17px; font-size: 8px; }
.top-avatar { margin-left: 4px; cursor: pointer; }
.install-btn { color: var(--accent); }

/* ---------- Shared views ---------- */

.view { display: flex; flex: 1; min-height: 0; min-width: 0; flex-direction: column; }
.view-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 30px 34px 54px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; max-width: 1280px; margin: 0 auto 26px; }
.page-head .eyebrow { margin-bottom: 9px; }
.page-head h2 { margin: 0 0 6px; font-size: clamp(25px, 2.4vw, 34px); font-weight: 600; letter-spacing: -0.045em; }
.page-head > div > p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 12.5px; }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.live-stamp { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; }
.panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(155deg, rgba(17, 25, 39, 0.64), rgba(8, 12, 20, 0.64));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 16px 40px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}
[data-theme="light"] .panel { background: rgba(255, 255, 255, 0.68); }
.panel::before {
  content: "";
  position: absolute;
  inset: 0 20% auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), 0.3), transparent);
  opacity: 0.6;
}
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 18px 20px 10px; }
.panel-head h3 { margin: 0 0 3px; font-size: 13.5px; font-weight: 600; }
.panel-head p { margin: 0; color: var(--dim); font-size: 10.5px; }
.panel-tag { display: inline-flex; align-items: center; gap: 6px; color: var(--dim); font-family: var(--mono); font-size: 8.5px; font-weight: 600; letter-spacing: 0.1em; }

/* ---------- Chat ---------- */

.view-chat { position: relative; }
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; scroll-behavior: smooth; }
.chat-inner { width: 100%; max-width: 940px; margin: 0 auto; padding: 0 28px; }
.welcome { padding: 58px 0 20px; animation: fade-up 0.6s var(--ease); }
.welcome-hero { display: flex; flex-direction: column; align-items: center; text-align: center; }
.orb-stage { position: relative; display: grid; place-items: center; width: 212px; height: 212px; margin-bottom: 18px; }
.welcome-orb { width: 104px; height: 104px; }
.welcome-orb::before { inset: 8px; }
.welcome-orb::after { inset: -13px; }
.orbit-ring { position: absolute; border: 1px solid rgba(var(--accent-rgb), 0.1); border-radius: 50%; pointer-events: none; }
.ring-1 { width: 142px; height: 142px; border-top-color: rgba(var(--accent-rgb), 0.36); animation: orb-spin 12s linear infinite; }
.ring-2 { width: 178px; height: 178px; border-right-color: rgba(var(--accent-2-rgb), 0.3); border-style: dashed; animation: orb-spin 22s linear infinite reverse; }
.ring-3 { width: 208px; height: 208px; border-bottom-color: rgba(var(--accent-rgb), 0.18); animation: orb-spin 30s linear infinite; }
.welcome .eyebrow { margin-bottom: 12px; }
.welcome h2 { max-width: 680px; margin: 0; font-size: clamp(28px, 3.2vw, 42px); font-weight: 600; line-height: 1.25; letter-spacing: -0.05em; background: linear-gradient(110deg, var(--text) 34%, rgba(var(--accent-rgb), 0.95) 74%, var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.welcome-sub { max-width: 540px; margin: 13px auto 0; color: var(--muted); font-size: 12.5px; line-height: 1.8; }
.suggestion-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 34px; }
.suggestion {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012));
  text-align: left;
  transition: border-color 0.2s, background 0.2s, transform 0.2s, box-shadow 0.2s;
}
.suggestion:hover { border-color: rgba(var(--accent-rgb), 0.28); background: linear-gradient(150deg, rgba(var(--accent-rgb), 0.065), rgba(var(--accent-2-rgb), 0.025)); transform: translateY(-2px); box-shadow: 0 14px 30px rgba(0, 0, 0, 0.16); }
.suggestion-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; flex: 0 0 auto; }
.suggestion-icon svg { width: 18px; height: 18px; }
.tint-cyan { background: rgba(var(--accent-rgb), 0.09); color: var(--accent); border: 1px solid rgba(var(--accent-rgb), 0.16); }
.tint-violet { background: rgba(167, 139, 250, 0.09); color: var(--violet); border: 1px solid rgba(167, 139, 250, 0.16); }
.tint-emerald { background: rgba(var(--success-rgb), 0.08); color: var(--success); border: 1px solid rgba(var(--success-rgb), 0.14); }
.tint-amber { background: rgba(255, 200, 87, 0.08); color: var(--warning); border: 1px solid rgba(255, 200, 87, 0.14); }
.suggestion > span:nth-child(2) { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.suggestion b { font-size: 12.5px; font-weight: 600; }
.suggestion small { color: var(--dim); font-size: 10px; }
.suggestion-arrow { width: 14px; height: 14px; color: var(--dim); opacity: 0.6; transition: transform 0.2s, opacity 0.2s; }
.suggestion:hover .suggestion-arrow { transform: translate(2px, -2px); opacity: 1; color: var(--accent); }
.scene-strip { display: flex; align-items: center; gap: 9px; margin-top: 22px; padding: 9px 12px; border: 1px solid var(--line-soft); border-radius: 11px; background: rgba(255, 255, 255, 0.018); }
.scene-label { display: flex; align-items: center; gap: 5px; color: var(--dim); font-family: var(--mono); font-size: 8.5px; font-weight: 600; letter-spacing: 0.12em; flex: 0 0 auto; }
.scene-label svg { width: 12px; height: 12px; color: var(--accent); }
.scene-chip svg { width: 12px; height: 12px; flex: 0 0 auto; }
.scene-chips { display: flex; gap: 6px; min-width: 0; overflow-x: auto; flex: 1; }
.scene-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
  transition: border-color 0.16s, color 0.16s, background 0.16s;
}
.scene-chip:hover { border-color: rgba(var(--accent-rgb), 0.3); color: var(--accent); background: rgba(var(--accent-rgb), 0.05); }
.scene-strip > .link-btn { flex: 0 0 auto; }

.messages { padding-bottom: 6px; }
.message { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 14px; padding: 15px 0; animation: fade-up 0.35s var(--ease); }
.message:first-child { padding-top: 26px; }
.msg-avatar { display: grid; place-items: center; width: 34px; height: 34px; margin-top: 2px; border: 1px solid var(--line); border-radius: 10px; background: linear-gradient(150deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.015)); color: var(--muted); font-size: 12px; font-weight: 700; flex: 0 0 auto; }
.msg-avatar.assistant { border-color: rgba(var(--accent-rgb), 0.25); background: radial-gradient(circle at 30% 20%, rgba(var(--accent-rgb), 0.24), rgba(8, 13, 22, 0.9)); color: var(--accent); box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 0 20px rgba(var(--accent-rgb), 0.08); }
[data-theme="light"] .msg-avatar.assistant { background: linear-gradient(145deg, #fff, #e6f3ff); }
.msg-main { min-width: 0; }
.msg-head { display: flex; align-items: center; gap: 8px; min-height: 26px; margin-bottom: 3px; }
.msg-name { font-size: 11.5px; font-weight: 650; }
.msg-model { padding: 1px 6px; border: 1px solid var(--line); border-radius: 4px; color: var(--dim); font-family: var(--mono); font-size: 8px; }
.msg-time { color: var(--dim); font-family: var(--mono); font-size: 8px; }
.msg-actions { display: flex; gap: 2px; margin-left: auto; opacity: 0; transition: opacity 0.18s; }
.message:hover .msg-actions { opacity: 1; }
.msg-actions .icon-btn { width: 26px; height: 26px; }
.msg-actions .icon-btn svg { width: 13px; height: 13px; }
.msg-content { color: var(--text-soft); font-size: 14px; line-height: 1.78; overflow-wrap: anywhere; }
.msg-content > :first-child { margin-top: 0; }
.msg-content > :last-child { margin-bottom: 0; }
.message.user { grid-template-columns: minmax(0, 1fr) 34px; }
.message.user .msg-main { display: flex; flex-direction: column; align-items: flex-end; }
.message.user .msg-head { flex-direction: row; justify-content: flex-end; width: 100%; }
.message.user .msg-actions { margin-left: 6px; margin-right: 0; }
.message.user .msg-content {
  max-width: min(86%, 680px);
  padding: 11px 15px;
  border: 1px solid rgba(var(--accent-rgb), 0.16);
  border-radius: 15px 4px 15px 15px;
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.1), rgba(var(--accent-2-rgb), 0.06));
  color: var(--text);
  font-size: 13.5px;
}
[data-theme="light"] .message.user .msg-content { background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.13), rgba(var(--accent-2-rgb), 0.08)); }
.message.user .msg-avatar { order: 2; }
.message.streaming .msg-content::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 16px;
  margin-left: 3px;
  border-radius: 2px;
  background: var(--accent);
  vertical-align: -2px;
  animation: blink 1s steps(1) infinite;
  box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.7);
}
.msg-error {
  display: flex;
  gap: 9px;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(var(--danger-rgb), 0.2);
  border-radius: 9px;
  background: rgba(var(--danger-rgb), 0.06);
  color: var(--danger);
  font-size: 11.5px;
  line-height: 1.6;
}
.msg-error svg { width: 15px; height: 15px; flex: 0 0 auto; margin-top: 1px; }
.msg-note { margin-top: 8px; color: var(--dim); font-size: 9.5px; }
.reasoning { margin: 4px 0 10px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255, 255, 255, 0.02); overflow: hidden; }
.reasoning summary { display: flex; align-items: center; gap: 7px; padding: 8px 11px; color: var(--muted); font-size: 10.5px; font-weight: 600; cursor: pointer; list-style: none; user-select: none; }
.reasoning summary::-webkit-details-marker { display: none; }
.reasoning summary svg { width: 13px; height: 13px; color: var(--accent-2); }
.reasoning summary::after { content: "灞曞紑"; margin-left: auto; color: var(--dim); font-family: var(--mono); font-size: 8px; }
.reasoning[open] summary::after { content: "鏀惰捣"; }
.reasoning-body { padding: 0 12px 11px; color: var(--muted); font-size: 11.5px; line-height: 1.75; white-space: pre-wrap; border-top: 1px solid var(--line-soft); padding-top: 9px; margin: 0 11px 10px; }
.typing-dots { display: inline-flex; align-items: center; gap: 4px; height: 20px; }
.typing-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: typing 1.2s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: 0.15s; }
.typing-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: 0.35; } 30% { transform: translateY(-4px); opacity: 1; } }
.chat-bottom-pad { height: 32px; }
.scroll-bottom {
  position: absolute;
  left: 50%;
  bottom: 154px;
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel-solid);
  color: var(--muted);
  box-shadow: var(--shadow-md);
  z-index: 6;
}
.scroll-bottom svg { width: 16px; height: 16px; }
.scroll-bottom:hover { color: var(--accent); border-color: rgba(var(--accent-rgb), 0.3); }

/* Composer */

.composer-shell {
  position: relative;
  z-index: 5;
  padding: 6px 28px 13px;
  background: linear-gradient(180deg, transparent, var(--bg) 26%);
  flex: 0 0 auto;
}
.composer-wrap { width: 100%; max-width: 940px; margin: 0 auto; }
.active-scene { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; padding: 7px 9px; border: 1px solid rgba(var(--accent-rgb), 0.17); border-radius: 10px; background: rgba(var(--accent-rgb), 0.055); animation: fade-up 0.25s var(--ease); }
.scene-icon { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 7px; background: rgba(var(--accent-rgb), 0.1); color: var(--accent); flex: 0 0 auto; }
.scene-icon svg { width: 13px; height: 13px; }
.active-scene > span:nth-child(2) { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.active-scene b { font-size: 10.5px; }
.active-scene small { color: var(--dim); font-size: 9px; }
.composer {
  position: relative;
  border: 1px solid var(--line-strong);
  border-radius: 19px;
  background: rgba(12, 18, 28, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045), 0 14px 40px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(24px);
  transition: border-color 0.2s, box-shadow 0.2s;
  overflow: hidden;
}
[data-theme="light"] .composer { background: rgba(255, 255, 255, 0.82); }
.composer::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(130deg, rgba(var(--accent-rgb), 0.38), transparent 36%, transparent 64%, rgba(var(--accent-2-rgb), 0.26));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.composer:focus-within { border-color: transparent; box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.07), 0 18px 48px rgba(0, 0, 0, 0.3); }
.composer:focus-within::before { opacity: 1; }
.composer textarea {
  display: block;
  width: 100%;
  min-height: 52px;
  max-height: 220px;
  padding: 16px 17px 5px;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  line-height: 1.66;
  overflow-y: auto;
}
.composer textarea::placeholder { color: var(--dim); }
.composer-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 9px 8px 10px; }
.composer-tools { display: flex; align-items: center; gap: 3px; min-width: 0; }
.tool-btn { display: inline-flex; align-items: center; gap: 5px; height: 29px; padding: 0 8px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 500; white-space: nowrap; }
.tool-btn svg { width: 14px; height: 14px; }
.tool-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); border-color: var(--line); }
.composer-model { display: flex; align-items: center; gap: 6px; height: 29px; max-width: 190px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); font-size: 9.5px; cursor: pointer; }
.composer-model span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer-model svg { width: 11px; height: 11px; }
.composer-model:hover { color: var(--text); border-color: var(--line-strong); }
.composer-actions { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }
.token-hint { color: var(--dim); font-family: var(--mono); font-size: 8.5px; white-space: nowrap; }
.send-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(var(--accent-rgb), 0.45);
  border-radius: 12px;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  color: #041017;
  box-shadow: 0 6px 18px rgba(var(--accent-rgb), 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transition: transform 0.18s, box-shadow 0.18s, opacity 0.18s;
}
.send-btn svg { width: 18px; height: 18px; }
.send-btn:hover { transform: translateY(-1px) scale(1.02); box-shadow: 0 10px 24px rgba(var(--accent-rgb), 0.34); }
.send-btn:disabled { opacity: 0.4; box-shadow: none; }
.send-btn.streaming { background: rgba(var(--danger-rgb), 0.12); color: var(--danger); border-color: rgba(var(--danger-rgb), 0.32); box-shadow: none; }
.send-btn.streaming:hover { background: rgba(var(--danger-rgb), 0.2); }
.send-btn .stop-icon { display: none; }
.send-btn.streaming .send-icon { display: none; }
.send-btn.streaming .stop-icon { display: block; }
.composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 7px 5px 0; color: var(--dim); font-size: 8.5px; }
.composer-foot > span { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.composer-foot .dot { width: 4px; height: 4px; }
.composer-foot kbd { height: 16px; min-width: 16px; padding: 0 4px; font-size: 8px; }

/* Markdown */

.md { color: var(--text-soft); }
.md p { margin: 0 0 11px; }
.md h1, .md h2, .md h3, .md h4 { margin: 20px 0 9px; color: var(--text); font-weight: 650; line-height: 1.4; letter-spacing: -0.02em; }
.md h1 { font-size: 21px; }
.md h2 { font-size: 17px; }
.md h3 { font-size: 15px; }
.md h4 { font-size: 13.5px; }
.md ul, .md ol { margin: 7px 0 12px; padding-left: 21px; }
.md li { margin: 4px 0; padding-left: 2px; }
.md li::marker { color: var(--accent); }
.md blockquote { margin: 12px 0; padding: 9px 13px; border-left: 2px solid rgba(var(--accent-rgb), 0.5); border-radius: 0 7px 7px 0; background: rgba(var(--accent-rgb), 0.045); color: var(--muted); }
.md blockquote p { margin: 0; }
.md hr { margin: 18px 0; border: 0; border-top: 1px solid var(--line); }
.md a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(var(--accent-rgb), 0.35); }
.md strong { color: var(--text); font-weight: 650; }
.md em { color: var(--text-soft); }
.md code:not(pre code) { padding: 2px 5px; border: 1px solid var(--line); border-radius: 4px; background: rgba(var(--accent-rgb), 0.055); color: var(--accent); font-family: var(--mono); font-size: 0.87em; }
.md table { width: 100%; margin: 13px 0; border-collapse: separate; border-spacing: 0; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; font-size: 11.5px; }
.md th, .md td { padding: 8px 11px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
.md th { background: rgba(255, 255, 255, 0.035); color: var(--muted); font-family: var(--mono); font-size: 9px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.md tr:last-child td { border-bottom: 0; }
.md .code-block { margin: 13px 0; border: 1px solid var(--line); border-radius: 11px; background: #070b12; overflow: hidden; }
.md .code-block-head { display: flex; align-items: center; justify-content: space-between; height: 32px; padding: 0 10px 0 12px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, 0.025); }
.md .code-lang { color: var(--dim); font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.08em; text-transform: uppercase; }
.md .code-copy { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 7px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--dim); font-size: 9px; }
.md .code-copy svg { width: 12px; height: 12px; }
.md .code-copy:hover { color: var(--accent); background: rgba(var(--accent-rgb), 0.07); }
.md pre { margin: 0; padding: 13px 14px; overflow-x: auto; }
.md pre code { color: #c9d9ef; font-family: var(--mono); font-size: 11.5px; line-height: 1.7; white-space: pre; }
.md .code-block[data-lang="json"] pre code { color: #a9e7c4; }
.md del { color: var(--dim); }

/* ---------- Dashboard ---------- */

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; max-width: 1280px; margin: 0 auto 14px; }
.stat-card { position: relative; padding: 17px 18px 15px; border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(155deg, rgba(17, 25, 39, 0.58), rgba(8, 12, 20, 0.54)); overflow: hidden; }
[data-theme="light"] .stat-card { background: rgba(255, 255, 255, 0.66); }
.stat-card::after { content: ""; position: absolute; right: -30px; top: -40px; width: 100px; height: 100px; border-radius: 50%; background: rgba(var(--accent-rgb), 0.05); filter: blur(12px); }
.stat-head { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 10.5px; font-weight: 500; }
.stat-icon { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid rgba(var(--accent-rgb), 0.13); border-radius: 8px; background: rgba(var(--accent-rgb), 0.055); color: var(--accent); }
.stat-icon svg { width: 14px; height: 14px; }
.stat-icon.success { border-color: rgba(var(--success-rgb), 0.15); background: rgba(var(--success-rgb), 0.055); color: var(--success); }
.stat-icon.amber { border-color: rgba(255, 200, 87, 0.15); background: rgba(255, 200, 87, 0.055); color: var(--warning); }
.stat-icon.violet { border-color: rgba(167, 139, 250, 0.15); background: rgba(167, 139, 250, 0.055); color: var(--violet); }
.stat-value { display: block; margin: 12px 0 3px; font-family: var(--mono); font-size: clamp(24px, 2.5vw, 33px); font-weight: 600; line-height: 1; letter-spacing: -0.04em; }
.stat-meta { color: var(--dim); font-size: 9.5px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.9fr); gap: 14px; max-width: 1280px; margin: 0 auto 14px; }
.dashboard-grid.lower { grid-template-columns: minmax(300px, 0.9fr) minmax(0, 1.55fr); }
.chart-panel { min-height: 340px; }
.chart-wrap { position: relative; display: flex; height: 238px; padding: 8px 18px 0 38px; }
.chart-y { position: absolute; left: 13px; top: 12px; bottom: 24px; display: flex; flex-direction: column; justify-content: space-between; color: var(--dim); font-family: var(--mono); font-size: 8px; }
.request-chart { width: 100%; height: 100%; overflow: visible; }
.chart-x { position: absolute; left: 38px; right: 18px; bottom: 3px; display: flex; justify-content: space-between; color: var(--dim); font-family: var(--mono); font-size: 8px; }
.chart-legend { display: flex; align-items: center; gap: 16px; padding: 4px 20px 16px; color: var(--dim); font-size: 9.5px; }
.chart-legend span { display: flex; align-items: center; gap: 5px; }
.legend-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.6); }
.legend-dot.red { background: var(--danger); box-shadow: 0 0 8px rgba(var(--danger-rgb), 0.6); }
.chart-note { margin-left: auto; font-family: var(--mono); font-size: 8px; }
.health-list { display: flex; flex-direction: column; gap: 2px; padding: 2px 12px 14px; }
.health-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 7px; border-radius: 9px; }
.health-row:hover { background: rgba(255, 255, 255, 0.025); }
.health-logo { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255, 255, 255, 0.03); font-family: var(--mono); font-size: 10px; font-weight: 700; }
.health-copy { display: flex; flex-direction: column; min-width: 0; }
.health-copy b { font-size: 11px; font-weight: 600; }
.health-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); font-family: var(--mono); font-size: 8.5px; }
.health-right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.health-latency { color: var(--muted); font-family: var(--mono); font-size: 9px; }
.health-state { display: flex; align-items: center; gap: 5px; color: var(--dim); font-size: 8px; }
.route-panel { min-height: 214px; }
.route-chain { display: flex; align-items: center; gap: 0; padding: 18px 20px 8px; overflow-x: auto; }
.route-node { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255, 255, 255, 0.025); }
.route-node .provider-dot { width: 6px; height: 6px; }
.route-node b { font-size: 10px; font-weight: 600; }
.route-node > span:not(.provider-dot) { display: none; }
.route-node.off { opacity: 0.35; text-decoration: line-through; }
.route-arrow { display: flex; align-items: center; width: 18px; flex: 0 0 auto; color: var(--dim); }
.route-arrow::before { content: ""; width: 100%; height: 1px; background: linear-gradient(90deg, var(--line), rgba(var(--accent-rgb), 0.25)); }
.route-arrow svg { width: 10px; height: 10px; margin-left: -2px; }
.route-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 20px 16px; border-top: 1px solid var(--line-soft); color: var(--dim); font-size: 9px; }
.route-foot > span { display: flex; align-items: center; gap: 5px; }
.route-foot svg { width: 12px; height: 12px; }
.recent-panel { min-height: 280px; }
.recent-table-wrap { overflow-x: auto; padding: 0 10px 10px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 10.5px; }
.data-table th { padding: 7px 9px; color: var(--dim); font-family: var(--mono); font-size: 8px; font-weight: 600; letter-spacing: 0.05em; text-align: left; white-space: nowrap; }
.data-table td { padding: 9px; border-top: 1px solid var(--line-soft); color: var(--muted); white-space: nowrap; }
.data-table td b { color: var(--text-soft); font-weight: 600; }
.data-table .provider-cell { display: flex; align-items: center; gap: 7px; }
.data-table .provider-cell .provider-dot { width: 5px; height: 5px; }
.table-empty { padding: 28px 8px !important; color: var(--dim) !important; text-align: center; }
.state-badge { display: inline-flex; align-items: center; gap: 4px; height: 18px; padding: 0 6px; border-radius: 4px; font-family: var(--mono); font-size: 7.5px; font-weight: 600; letter-spacing: 0.05em; }
.state-badge.success { background: rgba(var(--success-rgb), 0.08); color: var(--success); }
.state-badge.error { background: rgba(var(--danger-rgb), 0.08); color: var(--danger); }
.state-badge.aborted { background: rgba(255, 255, 255, 0.05); color: var(--dim); }
.sparkline { width: 90px; height: 24px; }

/* ---------- Plugins ---------- */

.notice-card { display: flex; align-items: center; gap: 13px; max-width: 1280px; margin: 0 auto 16px; padding: 13px 16px; border: 1px solid rgba(var(--success-rgb), 0.14); border-radius: 13px; background: linear-gradient(110deg, rgba(var(--success-rgb), 0.045), rgba(var(--accent-rgb), 0.02)); }
.notice-icon { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid rgba(var(--success-rgb), 0.18); border-radius: 10px; background: rgba(var(--success-rgb), 0.06); color: var(--success); flex: 0 0 auto; }
.notice-icon svg { width: 18px; height: 18px; }
.notice-card > div { flex: 1; min-width: 0; }
.notice-card b { font-size: 11.5px; }
.notice-card p { margin: 1px 0 0; color: var(--muted); font-size: 10.5px; line-height: 1.55; }
.plugin-stats { display: flex; gap: 20px; max-width: 1280px; margin: 0 auto 14px; padding: 0 3px; color: var(--dim); font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.06em; }
.plugin-stats b { color: var(--text-soft); }
.plugin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; max-width: 1280px; margin: 0 auto; }
.plugin-card { position: relative; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(155deg, rgba(17, 25, 39, 0.6), rgba(8, 12, 20, 0.56)); overflow: hidden; transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s; }
[data-theme="light"] .plugin-card { background: rgba(255, 255, 255, 0.68); }
.plugin-card:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.plugin-card.off { opacity: 0.62; }
.plugin-card-head { display: flex; align-items: flex-start; gap: 12px; padding: 17px 18px 12px; }
.plugin-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; flex: 0 0 auto; }
.plugin-icon svg { width: 20px; height: 20px; }
.plugin-title { flex: 1; min-width: 0; }
.plugin-title-line { display: flex; align-items: center; gap: 7px; }
.plugin-title h3 { margin: 0; font-size: 14px; font-weight: 650; }
.plugin-title p { margin: 2px 0 0; color: var(--dim); font-family: var(--mono); font-size: 8px; letter-spacing: 0.04em; }
.plugin-desc { margin: 0; padding: 0 18px 14px; color: var(--muted); font-size: 11.5px; line-height: 1.7; flex: 1; }
.plugin-tags { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 18px 14px; }
.plugin-tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 7px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); font-size: 9px; }
.plugin-tag svg { width: 11px; height: 11px; }
.plugin-card-foot { display: flex; align-items: center; justify-content: space-between; padding: 11px 18px; border-top: 1px solid var(--line-soft); background: rgba(255, 255, 255, 0.012); }
.plugin-card-foot .left { display: flex; align-items: center; gap: 10px; color: var(--dim); font-size: 9px; }
.plugin-card-foot .left span { display: flex; align-items: center; gap: 4px; }
.plugin-card-foot .left svg { width: 11px; height: 11px; }
.plugin-empty { grid-column: 1 / -1; padding: 50px; border: 1px dashed var(--line); border-radius: 16px; color: var(--dim); text-align: center; font-size: 12px; }

/* ---------- API view ---------- */

.api-hero { position: relative; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.6fr); gap: 20px; max-width: 1280px; margin: 0 auto 14px; padding: 27px 30px; border: 1px solid rgba(var(--accent-rgb), 0.17); border-radius: 22px; background: radial-gradient(circle at 78% 40%, rgba(var(--accent-rgb), 0.075), transparent 34%), linear-gradient(145deg, rgba(18, 28, 44, 0.7), rgba(8, 12, 20, 0.7)); overflow: hidden; }
[data-theme="light"] .api-hero { background: radial-gradient(circle at 78% 40%, rgba(var(--accent-rgb), 0.14), transparent 34%), linear-gradient(145deg, #fff, #edf5ff); }
.api-hero::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(130, 175, 230, 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(130, 175, 230, 0.035) 1px, transparent 1px); background-size: 38px 38px; mask-image: radial-gradient(ellipse at 70% 50%, #000, transparent 75%); pointer-events: none; }
.api-hero-copy { position: relative; z-index: 1; }
.api-hero-copy .eyebrow { margin-bottom: 10px; }
.api-hero-copy h3 { margin: 0 0 8px; font-size: clamp(23px, 2.3vw, 31px); font-weight: 600; letter-spacing: -0.04em; }
.api-hero-copy > p:not(.eyebrow) { max-width: 620px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.75; }
.endpoint-box { display: flex; align-items: center; gap: 9px; max-width: 620px; height: 46px; margin-top: 18px; padding: 0 11px; border: 1px solid var(--line); border-radius: 11px; background: rgba(4, 8, 14, 0.52); }
[data-theme="light"] .endpoint-box { background: rgba(255, 255, 255, 0.7); }
.endpoint-method { color: var(--accent); font-family: var(--mono); font-size: 8px; font-weight: 700; letter-spacing: 0.1em; }
.endpoint-box code { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; color: var(--text-soft); font-family: var(--mono); font-size: 11.5px; white-space: nowrap; }
.api-badges { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 15px; }
.api-badges span { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 9.5px; }
.api-badges svg { width: 12px; height: 12px; color: var(--success); }
.api-hero-visual { position: relative; display: grid; place-items: center; min-height: 200px; }
.api-ring { position: absolute; border: 1px solid rgba(var(--accent-rgb), 0.12); border-radius: 50%; }
.api-ring.r1 { width: 150px; height: 150px; border-top-color: rgba(var(--accent-rgb), 0.5); animation: orb-spin 14s linear infinite; }
.api-ring.r2 { width: 190px; height: 190px; border-right-color: rgba(var(--accent-2-rgb), 0.4); border-style: dashed; animation: orb-spin 24s linear infinite reverse; }
.api-ring.r3 { width: 224px; height: 224px; border-bottom-color: rgba(var(--accent-rgb), 0.16); }
.api-core { position: relative; display: grid; place-items: center; width: 82px; height: 82px; border: 1px solid rgba(var(--accent-rgb), 0.3); border-radius: 50%; background: radial-gradient(circle at 32% 24%, rgba(var(--accent-rgb), 0.28), rgba(7, 12, 20, 0.95) 64%); color: var(--accent); box-shadow: 0 0 40px rgba(var(--accent-rgb), 0.18); }
.api-core svg { width: 28px; height: 28px; }
[data-theme="light"] .api-core { background: radial-gradient(circle at 32% 24%, #fff, #d9ebff 70%); }
.api-node { position: absolute; display: grid; place-items: center; width: 31px; height: 31px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-solid); color: var(--muted); font-family: var(--mono); font-size: 8px; font-weight: 700; box-shadow: var(--shadow-md); }
.api-node.na { transform: translate(-96px, -40px); color: #4f8cff; }
.api-node.nb { transform: translate(92px, -44px); color: var(--success); }
.api-node.nc { transform: translate(20px, 92px); color: var(--amber); }
.api-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; max-width: 1280px; margin: 0 auto 14px; }
.token-list { display: flex; flex-direction: column; gap: 1px; padding: 0 10px 10px; max-height: 330px; overflow-y: auto; }
.token-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 8px; border-top: 1px solid var(--line-soft); }
.token-row:first-child { border-top: 0; }
.token-icon { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 7px; background: rgba(var(--accent-rgb), 0.05); color: var(--accent); }
.token-icon svg { width: 14px; height: 14px; }
.token-copy { min-width: 0; display: flex; flex-direction: column; }
.token-copy b { font-size: 10.5px; }
.token-copy code { overflow: hidden; text-overflow: ellipsis; color: var(--dim); font-family: var(--mono); font-size: 8px; white-space: nowrap; }
.token-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; color: var(--dim); font-size: 8px; white-space: nowrap; }
.token-meta .used { color: var(--muted); }
.token-actions { display: flex; align-items: center; gap: 6px; }
.token-empty { padding: 34px 10px; color: var(--dim); font-size: 11px; text-align: center; }
.code-tabs { display: flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 7px; background: rgba(0, 0, 0, 0.12); }
.code-tabs button { height: 24px; padding: 0 8px; border: 0; border-radius: 5px; background: transparent; color: var(--dim); font-family: var(--mono); font-size: 8px; font-weight: 600; }
.code-tabs button.active { background: rgba(var(--accent-rgb), 0.1); color: var(--accent); }
.code-sample { margin: 0 16px 16px; border: 1px solid var(--line); border-radius: 11px; background: #070b12; overflow: hidden; }
.code-sample-head { display: flex; align-items: center; justify-content: space-between; height: 31px; padding: 0 10px 0 12px; border-bottom: 1px solid var(--line); color: var(--dim); font-family: var(--mono); font-size: 8px; letter-spacing: 0.09em; text-transform: uppercase; }
.code-sample pre { max-height: 286px; margin: 0; padding: 13px 14px; overflow: auto; }
.code-sample code { color: #c9d9ef; font-family: var(--mono); font-size: 10.5px; line-height: 1.7; white-space: pre; }
.api-doc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; max-width: 1280px; margin: 0 auto; }
.doc-card { padding: 15px 16px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255, 255, 255, 0.022); }
.doc-method { display: inline-flex; align-items: center; height: 18px; padding: 0 5px; border-radius: 4px; font-family: var(--mono); font-size: 7px; font-weight: 700; letter-spacing: 0.06em; }
.doc-method.get { background: rgba(var(--success-rgb), 0.09); color: var(--success); }
.doc-method.post { background: rgba(var(--accent-rgb), 0.09); color: var(--accent); }
.doc-card code { margin-left: 6px; color: var(--text-soft); font-family: var(--mono); font-size: 10px; }
.doc-card p { margin: 8px 0 0; color: var(--dim); font-size: 10px; line-height: 1.6; }
.doc-card p code { margin: 0; padding: 1px 4px; border-radius: 3px; background: rgba(255, 255, 255, 0.04); font-size: 9px; }

/* ---------- Inspector ---------- */

.inspector { display: flex; flex-direction: column; min-height: 0; padding: 22px 17px 14px; border-left: 1px solid var(--line); background: rgba(7, 11, 18, 0.32); overflow-y: auto; }
[data-theme="light"] .inspector { background: rgba(255, 255, 255, 0.28); }
.inspector-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 14px; }
.inspector-head .eyebrow { font-size: 8px; }
.telemetry-orb-card { display: flex; align-items: center; gap: 13px; padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: linear-gradient(145deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01)); }
.telemetry-orb { position: relative; display: grid; place-items: center; width: 54px; height: 54px; flex: 0 0 auto; }
.telemetry-ring { position: absolute; inset: 0; border: 1px solid rgba(var(--accent-rgb), 0.22); border-top-color: var(--accent); border-radius: 50%; animation: orb-spin 7s linear infinite; }
.telemetry-ring.r2 { inset: 8px; border-style: dashed; border-top-color: transparent; border-right-color: rgba(var(--accent-2-rgb), 0.6); animation-duration: 11s; animation-direction: reverse; }
.telemetry-core { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid rgba(var(--accent-rgb), 0.22); border-radius: 50%; background: radial-gradient(circle at 36% 28%, rgba(var(--accent-rgb), 0.3), #080d16 70%); }
.telemetry-core .dot { width: 5px; height: 5px; }
.telemetry-copy { display: flex; flex-direction: column; min-width: 0; }
.telemetry-copy b { font-size: 11.5px; }
.telemetry-copy span { color: var(--dim); font-size: 9px; }
.inspector-section { padding: 15px 3px 0; }
.inspector-title { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 8px; color: var(--dim); font-family: var(--mono); font-size: 8px; font-weight: 600; letter-spacing: 0.11em; text-transform: uppercase; }
.inspector-title b { color: var(--muted); font-size: 8px; }
.link-chain { display: flex; flex-direction: column; gap: 0; padding-left: 3px; }
.link-node { position: relative; display: flex; align-items: center; gap: 8px; min-height: 29px; padding-left: 15px; }
.link-node::before { content: ""; position: absolute; left: 2px; top: 14px; width: 5px; height: 5px; border-radius: 50%; background: var(--dim); box-shadow: 0 0 0 3px var(--bg); z-index: 1; }
.link-node::after { content: ""; position: absolute; left: 4px; top: 19px; bottom: -9px; width: 1px; background: var(--line); }
.link-node:last-child::after { display: none; }
.link-node.active::before { background: var(--accent); box-shadow: 0 0 8px var(--accent), 0 0 0 3px var(--bg); }
.link-node.done::before { background: var(--success); }
.link-node .ln-name { color: var(--text-soft); font-size: 10px; font-weight: 500; }
.link-node .ln-meta { margin-left: auto; color: var(--dim); font-family: var(--mono); font-size: 8px; }
.link-node.active .ln-name { color: var(--text); }
.metric-rows { display: flex; flex-direction: column; gap: 6px; padding: 10px 11px; border: 1px solid var(--line-soft); border-radius: 9px; background: rgba(0, 0, 0, 0.09); }
.metric-rows > div { display: flex; align-items: center; justify-content: space-between; }
.metric-rows span { color: var(--dim); font-size: 9.5px; }
.metric-rows b { color: var(--text-soft); font-family: var(--mono); font-size: 9.5px; font-weight: 500; }
.mini-provider-list { display: flex; flex-direction: column; gap: 1px; }
.mini-provider { display: flex; align-items: center; gap: 7px; min-height: 28px; padding: 0 4px; border-radius: 6px; }
.mini-provider:hover { background: rgba(255, 255, 255, 0.025); }
.mini-provider .provider-dot { width: 5px; height: 5px; }
.mini-provider span { flex: 1; color: var(--muted); font-size: 9.5px; }
.mini-provider .provider-dot { flex: 0 0 5px; width: 5px; height: 5px; }
.mini-provider b { color: var(--dim); font-family: var(--mono); font-size: 8px; font-weight: 500; }
.security-rows { display: flex; flex-direction: column; gap: 3px; }
.security-rows > div { display: flex; align-items: center; gap: 7px; min-height: 26px; padding: 0 4px; }
.security-rows svg { width: 12px; height: 12px; color: var(--success); }
.security-rows span { flex: 1; color: var(--muted); font-size: 9.5px; }
.security-rows b { color: var(--dim); font-family: var(--mono); font-size: 7.5px; letter-spacing: 0.04em; }
.inspector-foot { margin-top: auto; padding: 16px 3px 2px; color: var(--dim); font-size: 8px; display: flex; align-items: center; gap: 5px; }

/* ---------- Popover / model picker ---------- */

.popover {
  position: fixed;
  z-index: 60;
  width: 404px;
  max-height: min(620px, calc(100dvh - 100px));
  border: 1px solid var(--line-strong);
  border-radius: 17px;
  background: rgba(10, 15, 25, 0.96);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(30px);
  overflow: hidden;
  animation: scale-in 0.18s var(--ease);
}
[data-theme="light"] .popover { background: rgba(255, 255, 255, 0.97); }
.popover-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 15px 15px 10px; }
.popover-head > div { display: flex; flex-direction: column; }
.popover-head b { font-size: 13px; }
.popover-head span { color: var(--dim); font-size: 9px; }
.model-search { display: flex; align-items: center; gap: 8px; margin: 0 12px 8px; padding: 0 9px; height: 37px; border: 1px solid var(--line); border-radius: 9px; background: rgba(0, 0, 0, 0.14); }
.model-search svg { width: 14px; height: 14px; color: var(--dim); }
.model-search input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; font-size: 11.5px; }
.model-list { max-height: 410px; overflow-y: auto; padding: 0 8px 8px; }
.model-group-title { display: flex; align-items: center; gap: 6px; padding: 11px 7px 5px; color: var(--dim); font-family: var(--mono); font-size: 8px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.model-group-title .provider-dot { width: 4px; height: 4px; }
.model-option { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 38px; padding: 6px 8px; border: 1px solid transparent; border-radius: 8px; background: transparent; text-align: left; }
.model-option:hover { background: rgba(255, 255, 255, 0.04); }
.model-option.selected { border-color: rgba(var(--accent-rgb), 0.2); background: rgba(var(--accent-rgb), 0.07); }
.model-option .mo-icon { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; background: rgba(255, 255, 255, 0.04); color: var(--muted); font-family: var(--mono); font-size: 7px; font-weight: 700; flex: 0 0 auto; }
.model-option.selected .mo-icon { background: rgba(var(--accent-rgb), 0.12); color: var(--accent); }
.model-option .mo-copy { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.model-option b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10.5px; font-weight: 600; }
.model-option small { color: var(--dim); font-family: var(--mono); font-size: 8px; }
.model-option .mo-check { width: 15px; height: 15px; color: var(--accent); opacity: 0; }
.model-option.selected .mo-check { opacity: 1; }
.model-option .mo-status { width: 5px; height: 5px; border-radius: 50%; background: var(--dim); }
.model-option .mo-status.ready { background: var(--success); box-shadow: 0 0 7px rgba(var(--success-rgb), 0.7); }
.model-option .mo-status.off { background: var(--dim); box-shadow: none; }
.model-current { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 4px 8px; padding: 8px 9px; border: 1px solid rgba(var(--accent-rgb), .14); border-radius: 8px; background: rgba(var(--accent-rgb), .045); }
.model-current span { color: var(--dim); font-family: var(--mono); font-size: 7.5px; letter-spacing: .08em; }
.model-current b { overflow: hidden; color: var(--text-soft); font-family: var(--mono); font-size: 8.5px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.model-group-status { margin-left: auto; padding: 1px 5px; border: 1px solid var(--line); border-radius: 99px; color: var(--dim); font-size: 6.5px; font-style: normal; letter-spacing: .04em; }
.model-group-status.on { color: var(--success); border-color: rgba(var(--success-rgb), .22); background: rgba(var(--success-rgb), .05); }
.model-latest { margin-left: 5px; padding: 1px 4px; border-radius: 3px; color: var(--accent); background: rgba(var(--accent-rgb), .09); font-family: var(--mono); font-size: 6.5px; font-style: normal; font-weight: 500; vertical-align: 1px; }
.popover-foot { display: flex; align-items: center; justify-content: space-between; padding: 9px 13px; border-top: 1px solid var(--line-soft); color: var(--dim); font-size: 8.5px; }
.popover-foot > span { display: flex; align-items: center; gap: 5px; }

/* ---------- Command palette ---------- */

.palette-overlay { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 10vh 20px 20px; background: rgba(2, 4, 8, 0.62); backdrop-filter: blur(8px); animation: fade-in 0.16s ease; }
.palette { width: 100%; max-width: 650px; border: 1px solid var(--line-strong); border-radius: 17px; background: rgba(11, 16, 26, 0.98); box-shadow: var(--shadow-lg); overflow: hidden; animation: scale-in 0.2s var(--ease); }
[data-theme="light"] .palette { background: rgba(255, 255, 255, 0.98); }
.palette-search { display: flex; align-items: center; gap: 11px; height: 56px; padding: 0 17px; border-bottom: 1px solid var(--line); }
.palette-search > svg { width: 18px; height: 18px; color: var(--dim); }
.palette-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 14px; }
.palette-search input::placeholder { color: var(--dim); }
.palette-body { max-height: 52vh; overflow-y: auto; padding: 7px; }
.palette-group-title { padding: 9px 10px 4px; color: var(--dim); font-family: var(--mono); font-size: 8px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; }
.palette-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 7px 9px; border: 1px solid transparent; border-radius: 8px; background: transparent; text-align: left; }
.palette-item:hover, .palette-item.active { background: rgba(var(--accent-rgb), 0.07); border-color: rgba(var(--accent-rgb), 0.12); }
.palette-item .pi-icon { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 7px; background: rgba(255, 255, 255, 0.04); color: var(--muted); flex: 0 0 auto; }
.palette-item .pi-icon svg { width: 14px; height: 14px; }
.palette-item .pi-copy { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.palette-item b { font-size: 11px; font-weight: 600; }
.palette-item small { color: var(--dim); font-size: 8.5px; }
.palette-item .pi-tag { color: var(--dim); font-family: var(--mono); font-size: 7.5px; }
.palette-empty { padding: 30px; color: var(--dim); font-size: 11px; text-align: center; }
.palette-foot { display: flex; align-items: center; gap: 16px; height: 36px; padding: 0 16px; border-top: 1px solid var(--line-soft); color: var(--dim); font-size: 8px; }
.palette-foot span { display: flex; align-items: center; gap: 4px; }

/* ---------- Modal / settings ---------- */

.modal-overlay { position: fixed; inset: 0; z-index: 110; display: flex; align-items: center; justify-content: center; padding: 22px; background: rgba(2, 4, 8, 0.68); backdrop-filter: blur(10px); animation: fade-in 0.18s ease; }
.modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 560px;
  max-height: min(880px, calc(100dvh - 44px));
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: rgba(10, 15, 24, 0.98);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: scale-in 0.22s var(--ease);
}
[data-theme="light"] .modal { background: rgba(255, 255, 255, 0.98); }
.modal.wide { max-width: 1040px; }
.modal.medium { max-width: 720px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 20px 22px 14px; border-bottom: 1px solid var(--line-soft); }
.modal-head h2 { margin: 0 0 3px; font-size: 18px; font-weight: 650; letter-spacing: -0.025em; }
.modal-head p { margin: 0; color: var(--dim); font-size: 10.5px; }
.modal-body { min-height: 0; overflow-y: auto; padding: 20px 22px; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 9px; padding: 13px 22px; border-top: 1px solid var(--line-soft); background: rgba(255, 255, 255, 0.015); }
.modal-foot .left { margin-right: auto; color: var(--dim); font-size: 9px; }
.modal-close { width: 32px; height: 32px; }
.settings-modal .modal-head { padding-bottom: 0; border-bottom: 0; }
.settings-body { display: grid; grid-template-columns: 190px minmax(0, 1fr); min-height: 0; flex: 1; }
.settings-tabs { display: flex; flex-direction: column; gap: 3px; padding: 12px 12px 20px; border-right: 1px solid var(--line-soft); }
.settings-tab { display: flex; align-items: center; gap: 9px; height: 38px; padding: 0 10px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted); font-size: 11.5px; font-weight: 500; text-align: left; }
.settings-tab svg { width: 15px; height: 15px; }
.settings-tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.035); }
.settings-tab.active { color: var(--text); background: rgba(var(--accent-rgb), 0.075); border-color: rgba(var(--accent-rgb), 0.12); }
.settings-tab.active svg { color: var(--accent); }
.settings-tab .tab-badge { margin-left: auto; color: var(--dim); font-family: var(--mono); font-size: 8px; }
.settings-content { min-height: 0; overflow-y: auto; padding: 18px 24px 26px; }
.settings-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.settings-section-head h3 { margin: 0 0 3px; font-size: 15px; font-weight: 650; }
.settings-section-head p { margin: 0; color: var(--dim); font-size: 10.5px; line-height: 1.55; }
.provider-card { margin-bottom: 12px; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 255, 255, 0.018); }
.provider-card.off { opacity: 0.62; }
.provider-card-head { display: flex; align-items: center; gap: 10px; }
.provider-logo { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255, 255, 255, 0.03); font-family: var(--mono); font-size: 10px; font-weight: 700; flex: 0 0 auto; }
.provider-card-title { flex: 1; min-width: 0; }
.provider-card-title h4 { display: flex; align-items: center; gap: 7px; margin: 0; font-size: 12px; font-weight: 650; }
.provider-card-title p { margin: 1px 0 0; color: var(--dim); font-family: var(--mono); font-size: 8px; }
.provider-card-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 11px; margin-top: 14px; }
.provider-card-body .full { grid-column: 1 / -1; }
.provider-models { display: flex; flex-wrap: wrap; gap: 5px; min-height: 27px; }
.model-chip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 7px; border: 1px solid var(--line); border-radius: 5px; background: rgba(255, 255, 255, 0.02); color: var(--muted); font-family: var(--mono); font-size: 8px; }
.model-chip button { display: grid; place-items: center; width: 12px; height: 12px; padding: 0; border: 0; background: transparent; color: var(--dim); }
.model-chip button svg { width: 9px; height: 9px; }
.model-chip button:hover { color: var(--danger); }
.provider-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.provider-status-line { display: flex; align-items: center; gap: 6px; margin-left: auto; color: var(--dim); font-size: 9px; white-space: nowrap; }
.settings-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line-soft); }
.settings-toggle-row:last-child { border-bottom: 0; }
.settings-toggle-row .copy b { display: block; font-size: 11.5px; font-weight: 600; }
.settings-toggle-row .copy span { color: var(--dim); font-size: 9.5px; }
.route-order-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 14px; }
.route-order-item { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255, 255, 255, 0.02); }
.route-order-item .provider-dot { width: 6px; height: 6px; }
.route-order-item b { font-size: 10.5px; flex: 1; }
.route-order-item span { color: var(--dim); font-family: var(--mono); font-size: 8px; }
.route-order-item .order-btns { display: flex; gap: 2px; }
.route-order-item .icon-btn { width: 24px; height: 24px; }
.route-order-item .icon-btn svg { width: 12px; height: 12px; }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input[type="range"] { flex: 1; accent-color: var(--accent); height: 3px; }
.range-row b { min-width: 62px; color: var(--text-soft); font-family: var(--mono); font-size: 9px; text-align: right; }
.security-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-bottom: 15px; }
.security-stat { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, 0.02); }
.security-stat span { display: block; color: var(--dim); font-family: var(--mono); font-size: 8px; letter-spacing: 0.06em; }
.security-stat b { display: block; margin-top: 4px; font-size: 11px; font-weight: 600; }
.audit-list { display: flex; flex-direction: column; max-height: 250px; overflow-y: auto; border: 1px solid var(--line-soft); border-radius: 9px; }
.audit-row { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 8px; padding: 7px 9px; border-bottom: 1px solid var(--line-soft); font-size: 9px; }
.audit-row:last-child { border-bottom: 0; }
.audit-row time { color: var(--dim); font-family: var(--mono); font-size: 8px; }
.audit-row span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-row b { color: var(--text-soft); font-weight: 600; }
.appearance-row { display: flex; gap: 10px; margin-bottom: 18px; }
.appearance-option { flex: 1; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255, 255, 255, 0.02); text-align: left; }
.appearance-option.active { border-color: rgba(var(--accent-rgb), 0.38); background: rgba(var(--accent-rgb), 0.06); }
.appearance-option b { display: block; font-size: 11px; }
.appearance-option span { color: var(--dim); font-size: 8.5px; }
.appearance-preview { display: flex; gap: 3px; margin-top: 8px; }
.appearance-preview i { display: block; height: 18px; flex: 1; border-radius: 4px; }
.accent-row { display: flex; gap: 10px; margin: 8px 0 18px; }
.accent-swatch { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--muted); font-size: 10px; }
.accent-swatch i { width: 11px; height: 11px; border-radius: 50%; }
.accent-swatch.active { border-color: var(--line-strong); color: var(--text); background: rgba(255, 255, 255, 0.03); }
.about-block { padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: radial-gradient(circle at 80% 20%, rgba(var(--accent-rgb), 0.08), transparent 40%), rgba(255, 255, 255, 0.02); }
.about-block h3 { margin: 0 0 4px; font-size: 18px; letter-spacing: 0.02em; }
.about-block p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.about-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.about-meta div { padding: 9px; border: 1px solid var(--line-soft); border-radius: 8px; }
.about-meta span { display: block; color: var(--dim); font-family: var(--mono); font-size: 7.5px; }
.about-meta b { display: block; margin-top: 3px; font-family: var(--mono); font-size: 9px; }
.feature-list { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 14px; }
.feature-item { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 9.5px; }
.feature-item svg { width: 13px; height: 13px; color: var(--success); }
.danger-zone { margin-top: 20px; padding: 14px; border: 1px solid rgba(var(--danger-rgb), 0.16); border-radius: 11px; background: rgba(var(--danger-rgb), 0.035); }
.danger-zone h4 { margin: 0 0 4px; color: var(--danger); font-size: 11.5px; }
.danger-zone p { margin: 0 0 10px; color: var(--muted); font-size: 9.5px; }

/* Modal misc */

.confirm-copy { color: var(--muted); font-size: 12px; line-height: 1.7; }
.token-reveal { display: flex; flex-direction: column; gap: 12px; }
.token-warning { display: flex; gap: 8px; padding: 10px 12px; border: 1px solid rgba(255, 200, 87, 0.2); border-radius: 8px; background: rgba(255, 200, 87, 0.06); color: var(--warning); font-size: 10.5px; line-height: 1.55; }
.token-warning svg { width: 15px; height: 15px; flex: 0 0 auto; }
.secret-box { display: flex; align-items: center; gap: 9px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: rgba(0, 0, 0, 0.24); }
.secret-box code { flex: 1; min-width: 0; overflow-x: auto; color: var(--accent); font-family: var(--mono); font-size: 11px; white-space: nowrap; }
.plugin-detail-section { margin-top: 14px; }
.plugin-detail-section h4 { margin: 0 0 7px; color: var(--muted); font-family: var(--mono); font-size: 8px; letter-spacing: 0.1em; text-transform: uppercase; }
.plugin-detail-item { display: flex; align-items: center; gap: 9px; padding: 8px 9px; border: 1px solid var(--line-soft); border-radius: 8px; margin-bottom: 5px; }
.plugin-detail-item .pi-copy { flex: 1; min-width: 0; }
.pi-icon svg, .model-option .mo-icon svg { width: 14px; height: 14px; }
.plugin-detail-item b { display: block; font-size: 10px; }
.plugin-detail-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); font-size: 8.5px; }

/* ---------- Toasts ---------- */

.toast-root { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 9px; max-width: 380px; padding: 10px 13px; border: 1px solid var(--line-strong); border-radius: 10px; background: rgba(12, 18, 29, 0.96); color: var(--text-soft); box-shadow: var(--shadow-md); font-size: 11px; line-height: 1.5; animation: slide-in-right 0.25s var(--ease); pointer-events: auto; }
[data-theme="light"] .toast { background: rgba(255, 255, 255, 0.98); }
.toast svg { width: 15px; height: 15px; flex: 0 0 auto; }
.toast.success { border-color: rgba(var(--success-rgb), 0.24); }
.toast.success svg { color: var(--success); }
.toast.error { border-color: rgba(var(--danger-rgb), 0.24); }
.toast.error svg { color: var(--danger); }
.toast.info svg { color: var(--accent); }
.toast.out { opacity: 0; transform: translateX(14px); transition: opacity 0.2s, transform 0.2s; }

/* ---------- Responsive ---------- */

@media (max-width: 1360px) {
  .app-shell { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .inspector { display: none; }
}

@media (max-width: 1180px) {
  :root { --sidebar-w: 260px; }
  .view-scroll { padding: 26px 24px 48px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid, .dashboard-grid.lower { grid-template-columns: 1fr; }
  .api-hero { grid-template-columns: 1fr; }
  .api-hero-visual { display: none; }
  .api-grid { grid-template-columns: 1fr; }
  .api-doc-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 980px) {
  .auth-screen { grid-template-columns: 1fr; padding: 16px; }
  .auth-visual { display: none; }
  .auth-panel { min-height: calc(100dvh - 32px); padding: 16px; }
  .auth-mobile-brand { display: flex; }
  .model-trigger { min-width: 180px; max-width: 280px; }
  .topbar { padding: 0 16px; }
  .command-trigger { width: 38px; }
  .command-trigger kbd { display: none; }
  .status-pill span:last-child { display: none; }
  .status-pill { width: 30px; justify-content: center; padding: 0; }
  .plugin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  body { overflow: hidden; }
  .app-shell { display: block; height: 100dvh; padding-bottom: calc(62px + env(safe-area-inset-bottom)); }
  .sidebar { position: fixed; z-index: 80; inset: 0 auto 0 0; width: min(310px, 86vw); transform: translateX(-102%); transition: transform 0.3s var(--ease); border-right-color: var(--line-strong); box-shadow: 30px 0 80px rgba(0, 0, 0, 0.45); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: grid; }
  .drawer-overlay { position: fixed; inset: 0; z-index: 70; background: rgba(2, 4, 8, 0.6); backdrop-filter: blur(4px); animation: fade-in 0.2s ease; }
  .main { height: 100%; }
  .topbar { height: 66px; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; padding: 0 12px; }
  .mobile-only { display: grid !important; }
  .view-heading .eyebrow { display: none; }
  .view-heading h1 { font-size: 15px; }
  .topbar-center { justify-content: flex-end; }
  .model-trigger { min-width: 0; width: auto; max-width: 190px; height: 38px; padding: 0 9px; border-color: transparent; background: transparent; }
  .model-trigger:hover { border-color: var(--line); }
  .model-trigger-copy small { display: none; }
  .model-trigger-copy b { font-size: 10.5px; }
  .topbar-right { gap: 1px; }
  .topbar-right .status-pill, .topbar-right .top-avatar, .command-trigger { display: none; }
  .topbar-right .icon-btn { width: 34px; height: 34px; }
  .topbar-right .icon-btn svg { width: 17px; height: 17px; }
  .view-scroll { padding: 20px 15px 30px; }
  .page-head { align-items: flex-start; flex-direction: column; gap: 12px; margin-bottom: 18px; }
  .page-head h2 { font-size: 25px; }
  .page-actions { width: 100%; justify-content: flex-start; }
  .chat-inner { padding: 0 14px; }
  .welcome { padding-top: 26px; }
  .orb-stage { width: 168px; height: 168px; margin-bottom: 10px; }
  .welcome-orb { width: 84px; height: 84px; }
  .ring-1 { width: 116px; height: 116px; }
  .ring-2 { width: 145px; height: 145px; }
  .ring-3 { width: 168px; height: 168px; }
  .welcome h2 { font-size: 27px; }
  .welcome-sub { font-size: 11.5px; }  .suggestion-grid { grid-template-columns: 1fr; gap: 8px; margin-top: 24px; }
  .suggestion { min-height: 64px; }
  .scene-strip { flex-wrap: wrap; }
  .scene-chips { order: 3; flex-basis: 100%; }
  .composer-shell { padding: 4px 10px calc(8px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, transparent, var(--bg) 20%); }
  .composer-foot .hide-mobile { display: none; }
  .composer-foot { justify-content: center; }
  .composer textarea { font-size: 16px; min-height: 48px; padding: 13px 13px 3px; }
  .composer-toolbar { padding: 4px 7px 7px 8px; }
  .tool-btn span { display: none; }
  .tool-btn { width: 30px; padding: 0; justify-content: center; }
  .composer-model { max-width: 132px; }
  .token-hint { display: none; }
  .send-btn { width: 38px; height: 38px; }
  .scroll-bottom { bottom: 144px; }
  .mobile-nav { display: flex; }
  .message { grid-template-columns: 30px minmax(0, 1fr); gap: 9px; padding: 12px 0; }
  .msg-avatar { width: 29px; height: 29px; border-radius: 8px; font-size: 10px; }
  .message.user { grid-template-columns: minmax(0, 1fr) 29px; }
  .msg-content { font-size: 13.5px; }
  .message.user .msg-content { max-width: 92%; }
  .msg-actions { opacity: 1; }
  .model-popover { left: 10px !important; right: 10px !important; top: auto !important; bottom: calc(10px + env(safe-area-inset-bottom)); width: auto; max-height: 74dvh; border-radius: 18px 18px 14px 14px; animation: sheet-in 0.24s var(--ease); }
  @keyframes sheet-in { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: translateY(0); } }
  .model-list { max-height: 52dvh; }
  .palette-overlay { padding: 7vh 10px 10px; }
  .palette { max-height: 78dvh; }
  .palette-body { max-height: 58dvh; }
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { max-height: 92dvh; border-radius: 20px 20px 0 0; max-width: none; }
  .modal.wide, .modal.medium { max-width: none; }
  .settings-body { grid-template-columns: 1fr; }
  .settings-tabs { flex-direction: row; overflow-x: auto; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .settings-tab { flex: 0 0 auto; height: 34px; padding: 0 10px; }
  .settings-tab .tab-badge { display: none; }
  .settings-content { padding: 16px 15px 30px; }
  .provider-card-body { grid-template-columns: 1fr; }
  .security-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 13px; }
  .stat-value { font-size: 24px; }
  .api-hero { padding: 20px 18px; }
  .endpoint-box code { font-size: 10px; }
  .api-doc-grid { grid-template-columns: 1fr; }
  .feature-list { grid-template-columns: 1fr; }
  .toast-root { right: 12px; left: 12px; bottom: calc(72px + env(safe-area-inset-bottom)); align-items: stretch; }
  .toast { max-width: none; }
  .appearance-row { flex-direction: column; }
  .about-meta { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .auth-card { padding: 26px 20px 22px; border-radius: 20px; }
  .auth-card-head h1 { font-size: 22px; }
  .auth-panel-foot { gap: 10px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .stat-head span:first-child { font-size: 9.5px; }
  .stat-value { font-size: 21px; }
  .health-row { grid-template-columns: 26px minmax(0, 1fr) auto; }
  .health-logo { width: 26px; height: 26px; }
  .topbar-right .install-btn { display: none; }
  .page-actions .btn { flex: 1; }
  .plugin-card-head { padding: 14px 14px 10px; }
  .plugin-desc, .plugin-tags { padding-left: 14px; padding-right: 14px; }
  .plugin-card-foot { padding-left: 14px; padding-right: 14px; }
}

/* Mobile nav is injected by app.js if absent */
.mobile-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 65;
  height: calc(62px + env(safe-area-inset-bottom));
  padding: 0 8px env(safe-area-inset-bottom);
  border-top: 1px solid var(--line);
  background: rgba(8, 12, 20, 0.92);
  backdrop-filter: blur(24px);
  align-items: center;
  justify-content: space-around;
}
[data-theme="light"] .mobile-nav { background: rgba(255, 255, 255, 0.92); }
.mobile-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; width: 58px; height: 49px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--dim); font-size: 8px; }
.mobile-nav button svg { width: 19px; height: 19px; }
.mobile-nav button.active { color: var(--accent); background: rgba(var(--accent-rgb), 0.07); border-color: rgba(var(--accent-rgb), 0.1); }

/* ---------- Supplemental components ---------- */

.rotate-180 { transform: rotate(180deg); }
.btn-spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 1.5px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: orb-spin 0.7s linear infinite;
}
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: orb-spin 0.8s linear infinite;
}
.settings-loading { display: flex; align-items: center; justify-content: center; gap: 9px; min-height: 220px; color: var(--muted); font-size: 11px; }
.history-none { padding: 24px 8px; color: var(--dim); font-size: 10.5px; line-height: 1.8; text-align: center; }
.history-none span { color: var(--dim); font-size: 9px; }
.scene-empty, .model-empty, .mini-empty { padding: 12px 4px; color: var(--dim); font-size: 9px; }
.model-empty { padding: 24px 8px; text-align: center; font-size: 10px; }
.provider-list { display: flex; flex-direction: column; }
.provider-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.provider-form-grid .full { grid-column: 1 / -1; }
.provider-actions .link-btn { margin-left: 3px; align-self: center; }
.provider-official-btn { color: var(--accent); border-color: rgba(var(--accent-rgb), 0.2); background: rgba(var(--accent-rgb), 0.04); }
.provider-official-btn:hover { border-color: rgba(var(--accent-rgb), 0.4); background: rgba(var(--accent-rgb), 0.08); }
.provider-test-result { margin-left: auto; color: var(--dim); font-family: var(--mono); font-size: 8.5px; }
.provider-test-result.ok { color: var(--success); }
.provider-test-result.bad { color: var(--danger); }
.official-inline { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line-soft); background: rgba(var(--accent-rgb), 0.022); }
.official-inline > span { display: flex; align-items: center; gap: 5px; color: var(--muted); font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.05em; }
.official-inline > span svg { width: 12px; height: 12px; color: var(--accent); }
.official-inline a { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); font-size: 9px; text-decoration: none; }
.official-inline a:hover { border-color: var(--line-strong); color: var(--text); background: rgba(255, 255, 255, 0.035); }
.official-inline a.primary { color: var(--accent); border-color: rgba(var(--accent-rgb), 0.24); background: rgba(var(--accent-rgb), 0.065); }
.native-checkbox { width: 17px; height: 17px; accent-color: var(--accent); }
.about-copyright { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line-soft); color: var(--dim); font-family: var(--mono); font-size: 8px; line-height: 1.7; }
.admin-owner-card { display:flex; align-items:center; gap:11px; padding:13px 14px; border:1px solid rgba(var(--accent-rgb),.18); border-radius:11px; background:rgba(var(--accent-rgb),.04); }
.admin-avatar { display:grid; place-items:center; width:38px; height:38px; flex:0 0 auto; border:1px solid var(--line); border-radius:10px; background:rgba(255,255,255,.03); color:var(--accent); }
.admin-avatar svg { width:18px; height:18px; }
.admin-avatar.small { width:31px; height:31px; border-radius:8px; }
.admin-avatar.small svg { width:15px; height:15px; }
.admin-copy { flex:1; min-width:0; }
.admin-copy b { display:block; font-size:12px; }
.admin-copy span { display:block; margin-top:2px; color:var(--dim); font-family:var(--mono); font-size:8.5px; }
.admin-list-head { display:flex; align-items:center; justify-content:space-between; gap:10px; margin:20px 0 8px; }
.admin-list-head b { font-size:12px; }
.admin-list { display:flex; flex-direction:column; gap:7px; }
.admin-row { display:flex; align-items:center; gap:10px; padding:10px 11px; border:1px solid var(--line); border-radius:10px; background:rgba(255,255,255,.018); }
.admin-row-copy { flex:1; min-width:0; }
.admin-row-copy b { display:block; font-size:11px; }
.admin-row-copy span { display:block; margin-top:2px; overflow:hidden; color:var(--dim); font-family:var(--mono); font-size:8px; text-overflow:ellipsis; white-space:nowrap; }
.admin-row-actions { display:flex; align-items:center; flex-wrap:wrap; gap:7px; justify-content:flex-end; }
.admin-row-actions .btn { min-height:28px; padding:0 9px; font-size:9px; }
.link-btn.danger { color:var(--danger); }
.admin-empty { padding:26px 12px; border:1px dashed var(--line); border-radius:10px; color:var(--dim); font-size:10px; text-align:center; }
@media(max-width:640px){.admin-row{flex-wrap:wrap}.admin-row-actions{width:100%;justify-content:flex-start;padding-left:41px}.admin-owner-card{align-items:flex-start}} 
.model-add { display: flex; gap: 7px; margin-top: 7px; }
.model-add input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: rgba(0, 0, 0, 0.14);
  font-family: var(--mono);
  font-size: 9.5px;
}
.model-add input:focus { border-color: rgba(var(--accent-rgb), 0.45); }
.model-add .btn { min-height: 34px; }
.capability-row { display: flex; flex-wrap: wrap; gap: 7px; }
.capability-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 31px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--dim);
  font-size: 9.5px;
  transition: border-color 0.16s, color 0.16s, background 0.16s;
}
.capability-chip svg { width: 13px; height: 13px; }
.capability-chip:hover { border-color: var(--line-strong); color: var(--text-soft); }
.capability-chip.on {
  border-color: rgba(var(--accent-rgb), 0.3);
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--accent);
}
.provider-models:empty::before { content: "灏氭湭娣诲姞妯″瀷"; color: var(--dim); font-size: 9px; }
.settings-section-head h3 { letter-spacing: -0.02em; }
.settings-content .provider-card:last-child { margin-bottom: 0; }
.code-tabs { flex: 0 0 auto; }
.code-sample .code-sample-head .icon-btn { width: 24px; height: 24px; }
.temperature-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.temperature-presets .accent-swatch { height: 34px; }
.context-menu {
  position: fixed;
  z-index: 150;
  width: 168px;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(11, 16, 26, 0.98);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(22px);
  animation: scale-in 0.14s var(--ease);
}
[data-theme="light"] .context-menu { background: rgba(255, 255, 255, 0.98); }
.context-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 33px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-soft);
  font-size: 10.5px;
  text-align: left;
}
.context-item svg { width: 14px; height: 14px; color: var(--dim); }
.context-item:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.context-item.danger { color: var(--danger); }
.context-item.danger svg { color: var(--danger); }
.context-item.danger:hover { background: rgba(var(--danger-rgb), 0.09); }
.context-divider { height: 1px; margin: 4px 6px; background: var(--line-soft); }
.settings-modal .modal { max-width: 1040px; }
.settings-modal .settings-body { border-top: 1px solid var(--line-soft); margin-top: 14px; min-height: 0; flex: 1; overflow: hidden; }
.settings-modal .settings-content { padding-top: 20px; }
.error-text { color: var(--danger); }
.muted-text { color: var(--dim); }
.field-hint code, .token-warning code { padding: 1px 4px; border-radius: 3px; background: rgba(255, 255, 255, 0.06); font-family: var(--mono); font-size: 0.92em; }
.telemetry-orb.working .telemetry-ring { animation-duration: 3.2s; }
.telemetry-orb.error .telemetry-ring { border-top-color: var(--danger); }
.telemetry-orb.error .telemetry-core { border-color: rgba(var(--danger-rgb), 0.3); }
.code-sample pre::-webkit-scrollbar { height: 6px; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }

@media (max-width: 520px) {
  .provider-form-grid { grid-template-columns: 1fr; }
  .settings-modal .modal-head { padding-left: 16px; padding-right: 16px; }
  .settings-tab { font-size: 10.5px; }
  .code-sample { margin-left: 10px; margin-right: 10px; }
  .code-sample code { font-size: 9.5px; }
  .provider-actions { gap: 6px; }
  .provider-actions .btn { padding: 0 10px; }
  .provider-test-result { flex-basis: 100%; margin-left: 0; }
}

@media (max-width: 860px) {
  .mobile-nav { display: flex; }
  .welcome h2 { max-width: 340px; font-size: 24px; text-wrap: balance; }
  .welcome-sub { max-width: 330px; }
  .toast-root { top: calc(76px + env(safe-area-inset-top)); bottom: auto; }
  .composer-shell { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
}

@media (max-width: 520px) {
  .welcome h2 { max-width: 320px; font-size: 23px; }
}

/* ---------- Light theme refinements ---------- */

[data-theme="light"] .ambient {
  background:
    radial-gradient(ellipse 82% 56% at 16% -12%, rgba(38, 160, 220, 0.16), transparent 62%),
    radial-gradient(ellipse 68% 48% at 94% 6%, rgba(120, 100, 235, 0.12), transparent 64%),
    linear-gradient(180deg, #edf3fb 0%, #e3ebf6 100%);
}
[data-theme="light"] .ambient-grid { opacity: 0.2; }
[data-theme="light"] .ambient-glow { opacity: 0.38; }
[data-theme="light"] .ambient-noise { opacity: 0.018; }
[data-theme="light"] .sidebar { background: linear-gradient(180deg, rgba(248, 252, 255, 0.9), rgba(238, 245, 253, 0.86)); }
[data-theme="light"] .topbar { background: rgba(250, 253, 255, 0.7); }
[data-theme="light"] .inspector { background: rgba(248, 252, 255, 0.62); }
[data-theme="light"] .panel,
[data-theme="light"] .stat-card,
[data-theme="light"] .plugin-card {
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 1px 0 #fff, 0 16px 36px rgba(31, 61, 99, 0.07);
}
[data-theme="light"] .model-trigger,
[data-theme="light"] .status-pill,
[data-theme="light"] .new-chat-btn,
[data-theme="light"] .history-search,
[data-theme="light"] .scene-strip {
  background: rgba(255, 255, 255, 0.62);
}
[data-theme="light"] .new-chat-btn { background: linear-gradient(110deg, rgba(20, 165, 220, 0.1), rgba(110, 90, 230, 0.06)); }
[data-theme="light"] .nav-item:hover,
[data-theme="light"] .icon-btn:hover,
[data-theme="light"] .history-item:hover { background: rgba(21, 77, 130, 0.055); }
[data-theme="light"] .nav-item.active { background: rgba(20, 135, 190, 0.1); border-color: rgba(20, 135, 190, 0.16); }
[data-theme="light"] .history-item.active { background: rgba(21, 77, 130, 0.07); border-color: var(--line); }
[data-theme="light"] .suggestion {
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.82), rgba(244, 250, 255, 0.66));
}
[data-theme="light"] .suggestion:hover { background: linear-gradient(150deg, rgba(255, 255, 255, 0.96), rgba(233, 246, 255, 0.9)); }
[data-theme="light"] .composer { background: rgba(255, 255, 255, 0.9); box-shadow: inset 0 1px 0 #fff, 0 16px 42px rgba(31, 61, 99, 0.12); }
[data-theme="light"] .composer-shell { background: linear-gradient(180deg, transparent, var(--bg) 26%); }
[data-theme="light"] .tool-btn:hover { background: rgba(21, 77, 130, 0.05); }
[data-theme="light"] .message.user .msg-content { background: linear-gradient(135deg, rgba(18, 152, 200, 0.12), rgba(110, 90, 230, 0.07)); }
[data-theme="light"] .msg-avatar { background: linear-gradient(150deg, #fff, #eef5fc); }
[data-theme="light"] .reasoning { background: rgba(21, 77, 130, 0.035); }
[data-theme="light"] .metric-rows { background: rgba(21, 77, 130, 0.035); }
[data-theme="light"] .model-option:hover { background: rgba(21, 77, 130, 0.05); }
[data-theme="light"] .settings-loading,
[data-theme="light"] .provider-card,
[data-theme="light"] .security-stat,
[data-theme="light"] .doc-card,
[data-theme="light"] .appearance-option,
[data-theme="light"] .about-block { background: rgba(255, 255, 255, 0.66); }
[data-theme="light"] .token-warning { background: rgba(196, 129, 16, 0.08); color: #8a5b07; border-color: rgba(168, 107, 5, 0.22); }
[data-theme="light"] .token-warning svg { color: #a86b05; }
[data-theme="light"] .provider-card .input-wrap,
[data-theme="light"] .model-add input { background: rgba(245, 250, 255, 0.8); }
[data-theme="light"] .provider-card .input-wrap:focus-within { background: #fff; }
[data-theme="light"] .audit-list { background: rgba(255, 255, 255, 0.55); }
[data-theme="light"] .code-block,
[data-theme="light"] .code-sample { background: #0a111b; }
[data-theme="light"] .api-hero { background: radial-gradient(circle at 78% 40%, rgba(25, 160, 210, 0.14), transparent 34%), linear-gradient(145deg, #ffffff, #edf5ff); box-shadow: 0 18px 42px rgba(31, 61, 99, 0.07); }
[data-theme="light"] .notice-card { background: linear-gradient(110deg, rgba(9, 154, 117, 0.07), rgba(20, 135, 190, 0.035)); }
[data-theme="light"] .security-chip { background: linear-gradient(120deg, rgba(9, 154, 117, 0.07), rgba(20, 135, 190, 0.04)); }
[data-theme="light"] .brand-glyph { border-color: rgba(20, 120, 170, 0.26); }
[data-theme="light"] .telemetry-orb-card { background: rgba(255, 255, 255, 0.56); }
[data-theme="light"] .auth-feature-row span { color: var(--text-soft); }
[data-theme="light"] .modal-overlay { background: rgba(33, 54, 82, 0.32); }
[data-theme="light"] .popover,
[data-theme="light"] .palette,
[data-theme="light"] .modal { box-shadow: 0 30px 80px rgba(25, 54, 92, 0.22); }
[data-theme="light"] .context-menu { box-shadow: 0 18px 44px rgba(25, 54, 92, 0.2); }

/* ---------- Attachments ---------- */

.attach-tool { color: var(--accent); }
.attach-tool:hover { border-color: rgba(var(--accent-rgb), 0.25); background: rgba(var(--accent-rgb), 0.06); }
.attachment-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 8px;
  padding: 9px;
  border: 1px solid rgba(var(--accent-rgb), 0.15);
  border-radius: 13px;
  background: rgba(var(--accent-rgb), 0.035);
  animation: fade-up 0.22s var(--ease);
}
[data-theme="light"] .attachment-tray { background: rgba(20, 135, 190, 0.055); }
.attachment-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 152px;
  max-width: 230px;
  padding: 6px 7px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-solid);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.14);
}
.attachment-card.uploading { opacity: 0.72; }
.attachment-card.error { border-color: rgba(var(--danger-rgb), 0.3); }
.attachment-thumb {
  display: grid;
  place-items: center;
  width: 39px;
  height: 39px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(var(--accent-rgb), 0.07);
  color: var(--accent);
}
.attachment-thumb img { width: 100%; height: 100%; object-fit: cover; }
.attachment-thumb svg { width: 18px; height: 18px; }
.attachment-copy { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.attachment-copy b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9.5px; font-weight: 600; }
.attachment-copy small { color: var(--dim); font-family: var(--mono); font-size: 7.5px; }
.attachment-remove {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--dim);
  flex: 0 0 auto;
}
.attachment-remove:hover { background: rgba(var(--danger-rgb), 0.1); color: var(--danger); }
.attachment-remove svg { width: 12px; height: 12px; }
.attachment-spinner {
  width: 14px;
  height: 14px;
  border: 1.5px solid rgba(var(--accent-rgb), 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: orb-spin 0.8s linear infinite;
}
.attachment-warning {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-basis: 100%;
  color: var(--warning);
  font-size: 9px;
}
.attachment-warning svg { width: 12px; height: 12px; flex: 0 0 auto; }
.drop-overlay {
  position: absolute;
  inset: 72px 18px 110px;
  z-index: 20;
  display: grid;
  place-items: center;
  border: 1.5px dashed rgba(var(--accent-rgb), 0.58);
  border-radius: 20px;
  background: rgba(5, 10, 17, 0.74);
  backdrop-filter: blur(8px);
  pointer-events: none;
}
[data-theme="light"] .drop-overlay { background: rgba(255, 255, 255, 0.78); }
.drop-card { display: flex; flex-direction: column; align-items: center; gap: 5px; text-align: center; }
.drop-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 4px;
  border: 1px solid rgba(var(--accent-rgb), 0.3);
  border-radius: 14px;
  background: rgba(var(--accent-rgb), 0.09);
  color: var(--accent);
}
.drop-icon svg { width: 22px; height: 22px; }
.drop-card b { font-size: 15px; }
.drop-card span:last-child { color: var(--muted); font-size: 10px; }

.msg-attachments { display: flex; flex-wrap: wrap; gap: 7px; margin: 2px 0 10px; }
.msg-attachments:last-child { margin-bottom: 0; }
.msg-image {
  position: relative;
  display: block;
  width: 168px;
  max-width: 100%;
  height: 118px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.1);
  cursor: zoom-in;
}
.msg-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.25s var(--ease); }
.msg-image:hover img { transform: scale(1.03); }
.msg-image .image-name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  padding: 12px 7px 5px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.72));
  color: #fff;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.msg-file {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 155px;
  max-width: 250px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-soft);
  transition: border-color 0.16s, background 0.16s;
}
.msg-file:hover { border-color: rgba(var(--accent-rgb), 0.3); background: rgba(var(--accent-rgb), 0.05); }
.msg-file .file-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; background: rgba(var(--accent-rgb), 0.08); color: var(--accent); flex: 0 0 auto; }
.msg-file .file-icon svg { width: 15px; height: 15px; }
.msg-file .file-copy { display: flex; flex-direction: column; min-width: 0; }
.msg-file .file-copy b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9.5px; font-weight: 600; }
.msg-file .file-copy small { color: var(--dim); font-family: var(--mono); font-size: 7.5px; }
.msg-file .file-arrow { width: 13px; height: 13px; color: var(--dim); flex: 0 0 auto; }
.message.user .msg-attachments { justify-content: flex-end; }
.message.user .msg-image { width: 148px; height: 104px; }
.image-lightbox { display: flex; align-items: center; justify-content: center; padding: 0; background: rgba(2, 4, 8, 0.84); backdrop-filter: blur(14px); }
.image-lightbox img { max-width: min(92vw, 1100px); max-height: 82dvh; border: 1px solid var(--line-strong); border-radius: 12px; background: #05070c; box-shadow: var(--shadow-lg); object-fit: contain; }
.image-lightbox-bar {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(10, 15, 24, 0.9);
  backdrop-filter: blur(18px);
}
[data-theme="light"] .image-lightbox-bar { background: rgba(255, 255, 255, 0.92); }
.image-lightbox-bar .icon-btn { color: var(--text-soft); }

@media (max-width: 860px) {
  .attachment-tray { gap: 6px; padding: 7px; }
  .attachment-card { min-width: 138px; max-width: 195px; }
  .msg-image { width: 145px; height: 104px; }
  .message.user .msg-image { width: 132px; height: 96px; }
  .drop-overlay { inset: 66px 10px 126px; }
}

/* ---------- Billing & legal ---------- */

.billing-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 1280px;
  margin: 0 auto 14px;
  padding: 13px 15px;
  border: 1px solid rgba(255, 200, 87, 0.17);
  border-radius: 13px;
  background: linear-gradient(110deg, rgba(255, 200, 87, 0.055), rgba(var(--accent-rgb), 0.018));
}
.billing-notice > div { flex: 1; min-width: 0; }
.billing-notice b { font-size: 11.5px; }
.billing-notice p { margin: 1px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.billing-notice .link-btn { flex: 0 0 auto; color: var(--warning); }
.billing-stat-grid .stat-value { font-size: clamp(22px, 2.2vw, 30px); }
.billing-top-grid { grid-template-columns: minmax(0, 1.55fr) minmax(310px, 0.9fr); }
.billing-chart-wrap { height: 238px; }
.billing-budget-body { display: flex; align-items: center; gap: 20px; padding: 14px 20px 8px; }
.billing-budget-ring {
  position: relative;
  display: grid;
  place-items: center;
  width: 116px;
  height: 116px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--budget-progress, 0) * 1%), rgba(255, 255, 255, 0.07) 0);
  box-shadow: 0 0 28px rgba(var(--accent-rgb), 0.12);
}
.billing-budget-ring::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--panel-solid);
  border: 1px solid var(--line);
}
.billing-budget-ring > span { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; }
.billing-budget-ring b { font-family: var(--mono); font-size: 21px; font-weight: 600; letter-spacing: -0.04em; }
.billing-budget-ring small { color: var(--dim); font-size: 8px; }
.billing-budget-copy { min-width: 0; flex: 1; }
.billing-budget-copy > b { display: block; font-size: 12px; }
.billing-budget-copy > span { display: block; margin-top: 3px; color: var(--dim); font-size: 9.5px; line-height: 1.5; }
.billing-progress { height: 5px; margin-top: 12px; overflow: hidden; border-radius: 99px; background: rgba(255, 255, 255, 0.07); }
.billing-progress i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.5s var(--ease); }
.billing-budget-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 7px; color: var(--dim); font-family: var(--mono); font-size: 8px; }
.billing-budget-actions { display: flex; gap: 8px; padding: 10px 20px 14px; }
.billing-budget-actions .btn { flex: 1; }
.billing-alert { display: flex; align-items: flex-start; gap: 7px; margin: 0 20px 16px; padding: 8px 10px; border: 1px solid rgba(var(--danger-rgb), 0.2); border-radius: 8px; background: rgba(var(--danger-rgb), 0.06); color: var(--danger); font-size: 9.5px; line-height: 1.5; }
.billing-alert svg { width: 13px; height: 13px; flex: 0 0 auto; margin-top: 1px; }

.official-platform-panel { max-width: 1280px; margin: 0 auto 14px; }
.official-link-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 4px 18px 18px; }
.official-link-card {
  position: relative;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01));
  overflow: hidden;
}
.official-link-card::before { content: ""; position: absolute; right: -22px; top: -28px; width: 80px; height: 80px; border-radius: 50%; background: var(--platform-color); opacity: 0.08; filter: blur(12px); }
.official-link-head { display: flex; align-items: center; gap: 8px; }
.official-link-logo { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255, 255, 255, 0.035); color: var(--platform-color); font-family: var(--mono); font-size: 9px; font-weight: 700; }
.official-link-head b { display: block; font-size: 11.5px; }
.official-link-head span { display: block; color: var(--dim); font-size: 8.5px; }
.official-link-body { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 11px; }
.official-link-body a { display: inline-flex; align-items: center; gap: 3px; height: 24px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); font-size: 9px; text-decoration: none; transition: border-color 0.16s, color 0.16s, background 0.16s; }
.official-link-body a:hover { border-color: var(--line-strong); color: var(--text); background: rgba(255, 255, 255, 0.04); }
.official-link-body a.primary { color: var(--platform-color); border-color: color-mix(in srgb, var(--platform-color) 28%, transparent); background: color-mix(in srgb, var(--platform-color) 7%, transparent); }
.official-link-body svg { width: 10px; height: 10px; }
.official-link-note { margin-top: 9px; color: var(--dim); font-size: 8.5px; }

.billing-breakdown-grid { grid-template-columns: 1fr 1fr; }
.billing-provider-list { display: flex; flex-direction: column; gap: 2px; padding: 2px 18px 9px; }
.billing-provider-row { display: grid; grid-template-columns: 9px minmax(0, 1fr) 80px 74px; align-items: center; gap: 8px; padding: 7px 4px; }
.billing-provider-row .provider-dot { width: 7px; height: 7px; }
.billing-provider-row b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10.5px; font-weight: 600; }
.billing-provider-bar { height: 4px; overflow: hidden; border-radius: 99px; background: rgba(255, 255, 255, 0.07); }
.billing-provider-bar i { display: block; height: 100%; border-radius: inherit; background: var(--provider-color); }
.billing-provider-row > span:last-child { color: var(--text-soft); font-family: var(--mono); font-size: 9px; text-align: right; }
.billing-model-list { padding: 8px 18px 16px; border-top: 1px solid var(--line-soft); }
.billing-model-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 6px 4px; border-bottom: 1px solid var(--line-soft); }
.billing-model-row:last-child { border-bottom: 0; }
.billing-model-row b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 9px; font-weight: 500; }
.billing-model-row span { color: var(--dim); font-family: var(--mono); font-size: 8.5px; text-align: right; }
.billing-token-list { padding: 2px 18px 8px; }
.billing-token-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 9px 4px; border-bottom: 1px solid var(--line-soft); }
.billing-token-row:last-child { border-bottom: 0; }
.billing-token-copy b { display: block; font-size: 10px; }
.billing-token-copy span { display: block; color: var(--dim); font-family: var(--mono); font-size: 8px; }
.billing-token-meter { width: 100px; height: 4px; margin-top: 5px; overflow: hidden; border-radius: 99px; background: rgba(255, 255, 255, 0.07); }
.billing-token-meter i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.billing-token-cost { color: var(--text-soft); font-family: var(--mono); font-size: 9px; text-align: right; }
.billing-token-cost small { display: block; color: var(--dim); font-size: 7.5px; }
.billing-token-foot { padding: 5px 20px 14px; border-top: 1px solid var(--line-soft); }
.billing-token-empty { padding: 20px 8px; color: var(--dim); font-size: 10px; text-align: center; }
.billing-recent-panel { max-width: 1280px; margin: 0 auto 14px; }
.billing-table th, .billing-table td { padding: 8px 10px; }
.billing-table .billing-cost { color: var(--accent); font-family: var(--mono); font-size: 9.5px; }
.billing-pricing-panel { max-width: 1280px; margin: 0 auto; }
.billing-pricing-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 2px 18px 18px; }
.billing-price-group { padding: 10px 11px; border: 1px solid var(--line-soft); border-radius: 9px; background: rgba(255, 255, 255, 0.018); }
.billing-price-group-head { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; }
.billing-price-group-head .provider-dot { width: 5px; height: 5px; }
.billing-price-group-head b { font-size: 10px; }
.billing-price-row { display: flex; justify-content: space-between; gap: 9px; padding: 2px 0; color: var(--dim); font-family: var(--mono); font-size: 8px; }
.billing-price-row b { color: var(--muted); font-weight: 500; }
.billing-edit-grid { display: grid; grid-template-columns: 1.2fr 0.8fr 0.8fr; gap: 8px; align-items: center; margin-top: 6px; }
.billing-edit-grid label { font-size: 9px; color: var(--dim); }
.billing-price-table { display: flex; flex-direction: column; gap: 7px; }
.billing-price-edit-row { display: grid; grid-template-columns: 1fr 90px 90px; gap: 7px; align-items: center; }
.billing-price-edit-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 9px; }
.billing-price-edit-row input { width: 100%; height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; outline: 0; background: rgba(0, 0, 0, 0.15); color: var(--text-soft); font-family: var(--mono); font-size: 9px; }
.billing-price-edit-row input:focus { border-color: rgba(var(--accent-rgb), 0.45); }
.billing-price-provider { margin-bottom: 12px; }
.billing-price-provider > b { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; font-size: 11px; }

.terms-field { padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255, 255, 255, 0.02); }
.terms-check { display: flex; align-items: flex-start; gap: 8px; color: var(--muted); font-size: 10.5px; line-height: 1.6; cursor: pointer; }
.terms-check input { width: 14px; height: 14px; margin: 2px 0 0; accent-color: var(--accent); flex: 0 0 auto; }
.terms-link { padding: 0; border: 0; background: transparent; color: var(--accent); font-size: inherit; text-decoration: underline; text-underline-offset: 2px; }
.auth-legal-link { color: var(--dim); font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.09em; }
.auth-legal-link:hover { color: var(--accent); }
.legal-doc { color: var(--muted); font-size: 11.5px; line-height: 1.8; }
.legal-doc h3 { margin: 17px 0 6px; color: var(--text); font-size: 13px; }
.legal-doc h3:first-child { margin-top: 0; }
.legal-doc p { margin: 0 0 8px; }
.legal-doc ul { margin: 0 0 9px; padding-left: 18px; }
.legal-doc li { margin: 3px 0; }
.legal-doc strong { color: var(--text-soft); }
.legal-meta { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 16px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; color: var(--dim); font-family: var(--mono); font-size: 8px; }
.legal-highlight { padding: 10px 12px; border: 1px solid rgba(255, 200, 87, 0.17); border-radius: 8px; background: rgba(255, 200, 87, 0.05); color: var(--warning); font-size: 10px; line-height: 1.6; }

.mobile-access-grid { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 18px; align-items: start; }
.mobile-qr { display: grid; place-items: center; min-height: 232px; padding: 11px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.mobile-qr svg { width: 100%; height: auto; max-width: 210px; display: block; }
.mobile-qr-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; color: #6c7d91; font-size: 10px; text-align: center; }
.mobile-qr-empty svg { width: 34px; height: 34px; }
.mobile-access-copy { min-width: 0; }
.network-url { display: flex; align-items: center; gap: 7px; margin: 6px 0 8px; padding: 7px 8px 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(0, 0, 0, 0.16); }
.network-url code { flex: 1; overflow: hidden; color: var(--accent); font-family: var(--mono); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.mobile-access-hint { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.mobile-steps { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.mobile-steps > div { display: flex; align-items: flex-start; gap: 8px; color: var(--dim); font-size: 9.5px; line-height: 1.5; }
.mobile-steps b { display: grid; place-items: center; width: 17px; height: 17px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 50%; color: var(--accent); font-family: var(--mono); font-size: 8px; font-weight: 500; }
.network-alt { margin-top: 10px; color: var(--dim); font-size: 9px; line-height: 1.8; }
.network-alt code { margin-left: 3px; color: var(--muted); font-family: var(--mono); font-size: 8.5px; }
.mobile-access-note { display: flex; align-items: flex-start; gap: 6px; margin-top: 10px; color: var(--dim); font-size: 8.5px; line-height: 1.55; }
.mobile-access-note svg { width: 12px; height: 12px; flex: 0 0 auto; margin-top: 1px; }
@media (max-width: 620px) {
  .mobile-access-grid { grid-template-columns: 1fr; }
  .mobile-qr { min-height: 0; }
  .mobile-qr svg { max-width: 190px; }
}

@media (max-width: 980px) {
  .official-link-grid { grid-template-columns: 1fr; }
  .billing-pricing-summary { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .view-billing .page-actions .status-pill { display: none; }
  .billing-notice { align-items: flex-start; flex-wrap: wrap; }
  .billing-notice .link-btn { margin-left: 36px; }
  .billing-top-grid, .billing-breakdown-grid { grid-template-columns: 1fr; }
  .billing-budget-body { gap: 14px; padding: 10px 16px 6px; }
  .billing-budget-ring { width: 94px; height: 94px; }
  .billing-budget-actions { padding: 8px 16px 12px; }
  .billing-alert { margin-left: 16px; margin-right: 16px; }
  .official-link-grid { padding-left: 14px; padding-right: 14px; }
  .billing-provider-list, .billing-token-list, .billing-model-list { padding-left: 14px; padding-right: 14px; }
  .billing-token-foot { padding-left: 16px; }
  .billing-pricing-summary { padding-left: 14px; padding-right: 14px; }
  .billing-price-edit-row { grid-template-columns: 1fr 72px 72px; }
}
@media (max-width: 520px) {
  .billing-budget-body { flex-direction: column; align-items: stretch; }
  .billing-budget-ring { margin: 0 auto; }
  .billing-provider-row { grid-template-columns: 8px minmax(0, 1fr) 56px; }
  .billing-provider-row .billing-provider-bar { display: none; }
  .billing-provider-row > span:last-child { grid-column: 2 / -1; text-align: right; margin-top: -3px; }
  .billing-notice .link-btn { margin-left: 0; }
}

/* ---------- Reduced motion ---------- */

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

