@font-face {
  font-family: Poppins;
  src: url("/assets/Poppins-Regular-6a79411d.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: Poppins;
  src: url("/assets/Poppins-SemiBold-ea01e269.ttf") format("truetype");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

/* Tokens. Light lavender theme in the wordmark's violet-to-pink gradient.
   Type: 11 label, 12.5 secondary, 14 body, 15 lead, 18 title. Space: 4 8 12 16 24 32. */
:root {
  color-scheme: light;
  --ink: #17151f;
  --ink-2: #4a4658;
  --muted: #6b6780;
  --line: #e2e0ec;
  --line-soft: #ecebf3;
  --side: #f7f6fb;
  --surface: #fff;
  --soft: #f4f2fb;
  --violet: #7b5cff;
  --violet-ink: #5b3fe0;
  --pink: #ff3d7f;
  --brand: linear-gradient(120deg, #7b5cff 0%, #b04fd0 55%, #ff3d7f 100%);
  --wash: radial-gradient(1200px 600px at 85% 110%, rgb(123 92 255 / .22), transparent 60%), radial-gradient(700px 420px at 105% 60%, rgb(255 61 127 / .12), transparent 60%);
  --shadow: 0 1px 2px rgb(23 21 31 / .04), 0 8px 24px rgb(23 21 31 / .06);
  --shadow-lift: 0 2px 4px rgb(23 21 31 / .03), 0 16px 40px rgb(91 63 224 / .08);
  --canvas: #fff;
  --sub: var(--soft);
  --text: var(--ink);
  --secondary: var(--muted);
  --accent: var(--violet-ink);
  --primary: var(--violet);
  --control-line: #d4d1e2;
  --positive: #0f7a3f;
  --positive-bg: #e7f8ee;
  --warning: #9a5300;
  --warning-bg: #fff2e0;
  --negative: #c62f45;
  --negative-bg: #fdecef;
  --go: #0f7a3f;
  --fs-label: 11px;
  --fs-small: 12.5px;
  --fs-body: 14px;
  --fs-lead: 15px;
  --fs-title: 24px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar: 232px;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  font: 400 var(--fs-body)/1.6 Poppins, ui-sans-serif, system-ui, sans-serif;
  background: var(--side);
  color: var(--text);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 0; }
.turbo-progress-bar { background: var(--accent); }
h1, h2, h3, h4, strong, th, b { font-weight: 600; }
h1, h2, h3, h4 { line-height: 1.3; text-wrap: balance; }
h1 { font-size: var(--fs-title); margin: 0 0 var(--space-3); }
h2 { font-size: var(--fs-body); margin: var(--space-5) 0 var(--space-2); }
h3 { font-size: var(--fs-label); text-transform: uppercase; letter-spacing: .06em; color: var(--secondary); margin: var(--space-4) 0 6px; }
:is(.card, .form-card) h3 { font-size: var(--fs-body); text-transform: none; letter-spacing: 0; color: var(--text); }
h4 { font-size: var(--fs-small); margin: var(--space-3) 0 var(--space-1); }
p { margin: var(--space-2) 0; }
small, .small { font-size: var(--fs-small); }
small, .context, .muted, figcaption { color: var(--secondary); }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
.record-link { color: var(--text); font-weight: 600; }
a, p, li, td, dd, code { overflow-wrap: anywhere; }
:where(a, button, input, textarea, select, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
[hidden] { display: none !important; }
img { max-width: 100%; height: auto; }
ul, ol { padding-left: var(--space-5); }
li { margin: var(--space-1) 0; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; }
code, pre, .code-input, .mono { font-family: var(--mono); font-size: .9em; }
q { display: block; color: var(--secondary); margin: var(--space-2) 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--space-3) 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* Layout helpers */
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.kv { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: var(--space-1) var(--space-3); font-size: var(--fs-small); margin: var(--space-2) 0; }
.kv dt { color: var(--secondary); }
.kv dd { margin: 0; }
.note { border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 7px 10px; font-size: var(--fs-small); }

/* Buttons. .btn is secondary (white, outlined); .pri the one primary action (the brand gradient); .ghost a quiet
   action; .go the green Publish. A bare submit is primary; a button_to is a small secondary. Turbo disables the
   submitter while its form is busy. */
button, input[type="submit"], .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 36px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  max-width: 100%;
  white-space: normal;
}
.btn:hover, .button_to button:not(.btn):hover { border-color: #cfcbe0; background: #fbfaff; text-decoration: none; }
:is(button, input[type="submit"]):not(.btn, .chip), .btn.pri { background: var(--brand); border-color: transparent; color: #fff; }
:is(button, input[type="submit"]):not(.btn, .chip):hover, .btn.pri:hover { background: var(--brand); filter: brightness(.95); text-decoration: none; }
.button_to button:not(.btn), .btn.sm { min-height: 30px; padding: 4px 11px; font-size: 12.5px; }
.button_to button:not(.btn) { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--soft); color: var(--ink); }
.btn.go { background: var(--go); border-color: transparent; color: #fff; }
.btn.go:hover { background: var(--go); filter: brightness(.94); }
button:disabled, input:disabled, textarea:disabled, select:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
form[aria-busy="true"] :is(button, input[type="submit"]):disabled { opacity: .8; cursor: progress; }
form[aria-busy="true"] button:disabled::before {
  content: "";
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { form[aria-busy="true"] button:disabled::before { animation: none; } }
.button_to { display: inline-block; margin: 0; }

/* Forms */
label, legend { font-weight: 600; font-size: var(--fs-small); }
label { display: block; margin-bottom: var(--space-1); }
label + br { display: none; }
.hint { display: block; color: var(--secondary); font-size: 12px; font-weight: 400; margin: 2px 0 var(--space-1); }
input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), textarea, select {
  width: 100%;
  max-width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--control-line);
  border-radius: 10px;
  color: var(--text);
  background: var(--canvas);
  font: inherit;
}
input::placeholder, textarea::placeholder { color: var(--secondary); opacity: 1; }
select:not([multiple]) { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23a1a1aa' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 12px 8px; }
input[type="file"] { padding: var(--space-3); border-style: dashed; color: var(--secondary); cursor: pointer; }
input[type="file"]::file-selector-button { min-height: 30px; margin-right: var(--space-3); padding: 4px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: inherit; font-size: var(--fs-small); font-weight: 600; cursor: pointer; }
.add-route { margin-top: var(--space-3); }
.add-route label { margin: 0; font-weight: 400; color: var(--secondary); }
.add-route select { flex: 0 1 260px; }
.add-route input[type="text"] { flex: 0 1 200px; }
textarea { resize: vertical; vertical-align: top; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 18px; height: 18px; flex: 0 0 auto; }
fieldset { border: 0; padding: 0; margin: var(--space-4) 0; }
fieldset label { display: flex; gap: var(--space-3); align-items: start; padding: 6px 0; font-weight: 400; font-size: var(--fs-body); }
form p { margin: var(--space-3) 0; }
[aria-invalid="true"] { border-color: var(--negative) !important; }
.field-error { display: block; margin-top: var(--space-1); color: var(--negative); font-size: var(--fs-small); }
.form-card { max-width: 760px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-4) var(--space-5); }
.form-card > :first-child { margin-top: 0; }

/* Card */
.card { padding: 16px 18px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); box-shadow: var(--shadow); }
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-3); }
.card-head > :is(h2, h3) { margin: 0; }
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); margin: var(--space-4) 0; }
.card-grid h2 { margin-top: 0; }

