/* ==========================================================================
   App design system. Tokens first (light + dark), then layout, then components.
   Dark mode: follows the OS unless the user picks one (html[data-theme]).
   ========================================================================== */
html.app {
  /* type scale (around a 14px base) */
  --fs-xs: 11.5px; --fs-sm: 12.5px; --fs-base: 14px; --fs-md: 15px; --fs-lg: 17px; --fs-xl: 20px; --fs-2xl: 24px; --fs-3xl: 30px;
  --lh: 1.5;
  /* spacing (4px grid) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s7: 32px; --s8: 40px;
  --r-xs: 5px; --r-sm: 7px; --r: 10px; --r-lg: 14px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);

  /* light palette */
  --bg: #F3F5F8; --surface: #FFFFFF; --surface-2: #F9FAFC; --surface-3: #EEF1F5; --sunken: #EBEFF4;
  --line: #E1E6ED; --line-strong: #CDD5E0; --ink: #141C27; --ink-2: #344256; --muted: #5E6B7D; --faint: #8A96A6;
  --primary: #1E3A5F; --primary-hover: #152B47; --primary-ink: #FFFFFF; --primary-soft: #E3EAF3; --primary-tint: #F0F4F9; --primary-text: #1E3A5F;
  --accent: #D9682B; --accent-soft: #FCEADF; --accent-text: #9A4316;
  --ok: #18794E; --ok-soft: #E1F3E9; --warn: #A15C07; --warn-soft: #FCF0DA; --bad: #B42318; --bad-soft: #FDE8E6; --info: #2B5FA6; --info-soft: #E7EEF9;
  --chart-1: #1E3A5F; --chart-2: #D9682B; --chart-3: #8AA3C2; --chart-grid: #E8ECF1;
  --field: #FFFFFF; --focus: 0 0 0 3px rgba(30, 58, 95, .22);
  --shadow-sm: 0 1px 2px rgba(16, 24, 32, .05);
  --shadow: 0 1px 2px rgba(16, 24, 32, .04), 0 6px 20px -6px rgba(16, 24, 32, .10);
  --shadow-lg: 0 24px 64px -12px rgba(16, 24, 32, .28), 0 2px 6px rgba(16, 24, 32, .06);
  --scrim: rgba(18, 24, 30, .42);
  --side-bg: #FFFFFF; --side-ink: #344256; --side-on: #EBF0F6;
  /* names used by the shared base.css */
  --card: var(--surface); --paper: var(--surface-2); --primary-dark: var(--ink);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  html.app:not([data-theme="light"]) {
    --bg: #0B1119; --surface: #111A25; --surface-2: #15202D; --surface-3: #1A2736; --sunken: #0E1620;
    --line: #213044; --line-strong: #2D3F56; --ink: #E6ECF3; --ink-2: #C1CCDA; --muted: #91A0B3; --faint: #708096;
    --primary: #7BA6DB; --primary-hover: #94B9E6; --primary-ink: #08121F; --primary-soft: #182A40; --primary-tint: #132234; --primary-text: #9FC0EA;
    --accent: #EE8A4F; --accent-soft: #3A2316; --accent-text: #F6B48C;
    --ok: #4CC08A; --ok-soft: #10302A; --warn: #E9AE4F; --warn-soft: #33270F; --bad: #F2796A; --bad-soft: #3A1B19; --info: #7DA8F0; --info-soft: #1A2740;
    --chart-1: #7BA6DB; --chart-2: #EE8A4F; --chart-3: #31507A; --chart-grid: #1E2C3E;
    --field: #0E1620; --focus: 0 0 0 3px rgba(123, 166, 219, .35);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -8px rgba(0, 0, 0, .5);
    --shadow-lg: 0 24px 64px -12px rgba(0, 0, 0, .7);
    --scrim: rgba(0, 0, 0, .6);
    --side-bg: #0E1620; --side-ink: #C1CCDA; --side-on: #1A2736;
    color-scheme: dark;
  }
}
html.app[data-theme="dark"] {
  --bg: #0B1119; --surface: #111A25; --surface-2: #15202D; --surface-3: #1A2736; --sunken: #0E1620;
  --line: #213044; --line-strong: #2D3F56; --ink: #E6ECF3; --ink-2: #C1CCDA; --muted: #91A0B3; --faint: #708096;
  --primary: #7BA6DB; --primary-hover: #94B9E6; --primary-ink: #08121F; --primary-soft: #182A40; --primary-tint: #132234; --primary-text: #9FC0EA;
  --accent: #EE8A4F; --accent-soft: #3A2316; --accent-text: #F6B48C;
  --ok: #4CC08A; --ok-soft: #10302A; --warn: #E9AE4F; --warn-soft: #33270F; --bad: #F2796A; --bad-soft: #3A1B19; --info: #7DA8F0; --info-soft: #1A2740;
  --chart-1: #7BA6DB; --chart-2: #EE8A4F; --chart-3: #31507A; --chart-grid: #1E2C3E;
  --field: #0E1620; --focus: 0 0 0 3px rgba(123, 166, 219, .35);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -8px rgba(0, 0, 0, .5);
  --shadow-lg: 0 24px 64px -12px rgba(0, 0, 0, .7);
  --scrim: rgba(0, 0, 0, .6);
  --side-bg: #0E1620; --side-ink: #C1CCDA; --side-on: #1A2736;
  color-scheme: dark;
}

