/* =============================================================
   TYTLVERSE Design System — Production CSS
   Vibe-based (monday.com) look from the TytlVerse-Backend Figma (#171):
   Figtree text, Poppins figures, #0073EA primary, soft card shadows.
   Loaded on all authenticated pages via layout/app.html.twig.
   ============================================================= */

/* ---------- Design Tokens ---------- */
:root {
  /* Brand — Vibe blues (Figma primary-color / hover / selected) */
  --tl-brand-900: #00376E;
  --tl-brand-700: #0060B9;
  --tl-brand-600: #0073EA;
  --tl-brand-500: #1F76C2;
  --tl-brand-400: #579BFC;
  --tl-brand-200: #AED4FC;
  --tl-brand-100: #CCE5FF;
  --tl-brand-50:  #E6F1FD;

  /* Shell — the Figma's inverted surface (sidebar, rail tooltips, public footer) */
  --tl-shell-bg: #323338;
  --tl-shell-item-active: #676879;
  --tl-shell-label: #C4C4C4;

  /* Accent — burnt orange, reserved for rush flags and wizard active step */
  --tl-accent-600: #C2410C;
  --tl-accent-500: #EA580C;
  --tl-accent-100: #FFEDD5;

  /* Neutrals */
  --tl-ink-1000: #1F1F24;
  --tl-ink-900:  #2B2C31;
  --tl-ink-800:  #303030;
  --tl-ink-700:  #323338;
  --tl-ink-600:  #4B4C5C;
  --tl-ink-500:  #676879;
  --tl-ink-400:  #9699A6;
  --tl-ink-300:  #C3C6D4;
  --tl-ink-200:  #D0D4E4;
  --tl-ink-150:  #E7E9EF;
  --tl-ink-100:  #ECEDF5;
  --tl-ink-50:   #F6F7FB;
  --tl-ink-0:    #FFFFFF;

  /* Semantic */
  --tl-success-700: #007038;
  --tl-success-600: #00854D;
  --tl-success-500: #00A359;
  --tl-success-100: #BBDBC9;
  --tl-success-50:  #E5F4EB;
  /* Vibe "done" green — the dashboard's chart bars (Closings, Employee Workload; #171) and the
     Closed status pill (#285). */
  --tl-chart-green: #00C875;

  --tl-warn-700: #854D0E;
  --tl-warn-600: #A16207;
  --tl-warn-500: #CA8A04;
  --tl-warn-100: #FEF9C3;
  --tl-warn-50:  #FEFCE8;

  --tl-danger-700: #B63546;
  --tl-danger-600: #D83A52;
  --tl-danger-500: #E2445C;
  --tl-danger-100: #F4C3CB;
  --tl-danger-50:  #FBEAED;

  --tl-info-700: #155E75;
  --tl-info-600: #0E7490;
  --tl-info-500: #06B6D4;
  --tl-info-100: #CFFAFE;
  --tl-info-50:  #ECFEFF;

  /* File-status palette — calibrated for the 8-step state machine */
  --tl-status-pending-order:    #6B7280;
  --tl-status-pending-abstract: #0E7490;
  --tl-status-pending-reading:  #7C3AED;
  --tl-status-pending-clearance:#B45309;
  --tl-status-clear:            #15803D;
  --tl-status-scheduled:        #1A4DA1;
  --tl-status-closed:           #11151C;
  --tl-status-postclosing:      #5A6478;

  /* Flag chips */
  --tl-flag-rush:   #EA580C;
  --tl-flag-hold:   #CA8A04;
  --tl-flag-hili:   #DB2777;
  --tl-flag-fincen: #DC2626;

  /* Semantic surface tokens */
  --fg-1: var(--tl-ink-700);
  --fg-2: var(--tl-ink-700);
  --fg-3: var(--tl-ink-600);
  --fg-4: var(--tl-ink-500);
  --fg-5: var(--tl-ink-400);
  --fg-disabled: var(--tl-ink-300);
  --fg-on-brand: #fff;
  --fg-link: var(--tl-brand-600);

  --bg-app:     #FFFFFF;
  --bg-surface: var(--tl-ink-0);
  --bg-sunken:  var(--tl-ink-100);
  --bg-row-hover: var(--tl-ink-100);
  --bg-row-stripe: var(--tl-ink-50);
  --bg-selected: var(--tl-brand-50);

  --border-1: var(--tl-ink-150);
  --border-2: var(--tl-ink-300);
  --border-strong: var(--tl-ink-300);
  --border-focus: var(--tl-brand-500);
  --shadow-focus-ring: 0 0 0 3px rgba(0, 115, 234, 0.18);

  /* Typography */
  --font-sans: "Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* Headings and big figures (Figma H2/H3, KPI numbers) */
  --font-display: "Poppins", var(--font-sans);
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Type scale */
  --fs-10: .625rem;
  --fs-11: .6875rem;
  --fs-12: .75rem;
  --fs-13: .8125rem;
  --fs-14: .875rem;
  --fs-16: 1rem;
  --fs-18: 1.125rem;
  --fs-20: 1.25rem;
  --fs-24: 1.5rem;
  --fs-32: 2rem;

  /* Spacing — 4px base */
  --sp-1: 2px; --sp-2: 4px; --sp-3: 6px; --sp-4: 8px;
  --sp-5: 12px; --sp-6: 16px; --sp-7: 20px; --sp-8: 24px;
  --sp-9: 32px; --sp-10: 40px; --sp-11: 48px; --sp-12: 64px;

  /* Radii — small, restrained */
  --r-1: 2px; --r-2: 4px; --r-3: 6px; --r-4: 8px; --r-5: 12px; --r-pill: 999px;

  /* Elevation */
  --elev-0: none;
  --elev-1: 0 1px 0 rgba(10,13,18,.04), 0 1px 2px rgba(10,13,18,.04);
  --elev-2: 0 2px 4px rgba(10,13,18,.06), 0 1px 2px rgba(10,13,18,.04);
  --elev-3: 0 6px 16px rgba(10,13,18,.08), 0 2px 4px rgba(10,13,18,.05);
  --elev-4: 0 16px 32px rgba(10,13,18,.12), 0 4px 8px rgba(10,13,18,.06);
  --elev-popover: 0 10px 24px rgba(10,13,18,.14), 0 2px 6px rgba(10,13,18,.08);
  --elev-card: 0 1px 4px rgba(0,0,0,.16);

  /* Motion */
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --dur-instant: 80ms;
  --dur-fast: 120ms;
  --dur-base: 180ms;
  --dur-slow: 280ms;

  /* Component metrics */
  --row-h-sm: 1.75rem;
  --row-h:    2rem;
  --row-h-md: 2.25rem;
  --row-h-lg: 2.5rem;
  --sidebar-w: 13.9375rem;
  --sidebar-collapsed-w: 52px;
  --topbar-h: 54px;
  --table-row-h: 2.25rem;
  --table-header-h: 2rem;

  /* Bootstrap overrides — align BS5 vars with TYTLVERSE palette */
  --bs-primary: #0073EA;
  --bs-primary-rgb: 0, 115, 234;
  --bs-body-bg: #FFFFFF;
  --bs-body-color: #323338;
  --bs-body-font-family: var(--font-sans);
  --bs-border-radius: 4px;
  --bs-border-radius-sm: 2px;
  --bs-border-radius-lg: 6px;
  --bs-border-color: #D0D4E4;
  --bs-link-color: #0073EA;
  --bs-link-hover-color: #0060B9;
}

/* Personal text size (#258): the user's /profile choice, set on <html> by
   layout/app.html.twig. Every font size, line height and text-holding control height in
   this file is in rem (DESIGN.md → Typography → "Sizes scale with the root"), so raising
   the root raises the whole working interface together. Public pages, PDFs and emails
   never carry the attribute. */
html[data-text-size="110"] { font-size: 110%; }
html[data-text-size="120"] { font-size: 120%; }

/* ---------- Reset / Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--font-sans);
  font-size: var(--fs-14);
  color: var(--fg-1);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

/* Headings: DESIGN.md prescribes explicit sizes + 600 weight across the scale.
   Without explicit sizes we'd inherit Bootstrap's heading scale — fragile under
   any future load-order change. */
h1, h2, h3, h4, h5, h6 { font-weight: 600; }
h1, h2, h3, h4, .h4 { font-family: var(--font-display); letter-spacing: -0.1px; }
h4, .h4 { font-size: var(--fs-24); }
h5, .h5 { font-size: var(--fs-20); }
h6, .h6 { font-size: var(--fs-16); }

/* Type scale utilities — mirror --fs-* tokens so templates can drop
   inline style="font-size:Npx" in favor of a class. */
.fs-10 { font-size: var(--fs-10); }
.fs-11 { font-size: var(--fs-11); }
.fs-12 { font-size: var(--fs-12); }
.fs-13 { font-size: var(--fs-13); }
.fs-14 { font-size: var(--fs-14); }
.fs-16 { font-size: var(--fs-16); }
.fs-18 { font-size: var(--fs-18); }
.fs-20 { font-size: var(--fs-20); }
.fs-24 { font-size: var(--fs-24); }
.fs-32 { font-size: var(--fs-32); }

/* Quill's own stylesheet sets the editor to a fixed 13px; the same size in rem follows the
   user's text size (#258) like the rest of the screen. */
.ql-container { font-size: var(--fs-13); }

/* A flex child that may shrink below its content (long subjects, addresses); the mail
   templates used the name before it existed. */
.min-w-0 { min-width: 0; }

/* AbstractAnalysis: section label — repeated across Property / Abstract
   Details / Page Quality / Run Sheet / Vesting / etc. Encapsulates the
   uppercase-10px-brand-tinted-label pattern so templates can drop the
   inline style="font-size:10px;letter-spacing:.06em;color:..." trio. */
.tl-section-label {
  font-size: var(--fs-10);
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--tl-brand-500);
}

/* AbstractAnalysis: content panel — the recurring tinted card-within-card
   used inside the Overview row and the per-module sections. */
.tl-aa-panel {
  background: var(--tl-ink-50);
  border: 1px solid var(--tl-brand-100);
  overflow: hidden;
}

/* ---------- App Shell ---------- */
.tl-shell {
  display: flex;
  height: 100vh;
}

.tl-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  height: 100vh;
  transition: margin-right var(--dur-base) var(--ease-standard);
}

.tl-content {
  flex: 1;
  overflow-y: auto;
  /* Both gutters (#171): with only a left one, the right-hand cards ran into the
     window edge and Bootstrap rows' negative margins overflowed sideways. */
  padding: 24px 28px 48px 28px;
}

/* Page backdrop from the Figma (#171): white with a few soft blue glows. Painted on
   .tl-content (the scroller) with background-attachment: local so the glow sits behind
   the top of the page instead of stretching over a long list. */
.tl-content {
  background:
    radial-gradient(520px 520px at 22% 18%, rgba(0,115,234,.07), transparent 70%),
    radial-gradient(420px 420px at 92% 10%, rgba(0,115,234,.06), transparent 70%),
    radial-gradient(520px 520px at 70% 75%, rgba(0,115,234,.05), transparent 70%),
    #fff;
  background-attachment: local;
}

.tl-page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 28px 64px 0;
}

/* ---------- Sidebar ---------- */
.tl-sidebar {
  background: var(--tl-shell-bg);
  color: #fff;
  display: flex;
  flex-direction: column;
  border-right: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  transition: width var(--dur-slow) var(--ease-standard), min-width var(--dur-slow) var(--ease-standard);
  flex-shrink: 0;
}

/* Collapsed sidebar — the icon rail is a desktop-only affordance. Below the lg
   breakpoint the sidebar is an off-canvas drawer (issue #40), so the persisted
   collapse state must not shrink it there. */
@media (min-width: 992px) {
  .tl-shell--sidebar-collapsed .tl-sidebar {
    width: var(--sidebar-collapsed-w);
    min-width: var(--sidebar-collapsed-w);
    overflow: hidden;
  }
  .tl-shell--sidebar-collapsed .tl-sidebar__brand-text,
  .tl-shell--sidebar-collapsed .tl-sidebar__section,
  .tl-shell--sidebar-collapsed .tl-sidebar__count,
  .tl-shell--sidebar-collapsed .tl-sidebar__user-text,
  .tl-shell--sidebar-collapsed .tl-sidebar__user-chevron {
    display: none;
  }
  .tl-shell--sidebar-collapsed .tl-sidebar__brand {
    justify-content: center;
    padding: 10px 0;
  }
  .tl-shell--sidebar-collapsed .tl-sidebar__brand-mark {
    display: block;
  }
  .tl-shell--sidebar-collapsed .tl-sidebar__nav {
    padding: 0 4px;
  }
  .tl-shell--sidebar-collapsed .tl-sidebar__item {
    justify-content: center;
    padding: 6px 0;
    gap: 0;
    font-size: 0;
  }
  .tl-shell--sidebar-collapsed .tl-sidebar__user {
    justify-content: center;
    padding: 12px 6px;
  }
  .tl-shell--sidebar-collapsed .tl-sidebar__user-menu { padding: 8px 4px 0; }
}
/* One tooltip look site-wide (owner, #225 2026-11-02): the shell's inverted surface with
   white text — Bootstrap tooltips, the clearance tl.hint()/tl.tip() hints and the collapsed
   rail alike. Set through Bootstrap's own variables so the arrow follows the fill. */
.tooltip {
  --bs-tooltip-bg: var(--tl-shell-bg);
  --bs-tooltip-color: #fff;
}
/* Tooltips fade in over 500 ms once the 700 ms hover delay has passed (owner, #225), and
   leave at Bootstrap's own speed — the transition follows the state being entered. */
.tooltip.fade.show {
  transition-duration: .5s;
}
@media (prefers-reduced-motion: reduce) {
  .tooltip.fade.show { transition: none; }
}
.tl-sidebar-tooltip.tooltip.fade.show {
  transition-duration: .15s;
}

/* Collapsed-rail hover tooltips (issue #43) — the shared fill above, a smaller label. */
.tl-sidebar-tooltip .tooltip-inner {
  font-size: var(--fs-12);
  font-weight: 500;
  padding: 4px 9px;
}

/* Field-help (i) tooltips (issue #162) — sentence-length text, so wider and
   smaller than Bootstrap's 200px default instead of a tall narrow column. */
.tooltip.tl-help-tooltip {
  --bs-tooltip-max-width: min(340px, calc(100vw - 32px));
  --bs-tooltip-font-size: var(--fs-12);
}
.tl-help-tooltip .tooltip-inner {
  text-align: left;
  line-height: 1.45;
}
/* A hint of several paragraphs (the /mail heading, #310): blank lines in the text break them. */
.tl-help-tooltip--paragraphs .tooltip-inner { white-space: pre-line; }

/* Sidebar toggle button */
.tl-sidebar-toggle {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--fg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  transition: background var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard);
}
.tl-sidebar-toggle:hover {
  background: var(--bg-sunken);
  color: var(--fg-1);
}
.tl-sidebar-toggle [data-lucide] { width: 16px; height: 16px; }

.tl-sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  height: var(--topbar-h);
  border-bottom: 1px solid var(--tl-shell-item-active);
  flex-shrink: 0;
  text-decoration: none;
}
/* Expanded: the reverse (white TYTL) wordmark. Collapsed rail: the V mark alone — the
   wordmark is ~10:1 and unreadable at 28px. Both are SVG in public/images (#171). */
.tl-sidebar__brand-mark {
  display: none;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  object-fit: contain;
}
.tl-sidebar__brand-wordmark {
  display: block;
  height: 15px;
  width: auto;
  margin-bottom: 5px;
}
.tl-sidebar__brand-tenant {
  font-size: var(--fs-12);
  font-weight: 600;
  color: var(--tl-shell-label);
  text-transform: uppercase;
  line-height: 1.2;
}

.tl-sidebar__section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 16px 16px 8px;
  font-size: var(--fs-12);
  font-weight: 600;
  text-transform: uppercase;
  color: var(--tl-shell-label);
  background: none;
  border: 0;
  text-align: left;
  cursor: pointer;
}
.tl-sidebar__section:hover { color: #fff; }
.tl-sidebar__section-chevron {
  width: 18px;
  height: 18px;
  opacity: .7;
  transition: transform var(--dur-instant) var(--ease-standard);
}
.tl-sidebar__section[aria-expanded="false"] .tl-sidebar__section-chevron {
  transform: rotate(-90deg);
}
.tl-sidebar__nav.tl-sidebar__nav--collapsed { display: none; }

/* Second-level group inside a section (Admin, #199): reads as a nav row with a
   chevron, not as another uppercase section label. Its items indent under it. */
.tl-sidebar__section--sub {
  height: 2.5rem;
  padding: 0 12px;
  border-radius: 4px;
  font-size: var(--fs-14);
  font-weight: 400;
  text-transform: none;
  color: #fff;
}
.tl-sidebar__section--sub:hover { background: rgba(255,255,255,.08); color: #fff; }
.tl-sidebar__section--sub > span {
  display: flex;
  align-items: center;
  gap: 12px;
}
.tl-sidebar__section--sub > span svg, .tl-sidebar__section--sub > span [data-lucide] {
  width: 16px;
  height: 16px;
  opacity: 0.9;
  flex-shrink: 0;
}
.tl-sidebar__section--sub .tl-sidebar__section-chevron { width: 16px; height: 16px; }
.tl-sidebar__nav--sub {
  padding: 0 0 4px 16px;
}

.tl-sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  padding: 0 8px;
}

.tl-sidebar__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  height: 2.5rem;
  border-radius: 4px;
  color: #fff;
  font-size: var(--fs-14);
  text-decoration: none;
  cursor: pointer;
  background: transparent;
  border: 0;
  text-align: left;
  width: 100%;
  transition: background var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard);
  white-space: nowrap;
}
.tl-sidebar__item:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
  text-decoration: none;
}
.tl-sidebar__item--active {
  background: var(--tl-shell-item-active);
  color: #fff;
}
.tl-sidebar__item--active:hover {
  background: var(--tl-shell-item-active);
  color: #fff;
}
.tl-sidebar__item svg, .tl-sidebar__item [data-lucide] {
  width: 16px;
  height: 16px;
  opacity: 0.9;
  flex-shrink: 0;
}
.tl-sidebar__item--active svg, .tl-sidebar__item--active [data-lucide] {
  opacity: 1;
}
.tl-sidebar__count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: .6875rem;
  color: var(--tl-shell-label);
  letter-spacing: -0.01em;
  background: rgba(0,0,0,.2);
  padding: 1px 6px;
  border-radius: 999px;
}
.tl-sidebar__item--active .tl-sidebar__count {
  color: rgba(255,255,255,.7);
  background: rgba(0,0,0,.25);
}

/* The account block at the foot of the sidebar (#258): the name button opens the user
   menu (Profile / Logout) right above it, in flow — the sidebar's scroll box cannot clip
   it and the off-canvas drawer needs nothing extra. */
.tl-sidebar__account {
  margin-top: auto;
  flex-shrink: 0;
  border-top: 1px solid var(--tl-shell-item-active);
}
.tl-sidebar__user-menu { padding: 8px 8px 0; }
.tl-sidebar__user-menu[hidden] { display: none; }
.tl-sidebar__user {
  width: 100%;
  padding: 16px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: 0;
  color: #fff;
  text-align: left;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-standard);
}
.tl-sidebar__user:hover,
.tl-sidebar__user[aria-expanded="true"] { background: rgba(255,255,255,.08); }
.tl-sidebar__user:focus-visible { outline: 2px solid var(--tl-brand-400); outline-offset: -2px; }
.tl-sidebar__user-text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.tl-sidebar__user-name, .tl-sidebar__user-role { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-sidebar__user-chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: .7;
  transition: transform var(--dur-instant) var(--ease-standard);
}
.tl-sidebar__user[aria-expanded="true"] .tl-sidebar__user-chevron { transform: rotate(180deg); }
.tl-sidebar__avatar {
  width: 2.125rem;
  height: 2.125rem;
  border-radius: 50%;
  background: #9D50DD;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-14);
  font-weight: 600;
  flex-shrink: 0;
}
/* A searchable dropdown (#348, assets/searchable-select.js): while a search is typed in a
   single-choice picker, the current choice is hidden so only the typed text shows. */
