/* LE PEAK, the chat page (peak.html). Builds on styles.css: the same tokens, type, hairlines, buttons and K2
   backdrop. One accent is added, --dawn, the alpenglow from the shader's dawn: it
   marks the experimental (Danger Zone) controls, exhausted quotas and deleting an
   account, nothing else.
   The layout follows Mistral's Le Chat: a sidebar of past chats, a slim top bar, the
   composer centred under a greeting until the first message, then docked at the bottom. */

.page-chat {
  --col: 780px;
  --side-w: 272px;
  --nav-h: 56px;
  --panel: rgba(8, 11, 15, 0.84);
  --panel-solid: #080b0f;
  --raise: rgba(214, 226, 242, 0.04);
  --dawn: #e9ab8f;
  --dawn-line: rgba(233, 171, 143, 0.45);
  --dawn-faint: rgba(233, 171, 143, 0.1);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.page-chat [hidden] { display: none !important; }
.lettering { margin: 0; }
.kbd {
  display: inline-block; min-width: 1.5em; padding: 2px 5px 1px; text-align: center;
  font: 500 0.6875rem/1.3 var(--mono); color: var(--soft);
  border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 2px;
}
.icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: square; stroke-linejoin: miter; flex: none; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; flex: none;
  color: var(--muted); background: none; border: 1px solid transparent; border-radius: 2px; cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.icon-btn:hover { color: var(--snow); border-color: var(--line-strong); }
.link-btn { padding: 0; font: 400 0.875rem var(--sans); color: var(--muted); background: none; border: 0; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; cursor: pointer; }
.link-btn:hover { color: var(--snow); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:disabled:hover { background: var(--snow); }

/* Pills: the site's .tag, quieter. */
.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 6px 2px; white-space: nowrap;
  font: 600 0.5625rem/1.2 var(--sans); font-stretch: 125%; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--soft); border: 1px solid var(--line-strong); border-radius: 1px;
}
.pill-free { color: var(--snow); border-color: var(--snow); }
.pill-dawn { color: var(--dawn); border-color: var(--dawn-line); }
.pill-lock { color: var(--snow); border-color: var(--snow); background: rgba(244, 247, 250, 0.06); }
.pill .icon { width: 10px; height: 10px; stroke-width: 1.8; }

/* ---------------- Backdrop ---------------- */
.page-chat .backdrop-shade {
  background:
    radial-gradient(ellipse 70% 55% at 30% 72%, rgba(5, 7, 10, 0.7), rgba(5, 7, 10, 0.25) 60%, rgba(5, 7, 10, 0) 90%),
    linear-gradient(0deg, rgba(5, 7, 10, 0.92) 0%, rgba(5, 7, 10, 0) 42%),
    linear-gradient(180deg, rgba(5, 7, 10, 0.55) 0%, rgba(5, 7, 10, 0) 22%);
}
.page-chat .backdrop-fallback, html.scene-live.page-chat .backdrop-canvas { transition: opacity 1.4s var(--ease); }
/* A thread is open: the mountain recedes for long reading sessions (scene.js also stops drawing it) */
html.chat-active .backdrop-fallback,
html.chat-active.scene-live .backdrop-canvas { opacity: 0.16; }

