/* llm-launcher — Apple-style visual language.
   Materials: translucent chrome over scrolling content; heavier blur on the
   big sheet, lighter on cards. Type: system-ui + PingFang SC, size-specific
   tracking. Motion: transform/opacity only, press feedback on pointer-down,
   everything respects prefers-reduced-motion. */

:root {
  color-scheme: dark;
  --accent: #0A84FF;
  --accent-tint: rgba(10, 132, 255, 0.16);
  --green: #30D158;
  --red: #FF453A;
  --orange: #FF9F0A;
  --bg: #0B0B0D;
  --bg-elev: rgba(28, 28, 30, 0.55);
  --bg-strong: rgba(24, 24, 27, 0.9);
  --label: rgba(255, 255, 255, 0.92);
  --label-2: rgba(255, 255, 255, 0.6);
  --label-3: rgba(255, 255, 255, 0.38);
  --sep: rgba(255, 255, 255, 0.08);
  --sep-strong: rgba(255, 255, 255, 0.14);
  --edge: rgba(255, 255, 255, 0.1);
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.45);
  --radius: 16px;
  --sidebar-w: 228px;
}
html[data-theme="light"] {
  color-scheme: light;
  --accent: #007AFF;
  --accent-tint: rgba(0, 122, 255, 0.12);
  --green: #28C840;
  --red: #FF3B30;
  --orange: #FF9500;
  --bg: #F4F4F6;
  --bg-elev: rgba(255, 255, 255, 0.66);
  --bg-strong: rgba(250, 250, 252, 0.94);
  --label: rgba(0, 0, 0, 0.88);
  --label-2: rgba(0, 0, 0, 0.56);
  --label-3: rgba(0, 0, 0, 0.36);
  --sep: rgba(0, 0, 0, 0.06);
  --sep-strong: rgba(0, 0, 0, 0.11);
  --edge: rgba(0, 0, 0, 0.08);
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.12);
}

* { box-sizing: border-box; margin: 0; }
html { height: 100%; }
body {
  height: 100%;
  background: var(--bg);
  color: var(--label);
  font: 15px/1.55 -apple-system, "SF Pro Text", system-ui, "PingFang SC", "HarmonyOS Sans SC", "Noto Sans CJK SC", sans-serif;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  transition: background-color 260ms ease, color 200ms ease;
}
.glass, .glass-strong, input, .mcard, .tile, .chart-card, .set-card {
  transition: background-color 260ms ease, border-color 220ms ease, color 200ms ease, box-shadow 240ms ease;
}
html[data-theme="dark"] body {
  background: radial-gradient(1200px 700px at 80% -10%, rgba(10, 132, 255, 0.10), transparent 60%), var(--bg);
}
html[data-theme="light"] body {
  background: radial-gradient(1100px 620px at 82% -12%, rgba(0, 122, 255, 0.10), transparent 62%), var(--bg);
}

.glass {
  background: var(--bg-elev);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
}
.glass-strong {
  background: var(--bg-strong);
  -webkit-backdrop-filter: blur(34px) saturate(180%);
  backdrop-filter: blur(34px) saturate(180%);
}

.hidden { display: none !important; }

/* ---------- layout ---------- */
.app { display: flex; height: 100%; }

