/* Deal Vision App design system: dv.css v0.1.0 (2026-10-09)
   Task 0.3. D-056: dark by default, every screen phone first. D-057: prospecting loops
   work better on the phone than on the laptop.
   One stylesheet for every module: tokens, base, app shell, components.

   Theme: dark is the default on :root. The server renders <html data-theme="dark|light">
   from the user's setting (Settings > Theme); with no attribute the device preference
   decides. Layout: two size containers. The app shell (dvapp) picks the frame: phone
   (< 600px, bottom tabs), tablet or narrow window (600-1023px, icon rail), laptop and
   desktop (>= 1024px, labelled navigation + record panel). The content column (dvmain)
   lays out rows, money and boards by the width it actually has.

   Contrast (Build Spec section 6): text pairs >= 4.5:1 and control borders >= 3:1 in
   both themes, checked by tests/design/test_contrast.py. Text on orange is navy
   (#011c6e, 4.83:1), never white (3.12:1 fails AA). */

/* ---------- 1. Tokens: dark (default) ---------- */
:root {
  color-scheme: dark;
  --dv-bg: #060a17;
  --dv-surface: #0c1430;
  --dv-surface-2: #121d40;
  --dv-surface-3: #1a2752;
  --dv-brand: #011c6e;
  --dv-on-brand: #ffffff;
  --dv-text: #f2f5fb;
  --dv-text-2: #b3bfd6;
  --dv-text-3: #8f9cba;
  --dv-line: #1f2c55;
  --dv-line-strong: #5b6e9e;
  --dv-primary: #ff5a18;
  --dv-primary-hover: #ff7a45;
  --dv-primary-pressed: #ff6a2e;
  --dv-on-primary: #011c6e;
  --dv-primary-edge: #ff5a18;
  --dv-primary-text: #ff7a45;
  --dv-link: #87b7e8;
  --dv-accent: #87b7e8;
  --dv-on-accent: #011c6e;
  --dv-accent-soft: #202e4d;
  --dv-selected: #1a366e;
  --dv-on-selected: #ffffff;
  --dv-ok: #5fd4a0;
  --dv-ok-soft: #193342;
  --dv-warn: #ffc857;
  --dv-warn-soft: #333136;
  --dv-bad: #ff8a8a;
  --dv-bad-soft: #33273e;
  --dv-focus: #87b7e8;
  --dv-overlay: rgba(2, 5, 14, 0.66);
  --dv-shadow-1: 0 1px 2px rgba(0, 0, 0, 0.45);
  --dv-shadow-2: 0 10px 32px rgba(0, 0, 0, 0.55);
  --dv-shadow-menu: 12px 0 32px rgba(0, 0, 0, 0.5);       /* the hover menu over the page (WO-377) */
}

/* ---------- 1b. Tokens: light (device preference when no theme is set) ---------- */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --dv-bg: #f3f5fa;
    --dv-surface: #ffffff;
    --dv-surface-2: #eef2f8;
    --dv-surface-3: #e2e8f3;
    --dv-brand: #011c6e;
    --dv-on-brand: #ffffff;
    --dv-text: #0a1433;
    --dv-text-2: #3f4e70;
    --dv-text-3: #56658a;
    --dv-line: #d8dfeb;
    --dv-line-strong: #6f7e9b;
    --dv-primary: #ff5a18;
    --dv-primary-hover: #ff7a45;
    --dv-primary-pressed: #ff6a2e;
    --dv-on-primary: #011c6e;
    --dv-primary-edge: #d9480f;
    --dv-primary-text: #b33a06;
    --dv-link: #1a366e;
    --dv-accent: #87b7e8;
    --dv-on-accent: #011c6e;
    --dv-accent-soft: #eef5fc;
    --dv-selected: #dce8f7;
    --dv-on-selected: #0a1433;
    --dv-ok: #0a6e44;
    --dv-ok-soft: #ddebe5;
    --dv-warn: #8a5600;
    --dv-warn-soft: #efe7db;
    --dv-bad: #b3261e;
    --dv-bad-soft: #f4e1df;
    --dv-focus: #1a366e;
    --dv-overlay: rgba(10, 20, 51, 0.4);
    --dv-shadow-1: 0 1px 2px rgba(10, 20, 51, 0.08);
    --dv-shadow-2: 0 10px 32px rgba(10, 20, 51, 0.18);
    --dv-shadow-menu: 12px 0 32px rgba(10, 20, 51, 0.18);
  }
}

/* ---------- 1c. Tokens: light (chosen in Settings) ---------- */
:root[data-theme="light"] {
  color-scheme: light;
  --dv-bg: #f3f5fa;
  --dv-surface: #ffffff;
  --dv-surface-2: #eef2f8;
  --dv-surface-3: #e2e8f3;
  --dv-brand: #011c6e;
  --dv-on-brand: #ffffff;
  --dv-text: #0a1433;
  --dv-text-2: #3f4e70;
  --dv-text-3: #56658a;
  --dv-line: #d8dfeb;
  --dv-line-strong: #6f7e9b;
  --dv-primary: #ff5a18;
  --dv-primary-hover: #ff7a45;
  --dv-primary-pressed: #ff6a2e;
  --dv-on-primary: #011c6e;
  --dv-primary-edge: #d9480f;
  --dv-primary-text: #b33a06;
  --dv-link: #1a366e;
  --dv-accent: #87b7e8;
  --dv-on-accent: #011c6e;
  --dv-accent-soft: #eef5fc;
  --dv-selected: #dce8f7;
  --dv-on-selected: #0a1433;
  --dv-ok: #0a6e44;
  --dv-ok-soft: #ddebe5;
  --dv-warn: #8a5600;
  --dv-warn-soft: #efe7db;
  --dv-bad: #b3261e;
  --dv-bad-soft: #f4e1df;
  --dv-focus: #1a366e;
  --dv-overlay: rgba(10, 20, 51, 0.4);
  --dv-shadow-1: 0 1px 2px rgba(10, 20, 51, 0.08);
  --dv-shadow-2: 0 10px 32px rgba(10, 20, 51, 0.18);
  --dv-shadow-menu: 12px 0 32px rgba(10, 20, 51, 0.18);
}

/* ---------- 1d. Tokens that do not change with the theme ---------- */
:root {
  --dv-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --dv-fs-xs: 0.75rem;    /* 12: meta, chips, badges (never smaller) */
  --dv-fs-sm: 0.875rem;   /* 14: secondary text, buttons */
  --dv-fs-md: 1rem;       /* 16: body and every input (stops iOS zoom) */
  --dv-fs-lg: 1.125rem;   /* 18: row titles, card headings */
  --dv-fs-xl: 1.375rem;   /* 22: screen titles */
  --dv-fs-2xl: 1.75rem;   /* 28: key numbers */
  --dv-fs-3xl: 2.125rem;  /* 34: page headings on desktop */
  --dv-s1: 4px; --dv-s2: 8px; --dv-s3: 12px; --dv-s4: 16px; --dv-s5: 20px;
  --dv-s6: 24px; --dv-s8: 32px; --dv-s10: 40px; --dv-s12: 48px;
  --dv-r-sm: 6px; --dv-r-md: 10px; --dv-r-lg: 14px; --dv-r-xl: 20px; --dv-r-pill: 999px;
  --dv-touch: 48px;       /* phone actions */
  --dv-touch-min: 44px;   /* hard minimum for anything tappable */
  --dv-appbar-h: 56px;
  --dv-tabbar-h: 64px;
  --dv-rail-w: 64px;      /* icon rail from 600 px (WO-377) */
  --dv-menu-w: 220px;     /* the full menu: over the page on hover or tap, its own column when pinned */
  --dv-list-w: 380px;     /* list column default from 1024 px; the record takes the rest (#1282). The divider sets a per-page width inline (WO-377) */
  --dv-list-min: 340px;   /* #1306: the list column never goes narrower (was 300); a saved width under it is clamped up */
  --dv-panel-min: 320px;
  --dv-split-w: 24px;      /* #2634: the list | record handle's hit area (was 10) */
  --dv-split-in: 6px;      /* #2634: how far the hit area reaches into the list column (the rest is over the record's pad) */
  --dv-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --dv-dur: 160ms;
  --dv-z-bar: 10; --dv-z-nav: 20; --dv-z-sheet: 50; --dv-z-toast: 60; --dv-z-palette: 70;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--dv-bg);
  color: var(--dv-text);
  font: 400 var(--dv-fs-md)/1.45 var(--dv-font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--dv-link); text-underline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--dv-focus); outline-offset: 2px; }