/* ---------------- App shell: sidebar + stage ---------------- */
.app { position: relative; display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); height: 100%; transition: grid-template-columns 0.3s var(--ease); }
html.side-collapsed .app { grid-template-columns: 0 minmax(0, 1fr); }
.sidebar {
  display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; padding: 10px 10px 12px; overflow: hidden;
  background: rgba(8, 11, 15, 0.88); border-right: 1px solid var(--line);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
html.side-collapsed .sidebar { visibility: hidden; border-right: 0; }
.side-head { display: flex; align-items: center; gap: 10px; height: 36px; padding-left: 6px; }
.side-head .brand { margin-right: 0; }
.side-name { font: 600 0.6875rem/1 var(--sans); font-stretch: 125%; letter-spacing: 0.18em; color: var(--snow); white-space: nowrap; }
.side-collapse { margin-left: auto; }
.side-new {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; white-space: nowrap;
  font: 500 0.875rem/1.2 var(--sans); color: var(--snow); text-align: left;
  background: var(--raise); border: 1px solid var(--line-strong); border-radius: 10px; cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.side-new:hover { border-color: var(--snow); background: rgba(214, 226, 242, 0.07); }
.side-new:disabled { opacity: 0.5; cursor: not-allowed; }
.side-search { display: flex; align-items: center; gap: 8px; padding: 0 10px; color: var(--faint); border: 1px solid var(--line); border-radius: 10px; transition: border-color 0.2s; }
.side-search:focus-within { border-color: var(--line-strong); color: var(--soft); }
.side-search-icon { display: inline-flex; }
.side-search input { flex: 1; min-width: 0; padding: 8px 0; font: 400 0.875rem var(--sans); color: var(--snow); background: transparent; border: 0; }
.side-search input::placeholder { color: var(--faint); }
.side-search input:focus, .side-search input:focus-visible { outline: none; }
.side-search input::-webkit-search-cancel-button { filter: invert(0.7); }
.history { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 -4px; padding: 0 4px; }
.history-group { padding: 14px 10px 6px; font-size: 0.5625rem; color: var(--faint); }
.history-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; }
.history-item { position: relative; display: flex; align-items: center; border-radius: 8px; transition: background 0.15s; }
.history-item:hover, .history-item:focus-within { background: var(--raise); }
.history-item.is-current { background: rgba(214, 226, 242, 0.085); }
.history-open {
  flex: 1; min-width: 0; padding: 8px 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: 400 0.875rem/1.3 var(--sans); color: var(--soft); text-align: left; background: none; border: 0; border-radius: 8px; cursor: pointer;
}
.history-item.is-current .history-open, .history-open:hover { color: var(--snow); }
.history-delete { width: 28px; height: 28px; margin-right: 2px; opacity: 0; }
.history-item:hover .history-delete, .history-item:focus-within .history-delete { opacity: 1; }
.history-delete:hover { color: var(--dawn); border-color: var(--dawn-line); }
.history-empty { padding: 10px; font-size: 0.8125rem; line-height: 1.5; color: var(--faint); }
.side-foot { display: grid; gap: 10px; padding: 12px 6px 0; border-top: 1px solid var(--line); }
.nav-auth { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.nav-auth .btn-solid { width: 100%; justify-content: center; }
.nav-user { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.75rem; color: var(--muted); }
.nav-account {
  display: inline-flex; align-items: center; gap: 8px; min-width: 0; padding: 7px 8px; margin-left: -8px;
  font: inherit; color: var(--muted); background: none; border: 1px solid transparent; border-radius: 2px; cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.nav-account:hover { color: var(--snow); border-color: var(--line-strong); }
.nav-account .nav-user { color: inherit; font-size: 0.8125rem; }
.nav-account .nav-user.mono { font-size: 0.75rem; }
.side-links { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.75rem; }
.side-links a { color: var(--faint); text-decoration: none; transition: color 0.2s; }
.side-links a:hover { color: var(--snow); }
.scrim { display: none; }

.stage { display: grid; grid-template-rows: auto minmax(0, 1fr); min-width: 0; min-height: 0; height: 100%; }
.topbar { display: flex; align-items: center; gap: 6px; height: var(--nav-h); padding: 0 14px; min-width: 0; }
html:not(.side-collapsed) #sidebar-open { display: none; }
.topbar-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 6px; font-size: 0.875rem; color: var(--muted); }
html:not(.chat-active) .topbar-title { visibility: hidden; }
.topbar .icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.quota-pill {
  display: inline-flex; align-items: center; gap: 8px; max-width: 46ch; min-width: 0; padding: 7px 11px 6px;
  font-size: 0.6875rem; letter-spacing: 0.02em; color: var(--soft); white-space: nowrap;
  background: rgba(5, 7, 10, 0.5); border: 1px solid var(--line-strong); border-radius: 999px; cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.quota-pill:hover { border-color: var(--snow); color: var(--snow); }
.quota-pill-text { overflow: hidden; text-overflow: ellipsis; }
.quota-pill-short { display: none; }
.quota-pill-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--snow); flex: none; box-shadow: 0 0 0 3px rgba(244, 247, 250, 0.08); }
.quota-pill[data-state="locked"] .quota-pill-dot { background: transparent; border: 1px solid var(--muted); box-shadow: none; }
.quota-pill[data-state="exhausted"] { color: var(--dawn); border-color: var(--dawn-line); }
.quota-pill[data-state="exhausted"] .quota-pill-dot { background: var(--dawn); box-shadow: 0 0 0 3px var(--dawn-faint); }

/* ---------------- Layout: centred until the first message, then docked ---------------- */
.chat { display: flex; flex-direction: column; justify-content: center; min-height: 0; padding-bottom: 6vh; }
html.chat-active .chat { justify-content: flex-start; padding-bottom: 0; }
.thread { flex: 0 1 auto; overflow-y: auto; overscroll-behavior: contain; scroll-padding-bottom: 24px; }
html.chat-active .thread { flex: 1 1 auto; }
.thread-inner { box-sizing: content-box; max-width: var(--col); margin: 0 auto; padding: 0 var(--gutter); display: flex; flex-direction: column; }
html.chat-active .thread-inner { min-height: calc(100% - 56px); padding-top: 20px; padding-bottom: 32px; }

/* ---------------- Empty state: a greeting over the live mountain ---------------- */
.empty { padding: 0 0 28px; text-align: center; }
html.chat-active .empty { display: none; }
/* The greeting: Archivo at the ends of its axes (heaviest, widest), lit like the summit at dawn. */
.empty-title {
  margin: 0; padding: 0.06em 0; font-size: clamp(3.5rem, 7.4vw, 7.75rem); font-weight: 900; font-stretch: 125%;
  line-height: 0.9; letter-spacing: -0.035em; white-space: nowrap;
  color: var(--snow);
  background: linear-gradient(180deg, var(--snow) 30%, #d9dee6 62%, var(--dawn) 118%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}

/* ---------------- Messages ---------------- */
.msgs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 30px; }
.msgs:empty { display: none; }
.msg { position: relative; animation: msg-in 0.5s var(--ease) both; }
@keyframes msg-in { from { opacity: 0; translate: 0 8px; } to { opacity: 1; translate: 0 0; } }
.msg-user { align-self: flex-end; max-width: min(82%, 620px); padding: 10px 16px; background: rgba(214, 226, 242, 0.075); border: 1px solid var(--line); border-radius: 18px 18px 4px 18px; }
.msg-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; padding-right: 40px; }
/* Model makers' logos (/logos), before a model's name */
.model-logo { width: 18px; height: 18px; flex: none; object-fit: contain; }
.model-logo-initial { display: inline-flex; align-items: center; justify-content: center; font: 600 0.625rem/1 var(--sans); color: var(--bg); background: var(--soft); border-radius: 4px; }
.msg-logo { width: 22px; height: 22px; padding: 3px; box-sizing: border-box; background: rgba(214, 226, 242, 0.06); border: 1px solid var(--line); border-radius: 50%; }
.chip-logo { width: 15px; height: 15px; align-self: center; }
.msg-who { font: 600 0.8125rem/1.2 var(--sans); color: var(--snow); }
.msg-model { font-size: 0.6875rem; color: var(--faint); }
.msg-user .msg-body { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--snow); font-size: 1rem; line-height: 1.55; }
.msg-images-gone { font-size: 0.625rem; color: var(--faint); margin-bottom: 4px; }
.msg-images { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin: 2px 0 8px; }
.msg-images img { width: auto; height: 96px; border: 1px solid var(--line-strong); border-radius: 10px; object-fit: cover; }
.msg-images img.is-not-sent, .msg-att-video.is-not-sent img { opacity: 0.4; }
/* A video shows its first frame sheet (what the model saw), with its length and frame count. */
.msg-att-video { position: relative; margin: 0; }
.msg-att-badge { position: absolute; left: 6px; bottom: 6px; padding: 2px 6px; font-size: 0.625rem; color: var(--snow); background: rgba(2, 3, 4, 0.72); border-radius: 4px; white-space: nowrap; }
.msg-files { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin: 2px 0 8px; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 8px; font-size: 0.6875rem; color: var(--soft); border: 1px solid var(--line-strong); border-radius: 8px; }
.file-chip .icon { width: 12px; height: 12px; flex: none; }
.file-chip-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--snow); }
.file-chip small { font-size: 0.625rem; color: var(--faint); white-space: nowrap; }
.file-chip.is-gone { border-style: dashed; opacity: 0.6; }
.file-chip.is-not-sent small { color: var(--dawn); }
.msg-actions { position: absolute; top: -4px; right: 0; display: flex; gap: 2px; opacity: 0; transition: opacity 0.2s; }
.msg-user .msg-actions { top: 4px; right: calc(100% + 4px); }
.msg:hover .msg-actions, .msg:focus-within .msg-actions { opacity: 1; }

