/* Beekon console — shell + component vocabulary.
 *
 * Rules that carry the brand and must not drift:
 *   - Elevation is surface tone + 1px hairlines. There is no drop shadow in the
 *     brand except one amber-tinted glow; overlays are the only exception here.
 *   - Tables/panels use the 1px-gap grid motif: gap:1px over a --line
 *     background with --bg-elev cells, so borders never double up.
 *   - Mono is a semantic layer (ids, keys, coordinates, micro-labels), not
 *     decoration.
 *   - Empty and error states are VISUALLY DISTINCT. Conflating them was the
 *     worst information-design fault of the console this replaces.
 */

/* ---------- base ---------- */

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; height: 100%; }

body {
  font-family: var(--f-body);
  font-size: var(--t-body);
  line-height: 1.5;
  letter-spacing: var(--tr-body);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
}

h1, h2, h3, h4 { margin: 0; font-family: var(--f-display); font-weight: 500; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 1px;
  border-radius: var(--r-sm);
}

/* The router moves focus to each view's heading so keyboard and screen-reader
   users land in the new page. That is a programmatic focus on a non-interactive
   element — it must not paint a focus ring, which would read as a selected
   control. Interactive elements keep theirs. */
[tabindex="-1"]:focus,
[tabindex="-1"]:focus-visible { outline: none; }

/* Screen-reader-only, but focusable (skip link). */
.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:focus-visible {
  position: fixed; top: var(--s-5); left: var(--s-5); z-index: 100;
  width: auto; height: auto; margin: 0; clip: auto;
  padding: var(--s-3) var(--s-6); background: var(--bg-elev);
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
}

/* ---------- typography helpers ---------- */

.eyebrow {
  font-family: var(--f-mono);
  font-size: var(--t-eyebrow);
  font-weight: 500;
  letter-spacing: var(--tr-eyebrow);
  text-transform: uppercase;
  color: var(--accent-text);
}
.eyebrow-muted { color: var(--ink-3); }

.page-title {
  font-size: var(--t-display);
  letter-spacing: var(--tr-display);
  line-height: 1.15;
}
.h2 { font-size: var(--t-h2); letter-spacing: var(--tr-h2); }
.h3 { font-size: var(--t-h3); letter-spacing: var(--tr-h3); }

.muted { color: var(--ink-3); }
.faint { color: var(--ink-4); }
.small { font-size: var(--t-sm); }
.micro { font-size: var(--t-micro); }
.mono { font-family: var(--f-mono); }
.num { font-variant-numeric: tabular-nums; }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* An id/ULID rendered inline: mono, dimmed, never wrapping mid-token. */
.id {
  font-family: var(--f-mono);
  font-size: var(--t-micro);
  color: var(--ink-3);
  letter-spacing: 0;
}

/* ---------- app shell ---------- */

.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  background: var(--bg-sunk);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}

.brand {
  display: flex; align-items: center; gap: var(--s-4);
  padding: var(--s-6) var(--s-6) var(--s-7);
}
.brand svg { width: 26px; height: 26px; flex: none; }
.brand-name {
  font-family: var(--f-display); font-size: 17px; font-weight: 600;
  letter-spacing: -0.022em; line-height: 1;
}
.brand-sub {
  font-family: var(--f-mono); font-size: 9.5px; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--accent-text); margin-top: 3px;
}

.nav { display: flex; flex-direction: column; gap: 2px; padding: 0 var(--s-4); flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: var(--s-4);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  color: var(--ink-2);
  font-size: var(--t-sm);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.nav-item:hover { background: color-mix(in oklch, var(--ink) 5%, transparent); text-decoration: none; color: var(--ink); }
.nav-item[aria-current="page"] {
  background: color-mix(in oklch, var(--honey) 14%, transparent);
  color: var(--accent-text);
  font-weight: 500;
}
.nav-item svg { width: 15px; height: 15px; flex: none; opacity: 0.85; }

.sidebar-foot { padding: var(--s-5) var(--s-6); border-top: 1px solid var(--line); }

.topbar {
  height: var(--topbar-h);
  border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-5);
  padding: 0 var(--s-8);
  position: sticky; top: 0; z-index: 20;
}
.topbar-right { display: flex; align-items: center; gap: var(--s-5); }

