@font-face { font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 400 700; font-stretch: 100%; font-display: swap; src: url("../fonts/bricolage-var-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 400 700; font-stretch: 100%; font-display: swap; src: url("../fonts/bricolage-var-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400 600; font-stretch: 100%; font-display: swap; src: url("../fonts/plex-sans-var-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400 600; font-stretch: 100%; font-display: swap; src: url("../fonts/plex-sans-var-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/plex-mono-400-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/plex-mono-400-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/plex-mono-500-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/plex-mono-500-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/plex-mono-600-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/plex-mono-600-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  color-scheme: light;
  --ground: #f4f6f7;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --surface-3: #eef1f3;
  --ink: #18212b;
  --ink-2: #3b4652;
  --ink-3: #5a6672;
  --line: #dce2e6;
  --line-strong: #c3ccd3;
  --pine: #0e6a61;
  --pine-hover: #094b44;
  --pine-ink: #ffffff;
  --pine-soft: #e6f0ee;
  --pine-line: #bcd8d3;
  --ochre: #9a5b12;
  --ochre-soft: #f8f1e7;
  --ochre-line: #e8d4be;
  --ok: #1e7b45;
  --ok-soft: #e8f4ed;
  --ok-line: #bfe0cb;
  --warn: #8f5d14;
  --warn-mark: #b7791f;
  --warn-soft: #fbf3e3;
  --warn-line: #efd9ae;
  --danger: #b42318;
  --danger-ink: #ffffff;
  --danger-soft: #fdeceb;
  --danger-line: #f3c5c1;
  --info: #2c5a9e;
  --info-soft: #ebf1fa;
  --info-line: #c7d6ed;
  --violet: #6a3d9a;
  --violet-soft: #f3eefa;
  --violet-line: #dccdef;
  --teal: #0b6b83;
  --teal-soft: #e8f5f8;
  --teal-line: #bfe0e8;
  --focus: #0e6a61;
  --row-hover: #f9fafb;
  --shadow-pop: 0 8px 24px rgba(24, 33, 43, 0.12), 0 1px 2px rgba(24, 33, 43, 0.06);
  --chart-1: #0e6a61;
  --chart-2: #9a5b12;
  --chart-3: #2c5a9e;
  --chart-4: #6a3d9a;
  --chart-5: #5a6672;
  --chart-grid: #e4e9ec;

  --font: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Bricolage Grotesque", "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs-2xs: 0.6875rem;
  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-md: 0.875rem;
  --fs-lg: 1rem;
  --fs-xl: 1.1875rem;
  --fs-2xl: 1.625rem;
  --fs-3xl: 2rem;
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --r-pill: 999px;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sidebar-w: 248px;
  --topbar-h: 56px;
  --ease: 150ms ease;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ground: #0e1316;
    --surface: #151b1f;
    --surface-2: #1a2126;
    --surface-3: #212a30;
    --ink: #e3e8eb;
    --ink-2: #bcc5cb;
    --ink-3: #8e99a2;
    --line: #283238;
    --line-strong: #3a464e;
    --pine: #54b8aa;
    --pine-hover: #74cbbe;
    --pine-ink: #06201c;
    --pine-soft: #11302c;
    --pine-line: #1f4b45;
    --ochre: #dfa561;
    --ochre-soft: #2f2210;
    --ochre-line: #4d381d;
    --ok: #62c28e;
    --ok-soft: #12301f;
    --ok-line: #1f4a31;
    --warn: #e2b660;
    --warn-mark: #e2b660;
    --warn-soft: #30260f;
    --warn-line: #4c3d1a;
    --danger: #f18a7c;
    --danger-ink: #230c09;
    --danger-soft: #371a16;
    --danger-line: #5a2b25;
    --info: #8fb5ea;
    --info-soft: #15243a;
    --info-line: #25405f;
    --violet: #c2a3e6;
    --violet-soft: #251a33;
    --violet-line: #3d2c52;
    --teal: #74c7da;
    --teal-soft: #10272d;
    --teal-line: #1f4650;
    --focus: #74cbbe;
    --row-hover: #1a2126;
    --shadow-pop: 0 12px 32px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.4);
    --chart-1: #54b8aa;
    --chart-2: #dfa561;
    --chart-3: #8fb5ea;
    --chart-4: #c2a3e6;
    --chart-5: #8e99a2;
    --chart-grid: #232c32;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.55;
  color: var(--ink);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-family: var(--font-head); font-weight: 600; letter-spacing: -0.012em; color: var(--ink); }
h1 { font-size: var(--fs-2xl); font-weight: 650; }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }
p { margin: 0 0 var(--sp-3); }
a { color: var(--pine); text-underline-offset: 2px; transition: color var(--ease); }
a:hover { color: var(--pine-hover); }
img, svg { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--sp-5) 0; }
code, kbd { font-family: var(--font-mono); font-size: 0.86em; background: var(--surface-3); border: 1px solid var(--line); padding: 0 5px; border-radius: var(--r-sm); }
.num, .tabular, .mono, time, .table td.num, .table th.num { font-variant-numeric: tabular-nums; }
.mono, .num, .table td.num { font-family: var(--font-mono); }
table { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm); }
.icon { width: 19px; height: 19px; flex: none; }
.icon-sm { width: 16px; height: 16px; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); left: 0; top: 0; white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: var(--sp-4); top: -60px; background: var(--pine); color: var(--pine-ink); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm); z-index: 100; }
.skip-link:focus { top: var(--sp-3); }
.muted { color: var(--ink-3); }
.small { font-size: var(--fs-sm); }
.nowrap { white-space: nowrap; }
.money { color: var(--ochre); }
.eyebrow { font-family: var(--font-head); font-size: var(--fs-2xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.stack > * + * { margin-top: var(--sp-4); }
.stack-lg > * + * { margin-top: var(--sp-5); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); }
.row-between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.grid { display: grid; gap: var(--sp-4); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); }
.split { display: grid; gap: var(--sp-5); grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }

/* Shell */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  align-self: start; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: var(--sp-4) var(--sp-3); scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px var(--sp-2) var(--sp-4); color: var(--ink); text-decoration: none; min-width: 0; }
.brand:hover { color: var(--ink); }
.brand-mark { width: 32px; height: 32px; border-radius: var(--r-sm); background: var(--pine); color: var(--pine-ink); display: grid; place-items: center; font-family: var(--font-head); font-weight: 650; font-size: 13px; letter-spacing: .01em; flex: none; }
.brand-text { display: grid; line-height: 1.2; min-width: 0; }
.brand-name { font-family: var(--font-head); font-weight: 600; font-size: var(--fs-lg); letter-spacing: -0.01em; }
.brand-sub { font-size: var(--fs-2xs); color: var(--ink-3); }
.nav-group { margin-top: var(--sp-3); }
.nav-group + .nav-group { padding-top: var(--sp-3); border-top: 1px solid var(--line); }
.nav-group-label { font-family: var(--font-head); font-size: var(--fs-2xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding: 0 10px 6px; }
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; margin: 1px 0;
  color: var(--ink-3); text-decoration: none; border-radius: var(--r-sm); font-size: var(--fs-md); position: relative;
  transition: background-color var(--ease), color var(--ease);
}
.nav-link:hover { background: var(--ground); color: var(--ink); }
.nav-link[aria-current="page"] { background: var(--pine-soft); color: var(--pine); font-weight: 500; }
.nav-link[aria-current="page"]::before { content: ""; position: absolute; left: -12px; top: 4px; bottom: 4px; width: 3px; border-radius: 0 2px 2px 0; background: var(--pine); }
.nav-link[aria-current="page"] .icon { color: var(--pine); }
.nav-count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); background: var(--pine-soft); color: var(--pine); font-family: var(--font-mono); font-size: var(--fs-2xs); display: grid; place-items: center; }
.sidebar-foot { margin-top: auto; padding-top: var(--sp-3); border-top: 1px solid var(--line); }
.sidebar-foot form { margin: 0; }
.sidebar-foot .nav-link { width: 100%; background: none; border: 0; font: inherit; font-size: var(--fs-md); cursor: pointer; text-align: left; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--sp-3);
  height: var(--topbar-h); padding: 0 var(--sp-6); background: var(--surface); border-bottom: 1px solid var(--line);
}
.topbar-tenant { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.tenant-pill { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-family: var(--font-head); font-weight: 600; font-size: var(--fs-lg); color: var(--ink); }
.tenant-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--tenant-color, var(--pine)); flex: none; }
.tenant-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tenant-switch { margin: 0; }
.tenant-switch .select { min-height: 36px; width: auto; max-width: 280px; font-weight: 500; padding-left: 26px; background-color: var(--surface); }
.tenant-switch-wrap { position: relative; display: inline-flex; align-items: center; }
.tenant-switch-wrap::before { content: ""; position: absolute; left: 11px; width: 8px; height: 8px; border-radius: 50%; background: var(--tenant-color, var(--pine)); pointer-events: none; }
.topbar-title { font-size: var(--fs-sm); color: var(--ink-3); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: var(--sp-3); border-left: 1px solid var(--line); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: var(--sp-1); }
.topbar-sep { width: 1px; height: 24px; background: var(--line); margin: 0 var(--sp-2); }
.user-chip { display: flex; align-items: center; gap: 10px; text-align: left; }
.user-chip-text { display: grid; line-height: 1.2; }
.user-chip-name { font-weight: 500; font-size: var(--fs-md); color: var(--ink); }
.user-chip-role { font-size: var(--fs-2xs); color: var(--ink-3); font-weight: 400; }
.btn.menu-toggle { display: none; }
.content { padding: var(--sp-6) var(--sp-6) var(--sp-7); width: 100%; max-width: 1520px; }

.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--sp-3) var(--sp-5); margin-bottom: var(--sp-5); }
.page-header > div:first-child { min-width: 0; }
.page-header h1 { font-size: var(--fs-2xl); overflow-wrap: anywhere; }
.page-header .lede { color: var(--ink-3); margin: var(--sp-1) 0 0; max-width: 72ch; font-size: 0.9375rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--ink-3); margin-bottom: var(--sp-2); }
.breadcrumb a { color: var(--ink-3); text-decoration: none; }
.breadcrumb a:hover { color: var(--pine); }
.breadcrumb span:last-child { color: var(--ink); }