.notice { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 12px; padding: 10px 12px; font-size: 0.8125rem; color: var(--soft); background: var(--raise); border-left: 1px solid var(--line-strong); }
.notice .icon { margin-top: 2px; }
.notice-dawn { color: var(--dawn); border-left-color: var(--dawn-line); background: var(--dawn-faint); }

/* Thinking indicator: a scan line across the label while nothing has arrived yet */
.pending { position: relative; display: inline-block; width: 120px; height: 1px; margin: 12px 0; background: var(--line-strong); overflow: hidden; }
.pending::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 36px; background: linear-gradient(90deg, transparent, var(--snow), transparent); animation: scan 1.2s linear infinite; }
@keyframes scan { from { transform: translateX(-36px); } to { transform: translateX(120px); } }

.reasoning { margin: 0 0 14px; border-left: 1px solid var(--line-strong); }
.reasoning summary { padding: 4px 12px; cursor: pointer; list-style: none; font: 560 0.625rem/1.2 var(--sans); font-stretch: 125%; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); }
.reasoning summary::-webkit-details-marker { display: none; }
.reasoning summary::before { content: "+ "; font-family: var(--mono); }
.reasoning[open] summary::before { content: "– "; }
.reasoning-body { padding: 4px 12px 8px; font: 400 0.8125rem/1.6 var(--mono); color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow-y: auto; }

/* Assistant prose */
.prose { color: var(--text); font-size: 1rem; line-height: 1.7; overflow-wrap: anywhere; }
.prose > * + * { margin-top: 0.85em; }
.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 { margin-top: 1.4em; line-height: 1.1; font-stretch: 88%; font-weight: 620; letter-spacing: -0.01em; }
.prose h1 { font-size: 1.75rem; } .prose h2 { font-size: 1.45rem; } .prose h3 { font-size: 1.2rem; }
.prose h4, .prose h5, .prose h6 { font-size: 1rem; }
.prose a { color: var(--snow); text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: var(--snow); }
.prose strong { color: var(--snow); font-weight: 620; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: 0.3em; }
.prose li > * + * { margin-top: 0.4em; }
.prose ul { list-style: none; }
.prose ul > li { position: relative; }
.prose ul > li::before { content: ""; position: absolute; left: -1.05em; top: 0.8em; width: 6px; height: 1px; background: var(--muted); }
.prose blockquote { margin-left: 0; margin-right: 0; padding-left: 14px; border-left: 1px solid var(--line-strong); color: var(--soft); }
.prose hr { border: 0; height: 1px; background: var(--line); }
.prose :not(pre) > code { padding: 1px 5px; font: 400 0.875em var(--mono); color: var(--snow); background: var(--raise); border: 1px solid var(--line); border-radius: 2px; }
.prose .table-scroll { overflow-x: auto; }
.prose table { width: 100%; border-collapse: collapse; font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.prose th, .prose td { padding: 8px 12px 8px 0; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { font: 560 0.625rem/1.2 var(--sans); font-stretch: 125%; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); }
.prose [data-align="center"] { text-align: center; }
.prose [data-align="right"] { text-align: right; }

.code { border: 1px solid var(--line); border-radius: 2px; background: rgba(214, 226, 242, 0.025); }
.code-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 4px 4px 12px; border-bottom: 1px solid var(--line); font-size: 0.6875rem; color: var(--faint); }
.code-head .icon-btn { width: 28px; height: 28px; }
.code pre { margin: 0; padding: 12px 14px; overflow-x: auto; font: 400 0.8125rem/1.6 var(--mono); color: var(--text); tab-size: 2; }
.code-open .code-head::after { content: "streaming"; margin-right: auto; margin-left: 8px; color: var(--faint); animation: blink 1.2s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.2; } }

/* Telemetry under each reply */
.telemetry { display: flex; flex-wrap: wrap; gap: 4px 0; margin-top: 16px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 0.6875rem; letter-spacing: 0.02em; color: var(--faint); font-variant-numeric: tabular-nums; }
.telemetry > span + span::before { content: "·"; margin: 0 8px; color: var(--line-strong); }
.telemetry b { font-weight: 450; color: var(--soft); }
.telemetry .is-dawn, .telemetry .is-dawn b { color: var(--dawn); }