.dv-num { font-variant-numeric: tabular-nums; }
.dv-muted { color: var(--dv-text-2); }
.dv-faint { color: var(--dv-text-3); }
.dv-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.dv-ico { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ---------- 3. App shell (phone first; container queries widen it) ---------- */
.dv-app {
  container: dvapp / inline-size;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--dv-bg);
  color: var(--dv-text);
}
.dv-shell { height: 100%; display: flex; flex-direction: column; min-height: 0; }
/* #1295 (Nick 11/08: "The font looks too small on the phone"): under 600 px the whole type scale steps up through the
   tokens, so every screen that uses them follows. Body 17, secondary and help 15, chips, labels and the tab bar 14,
   headings with them. Still rem: the phone's own text-size setting scales all of it (no maximum-scale anywhere).
   The tokens are redefined on the app's children (a container query styles what is inside its container, never the
   container or :root), and font-size re-reads the body size there. Tablet and desktop keep the :root scale. */
@container dvapp (max-width: 599px) {
  .dv-app > * {
    --dv-fs-xs: 0.875rem;    /* 14 (12 from 600 px) */
    --dv-fs-sm: 0.9375rem;   /* 15 (14) */
    --dv-fs-md: 1.0625rem;   /* 17 (16) */
    --dv-fs-lg: 1.1875rem;   /* 19 (18) */
    --dv-fs-xl: 1.5rem;      /* 24 (22) */
    --dv-fs-2xl: 1.875rem;   /* 30 (28) */
    --dv-fs-3xl: 2.25rem;    /* 36 (34) */
    font-size: var(--dv-fs-md);
  }
}
.dv-appbar {
  flex: none; height: var(--dv-appbar-h); display: flex; align-items: center; gap: var(--dv-s2);
  padding: 0 var(--dv-s2) 0 var(--dv-s4); background: var(--dv-bg);
  border-bottom: 1px solid var(--dv-line); z-index: var(--dv-z-bar);
}
.dv-appbar__title { flex: 1; min-width: 0; font-size: var(--dv-fs-lg); font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dv-appbar__brand { display: inline-flex; align-items: center; gap: var(--dv-s2); font-weight: 700; }
.dv-appbar__word { display: none; }
.dv-appbar .dv-appbar__search { display: none; }
.dv-mark {
  width: 28px; height: 28px; border-radius: 7px; display: inline-grid; place-items: center; flex: none;
  background: var(--dv-primary); color: var(--dv-on-primary); font: 800 12px/1 var(--dv-font); letter-spacing: 0.02em;
}
/* #1756: the room under a page's last line is an end spacer inside the scroll area, not the scroll area's own bottom
   padding. A browser holds a `position: sticky; bottom: 0` bar above the scroll area's padding, so with padding a
   page's sticky bottom bar (the review queue's Confirm all, the CFO confirm bar) sat 24 px above the tab bar with
   the list showing through the strip. With no padding the bar sits flush on the tab bar (the tab bar keeps its own
   safe-area inset); the page still ends with the same 24 px of room. The map fills the area and never scrolls
   (map.css: padding 0, overflow hidden), so it gets no spacer: a hidden 24 px would let a focus move scroll it. */
.dv-main { container: dvmain / inline-size; flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.dv-main::after { content: ""; display: block; height: var(--dv-s6); }
.dv-main:has(> .mp-screen)::after { content: none; }
.dv-sidenav, .dv-panel, .dv-split { display: none; }
.dv-tabbar {
  flex: none; display: grid; grid-template-columns: repeat(5, 1fr);
  min-height: var(--dv-tabbar-h); padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--dv-surface); border-top: 1px solid var(--dv-line); z-index: var(--dv-z-bar);
}
.dv-tab {
  position: relative; display: grid; place-items: center; align-content: center; gap: 3px;
  min-height: var(--dv-tabbar-h); border: 0; background: none; color: var(--dv-text-2);
  font: 600 var(--dv-fs-xs)/1 var(--dv-font); cursor: pointer;
}
.dv-tab .dv-ico { width: 22px; height: 22px; }
.dv-tab[aria-current="page"] { color: var(--dv-primary-text); }
.dv-tab[aria-current="page"]::before {
  content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px;
  border-radius: 0 0 3px 3px; background: var(--dv-primary);
}
.dv-tab .dv-badge { position: absolute; top: 8px; left: calc(50% + 6px); }
/* Relay #1895 (Nav A, flag nav_grouped): on a phone the More tab opens the grouped menu (core/_nav_groups.html), the
   four small headings with their items as full-width rows. From 600 px the rail is that menu, so More hides it. */
.dv-navgroups { display: flex; flex-direction: column; padding: 0 var(--dv-s4); }
.dv-navgroups .dv-nav-group {
  display: block; padding: var(--dv-s4) var(--dv-s2) var(--dv-s1); color: var(--dv-text-3);
  font: 700 var(--dv-fs-xs)/1 var(--dv-font); letter-spacing: 0.08em; text-transform: uppercase;
}
.dv-navgroups .dv-navitem {
  display: flex; align-items: center; gap: var(--dv-s3); min-height: var(--dv-touch-min); padding: 0 var(--dv-s2);
  border-radius: var(--dv-r-md); color: var(--dv-text); font: 600 var(--dv-fs-md)/1.2 var(--dv-font); text-decoration: none;
}
.dv-navgroups .dv-navitem:active { background: var(--dv-surface-2); }
.dv-navgroups .dv-navitem .dv-badge { margin-left: auto; }
@container dvapp (min-width: 600px) { .dv-navgroups { display: none; } }

.dv-screen { padding: var(--dv-s4); display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--dv-s4); align-content: start; }
.dv-screen__head { display: flex; align-items: center; justify-content: space-between; gap: var(--dv-s3); }
.dv-screen__title { font-size: var(--dv-fs-xl); }
/* On a phone the app bar carries the screen name; the page heading stays for screen readers.
   WO-615: a record shows its name once. When the view names no screen, the bar shows only "Deal Vision" (data-default),
   so the page heading (a comp's address, say) stays on screen (:where keeps a heading's own sr-only class, the map's,
   in charge). When the page's own heading is the record name
   (h1.dv-record__name, the criteria record), the bar's copy of it steps aside. */