.ts-wrapper.single.tl-ts-typing .ts-control > .item { display: none; }
/* …and a chosen value keeps to one line (#353): a long choice ("First Loss - M (20-06) — Loan
   Policy only — UW approval") wrapped, with the search box on a line of its own while focused, so
   the box changed height when it lost focus and moved the button being clicked. */
.ts-wrapper.tl-searchable.single.has-items:not(.tl-ts-typing) .ts-control { flex-wrap: nowrap; }
.ts-wrapper.tl-searchable.single.has-items:not(.tl-ts-typing) .ts-control > .item {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ts-wrapper.tl-searchable.single.has-items:not(.tl-ts-typing) .ts-control > input { flex: 0 0 .5rem; min-width: .5rem; }

/* Assignee picker (TomSelect) — initials avatar on options + selected item.
   Mirrors .tl-sidebar__avatar at a smaller size. */
.tl-assignee-row {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  min-width: 0;
}
.tl-assignee-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tl-assignee-av {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: var(--tl-brand-600);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-10);
  font-weight: 600;
  line-height: 1;
  flex-shrink: 0;
}
.tl-assignee-av--none {
  background: var(--tl-ink-200);
  color: var(--tl-ink-600);
}
/* Role/category label trailing the assignee name (e.g. "Admin", "Closer"). */
.tl-assignee-role {
  margin-left: auto;
  padding-left: var(--sp-3);
  font-size: var(--fs-11);
  color: var(--tl-ink-500);
  white-space: nowrap;
  flex-shrink: 0;
}
/* Departments on the admin user form (#294): department + its Head mark, in columns that
   wrap down to one on a phone. */
.tl-department-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: var(--sp-3) var(--sp-4);
}
.tl-department-grid__item {
  min-width: 0;
}
/* Stage owners on the file's Team card (#294): the stage the file is at carries a "Now" badge
   and its owner's name reads in bold (the stage name is a dt, bold already). */
dd.tl-stage-owner--current {
  font-weight: 600;
}
/* Pretty file input — a styled drop area replacing the bare native control.
   The native input overlays the area transparently so it stays clickable,
   focusable and HTML5-validatable. */
.tl-file-drop {
  position: relative;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.tl-file-drop:hover,
.tl-file-drop.is-dragover {
  border-color: var(--tl-brand-600) !important;
  background-color: var(--tl-brand-50);
}
.tl-file-drop__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.tl-file-drop__icon {
  color: var(--tl-brand-600);
  font-size: var(--fs-18);
  flex-shrink: 0;
}
.tl-file-drop.has-file .tl-file-drop__text {
  color: var(--tl-ink-900);
  font-weight: 500;
}
/* A date shown as text with a calendar icon that changes it (#319, the Recording Checklist).
   The native date input lies transparent over the icon: a tap opens the picker in Safari and
   iOS; Chromium stretches its picker indicator over the box (and the page calls showPicker()).
   1rem on the input keeps iOS from zooming in on focus. */
.tl-date-pick__value {
  font-variant-numeric: tabular-nums;
}
.tl-date-pick__btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--bs-border-radius);
  color: var(--tl-brand-600);
  cursor: pointer;
}
.tl-date-pick__btn:hover,
.tl-date-pick__btn:focus-within {
  background-color: var(--tl-brand-50);
}
.tl-date-pick__btn:focus-within {
  outline: 2px solid var(--tl-brand-600);
  outline-offset: 1px;
}
.tl-date-pick__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  font-size: 1rem;
  cursor: pointer;
}
.tl-date-pick__input::-webkit-calendar-picker-indicator {
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  cursor: pointer;
}
/* A Recording Checklist document name keeps to its cell (#319: the cell is narrow on a phone). */
.tl-recording-slot__doc a {
  max-width: 13.75rem;
}
/* Upload progress (#202, assets/upload-progress.js): Bootstrap .progress in brand blue,
   figures that do not jitter while they count. */
.tl-upload-progress .progress {
  height: 8px;
  background-color: var(--tl-brand-50);
}
.tl-upload-progress .progress-bar {
  background-color: var(--tl-brand-600);
}
.tl-upload-progress [data-upload-pct] {
  font-variant-numeric: tabular-nums;
}
/* After 100 % the server checks the document (#366): a small brand spinner before
   "Checking the document…" — rem, so it grows with the text size. */
.tl-upload-progress__spinner {
  flex: none;
  width: 0.875rem;
  height: 0.875rem;
  border-width: 0.125rem;
  color: var(--tl-brand-600);
}
/* Two-line clamp for long table cell text (e.g. Buyer/Borrower lists). */
.tl-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 16rem;
}
.tl-sidebar__user-name {
  font-size: var(--fs-14);
  color: #fff;
  font-weight: 500;
  line-height: 1.2;
}
.tl-sidebar__user-role {
  font-size: var(--fs-12);
  font-weight: 600;
  color: var(--tl-ink-400);
  line-height: 1.2;
}

/* ---------- Topbar ---------- */
.tl-topbar {
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border-1);
  background: #fff;
  display: flex;
  align-items: center;
  padding: 0 24px 0 12px;
  gap: 16px;
  flex-shrink: 0;
}

.tl-topbar__crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .8125rem;
  color: var(--fg-4);
  min-width: 0;
}
.tl-topbar__crumbs .sep { color: var(--tl-ink-300); font-size: .75rem; }
.tl-topbar__crumbs .current { color: var(--fg-1); font-weight: 500; }
.tl-topbar__crumbs a { color: var(--fg-4); text-decoration: none; }
.tl-topbar__crumbs a:hover { color: var(--fg-2); }

.tl-topbar__search {
  margin-left: auto;
  position: relative;
  width: 237px;
  flex-shrink: 0;
}
.tl-topbar__search input {
  width: 100%;
  height: 2rem;
  padding: 0 10px 0 40px;
  border: 1px solid var(--border-2);
  border-radius: 4px;
  background: #F5F5F5;
  font-size: var(--fs-14);
  font-family: var(--font-sans);
  color: var(--fg-1);
  outline: none;
  transition: border-color var(--dur-fast) var(--ease-standard);
}
.tl-topbar__search input:focus {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus-ring);
}
.tl-topbar__search [data-lucide] {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--fg-1);
  pointer-events: none;
}
.tl-search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-2);
  border-radius: 6px;
  box-shadow: var(--elev-popover);
  z-index: 1050;
  overflow: hidden;
}
.tl-search-result {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  cursor: pointer;
  text-decoration: none;
  color: var(--fg-1);
  font-size: .75rem;
  border-bottom: 1px solid var(--border-1);
}
.tl-search-result:last-child { border-bottom: none; }
.tl-search-result:hover, .tl-search-result.active { background: var(--tl-ink-100); }
.tl-search-result__icon {
  flex-shrink: 0;
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .625rem;
  font-weight: 600;
}
.tl-search-result__icon--file { background: #e0edff; color: #0d6efd; }
.tl-search-result__icon--client { background: #e8f5e9; color: #198754; }
.tl-search-result__body { min-width: 0; flex: 1; }
.tl-search-result__label { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-search-result__sub { color: var(--fg-4); font-size: .6875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-search-empty { padding: 10px; text-align: center; color: var(--fg-4); font-size: .75rem; }

.tl-topbar__actions {
  display: flex;
  align-items: center;
  gap: 13px;
}
.tl-topbar__actions .btn-group { margin-right: 11px; }

.tl-icon-btn {
  width: 28px;
  height: 28px;
  color: var(--fg-1);
  border-radius: 4px;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--fg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: background var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard);
  text-decoration: none;
}
.tl-icon-btn:hover {
  background: var(--bg-sunken);
  color: var(--fg-1);
}
.tl-icon-btn [data-lucide] { width: 16px; height: 16px; }
.tl-icon-btn .tl-pip {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tl-brand-500);
  border: 1px solid #fff;
}

/* Narrow topbar (below md). At phone width the full topbar — search 237px, Create
   File, four icons — was 596px wide and scrolled every page sideways. Below md the
   crumbs give way first (ellipsis), the search folds into an icon that opens the
   field over the whole bar, Create File keeps only its plus icon (label stays as
   aria-label/title) and the Profile icon goes (the sidebar's user menu → Profile is the same page).
   The notification panel pins to the viewport instead of hanging off the bell.
   md and up is the desktop topbar, unchanged. */
.tl-topbar .tl-topbar__search-toggle,
.tl-topbar .tl-topbar__search-close,
.tl-topbar .tl-topbar__create-icon { display: none; }

@media (max-width: 767.98px) {
  .tl-topbar { position: relative; padding: 0 var(--sp-5); gap: var(--sp-4); }
  .tl-topbar__crumbs { flex: 1 1 auto; overflow: hidden; white-space: nowrap; }
  .tl-topbar__crumbs > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .tl-topbar__crumbs > .sep { flex-shrink: 0; }

  .tl-topbar .tl-topbar__search-toggle { display: flex; flex-shrink: 0; }
  .tl-topbar__search { display: none; }
  .tl-topbar--search-open .tl-topbar__search {
    display: flex;
    align-items: center;
    position: absolute;
    inset: 0;
    width: auto;
    margin: 0;
    padding: 0 var(--sp-5);
    gap: var(--sp-4);
    background: #fff;
    /* Over the action buttons (positioned, later in the DOM) and sticky page
       headers (Bootstrap 1020); under the off-canvas sidebar (1040/1045). */
    z-index: 1030;
  }
  .tl-topbar--search-open .tl-topbar__search > :first-child { left: calc(var(--sp-5) + 16px); }
  .tl-topbar--search-open .tl-topbar__search input { flex: 1 1 auto; min-width: 0; }
  .tl-topbar .tl-topbar__search-close { display: flex; flex-shrink: 0; }
  .tl-topbar__search-close [data-lucide], .tl-topbar__search-close svg {
    position: static; transform: none; pointer-events: none;
  }
  .tl-search-results { left: var(--sp-5); right: var(--sp-5); }

  .tl-topbar__actions { gap: var(--sp-2); flex-shrink: 0; }
  .tl-topbar__actions .btn-group { margin-right: var(--sp-2); }
  .tl-topbar .tl-topbar__optional { display: none; }
  .tl-topbar .tl-topbar__create { display: flex; align-items: center; padding: 0 var(--sp-4); height: 28px; }
  .tl-topbar .tl-topbar__create::after { display: none; }
  .tl-topbar .tl-topbar__create-icon { display: block; width: 16px; height: 16px; }
  .tl-topbar__create-label {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
  }

  .tl-notif-wrap .tl-notif {
    position: fixed;
    top: calc(var(--topbar-h) + 6px);
    left: var(--sp-4);
    right: var(--sp-4);
    width: auto;
  }
}

/* ---------- Notification dropdown ---------- */
.tl-notif-wrap { position: relative; }
.tl-notif {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 22.5rem;
  background: #fff;
  border: 1px solid var(--border-1);
  border-radius: var(--r-4);
  box-shadow: var(--elev-popover);
  z-index: 1050;
  overflow: hidden;
}
.tl-notif__head {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--fg-1);
}
.tl-notif__list { max-height: 360px; overflow-y: auto; }
.tl-notif__item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-1);
  display: flex;
  gap: 10px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.tl-notif__item:hover { background: var(--bg-row-hover); }
.tl-notif__item:last-child { border-bottom: 0; }
.tl-notif__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tl-brand-500);
  margin-top: 6px;
  flex-shrink: 0;
}
.tl-notif__title { font-size: .8125rem; color: var(--fg-1); font-weight: 500; line-height: 1.4; }
.tl-notif__msg {
  font-size: .75rem;
  color: var(--fg-3);
  line-height: 1.4;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tl-notif__sub { font-size: .6875rem; color: var(--fg-5); margin-top: 2px; }
.tl-notif__footer {
  padding: 8px 14px;
  border-top: 1px solid var(--border-1);
  text-align: center;
  font-size: .75rem;
  color: var(--fg-link);
  text-decoration: none;
  display: block;
}
.tl-notif__footer:hover { background: var(--bg-sunken); }

.tl-notif__empty { padding: 16px 14px; font-size: .8125rem; color: var(--fg-5); }

/* ---------- Flash messages ---------- */
.tl-flashes { padding: 0 0 12px; }

/* ---------- Page structure (inner content) ---------- */
.tl-page__header {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-1);
  margin-bottom: 18px;
}
.tl-page__title-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
}
.tl-page__eyebrow {
  font-size: .625rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-4);
}
.tl-page__title {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--fg-1);
  margin: 0;
  line-height: 1.2;
  white-space: nowrap;
}
.tl-page__subtitle { font-size: .8125rem; color: var(--fg-3); }
.tl-page__actions { margin-left: auto; display: flex; gap: 8px; flex: 0 0 auto; }

.tl-file-heading { font-family: var(--font-display); font-weight: 500; font-size: clamp(1.375rem, 4vw, 2rem); margin-bottom: 0; hyphens: none; overflow-wrap: normal; }

/* Concern history row chevron rotation */
.tl-concern-chevron { transition: transform 0.2s ease; }
[data-bs-toggle="collapse"][aria-expanded="true"] .tl-concern-chevron { transform: rotate(90deg); }

/* 2-column definition list for Property Details card */
@media (min-width: 576px) {
  dl.tl-2col-dl {
    display: grid;
    grid-template-columns: max-content minmax(0,1fr) max-content minmax(0,1fr);
    column-gap: 16px;
    row-gap: 3px;
    align-items: baseline;
  }
  dl.tl-2col-dl > dt,
  dl.tl-2col-dl > dd {
    width: auto !important;
    max-width: none !important;
    padding: 0;
    margin-bottom: 0;
  }
  dl.tl-2col-dl > dt.tl-full { grid-column: 1 / 3; }
  dl.tl-2col-dl > dt.tl-full + dd { grid-column: 3 / -1; }
  dl.tl-2col-dl > dt.tl-span { grid-column: 1 / 2; }
  dl.tl-2col-dl > dd.tl-span { grid-column: 2 / -1; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 2.25rem;
  padding: 0 12px;
  border-radius: var(--r-2);
  border: 1px solid var(--border-2);
  background: #fff;
  font-size: var(--fs-13);
  font-weight: 500;
  font-family: var(--font-sans);
  color: var(--fg-2);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-standard), border-color var(--dur-fast) var(--ease-standard), box-shadow var(--dur-fast) var(--ease-standard);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}
.btn:hover { background: var(--bg-sunken); border-color: var(--border-strong); color: var(--fg-1); text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--tl-brand-600);
  border-color: var(--tl-brand-600);
  color: #fff;
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--tl-brand-700);
  border-color: var(--tl-brand-700);
  color: #fff;
  box-shadow: none;
}
.btn-secondary {
  background: #fff;
  border-color: var(--border-2);
  color: var(--fg-2);
}
.btn-secondary:hover { background: var(--bg-sunken); border-color: var(--border-strong); color: var(--fg-1); }

.btn-outline-primary {
  background: transparent;
  border-color: var(--tl-brand-600);
  color: var(--tl-brand-600);
}
.btn-outline-primary:hover {
  background: var(--tl-brand-600);
  border-color: var(--tl-brand-600);
  color: #fff;
}
.btn-outline-secondary {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--fg-2);
}
.btn-outline-secondary:hover { background: var(--bg-sunken); color: var(--fg-1); }

.btn-danger {
  background: var(--tl-danger-600);
  border-color: var(--tl-danger-600);
  color: #fff;
}
.btn-danger:hover {
  background: var(--tl-danger-700);
  border-color: var(--tl-danger-700);
  color: #fff;
}
.btn-outline-danger {
  background: transparent;
  border-color: var(--tl-danger-500);
  color: var(--tl-danger-600);
}
.btn-outline-danger:hover {
  background: var(--tl-danger-600);
  border-color: var(--tl-danger-600);
  color: #fff;
}

.btn-success {
  background: var(--tl-success-600);
  border-color: var(--tl-success-600);
  color: #fff;
}
.btn-success:hover {
  background: var(--tl-success-700);
  border-color: var(--tl-success-700);
  color: #fff;
}

.btn-link {
  background: transparent;
  border-color: transparent;
  color: var(--fg-link);
  padding: 0;
  height: auto;
  text-decoration: none;
}
.btn-link:hover { color: var(--tl-brand-700); background: transparent; border-color: transparent; text-decoration: underline; }

.btn-sm { height: 1.875rem; padding: 0 10px; font-size: var(--fs-12); }
.btn-lg { height: 2.5rem; padding: 0 16px; font-size: var(--fs-14); }

.btn:disabled, .btn.disabled {
  background: var(--bg-sunken);
  color: var(--fg-disabled);
  border-color: var(--border-1);
  cursor: not-allowed;
  opacity: 1;
}
.btn [data-lucide], .btn .bi { width: 14px; height: 14px; }
.btn-sm [data-lucide], .btn-sm .bi { width: 13px; height: 13px; }

/* ---------- Form Controls ---------- */
.form-control, .form-select, .form-control-sm, .form-select-sm {
  border: 1px solid var(--border-2);
  border-radius: var(--r-2);
  background: #fff;
  color: var(--fg-1);
  font-size: var(--fs-13);
  font-family: var(--font-sans);
  padding: 0 10px;
  height: 2rem;
  transition: border-color var(--dur-fast) var(--ease-standard), box-shadow var(--dur-fast) var(--ease-standard);
  line-height: 1;
}
.form-control:focus, .form-select:focus {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus-ring);
  outline: none;
}
.form-control.is-invalid, .form-select.is-invalid {
  border-color: var(--tl-danger-500);
}
.form-control.is-invalid:focus, .form-select.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}
textarea.form-control {
  height: auto;
  padding: 8px 10px;
  line-height: 1.5;
}
/* A read-only value shown in a field's box — a div/span styled .form-control (Schedule A's
   Title Vested In, #255). The input rules above (fixed 32px, no vertical padding, line-height
   1) leave its text stuck to the top edge, and rich text can run to several lines. Grow with
   the content and centre one line with symmetric padding: 2px border + 2×6px + 13px×1.4 ≈ 32px,
   the same height as an input beside it. Plain block layout, no flex — an icon and its text
   must stay on one line, and it renders the same in Safari. */
div.form-control, span.form-control, p.form-control {
  display: block;
  height: auto;
  min-height: 2rem;
  padding-top: 6px;
  padding-bottom: 6px;
  line-height: 1.4;
}

/* File inputs. Bootstrap leaves ::file-selector-button at the browser default, so every
   upload on the app showed an OS-grey "Choose File" block beside our own inputs (#144).
   Dress the button as a quiet secondary control welded to the left of the field; the
   padding has to go on the button, not the input, or the native control is squashed. */
input.form-control[type="file"] {
  padding: 0;
  line-height: 1.875rem;
  color: var(--fg-4);
  cursor: pointer;
}
input.form-control[type="file"]::file-selector-button {
  height: 1.875rem;
  margin: 0 10px 0 0;
  padding: 0 12px;
  border: 0;
  border-right: 1px solid var(--border-2);
  border-radius: var(--r-2) 0 0 var(--r-2);
  background: var(--bg-sunken);
  color: var(--fg-2);
  font-family: var(--font-sans);
  font-size: var(--fs-13);
  font-weight: 500;
  line-height: 1.875rem;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard);
}
input.form-control[type="file"]:hover::file-selector-button {
  background: var(--tl-ink-150);
  color: var(--fg-1);
}
input.form-control[type="file"]:disabled::file-selector-button {
  cursor: not-allowed;
  color: var(--fg-5);
}

