:root {
  color-scheme: dark;
  --bg: #070a12;
  --panel: rgba(14, 18, 31, .82);
  --panel-solid: #0e1220;
  --panel-2: #151a2c;
  --line: rgba(255, 255, 255, .085);
  --line-strong: rgba(255, 255, 255, .15);
  --text: #f5f7ff;
  --muted: #8f98b2;
  --muted-2: #606a83;
  --cyan: #42e8d6;
  --blue: #68a8ff;
  --violet: #a979ff;
  --green: #61e394;
  --danger: #ff6f91;
  --warning: #ffc861;
  --shadow: 0 30px 80px rgba(0, 0, 0, .34);
  --radius-xl: 26px;
  --radius-lg: 18px;
  --radius-md: 13px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); scroll-behavior: smooth; }
body { min-height: 100vh; margin: 0; color: var(--text); background: radial-gradient(circle at 50% -30%, #172041 0, var(--bg) 46%); }
button, input, textarea, select { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
::selection { color: #071013; background: var(--cyan); }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 100; top: 12px; left: 12px; padding: 10px 14px; border-radius: 10px; color: #071013; background: var(--cyan); transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }
.ambient { position: fixed; z-index: -1; width: 520px; height: 520px; border-radius: 50%; filter: blur(130px); opacity: .13; pointer-events: none; }
.ambient-one { top: -250px; right: 5%; background: var(--violet); }
.ambient-two { bottom: -330px; left: 20%; background: var(--cyan); }

.brand { display: flex; align-items: center; gap: 12px; min-width: max-content; }
.brand-mark { position: relative; display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid rgba(66, 232, 214, .28); border-radius: 13px; background: linear-gradient(145deg, rgba(66,232,214,.15), rgba(169,121,255,.1)); box-shadow: inset 0 0 16px rgba(66,232,214,.08), 0 0 30px rgba(66,232,214,.08); }
.brand-mark::before { position: absolute; inset: 7px; border: 1px solid rgba(255,255,255,.14); border-radius: 8px; content: ""; transform: rotate(45deg); }
.brand-mark img { position: relative; z-index: 1; width: 30px; height: 30px; object-fit: contain; }
.brand strong { display: block; font-size: 17px; letter-spacing: .12em; }
.brand small { display: block; margin-top: 2px; color: var(--muted-2); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.eyebrow { margin: 0 0 8px; color: var(--cyan); font-size: 11px; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; }
.pulse-dot { display: inline-block; width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(97,227,148,.09), 0 0 14px rgba(97,227,148,.8); animation: pulse 2.4s ease-in-out infinite; }
.pulse-dot.offline { background: var(--danger); box-shadow: 0 0 0 5px rgba(255,111,145,.09); animation: none; }
@keyframes pulse { 50% { opacity: .55; transform: scale(.82); } }

/* Chat */
.app-shell { display: grid; min-height: 100vh; grid-template-columns: 252px minmax(0, 1fr); }
.sidebar { position: sticky; z-index: 20; top: 0; display: flex; height: 100vh; flex-direction: column; padding: 24px 18px 18px; border-right: 1px solid var(--line); background: rgba(7, 10, 18, .72); backdrop-filter: blur(24px); }
.sidebar .brand { padding: 0 8px 24px; }
.new-chat { display: flex; align-items: center; width: 100%; gap: 10px; padding: 12px 13px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); color: #eaf0ff; background: rgba(255,255,255,.045); cursor: pointer; transition: .2s ease; }
.new-chat:hover { border-color: rgba(66,232,214,.35); background: rgba(66,232,214,.07); transform: translateY(-1px); }
.new-chat span[aria-hidden="true"] { color: var(--cyan); font-size: 21px; line-height: 0; }
.new-chat kbd { margin-left: auto; color: var(--muted-2); font-size: 10px; }
.sidebar-label { margin: 28px 10px 10px; color: var(--muted-2); font-size: 10px; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
.history-list { display: grid; gap: 5px; }
.history-item { width: 100%; overflow: hidden; padding: 10px 11px; border: 1px solid transparent; border-radius: 10px; color: #a9b2ca; background: transparent; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; transition: .2s ease; }
.history-item:hover, .history-item.active { color: var(--text); border-color: var(--line); background: rgba(255,255,255,.04); }
.history-empty { margin: 8px 10px; color: var(--muted-2); font-size: 11px; line-height: 1.5; }
.sidebar-spacer { flex: 1; }
.cluster-card { padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(145deg, rgba(66,232,214,.06), rgba(169,121,255,.04)); }
.cluster-card-head { display: flex; align-items: center; gap: 9px; margin-bottom: 11px; color: #cbd3e8; font-size: 11px; font-weight: 650; }
.capacity-track, .mini-track { overflow: hidden; height: 4px; border-radius: 10px; background: rgba(255,255,255,.07); }
.capacity-track span, .mini-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--cyan), var(--violet)); transition: width .45s ease; }
.cluster-card small { display: block; margin-top: 8px; color: var(--muted-2); font-size: 10px; }
.sidebar-link { display: flex; justify-content: space-between; margin-top: 9px; padding: 11px 12px; color: var(--muted); font-size: 12px; transition: color .2s; }
.sidebar-link:hover { color: var(--cyan); }

.main-panel { display: flex; min-width: 0; min-height: 100vh; flex-direction: column; }
.topbar { position: sticky; z-index: 12; top: 0; display: flex; min-height: 75px; align-items: center; justify-content: space-between; gap: 18px; padding: 12px clamp(20px, 4vw, 58px); border-bottom: 1px solid var(--line); background: rgba(7, 10, 18, .72); backdrop-filter: blur(20px); }
.topbar-controls { display: flex; min-width: 0; align-items: center; gap: 18px; }
.model-control { display: grid; grid-template-columns: auto auto; align-items: center; gap: 2px 12px; }
.model-control label { color: var(--muted-2); font-size: 9px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.select-wrap { position: relative; display: flex; align-items: center; grid-row: 1 / span 2; grid-column: 2; }
.select-spark { position: absolute; z-index: 1; left: 11px; color: var(--violet); pointer-events: none; }
.model-control select { min-width: 220px; padding: 9px 32px 9px 31px; border: 1px solid var(--line); border-radius: 11px; color: var(--text); background: var(--panel-solid); appearance: none; cursor: pointer; }
.select-wrap::after { position: absolute; right: 12px; color: var(--muted); content: "⌄"; pointer-events: none; }
.model-control > span { max-width: 260px; color: var(--muted); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.language-control { display: grid; min-width: 130px; gap: 2px; }
.language-control label { color: var(--muted-2); font-size: 9px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.language-control select { min-width: 130px; padding: 9px 28px 9px 11px; border: 1px solid var(--line); border-radius: 11px; color: var(--text); background: var(--panel-solid); cursor: pointer; }
.retry-toggle { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 10px; font-weight: 650; white-space: nowrap; cursor: pointer; user-select: none; }
.retry-toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.toggle-track { position: relative; display: inline-block; width: 31px; height: 18px; border: 1px solid var(--line-strong); border-radius: 999px; background: rgba(255,255,255,.08); transition: .2s ease; }
.toggle-track i { position: absolute; top: 3px; left: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); transition: .2s ease; }
.retry-toggle input:checked + .toggle-track { border-color: rgba(66,232,214,.5); background: rgba(66,232,214,.16); }
.retry-toggle input:checked + .toggle-track i { left: 16px; background: var(--cyan); box-shadow: 0 0 10px rgba(66,232,214,.55); }
.retry-toggle input:focus-visible + .toggle-track { outline: 2px solid var(--cyan); outline-offset: 3px; }
.topbar-badge, .live-pill { display: flex; align-items: center; gap: 8px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.03); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.lock-icon { color: var(--green); font-size: 9px; }
.mobile-menu { display: none; }

.chat-stage { width: min(900px, calc(100% - 36px)); flex: 1; margin: 0 auto; padding: 50px 0 185px; }
.welcome { display: grid; min-height: calc(100vh - 310px); place-items: center; align-content: center; text-align: center; }
.hero-orb { position: relative; display: grid; width: 74px; height: 74px; margin-bottom: 23px; place-items: center; border: 1px solid rgba(66,232,214,.27); border-radius: 24px; background: linear-gradient(145deg, rgba(66,232,214,.1), rgba(169,121,255,.12)); box-shadow: inset 0 0 30px rgba(66,232,214,.07), 0 0 60px rgba(66,232,214,.09); transform: rotate(45deg); }
.hero-orb img { z-index: 1; width: 50px; height: 50px; object-fit: contain; transform: rotate(-45deg); }
.hero-orb i { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: var(--violet); box-shadow: 0 0 10px var(--violet); }
.hero-orb i:nth-of-type(1) { top: -9px; right: 8px; }
.hero-orb i:nth-of-type(2) { bottom: 5px; left: -12px; background: var(--cyan); }
.welcome h1 { margin: 0; font-size: clamp(36px, 5vw, 58px); font-weight: 520; letter-spacing: -.045em; line-height: 1.05; }
.welcome h1 em { color: transparent; background: linear-gradient(90deg, var(--cyan), #9bc5ff 45%, var(--violet)); background-clip: text; font-style: normal; font-weight: 680; }
.hero-copy { max-width: 570px; margin: 20px auto 32px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.suggestion-grid { display: grid; width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; text-align: left; }
.suggestion { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 15px; border: 1px solid var(--line); border-radius: 15px; color: inherit; background: rgba(255,255,255,.025); cursor: pointer; transition: border .2s, background .2s, transform .2s; }
.suggestion:hover { border-color: rgba(255,255,255,.18); background: rgba(255,255,255,.05); transform: translateY(-2px); }
.suggestion-icon, .stat-icon { display: grid; width: 36px; height: 36px; place-items: center; border: 1px solid currentColor; border-radius: 11px; background: color-mix(in srgb, currentColor 9%, transparent); }
.cyan { color: var(--cyan); }.blue { color: var(--blue); }.violet { color: var(--violet); }.green { color: var(--green); }
.suggestion strong { display: block; color: #dbe1f1; font-size: 12px; }
.suggestion small { display: block; margin-top: 4px; color: var(--muted-2); font-size: 10px; }
.suggestion b { color: var(--muted-2); font-weight: 400; }

.messages { display: grid; gap: 26px; }
.message { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 14px; animation: message-in .3s ease both; }
@keyframes message-in { from { opacity: 0; transform: translateY(8px); } }
.message.user { grid-template-columns: minmax(0, 1fr) 36px; }
.message.user .message-avatar { grid-column: 2; background: linear-gradient(145deg, #2b3150, #151a2d); }
.message.user .message-body { grid-row: 1; grid-column: 1; justify-self: end; max-width: 78%; padding: 14px 17px; border: 1px solid rgba(169,121,255,.16); border-radius: 17px 5px 17px 17px; background: rgba(169,121,255,.07); }
.message-avatar { display: grid; width: 36px; height: 36px; place-items: center; border: 1px solid rgba(66,232,214,.2); border-radius: 11px; color: var(--cyan); background: rgba(66,232,214,.07); font-size: 12px; font-weight: 800; }
.message-avatar img { width: 28px; height: 28px; object-fit: contain; }
.message-head { display: flex; gap: 8px; align-items: center; margin-bottom: 7px; }
.message-head strong { font-size: 12px; }
.message-head span { color: var(--muted-2); font-size: 9px; }
.message-content { color: #cbd2e3; font-size: 14px; line-height: 1.75; overflow-wrap: anywhere; }
.message-text { white-space: pre-wrap; }
.message-text + .message-text { margin-top: 12px; }
.code-block { overflow: hidden; margin: 14px 0; border: 1px solid rgba(104,168,255,.2); border-radius: 12px; background: #080d18; }
.code-block-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 10px; border-bottom: 1px solid rgba(104,168,255,.14); color: var(--muted); background: rgba(104,168,255,.07); font: 10px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; text-transform: uppercase; }
.code-actions, .answer-actions { display: inline-flex; align-items: center; gap: 6px; }
.copy-code, .download-code, .copy-answer, .download-answer { padding: 4px 8px; border: 1px solid rgba(66,232,214,.24); border-radius: 7px; color: var(--cyan); background: rgba(66,232,214,.06); font-size: 10px; cursor: pointer; }
.copy-code:hover, .download-code:hover, .copy-answer:hover, .download-answer:hover { border-color: rgba(66,232,214,.55); background: rgba(66,232,214,.12); }
.code-block pre { overflow-x: auto; margin: 0; padding: 13px; color: #dbe7ff; font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; white-space: pre; }
.code-block code { font: inherit; }
.message-copy { margin-left: auto; opacity: 0; transition: opacity .2s; }
.message.assistant:hover .message-copy, .message-copy:focus-within { opacity: 1; }
.message.assistant .message-content::after { display: inline-block; width: 5px; height: 15px; margin-left: 3px; background: var(--cyan); content: ""; vertical-align: -2px; animation: blink .8s step-end infinite; }
.message.assistant.done .message-content::after { display: none; }
@keyframes blink { 50% { opacity: 0; } }
.message-error { color: #ffc0ce; }

.composer-zone { position: fixed; z-index: 10; right: 0; bottom: 0; left: 252px; padding: 24px clamp(18px, 4vw, 54px) 17px; background: linear-gradient(0deg, var(--bg) 58%, rgba(7,10,18,0)); }
.composer { width: min(900px, 100%); margin: 0 auto; padding: 13px 13px 11px 17px; border: 1px solid var(--line-strong); border-radius: 19px; background: rgba(17, 22, 38, .94); box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.035); backdrop-filter: blur(20px); transition: border .2s, box-shadow .2s; }
.composer:focus-within { border-color: rgba(66,232,214,.33); box-shadow: 0 22px 70px rgba(0,0,0,.42), 0 0 0 3px rgba(66,232,214,.045); }
.composer.drag-active { border-color: var(--cyan); box-shadow: 0 22px 70px rgba(0,0,0,.42), 0 0 0 4px rgba(66,232,214,.1); }
.composer-tools { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.attach-button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border: 1px solid rgba(66,232,214,.23); border-radius: 8px; color: var(--cyan); background: rgba(66,232,214,.055); font-size: 10px; cursor: pointer; transition: .2s ease; }
.attach-button:hover { border-color: rgba(66,232,214,.55); background: rgba(66,232,214,.12); transform: translateY(-1px); }
.attach-button span { font-size: 16px; line-height: .7; }
#file-input { display: none; }
.attachment-note { color: var(--muted-2); font-size: 9px; }
.attachment-list { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 9px; }
.attachment-item { display: inline-flex; min-width: 0; max-width: 100%; align-items: center; gap: 7px; padding: 6px 8px; border: 1px solid rgba(104,168,255,.2); border-radius: 10px; background: rgba(104,168,255,.055); }
.attachment-icon { display: grid; width: 20px; height: 20px; flex: 0 0 auto; place-items: center; border-radius: 6px; color: var(--blue); background: rgba(104,168,255,.11); font-size: 12px; }
.attachment-details { display: grid; min-width: 0; gap: 2px; }
.attachment-details strong { max-width: 230px; overflow: hidden; color: #dbe4fa; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.attachment-details small { overflow: hidden; color: var(--muted-2); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.attachment-remove { width: 20px; height: 20px; padding: 0; border: 0; border-radius: 6px; color: var(--muted); background: transparent; font-size: 16px; line-height: 1; cursor: pointer; }
.attachment-remove:hover { color: var(--danger); background: rgba(255,111,145,.1); }
.composer textarea { display: block; width: 100%; max-height: 170px; resize: none; padding: 3px 0 9px; border: 0; outline: 0; color: var(--text); background: transparent; line-height: 1.55; }
.composer textarea::placeholder { color: #626b83; }
.composer-footer { display: flex; align-items: center; gap: 10px; }
.composer-hint { color: var(--muted-2); font-size: 9px; }
kbd { padding: 2px 4px; border: 1px solid var(--line); border-radius: 4px; color: #8c96af; background: rgba(255,255,255,.035); font-family: inherit; }
.send-button { display: grid; width: 36px; height: 36px; margin-left: auto; place-items: center; border: 0; border-radius: 11px; color: #071013; background: linear-gradient(135deg, var(--cyan), #8cf6cf); box-shadow: 0 8px 24px rgba(66,232,214,.18); font-size: 19px; cursor: pointer; transition: .2s; }
.send-button:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(66,232,214,.25); }
.send-button:disabled { opacity: .35; cursor: not-allowed; transform: none; }
.stop-button { margin-left: auto; padding: 7px 11px; border: 1px solid rgba(255,111,145,.2); border-radius: 9px; color: #ff9eb4; background: rgba(255,111,145,.07); cursor: pointer; }
.privacy-note { display: flex; justify-content: center; gap: 7px; margin: 9px 0 0; color: #4f5870; font-size: 9px; }
.privacy-note span { color: var(--green); }
.sidebar-backdrop { position: fixed; z-index: 18; inset: 0; background: rgba(0,0,0,.55); backdrop-filter: blur(4px); }

/* Login */
.auth-page { overflow-x: hidden; }
.auth-layout { display: grid; width: min(100% - 36px, 440px); min-height: 100vh; margin: 0 auto; place-items: center; align-content: center; gap: 24px; padding: 40px 0; }
.auth-brand { margin-bottom: 8px; }
.auth-card { width: 100%; padding: 34px; border: 1px solid var(--line); border-radius: var(--radius-xl); background: linear-gradient(145deg, rgba(20,25,43,.92), rgba(10,13,24,.9)); box-shadow: var(--shadow); backdrop-filter: blur(24px); }
.auth-icon { display: grid; width: 48px; height: 48px; margin-bottom: 24px; place-items: center; border: 1px solid rgba(66,232,214,.25); border-radius: 15px; color: var(--cyan); background: rgba(66,232,214,.06); font-size: 20px; }
.auth-card h1 { margin: 0; font-size: 30px; letter-spacing: -.035em; }
.auth-copy { margin: 10px 0 26px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.auth-card label { display: block; margin: 15px 0 7px; color: #aeb7cc; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.field { display: flex; align-items: center; gap: 10px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted-2); background: rgba(0,0,0,.14); transition: border .2s; }
.field:focus-within { border-color: rgba(66,232,214,.35); }
.field input { width: 100%; padding: 12px 0; border: 0; outline: 0; color: var(--text); background: transparent; }
.field button { padding: 6px; border: 0; color: var(--muted); background: transparent; cursor: pointer; }
.primary-button, .secondary-button { display: flex; width: 100%; align-items: center; justify-content: space-between; margin-top: 22px; padding: 12px 15px; border: 0; border-radius: 12px; color: #061014; background: linear-gradient(135deg, var(--cyan), #9becc9); font-weight: 750; cursor: pointer; transition: .2s; }
.primary-button:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(66,232,214,.15); }
.primary-button:disabled { opacity: .55; cursor: wait; }
.form-error { margin-top: 13px; padding: 10px 12px; border: 1px solid rgba(255,111,145,.2); border-radius: 10px; color: #ffb3c4; background: rgba(255,111,145,.07); font-size: 11px; }
.secure-note { display: flex; align-items: center; justify-content: center; gap: 9px; margin: 21px 0 0; color: var(--muted-2); font-size: 9px; }
.secure-note .pulse-dot { width: 6px; height: 6px; }
.back-link { color: var(--muted); font-size: 11px; transition: color .2s; }
.back-link:hover { color: var(--cyan); }

/* Admin */
.admin-shell { display: grid; min-height: 100vh; grid-template-columns: 220px minmax(0, 1fr); }
.admin-nav { position: sticky; top: 0; display: flex; height: 100vh; flex-direction: column; padding: 24px 16px; border-right: 1px solid var(--line); background: rgba(7,10,18,.78); backdrop-filter: blur(20px); }
.admin-nav .brand { padding: 0 8px 30px; }
.admin-nav nav, .admin-nav-bottom { display: grid; gap: 5px; }
.admin-nav nav a, .admin-nav-bottom a, .admin-nav-bottom button { display: flex; align-items: center; gap: 11px; padding: 11px 12px; border: 1px solid transparent; border-radius: 10px; color: var(--muted); background: transparent; font-size: 12px; text-align: left; cursor: pointer; }
.admin-nav nav a:hover, .admin-nav nav a.active, .admin-nav-bottom a:hover, .admin-nav-bottom button:hover { color: var(--text); border-color: var(--line); background: rgba(255,255,255,.04); }
.admin-nav nav a.active span { color: var(--cyan); }
.admin-nav-bottom { margin-top: auto; }
.dashboard { width: min(1180px, calc(100% - 50px)); margin: 0 auto; padding: 46px 0 70px; }
.dashboard-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 26px; }
.dashboard-header h1 { margin: 0; font-size: clamp(30px, 4vw, 44px); letter-spacing: -.045em; }
.dashboard-header p:last-child { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat-card, .dashboard-section { border: 1px solid var(--line); background: rgba(15,19,33,.72); box-shadow: 0 18px 60px rgba(0,0,0,.12); backdrop-filter: blur(14px); }
.stat-card { display: grid; grid-template-columns: 38px 1fr; gap: 12px; padding: 17px; border-radius: 16px; }
.stat-card .stat-icon { width: 38px; height: 38px; grid-row: 1 / span 2; }
.stat-card span { display: block; color: var(--muted-2); font-size: 9px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.stat-card strong { display: block; margin-top: 3px; font-size: 22px; letter-spacing: -.03em; }
.stat-card small { color: var(--muted-2); font-size: 9px; }
.stat-card .mini-track { grid-column: 1 / -1; }
.dashboard-section { margin-top: 14px; padding: 23px; border-radius: 19px; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section-heading h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.section-heading > p, .dashboard-section > p { max-width: 450px; margin: 3px 0 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.model-admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.model-admin-card { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.025); }
.model-admin-card .model-symbol { display: grid; width: 40px; height: 40px; place-items: center; border: 1px solid currentColor; border-radius: 12px; background: color-mix(in srgb, currentColor 7%, transparent); }
.model-admin-card strong { display: block; font-size: 12px; }
.model-admin-card small { display: block; margin-top: 4px; color: var(--muted-2); font-size: 9px; }
.model-meta { display: flex; gap: 6px; margin-top: 8px; }
.model-meta span, .status-tag { padding: 4px 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.025); font-size: 8px; font-weight: 700; text-transform: uppercase; }
.model-meta .online { color: var(--green); border-color: rgba(97,227,148,.15); }
.model-meta .offline { color: var(--danger); border-color: rgba(255,111,145,.15); }
.switch { position: relative; display: inline-flex; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch span { display: block; width: 39px; height: 22px; border: 1px solid var(--line-strong); border-radius: 999px; background: #252b3c; cursor: pointer; transition: .2s; }
.switch span::after { display: block; width: 16px; height: 16px; margin: 2px; border-radius: 50%; background: #8992a8; content: ""; transition: .2s; }
.switch input:checked + span { border-color: rgba(66,232,214,.3); background: rgba(66,232,214,.16); }
.switch input:checked + span::after { background: var(--cyan); box-shadow: 0 0 10px rgba(66,232,214,.5); transform: translateX(17px); }
.switch input:focus-visible + span { outline: 2px solid var(--cyan); outline-offset: 3px; }
.skeleton { min-height: 82px; border-radius: 14px; background: linear-gradient(100deg, rgba(255,255,255,.025) 20%, rgba(255,255,255,.065) 40%, rgba(255,255,255,.025) 60%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position-x: -200%; } }
.dashboard-split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.status-tag.ready { color: var(--green); border-color: rgba(97,227,148,.18); }
.status-tag.locked { color: var(--danger); border-color: rgba(255,111,145,.18); }
.secondary-button { width: auto; min-width: 150px; justify-content: center; margin-top: 18px; color: var(--text); border: 1px solid var(--line-strong); background: rgba(255,255,255,.045); }
.secondary-button.danger { color: #ffb3c4; border-color: rgba(255,111,145,.2); background: rgba(255,111,145,.07); }
.slot-visual { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; margin: 24px 0 15px; }
.slot-visual i { height: 9px; border-radius: 999px; background: rgba(255,255,255,.075); transition: .3s; }
.slot-visual i.busy { background: linear-gradient(90deg, var(--cyan), var(--violet)); box-shadow: 0 0 15px rgba(66,232,214,.18); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 10px; }
th { padding: 9px 12px; color: var(--muted-2); font-size: 8px; letter-spacing: .09em; text-align: left; text-transform: uppercase; }
td { padding: 12px; border-top: 1px solid var(--line); color: #abb4ca; }
.log-status { display: inline-flex; align-items: center; gap: 6px; }
.log-status::before { width: 6px; height: 6px; border-radius: 50%; background: var(--green); content: ""; }
.log-status.running::before { background: var(--warning); }
.log-status.error::before { background: var(--danger); }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: 330px; padding: 12px 15px; border: 1px solid var(--line-strong); border-radius: 12px; color: #dbe2f3; background: #181d2e; box-shadow: var(--shadow); font-size: 11px; }

@media (max-width: 980px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-shell { grid-template-columns: 78px minmax(0, 1fr); }
  .admin-nav .brand > div:last-child, .admin-nav nav a:not(.active) { font-size: 0; }
  .admin-nav nav a, .admin-nav-bottom a, .admin-nav-bottom button { justify-content: center; }
  .admin-nav-bottom { font-size: 0; }
}

@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; transform: translateX(-105%); width: min(82vw, 280px); transition: transform .25s ease; }
  .sidebar.open { transform: translateX(0); }
  .composer-zone { left: 0; }
  .mobile-menu { display: grid; }
  .icon-button { width: 36px; height: 36px; place-items: center; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: rgba(255,255,255,.03); }
  .topbar { gap: 12px; padding: 11px 15px; flex-wrap: wrap; }
  .topbar-badge { display: none; }
  .topbar-controls { flex: 1; gap: 10px; justify-content: flex-end; }
  .model-control { min-width: 0; flex: 1; grid-template-columns: auto 1fr; }
  .select-wrap { width: 100%; }
  .model-control select { width: 100%; min-width: 0; }
  .model-control > span { max-width: 55vw; }
  .language-control { min-width: 110px; }
  .language-control select { min-width: 0; width: 100%; }
  .retry-toggle > span:last-child { display: none; }
  .chat-stage { padding-top: 35px; }
  .welcome { min-height: auto; padding: 35px 0 20px; }
  .suggestion-grid { grid-template-columns: 1fr; }
  .composer-hint { display: none; }
  .attachment-note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .code-actions, .answer-actions { flex-wrap: wrap; justify-content: flex-end; }
  .message.user .message-body { max-width: 90%; }
  .privacy-note { text-align: center; }
  .admin-shell { display: block; }
  .admin-nav { position: static; width: 100%; height: auto; flex-direction: row; align-items: center; padding: 13px 16px; }
  .admin-nav .brand { padding: 0; }
  .admin-nav nav { display: none; }
  .admin-nav-bottom { display: flex; margin: 0 0 0 auto; }
  .admin-nav-bottom a, .admin-nav-bottom button { padding: 8px; }
  .dashboard { width: min(100% - 28px, 680px); padding-top: 28px; }
  .model-admin-grid, .dashboard-split { grid-template-columns: 1fr; }
  .section-heading { display: block; }
  .section-heading > p { margin-top: 8px; }
}

@media (max-width: 520px) {
  .stat-grid { grid-template-columns: 1fr; }
  .dashboard-header { display: block; }
  .live-pill { width: max-content; margin-top: 15px; }
  .auth-card { padding: 25px 21px; }
  .welcome h1 { font-size: 36px; }
  .hero-copy { font-size: 12px; }
}

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