/* ---------------------------------------------------------------- base */
html.app body { background: var(--bg); color: var(--ink); font: var(--fs-base)/var(--lh) var(--font); -webkit-font-smoothing: antialiased; }
html.app h1, html.app h2, html.app h3 { font-family: var(--font); font-weight: 650; letter-spacing: -.012em; color: var(--ink); }
html.app a { color: var(--primary-text); }
html.app .muted { color: var(--muted); }
html.app .small { font-size: var(--fs-sm); }
html.app :focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-xs); }
html.app input, html.app select, html.app textarea {
  min-height: 38px; padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--field); color: var(--ink);
  font: var(--fs-base)/1.3 var(--font); transition: border-color .12s, box-shadow .12s;
}
html.app input[type="checkbox"], html.app input[type="radio"] { min-height: 16px; width: 16px; height: 16px; padding: 0; accent-color: var(--primary); }
html.app input:focus, html.app select:focus, html.app textarea:focus { border-color: var(--primary); box-shadow: var(--focus); outline: none; }
html.app input::placeholder, html.app textarea::placeholder { color: var(--faint); }
html.app label { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }
html.app .check { font-size: var(--fs-base); font-weight: 500; }
html.app .field .hint { color: var(--muted); font-size: var(--fs-sm); }
html.app input[type="file"] { background: var(--surface-2); }
.tnum, .num { font-variant-numeric: tabular-nums; }
kbd { font: 600 11px/1 var(--mono); padding: 3px 5px; border-radius: 4px; border: 1px solid var(--line-strong); border-bottom-width: 2px; color: var(--muted); background: var(--surface); }

/* buttons */
html.app .btn { min-height: 36px; padding: 7px 14px; border-radius: var(--r-sm); font: 600 var(--fs-base)/1.2 var(--font); background: var(--primary); color: var(--primary-ink);
  border: 1px solid transparent; box-shadow: var(--shadow-sm); gap: 7px; transition: background .12s, border-color .12s, transform .06s; }
html.app .btn:hover { background: var(--primary-hover); color: var(--primary-ink); }
html.app .btn:active { transform: translateY(.5px); }
html.app .btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
html.app .btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
html.app .btn.secondary:hover { background: var(--surface-3); color: var(--ink); }
html.app .btn.ghost { background: transparent; color: var(--ink-2); box-shadow: none; padding-inline: 9px; }
html.app .btn.ghost:hover { background: var(--surface-3); color: var(--ink); }
html.app .btn.accent { background: var(--accent); color: #fff; }
html.app .btn.danger { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); box-shadow: none; }
html.app .btn.danger:hover { background: var(--bad-soft); }
html.app .btn.small { min-height: 30px; padding: 4px 10px; font-size: var(--fs-sm); }
html.app .btn[disabled] { opacity: .5; pointer-events: none; }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh;
  background: linear-gradient(90deg, var(--side-bg) 247px, var(--line) 247px 248px, transparent 248px); }
.side { background: var(--side-bg); border-right: 1px solid var(--line); padding: 14px 10px; display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px 10px; text-decoration: none; color: var(--ink); }
html.app .brand { color: var(--ink); }
.brand img { width: 28px; height: 28px; }
.brand span { font-family: var(--font); font-weight: 800; font-size: 19px; letter-spacing: -.02em; }
.search-btn { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--muted); font: 500 var(--fs-base) var(--font); cursor: pointer; margin-bottom: 6px; white-space: nowrap; }
.search-btn:hover { border-color: var(--line-strong); color: var(--ink-2); }
.search-btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; }
.search-btn .k { margin-left: auto; display: flex; gap: 3px; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-group { font-size: var(--fs-xs); font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 14px 10px 5px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: var(--r-sm); color: var(--side-ink); text-decoration: none; font-weight: 520; font-size: var(--fs-base); }
.nav a svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; opacity: .8; }
.nav a:hover { background: var(--side-on); color: var(--ink); }
.nav a.on { background: var(--side-on); color: var(--ink); font-weight: 600; }
.nav a.on svg { opacity: 1; color: var(--primary-text); }
.nav a .badge { margin-left: auto; }
.side-foot { margin-top: auto; padding: 10px 6px 2px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.plan-chip { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 650; color: var(--accent-text); background: var(--accent-soft);
  border-radius: 999px; padding: 3px 9px; width: max-content; text-decoration: none; }
html.app a.plan-chip { color: var(--accent-text); }
.who-row { display: flex; align-items: center; gap: 6px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-text); display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.who { font-size: var(--fs-sm); color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.icon-btn { border: 0; background: transparent; width: 34px; height: 34px; border-radius: var(--r-sm); display: grid; place-items: center; color: var(--muted); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--side-on); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.9; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.view { padding: 26px 36px 72px; max-width: 1280px; width: 100%; margin: 0 auto; outline: none; }
.banner { padding: 12px 36px 0; max-width: 1280px; margin: 0 auto; width: 100%; }
.banner:empty { display: none; }

/* page header */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s5); }
html.app .page-head h1 { font-size: var(--fs-2xl); margin: 0; }
.page-head .sub { color: var(--muted); margin: 3px 0 0; font-size: var(--fs-base); }
.crumbs { font-size: var(--fs-sm); color: var(--muted); margin-bottom: 4px; }
html.app .crumbs a { color: var(--muted); text-decoration: none; }
html.app .crumbs a:hover { color: var(--ink); }
.actions { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }

/* cards and grids */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s5); box-shadow: var(--shadow-sm); }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-head { padding: var(--s4) var(--s5) 0; }
.card + .card, .grid + .card, .card + .grid, .tabs + .card, .grid + .grid { margin-top: var(--s4); }
.grid > .card + .card, .grid > * + * { margin-top: 0; }
html.app .card h2 { font-size: var(--fs-md); font-weight: 650; margin: 0 0 var(--s3); letter-spacing: -.005em; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); margin-bottom: var(--s3); flex-wrap: wrap; }
html.app .card-head h2 { margin: 0; }
.card-head .sub { color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; }
.grid { display: grid; gap: var(--s4); }
.grid.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.two { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.grid.half { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

/* KPIs */
.kpi { position: relative; }
.kpi .label { color: var(--muted); font-size: var(--fs-sm); font-weight: 560; display: flex; align-items: center; gap: 6px; }
.kpi .value { font: 650 var(--fs-3xl)/1.1 var(--font); letter-spacing: -.02em; color: var(--ink); margin-top: 6px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi .value.bad { color: var(--bad); }
.kpi .meta { color: var(--muted); font-size: var(--fs-sm); margin-top: 6px; }
.kpi a.stretch { color: inherit; text-decoration: none; }
.kpi a.stretch::after { content: ''; position: absolute; inset: 0; border-radius: inherit; }
.kpi:has(a.stretch):hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.meter { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 10px; }
.meter > i { display: block; height: 100%; background: var(--primary); border-radius: 99px; transition: width .6s var(--ease); }

/* pills and badges */
html.app .pill { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 650; white-space: nowrap; line-height: 18px; }
html.app .pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
html.app .pill.plain::before { display: none; }
html.app .pill.ok { background: var(--ok-soft); color: var(--ok); }
html.app .pill.warn { background: var(--warn-soft); color: var(--warn); }
html.app .pill.bad { background: var(--bad-soft); color: var(--bad); }
html.app .pill.info { background: var(--info-soft); color: var(--info); }
html.app .pill.mute { background: var(--surface-3); color: var(--muted); }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; background: var(--bad-soft); color: var(--bad); }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: var(--s4); overflow-x: auto; scrollbar-width: none; }
html.app .tabs a { padding: 8px 12px; text-decoration: none; color: var(--muted); font-weight: 560; font-size: var(--fs-base); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
html.app .tabs a:hover { color: var(--ink); }
html.app .tabs a.on { color: var(--ink); border-bottom-color: var(--primary); font-weight: 620; }
.seg { display: inline-flex; background: var(--surface-3); border-radius: var(--r-sm); padding: 2px; gap: 2px; }
html.app .seg a, .seg button { border: 0; background: transparent; padding: 4px 10px; border-radius: 5px; font: 560 var(--fs-sm) var(--font); color: var(--muted); text-decoration: none; cursor: pointer; }
html.app .seg .on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ---------------------------------------------------------------- data table */
.dt-toolbar { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); }
.dt-search { position: relative; flex: 1 1 220px; max-width: 320px; }
.dt-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; stroke: var(--faint); fill: none; stroke-width: 2; pointer-events: none; }
html.app .dt-search input { padding-left: 32px; min-height: 34px; background: var(--surface-2); }
html.app .dt-toolbar select { width: auto; min-height: 34px; padding: 5px 10px; font-size: var(--fs-sm); background-color: var(--surface-2); }
.dt-count { margin-left: auto; color: var(--muted); font-size: var(--fs-sm); white-space: nowrap; }
.dt-wrap { overflow-x: auto; }
table.dt { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-base); }
table.dt th { background: var(--surface-2); text-align: left; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 650; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.dt th button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
table.dt th button:focus-visible { box-shadow: var(--focus); border-radius: 3px; }
table.dt th .arrow { opacity: .35; font-size: 10px; }
table.dt th[aria-sort] .arrow { opacity: 1; color: var(--ink); }
table.dt th.num button { flex-direction: row-reverse; }
table.dt td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.dt tbody tr { transition: background .08s; }
table.dt tbody tr:hover { background: var(--surface-2); }
table.dt tbody tr:last-child td { border-bottom: 0; }
table.dt tbody tr.removing { opacity: .35; }
table.dt .num { text-align: right; white-space: nowrap; }
table.dt td .sub { color: var(--muted); font-size: var(--fs-sm); margin-top: 1px; }
html.app table.dt td a { font-weight: 600; text-decoration: none; color: var(--ink); }
html.app table.dt td a:hover { color: var(--primary-text); text-decoration: underline; }
html.app table.dt td a.btn { color: var(--ink-2); font-weight: 600; }
html.app table.dt td a.btn:hover { text-decoration: none; }
table.dt tfoot td { font-weight: 650; border-top: 1px solid var(--line-strong); background: var(--surface-2); padding: 9px 12px; }
td.editable { cursor: text; position: relative; }
td.editable:hover { box-shadow: inset 0 0 0 1px var(--line-strong); }
td.editing { padding: 3px 6px !important; }
html.app td.editing input, html.app td.editing select { min-height: 30px; padding: 4px 8px; font-size: var(--fs-base); }
td.saved { animation: flash 1.2s var(--ease); }
@keyframes flash { 0% { background: var(--ok-soft); } 100% { background: transparent; } }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; flex-wrap: nowrap; }
.dt-more { display: flex; justify-content: center; padding: var(--s3); border-top: 1px solid var(--line); }

/* simple tables (reports) */
table.t { width: 100%; border-collapse: collapse; font-size: var(--fs-base); }
table.t th { text-align: left; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.t .num, table.t th.num { text-align: right; }
table.t tr.sub td { color: var(--muted); font-size: var(--fs-xs); font-weight: 650; letter-spacing: .05em; padding-top: 14px; }
table.t tr.total td { font-weight: 650; background: var(--surface-2); }
table.t tr.grand td { font-weight: 700; background: var(--primary-tint); }
.table-wrap { overflow-x: auto; }

/* ---------------------------------------------------------------- empty states and skeletons */
.empty { text-align: center; padding: 44px 24px; }
.empty .ill { width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 15px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-text); }
.empty .ill svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
html.app .empty h3 { font-size: var(--fs-lg); margin: 0 0 6px; }
.empty p { color: var(--muted); max-width: 440px; margin: 0 auto; }
.empty .actions { justify-content: center; margin-top: var(--s4); }
.sk { display: block; border-radius: 6px; background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 50%, var(--surface-3) 100%); background-size: 200% 100%;
  animation: shimmer 1.3s infinite linear; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.sk.h1 { height: 26px; width: 220px; margin-bottom: 8px; }
.sk.line { height: 12px; margin: 10px 0; }
.sk.kpi { height: 108px; border-radius: var(--r-lg); }
.sk.block { height: 280px; border-radius: var(--r-lg); }

/* ---------------------------------------------------------------- charts */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font: 11px var(--font); fill: var(--muted); }
.chart .grid-line { stroke: var(--chart-grid); }
.chart .axis { stroke: var(--line-strong); }
.chart .s1 { fill: var(--chart-1); }
.chart .s2 { fill: var(--chart-2); }
.chart .line1 { stroke: var(--chart-1); fill: none; stroke-width: 2.2; stroke-linejoin: round; }
.chart .line2 { stroke: var(--chart-2); fill: none; stroke-width: 2.2; stroke-linejoin: round; }
.chart .area1 { fill: var(--chart-1); opacity: .10; }
.chart .dot1 { fill: var(--surface); stroke: var(--chart-1); stroke-width: 2; }
.chart .dot2 { fill: var(--surface); stroke: var(--chart-2); stroke-width: 2; }
.chart g.col .hit { fill: transparent; }
.chart g.col:hover .hit { fill: var(--surface-3); }
.legend { display: flex; gap: 14px; font-size: var(--fs-sm); color: var(--muted); margin-top: 8px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(80px, 150px) 1fr auto; gap: 10px; align-items: center; font-size: var(--fs-sm); }
html.app .hbar .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 560; color: var(--ink-2); text-decoration: none; }
html.app .hbar .name:hover { color: var(--primary-text); }
.hbar .track { height: 8px; background: var(--surface-3); border-radius: 99px; position: relative; overflow: hidden; }
.hbar .track i { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 99px; background: var(--chart-1); }
.hbar .track i.neg { background: var(--bad); }
.hbar .v { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; min-width: 76px; }

/* ---------------------------------------------------------------- lists, alerts */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: var(--fs-base); }
.list li:last-child { border-bottom: 0; }
.list .sub { color: var(--muted); font-size: var(--fs-sm); }
.alerts { display: flex; flex-direction: column; gap: 8px; }
html.app a.alert, .alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface-2); text-decoration: none; color: var(--ink); }
html.app a.alert:hover { border-color: var(--line-strong); background: var(--surface-3); }
.alert .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: none; }
.alert.bad .dot { background: var(--bad); } .alert.warn .dot { background: var(--warn); } .alert.info .dot { background: var(--info); }
.alert b { font-weight: 600; display: block; }
.alert span { color: var(--muted); font-size: var(--fs-sm); }
html.app .error-box { background: var(--bad-soft); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 25%, transparent); border-radius: var(--r-sm); }
html.app .ok-box { background: var(--ok-soft); color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 25%, transparent); border-radius: var(--r-sm); }
html.app .notice { background: var(--accent-soft); color: var(--accent-text); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-radius: var(--r-sm); }
.callout { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--r); background: var(--primary-tint); border: 1px solid var(--primary-soft); }

/* properties */
.props { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--s4); }
.prop { display: flex; flex-direction: column; gap: 12px; position: relative; transition: border-color .12s, box-shadow .12s; }
.prop:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.prop .top { display: flex; gap: 10px; align-items: flex-start; }
.prop .top > div { flex: 1; min-width: 0; }
html.app .prop h3 { font-size: var(--fs-md); margin: 0; }
html.app .prop h3 a { color: var(--ink); text-decoration: none; }
html.app .prop h3 a::after { content: ''; position: absolute; inset: 0; }
.prop .btn, .prop .unit a, .prop .unit button { position: relative; z-index: 1; }
.prop .addr { color: var(--muted); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prop .stats { display: flex; gap: 18px; font-size: var(--fs-sm); color: var(--muted); }
.prop .stats b { color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 650; display: block; font-size: var(--fs-md); }
.units { display: flex; flex-direction: column; gap: 4px; }
.unit { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 10px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); font-size: var(--fs-sm); min-height: 38px; }
.unit .u-name { font-weight: 600; }
.ptype { display: inline-flex; width: 34px; height: 34px; border-radius: 10px; background: var(--primary-soft); color: var(--primary-text); align-items: center; justify-content: center; flex: none; }
.ptype svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ptype.str { background: var(--accent-soft); color: var(--accent-text); }