@container dvapp (max-width: 599px) {
  .dv-screen__title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  :where(.dv-shell:has(#appbar-title[data-default])) .dv-screen__title { position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: normal; }
  .dv-shell:has(h1.dv-record__name) .dv-appbar__title { visibility: hidden; }
}
.dv-screen--flush { padding-left: 0; padding-right: 0; }
.dv-screen--flush > .dv-screen__head, .dv-screen--flush > .dv-pad { padding-left: var(--dv-s4); padding-right: var(--dv-s4); }

/* Tablet and up (WO-377): an icon rail (64 px) on the left, one content column. Resting on the rail for 150 ms
   (app.js), a tap on a touch screen, or keyboard focus opens the full menu (220 px) OVER the page: the nav grows past
   its grid column and the content does not move. Pin gives the full menu its own column (the page moves over).
   Labels stay in the markup (visually hidden in the rail), so every icon keeps its accessible name.
   WO-389: the open menu lists every item at every width from 600 px, in the 1024 px order. The closed rail at
   600-1023 px is the 1024 px rail (More included, #1340) minus the Tools heading, Settings and Admin (dv-*--extra), which all come
   after Map, so opening the menu only adds rows below the last rail item and never moves one under the pointer. */
@container dvapp (min-width: 600px) {
  .dv-shell {
    --dv-nav-col: var(--dv-rail-w);
    display: grid; grid-template-columns: var(--dv-nav-col) minmax(0, 1fr);
    grid-template-rows: var(--dv-appbar-h) minmax(0, 1fr);
    grid-template-areas: "bar bar" "nav main";
  }
  :root[data-nav="pinned"] .dv-shell { --dv-nav-col: var(--dv-menu-w); }
  .dv-shell.dv-anim { transition: grid-template-columns var(--dv-dur) var(--dv-ease); }
  .dv-appbar { grid-area: bar; padding: 0 var(--dv-s4); }
  .dv-appbar__word { display: inline; }
  .dv-appbar__title { display: none; }
  .dv-appbar .dv-appbar__search { display: flex; flex: 1; max-width: 520px; margin: 0 auto; }
  .dv-appbar .dv-appbar__search-btn { display: none; }
  .dv-main { grid-area: main; }
  .dv-tabbar { display: none; }
  .dv-sidenav {
    grid-area: nav; position: relative; z-index: var(--dv-z-nav); width: var(--dv-rail-w); min-width: 0;
    display: flex; flex-direction: column; gap: 2px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
    padding: var(--dv-s2); background: var(--dv-bg); border-right: 1px solid var(--dv-line);
    transition: width var(--dv-dur) var(--dv-ease), box-shadow var(--dv-dur) var(--dv-ease);
  }
  .dv-navitem {
    position: relative; flex: none; display: flex; align-items: center; justify-content: center; gap: var(--dv-s3);
    width: 100%; min-height: var(--dv-touch-min); padding: 0;
    border: 0; border-radius: var(--dv-r-md); background: none; color: var(--dv-text-2);
    font: 600 var(--dv-fs-sm)/1.2 var(--dv-font); text-align: left; white-space: nowrap; cursor: pointer;
  }
  .dv-navitem > span:not(.dv-badge) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .dv-navitem:hover { background: var(--dv-surface-2); color: var(--dv-text); }
  .dv-navitem[aria-current="page"] { background: var(--dv-selected); color: var(--dv-on-selected); }
  /* #2408: the closed rail's badge is anchored to the item's right edge (into the nav's 8 px padding, inside the rail),
     so "9", "32" and "99+" (rail_count caps there) always fit; the phone tab bar keeps its own rule. */
  .dv-navitem .dv-badge { position: absolute; top: 3px; right: -4px; left: auto; }
  /* #2408: the closed rail never draws a scrollbar (it would take width and cut the badges); it still scrolls by wheel,
     touch and keyboard. The open and pinned menus keep the browser's scrollbar, as before. */
  :root:not([data-nav="pinned"]) .dv-sidenav:not([data-open="true"]) { scrollbar-width: none; }
  :root:not([data-nav="pinned"]) .dv-sidenav:not([data-open="true"])::-webkit-scrollbar { display: none; }
  :root.no-js:not([data-nav="pinned"]) .dv-sidenav:not([data-open="true"]):is(:hover, :focus-within) { scrollbar-width: auto; }
  /* Group headings keep one height open or shut, so opening the menu never moves an item under the pointer. */
  .dv-nav-group {
    display: block; position: relative; flex: none; height: 28px; padding: 13px var(--dv-s3) 0 14px; overflow: hidden;
    color: transparent; font: 700 var(--dv-fs-xs)/1 var(--dv-font); letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap;
  }
  .dv-nav-group::before { content: ""; position: absolute; left: 10px; right: 10px; top: 50%; border-top: 1px solid var(--dv-line); }
  .dv-navitem--extra, .dv-nav-group--extra { display: none; }   /* closed rail under 1024 px: in the open menu and More */
  /* Sticky at the bottom; the shadow fills the nav's bottom padding so a scrolled item never shows under Pin (WO-389). */
  .dv-navpin { margin-top: auto; position: sticky; bottom: 0; background: var(--dv-bg); box-shadow: 0 var(--dv-s2) 0 var(--dv-bg); }
  .dv-navpin[aria-pressed="true"] { color: var(--dv-primary-text); }
  /* The open menu: hover/tap/focus (data-open), pinned, or, without JavaScript, plain :hover and :focus-within. */
  .dv-sidenav[data-open="true"], :root[data-nav="pinned"] .dv-sidenav,
  .no-js .dv-sidenav:hover, .no-js .dv-sidenav:focus-within { width: var(--dv-menu-w); }
  .dv-sidenav[data-open="true"], .no-js .dv-sidenav:hover, .no-js .dv-sidenav:focus-within { box-shadow: var(--dv-shadow-menu); }
  :root[data-nav="pinned"] .dv-sidenav { box-shadow: none; }
  :is(.dv-sidenav[data-open="true"], :root[data-nav="pinned"] .dv-sidenav, .no-js .dv-sidenav:hover, .no-js .dv-sidenav:focus-within) .dv-navitem {
    justify-content: flex-start; padding: 0 var(--dv-s3) 0 14px;
  }
  :is(.dv-sidenav[data-open="true"], :root[data-nav="pinned"] .dv-sidenav, .no-js .dv-sidenav:hover, .no-js .dv-sidenav:focus-within) .dv-navitem > span:not(.dv-badge) {
    position: static; width: auto; height: auto; flex: 0 1 auto; min-width: 0; clip: auto; clip-path: none; text-overflow: ellipsis;
  }
  :is(.dv-sidenav[data-open="true"], :root[data-nav="pinned"] .dv-sidenav, .no-js .dv-sidenav:hover, .no-js .dv-sidenav:focus-within) .dv-navitem .dv-badge {
    position: static; left: auto; margin-left: auto;
  }
  :is(.dv-sidenav[data-open="true"], :root[data-nav="pinned"] .dv-sidenav, .no-js .dv-sidenav:hover, .no-js .dv-sidenav:focus-within) .dv-navitem--extra { display: flex; }
  :is(.dv-sidenav[data-open="true"], :root[data-nav="pinned"] .dv-sidenav, .no-js .dv-sidenav:hover, .no-js .dv-sidenav:focus-within) .dv-nav-group--extra { display: block; }
  :is(.dv-sidenav[data-open="true"], :root[data-nav="pinned"] .dv-sidenav, .no-js .dv-sidenav:hover, .no-js .dv-sidenav:focus-within) .dv-nav-group { color: var(--dv-text-3); }
  :is(.dv-sidenav[data-open="true"], :root[data-nav="pinned"] .dv-sidenav, .no-js .dv-sidenav:hover, .no-js .dv-sidenav:focus-within) .dv-nav-group::before { display: none; }
  .dv-navtip {
    position: fixed; z-index: var(--dv-z-sheet); pointer-events: none; transform: translateY(-50%);
    padding: 5px 9px; border-radius: var(--dv-r-sm); background: var(--dv-surface-3); color: var(--dv-text);
    font: 600 var(--dv-fs-xs)/1.2 var(--dv-font); white-space: nowrap; box-shadow: var(--dv-shadow-2);
  }
  .dv-screen { padding: var(--dv-s6); }
  /* #1442: flush stays flush here too (this rule comes after the phone one above, so it would otherwise inset every
     flush list 24 px on top of its pads' 24 px); a flush list's only side space is its own pads. */
  .dv-screen--flush { padding-left: 0; padding-right: 0; }
  .dv-screen--flush > .dv-screen__head, .dv-screen--flush > .dv-pad { padding-left: var(--dv-s6); padding-right: var(--dv-s6); }
}

/* Laptop and desktop: the rail (or pinned menu), a narrow list, and the wide record panel on the right, where the
   work is done (#1282, Nick 11/08: "narrow on the left ... wide on the right side"). The list is 380 px by default and
   the record takes the rest. The divider between them (.dv-split, WO-377) drags the list between 340 px (#1306) and "the
   record keeps 320 px"; the clamp() holds both limits when the window shrinks too. */
@container dvapp (min-width: 1024px) {
  .dv-shell {
    grid-template-columns: var(--dv-nav-col)
      clamp(var(--dv-list-min), var(--dv-list-w), calc(100% - var(--dv-nav-col) - var(--dv-panel-min))) minmax(0, 1fr);
    grid-template-areas: "bar bar bar" "nav main panel";
  }
  .dv-shell[data-panel="off"] { grid-template-columns: var(--dv-nav-col) minmax(0, 1fr); grid-template-areas: "bar bar" "nav main"; }
  .dv-shell[data-panel="off"] .dv-panel, .dv-shell[data-panel="off"] .dv-split { display: none; }
  /* #1282: in the narrow list column a screen's heading row wraps (its CSV / New buttons go under the title) instead
     of pushing past the column's edge. */
  .dv-shell[data-panel="on"] > .dv-main .dv-screen__head,
  .dv-shell[data-panel="on"] > #shell > .dv-main .dv-screen__head { flex-wrap: wrap; row-gap: var(--dv-s2); }
  /* #1282 fix round (Seat T, Nick 11/08 20:34): the narrow list column keeps a stable scrollbar gutter, so a row never
     sits under the scrollbar and the column's content width does not jump when the list starts to scroll. The column's
     own width never goes below --dv-list-min: the clamp() above holds it, whatever width the divider saved. */
  .dv-shell[data-panel="on"] > .dv-main,
  .dv-shell[data-panel="on"] > #shell > .dv-main { scrollbar-gutter: stable; }
  .dv-navitem--extra { display: flex; }
  .dv-nav-group--extra { display: block; }
  /* #1340: More stays in the rail at every width (Ideas, Market Intel, Settings and the rest light it). */
  .dv-panel {
    grid-area: panel; display: block; overflow-y: auto; background: var(--dv-surface);
    border-left: 1px solid var(--dv-line);
  }
  /* #2634 (Nick 11/20, D-450): the list | record handle is the record pages' handle (core/dv_split.css: the 28 x 112
     pill with its dots and chevron, on a 2 px line), on a 24 px hit area that reaches 6 px into the list (so the list's
     scrollbar stays reachable) and the rest over the record's own pad. A click closes or opens the record panel, a
     drag resizes (app.js). Closed: the list takes the width and the handle stays on a 16 px strip at the right edge. */
  .dv-split {
    grid-area: panel; justify-self: start; align-self: stretch; position: relative; z-index: 3; display: block;
    width: var(--dv-split-w); margin-left: calc(-1 * var(--dv-split-in)); padding: 0; border: 0; background: transparent;
    cursor: col-resize; touch-action: none; outline-offset: -2px;
  }
  .dv-split::before { content: ""; position: absolute; top: 0; bottom: 0; left: calc(var(--dv-split-in) - 1px); width: 2px; background: var(--dv-line-strong); transition: background var(--dv-dur); }
  .dv-split > .dv-rsplit__pill { position: absolute; top: 50%; left: var(--dv-split-in); margin: 0; transform: translate(-50%, -50%); transition: background var(--dv-dur), border-color var(--dv-dur); }
  .dv-split:hover::before, .dv-split:focus-visible::before { background: var(--dv-accent); }
  .dv-shell.is-resizing .dv-split::before { background: var(--dv-primary); }
  .dv-shell.is-resizing .dv-split > .dv-rsplit__pill { background: var(--dv-primary); border-color: var(--dv-primary); }
  .dv-shell.is-resizing .dv-split .dv-rsplit__dot { background: var(--dv-on-primary); }
  .dv-shell.is-resizing .dv-split .dv-rsplit__chev { stroke: var(--dv-on-primary); }
  .dv-shell.is-resizing { transition: none; cursor: col-resize; user-select: none; -webkit-user-select: none; }
  .dv-shell[data-record="closed"] { grid-template-columns: var(--dv-nav-col) minmax(0, 1fr) 16px; }
  .dv-shell[data-record="closed"] .dv-panel { display: none; }
}
/* #1306 (Nick 11/09 05:46: "we want the default view to show the full records on the left"): with a record open, the
   narrow list column (340 px and up, until it is dragged past 600) lays out like a phone column and shows every row
   whole. Nothing here applies on a phone or with the record closed.
   - The screen keeps the phone's 16 px gutter and a flush list runs edge to edge (the 24 px desktop inset cost a
     narrow row 48 px), so rows get the room; the scrollbar keeps its own gutter (#1282).
   - A row's name wraps to a second line before any ellipsis; an ellipsis only after 2 lines.
   - A row's meta lines wrap instead of ellipsizing and show whole (a chip-led line wraps under its chip); the assets
     row's split line wraps too, its size ("48,000 SF") kept on one line (WO-005).
   - A chip with a phone label (assets status, Nick 10/17) shows it here as on a phone, so the name keeps the room.
   - My Loop: a 32 px avatar and 12 px row padding; the overdue chip stays top-right beside the name, and the lines
     under the name (company and title, the grade chip and "Last touch") use the full width, under the chip too; the
     call, text and email icons and the Log button (with its word, it fits at 340) share their own line in the column. */
@container dvapp (min-width: 1024px) {
  .dv-shell[data-panel="on"] .dv-main .dv-screen { padding-left: var(--dv-s4); padding-right: var(--dv-s4); }
  .dv-shell[data-panel="on"] .dv-main .dv-screen--flush { padding-left: 0; padding-right: 0; }
  .dv-shell[data-panel="on"] .dv-main .dv-screen--flush > .dv-screen__head,
  .dv-shell[data-panel="on"] .dv-main .dv-screen--flush > .dv-pad { padding-left: var(--dv-s4); padding-right: var(--dv-s4); }
  @container dvmain (max-width: 599px) {
    .dv-shell[data-panel="on"] .dv-main .dv-row__title {
      display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
      white-space: normal; overflow-wrap: anywhere;
    }
    .dv-shell[data-panel="on"] .dv-main .dv-row__meta:not(.dv-row__meta--split) { white-space: normal; overflow-wrap: anywhere; }
    .dv-shell[data-panel="on"] .dv-main .dv-row__meta--split { display: block; white-space: normal; overflow-wrap: anywhere; }
    .dv-shell[data-panel="on"] .dv-main .dv-row__meta--split > .dv-row__meta-text { white-space: normal; overflow: visible; }
    .dv-shell[data-panel="on"] .dv-main .dv-chip__full { display: none; }
    .dv-shell[data-panel="on"] .dv-main .dv-chip__short { display: inline; }
    .dv-shell[data-panel="on"] .dv-main .dv-row--loop { padding: var(--dv-s3); row-gap: 0; }
    .dv-shell[data-panel="on"] .dv-main .dv-row--loop > .dv-avatar { width: 32px; height: 32px; font-size: var(--dv-fs-xs); }
    /* the name shares line 1 with the overdue chip; the lines under it take the full width, under the chip too */
    .dv-shell[data-panel="on"] .dv-main .dv-row--loop > .dv-row__body { display: contents; }
    .dv-shell[data-panel="on"] .dv-main .dv-row--loop > .dv-row__body > * { grid-column: 2 / -1; min-width: 0; }
    .dv-shell[data-panel="on"] .dv-main .dv-row--loop > .dv-row__body > .dv-row__title { grid-column: 2; grid-row: 1; align-self: center; }
    .dv-shell[data-panel="on"] .dv-main .dv-row--loop > .dv-row__end { grid-column: 3; grid-row: 1; }
    .dv-shell[data-panel="on"] .dv-main .dv-row--loop > .dv-row__actions { margin-top: var(--dv-s2); }
  }
}
/* ---------- 4. Components ---------- */
/* Buttons */
.dv-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--dv-s2);
  min-height: var(--dv-touch-min); padding: 0 var(--dv-s4); border: 1px solid transparent;
  border-radius: var(--dv-r-md); background: none; color: var(--dv-text);
  font: 650 var(--dv-fs-sm)/1 var(--dv-font); letter-spacing: 0.01em; text-decoration: none;
  cursor: pointer; user-select: none; white-space: nowrap;
  transition: background-color var(--dv-dur) var(--dv-ease), border-color var(--dv-dur) var(--dv-ease), transform 80ms var(--dv-ease);
}
.dv-btn .dv-ico { width: 18px; height: 18px; }
.dv-btn:active { transform: translateY(1px); }
.dv-btn--primary { background: var(--dv-primary); border-color: var(--dv-primary-edge); color: var(--dv-on-primary); }
.dv-btn--primary:hover { background: var(--dv-primary-hover); }
.dv-btn--primary:active { background: var(--dv-primary-pressed); }
.dv-btn--secondary { border-color: var(--dv-line-strong); color: var(--dv-text); }
.dv-btn--secondary:hover { background: var(--dv-surface-2); }
.dv-btn--ghost { color: var(--dv-link); }
.dv-btn--ghost:hover { background: var(--dv-accent-soft); }
.dv-btn--danger { border-color: var(--dv-bad); color: var(--dv-bad); }
.dv-btn--danger:hover { background: var(--dv-bad-soft); }
.dv-btn--lg { min-height: var(--dv-touch); padding: 0 var(--dv-s5); font-size: var(--dv-fs-md); }
.dv-btn--block { width: 100%; }
.dv-btn[disabled], .dv-btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; }
/* Relay #1384 (Nick: buttons "start greyed out"): a disabled primary is grey, not dimmed orange. It takes the neutral
   surface, a quiet edge and muted text at full opacity, in both themes, and hover/press do not bring the orange back. */