.form-label {
  /* Vibe text-field label (#171): sentence case, 14px, secondary grey. */
  font-size: var(--fs-14);
  font-weight: 400;
  color: var(--fg-4);
  letter-spacing: 0;
  text-transform: none;
  margin-bottom: 4px;
}
.form-text { font-size: .6875rem; color: var(--fg-5); }
.invalid-feedback { font-size: .6875rem; color: var(--tl-danger-600); }

.form-control-mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* ---------- Cards ---------- */
.card {
  background: #fff;
  border: 0;
  border-radius: var(--r-4);
  box-shadow: var(--elev-card);
}
.card:hover { box-shadow: var(--elev-card); }

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border-1);
  padding: 14px 20px;
  font-size: var(--fs-14);
  font-weight: 600;
  color: var(--fg-4);
  display: flex;
  align-items: center;
  gap: 8px;
}
/* .card-header is itself flex, so a "title left / action right" wrapper div
   must stretch to the full header width or the action hugs the title */
.card-header > .justify-content-between { flex: 1 1 auto; }
.card-header [data-lucide], .card-header .bi {
  width: 14px;
  height: 14px;
  color: var(--fg-4);
}
/* …but an icon inside a header button is part of the button: it takes the button's
   colour (a muted glyph on a filled primary button read as a smudge, #171). */
.card-header .btn [data-lucide], .card-header .btn .bi { color: inherit; }
.card-body { padding: 16px 20px; }
/* Card titles are quiet labels in the Figma (14px semibold grey), whatever heading tag
   a template used for them. */
.card-header h1, .card-header h2, .card-header h3, .card-header h4, .card-header h5, .card-header h6 {
  font-family: var(--font-sans);
  font-size: var(--fs-14);
  font-weight: 600;
  color: var(--fg-4);
  letter-spacing: 0;
}
.card-footer {
  background: transparent;
  border-top: 1px solid var(--border-1);
  padding: 10px 16px;
}

/* ---------- Tables ---------- */
/* A table wrapper scrolls sideways, but an absolutely positioned child whose containing block
   lies outside it (a `.visually-hidden` header label, a hidden file input) escapes that clip
   and widens the page — the Escrow Ledger's "Actions" label pushed the file overview's
   Finances pane to 969px at every width below desktop. Contain them in the wrapper. */
.table-responsive { position: relative; }
/* Empty-state row (a lone colspan cell, or DataTables' td.dt-empty): the cell is as wide
   as the table, which on a phone is wider than its scroller, so a centred message and CTA
   sat off to the right. base.html.twig's tlFitEmptyCells() wraps the cell's content in this
   box, sizes it to the scroller's visible width and sets `left`; sticky keeps it in view
   while the header row scrolls. Desktop: the box is the cell's own width, nothing moves. */
.tl-empty-cell { position: sticky; }
.table {
  font-size: var(--fs-12);
  color: var(--fg-1);
  margin-bottom: 0;
  --bs-table-bg: transparent;
  --bs-table-hover-bg: var(--bg-row-hover);
  --bs-table-striped-bg: var(--bg-row-stripe);
}
.table thead th {
  background: var(--tl-ink-50);
  font-size: var(--fs-12);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--fg-4);
  padding: 8px 12px;
  height: var(--table-header-h);
  border-top: 1px solid var(--border-1);
  border-bottom: 1px solid var(--border-1) !important;
  vertical-align: middle;
  white-space: nowrap;
}
/* Opt-in dark table header (white text on dark) — used where the muted light
   default is hard to read, e.g. the exception-catalogue admin tables (#33).
   Overrides the light `.table thead th` default above.
   Bootstrap's `.table-dark` paints the dark background but loses the `color`
   cascade to `.table thead th` above, leaving muted slate on near-black (#51),
   so it maps to the same opt-in. */
.table thead.table-dark th,
.table thead.tl-thead-dark th {
  background: var(--tl-ink-800);
  color: #fff;
}
.table tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-1);
  vertical-align: middle;
  color: var(--fg-1);
}
.table tbody tr:last-child td { border-bottom: 0; }
/* File Overview widgets (#156): the page's list-group widgets (Searches, Team…)
   read at the 14px body size, so a table sitting beside them uses it too instead
   of the 12px data-table default. Header row keeps its 10px caps. */
