/* Admin design system (Phase 2, Stage B). Approved mockup: docs/design/hub-mockups-stage-a.html.
   Light is the default: white and light grey, navy as the accent. Dark is the navy look.
   Loaded after brand.css, so the brand blocks still render in the style guide. */

:root {
  --a-navy: #3D3F6B;
  --a-navy-soft: #EDEEF6;
  --a-gold: #FBC85F;
  --a-gold-soft: #FFF5DC;
  --a-bg: #F5F5F7;
  --a-surface: #FFFFFF;
  --a-surface-2: #F5F5F7;
  --a-fg: #1D1D1F;
  --a-muted: #6E6E73;
  --a-faint: #8E8E93;
  --a-line: #E6E6EB;
  --a-card-line: rgba(0, 0, 0, 0.06);
  --a-accent: #3D3F6B;
  --a-ok: #1F7F45; --a-ok-bg: #E6F4EA;
  --a-warn: #9A5B00; --a-warn-bg: #FFF2DB;
  --a-bad: #C0362C; --a-bad-bg: #FDECEA;
  --a-info: #3D3F6B; --a-info-bg: #EDEEF6;
  --a-violet: #5B4BB0; --a-violet-bg: #EFEBFF;
  --a-side-bg: rgba(250, 250, 252, 0.88);
  --a-side-fg: #1D1D1F;
  --a-side-dim: #6E6E73;
  --a-side-line: #E6E6EB;
  --a-side-hover: rgba(0, 0, 0, 0.04);
  --a-side-on-bg: #EDEEF6;
  --a-side-on-fg: #3D3F6B;
  --a-side-on-ico: #3D3F6B;
  --a-bar-bg: rgba(255, 255, 255, 0.82);
  --a-btn-bg: #3D3F6B; --a-btn-fg: #FFFFFF;
  --a-fill: #3D3F6B;
  --a-focus: rgba(251, 200, 95, 0.75);
  --a-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 6px 20px rgba(0, 0, 0, 0.04);
  --a-r: 16px;
  --a-r-sm: 10px;
  --a-side-w: 248px;
  color-scheme: light;
}
:root[data-mode="dark"] {
  --a-navy-soft: #2C2E4D; --a-gold-soft: #3A3220;
  --a-bg: #14152A; --a-surface: #1D1F37; --a-surface-2: #232543;
  --a-fg: #ECEDF7; --a-muted: #A9ABC8; --a-faint: #7E80A0; --a-line: #2E3052; --a-card-line: #2E3052;
  --a-accent: #B9BCF0;
  --a-ok: #5FCB97; --a-ok-bg: #173527; --a-warn: #F2BE5C; --a-warn-bg: #3A2E15; --a-bad: #F08A8A; --a-bad-bg: #3D1E22;
  --a-info: #B9BCF0; --a-info-bg: #2C2E4D; --a-violet: #C4B8FF; --a-violet-bg: #2D2850;
  --a-side-bg: #191A33; --a-side-fg: #D9DAEE; --a-side-dim: #9EA0C6; --a-side-line: rgba(255, 255, 255, 0.1);
  --a-side-hover: rgba(255, 255, 255, 0.06); --a-side-on-bg: rgba(251, 200, 95, 0.14); --a-side-on-fg: #FFFFFF; --a-side-on-ico: #FBC85F;
  --a-bar-bg: rgba(29, 31, 55, 0.86);
  --a-btn-bg: #5A5DA0; --a-btn-fg: #FFFFFF;
  --a-fill: #FBC85F;
  --a-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

html { background: var(--a-bg); }

/* brand.css colours, pointed at the admin palette so its rules follow the mode. */
body.admin {
  --white: var(--a-surface);
  --text: var(--a-fg);
  --tint: var(--a-surface-2);
  --muted: var(--a-muted);
  background: var(--a-bg);
  color: var(--a-fg);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
body.admin h1, body.admin h2, body.admin h3, body.admin h4 { color: var(--a-fg); text-wrap: balance; }
body.admin h1 { font-size: clamp(1.5rem, 2.4vw, 1.85rem); letter-spacing: -0.02em; margin: 0 0 0.4em; }
body.admin h2 { font-size: 1.1rem; letter-spacing: -0.01em; margin: 1.6em 0 0.6em; }
body.admin h3 { font-size: 1rem; }
body.admin a { color: var(--a-accent); }
body.admin :focus-visible { outline: 2px solid var(--a-focus); outline-offset: 2px; }
.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--a-surface); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }

/* Logos: dark lettering in light mode, white lettering in dark mode. */
.for-dark { display: none; }
:root[data-mode="dark"] .for-light { display: none; }
:root[data-mode="dark"] .for-dark { display: inline; }
.when-dark { display: none; }
:root[data-mode="dark"] .when-light { display: none; }
:root[data-mode="dark"] .when-dark { display: inline-flex; }
.when-light, .when-dark { align-items: center; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--a-side-w) minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px; padding: 18px 12px;
  background: var(--a-side-bg); color: var(--a-side-fg);
  border-right: 1px solid var(--a-side-line);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 8px; text-decoration: none; }
.side-brand img { height: 32px; width: auto; }
body.admin .side-brand span { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--a-side-dim); border-left: 1px solid var(--a-side-line); padding-left: 10px; font-weight: 600; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--a-side-dim); padding: 14px 10px 6px; font-weight: 600; }
body.admin .nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--a-r-sm); color: var(--a-side-fg); text-decoration: none; font-weight: 500; font-size: 13.5px; }
body.admin a.nav-link:hover { background: var(--a-side-hover); }
.nav-link.soon { color: var(--a-side-dim); cursor: default; }
.soon-tag { margin-left: auto; font-size: 10.5px; font-weight: 600; border: 1px solid var(--a-side-line); border-radius: 999px; padding: 0 7px; color: var(--a-side-dim); }
.nav-item.on > .nav-link { background: var(--a-side-on-bg); color: var(--a-side-on-fg); font-weight: 600; }
.nav-item.on > .nav-link .i { color: var(--a-side-on-ico); }
.nav-sub { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 6px 28px; padding-left: 8px; border-left: 1px solid var(--a-side-line); }
.js .nav-item:not(.on) > .nav-sub { display: none; }
body.admin .nav-sub a { font-size: 13px; padding: 5px 10px; border-radius: 8px; color: var(--a-side-dim); text-decoration: none; font-weight: 500; }
body.admin .nav-sub a:hover { color: var(--a-side-fg); }
body.admin .nav-sub a.on { color: var(--a-side-on-fg); font-weight: 600; }
:root[data-mode="dark"] body.admin .nav-sub a.on { color: var(--a-gold); }
.side-me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 0; border-top: 1px solid var(--a-side-line); font-size: 12px; min-width: 0; }
.side-me-text { display: flex; flex-direction: column; min-width: 0; }
.side-me-text b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-me-text small { color: var(--a-side-dim); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--a-navy); color: #FFFFFF; font-weight: 700; font-size: 11.5px; }
:root[data-mode="dark"] .avatar { background: var(--a-gold); color: #2B2D50; }
.side-scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); z-index: 39; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px; padding: 12px 28px;
  background: var(--a-bar-bg); border-bottom: 1px solid var(--a-line);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
.topbar-gap { flex: 1; }
.search { flex: 0 1 440px; min-width: 0; display: flex; align-items: center; gap: 8px; background: var(--a-surface-2); border: 1px solid var(--a-line); border-radius: 999px; padding: 0 12px; color: var(--a-faint); margin: 0; }
body.admin .search input { border: 0; background: transparent; outline: 0; margin: 0; padding: 9px 0; font-size: 13.5px; min-width: 0; flex: 1; color: var(--a-fg); }
.search kbd { font: inherit; font-size: 11px; border: 1px solid var(--a-line); border-radius: 5px; padding: 0 5px; color: var(--a-faint); }
.icon-btn { width: 36px; height: 36px; border-radius: 999px; display: grid; place-items: center; border: 1px solid var(--a-line); background: var(--a-surface); color: var(--a-muted); cursor: pointer; flex: none; padding: 0; }
.icon-btn:hover { color: var(--a-fg); }
.menu-btn { display: none; }
.content { padding: 28px; max-width: 1320px; width: 100%; }
.content > :first-child { margin-top: 0; }