.dv-btn--primary:is([disabled], [aria-disabled="true"]),
.dv-btn--primary:is([disabled], [aria-disabled="true"]):is(:hover, :active) {
  opacity: 1; background: var(--dv-surface-3); border-color: var(--dv-line-strong); color: var(--dv-text-2);
}
.dv-iconbtn {
  display: inline-grid; place-items: center; flex: none; width: var(--dv-touch-min); height: var(--dv-touch-min);
  border: 1px solid var(--dv-line); border-radius: var(--dv-r-pill); background: var(--dv-surface-2);
  color: var(--dv-text); cursor: pointer; text-decoration: none;
  transition: background-color var(--dv-dur) var(--dv-ease);
}
.dv-iconbtn:hover { background: var(--dv-surface-3); }
.dv-iconbtn--plain { border-color: transparent; background: none; color: var(--dv-text-2); }
.dv-iconbtn--plain:hover { background: var(--dv-surface-2); color: var(--dv-text); }
.dv-iconbtn--lg { width: var(--dv-touch); height: var(--dv-touch); }
.dv-avatar {
  display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: var(--dv-r-pill);
  background: var(--dv-surface-3); color: var(--dv-text); font: 700 var(--dv-fs-sm)/1 var(--dv-font);
}
.dv-avatar--sm { width: 32px; height: 32px; font-size: var(--dv-fs-xs); }
.dv-kbd {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--dv-r-sm);
  border: 1px solid var(--dv-line-strong); color: var(--dv-text-2); font: 600 var(--dv-fs-xs)/1 var(--dv-font);
}