.table.tl-table-widget { font-size: var(--fs-14); }
.table-hover tbody tr:hover { background: var(--bg-row-hover); cursor: pointer; }
.table td.col-mono, .table th.col-mono {
  /* File codes and IDs are Figtree in the Figma (#171); tabular figures keep them aligned. */
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.table td.col-num, .table th.col-num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
/* Dates are atomic: 08/14/2026 must never break across two lines just because a
   neighbouring address column is greedy (#105). */
.table td.col-date, .table th.col-date {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.table td.col-muted { color: var(--fg-4); }

/* Figma list rows (#171): 60px rows alternating white / #F5F5F5 with a #C3C6D4 rule. */
.table.tl-table-zebra tbody td { padding: 10px 12px; height: 3.75rem; border-bottom-color: var(--tl-ink-300); }
.table.tl-table-zebra thead th { padding: 8px 12px; border-color: var(--tl-ink-300) !important; }
.table.tl-table-zebra tbody tr:nth-child(even) > td { background: #F5F5F5; }
.table.tl-table-zebra tbody tr:hover > td { background: var(--tl-brand-50); }
.table th.tl-col-person { min-width: 150px; }
.table .tl-sub { font-size: var(--fs-11); color: var(--fg-4); line-height: 1.3; }
.table a.tl-code { font-weight: 600; color: var(--tl-brand-500); text-decoration: none; white-space: nowrap; }
/* A badge that is a link keeps its own ink — the link blue painted the Contacts "Files"
   count blue on its blue pill (#177). Every .badge variant below sets its colour. */
.table a:not(.btn):not(.dropdown-item):not(.badge) { color: var(--tl-brand-500); }

/* Pagination (Figma #171): bare Previous / numbers / Next, current page on a pale blue chip. */
.pagination { gap: 4px; --bs-pagination-border-width: 0; }
.pagination .page-link { border: 0; background: transparent; color: var(--fg-1); font-size: var(--fs-14); padding: 4px 8px; border-radius: var(--r-2); }
.pagination .page-link:hover { background: var(--tl-ink-100); color: var(--fg-1); }
.pagination .page-item.active .page-link { background: var(--tl-brand-100); color: var(--fg-1); }
.pagination .page-item.disabled .page-link { color: var(--fg-5); background: transparent; }

/* Sticky table header */
.table-sticky thead th { position: sticky; top: 0; z-index: 1; }

/* ---------- Badges / Status Chips ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 1.5rem;
  padding: 0 8px;
  border-radius: var(--r-pill);
  font-size: var(--fs-12);
  font-weight: 600;
  font-family: var(--font-sans);
  border: 1px solid transparent;
  line-height: 1;
}

/* Status chip variants */
/* Pill colours are the Figma "Status's" set (#171) — filled, no border. */
.badge-status-pending-order    { background: var(--tl-ink-150); color: var(--tl-ink-500); border-color: transparent; }
.badge-status-pending-abstract { background: #ACE5FE; color: #0073EA; border-color: transparent; }
.badge-status-pending-reading  { background: #DCB0FF; color: #401694; border-color: transparent; }
.badge-status-pending-clearance{ background: #0073EA; color: #ACE5FE; border-color: transparent; }
.badge-status-clear            { background: #00854D; color: #D0FFCF; border-color: transparent; }
.badge-status-scheduled,
.tl-btn-status.badge-status-scheduled:is(:hover, :focus-visible, :active) { background: #D0FFCF; color: var(--tl-success-600); border-color: transparent; }
/* Closed is the Vibe "done" green (#285, owner 2026-11-17): green like the Closed progress bar,
   bright where Clear to Close is deep #00854D; dark ink text keeps it readable at 12px. */
.badge-status-closed           { background: var(--tl-chart-green); color: var(--tl-ink-900); border-color: transparent; }
.badge-status-postclosing      { background: var(--tl-ink-150); color: var(--tl-ink-500); border-color: transparent; }
.badge-status-on-hold          { background: var(--tl-warn-50); color: var(--tl-warn-700); border-color: var(--tl-warn-100); }
/* Canceled is dark everywhere (#285, owner 2026-11-15): ended on purpose — not red (failed), not grey (queued/pending). */
.badge-status-cancelled        { background: var(--tl-ink-900); color: #fff; border-color: transparent; }

/* A button in a status pill's colours (.tl-btn-status + a badge-status-* class, #231
   Resolve): the selector above keeps the pill's fill through Bootstrap's / the icon
   button's hover and active states; this only darkens it a touch as the hover cue. */
.tl-btn-status:is(:hover, :focus-visible) { filter: brightness(0.95); }

/* Generic chip variants */
.badge-chip                    { background: var(--bg-sunken); color: var(--fg-3); border-color: var(--border-1); }
.badge-chip-brand              { background: var(--tl-brand-50); color: var(--tl-brand-700); border-color: var(--tl-brand-100); }
.badge-chip-success            { background: var(--tl-success-50); color: var(--tl-success-700); border-color: var(--tl-success-100); }
.badge-chip-warn               { background: var(--tl-warn-50); color: var(--tl-warn-700); border-color: var(--tl-warn-100); }
.badge-chip-danger             { background: var(--tl-danger-50); color: var(--tl-danger-700); border-color: var(--tl-danger-100); }
.badge-chip-info               { background: var(--tl-info-50); color: var(--tl-info-700); border-color: var(--tl-info-100); }

/* Keep Bootstrap badge bg-* variants working */
.badge.bg-primary   { background: var(--tl-brand-600) !important; color: #fff; border-color: var(--tl-brand-600); }
.badge.bg-secondary { background: var(--tl-ink-500) !important; color: #fff; border-color: var(--tl-ink-500); }
.badge.bg-success   { background: var(--tl-success-600) !important; color: #fff; border-color: var(--tl-success-600); }
.badge.bg-danger    { background: var(--tl-danger-600) !important; color: #fff; border-color: var(--tl-danger-600); }
.badge.bg-warning   { background: var(--tl-warn-600) !important; color: #fff; border-color: var(--tl-warn-600); }
.badge.bg-info      { background: var(--tl-info-600) !important; color: #fff; border-color: var(--tl-info-600); }
.badge.bg-dark      { background: var(--tl-ink-900) !important; color: #fff; border-color: var(--tl-ink-900); }
.badge.bg-light     { background: var(--tl-ink-100) !important; color: var(--fg-2); border-color: var(--tl-ink-200); }

/* Flag chips (rush, hold, hi-li, fincen) */
.flag-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 1.25rem;
  padding: 0 7px;
  border-radius: var(--r-pill);
  font-size: .625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid;
}
.flag-chip--rush   { background: var(--tl-accent-100); color: var(--tl-accent-600); border-color: #FED7AA; }

/* Status dot (used inside badges) */
.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ---------- Nav Tabs ---------- */
/* A tab row that doesn't fit wraps onto further rows (phones, long category lists) instead
   of pushing the page sideways — never an inner sideways scroll, which would clip a tab's
   dropdown menu. No tab gets narrower than its label (`.nav-link` is nowrap); where the row
   fits it renders as one line, as before. Same rule as #fileHubTabs below. */
.nav-tabs {
  border-bottom: 1px solid var(--border-1);
  gap: var(--sp-1);
  flex-wrap: wrap;
}
.nav-tabs > .nav-item,
.nav-tabs > .nav-link { min-width: max-content; }
/* The file hub's tabs spread across the page like the Figma's Overview / Documentation /
   Finances / Messages / Activity bar (#171). */
#fileHubTabs { justify-content: space-between; border-bottom-color: var(--tl-ink-200); }
#fileHubTabs > .nav-item { flex: 1 1 0; }
#fileHubTabs > .nav-item > .nav-link { justify-content: center; height: 2.5rem; }
.nav-tabs .nav-link {
  padding: 8px 12px;
  font-size: var(--fs-14);
  font-weight: 400;
  color: var(--fg-1);
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  height: 2.25rem;
  border-radius: 0;
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease-standard);
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-tabs .nav-link:hover { color: var(--fg-2); background: transparent; border-color: transparent; border-bottom-color: var(--tl-ink-200); }
.nav-tabs .nav-link.active {
  color: var(--tl-brand-600);
  font-weight: 400;
  background: transparent;
  border-color: transparent;
  border-bottom-color: var(--tl-brand-600);
}
.nav-tabs .nav-link .badge {
  font-family: var(--font-mono);
  font-size: .625rem;
  height: 1.125rem;
  font-weight: 600;
  /* !important beats the .badge.bg-* colour utilities, which otherwise leave
     the count grey-on-grey inside a tab (e.g. bg-secondary on /documents). */
  background: var(--bg-sunken) !important;
  color: var(--fg-3) !important;
  border-color: var(--tl-ink-200);
}
.nav-tabs .nav-link.active .badge {
  background: var(--tl-brand-100) !important;
  color: var(--tl-brand-700) !important;
  border-color: var(--tl-brand-200);
}

/* ---------- Alerts ---------- */
.alert {
  border: 1px solid;
  border-radius: var(--r-3);
  font-size: var(--fs-13);
  padding: 10px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-success { background: var(--tl-success-50); border-color: var(--tl-success-100); color: var(--tl-success-700); }
.alert-danger, .alert-error  { background: var(--tl-danger-50); border-color: var(--tl-danger-100); color: var(--tl-danger-700); }
.alert-warning { background: var(--tl-warn-50); border-color: var(--tl-warn-100); color: var(--tl-warn-700); }
.alert-info    { background: var(--tl-info-50); border-color: var(--tl-info-100); color: var(--tl-info-700); }
/* #227: Bootstrap pins the close (X) to the top with padding sized for its own, taller
   alert; ours is 10px 14px, so the X sat below the middle. Centre it on the alert instead. */
.alert-dismissible .btn-close {
  top: 50%;
  transform: translateY(-50%);
  padding: 10px 14px;
}
/* The alert padding above replaced Bootstrap's 3rem right padding on a dismissible alert, so
   wrapped text ran under the X (the phone-width banner). Keep room for the X's 1em + 2×14px. */
.alert.alert-dismissible { padding-right: calc(1em + 28px + var(--sp-4)); }

/* The suggested remittance on an unfilled Remittance row (#226): a compact soft-danger alert
   on its own line under the amount, right-aligned and one line like the hint it replaces,
   the same on every ledger screen (_transactions_table). */
.alert.tl-remit-suggest {
  display: flex;
  align-items: baseline;
  gap: 0;
  width: fit-content;
  margin: 6px 0 0 auto;
  padding: 4px 8px;
  font-size: var(--fs-12);
  font-weight: 400;
  white-space: nowrap;
}

/* WFG Staging warning on the jacket and CPL / Authorization Letter issue screens (#68): the
   danger alert, louder — a test document must not pass for a real one. */
.alert.tl-wfg-staging {
  align-items: center;
  border-width: 2px;
  border-color: var(--tl-danger-500);
  font-size: var(--fs-16);
  padding: 12px 16px;
}

/* ---------- Modals ---------- */
.modal-content {
  border: 1px solid var(--border-1);
  border-radius: var(--r-4);
  box-shadow: var(--elev-4);
  background: #fff;
}
.modal-header {
  border-bottom: 1px solid var(--border-1);
  padding: 14px 20px;
}
.modal-title { font-size: var(--fs-16); font-weight: 600; color: var(--fg-1); }
.modal-body { padding: 16px 20px; font-size: var(--fs-13); color: var(--fg-3); line-height: 1.55; }
.modal-footer { border-top: 1px solid var(--border-1); padding: 12px 20px; }
.btn-close { opacity: 0.4; transition: opacity var(--dur-fast); }
.btn-close:hover { opacity: 0.7; }

/* ---------- Dropdowns ---------- */
.dropdown-menu {
  box-shadow: var(--elev-popover);
  border: 1px solid var(--border-1);
  border-radius: var(--r-3);
  padding: 4px;
  font-size: var(--fs-13);
  min-width: 11.25rem;
}
/* A long row-action menu opened mid-table has room neither above nor below, and a
   fixed-strategy menu can't be reached by scrolling the page — so it scrolls itself (#162).
   Half the viewport: whichever side of the toggle is larger always fits it, and Popper's
   flip moves the menu there. */
.dropdown-menu.tl-menu-scroll {
  max-height: calc(50vh - 2.5rem);
  overflow-y: auto;
}
.dropdown-item {
  border-radius: var(--r-2);
  padding: 6px 10px;
  font-size: var(--fs-13);
  font-weight: 400;
  color: var(--fg-1);
  transition: background var(--dur-fast);
  display: flex;
  align-items: center;
  gap: 8px;
}
.dropdown-item:hover, .dropdown-item:focus { background: var(--bg-sunken); color: var(--fg-1); }
.dropdown-item.active, .dropdown-item:active { background: var(--tl-brand-50); color: var(--tl-brand-700); }
.dropdown-item [data-lucide], .dropdown-item .bi { width: 14px; height: 14px; color: var(--fg-4); }
.dropdown-header { font-size: .625rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-5); padding: 8px 10px 4px; }
.dropdown-divider { border-color: var(--border-1); margin: 4px 0; }

/* ---------- Key-value pairs (file details) ---------- */
.tl-kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; font-size: var(--fs-12); }
.tl-kv dt { color: var(--fg-5); font-weight: 400; }
.tl-kv dd {
  margin: 0;
  color: var(--fg-1);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.tl-kv dd.text { font-family: var(--font-sans); letter-spacing: 0; }

/* ---------- Wizard stepper ---------- */
.tl-wizard {
  display: flex;
  align-items: center;
  padding: 14px 0 24px;
}
.tl-wizard__step { display: flex; align-items: center; gap: 10px; }
.tl-wizard__num {
  width: 1.625rem;
  height: 1.625rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 600;
  background: #fff;
  border: 1px solid var(--border-strong);
  color: var(--fg-5);
  flex-shrink: 0;
}
.tl-wizard__step--current .tl-wizard__num { background: var(--tl-accent-500); color: #fff; border-color: var(--tl-accent-500); }
.tl-wizard__step--done .tl-wizard__num { background: var(--tl-success-600); color: #fff; border-color: var(--tl-success-600); }
.tl-wizard__label { font-size: .8125rem; font-weight: 500; color: var(--fg-5); }
.tl-wizard__step--current .tl-wizard__label { color: var(--fg-1); font-weight: 600; }
.tl-wizard__step--done .tl-wizard__label { color: var(--fg-2); }
.tl-wizard__bar { flex: 1; height: 1px; background: var(--border-2); margin: 0 12px; }
.tl-wizard__bar--done { background: var(--tl-success-600); }
/* Phone width: only the current step keeps its label, so a three-step bar fits 320px
   at any text size (#258) — the numbers still show where the user is. */
@media (max-width: 575.98px) {
  .tl-wizard__step:not(.tl-wizard__step--current) .tl-wizard__label { display: none; }
  .tl-wizard__bar { margin: 0 var(--sp-3); min-width: var(--sp-4); }
}

/* ---------- Recording widget ---------- */
.tl-rec-bars { display: flex; gap: 4px; margin-bottom: 4px; }
.tl-rec-bar {
  flex: 1;
  height: 6px;
  background: var(--border-1);
  border-radius: 3px;
  transition: background var(--dur-base);
}
.tl-rec-bar--recorded { background: var(--tl-success-600); }
.tl-rec-bar--sent     { background: var(--tl-warn-500); }

/* ---------- Inline "New Client" popover (order wizard step 1) ---------- */
/* Hosted by the last column of the Transaction Details row, so it is anchored to
   its right edge and grows leftward — a left-anchored popover this wide overhangs
   the card and forces a horizontal scroll (#59). Below md the columns stack and
   the popover would outgrow the viewport, so it drops back into normal flow. */
.tl-client-popover {
  position: absolute;
  z-index: 1045;
  right: 0;
  width: min(560px, 90vw);
}
@media (max-width: 767.98px) {
  .tl-client-popover { position: static; width: auto; }
}

/* ---------- Contact search results (order forms, Add Party; #291) ---------- */
/* Each result is several lines (name, company, address, email — window.tlContactResult), so
   the list takes the width of its column and wraps — a content-sized absolute list ran past
   the viewport. Client search and Contacts search (attorneys, lender) alike. */
.tl-client-results {
  position: absolute;
  z-index: 1050;
  top: 0;
  left: 0;
  right: 0;
  max-height: 22rem;
  overflow-y: auto;
  box-shadow: var(--elev-popover);
}
.tl-client-result { overflow-wrap: anywhere; line-height: 1.3; }

/* ---------- Sortable items ---------- */
.tl-sortable {
  display: grid;
  grid-template-columns: 24px 36px 1fr auto auto;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-1);
  background: #fff;
  border-radius: var(--r-3);
  align-items: center;
  cursor: grab;
}
.tl-sortable:hover { border-color: var(--border-strong); }
.tl-sortable__grip { color: var(--fg-5); }
.tl-sortable__num { font-family: var(--font-mono); font-size: .75rem; color: var(--fg-5); }

/* ---------- Utility classes ---------- */
.tl-mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.tl-eyebrow {
  font-size: .625rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-4);
}
.tl-divider { height: 1px; background: var(--border-1); }
.tl-muted { color: var(--fg-4); }
.tl-num-right { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* Grid helpers */
.tl-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tl-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.tl-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.tl-grid-main { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: flex-start; }

/* ---------- Links ---------- */
a { color: var(--fg-link); text-decoration: none; transition: color var(--dur-fast); }
a:hover { color: var(--tl-brand-700); }
a.tl-link { border-bottom: 1px solid transparent; transition: border-color var(--dur-fast); }
a.tl-link:hover { border-bottom-color: currentColor; }

/* ---------- DataTables overrides ---------- */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter { margin-bottom: 10px; font-size: var(--fs-12); }
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
  border: 1px solid var(--border-2);
  border-radius: var(--r-2);
  font-size: var(--fs-12);
  padding: 4px 8px;
  height: 1.75rem;
  font-family: var(--font-sans);
}
.dataTables_wrapper .dataTables_filter input:focus {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus-ring);
  outline: none;
}
.dataTables_wrapper .dataTables_info { font-size: var(--fs-12); color: var(--fg-5); }
.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: var(--r-2) !important;
  font-size: var(--fs-12);
  font-weight: 500;
  border: 1px solid var(--border-1) !important;
  color: var(--fg-2) !important;
  padding: 3px 8px !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--tl-brand-600) !important;
  border-color: var(--tl-brand-600) !important;
  color: #fff !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--bg-sunken) !important;
  border-color: var(--border-strong) !important;
  color: var(--fg-1) !important;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--tl-ink-200); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--tl-ink-300); }

/* ---------- Focus / accessibility ---------- */
:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
/* Form controls show focus via their own border/ring (see .form-control:focus);
   buttons keep the global tokenized :focus-visible outline for keyboard a11y. */
.form-control:focus-visible, .form-select:focus-visible { outline: none; }

/* ---------- Small viewport warning ---------- */
/* Off-canvas sidebar (issue #40): below the lg breakpoint the sidebar slides
   in over the content instead of vanishing. The topbar toggle opens it; the
   backdrop, a nav click, or Escape closes it. */
.tl-sidebar-backdrop { display: none; }

@media (max-width: 991.98px) {
  .tl-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1045;
    transform: translateX(-100%);
    transition: transform var(--dur-slow) var(--ease-standard);
  }
  .tl-shell--sidebar-open .tl-sidebar {
    transform: translateX(0);
    box-shadow: 0 8px 30px rgba(3, 12, 25, .45);
  }
  .tl-shell--sidebar-open .tl-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1040;
    background: rgba(3, 12, 25, .55);
  }
}

/* ---------- Print ---------- */
@media print {
  .tl-sidebar, .tl-topbar { display: none !important; }
  .tl-shell { display: block; }
  .tl-content { overflow: visible; height: auto; }
}

/* ---------- PublicWebsite ----------
   The marketing surface inverts the operator shell's white background to
   --tl-brand-900 in the footer only (DESIGN.md PublicWebsite Variant). */
.tl-public-footer { background: var(--tl-shell-bg); }

/* ---------- Chip primitive ----------
   Repeated inline pattern across AbstractAnalysis surfaces:
   style="background:var(--tl-brand-100);color:var(--tl-brand-700);
   font-size:12px;padding:1px 6px;border-radius:4px". Extracted so templates
   can drop the inline drift in favor of <span class="tl-chip tl-chip--brand">. */
.tl-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: var(--r-2);
  font-size: var(--fs-12);
  font-weight: 500;
  line-height: 1.5;
}
.tl-chip--brand   { background: var(--tl-brand-100);   color: var(--tl-brand-700); }
.tl-chip--ink     { background: var(--tl-ink-100);     color: var(--tl-ink-800); }
.tl-chip--success { background: var(--tl-success-100); color: var(--tl-success-700); }
.tl-chip--warn    { background: var(--tl-warn-100);    color: var(--tl-warn-700); }
.tl-chip--danger  { background: var(--tl-danger-100);  color: var(--tl-danger-700); }
.tl-chip--info    { background: var(--tl-info-100);    color: var(--tl-info-700); }

/* Deep-link arrival highlight: flash a row/card targeted by a #fragment
   (e.g. Missing Info dashboard "Upload" / "Post-Closing" deep-links). */
.list-group-item:target,
.tl-tx-row:target,
#recordingChecklist:target {
  animation: tl-flash 1.6s ease-out 1;
}
@keyframes tl-flash {
  from { background: var(--tl-warn-50); }
  to   { background: transparent; }
}

/* Clickable address (opens the Google Maps popup). */
.tl-address-link { cursor: pointer; }

/* Address columns are capped (#105). A long street line otherwise grows the
   column to its max-content width and the auto table layout pays for it by
   wrapping the short neighbours — File Number and Ordered Date split onto two
   lines. inline-block caps the cell's max-content contribution, so the street
   wraps inside its own cell and the rest of the row keeps one line. The :has()
   rule covers the "city, ST ZIP" sub-line rendered under the link. The floor
   keeps the column readable when a wide table is squeezed — .table-responsive
   scrolls instead of shredding the street into six lines.
   Pair with .col-mono / .col-date on the code and date columns of the table. */
.table td:has(.tl-address-link) {
  min-width: var(--tl-col-address-min, 12rem);
  max-width: var(--tl-col-address, 18rem);
}
.table .tl-address-link {
  display: inline-block;
  max-width: var(--tl-col-address, 18rem);
}

/* Stat strip — segmented summary counters (Missing Info dashboard).
   One quiet surface, hairline dividers via 1px grid gap over the border color.
   Color is signal: a count is tinted only when it is non-zero. */
.tl-stat-strip {
  /* Tiles reflow to fit the CONTAINER, not the viewport. The messages drawer takes
     380px off .tl-main without changing the viewport, so a viewport media query never
     fired: the 7-up dashboard strip kept seven columns in ~780px, overflowed its own
     overflow:hidden, and the right-hand tiles were clipped with no scrollbar to
     recover them (#96). Wrapping flex instead of grid, because a wrapped grid row
     keeps the parent's track widths: the two orphans of a 7-tile strip would sit in
     the first two tracks and leave the rest of the row as a bare block of the divider
     colour. Flex items stretch to fill whatever row they land on.
     --tl-stat-min is the flex basis and the floor: keep it wider than the longest
     single word in a label plus the tile padding (currently "Construction" at 116px
     + 32px), or a word that cannot wrap clips against overflow: hidden. */
  display: flex;
  flex-wrap: wrap;
  /* Figma (#171): separate frosted tiles with a gap, not one segmented surface. */
  gap: var(--sp-6);
}
.tl-stat {
  /* One equal share of its row, never narrower than the floor (see .tl-stat-strip);
     min-width: 0 lets a long label wrap rather than widening the tile past its share. */
  flex: 1 1 var(--tl-stat-min, 9.5rem);
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  min-height: 2.875rem;
  background: rgba(255,255,255,.6);
  border-radius: var(--r-4);
  box-shadow: var(--elev-card);
  padding: var(--sp-4) var(--sp-7);
  text-decoration: none;
  transition: background var(--dur-instant) var(--ease-standard), box-shadow var(--dur-fast) var(--ease-standard);
}
a.tl-stat:hover { background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.16); }
.tl-stat__label {
  flex: 1 1 auto;
  min-width: 0;
  font-size: var(--fs-14);
  font-weight: 600;
  color: var(--fg-4);
  /* Deliberately wrapping: nowrap made each tile's min-content width the full label,
     which is what pushed the strip past its container in the first place (#96). */
}
.tl-stat__value {
  font-family: var(--font-display);
  font-size: var(--fs-18);
  font-weight: 600;
  letter-spacing: -0.1px;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
  color: var(--fg-1);
  text-align: right;
  flex-shrink: 0;
}
.tl-stat__icon {
  font-size: var(--fs-18);
  color: var(--tl-brand-600);
  flex-shrink: 0;
  line-height: 1;
}
.tl-stat__hint {
  font-size: var(--fs-11);
  color: var(--fg-4);
  margin-top: var(--sp-2);
  line-height: 1.3;
}
.tl-stat--zero .tl-stat__value { color: var(--tl-ink-300); }
.tl-stat--warning .tl-stat__value { color: var(--tl-warn-600); }
.tl-stat--danger .tl-stat__value { color: var(--tl-danger-600); }
/* Larger variant (dashboard billboards, issue #10): label and count both bumped
   up, count stays the dominant figure. Scoped so the Missing Info strip is unaffected. */
.tl-stat-strip--lg { --tl-stat-min: 17rem; }
/* Segmented variant (Missing Info in the Figma, #171): one bordered surface, figure on
   top of its label, figures in body ink — the cards below carry the urgency. */
.tl-stat-strip--segmented { gap: 0; border: 1px solid var(--tl-ink-300); border-radius: var(--r-4); background: #fff; overflow: hidden; }
.tl-stat-strip--segmented .tl-stat { flex-direction: column; align-items: flex-start; gap: 0; min-height: 0; padding: var(--sp-4) var(--sp-6); border-radius: 0; box-shadow: none; background: #fff; border-right: 1px solid var(--tl-ink-300); }
.tl-stat-strip--segmented .tl-stat:last-child { border-right: 0; }
.tl-stat-strip--segmented a.tl-stat:hover { background: var(--tl-ink-50); box-shadow: none; }
.tl-stat-strip--segmented .tl-stat__value { order: -1; text-align: left; font-size: var(--fs-20); color: var(--fg-1); }
.tl-stat-strip--segmented .tl-stat__label { font-size: var(--fs-11); font-weight: 400; color: var(--fg-4); }
/* The open section (Missing Info shows one list at a time, #234): a tinted tile with a
   brand underline, label in body ink — the tile is the section's tab. */
.tl-stat-strip--segmented .tl-stat--active,
.tl-stat-strip--segmented a.tl-stat--active:hover { background: var(--tl-ink-50); box-shadow: inset 0 -3px 0 var(--tl-brand-600); }
.tl-stat-strip--segmented .tl-stat--active .tl-stat__label { color: var(--fg-1); font-weight: 600; }
/* Missing Info's eight tiles in one row (#332, owner 2026-11-26): a lower floor and tighter
   padding so all eight share one row on a desktop; where they do not fit they wrap as any
   strip does (flex-wrap stays). The floor still clears the longest label word ("Recordings",
   "Contracts") at 120 % text size — rem, so it grows with the root. */
.tl-stat-strip--one-row { --tl-stat-min: 6.75rem; }
.tl-stat-strip--one-row.tl-stat-strip--segmented .tl-stat { padding: var(--sp-4) var(--sp-5); }
.tl-stat-strip--lg .tl-stat { min-height: 5rem; }
.tl-stat-strip--lg .tl-stat__label { font-family: var(--font-display); font-size: var(--fs-18); font-weight: 500; letter-spacing: -0.1px; }
.tl-stat-strip--lg .tl-stat__value { font-size: var(--fs-24); }
.tl-stat-strip--lg .tl-stat__icon { font-size: 1.75rem; }
/* Figma illustration icons on the big dashboard tiles (#171 round 4) — the same set as
   public/images/icons/ uses for card and page titles. */
.tl-stat__icon--img { width: 32px; height: 32px; object-fit: contain; }
.tl-stat-strip--lg .tl-stat__icon--img { width: 44px; height: 44px; }
/* In-page targets of KPI tiles (My Queue): clear the sticky top bar when scrolled to. */
.tl-dash-anchor { scroll-margin-top: 64px; }
/* A chart card's state + period switches (#200): right of the title, and under it when the
   header is too narrow for both — never pushed past the card edge. */
.tl-chart-controls { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: var(--sp-3); margin-left: auto; }
.card-header:has(> .tl-chart-controls) { flex-wrap: wrap; }
/* Stacked column (dashboard, #171 round 3 — the Figma's two tile columns): one tile per
   row. Compact = the Figma's small tiles under the big ones: label + figure, no icon. */
.tl-stat-strip--stack { flex-direction: column; flex-wrap: nowrap; gap: var(--sp-5); }
.tl-stat-strip--stack .tl-stat { flex: 0 0 auto; }
.tl-stat-strip--compact .tl-stat { min-height: 2.875rem; padding: var(--sp-3) var(--sp-7); }
.tl-stat-strip--compact .tl-stat__icon { display: none; }
.tl-stat-strip--compact .tl-stat__label { font-size: var(--fs-14); font-weight: 600; color: var(--fg-2); }
.tl-stat-strip--compact .tl-stat__value { font-size: var(--fs-20); }
/* Needs Attention, the third column: as tall as the two tile columns beside it, the list
   scrolling inside — it must not stretch the row (it can hold a hundred files). */
.tl-dash-kpis .tl-dash-attention .card-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.tl-dash-kpis .col-lg-4:has(> .tl-dash-attention) { position: relative; }
@media (min-width: 992px) {
  .tl-dash-kpis .tl-dash-attention {
    position: absolute;
    inset: 0 calc(var(--bs-gutter-x) * .5);
  }
}
@media (max-width: 991.98px) {
  .tl-dash-kpis .tl-dash-attention { max-height: 32rem; }
}
/* Needs Attention header (#318): the title may take a line of its own, but the state switch,
   the type filter and the count stay on one line (owner 2026-11-23) — the type filter has a
   fixed rem width and shrinks before anything wraps (its long option names show in the open
   list; the closed select cuts its text). Never wider than the screen, at 120 % text too.
   A row's text column may shrink so its address truncates. */
.tl-attention-head { flex-wrap: wrap; gap: var(--sp-3); }
.tl-attention-head__controls { display: flex; flex-wrap: nowrap; align-items: center; gap: var(--sp-3); min-width: 0; max-width: 100%; }
.tl-attention-head__controls .form-select { flex: 0 0 auto; min-width: 0; max-width: 100%; }
.tl-attention-head__controls .form-select.tl-attention-type { flex: 0 1 12rem; width: 12rem; min-width: 5rem; text-overflow: ellipsis; }
.tl-attention-head__controls > .badge, .tl-attention-head__controls > .tl-count-pill { flex: 0 0 auto; }
.tl-attention-row__body { min-width: 0; }
/* The full Needs Attention page (#318, owner 2026-11-23): File number | Address | Reason | Date.
   The list look of /files (.tl-table-zebra). Below md every row reads as a block — the file
   number first, each other cell under its column name — so a phone never scrolls sideways;
   the zebra moves from the cells to the row there. */
.tl-attention-table td { overflow-wrap: anywhere; vertical-align: top; }
.tl-attention-table td .badge { white-space: normal; }
@media (max-width: 767.98px) {
  .tl-attention-table thead { display: none; }
  .tl-attention-table, .tl-attention-table tbody { display: block; width: 100%; }
  .tl-attention-table tr { display: block; padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--tl-ink-300); }
  .tl-attention-table tr:last-child { border-bottom: 0; }
  .table.tl-table-zebra.tl-attention-table > tbody > tr > td { display: block; height: auto; border: 0; box-shadow: none; padding: 0 0 var(--sp-2); background: transparent; }
  .table.tl-table-zebra.tl-attention-table > tbody > tr:nth-child(even) { background: #F5F5F5; }
  .tl-attention-table td[data-label]:not(.tl-attention-table__file)::before {
    content: attr(data-label);
    display: block;
    font-size: var(--fs-12);
    color: var(--fg-3);
  }
}
/* No viewport breakpoints here on purpose — auto-fit already covers narrow
   viewports, and a media-query override would defeat the container-driven reflow
   exactly when the drawer is open on a wide screen (#96). */

/* Card title with illustration (Figma #171) — _partials/_card_title.html.twig. Beats the
   generic quiet .card-header h* label: these cards are the page's main blocks. */
.card-header .tl-card-title, .tl-card-title {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-size: var(--fs-18); font-weight: 600;
  color: var(--fg-4); letter-spacing: -0.1px;
}
.tl-card-title img { width: 28px; height: 28px; object-fit: contain; flex-shrink: 0; }
/* Blue section heading inside a long page ("Overview", "Documentation"… in the Figma). */
.tl-section-title { font-family: var(--font-display); font-size: var(--fs-24); font-weight: 600; color: var(--tl-brand-600); margin: 0 0 var(--sp-6); }

/* Page header (#171) — _partials/_page_head.html.twig */
.tl-page-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-6); flex-wrap: wrap; margin-bottom: var(--sp-8); }
.tl-page-head__title { display: flex; align-items: center; gap: var(--sp-6); min-width: 0; }
.tl-page-head__icon { width: 40px; height: 40px; object-fit: contain; flex-shrink: 0; }
.tl-page-head h4 { font-family: var(--font-display); font-weight: 500; font-size: var(--fs-24); color: #000; }
.tl-page-head__actions { display: flex; align-items: center; gap: var(--sp-8); flex-wrap: wrap; }

/* The Figma's big page panel: one white card holding a page's search + list (#171). */
.tl-panel { background: #fff; border-radius: var(--r-4); box-shadow: 0 2px 8px rgba(0,0,0,.25); padding: var(--sp-7) var(--sp-9) var(--sp-9); }
.tl-panel__title { font-family: var(--font-display); font-weight: 500; font-size: var(--fs-18); color: var(--fg-4); letter-spacing: -0.1px; margin: 0; }
.tl-panel__divider { border: 0; border-top: 1px solid var(--tl-ink-200); margin: var(--sp-9) 0 var(--sp-7); opacity: 1; }
.tl-count-pill { display: inline-flex; align-items: center; height: 1.5rem; padding: 0 8px; border-radius: var(--r-pill); background: var(--tl-brand-600); color: #fff; font-size: var(--fs-14); }
.tl-letter-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 1.5625rem; height: 1.125rem; padding: 0 6px; border-radius: var(--r-pill); background: var(--tl-ink-150); color: var(--fg-1); font-size: var(--fs-12); }
.tl-search-input { position: relative; }
.tl-search-input .bi { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--fg-1); pointer-events: none; }
.tl-search-input--wide { max-width: 520px; }
/* /files County + Underwriter dropdowns (#244): a steady width, never wider than the row. */
.tl-filter-select { min-width: 12rem; max-width: 100%; }
.tl-filter-select .form-select { max-width: 100%; }
.tl-search-input .form-control { height: 2.5rem; padding-left: 44px; background: #F5F5F5; border-color: var(--tl-ink-300); font-size: var(--fs-16); }

/* Contract upload (Figma "Desktop_Upload contract", #171). */
.tl-upload-title { font-family: var(--font-display); font-weight: 500; font-size: var(--fs-18); color: var(--fg-1); margin-bottom: var(--sp-3); }
.tl-upload-copy { font-size: var(--fs-14); color: var(--fg-4); }
.tl-upload-copy ul { padding-left: 1.25rem; margin: 0; }
.tl-dropzone { display: flex; flex-direction: column; gap: var(--sp-4); min-height: 14.75rem; padding: var(--sp-5); border: 1px solid var(--tl-ink-300); border-radius: var(--r-4); }
.tl-dropzone__chip { display: flex; align-items: center; gap: var(--sp-4); height: 2.5rem; padding: 0 var(--sp-6); border-radius: var(--r-2); background: var(--tl-ink-150); font-size: var(--fs-14); }
.tl-dropzone__chip[hidden] { display: none; }
.tl-dropzone__drop { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-3); border-radius: var(--r-3); text-align: center; }
.tl-dropzone__cta { font-size: var(--fs-14); font-weight: 600; color: var(--fg-1); display: inline-flex; gap: var(--sp-4); align-items: center; }
.tl-dropzone__cta .bi { font-size: 1.125rem; }
.tl-dropzone__hint { font-size: var(--fs-12); color: var(--fg-4); }

/* Page greeting (dashboard header, Figma #171): icon + Poppins title + quiet subtitle. */
.tl-page-greeting { display: flex; align-items: center; gap: var(--sp-6); }
.tl-page-greeting__icon { font-size: 2rem; color: var(--tl-brand-600); line-height: 1; }
.tl-page-greeting h3 { font-size: var(--fs-24); font-weight: 500; color: #000; }
.tl-page-greeting__sub { font-size: var(--fs-14); color: var(--fg-1); margin-top: 2px; }

/* ---------- Messages drawer ---------- */
.tl-msg-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tl-danger-500);
  border: 1px solid var(--tl-ink-0);
}

/* The messages panel is a docked sidebar, not a modal (issue #47): it must not
   dim or block the page, and it must not close on an outside click — so the
   scrim stays inert on desktop. On phones the panel is full-width and there is
   nothing to work alongside, so a tap-catching scrim is still shown there. */
.tl-msg-scrim {
  position: fixed;
  inset: 0;
  background: rgba(10, 13, 18, .32);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-standard);
  z-index: 1200;
}
@media (max-width: 575px) {
  .tl-msg-scrim--visible { opacity: 1; pointer-events: auto; }
}

/* Docked mode: reclaim space on the right so the page content shrinks beside
   the panel instead of being covered — lets you work a file and message at the
   same time. Below 576px the panel is full-width, so it overlays instead.
   Width is the user's own choice in sidebar mode (#182): `--tl-msg-w`, set by the
   resize handle, 350–450 px. `.tl-shell--msg-open` is only set in sidebar mode —
   the popup floats over the page and takes no room from it. */
@media (min-width: 576px) {
  .tl-shell--msg-open .tl-main { margin-right: var(--tl-msg-w, 350px); }
}
/* No margin animation while dragging the edge — the page must track the pointer. */
.tl-shell--msg-resizing .tl-main { transition: none; }

.tl-msg-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--tl-msg-w, 350px);
  max-width: 100%;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-2);
  box-shadow: var(--elev-4);
  z-index: 1201;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--dur-base) var(--ease-standard);
}
.tl-msg-drawer--open { transform: translateX(0); }

/* Sidebar resize handle: a thin grab strip over the left border (#182). */
.tl-msg-drawer__resize {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -3px;
  width: 6px;
  cursor: col-resize;
  z-index: 1;
  touch-action: none;
}
.tl-msg-drawer__resize:hover,
.tl-msg-drawer__resize:focus-visible,
.tl-msg-drawer--resizing .tl-msg-drawer__resize {
  background: var(--tl-brand-500);
  outline: none;
}
.tl-msg-drawer--resizing { user-select: none; }

/* Popup mode (#182, the default): a 350×600 window under the topbar at the top
   right. No scrim, no docking — the page stays usable beside and below it. */
.tl-msg-drawer--popup {
  top: calc(var(--topbar-h) + var(--sp-4));
  right: var(--sp-6);
  bottom: auto;
  width: 350px;
  height: 600px;
  max-height: calc(100vh - var(--topbar-h) - var(--sp-8));
  border: 1px solid var(--border-1);
  border-radius: var(--r-4);
  box-shadow: var(--elev-popover);
  overflow: hidden;
  transform: translateY(calc(-1 * var(--sp-4)));
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-base) var(--ease-standard), transform var(--dur-base) var(--ease-standard), visibility 0s linear var(--dur-base);
}
.tl-msg-drawer--popup.tl-msg-drawer--open {
  transform: none;
  opacity: 1;
  visibility: visible;
  transition: opacity var(--dur-base) var(--ease-standard), transform var(--dur-base) var(--ease-standard), visibility 0s;
}
.tl-msg-drawer--popup .tl-msg-drawer__resize { display: none; }
/* Collapsed to a strip: only the current view's header stays. */
.tl-msg-drawer--popup.tl-msg-drawer--collapsed { height: auto; }
.tl-msg-drawer--popup.tl-msg-drawer--collapsed .tl-msg-view > :not(.tl-msg-drawer__header) { display: none !important; }
.tl-msg-drawer--popup.tl-msg-drawer--collapsed .tl-msg-drawer__header { border-bottom: 0; cursor: pointer; }
.tl-msg-drawer--popup.tl-msg-drawer--collapsed #tl-msg-new-btn { display: none; }
/* Unread count on the collapsed strip (#182): only there — expanded, the list
   already shows per-conversation counts. `d-none` (count 0) still wins. */