/* ---------- Buttons ---------- */
body.admin .button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 8px 18px; border-radius: 999px;
  background: var(--a-btn-bg); color: var(--a-btn-fg); border: 1px solid transparent; box-shadow: none;
  font: inherit; font-weight: 600; font-size: 13.5px; line-height: 1.2; text-decoration: none; white-space: nowrap; cursor: pointer;
}
body.admin .button:hover, .btn:hover { filter: brightness(1.1); }
body.admin .button-secondary, .btn-secondary { background: var(--a-surface); color: var(--a-fg); border: 1px solid var(--a-line); box-shadow: none; }
body.admin .button-secondary:hover, .btn-secondary:hover { filter: none; border-color: var(--a-faint); }
.btn-primary { background: var(--a-btn-bg); color: var(--a-btn-fg); }
.btn-sm, body.admin .actions .btn-sm { min-height: 30px; padding: 4px 12px; font-size: 12.5px; }
body.admin .actions .button { padding: 8px 18px; }
body.admin button:disabled, body.admin .button[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }

/* ---------- Forms ---------- */
body.admin input[type="text"], body.admin input[type="email"], body.admin input[type="tel"], body.admin input[type="date"],
body.admin input[type="number"], body.admin input[type="url"], body.admin input[type="search"]:not(.search input), body.admin input:not([type]), body.admin textarea, body.admin select {
  background: var(--a-surface); color: var(--a-fg); border: 1px solid var(--a-line); border-radius: var(--a-r-sm); padding: 9px 12px; font-size: 14px;
}
body.admin input:focus, body.admin textarea:focus, body.admin select:focus { outline: 2px solid var(--a-focus); outline-offset: 0; border-color: transparent; }
body.admin .search input:focus { outline: 0; }
body.admin .search:focus-within { outline: 2px solid var(--a-focus); }
body.admin input[type="checkbox"], body.admin input[type="radio"] { accent-color: var(--a-navy); }
:root[data-mode="dark"] body.admin input[type="checkbox"], :root[data-mode="dark"] body.admin input[type="radio"] { accent-color: var(--a-gold); }
body.admin .field > label, body.admin .field .label { color: var(--a-muted); font-size: 12.5px; }
body.admin .money span { color: var(--a-muted); }
.form-alert, body.admin .form-alert { background: var(--a-bad-bg); color: var(--a-bad); border-radius: var(--a-r-sm); padding: 12px 16px; font-weight: 600; margin: 0 0 16px; }
body.admin .field-error { color: var(--a-bad); }

/* ---------- Page bits used across the existing pages ---------- */
.note, body.admin .note { color: var(--a-muted); font-size: 13px; }
.title-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.title-row h1 { margin: 0; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--a-muted); margin: 4px 0 0; }
.crumbs { font-size: 12px; color: var(--a-faint); margin-bottom: 4px; }
body.admin .crumbs a { color: var(--a-muted); text-decoration: none; font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 12px; }
form.inline { display: inline-flex; margin: 0; }

.card, body.admin .card, .panel, body.admin .panel {
  background: var(--a-surface); border: 1px solid var(--a-card-line); border-radius: var(--a-r); box-shadow: var(--a-shadow); padding: 0; min-width: 0;
}
body.admin .panel { padding: 16px 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 0; flex-wrap: wrap; }
body.admin .card-head h2 { margin: 0; font-size: 15px; }
.card-body { padding: 14px 18px 18px; }
.card-link { font-size: 12.5px; font-weight: 600; text-decoration: none; }