/* board (maintenance) */
.board { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: var(--s3); overflow-x: auto; padding-bottom: 6px; }
.lane { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px; min-height: 160px; }
html.app .lane h3 { font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 2px 4px 10px; display: flex; justify-content: space-between; }
.wo { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; margin-bottom: 8px; cursor: pointer; box-shadow: var(--shadow-sm); display: block; width: 100%; text-align: left; font: inherit; color: inherit; }
.wo:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.wo b { display: block; font-weight: 600; margin-bottom: 2px; }
.wo .meta { font-size: var(--fs-sm); color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.lane .none { color: var(--faint); font-size: var(--fs-sm); padding: 6px 4px; }

/* calendar */
.cal-wrap { overflow-x: auto; }
table.cal { border-collapse: separate; border-spacing: 0; font-size: 12px; min-width: 100%; }
table.cal th, table.cal td { padding: 0; text-align: center; min-width: 28px; height: 38px; border-bottom: 1px solid var(--line); }
table.cal th { color: var(--muted); font-weight: 600; font-size: 11px; line-height: 1.3; }
table.cal th.we, table.cal td.we { background: var(--surface-2); }
table.cal td.name, table.cal th.name { text-align: left; padding: 0 12px 0 0; min-width: 150px; font-weight: 600; font-size: var(--fs-sm); position: sticky; left: 0; background: var(--surface); z-index: 1; }
table.cal td.b { background: var(--primary-soft); }
table.cal td.b.start { background: var(--primary); color: var(--primary-ink); font-weight: 700; border-radius: 7px 0 0 7px; }
table.cal td.b.end { border-radius: 0 7px 7px 0; }
table.cal td.b.start.end { border-radius: 7px; }
table.cal td.today, table.cal th.today { box-shadow: inset 0 0 0 2px var(--accent); }

/* ---------------------------------------------------------------- dialogs: modal, drawer, sheet */
.modal { border: 0; padding: 0; color: var(--ink); background: var(--surface); box-shadow: var(--shadow-lg); max-height: calc(100vh - 32px); }
.modal::backdrop { background: var(--scrim); }
.modal.center { border-radius: var(--r-lg); width: min(520px, calc(100vw - 24px)); }
.modal.drawer { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(500px, 100vw); border-radius: 0; border-left: 1px solid var(--line); }
.modal.drawer.wide { width: min(760px, 100vw); }
.modal[open].drawer { animation: slidein .22s var(--ease); }
.modal[open].center { animation: pop .16s var(--ease); }
@keyframes slidein { from { transform: translateX(24px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes pop { from { transform: scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
.modal form, .modal .frame { display: flex; flex-direction: column; max-height: inherit; height: 100%; }
.modal .m-head { padding: 14px 16px 14px 20px; display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
html.app .modal .m-head h2 { font-size: var(--fs-lg); margin: 0; }
.modal .m-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.modal .m-foot { padding: 12px 20px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); background: var(--surface-2); }
.x-btn { border: 0; background: transparent; width: 32px; height: 32px; border-radius: var(--r-sm); cursor: pointer; color: var(--muted); display: grid; place-items: center; flex: none; }
.x-btn:hover { background: var(--surface-3); color: var(--ink); }
.x-btn svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
html.app details.more > summary { cursor: pointer; color: var(--muted); font-size: var(--fs-sm); font-weight: 600; margin: 4px 0 12px; }
.receipt-preview { display: flex; gap: 10px; align-items: center; margin-top: 8px; font-size: var(--fs-sm); color: var(--muted); }
.receipt-preview img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.camera-btn { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px; border: 1.5px dashed var(--line-strong); border-radius: var(--r); cursor: pointer; color: var(--ink-2); font-weight: 600; background: var(--surface-2); }
html.app label.camera-btn { font-size: var(--fs-base); }
.camera-btn:hover, .camera-btn:focus-within { border-color: var(--primary); color: var(--primary-text); }
.camera-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.camera-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* command palette */
.palette { border: 0; padding: 0; width: min(620px, calc(100vw - 24px)); border-radius: var(--r-lg); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg);
  margin: 12vh auto auto; max-height: 70vh; overflow: hidden; }
.palette::backdrop { background: var(--scrim); }
.palette .p-in { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.palette .p-in svg { width: 18px; height: 18px; stroke: var(--faint); fill: none; stroke-width: 2; flex: none; }
html.app .palette input { border: 0; box-shadow: none; min-height: 52px; font-size: var(--fs-md); padding: 0; background: transparent; }
.palette ul { list-style: none; margin: 0; padding: 6px; max-height: calc(70vh - 96px); overflow-y: auto; }
.palette li.group { font-size: var(--fs-xs); color: var(--faint); text-transform: uppercase; letter-spacing: .06em; font-weight: 650; padding: 10px 10px 4px; }
.palette li.item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; }
.palette li.item[aria-selected="true"] { background: var(--surface-3); }
.palette li.item .ic { width: 26px; height: 26px; border-radius: 7px; background: var(--surface-3); display: grid; place-items: center; color: var(--muted); flex: none; }
.palette li.item[aria-selected="true"] .ic { background: var(--primary-soft); color: var(--primary-text); }
.palette li.item .ic svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.palette li.item .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette li.item .s { color: var(--muted); font-size: var(--fs-sm); margin-left: 6px; }
.palette li.item .k { font-size: var(--fs-xs); color: var(--faint); }
.palette li.none { padding: 22px; text-align: center; color: var(--muted); }
.palette .p-foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: var(--fs-xs); color: var(--muted); background: var(--surface-2); }

/* toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 80; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; background: #142236; color: #F2F5F6; padding: 10px 12px 10px 14px; border-radius: var(--r);
  box-shadow: var(--shadow-lg); font-size: var(--fs-base); max-width: 420px; animation: toastin .2s var(--ease); }
.toast .ic { width: 18px; height: 18px; border-radius: 50%; flex: none; display: grid; place-items: center; background: #2E9E6A; color: #fff; font-size: 11px; font-weight: 800; }
.toast.bad .ic { background: #E0573F; }
.toast button { margin-left: auto; border: 0; background: rgba(255, 255, 255, .14); color: #fff; font: 650 var(--fs-sm) var(--font); padding: 5px 10px; border-radius: 6px; cursor: pointer; }
.toast button:hover { background: rgba(255, 255, 255, .24); }
@keyframes toastin { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* onboarding wizard */
.wizard { border: 0; padding: 0; width: min(640px, calc(100vw - 24px)); border-radius: 18px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
.wizard::backdrop { background: var(--scrim); }
.wizard .w-steps { display: flex; gap: 6px; padding: 18px 24px 0; }
.wizard .w-steps i { height: 4px; flex: 1; border-radius: 99px; background: var(--surface-3); }
.wizard .w-steps i.on { background: var(--primary); }
.wizard .w-body { padding: 22px 24px 8px; }
html.app .wizard h2 { font-size: var(--fs-2xl); margin: 0 0 6px; }
.wizard .lead { color: var(--muted); margin: 0 0 18px; }
.wizard .w-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 14px 24px 20px; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice { all: unset; box-sizing: border-box; display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 1px solid var(--line-strong); border-radius: var(--r-lg); cursor: pointer; background: var(--surface); }
.choice:hover, .choice:focus-visible { border-color: var(--primary); box-shadow: var(--focus); }
.choice b { font-weight: 650; }
.choice span { color: var(--muted); font-size: var(--fs-sm); }

/* import */
.dropzone { border: 1.5px dashed var(--line-strong); border-radius: var(--r-lg); padding: 30px 20px; text-align: center; background: var(--surface-2); transition: border-color .12s, background .12s; }
.dropzone.drag { border-color: var(--primary); background: var(--primary-tint); }
.dropzone input[type=file] { max-width: 340px; margin: 12px auto 0; display: block; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin: 12px 0; }
.summary-grid div { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; }
.summary-grid b { display: block; font: 650 var(--fs-xl) var(--font); color: var(--ink); font-variant-numeric: tabular-nums; }
.summary-grid span { font-size: var(--fs-sm); color: var(--muted); }

/* plans */
.plan-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.plan-card { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; background: var(--surface-2); display: flex; flex-direction: column; }
.plan-card.current { border: 1.5px solid var(--primary); background: var(--surface); }
html.app .plan-card h3 { font-size: var(--fs-lg); margin: 0; }
.plan-card .p { font-weight: 700; margin: 4px 0 8px; font-variant-numeric: tabular-nums; }
.plan-card ul { margin: 0 0 12px; padding-left: 18px; font-size: var(--fs-sm); color: var(--muted); flex: 1; }

/* key-value lists, share links */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: var(--fs-base); margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 520; }
.copy-row { display: flex; gap: 8px; }
html.app .copy-row input { font: var(--fs-sm) var(--mono); }

/* activity */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 24px 1fr auto; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: start; }
.timeline li:last-child { border-bottom: 0; }
.timeline .tdot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; background: var(--surface-3); color: var(--muted); }
.timeline .tdot.create { background: var(--ok-soft); color: var(--ok); }
.timeline .tdot.delete { background: var(--bad-soft); color: var(--bad); }
.timeline .tdot.import { background: var(--info-soft); color: var(--info); }
.timeline .tdot.billing, .timeline .tdot.settings { background: var(--accent-soft); color: var(--accent-text); }
.timeline time { color: var(--faint); font-size: var(--fs-sm); white-space: nowrap; }

/* bottom tab bar (mobile) */
.tabbar { display: none; }
.scrim { display: none; }
.only-md { display: none !important; }

@media (max-width: 1100px) {
  .grid.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.two, .grid.half { grid-template-columns: 1fr; }
  .plan-cards { grid-template-columns: 1fr; }
  .board { grid-template-columns: repeat(4, 240px); }
}
@media (max-width: 780px) {
  .shell { grid-template-columns: 1fr; background: none; }
  .side { position: fixed; z-index: 70; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-105%); transition: transform .22s var(--ease); box-shadow: var(--shadow-lg); }
  .side.open { transform: none; }
  .scrim.show { display: block; position: fixed; inset: 0; background: var(--scrim); z-index: 60; }
  .topbar { display: flex; align-items: center; gap: 4px; padding: 8px 8px; padding-top: max(8px, env(safe-area-inset-top)); background: color-mix(in srgb, var(--surface) 90%, transparent);
    backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
  .topbar .brand { padding: 0 4px; flex: 1; }
  .topbar .brand span { font-size: 18px; }
  .topbar .icon-btn { width: 40px; height: 40px; }
  .topbar .icon-btn svg { width: 21px; height: 21px; }
  .view { padding: 18px 16px calc(96px + env(safe-area-inset-bottom)); }
  .banner { padding: 10px 16px 0; }
  .banner .callout { flex-wrap: nowrap; padding: 8px 10px 8px 12px; font-size: var(--fs-sm); line-height: 1.4; gap: 10px; flex-direction: row; align-items: center; }
  .banner .callout .btn { flex: none; }
  .page-head { margin-bottom: 16px; align-items: flex-start; }
  html.app .page-head h1 { font-size: var(--fs-xl); }
  .page-head .actions .btn:not(.keep) { display: none; }
  .grid.k4, .grid.k3 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi .value { font-size: var(--fs-xl); }
  .card { padding: 14px; border-radius: var(--r); }
  .card.flush > .card-head { padding: 14px 14px 0; }
  .row2, .row3 { grid-template-columns: 1fr; gap: 0; }
  .hide-md { display: none !important; }
  .only-md { display: inline-flex !important; }
  .props { grid-template-columns: 1fr; }
  .choice-grid { grid-template-columns: 1fr; }
  .dt-toolbar { padding: 10px 12px; }
  .dt-search { max-width: none; flex-basis: 100%; }
  .dt-count { display: none; }
  /* tables become stacked rows */
  table.dt.stack thead { display: none; }
  table.dt.stack, table.dt.stack tbody, table.dt.stack tfoot, table.dt.stack tr, table.dt.stack td { display: block; }
  table.dt.stack tr { padding: 10px 14px; border-bottom: 1px solid var(--line); position: relative; }
  table.dt.stack tbody tr:last-child { border-bottom: 0; }
  table.dt.stack td { border: 0; padding: 1px 0; text-align: left; }
  table.dt.stack td.num { text-align: left; }
  table.dt.stack td.lead-num { position: absolute; right: 14px; top: 10px; font-weight: 650; }
  table.dt.stack td[data-mhide] { display: none; }
  table.dt.stack td.num:not(.lead-num) { color: var(--muted); font-size: var(--fs-sm); }
  table.dt.stack td.num:not(.lead-num)::before { content: attr(data-label) ': '; }
  table.dt.stack td.actions-cell .row-actions { justify-content: flex-start; margin-top: 4px; margin-left: -9px; }
  table.dt.stack td:first-child { padding-right: 120px; }
  table.dt.stack tfoot td { padding: 2px 0; background: transparent; }
  .modal.drawer, .modal.center { margin: auto 0 0; width: 100vw; max-width: 100vw; height: auto; max-height: 92vh; border-radius: 16px 16px 0 0; border: 0; }
  .modal[open].drawer, .modal[open].center { animation: sheetup .24s var(--ease); }
  .modal .m-foot { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .palette { margin-top: 8px; max-height: 80vh; }
  .toasts { left: 12px; right: 12px; bottom: calc(78px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding: 6px 4px max(6px, env(safe-area-inset-bottom)); }
  .tabbar a, .tabbar button { all: unset; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; font-weight: 600; color: var(--muted); padding: 4px 0; cursor: pointer; }
  .tabbar svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  html.app .tabbar a.on { color: var(--primary-text); }
  .tabbar .fab { width: 46px; height: 46px; border-radius: 15px; background: var(--primary); color: var(--primary-ink); display: grid; place-items: center; box-shadow: var(--shadow); }
  .tabbar .fab svg { width: 24px; height: 24px; stroke-width: 2.2; }
  .board { grid-template-columns: repeat(4, 82vw); scroll-snap-type: x mandatory; }
  .lane { scroll-snap-align: start; }
}
@keyframes sheetup { from { transform: translateY(30px); opacity: .5; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------------------------------------------------------------- tenant share page (/t/) */
html.app { background: var(--bg); }
html.app .share-page { max-width: 880px; margin: 0 auto; padding: var(--s8) var(--s4) var(--s4); display: grid; gap: var(--s4); outline: none; }
html.app .share-head h1 { font-size: var(--fs-3xl); margin: 2px 0 4px; }
html.app .share-head .eyebrow { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; margin: 0; }
html.app .share-lease h2 { font-size: var(--fs-lg); margin: 0 0 2px; }
html.app .share-lease h3 { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: var(--s4) 0 var(--s2); }
html.app .share-lease-head { display: flex; gap: var(--s4); justify-content: space-between; align-items: flex-start; flex-wrap: wrap; }
html.app .share-bal { text-align: right; padding: var(--s2) var(--s4); border-radius: var(--r); background: var(--ok-soft); color: var(--ok); }
html.app .share-bal.owe { background: var(--bad-soft); color: var(--bad); }
html.app .share-bal span { display: block; font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
html.app .share-bal b { font-size: var(--fs-xl); font-variant-numeric: tabular-nums; }
html.app .share-cols { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s6); }
html.app .share-empty { text-align: center; padding: var(--s8) var(--s6); }
html.app .share-foot { text-align: center; color: var(--faint); font-size: var(--fs-sm); padding: var(--s6) var(--s4) var(--s8); }
@media (max-width: 780px) { html.app .share-cols { grid-template-columns: 1fr; gap: 0; } html.app { background: var(--bg); }
html.app .share-page { padding-top: var(--s6); } html.app .share-bal { text-align: left; } }

html.app .list li a { color: var(--ink); text-decoration: none; }
html.app .list li a:hover { color: var(--primary-text); text-decoration: underline; text-underline-offset: 2px; }
html.app .table-wrap table.t td:first-child { white-space: nowrap; }
html.app table.dt td .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }

/* ================================================================ HaulReady screens */
.sdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--faint); }
.sdot.red { background: var(--bad); } .sdot.amber { background: var(--warn); } .sdot.green { background: var(--ok); } .sdot.na { background: var(--faint); }
.kpi .value.ok { color: var(--ok); } .kpi .value.warn { color: var(--warn); } .kpi .value.muted { color: var(--faint); }
.kpi .value small { font-size: .5em; color: var(--muted); font-weight: 560; margin-left: 2px; }
.meter.green > i { background: var(--ok); } .meter.amber > i { background: var(--warn); } .meter.red > i { background: var(--bad); }
.neg { color: var(--bad); } .pos { color: var(--ok); }
.fine { color: var(--muted); font-size: var(--fs-xs); margin: 14px 0 0; line-height: 1.5; }
.year-pick { min-height: 38px; }

/* score ring */
.ring { position: relative; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 11; }
.ring .track { stroke: var(--surface-3); }
.ring .val { stroke: var(--primary); stroke-linecap: round; transition: stroke-dashoffset .8s var(--ease); }
.ring.green .val { stroke: var(--ok); } .ring.amber .val { stroke: var(--warn); } .ring.red .val { stroke: var(--bad); }
.ring-n { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-n b { font-size: 34px; font-weight: 800; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ring-n span { color: var(--muted); font-size: var(--fs-xs); margin-top: 2px; }
.score-card { display: flex; gap: 24px; align-items: center; }
html.app .score-text h2 { font-size: var(--fs-2xl); margin: 0 0 4px; }
.score-text p { margin: 0; max-width: 62ch; }
.score-counts { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: var(--fs-sm); }
.score-counts span { display: inline-flex; align-items: center; gap: 6px; }

/* callouts, area lists, fleet mini */
html.app .callout.bad-callout { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 28%, transparent); justify-content: flex-start; align-items: flex-start; flex-wrap: nowrap; margin-bottom: 12px; }
.bad-callout > svg { width: 20px; height: 20px; stroke: var(--bad); fill: none; stroke-width: 2; flex: none; margin-top: 1px; }
.bad-callout b { color: var(--bad); }
.bad-callout ul { margin: 6px 0 0; padding-left: 18px; font-size: var(--fs-sm); }
.bad-callout li + li { margin-top: 3px; }
.area-list a { color: var(--ink); text-decoration: none; }
.area-list a:hover { text-decoration: underline; }
.area-counts { display: inline-flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.fleet-mini { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
html.app .fleet-mini a { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: var(--fs-sm); }
.fleet-mini a:hover { border-color: var(--line-strong); }
.fleet-mini svg { width: 20px; height: 20px; stroke: var(--primary); fill: none; stroke-width: 1.8; flex: none; }

/* New Entrant timeline */
.ne-card { margin-top: var(--s4); }
.timeline-bar { position: relative; height: 12px; border-radius: 99px; background: var(--surface-3); margin: 6px 0 8px; }
.timeline-bar .win { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 99px; }
.timeline-bar .now { position: absolute; top: -5px; width: 4px; height: 22px; margin-left: -2px; border-radius: 2px; background: var(--primary); box-shadow: 0 0 0 2px var(--surface); }
.timeline-labels { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

/* audit checklist */
.checklist { scroll-margin-top: 80px; }
.checklist ul { list-style: none; margin: 0; padding: 0; }
.ck { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); scroll-margin-top: 90px; }
.ck .sdot { margin-top: 6px; }
.ck-main { flex: 1; min-width: 0; }
.ck-title { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.ck-title b { font-weight: 620; }
.ck-detail { color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; }
.ck-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: var(--fs-xs); color: var(--faint); margin-top: 4px; }
.ck-meta span { display: inline-flex; align-items: center; gap: 4px; }
.ck-meta svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2; }
.ck-act { display: flex; gap: 6px; flex: none; align-items: center; }
.ck.green .ck-title b { color: var(--muted); font-weight: 560; }

/* wizard extras */
.carrier-card { border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; margin-top: 14px; background: var(--surface-2); }
.cc-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 8px; }
.carrier-card .kv { margin-top: 10px; font-size: var(--fs-sm); }
.derived { margin: 0 0 16px; }
.derived li span { display: inline-flex; gap: 8px; align-items: center; color: var(--muted); }
.derived svg { width: 16px; height: 16px; stroke: var(--primary); fill: none; stroke-width: 1.8; }
.derived b { text-align: right; }

/* tables */
.dl-table td:first-child { width: 1%; }
.dl-table td:last-child { width: 1%; text-align: right; white-space: nowrap; }
table.t .sub { color: var(--muted); font-size: var(--fs-sm); }
table.t.pl td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; }
table.t.pl tr.total td:first-child { background: var(--surface-2); } table.t.pl tr.grand td:first-child { background: var(--primary-tint); }
table.t.pl td, table.t.pl th { white-space: nowrap; }
table.t.ifta input { width: 96px; min-height: 32px; padding: 4px 8px; text-align: right; font-variant-numeric: tabular-nums; }
.ifta-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding: var(--s4) var(--s5); border-top: 1px solid var(--line); }
table.t.mis td, table.t.mis th { white-space: nowrap; }
fieldset.fs { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px 4px; margin: 6px 0 12px; }
fieldset.fs legend { font-size: var(--fs-sm); font-weight: 620; padding: 0 6px; color: var(--muted); }

/* packet */
.packet-tree { list-style: none; margin: 0; padding: 0; }
.packet-tree > li { border-top: 1px solid var(--line); }
.packet-tree > li:first-child { border-top: 0; }
.packet-tree summary { display: flex; gap: 10px; align-items: center; padding: 10px 0; cursor: pointer; list-style: none; }
.packet-tree summary::-webkit-details-marker { display: none; }
.packet-tree summary svg { width: 18px; height: 18px; stroke: var(--accent); fill: none; stroke-width: 1.8; flex: none; }
.packet-tree summary .muted { font-size: var(--fs-sm); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.packet-tree .count { font-size: var(--fs-xs); font-weight: 650; color: var(--muted); background: var(--surface-3); border-radius: 99px; padding: 1px 8px; }
.packet-tree ul { list-style: none; margin: 0 0 10px 28px; padding: 0; }
.packet-tree ul li { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 4px 0; font-size: var(--fs-sm); }
.packet-tree .path { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; overflow-wrap: anywhere; color: var(--ink); }

/* forms on pages */
.form-card h2 { margin-top: var(--s5) !important; }
.form-card h2:first-of-type { margin-top: 0 !important; }
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.checks { display: flex; flex-wrap: wrap; gap: 4px 22px; margin: 4px 0 6px; }
.checks.col { flex-direction: column; }
.checks .field { margin-bottom: 4px; }
.form-foot { display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); margin-top: var(--s4); padding-top: var(--s4); }
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin: 0; flex: 1 1 220px; max-width: 320px; }
html.app .danger-zone { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
html.app .danger-zone h2 { color: var(--bad); }

/* billing */
.usage { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.usage > div { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; font-size: var(--fs-sm); }
.usage i { grid-column: 1 / -1; height: 6px; border-radius: 99px; background: var(--surface-3); position: relative; overflow: hidden; }
.usage i::after { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--primary); border-radius: 99px; }
.plan-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.plan-opt { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.plan-opt.featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.plan-opt .pn { font-weight: 800; font-size: var(--fs-lg); }
.plan-opt .pp b { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.plan-opt .pp span { color: var(--muted); margin-left: 2px; }
.plan-opt ul { list-style: none; margin: 6px 0 12px; padding: 0; font-size: var(--fs-sm); flex: 1; }
.plan-opt li { display: flex; gap: 8px; align-items: flex-start; padding: 3px 0; }
.plan-opt li svg { width: 15px; height: 15px; stroke: var(--ok); fill: none; stroke-width: 2.4; flex: none; margin-top: 3px; }
html.app .btn.block { width: 100%; justify-content: center; }

/* activity */
.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.activity li:first-child { border-top: 0; }
.activity .sub { color: var(--muted); font-size: var(--fs-sm); }

@media (max-width: 780px) {
  .score-card { flex-direction: column; text-align: center; gap: 14px; }
  .score-counts { justify-content: center; }
  .row3, .usage, .plan-pick, .fleet-mini { grid-template-columns: 1fr; }
  .ck { flex-wrap: wrap; }
  .ck-act { width: 100%; padding-left: 21px; }
  .timeline-labels { font-size: 11px; }
  .inline-form .field { max-width: none; }
  .ifta-foot { padding: var(--s4); }
}

/* default for inline icons that no component rule sizes (zero specificity, so component rules win) */
:where(html.app svg[viewBox="0 0 24 24"]) { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; vertical-align: -2px; flex: none; }
.status-strip { display: flex; gap: 8px 12px; align-items: baseline; flex-wrap: wrap; border-left: 4px solid var(--line-strong); }
.status-strip.red { border-left-color: var(--bad); } .status-strip.amber { border-left-color: var(--warn); } .status-strip.green { border-left-color: var(--ok); }
.status-strip > span:not(.pill) { flex: 1 1 320px; min-width: 0; }
.status-strip > .muted.small { flex: 0 0 auto; margin-left: auto; white-space: nowrap; }
table.t.mis { font-size: var(--fs-sm); }
table.t.mis th, table.t.mis td { padding: 7px 6px; }
table.t.mis th { letter-spacing: .02em; }
.alerts.clamp .alert span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
table.t tr.det td { color: var(--muted); }
table.t tr.det td:first-child { padding-left: 22px; }
.page-head .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
html.app .page-head .actions select { width: auto; min-width: 110px; }
