/* ============================================================================
   1-Ventures unified theme — ports the admin dashboard's design language everywhere
   ----------------------------------------------------------------------------
   The palette is the Venture Roadmap Manager sheet ("extracted from the app,
   v62") — the design language the product was specified against. Its values
   live here once, as :root tokens, and every surface reads them:

     ink        #12202F     paper      #EDF1F2     panel      #FFFFFF
     muted      #55636F     rules      #D3DBDF     radius     8/12px
     ok         #1E8A5B     warn       #B7791F     bad        #C0392B
     tech       #1F6672     biz        #4B4FA0     gate       #C2461F
     navy       #14304A
     type       IBM Plex Sans, .72 / .8125 / .9375 / 1.3125rem
                Bricolage Grotesque (display) · IBM Plex Mono (codes, metrics)

   The four named roles are the point. Before this, "technical", "business"
   and "stage gate" had no colour of their own, so ~1,800 call sites invented
   one — #6366f1 and #0ea5e9 next to #7c3aed next to #2563eb — and the product
   read as assembled rather than designed. A role is now a token:

     tech → --tech / --info            biz → --biz / --purple
     gate → --gate / --warning         navy → --navy / --primary

   Historically the tenant portal, mentor portal and SME portal each declared
   their own palette in a <style> block: navy #0a2540, cyan #0891b2, orange
   #f97316, Space Grotesk, 135deg gradients on every button and 16px coloured
   shadows under every card. That is the "old design" — a different product
   wearing the same name.

   Two layers are needed, because the old surfaces are built two different ways:

     1. This file. Loaded LAST on every shell, it re-points the legacy variable
        names (--primary, --surface, --text, --border …) at the dash palette and
        flattens the components that were defined by class. Anything written
        against the old variables converts without touching a call site.

     2. The inline renderers. Check-ins, documents and the proof-upload dialog
        were string-concatenated with literal hex (#f59e0b, #10b981, #0f172a),
        so no stylesheet can reach them. Those were rewritten to emit the
        .dtv-* classes defined at the bottom of this file.

   Rules here are deliberately specific (body .card rather than .card) so they
   win over the inline shell blocks regardless of source order.
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:wght@600;700;800&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root {
  /* ── Navy — authority: bars, headers, primary buttons ────────────────── */
  --primary: #14304A; --primary-light: #1F4D63; --primary-dark: #0E2233;
  --navy: #14304A; --on-navy: #FFFFFF;
  /* ── Roles ON DARK. The navy sidebar cannot use the solid roles above:
        #1F6672 on #14304A is ~1.1:1 and effectively invisible. These are the
        same six roles lifted to read at >=4.5:1 against the panel, and they
        exist so a menu icon can say "this is the technical section" without
        fourteen ad-hoc pastels. ──────────────────────────────────────────── */
  --tech-on-dark: #63B3BC; --biz-on-dark: #A3A7F2; --gate-on-dark: #F08A63;
  --ok-on-dark: #4CC38A; --warn-on-dark: #E0B050; --bad-on-dark: #F0776A;
  --neutral-on-dark: #A9BCCB;
  /* ── The three accent roles. Was --primary (ink), --info (blue 2E6EA8)
        and --purple (violet 5B5BD6) standing in for concepts they were never
        meant to describe. ─────────────────────────────────────────────── */
  --tech: #1F6672; --tech-t: #E3F1EF; --tech-l: #BFD8D5;
  --biz:  #4B4FA0; --biz-t:  #ECECFA; --biz-l:  #CBCDEA;
  --gate: #C2461F; --gate-t: #FCEDE6; --gate-l: #E5B7A2; --gate-ink: #7E2A10;
  /* ── Semantic. These three were already identical in both palettes. ─── */
  --accent: #1E8A5B; --accent-light: #EAF5F0; --accent-dark: #166B47;
  --orange: #B7791F; --orange-light: #FBF3E4; --orange-dark: #8F5E14;
  --success: #1E8A5B; --success-light: #EAF5F0; --success-dark: #166B47;
  --warning: #B7791F; --warning-light: #FBF3E4; --warning-dark: #8F5E14;
  --danger: #C0392B; --danger-light: #FBEDEB; --danger-dark: #96291F;
  /* info/purple are now the tech/biz roles, not a blue and a violet. Every
     legacy call site written against --info converts without being touched. */
  --info: #1F6672; --info-light: #E3F1EF; --info-dark: #164C55;
  --purple: #4B4FA0; --purple-light: #ECECFA;
  /* ── Surfaces ────────────────────────────────────────────────────────── */
  --surface: #FFFFFF; --surface-2: #EDF1F2; --surface-3: #E4EAEC;
  --border: #D3DBDF; --border-light: #E2E8EA;
  /* ── Text ────────────────────────────────────────────────────────────── */
  --text: #12202F; --text-2: #3A4753; --text-3: #55636F; --text-4: #8A97A2;
  /* ── Geometry. The sheet is tighter than the 24px→16px pass this file was
        written for: an 8px rule, a 12px card. Crisper at every size. ──── */
  --radius-sm: 6px; --radius: 8px; --radius-lg: 12px; --radius-xl: 14px;
  /* ── Elevation. Essentially flat: a card is a rule, not a shadow. Kept
        faint so stacked popovers still separate. ──────────────────────── */
  --shadow-sm: 0 1px 2px rgba(20,48,74,.05);
  --shadow: 0 1px 3px rgba(20,48,74,.07);
  --shadow-lg: 0 6px 22px rgba(20,48,74,.10);
  --shadow-xl: 0 10px 30px rgba(20,48,74,.12);
  /* ── Type. Three faces, each with one job. Plex Sans carries body copy;
        Bricolage Grotesque is the display face for headings and numerals;
        Plex Mono renders codes, IDs, dates and every metric. Inter stays in
        the stack as the fallback the shells already preload. ──────────── */
  --dtv-font: 'IBM Plex Sans', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --dtv-font-display: 'Bricolage Grotesque', 'IBM Plex Sans', system-ui, sans-serif;
  --dtv-font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ── Dark mode is opt-in, not automatic. The app still holds hardcoded hexes
      that no stylesheet can reach (see note 2 below), so following the OS
      setting would half-invert a page. [data-theme="dark"] is the hook for
      when those call sites are migrated; nothing changes until it is set. */
:root[data-theme="dark"] {
  --primary: #0A1823; --primary-light: #14304A; --primary-dark: #060F17;
  --navy: #0A1823; --on-navy: #E7EEF3;
  --tech: #62B6C0; --tech-t: #12323A; --tech-l: #285560;
  --biz:  #A3A7F2; --biz-t:  #202352; --biz-l:  #3A3E86;
  --gate: #F08A63; --gate-t: #37201A; --gate-l: #6B3A29; --gate-ink: #F5B49A;
  --accent: #4CC38A; --accent-light: #16392B; --accent-dark: #9BE0BC;
  --success: #4CC38A; --success-light: #16392B; --success-dark: #9BE0BC;
  --warning: #E0B050; --warning-light: #3A2F14; --warning-dark: #EBCB83;
  --orange: #E0B050; --orange-light: #3A2F14; --orange-dark: #EBCB83;
  --danger: #F0776A; --danger-light: #40201C; --danger-dark: #F4A79D;
  --info: #62B6C0; --info-light: #12323A; --info-dark: #9BDDE4;
  --purple: #A3A7F2; --purple-light: #202352;
  --surface: #132130; --surface-2: #0C1520; --surface-3: #182A3C;
  --border: #27394B; --border-light: #1E2E3D;
  --text: #E7EEF3; --text-2: #C3D0DA; --text-3: #93A4B3; --text-4: #6C7C8A;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.30);
  --shadow: 0 1px 3px rgba(0,0,0,.34);
  --shadow-lg: 0 6px 22px rgba(0,0,0,.42);
  --shadow-xl: 0 10px 30px rgba(0,0,0,.48);
  color-scheme: dark;
}

/* ── 1. Typography ────────────────────────────────────────────────────────
   One family across every surface. Space Grotesk was loaded per-shell and is
   now unused; Inter is what the admin app and the dash both render in. */
body, button, input, select, textarea, .form-input, .btn-primary, .btn-secondary {
  font-family: var(--dtv-font) !important;
}
body { background: var(--surface-2) !important; color: var(--text) !important; }
/* Headings take the display face: tighter apertures and a taller x-height read
   as a masthead rather than as bolded body copy. Weight drops from 700 to 600
   because Bricolage Grotesque is already denser at the same size. */
body h1, body h2, body h3, body h4 {
  font-family: var(--dtv-font-display);
  color: var(--text); font-weight: 700; letter-spacing: -.015em;
}
/* Codes, IDs, dates and metrics are monospaced so columns line up without
   tabular-figure support, and so a generated ID reads as data, not prose. */
body .dtv-mono, body code, body kbd, body samp, body pre,
body .metric-value, body .stat-value, body .kpi-value {
  font-family: var(--dtv-font-mono);
  font-variant-numeric: tabular-nums;
}

