/* PBC Tracker design system: tokens, app shell, components. One file, no build step. */

/* ---------------------------------------------------------------- tokens */
:root {
  /* neutrals carry a slight blue-green hue */
  --bg: #f4f6f7;
  --surface: #ffffff;
  --surface-2: #f7f9fa;
  --surface-3: #eef2f4;
  --line: #dfe5e8;
  --line-strong: #c8d1d6;
  --text: #13212b;
  --text-2: #33434e;
  --muted: #5c6c77;
  --faint: #8796a0;

  /* brand: ink navy and audit teal */
  --ink: #0f2430;
  --ink-2: #16313f;
  --ink-3: #1e3e4e;
  --ink-text: #c3d2d9;
  --brand: #0d5c63;
  --brand-hover: #0a4b51;
  --brand-strong: #083a3f;
  --brand-50: #e8f3f3;
  --brand-100: #cde5e5;
  --accent: #2fa69a;

  /* semantic */
  --ok: #18794a;     --ok-bg: #e5f4eb;     --ok-line: #b7dfc7;
  --warn: #8a5300;   --warn-bg: #fdf3df;   --warn-line: #f1d59b;
  --bad: #b42318;    --bad-bg: #fdecea;    --bad-line: #f5c2bc;
  --info: #1d5aa6;   --info-bg: #e8f0fb;   --info-line: #bed3f1;
  --violet: #5f3aa8; --violet-bg: #f0ebfa; --violet-line: #d4c6f1;
  --orange: #b0400f; --orange-bg: #fdede4; --orange-line: #f5c8ae;
  --grey: #55636d;   --grey-bg: #eef1f3;   --grey-line: #d5dce0;

  /* type */
  --font: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-base: 14px;
  --fs-md: 16px;
  --fs-lg: 18px;
  --fs-xl: 22px;
  --fs-2xl: 28px;
  --fs-3xl: 40px;

  /* spacing */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;
  --s-12: 48px;
  --s-16: 64px;

  --r-sm: 4px;
  --r: 6px;
  --r-lg: 10px;
  --r-xl: 14px;
  --r-pill: 999px;

  --shadow-xs: 0 1px 2px rgba(15, 36, 48, 0.06);
  --shadow-sm: 0 1px 2px rgba(15, 36, 48, 0.06), 0 1px 3px rgba(15, 36, 48, 0.08);
  --shadow: 0 4px 12px rgba(15, 36, 48, 0.08), 0 1px 3px rgba(15, 36, 48, 0.06);
  --shadow-lg: 0 18px 48px rgba(15, 36, 48, 0.16), 0 4px 12px rgba(15, 36, 48, 0.08);
  --focus: 0 0 0 3px rgba(47, 166, 154, 0.45);

  --sidebar-w: 248px;
  --topbar-h: 56px;
  --content-max: 1240px;
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: var(--fs-base)/1.5 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { color: var(--text); margin: 0 0 var(--s-2); line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: var(--fs-xl); }
h2 { font-size: var(--fs-lg); margin-top: var(--s-6); }
h3 { font-size: var(--fs-md); margin-top: var(--s-4); }
p { margin: 0 0 var(--s-3); }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); text-decoration: underline; text-underline-offset: 2px; }
code, kbd { overflow-wrap: anywhere; font-family: var(--mono); font-size: 0.92em; background: var(--surface-3); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 0 4px; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s-6) 0; }
ol, ul { padding-left: 1.3em; margin: 0 0 var(--s-3); }
li + li { margin-top: 4px; }
img, svg { vertical-align: middle; }
svg[viewBox="0 0 24 24"] { width: 1.15em; height: 1.15em; flex-shrink: 0; }
h2 > svg, h3 > svg { width: 18px; height: 18px; margin-right: 2px; vertical-align: -3px; color: var(--muted); }
.tabs a svg { width: 15px; height: 15px; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
::selection { background: var(--brand-100); }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small, small { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 0.92em; }
.num, .tabular { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.stack > * + * { margin-top: var(--s-4); }
.row { display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: var(--s-3); align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grow { flex: 1 1 auto; }
.row > select { flex: 1 1 220px; min-width: 0; width: 100%; }
.row-between > form.row { flex: 1 1 320px; min-width: 0; }
.row > select + button { flex: 0 0 auto; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); }
.mt-0 { margin-top: 0; }
.mt-4 { margin-top: var(--s-4); }
.mt-6 { margin-top: var(--s-6); }
.mb-0 { margin-bottom: 0; }
.pre { white-space: pre-wrap; }

/* ---------------------------------------------------------------- app shell */
.app { display: flex; min-height: 100vh; }
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }

.sidebar {
  position: sticky; top: 0; height: 100vh; flex: 0 0 var(--sidebar-w); width: var(--sidebar-w);
  background: var(--ink); color: var(--ink-text);
  display: flex; flex-direction: column; overflow-y: auto; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 8px; flex: 0 0 32px;
  background: linear-gradient(140deg, var(--accent), var(--brand) 70%);
  display: grid; place-items: center; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15);
}
.brand-mark svg { width: 18px; height: 18px; stroke: #fff; }
.brand-name { font-weight: 650; font-size: 15px; letter-spacing: -0.01em; line-height: 1.15; }
.brand-name small { display: block; font-weight: 400; font-size: 11.5px; color: #8fa7b2; letter-spacing: 0; }

.nav { padding: 6px 10px 12px; }
.nav-group { margin-top: 14px; }
.nav-label { padding: 0 10px 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: #7f98a4; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; margin: 1px 0;
  color: var(--ink-text); border-radius: var(--r); font-weight: 500; font-size: 13.5px; position: relative;
}
.nav a:hover { background: rgba(255,255,255,0.06); color: #fff; text-decoration: none; }
.nav a[aria-current="page"] { background: rgba(47,166,154,0.16); color: #fff; }
.nav a[aria-current="page"]::before { content: ""; position: absolute; left: -10px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav svg { width: 18px; height: 18px; flex: 0 0 18px; stroke: currentColor; opacity: 0.9; }
.nav .badge { margin-left: auto; }
.badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: var(--r-pill); font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums;
  background: var(--accent); color: #062a2d;
}
.badge.zero { background: rgba(255,255,255,0.08); color: #8fa7b2; }
.sidebar-foot { margin-top: auto; padding: 12px 10px 14px; border-top: 1px solid rgba(255,255,255,0.08); }
.user { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 30px; display: grid; place-items: center;
  background: var(--ink-3); color: #fff; font-weight: 600; font-size: 12px; text-transform: uppercase;
}
.user-email { font-size: 12.5px; color: #dbe6ea; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.user-email small { display: block; color: #7f98a4; font-size: 11px; }
.signout { margin: 4px 10px 0; }
.signout button {
  width: 100%; justify-content: center; background: transparent; color: var(--ink-text);
  border: 1px solid rgba(255,255,255,0.14);
}
.signout button:hover { background: rgba(255,255,255,0.06); color: #fff; border-color: rgba(255,255,255,0.24); }
.residency { display: flex; gap: 8px; align-items: center; padding: 8px 10px 0; font-size: 11.5px; color: #7f98a4; }
.residency svg { width: 14px; height: 14px; stroke: currentColor; }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--s-3); padding: 0 var(--s-6);
  background: rgba(255,255,255,0.92); backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar .menu-btn { display: none; }
.topbar .brand-mini { display: none; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--muted); min-width: 0; overflow: hidden; white-space: nowrap; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { color: var(--faint); }
.crumbs [aria-current] { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: var(--s-2); flex: 0 0 auto; }

.sync {
  display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 10px; border-radius: var(--r-pill);
  font-size: 12.5px; font-weight: 500; border: 1px solid var(--line); background: var(--surface); color: var(--text-2);
  white-space: nowrap; max-width: 46vw; overflow: hidden; text-overflow: ellipsis;
}
.sync::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: 0 0 7px; }
.sync.ok::before { background: #22a061; box-shadow: 0 0 0 3px rgba(34,160,97,0.15); }
.sync.off::before { background: #c0911f; }
.sync.bad { color: var(--bad); border-color: var(--bad-line); background: var(--bad-bg); }
.sync.bad::before { background: var(--bad); }
a.sync:hover { text-decoration: none; border-color: var(--line-strong); color: var(--text); }
a.sync.bad:hover { color: var(--bad); }

.content { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: var(--s-6) var(--s-6) var(--s-16); }
.nav-scrim { display: none; }

/* ---------------------------------------------------------------- page header */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-4); margin-bottom: var(--s-6); flex-wrap: wrap; }
.page-header h1 { font-size: var(--fs-2xl); margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-header .desc { color: var(--muted); margin: 6px 0 0; max-width: 72ch; font-size: 14.5px; }
.page-header .eyebrow { font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--brand); margin-bottom: 6px; }
.page-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; align-items: center; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); margin: var(--s-8) 0 var(--s-3); flex-wrap: wrap; }
.section-title h2 { margin: 0; }
.section-title .muted { font-size: var(--fs-sm); }

/* ---------------------------------------------------------------- buttons */
button, .btn, .button {
  font: inherit; font-size: var(--fs-sm); font-weight: 500; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: var(--r); cursor: pointer; white-space: nowrap;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  text-decoration: none; box-shadow: var(--shadow-xs);
  transition: background-color .12s, border-color .12s, color .12s, box-shadow .12s;
}
button:hover, .btn:hover, .button:hover { background: var(--surface-2); border-color: #b3bfc6; color: var(--text); text-decoration: none; }
button:active, .btn:active, .button:active { transform: translateY(0.5px); }
button:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
button svg, .btn svg, .button svg { width: 16px; height: 16px; stroke: currentColor; flex: 0 0 16px; }
.btn-primary, button.primary, .button.primary {
  background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(8,58,63,0.3);
}
.btn-primary:hover, button.primary:hover, .button.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }
.btn-secondary { background: var(--surface); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--brand); }
.btn-ghost:hover { background: var(--brand-50); border-color: transparent; color: var(--brand-hover); }
.btn-danger { color: var(--bad); border-color: var(--bad-line); background: var(--surface); }
.btn-danger:hover { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.btn-sm { height: 28px; padding: 0 10px; font-size: var(--fs-xs); }
.btn-lg { height: 42px; padding: 0 20px; font-size: var(--fs-base); border-radius: 8px; }
.btn-block { width: 100%; }
form.inline { display: inline; }
.btn-group { display: inline-flex; gap: var(--s-2); flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------------- forms */
label { display: block; margin: 0 0 5px; font-weight: 500; font-size: var(--fs-sm); color: var(--text-2); }
label.inline, .check { display: inline-flex; align-items: center; gap: 7px; margin: 0; font-weight: 500; }
input, select, textarea {
  font: inherit; font-size: var(--fs-base); color: var(--text);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r);
  padding: 7px 10px; min-height: 36px; max-width: 100%;
  transition: border-color .12s, box-shadow .12s;
}
textarea { min-height: 0; line-height: 1.5; width: 100%; resize: vertical; }
select { padding-right: 30px; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235c6c77' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
input:hover, select:hover, textarea:hover { border-color: #aab7be; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
input[type="checkbox"], input[type="radio"] { min-height: 0; width: 16px; height: 16px; padding: 0; accent-color: var(--brand); box-shadow: none; }
input[type="file"] { padding: 5px; font-size: var(--fs-sm); background: var(--surface-2); }
input[type="file"]::file-selector-button {
  font: inherit; font-size: var(--fs-xs); font-weight: 500; border: 1px solid var(--line-strong); background: var(--surface);
  border-radius: var(--r-sm); padding: 5px 10px; margin-right: 10px; cursor: pointer; color: var(--text);
}
input[readonly], textarea[readonly] { background: var(--surface-2); }
.field { margin-bottom: var(--s-4); }
.field > input:not([type="checkbox"]):not([type="radio"]), .field > select, .field > textarea { width: 100%; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 var(--s-4); }
.help { display: block; color: var(--muted); font-size: var(--fs-sm); margin-top: 5px; font-weight: 400; }
.form-actions { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; margin-top: var(--s-5); padding-top: var(--s-4); border-top: 1px solid var(--line); }
.form-narrow { max-width: 640px; }
.form-medium { max-width: 760px; }
.push-right { margin-left: auto; }
.toolbar .tb-narrow { min-width: 100px; flex: 0 1 120px; }
.nav-flush { padding: 0; }
fieldset { border: 0; padding: 0; margin: 0 0 var(--s-4); }
legend { font-weight: 600; margin-bottom: var(--s-2); }
.code-box { font-family: var(--mono); font-size: 12px; line-height: 1.55; }

/* ---------------------------------------------------------------- cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-header h2, .card-header h3 { margin: 0; font-size: 15px; }
.card-header .muted { font-size: var(--fs-sm); }
.card-body { padding: 18px; }
.card-body > :last-child { margin-bottom: 0; }
.card-footer { padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.card + .card { margin-top: var(--s-4); }
.card-flush .table th:first-child, .card-flush .table td:first-child { padding-left: 18px; }
.card-flush .table th:last-child, .card-flush .table td:last-child { padding-right: 18px; }
/* legacy: <div class="cards"><div class="card"><div class="n">..</div>label</div></div> */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s-3); margin: var(--s-3) 0 var(--s-4); }
.cards > .card { padding: 14px 16px; }
.card .n { font-size: var(--fs-xl); font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.2; }
.cards .card a { color: inherit; text-decoration: none; display: block; }

/* ---------------------------------------------------------------- KPI */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-4); margin-bottom: var(--s-6); }
.kpi {
  display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px 18px; color: inherit; box-shadow: var(--shadow-xs); position: relative; overflow: hidden;
}
a.kpi:hover { text-decoration: none; border-color: var(--line-strong); box-shadow: var(--shadow-sm); color: inherit; }
.kpi-label { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--muted); font-weight: 500; }
.kpi-label svg { width: 16px; height: 16px; stroke: currentColor; }
.kpi-value { font-size: 30px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; margin-top: 8px; color: var(--text); }
.kpi-sub { font-size: var(--fs-xs); color: var(--muted); margin-top: 4px; }
.kpi::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--line); }
.kpi.tone-warn::after { background: #e0a43a; }
.kpi.tone-violet::after { background: #8a68d1; }
.kpi.tone-bad::after { background: #d9534a; }
.kpi.tone-ok::after { background: #2a9d63; }
.kpi.tone-info::after { background: #4c86d6; }

.queue-tile { display: flex; align-items: center; gap: 14px; }
.queue-tile .kpi-value { margin: 0; }
.queue-tile strong { color: var(--text); }
.qt-icon { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 10px; display: grid; place-items: center; }
.qt-icon svg { width: 20px; height: 20px; stroke: currentColor; }
.qt-violet { background: var(--violet-bg); color: var(--violet); }
.qt-warn { background: var(--warn-bg); color: var(--warn); }
.qt-info { background: var(--info-bg); color: var(--info); }
.setup-progress { min-width: 160px; }
.card-body-tight { padding-top: 4px; padding-bottom: 4px; }

/* ---------------------------------------------------------------- progress */
.progress { display: block; }
.progress-track { height: 8px; background: var(--surface-3); border-radius: var(--r-pill); overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--accent), var(--ok)); border-radius: var(--r-pill); min-width: 0; transition: width .3s; }
.progress-meta { display: flex; justify-content: space-between; gap: var(--s-2); font-size: var(--fs-xs); color: var(--muted); margin-top: 6px; font-variant-numeric: tabular-nums; }
.progress-meta.top { margin: 0 0 6px; }
.progress-meta strong { color: var(--text); font-weight: 600; }
.progress-lg .progress-track { height: 10px; }
.stackbar { display: flex; height: 10px; border-radius: var(--r-pill); overflow: hidden; background: var(--surface-3); }
.stackbar > span { display: block; height: 100%; }
.seg-open { background: #e6b04f; }
.seg-received_auto { background: #4c86d6; }
.seg-received_review { background: #8a68d1; }
.seg-follow_up { background: #e0703e; }
.seg-accepted { background: #2a9d63; }
.seg-not_applicable { background: #b7c2c8; }

/* ---------------------------------------------------------------- chips */
.chip, .pill {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px;
  border-radius: var(--r-pill); font-size: 12px; font-weight: 500; line-height: 1; white-space: nowrap;
  border: 1px solid var(--grey-line); background: var(--grey-bg); color: var(--grey);
  vertical-align: middle;
}
.chip::before, .pill.open::before, .pill.received_auto::before, .pill.received_review::before,
.pill.accepted::before, .pill.follow_up::before, .pill.not_applicable::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 6px;
}
.chip.no-dot::before { display: none; }
.chip-open, .pill.open { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.chip-received_auto, .pill.received_auto { background: var(--info-bg); border-color: var(--info-line); color: var(--info); }
.chip-received_review, .pill.received_review { background: var(--violet-bg); border-color: var(--violet-line); color: var(--violet); }
.chip-follow_up, .pill.follow_up { background: var(--orange-bg); border-color: var(--orange-line); color: var(--orange); }
.chip-accepted, .pill.accepted { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.chip-not_applicable, .pill.not_applicable { background: var(--grey-bg); border-color: var(--grey-line); color: var(--grey); }
.chip-ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.chip-warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.chip-bad { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad); }
.chip-info { background: var(--info-bg); border-color: var(--info-line); color: var(--info); }
.chip-violet { background: var(--violet-bg); border-color: var(--violet-line); color: var(--violet); }
.chip-neutral, .chip-closed { background: var(--grey-bg); border-color: var(--grey-line); color: var(--grey); }
.chip-brand { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand); }
p.chip, div.chip { display: flex; height: auto; min-height: 22px; white-space: normal; line-height: 1.45; padding: 7px 12px; border-radius: var(--r); font-size: var(--fs-sm); margin: 0 0 var(--s-3); }
p.chip::before, div.chip::before { margin-top: 6px; align-self: flex-start; }
.chip-lg { height: 26px; font-size: 13px; padding: 0 11px; }

/* ---------------------------------------------------------------- tables */
table { border-collapse: separate; border-spacing: 0; width: 100%; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-2); letter-spacing: 0.02em; white-space: nowrap; }
tbody tr:last-child td, table tr:last-child td { border-bottom: 0; }
.table { background: var(--surface); }
.table thead th { position: sticky; top: var(--topbar-h); z-index: 2; border-bottom: 1px solid var(--line); }
.table tbody tr:hover td { background: #fafcfc; }
.table td.num, .table th.num { text-align: right; }
.col-progress { min-width: 160px; }
.table .desc-cell { min-width: 240px; max-width: 520px; }
.table .code { font-family: var(--mono); font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.table .sub { color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; }
.table-compact th, .table-compact td { padding: 7px 10px; }
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); }
.table-wrap > table { border-radius: var(--r-lg); }
.table-wrap > table thead th:first-child { border-top-left-radius: var(--r-lg); }
.table-wrap > table thead th:last-child { border-top-right-radius: var(--r-lg); }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll .table thead th { top: 0; }
.card > .table-scroll:last-child table, .card > table:last-child { border-radius: 0 0 var(--r-lg) var(--r-lg); }
tr.muted td { color: var(--faint); }
tr.is-dim td { color: var(--faint); background: var(--surface-2); }
.row-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: nowrap; }

/* ---------------------------------------------------------------- toolbar */
.toolbar {
  display: flex; gap: var(--s-3); align-items: flex-end; flex-wrap: wrap;
  padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  margin-bottom: var(--s-3); box-shadow: var(--shadow-xs);
}
.toolbar .tb-field { display: flex; flex-direction: column; min-width: 140px; }
.toolbar .tb-field label { font-size: 12px; margin-bottom: 4px; }
.toolbar .tb-grow { flex: 1 1 240px; }
.toolbar .tb-grow input { width: 100%; }
.toolbar .tb-actions { display: flex; gap: var(--s-2); align-items: center; margin-left: auto; flex-wrap: wrap; }
.toolbar .tb-count { font-size: var(--fs-sm); color: var(--muted); align-self: center; }
.search-input { position: relative; }
.search-input svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; stroke: var(--faint); pointer-events: none; }
.search-input input { padding-left: 34px; }
.bulkbar { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); border-radius: var(--r-lg) var(--r-lg) 0 0; }
.bulkbar label { margin: 0; }

/* ---------------------------------------------------------------- notices */
.notice {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin: 0 0 var(--s-4);
  border: 1px solid var(--info-line); background: var(--info-bg); color: #18406f; border-radius: var(--r);
  font-size: var(--fs-sm);
}
.notice > div { min-width: 0; }
.notice svg { width: 18px; height: 18px; flex: 0 0 18px; stroke: currentColor; margin-top: 1px; }
.notice a { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.notice ul { margin: 6px 0 0; }
.notice.ok, .notice-ok { border-color: var(--ok-line); background: var(--ok-bg); color: #10522f; }
.notice.warn, .notice-warn { border-color: var(--warn-line); background: var(--warn-bg); color: #6b4100; }
.notice.bad, .notice-bad { border-color: var(--bad-line); background: var(--bad-bg); color: #8a1a12; }
.notice.neutral, .notice-neutral { border-color: var(--line); background: var(--surface-2); color: var(--text-2); }
.error { color: var(--bad); }

/* ---------------------------------------------------------------- empty state */
.empty-state { text-align: center; padding: var(--s-12) var(--s-6); background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--r-lg); }
.empty-state .es-icon { width: 48px; height: 48px; margin: 0 auto var(--s-3); border-radius: 12px; background: var(--brand-50); display: grid; place-items: center; }
.empty-state .es-icon svg { width: 24px; height: 24px; stroke: var(--brand); }
.empty-state h3 { margin: 0 0 6px; font-size: var(--fs-md); }
.empty-state p { color: var(--muted); max-width: 52ch; margin: 0 auto var(--s-4); }
.empty-state .btn-group { justify-content: center; }
.card .empty-state { border: 0; border-radius: 0 0 var(--r-lg) var(--r-lg); padding: var(--s-8) var(--s-6); }

/* ---------------------------------------------------------------- steps / checklist */
/* .steps: a numbered how-to list; plain <li> content is fine. */
.steps { list-style: none; padding: 0; margin: 0 0 var(--s-4); counter-reset: step; }
.steps > li { position: relative; padding: 2px 0 12px 38px; margin: 0; counter-increment: step; color: var(--text-2); }
.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; background: var(--brand-50); color: var(--brand); font-weight: 600; font-size: 12px;
  border: 1px solid var(--brand-100);
}
.steps > li:last-child { padding-bottom: 0; }
/* .checklist: getting-started style rows with a mark, text and an action. */
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist > li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); margin: 0; }
.checklist > li:first-child { border-top: 0; }
.checklist .step-mark {
  flex: 0 0 26px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 600; border: 1.5px solid var(--line-strong); color: var(--muted); background: var(--surface);
}
.checklist .done .step-mark, .checklist > li.done .step-mark { background: var(--ok); border-color: var(--ok); color: #fff; }
.checklist .step-mark svg { width: 14px; height: 14px; stroke: currentColor; }
.checklist .step-body { flex: 1 1 auto; min-width: 0; }
.checklist .step-title { font-weight: 600; color: var(--text); }
.checklist > li.done .step-title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.checklist .step-desc { color: var(--muted); font-size: var(--fs-sm); }
.checklist .step-cta { flex: 0 0 auto; align-self: center; }

/* ---------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 0 0 var(--s-6); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; color: var(--muted); font-weight: 500; font-size: var(--fs-sm);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs a:hover { color: var(--text); text-decoration: none; border-bottom-color: var(--line-strong); }
.tabs a[aria-current="page"], .tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }
.tabs .count { font-size: 11px; background: var(--surface-3); color: var(--muted); border-radius: var(--r-pill); padding: 1px 7px; font-variant-numeric: tabular-nums; }
section[id] { scroll-margin-top: calc(var(--topbar-h) + 16px); }

/* ---------------------------------------------------------------- engagement workspace */
.workspace-head { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px 22px; box-shadow: var(--shadow-xs); margin-bottom: var(--s-4); }
.workspace-head .page-header { margin-bottom: var(--s-4); }
.meta-chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.meta-item { display: inline-flex; gap: 6px; align-items: center; font-size: var(--fs-sm); color: var(--muted); }
.meta-item svg { width: 15px; height: 15px; stroke: currentColor; }
.meta-item strong { color: var(--text-2); font-weight: 500; }
.status-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; }
.status-legend .legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--muted); }
.status-legend .legend-item a { color: inherit; }
.status-legend .legend-item a:hover { color: var(--text); }
.status-legend .sw { width: 9px; height: 9px; border-radius: 2px; }
.status-legend .n { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; font-size: var(--fs-xs); }

/* engagement cards on the dashboard */
.eng-list { display: grid; gap: var(--s-3); }
.eng-card { display: grid; grid-template-columns: minmax(220px, 1.3fr) minmax(180px, 1fr) minmax(320px, 1.6fr); gap: var(--s-5); align-items: center; padding: 16px 18px; }
.eng-card h3 { margin: 0; font-size: 15px; }
.eng-card h3 a { color: var(--text); }
.eng-card h3 a:hover { color: var(--brand); }
.eng-card .eng-sub { color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; }
.eng-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.eng-stat { display: block; padding: 6px 8px; border-radius: var(--r); color: inherit; text-align: left; }
a.eng-stat:hover { background: var(--surface-2); text-decoration: none; color: inherit; }
.eng-stat .n { font-size: var(--fs-md); font-weight: 650; font-variant-numeric: tabular-nums; display: block; line-height: 1.3; }
.eng-stat .l { font-size: 11.5px; color: var(--muted); line-height: 1.25; display: block; }
.eng-stat.hot .n { color: var(--bad); }
.eng-stat .age { font-size: 11px; color: var(--faint); display: block; }
.eng-warn { grid-column: 1 / -1; margin: 0; }

/* review cards */
.review-item .card-header { align-items: flex-start; }
.review-item .subject { font-weight: 600; font-size: 15px; color: var(--text); }
.review-item .from { color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; }
.mail-body { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; max-height: 12em; overflow: auto; font-size: var(--fs-sm); color: var(--text-2); margin-bottom: var(--s-3); }
.files { display: flex; flex-wrap: wrap; gap: 6px; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); font-size: var(--fs-sm); color: var(--text-2); max-width: 100%; }
.file-chip svg { width: 14px; height: 14px; stroke: var(--muted); flex: 0 0 14px; }
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.file-chip:hover { border-color: var(--brand-100); background: var(--brand-50); text-decoration: none; color: var(--brand); }
.score { font-variant-numeric: tabular-nums; font-weight: 600; }
.score-bar { display: inline-block; width: 44px; height: 5px; background: var(--surface-3); border-radius: 3px; overflow: hidden; vertical-align: middle; margin-left: 6px; }
.score-bar > span { display: block; height: 100%; background: var(--violet); }
.signal { display: inline-block; font-size: 11.5px; padding: 1px 7px; border-radius: var(--r-sm); background: var(--surface-3); color: var(--text-2); margin: 1px 2px 1px 0; }

/* details/summary disclosure */
details.disclose > summary { cursor: pointer; list-style: none; }
details.disclose > summary::-webkit-details-marker { display: none; }
details.attach { position: relative; display: inline-block; }
details.attach > summary { list-style: none; }
details.attach > summary::-webkit-details-marker { display: none; }
details.attach[open] > .attach-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 5; width: 300px; padding: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow);
}
.attach-pop form { display: flex; flex-direction: column; gap: 8px; }
.attach-pop input[type="file"] { width: 100%; }