/* Buttons */
.btn {
  --btn-bg: var(--surface); --btn-ink: var(--ink); --btn-line: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 0 14px; font: inherit; font-size: var(--fs-md); font-weight: 500; line-height: 1;
  color: var(--btn-ink); background: var(--btn-bg); border: 1px solid var(--btn-line); border-radius: var(--r-sm);
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color var(--ease), border-color var(--ease), color var(--ease);
}
.btn:hover { background: var(--surface-2); border-color: var(--ink-3); color: var(--btn-ink); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-primary { --btn-bg: var(--pine); --btn-ink: var(--pine-ink); --btn-line: var(--pine); }
.btn-primary:hover { background: var(--pine-hover); border-color: var(--pine-hover); color: var(--pine-ink); }
.btn-tertiary { --btn-bg: transparent; --btn-ink: var(--pine); --btn-line: var(--pine); }
.btn-tertiary:hover { background: var(--pine); border-color: var(--pine); color: var(--pine-ink); }
.btn-ghost { --btn-bg: transparent; --btn-line: transparent; --btn-ink: var(--ink-3); }
.btn-ghost:hover { background: var(--ground); border-color: transparent; color: var(--ink); }
.btn-danger { --btn-ink: var(--danger); --btn-line: var(--danger-line); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: var(--fs-sm); }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }
.btn-link { background: none; border: 0; padding: 0; font: inherit; color: var(--pine); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.btn-link:hover { color: var(--pine-hover); }
.btn-link.danger { color: var(--danger); }
.inline-form { display: inline; margin: 0; }

/* Forms */
.form { display: grid; gap: var(--sp-4); }
.form-grid { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field-full { grid-column: 1 / -1; }
.label { font-size: var(--fs-sm); font-weight: 500; color: var(--ink-2); font-family: var(--font); letter-spacing: 0; }
.label .opt { font-weight: 400; color: var(--ink-3); }
.input, .select, .textarea {
  width: 100%; min-height: 38px; padding: 8px 11px; font: inherit; font-size: var(--fs-md); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  transition: border-color var(--ease), box-shadow var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-3); opacity: .8; }
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--pine); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pine) 18%, transparent); }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }
input[type="date"].input, input[type="month"].input, input[type="number"].input { font-family: var(--font-mono); font-size: var(--fs-sm); }
.hint { font-size: var(--fs-sm); color: var(--ink-3); }
.field-error { font-size: var(--fs-sm); color: var(--danger); }
.check { display: flex; align-items: flex-start; gap: var(--sp-2); font-size: var(--fs-md); cursor: pointer; }
.check input { width: 16px; height: 16px; margin-top: 3px; accent-color: var(--pine); }
.form-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; padding-top: var(--sp-2); }
.filters { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: flex-end; margin-bottom: var(--sp-5); padding: var(--sp-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.filters .field { min-width: 160px; flex: 1 1 160px; max-width: 260px; }
.filters .label { font-size: var(--fs-xs); color: var(--ink-3); }
.filters .btn { min-height: 38px; }

/* Segmented control */
.segmented { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--ground); border: 1px solid var(--line); border-radius: var(--r-md); }
.segmented a, .segmented button { padding: 5px 11px; border-radius: var(--r-sm); color: var(--ink-3); text-decoration: none; font: inherit; font-size: var(--fs-sm); background: none; border: 0; cursor: pointer; transition: background-color var(--ease), color var(--ease); }
.segmented a:hover, .segmented button:hover { color: var(--ink); }
.segmented [aria-current="page"], .segmented [aria-pressed="true"] { background: var(--surface); color: var(--pine); font-weight: 500; box-shadow: 0 0 0 1px var(--line); }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); min-width: 0; }
.card-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--line); }
.card-header h2, .card-header h3 { font-size: var(--fs-lg); font-weight: 600; }
.card-header .lede { width: 100%; margin: 0; color: var(--ink-3); font-size: var(--fs-sm); }
.card-body { padding: var(--sp-5); }
.card-footer { padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); font-size: var(--fs-sm); }
.card-flush .card-body { padding: 0; }
.card-flush .card-body:not(:has(> .table-wrap, > table, > .list-flush)) { padding: var(--sp-4) var(--sp-5); }
.card-flush > .card-header + .table-wrap { border-radius: 0; }
.section-title { font-size: var(--fs-lg); margin: 0 0 var(--sp-3); }
.panel-title, .card-header .panel-title { font-family: var(--font-head); font-size: var(--fs-2xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }

/* Callout */
.callout { position: relative; padding: var(--sp-5); padding-left: calc(var(--sp-5) + 4px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.callout::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--ink-3); }
.callout > :last-child { margin-bottom: 0; }
.callout-title { display: flex; align-items: center; gap: 8px; font-family: var(--font-head); font-weight: 600; font-size: var(--fs-lg); margin: 0 0 var(--sp-2); }
.callout-pine { background: color-mix(in srgb, var(--pine-soft) 60%, var(--surface)); border-color: var(--pine-line); }
.callout-pine::before { background: var(--pine); }
.callout-pine .callout-title { color: var(--pine); }
.callout-ochre { background: color-mix(in srgb, var(--ochre-soft) 70%, var(--surface)); border-color: var(--ochre-line); }
.callout-ochre::before { background: var(--ochre); }
.callout-ochre .callout-title { color: var(--ochre); }
.callout-warn::before { background: var(--warn-mark); }
.callout-danger { border-color: var(--danger-line); }
.callout-danger::before { background: var(--danger); }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.card .table-wrap { border: 0; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
.table th { text-align: left; font-family: var(--font-head); font-size: var(--fs-2xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); background: var(--surface); padding: 12px var(--sp-4); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px var(--sp-4); border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color var(--ease); }
.table tbody tr:hover td { background: var(--row-hover); }
.table .num, .table th.num { text-align: right; white-space: nowrap; }
.table td.num { font-size: var(--fs-sm); }
.table time { font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--ink-2); white-space: nowrap; }
.table .row-title { font-weight: 500; color: var(--ink); text-decoration: none; }
.table .row-title:hover { color: var(--pine); }
.table tfoot td { font-weight: 600; background: var(--surface-2); border-top: 1px solid var(--line-strong); }
.table-foot { display: flex; flex-wrap: wrap; gap: 6px 20px; align-items: center; padding: 10px var(--sp-4); border-top: 1px solid var(--line); background: var(--surface-2); font-size: var(--fs-sm); color: var(--ink-3); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.table-foot strong { font-family: var(--font-mono); font-weight: 600; color: var(--ink); }
.is-struck { text-decoration: line-through; color: var(--ink-3); }
.dl { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 0; margin: 0; }
.dl dt, .dl dd { padding: 10px 0; border-bottom: 1px solid var(--line); }
.dl dt:last-of-type, .dl dd:last-of-type { border-bottom: 0; }
.dl dt { color: var(--ink-3); font-size: var(--fs-sm); padding-right: var(--sp-3); }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; text-align: right; }

/* Pills (status) */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: var(--r-pill); font-size: var(--fs-2xs); font-weight: 500; line-height: 1.7; white-space: nowrap; background: var(--surface-3); color: var(--ink-2); border: 1px solid var(--line); vertical-align: middle; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip-plain::before { display: none; }
.chip .icon-sm { width: 13px; height: 13px; }
.chip-ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.chip-warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.chip-danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }
.chip-info { background: var(--info-soft); color: var(--info); border-color: var(--info-line); }
.chip-pine { background: var(--pine-soft); color: var(--pine); border-color: var(--pine-line); }
.chip-ochre { background: var(--ochre-soft); color: var(--ochre); border-color: var(--ochre-line); }
.chip-violet { background: var(--violet-soft); color: var(--violet); border-color: var(--violet-line); }
.chip-teal { background: var(--teal-soft); color: var(--teal); border-color: var(--teal-line); }
.chip-muted { background: var(--surface-2); color: var(--ink-3); border-color: var(--line); }
.chip-internal { background: var(--surface-3); color: var(--ink-2); border: 1px solid var(--line-strong); border-radius: var(--r-sm); }