.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  display: flex; flex-direction: column;
  border-right: 1px solid var(--sep);
  padding: 18px 12px 14px;
  z-index: 20;
}
.brand { display: flex; gap: 11px; align-items: center; padding: 4px 8px 16px; }
.brand-mark { width: 34px; height: 34px; border-radius: 8.5px; box-shadow: 0 4px 14px rgba(10,132,255,.4); }
.brand-name { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.brand-host { font-size: 11.5px; color: var(--label-3); }

.sidebar nav { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.sidebar nav a, .tabbar a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  color: var(--label-2); text-decoration: none; font-size: 14px; font-weight: 500;
  transition: background 150ms ease, color 150ms ease, transform 100ms ease-out;
}
.sidebar nav a svg, .tabbar a svg { width: 19px; height: 19px; }
.sidebar nav a:active, .tabbar a:active { transform: scale(0.97); }
.sidebar nav a.active { background: var(--accent-tint); color: var(--accent); }
.sidebar nav a:hover:not(.active) { background: var(--sep); color: var(--label); }

.sidebar-foot { margin-top: auto; padding: 8px; display: flex; flex-direction: column; gap: 7px; }
.theme-quick {
  width: 100%; border: 0; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  color: var(--label-2); background: transparent;
  padding: 8px 10px; border-radius: 10px;
  font: inherit; font-size: 12px; text-align: left;
  transition: background 150ms ease, color 150ms ease, transform 100ms ease-out;
}
.theme-quick:hover { color: var(--label); background: var(--sep); }
.theme-quick:active { transform: scale(0.97); }
.theme-quick svg { width: 16px; height: 16px; }
html[data-theme="dark"] .theme-moon, html[data-theme="light"] .theme-sun { display: none; }
.tunnel-chip {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--label-2);
  padding: 8px 10px; border-radius: 10px; background: var(--sep);
}
.tunnel-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--label-3); }
.tunnel-chip.on .dot { background: var(--green); box-shadow: 0 0 8px var(--green); }
.logout-side {
  width: 100%; border: 0; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  color: var(--label-2); background: transparent;
  padding: 8px 10px; border-radius: 10px;
  font: inherit; font-size: 12px; text-align: left;
  transition: background 150ms ease, color 150ms ease, transform 100ms ease-out;
}
.logout-side:hover { color: var(--danger, #e5484d); background: var(--sep); }
.logout-side:active { transform: scale(0.97); }
.logout-side svg { width: 16px; height: 16px; flex: none; }

.main { flex: 1; overflow-y: auto; padding: 36px clamp(20px, 4vw, 48px) 90px; scroll-behavior: smooth; }
.view { max-width: 1120px; margin: 0 auto; }
.view > * { animation: viewin 300ms cubic-bezier(0.2, 0.8, 0.2, 1) backwards; }
.view > *:nth-child(2) { animation-delay: 40ms; }
.view > *:nth-child(3) { animation-delay: 80ms; }
.view > *:nth-child(4) { animation-delay: 120ms; }
@keyframes viewin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.page-head h1 { font-size: clamp(26px, 3.4vw, 34px); font-weight: 700; letter-spacing: -0.022em; line-height: 1.08; }
.page-sub { color: var(--label-2); margin-top: 4px; font-size: 14px; }
.page-head { margin-bottom: 20px; }

/* ---------- tabs (narrow) ---------- */
.tabbar { display: none; }

@media (max-width: 860px) {
  body { overflow: auto; }
  .app { flex-direction: column; height: auto; min-height: 100%; }
  .sidebar { display: none; }
  .main { padding: 24px 16px 110px; }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    display: flex; justify-content: space-around;
    border-top: 1px solid var(--edge);
    padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
  }
  .tabbar a { flex-direction: column; gap: 3px; font-size: 10.5px; padding: 4px 14px; border-radius: 10px; }
  .tabbar a svg { width: 21px; height: 21px; }
  .tabbar a.active { color: var(--accent); background: none; }
}

/* ---------- login · tech hero ---------- */
.login-layer {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 20px;
  overflow: hidden;
}
#login-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* aurora color fields — vivid on dark, soft pastel wash on light */
.aurora { position: absolute; border-radius: 50%; filter: blur(90px); pointer-events: none; }
.aurora.a1 { width: 540px; height: 540px; top: -170px; left: -130px; background: #5E5CE6; opacity: .42; animation: drift1 26s ease-in-out infinite alternate; }
.aurora.a2 { width: 480px; height: 480px; bottom: -160px; right: -110px; background: #0A84FF; opacity: .40; animation: drift2 30s ease-in-out infinite alternate; }
.aurora.a3 { width: 380px; height: 380px; top: 36%; left: 56%; background: #BF5AF2; opacity: .30; animation: drift3 24s ease-in-out infinite alternate; }
.aurora.a4 { width: 320px; height: 320px; bottom: 14%; left: 6%; background: #64D2FF; opacity: .26; animation: drift1 34s ease-in-out infinite alternate-reverse; }
html[data-theme="light"] .aurora { opacity: .26; filter: blur(110px); }
html[data-theme="light"] .aurora.a3 { opacity: .18; }
html[data-theme="light"] .aurora.a4 { opacity: .20; }
@keyframes drift1 { to { transform: translate(70px, 46px) scale(1.12); } }
@keyframes drift2 { to { transform: translate(-56px, -40px) scale(1.08); } }
@keyframes drift3 { to { transform: translate(-48px, 40px); } }

/* theme switch on the login screen itself */
.hud-theme {
  position: absolute; top: 16px; right: 52px; z-index: 1;
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  color: var(--label-2); background: transparent; border: 0; cursor: pointer;
  transition: background 150ms ease, color 150ms ease, transform 100ms ease-out;
}
.hud-theme:hover { background: var(--sep); color: var(--label); }
.hud-theme:active { transform: scale(0.94); }
.hud-theme svg { width: 17px; height: 17px; }

/* HUD frame */
.hud-corner {
  position: absolute; width: 26px; height: 26px; z-index: 1;
  border-color: var(--accent); border-style: solid; border-width: 0;
  opacity: 0.55; pointer-events: none;
}
.hud-corner.tl { top: 16px; left: 16px; border-top-width: 1.5px; border-left-width: 1.5px; }
.hud-corner.tr { top: 16px; right: 16px; border-top-width: 1.5px; border-right-width: 1.5px; }
.hud-corner.bl { bottom: 16px; left: 16px; border-bottom-width: 1.5px; border-left-width: 1.5px; }
.hud-corner.br { bottom: 16px; right: 16px; border-bottom-width: 1.5px; border-right-width: 1.5px; }
.hud-topline {
  position: absolute; top: 22px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  font: 10px/1 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.22em; color: var(--label-3);
  z-index: 1; pointer-events: none; white-space: nowrap;
}
.hud-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 8px var(--green); animation: pulse 2s ease infinite; }
.hud-cursor { animation: blink 1.1s steps(1) infinite; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }

.login-card {
  position: relative; z-index: 2;
  width: min(420px, 94vw); border-radius: 22px; padding: 38px 34px 30px;
  border: 1px solid transparent;
  background:
    linear-gradient(var(--bg-elev), var(--bg-elev)) padding-box,
    linear-gradient(135deg, var(--accent) 0%, transparent 32%, transparent 68%, #64D2FF 100%) border-box;
  box-shadow: var(--shadow), 0 0 42px rgba(10, 132, 255, 0.14);
  text-align: center;
  overflow: hidden;
}
html[data-theme="light"] .login-card {
  box-shadow: var(--shadow), 0 0 42px rgba(0, 122, 255, 0.10);
}
/* scan line sweeping the card */
.login-card::after {
  content: ""; position: absolute; left: 0; right: 0; top: -40%;
  height: 34%; pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(100, 210, 255, 0.07), transparent);
  animation: scan 6.5s ease-in-out infinite;
}
@keyframes scan { 0%, 55% { top: -40%; } 90%, 100% { top: 120%; } }

.login-card.shake { animation: shake 380ms ease; }
@keyframes shake { 20% { transform: translateX(-9px); } 45% { transform: translateX(7px); } 70% { transform: translateX(-4px); } 90% { transform: translateX(2px); } }

/* rotating energy ring around the lock */
.login-ring { width: 66px; height: 66px; margin: 0 auto 16px; position: relative; }
.login-ring::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 62%, var(--accent) 82%, #64D2FF 94%, transparent);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2px));
  animation: ringspin 3.2s linear infinite;
}
@keyframes ringspin { to { transform: rotate(360deg); } }
.login-ring-core {
  position: absolute; inset: 7px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-tint); color: var(--accent);
}
.login-ring-core svg { width: 24px; height: 24px; }

.hero-title {
  font-size: 32px; font-weight: 750; letter-spacing: -0.024em; line-height: 1.06;
}
.hero-title .grad {
  background: linear-gradient(100deg, var(--accent), #64D2FF);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub {
  font: 10.5px/1 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.2em; color: var(--label-3);
  margin: 9px 0 16px; text-transform: uppercase;
}
.hero-chips { display: flex; justify-content: center; gap: 7px; flex-wrap: wrap; margin-bottom: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font: 10.5px/1 ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--label-2); border: 1px solid var(--sep-strong);
  border-radius: 999px; padding: 4.5px 10px; white-space: nowrap;
}
.chip .led { width: 5px; height: 5px; border-radius: 50%; }
.led-g { background: var(--green); box-shadow: 0 0 6px var(--green); }
.led-p { background: #BF5AF2; box-shadow: 0 0 6px #BF5AF2; }
.led-c { background: #64D2FF; box-shadow: 0 0 6px #64D2FF; }

#login-user, #login-key {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.05em;
}
#login-user:focus, #login-key:focus { box-shadow: 0 0 0 3px var(--accent-tint); }
.hero-btn {
  margin-top: 14px; padding: 12px;
  background: linear-gradient(100deg, var(--accent), #3B6EF6);
  color: #fff; letter-spacing: 0.04em;
}
.hero-btn:hover { filter: brightness(1.1); }
.login-err { color: var(--red); font-size: 12.5px; margin-top: 10px; }

@media (prefers-reduced-motion: reduce) {
  .login-ring::before, .login-card::after, .hud-dot, .hud-cursor { animation: none; }
}
@media (max-width: 560px) {
  .hud-topline { font-size: 8.5px; letter-spacing: 0.14em; }
  .login-card { padding: 30px 24px 24px; }
}

input {
  width: 100%; padding: 11px 13px; margin-top: 10px;
  border-radius: 11px; border: 1px solid var(--sep-strong);
  background: var(--sep); color: var(--label);
  font: inherit; font-size: 14px; outline: none;
  transition: border-color 150ms ease, background 150ms ease;
}
input:focus { border-color: var(--accent); background: transparent; }
input::placeholder { color: var(--label-3); }

/* ---------- buttons ---------- */
.btn {
  -webkit-appearance: none; appearance: none; border: none; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--label);
  padding: 9px 16px; border-radius: 11px;
  background: var(--sep-strong);
  transition: transform 100ms ease-out, filter 150ms ease, opacity 150ms ease, background 150ms ease;
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
}
.btn:active { transform: scale(0.965); }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.secondary { background: var(--accent-tint); color: var(--accent); }
.btn.danger { background: rgba(255, 69, 58, 0.14); color: var(--red); }
.btn.ghost { background: transparent; color: var(--label-2); }
.btn.ghost:hover { background: var(--sep); color: var(--label); }
.btn.small { padding: 6px 11px; font-size: 12.5px; border-radius: 9px; }
.btn.wide { width: 100%; padding: 12px; margin-top: 14px; }
.btn.icon-only { padding: 6px; }
.btn svg { width: 15px; height: 15px; }

/* ---------- status pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.01em;
  padding: 3.5px 10px; border-radius: 999px;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.running { color: var(--green); background: rgba(48, 209, 88, 0.14); }
.pill.booting { color: var(--orange); background: rgba(255, 159, 10, 0.14); }
.pill.booting .dot { animation: pulse 1.2s ease infinite; }
.pill.stopped { color: var(--label-2); background: var(--sep-strong); }
.pill.foreign { color: var(--red); background: rgba(255, 69, 58, 0.13); }
@keyframes pulse { 50% { opacity: 0.25; } }

/* ---------- banner ---------- */
.banner {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 13px; color: var(--orange);
  background: rgba(255, 159, 10, 0.1); border: 1px solid rgba(255, 159, 10, 0.25);
  border-radius: 12px; padding: 11px 14px; margin-bottom: 16px;
}
.banner svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }

/* ---------- model cards ---------- */
.model-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 980px) { .model-grid { grid-template-columns: 1fr; } }

.mcard {
  border-radius: var(--radius); border: 1px solid var(--edge);
  box-shadow: 0 1px 0 rgba(255,255,255,0.05) inset, 0 8px 26px rgba(0,0,0,0.18);
  padding: 18px 18px 16px;
  display: flex; flex-direction: column; gap: 13px;
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 220ms ease,
    background-color 260ms ease, border-color 220ms ease;
}
.mcard.cardin { animation: cardin 420ms cubic-bezier(0.2, 0.8, 0.2, 1) backwards; }
@keyframes cardin { from { opacity: 0; transform: translateY(14px) scale(0.985); } }
@media (hover: hover) {
  .mcard:hover { transform: translateY(-3px); box-shadow: 0 1px 0 rgba(255,255,255,0.05) inset, 0 16px 40px rgba(0,0,0,0.26); }
  html[data-theme="light"] .mcard:hover { box-shadow: 0 1px 0 rgba(255,255,255,0.7) inset, 0 16px 40px rgba(0,0,0,0.10); }
}
html[data-theme="light"] .mcard { box-shadow: 0 1px 0 rgba(255,255,255,0.7) inset, 0 8px 26px rgba(0,0,0,0.06); }
.mcard-head { display: flex; align-items: flex-start; gap: 10px; }
.mcard-title { flex: 1; min-width: 0; }
.mcard-title h2 { font-size: 17.5px; font-weight: 650; letter-spacing: -0.015em; }
.mcard-title .sub { font-size: 12px; color: var(--label-3); margin-top: 1px; }
.mcard-desc { font-size: 12.8px; color: var(--label-2); line-height: 1.55; }

.specs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 9px 18px;
  padding: 12px 14px; border-radius: 11px; background: var(--sep);
  align-content: start;
}
.spec { min-width: 0; font-size: 12px; line-height: 1.45; }
.spec b { display: block; color: var(--label-3); font-weight: 500; font-size: 10.5px; letter-spacing: 0.04em; margin-bottom: 1px; }
.spec span { color: var(--label); word-break: break-all; }
@media (max-width: 560px) { .specs { grid-template-columns: 1fr; } }