/* Errors and limits, inline in the thread */
.msg-error { margin-top: 4px; padding: 14px 16px; border: 1px solid var(--line-strong); border-left: 2px solid var(--dawn); background: rgba(8, 11, 15, 0.7); }
.msg-error-title { font: 560 0.6875rem/1.2 var(--sans); font-stretch: 125%; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dawn); }
.msg-error-text { margin-top: 6px; font-size: 0.9375rem; color: var(--soft); }
.msg-error-meta { margin-top: 8px; font-size: 0.75rem; color: var(--muted); }
.msg-error-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ---------------- Jev decisions ---------------- */
.decision { margin: 0; border: 1px solid var(--line-strong); border-radius: 2px; background: rgba(8, 11, 15, 0.6); }
.decision-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.decision-q { font-size: 0.9375rem; color: var(--snow); }
.decision-type { font-size: 0.6875rem; color: var(--faint); }
.decision-body { padding: 16px 14px 18px; }
.figure { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.figure-num { white-space: nowrap; font: 400 clamp(2.4rem, 5vw, 3.25rem)/1 var(--mono); letter-spacing: -0.04em; color: var(--snow); font-variant-numeric: tabular-nums; }
.figure-label { font-size: 0.75rem; color: var(--muted); }
.bar { position: relative; height: 2px; background: var(--line-strong); }
.bar > i { position: absolute; inset: 0 auto 0 0; width: calc(var(--f, 0) * 100%); background: var(--snow); transition: width 0.8s var(--ease); }
.bar-noul { margin-top: 16px; height: 6px; background: transparent; border: 1px solid var(--line-strong); }
.bar-noul > i { inset: 0 auto 0 0; }
.bar-noul::after { content: ""; position: absolute; left: 50%; top: -5px; bottom: -5px; width: 1px; background: var(--muted); }
.scale-ends { display: flex; justify-content: space-between; margin-top: 8px; font-size: 0.6875rem; color: var(--faint); }
.dist { display: grid; grid-template-columns: minmax(0, max-content) minmax(80px, 1fr) 4.5em; gap: 10px 14px; align-items: center; }
.dist-label { font-size: 0.875rem; color: var(--soft); overflow-wrap: anywhere; }
.dist-pct { text-align: right; font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.dist-top .dist-label { color: var(--snow); font-weight: 600; }
.dist-top .dist-pct { color: var(--snow); }
.dist .bar > i { background: var(--muted); }
.dist-top .bar > i { background: var(--snow); }
.decision-foot { margin-top: 14px; font-size: 0.6875rem; color: var(--faint); }
.dist-wrap { margin-top: 16px; }
.rail { position: relative; margin: 30px 8px 10px; height: 1px; background: var(--line-strong); }
.rail-tick { position: absolute; top: -5px; width: 1px; height: 11px; background: var(--muted); }
.rail-label { position: absolute; top: 14px; transform: translateX(-50%); font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
.rail-label.is-near { color: var(--snow); }
.rail-label.is-first { transform: none; }
.rail-label.is-last { transform: translateX(-100%); }
.rail-mark { position: absolute; top: -26px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 0.6875rem; color: var(--snow); }
.rail-mark::after { content: ""; width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 8px solid var(--snow); }
.rail-wrap { padding-bottom: 28px; }

/* Box: a technical HUD over the uploaded image. Edges are fractions from the top-left. */
.hud { position: relative; display: inline-block; max-width: 100%; border: 1px solid var(--line-strong); line-height: 0; }
.hud img { display: block; max-width: 100%; max-height: min(440px, 52vh); width: auto; height: auto; }
.hud-shade { position: absolute; inset: 0; background: rgba(5, 7, 10, 0.38); pointer-events: none;
  clip-path: polygon(evenodd, 0 0, 100% 0, 100% 100%, 0 100%, 0 var(--t), var(--l) var(--t), var(--l) var(--b), var(--r) var(--b), var(--r) var(--t), 0 var(--t)); }
.hud-guide { position: absolute; background: rgba(244, 247, 250, 0.35); pointer-events: none; }
.hud-guide-x { left: 0; right: 0; height: 1px; }
.hud-guide-y { top: 0; bottom: 0; width: 1px; }
.hud-box { position: absolute; left: var(--l); top: var(--t); width: calc(var(--r) - var(--l)); height: calc(var(--b) - var(--t)); outline: 1px solid var(--snow); box-shadow: 0 0 0 1px rgba(5, 7, 10, 0.7), inset 0 0 0 1px rgba(5, 7, 10, 0.4); pointer-events: none; }
.hud-corner { position: absolute; width: 10px; height: 10px; border: 0 solid var(--snow); }
.hud-corner.tl { left: -4px; top: -4px; border-left-width: 2px; border-top-width: 2px; }
.hud-corner.tr { right: -4px; top: -4px; border-right-width: 2px; border-top-width: 2px; }
.hud-corner.bl { left: -4px; bottom: -4px; border-left-width: 2px; border-bottom-width: 2px; }
.hud-corner.br { right: -4px; bottom: -4px; border-right-width: 2px; border-bottom-width: 2px; }
.hud-center { position: absolute; left: 50%; top: 50%; width: 9px; height: 9px; transform: translate(-50%, -50%);
  background: linear-gradient(var(--snow), var(--snow)) center / 1px 100% no-repeat, linear-gradient(var(--snow), var(--snow)) center / 100% 1px no-repeat; }
.hud-tag { position: absolute; left: -1px; bottom: calc(100% + 6px); padding: 3px 6px; line-height: 1.2; font: 500 0.6875rem var(--mono); white-space: nowrap; color: var(--bg); background: var(--snow); }
.hud-tag.is-below { bottom: auto; top: calc(100% + 6px); }
.hud-readout { display: grid; grid-template-columns: repeat(4, auto) 1fr; gap: 4px 20px; margin-top: 12px; font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.hud-readout b { font-weight: 450; color: var(--snow); }
.hud-px { grid-column: 1 / -1; color: var(--faint); }

/* ---------------- Dock: Danger Zone + composer ---------------- */
.dock { position: relative; padding: 0 var(--gutter) max(12px, env(safe-area-inset-bottom)); }
html:not(.chat-active) .dock::before { display: none; }
.dock::before { content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 32px; pointer-events: none; background: linear-gradient(to bottom, rgba(5, 7, 10, 0), rgba(5, 7, 10, 0.9)); }
.dock-inner { max-width: var(--col); margin: 0 auto; }

.dz {
  position: relative; padding: 12px 14px 12px; border: 1px solid var(--line-strong); border-bottom: 0;
  background: linear-gradient(180deg, rgba(233, 171, 143, 0.05), rgba(8, 11, 15, 0) 70%), var(--panel-solid);
  border-radius: 14px 14px 0 0; animation: dz-in 0.45s var(--ease) both;
}
.dz::before { content: ""; position: absolute; left: 14px; right: -1px; top: -1px; height: 1px; background: linear-gradient(90deg, var(--dawn-line), rgba(233, 171, 143, 0) 75%); }
@keyframes dz-in { from { opacity: 0; transform: translateY(14px); clip-path: inset(100% 0 0 0); } to { opacity: 1; transform: none; clip-path: inset(0 0 0 0); } }
.dz-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; }
.dz-title { color: var(--dawn); font-size: 0.625rem; }
.dz-model { margin-left: auto; font-size: 0.6875rem; color: var(--muted); }
.dz-toggle { padding: 2px 0; font: 400 0.6875rem var(--mono); color: var(--muted); background: none; border: 0; cursor: pointer; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.dz-toggle:hover { color: var(--snow); }
.dz-summary { display: none; margin-top: 6px; font-size: 0.6875rem; color: var(--muted); }
.dz.is-collapsed .dz-row, .dz.is-collapsed .dz-fields, .dz.is-collapsed .dz-note { display: none; }
.dz.is-collapsed .dz-summary { display: block; }
.dz-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 22px; margin-top: 10px; }
.dz-row-mode { justify-content: space-between; }
.dz-ctx { font-size: 0.6875rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.dz-ctx.is-over { color: var(--dawn); }
.dz-fields { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 10px; }
.dz-fields:empty, .dz-fields[hidden] { display: none; }
.dz-field { display: flex; flex-direction: column; gap: 6px; }
.dz-field[hidden] { display: none; }
.dz-field .lettering { font-size: 0.5625rem; color: var(--faint); }
.dz-field-hint { letter-spacing: 0.04em; text-transform: none; font-stretch: 100%; font-weight: 400; color: var(--faint); }
.dz-field input, .dz-field textarea {
  width: 100%; padding: 8px 10px; font: 400 0.875rem/1.45 var(--sans); color: var(--snow);
  background: rgba(5, 7, 10, 0.6); border: 1px solid var(--line-strong); border-radius: 2px; resize: vertical;
}
.dz-field input:focus, .dz-field textarea:focus { outline: none; border-color: var(--snow); }
.dz-field textarea { min-height: 64px; max-height: 180px; font-family: var(--mono); font-size: 0.8125rem; }
.dz-note { margin-top: 10px; font-size: 0.75rem; color: var(--muted); }
.dz-note:empty { display: none; }
.dz-note.is-warn { color: var(--dawn); }

.switch { display: inline-flex; align-items: center; gap: 10px; padding: 4px 0; color: var(--soft); background: none; border: 0; cursor: pointer; text-align: left; }
.switch-track { position: relative; width: 30px; height: 16px; flex: none; border: 1px solid var(--line-strong); border-radius: 1px; transition: border-color 0.2s, background 0.2s; }
.switch-thumb { position: absolute; top: 3px; left: 3px; width: 8px; height: 8px; background: var(--muted); transition: transform 0.25s var(--ease), background 0.2s; }
.switch-label { font-size: 0.75rem; }
.switch-label b { font-weight: 450; color: var(--faint); }
.switch:hover .switch-track { border-color: var(--snow); }
.switch[aria-checked="true"] .switch-track { border-color: var(--dawn); background: var(--dawn-faint); }
.switch[aria-checked="true"] .switch-thumb { transform: translateX(14px); background: var(--dawn); }
.switch[aria-checked="true"] .switch-label b { color: var(--dawn); }

.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line-strong); border-radius: 1px; }
.seg button { padding: 7px 11px 6px; font: 450 0.75rem/1 var(--mono); color: var(--muted); background: none; border: 0; border-left: 1px solid var(--line); cursor: pointer; transition: color 0.2s, background 0.2s; }
.seg button:first-child { border-left: 0; }
.seg button:hover { color: var(--snow); }
.seg button[aria-checked="true"] { color: var(--bg); background: var(--snow); }

.composer {
  position: relative; display: flex; flex-direction: column; gap: 4px; padding: 12px 10px 10px 16px;
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: 20px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  transition: border-color 0.25s, box-shadow 0.35s;
}
.dz:not([hidden]) + .composer { border-top-color: var(--line); border-radius: 0 0 20px 20px; }
.composer:focus-within { border-color: rgba(244, 247, 250, 0.42); box-shadow: 0 0 0 1px rgba(244, 247, 250, 0.05), 0 0 40px rgba(214, 226, 242, 0.07), 0 18px 60px rgba(0, 0, 0, 0.4); }
.dz:not([hidden]) + .composer:focus-within { border-color: var(--dawn-line); box-shadow: 0 0 0 1px var(--dawn-faint), 0 0 40px rgba(233, 171, 143, 0.06); }
.model-chip {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-width: 0; padding: 6px 12px 5px;
  color: var(--snow); background: var(--raise); border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
  transition: border-color 0.2s;
}
.model-chip:hover { border-color: var(--line-strong); }
.model-chip-name { display: inline-flex; align-items: center; gap: 7px; font: 600 0.8125rem/1.2 var(--sans); white-space: nowrap; }
.model-chip-id { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.6875rem; color: var(--muted); }
.model-chip-kbd { display: inline-flex; gap: 2px; }
.model-chip-kbd .kbd { font-size: 0.625rem; padding: 1px 4px 0; }
.composer textarea {
  width: 100%; min-height: 52px; max-height: 40vh; padding: 6px 2px; resize: none; overflow-y: auto;
  font: 400 1rem/1.55 var(--sans); color: var(--snow); background: transparent; border: 0;
}
.composer textarea::placeholder { color: var(--faint); }
.composer textarea:focus, .composer textarea:focus-visible { outline: none; }
.composer-bar { display: flex; align-items: center; gap: 8px; min-width: 0; }
.composer-bar .icon-btn { border-radius: 999px; }
.composer-hint { margin-left: auto; font-size: 0.6875rem; color: var(--faint); white-space: nowrap; }
.send-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex: none;
  color: var(--bg); background: var(--snow); border: 0; border-radius: 50%; cursor: pointer; transition: opacity 0.2s, transform 0.2s;
}
.send-btn:hover { transform: translateY(-1px); }
.send-btn .icon { stroke-width: 1.9; }
.send-btn.is-stop { color: var(--snow); background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); }
.stop-square { width: 10px; height: 10px; background: currentColor; border-radius: 1px; }
.composer.is-dragging { border-color: var(--snow); border-style: dashed; }