.content { padding: var(--s-9) var(--s-8) var(--s-10); max-width: var(--content-max); }
.page-head { margin-bottom: var(--s-8); }
.page-head .page-title { margin-top: var(--s-2); }
.page-head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-6); flex-wrap: wrap; }

section + section { margin-top: var(--s-9); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-5); margin-bottom: var(--s-5); }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-3);
  font-family: var(--f-body); font-size: var(--t-sm); font-weight: 500;
  letter-spacing: var(--tr-body);
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  background: transparent; color: var(--ink);
  cursor: pointer; white-space: nowrap;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.btn:focus-visible { box-shadow: var(--focus-ring); outline-offset: 2px; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn:not(:disabled):active { transform: translateY(0.5px); }

.btn-primary { background: var(--accent-solid); color: var(--accent-solid-ink); }
.btn-primary:not(:disabled):hover { background: color-mix(in oklch, var(--accent-solid) 88%, var(--honey)); transform: translateY(-1px); }

.btn-ghost { border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:not(:disabled):hover { background: var(--bg-elev); border-color: var(--ink-4); }

.btn-danger { border-color: var(--line-strong); color: var(--red); }
.btn-danger:not(:disabled):hover { background: color-mix(in oklch, var(--red) 10%, transparent); border-color: var(--red); }

.btn-sm { padding: 5px 10px; font-size: var(--t-xs); }
.btn-icon { padding: 6px; border-radius: var(--r-md); border-color: transparent; color: var(--ink-3); }
.btn-icon:hover { background: color-mix(in oklch, var(--ink) 6%, transparent); color: var(--ink); }
.btn-icon svg { width: 16px; height: 16px; display: block; }

.btn-row { display: flex; gap: var(--s-3); flex-wrap: wrap; }

/* ---------- fields ---------- */

.field { display: block; margin-bottom: var(--s-5); }
.field-label {
  display: block; font-size: var(--t-xs); font-weight: 500;
  color: var(--ink-2); margin-bottom: var(--s-2);
}
.field-req { color: var(--ink-4); font-weight: 400; }

.input, .select, textarea.input {
  width: 100%;
  font-family: var(--f-body); font-size: var(--t-body); color: var(--ink);
  background: var(--bg-elev);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 8px 11px;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.input::placeholder { color: var(--ink-4); }
.input:focus-visible, .select:focus-visible, textarea.input:focus-visible {
  outline: none; border-color: var(--accent-text); box-shadow: var(--focus-ring);
}
.input:disabled, .select:disabled { background: var(--bg-sunk); color: var(--ink-3); }
.input.mono { font-family: var(--f-mono); font-size: var(--t-sm); }

.select {
  appearance: none;
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.field-hint { font-size: var(--t-micro); color: var(--ink-3); margin-top: var(--s-2); }
.field-error { font-size: var(--t-micro); color: var(--red); margin-top: var(--s-2); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }

/* ---------- region picker (M4-0173) ----------
   A permanent, unrepairable choice, so it reads as a decision rather than a
   form control: full-width rows, the human name leading, the cell id and its
   region as secondary metadata in mono because the id is what the operator
   will recognise inside their SDK key. */

.region-options { display: grid; gap: var(--s-2); margin-top: var(--s-3); }
.region-option {
  display: flex; align-items: flex-start; gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--bg-elev);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.region-option:hover { border-color: var(--accent-text); }
.region-option:has(input:checked) { border-color: var(--accent-text); background: var(--bg-sunk); }
.region-option:has(input:focus-visible) { box-shadow: var(--focus-ring); }
.region-option input { margin-top: 3px; accent-color: var(--accent-text); flex: none; }
.region-text { display: grid; gap: 2px; }
.region-name { font-size: var(--t-body); color: var(--ink); }
.region-meta { font-size: var(--t-micro); color: var(--ink-3); }

/* ---------- cards + the 1px-gap grid motif ---------- */

.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s-7);
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-5); margin-bottom: var(--s-5); }
.card-foot {
  margin-top: var(--s-6); padding-top: var(--s-5);
  border-top: 1px dashed var(--line);
  display: flex; justify-content: space-between; gap: var(--s-5);
  font-family: var(--f-mono); font-size: var(--t-micro); color: var(--ink-3);
}

/* Seamless bordered grid: one hairline between cells, none doubled. */
.grid-panel {
  display: grid; gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.grid-panel > * { background: var(--bg-elev); padding: var(--s-6); }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ---------- table ---------- */

.table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.table th {
  text-align: left; font-weight: 500;
  font-family: var(--f-mono); font-size: var(--t-eyebrow);
  letter-spacing: var(--tr-eyebrow); text-transform: uppercase;
  color: var(--ink-3);
  padding: var(--s-4) var(--s-6);
  border-bottom: 1px solid var(--line);
  background: var(--bg-sunk);
  white-space: nowrap;
}
.table td { padding: var(--s-5) var(--s-6); border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--dur-fast) var(--ease); }
.table tbody tr:hover { background: color-mix(in oklch, var(--ink) 3%, transparent); }
.table .cell-actions { text-align: right; white-space: nowrap; }
.table .cell-num { text-align: right; font-variant-numeric: tabular-nums; }

.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-elev);
}