/* Tags (categories) */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: var(--r-sm); font-size: var(--fs-2xs); font-weight: 500; line-height: 1.7; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line-strong); vertical-align: middle; }
.tag-pine { background: var(--pine-soft); color: var(--pine); border-color: var(--pine-line); }
.tag-ochre { background: var(--ochre-soft); color: var(--ochre); border-color: var(--ochre-line); }
.tag-info { background: var(--info-soft); color: var(--info); border-color: var(--info-line); }
.tag-violet { background: var(--violet-soft); color: var(--violet); border-color: var(--violet-line); }
.tag-teal { background: var(--teal-soft); color: var(--teal); border-color: var(--teal-line); }
.tag-warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.tag-mono { font-family: var(--font-mono); font-size: var(--fs-xs); }

/* Tabs */
.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--line); margin-bottom: var(--sp-5); overflow-x: auto; scrollbar-width: none; }
.tab { padding: 10px var(--sp-3); color: var(--ink-3); text-decoration: none; border: 0; background: none; font: inherit; font-weight: 500; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; transition: color var(--ease), border-color var(--ease); }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"], .tab[aria-current="page"] { color: var(--pine); border-bottom-color: var(--pine); }
.tab-count { font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 400; color: var(--ink-3); margin-left: 4px; }

/* Empty state */
.empty { text-align: left; padding: var(--sp-6) var(--sp-5); border: 1px dashed var(--line-strong); border-radius: var(--r-lg); background: var(--surface); }
.empty h3 { margin-bottom: var(--sp-1); }
.empty p { color: var(--ink-3); max-width: 56ch; }
.empty .icon { width: 28px; height: 28px; color: var(--ink-3); margin-bottom: var(--sp-3); }
.card .empty { border: 0; padding: var(--sp-3) 0; background: transparent; }