/* ── 2. Top bar — ink, flat, no gradient ─────────────────────────────── */
body .p-nav {
  background: var(--primary) !important;
  box-shadow: none !important;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
body .p-hero {
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  border-left: 3px solid var(--accent) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: none !important;
}
body .p-hero * { color: inherit; }

/* ── 3. Cards ────────────────────────────────────────────────────────────
   White panel, one hairline, 16px radius, no shadow — the dash's .sp-card. */
body .card, body .section-card, body .p-stat-card {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: none !important;
}
body .p-stat-card::before { display: none !important; }
body .section-header { border-bottom: 1px solid var(--border-light) !important; }
body .card-title, body .section-title {
  font-size: .9375rem !important; font-weight: 700 !important;
  color: var(--text) !important; letter-spacing: -.005em;
}

/* ── 4. Buttons — flat ink, no gradient, no lift ──────────────────────── */
body .btn-primary,
body .btn-success,
body .btn-dtv-sm,
body .btn-dtv-sm-alt,
body .btn-dtv-sm-warn {
  background: var(--primary) !important;
  background-image: none !important;
  border: 1px solid var(--primary) !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: none !important;
  color: #fff !important;
  font-weight: 600 !important;
  transform: none !important;
}
body .btn-primary:hover,
body .btn-success:hover,
body .btn-dtv-sm:hover,
body .btn-dtv-sm-alt:hover,
body .btn-dtv-sm-warn:hover {
  background: var(--primary-light) !important;
  border-color: var(--primary-light) !important;
  box-shadow: none !important;
  transform: none !important;
}
body .btn-primary:active, body .btn-success:active { transform: none !important; }
body .btn-secondary {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--text) !important;
  box-shadow: none !important;
  font-weight: 600 !important;
}
body .btn-secondary:hover { background: var(--surface-2) !important; border-color: var(--text-4) !important; }
body .btn-danger {
  background: var(--surface) !important;
  border: 1px solid var(--danger) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--danger) !important;
}
body .btn-danger:hover { background: var(--danger-light) !important; }
body .btn-edit, body .btn-fill, body .btn-view {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--text-2) !important;
}
body .btn-edit:hover, body .btn-fill:hover, body .btn-view:hover {
  background: var(--surface-2) !important; border-color: var(--text-4) !important;
}
body .btn-icon { border-radius: var(--radius-sm) !important; }
body .btn-icon-edit { background: var(--surface-3) !important; color: var(--text-2) !important; }
body .btn-icon-del { background: var(--danger-light) !important; color: var(--danger) !important; }

/* ── 5. Pills — outline + a colour dot, not a colour fill ─────────────── */
body .badge {
  gap: .35rem !important;
  border: 1px solid var(--border) !important;
  border-radius: 999px !important;
  padding: 2px 9px !important;
  font-size: .6875rem !important;
  font-weight: 600 !important;
  background: var(--surface) !important;
  color: var(--text-3) !important;
}
body .badge-green, body .badge-red, body .badge-amber,
body .badge-blue, body .badge-purple, body .badge-gray,
body .badge-pending, body .badge-draft, body .badge-submitted {
  border-color: var(--border) !important;
  color: var(--text-3) !important;
  background: var(--surface) !important;
}
body .badge-green::before, body .badge-submitted::before,
body .badge-red::before, body .badge-amber::before, body .badge-draft::before,
body .badge-blue::before, body .badge-purple::before {
  content: ''; width: .4rem; height: .4rem; border-radius: 50%;
  background: var(--text-4); flex-shrink: 0;
}
body .badge-green::before, body .badge-submitted::before { background: var(--success); }
body .badge-red::before { background: var(--danger); }
body .badge-amber::before, body .badge-draft::before { background: var(--warning); }
body .badge-blue::before { background: var(--info); }
body .badge-purple::before { background: var(--purple); }

/* ── 6. Tabs — underline, like the dash's .sp-tab ─────────────────────── */
body .vtab {
  background: transparent !important;
  border: 0 !important;
  border-bottom: 2px solid transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  color: var(--text-3) !important;
  font-weight: 500 !important;
  font-size: .8125rem !important;
  padding: .5rem .75rem !important;
  margin-bottom: -1px;
}
body .vtab:hover { background: transparent !important; color: var(--text) !important; box-shadow: none !important; }
body .vtab.active {
  color: var(--text) !important;
  border-bottom-color: var(--text) !important;
  font-weight: 600 !important;
  background: transparent !important;
  box-shadow: none !important;
}
body #tab-bar {
  background: transparent !important;
  border: 0 !important;
  border-bottom: 1px solid var(--border) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  gap: 2px !important;
}

/* ── 7. Inputs ───────────────────────────────────────────────────────── */
body .form-input, body .form-field input, body .form-field select, body .form-field textarea {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--text) !important;
  font-size: .8125rem !important;
}
body .form-input:focus { border-color: var(--text-2) !important; box-shadow: 0 0 0 3px rgba(15,27,38,.08) !important; }
body .form-field label { font-size: .72rem !important; color: var(--text-3) !important; font-weight: 600 !important; }

/* ── 8. Progress ─────────────────────────────────────────────────────── */
body .progress-bar-wrap { background: var(--surface-3) !important; height: 6px !important; }
body .progress-bar-fill { border-radius: 99px !important; }

/* ── 9. Sign-in doors — flat wash, not a three-colour gradient ───────── */
body #login-screen {
  background: var(--surface-2) !important;
}
body #login-card {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: none !important;
  overflow: hidden;
}
/* The brand band keeps its white field and tri-colour rule — that is the one
   place the brand gradient belongs, and dtv-loader.css already defines it. */

/* ── 10. Modals ──────────────────────────────────────────────────────── */
body #form-modal { background: rgba(15,27,38,.55) !important; }
body #form-modal-inner {
  background: var(--surface) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-xl) !important;
}

/* ── 11. Toast ───────────────────────────────────────────────────────── */
body #toast {
  background: var(--primary) !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: var(--shadow-lg) !important;
  font-weight: 500 !important;
}

/* ── 12. Tables ──────────────────────────────────────────────────────── */
body .dtv-table { width: 100%; border-collapse: collapse; font-size: .72rem; }
body .dtv-table th {
  text-align: left; font-weight: 600; color: var(--text-3);
  padding: .375rem .625rem; border-bottom: 1px solid var(--border); white-space: nowrap;
}
body .dtv-table td { padding: .375rem .625rem; border-bottom: 1px solid var(--border-light); vertical-align: top; }

/* ============================================================================
   13. Check-ins
   ----------------------------------------------------------------------------
   Replaces inline markup that painted four saturated blocks per check-in
   (#f0fdf4 green, #fef2f2 red, #fffbeb amber, #eff6ff blue) with full-width
   colour fields. The dash reads the same four states as a thin left rule on a
   neutral panel, with the label in muted small caps — so a month of check-ins
   reads as a list rather than a colour chart.
   ========================================================================= */
.dtv-ci {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.125rem;
  margin-bottom: .75rem;
}
.dtv-ci-hd {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem;
  margin-bottom: .75rem;
}
.dtv-ci-date {
  font-size: .8125rem; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.dtv-ci-rag {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .6875rem; font-weight: 600; color: var(--text-3);
  border: 1px solid var(--border); border-radius: 999px; padding: 2px 9px;
}
.dtv-ci-rag::before { content: ''; width: .4rem; height: .4rem; border-radius: 50%; background: var(--text-4); }
.dtv-ci-rag.is-green::before { background: var(--success); }
.dtv-ci-rag.is-amber::before { background: var(--warning); }
.dtv-ci-rag.is-red::before { background: var(--danger); }
.dtv-ci-mood { font-size: .9375rem; line-height: 1; }
.dtv-ci-by {
  margin-left: auto; font-size: .72rem; color: var(--text-4);
  display: inline-flex; align-items: center; gap: .3rem;
}
.dtv-ci-metrics { display: flex; flex-wrap: wrap; gap: .375rem; margin-bottom: .75rem; }
.dtv-ci-metric {
  font-size: .6875rem; font-weight: 600; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--border-light);
  border-radius: 999px; padding: 1px 8px; font-variant-numeric: tabular-nums;
}
.dtv-ci-grid { display: grid; gap: .5rem; }
.dtv-ci-block {
  border-left: 2px solid var(--border);
  padding: .375rem 0 .375rem .75rem;
  background: transparent;
}
.dtv-ci-block.is-ok { border-left-color: var(--success); }
.dtv-ci-block.is-bad { border-left-color: var(--danger); }
.dtv-ci-block.is-warn { border-left-color: var(--warning); }
.dtv-ci-block.is-info { border-left-color: var(--info); }
.dtv-ci-block-h {
  font-size: .6875rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-3); margin-bottom: .25rem;
}
.dtv-ci-item {
  display: flex; align-items: flex-start; gap: .5rem;
  padding: .1875rem .375rem; border-radius: 6px; cursor: pointer;
}
.dtv-ci-item:hover { background: var(--surface-2); }
.dtv-ci-item.is-done .dtv-ci-txt { text-decoration: line-through; color: var(--text-4); }
.dtv-ci-item input[type=checkbox] {
  accent-color: var(--success); width: 14px; height: 14px;
  margin-top: .15rem; cursor: pointer; flex-shrink: 0; pointer-events: none;
}
.dtv-ci-txt { font-size: .8125rem; color: var(--text-2); line-height: 1.45; flex: 1; }
.dtv-ci-note {
  font-size: .6875rem; color: var(--text-3); background: var(--surface-2);
  border: 1px solid var(--border-light); border-radius: 999px;
  padding: 1px 8px; cursor: pointer; flex-shrink: 0; white-space: nowrap;
}
.dtv-ci-empty {
  text-align: center; color: var(--text-4); font-size: .8125rem;
  padding: 2rem 1rem; border: 1px dashed var(--border);
  border-radius: var(--radius-lg); background: var(--surface);
}
.dtv-ci-empty b { display: block; color: var(--text-2); font-size: .875rem; margin-bottom: .25rem; }
.dtv-ci-foot {
  font-size: .8125rem; color: var(--text-3); line-height: 1.5;
  margin-top: .625rem; padding: .5rem .75rem;
  background: var(--surface-2); border-radius: var(--radius-sm);
}

/* ============================================================================
   14. Documents
   ----------------------------------------------------------------------------
   Was: one full-width band per category, each holding full-width rows. A
   venture with a single file in each of seven categories produced seven bands
   whose text filled the left ~40% of the page and left the rest empty, while
   the list still ran past the fold. The data was fine; the geometry wasted the
   screen.

   Now two layers, both driven by the same rows:
     .dtv-docs-sum    a count strip, so "how much is outstanding" is readable
                      without scrolling.
     .dtv-docs-grid   categories flow into responsive columns (min 300px), so
                      several groups share a line instead of stacking.

   A row is a 3-track grid — icon | name+meta | status+actions — so the status
   sits beside the name on the same optical line rather than being flung to the
   far right of a full-width band. Colour is limited to the review-state dot.
   ========================================================================= */