.attachments { display: flex; flex-wrap: wrap; gap: 8px; }
.attachments[hidden] { display: none; }
.attachment { position: relative; display: flex; align-items: center; gap: 8px; padding: 4px; border: 1px solid var(--line-strong); border-radius: 10px; background: rgba(5, 7, 10, 0.6); }
.attachment img { width: 40px; height: 40px; object-fit: cover; border-radius: 7px; }
.attachment-meta { display: flex; flex-direction: column; gap: 2px; font-size: 0.6875rem; color: var(--muted); line-height: 1.2; }
.attachment-meta b { font-weight: 450; color: var(--snow); max-width: 18ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment[data-status="reading"] .attachment-meta span { color: var(--faint); animation: reading 1.4s ease-in-out infinite alternate; }
@keyframes reading { to { opacity: 0.45; } }
.attachment-kind { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: none; color: var(--soft); background: var(--raise); border-radius: 7px; }
.attachment .icon-btn { width: 26px; height: 26px; }
.attachment-action { padding: 3px 7px; font-size: 0.625rem; color: var(--muted); background: none; border: 1px solid var(--line-strong); border-radius: 999px; cursor: pointer; }
.attachment-action[aria-pressed="true"] { color: var(--bg); background: var(--snow); border-color: var(--snow); }
.attachment-action:disabled { opacity: 0.5; cursor: default; }
.attach-errors { display: flex; flex-direction: column; gap: 2px; }
.attach-errors[hidden] { display: none; }
.attach-error { font-size: 0.75rem; color: var(--dawn); overflow-wrap: anywhere; }

.status { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 0; min-height: 1.5em; margin-top: 8px; padding: 0 2px; font-size: 0.6875rem; letter-spacing: 0.02em; color: var(--faint); font-variant-numeric: tabular-nums; }
.status > span + span::before { content: "·"; margin: 0 8px; color: var(--line-strong); }
.legal-fine { margin: 6px auto 0; max-width: 60em; padding: 0 2px; font-size: 0.6875rem; line-height: 1.45; color: var(--faint); text-align: center; opacity: 0.8; }
.status b { font-weight: 450; color: var(--soft); }
.status .is-dawn, .status .is-dawn b { color: var(--dawn); }

/* ---------------- Model selector (spec-sheet palette) ---------------- */
.palette {
  width: min(1180px, calc(100vw - 32px)); max-height: min(82vh, 880px); margin: 9vh auto auto; padding: 0;
  color: var(--text); background: var(--panel-solid); border: 1px solid var(--line-strong); border-radius: 2px;
  box-shadow: 0 40px 140px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(5, 7, 10, 0.6);
}
.palette[open] { display: flex; flex-direction: column; animation: pop 0.28s var(--ease) both; }
.palette::backdrop, .auth::backdrop { background: rgba(2, 3, 4, 0.72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.99); } to { opacity: 1; transform: none; } }
.palette-head { display: flex; align-items: center; gap: 16px 24px; flex-wrap: wrap; padding: 16px 20px 14px; border-bottom: 1px solid var(--line-strong); }
.palette-title { color: var(--snow); }
.palette-search { flex: 1 1 320px; display: flex; align-items: center; gap: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line-strong); }
.palette-search:focus-within { border-bottom-color: var(--snow); }
.palette-search input { flex: 1; min-width: 0; padding: 4px 0; font: 400 1.0625rem var(--sans); color: var(--snow); background: transparent; border: 0; }
.palette-search input::placeholder { color: var(--faint); }
.palette-search input:focus, .palette-search input:focus-visible { outline: none; }
.palette-cols, .row { display: grid; grid-template-columns: minmax(190px, 1.35fr) minmax(200px, 1.45fr) minmax(170px, 1.25fr) minmax(210px, 1.1fr); gap: 16px; }
.palette-cols { padding: 10px 20px 8px; font-size: 0.5625rem; color: var(--faint); border-bottom: 1px solid var(--line); }
.palette-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 8px; }
.group-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 20px 8px; background: var(--panel-solid); border-bottom: 1px solid var(--line); }
.group-head .lettering { font-size: 0.5625rem; color: var(--muted); }
.group-policy { font-size: 0.6875rem; color: var(--faint); text-align: right; }
.row { position: relative; align-items: center; padding: 13px 20px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background 0.15s; }
.row::before { content: ""; position: absolute; left: 0; top: -1px; bottom: 0; width: 2px; background: transparent; transition: background 0.15s; }
.row.is-active { background: linear-gradient(90deg, rgba(214, 226, 242, 0.075), rgba(214, 226, 242, 0.015) 70%); }
.row.is-active::before { background: var(--snow); }
.row[aria-disabled="true"] { cursor: default; }
.row.is-unavailable > *, .row.is-exhausted .row-name, .row.is-exhausted .row-id { opacity: 0.5; }
.row-name { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.row-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 0.9375rem; color: var(--snow); }
.row-current { font: 600 0.5rem/1 var(--sans); font-stretch: 125%; letter-spacing: 0.16em; text-transform: uppercase; color: var(--bg); background: var(--snow); padding: 3px 5px 2px; border-radius: 1px; }
.row-vendor { font-size: 0.75rem; color: var(--muted); }
.row-note { font-size: 0.6875rem; color: var(--faint); }
.row-id { min-width: 0; overflow-wrap: anywhere; font-size: 0.8125rem; color: var(--soft); }
.row-caps { display: flex; flex-wrap: wrap; gap: 4px; }
.row-quota { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.meter { display: grid; gap: 5px; }
.meter-text { font-size: 0.6875rem; color: var(--soft); font-variant-numeric: tabular-nums; }
.meter .bar > i { background: var(--soft); }
.meter.is-full .bar > i { background: var(--dawn); }
.meter.is-full .meter-text { color: var(--dawn); }
.row-free { font-size: 0.6875rem; color: var(--muted); }
.row-locked { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.row-policy { font-size: 0.6875rem; color: var(--faint); }
.row-exhausted { font-size: 0.6875rem; color: var(--dawn); }
.palette-empty { padding: 40px 20px; color: var(--muted); }
.palette-legend { margin: 0; padding: 10px 20px; font-size: 0.75rem; line-height: 1.5; color: var(--muted); border-top: 1px solid var(--line-strong); }
.palette-foot { display: flex; gap: 18px; flex-wrap: wrap; padding: 10px 20px; border-top: 1px solid var(--line-strong); font-size: 0.6875rem; color: var(--faint); }
.palette-count { margin-left: auto; }

/* ---------------- Sign-in ---------------- */
.auth {
  width: min(460px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 28px 28px 22px;
  color: var(--text); background: var(--panel-solid); border: 1px solid var(--line-strong); border-radius: 2px;
  box-shadow: 0 40px 140px rgba(0, 0, 0, 0.65);
}
.auth[open] { animation: pop 0.28s var(--ease) both; }
.auth-close { position: absolute; top: 12px; right: 12px; }
.auth-title { margin-top: 14px; font-size: 2.4rem; font-weight: 640; font-stretch: 80%; line-height: 0.92; letter-spacing: -0.02em; }
.auth-sub { margin-top: 12px; font-size: 0.9375rem; color: var(--soft); }
.auth-oauth { display: grid; gap: 8px; margin-top: 22px; }
.auth-oauth:empty { display: none; }
.auth-oauth .btn { justify-content: flex-start; width: 100%; }
.auth-or { display: flex; align-items: center; gap: 12px; margin: 20px 0 4px; font-size: 0.5625rem; color: var(--faint); }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-tabs { display: flex; gap: 20px; margin-top: 14px; border-bottom: 1px solid var(--line); }
.auth-tabs button { padding: 8px 0; margin-bottom: -1px; font: 560 0.6875rem/1.2 var(--sans); font-stretch: 125%; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); background: none; border: 0; border-bottom: 1px solid transparent; cursor: pointer; }
.auth-tabs button[aria-selected="true"] { color: var(--snow); border-bottom-color: var(--snow); }
.auth-form { display: grid; gap: 14px; margin-top: 18px; }
.auth-field { display: grid; gap: 6px; }
.auth-field[hidden] { display: none; }
.auth-field .lettering { font-size: 0.5625rem; color: var(--faint); }
.auth-field input { padding: 9px 0; font: 400 1.0625rem var(--sans); color: var(--snow); background: transparent; border: 0; border-bottom: 1px solid var(--line-strong); border-radius: 0; }
.auth-field input:focus, .auth-field input:focus-visible { outline: none; border-bottom-color: var(--snow); box-shadow: 0 1px 0 var(--snow); }
.turnstile:empty { display: none; }
.auth-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; }
.auth-msg { min-height: 1.4em; margin-top: 14px; font-size: 0.875rem; color: var(--snow); }
.auth-msg.is-error { color: var(--dawn); }
.auth-fine { margin-top: 8px; font-size: 0.75rem; line-height: 1.5; color: var(--faint); }

/* ---------------- Settings (the sign-in dialog's frame) ---------------- */
.settings { width: min(520px, calc(100vw - 32px)); }
.set-section { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.set-head { font-size: 0.5625rem; color: var(--soft); }
.set-form { display: grid; gap: 14px; margin-top: 12px; }
.set-hint { margin-left: 6px; letter-spacing: 0.04em; text-transform: none; font-stretch: 100%; font-weight: 400; color: var(--faint); }
.set-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin-top: 2px; }
.set-msg { font-size: 0.875rem; color: var(--snow); }
.set-msg:empty { display: none; }
.set-msg.is-error { color: var(--dawn); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; }
.set-row-text { display: grid; gap: 4px; min-width: 0; }
.set-row-text .lettering { font-size: 0.5625rem; color: var(--faint); }
.set-value { overflow-wrap: anywhere; font-size: 0.875rem; color: var(--snow); }
.set-note { margin-top: 10px; font-size: 0.875rem; line-height: 1.5; color: var(--soft); }
.set-row .set-note { margin-top: 0; }
.set-note a { color: var(--snow); }
.set-danger .set-head { color: var(--dawn); }
.set-danger .btn-danger { margin-top: 14px; }
.btn-danger { color: var(--dawn); border-color: var(--dawn-line); background: rgba(5, 7, 10, 0.3); }
.btn-danger:hover { border-color: var(--dawn); }
.btn-danger:disabled:hover { border-color: var(--dawn-line); background: rgba(5, 7, 10, 0.3); }
.btn-danger-solid { color: var(--bg); background: var(--dawn); border-color: var(--dawn); }
.btn-danger-solid:hover { background: #f1bea6; }
.btn-danger-solid:disabled:hover { background: var(--dawn); }
.set-check { display: flex; align-items: center; gap: 10px; font-size: 0.875rem; color: var(--soft); cursor: pointer; }
.set-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--dawn); }