/* Stats */
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--sp-4) var(--sp-5); min-width: 0; }
.stat-label { font-size: var(--fs-sm); color: var(--ink-3); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.stat-value { font-family: var(--font-mono); font-size: clamp(1.5rem, 2.1vw, var(--fs-3xl)); font-weight: 500; letter-spacing: -0.02em; line-height: 1.15; margin-top: var(--sp-2); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; color: var(--ink); }
.stat-value.is-money { color: var(--ochre); }
.stat-meta { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--ink-3); margin-top: var(--sp-2); }
.stat-meta a { font-family: var(--font); font-size: var(--fs-sm); }
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.stat-strip .stat { border: 0; border-radius: 0; box-shadow: -1px 0 0 var(--line); }
.delta-up { color: var(--ok); }
.delta-down { color: var(--danger); }
.meter { height: 6px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--pine); border-radius: inherit; }
.meter.is-over > span { background: var(--ok); }
.meter.is-behind > span { background: var(--warn-mark); }

/* Timeline: our work on the spine in petrol, external events in copper */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 107px; top: 6px; bottom: 6px; width: 1px; background: var(--line-strong); }
.tl-item { display: grid; grid-template-columns: 92px 32px minmax(0, 1fr); align-items: start; padding: 6px 0; }
.tl-date { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--ink-3); text-align: right; padding-top: 4px; }
.tl-mark { position: relative; height: 24px; }
.tl-mark::after { content: ""; position: absolute; left: 10px; top: 8px; width: 11px; height: 11px; border-radius: 50%; background: var(--pine); box-shadow: 0 0 0 3px var(--surface); }
.tl-body { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); min-width: 0; }
.tl-title { font-weight: 500; color: var(--ink); text-decoration: none; }
.tl-title:hover { color: var(--pine); }
.tl-rationale { color: var(--ink-3); margin: var(--sp-1) 0 0; font-size: var(--fs-sm); }
.tl-meta { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-2); font-size: var(--fs-sm); color: var(--ink-3); align-items: center; }
.tl-item.is-external .tl-mark::after { border-radius: 2px; transform: rotate(45deg); background: var(--surface); border: 2px solid var(--ochre); width: 10px; height: 10px; }
.tl-item.is-external .tl-body { background: color-mix(in srgb, var(--ochre-soft) 70%, var(--surface)); border-color: var(--ochre-line); }
.tl-item.is-internal .tl-body { border-style: dashed; }
.tl-month { padding: var(--sp-4) 0 var(--sp-1) 124px; font-family: var(--font-head); font-size: var(--fs-2xs); letter-spacing: .08em; text-transform: uppercase; font-weight: 600; color: var(--ink-3); }

/* Comments & attachments */
.comments { display: grid; gap: var(--sp-3); }
.comment { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: var(--sp-3); }
.comment-body { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px var(--sp-3); min-width: 0; }
.comment.is-internal .comment-body { border-style: dashed; background: transparent; }
.comment-head { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: baseline; font-size: var(--fs-sm); }
.comment-author { font-weight: 600; }
.comment-text { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
.comment-actions { display: flex; gap: var(--sp-3); font-size: var(--fs-sm); margin-top: var(--sp-1); }
.avatar { width: 32px; height: 32px; border-radius: var(--r-sm); display: inline-grid; place-items: center; font-family: var(--font-mono); font-size: var(--fs-2xs); font-weight: 600; background: var(--surface-3); color: var(--ink-2); flex: none; }
.avatar-agency { background: var(--pine); color: var(--pine-ink); }
.attachment-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); }
.attachment { display: flex; align-items: center; gap: var(--sp-2); padding: 10px var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); min-width: 0; transition: border-color var(--ease); }
.attachment:hover { border-color: var(--line-strong); }
.attachment a { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); font-size: var(--fs-sm); }
.attachment .meta { margin-left: auto; font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--ink-3); white-space: nowrap; }

/* Flash / toast */
.flash-stack { display: grid; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.flash { position: relative; display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-3) var(--sp-4) var(--sp-3) calc(var(--sp-4) + 4px); border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); overflow: hidden; }
.flash::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--ink-3); }
.flash-success { border-color: var(--ok-line); background: var(--ok-soft); }
.flash-success::before { background: var(--ok); }
.flash-error { border-color: var(--danger-line); background: var(--danger-soft); }
.flash-error::before { background: var(--danger); }
.flash-warning { border-color: var(--warn-line); background: var(--warn-soft); }
.flash-warning::before { background: var(--warn-mark); }
.flash-info { border-color: var(--info-line); background: var(--info-soft); }
.flash-info::before { background: var(--info); }
.flash .btn-icon { margin-left: auto; }
.toast-region { position: fixed; right: var(--sp-4); bottom: var(--sp-4); z-index: 90; display: grid; gap: var(--sp-2); width: min(360px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: var(--surface); padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); box-shadow: var(--shadow-pop); font-size: var(--fs-md); }
.toast.is-error { background: var(--danger); color: var(--danger-ink); }