.tl-msg-strip-badge {
  display: none;
  min-width: 1.25rem;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--tl-danger-500);
  color: var(--tl-ink-0);
  font-family: var(--font-mono);
  font-size: var(--fs-11);
  font-weight: 600;
  line-height: 1rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.tl-msg-drawer--popup.tl-msg-drawer--collapsed .tl-msg-strip-badge { display: inline-block; }

/* Header controls show the icon for the state a click switches to. */
.tl-msg-when-expanded, .tl-msg-when-popup { display: contents; }
.tl-msg-when-collapsed, .tl-msg-when-sidebar { display: none; }
.tl-msg-drawer--collapsed .tl-msg-when-expanded { display: none; }
.tl-msg-drawer--collapsed .tl-msg-when-collapsed { display: contents; }
.tl-msg-drawer:not(.tl-msg-drawer--popup) .tl-msg-when-popup { display: none; }
.tl-msg-drawer:not(.tl-msg-drawer--popup) .tl-msg-when-sidebar { display: contents; }
.tl-msg-drawer:not(.tl-msg-drawer--popup) .tl-msg-collapse-btn { display: none; }

/* Layers above the Messages drawer (scrim 1200, drawer 1201). Bootstrap puts modals at 1055,
   so with the drawer open every dialog in the app sat underneath it and its buttons could not
   be clicked (#166). A dialog is the thing being asked for, so it goes on top — and the
   tooltips, popovers and toasts that can open inside one go above it, keeping Bootstrap's
   own order. */
.modal-backdrop { --bs-backdrop-zindex: 1210; }
.modal { --bs-modal-zindex: 1215; }
.popover { --bs-popover-zindex: 1220; }
.tooltip { --bs-tooltip-zindex: 1225; }
.toast-container { z-index: 1230; }

.tl-msg-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.tl-msg-drawer__header {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border-1);
  flex-shrink: 0;
}
.tl-msg-drawer__title { flex: 1; min-width: 0; font-family: var(--font-display); font-weight: 500; font-size: var(--fs-18); color: var(--fg-4); }
.tl-msg-drawer__header-actions { display: flex; align-items: center; gap: var(--sp-3); flex-shrink: 0; }

.tl-msg-drawer__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.tl-msg-loading {
  padding: var(--sp-8) var(--sp-6);
  text-align: center;
  color: var(--fg-4);
  font-size: var(--fs-13);
}

/* Conversation list rows (rendered by _drawer_list.html.twig) */
/* Conversation tiles (Figma "Messages", #171): grey rounded tiles with a gap, preview in
   body ink, bold while unread. */
#tl-msg-list .list-group { gap: var(--sp-4); padding: var(--sp-6); }
#tl-msg-list .list-group-item {
  border: 0;
  border-radius: var(--r-4);
  background: #F5F5F5;
  padding: var(--sp-4) var(--sp-4) var(--sp-5);
  cursor: pointer;
}
#tl-msg-list .list-group-item:hover { background: var(--tl-ink-150); }
#tl-msg-list .list-group-item strong { font-weight: 700; font-size: var(--fs-14); color: var(--fg-1); }
#tl-msg-list .tl-msg-preview { font-size: var(--fs-14); color: var(--fg-1); max-width: 20rem; margin-top: var(--sp-2); }
#tl-msg-list .tl-msg-unread .tl-msg-preview { font-weight: 600; }
#tl-msg-list .tl-msg-resolved { margin-top: var(--sp-2); } /* under the time (#231) */

/* Thread body (rendered by _drawer_thread.html.twig) */
.drawer-thread { display: flex; flex-direction: column; height: 100%; min-height: 0; padding: var(--sp-5) var(--sp-6); }
.drawer-thread-header { flex-shrink: 0; }
.drawer-thread-messages { flex: 1; overflow-y: auto; min-height: 0; }
/* Add people / Leave confirm under the chat window's thread header (#286) */
.tl-msg-inline-panel {
  flex-shrink: 0;
  margin-bottom: var(--sp-4);
  padding: var(--sp-4);
  border: 1px solid var(--border-1);
  border-radius: var(--r-3);
  background: var(--bg-row-stripe);
  font-size: var(--fs-13);
}
.tl-msg-inline-panel__list { max-height: 11rem; background: var(--bg-surface); }
/* System lines in a thread (#286): "X added Y", "X renamed the chat to …" — centred, muted,
   no bubble. Thread page and chat window alike (messaging/_message.html.twig). */
.tl-msg-system {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 0 var(--sp-3);
  margin: var(--sp-4) auto;
  max-width: 90%;
  text-align: center;
  font-size: var(--fs-12);
  color: var(--fg-3);
  overflow-wrap: anywhere;
}
.tl-msg-system__time { white-space: nowrap; }
/* Thread page header title block: grows, shrinks, wraps above the actions on a phone (#286). */
.tl-msg-thread-head__title { flex: 1 1 12rem; min-width: 0; }
/* The chat's "⋯" menu (#286): Resolve keeps the Resolved pill's green on its icon (the text colour
   of .badge-status-scheduled, i.e. the success-600 token — never a literal hex, #321), Leave reads red. */
.tl-msg-menu { flex-shrink: 0; }
.tl-msg-menu .dropdown-item.tl-msg-menu__resolve .bi { color: var(--tl-success-600); }
.tl-msg-menu .dropdown-item.text-danger .bi { color: inherit; }

.tl-msg-attach-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.tl-msg-attach-thumb {
  max-height: 120px;
  max-width: 100%;
  border-radius: var(--r-3);
  border: 1px solid var(--border-1);
  display: block;
}
.tl-msg-attach-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-pill);
  background: var(--bg-sunken);
  border: 1px solid var(--border-1);
  font-size: var(--fs-12);
  color: var(--fg-2);
  text-decoration: none;
}
.tl-msg-attach-chip:hover { background: var(--bg-row-hover); color: var(--fg-1); }

.tl-msg-attach-preview {
  padding: var(--sp-3) var(--sp-6);
  border-top: 1px solid var(--border-1);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  flex-shrink: 0;
}

.tl-msg-composer {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--border-1);
  flex-shrink: 0;
}
.tl-msg-attach-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--r-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-3);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard);
}
.tl-msg-attach-btn:hover { background: var(--bg-sunken); color: var(--fg-1); }
.tl-msg-composer__input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border-2);
  border-radius: var(--r-pill);
  padding: var(--sp-3) var(--sp-5);
  font-size: var(--fs-13);
  color: var(--fg-1);
  background: var(--bg-surface);
}
.tl-msg-composer__input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus-ring);
}
.tl-msg-send-btn { flex-shrink: 0; color: var(--tl-brand-500); }

/* ── Tilo, the staff assistant (#304): assistant/_panel.html.twig on /tilo and in the chat window.
   One column — the lines scroll, the question box stays at the bottom. Every text size is a
   --fs token (rem) so it follows the personal text size; nothing is wider than its box. ── */
.tl-tilo { display: flex; flex-direction: column; min-height: 0; min-width: 0; height: 100%; }
.tl-tilo-card { overflow: hidden; }
.tl-tilo-card .tl-tilo { height: 70vh; height: 70dvh; min-height: 22rem; }
.tl-msg-drawer__body--tilo { display: flex; flex-direction: column; overflow: hidden; }
.tl-tilo__lines {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: var(--sp-5) var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}
.tl-tilo-intro {
  padding: var(--sp-4);
  border: 1px solid var(--border-1);
  border-radius: var(--r-3);
  background: var(--bg-row-stripe);
  font-size: var(--fs-13);
  color: var(--fg-2);
}
.tl-tilo-line { display: flex; justify-content: flex-start; min-width: 0; }
.tl-tilo-line--mine { justify-content: flex-end; }
.tl-tilo-bubble {
  max-width: 90%;
  min-width: 0;
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border-1);
  border-radius: var(--r-3);
  background: var(--bg-surface);
  color: var(--fg-1);
  font-size: var(--fs-14);
  overflow-wrap: anywhere;
}
.tl-tilo-bubble--mine { background: var(--tl-brand-500); border-color: var(--tl-brand-500); color: #fff; }
.tl-tilo-bubble--failed { border-color: var(--border-2); background: var(--bg-row-stripe); color: var(--fg-2); }
.tl-tilo-pending .tl-tilo-bubble { color: var(--fg-3); font-style: italic; }
.tl-tilo-bubble__name { font-size: var(--fs-12); font-weight: 600; color: var(--fg-2); margin-bottom: var(--sp-2); }
.tl-tilo-bubble__time { font-size: var(--fs-11); color: var(--fg-3); }
.tl-tilo-bubble--mine .tl-tilo-bubble__time { color: rgba(255, 255, 255, .7); display: block; margin-top: var(--sp-2); }
.tl-tilo-answer > :last-child { margin-bottom: 0; }
.tl-tilo-answer p, .tl-tilo-answer ul, .tl-tilo-answer ol { margin-bottom: var(--sp-3); }
.tl-tilo-answer ul, .tl-tilo-answer ol { padding-left: 1.25rem; }
.tl-tilo-answer table { display: block; max-width: 100%; overflow-x: auto; font-size: var(--fs-12); }
.tl-tilo-answer pre, .tl-tilo-answer code { white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--fs-12); }
.tl-tilo-sources {
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border-1);
  font-size: var(--fs-12);
  color: var(--fg-2);
}
.tl-tilo-sources__label { display: block; font-weight: 600; color: var(--fg-3); margin-bottom: var(--sp-1); }
.tl-tilo-sources li + li { margin-top: var(--sp-1); }
.tl-tilo-bubble__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-top: var(--sp-3); }
.tl-tilo-rate { display: inline-flex; gap: var(--sp-1); }
.tl-tilo-rate .tl-icon-btn { width: 1.75rem; height: 1.75rem; }
.tl-tilo-rate .tl-icon-btn.is-active { color: var(--tl-brand-500); background: var(--bg-sunken); }
.tl-tilo-comment { margin-top: var(--sp-3); }
.tl-tilo-status { margin-top: var(--sp-2); }
.tl-tilo__composer {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--border-1);
  flex-shrink: 0;
  background: var(--bg-surface);
}
.tl-tilo__input {
  flex: 1 1 auto;
  min-width: 0;
  resize: none;
  border: 1px solid var(--border-2);
  border-radius: var(--r-3);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-14); /* 16px+ would stop iOS zooming; 14px is the app's body size */
  line-height: 1.4;
  color: var(--fg-1);
  background: var(--bg-surface);
  max-height: 10rem;
}
.tl-tilo__input:focus { outline: none; border-color: var(--border-focus); box-shadow: var(--shadow-focus-ring); }
.tl-tilo-row { background: var(--bg-row-stripe); }
.tl-tilo-row__body { min-width: 0; }
@media (max-width: 575.98px) {
  .tl-tilo__lines { padding: var(--sp-4); }
  .tl-tilo__composer { padding: var(--sp-3) var(--sp-4); }
  .tl-tilo-bubble { max-width: 100%; }
}
.tl-msg-send-btn:hover { background: var(--bg-sunken); color: var(--tl-brand-600); }

/* Participant list under a conversation title (#231): the title is a <details>
   summary with an (i); the list opens as a popover-style card below it. */
.tl-msg-participants { position: relative; min-width: 0; }
.tl-msg-participants__summary {
  display: flex; align-items: center; gap: var(--sp-2);
  list-style: none; cursor: pointer; min-width: 0; color: var(--fg-1);
}
.tl-msg-participants__summary::-webkit-details-marker { display: none; }
.tl-msg-participants__summary:hover [data-thread-title] { text-decoration: underline; }
.tl-msg-participants__summary:focus-visible { outline: none; box-shadow: var(--shadow-focus-ring); border-radius: var(--r-2); }
.tl-msg-participants__icon { flex-shrink: 0; font-size: var(--fs-13); color: var(--fg-4); }
.tl-msg-participants[open] .tl-msg-participants__icon { color: var(--tl-brand-600); }
.tl-msg-participants__panel {
  position: absolute; top: calc(100% + var(--sp-2)); left: 0; z-index: 1060;
  min-width: 200px; max-width: 300px; max-height: 260px; overflow-y: auto;
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-surface); border: 1px solid var(--border-1);
  border-radius: var(--r-3); box-shadow: var(--elev-popover);
  font-family: var(--font-sans); font-size: var(--fs-13); font-weight: 400; color: var(--fg-1);
}
.tl-msg-participants__head { font-size: var(--fs-12); font-weight: 600; color: var(--fg-4); margin-bottom: var(--sp-2); }
.tl-msg-participants__item { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-1) 0; }
.tl-msg-participants__item .bi { color: var(--fg-4); }

/* Emoji picker in the composers (#231): a fixed grid of standard emoji. */
.tl-emoji__toggle { border: 0; background: transparent; padding: 0; }
.tl-emoji__menu.dropdown-menu {
  min-width: 0; width: 15.75rem; padding: var(--sp-2);
  grid-template-columns: repeat(7, 1fr); gap: var(--sp-1);
}
.tl-emoji__menu.dropdown-menu.show { display: grid; }
.tl-emoji__item {
  border: 0; background: transparent; border-radius: var(--r-2);
  width: 2rem; height: 2rem; padding: 0; font-size: var(--fs-20); line-height: 1;
}
.tl-emoji__item:hover, .tl-emoji__item:focus-visible { background: var(--bg-sunken); outline: none; }

/* New-chat view */
.tl-msg-new-field { padding: var(--sp-5) var(--sp-6); border-bottom: 1px solid var(--border-1); }
.tl-msg-new-field:last-child { border-bottom: 0; }
.tl-msg-new-file-results {
  margin-top: var(--sp-2);
  max-height: 180px;
  overflow-y: auto;
}
.tl-msg-file-option {
  display: block;
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-13);
  color: var(--fg-1);
  text-decoration: none;
  border-radius: var(--r-2);
}
.tl-msg-file-option:hover { background: var(--bg-row-hover); }
.tl-msg-new-file-selected {
  margin-top: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-3);
  background: var(--bg-selected);
  font-size: var(--fs-13);
  color: var(--fg-1);
}
.tl-msg-empty-hint { padding: var(--sp-3) var(--sp-4); font-size: var(--fs-12); color: var(--fg-4); }
.tl-msg-new-staff-list {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border-1);
  border-radius: var(--r-3);
}
.tl-msg-staff-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-13);
  color: var(--fg-1);
  cursor: pointer;
  border-bottom: 1px solid var(--border-1);
}
.tl-msg-staff-item:last-child { border-bottom: 0; }
.tl-msg-staff-item:hover { background: var(--bg-row-hover); }