/* Tables */
body.admin table.data {
  width: 100%; border-collapse: separate; border-spacing: 0; background: var(--a-surface);
  border: 1px solid var(--a-card-line); border-radius: var(--a-r); box-shadow: var(--a-shadow); overflow: hidden; font-size: 13.5px;
}
body.admin table.data th { text-align: left; font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--a-faint); font-weight: 600; padding: 11px 16px; border-bottom: 1px solid var(--a-line); white-space: nowrap; background: var(--a-surface); }
body.admin table.data td { padding: 12px 16px; border-bottom: 1px solid var(--a-line); vertical-align: top; }
body.admin table.data tbody tr:last-child td { border-bottom: 0; }
body.admin table.data tbody tr:hover td { background: var(--a-surface-2); }
.card table.data, body.admin .card table.data { border: 0; box-shadow: none; border-radius: 0 0 var(--a-r) var(--a-r); }
.table-wrap { overflow-x: auto; border-radius: var(--a-r); }
td.r, th.r { text-align: right; }

/* Status pills */
body.admin .pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--a-surface-2); color: var(--a-muted); border: 1px solid var(--a-line); text-decoration: none; }
body.admin .pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
body.admin a.pill::before { display: none; }
body.admin .pill-done, body.admin .status-accepted, body.admin .status-paid, body.admin .pill.ok { background: var(--a-ok-bg); color: var(--a-ok); border-color: transparent; }
body.admin .pill-todo, body.admin .status-in_review, body.admin .pill.warn { background: var(--a-warn-bg); color: var(--a-warn); border-color: transparent; }
body.admin .status-approved, body.admin .pill.info { background: var(--a-info-bg); color: var(--a-info); border-color: transparent; }
body.admin .status-sent, body.admin .status-viewed { background: var(--a-violet-bg); color: var(--a-violet); border-color: transparent; }
body.admin .status-expired, body.admin .status-withdrawn, body.admin .pill.bad { background: var(--a-bad-bg); color: var(--a-bad); border-color: transparent; }
body.admin .status-draft { background: var(--a-surface-2); color: var(--a-muted); }
/* A notice at the top of a page after saving */
body.admin .content > .pill.pill-done:first-child, body.admin p.pill.pill-done, body.admin p.notice { display: flex; width: fit-content; padding: 8px 14px; font-size: 13px; margin: 0 0 16px; }

/* Section badges in the editor and style guide: a soft tint in the admin */
body.admin .badge { background: var(--a-navy-soft); color: var(--a-accent); }

/* Filter chips */
.filters, body.admin .filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 16px; }
body.admin .filters a { padding: 5px 13px; border-radius: 999px; background: var(--a-surface); border: 1px solid var(--a-line); text-decoration: none; font-weight: 600; font-size: 12.5px; color: var(--a-muted); }
body.admin .filters a:hover { color: var(--a-fg); }
body.admin .filters a.active { background: var(--a-btn-bg); color: var(--a-btn-fg); border-color: transparent; }

/* Facts (label and value tiles) */
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin: 16px 0; }
.facts div { background: var(--a-surface); border: 1px solid var(--a-card-line); border-radius: 12px; padding: 12px 14px; }
.facts span { display: block; font-size: 12px; color: var(--a-muted); margin-bottom: 2px; }