.dtv-docs-sum {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: .5rem; margin-bottom: .875rem;
}
.dtv-docs-tile {
  border: 1px solid var(--border-light); border-radius: var(--radius-sm);
  background: var(--surface-2); padding: .5rem .625rem; min-width: 0;
}
.dtv-docs-tile b {
  display: block; font-size: 1.125rem; line-height: 1.15; font-weight: 700;
  color: var(--text); font-variant-numeric: tabular-nums;
}
.dtv-docs-tile span {
  display: block; font-size: .6875rem; font-weight: 600; color: var(--text-3);
  margin-top: .125rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* A tile is tinted only when it reports something needing attention, so the
   strip stays quiet when every document is approved. */
.dtv-docs-tile.is-ok { background: var(--success-light); border-color: var(--success); }
.dtv-docs-tile.is-ok b, .dtv-docs-tile.is-ok span { color: var(--success-dark); }
.dtv-docs-tile.is-warn { background: var(--warning-light); border-color: var(--warning); }
.dtv-docs-tile.is-warn b, .dtv-docs-tile.is-warn span { color: var(--warning-dark); }
.dtv-docs-tile.is-bad { background: var(--danger-light); border-color: var(--danger); }
.dtv-docs-tile.is-bad b, .dtv-docs-tile.is-bad span { color: var(--danger-dark); }

/* ── Equal-height cards ───────────────────────────────────────────────────
   Every card is the SAME height in both states. `align-items:start` (the old
   value) let each card shrink to its own contents, so a six-file category
   towered over a one-file category and the row read as a ragged staircase --
   which is what made it uncomfortable to scan. One custom property now drives
   every card's height, so the whole grid resizes as a single unit and no card
   can outgrow its neighbours. The difference in content is absorbed by the
   card body, which scrolls internally instead of stretching the card. */
.dtv-docs-grid {
  --docs-card-h: 320px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: .75rem; align-items: stretch;
}
.dtv-docs-grid.is-expanded { --docs-card-h: 620px; }
@media (max-width: 700px) {
  .dtv-docs-grid { grid-template-columns: minmax(0, 1fr); --docs-card-h: 260px; }
  .dtv-docs-grid.is-expanded { --docs-card-h: 520px; }
}

/* Toolbar: a count on the left, one control on the right that moves every
   card at once. The control is a real button with aria-pressed, because it is
   a toggle over a set, not a link. */
.dtv-docs-bar {
  display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem;
}
.dtv-docs-bar-n {
  font-size: .6875rem; font-weight: 600; color: var(--text-3);
  letter-spacing: .02em;
}
.dtv-docs-expand {
  margin-left: auto; font: 600 .6875rem/1 Inter, system-ui, sans-serif;
  color: var(--text-2); background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 0 10px; height: 24px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
  white-space: nowrap;
}
.dtv-docs-expand:hover { background: var(--surface-2); color: var(--text); }
.dtv-docs-expand:focus-visible { outline: 2px solid var(--info); outline-offset: 1px; }
.dtv-docs-expand[aria-pressed="true"] {
  background: var(--tech-t); border-color: var(--tech-l); color: var(--tech);
}

.dtv-doc-cat {
  border: 1px solid var(--border-light); border-radius: var(--radius-sm);
  background: var(--surface); padding: .5rem .5rem .375rem; min-width: 0;
  /* Fixed height + column flex is what equalises the cards: the header keeps
     its natural size and the body takes the remainder and scrolls. */
  height: var(--docs-card-h); display: flex; flex-direction: column;
  min-height: 0; box-sizing: border-box;
  transition: height .18s ease;
}
.dtv-doc-cat-h {
  display: flex; align-items: center; gap: .5rem; margin-bottom: .375rem;
  padding: 0 .125rem .375rem; border-bottom: 1px solid var(--border-light);
  flex: 0 0 auto;
}
/* The scrolling region. min-height:0 is required — a flex child defaults to
   min-height:auto, which would let the content push the card taller than
   --docs-card-h and defeat the whole equalisation. */
.dtv-doc-cat-b {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden;
  padding-right: 2px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.dtv-doc-cat-b::-webkit-scrollbar { width: 7px; }
.dtv-doc-cat-b::-webkit-scrollbar-thumb {
  background: var(--border); border-radius: 999px;
}
.dtv-doc-cat-b::-webkit-scrollbar-track { background: transparent; }
.dtv-doc-cat-h .dtv-doc-ico {
  width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0;
  display: grid; place-items: center; background: var(--surface-2);
  color: var(--text-3); font-size: 10px; border: 1px solid var(--border-light);
}
.dtv-doc-cat-h .dtv-doc-cat-n {
  font-size: .72rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-3);
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dtv-doc-cat-h .dtv-doc-count {
  font-size: .6875rem; color: var(--text-4); background: var(--surface-2);
  border-radius: 999px; padding: 0 7px; font-variant-numeric: tabular-nums;
  flex-shrink: 0; margin-left: auto;
}

/* icon | name+meta | status+actions. minmax(0,1fr) on the middle track is what
   lets a long filename ellipsis instead of forcing the row wider than its
   column. */
.dtv-doc-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center; gap: .5rem;
  padding: .3rem .375rem; border-radius: var(--radius-sm);
}
.dtv-doc-row + .dtv-doc-row { border-top: 1px solid var(--surface-3); }
.dtv-doc-row:hover { background: var(--surface-2); }
.dtv-doc-row .dtv-doc-file {
  color: var(--text-4); font-size: 12px; flex-shrink: 0;
  width: 14px; text-align: center;
}
.dtv-doc-main { min-width: 0; }
.dtv-doc-name {
  font-size: .8125rem; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dtv-doc-meta {
  display: flex; align-items: center; gap: .375rem; margin-top: .0625rem;
  flex-wrap: wrap; font-size: .6875rem; color: var(--text-4);
}
.dtv-doc-size { font-size: .6875rem; color: var(--text-4); font-variant-numeric: tabular-nums; }
.dtv-doc-desc {
  font-size: .6875rem; color: var(--text-3); font-style: italic;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dtv-doc-side {
  display: flex; align-items: center; gap: .375rem; flex-shrink: 0;
}
.dtv-doc-link {
  font-size: .6875rem; font-weight: 600; color: var(--text);
  display: inline-flex; align-items: center; gap: .25rem;
  text-decoration: underline; text-underline-offset: 2px;
  white-space: nowrap; border-radius: 4px;
}
.dtv-doc-link:hover { color: var(--info); }
.dtv-doc-link:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }
.dtv-doc-nofile {
  font-size: .6875rem; color: var(--text-4); white-space: nowrap;
  font-style: italic;
}
.dtv-doc-req {
  font-size: .625rem; color: var(--danger); border: 1px solid var(--danger);
  border-radius: 999px; padding: 0 6px; font-weight: 600; white-space: nowrap;
}
.dtv-doc-state {
  font-size: .625rem; font-weight: 600; color: var(--text-3);
  display: inline-flex; align-items: center; gap: .3rem;
  border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px;
  text-transform: capitalize; white-space: nowrap; background: var(--surface);
}
.dtv-doc-state::before {
  content: ''; width: .35rem; height: .35rem; border-radius: 50%; background: var(--text-4);
}
.dtv-doc-state.is-approved::before { background: var(--success); }
.dtv-doc-state.is-pending::before { background: var(--warning); }
.dtv-doc-state.is-rejected::before { background: var(--danger); }
.dtv-doc-state.is-review::before { background: var(--info); }
.dtv-doc-del {
  width: 22px; height: 22px; border-radius: 5px; border: 1px solid transparent;
  background: transparent; color: var(--text-4); cursor: pointer;
  display: grid; place-items: center; font-size: 10px; flex-shrink: 0;
}
.dtv-doc-del:hover { color: var(--danger); border-color: var(--danger); background: var(--surface); }
.dtv-doc-del:focus-visible { outline: 2px solid var(--danger); outline-offset: 1px; }
.dtv-doc-empty { color: var(--text-4); font-size: .8125rem; padding: .5rem 0; }

/* ── Upload: one trigger in the card header, requirements in a dialog ──────
   The form used to sit at the BOTTOM of the tab, below a document list that is
   already taller than the fold — so the one action a founder opens this page to
   perform was the last thing they could reach. The trigger is now in the card
   header, and the form opens over the page where the requirements can be read
   BEFORE a file is chosen instead of being scattered across field labels. */
.dtv-docs-head {
  display: flex; align-items: center; gap: .5rem;
  margin-bottom: .875rem; flex-wrap: wrap;
}
.dtv-docs-head-t {
  font-size: .875rem; font-weight: 700; color: var(--text);
  display: inline-flex; align-items: center; gap: .4375rem;
}
.dtv-docs-head-t i { color: var(--tech); font-size: .8125rem; }
.dtv-docs-add {
  margin-left: auto;
  font: 700 .75rem/1 Inter, system-ui, sans-serif;
  color: #fff; background: var(--tech);
  border: 1px solid var(--tech); border-radius: var(--radius-sm);
  padding: 0 12px; height: 30px; cursor: pointer;
  display: inline-flex; align-items: center; gap: .375rem;
  white-space: nowrap;
}
.dtv-docs-add:hover { background: var(--tech); filter: brightness(.92); }
.dtv-docs-add:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }
.dtv-docs-add i { font-size: .6875rem; }

/* Requirements block. Deliberately quiet: a tinted panel, not a warning, because
   these are conditions, not errors. */
.dtv-docs-req {
  border: 1px solid var(--border-light); background: var(--surface-2);
  border-radius: var(--radius-sm); padding: .625rem .75rem;
}
.dtv-docs-req-h {
  font-size: .625rem; font-weight: 700; color: var(--text-2);
  letter-spacing: .06em; text-transform: uppercase;
  display: flex; align-items: center; gap: .375rem; margin-bottom: .4375rem;
}
.dtv-docs-req-h i { color: var(--tech); font-size: .6875rem; }
.dtv-docs-req-list {
  margin: 0 0 .5rem; padding-left: 1rem;
  font-size: .75rem; line-height: 1.5; color: var(--text-2);
}
.dtv-docs-req-list li { margin-bottom: .25rem; }
.dtv-docs-req-list li:last-child { margin-bottom: 0; }
.dtv-docs-req-list b { color: var(--text); font-weight: 700; }
.dtv-docs-req-fmt {
  display: flex; align-items: center; gap: .25rem; flex-wrap: wrap;
  padding-top: .4375rem; border-top: 1px solid var(--border);
}
.dtv-docs-req-fmt-l {
  font-size: .5625rem; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .06em; margin-right: .125rem;
}
.dtv-chip {
  font-size: .625rem; font-weight: 600; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 1px 6px; line-height: 1.5;
}
.dtv-docs-req-note {
  margin-top: .5rem; font-size: .6875rem; color: var(--text-3);
  display: flex; align-items: flex-start; gap: .3125rem; line-height: 1.45;
}
.dtv-docs-req-note i { color: var(--warning); margin-top: .1875rem; font-size: .5625rem; }

/* Dialog sizing. max-height + overflow keeps the whole form reachable on a short
   laptop viewport, where a tall fixed dialog would otherwise clip its own submit
   button and leave the user with no way to finish. */
.dtv-modal.is-docs {
  max-width: 620px;
  max-height: calc(100vh - 32px); overflow-y: auto;
}
/* The overlay is display:flex, which would beat the [hidden] attribute; this
   rule makes hiding it actually work instead of relying on inline styles. */
.dtv-modal-ov[hidden] { display: none; }
body.dtv-modal-open { overflow: hidden; }

.dtv-docs-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.dtv-docs-submit {
  font: 700 .75rem/1 Inter, system-ui, sans-serif;
  color: #fff; background: var(--tech); border: 1px solid var(--tech);
  border-radius: var(--radius-sm); padding: 0 14px; height: 32px;
  cursor: pointer; display: inline-flex; align-items: center; gap: .375rem;
}
.dtv-docs-submit:hover { filter: brightness(.92); }
.dtv-docs-submit:disabled { opacity: .6; cursor: default; filter: none; }
.dtv-docs-submit:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }
.dtv-docs-submit i { font-size: .6875rem; }
.dtv-docs-cancel {
  font: 600 .75rem/1 Inter, system-ui, sans-serif;
  color: var(--text-2); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0 12px; height: 32px; cursor: pointer;
}
.dtv-docs-cancel:hover { background: var(--surface-2); color: var(--text); }
.dtv-docs-cancel:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }

/* ============================================================================
   15. Modal — used by the proof-upload dialog
   ----------------------------------------------------------------------------
   The old dialog was an amber card with a dashed amber dropzone and a
   two-colour gradient button. Same structure, dash surface.
   ========================================================================= */
.dtv-modal-ov {
  position: fixed; inset: 0; z-index: 9100; display: flex;
  align-items: center; justify-content: center; padding: 16px;
  background: rgba(15,27,38,.55);
}
.dtv-modal {
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl); width: 100%; max-width: 460px;
  padding: 1.5rem; position: relative;
}
/* Wide variant for form modals that carry a 2-up field grid. */
.dtv-modal.is-wide { max-width: 560px; }

/* Dismiss affordance. Every dialog needs one: the proof-upload dialog used to
   render with no close control at all when a task required evidence, which
   trapped the founder with no way out. */
.dtv-modal-x {
  position: absolute; top: .875rem; right: .875rem;
  width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center; cursor: pointer; line-height: 1;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-3); font-size: 17px; font-family: inherit;
  transition: background .15s, color .15s, border-color .15s;
}
.dtv-modal-x:hover {
  background: var(--surface-3); color: var(--text); border-color: var(--text-4);
}
.dtv-modal-x:focus-visible {
  outline: none; border-color: var(--text-2);
  box-shadow: 0 0 0 3px rgba(15,27,38,.10);
}
/* Leave room for the × so a long title never slides under it. */
.dtv-modal-hd { display: flex; align-items: flex-start; gap: .625rem; margin-bottom: .875rem; padding-right: 2.25rem; }
.dtv-modal-ico {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  display: grid; place-items: center; background: var(--surface-2);
  border: 1px solid var(--border-light); color: var(--text-3); font-size: 13px;
}
.dtv-modal-t { font-size: .9375rem; font-weight: 700; color: var(--text); letter-spacing: -.005em; }
.dtv-modal-s { font-size: .72rem; color: var(--text-3); margin-top: 2px; line-height: 1.45; }
.dtv-modal-task {
  font-size: .72rem; color: var(--text-2); background: var(--surface-2);
  border: 1px solid var(--border-light); border-radius: var(--radius-sm);
  padding: .5rem .625rem; margin-bottom: .75rem;
  display: flex; align-items: center; gap: .4rem;
}
.dtv-modal-hint {
  font-size: .72rem; color: var(--text-3); background: var(--surface-2);
  border-left: 2px solid var(--warning); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: .5rem .625rem; margin-bottom: .75rem; line-height: 1.45;
}
.dtv-modal-lab {
  display: block; font-size: .6875rem; font-weight: 600; color: var(--text-3);
  margin-bottom: .3125rem;
}
.dtv-modal-lab .dtv-req { color: var(--danger); }
.dtv-modal-lab .dtv-hint { font-weight: 400; color: var(--text-4); }
.dtv-drop {
  width: 100%; box-sizing: border-box; font-size: .72rem; color: var(--text-3);
  background: var(--surface); border: 1px dashed var(--border);
  border-radius: var(--radius-sm); padding: .5rem;
}
.dtv-drop:focus { outline: none; border-color: var(--text-2); }
.dtv-modal-msg { display: none; font-size: .72rem; margin-bottom: .5rem; }
.dtv-modal-foot { display: flex; gap: .5rem; margin-top: .25rem; }

/* Base button. Declared BEFORE the variants so .dtv-btn-ghost / -primary win
   the border and background without needing !important. */
.dtv-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .5rem .875rem; font-size: .8125rem; font-weight: 600;
  font-family: inherit; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.dtv-btn:disabled { opacity: .55; cursor: not-allowed; }
.dtv-modal-foot .dtv-btn { flex: 1; }
.dtv-btn-ghost { background: var(--surface); border: 1px solid var(--border); color: var(--text-2); }
.dtv-btn-ghost:hover { background: var(--surface-2); }
.dtv-btn-primary { background: var(--primary); border: 1px solid var(--primary); color: #fff; }
.dtv-btn-primary:hover { background: var(--primary-light); }
.dtv-btn-primary:disabled { opacity: .55; cursor: not-allowed; }

/* ============================================================================
   16. Portal to-do list
   ----------------------------------------------------------------------------
   Was a white card per row with pastel status fills (#10b981 / #f59e0b /
   #6366f1) and coloured action buttons. Now the same neutral row the dash
   uses: title, muted meta, a dotted status pill, and flat actions.
   ========================================================================= */
.dtv-todo {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .625rem .75rem;
  margin-bottom: .5rem;
  background: var(--surface);
}
.dtv-todo-hd {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: .75rem; flex-wrap: wrap;
}
.dtv-todo-main { flex: 1; min-width: 10rem; }
.dtv-todo-t {
  font-size: .8125rem; font-weight: 600; color: var(--text); line-height: 1.4;
}
.dtv-todo-t.is-done { text-decoration: line-through; color: var(--text-4); }
.dtv-todo-n { font-size: .72rem; color: var(--text-3); margin-top: .1875rem; line-height: 1.45; }
.dtv-todo-side {
  display: flex; flex-direction: column; gap: .25rem;
  align-items: flex-end; flex-shrink: 0;
}
.dtv-todo .dtv-ci-rag.is-neutral::before { background: var(--text-4); }
.dtv-todo-acts {
  display: flex; flex-wrap: wrap; gap: .375rem;
  margin-top: .5rem; padding-top: .5rem;
  border-top: 1px solid var(--border-light);
}
.dtv-todo-acts .dtv-btn {
  padding: .25rem .625rem; font-size: .72rem; font-weight: 500;
  border-radius: 6px; cursor: pointer; display: inline-flex;
  align-items: center; gap: .3rem; font-family: inherit;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2);
}
.dtv-todo-acts .dtv-btn:hover { background: var(--surface-2); border-color: var(--text-4); }
.dtv-todo-acts .dtv-btn-primary {
  background: var(--primary); border-color: var(--primary); color: #fff;
}
.dtv-todo-acts .dtv-btn-primary:hover { background: var(--primary-light); border-color: var(--primary-light); }
.dtv-todo-acts .dtv-btn.dtv-is-danger { color: var(--danger); }
.dtv-todo-acts .dtv-btn.dtv-is-danger:hover {
  background: var(--danger-light); border-color: var(--danger);
}

/* ── 17. Portal chooser doors ─────────────────────────────────────────────
   The four portal cards on /portal. Replaces markup that carried its styling
   in inline style="" attributes PLUS inline onmouseover/onmouseout handlers
   that reassigned boxShadow, borderColor and transform on every hover.

   Three things were wrong with the old version, and all three are fixed here:
     1. Four different accent gradients (cyan, navy, orange, purple), each with
        its own coloured drop shadow. Four brand colours on one screen means
        none of them reads as the brand.
     2. Cards lifted on hover via transform:translateY(-2px) plus a shadow.
        The admin dash does not do this — it is flat, and hover moves the
        border/background, never the geometry. Lifting cards is the single
        most "old design system" thing left on the page.
     3. Styling via onmouseover JS cannot express focus. A keyboard user
        tabbing through these four links previously got no feedback at all.
        Hover and :focus-visible now share one rule, so both behave the same. */