/* Action row: same horizontal padding as the fields above, with the primary
   action centred on the form rather than hugging the panel edge (issue #49). */
.tl-msg-new-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-5) var(--sp-6);
}
.tl-msg-new-actions .tl-msg-new-error { text-align: center; }

@media (max-width: 575px) {
  .tl-msg-drawer { width: 100%; }
  .tl-msg-drawer--popup { left: var(--sp-4); right: var(--sp-4); width: auto; }
  .tl-msg-drawer__resize { display: none; }
}

/* User-authored rich text — Title Vested In, file notes (#158). Output of the
   `rich_text` Twig filter, often a paste from Gmail: headings are demoted to body
   size and pasted layout tables scroll inside the card instead of widening it. */
.tl-rich-text { overflow-wrap: break-word; }
.tl-rich-text > :last-child { margin-bottom: 0; }
.tl-rich-text p,
.tl-rich-text ul,
.tl-rich-text ol,
.tl-rich-text pre,
.tl-rich-text blockquote,
.tl-rich-text table { margin-bottom: .5rem; }
.tl-rich-text ul,
.tl-rich-text ol { padding-left: 1.25rem; }
.tl-rich-text h1, .tl-rich-text h2, .tl-rich-text h3,
.tl-rich-text h4, .tl-rich-text h5, .tl-rich-text h6 {
  font-size: inherit; font-weight: 600; line-height: inherit; margin: 0 0 .25rem;
}
.tl-rich-text table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.tl-rich-text td,
.tl-rich-text th { padding: 0 .75rem 0 0; vertical-align: top; }
.tl-rich-text blockquote { border-left: 2px solid var(--border-strong); padding-left: .75rem; color: var(--fg-3); }
.tl-rich-text pre { white-space: pre-wrap; font-family: inherit; }
.tl-rich-text hr { margin: .5rem 0; }

/* Trial Balance card header (#165): the file-code + address cell wraps the
   address onto its own line within a bounded width instead of stretching the
   flex row and pushing the other header cells (status, client, sales tax,
   balance) to the right. */
.tl-tb-file-cell {
  max-width: 320px;
  min-width: 180px;
}
.tl-tb-file-cell .tl-tb-address {
  display: block;
  white-space: normal;
  overflow-wrap: break-word;
}
/* A save from a card returns to it by its #tb-file-… anchor (#226): keep a little air above. */
.tl-tb-card { scroll-margin-top: var(--sp-6); }

/* #266: transaction type + Residential/Commercial pills after the County, wrapping as a row. */
.tl-tb-types { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-2); }

/* #266: the file's Hold Note strip — on a Trial Balance card (between header and ledger) and
   on the Escrow Ledger card. Amber while a Hold is active and the note is still missing. */
.tl-hold-note {
  padding: var(--sp-4) var(--sp-6);
  background: var(--tl-warn-50);
  border-bottom: 1px solid var(--border-1);
  font-size: var(--fs-13);
  line-height: 1.4;
}
/* #355: inside the file's ledger card the strip keeps clear of the table below it. */
.card-body > .tl-hold-note { border: 1px solid var(--border-1); border-radius: var(--r-4); margin-bottom: var(--sp-6); }
.tl-hold-note--missing { background: var(--tl-danger-50); }
.tl-hold-note__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); }
.tl-hold-note__label { font-weight: 600; color: var(--tl-warn-700); }
.tl-hold-note__reminder { color: var(--fg-3); }
.tl-hold-note__text { margin-top: var(--sp-2); white-space: pre-line; overflow-wrap: anywhere; }
.tl-hold-note-fields { padding: var(--sp-5); background: var(--tl-warn-50); border-radius: var(--r-4); }

/* #266 Escrow Holds report: the long Note column wraps instead of widening the table. */
.tl-holds-note { min-width: 12rem; max-width: 28rem; white-space: pre-line; overflow-wrap: anywhere; }
.tl-holds-actions { display: inline-flex; flex-wrap: nowrap; gap: .25rem; justify-content: flex-end; }

/* #312 Office Expenses: a long description wraps inside its column; the form stays readable wide. */
.tl-office-expenses__desc { min-width: 10rem; max-width: 32rem; overflow-wrap: anywhere; }
.tl-office-expense-form { max-width: 48rem; }
.tl-office-expenses-total { border-top: 1px solid var(--bs-border-color); }
.tl-office-expenses-total__row { display: flex; justify-content: space-between; gap: var(--sp-4); padding: .5rem 1rem; font-weight: 600; }
.tl-office-expenses-total__row + .tl-office-expenses-total__row { border-top: 1px solid var(--bs-border-color); }
.tl-office-expenses-total__row dt, .tl-office-expenses-total__row dd { margin: 0; font-weight: 600; }

/* ---------- One-page file overview (#171) ----------
   The Figma's File Overview: the summary cards, then Documentation / Finances /
   Messages / Activity sections on the same page. The file tabs become split controls
   (label → section, caret → the group's full pages) and stick to the top of the
   scroller on the overview, following the scroll. */
#fileHubTabs > .tl-file-tab { display: flex; justify-content: center; }
#fileHubTabs > .tl-file-tab > .tl-file-tab__label { padding-right: var(--sp-1); }
#fileHubTabs > .tl-file-tab > .tl-file-tab__caret { padding-left: var(--sp-1); padding-right: var(--sp-2); color: var(--fg-3); }
#fileHubTabs > .tl-file-tab > .tl-file-tab__caret::after { margin-left: 0; }
/* When the five split tabs don't fit one row (phones) they wrap onto further rows instead of
   running off the page — not an inner sideways scroll, which would clip the carets' dropdown
   menus. No tab gets narrower than its label + caret, so a tab wraps whole; where the row fits
   (md and up) the tabs spread as before. No media query on purpose: WebKit with a classic
   scrollbar matches max-width: 767.98px at a 768px window. */
#fileHubTabs { flex-wrap: wrap; row-gap: var(--sp-2); }
#fileHubTabs > .nav-item { min-width: max-content; }

/* File status bar header (#365, Dave 2026-11-29): file number · status · Ask Tilo on the
   left, the action cluster (assignee · ⋯ · next status) right-aligned in the same row. When
   the row runs short the assignee field narrows first (to 6rem, the name ellipsised); the
   identity block leaves 28rem to the cluster (its narrowest plus the gap), so a long status
   drops Ask Tilo under the pill rather than push the buttons out of the card. On a card
   narrower than 54rem — a container query on the card body, so the sidebar and the personal
   text size (rem follows the root) both count — the cluster wraps under the title as a
   whole, starting at the left, then inside itself. The assignee field is as wide as the name
   (6–12rem), not a fixed 15rem. Tom-Select copies the select's classes onto its wrapper, the
   box sized here; `.input-group >` beats Bootstrap's `flex: 1 1 auto; width: 1%;
   min-width: 0` on input-group selects. */
#fileStatusBar > .card-body { container-type: inline-size; }
/* While ⋯ or the assignee list is open the card sits above the sticky tab bar (z-index 20),
   whatever stacking the container query's containment makes of the card body. */
#fileStatusBar:has(.dropdown-menu.show, .ts-wrapper.dropdown-active) { position: relative; z-index: 25; }
.tl-file-header { flex-wrap: nowrap; }
.tl-file-header__identity { flex: 0 0 auto; max-width: calc(100% - 28rem); }
.tl-file-actions { flex: 0 1 auto; flex-wrap: nowrap; min-width: 0; }
.tl-file-actions > * { flex: 0 0 auto; }
/* min-width: the icon + the field's 6rem, so the form never shrinks under its own input group. */
.tl-file-actions > .tl-file-actions__assignee { flex: 0 1 auto; min-width: 8.75rem; max-width: 100%; }
.input-group > .tl-assignee-select {
  flex: 0 1 auto;
  width: auto;
  min-width: 6rem;
  max-width: 12rem;
}
.tl-file-actions__assignee .ts-control { overflow: hidden; }
.tl-file-actions__assignee .ts-control > .item { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The open list stays readable when the closed field is short. */
.tl-file-actions__assignee .ts-dropdown { min-width: 15rem; }
@container (max-width: 54rem) {
  .tl-file-header { flex-wrap: wrap; }
  .tl-file-header__identity { flex: 0 1 auto; max-width: 100%; }
  .tl-file-actions { flex-wrap: wrap; }
  /* A long next-step label ("Advance to Clear to Close") wraps inside its button on a phone at 120 %. */
  .tl-file-actions > * { max-width: 100%; }
  .tl-file-actions > .btn { white-space: normal; }
}
#fileHubTabs[data-overview-tabs] {
  position: sticky;
  top: -24px;               /* .tl-content's top padding: stick flush with the scroller's edge */
  z-index: 20;
  background: #fff;
  margin-top: -8px;
  padding-top: 8px;
}
.tl-overview-anchor,
.tl-overview-section { scroll-margin-top: 64px; }
.tl-overview-section { margin-top: var(--sp-9); }
.tl-overview-section__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}
.tl-overview-scroll { max-height: 24rem; overflow-y: auto; }

/* Escrow ledger totals — one bordered strip of four, as in the Figma. */
.tl-ledger-totals {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--tl-ink-200);
  border-radius: var(--r-4);
  margin-bottom: var(--sp-6);
}
.tl-ledger-totals__cell { padding: var(--sp-5) var(--sp-4); text-align: center; }
.tl-ledger-totals__cell + .tl-ledger-totals__cell { border-left: 1px solid var(--tl-ink-200); }
.tl-ledger-totals__label { font-size: var(--fs-12); color: var(--fg-2); text-transform: uppercase; letter-spacing: .02em; }
.tl-ledger-totals__value { font-family: var(--font-display); font-size: var(--fs-24); font-weight: 600; color: var(--fg-1); margin-top: var(--sp-1); }
.tl-ledger-totals__value--balance { color: var(--fg-2); }
/* The Escrow Ledger table (#197 item 8) — one table on Trial Balance, the ledger page and the
   file overview, on the light .tl-table-figma header. */
.tl-escrow-ledger td { vertical-align: middle; }
.tl-escrow-ledger .tl-cleared { display: inline-flex; align-items: center; white-space: nowrap; }
.tl-escrow-ledger .tl-slip-btn { display: inline-flex; align-items: center; white-space: nowrap; }
.tl-escrow-ledger .tl-tx-row--void > td { color: var(--fg-4); }
.tl-escrow-ledger tfoot td { background: var(--tl-ink-100); border-bottom: 0; font-size: var(--fs-14); }
@media (max-width: 767.98px) {
  .tl-ledger-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* A six-figure sum must not break mid-number in a half-width tile. */
  .tl-ledger-totals__value { font-size: var(--fs-18); white-space: nowrap; }
  .tl-ledger-totals__cell:nth-child(3) { border-left: 0; }
  .tl-ledger-totals__cell:nth-child(n+3) { border-top: 1px solid var(--tl-ink-200); }
}