/* ---------------- Toasts ---------------- */
.toasts { position: fixed; z-index: 300; left: 50%; top: calc(var(--nav-h) + 12px); transform: translateX(-50%); display: grid; gap: 8px; width: min(520px, calc(100vw - 32px)); pointer-events: none; }
html:not(.side-collapsed) .toasts { left: calc(50% + var(--side-w) / 2); }
@media (max-width: 860px) { html:not(.side-collapsed) .toasts { left: 50%; } }
.toast { padding: 10px 14px; font-size: 0.875rem; color: var(--snow); background: var(--panel-solid); border: 1px solid var(--line-strong); border-left: 2px solid var(--snow); border-radius: 2px; animation: pop 0.3s var(--ease) both; }
.toast.is-warn { border-left-color: var(--dawn); }
.noscript { position: fixed; inset: auto 16px 16px; z-index: 300; padding: 12px 14px; background: var(--panel-solid); border: 1px solid var(--line-strong); }

@media (prefers-reduced-motion: reduce) {
  .msg, .dz, .palette[open], .auth[open], .toast { animation: none; }
  .app, .sidebar { transition: none; }
  .pending::after, .code-open .code-head::after, .attachment[data-status="reading"] .attachment-meta span { animation: none; }
  .bar > i { transition: none; }
}