.dtv-portal-doors {
  display: grid;
  gap: .5rem;
}
.dtv-portal-door {
  display: flex;
  align-items: center;
  gap: .875rem;
  padding: .75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  cursor: pointer;
  /* No transform, no box-shadow: geometry never moves. */
  transition: border-color .15s, background-color .15s;
}
.dtv-portal-door:hover,
.dtv-portal-door:focus-visible {
  border-color: var(--text-4);
  background: var(--surface-2);
  outline: none;
}
.dtv-portal-door:focus-visible {
  /* Keyboard users get a visible ring; the dash uses the same 2px pattern. */
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary);
}
/* Flat icon tile — surface, hairline border, ink glyph. No gradient fill. */
.dtv-door-ico {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--primary);
  font-size: .9375rem;
}
.dtv-portal-door:hover .dtv-door-ico,
.dtv-portal-door:focus-visible .dtv-door-ico {
  background: var(--surface);
  border-color: var(--text-4);
}
.dtv-door-txt {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .125rem;
}
.dtv-door-t {
  font-size: .875rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.005em;
}
.dtv-door-s {
  font-size: .75rem;
  color: var(--text-3);
  line-height: 1.4;
}
.dtv-door-arrow {
  color: var(--text-4);
  font-size: .6875rem;
  flex-shrink: 0;
  transition: color .15s, transform .15s;
}
.dtv-portal-door:hover .dtv-door-arrow,
.dtv-portal-door:focus-visible .dtv-door-arrow {
  color: var(--text-2);
}

/* ============================================================================
   18. Form fields — one vocabulary for every dialog
   ----------------------------------------------------------------------------
   Every portal dialog (expense, task, proof, profile) used to carry its own
   copy-pasted inline style string:

     border:1.5px solid #e2e8f0; border-radius:8px; padding:9px 12px;
     color:#0f172a; background:#fff

   Nine of those strings appear 11 times each, with 39 more copies of the same
   uppercase #64748b label. That is where the "old theme" look came from — no
   stylesheet could reach it because it lived in style="" attributes.

   These classes are the replacement. Nothing here introduces a new colour:
   every value resolves to a token declared in :root above.
   ========================================================================= */
.dtv-form { display: grid; gap: .75rem; }
.dtv-form-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: .75rem;
}
@media (max-width: 480px) { .dtv-form-row { grid-template-columns: 1fr; } }

.dtv-field { display: block; }
.dtv-field-lab {
  display: block; font-size: .6875rem; font-weight: 600; color: var(--text-3);
  letter-spacing: .03em; margin-bottom: .3125rem;
}
.dtv-field-lab .dtv-req { color: var(--danger); }
.dtv-field-lab .dtv-hint { font-weight: 400; color: var(--text-4); letter-spacing: 0; }

.dtv-input, .dtv-select, .dtv-textarea {
  width: 100%; box-sizing: border-box;
  font-family: inherit; font-size: .8125rem; line-height: 1.4;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .5rem .625rem; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.dtv-input::placeholder, .dtv-textarea::placeholder { color: var(--text-4); }
.dtv-input:focus, .dtv-select:focus, .dtv-textarea:focus {
  border-color: var(--text-2);
  box-shadow: 0 0 0 3px rgba(15,27,38,.08);
}
.dtv-textarea { resize: vertical; line-height: 1.5; }

/* File pickers read as a dropzone, but in the dash's neutral, not amber. */
.dtv-input-file {
  width: 100%; box-sizing: border-box; font-size: .72rem; color: var(--text-3);
  background: var(--surface); border: 1px dashed var(--border);
  border-radius: var(--radius-sm); padding: .5rem; cursor: pointer;
}
.dtv-input-file:focus { outline: none; border-color: var(--text-2); }

.dtv-form-msg { display: none; font-size: .75rem; padding: .5rem .75rem; border-radius: var(--radius-sm); }
.dtv-form-msg.is-ok  { display: block; background: var(--success-light); color: var(--success-dark); }
.dtv-form-msg.is-bad { display: block; background: var(--danger-light);  color: var(--danger-dark);  }

/* Sheet padding for dialogs injected into #tenant-modal-box, which is a bare
   white shell with its own radius and no padding of its own. */
.dtv-modal-sheet { padding: 1.5rem; }

/* .dtv-btn itself is declared in §15 above (before its variants, so the
   ghost/primary borders win without !important). */
.dtv-form-foot { display: flex; gap: .5rem; justify-content: flex-end; margin-top: .25rem; }
@media (max-width: 480px) {
  .dtv-form-foot { flex-direction: column-reverse; }
  .dtv-form-foot .dtv-btn { width: 100%; }
}

/* ============================================================================
   19. Budget & P&L
   ----------------------------------------------------------------------------
   Moved out of portal.js, which injected a <style id="tpb-css"> element at
   render time and redeclared the whole palette inside it:

     .tpb{--ink:#0F1B26;--mute:#5B6B77;--line:#DCE3E7;--ok:#1E8A5B …}

   Those values were already correct — they are the dash palette. The problem
   was that they were a *second* copy, so a change to this file never reached
   the P&L tab and a change there never reached anything else. The block also
   could not be themed, cached, or audited because it only existed after the
   first render.

   Ported here verbatim in structure, but every colour now resolves to the
   :root tokens above. No local palette is declared.
   ========================================================================= */
.tpb { color: var(--text); font-size: .8125rem; line-height: 1.45; }
.tpb * { box-sizing: border-box; }

.tpb-top {
  display: grid; grid-template-columns: auto minmax(0,1fr); gap: 18px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
  align-items: center;
}
@media (max-width: 700px) { .tpb-top { grid-template-columns: minmax(0,1fr); } }

.tpb-rings { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.tpb-ring { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tpb-ring svg { display: block; }
.tpb-ring-k {
  font-size: 10px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-4);
}
.tpb-ring-v {
  font-size: 11px; font-weight: 650; color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.tpb-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px,1fr)); gap: 12px; }
.tpb-fact { border-left: 2px solid var(--border-light); padding-left: 11px; }
.tpb-fact-k {
  font-size: 10px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-4);
}
.tpb-fact-v {
  font-size: 17px; font-weight: 750; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; color: var(--text); margin-top: 1px;
}
.tpb-fact-u { font-size: 10px; color: var(--text-4); font-weight: 600; margin-left: 2px; }
.tpb-fact-ok   .tpb-fact-v { color: var(--success); }
.tpb-fact-warn .tpb-fact-v { color: var(--warning); }
.tpb-fact-bad  .tpb-fact-v { color: var(--danger); }

.tpb-bar {
  height: 7px; border-radius: 99px; background: var(--surface-3);
  overflow: hidden; margin-top: 10px; display: flex;
}
.tpb-bar > i { display: block; height: 100%; }
.tpb-bar > i.sp { background: var(--primary); }
/* Pale tint of --success, so the pair reads as one colour at two weights. */
.tpb-bar > i.rm { background: #CFE3D9; }

.tpb-legend {
  display: flex; gap: 14px; flex-wrap: wrap; margin-top: 7px;
  font-size: 10.5px; color: var(--text-3);
}
.tpb-legend i { display: inline-block; width: 7px; height: 7px; border-radius: 2px; margin-right: 5px; }
.tpb-legend .sp { background: var(--primary); }
.tpb-legend .rm { background: #CFE3D9; }

.tpb-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tpb-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: var(--radius-sm); padding: 7px 13px;
  font-size: 12px; font-weight: 650; cursor: pointer; font-family: inherit;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
}
.tpb-btn:hover { border-color: var(--text-4); }
.tpb-btn.pri { background: var(--primary); border-color: var(--primary); color: #fff; }
.tpb-btn.pri:hover { background: var(--primary-light); filter: none; }
.tpb-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(15,27,38,.10); }
.tpb-btn i { font-size: 11px; }

.tpb-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.tpb-card-h {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border-light); flex-wrap: wrap;
}
.tpb-card-h h3 { font-size: 13px; font-weight: 700; margin: 0; letter-spacing: -.015em; color: var(--text); }
.tpb-count {
  background: var(--surface-3); color: var(--text-3); border-radius: 99px;
  padding: 1px 8px; font-size: 10.5px; font-weight: 750;
}

.tpb-tbl { width: 100%; border-collapse: collapse; }
.tpb-tbl th {
  text-align: left; font-size: 9.5px; font-weight: 750; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-4); padding: 8px 14px;
  border-bottom: 1px solid var(--border-light); background: var(--surface-2); white-space: nowrap;
}
.tpb-tbl td {
  padding: 10px 14px; border-bottom: 1px solid var(--border-light);
  vertical-align: top; font-size: 12px;
}
.tpb-tbl tr:last-child td { border-bottom: 0; }
.tpb-tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tpb-what { font-weight: 650; color: var(--text); }
.tpb-sub { font-size: 10.5px; color: var(--text-4); margin-top: 1px; }
.tpb-just { font-size: 11px; color: var(--text-3); margin-top: 3px; line-height: 1.5; }
.tpb-type {
  font-size: 9.5px; font-weight: 750; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-4); background: var(--surface-3); border: 1px solid var(--border);
  border-radius: 5px; padding: 2px 6px; display: inline-block; white-space: nowrap;
}
.tpb-st {
  font-size: 10.5px; font-weight: 700; border-radius: 99px; padding: 2px 9px;
  white-space: nowrap; display: inline-block;
}
.tpb-st.ok   { background: var(--success-light); color: var(--success-dark); }
.tpb-st.warn { background: var(--warning-light); color: var(--warning-dark); }
.tpb-st.bad  { background: var(--danger-light);  color: var(--danger-dark);  }
.tpb-st.idle { background: var(--surface-3);     color: var(--text-3);       }
/* Links inside the table are ink, not a link-blue: the dash underlines on
   hover rather than colouring, and the accent is reserved for real actions. */