/* Activity feed — grey tiles, the Figma's Activity History (also the Activity page). */
.tl-activity-list { display: flex; flex-direction: column; gap: var(--sp-4); }
.tl-activity-item { background: #F5F5F5; border-radius: var(--r-4); padding: var(--sp-4) var(--sp-5); }
.tl-activity-item__type { font-size: var(--fs-16); font-weight: 500; color: var(--fg-1); }
.tl-activity-item__body { font-size: var(--fs-13); color: var(--fg-1); margin-top: var(--sp-2); overflow-wrap: anywhere; }
.tl-activity-item__meta { font-size: var(--fs-12); color: var(--fg-2); margin-top: var(--sp-3); }
/* #185: what was done ("ordered", "deleted"), the searches it concerned, and a secondary line. */
.tl-activity-item__verb { font-weight: 400; color: var(--fg-2); }
.tl-activity-item__verb--gone { color: var(--tl-danger-700); }
.tl-activity-item__searches { display: flex; flex-direction: column; gap: var(--sp-2); font-size: var(--fs-13); margin: var(--sp-2) 0 0; }
.tl-activity-item__detail { font-size: var(--fs-12); color: var(--fg-2); margin-top: var(--sp-1); overflow-wrap: anywhere; }
table.tl-row-links tbody tr[data-href],
.tl-row-links > [data-href] { cursor: pointer; }

/* ── #171 round 3 (owner feedback 2026-10-15) ─────────────────────────────────────── */

/* File overview tabs: one pane at a time. html[data-file-pane] is set by _file_tabs before
   the panes parse; without it (no JS, searchers without tabs) every pane shows. */
html[data-file-pane] [data-tab-pane] { display: none; }
html[data-file-pane="overview"] [data-tab-pane="overview"],
html[data-file-pane="documentation"] [data-tab-pane="documentation"],
html[data-file-pane="finances"] [data-tab-pane="finances"],
html[data-file-pane="messages"] [data-tab-pane="messages"],
html[data-file-pane="activity"] [data-tab-pane="activity"] { display: block; }
html[data-file-pane] .tl-overview-section { margin-top: 0; }

/* File header: transaction type + flag chips (the Figma's "Purchase" / "CONSTRUCTION LOAN"). */
.tl-type-pill {
  display: inline-flex; align-items: center; height: 1.5rem; padding: 0 var(--sp-5);
  border-radius: var(--r-pill); background: var(--tl-ink-400); color: #fff;
  font-size: var(--fs-13); font-weight: 500;
}
.tl-flag-pill {
  display: inline-flex; align-items: center; height: 1.5rem; padding: 0 var(--sp-5);
  border-radius: var(--r-pill); border: 1px solid currentColor; background: #fff;
  color: var(--tl-ink-700); font-size: var(--fs-13); font-weight: 500;
  text-transform: uppercase; letter-spacing: .02em; white-space: nowrap;
}
.tl-flag-pill--rush   { color: var(--tl-flag-rush); }
.tl-flag-pill--hold   { color: var(--tl-warn-700); }

/* #171 flags — owner 2026-10-16 + Figma "Flags": every flag is an ink outlined pill on
   white and only RUSH is red. Rendered by file_management/_file_flags.html.twig for both
   the /files list (.flag-chip, small) and the file header (.tl-flag-pill, large). The old
   hold/hili/fincen colour modifiers are gone; .tl-flag-pill--hold stays for the header's
   Adjourned pill. */
.flag-chip { background: #fff; color: var(--tl-ink-700); border-color: currentColor; }
.flag-chip--rush,
.tl-flag-pill--rush { background: #fff; color: var(--tl-danger-700); border-color: currentColor; }
/* end #171 flags */

/* #201 property category in the file header — flag-pill shape, filled with the status
   palette's Closing Scheduled (Residential) and Pending Reading (Commercial) colours
   (owner 2026-10-29). Classes come from PropertyCategory::getPillClass(). */
.tl-flag-pill--residential { background: #D0FFCF; color: #00854D; border-color: transparent; }
.tl-flag-pill--commercial  { background: #DCB0FF; color: #401694; border-color: transparent; }

/* Lifecycle stages under the Progress bar (the Figma's STAGE n / name row). */
.tl-stage-steps {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  list-style: none; margin: var(--sp-3) 0 0; padding: 0;
}
.tl-stage-steps__item {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: var(--sp-2) var(--sp-2) 0; color: var(--tl-ink-400); line-height: 1.3;
}
.tl-stage-steps__item + .tl-stage-steps__item { border-left: 1px solid var(--tl-ink-200); }
.tl-stage-steps__num { font-size: var(--fs-11); text-transform: uppercase; letter-spacing: .03em; }
.tl-stage-steps__label { font-size: var(--fs-12); }
.tl-stage-steps__item.is-done,
.tl-stage-steps__item.is-current { color: var(--fg-1); }
.tl-stage-steps__item.is-current .tl-stage-steps__label { font-weight: 600; }
/* Each stage links to /files?status=… (#187): keeps the stage's own colour, underline on hover. */
.tl-stage-steps__link {
  display: flex; flex-direction: column; align-items: center;
  color: inherit; text-decoration: none; border-radius: var(--r-2);
}
.tl-stage-steps__link:hover .tl-stage-steps__label { text-decoration: underline; }
.tl-stage-steps__link:hover { color: var(--fg-1); }
@media (max-width: 767.98px) {
  .tl-stage-steps { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: var(--sp-3); }
  .tl-stage-steps__item:nth-child(5) { border-left: 0; }
}

/* "Required to leave …" — a narrow quiet panel against the header's right edge. */
.tl-required-panel { background: var(--tl-ink-100); border-radius: var(--r-4); padding: var(--sp-5) var(--sp-6); }

/* Code pill (search codes — Searches card and search documents): outlined Vibe blue. */
.tl-code-pill {
  display: inline-flex; align-items: center; height: 1.375rem; padding: 0 var(--sp-4);
  border: 1px solid var(--tl-brand-600); border-radius: var(--r-pill);
  color: var(--tl-brand-600); background: #fff;
  font-size: var(--fs-13); font-weight: 500; white-space: nowrap; vertical-align: middle;
}
/* Soft status pill (search status): pastel fill, dark text of the same family. */
.tl-soft-pill {
  display: inline-flex; align-items: center; height: 1.375rem; padding: 0 var(--sp-4);
  border-radius: var(--r-pill); font-size: var(--fs-12); font-weight: 500; white-space: nowrap;
  background: var(--tl-ink-150); color: var(--fg-2);
}
.tl-soft-pill--warning   { background: var(--tl-ink-150);    color: var(--fg-2); }  /* pending — the Figma's grey */
.tl-soft-pill--info      { background: var(--tl-info-100);   color: var(--tl-info-700); }
.tl-soft-pill--primary   { background: var(--tl-brand-100);  color: var(--tl-brand-700); }
.tl-soft-pill--success   { background: var(--tl-success-50); color: var(--tl-success-700); }
.tl-soft-pill--danger    { background: var(--tl-danger-50);  color: var(--tl-danger-700); }
.tl-soft-pill--secondary { background: var(--tl-ink-150);    color: var(--fg-4); }
.tl-soft-pill--dark      { background: var(--tl-ink-900);    color: #fff; }  /* canceled (#285) */
/* Search row type (the Figma's Searches card): name 14/500, provider muted below. */
.tl-search-row__name { font-size: var(--fs-14); font-weight: 500; color: var(--fg-1); }

/* Reports table (Figma): light grey header band, ink text. */
.table.tl-table-figma thead th {
  background: var(--tl-ink-100); color: var(--fg-2);
  font-size: var(--fs-13); font-weight: 500; border-color: var(--tl-ink-200) !important;
}
.table.tl-table-figma tbody td { font-size: var(--fs-14); }
/* Outlined status pill (report status): ink by default, a semantic outline when it means something. */
.tl-outline-pill {
  display: inline-flex; align-items: center; height: 1.5rem; padding: 0 var(--sp-5);
  border: 1px solid currentColor; border-radius: var(--r-pill); background: #fff;
  color: var(--tl-ink-700); font-size: var(--fs-13); font-weight: 500; white-space: nowrap;
}
.tl-outline-pill--warning   { color: var(--tl-warn-700); }
.tl-outline-pill--info      { color: var(--tl-info-700); }
.tl-outline-pill--success   { color: var(--tl-success-700); }
.tl-outline-pill--danger    { color: var(--tl-danger-700); }
.tl-outline-pill--secondary { color: var(--fg-4); }
.tl-outline-pill--dark      { color: var(--tl-ink-900); }
/* Count pill (report exceptions): filled Vibe blue; "-" (no count applies) is quiet grey. */
.tl-count-pill {
  display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 1.375rem;
  padding: 0 var(--sp-4); border-radius: var(--r-pill);
  background: var(--tl-brand-600); color: #fff; font-size: var(--fs-13); font-weight: 600;
}
.tl-count-pill--none { background: var(--tl-ink-150); color: var(--fg-4); }

/* Document name (the Figma's Documents card): an outlined ink pill. */
.tl-doc-pill {
  display: inline-flex; align-items: center; min-height: 1.5rem; padding: 1px var(--sp-5);
  border: 1px solid var(--tl-ink-700); border-radius: var(--r-pill);
  color: var(--fg-1); font-size: var(--fs-13); font-weight: 500; line-height: 1.3;
}

/* Escrow transaction type (ledger + overview Finances): soft pills by money direction. */
.tl-tx-pill {
  display: inline-flex; align-items: center; height: 1.375rem; padding: 0 var(--sp-4);
  border-radius: var(--r-pill); font-size: var(--fs-12); font-weight: 600; white-space: nowrap;
}
.tl-tx-pill--in   { background: var(--tl-success-50); color: var(--tl-success-700); }
.tl-tx-pill--out  { background: var(--tl-danger-50);  color: var(--tl-danger-700); }
.tl-tx-pill--move { background: var(--tl-brand-50);   color: var(--tl-brand-700); }
.tl-tx-pill--held { background: var(--tl-warn-100);   color: var(--tl-warn-700); }
.tl-tx-pill--book { background: var(--tl-ink-150);    color: var(--fg-2); }

/* #171 missing info */
/* Tables grouped by file (the Figma's Missing Slips): a file's rows sit together,
   its number and address print once, and the group shares one background —
   alternate groups take the Figma's light grey. The script in missing_info re-marks
   .tl-mi-cont / .tl-mi-alt on every DataTables draw. */
.table.tl-mi-grouped tbody td { padding: 10px 12px; border-bottom-color: var(--tl-ink-200); }
.table.tl-mi-grouped thead th { padding: 8px 12px; border-color: var(--tl-ink-300) !important; }
.table.tl-mi-grouped tbody tr.tl-mi-alt > td { background: #F5F5F5; }
.table.tl-mi-grouped tbody tr:hover > td { background: var(--tl-brand-50); }
/* Removed, not just hidden: an invisible two-line address still held every
   continuation row at the head row's height. */
.table.tl-mi-grouped tbody tr.tl-mi-cont > td.tl-mi-group-cell > * { display: none; }
/* No rule across the File / Address cells inside a group: the line only separates
   the group's own rows, as in the Figma. */
.table.tl-mi-grouped tbody tr:has(+ tr.tl-mi-cont) > td.tl-mi-group-cell { border-bottom-color: transparent; }
/* Missing Searches: a narrower address so the row fits, and the search's code, name
   and status on one line (#171) — the status wraps below only when a long name leaves
   no room. Rows are condensed: with tighter padding a one-line row is as tall as its
   Upload button (~43px, was ~71px). */
.table.tl-mi-searches { --tl-col-address-min: 10rem; --tl-col-address: 14rem; }
.table.tl-mi-searches tbody td { padding-top: var(--sp-3); padding-bottom: var(--sp-3); }
.table.tl-mi-searches .tl-mi-col-search { min-width: 22rem; }
.table.tl-mi-searches .tl-mi-col-vendor { min-width: 8rem; }
/* Inline flow, not flex: a long name wraps as text and the status follows its last word. */
.tl-mi-search { line-height: 1.625rem; }
.tl-mi-search > .tl-code-pill { margin-right: var(--sp-3); }
.tl-mi-search > .badge { margin-left: var(--sp-3); white-space: nowrap; vertical-align: middle; }
/* A mandatory search with nothing waiting (#332): "Not ordered" / "No result" in the
   status's place, at the status chip's size. */
.tl-mi-search > .tl-outline-pill { margin-left: var(--sp-3); font-size: var(--fs-12); vertical-align: middle; }

/* Clearance help (#162, Tooltip Spec v1.3) ------------------------------------------------ */
/* The (i) hint: a real button so it takes keyboard focus and a tap, styled as the bare icon. */
.tl-help-hint {
  display: inline-flex;
  align-items: center;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--fg-3);
  line-height: 1;
  vertical-align: baseline;
  cursor: help;
  border-radius: var(--r-1, 3px);
}
.tl-help-hint:hover,
.tl-help-hint:focus-visible { color: var(--fg-1); }
/* An (i) beside a page heading (the Email page, #310): body-text size, not the heading's. */
.tl-heading-hint .tl-help-hint { font-size: var(--fs-16); vertical-align: middle; }
.tl-help-hint:focus-visible,
[data-bs-toggle="tooltip"][tabindex="0"]:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: 1px;
}
/* Glossary terms in item text (|abbr). Dotted underline is the convention for "hover me". */
abbr.tl-abbr {
  text-decoration: underline dotted;
  text-underline-offset: 2px;
  cursor: help;
}
/* One muted line of help under each Update-menu action. */
.tl-menu-described { max-width: 22rem; }
.tl-menu-described .dropdown-item { white-space: normal; flex-wrap: wrap; row-gap: 1px; }
.tl-menu-help {
  display: block;
  flex-basis: 100%;
  font-size: var(--fs-12);
  color: var(--fg-3);
  white-space: normal;
  line-height: 1.35;
}
.dropdown-item.text-danger .tl-menu-help,
.dropdown-item:active .tl-menu-help { color: inherit; opacity: .8; }

/* Clearance Items list (#198, Figma "Clearance Items List"). Header count pills, the Hold
   column's chips, and the add form that slides open behind "Add Another Item". */
.tl-ci-count {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  height: 1.75rem; padding: 0 var(--sp-5);
  border-radius: var(--r-pill); border: 1px solid currentColor; background: #fff;
  color: var(--tl-ink-800); font-size: var(--fs-13); font-weight: 500; white-space: nowrap;
}
.tl-ci-count strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.tl-ci-count--hold { color: var(--tl-danger-700); }
.tl-ci-pill {
  display: inline-flex; align-items: center; height: 1.5rem; padding: 0 var(--sp-4);
  border-radius: var(--r-pill); border: 1px solid transparent;
  font-size: var(--fs-12); font-weight: 500; white-space: nowrap;
}
.tl-ci-pill--timing   { background: #fff; color: var(--tl-ink-800); border-color: currentColor; text-transform: uppercase; letter-spacing: .02em; }
.tl-ci-pill--blocking { background: #fff; color: var(--tl-danger-700); border-color: currentColor; }
.tl-ci-pill--muted    { background: var(--tl-ink-100); color: var(--fg-2); }
.tl-ci-pill--ok       { background: var(--tl-success-50); color: var(--tl-success-700); border-color: currentColor; }
/* An underwriter rule a person must check (#276 CLR-DS-003 "check by hand"). */
.tl-ci-pill--warn     { background: var(--tl-warn-50); color: var(--tl-warn-700); border-color: currentColor; }
/* A pill with a sentence in it (#276 expiry): wraps on a narrow screen instead of overflowing. */
.tl-ci-pill--wrap     { white-space: normal; height: auto; min-height: 1.5rem; padding-top: .125rem; padding-bottom: .125rem; gap: var(--sp-2); border-radius: var(--r-4); }
.tl-ci-table td { padding-top: var(--sp-5); padding-bottom: var(--sp-5); }
.tl-ci-table .tl-ci-col-sb { width: 18%; }
.tl-ci-table .tl-ci-col-status { width: 14%; }
.tl-ci-table .tl-ci-col-hold { width: 24%; }
.tl-ci-doc { max-width: 14rem; }
/* The file's underwriter rules on the Clearance screen (#276 B2). */
.tl-ci-uw { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-2) var(--sp-4); padding: var(--sp-4) var(--sp-5); margin-bottom: var(--sp-5); border: 1px solid var(--tl-ink-100); border-radius: var(--r-4); background: var(--tl-ink-50, #fafafa); font-size: var(--fs-13); }
.tl-ci-uw__name { font-weight: 600; }
.tl-ci-uw__rules { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); margin: 0; padding: 0; list-style: none; min-width: 0; }
.tl-ci-uw__rules li { overflow-wrap: anywhere; }
.tl-ci-uw details { flex-basis: 100%; }
.tl-ci-uw details p { margin: var(--sp-2) 0 0; overflow-wrap: anywhere; }
/* "Held again" / "Item reopened" after Clear to Close (#276 slice 4): under the Clearance card's
   header, on the overview too. Amber for a non-blocking reopen, red when the file went back to
   Pending Clearance. Earlier endings under an item: a quiet list. */
.tl-ci-held { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--tl-warn-100); background: var(--tl-warn-50); color: var(--tl-warn-700); font-size: var(--fs-13); overflow-wrap: anywhere; }
.tl-ci-held > div { min-width: 0; }
.tl-ci-held span { margin-right: var(--sp-2); }
.tl-ci-held--blocking { border-top-color: var(--tl-danger-100); background: var(--tl-danger-50); color: var(--tl-danger-700); }
.tl-ci-held a { color: inherit; text-decoration: underline; }
.tl-ci-endings { margin: var(--sp-2) 0 0; padding-left: var(--sp-5); }
.tl-ci-endings li + li { margin-top: var(--sp-2); }
.tl-ci-add .collapsing { transition-duration: var(--dur-slow); transition-timing-function: var(--ease-standard); }

/* Letter issue form's parties (#241, owner 2026-11-04): the Parties page's table — Name, Role,
   Entity, Address, Covered — with each lender's Liability Amount / Loan Number compact on a row
   of its own under the lender. */
.table.tl-cpl-parties .tl-cpl-term { flex: 0 1 14rem; min-width: 10rem; }
.table.tl-cpl-parties tr.tl-cpl-lender:has(+ tr.tl-cpl-lender-terms:not(.d-none)) > td { border-bottom-width: 0; }
.table.tl-cpl-parties tr.tl-cpl-lender-terms > td { padding-top: 0; }
.table.tl-cpl-parties td:last-child { min-width: 9rem; }
/* "Add it" under Address required (#68): a link-looking button that opens the Edit Party dialog
   and keeps the surrounding hint's size. */
.tl-inline-link-button {
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  color: var(--bs-link-color);
  vertical-align: baseline;
  cursor: pointer;
}
.tl-inline-link-button:hover { color: var(--bs-link-hover-color); text-decoration: underline; }
.tl-inline-link-button:focus-visible { outline: 2px solid var(--tl-brand-600); outline-offset: 2px; border-radius: var(--r-1); }

/* Additional Documents folders on a file's documents page (#260). The section bar and each
   folder's head row read as group labels inside the documents table; the drag handle is a
   button (so the row link ignores it) and the folder bodies are the SortableJS lists
   (ADR 025: user-select none on the container, a wrapper handle, forceFallback). */
#documentsTable .tl-folders-bar__row > td {
  background: var(--bg-sunken);
  border-top: 1px solid var(--border-2);
  color: var(--fg-2);
  font-size: var(--fs-13);
}
#documentsTable .tl-folder__head > td {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-1);
  font-size: var(--fs-13);
  box-shadow: none;
}
#documentsTable .tl-folder__head .text-truncate {
  min-width: 0;
}
#documentsTable .tl-folder__empty > td {
  background: var(--bg-surface);
  box-shadow: none;
}
#documentsTable .tl-doc-row .min-w-0 {
  min-width: 0;
}
.tl-folder--droppable {
  user-select: none;
  -webkit-user-select: none;
}
.tl-drag-handle {
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 20px;
  min-height: 20px;
  padding: 0;
  border: 0;
  border-radius: var(--r-1);
  background: transparent;
  color: var(--fg-4);
  cursor: grab;
  touch-action: none;
}
.tl-drag-handle:hover,
.tl-drag-handle:focus-visible {
  color: var(--fg-1);
  background: var(--bg-row-hover);
}
.tl-folder-drag-ghost > td {
  background: var(--tl-brand-50) !important;
}
/* The pointer-driven clone SortableJS moves under the cursor is a lone <tr> on <body>:
   lay it out as a table so its cells keep their content's width. */
tr.sortable-fallback {
  display: table;
  background: var(--bg-surface);
  box-shadow: var(--elev-popover);
  opacity: .95;
}

/* The file overview's Additional Documents widget (#260 part 2): folders that open and close,
   each a SortableJS list (the rules above), and a drop target for files from the computer —
   the card outlines while a file is over it, the folder it would land in is tinted. */
.tl-additional-docs__scroll {
  max-height: 24rem;
  overflow-y: auto;
}
.tl-additional-docs .tl-folder__head > td {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-1);
  font-size: var(--fs-13);
  box-shadow: none;
}
.tl-additional-docs .tl-folder:first-child .tl-folder__head > td { border-top: 0; }
.tl-additional-docs .tl-folder__empty > td {
  background: var(--bg-surface);
  box-shadow: none;
}
.tl-additional-docs .min-w-0 { min-width: 0; }
/* Fixed layout so a long folder or document name truncates / wraps inside the card instead of
   widening the table past it on a phone; the second column holds the ⋯ menus. */
.tl-additional-docs #additionalDocsTable { table-layout: fixed; width: 100%; }
.tl-additional-docs__menu-col { width: 3rem; }
.tl-additional-docs .tl-doc-pill { max-width: 100%; overflow-wrap: anywhere; }
.tl-folder__toggle {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
}
button.tl-folder__toggle { cursor: pointer; }
button.tl-folder__toggle:focus-visible {
  outline: 2px solid var(--tl-brand-600);
  outline-offset: 2px;
  border-radius: var(--r-1);
}
.tl-folder__toggle .text-truncate { min-width: 0; }
.tl-folder__chevron {
  display: inline-block;
  color: var(--fg-3);
  transition: transform .15s ease;
}
.tl-folder:not(.is-collapsed) .tl-folder__chevron { transform: rotate(90deg); }
/* A closed folder hides its rows — but not the row being dragged in (SortableJS's chosen row):
   hidden, it would leave the folder as soon as it arrived and the drop would land nowhere. */
.tl-folder.is-collapsed > .tl-doc-row:not(.sortable-chosen),
.tl-folder.is-collapsed > .tl-folder__empty { display: none; }
.tl-additional-docs.is-file-over {
  outline: 2px dashed var(--tl-brand-600);
  outline-offset: -2px;
}
.tl-additional-docs .tl-folder.is-file-target > tr > td {
  background: var(--tl-brand-50) !important;
}

/* ---------- File overview, Messages tab (#280, owner 2026-11-15) ---------- */
/* The Emails and Messages widgets read like the Documentation tab: a sub-heading is the
   Reports table's grey header band, and a mail/chat row is a Searches row (title 14/500,
   details 13 muted below, date on the right) with a table cell's padding. */
.tl-msg-widget__subhead {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  background: var(--tl-ink-100); color: var(--fg-2);
  border-bottom: 1px solid var(--tl-ink-200);
  font-size: var(--fs-13); font-weight: 500;
}
.tl-msg-widget__subhead:not(:first-child) { border-top: 1px solid var(--tl-ink-200); }
.tl-msg-widget__subhead a { font-weight: 400; white-space: nowrap; }
.tl-msg-widget .list-group-item { padding: 9px var(--sp-5); }
.tl-msg-row__line { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-5); min-width: 0; }
.tl-msg-row__title { min-width: 0; font-size: var(--fs-14); font-weight: 500; color: var(--fg-1); }
.tl-msg-row__title.is-unread { font-weight: 700; }
.tl-msg-row__date {
  flex-shrink: 0; white-space: nowrap;
  font-size: var(--fs-13); color: var(--fg-4); font-variant-numeric: tabular-nums;
}
.tl-msg-row__meta { margin-top: var(--sp-1); font-size: var(--fs-13); color: var(--fg-4); }
/* The file's Emails page (#280, owner 2026-11-16) uses the same rows, with more on each line:
   the subject carries how the conversation was linked as a quiet neutral note (never green —
   green means done), and the second line is participants, then the snippet cut at about half
   the line. The note gives way before the subject does on a phone. */
.tl-msg-row__head { display: flex; align-items: baseline; gap: var(--sp-3); min-width: 0; }
.tl-msg-row__head .tl-msg-row__title { flex: 0 1 auto; }
.tl-msg-row__how {
  flex: 0 100 auto; min-width: 0; max-width: 50%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 0 var(--sp-3); border-radius: var(--r-pill);
  background: var(--tl-ink-150); color: var(--fg-4);
  font-size: var(--fs-12); font-weight: 400; line-height: 1.5;
}
.tl-msg-row__count {
  display: inline-block; padding: 0 var(--sp-2); border-radius: var(--r-pill);
  background: var(--tl-ink-150); color: var(--fg-4); font-size: var(--fs-12);
}
/* A conversation in two mailboxes is one row (#280, owner 2026-11-19); this says which.
   Neutral like the link note, but kept on a phone (it is why there is one row, not two). */
.tl-msg-row__boxes {
  flex: 0 100 auto; min-width: 0; max-width: 45%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 0 var(--sp-3); border-radius: var(--r-pill);
  background: var(--tl-ink-150); color: var(--fg-4);
  font-size: var(--fs-12); font-weight: 400; line-height: 1.5;
}
.tl-msg-row__split { display: flex; gap: var(--sp-3); min-width: 0; }
.tl-msg-row__who, .tl-msg-row__snippet { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-msg-row__who { flex: 0 1 auto; }
.tl-msg-row__snippet { flex: 0 1 auto; max-width: 50%; }
.tl-msg-row__who + .tl-msg-row__snippet::before { content: "— "; }
.tl-file-mail-tabs__hint { flex-shrink: 0; padding-bottom: var(--sp-2); }
/* A phone has no room for the note beside the subject: cut to a letter it says nothing, so
   it goes, and the row's title still says how the conversation was linked. */
@media (max-width: 575.98px) { .tl-msg-row__how { display: none; } }
.tl-msg-row__boxes-count { display: none; }
@media (max-width: 575.98px) {
  .tl-msg-row__boxes { flex: 0 0 auto; max-width: none; }
  .tl-msg-row__boxes-names { display: none; }
  .tl-msg-row__boxes-count { display: inline; }
}

/* ---------- Contract Contingencies tracker (file overview, #196) ---------- */
/* Five columns do not fit a phone: below md each contingency reads as a block, every
   cell under its column name. A formula-only deadline ("No date yet — 30 days from
   mortgage commitment") wraps inside its cell rather than widening the table. */
.tl-contingency-table td { overflow-wrap: break-word; }
@media (max-width: 767.98px) {
  .tl-contingency-table thead { display: none; }
  .tl-contingency-table tr { display: block; padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border-1); }
  .tl-contingency-table tr:last-child { border-bottom: 0; }
  .tl-contingency-table td { display: block; border: 0; padding: 0 0 var(--sp-3); }
  .tl-contingency-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: var(--fs-12);
    color: var(--fg-3);
  }
}

/* Lender search in the Add Party dialog (#241): the order form's Contacts search, as a list
   under the Name field. Above the modal, never wider than the field, scrolls on a phone. */
.tl-lender-results {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  right: 0;
  z-index: 1060;
  max-height: 16rem;
  overflow-y: auto;
  box-shadow: var(--elev-popover);
}
.tl-lender-results .list-group-item { font-size: var(--fs-13); }

/* #68: Add Mapping's "Load WFG's list" — at least 5 rows in view, wrapped two-line names included
   (5 × ~3rem), in rem so 120 % text keeps the same rows; scrolls inside, never sideways. */
.tl-lookup-list { max-height: 16rem; overflow-y: auto; overflow-x: hidden; }
/* A phone wraps a long WFG name onto 2–3 lines, so the box grows to keep 5 rows in view. */
@media (max-width: 575.98px) { .tl-lookup-list { max-height: 22rem; } }
.tl-lookup-list .list-group-item { font-size: var(--fs-13); line-height: 1.35; padding: 0.375rem 0.75rem; overflow-wrap: anywhere; }

/* #265: the Recording Checklist's searchable type picker (Tom Select) — grows to 18rem, shrinks on a phone. */
.tl-recording-type-picker { flex: 1 1 14rem; min-width: 0; max-width: 18rem; }