/* dl.details: request "Details from the PBC list" */
dl.details { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 8px 20px; margin: 0; }
dl.details dt { color: var(--muted); font-weight: 500; font-size: var(--fs-sm); }
dl.details dd { margin: 0; white-space: pre-wrap; }
.meta-line { color: var(--text-2); font-size: var(--fs-sm); }

/* timeline (history, notes) */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; margin: 0; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.timeline li::after { content: ""; position: absolute; left: 8.5px; top: 18px; bottom: 2px; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline .when { font-size: var(--fs-xs); color: var(--muted); }

/* drop zone */
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--r-lg); padding: var(--s-10) var(--s-6); text-align: center; background: var(--surface-2); transition: border-color .15s, background-color .15s; }
.dropzone.is-over { border-color: var(--brand); background: var(--brand-50); }
.dropzone .es-icon { width: 48px; height: 48px; margin: 0 auto var(--s-3); border-radius: 12px; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; }
.dropzone .es-icon svg { width: 24px; height: 24px; stroke: var(--brand); }
.dropzone p { margin-bottom: var(--s-3); }

/* layout helpers for detail pages */
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: var(--s-5); align-items: start; }
.prose { max-width: 75ch; }
.prose p, .prose li { color: var(--text-2); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: var(--fs-sm); margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1 1 auto; min-width: 0; font-family: var(--mono); font-size: 13px; }