/* ---------- status ---------- */

.pill {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-family: var(--f-mono); font-size: var(--t-eyebrow); font-weight: 500;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 4px;
  background: color-mix(in oklch, var(--ink) 8%, transparent);
  color: var(--ink-2);
}
.pill-ok { background: color-mix(in oklch, var(--green) 14%, transparent); color: var(--green); }
.pill-warn { background: color-mix(in oklch, var(--amber) 18%, transparent); color: var(--honey-ink); }
.pill-bad { background: color-mix(in oklch, var(--red) 13%, transparent); color: var(--red); }
:root[data-theme="dark"] .pill-warn { color: var(--honey); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill-warn { color: var(--honey); } }

.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); flex: none; }
.dot-live { animation: pulse 1.8s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in oklch, var(--green) 55%, transparent); }
  70% { box-shadow: 0 0 0 6px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@media (prefers-reduced-motion: reduce) { .dot-live { animation: none; } }

/* ---------- stat tile ---------- */

.stat-label {
  font-family: var(--f-mono); font-size: var(--t-eyebrow); font-weight: 500;
  letter-spacing: var(--tr-eyebrow); text-transform: uppercase; color: var(--ink-3);
}
.stat-value {
  font-family: var(--f-display); font-size: 28px; font-weight: 500;
  letter-spacing: -0.025em; line-height: 1.1; margin-top: var(--s-3);
  font-variant-numeric: tabular-nums;
}
.stat-note { font-size: var(--t-micro); color: var(--ink-3); margin-top: var(--s-2); }

/* ---------- empty vs error: deliberately different ---------- */

.empty {
  text-align: center;
  padding: var(--s-10) var(--s-7);
  color: var(--ink-3);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--bg-sunk);
}
.empty-title { font-family: var(--f-display); font-size: var(--t-h2); letter-spacing: var(--tr-h2); color: var(--ink); }
.empty-body { margin-top: var(--s-3); font-size: var(--t-sm); max-width: 46ch; margin-left: auto; margin-right: auto; }
.empty-action { margin-top: var(--s-6); }

.errorbox {
  display: flex; gap: var(--s-4); align-items: flex-start;
  padding: var(--s-5) var(--s-6);
  border: 1px solid color-mix(in oklch, var(--red) 40%, var(--line));
  border-left: 3px solid var(--red);
  border-radius: var(--r-md);
  background: color-mix(in oklch, var(--red) 7%, var(--bg-elev));
  color: var(--ink);
  font-size: var(--t-sm);
}
.errorbox-title { font-weight: 500; color: var(--red); }
.errorbox-body { color: var(--ink-2); margin-top: 2px; }
.errorbox-actions { margin-left: auto; }

/* An "unavailable / not measured" state — neither empty nor error. This is the
   ingest-health honesty case: we could not ask, which is not the same as zero. */
.notice {
  padding: var(--s-5) var(--s-6);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-sunk);
  color: var(--ink-3);
  font-size: var(--t-sm);
}

/* ---------- skeleton ---------- */