/* Page header: one title, one muted line, actions on the right */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.page-head > div:first-child { min-width: 0; flex: 1 1 320px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 2px 0 0; font-size: var(--fs-small); }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }

/* Tabs and segmented choices */
.tabs { display: flex; overflow-x: auto; scrollbar-width: none; gap: 22px; border-bottom: 1px solid var(--line-soft); margin: 0 0 22px; font-size: 13.5px; }
.tabs a { flex: none; display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 0 6px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--ink-2); text-decoration: none; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs.wrap { flex-wrap: wrap; column-gap: 18px; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--violet); font-weight: 600; }

/* Tags (a kind or role) */
.tag { display: inline-block; padding: 0 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--secondary); font-size: 10.5px; font-weight: 400; line-height: 1.7; white-space: nowrap; vertical-align: 1px; }
.tag.acc { border-color: var(--accent); color: var(--text); }

/* Lists, chips and timelines */
.plain { list-style: none; padding: 0; margin: 0; }
.clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.block { display: block; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: var(--space-2) 0; }
.chip { display: inline-flex; align-items: center; min-height: 32px; padding: 6px 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 400; text-decoration: none; }
.chip:hover { border-color: #cfc6f5; background: var(--surface); text-decoration: none; }
.chip[aria-current="true"], .chip[aria-current="page"], .chip.on { border-color: var(--accent); color: var(--text); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.hist { margin: 0 0 0 4px; padding: 0 0 0 10px; border-left: 2px solid var(--line); list-style: none; }
.hist > * { margin: 0; padding: 3px 0; font-size: var(--fs-small); }
.hist > li > p { margin: 0; }
.hist .version-statement { display: block; color: var(--text); }
.hist .superseded .version-statement, .hist .retracted .version-statement { color: var(--secondary); }
.hist .activity-lines { padding-left: 12px; color: var(--secondary); font-size: 12px; }
.hist > li.failed .activity-lines { color: var(--negative); }

/* Status chip: a dot and a word, coloured by UiHelper::STATUS_TONES */
.status-chip { --tone: var(--secondary); display: inline-flex; align-items: center; gap: 5px; color: var(--tone); font-size: 11.5px; font-weight: 600; line-height: 1.6; white-space: nowrap; vertical-align: 1px; }
.status-chip::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-chip[data-tone="ok"] { --tone: var(--positive); }
.status-chip[data-tone="warn"] { --tone: var(--warning); }
.status-chip[data-tone="active"] { --tone: var(--accent); }
.status-chip[data-tone="bad"] { --tone: var(--negative); }

/* Empty, loading and error states */
.state { padding: var(--space-4); border: 1px dashed var(--line); border-radius: var(--radius); color: var(--secondary); }
.state p { margin: 0; }
.state-action { margin-top: var(--space-3); }
.state.loading p::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: var(--space-2); border: 2px solid var(--accent); border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.state.error { border-style: solid; border-color: color-mix(in srgb, var(--negative) 50%, var(--line)); color: var(--negative); }

/* Disclosure */
details { margin: var(--space-3) 0; }
summary { cursor: pointer; color: var(--accent); min-height: 32px; padding: 5px 0; }
summary:hover { color: var(--ink); }

/* Tables. data-stack turns rows into cards under 768px; each cell carries data-label. */
.table-region { width: 100%; max-width: 100%; overflow-x: auto; margin: var(--space-3) 0 var(--space-5); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.table-region:focus-visible { outline-offset: 2px; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 7px var(--space-2); vertical-align: top; min-width: 80px; }
th:first-child, td:first-child { padding-left: 14px; }
th:last-child, td:last-child { padding-right: 14px; }
th { padding-top: var(--space-2); padding-bottom: 6px; color: var(--secondary); font-size: var(--fs-label); text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--line); }
td { border-top: 1px solid var(--line-soft); }
tbody tr:first-child td { border-top: 0; }
td .button_to { margin: 0; }
td :is(button, input[type="submit"], .btn) { min-height: 32px; padding: 4px 14px; white-space: nowrap; }
.table-region img { max-width: 320px; max-height: 600px; object-fit: contain; }
@media (max-width: 767px) {
  .table-region[data-stack] { overflow: visible; background: transparent; border: 0; }
  .table-region[data-stack] thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .table-region[data-stack] :is(table, tbody, tr, td) { display: block; }
  .table-region[data-stack] tr { margin-bottom: var(--space-2); padding: var(--space-2) 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
  .table-region[data-stack] td { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: var(--space-3); border: 0; padding: 4px 14px; min-width: 0; }
  .table-region[data-stack] td:not([data-label]) { display: block; }
  .table-region[data-stack] tbody th { display: block; padding: 4px 14px; border: 0; }
  .table-region[data-stack] .nowrap { white-space: normal; overflow-wrap: anywhere; }
  .table-region[data-stack] td::before { content: attr(data-label); color: var(--secondary); font-size: var(--fs-label); text-transform: uppercase; letter-spacing: .05em; }
}

/* Flash: an error banner that stays in view; a form save's note is one quiet line. */
#flash:not(:has(p)) { display: none; }
#flash { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--space-3); align-items: start; margin-bottom: var(--space-4); }
#flash:has(#alert) { position: sticky; top: var(--space-2); z-index: 5; padding: 4px 4px 4px var(--space-4); background: color-mix(in srgb, var(--negative) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--negative) 55%, var(--line)); border-radius: var(--radius); box-shadow: var(--shadow); }
#flash p { grid-column: 1; margin: 8px 0; }
#notice { display: flex; align-items: center; gap: var(--space-2); color: var(--positive); font-size: var(--fs-small); }
#notice::before { content: "✓"; }
.flash-dismiss { grid-column: 2; grid-row: 1; width: 36px; min-height: 36px; padding: 0; border: 0; border-radius: 999px; background: transparent !important; color: var(--secondary) !important; font-size: 1.4rem; font-weight: 400; line-height: 1; }
.flash-dismiss:hover { color: var(--ink) !important; }

/* The frame: the sidebar on the lavender side, the screen in one white rounded panel */
.skip-link { position: fixed; left: var(--space-4); top: -100px; z-index: 30; background: var(--surface); padding: var(--space-3) var(--space-5); border-radius: 12px; box-shadow: var(--shadow); }
.skip-link:focus-visible { top: var(--space-3); }
.frame { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100dvh; }
.sidebar { position: sticky; top: 0; height: 100dvh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding: 18px 12px; background: var(--side); }
.sidebar-mark { display: block; align-self: flex-start; padding: 2px 8px 18px; }
.sidebar-mark img { display: block; width: 118px; height: auto; }
.new-page { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--ink); font-weight: 600; text-decoration: none; }
.new-page:hover, .new-page[aria-current="page"] { text-decoration: none; border-color: #cfc6f5; }
.spark { flex: none; width: 16px; height: 16px; background: var(--brand); -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 2l2.2 6.3L20.5 10.5 14.2 12.7 12 19l-2.2-6.3L3.5 10.5 9.8 8.3z'/><path d='M19 15l.9 2.1L22 18l-2.1.9L19 21l-.9-2.1L16 18l2.1-.9z'/></svg>") center / contain no-repeat; mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 2l2.2 6.3L20.5 10.5 14.2 12.7 12 19l-2.2-6.3L3.5 10.5 9.8 8.3z'/><path d='M19 15l.9 2.1L22 18l-2.1.9L19 21l-.9-2.1L16 18l2.1-.9z'/></svg>") center / contain no-repeat; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.nav-label { margin: 18px 12px 6px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; color: var(--ink-2); text-decoration: none; }
.nav-item:hover { background: #efedf8; text-decoration: none; }
.nav-item[aria-current="page"] { background: #ece9fb; color: var(--ink); font-weight: 600; }
.ico { flex: none; width: 16px; height: 16px; border: 1.6px solid currentColor; border-radius: 4px; opacity: .8; }
.ico.circle { border-radius: 50%; }
.person { position: relative; margin: auto 0 0; }
.person > summary { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; color: var(--ink); list-style: none; }
.person > summary::-webkit-details-marker { display: none; }
.person > summary:hover { background: #efedf8; }
.person-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.person-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-name small { color: var(--muted); font-size: 12px; }
.person-menu { position: absolute; bottom: calc(100% + 6px); left: 0; right: 0; z-index: 5; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-lift); }
.person-menu p { margin: 0 4px 8px; overflow-wrap: anywhere; }
.person-menu .button_to, .person-menu button { width: 100%; }
.avatar { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: #fff; font-size: 13px; font-weight: 600; }
.panel { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: calc(100dvh - 16px); margin: 8px 8px 8px 0; border: 1px solid var(--line-soft); border-radius: 18px; background: var(--surface); overflow: clip; }
.topbar { display: none; }
.admin-banner { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-3); padding: 7px 14px 7px 44px; background: #efebfc; border-bottom: 1px solid #e3dcfb; font-size: var(--fs-small); color: var(--ink-2); }
.admin-banner > b { color: var(--violet-ink); white-space: nowrap; }
.admin-banner > span { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.company-switch { margin: 0 0 0 auto; font-weight: 400; }
.company-switch select { width: auto; min-height: 30px; padding-top: 3px; padding-bottom: 3px; font-size: 13px; }
#main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
#main:focus { outline: none; }
#main.screen { padding: 34px 44px 48px; }
.scrim { display: none; }
@media (max-width: 899px) {
  .frame { display: block; }
  .sidebar { display: none; }
  .frame[data-sheet="menu"] .sidebar { display: flex; position: fixed; z-index: 20; top: 0; left: 0; bottom: 0; width: min(280px, 86vw); height: auto; box-shadow: var(--shadow-lift); }
  .frame[data-sheet="menu"] .scrim { display: block; position: fixed; inset: 0; z-index: 15; background: rgb(23 21 31 / .3); }
  .panel { min-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line-soft); }
  .topbar-mark img { display: block; width: 104px; }
  .admin-banner { padding-left: 16px; }
  .admin-banner span { display: none; }
  #main.screen { padding: 20px 16px 40px; }
  input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), textarea, select { font-size: 16px; }
  .card-grid, .grid2 { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: minmax(0, 1fr); }
}
.bare { max-width: 460px; margin: 0 auto; padding: 9vh var(--space-5) var(--space-6); }
.bare-mark { display: block; margin: 0 auto var(--space-5); }

/* Screens */
.extraction-failed { color: var(--negative); }
#errors, #refusal, [data-draft-stale], .error, .warnings { background: var(--surface); border-radius: var(--radius); padding: var(--space-3) var(--space-4); }
#alert, #errors, .error, .failed, #failures { color: var(--negative); }
.passed, .succeeded { color: var(--positive); }
[data-draft-stale], .warnings, .pending, .running, .attention { color: var(--warning); }
#errors { padding-left: 36px; }
.admin-companies { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--space-3); align-items: start; }
.admin-companies > .table-region, .admin-companies form > h2 { margin: 0; }
.admin-companies td:last-child .btn, .nowrap { white-space: nowrap; }
@media (max-width: 1100px) { .admin-companies { grid-template-columns: minmax(0, 1fr); } }
.overridden { color: var(--secondary); }
.auth-screen { max-width: 400px; margin: 7vh auto; padding: var(--space-6) var(--space-5); }
.auth-screen h1 { margin: 0 0 var(--space-5); text-align: center; font-size: var(--fs-title); }
.auth-screen form p { margin: 0 0 var(--space-4); }
.auth-screen form p:last-child { margin: 0; }
.auth-screen .google-sign-in { display: block; margin: 0; }
.auth-screen .google-sign-in .btn.google { width: 100%; min-height: 44px; gap: 10px; background: #fff; border: 1px solid #747775; color: #1f1f1f; font-family: Roboto, Poppins, ui-sans-serif, system-ui, sans-serif; font-size: var(--fs-body); font-weight: 500; }
.auth-screen .google-sign-in .btn.google:hover { background: #f8f8f8; border-color: #747775; }
.auth-divider { display: flex; align-items: center; gap: var(--space-3); margin: var(--space-5) 0; color: var(--secondary); font-size: var(--fs-label); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-screen input[type="submit"] { width: 100%; min-height: 44px; background: var(--violet-ink); border-color: transparent; color: #fff; font-size: var(--fs-body); }
.auth-screen input[type="submit"]:hover { background: var(--violet-ink); filter: brightness(.92); }
/* Brain: board, drawer, changes */
.brain-bar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 0 var(--space-4); border-bottom: 1px solid var(--line); }
.brain-bar .tabs { border-bottom: 0; margin: 0; }
.brain-counts { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); margin: 0 0 var(--space-2); color: var(--secondary); font-size: var(--fs-small); }
.brain-intro { margin: var(--space-2) 0 var(--space-3); }
#brain-progress { margin-bottom: var(--space-3); }
#brain-progress > p { margin: var(--space-1) 0; }
.prep-log { margin: 0; font-size: var(--fs-small); }
.prep-log p { margin: 2px 0; color: var(--secondary); }
.board-filters { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin: 0 0 var(--space-3); }
.board-filters input[type="search"] { flex: 1 1 220px; }
.board-filters select { flex: 1 1 140px; max-width: 200px; }
@media (max-width: 899px) { .board-filters input[type="search"] { flex-basis: 100%; } .board-filters select { max-width: none; } }
.board-summary { margin: 0 0 var(--space-2); }
.kmap { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--space-3) 10px; align-items: start; }
.kmap.open { grid-template-columns: minmax(0, 1fr); }
.kmap.open .kcol { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 10px; align-items: start; }
.kmap.open .kcol-head { grid-column: 1 / -1; }
.kcol { min-width: 0; }
.kcol-head { display: flex; justify-content: space-between; margin: 0; padding: 2px 2px 6px; font-size: 12px; }
.kcol-more { display: inline-flex; align-items: center; min-height: 32px; font-size: var(--fs-small); }
.kcol-more.narrow { display: none; }
.kcard { --st: var(--secondary); position: relative; margin-bottom: var(--space-2); padding: var(--space-2) 10px; border: 1px solid var(--line); border-left: 3px solid var(--st); border-radius: var(--radius-sm); background: var(--surface); }
.kcard.current { --st: var(--positive); }
.kcard:is(.contested, .proposed) { --st: var(--warning); }
.kcard.retracted { --st: var(--negative); }
.kcard.stale, .kcard.unset { border-left-style: dashed; }
.kcard:hover { border-color: var(--text); border-left-color: var(--st); }
.kcard p { margin: 0; }
.kcard-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) 6px; }
.kcard-status { margin-left: auto; display: inline-flex; gap: 6px; }
.k { color: var(--secondary); font-size: var(--fs-label); }
.kcard-statement { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; margin: var(--space-1) 0 6px; color: var(--text); font-size: var(--fs-small); text-decoration: none; }
a.kcard-statement::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
a.kcard-statement:focus-visible { outline: none; }
a.kcard-statement:focus-visible::after { outline: 2px solid var(--accent); outline-offset: 2px; }
.kcard-measures { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 11.5px; }
.kcard details { position: relative; z-index: 1; margin: var(--space-1) 0 0; }
.sbar { display: inline-block; flex: none; width: 36px; height: 6px; border-radius: 3px; background: var(--sub); border: 1px solid var(--line); vertical-align: middle; overflow: hidden; }
.sbar i { display: block; height: 100%; background: var(--text); opacity: .6; }
.cites { list-style: none; padding: 0; margin: 0; }
.cite { margin: 0 0 6px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px; font-size: 12px; }
.cite q { margin: 2px 0 0; quotes: none; }
.drawer { position: fixed; inset: 0 0 0 auto; width: 480px; max-width: 100vw; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; border-left: 1px solid var(--line); background: var(--surface); color: var(--text); overflow-y: auto; overscroll-behavior: contain; }
.drawer-body { padding: var(--space-4) 18px var(--space-6); }
.drawer-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.drawer-close { margin-left: auto; min-width: 32px; padding: 4px 8px; font-size: 1.1rem; font-weight: 400; }
.drawer-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: var(--space-3) 0 var(--space-1); }
.drawer-statement { margin: 0 0 var(--space-3); font-size: var(--fs-lead); font-weight: 400; line-height: 1.5; }
.drawer-measures .card { display: flex; flex-direction: column; gap: 2px; padding: var(--space-2) 10px; }
.drawer-measures b { display: flex; align-items: center; gap: var(--space-2); }
.drawer-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-4) 0 var(--space-1); }
.drawer-actions details { margin: 0; }
.drawer-actions details[open] { flex: 1 1 100%; }
.drawer-actions details[open] > summary { display: none; }
.drawer-actions summary { list-style: none; }
.drawer-actions summary::-webkit-details-marker { display: none; }
.drawer-change textarea, .drawer-change input[type="text"] { width: 100%; }
.drawer-flash { margin: var(--space-3) 0 0; padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); font-size: var(--fs-small); }
.drawer-flash.alert { color: var(--negative); background: color-mix(in srgb, var(--negative) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--negative) 55%, var(--line)); }
.drawer-flash.notice { color: var(--positive); }
body:has(.drawer[open]) #flash { display: none; }
.drawer-decisions .decision-card { margin: var(--space-2) 0; }
.brain-since { gap: var(--space-2) var(--space-4); margin: 0 0 var(--space-3); }
.brain-since-date { flex-wrap: nowrap; }
.brain-since-date label { display: inline; margin: 0; font-weight: 400; color: var(--secondary); white-space: nowrap; }
.brain-since-date input[type="date"] { flex: 0 1 170px; padding: 3px 10px; }
.brain-change-group { margin-bottom: 10px; }
.brain-change-group h2 { margin: 0 0 var(--space-1); }
.brain-changes { list-style: none; padding: 0; margin: 0; }
.change { display: grid; grid-template-columns: 96px minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 10px; align-items: baseline; margin: 0; padding: 6px 0; border-top: 1px solid var(--line-soft); font-size: var(--fs-small); }
.change-statement { color: var(--text); text-decoration: none; }
.change-statement:hover { text-decoration: underline; }
.brain-more > summary { font-size: var(--fs-small); }
time { white-space: nowrap; }
.brain-decision.decided { margin: 0; padding: var(--space-1) 0; border-top: 1px solid var(--line-soft); }
.brain-decision.decided > summary { color: var(--text); font-size: var(--fs-small); }
@media (max-width: 899px) {
  .kcol .kcard:nth-of-type(n+3) { display: none; }
  .kmap.open .kcol .kcard { display: block; }
  .kcol-more.narrow { display: inline-flex; }
  .drawer { width: 100vw; border-left: 0; }
  .change { grid-template-columns: minmax(0, 1fr) auto; }
  .change > :is(:first-child, .change-statement) { grid-column: 1 / -1; }
}
#new-token { padding: 24px; border-radius: 24px; background: var(--surface); margin: 24px 0; }
#new-token code { display: block; user-select: all; overflow-wrap: anywhere; }
.token-form, .company-form { max-width: 640px; }
@media (max-width: 767px) {
  .card-grid { grid-template-columns: minmax(0, 1fr); }
  .auth-screen { margin: 24px auto; padding: var(--space-5) var(--space-4); }
}
.evidence-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 24px; margin: 16px 0 24px; align-items: start; }
.evidence-shot { margin: 0; min-width: 0; }
.evidence-shot figcaption { margin-bottom: 8px; }
.evidence-shot img { display: block; width: 100%; max-width: 100%; height: auto; max-height: 480px; object-fit: cover; object-position: top; border-radius: 12px; background: var(--surface); }
.evidence-links { margin: 8px 0 0; }
.evidence-links a { display: inline-flex; align-items: center; min-height: 44px; }
.evidence-unavailable { background: var(--surface); border-radius: 16px; padding: 16px 20px; color: var(--secondary); margin: 0; }
.table-region .evidence-shot + .evidence-shot { margin-top: 16px; }
.page-shots { display: flex; flex-wrap: wrap; align-items: flex-end; }
.page-shots .evidence-shot:first-child { flex: 0 1 512px; }
.page-shots .evidence-shot:last-child { flex: 0 0 200px; }
.page-shots .evidence-shot img { height: auto; max-height: none; object-fit: cover; object-position: top; }
.page-shots .evidence-shot:first-child img { aspect-ratio: 1440 / 900; }
.page-shots .evidence-shot:last-child img { width: 148px; aspect-ratio: 390 / 844; }
:is(.drawer, .modal, .confirm-dialog)::backdrop { background: rgb(23 21 31 / .35); }
.confirm-dialog { margin: auto; max-width: min(520px, calc(100vw - 40px)); padding: 24px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); color: var(--text); }
.confirm-dialog form p { margin: 0; }
#confirm_message { overflow-wrap: break-word; }
.confirm-dialog .confirm-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; margin-top: 24px; }
.live-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); margin: var(--space-3) 0; padding: var(--space-3) 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.live-bar p { margin: 0 auto 0 0; }
.live-bar .button_to { margin: 0; }
#publications .url-cell a { overflow-wrap: anywhere; }
#publications td.delivery { min-width: 9rem; }

