/* Taiga Day — see docs/DESIGN.md. If this file and the spec disagree, the spec wins. */
:root {
  /* Taiga Day: white work area, neutral greys; pine green and orange are the only accents. */
  --bg: #FFFFFF;
  --surface: #F6F6F3;
  --surface-2: #ECEDE8;
  --border: #DEDDD6;
  --text: #1A1D1B;
  --text-muted: #59615C;
  --text-faint: #737A75;
  --accent: #E07A2E;
  --accent-hover: #C96A22;
  --on-accent: #0E1512;
  --pine: #1E3B2F;
  --pine-soft: rgb(30 59 47 / .08);
  --success: #1D7A4C;
  --warning: #8A5E00;
  --danger: #B93A30;
  --info: #2A6896;

  --font: "Roboto Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-7: 48px; --space-8: 64px;

  --radius-s: 6px; --radius-m: 10px; --radius-l: 16px;

  --sidebar-w: 264px;
  --sidebar-w-collapsed: 64px;
  --topbar-h: 56px;

  --ease: cubic-bezier(0.2, 0, 0, 1);
  --t-fast: 120ms;
  --t-panel: 200ms;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: var(--font); }
.login { overflow: auto; height: 100%; }
body { font-size: 14px; line-height: 22px; font-weight: 400; }
a { color: var(--text); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3 { font-weight: 500; margin: 0; }
.icon { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.mark { flex: none; display: block; }
.grow { flex: 1; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.yes { color: var(--text); font-weight: 700; }
code { font-family: var(--font); font-size: 12px; color: var(--text-muted); }
::placeholder { color: var(--text-faint); }

/* Labels: 12 / 16, 500, uppercase */
.side-label, .field > label, .grid thead th, .props dt {
  font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted);
}

/* ---------- Inputs ---------- */
input:not([type=checkbox]):not([type=radio]), select, textarea {
  height: 36px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-s);
  padding: 0 10px; min-width: 0; width: 100%; transition: border-color var(--t-fast) var(--ease);
}
textarea { height: auto; padding: 8px 10px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input:disabled, select:disabled, textarea:disabled { color: var(--text-faint); background: var(--surface); }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger); }
input[type=checkbox] { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 16px;
  border-radius: var(--radius-s); border: 1px solid var(--border); background: transparent; color: var(--text);
  font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { border-color: transparent; color: var(--text-muted); }
.btn.ghost:hover:not(:disabled) { color: var(--text); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; min-width: 32px; height: 32px; border: 0; background: transparent;
  border-radius: var(--radius-s); cursor: pointer; color: var(--text-muted);
}
.icon-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.icon-btn:disabled { opacity: .4; cursor: default; }
.text-btn { background: none; border: 0; padding: 0; color: var(--text-muted); text-decoration: underline; cursor: pointer; justify-self: start; }
.text-btn:hover { color: var(--text); }

/* ---------- Status tags (always with a mark or word) ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; line-height: 16px; font-weight: 700; text-transform: uppercase;
  padding: 2px 8px; border-radius: 4px; white-space: nowrap; letter-spacing: 0.02em;
}
.tag.success { color: var(--success); background: rgb(29 122 76 / .12); }
.tag.warning { color: var(--warning); background: rgb(255 194 26 / .22); }
.tag.danger  { color: var(--danger);  background: rgb(185 58 48 / .10); }
.tag.info    { color: var(--info);    background: rgb(42 104 150 / .10); }
.tag.muted   { color: var(--text-muted); background: var(--surface-2); font-weight: 500; }

/* ---------- Logo lockup ---------- */
.lockup { display: flex; align-items: center; gap: calc(28px * 0.2); padding: 16px; text-decoration: none; color: var(--text); flex: none; }
.wordmark { font-weight: 500; font-size: 18px; letter-spacing: -0.04em; line-height: 1; }
.lockup.big { justify-content: center; gap: 8px; padding: 0 0 24px; }
.lockup.big .wordmark { font-size: 26px; }

/* ---------- Login ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: min(380px, 100%); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-m);
  padding: 32px; display: grid; gap: 16px;
}
.login-lang { margin-top: 8px; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); height: 100vh; transition: grid-template-columns var(--t-panel) var(--ease); }
body.sidebar-collapsed .shell { grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr); }

.sidebar {
  background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column;
  height: 100vh; min-width: 0; overflow: hidden;
}
.side-scroll { flex: 1; min-height: 0; overflow: hidden; padding: 0 12px; display: flex; flex-direction: column; gap: 8px; }
.side-scroll > .side-section:first-child { flex: 1 1 auto; min-height: 120px; overflow-y: auto; overflow-x: hidden; }
.side-section.controls { flex: 0 1 auto; max-height: 50%; overflow-y: auto; border-top: 1px solid var(--border); padding: 8px 0 12px; }
.side-section { display: flex; flex-direction: column; gap: 2px; }
.side-label { padding: 8px 12px; }
.side-bottom { border-top: 1px solid var(--border); padding: 12px; display: flex; flex-direction: column; gap: 4px; flex: none; }
.side-bottom .wh { margin-bottom: 8px; }

.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: var(--radius-s);
  color: var(--text-muted); text-decoration: none; font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
  background: none; border: 0; width: 100%; text-align: left; list-style: none;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.nav-item::-webkit-details-marker { display: none; }
.nav-item .label { overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--pine-soft); color: var(--pine); }
.nav-item.active::before {
  content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav-item.sub { padding-left: 42px; font-weight: 400; }
.nav-item.sub.planned { color: var(--text-faint); }
.nav-item.sub.planned:hover { color: var(--text-muted); }
.nav-group.has-active > summary { color: var(--pine); }
.nav-item .count {
  font-size: 12px; line-height: 16px; font-weight: 700; padding: 0 6px; border-radius: 8px;
  background: var(--pine-soft); color: var(--pine);
}
.nav-item .tag { font-size: 11px; padding: 0 6px; }

.controls .control-stack { display: flex; flex-direction: column; gap: 12px; padding: 4px 12px 0; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

/* Collapsed sidebar: icons only */
body.sidebar-collapsed .sidebar .label,
body.sidebar-collapsed .sidebar .wordmark,
body.sidebar-collapsed .sidebar .count,
body.sidebar-collapsed .sidebar .side-label,
body.sidebar-collapsed .sidebar .nav-item.sub,
body.sidebar-collapsed .sidebar .controls,
body.sidebar-collapsed .sidebar .wh { display: none !important; }
body.sidebar-collapsed .side-scroll, body.sidebar-collapsed .side-bottom { padding-left: 8px; padding-right: 8px; }
body.sidebar-collapsed .nav-item { justify-content: center; padding: 0; }
body.sidebar-collapsed .lockup { justify-content: center; padding: 16px 0; }
body.sidebar-collapsed .nav-group.has-active > summary { background: var(--pine-soft); }
body.sidebar-collapsed .nav-group.has-active > summary::before {
  content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent);
}
body.sidebar-collapsed .side-bottom .icon { transform: rotate(180deg); }
body.sidebar-collapsed .side-bottom a .icon { transform: none; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100vh; }
.topbar {
  height: var(--topbar-h); flex: none; display: flex; align-items: center; gap: 16px; padding: 0 24px;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.titles { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.crumb { font-size: 12px; line-height: 16px; color: var(--text-muted); }
.page-title { font-size: 24px; line-height: 32px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb:empty { display: none; }
.topbar .search { flex: 0 1 280px; min-width: 140px; }
.menu-toggle { display: none; }
.user-menu { position: relative; }
.user-menu summary {
  list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; height: 36px; padding: 0 12px;
  border-radius: var(--radius-s); color: var(--text-muted);
}
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { background: var(--surface-2); color: var(--text); }
.user-menu .menu {
  position: absolute; right: 0; top: calc(100% + 6px); background: var(--bg); border: 1px solid var(--border); box-shadow: 0 8px 24px rgb(26 29 27 / .08);
  border-radius: var(--radius-m); min-width: 260px; padding: 8px; z-index: 30; display: grid; gap: 4px;
}
.menu-head { display: flex; flex-direction: column; padding: 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu-row { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px; padding: 4px 8px; color: var(--text-muted); }
.user-menu .menu button {
  display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; background: none; border: 0;
  height: 36px; padding: 0 8px; border-radius: var(--radius-s); cursor: pointer; color: var(--text-muted);
}
.user-menu .menu button:hover { background: var(--surface-2); color: var(--text); }

.content { flex: 1; min-height: 0; overflow: auto; }
.screen { padding: 24px; max-width: 1440px; height: 100%; display: flex; flex-direction: column; gap: 16px; min-height: 0; }
.home.screen { height: auto; }

.card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-m); }

/* ---------- Browser (grid screen) ---------- */
.browser { display: flex; flex-direction: column; min-height: 0; flex: 1; overflow: hidden; }
.browser.compact { min-height: 260px; }
.toolbar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.browser.compact .toolbar { padding: 8px; }
.browser.compact .btn { padding: 0 10px; }
.browser.compact .btn span { display: none; }
.browser-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 36%); min-height: 0; flex: 1; }
.browser.compact .browser-body { grid-template-columns: 1fr; }
.grid-wrap { overflow: auto; min-height: 0; }
.grid { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; table-layout: fixed; }
.grid th, .grid td { border-bottom: 1px solid var(--border); padding: 0 12px; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid thead th { position: sticky; top: 0; z-index: 1; background: var(--surface); height: 40px; }
.grid tbody td { height: 44px; }
.th-btn { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; text-align: left; width: 100%; overflow: hidden; text-overflow: ellipsis; }
.th-btn:hover { color: var(--text); }
.sort { color: var(--text); }
.resizer { position: absolute; right: 0; top: 8px; bottom: 8px; width: 7px; cursor: col-resize; border-right: 1px solid var(--border); }
.grid tbody tr:hover td { background: var(--surface); }
.grid tbody tr.selected td { background: var(--pine-soft); }
.grid tbody tr.selected td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.grid tbody tr.row-muted td { color: var(--text-muted); }
.grid td.t-int, .grid td.t-decimal { text-align: right; font-variant-numeric: tabular-nums; }
.grid td.t-string:first-child { font-weight: 500; }
.grid td.empty, .empty { color: var(--text-muted); text-align: center; padding: 32px 16px; }
.empty.big { padding: 64px 16px; }
.statusbar { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 13px; flex: none; }
.statusbar select { width: auto; height: 32px; }

.detail { border-left: 1px solid var(--border); overflow: auto; padding: 16px; min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.detail h3 { font-size: 18px; line-height: 26px; font-weight: 500; overflow-wrap: anywhere; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tabs button {
  background: none; border: 0; height: 36px; padding: 0 12px; border-bottom: 2px solid transparent; margin-bottom: -1px;
  cursor: pointer; color: var(--text-muted); font-weight: 500;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { border-color: var(--pine); color: var(--pine); }
.tab-pane { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.props { display: grid; grid-template-columns: minmax(110px, 40%) 1fr; gap: 10px 12px; margin: 0; align-items: baseline; }
.props dd { margin: 0; overflow-wrap: anywhere; }
.props dd.pre { white-space: pre-wrap; font-size: 13px; line-height: 20px; }

.rights { display: grid; gap: 12px; }
.rights fieldset { border: 1px solid var(--border); border-radius: var(--radius-s); padding: 8px 12px 12px; margin: 0; }
.rights legend { padding: 0 4px; font-weight: 500; }
.rights .right { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.rights .right code { margin-left: auto; }

/* ---------- Popover / modal / toasts ---------- */
.popover {
  position: fixed; z-index: 40; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-m); box-shadow: 0 8px 24px rgb(26 29 27 / .08);
  padding: 12px; display: grid; gap: 8px; max-height: 60vh; overflow: auto; min-width: 240px;
}
.popover label { display: flex; gap: 10px; align-items: center; }
.action-menu { min-width: 240px; gap: 2px; padding: 6px; }
.action-menu .menu-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px; border: 0; background: none; border-radius: var(--radius-s); text-align: left; cursor: pointer; color: var(--text); font-weight: 400; }
.action-menu .menu-item:hover:not(:disabled), .action-menu .menu-item:focus-visible { background: var(--pine-soft); color: var(--pine); }
.action-menu .menu-item:disabled { color: var(--text-faint); cursor: default; }
.overlay { position: fixed; inset: 0; background: rgb(26 29 27 / .4); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-m); width: min(520px, 100%);
  max-height: calc(100vh - 32px); display: flex; flex-direction: column;
}
.modal.wide { width: min(860px, 100%); }
.modal header { display: flex; align-items: center; gap: 8px; padding: 16px 24px; border-bottom: 1px solid var(--border); }
.modal header h2 { font-size: 18px; line-height: 26px; flex: 1; }
.modal-body { padding: 24px; overflow: auto; }
.modal-body:empty { display: none; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px; border-top: 1px solid var(--border); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; }
.modal:not(.wide) .form-grid, .form-grid.one { grid-template-columns: 1fr; }
.field.wide { grid-column: 1 / -1; }
.field.check { justify-content: flex-end; }
.field.check > label { display: flex; align-items: center; gap: 10px; height: 36px; font-size: 14px; text-transform: none; letter-spacing: 0; color: var(--text); font-weight: 400; }
.req { color: var(--danger); }
.field-error, .form-error { color: var(--danger); font-size: 12px; line-height: 16px; }
.form-error:empty, .field-error:empty { display: none; }
.form-error { font-size: 14px; line-height: 22px; }
.field-hint { color: var(--text-muted); font-size: 12px; line-height: 16px; }
.notice { border: 1px solid var(--warning); color: var(--warning); background: rgb(255 194 26 / .12); padding: 8px 12px; border-radius: var(--radius-s); margin: 0; }
.toasts { position: fixed; bottom: 24px; right: 24px; display: grid; gap: 8px; z-index: 60; }
.toast {
  display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--border); box-shadow: 0 8px 24px rgb(26 29 27 / .08);
  border-left: 4px solid var(--success); padding: 10px 12px 10px 16px; border-radius: var(--radius-s); max-width: 440px;
}
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--info); }

