/* Base: tokens that are not colours, reset, shared controls. Colours live in css/themes/. */
:root {
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
  --font-prose: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --fs: 13px;
  --fs-small: 11.5px;
  --gap: 6px;
  --radius: 2px;
  --head-h: 26px;
  --bar-h: 26px;
}

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

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--fs) / 1.45 var(--font-mono);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { overflow: hidden; }
::selection { background: var(--selection); }

#app {
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) var(--bar-h);
}
#app[inert] { filter: saturate(0.6); }

[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.pane:focus-visible { outline-offset: -3px; }

kbd {
  font: inherit; font-size: var(--fs-small); padding: 0 5px; border: 1px solid var(--border-strong);
  border-bottom-width: 2px; border-radius: var(--radius); background: var(--surface-2); color: var(--text);
}

code { font-family: var(--font-mono); font-size: 0.95em; background: var(--surface-2); padding: 0 4px; border-radius: var(--radius); }
.dim { color: var(--text-dim); }

/* ---- controls ---- */
button, select, input, textarea { font: inherit; color: inherit; }

.btn {
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius);
  padding: 3px 12px; cursor: pointer; color: var(--text);
}
.btn:hover { background: var(--surface-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: transparent; border-color: var(--err); color: var(--err); }
.btn:disabled { opacity: 0.5; cursor: default; }

.ctl {
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
  padding: 1px 4px; height: 20px; font-size: 12px; min-width: 0; max-width: 100%;
}
.ctl.grow { flex: 1; height: 24px; padding: 2px 8px; }
select.ctl { cursor: pointer; }

.tabs { display: inline-flex; gap: 2px; }
.tab {
  background: transparent; border: 0; border-bottom: 2px solid transparent; padding: 0 6px; height: 20px;
  color: var(--text-dim); cursor: pointer; font-size: 12px;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }

.chip {
  display: inline-block; padding: 0 5px; margin: 0 2px; font-size: 11px; line-height: 16px; white-space: nowrap;
  border: 1px solid color-mix(in srgb, currentColor 45%, transparent); border-radius: var(--radius);
  color: var(--text-dim); vertical-align: baseline;
}
.chip.ok { color: var(--ok); }
.chip.warn { color: var(--warn); }
.chip.err { color: var(--err); }
.tier-chat { color: var(--tier-chat); }
.tier-coding { color: var(--tier-coding); }
.tier-long-context { color: var(--tier-long-context); }
.tier-reasoning { color: var(--tier-reasoning); }

.model-plat { color: var(--text-faint); }
.model { word-break: break-all; }

/* scrollbars: thin, themed */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

.fatal { padding: 16px; color: var(--err); white-space: pre-wrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