.endpoint-row { display: flex; flex-direction: column; gap: 6px; }
.ep {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--label-2);
  background: var(--sep); border-radius: 9px; padding: 7px 10px;
}
.ep b { color: var(--label); font-weight: 500; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.ep .tag { font-size: 10px; font-weight: 600; color: var(--label-3); letter-spacing: 0.03em; }

.opts { display: flex; flex-direction: column; gap: 7px; }
.opt-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.opt-row label { width: 92px; flex: none; color: var(--label-2); }
.opt-row select, .opt-row input {
  flex: 1; margin: 0; padding: 7px 10px; border-radius: 9px;
  background: var(--sep); border: 1px solid var(--sep-strong); font-size: 12.5px;
}
.opt-hint { font-size: 11px; color: var(--label-3); margin: -2px 0 0 100px; }

.mcard-actions { display: flex; gap: 8px; margin-top: auto; flex-wrap: wrap; }
.mcard-actions .btn { flex: 1; min-width: 86px; }
.mcard-actions .btn.noflex { flex: 0 0 auto; min-width: 0; }

/* ---------- monitor ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(212px, 1fr)); gap: 14px; margin-bottom: 18px; }
.tile { border-radius: var(--radius); border: 1px solid var(--edge); padding: 15px 16px 13px; transition: transform 220ms cubic-bezier(0.2,0.8,0.2,1), box-shadow 220ms ease, background-color 260ms ease; }
@media (hover: hover) { .tile:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0,0,0,0.14); } }
.tile-label { font-size: 11.5px; font-weight: 600; color: var(--label-3); letter-spacing: 0.03em; }
.tile-value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin: 3px 0 8px; font-variant-numeric: tabular-nums; }
.tile-bar { height: 5px; border-radius: 3px; background: var(--sep-strong); overflow: hidden; }
.tile-bar > div { height: 100%; border-radius: 3px; background: var(--accent); width: 0%; transition: width 400ms ease; }
.tile-bar > div.hot { background: var(--orange); }
.tile-foot { font-size: 11px; color: var(--label-3); margin-top: 7px; font-variant-numeric: tabular-nums; }

.chart-card { border-radius: var(--radius); border: 1px solid var(--edge); padding: 15px 16px 12px; margin-bottom: 18px; }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.chart-head h2 { font-size: 14px; font-weight: 650; letter-spacing: -0.01em; }
.chart-legend { font-size: 11px; color: var(--label-3); display: flex; gap: 12px; align-items: center; }
.lg { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.lg-mem { background: var(--accent); } .lg-cpu { background: var(--green); }
.lg-rx { background: var(--accent); } .lg-tx { background: var(--orange); }
canvas { width: 100%; height: 160px; display: block; }
#chart-mem { height: 180px; }

.container-list { display: flex; flex-direction: column; }
.crow { display: flex; align-items: center; gap: 12px; padding: 9px 2px; border-top: 1px solid var(--sep); font-size: 12.5px; }
.crow:first-child { border-top: none; }
.crow .cname { flex: 0 0 auto; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.crow .cbar { flex: 1; height: 5px; background: var(--sep-strong); border-radius: 3px; overflow: hidden; }
.crow .cbar > div { height: 100%; background: var(--accent); border-radius: 3px; }
.crow .cval { flex: 0 0 150px; text-align: right; color: var(--label-2); font-variant-numeric: tabular-nums; font-size: 11.5px; }
.container-empty { color: var(--label-3); font-size: 12.5px; padding: 8px 0; }

/* ---------- settings ---------- */
.set-card { border-radius: var(--radius); border: 1px solid var(--edge); padding: 18px 20px; margin-bottom: 15px; }
.set-card h2 { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; margin-bottom: 10px; }
.set-note { font-size: 12.3px; color: var(--label-2); line-height: 1.55; margin-bottom: 10px; }
.set-note code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11px; background: var(--sep); padding: 1.5px 5px; border-radius: 5px; }
.kv { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 13px; border-top: 1px solid var(--sep); }
.kv:first-of-type { border-top: none; }
.kv span { color: var(--label-2); width: 90px; flex: none; }
.kv b { flex: 1; font-weight: 500; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.set-row { display: flex; align-items: center; gap: 14px; padding: 4px 0 10px; }
.set-row-main { flex: 1; }
.set-row-title { font-size: 13.5px; font-weight: 550; }
.set-row-sub { font-size: 12px; color: var(--label-3); margin-top: 1px; }
.set-grid { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; align-items: center; margin: 6px 0 4px; }
.set-grid label { font-size: 12.5px; color: var(--label-2); }
.set-grid input { margin: 0; }
.set-actions { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.set-status { font-size: 12px; color: var(--label-2); }
.set-status.dim { color: var(--label-3); }
.set-card.danger { border-color: rgba(255, 69, 58, 0.3); }
.keyrow { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.keyrow label { width: 170px; flex: none; font-size: 12.5px; color: var(--label-2); }
@media (max-width: 560px) { .keyrow { flex-direction: column; align-items: stretch; } .keyrow label { width: auto; } }
.defaults-pair { flex: 1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.defaults-pair select { width: auto; min-width: 110px; flex: none; margin: 0; padding: 6px 9px; font-size: 12.5px; }
.pair-label { font-size: 11.5px; color: var(--label-3); }
.opt-note { font-size: 11.5px; color: var(--label-3); }

.switch {
  width: 48px; height: 29px; border-radius: 999px; border: none; cursor: pointer;
  background: var(--sep-strong); position: relative; flex: none;
  transition: background 200ms ease;
}
.switch .knob {
  position: absolute; top: 2px; left: 2px; width: 25px; height: 25px;
  border-radius: 50%; background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  transition: transform 220ms cubic-bezier(0.3, 1.2, 0.4, 1);
}
.switch[aria-checked="true"] { background: var(--green); }
.switch[aria-checked="true"] .knob { transform: translateX(19px); }
.switch:active .knob { width: 28px; }
.switch[aria-checked="true"]:active .knob { transform: translateX(16px); }

.segmented {
  display: inline-grid; grid-template-columns: 1fr 1fr;
  padding: 3px; border-radius: 11px; background: var(--sep-strong);
  min-width: 190px;
}
.segmented button {
  border: 0; cursor: pointer; border-radius: 8px;
  padding: 7px 12px; color: var(--label-2); background: transparent;
  font: inherit; font-size: 12.5px; font-weight: 600;
  display: inline-flex; justify-content: center; align-items: center; gap: 6px;
  transition: color 150ms ease, background 180ms ease, box-shadow 180ms ease, transform 100ms ease-out;
}
.segmented button svg { width: 15px; height: 15px; }
.segmented button:active { transform: scale(0.96); }
.segmented button[aria-pressed="true"] {
  color: var(--label); background: var(--bg-strong);
  box-shadow: 0 1px 5px rgba(0,0,0,.18), 0 1px 0 var(--edge) inset;
}
@media (max-width: 560px) {
  .appearance-row { align-items: flex-start; flex-direction: column; }
  .segmented { width: 100%; }
}

/* ---------- sheet (log drawer) ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 0, 0, 0.42);
  opacity: 0; transition: opacity 260ms ease;
}
.scrim.show { opacity: 1; }
.sheet {
  position: fixed; left: 50%; z-index: 60;
  width: min(880px, 96vw);
  bottom: 0; border-radius: 22px 22px 0 0;
  border: 1px solid var(--edge); border-bottom: none;
  box-shadow: 0 -18px 60px rgba(0, 0, 0, 0.4);
  transform: translate(-50%, 100%);
  display: flex; flex-direction: column; height: min(72vh, 640px);
  will-change: transform;
}
.sheet-grabber { padding: 9px 0 3px; display: grid; place-items: center; cursor: grab; touch-action: none; }
.sheet-grabber i { width: 40px; height: 5px; border-radius: 3px; background: var(--label-3); display: block; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 18px 10px; border-bottom: 1px solid var(--sep); }
.sheet-title { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.sheet-sub { font-size: 11px; color: var(--label-3); font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.sheet-head-actions { display: flex; gap: 8px; }
.sheet-log {
  flex: 1; overflow: auto; padding: 12px 18px 18px;
  font: 11px/1.65 ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--label-2); white-space: pre-wrap; word-break: break-all;
  -webkit-user-select: text; user-select: text;
}

/* ---------- toast ---------- */
.toast {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  z-index: 90; padding: 9px 18px; border-radius: 999px;
  font-size: 13px; font-weight: 550; border: 1px solid var(--edge);
  box-shadow: var(--shadow);
  animation: toastin 300ms cubic-bezier(0.3, 1.2, 0.4, 1);
}
.toast.err { color: var(--red); }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, -14px) scale(0.95); } }

/* ---------- chat playground ---------- */
.chat-layout { display: grid; grid-template-columns: 264px 1fr; gap: 16px; height: calc(100vh - 210px); min-height: 460px; }
@media (max-width: 860px) { .chat-layout { grid-template-columns: 1fr; height: auto; } .chat-main { height: 70vh; } }
.chat-side { display: flex; flex-direction: column; gap: 10px; }
.chat-side-title { font-size: 12px; font-weight: 600; color: var(--label-3); letter-spacing: 0.04em; }
.chat-models { display: flex; flex-direction: column; gap: 7px; }
.chat-model {
  border: 1px solid var(--sep-strong); border-radius: 12px; cursor: pointer;
  background: var(--bg-elev); color: var(--label); text-align: left;
  padding: 10px 12px; font: inherit;
  transition: transform 120ms ease-out, border-color 150ms ease, background 150ms ease;
}
.chat-model:active { transform: scale(0.98); }
.chat-model:hover { border-color: var(--accent); }
.chat-model.sel { border-color: var(--accent); background: var(--accent-tint); }
.chat-model b { display: block; font-size: 13px; font-weight: 600; }
.chat-model span { font: 10.5px/1.4 ui-monospace, "SF Mono", Menlo, monospace; color: var(--label-3); }
.chat-opts { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.chat-opts label { font-size: 11.5px; color: var(--label-3); margin-top: 4px; }
.chat-opts select, .chat-opts input { margin: 0; padding: 8px 10px; font-size: 12.5px; }
.chat-hint { font: 10.5px/1.5 ui-monospace, "SF Mono", Menlo, monospace; color: var(--label-3); margin-top: auto; }
.chat-main { border-radius: var(--radius); border: 1px solid var(--edge); display: flex; flex-direction: column; overflow: hidden; }
.chat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.chat-empty { color: var(--label-3); font-size: 13px; text-align: center; margin: auto; }
.bubble { max-width: 82%; padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.bubble.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 5px; }
.bubble.assistant { align-self: flex-start; background: var(--sep); border-bottom-left-radius: 5px; }
.bubble.assistant .bubble-text { color: var(--label); }
.reasoning { margin-bottom: 6px; font-size: 12px; color: var(--label-3); }
.reasoning summary { cursor: pointer; user-select: none; }
.reasoning-body { margin-top: 4px; padding: 8px 10px; border-radius: 8px; background: var(--sep); font-size: 12px; white-space: pre-wrap; }
.bubble-meta { margin-top: 7px; font: 10.5px/1.4 ui-monospace, "SF Mono", Menlo, monospace; color: var(--label-3); }
.chat-event { align-self: center; font-size: 11px; color: var(--label-3); background: var(--sep); padding: 4px 10px; border-radius: 999px; }
.chat-runtime { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--sep); font-size: 11.5px; color: var(--label-2); }
#chat-runtime-state { font-weight: 600; }
#chat-runtime-stats { margin-right: auto; font-family: ui-monospace, "SF Mono", Menlo, monospace; color: var(--label-3); }
.chat-inputrow { display: flex; gap: 9px; padding: 12px; border-top: 1px solid var(--sep); }
.chat-inputrow input { flex: 1; margin: 0; }
.chat-inputrow .btn { flex: none; }

.user-create-grid { display: grid; grid-template-columns: 1fr 1fr 1.25fr auto; gap: 8px; align-items: center; margin: 8px 0 12px; }
.user-create-grid input { margin: 0; }
.user-summary { font-size: 11.5px; color: var(--label-3); margin: 4px 0 6px; }
.user-list { display: flex; flex-direction: column; }
.user-row { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-top: 1px solid var(--sep); }
.user-who { flex: 1; min-width: 0; }
.user-who b { display: block; font-size: 13px; font-weight: 600; }
.user-who span { display: block; font: 10.5px/1.5 ui-monospace, "SF Mono", Menlo, monospace; color: var(--label-3); overflow: hidden; text-overflow: ellipsis; }
.user-actions { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 760px) {
  .user-create-grid { grid-template-columns: 1fr; }
  .user-row { align-items: flex-start; flex-direction: column; }
  .user-actions { justify-content: flex-start; }
  .chat-runtime { flex-wrap: wrap; }
}

/* ---------- reduced motion / transparency ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .view { animation: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .glass, .glass-strong { -webkit-backdrop-filter: none; backdrop-filter: none; }
  html[data-theme="dark"] { --bg-elev: rgba(28, 28, 30, 0.98); --bg-strong: rgba(24, 24, 27, 1); }
  html[data-theme="light"] { --bg-elev: rgba(255, 255, 255, 0.98); --bg-strong: rgba(250, 250, 252, 1); }
}
@media (prefers-contrast: more) {
  .glass, .glass-strong, .mcard, .tile, .set-card { border-color: var(--sep-strong); }
}