/* ---------- Ref picker ---------- */
.refpicker { position: relative; }
.rp-list {
  position: absolute; z-index: 55; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-s); box-shadow: 0 8px 24px rgb(26 29 27 / .08);
  max-height: 280px; overflow: auto;
}
.rp-list li { padding: 6px 8px; border-radius: 4px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-list li.active, .rp-list li:hover { background: var(--pine-soft); color: var(--pine); }
.rp-list li.rp-empty { color: var(--text-muted); cursor: default; background: none; }

/* ---------- Form & detail sections ---------- */
.form-section { grid-column: 1 / -1; font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--pine); padding-top: 8px; border-top: 1px solid var(--border); }
.form-section:first-child { padding-top: 0; border-top: 0; }
.props-section { grid-column: 1 / -1; font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--pine); padding-top: 8px; border-top: 1px solid var(--border); }
.props-section:first-child { padding-top: 0; border-top: 0; }

/* ---------- Agent registration ---------- */
.enroll { display: grid; gap: 12px; }
.enroll p, .enroll ol { margin: 0; }
.enroll ol { padding-left: 20px; display: grid; gap: 10px; }
.display-code { font-size: 32px; line-height: 40px; font-weight: 700; letter-spacing: 0.04em; color: var(--pine); padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-s); text-align: center; user-select: all; }
.cmd { margin: 6px 0 0; padding: 8px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-s); white-space: pre-wrap; overflow-wrap: anywhere; font: 500 13px/20px var(--font); user-select: all; }