/* ---------------- Responsive ---------------- */
@media (max-width: 1100px) {
  .palette-cols { display: none; }
  .row { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 10px 16px; }
  .row-id { grid-column: 1; }
  .row-caps { grid-column: 1; }
  .row-quota { grid-column: 2; grid-row: 1 / span 3; align-self: start; }
}
@media (max-width: 860px) {
  .app, html.side-collapsed .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar, html.side-collapsed .sidebar {
    position: fixed; z-index: 250; inset: 0 auto 0 0; width: min(300px, 86vw); visibility: hidden;
    border-right: 1px solid var(--line-strong); background: var(--panel-solid);
    transform: translateX(-100%); transition: transform 0.3s var(--ease), visibility 0s 0.3s;
  }
  html.side-open .sidebar { visibility: visible; transform: none; transition: transform 0.3s var(--ease); }
  .scrim { display: block; position: fixed; inset: 0; z-index: 240; background: rgba(2, 3, 4, 0.6); }
  .scrim[hidden] { display: none; }
  html:not(.side-collapsed) #sidebar-open { display: inline-flex; }
  .quota-pill { max-width: 46vw; }
}
@media (max-width: 640px) {
  .topbar { padding: 0 8px; }
  .quota-pill-text { display: none; }
  .quota-pill-short { display: inline; }
  .dz { padding: 10px 12px; }
  .dz-model { display: none; }
  .dz-row { gap: 4px 16px; margin-top: 8px; }
  .dz-note { font-size: 0.6875rem; }
  .quota-pill { max-width: 52vw; padding: 6px 9px 5px; }
  .chat { padding-bottom: 2vh; }
  .empty-title { font-size: clamp(2.75rem, 15vw, 4.5rem); letter-spacing: -0.03em; }
  .composer-hint { display: none; }
  .model-chip { margin-right: auto; }
  .model-chip-kbd { display: none; }
  .model-chip-id { display: none; }
  .msg-user { max-width: 88%; }
  .msg-user .msg-actions { display: none; }
  .dz-fields { grid-template-columns: 1fr; }
  .switch-label { font-size: 0.6875rem; }
  .palette { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .row { grid-template-columns: 1fr; padding: 14px 16px; }
  .row-id, .row-caps, .row-quota { grid-column: 1; grid-row: auto; }
  .group-head { padding: 12px 16px 8px; flex-direction: column; gap: 4px; }
  .group-policy { text-align: left; }
  .palette-head, .palette-foot, .palette-legend { padding-left: 16px; padding-right: 16px; }
  .auth { padding: 24px 20px 18px; }
  .set-row { flex-direction: column; align-items: flex-start; gap: 10px; }
  .msg-actions { opacity: 1; }
  .hud-readout { grid-template-columns: repeat(2, auto) 1fr; }
}