.skel {
  background: linear-gradient(90deg,
    color-mix(in oklch, var(--ink) 6%, transparent) 25%,
    color-mix(in oklch, var(--ink) 11%, transparent) 37%,
    color-mix(in oklch, var(--ink) 6%, transparent) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: var(--r-sm);
  height: 1em;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }
.skel-row { height: 44px; border-radius: var(--r-md); margin-bottom: var(--s-3); }

/* ---------- tabs ---------- */

.tabs { display: flex; gap: var(--s-6); border-bottom: 1px solid var(--line); margin-bottom: var(--s-8); }
.tab {
  padding: var(--s-4) 2px var(--s-5);
  font-size: var(--t-sm); color: var(--ink-3);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none; border-top: 0; border-left: 0; border-right: 0;
  cursor: pointer; font-family: var(--f-body);
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.tab:hover { color: var(--ink); text-decoration: none; }
.tab[aria-selected="true"] { color: var(--accent-text); border-bottom-color: var(--honey); font-weight: 500; }

/* ---------- modal ---------- */

.overlay {
  position: fixed; inset: 0; z-index: 60;
  background: color-mix(in oklch, oklch(15% 0.02 60) 55%, transparent);
  display: flex; align-items: center; justify-content: center;
  padding: var(--s-7);
  backdrop-filter: blur(3px);
}
.modal {
  background: var(--bg-elev);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  padding: var(--s-8);
  width: 100%; max-width: 460px;
  max-height: calc(100vh - 2 * var(--s-7));
  overflow-y: auto;
  box-shadow: 0 24px 60px -28px color-mix(in oklch, oklch(15% 0.02 60) 60%, transparent);
}
.modal-wide { max-width: 620px; }
.modal-title { font-size: var(--t-h2); letter-spacing: var(--tr-h2); }
.modal-body { margin-top: var(--s-4); color: var(--ink-2); font-size: var(--t-sm); }
.modal-actions { margin-top: var(--s-8); display: flex; justify-content: flex-end; gap: var(--s-3); }

/* ---------- secret reveal ---------- */

.secret {
  display: flex; align-items: center; gap: var(--s-4);
  font-family: var(--f-mono); font-size: var(--t-sm);
  background: var(--bg-sunk);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: var(--s-4) var(--s-5);
  word-break: break-all;
}
.secret-value { flex: 1; min-width: 0; }
.secret-masked { letter-spacing: 0.08em; color: var(--ink-3); }
.warn-band {
  display: flex; gap: var(--s-4); align-items: flex-start;
  padding: var(--s-5) var(--s-6);
  border: 1px solid color-mix(in oklch, var(--amber) 45%, var(--line));
  border-left: 3px solid var(--amber);
  border-radius: var(--r-md);
  background: color-mix(in oklch, var(--amber) 10%, var(--bg-elev));
  font-size: var(--t-sm);
}

/* ---------- toast ---------- */

.toasts {
  position: fixed; bottom: var(--s-7); right: var(--s-7); z-index: 80;
  display: flex; flex-direction: column; gap: var(--s-3);
  max-width: min(380px, calc(100vw - 2 * var(--s-7)));
}
.toast {
  display: flex; gap: var(--s-4); align-items: flex-start;
  background: var(--bg-elev);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--ink-3);
  border-radius: var(--r-md);
  padding: var(--s-5) var(--s-6);
  font-size: var(--t-sm);
  box-shadow: 0 12px 32px -18px color-mix(in oklch, oklch(15% 0.02 60) 70%, transparent);
}
.toast-ok { border-left-color: var(--green); }
.toast-bad { border-left-color: var(--red); }

/* ---------- login ---------- */

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: var(--s-7); }
.auth-card { width: 100%; max-width: 380px; }
.auth-brand { display: flex; align-items: center; gap: var(--s-4); margin-bottom: var(--s-8); }
.auth-brand svg { width: 30px; height: 30px; }
.auth-sep {
  display: flex; align-items: center; gap: var(--s-4);
  margin: var(--s-6) 0;
  color: var(--ink-4); font-size: var(--t-micro);
  font-family: var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase;
}
.auth-sep::before, .auth-sep::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.auth-foot { margin-top: var(--s-7); text-align: center; font-size: var(--t-micro); color: var(--ink-4); }
.btn-block { width: 100%; }

/* ---------- map surface ---------- */

.map-wrap {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-sunk);
  min-height: 420px;
}
.map-wrap svg { display: block; width: 100%; height: 100%; position: absolute; inset: 0; }
.map-note {
  position: absolute; left: var(--s-4); bottom: var(--s-4);
  font-family: var(--f-mono); font-size: var(--t-eyebrow);
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-3);
  background: color-mix(in oklch, var(--bg-elev) 85%, transparent);
  padding: 3px 8px; border-radius: 4px;
}
.map-attr {
  position: absolute; right: var(--s-4); bottom: var(--s-4);
  font-size: 10.5px; color: var(--ink-3);
  background: color-mix(in oklch, var(--bg-elev) 85%, transparent);
  padding: 2px 7px; border-radius: 4px;
}
.map-toolbar {
  position: absolute; left: var(--s-4); top: var(--s-4);
  display: flex; gap: var(--s-2);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 3px;
}
.map-tool {
  font-family: var(--f-body); font-size: var(--t-xs);
  padding: 5px 10px; border-radius: var(--r-sm);
  border: 0; background: transparent; color: var(--ink-2); cursor: pointer;
}
.map-tool[aria-pressed="true"] { background: var(--accent-solid); color: var(--accent-solid-ink); }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--s-6); align-items: start; }