/* Chips and badges: every color comes with a word or an icon, never color alone */
.dv-chip {
  display: inline-flex; align-items: center; gap: 5px; min-height: 26px; padding: 0 10px;
  border: 1px solid transparent; border-radius: var(--dv-r-pill);
  font: 650 var(--dv-fs-xs)/1 var(--dv-font); white-space: nowrap;
}
.dv-chip .dv-ico { width: 14px; height: 14px; stroke-width: 2.2; }
.dv-chip--vip { background: var(--dv-primary); color: var(--dv-on-primary); }
.dv-chip--active { background: var(--dv-accent); color: var(--dv-on-accent); }
.dv-chip--passive { border-color: var(--dv-line-strong); color: var(--dv-text-2); }
.dv-chip--omit { border: 1px dashed var(--dv-line-strong); color: var(--dv-text-3); }
.dv-chip--ok { background: var(--dv-ok-soft); color: var(--dv-ok); }
.dv-chip--warn { background: var(--dv-warn-soft); color: var(--dv-warn); }
.dv-chip--bad { background: var(--dv-bad-soft); color: var(--dv-bad); }
.dv-chip--info { background: var(--dv-accent-soft); color: var(--dv-link); }
/* A chip with a full label and a phone label (assets row: "Available (On Market)" / "On market", Nick 10/17):
   the phone label gives the row's name the room; desktop and the record keep the full wording. */
.dv-chip__short { display: none; }
@container dvapp (max-width: 599px) {
  .dv-chip__full { display: none; }
  .dv-chip__short { display: inline; }
}
.dv-chip--neutral { background: var(--dv-surface-2); color: var(--dv-text-2); }
.dv-chip--flag { border-color: var(--dv-primary-edge); color: var(--dv-primary-text); }
.dv-chip--tier { letter-spacing: 0.06em; text-transform: uppercase; }
.dv-fchip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; flex: none;
  border: 1px solid var(--dv-line-strong); border-radius: var(--dv-r-pill); background: none;
  color: var(--dv-text-2); font: 600 var(--dv-fs-sm)/1 var(--dv-font); cursor: pointer; white-space: nowrap;
}
.dv-fchip[aria-pressed="true"] { background: var(--dv-selected); border-color: var(--dv-selected); color: var(--dv-on-selected); }
.dv-fchip .dv-count { color: inherit; opacity: 0.85; font-variant-numeric: tabular-nums; }
.dv-chiprow { display: flex; flex-wrap: wrap; gap: var(--dv-s2); }
.dv-chiprow--scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.dv-chiprow--scroll::-webkit-scrollbar { display: none; }
.dv-badge {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--dv-r-pill); background: var(--dv-primary); color: var(--dv-on-primary);
  font: 750 var(--dv-fs-xs)/1 var(--dv-font); font-variant-numeric: tabular-nums;
}
.dv-badge--quiet { background: var(--dv-surface-3); color: var(--dv-text); }