/* Experiments board */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px var(--space-3); }
.kanban-empty { display: none; margin: 0; }
.kanban-column { min-width: 0; }
.kanban-column h2 { margin: 0 0 6px; padding: 2px 2px 0; font-size: 12.5px; }
.xcard { margin-bottom: var(--space-2); padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font-size: 12px; }
.xcard h3 { margin: 0 0 4px; color: var(--text); font-size: 12.5px; font-weight: 600; letter-spacing: 0; text-transform: none; }
.xcard h3 a { color: var(--text); text-decoration: none; }
.xcard h3 a:hover { text-decoration: underline; }
.xcard p { margin: 2px 0 0; }

@media (max-width: 899px) {
  .kanban { grid-template-columns: minmax(0, 1fr); }
  .kanban-column[data-empty] { display: none; }
  .kanban-empty { display: block; }
}

/* Backoffice authoring: skills, plugins, capabilities. */
.authoring { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: var(--space-3); align-items: start; }
.authoring > div { display: grid; gap: var(--space-3); min-width: 0; }
.card > .table-region { margin: 0; border: 0; border-radius: 0; background: none; }
.card > .table-region th:first-child, .card > .table-region td:first-child { padding-left: 0; }
.catalog-pair { align-items: start; margin-bottom: var(--space-3); }
.secrow { display: grid; grid-template-columns: 150px 100px minmax(0, 1fr); gap: var(--space-1) 10px; padding: var(--space-2) 0; border-top: 1px solid var(--line-soft); align-items: start; font-size: var(--fs-small); }
.secrow > code { overflow-wrap: anywhere; }
.secrow p, .secrow div p { margin: 0 0 var(--space-1); }
.secrow.mine { box-shadow: inset 2px 0 0 var(--accent); padding-left: 8px; }
.secrow textarea, .secrow select { width: 100%; }
.rows { list-style: none; padding: 0; margin: 0; }
.rows > li { margin: 0; padding: var(--space-2) 0; border-top: 1px solid var(--line-soft); font-size: var(--fs-small); }
.rows > li:first-child { border-top: 0; }
.cases > li, [data-bindings] > li { padding: 2px 0; border: 0; }
.version-history { margin-top: var(--space-2); }
.catalog-pair td:last-child .btn, .capability td:last-child .btn { white-space: nowrap; }
.rows ul { padding-left: 16px; margin: var(--space-1) 0 0; }
.rows ul li { margin: 0; }
.case-mark { display: inline-block; width: 1.2em; font-weight: 600; }
[data-status="passed"] > .case-mark { color: var(--positive); }
[data-status="failed"] > .case-mark { color: var(--negative); }
.note.acc { border-color: var(--accent); }
.proposal { display: grid; gap: var(--space-2); }
.proposal h3 { margin: 0; }
.proposal-step { font-size: var(--fs-small); font-weight: 600; margin: var(--space-1) 0 0; }
.capability-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: var(--space-3); align-items: start; margin-top: var(--space-2); }
.capability-grid .kv { margin: 0; }
.pstep { display: grid; grid-template-columns: 24px 64px minmax(0, 1fr); gap: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 12px; background: var(--surface); font-size: var(--fs-small); }
.pstep + .pstep { margin-top: var(--space-2); }
.pstep[data-kind="gate"] { border-style: dashed; }
.pstep .n { font: 600 12px var(--mono); color: var(--secondary); }
.pstep .kv { margin: var(--space-1) 0 0; }
.plugin-steps { list-style: none; padding: 0; margin: 0; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 var(--space-3); }
.field-grid p { margin: 0 0 var(--space-2); }
.card-legend { float: left; width: 100%; padding: 0; margin: 0 0 var(--space-2); font-size: var(--fs-body); font-weight: 600; color: var(--text); }
.card-legend + * { clear: both; }
fieldset.card { margin: 0; }
.fieldcard { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--space-3); margin: 0 0 var(--space-3); }
.fieldcard legend { padding: 0 var(--space-1); font-size: var(--fs-small); }
.fieldcard[data-kind="gate"] { border-style: dashed; }
.plugin-step:has(select[data-step-kind] option[value="tool"]:checked) .for-agent,
.plugin-step:has(select[data-step-kind] option[value="gate"]:checked) .for-agent,
.plugin-step:has(select[data-step-kind] option[value="agent"]:checked) .for-tool,
.plugin-step:has(select[data-step-kind] option[value="gate"]:checked) .for-tool,
.plugin-step:has(select[data-step-kind] option[value="agent"]:checked) .for-gate,
.plugin-step:has(select[data-step-kind] option[value="tool"]:checked) .for-gate { display: none; }
.tool-requests { margin: 0 0 var(--space-2); }
.tool-requests label { display: inline-flex; gap: 6px; padding: 2px 14px 2px 0; font-size: var(--fs-small); }
.step-result { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 80px; gap: var(--space-2); align-items: end; margin: 0 0 var(--space-2); }
.step-result label { margin: 0; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); margin: var(--space-4) 0 0; }
.diff, .instructions { background: var(--canvas); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--space-2) 10px; margin: 0; max-height: 60vh; overflow: auto; font-size: 11.5px; line-height: 1.7; white-space: pre-wrap; }
.diff-add { color: var(--positive); }
.diff-remove { color: var(--negative); text-decoration: line-through; }
.diff-change { color: var(--warning); }
.diff-same { color: var(--secondary); }
.compile-errors { color: var(--negative); margin: var(--space-1) 0; padding-left: 18px; font-size: var(--fs-small); }
.capability + .capability { margin-top: var(--space-3); }
@media (max-width: 900px) { .authoring, .capability-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 767px) {
  .card > .table-region[data-stack] tr { margin: 0; border: 0; border-top: 1px solid var(--line-soft); border-radius: 0; background: none; }
  .card > .table-region[data-stack] tbody tr:first-child { border-top: 0; }
  .card > .table-region[data-stack] td { padding-left: 0; padding-right: 0; }
}
@media (max-width: 600px) {
  .secrow { grid-template-columns: minmax(0, 1fr) auto; }
  .secrow > :last-child { grid-column: 1 / -1; }
  .step-result { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

/* Stage chips and the modal */
.stages { display: flex; flex-wrap: wrap; gap: 3px; margin: var(--space-1) 0; }
.stage { font-size: 11px; line-height: 1.7; border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; white-space: nowrap; color: var(--secondary); }
.stage.running { border-color: var(--accent); color: var(--text); }
.stage.failing { border-style: dashed; border-color: var(--negative); color: var(--negative); white-space: normal; }
.stage.warning { border-style: dashed; border-color: var(--warning); color: var(--warning); }
.stage.waiting { border-style: dashed; }
.modal { margin: auto; width: min(540px, calc(100vw - 32px)); max-height: 80vh; overflow: auto; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.modal-head h2 { margin: 0; }

/* Brand tiles: logo surfaces, color swatches and font samples */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: var(--space-3); }
.tiles.narrow { grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr)); }
.tiles figure { margin: 0; }
.logo-tile { display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; height: 88px; padding: var(--space-3); border-radius: var(--radius-sm); font-size: var(--fs-small); }
.logo-tile.light { background: #f5f5f7; color: #555; }
.logo-tile.dark { background: #111; color: #aaa; border: 1px solid var(--line); }
.logo-tile img { max-width: 100%; max-height: 100%; object-fit: contain; }
.tiles .card .small { margin: 6px 0 0; }
.swatch { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font-size: 12px; }
.swatch > div:first-child { height: 54px; }
.swatch > div:last-child { padding: 6px 8px; }
.font-sample { margin: 0; font-size: 28px; line-height: 1.25; overflow-wrap: anywhere; }
#decisions { margin-bottom: var(--space-4); }
.datasets code { white-space: nowrap; }
.grid2 > .card :is(th, td) { min-width: 0; overflow-wrap: break-word; }