/* Schedule B's exception list, one for the Title and the Policy Report (#264,
   reporting/_schedule_b_list). SortableJS needs the container unselectable (ADR 025);
   the editors stay selectable, which Safari would otherwise inherit away. */
.sb-list { user-select: none; -webkit-user-select: none; }
.sb-list .ql-editor { user-select: text; -webkit-user-select: text; }
.sb-drag-handle { cursor: grab; padding: 0.25rem; touch-action: none; }
.sb-editor { min-height: 3.75rem; padding: 0.5rem; }
.sb-exception { scroll-margin-top: 5rem; transition: box-shadow 0.3s ease; }
/* The exception just added or sent (#264): the page scrolls to it and marks it briefly. */
.sb-exception--focus { box-shadow: 0 0 0 0.1875rem var(--tl-brand-400); }
/* Add from Title Report (#348): the exception text set as on Schedule B's editor — no
   margin between paragraphs; Quill's empty paragraph is the blank line where one was typed. */
.sb-pick-text { overflow-wrap: anywhere; line-height: 1.42; }
.sb-pick-text p, .sb-pick-text ol, .sb-pick-text ul { margin-bottom: 0; }

/* A choice block (#348, DESIGN.md → Choice blocks): radio options with a semibold name and an
   optional text under it. Two sizes — body for headings, names and texts, --fs-12 for hints —
   and two tones — --fg-1 and --fg-4 for hints. .tl-choice-dialog brings a dialog's body
   (13px --fg-3 by default) to the same two. */
.tl-choice { margin: 0 0 1rem; font-size: var(--fs-14); color: var(--fg-1); }
.tl-choice__legend { float: none; width: auto; margin-bottom: 0.25rem; padding: 0; font-size: var(--fs-14); font-weight: 600; color: var(--fg-1); line-height: 1.43; }
.tl-choice__hint { margin: 0 0 0.5rem; font-size: var(--fs-12); color: var(--fg-4); }
.tl-choice__option { margin: 0; }
.tl-choice__option + .tl-choice__option { margin-top: 0.75rem; }
.tl-choice__name { display: block; font-weight: 600; }
.tl-choice__text { display: block; margin-top: 0.25rem; overflow-wrap: anywhere; }
.tl-choice__text:empty { display: none; }
.tl-choice-dialog { font-size: var(--fs-14); color: var(--fg-1); }
.tl-choice-dialog__subject { font-weight: 600; }
.tl-choice-dialog .form-text { font-size: var(--fs-12); color: var(--fg-4); }

/* #189: the SJ Carroll service-code picker per search type — beside the name on a wide
   screen, its own full line on a phone. */
.tl-sjc-select { flex: 1 1 16rem; min-width: 0; max-width: 24rem; }
/* E-Recording county rows (#191): name, channel, recipient — one line wide, stacked narrow. */
.tl-erec-county { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.tl-erec-county__name { flex: 1 1 10rem; min-width: 0; overflow-wrap: anywhere; }
.tl-erec-county__channel { flex: 0 1 9rem; min-width: 0; }
.tl-erec-county__recipient { flex: 1 1 14rem; min-width: 0; max-width: 22rem; }
.tl-erec-mapping { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.tl-erec-mapping__type { flex: 1 1 12rem; min-width: 0; overflow-wrap: anywhere; }
.tl-erec-mapping__select { flex: 1 1 16rem; min-width: 0; max-width: 26rem; }

/* ── Report a problem (#292) ──────────────────────────────────────────────
   A slim tab on the right edge near the bottom: over the content pane's right gutter, not
   its content; under modals (1055) and the Messages window (1201), and beside the docked
   Messages drawer instead of under it. Vertical label on wide screens, icon only on phones. */
.tl-report-tab {
  position: fixed;
  right: 0;
  bottom: 88px;
  z-index: 1040;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-3);
  border: 1px solid var(--border-2);
  border-right: 0;
  border-radius: var(--r-3) 0 0 var(--r-3);
  background: var(--bg-surface);
  color: var(--fg-3);
  box-shadow: var(--elev-2);
  font-size: var(--fs-12);
  font-weight: 600;
  line-height: 1;
  writing-mode: vertical-rl;
  cursor: pointer;
  transition: color var(--dur-instant) var(--ease-standard), background var(--dur-instant) var(--ease-standard);
}
.tl-report-tab .bi { writing-mode: horizontal-tb; font-size: var(--fs-14); }
.tl-report-tab:hover,
.tl-report-tab:focus-visible { color: var(--tl-brand-700); background: var(--tl-brand-50); outline: none; }
.tl-report-tab:focus-visible { box-shadow: 0 0 0 3px rgba(0,115,234,.35); }
.tl-report-tab--busy { cursor: progress; opacity: .6; }
@media (min-width: 576px) {
  .tl-shell--msg-open ~ .tl-report-tab { right: var(--tl-msg-w, 350px); }
}
@media (max-width: 575.98px) {
  .tl-report-tab { padding: var(--sp-4) var(--sp-2); bottom: 72px; }
  .tl-report-tab__label { display: none; }
}
@media print { .tl-report-tab { display: none; } }

/* Provider Portal shell (layout/provider.html.twig, #285 follow-up). Every rule is on a
   .tl-provider-* class that only the portal layout renders, so the staff app is untouched.
   Flex-wrap rather than grid areas (Safari-safe); min-width: 0 lets long text shrink. */
.tl-provider-main { max-width: 960px; }
.tl-provider-nav {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--sp-3) var(--sp-6); padding: var(--sp-4) var(--sp-8);
}
.tl-provider-nav__brand {
  display: inline-flex; align-items: center; gap: var(--sp-4);
  min-width: 0; text-decoration: none; white-space: nowrap;
}
.tl-provider-nav__tabs { flex-wrap: wrap; min-width: 0; }
.tl-provider-nav__account {
  display: flex; align-items: center; gap: var(--sp-5);
  min-width: 0; margin-left: auto;
}
.tl-provider-nav__user { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 991.98px) {
  .tl-provider-nav { padding: var(--sp-4) var(--sp-6); }
  /* Tabs drop to their own line under brand + account. */
  .tl-provider-nav__tabs { order: 3; flex-basis: 100%; margin-left: calc(-1 * var(--bs-nav-link-padding-x, 1rem)); }
  .tl-provider-nav__user { max-width: 40vw; }
}
@media (max-width: 479.98px) {
  /* The wordmark alone says where you are; the account email shortens instead of pushing. */
  .tl-provider-nav__brand .text-muted { display: none; }
}
.tl-provider-row__main { min-width: 0; overflow-wrap: anywhere; }


/* ── Knowledge Base / Help (docs/kb) ─────────────────────────────────────────
   The "?" beside the page title, the /help index and an article. Text sizes are
   rem tokens so the personal text size (#258) reaches them; an article reads at
   a comfortable measure, and its tables scroll inside their own wrapper. */
.tl-topbar__help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.375rem;
  height: 1.375rem;
  margin-left: 6px;
  border: 1px solid var(--tl-brand-600);
  border-radius: var(--r-pill);
  color: var(--tl-brand-600);
  font-size: var(--fs-12);
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
}
.tl-topbar__help:hover { background: var(--tl-brand-600); color: #fff; }
.tl-topbar__help:focus-visible { outline: none; box-shadow: var(--shadow-focus-ring); }

/* Help index (#321): each area is a card like every other list surface, its title the quiet card label. */
.tl-kb-index { max-width: 52rem; }
.tl-kb-index__area { margin-bottom: var(--sp-6); }
.tl-kb-index__list { list-style: none; margin: 0; padding: 0 var(--sp-7); }
.tl-kb-index__item { padding: var(--sp-5) 0; border-bottom: 1px solid var(--border-1); }
.tl-kb-index__item:last-child { border-bottom: 0; }
.tl-kb-index__link { font-weight: 600; font-size: var(--fs-14); }
.tl-kb-index__lead { margin: 2px 0 0; font-size: var(--fs-13); color: var(--fg-3); overflow-wrap: anywhere; }

/* Help article (#321): the file pages' breadcrumb, the page-head title, the body on a card. */
.tl-kb { max-width: 50rem; overflow-wrap: anywhere; }
.tl-kb__meta { font-size: var(--fs-12); color: var(--fg-4); margin-bottom: var(--sp-6); }
.tl-kb__body { font-size: var(--fs-14); line-height: 1.6; color: var(--fg-1); }
.tl-kb__body > :first-child { margin-top: 0; }
.tl-kb__body > :last-child { margin-bottom: 0; }
.tl-kb__body h2 { font-size: var(--fs-20); font-weight: 600; margin: var(--sp-9) 0 var(--sp-4); }
.tl-kb__body h3 { font-size: var(--fs-16); font-weight: 600; margin: var(--sp-8) 0 var(--sp-3); }
.tl-kb__body h4, .tl-kb__body h5, .tl-kb__body h6 { font-size: var(--fs-14); font-weight: 600; margin: var(--sp-7) 0 var(--sp-3); }
.tl-kb__body p, .tl-kb__body ul, .tl-kb__body ol, .tl-kb__body blockquote { margin-bottom: var(--sp-6); }
.tl-kb__body li + li { margin-top: var(--sp-2); }
.tl-kb__body li > ul, .tl-kb__body li > ol { margin: var(--sp-2) 0 0; }
.tl-kb__body code { font-size: var(--fs-13); color: var(--fg-1); background: var(--tl-ink-100); padding: 0 4px; border-radius: var(--r-1); }
.tl-kb__body blockquote { border-left: 3px solid var(--tl-brand-100); padding: var(--sp-2) 0 var(--sp-2) var(--sp-6); color: var(--fg-3); }
.tl-kb__body hr { border-top: 1px solid var(--border-1); opacity: 1; margin: var(--sp-8) 0; }
.tl-kb__table { margin-bottom: var(--sp-6); border: 1px solid var(--border-1); border-radius: var(--r-3); }
.tl-kb__table .table { margin-bottom: 0; font-size: var(--fs-13); }
.tl-kb__table th { font-size: var(--fs-12); font-weight: 600; color: var(--fg-3); background: var(--tl-ink-100); white-space: nowrap; }
.tl-kb__table td, .tl-kb__table th { padding: var(--sp-4) var(--sp-5); vertical-align: top; overflow-wrap: normal; }
/* Long setting keys and routes in a cell may break, so a narrow screen wraps the table instead of
   scrolling it sideways; the headers wrap too below the small breakpoint. */
.tl-kb__table td code { overflow-wrap: anywhere; }
.tl-kb__table td:first-child:has(code) { min-width: 7.5rem; } /* a key column breaks in readable pieces, not two letters a line */
@media (max-width: 575.98px) {
  .tl-kb__table th { white-space: normal; }
  .tl-kb__table td, .tl-kb__table th { padding: var(--sp-3) var(--sp-4); }
}
.tl-kb__more { margin-top: var(--sp-10); padding-top: var(--sp-6); border-top: 1px solid var(--border-1); }
.tl-kb__more ul { list-style: none; padding: 0; margin: 0; font-size: var(--fs-13); }
.tl-kb__more li + li { margin-top: var(--sp-2); }
.tl-kb__more [aria-current] { font-weight: 600; color: var(--fg-1); }

/* Email agent journal + Quarantine (#321). A card opened from a link (?flag= / ?item=) carries a
   brand ring — cards are borderless, so Bootstrap's border-primary showed nothing — and clears the
   sticky top bar when the #fragment scrolls to it. */
.tl-agent-entry { scroll-margin-top: 4.5rem; }
/* A card's lead line (the mail's subject, the "Why" reason, the document) gets a little air
   before its small grey details (#321). */
.tl-agent-lead { margin-bottom: var(--sp-3); }
/* Sender / our mailbox lines (_mail_block): an icon before each address, items split by "·",
   a long address breaks inside the column instead of widening it. */
.tl-agent-mail-line { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: var(--sp-2); min-width: 0; }
.tl-agent-mail-line > span { min-width: 0; overflow-wrap: anywhere; }
.tl-agent-mail-line > span:not(:last-child)::after { content: "·"; margin-left: var(--sp-2); color: var(--fg-1); }
.tl-agent-mail-line .bi { margin-right: var(--sp-2); }
.tl-card--focus, .tl-card--focus:hover { box-shadow: 0 0 0 0.1875rem var(--tl-brand-400), var(--elev-card); }
.tl-agent-state { display: inline-flex; align-items: center; gap: var(--sp-3); font-size: var(--fs-13); color: var(--fg-4); }
/* A long button label that must stay whole (Confirm — file and type are right): wraps onto a second
   line on a phone instead of running out of the card. */
.btn.tl-btn-wrap { height: auto; min-height: 2.25rem; white-space: normal; padding-top: var(--sp-3); padding-bottom: var(--sp-3); }

/* ── Wire instructions (#301) ──────────────────────────────────────────────
   The public page a wire instructions link opens. The numbers are drawn by CSS
   (`::before { content: attr(data-d) }`), so they are not part of the page's
   text: select-all and copy, and the browser's Save as text, carry no digits.
   Printing is switched off. Deterrence only — a screenshot or a hand-copy still
   works, and the help article says so. */
.tl-wire { max-width: 36rem; }
.tl-wire__card { border: 1px solid var(--border-1); border-radius: var(--r-3); padding: var(--sp-7); background: var(--bg-surface); }
.tl-wire__rows { margin: 0; }
.tl-wire__row { display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 1fr); gap: var(--sp-2) var(--sp-5); padding: var(--sp-4) 0; border-top: 1px solid var(--border-1); }
.tl-wire__row:first-child { border-top: 0; }
.tl-wire__row dt { font-size: var(--fs-13); font-weight: 600; color: var(--fg-3); }
.tl-wire__row dd { margin: 0; font-size: var(--fs-16); color: var(--fg-1); overflow-wrap: anywhere; }
.tl-wire__digits { display: inline-flex; flex-wrap: wrap; gap: 0 .5em; font-variant-numeric: tabular-nums; letter-spacing: .04em; font-weight: 600;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.tl-wire__digits [data-d]::before { content: attr(data-d); }
.tl-wire__code { max-width: 12rem; font-size: var(--fs-20); letter-spacing: .3em; font-variant-numeric: tabular-nums; }
.tl-wire__print-note { display: none; }
@media (max-width: 575.98px) {
  .tl-wire__card { padding: var(--sp-6) var(--sp-5); }
  .tl-wire__row { grid-template-columns: minmax(0, 1fr); }
}
@media print {
  .tl-wire__details, .tl-wire__card { display: none !important; }
  .tl-wire__print-note { display: block !important; }
}

/* AI Prompts (#323): a module card opens on its header (chevron turns), the prompt text keeps
   its line breaks and wraps a long token (an enum list) instead of running past a phone's edge. */
.tl-prompt-module__chevron { display: inline-block; transition: transform var(--dur-fast, 120ms) ease; }
.tl-prompt-module__toggle:not(.collapsed) .tl-prompt-module__chevron { transform: rotate(90deg); }
.tl-prompt-module__toggle { color: var(--fg-1); min-width: 0; white-space: normal; }
.tl-prompt-text { min-height: 25rem; }
.tl-prompt-pre { white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--bs-font-monospace); }
/* #323: a version's Notes on the list — one line, cut with "…", the full text on hover (title). */
.tl-prompt-notes { display: block; max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-prompt-by { min-width: 6rem; }
.tl-prompt-meta__notes { white-space: pre-wrap; overflow-wrap: anywhere; }
@media (prefers-reduced-motion: reduce) { .tl-prompt-module__chevron { transition: none; } }

/* ── Admin → Integrations: collapsible sections (#356) ── */
.tl-settings-section__toggle { color: var(--fg-1); min-width: 0; white-space: normal; }
.tl-settings-section__toggle:hover, .tl-settings-section__toggle:focus { color: var(--fg-1); }
.tl-settings-section__chevron { display: inline-block; transition: transform var(--dur-fast, 120ms) ease; }
.tl-settings-section__toggle:not(.collapsed) .tl-settings-section__chevron { transform: rotate(90deg); }
.tl-settings-section { scroll-margin-top: 4.5rem; }
.tl-settings-group { scroll-margin-top: 4.5rem; min-width: 0; }
@media (prefers-reduced-motion: reduce) { .tl-settings-section__chevron { transition: none; } }

/* ── Admin → Roles: the role matrix grid (#334, read-only preview) ──────────────
   Ten columns never fit a phone: the grid scrolls inside its own .table-responsive,
   the page does not. The action column stays in view while it scrolls (sticky needs
   border-collapse: separate in Safari). */
.tl-role-matrix-scroll { min-width: 0; }
.tl-role-matrix { border-collapse: separate; border-spacing: 0; font-size: var(--fs-13); }
.tl-role-matrix th, .tl-role-matrix td { vertical-align: middle; }
/* Bootstrap paints table cells with --bs-table-bg (transparent here) at a higher
   specificity, so the sticky cell names the table too — else scrolled ticks show through. */
.tl-role-matrix > :not(caption) > * > .tl-role-matrix__action {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 12rem;
  max-width: 20rem;
  background-color: var(--tl-ink-0);
}
.tl-role-matrix > thead > tr > .tl-role-matrix__action { background-color: var(--tl-ink-50); }
/* On a phone the action column keeps room for the role columns to scroll past it. */
@media (max-width: 575.98px) {
  .tl-role-matrix > :not(caption) > * > .tl-role-matrix__action { min-width: 9.5rem; }
}
.tl-role-matrix__role { min-width: 5.5rem; white-space: nowrap; }
.tl-role-matrix > tbody > .tl-role-matrix__section > td {
  background: var(--tl-ink-50);
  color: var(--tl-ink-700);
  font-weight: 600;
}
.tl-role-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 .25rem;
  border-radius: .375rem;
  font-size: var(--fs-12);
  line-height: 1;
}
.tl-role-cell--granted { background: var(--tl-success-50); color: var(--tl-success-700); }
.tl-role-cell--inherited { background: var(--tl-ink-100); color: var(--tl-ink-400); }
.tl-role-cell--read { background: var(--tl-brand-50); color: var(--tl-brand-700); }
.tl-role-cell--locked { background: var(--tl-ink-100); color: var(--tl-ink-600); }
.tl-role-legend li { display: inline-flex; align-items: center; gap: .375rem; }

/* ---------- Mail in the top bar and the mailbox switcher (#310) ---------- */
/* The mail icon's unread count: absolutely placed on the 28px icon button, so it adds no
   width to the top bar at any text size (rem font and box, DESIGN.md → Sizes scale). */
.tl-icon-btn__count {
  position: absolute;
  top: -.25rem;
  right: -.375rem;
  min-width: 1rem;
  height: 1rem;
  padding: 0 .25rem;
  border-radius: var(--r-pill);
  background: var(--tl-brand-600);
  color: #fff;
  border: 1px solid var(--tl-ink-0);
  font-size: var(--fs-10);
  font-weight: 600;
  line-height: calc(1rem - 2px);
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
}
.mail-switcher__menu {
  /* Never wider than the phone (16px gutter each side); a long address wraps. */
  width: max-content;
  min-width: 15rem;
  max-width: min(24rem, calc(100vw - 2rem));
}
.mail-switcher__item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  white-space: normal;
}
.mail-switcher__tick { flex: 0 0 1rem; width: 1rem; }
.mail-switcher__text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.mail-switcher__address { overflow-wrap: anywhere; font-weight: 500; }
.mail-switcher__meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); font-size: var(--fs-12); color: var(--fg-3); }
.mail-switcher__item.active .mail-switcher__meta { color: inherit; }
/* Main sits on the meta line, so the address keeps the item's whole width. */
.mail-switcher__main { height: 1.125rem; }
@media (max-width: 575.98px) {
  /* The icon says it; the word would push Compose onto a second line at 320px. */
  .mail-switcher__label { display: none; }
}