.tpb-link { color: var(--text); font-weight: 650; text-decoration: none; font-size: 11px; }
.tpb-link:hover { text-decoration: underline; }
.tpb-del {
  border: 1px solid var(--border); background: var(--surface); color: var(--danger);
  border-radius: 6px; padding: 3px 8px; font-size: 10.5px; font-weight: 650; cursor: pointer;
}
.tpb-del:hover { background: var(--danger-light); border-color: var(--danger); }
.tpb-note {
  font-size: 11px; color: var(--text-3); margin-top: 5px; padding: 6px 9px;
  border-radius: 6px; background: var(--surface-2);
  border-left: 2px solid var(--warning); line-height: 1.5;
}
.tpb-empty { padding: 32px 16px; text-align: center; color: var(--text-4); font-size: 12.5px; line-height: 1.6; }
.tpb-empty i { font-size: 20px; display: block; margin-bottom: 8px; opacity: .4; }

@media (max-width: 760px) {
  .tpb-tbl thead { display: none; }
  .tpb-tbl td { display: block; border-bottom: 0; padding: 3px 14px; }
  .tpb-tbl tr { display: block; border-bottom: 1px solid var(--border-light); padding: 8px 0; }
  .tpb-tbl .num { text-align: left; }
}

/* Inline form panel — the venture budget tab renders its expense form in
   place (inserted after the cards) rather than in a dialog, so it needs a
   card of its own rather than the sheet padding used by #tenant-modal-box. */
.dtv-form-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 1.25rem;
  margin-top: 1rem;
}
.dtv-form-card-hd {
  display: flex; align-items: center; gap: .5rem;
  font-size: .9375rem; font-weight: 700; color: var(--text);
  letter-spacing: -.005em; margin-bottom: 1rem;
}
.dtv-form-card-hd i { color: var(--text-3); font-size: .875rem; }

/* ============================================================================
   20. Budget & Expenses section header (admin)
   ----------------------------------------------------------------------------
   src/client/06-startups.js and 07-ventures.js each built this header inline
   with a 135deg #065f46→#047857 green gradient, a translucent white icon tile
   and #6ee7b7 text. It was the last green surface in the product and it sat
   directly beside flat white dash cards, so it read as a leftover from the
   previous design system. Same structure, dash surface: hairline rule, ink
   title, muted sub-line, neutral icon tile.
   ========================================================================= */
.dtv-budget-card {
  padding: 0;
  overflow: hidden;
  margin-bottom: 16px;
}
.dtv-budget-hd {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
  background: var(--surface);
}
.dtv-budget-ico {
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: var(--radius);
  display: grid; place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-3);
  font-size: .9375rem;
}
.dtv-budget-t {
  font-size: .9375rem; font-weight: 700;
  color: var(--text); letter-spacing: -.005em;
}
.dtv-budget-s {
  font-size: .75rem; color: var(--text-3); margin-top: 2px;
}
.dtv-budget-body { padding: 1.25rem; }
.dtv-budget-load {
  display: flex; align-items: center; justify-content: center;
  gap: .5rem; padding: 2.5rem 1rem;
  color: var(--text-3); font-size: .8125rem;
}

/* The venture budget section sits below the tab body rather than inside a
   padded card, so it needs the top offset the startup one gets from its card. */
.dtv-budget-card.is-top { margin-top: 20px; }

/* ============================================================================
   §20. Risk register — heat matrix + severity-sorted rows
   ----------------------------------------------------------------------------
   Ported from the Ventures admin register (src/client/07-ventures.js) so the
   founder portal and the admin workspace read the same way: rows on the left,
   four stat cards over a likelihood x severity heat map on the right.

   Why classes and not inline styles: the admin version is inline throughout,
   which is why it cannot be restyled or made responsive. Rules live here so the
   matrix can collapse to one column on a narrow screen and so the two screens
   cannot drift apart.
   ========================================================================== */

/* Two tracks: the register takes the available width, the rail is fixed. The
   rail is what makes the matrix readable at a glance, so it must not shrink. */
.dtv-rk-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 1rem;
  align-items: start;
}

/* The rail holds position while a long register scrolls past it. `top` clears
   the sticky portal header rather than the viewport edge. */
.dtv-rk-rail {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  position: sticky;
  top: 12px;
}

/* ── Stat cards ─────────────────────────────────────────────────────────── */
.dtv-rk-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
}
.dtv-rk-stat {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: .6875rem .8125rem;
}
.dtv-rk-stat-l {
  font-size: .625rem; font-weight: 800;
  letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-4);
}
.dtv-rk-stat-v {
  font-size: 1.5rem; font-weight: 900;
  line-height: 1.1; margin-top: .25rem;
  color: var(--text);
}
/* A count that needs attention carries its own colour; a zero stays quiet. */
.dtv-rk-stat-v.is-high { color: var(--danger); }
.dtv-rk-stat-v.is-med  { color: var(--warning); }

/* ── Heat matrix ────────────────────────────────────────────────────────── */
.dtv-rk-map {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: .75rem;
}
.dtv-rk-map-h {
  font-size: .625rem; font-weight: 800;
  letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-4); margin-bottom: .5625rem;
}
.dtv-rk-map-row { display: flex; align-items: stretch; }

/* Row label column is fixed so every grid of cells starts at the same x. */
.dtv-rk-map-rl {
  width: 58px; flex: none;
  display: flex; align-items: center;
  font-size: .65625rem; font-weight: 700;
  color: var(--text-3);
}
.dtv-rk-cell {
  flex: 1; height: 44px; margin: 1px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: .9375rem; font-weight: 800;
  font-variant-numeric: tabular-nums;
}
/* Three tones only, driven by the band product — the same thresholds the
   admin register uses, so a risk lands in the same colour on both screens. */