/* Form controls: 16px text so iOS never zooms; 44px minimum height */
.dv-field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.dv-label { color: var(--dv-text-2); font: 650 var(--dv-fs-xs)/1.2 var(--dv-font); letter-spacing: 0.03em; }
.dv-input, .dv-select, .dv-textarea {
  width: 100%; min-height: var(--dv-touch-min); padding: 0 14px; border: 1px solid var(--dv-line-strong);
  border-radius: var(--dv-r-md); background: var(--dv-surface); color: var(--dv-text); font-size: var(--dv-fs-md);
}
.dv-textarea { min-height: 96px; padding: 12px 14px; resize: vertical; line-height: 1.45; }
.dv-input::placeholder, .dv-textarea::placeholder { color: var(--dv-text-3); }
.dv-input:focus, .dv-select:focus, .dv-textarea:focus { outline: 2px solid var(--dv-focus); outline-offset: 1px; border-color: var(--dv-focus); }
.dv-help { color: var(--dv-text-3); font-size: var(--dv-fs-xs); }
.dv-field--error .dv-input { border-color: var(--dv-bad); }
.dv-field--error .dv-help { color: var(--dv-bad); }
.dv-search {
  display: flex; align-items: center; gap: var(--dv-s2); width: 100%; min-height: 40px; padding: 0 var(--dv-s2) 0 var(--dv-s3);
  border: 1px solid var(--dv-line-strong); border-radius: var(--dv-r-pill); background: var(--dv-surface);
  color: var(--dv-text-3); font-size: var(--dv-fs-sm); cursor: text; text-align: left;
}
.dv-search__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dv-switch { display: flex; align-items: center; justify-content: space-between; gap: var(--dv-s4); min-height: var(--dv-touch); cursor: pointer; }
.dv-switch input { position: absolute; opacity: 0; pointer-events: none; }
.dv-switch__track {
  position: relative; flex: none; width: 48px; height: 28px; border-radius: var(--dv-r-pill);
  background: var(--dv-surface-3); border: 1px solid var(--dv-line-strong); transition: background-color var(--dv-dur) var(--dv-ease);
}
.dv-switch__track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--dv-text-2); transition: transform var(--dv-dur) var(--dv-ease), background-color var(--dv-dur) var(--dv-ease);
}
.dv-switch input:checked + .dv-switch__track { background: var(--dv-primary); border-color: var(--dv-primary-edge); }
.dv-switch input:checked + .dv-switch__track::after { transform: translateX(20px); background: var(--dv-on-primary); }
.dv-switch input:focus-visible + .dv-switch__track { outline: 2px solid var(--dv-focus); outline-offset: 2px; }
.dv-seg { display: inline-flex; padding: 3px; gap: 3px; border-radius: var(--dv-r-md); background: var(--dv-surface-2); border: 1px solid var(--dv-line); }
.dv-seg button {
  min-height: 38px; padding: 0 14px; border: 0; border-radius: 8px; background: none; color: var(--dv-text-2);
  font: 650 var(--dv-fs-sm)/1 var(--dv-font); cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.dv-seg button[aria-pressed="true"] { background: var(--dv-surface); color: var(--dv-text); box-shadow: var(--dv-shadow-1); }
.dv-seg--block { display: flex; }
.dv-seg--block button { flex: 1; justify-content: center; }

/* Cards, key numbers */
.dv-card { background: var(--dv-surface); border: 1px solid var(--dv-line); border-radius: var(--dv-r-lg); padding: var(--dv-s4); min-width: 0; }
.dv-card--flush { padding: 0; overflow: hidden; }
.dv-card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--dv-s3); margin-bottom: var(--dv-s3); }
.dv-card--flush .dv-card__head { margin: 0; padding: var(--dv-s3) var(--dv-s4); border-bottom: 1px solid var(--dv-line); }
.dv-eyebrow { color: var(--dv-text-2); font: 700 var(--dv-fs-xs)/1.2 var(--dv-font); letter-spacing: 0.08em; text-transform: uppercase; }
.dv-kpi { font: 700 var(--dv-fs-2xl)/1.1 var(--dv-font); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.dv-kpi--md { font-size: var(--dv-fs-xl); }
.dv-kv { display: flex; justify-content: space-between; align-items: baseline; gap: var(--dv-s3); padding: 6px 0; font-size: var(--dv-fs-sm); }
.dv-kv > :last-child { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
.dv-kv + .dv-kv { border-top: 1px solid var(--dv-line); }
/* #2045: one rule for every key/value row, inside a record or not (Center Stage side columns, Settings, any card): the
   label keeps its width (up to 60% of the row, then it wraps) and a long value wraps inside the row instead of running
   past the card's edge; a short value still reads on one line, right-aligned. Numbers, chips and buttons never split;
   beside one of those the label wraps instead. */
.dv-kv > :first-child:not(:last-child) { flex: none; max-width: 60%; }
.dv-kv > :last-child:not(:first-child) { flex: 0 1 auto; min-width: 0; white-space: normal; overflow-wrap: anywhere; text-align: right; }
.dv-kv > :last-child:is(.dv-num, .dv-chip, .dv-btn, .dv-badge) { flex: none; white-space: nowrap; overflow-wrap: normal; }
.dv-kv:has(> :last-child:is(.dv-num, .dv-chip, .dv-btn, .dv-badge)) > :first-child:not(:last-child) { flex: 0 1 auto; min-width: 0; }   /* then the label gives way */
/* #1993 (was WO-551, Center Stage only): in any side column (Center Stage's .cs-side, the resizable dv-rsplit panel) a
   row keeps its label readable: the label takes the room first and the value wraps under it, at any width, when both
   do not fit on one line. */
:is(.cs-side, .dv-rsplit__side) .dv-kv { flex-wrap: wrap; column-gap: var(--dv-s2); row-gap: 2px; }
:is(.cs-side, .dv-rsplit__side) .dv-kv > :first-child { flex: 1 1 auto; min-width: min(9em, 100%); }
:is(.cs-side, .dv-rsplit__side) .dv-kv > :last-child:not(:first-child) { flex: 0 1 auto; min-width: 0; margin-left: auto; overflow-wrap: anywhere; }
.dv-money { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--dv-s4); }
.dv-money__col { min-width: 0; }
.dv-money__col + .dv-money__col { padding-top: var(--dv-s4); border-top: 1px solid var(--dv-line); }
.dv-money__weighted { display: flex; align-items: center; justify-content: space-between; gap: var(--dv-s3); padding: var(--dv-s3); border-radius: var(--dv-r-md); background: var(--dv-surface-2); }
@container dvmain (min-width: 720px) {
  .dv-money { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dv-money__col + .dv-money__col { padding-top: 0; border-top: 0; padding-left: var(--dv-s4); border-left: 1px solid var(--dv-line); }
  .dv-money__weighted { grid-column: 1 / -1; }
}

/* Lists and rows */
.dv-list { list-style: none; margin: 0; padding: 0; }
.dv-row {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--dv-s3);
  align-items: start; padding: var(--dv-s3) var(--dv-s4); background: var(--dv-surface);
  border-bottom: 1px solid var(--dv-line); min-height: 64px;
}
.dv-row--button { cursor: pointer; }
.dv-row--button:hover, .dv-row--button:active { background: var(--dv-surface-2); }
.dv-row[aria-selected="true"] { background: var(--dv-selected); color: var(--dv-on-selected); }
.dv-row[aria-selected="true"] .dv-row__meta { color: inherit; opacity: 0.85; }
.dv-row__title { font-size: var(--dv-fs-md); font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dv-linkbtn { display: block; max-width: 100%; padding: 0; border: 0; background: none; color: inherit; text-align: left; cursor: pointer; }
.dv-row__meta { color: var(--dv-text-2); font-size: var(--dv-fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Line 2 in two parts (assets row, WO-005): the text gives way, the size ("48,000 SF", "3.25 ac") never shrinks. */
.dv-row__meta--split { display: flex; min-width: 0; }
.dv-row__meta-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dv-row__meta-size { flex: none; white-space: nowrap; }
.dv-row__end { display: grid; justify-items: end; gap: 6px; }
.dv-row__actions { grid-column: 2 / -1; display: flex; align-items: center; gap: var(--dv-s2); margin-top: var(--dv-s1); }
.dv-row__actions .dv-btn--primary { margin-left: auto; }

/* My Loop row: the row is the control on a phone (tap or swipe right to log) */
.dv-swipe { position: relative; overflow: hidden; background: var(--dv-primary); }
.dv-swipe__under {
  position: absolute; inset: 0; display: flex; align-items: center; gap: var(--dv-s2); padding-left: var(--dv-s5);
  color: var(--dv-on-primary); font: 750 var(--dv-fs-sm)/1 var(--dv-font);
}
.dv-swipe > .dv-row { touch-action: pan-y; transition: transform 180ms var(--dv-ease); }
.dv-swipe > .dv-row.is-dragging { transition: none; }
.dv-overdue { font-variant-numeric: tabular-nums; }
.dv-metaline { display: flex; align-items: center; gap: 6px; min-width: 0; margin-top: 4px; }
.dv-ellipsis { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* #1306: a chip-led meta line (My Loop: the grade chip, then "Last touch · Nov 27") puts its text under the chip when
   it won't fit beside it, and wraps there, instead of cutting it to "L…". Where it fits, nothing moves. */
.dv-metaline { flex-wrap: wrap; row-gap: 2px; }
.dv-metaline > .dv-ellipsis { flex: 0 1 auto; white-space: normal; overflow-wrap: anywhere; }
@container dvmain (min-width: 600px) {
  .dv-row--loop { grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; }
  .dv-row--loop .dv-row__actions { grid-column: auto; margin: 0; }
  .dv-row--loop .dv-row__actions .dv-btn--primary { margin-left: var(--dv-s2); }
}
/* #1295 fix round: the bigger phone type must not cut a row's numbers (phone-fit audit, WO-004). Under 600 px:
   - a row's meta line wraps to a second line instead of ellipsizing, so a date, a count or a size is never cut
     (the assets row's split line keeps its own rule: the address gives way, the size never shrinks, WO-005);
   - a meta line led by a chip (My Loop: VIP + "Last touch · Nov 27") puts its text under the chip when it won't fit
     beside it, and wraps there before it would cut;
   - a compact row's body adds no width of its own to its panel (a long one-line task title used to widen the deal
     record and make it scroll sideways); its text still ellipsizes inside the row;
   - rows and chips give back the room the 14 px chips took, so the assets list's names keep >= 200 px (Nick 10/17). */
@container dvapp (max-width: 599px) {
  .dv-row__meta:not(.dv-row__meta--split) { white-space: normal; overflow-wrap: anywhere; text-overflow: clip; }
  .dv-metaline { flex-wrap: wrap; row-gap: 2px; }
  .dv-metaline > .dv-ellipsis { white-space: normal; overflow-wrap: anywhere; text-overflow: clip; }
  .dv-row { column-gap: 10px; }
  .dv-chip { padding: 0 8px; }
  .dv-row--compact > .dv-row__body { contain: inline-size; }
}

/* Banners, toasts, empty states, skeletons */
.dv-banner {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px var(--dv-s3); align-items: center;
  padding: var(--dv-s3) var(--dv-s4); border-radius: var(--dv-r-md); border: 1px solid var(--dv-line);
  background: var(--dv-surface-2); font-size: var(--dv-fs-sm);
}
.dv-banner--info { background: var(--dv-accent-soft); border-color: transparent; }
.dv-banner--info > .dv-ico { color: var(--dv-link); }
.dv-banner--warn { background: var(--dv-warn-soft); border-color: transparent; }
.dv-banner--warn > .dv-ico { color: var(--dv-warn); }
.dv-banner--bad { background: var(--dv-bad-soft); border-color: transparent; }
.dv-banner--bad > .dv-ico { color: var(--dv-bad); }
.dv-banner strong { font-weight: 700; }
.dv-banner > .dv-btn { grid-column: 2; justify-self: start; margin-left: calc(-1 * var(--dv-s3)); padding: 0 var(--dv-s3); }
@container dvmain (min-width: 600px) {
  .dv-banner { grid-template-columns: auto minmax(0, 1fr) auto; }
  .dv-banner > .dv-btn { grid-column: auto; margin-left: 0; }
}
.dv-toast-layer {
  position: absolute; left: var(--dv-s3); right: var(--dv-s3); bottom: calc(var(--dv-tabbar-h) + var(--dv-s3));
  display: grid; gap: var(--dv-s2); z-index: var(--dv-z-toast); pointer-events: none;
}
@container dvapp (min-width: 600px) {
  .dv-toast-layer { left: auto; right: var(--dv-s5); bottom: var(--dv-s5); width: min(420px, calc(100% - 40px)); }
}
.dv-toast {
  display: flex; align-items: center; gap: var(--dv-s3); min-height: 52px; padding: var(--dv-s2) var(--dv-s2) var(--dv-s2) var(--dv-s4);
  border-radius: var(--dv-r-md); background: var(--dv-text); color: var(--dv-bg); box-shadow: var(--dv-shadow-2);
  font-size: var(--dv-fs-sm); pointer-events: auto; animation: dv-rise 200ms var(--dv-ease);
}
.dv-toast > span { flex: 1; min-width: 0; }
.dv-toast .dv-btn { min-height: var(--dv-touch-min); padding: 0 var(--dv-s3); color: var(--dv-bg); border-color: transparent; font-weight: 750; text-decoration: underline; text-underline-offset: 3px; }
.dv-empty { display: grid; justify-items: center; gap: var(--dv-s3); padding: var(--dv-s10) var(--dv-s6); text-align: center; }
.dv-empty__icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--dv-ok-soft); color: var(--dv-ok); }
.dv-empty__icon .dv-ico { width: 30px; height: 30px; stroke-width: 2.2; }
.dv-skel { border-radius: var(--dv-r-sm); background: linear-gradient(90deg, var(--dv-surface-2), var(--dv-surface-3), var(--dv-surface-2)); background-size: 200% 100%; animation: dv-shimmer 1.4s linear infinite; }
@keyframes dv-shimmer { to { background-position: -200% 0; } }
@keyframes dv-rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Bottom sheet on a phone, centered dialog from the laptop width up */
.dv-sheet-layer { position: absolute; inset: 0; z-index: var(--dv-z-sheet); display: none; }
.dv-sheet-layer.is-open { display: block; }
.dv-scrim { position: absolute; inset: 0; background: var(--dv-overlay); animation: dv-fade 160ms var(--dv-ease); }
.dv-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 88%; overflow-y: auto;
  padding: var(--dv-s2) var(--dv-s4) calc(var(--dv-s5) + env(safe-area-inset-bottom, 0px));
  border-radius: var(--dv-r-xl) var(--dv-r-xl) 0 0; background: var(--dv-surface); box-shadow: var(--dv-shadow-2);
  animation: dv-up 220ms var(--dv-ease);
}
.dv-sheet__grip { width: 40px; height: 4px; margin: 2px auto var(--dv-s3); border-radius: 2px; background: var(--dv-line-strong); }
.dv-sheet__head { display: flex; align-items: center; gap: var(--dv-s3); margin-bottom: var(--dv-s4); }
.dv-sheet__title { flex: 1; min-width: 0; font-size: var(--dv-fs-lg); font-weight: 700; }
.dv-sheet__section + .dv-sheet__section { margin-top: var(--dv-s4); }
.dv-outcomes { display: grid; grid-template-columns: 1fr 1fr; gap: var(--dv-s2); }
.dv-outcome {
  display: grid; justify-items: center; align-content: center; gap: 4px; min-height: 64px; padding: var(--dv-s2);
  border: 1px solid var(--dv-line-strong); border-radius: var(--dv-r-lg); background: var(--dv-surface-2);
  color: var(--dv-text); font: 700 var(--dv-fs-md)/1.1 var(--dv-font); cursor: pointer;
}
.dv-outcome:hover { background: var(--dv-surface-3); }
.dv-outcome small { color: var(--dv-text-2); font: 500 var(--dv-fs-xs)/1.2 var(--dv-font); }
.dv-outcome--primary { background: var(--dv-primary); border-color: var(--dv-primary-edge); color: var(--dv-on-primary); }
.dv-outcome--primary:hover { background: var(--dv-primary-hover); }
.dv-outcome--primary small { color: var(--dv-on-primary); }
@container dvapp (min-width: 600px) {
  .dv-sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: min(460px, calc(100% - 48px)); transform: translate(-50%, -50%); border-radius: var(--dv-r-xl); padding: var(--dv-s5); animation: dv-fade 160ms var(--dv-ease); }
  .dv-sheet__grip { display: none; }
}
@keyframes dv-up { from { transform: translateY(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@keyframes dv-fade { from { opacity: 0; } to { opacity: 1; } }

/* Command palette (press / anywhere) */
.dv-palette-layer { position: absolute; inset: 0; z-index: var(--dv-z-palette); display: none; }
.dv-palette-layer.is-open { display: block; }
.dv-palette {   /* phone (WO-226): a full-screen results sheet; the input stays focused so the keyboard stays up */
  position: absolute; inset: 0; display: flex; flex-direction: column;
  background: var(--dv-surface); overflow: hidden;
}
@container dvapp (min-width: 600px) {
  .dv-palette { inset: auto; left: 50%; top: 72px; width: min(560px, calc(100% - 48px)); max-height: 70%; transform: translateX(-50%);
    border-radius: var(--dv-r-lg); border: 1px solid var(--dv-line); box-shadow: var(--dv-shadow-2); }
}
.dv-palette__input { display: flex; align-items: center; gap: var(--dv-s2); padding: 0 var(--dv-s3); border-bottom: 1px solid var(--dv-line); flex: none; }
.dv-palette__input input { flex: 1; min-width: 0; min-height: 52px; border: 0; background: none; color: var(--dv-text); font-size: max(16px, var(--dv-fs-md)); outline: none; }
.dv-palette__input .dv-kbd { display: none; }
.dv-palette__close { flex: none; }
@container dvapp (min-width: 600px) { .dv-palette__input .dv-kbd { display: inline-flex; } .dv-palette__close { display: none; } }
.dv-palette__list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: var(--dv-s2); }
.dv-palette__head { margin: var(--dv-s3) var(--dv-s3) var(--dv-s1); color: var(--dv-text-2); font-size: var(--dv-fs-xs); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.dv-palette__head:first-child { margin-top: var(--dv-s1); }
.dv-palette__empty { padding: var(--dv-s3); }
.dv-palette__item { display: flex; align-items: center; gap: var(--dv-s3); width: 100%; min-height: var(--dv-touch-min); padding: 0 var(--dv-s3); border: 0; border-radius: var(--dv-r-md); background: none; color: var(--dv-text); text-align: left; cursor: pointer; }
.dv-palette__item > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dv-palette__item[aria-selected="true"], .dv-palette__item:hover { background: var(--dv-surface-2); }
.dv-palette__item small { margin-left: auto; flex: none; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dv-text-3); font-size: var(--dv-fs-xs); }
.dv-palette__item--more span { color: var(--dv-link); font-weight: 600; }

/* Matches: score hidden, evidence shown */
.dv-match { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--dv-s3); padding: var(--dv-s4); border-bottom: 1px solid var(--dv-line); background: var(--dv-surface); }
.dv-match__head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--dv-s2); align-items: start; }
.dv-match__name { font-size: var(--dv-fs-lg); font-weight: 700; }
.dv-match__facts { color: var(--dv-text-2); font-size: var(--dv-fs-sm); font-variant-numeric: tabular-nums; }
.dv-evidence { display: flex; flex-wrap: wrap; gap: 6px; }
.dv-match__actions { display: flex; gap: var(--dv-s2); }
.dv-match__actions .dv-btn { flex: 1; }
@container dvmain (min-width: 600px) { .dv-match__actions .dv-btn { flex: none; } }
.dv-criteria-head { display: flex; align-items: center; gap: var(--dv-s2); padding: var(--dv-s3) var(--dv-s4); background: var(--dv-bg); border-bottom: 1px solid var(--dv-line); }
.dv-criteria-head__name { flex: 1; min-width: 0; font-weight: 700; font-size: var(--dv-fs-sm); line-height: 1.3; }