/* Dropdown & modal */
.dropdown { position: relative; }
.dropdown > summary { list-style: none; cursor: pointer; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); padding: var(--sp-2); }
.dropdown-panel.is-wide { width: min(380px, calc(100vw - 32px)); }
.dropdown-panel > .form { padding: var(--sp-2); }
pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--font-mono); font-size: var(--fs-sm); }
.menu-item { display: flex; align-items: center; gap: var(--sp-2); width: 100%; padding: 8px var(--sp-2); color: var(--ink); text-decoration: none; border-radius: var(--r-sm); background: none; border: 0; font: inherit; text-align: left; cursor: pointer; transition: background-color var(--ease); }
.menu-item:hover { background: var(--ground); color: var(--ink); }
.menu-sep { border-top: 1px solid var(--line); margin: var(--sp-2) 0; }
.bell { position: relative; }
.bell-count { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--r-pill); background: var(--danger); color: var(--danger-ink); font-family: var(--font-mono); font-size: 10px; font-weight: 600; display: grid; place-items: center; line-height: 1; box-shadow: 0 0 0 2px var(--surface); }
.notif-list { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow-y: auto; }
.notif { display: block; padding: var(--sp-2); border-radius: var(--r-sm); color: var(--ink); text-decoration: none; }
.notif:hover { background: var(--ground); color: var(--ink); }
.notif.is-unread { box-shadow: inset 3px 0 0 var(--pine); }
.notif-title { font-size: var(--fs-md); font-weight: 500; display: block; }
.notif-time { font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--ink-3); }
.modal { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 0; width: min(480px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop); }
.modal::backdrop { background: rgba(14, 19, 22, 0.45); }
.modal-body { padding: var(--sp-5); }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }

/* Pagination */
.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-top: var(--sp-4); font-size: var(--fs-sm); color: var(--ink-3); }
.pagination-links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.page-link { display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font-family: var(--font-mono); font-size: var(--fs-sm); text-decoration: none; transition: background-color var(--ease), border-color var(--ease); }
a.page-link:hover { border-color: var(--ink-3); color: var(--ink); }
.page-link[aria-current="page"] { background: var(--pine); border-color: var(--pine); color: var(--pine-ink); }
.page-link.is-text { font-family: var(--font); padding: 0 12px; }
.page-link.is-disabled { color: var(--ink-3); opacity: .6; }
.page-gap { color: var(--ink-3); padding: 0 2px; }