.dtv-rk-cell.is-hi { background: #FEE2E2; color: #DC2626; }
.dtv-rk-cell.is-me { background: #FEF3C7; color: #B45309; }
.dtv-rk-cell.is-lo { background: #D1FAE5; color: #047857; }

.dtv-rk-map-axis { display: flex; align-items: center; margin-top: 2px; }
.dtv-rk-map-axis .dtv-rk-map-rl { width: 58px; }
.dtv-rk-map-al {
  flex: 1; text-align: center;
  font-size: .65625rem; font-weight: 700;
  color: var(--text-3);
}
.dtv-rk-map-note {
  font-size: .65625rem; color: var(--text-4);
  margin-top: .5rem; line-height: 1.5;
}

/* ── Rows ───────────────────────────────────────────────────────────────── */
.dtv-rk-list { display: flex; flex-direction: column; gap: .5rem; }
.dtv-rk-row {
  border: 1px solid var(--border-light);
  border-radius: 9px;
  padding: .625rem .75rem;
  /* The severity band is carried by the leading edge, so the list can be
     scanned down the left margin without reading a single word. */
  border-left: 3px solid var(--text-4);
  background: var(--surface);
}
.dtv-rk-row.is-high { border-left-color: var(--danger); }
.dtv-rk-row.is-med  { border-left-color: var(--warning); }
.dtv-rk-row.is-low  { border-left-color: var(--success); }
/* Closed risks recede: grey edge, grey field, struck-through title. */
.dtv-rk-row.is-closed {
  border-left-color: var(--border);
  background: #FAFAFA;
}
.dtv-rk-row.is-closed .dtv-rk-title {
  text-decoration: line-through; color: var(--text-4);
}

.dtv-rk-top {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: .5rem;
}
.dtv-rk-head {
  display: flex; align-items: center; gap: .4375rem;
  flex: 1; min-width: 0;
}
.dtv-rk-ico { flex-shrink: 0; font-size: .75rem; }
.dtv-rk-title {
  font-size: .8125rem; font-weight: 700;
  color: var(--text); line-height: 1.35;
  /* A long risk title wraps rather than pushing the badges off the row. */
  overflow-wrap: anywhere;
}
.dtv-rk-badges {
  display: flex; align-items: center;
  gap: 5px; flex-shrink: 0;
}
.dtv-rk-pill {
  font-size: .625rem; font-weight: 800;
  padding: 2px 8px; border-radius: 20px;
  white-space: nowrap; text-transform: capitalize;
}

.dtv-rk-meta {
  display: flex; align-items: center;
  gap: .5rem; flex-wrap: wrap;
  margin-top: .375rem;
  font-size: .65625rem; color: var(--text-4);
}
.dtv-rk-cat {
  font-size: .65625rem; font-weight: 600;
  color: var(--text-2); background: var(--surface-2);
  padding: 2px 7px; border-radius: 6px;
}
.dtv-rk-score strong { font-weight: 800; }
.dtv-rk-due.is-overdue { color: var(--danger); }

.dtv-rk-desc {
  font-size: .75rem; color: var(--text-3);
  margin-top: .375rem; line-height: 1.5;
}
/* Mitigation is the answer to the risk, so it gets a green field — not another
   grey paragraph the eye skips. */
.dtv-rk-mit {
  background: #F0FDF4;
  border-radius: var(--radius-sm);
  padding: .375rem .5625rem;
  font-size: .75rem; color: #15803D;
  display: flex; gap: .4375rem; align-items: flex-start;
  margin-top: .375rem; line-height: 1.5;
}
.dtv-rk-mit i { color: #16A34A; flex-shrink: 0; margin-top: 2px; }

/* Small square icon action — matches the admin register's edit / delete. */
.dtv-rk-act {
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 3px 8px; font-size: .6875rem;
  color: var(--text-2); cursor: pointer; line-height: 1.4;
}
.dtv-rk-act:hover { background: var(--surface-3); }
.dtv-rk-act:focus-visible { outline: 2px solid var(--biz); outline-offset: 1px; }

.dtv-rk-empty {
  text-align: center; padding: 2.125rem 1rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: #F8FAFC;
}
.dtv-rk-empty i {
  font-size: 1.625rem; color: var(--border); display: block;
}
.dtv-rk-empty-t {
  font-size: .8125rem; font-weight: 700;
  color: var(--text-3); margin-top: .625rem;
}
.dtv-rk-empty-s {
  font-size: .75rem; color: var(--text-4); margin-top: .25rem;
}

.dtv-rk-clear {
  font-size: .71875rem;
  color: var(--success-dark);
  background: var(--success-light);
  border: 1px solid var(--success);
  border-radius: var(--radius-sm);
  padding: .5rem .625rem;
}

/* ── Narrow screens: the rail cannot sit beside the list, so it goes above.
      The matrix stays useful at 300px; the list does not shrink below 320px. */
@media (max-width: 900px) {
  .dtv-rk-grid { grid-template-columns: 1fr; }
  .dtv-rk-rail { position: static; }
}

/* ============================================================================
   §21. Gate decision — Go · Conditional Go · Recycle · No-Go
   ----------------------------------------------------------------------------
   The reference and the admin Stage Gates tab record one of four outcomes per
   gate. The portal showed the outcome read-only and had no form at all, so a
   founder could see a decision but never record one.
   ========================================================================== */
.dtv-gate-dec {
  margin-top: .75rem;
  padding-top: .625rem;
  border-top: 1px dashed var(--border-light);
}
.dtv-gate-dec-h {
  font-size: .625rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-4); margin-bottom: .375rem;
}
.dtv-gate-dec-now {
  display: flex; align-items: center;
  gap: .5rem; flex-wrap: wrap;
}
.dtv-gate-dec-v { font-size: .9375rem; font-weight: 800; }
.dtv-gate-dec-meta {
  font-size: .6875rem; color: var(--text-4); line-height: 1.5;
}
.dtv-gate-dec-form {
  display: grid; gap: .5rem; margin-top: .625rem;
}
.dtv-gate-dec-sel,
.dtv-gate-dec-notes {
  width: 100%; box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .5rem .625rem;
  font-size: .8125rem; font-family: inherit;
  background: var(--surface); color: var(--text);
}
.dtv-gate-dec-notes { resize: vertical; }
.dtv-gate-dec-save {
  justify-self: start;
  padding: .5rem .875rem;
  border: none; cursor: pointer;
  border-radius: var(--radius);
  background: var(--biz); color: #fff;
  font-size: .75rem; font-weight: 800;
}
.dtv-gate-dec-save:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.dtv-gate-dec-hint {
  font-size: .6875rem; color: var(--text-4); line-height: 1.5;
}
.dtv-gate-dec-msg {
  display: none; font-size: .75rem;
  border-radius: var(--radius-sm);
  padding: .375rem .5rem; line-height: 1.5;
}

/* ============================================================================
   §22. Applicant portal — the post-login tracking dashboard
   ----------------------------------------------------------------------------
   Was: a ~180-line renderer in portal.js emitting inline hexes (#f8fafc,
   #0f172a, #94a3b8, #6366f1, #e2e8f0 …) on elements that carried no class at
   all. Nothing here could be reached by a stylesheet, so the applicant door was
   the only portal still painting the pre-theme palette while Mentor, SME and the
   venture dashboards all rendered the current one.

   Now: named classes over theme tokens only. No hex is written in this file
   except inside a token, so dark mode keeps working and a future palette change
   lands here rather than in a JavaScript string.

   Geometry follows the rest of the sheet: hairline borders, 6px/12px radii, a
   flat surface, and colour used only for state (the journey dot, the document
   status dot). Cards are not defined here — they are still `.card`, which §3
   already paints, so the applicant panels are literally the same panel object
   as every other portal's.
   ========================================================================== */

/* ── Identity header ─────────────────────────────────────────────────────── */
.dtv-appl-hd {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: .75rem;
}
.dtv-appl-id { display: flex; align-items: center; gap: .875rem; min-width: 0; }
.dtv-appl-av {
  width: 48px; height: 48px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-lg);
  background: var(--primary); color: #fff;
  font-family: var(--dtv-font-display);
  font-size: 1.25rem; font-weight: 700; line-height: 1;
}
.dtv-appl-eyebrow {
  font-size: .625rem; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-4); margin-bottom: .1875rem;
}
.dtv-appl-name {
  font-family: var(--dtv-font-display);
  font-size: 1.1875rem; font-weight: 700; line-height: 1.2;
  color: var(--text); letter-spacing: -.015em;
}
.dtv-appl-meta {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: .25rem .875rem; margin-top: .25rem;
  font-size: .75rem; color: var(--text-3);
}
.dtv-appl-meta i { margin-right: .3rem; color: var(--text-4); width: .8125rem; text-align: center; }

/* Status pill — outline + dot, exactly the shape and vocabulary of §5 .badge.
   Deliberately NO icon inside: the dot already carries the state, and a dot plus
   a glyph in a pill this small reads as two competing marks. */
.dtv-appl-pill {
  display: inline-flex; align-items: center; gap: .35rem;
  height: fit-content; flex-shrink: 0;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text-2);
  padding: 3px 11px; font-size: .75rem; font-weight: 600;
}
.dtv-appl-pill::before {
  content: ''; width: .4rem; height: .4rem; border-radius: 50%;
  background: var(--text-4); flex-shrink: 0;
}
.dtv-appl-pill.is-open::before   { background: var(--info); }
.dtv-appl-pill.is-good::before   { background: var(--success); }
.dtv-appl-pill.is-mid::before    { background: var(--purple); }
.dtv-appl-pill.is-bad::before    { background: var(--danger); }
.dtv-appl-pill.is-wait::before   { background: var(--warning); }
.dtv-appl-pill.is-open { color: var(--info); border-color: var(--info); }
.dtv-appl-pill.is-good { color: var(--success-dark); border-color: var(--success); }
.dtv-appl-pill.is-mid  { color: var(--purple); border-color: var(--purple); }
.dtv-appl-pill.is-bad  { color: var(--danger); border-color: var(--danger); }
.dtv-appl-pill.is-wait { color: var(--warning-dark); border-color: var(--warning); }

/* ── Stat strip ──────────────────────────────────────────────────────────── */
.dtv-appl-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: .5rem; margin-top: 1rem;
}
.dtv-appl-stat {
  background: var(--surface-2); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); padding: .5rem .625rem; min-width: 0;
}
.dtv-appl-stat-k {
  font-size: .625rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-4);
}
.dtv-appl-stat-v {
  margin-top: .1875rem; font-size: .8125rem; font-weight: 600;
  color: var(--text); display: flex; align-items: center; gap: .3rem;
}
/* Dates and counts are data, so they take the mono face like every other metric. */
.dtv-appl-stat-v.is-num { font-family: var(--dtv-font-mono); font-variant-numeric: tabular-nums; }
.dtv-appl-stat-v.is-good { color: var(--success-dark); }
.dtv-appl-stat-v.is-idle { color: var(--text-4); }

/* ── Journey ─────────────────────────────────────────────────────────────── */
.dtv-appl-journey { display: flex; align-items: flex-start; margin-top: .25rem; }
.dtv-appl-jstep {
  position: relative; flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center;
}
/* The connector is drawn by the step that FOLLOWS the dot, so the last step
   owns no line and the rail cannot overhang the row. */
.dtv-appl-jstep + .dtv-appl-jstep::before {
  content: ''; position: absolute; z-index: 0;
  inset-inline-start: -50%; inset-block-start: 13px;
  width: 100%; height: 2px; background: var(--surface-3);
}
/* The connector INTO a step is green once that step is reached. Scoped to the
   `+` form only: a bare `.is-done::before` would also match the first step,
   which owns no incoming line, and paint a stray dash off its left edge. */
.dtv-appl-jstep.is-done + .dtv-appl-jstep::before,
.dtv-appl-jstep.is-now + .dtv-appl-jstep::before { background: var(--success); }
.dtv-appl-jstep.is-fail + .dtv-appl-jstep::before { background: var(--danger); }
.dtv-appl-jdot {
  position: relative; z-index: 1; flex-shrink: 0;
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-3); color: var(--text-4);
  border: 1px solid var(--border);
  font-size: .625rem;
}
.dtv-appl-jstep.is-done .dtv-appl-jdot {
  background: var(--success); border-color: var(--success); color: #fff;
}
.dtv-appl-jstep.is-now .dtv-appl-jdot {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 0 0 3px rgba(20,48,74,.12);
}
.dtv-appl-jstep.is-fail .dtv-appl-jdot {
  background: var(--danger); border-color: var(--danger); color: #fff;
}
.dtv-appl-jlbl {
  margin-top: .375rem; text-align: center; line-height: 1.3;
  font-size: .6875rem; font-weight: 600; color: var(--text-4);
}
.dtv-appl-jstep.is-done .dtv-appl-jlbl { color: var(--text-3); }
.dtv-appl-jstep.is-now .dtv-appl-jlbl  { color: var(--text); font-weight: 700; }
.dtv-appl-jstep.is-fail .dtv-appl-jlbl { color: var(--danger); font-weight: 700; }