.two-col { display: grid; gap: 28px; grid-template-columns: 1fr; }
@media (min-width: 1100px) { .two-col { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); } }
dl.answers { margin: 0; }
dl.answers dt { font-weight: 600; color: var(--a-muted); font-size: 12.5px; margin-top: 14px; }
dl.answers dd { margin: 2px 0 0; white-space: pre-wrap; }
.internal-form .field { margin-bottom: 14px; }
body.admin .internal-form label { display: block; font-weight: 600; color: var(--a-muted); font-size: 12.5px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0 20px; }
.inline-form input { width: auto; flex: 1 1 180px; margin: 0; }
.copy-field { font-size: 12px; padding: 6px 8px; margin: 0; }
.status-list { padding-left: 1.1em; }
.status-list li { margin-bottom: 6px; }
.checklist { background: var(--a-warn-bg); color: var(--a-fg); border-radius: var(--a-r-sm); padding: 12px 16px; margin: 12px 0; }
.checklist ul { margin: 6px 0 0; padding-left: 1.2em; }
.note-form { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.note-form textarea { flex: 1 1 300px; }
.timeline { list-style: none; padding: 0; margin: 8px 0 24px; }
.timeline li { border-left: 2px solid var(--a-line); padding: 4px 0 12px 14px; }
.timeline li p { margin: 4px 0 0; white-space: pre-wrap; }
table.changes td { font-size: 12.5px; vertical-align: top; word-break: break-word; }
body.admin details summary { cursor: pointer; font-weight: 600; margin-bottom: 8px; }
.acceptance-box { background: var(--a-ok-bg); border-radius: var(--a-r); padding: 14px 18px; margin: 16px 0; }
body.admin .acceptance-box h2 { margin-top: 0; }
.plans { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin: 8px 0 16px; }
.plan { background: var(--a-surface); border: 1px solid var(--a-card-line); border-radius: 12px; padding: 12px 14px; }
.plan ul { margin: 6px 0; padding-left: 1.1em; font-size: 13px; }
body.admin .banner { background: var(--a-surface-2); }

/* Editor */
.editor { max-width: 1100px; }
.ed-nav { position: sticky; top: 61px; z-index: 5; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; background: var(--a-bar-bg); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); padding: 10px 0; border-bottom: 1px solid var(--a-line); }
body.admin .ed-nav a { font-weight: 600; text-decoration: none; font-size: 13px; }
.ed-nav .button { margin-left: auto; }
.ed-section { padding: 28px 0 8px; border-bottom: 1px solid var(--a-line); }
body.admin .ed-section h2 { margin-top: 4px; }
.ed-grid { display: grid; gap: 12px 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-bottom: 12px; }
.ed-field { display: block; margin-bottom: 12px; }
.ed-field > span { display: block; font-weight: 600; color: var(--a-muted); font-size: 12.5px; margin-bottom: 2px; }
.ed-field small { display: block; color: var(--a-faint); font-size: 12px; }
.ed-field.wide { grid-column: 1 / -1; }
.ed-card { border: 1px solid var(--a-card-line); border-radius: 14px; padding: 14px 16px; margin: 0 0 14px; background: var(--a-surface); box-shadow: var(--a-shadow); }
.ed-card legend { font-weight: 700; color: var(--a-fg); padding: 0 6px; }
.ed-card > input, .ed-card > textarea { margin-bottom: 8px; }
.ed-rows { width: 100%; border-collapse: collapse; }
.ed-rows th { text-align: left; font-size: 12px; color: var(--a-muted); font-weight: 600; padding: 4px; }
.ed-rows td { padding: 2px 4px; vertical-align: top; }
.ed-rows td:first-child { white-space: nowrap; }
.ed-rows input { margin: 0; }
.ed-check { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0; font-weight: 500; }
.ed-check input { width: 18px; height: 18px; margin-top: 3px; }
.ed-save { padding: 24px 0 64px; }
.money-field .money { max-width: none; }
.pick-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin: 12px 0 20px; }
.pick { display: flex; flex-direction: column; gap: 4px; background: var(--a-surface); border: 1px solid var(--a-card-line); border-radius: 12px; padding: 10px; cursor: pointer; }
.pick img { width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 8px; background: var(--a-surface-2); }
.pick.inactive { opacity: 0.55; }
.pick small { color: var(--a-muted); }
.no-grab { display: flex; align-items: center; justify-content: center; aspect-ratio: 16 / 10; background: var(--a-surface-2); border-radius: 8px; color: var(--a-muted); font-size: 13px; }
.grab-large { max-width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--a-line); }