/* Auth */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.auth-panel { display: flex; flex-direction: column; justify-content: center; padding: var(--sp-7) var(--sp-6); background: var(--surface); }
.auth-inner { width: 100%; max-width: 380px; margin: 0 auto; }
.auth-inner .brand { padding-left: 0; }
.auth-inner h1 { font-size: var(--fs-2xl); margin: var(--sp-5) 0 var(--sp-2); }
.auth-inner .lede { color: var(--ink-3); margin-bottom: var(--sp-5); }
.auth-aside { position: relative; overflow: hidden; background: var(--pine-hover); color: #fff; padding: var(--sp-7) var(--sp-6); display: flex; flex-direction: column; justify-content: center; gap: var(--sp-6); }
.auth-aside-card { max-width: 480px; border: 1px solid rgba(255, 255, 255, .16); border-radius: 8px; background: rgba(255, 255, 255, .04); padding: var(--sp-5); display: grid; gap: var(--sp-4); }
.auth-aside-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: var(--sp-2); }
.auth-aside-eyebrow { font-family: var(--font-head); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; opacity: .7; }
.auth-aside-caption { font-size: var(--fs-xs); opacity: .7; }
.auth-aside-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; border-top: 1px solid rgba(255, 255, 255, .16); border-bottom: 1px solid rgba(255, 255, 255, .16); }
.auth-aside-stats div { padding: var(--sp-3) var(--sp-3) var(--sp-3) 0; display: grid; gap: 2px; }
.auth-aside-stats div + div { padding-left: var(--sp-3); border-left: 1px solid rgba(255, 255, 255, .16); }
.auth-aside-stats dt { font-size: var(--fs-xs); opacity: .7; }
.auth-aside-stats dd { margin: 0; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: var(--fs-xl); font-weight: 500; }
.auth-aside-chart { width: 100%; height: 130px; display: block; overflow: visible; }
.auth-aside-chart .grid line { stroke: rgba(255, 255, 255, .1); stroke-width: 1; }
.auth-aside-chart .last { fill: none; stroke: rgba(255, 255, 255, .45); stroke-width: 1.5; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.auth-aside-chart .area { fill: rgba(255, 255, 255, .08); stroke: none; }
.auth-aside-chart .now { fill: none; stroke: #fff; stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.auth-aside-chart .mark { stroke: rgba(255, 255, 255, .25); stroke-width: 1; stroke-dasharray: 2 3; vector-effect: non-scaling-stroke; }
.auth-aside-chart .work { fill: #fff; stroke: var(--pine-hover); stroke-width: 2; }
.auth-aside-chart .ext { fill: var(--pine-hover); stroke: #e8c79a; stroke-width: 2; }
.auth-aside-chart .end { fill: #fff; }
.auth-aside-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); font-size: var(--fs-xs); opacity: .8; }
.auth-aside-legend li { display: inline-flex; align-items: center; gap: 6px; }
.auth-aside-legend li::before { content: ""; display: inline-block; }
.auth-aside-legend .k-now::before { width: 14px; height: 2px; background: #fff; }
.auth-aside-legend .k-last::before { width: 14px; border-top: 2px dashed rgba(255, 255, 255, .5); }
.auth-aside-legend .k-work::before { width: 9px; height: 9px; border-radius: 50%; background: #fff; }
.auth-aside-legend .k-ext::before { width: 8px; height: 8px; border: 2px solid #e8c79a; transform: rotate(45deg); }
.auth-aside-foot { display: grid; gap: var(--sp-3); max-width: 480px; }
.auth-aside-promises { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.auth-aside-promises li { font-size: var(--fs-xs); padding: 4px 10px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .25); }
.auth-aside-ledger { list-style: none; margin: 0; padding: 0; position: relative; max-width: 440px; }
.auth-aside-ledger::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 1px; background: rgba(255, 255, 255, .3); }
.auth-aside-ledger li { position: relative; padding: 0 0 var(--sp-4) var(--sp-5); }
.auth-aside-ledger li::before { content: ""; position: absolute; left: 0; top: 6px; width: 11px; height: 11px; border-radius: 50%; background: #fff; }
.auth-aside-ledger li.is-external::before { border-radius: 2px; transform: rotate(45deg); background: transparent; border: 2px solid #e8c79a; width: 10px; height: 10px; }
.auth-aside-ledger strong { display: block; font-family: var(--font-head); font-weight: 600; font-size: var(--fs-lg); }
.auth-aside-ledger span { opacity: .75; font-family: var(--font-mono); font-size: var(--fs-xs); }
.auth-aside p { max-width: 42ch; opacity: .85; margin: 0; }

/* Error page */
.error-page { max-width: 560px; padding: var(--sp-7) 0; }
.error-code { font-family: var(--font-mono); font-size: 4.5rem; font-weight: 500; line-height: 1; color: var(--line-strong); letter-spacing: -0.04em; }
.debug { margin-top: var(--sp-5); padding: var(--sp-4); background: var(--surface-3); border-radius: var(--r-md); overflow-x: auto; font-family: var(--font-mono); font-size: var(--fs-xs); white-space: pre-wrap; }

.chart-box { position: relative; width: 100%; height: 280px; }
.chart-box canvas { max-width: 100%; }

/* Record header: title + status, step line, month picker */
.page-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); min-width: 0; }
.page-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-4); margin-top: var(--sp-2); font-size: var(--fs-sm); color: var(--ink-3); }
.page-meta time, .page-meta .mono { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--ink-2); }
.status-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-2); }
.status-steps li { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3); }
.status-steps li + li::before { content: "›"; color: var(--line-strong); margin-right: 2px; }
.status-steps li.is-done { color: var(--ink-2); }
.status-steps li[aria-current="step"] { color: var(--ink); font-weight: 600; }
.status-steps time { font-weight: 400; color: var(--ink-3); }
.period-picker > summary.btn { gap: 8px; }
.period-picker .dropdown-panel { min-width: 200px; max-height: 320px; overflow-y: auto; }
.menu-item[aria-current="page"] { background: var(--pine-soft); color: var(--pine); font-weight: 500; }

/* Numbered document sections */
.doc-sections { counter-reset: doc-section; }
.doc-sections .is-numbered { counter-increment: doc-section; }
.doc-sections .is-numbered .section-heading::before { content: counter(doc-section) ". "; font-family: var(--font-mono); font-weight: 500; color: var(--ink-3); }
.card-heading { min-width: 0; flex: 1 1 320px; }
.card-heading h2 { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.card-heading .lede { margin-top: 2px; }
.badge-box { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; padding: 4px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); font-size: var(--fs-xs); color: var(--ink-3); max-width: 100%; }
.badge-box strong { font-family: var(--font-mono); font-weight: 500; color: var(--ink); }
.badge-box .icon-sm { color: var(--ochre); }

/* Stat tiles: boxed figures inside a card */
.stat-tiles { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
.stat-tile { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); padding: var(--sp-3) var(--sp-4); min-width: 0; }
.stat-tile .stat-label { font-size: var(--fs-xs); }
.stat-tile .stat-value { font-size: var(--fs-xl); font-weight: 600; margin-top: var(--sp-1); }
.stat-tile .stat-meta { margin-top: 2px; }
.stat-tile .stat-value.is-quiet { color: var(--ink-2); }
.stat-tile .stat-value.is-negative { color: var(--danger); }
.stat-tile.is-accent { background: color-mix(in srgb, var(--pine-soft) 70%, var(--surface)); border-color: var(--pine-line); }
.stat-tile.is-accent .stat-label, .stat-tile.is-accent .stat-value { color: var(--pine); }