/* ── Tabs — underline, identical to §6 .vtab ─────────────────────────────── */
.dtv-appl-tabs {
  display: flex; gap: 2px; margin-bottom: .875rem;
  border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none;
}
.dtv-appl-tabs::-webkit-scrollbar { display: none; }
.dtv-appl-tab {
  flex-shrink: 0;
  background: transparent; border: 0; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  padding: .5rem .75rem;
  font-family: inherit; font-size: .8125rem; font-weight: 500;
  color: var(--text-3); white-space: nowrap;
  transition: color .12s, border-color .12s;
}
.dtv-appl-tab:hover { color: var(--text); }
.dtv-appl-tab.is-on { color: var(--text); font-weight: 600; border-bottom-color: var(--text); }
.dtv-appl-tab i { margin-right: .375rem; font-size: .75rem; }
/* Count beside the tab label. A tab is a control, not a status chip, so this is
   a quiet numeral — no fill, no border — and only appears when it has a value. */
.dtv-appl-tab-n {
  display: inline-block; margin-left: .375rem;
  font-family: var(--dtv-font-mono); font-variant-numeric: tabular-nums;
  font-size: .625rem; font-weight: 600; color: var(--text-4);
  background: var(--surface-2); border-radius: 999px; padding: 0 .3125rem;
}
.dtv-appl-tab.is-on .dtv-appl-tab-n { color: var(--text-2); background: var(--surface-3); }
.dtv-appl-tab:focus-visible { outline: 2px solid var(--text); outline-offset: -2px; border-radius: var(--radius-sm) var(--radius-sm) 0 0; }

/* ── Section chrome ──────────────────────────────────────────────────────── */
.dtv-appl-sec-h {
  display: flex; align-items: center; gap: .4375rem;
  font-size: .8125rem; font-weight: 700; color: var(--text);
  margin-bottom: .75rem;
}
.dtv-appl-sec-h i { color: var(--text-4); font-size: .8125rem; }
.dtv-appl-sec-sub {
  font-size: .75rem; color: var(--text-3); line-height: 1.55;
  margin: -.4375rem 0 .875rem;
}

/* A response is a labelled block with a rule, not a tinted box: seven tinted
   boxes stacked read as seven alerts. */
.dtv-appl-q { border-left: 2px solid var(--border); padding: .125rem 0 .125rem .75rem; margin-bottom: 1rem; }
.dtv-appl-q:last-child { margin-bottom: 0; }
.dtv-appl-q-k {
  font-size: .625rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-4); margin-bottom: .25rem;
}
.dtv-appl-q-v {
  font-size: .8125rem; color: var(--text-2); line-height: 1.6;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.dtv-appl-q-v.is-empty { color: var(--text-4); font-style: italic; }

/* Quiet aside — "what happens next", file-type notes. */
.dtv-appl-aside {
  display: flex; align-items: flex-start; gap: .5rem;
  margin-top: .75rem; padding: .625rem .75rem;
  background: var(--surface-2); border: 1px solid var(--border-light);
  border-left: 2px solid var(--info);
  border-radius: var(--radius-sm);
  font-size: .75rem; color: var(--text-3); line-height: 1.6;
}
.dtv-appl-aside i { color: var(--info); margin-top: .125rem; flex-shrink: 0; }

/* ── Documents ───────────────────────────────────────────────────────────── */
.dtv-appl-docbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; padding: .75rem 1.125rem;
  border-bottom: 1px solid var(--border-light);
}
.dtv-appl-doclist { padding: .75rem 1.125rem; }
.dtv-appl-doc {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center; gap: .75rem;
  padding: .5rem 0;
}
.dtv-appl-doc + .dtv-appl-doc { border-top: 1px solid var(--border-light); }
.dtv-appl-doc-ico {
  width: 34px; height: 34px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border-light);
  color: var(--text-3); font-size: .875rem;
}
/* Colour is spent only on the two states that matter (rejected / approved);
   a PDF is not an error just because PDFs are red. */
.dtv-appl-doc-ico.is-pdf { color: var(--danger); }
.dtv-appl-doc-n {
  font-size: .8125rem; font-weight: 600; color: var(--text);
  line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dtv-appl-doc-m {
  font-size: .6875rem; color: var(--text-4); margin-top: .125rem;
  font-variant-numeric: tabular-nums;
}
.dtv-appl-doc-act { display: flex; align-items: center; gap: .375rem; flex-shrink: 0; }
.dtv-appl-doc-state {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .625rem; font-weight: 600; color: var(--text-3);
  border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px;
  white-space: nowrap;
}
.dtv-appl-doc-state::before {
  content: ''; width: .35rem; height: .35rem; border-radius: 50%;
  background: var(--text-4); flex-shrink: 0;
}
.dtv-appl-doc-state.is-approved::before { background: var(--success); }
.dtv-appl-doc-state.is-approved { color: var(--success-dark); border-color: var(--success); }
.dtv-appl-doc-state.is-rejected::before { background: var(--danger); }
.dtv-appl-doc-state.is-rejected { color: var(--danger); border-color: var(--danger); }
.dtv-appl-ico-btn {
  width: 30px; height: 30px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-3); font-size: .75rem; text-decoration: none;
  transition: background .12s, border-color .12s, color .12s;
}
.dtv-appl-ico-btn:hover { background: var(--surface-2); border-color: var(--text-4); color: var(--text); }
.dtv-appl-ico-btn.is-del:hover { background: var(--danger-light); border-color: var(--danger); color: var(--danger); }
.dtv-appl-ico-btn:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }

.dtv-appl-empty {
  text-align: center; padding: 1.75rem 1rem;
  border: 1px dashed var(--border); border-radius: var(--radius-lg);
  color: var(--text-4); font-size: .8125rem; line-height: 1.6;
}
.dtv-appl-empty i { display: block; font-size: 1.25rem; margin-bottom: .5rem; color: var(--text-4); }

/* ── Edit form ───────────────────────────────────────────────────────────── */
.dtv-appl-field { margin-bottom: .875rem; }
.dtv-appl-field label {
  display: block; margin-bottom: .3125rem;
  font-size: .6875rem; font-weight: 600; letter-spacing: .02em; color: var(--text-3);
}
.dtv-appl-inp,
.dtv-appl-field input[type=text],
.dtv-appl-field textarea {
  width: 100%; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .5rem .625rem;
  font-family: inherit; font-size: .8125rem; line-height: 1.5;
  color: var(--text); background: var(--surface);
}
.dtv-appl-field textarea { resize: vertical; min-height: 5rem; }
.dtv-appl-inp:focus,
.dtv-appl-field input[type=text]:focus,
.dtv-appl-field textarea:focus {
  outline: none; border-color: var(--text-2);
  box-shadow: 0 0 0 3px rgba(15,27,38,.08);
}
.dtv-appl-actions {
  display: flex; justify-content: flex-end; gap: .5rem;
  margin-top: .875rem; padding-top: .75rem;
  border-top: 1px solid var(--border-light);
}

/* ── Buttons — the §4 shape, at portal scale ─────────────────────────────── */
.dtv-appl-btn {
  display: inline-flex; align-items: center; gap: .375rem;
  cursor: pointer; font-family: inherit;
  font-size: .8125rem; font-weight: 600; line-height: 1;
  padding: .5rem .875rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--primary);
  background: var(--primary); color: #fff;
  transition: background .12s, border-color .12s;
}
.dtv-appl-btn:hover { background: var(--primary-light); border-color: var(--primary-light); }
.dtv-appl-btn:disabled { opacity: .55; cursor: not-allowed; }
.dtv-appl-btn:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.dtv-appl-btn.is-ghost {
  background: var(--surface); color: var(--text-2); border-color: var(--border);
}
.dtv-appl-btn.is-ghost:hover { background: var(--surface-2); border-color: var(--text-4); }
.dtv-appl-btn i { font-size: .75rem; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.dtv-appl-overlay {
  position: fixed; inset: 0; z-index: 8000;
  background: rgba(15,27,38,.55);
  overflow-y: auto; padding: 24px 16px;
}
.dtv-appl-modal {
  position: relative; max-width: 520px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-xl);
  padding: 1.25rem 1.375rem 1.125rem;
}
.dtv-appl-modal-h {
  display: flex; align-items: center; gap: .4375rem;
  font-size: .9375rem; font-weight: 700; color: var(--text);
  margin-bottom: 1rem;
}
.dtv-appl-modal-h i { color: var(--text-4); font-size: .875rem; }
.dtv-appl-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.dtv-appl-file-prev {
  margin-top: .5rem; padding: .5rem .625rem;
  background: var(--surface-2); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: .75rem; color: var(--text-3); overflow-wrap: anywhere;
}
.dtv-appl-file-prev b { color: var(--text); font-weight: 600; }
.dtv-appl-file-warn { color: var(--danger); font-weight: 600; margin-left: .5rem; }
.dtv-appl-prog { margin-bottom: .75rem; }
.dtv-appl-prog-k { font-size: .6875rem; color: var(--text-3); margin-bottom: .375rem; }
.dtv-appl-prog-track {
  height: 6px; border-radius: 99px; overflow: hidden; background: var(--surface-3);
}
.dtv-appl-prog-fill {
  height: 100%; width: 0%; border-radius: 99px;
  background: var(--primary); transition: width .3s;
}

/* ── Toast ───────────────────────────────────────────────────────────────── */
.dtv-appl-toast {
  position: fixed; bottom: 24px; inset-inline-start: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  max-width: calc(100vw - 32px);
  padding: .625rem 1.125rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--primary);
  background: var(--primary); color: #fff;
  font-size: .8125rem; font-weight: 500;
  box-shadow: var(--shadow-lg);
  transition: opacity .3s;
}
.dtv-appl-toast.is-error { background: var(--danger); border-color: var(--danger); }
.dtv-appl-toast.is-success { background: var(--success-dark); border-color: var(--success-dark); }

@media (max-width: 560px) {
  .dtv-appl-grid2 { grid-template-columns: 1fr; }
  .dtv-appl-jlbl { font-size: .625rem; }
  .dtv-appl-doc { grid-template-columns: 30px minmax(0, 1fr) auto; gap: .5rem; }
  .dtv-appl-doc-m { font-size: .625rem; }
}