/* ---------- Location generator ---------- */
.generator { display: grid; grid-template-columns: minmax(0, 3fr) minmax(260px, 2fr); gap: 16px; align-items: start; }
.gen-form, .gen-out { padding: 24px; display: grid; gap: 16px; }
.gen-form > p, .gen-out p { margin: 0; }
.gen-out h2 { font-size: 18px; line-height: 26px; }
.gen-ranges { border-collapse: collapse; width: 100%; }
.gen-ranges th { text-align: left; font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); padding: 4px 8px 4px 0; }
.gen-ranges td { padding: 4px 8px 4px 0; }
.gen-actions { display: flex; justify-content: flex-end; }
.gen-sample { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 4px 12px; font-weight: 500; }
@media (max-width: 1100px) { .generator { grid-template-columns: 1fr; } }

/* ---------- Home ---------- */
.parity { padding: 24px; display: grid; gap: 8px; }
.parity h2 { font-size: 18px; line-height: 26px; }
.parity p { margin: 0; }
.display-num { font-size: 48px; line-height: 52px; font-weight: 700; letter-spacing: -0.02em; }
.meter { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin: 8px 0; }
.meter div { height: 100%; background: var(--pine); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.tile { padding: 16px; }
.tile header { display: flex; align-items: center; gap: 10px; color: var(--pine); }
.tile h3 { font-size: 14px; line-height: 22px; flex: 1; color: var(--text); }
.tile .count { font-size: 12px; }
.tile ul { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 4px; }
.tile li { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.tile li a { text-decoration: none; color: var(--pine); }
.tile li a:hover { text-decoration: underline; }

.scrim { display: none; }

/* ---------- Under 900 px: sidebar becomes a drawer ---------- */
@media (max-width: 899px) {
  .shell, body.sidebar-collapsed .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; width: min(var(--sidebar-w), 85vw); z-index: 45;
    transform: translateX(-100%); visibility: hidden;
    transition: transform var(--t-panel) var(--ease), visibility 0s linear var(--t-panel);
  }
  body.nav-open .sidebar { transform: none; visibility: visible; transition: transform var(--t-panel) var(--ease); }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgb(26 29 27 / .4); z-index: 44; }
  /* the collapsed state does not apply to the drawer */
  body.sidebar-collapsed .sidebar .label, body.sidebar-collapsed .sidebar .wordmark, body.sidebar-collapsed .sidebar .count,
  body.sidebar-collapsed .sidebar .side-label, body.sidebar-collapsed .sidebar .wh { display: revert !important; }
  body.sidebar-collapsed .sidebar .nav-item.sub { display: flex !important; }
  body.sidebar-collapsed .sidebar .controls { display: flex !important; }
  body.sidebar-collapsed .nav-item { justify-content: flex-start; padding: 0 12px; }
  .side-bottom > button.nav-item { display: none; }
  .menu-toggle { display: inline-grid; }
  .topbar { padding: 0 16px; gap: 8px; }
  .topbar .search { flex-basis: 160px; min-width: 100px; }
  .user-menu summary span { display: none; }
  .page-title { font-size: 18px; line-height: 26px; }
  .screen { padding: 16px; }
  .browser-body { grid-template-columns: 1fr; grid-template-rows: minmax(260px, 1fr) auto; }
  .detail { border-left: 0; border-top: 1px solid var(--border); }
  .toolbar .btn span { display: none; }
  .toolbar .btn { padding: 0 10px; }
  .form-grid { grid-template-columns: 1fr; }
}

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

/* ---------- Platform: grid features (filters, groups, summaries, fixed columns, tree, edit in list) ---------- */
.browser { container-type: inline-size; }
@container (max-width: 1180px) { .toolbar .btn.ghost > span:not(.count) { display: none; } .toolbar .btn.ghost { padding: 0 10px; } }
.browser.with-tree .browser-body { grid-template-columns: 240px minmax(0, 1fr) minmax(320px, 32%); }
.grid-col { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.grid-col .grid-wrap { flex: 1; }
.btn .count, .filter-bar .count { margin-left: 4px; font-size: 12px; font-weight: 700; color: var(--pine); background: var(--pine-soft); border-radius: 999px; padding: 0 6px; }
.btn.on { background: var(--pine-soft); color: var(--pine); border-color: var(--pine); }
.filter-bar { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; color: var(--text-muted); }
.filter-bar .saved-filters { width: auto; min-width: 200px; max-width: 320px; }
.filter-strip, .group-panel, .find-bar { display: flex; align-items: center; gap: 8px; padding: 6px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; background: var(--bg); font-size: 13px; flex: none; }
.group-panel, .find-bar { border-top: 0; border-bottom: 1px solid var(--border); background: var(--surface); }
.find-bar input { width: 280px; height: 32px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg); color: var(--text); max-width: 100%; }
.chip > span:first-child { overflow-wrap: anywhere; }
.chip .icon-btn { min-width: 24px; height: 24px; }
.chip.active, a.chip.active { border-color: var(--pine); color: var(--pine); background: var(--pine-soft); }
a.chip { text-decoration: none; padding-right: 10px; }
.chip a { color: inherit; text-decoration: none; }
mark.find-hit { background: rgb(224 122 46 / .28); color: inherit; border-radius: 2px; }
.grid th.fixed-l, .grid td.fixed-l, .grid th.fixed-r, .grid td.fixed-r { z-index: 1; background: var(--bg); }
.grid thead th.fixed-l, .grid thead th.fixed-r { z-index: 2; background: var(--surface); }
.grid td.fixed-l { box-shadow: inset -1px 0 0 var(--border); }
.grid td.fixed-r { box-shadow: inset 1px 0 0 var(--border); }
.grid tbody tr:hover td.fixed-l, .grid tbody tr:hover td.fixed-r { background: var(--surface); }
.grid thead th.grouped .th-btn { color: var(--pine); }
.grid tfoot td { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--border); height: 36px; font-size: 13px; z-index: 1; }
.foot-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--text-muted); cursor: pointer; width: 100%; text-align: inherit; overflow: hidden; text-overflow: ellipsis; }
.foot-btn:hover, .foot-btn:focus-visible { color: var(--text); }
.grid tr.group-row td { background: var(--surface-2); height: 36px; font-size: 13px; }
.group-toggle { background: none; border: 0; font: inherit; color: var(--text); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-weight: 500; padding: 0; }
.group-toggle .count { font-size: 12px; font-weight: 700; color: var(--pine); background: var(--pine-soft); border-radius: 999px; padding: 0 6px; }
.group-aggs { margin-left: 16px; color: var(--text-muted); }
/* row colour rules: always with a legend and a row title, never colour alone */
.grid tbody tr.row-danger td { background: rgb(185 58 48 / .08); }
.grid tbody tr.row-warning td { background: rgb(255 194 26 / .16); }
.grid tbody tr.row-info td { background: rgb(42 104 150 / .08); }
.grid tbody tr.row-success td { background: rgb(29 122 76 / .08); }
.grid tbody tr.row-danger td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.grid tbody tr.row-warning td:first-child { box-shadow: inset 3px 0 0 var(--warning); }
.grid tbody tr.row-info td:first-child { box-shadow: inset 3px 0 0 var(--info); }
.grid tbody tr.row-success td:first-child { box-shadow: inset 3px 0 0 var(--success); }
.grid tbody tr.selected.row-danger td, .grid tbody tr.selected.row-warning td, .grid tbody tr.selected.row-info td, .grid tbody tr.selected.row-success td { background: var(--pine-soft); }
.legend { display: inline-flex; gap: 12px; flex-wrap: wrap; margin-left: 12px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-item .swatch { width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--border); background: var(--bg); }
.legend-item.row-danger .swatch { background: rgb(185 58 48 / .25); border-color: var(--danger); }
.legend-item.row-warning .swatch { background: rgb(255 194 26 / .4); border-color: var(--warning); }
.legend-item.row-info .swatch { background: rgb(42 104 150 / .25); border-color: var(--info); }
.legend-item.row-success .swatch { background: rgb(29 122 76 / .25); border-color: var(--success); }
.legend-item.row-muted .swatch { background: var(--surface-2); }
/* edit in list */
.grid td.editable { cursor: cell; }
.grid td.editable:hover { box-shadow: inset 0 0 0 1px var(--border); }
.grid td.editing { padding: 2px 4px; overflow: visible; }
.grid td.editing input, .grid td.editing select { height: 36px; width: 100%; }
.grid td.editing .invalid, .grid td.editing input.invalid { border-color: var(--danger); }
.grid td.editing .refpicker { position: relative; }
/* menus */
.ctx-menu { position: fixed; z-index: 40; min-width: 220px; padding: 6px; gap: 2px; box-shadow: 0 8px 24px rgb(26 29 27 / .08); }
.ctx-menu .menu-item .grow { flex: 1; }
.menu-sep { height: 1px; background: var(--border); margin: 4px 0; }
.menu-heading { font-size: 12px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); padding: 6px 10px 2px; }
.menu-check { display: inline-block; width: 16px; text-align: center; color: var(--pine); }
/* tree panel */
.tree-host { border-right: 1px solid var(--border); overflow: auto; min-height: 0; padding: 12px 8px; background: var(--bg); display: grid; align-content: start; gap: 8px; }
.tree-panel { display: grid; gap: 4px; align-content: start; }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { padding-left: 14px; }
.tree-row { display: flex; align-items: center; }
.tree-toggle { width: 22px; height: 28px; border: 0; background: none; color: var(--text-muted); cursor: pointer; flex: none; padding: 0; font: inherit; }
.tree-node { flex: 1; display: flex; gap: 6px; align-items: center; min-height: 28px; border: 0; background: none; border-radius: var(--radius-s); padding: 0 6px; font: inherit; font-size: 13px; color: var(--text); text-align: left; cursor: pointer; min-width: 0; }
.tree-node .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-node:hover { background: var(--surface-2); }
.tree-node.selected { background: var(--pine-soft); color: var(--pine); box-shadow: inset 3px 0 0 var(--accent); }
.tree-node .count { font-size: 11px; color: var(--text-muted); }
/* filter editor */
.fe { display: grid; gap: 12px; padding-top: 8px; min-height: 240px; }
.fe-table { width: 100%; border-collapse: collapse; }
.fe-table th, .fe-table td { padding: 4px 6px; text-align: left; vertical-align: middle; font-weight: 400; }
.fe-table th { white-space: nowrap; }
.fe-table select { min-width: 160px; }
.fe-group { border-left: 2px solid var(--pine-soft); padding: 4px 0 4px 8px; display: grid; gap: 6px; }
.fe-ghead { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fe-gkind { width: auto; font-weight: 500; color: var(--pine); }
.fe-leaf { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(150px, 180px) minmax(200px, 1.4fr) auto; gap: 8px; align-items: center; }
.fe-rule { grid-template-columns: minmax(160px, 1fr) minmax(150px, 180px) minmax(200px, 1.4fr) 120px auto; }
.fe-val { min-width: 0; }
.fe-between, .fe-date { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.fe-date input[type=number] { width: 90px; }
.fe-rel { display: inline-flex; gap: 4px; align-items: center; font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.fe-multi { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.fe-multi label { display: inline-flex; gap: 4px; align-items: center; }
.fe-sort { display: grid; grid-template-columns: 1fr 1.4fr; gap: 16px; }
.fe-sortlist { width: 100%; height: auto; }
.fe-sorted { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.fe-sorted li { display: flex; align-items: center; gap: 6px; }
.fe-save { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; border-top: 1px solid var(--border); padding-top: 12px; margin-top: 8px; }
.fe-save .field { min-width: 240px; }
.fe-save .check { display: inline-flex; gap: 6px; align-items: center; height: 36px; }
.fe-rules { display: grid; gap: 8px; }
.modal footer .grow { flex: 1; }
/* top bar: alerts, environment, related-list navigation */
.bell { position: relative; }
.bell-count { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.env-tag { white-space: nowrap; }
.list-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 24px; border-bottom: 1px solid var(--border); background: var(--surface); font-size: 13px; }
.alerts-panel { display: grid; gap: 12px; }
.alert-types { list-style: none; margin: 0; padding: 0; display: flex; gap: 12px; flex-wrap: wrap; }
.alert-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.alert-item { border: 1px solid var(--border); border-radius: var(--radius-m); padding: 12px; display: grid; gap: 6px; }
.alert-item.s-new { border-left: 4px solid var(--warning); }
.alert-item.s-solving { border-left: 4px solid var(--info); }
.alert-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.alert-actions { display: flex; gap: 8px; }
.alert-pop { display: flex; gap: 8px; align-items: center; max-width: 520px; }
.pre { white-space: pre-wrap; }
/* platform screens */
.card.pad { padding: 16px 24px; display: grid; gap: 16px; align-content: start; }
.field.inline { display: flex; gap: 8px; align-items: center; }
.field.inline input { width: 100px; }
.grid.static { width: 100%; min-width: 0; table-layout: auto; }
.grid.static td, .grid.static th { white-space: normal; }
.bars { display: flex; gap: 4px; align-items: flex-end; height: 140px; border-bottom: 1px solid var(--border); padding-top: 8px; overflow-x: auto; }
.bar { width: 28px; flex: none; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; font-size: 10px; color: var(--text-muted); }
.bar .fill { width: 100%; background: var(--pine); border-radius: 3px 3px 0 0; min-height: 1px; }
.diag { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.diag h3, .diag-screen h3, .lic-daily h3 { font-size: 16px; line-height: 24px; font-weight: 500; margin: 0 0 8px; }
@media (max-width: 900px) {
  .browser.with-tree .browser-body { grid-template-columns: 1fr; grid-template-rows: auto minmax(260px, 1fr) auto; }
  .tree-host { border-right: 0; border-bottom: 1px solid var(--border); max-height: 240px; }
  .fe-leaf, .fe-rule { grid-template-columns: 1fr; }
  .fe-sort { grid-template-columns: 1fr; }
  .list-nav { padding: 8px 16px; }
}
.grid thead th.drop { box-shadow: inset 3px 0 0 var(--accent); }
.value-filter { display: grid; gap: 4px; max-height: 50vh; overflow: auto; }
.value-filter .check { display: flex; gap: 6px; align-items: center; }