/* help page */
.help-nav { position: sticky; top: calc(var(--topbar-h) + 16px); }
.help-nav a { display: block; padding: 6px 10px; border-radius: var(--r); color: var(--text-2); font-size: var(--fs-sm); }
.help-nav a:hover { background: var(--surface-3); text-decoration: none; }
.help-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: var(--s-6); align-items: start; }
.help-layout section + section { margin-top: var(--s-4); }

/* ---------------------------------------------------------------- auth (split) */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--surface); }
.auth-pitch {
  background: radial-gradient(1200px 600px at -10% -10%, rgba(47,166,154,0.28), transparent 60%), linear-gradient(160deg, var(--ink) 0%, var(--ink-2) 55%, #0d3a40 100%);
  color: #d7e3e8; padding: var(--s-12) var(--s-12); display: flex; flex-direction: column;
}
.auth-pitch .brand { padding: 0; }
.auth-pitch h2 { color: #fff; font-size: 30px; line-height: 1.2; margin: auto 0 var(--s-4); max-width: 18ch; letter-spacing: -0.02em; }
.auth-pitch p { color: #b6c8cf; max-width: 46ch; font-size: 15px; }
.auth-points { list-style: none; padding: 0; margin: var(--s-6) 0 auto; display: grid; gap: 14px; }
.auth-points li { display: flex; gap: 12px; align-items: flex-start; margin: 0; color: #d7e3e8; }
.auth-points svg { width: 18px; height: 18px; stroke: var(--accent); flex: 0 0 18px; margin-top: 2px; }
.auth-foot { font-size: var(--fs-xs); color: #7f98a4; margin-top: var(--s-8); display: flex; gap: 8px; align-items: center; }
.auth-foot svg { width: 14px; height: 14px; stroke: currentColor; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: var(--s-10) var(--s-6); background: var(--bg); }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow); padding: 28px; }
.auth-card h1 { font-size: var(--fs-xl); margin-bottom: 4px; }
.auth-card .lead { color: var(--muted); margin-bottom: var(--s-5); }
.auth-card input:not([type="checkbox"]) { width: 100%; }
.auth-card .btn { width: 100%; margin-top: 12px; }
.auth-step { display: flex; gap: 10px; align-items: baseline; font-weight: 600; margin: 0 0 8px; }
.auth-step .num-dot { width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--brand-50); color: var(--brand); font-size: 12px; font-weight: 700; flex: 0 0 22px; }
.divider { display: flex; align-items: center; gap: 10px; margin: var(--s-5) 0; color: var(--faint); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.08em; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.auth-card .back { display: block; text-align: center; margin-top: var(--s-4); font-size: var(--fs-sm); }

/* ---------------------------------------------------------------- client portal */
.portal-body { background: var(--bg); }
.portal-top { background: var(--surface); border-bottom: 1px solid var(--line); }
.portal-top-inner { max-width: 960px; margin: 0 auto; padding: 14px 20px; display: flex; align-items: center; gap: 12px; }
.portal-top .lock { width: 32px; height: 32px; border-radius: 8px; background: var(--brand-50); display: grid; place-items: center; }
.portal-top .lock svg { width: 18px; height: 18px; stroke: var(--brand); }
.portal-top strong { display: block; font-size: 14px; }
.portal-top span { font-size: var(--fs-xs); color: var(--muted); }
.portal-main { max-width: 960px; margin: 0 auto; padding: var(--s-8) 20px var(--s-16); }
.portal-hero h1 { font-size: var(--fs-2xl); margin-bottom: 6px; }
.portal-hero p { color: var(--muted); max-width: 70ch; }
.portal-items { display: grid; gap: var(--s-3); margin-top: var(--s-5); }
.portal-item { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); gap: var(--s-5); padding: 16px 18px; }
.portal-item .code { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.portal-item .what { font-weight: 600; margin: 2px 0 6px; }
.portal-item form { display: flex; flex-direction: column; gap: 8px; }
.portal-item form input[type="file"] { width: 100%; }
.portal-foot { text-align: center; color: var(--faint); font-size: var(--fs-xs); margin-top: var(--s-10); }
.portal-progress { margin: var(--s-4) 0 var(--s-3); max-width: 560px; }
.portal-progress .progress-meta { font-size: var(--fs-sm); }
.portal-steps { margin: var(--s-3) 0 var(--s-2); padding-left: 1.3em; color: var(--text-2); display: grid; gap: 2px; }
.portal-rules { color: var(--muted); font-size: var(--fs-sm); margin: 0; }
.portal-section { font-size: var(--fs-lg); margin: var(--s-8) 0 var(--s-2); }
.portal-area { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: var(--s-5) 0 0; }
.portal-area + .portal-items { margin-top: var(--s-2); }
.portal-item.is-overdue { border-left: 3px solid var(--bad); }
.portal-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.portal-query { margin: 8px 0 0; padding: 8px 10px; border-radius: var(--r); background: var(--orange-bg); border: 1px solid var(--orange-line); font-size: var(--fs-sm); }
.portal-files { margin: 8px 0 0; padding-left: 1.1em; font-size: var(--fs-sm); color: var(--text-2); word-break: break-word; }
.portal-more > summary { list-style: none; cursor: pointer; justify-self: start; }
.portal-more > summary::-webkit-details-marker { display: none; }
.portal-more[open] > summary { margin-bottom: 8px; }
.portal-size { font-size: var(--fs-xs); color: var(--muted); }
.portal-size:empty { display: none; }
.portal-size.error { color: var(--bad); }
.portal-upload button[disabled] { opacity: .6; cursor: not-allowed; }
.portal-accepted { display: flex; gap: 8px; align-items: center; margin-top: var(--s-6); color: var(--ok); font-weight: 500; }
.portal-accepted svg { width: 18px; height: 18px; flex: 0 0 18px; }
/* auditor side: invite panel */
.contact-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r); }
.contact-row { display: flex; gap: var(--s-3); align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 10px 12px; }
.contact-row + .contact-row { border-top: 1px solid var(--line); }
.contact-who { display: flex; flex-direction: column; min-width: 0; }
.contact-who .small { word-break: break-all; }
.contact-add { border: 1px dashed var(--line-strong); border-radius: var(--r); padding: 12px; }
.disclose-inline > summary { cursor: pointer; color: var(--brand); font-weight: 500; font-size: var(--fs-sm); }
.disclose-inline textarea { width: 100%; font-size: 13px; }
.signer-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.signer-form input { flex: 1 1 180px; min-width: 0; }
.activity-list { list-style: none; margin: 0; padding: 0; }
.activity-list li { padding: 8px 0; border-top: 1px solid var(--line); word-break: break-word; }
.activity-list li:first-child { border-top: 0; padding-top: 0; }
.activity-list svg { width: 13px; height: 13px; vertical-align: -2px; stroke: var(--muted); }
.mt-2 { margin-top: var(--s-2); }

/* ---------------------------------------------------------------- landing */
.lp { background: var(--surface); color: var(--text); }
.lp-wrap { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.lp-nav { position: sticky; top: 0; z-index: 10; background: rgba(255,255,255,0.9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.lp-nav .lp-wrap { display: flex; align-items: center; gap: var(--s-6); height: 64px; }
.lp-nav .brand { color: var(--text); padding: 0; }
.lp-nav .brand:hover { color: var(--text); }
.lp-nav .brand-name small { color: var(--muted); }
.lp-links { display: flex; gap: var(--s-5); margin-left: auto; font-size: var(--fs-sm); font-weight: 500; }
.lp-links a { color: var(--text-2); }
.lp-hero { background: radial-gradient(900px 480px at 85% 0%, rgba(47,166,154,0.14), transparent 60%), linear-gradient(180deg, #f6f9f9, #fff); padding: 72px 0 40px; }
.lp-hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr); gap: var(--s-12); align-items: center; }
.lp-visual { min-width: 0; }
.lp-kicker.on-dark { color: var(--accent); }
.lp-section .sub.center { margin-left: auto; margin-right: auto; }
.lp-eyebrow { display: inline-flex; gap: 8px; align-items: center; padding: 4px 12px 4px 6px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line); font-size: var(--fs-xs); font-weight: 500; color: var(--text-2); box-shadow: var(--shadow-xs); }
.lp-eyebrow .chip { height: 20px; }
.lp-hero h1 { font-size: 50px; line-height: 1.06; letter-spacing: -0.03em; margin: 18px 0 18px; max-width: 16ch; font-weight: 650; }
.lp-hero h1 em { font-style: normal; color: var(--brand); }
.lp-hero .lede { font-size: 18px; color: var(--text-2); max-width: 60ch; line-height: 1.55; }
.lp-cta { display: flex; gap: var(--s-3); margin-top: var(--s-6); flex-wrap: wrap; }
.lp-trust { display: flex; gap: var(--s-5); flex-wrap: wrap; margin-top: var(--s-5); font-size: var(--fs-sm); color: var(--muted); }
.lp-trust span { display: inline-flex; gap: 6px; align-items: center; }
.lp-trust svg { width: 16px; height: 16px; stroke: var(--brand); }
.lp-section { padding: 72px 0; }
.lp-section.alt { background: var(--bg); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.lp-section h2 { font-size: 32px; letter-spacing: -0.02em; margin: 0 0 10px; }
.lp-section .sub { color: var(--muted); font-size: 16px; max-width: 62ch; margin-bottom: var(--s-8); }
.lp-kicker { font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--brand); margin-bottom: 10px; }
.lp-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-5); counter-reset: lp; }
.lp-step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; position: relative; box-shadow: var(--shadow-xs); }
.lp-step .num { width: 32px; height: 32px; border-radius: 9px; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; margin-bottom: 14px; }
.lp-step h3 { margin: 0 0 6px; font-size: 17px; }
.lp-step p { color: var(--muted); margin: 0; }
.lp-features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); }
.lp-feature { padding: 22px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.lp-feature .ficon { width: 40px; height: 40px; border-radius: 10px; background: var(--brand-50); display: grid; place-items: center; margin-bottom: 14px; }
.lp-feature .ficon svg { width: 20px; height: 20px; stroke: var(--brand); }
.lp-feature h3 { margin: 0 0 6px; font-size: 16px; }
.lp-feature p { color: var(--muted); margin: 0; font-size: 14px; }
.lp-security { background: var(--ink); color: #c9d7dd; padding: 56px 0; }
.lp-security h2 { color: #fff; }
.lp-security .sub { color: #9db2bb; }
.lp-sec-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-5); }
.lp-sec-item { border-top: 2px solid var(--accent); padding-top: 14px; }
.lp-sec-item strong { color: #fff; display: block; margin-bottom: 4px; }
.lp-sec-item span { font-size: 14px; color: #9db2bb; }
.lp-final { text-align: center; }
.lp-final .lp-cta { justify-content: center; }
.lp-footer { border-top: 1px solid var(--line); padding: 24px 0; color: var(--muted); font-size: var(--fs-sm); }
.lp-footer .lp-wrap { display: flex; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; }

/* mock product screenshot (pure HTML/CSS) */
.mock { border-radius: 14px; border: 1px solid var(--line-strong); background: var(--surface); box-shadow: var(--shadow-lg); overflow: hidden; font-size: 12px; }
.mock-chrome { display: flex; align-items: center; gap: 6px; padding: 9px 12px; background: var(--surface-3); border-bottom: 1px solid var(--line); }
.mock-chrome i { width: 10px; height: 10px; border-radius: 50%; background: #d4dbdf; display: block; }
.mock-chrome .url { margin-left: 12px; flex: 1; max-width: 340px; height: 20px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); font-size: 11px; color: var(--muted); display: flex; align-items: center; padding: 0 8px; }
.mock-body { display: grid; grid-template-columns: 170px minmax(0, 1fr); min-height: 360px; }
.mock-side { background: var(--ink); padding: 14px 10px; color: #a9bcc4; }
.mock-side .m-brand { display: flex; gap: 8px; align-items: center; color: #fff; font-weight: 600; margin-bottom: 16px; padding: 0 4px; }
.mock-side .m-brand b { width: 20px; height: 20px; border-radius: 5px; background: linear-gradient(140deg, var(--accent), var(--brand)); display: block; }
.mock-side .m-item { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px; border-radius: 5px; margin-bottom: 2px; }
.mock-side .m-item.on { background: rgba(47,166,154,0.18); color: #fff; }
.mock-side .m-item em { font-style: normal; font-size: 10px; background: var(--accent); color: #062a2d; border-radius: 9px; padding: 0 6px; font-weight: 700; }
.mock-side .m-label { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.08em; color: #6f8994; margin: 12px 8px 4px; }
.mock-main { padding: 16px 18px; background: var(--bg); min-width: 0; }
.mock-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 8px; }
.mock-h strong { font-size: 15px; color: var(--text); }
.mock-h .mbtn { background: var(--brand); color: #fff; border-radius: 5px; padding: 4px 10px; font-weight: 500; font-size: 11px; white-space: nowrap; }
.mock-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.mock-kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; }
.mock-kpi span { color: var(--muted); font-size: 10.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mock-kpi b { font-size: 18px; color: var(--text); font-variant-numeric: tabular-nums; }
.mock-table { background: var(--surface); border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.mock-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) 128px; gap: 10px; align-items: center; padding: 7px 10px; border-top: 1px solid var(--line); }
.mock-row:first-child { border-top: 0; background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 10.5px; }
.mock-row .c { font-family: var(--mono); font-size: 10.5px; color: var(--text-2); }
.mock-row .d { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.mock-row .chip { height: 18px; font-size: 10.5px; padding: 0 7px; justify-self: start; }
.mock-toast { position: relative; margin: -22px 18px 0 auto; width: max-content; max-width: 90%; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 10px 12px; font-size: 12px; display: flex; gap: 10px; align-items: center; }
.mock-toast svg { width: 18px; height: 18px; stroke: var(--ok); flex: 0 0 18px; }
.mock-toast small { display: block; color: var(--muted); font-size: 11px; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .lp-hero-grid { grid-template-columns: minmax(0, 1fr); gap: var(--s-10); }
  .lp-hero h1 { max-width: 20ch; }
  .eng-card { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .eng-card .eng-stats { grid-column: 1 / -1; }
  .lp-sec-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 961px) { .nav-toggle { display: none; } }
.show-md { display: none; }
@media (max-width: 1200px) {
  .hide-md { display: none; }
  .split { grid-template-columns: minmax(0, 1fr); }
  .show-md { display: block; }
  .table-scroll-sm { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-scroll-sm .table thead th { position: static; }
}
@media (max-width: 960px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .2s ease;
    box-shadow: var(--shadow-lg);
  }
  .nav-toggle:checked ~ .sidebar { transform: none; }
  .nav-toggle:checked ~ .nav-scrim { display: block; position: fixed; inset: 0; background: rgba(15,36,48,0.4); z-index: 25; }
  .topbar { padding: 0 var(--s-4); }
  .topbar .menu-btn { display: inline-flex; width: 36px; height: 36px; padding: 0; margin: 0; border-radius: var(--r); border: 1px solid var(--line-strong); align-items: center; justify-content: center; cursor: pointer; background: var(--surface); flex: 0 0 36px; }
  .topbar .menu-btn svg { width: 18px; height: 18px; stroke: var(--text); }
  .nav-toggle:focus-visible ~ .main .menu-btn { box-shadow: var(--focus); }
  .topbar .brand-mini { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; color: var(--text); }
  .topbar .brand-mini .brand-mark { width: 26px; height: 26px; flex-basis: 26px; border-radius: 7px; }
  .topbar .brand-mini .brand-mark svg { width: 15px; height: 15px; }
  .crumbs { display: none; }
  .content { padding: var(--s-5) var(--s-4) var(--s-12); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .help-layout { grid-template-columns: minmax(0, 1fr); }
  .help-nav { position: static; display: flex; flex-wrap: wrap; gap: 4px; }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-pitch { padding: var(--s-5) var(--s-4) var(--s-6); }
  .auth-pitch h2 { margin: var(--s-5) 0 0; font-size: 20px; max-width: none; }
  .auth-pitch p, .auth-points { display: none; }
  .auth-foot { margin-top: var(--s-3); }
  .lp-hero h1 { font-size: 40px; }
  .lp-steps, .lp-features { grid-template-columns: minmax(0, 1fr); }
  .lp-links a.hide-sm { display: none; }
  .portal-item { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .page-header h1 { font-size: var(--fs-xl); }
  .page-actions { width: 100%; }
  .eng-card { grid-template-columns: minmax(0, 1fr); gap: var(--s-3); }
  .eng-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .toolbar .tb-field { min-width: 0; flex: 1 1 140px; }
  .toolbar .tb-actions { margin-left: 0; }
  .sync { max-width: 52vw; }
  .sync .long { display: none; }
  .kpi-value { font-size: 24px; }
  .lp-hero { padding-top: 44px; }
  .lp-hero h1 { font-size: 32px; }
  .lp-hero .lede { font-size: 16px; }
  .lp-section { padding: 52px 0; }
  .lp-section h2 { font-size: 26px; }
  .lp-sec-grid { grid-template-columns: minmax(0, 1fr); }
  .lp-wrap { padding: 0 16px; }
  .lp-links { gap: var(--s-3); }
  .mock-body { grid-template-columns: minmax(0, 1fr); }
  .mock-side { display: none; }
  .mock-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mock-row { grid-template-columns: 70px minmax(0, 1fr) 104px; gap: 6px; }
  .auth-panel { padding: var(--s-6) var(--s-4); }
  .auth-card { padding: 20px; }
  dl.details { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  dl.details dd { margin-bottom: 8px; }
  details.attach[open] > .attach-pop { width: min(300px, 80vw); }
  .copy-row { flex-direction: column; }
}
/* ---------------------------------------------------------------- usability pass */
/* status chip tooltip wrapper: the title explains the status in plain words */
.status-tip { cursor: help; }
/* one-line "what is this?" under a page title */
.page-hint { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: var(--fs-sm); margin: calc(-1 * var(--s-3)) 0 var(--s-5); max-width: 80ch; }
.page-hint svg { width: 16px; height: 16px; flex: 0 0 16px; stroke: var(--brand); margin-top: 1px; }
/* success notice after an action (?done=…) */
.notice.flash { margin-bottom: var(--s-5); }
/* JS-free "Are you sure?": the real submit button sits inside the expansion */
details.confirm { display: inline-block; position: relative; }
details.confirm > summary { list-style: none; cursor: pointer; }
details.confirm > summary::-webkit-details-marker { display: none; }
details.confirm[open] > summary { box-shadow: var(--focus); }
details.confirm > .confirm-pop {
  margin-top: 8px; padding: 12px; max-width: 360px; background: var(--surface);
  border: 1px solid var(--bad-line); border-radius: var(--r-lg); box-shadow: var(--shadow); font-size: var(--fs-sm);
}
details.confirm > .confirm-pop p { margin: 0 0 10px; color: var(--text-2); }
details.confirm > .confirm-pop form { display: flex; gap: 8px; flex-wrap: wrap; }
/* friendly error page */
.error-body { background: var(--bg); min-height: 100vh; }
.error-page { max-width: 560px; margin: 0 auto; padding: var(--s-12) var(--s-4); }
.error-page .brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); margin-bottom: var(--s-6); }
.error-page .card-body { text-align: center; padding: var(--s-8) var(--s-6); }
.error-page .es-icon { width: 48px; height: 48px; margin: 0 auto var(--s-3); border-radius: 12px; background: var(--brand-50); display: grid; place-items: center; }
.error-page .es-icon svg { width: 24px; height: 24px; stroke: var(--brand); }
.error-page h1 { font-size: var(--fs-xl); margin: 0 0 var(--s-2); }
.error-page .error-detail { font-weight: 500; margin: 0 0 var(--s-2); }
.error-page .btn-group { justify-content: center; margin-top: var(--s-4); }
.error-page > .xs { text-align: center; margin-top: var(--s-3); }
/* glossary on the help page */
dl.glossary dt { font-weight: 600; margin-top: var(--s-3); }
dl.glossary dt:first-child { margin-top: 0; }
dl.glossary dd { margin: 2px 0 0; color: var(--text-2); }
@media (max-width: 640px) {
  details.confirm { display: block; }
  details.confirm > .confirm-pop { max-width: none; }
  .bulkbar { flex-wrap: wrap; }
  .row-actions { flex-wrap: wrap; justify-content: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
@media print {
  .sidebar, .topbar, .page-actions, .toolbar, .tabs { display: none !important; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; }
}