/* Collapsible card section */
.card-collapse > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border-radius: var(--r-lg); }
.card-collapse > summary::-webkit-details-marker { display: none; }
.card-collapse > summary h2 { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-lg); }
.card-collapse > summary h2 .icon-sm { color: var(--pine); }
.card-collapse > summary .collapse-icon { color: var(--ink-3); transition: transform var(--ease); }
.card-collapse[open] > summary { border-bottom: 1px solid var(--line); border-radius: var(--r-lg) var(--r-lg) 0 0; }
.card-collapse[open] > summary .collapse-icon { transform: rotate(180deg); }

/* Numbered explanation cards */
.step-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.step-card { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); padding: var(--sp-3) var(--sp-4); min-width: 0; }
.step-card h3 { display: flex; align-items: center; gap: var(--sp-2); font-family: var(--font); font-size: var(--fs-md); font-weight: 600; margin-bottom: 6px; }
.step-card p { margin: 0; color: var(--ink-3); font-size: var(--fs-sm); line-height: 1.6; overflow-wrap: anywhere; }
.step-no { width: 20px; height: 20px; border-radius: 50%; background: var(--pine); color: var(--pine-ink); display: inline-grid; place-items: center; font-family: var(--font-mono); font-size: var(--fs-2xs); font-weight: 600; flex: none; }
.note-box { display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); font-size: var(--fs-sm); color: var(--ink-3); }
.note-box p { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.note-box strong { color: var(--ink); }
.note-box > .icon-sm { color: var(--pine); margin-top: 2px; }

/* Row list: numbered or dated rows inside a card */
.row-list { list-style: none; margin: 0; padding: 0; }
.row-list > li { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--sp-2) var(--sp-3); padding: var(--sp-3) var(--sp-5); border-bottom: 1px solid var(--line); min-width: 0; }
.row-list > li:last-child { border-bottom: 0; }
.row-no { width: 22px; height: 22px; border-radius: var(--r-sm); background: var(--pine-soft); color: var(--pine); display: inline-grid; place-items: center; font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 600; flex: none; margin-top: 1px; }
.row-date { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--ink-3); flex: none; min-width: 84px; padding-top: 2px; }
.row-main { flex: 1 1 240px; min-width: 0; overflow-wrap: anywhere; }
.row-main .muted { display: block; font-size: var(--fs-sm); margin-top: 2px; }
.row-side { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-left: auto; }

/* Styleguide */
.sg-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--sp-3); }
.sg-swatch { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--surface); }
.sg-swatch i { display: block; height: 48px; border-bottom: 1px solid var(--line); }
.sg-swatch div { padding: 8px 10px; font-size: var(--fs-xs); }
.sg-swatch code { background: none; border: 0; padding: 0; color: var(--ink-3); }
.sg-type > * + * { margin-top: var(--sp-3); }

@media (max-width: 1180px) {
  .split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(280px, 86vw); z-index: 60; transform: translateX(-102%); transition: transform .18s ease; box-shadow: var(--shadow-pop); }
  .shell.nav-open .sidebar { transform: none; }
  .nav-scrim { position: fixed; inset: 0; background: rgba(14, 19, 22, .45); z-index: 55; }
  .btn.menu-toggle { display: inline-flex; }
  .topbar { padding: 0 var(--sp-4); gap: var(--sp-2); }
  .topbar-title { display: none; }
  .content { padding: var(--sp-5) var(--sp-4) var(--sp-6); }
  .auth-shell { grid-template-columns: minmax(0, 1fr); }
  .auth-aside { display: none; }
  .auth-panel { padding: var(--sp-6) var(--sp-4); }
}
@media (max-width: 640px) {
  .user-chip-text, .topbar-sep { display: none; }
  .tenant-switch .select { max-width: 150px; }
  .tenant-pill { font-size: var(--fs-md); }
  .card-header, .card-body { padding-left: var(--sp-4); padding-right: var(--sp-4); }
  .card-footer { padding-left: var(--sp-4); padding-right: var(--sp-4); }
  .filters { padding: var(--sp-3); }
  .pagination { justify-content: center; }
}
@media (max-width: 560px) {
  .timeline::before { left: 11px; }
  .tl-item { grid-template-columns: 24px minmax(0, 1fr); }
  .tl-date { grid-column: 2; text-align: left; padding: 0 0 2px; }
  .tl-mark { grid-row: 1 / span 2; grid-column: 1; }
  .tl-mark::after { left: 6px; }
  .tl-body { grid-column: 2; }
  .tl-month { padding-left: 24px; }
  .dl { grid-template-columns: minmax(0, 1fr); }
  .dl dt { border-bottom: 0; padding-bottom: 0; }
  .dl dd { text-align: left; padding-top: 2px; }
  .page-header h1 { font-size: var(--fs-xl); }
  .stat-value { font-size: var(--fs-2xl); }
  .filters .field { max-width: none; }
  .callout { padding: var(--sp-4); padding-left: calc(var(--sp-4) + 4px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media print {
  .sidebar, .topbar, .page-actions, .comment-form, .no-print { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; }
}