/* Deals: list on a phone, board from the laptop width up */
.dv-deal { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; padding: var(--dv-s3) var(--dv-s4); background: var(--dv-surface); border-bottom: 1px solid var(--dv-line); cursor: pointer; }
.dv-deal:hover, .dv-deal:active { background: var(--dv-surface-2); }
.dv-deal__top { display: flex; align-items: baseline; justify-content: space-between; gap: var(--dv-s3); }
.dv-deal__name { font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.dv-deal__money { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.dv-deal__next { color: var(--dv-text-2); font-size: var(--dv-fs-sm); }
.dv-board { display: none; }
@container dvmain (min-width: 900px) {
  .dv-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: var(--dv-s3); overflow-x: auto; padding: 0 var(--dv-s6) var(--dv-s4); }
  .dv-dealslist { display: none; }
  .dv-board__col { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: var(--dv-s2); min-width: 0; }
  .dv-board__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--dv-s2); padding: var(--dv-s2) 2px; border-bottom: 2px solid var(--dv-line); font-size: var(--dv-fs-sm); font-weight: 700; }
  .dv-board .dv-deal { border: 1px solid var(--dv-line); border-radius: var(--dv-r-md); }
  .dv-board .dv-deal__stage { display: none; }
}

/* Two-column content blocks from the laptop width up */
.dv-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--dv-s4); }
@container dvmain (min-width: 900px) { .dv-grid--2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }

/* Record panel (desktop right panel; the same partial renders full screen on a phone) */
.dv-record { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--dv-s4); padding: var(--dv-s5); }
.dv-record__head { display: flex; align-items: center; gap: var(--dv-s3); }
.dv-record__name { font-size: var(--dv-fs-xl); font-weight: 700; }
.dv-timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--dv-s3); }
.dv-timeline li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: var(--dv-s2); font-size: var(--dv-fs-sm); }
.dv-timeline .dv-ico { width: 18px; height: 18px; color: var(--dv-text-2); margin-top: 1px; }