/* ---------- charts ---------- */

.chart { width: 100%; display: block; overflow: visible; }
.chart-bar { fill: color-mix(in oklch, var(--honey) 55%, transparent); transition: fill var(--dur-fast) var(--ease); }
.chart-bar-current { fill: var(--honey); }
.chart-baseline { stroke: var(--line); stroke-width: 1; }
.chart-label { font-family: var(--f-mono); font-size: 9px; fill: var(--ink-4); letter-spacing: 0.04em; }
.spark { width: 72px; height: 20px; display: block; }
.spark path { fill: none; stroke: var(--honey); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }

.meter { height: 8px; border-radius: var(--r-pill); background: var(--bg-sunk); overflow: hidden; border: 1px solid var(--line); }
.meter-fill { height: 100%; background: var(--honey); border-radius: var(--r-pill); }
.meter-fill.warn { background: var(--amber); }
.meter-fill.over { background: var(--red); }

/* ---------- misc layout ---------- */

.stack > * + * { margin-top: var(--s-5); }
.stack-lg > * + * { margin-top: var(--s-7); }
.row { display: flex; align-items: center; gap: var(--s-4); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--s-5); }
.spacer { flex: 1; }
.wrap-gap { display: flex; flex-wrap: wrap; gap: var(--s-3); }

.menu-btn { display: none; }

/* ---------- responsive ---------- */

@media (max-width: 1200px) {
  :root { --sidebar-w: 64px; }
  .brand-text, .nav-item span, .sidebar-foot .label-text { display: none; }
  .brand { justify-content: center; padding: var(--s-6) 0 var(--s-7); }
  .nav-item { justify-content: center; padding: var(--s-4); }
  .cols-4 { grid-template-columns: 1fr 1fr; }
  .cols-3 { grid-template-columns: 1fr 1fr; }
  .editor-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 50;
    width: 260px; height: 100vh;
    transform: translateX(-100%);
    transition: transform var(--dur) var(--ease);
    box-shadow: 0 0 60px -20px color-mix(in oklch, oklch(15% 0.02 60) 60%, transparent);
  }
  .shell[data-nav="open"] .sidebar { transform: translateX(0); }
  :root { --sidebar-w: 0px; }
  .brand-text, .nav-item span, .sidebar-foot .label-text { display: revert; }
  .brand { justify-content: flex-start; padding: var(--s-6); }
  .nav-item { justify-content: flex-start; padding: var(--s-3) var(--s-4); }
  .menu-btn { display: inline-flex; }
  .nav-scrim { position: fixed; inset: 0; z-index: 40; background: color-mix(in oklch, oklch(15% 0.02 60) 45%, transparent); }

  .topbar { padding: 0 var(--s-6); }
  .content { padding: var(--s-7) var(--s-6) var(--s-9); }
  .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .page-head-row { align-items: flex-start; }

  /* Tables reflow to stacked cards — the page body must never scroll sideways. */
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table thead { display: none; }
  .table tr { padding: var(--s-5) var(--s-6); border-bottom: 1px solid var(--line); }
  .table tr:last-child { border-bottom: none; }
  .table td { border: none; padding: var(--s-2) 0; text-align: left; }
  .table td::before {
    content: attr(data-label);
    display: block;
    font-family: var(--f-mono); font-size: var(--t-eyebrow);
    letter-spacing: var(--tr-eyebrow); text-transform: uppercase;
    color: var(--ink-3); margin-bottom: 2px;
  }
  .table td:empty { display: none; }
  .table .cell-actions, .table .cell-num { text-align: left; }
  .table .cell-actions { padding-top: var(--s-4); }

  .btn { min-height: 40px; }
  .btn-sm { min-height: 34px; }
  .toasts { left: var(--s-5); right: var(--s-5); bottom: var(--s-5); max-width: none; }
}