/* Libraries */
.lib-index { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.lib-index li { background: var(--a-surface); border: 1px solid var(--a-card-line); border-radius: 14px; box-shadow: var(--a-shadow); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
body.admin .lib-index a { font-weight: 700; text-decoration: none; color: var(--a-fg); }
.lib-form { margin: 16px 0 32px; }
.lib-form textarea.wide { width: 100%; }
.email-preview { background: var(--a-surface); border: 1px solid var(--a-line); border-radius: 12px; padding: 16px; margin-bottom: 12px; }

/* Pricing */
.suggested { white-space: nowrap; }
.suggestion { display: block; color: var(--a-muted); font-size: 12px; margin-top: 2px; }
.use-suggestion { font: inherit; font-size: 11.5px; font-weight: 600; color: var(--a-accent); background: var(--a-navy-soft); border: 1px solid var(--a-line); border-radius: 999px; padding: 1px 10px; cursor: pointer; }
body.admin input.needs-price { border: 1px dashed var(--a-warn); background: var(--a-warn-bg); }

/* ---------- Dashboard ---------- */
.dash { display: flex; flex-direction: column; gap: 20px; }
.dash .page-head { margin-bottom: 0; }
.stats { display: grid; gap: 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
body.admin .stat { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: inherit; }
body.admin a.stat { color: var(--a-fg); }
body.admin a.stat:hover { border-color: var(--a-line); }
.stat-k { font-size: 12px; color: var(--a-muted); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.stat-v { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.stat-d { font-size: 12px; color: var(--a-muted); }
.ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--a-navy-soft); color: var(--a-accent); }
.ico.gold { background: var(--a-gold-soft); color: var(--a-warn); }
.ico.bad { background: var(--a-bad-bg); color: var(--a-bad); }
.ico.ok { background: var(--a-ok-bg); color: var(--a-ok); }
.ico .i { width: 16px; height: 16px; }
.dash-grid { display: grid; gap: 20px; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--a-line); }
.row:last-child { border-bottom: 0; padding-bottom: 0; }
.row:first-child { padding-top: 0; }
.row-t { flex: 1; min-width: 0; }
.row-t b { display: block; font-weight: 600; }
.row-t small { color: var(--a-muted); font-size: 12.5px; }
.empty { color: var(--a-muted); padding: 6px 0; }
.num { font-variant-numeric: tabular-nums; }

/* Search results */
.results { display: grid; gap: 20px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }


/* ---------- Clients and pipeline (Stage C) ---------- */
.callout { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; background: var(--a-info-bg); color: var(--a-fg); border-radius: var(--a-r-sm); padding: 12px 16px; margin: 0 0 16px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 0 0 14px; }
.toolbar .filters { margin: 0; }
body.admin .filters a .n { opacity: 0.7; margin-left: 2px; }
.mini-search { margin: 0; }
body.admin .mini-search input { width: 240px; max-width: 100%; border-radius: 999px; padding: 7px 14px; font-size: 13px; margin: 0; }
body.admin a.who { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--a-fg); }
.who b { display: block; font-weight: 600; }
.who small { display: block; color: var(--a-muted); font-size: 12px; }
body.admin .avatar.soft { background: var(--a-navy-soft); color: var(--a-accent); }
.empty-card { padding: 28px 22px; color: var(--a-muted); }
.form-card { padding: 6px 22px 18px; max-width: 980px; }
.form-card h2 { margin-top: 18px; }
body.admin .h-pills { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
body.admin .h-pills .pill { font-size: 12px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--a-line); margin: 0 0 20px; overflow-x: auto; }
body.admin .tabs a { padding: 10px 14px; font-weight: 600; color: var(--a-muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
body.admin .tabs a.on { color: var(--a-accent); border-color: var(--a-gold); }
.tag { font-size: 11px; font-weight: 600; color: var(--a-muted); background: var(--a-surface-2); border: 1px solid var(--a-line); border-radius: 6px; padding: 0 6px; }
.split { display: grid; gap: 20px; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.card-flush { padding-top: 10px; }
.card-flush table.data { border-top: 1px solid var(--a-line); }
.kv { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px 14px; margin: 0; font-size: 13.5px; }
.kv dt { color: var(--a-muted); }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.bad-text { color: var(--a-bad); }
.note-body { white-space: pre-wrap; font-weight: 500 !important; }
body.admin a.row { text-decoration: none; color: inherit; }
.stage-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
body.admin .stage-form select, body.admin .stage-form input { margin: 0; width: auto; flex: 1 1 140px; padding: 7px 10px; font-size: 13px; }

.board { display: grid; grid-template-columns: repeat(5, minmax(210px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.col { background: var(--a-surface-2); border: 1px solid var(--a-line); border-radius: var(--a-r); padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 160px; }
.col.drop { outline: 2px dashed var(--a-accent); outline-offset: -4px; }
body.admin .col h3 { margin: 0; font-size: 13.5px; display: flex; justify-content: space-between; align-items: center; }
.col h3 small { color: var(--a-muted); font-weight: 600; }
.col-sum { margin: -6px 0 0; font-size: 12px; color: var(--a-muted); }
.deal { background: var(--a-surface); border: 1px solid var(--a-card-line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--a-shadow); }
.js .deal { cursor: grab; }
.deal.dragging { opacity: 0.5; }
body.admin .deal-name { font-weight: 600; color: var(--a-fg); text-decoration: none; }
.deal-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--a-muted); }
.deal-move { display: flex; gap: 6px; margin: 4px 0 0; }
body.admin .deal-move select { margin: 0; padding: 4px 8px; font-size: 12px; flex: 1; min-width: 0; }
.js .deal-move button { display: none; }


/* ---------- Projects and services (Stage D) ---------- */
.cards-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
body.admin a.proj-card { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px; text-decoration: none; color: var(--a-fg); }
.proj-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.proj-now { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; }
.stagebar { display: flex; gap: 4px; min-width: 120px; }
.stagebar span { flex: 1; height: 6px; border-radius: 999px; background: var(--a-line); }
.stagebar .sb-done { background: var(--a-ok); }
.stagebar .sb-in_progress { background: var(--a-gold); }
.stagebar .sb-waiting_client { background: var(--a-warn); }
.stage-list { display: flex; flex-direction: column; }
.stage-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--a-line); }
.stage-row:last-child { border-bottom: 0; }
.stage-n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12px; background: var(--a-surface-2); border: 2px solid var(--a-line); color: var(--a-muted); }
.st-done .stage-n { background: var(--a-ok); border-color: var(--a-ok); color: #FFFFFF; }
.st-in_progress .stage-n { background: var(--a-gold); border-color: var(--a-gold); color: #2B2D50; }
.st-waiting_client .stage-n { background: var(--a-warn-bg); border-color: var(--a-warn); color: var(--a-warn); }
.stage-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.stage-line { display: grid; grid-template-columns: minmax(0, 1fr) 140px 170px; gap: 8px; }
body.admin .stage-main input, body.admin .stage-main select, body.admin .stage-main textarea { margin: 0; padding: 7px 10px; font-size: 13.5px; }
body.admin .stage-main textarea { min-height: 38px; }
body.admin .stage-title { font-weight: 600; }
.stage-del { font-size: 12px; color: var(--a-muted); display: flex; gap: 4px; align-items: center; padding-top: 8px; white-space: nowrap; }
.stage-new .stage-line { grid-template-columns: minmax(0, 1fr) 140px; }
.link-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.link-row { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 8px; }
body.admin .link-row input { margin: 0; }
.link-row .field-error { grid-column: 1 / -1; margin: 0; }
@media (max-width: 760px) {
  .stage-line, .stage-new .stage-line { grid-template-columns: minmax(0, 1fr); }
  .stage-row { grid-template-columns: 28px minmax(0, 1fr); }
  .stage-del { grid-column: 2; padding-top: 0; }
  .link-row { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Small screens ---------- */
@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid, .results, .split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 272px; z-index: 40; transform: translateX(-100%); transition: transform 0.2s; background: var(--a-surface); }
  :root[data-mode="dark"] .side { background: var(--a-side-bg); }
  .side.open { transform: none; }
  .menu-btn { display: grid; }
  .ed-nav { top: 61px; }
}
@media (max-width: 640px) {
  .content { padding: 18px 16px 40px; }
  .topbar { padding: 10px 16px; gap: 8px; }
  .search { flex: 1 1 auto; }
  .topbar .btn { padding: 8px 10px; }
  .stats { grid-template-columns: minmax(0, 1fr); }
  .hide-sm { display: none; }
  body.admin table.data { display: block; overflow-x: auto; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }
