/*
  Design tokens match docs/mockups/*.html exactly -- keep these two in
  sync. See docs/system-design.md for the rationale behind the palette.

  Layout strategy: the mockups draw two separate frames (a desktop
  sidebar layout and a mobile "phone" layout). This stylesheet merges
  them into one responsive app shell -- .sidebar/.main above the
  --shell-breakpoint, .topbar-mobile/.tabbar below it -- so the same
  templates serve both, per docs/system-design.md's PWA/responsive intent.
*/
:root {
  --navy: #16233D; --navy-soft: #223050; --navy-dim: #93A0BC;
  --bg-app: #F5F6F8; --surface: #FFFFFF;
  --border: #E3E6EB; --border-soft: #EDEFF3;
  --text-primary: #101828; --text-secondary: #667085; --text-tertiary: #98A2B3;
  --accent: #235789; --accent-hover: #1B4568; --accent-bg: #E8F0F8;
  --danger: #B42318; --danger-bg: #FDECEA;
  --warning: #93500A; --warning-bg: #FDF0DE;
  --success: #067647; --success-bg: #E7F6EC;
  --font-sans: 'Inter', -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --shell-breakpoint: 900px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg-app);
  font-family: var(--font-sans);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ---------------------------------------------------------------- */
/* Toast notifications -- overlay the page, never push layout down   */
/* ---------------------------------------------------------------- */

.toast-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(16,24,40,0.12), 0 2px 6px rgba(16,24,40,0.08);
  padding: 12px 12px 12px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  animation: toast-in 0.2s ease-out;
}
.toast.toast-hide { animation: toast-out 0.25s ease-in forwards; }

.toast.toast-danger { border-left-color: var(--danger); }
.toast.toast-success { border-left-color: var(--success); }
.toast.toast-neutral { border-left-color: var(--text-tertiary); }

.toast-message { flex: 1; line-height: 1.4; }

.toast-close {
  flex-shrink: 0;
  border: none;
  background: none;
  color: var(--text-tertiary);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.toast-close:hover { color: var(--text-primary); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-8px); }
}

@media (max-width: 900px) {
  .toast-stack { top: auto; bottom: 84px; right: 12px; left: 12px; width: auto; }
}

/* ---------------------------------------------------------------- */
/* App shell                                                         */
/* ---------------------------------------------------------------- */

.app { display: flex; min-height: 100vh; }

/* Sidebar (desktop) */
.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 8px 18px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

.brand-name { font-size: 13.5px; font-weight: 600; }
.brand-role { font-size: 11.5px; color: var(--navy-dim); margin-top: 1px; }

.nav { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: 7px;
  color: var(--navy-dim);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-sans);
}

.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }

.nav-item:hover { color: #fff; }

.nav-item.active {
  background: rgba(255,255,255,0.07);
  color: #fff;
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.nav-spacer { flex: 1; }

.nav-form { margin: 0; padding-top: 11px; margin-top: 7px; border-top: 1px solid rgba(255,255,255,0.10); }

/* Main (desktop). max-width keeps rows/panels from stretching to an
   uncomfortable reading width on very wide monitors; margin: 0 auto
   centers that capped box within whatever space is left next to the
   sidebar, instead of leaving all the leftover space stranded on the
   right (a flex item with auto margins absorbs free space itself,
   ahead of flex-grow -- see docs/system-design.md's UI notes). */
.main { flex: 1; min-width: 0; width: 100%; padding: 26px 36px 48px; max-width: 1440px; margin: 0 auto; }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.page-title { font-size: 22px; font-weight: 600; margin: 0 0 3px; }
.page-sub { font-size: 13.5px; color: var(--text-secondary); margin: 0; }

/* Mobile topbar / tabbar -- hidden by default, shown below breakpoint */
.topbar-mobile { display: none; }
.tabbar { display: none; }

/* ---------------------------------------------------------------- */
/* Buttons                                                            */
/* ---------------------------------------------------------------- */

.btn-primary {
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-ghost {
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-bg);
  border: none;
  border-radius: 7px;
  padding: 7px 12px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-secondary {
  font-family: var(--font-sans); font-size: 13.5px; font-weight: 600; color: var(--text-primary);
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 16px; cursor: pointer;
}

.btn-primary-full {
  width: 100%;
  font-family: var(--font-sans); font-size: 13.5px; font-weight: 600; color: #fff;
  background: var(--accent); border: none; border-radius: 8px; padding: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-primary-full svg { width: 16px; height: 16px; }

.panel-action {
  font-size: 12px; font-weight: 600; color: var(--accent); background: var(--accent-bg);
  border: none; border-radius: 7px; padding: 6px 10px; cursor: pointer;
}

/* ---------------------------------------------------------------- */
/* Metrics + grid                                                     */
/* ---------------------------------------------------------------- */

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}

.metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 15px 18px;
  box-shadow: 0 1px 2px rgba(16,24,40,0.04);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  min-height: 78px;
}

.metric-label { font-size: 12.5px; color: var(--text-secondary); margin: 0; }
.metric-value { font-family: var(--font-mono); font-size: 23px; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.metric-value.danger { color: var(--danger); }

.grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* Dashboard: now has more panels than fit a fixed 2x2 grid (breakdowns,
   recently-updated, monthly overview), so it uses the generic .grid/.col
   above like the matter/client detail pages, rather than a dedicated
   area-based grid. */

/* Dashboard only: the two columns hold a different mix of panels
   (hearings/recently-updated on the left vs. fee/drafts/breakdowns on
   the right), so their total content height rarely matches.
   .dashboard-grid-balanced used to stretch both columns to the same
   height and let "Recently updated matters" (the left column's last
   panel) absorb the leftover space via `flex: 1`, on the theory that a
   dead strip of page background under the shorter column read worse
   than folding it into the last card. In practice it's the opposite for
   most firms: recently_updated rarely has enough rows to fill that
   space (a firm with a handful of matters always sees this, not just
   as an edge case), so the "fix" mostly showed up as a large blank
   rectangle bounded by the card's own border -- which reads as more
   broken than a plain gap ever did, since a card is where content is
   expected to fill it. Reverted to the shared .grid's natural
   `align-items: start` (this class now does nothing; kept on the
   template rather than pulled, in case a future revisit wants it)
   -- any leftover height difference between columns is just ordinary
   page background below the shorter one, same as matter/client detail
   pages already look. The "View all matters" footer added below
   (.panel-foot) still gives the card a clean, deliberate bottom edge
   regardless of row count. */
.panel-list-fill > .row:last-child { border-bottom: none; } /* see the
  matching .panel-list-scroll rule above -- same reasoning. */

/* Cases-by-court / cases-by-stage breakdown rows: a label, a proportional
   bar, and a count -- the simplest categorical chart that fits the
   existing row/panel language without pulling in a charting library. */
.breakdown-list { padding: 6px 20px 16px; }
.breakdown-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.breakdown-label {
  /* Sized per panel via --breakdown-label-w (see dashboard/index.html and
     _breakdown_label_width() in dashboard/routes.py) to the longest label
     that panel actually has, instead of one width shared by "Cases by
     court" (long names) and "Cases by stage" (short ones) -- the shared
     width used to leave a dead gap before the bar in whichever panel had
     the shorter labels. 128px is only the fallback for a caller that
     never set the variable. */
  flex: 0 0 var(--breakdown-label-w, 128px); font-size: 12.5px; color: var(--text-secondary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.breakdown-track { flex: 1; height: 7px; background: var(--border-soft); border-radius: 99px; overflow: hidden; }
.breakdown-fill { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.breakdown-count { flex: 0 0 26px; text-align: right; font-family: var(--font-mono); font-size: 12px; color: var(--text-tertiary); }

/* Monthly overview panel: a month picker, four stat tiles for the
   selected month, and a small trailing-6-months bar chart underneath. */
.month-overview-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.month-select-form select { width: auto; min-width: 160px; }
.month-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--border-soft);
}
.month-stat-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.month-stat-value { font-family: var(--font-mono); font-size: 19px; font-weight: 600; }

.chart-bars { display: flex; align-items: flex-end; gap: 14px; height: 130px; padding: 18px 20px 16px; }
.chart-bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; min-width: 0; }
.chart-bar-value { font-size: 10.5px; font-family: var(--font-mono); color: var(--text-tertiary); white-space: nowrap; }
.chart-bar { width: 100%; max-width: 34px; min-height: 2px; background: var(--accent); border-radius: 4px 4px 0 0; }
.chart-bar-label { font-size: 11px; color: var(--text-secondary); }

/* Lands the "Monthly overview" panel's heading clear of the sticky
   mobile topbar (see the @media (max-width: 900px) block below) when
   the browser jumps to #monthly-overview-heading after the month
   <select> reloads the page (see dashboard/index.html's form action) --
   harmless on desktop, where nothing is sticky, and unrelated to the
   panel-highlight glow just above. */
#monthly-overview-heading { scroll-margin-top: 76px; }

/* ---------------------------------------------------------------- */
/* Panels, rows, pills                                                */
/* ---------------------------------------------------------------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(16,24,40,0.04);
  overflow: hidden;
  margin-bottom: 20px;
}

.panel-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft);
  flex-wrap: wrap;
}

.panel-title { font-size: 14.5px; font-weight: 600; margin: 0; }
.panel-count { font-size: 12px; color: var(--text-tertiary); margin-left: auto; }

.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.pill.danger { background: var(--danger-bg); color: var(--danger); }
.pill.warning { background: var(--warning-bg); color: var(--warning); }
.pill.success { background: var(--success-bg); color: var(--success); }
.pill.neutral { background: var(--border-soft); color: var(--text-secondary); }
.pill.on-navy { background: rgba(255,255,255,0.12); color: #fff; }

.row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--border-soft);
  position: relative; /* anchors .row-link-cover below */
}
.panel > .row:last-child, .panel > form:last-child .row:last-child { border-bottom: none; }
/* Rows inside .panel-list-scroll (see above) are no longer direct children
   of .panel, so the rule above doesn't reach the last one -- without this,
   a trailing border-bottom sat right at the scroll cutoff, reading as a
   stray line rather than a clean edge. */
.panel-list-scroll > .row:last-child { border-bottom: none; }

/* A full-row link "underneath" the row's own content, so the whole row
   stays clickable to open the record without wrapping everything in a
   single <a> -- which would make it impossible to also have a separate,
   independently-clickable Edit link inside (browsers don't allow nested
   <a> tags). See matters/list.html and clients/list.html. */
.row-link-cover {
  position: absolute;
  inset: 0;
  z-index: 1;
}
.row-actions {
  position: relative; /* stack above .row-link-cover */
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.row-edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  color: var(--text-tertiary);
  border: 1px solid transparent;
  flex-shrink: 0;
}
.row-edit-btn:hover { background: var(--bg-app); color: var(--text-primary); border-color: var(--border); }

.row-time-col { width: 92px; flex-shrink: 0; }
.row-time { font-family: var(--font-mono); font-size: 13px; font-weight: 600; color: var(--text-primary); margin-top: 4px; }

.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 13.5px; font-weight: 500; }
.row-title .case-no { font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.row-sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.row-tertiary { font-size: 11.5px; color: var(--text-tertiary); margin-top: 2px; }

.fee-row-right { text-align: right; flex-shrink: 0; }
.fee-amount { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.fee-amount.danger { color: var(--danger); }
.fee-note { font-size: 11.5px; color: var(--text-tertiary); margin-top: 3px; }
.fee-note.danger { color: var(--danger); font-weight: 500; }

/* A panel whose list has no natural cap (see dashboard/index.html's
   "Drafts pending" -- pending_drafts is every open draft firm-wide, so a
   busy firm can easily have 40-50 of them) scrolls within itself instead
   of stretching the whole column: .grid's two columns size independently
   (align-items: start, see .grid above), so an uncapped list here used to
   make the right-hand column run far taller than the left one on a wide
   screen. On mobile the columns already collapse to one and the whole
   page scrolls together (see the 900px breakpoint below), which is why
   this never looked wrong there -- so the cap only applies above 900px.
   The panel's own count badge (.panel-count) still shows the true total. */
.panel-list-scroll {
  max-height: 330px; /* ~7 rows before the list scrolls on its own */
  overflow-y: auto;
}
@media (max-width: 900px) {
  .panel-list-scroll { max-height: none; overflow-y: visible; }
}

.panel-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 13px 20px;
  background: var(--bg-app);
  gap: 12px;
  flex-wrap: wrap;
}
.panel-foot-label { font-size: 12px; color: var(--text-secondary); }
.panel-foot-value { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.panel-foot-link { font-size: 12.5px; font-weight: 600; color: var(--accent); text-decoration: none; }
.panel-foot-link:hover { text-decoration: underline; }

/* Editable-fee + revision history (matters/detail.html's Fees panel --
   docs/system-design.md section 13, Option C). The reason/note pair
   inside .fee-reason-wrap is hidden by default and only shown once the
   amount input actually differs from its original value -- see the
   js-fee-* wiring in base.html. */
.fee-reason-wrap { display: inline-flex; gap: 8px; }
.linklike {
  display: inline-block;
  margin: 4px 20px 0;
  padding: 0;
  border: none;
  background: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
}
.linklike:hover { color: var(--accent-hover); text-decoration: underline; }
.fee-history { padding: 2px 20px 12px; }
.fee-history-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-soft);
}
.fee-history-row:last-child { border-bottom: none; }
.fee-history-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.fee-history-what { font-size: 13.5px; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.fee-history-delta { flex: none; font-family: var(--font-mono); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.fee-history-delta.is-down { color: var(--warning); }
.fee-history-amounts { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.fee-history-meta { font-size: 11.5px; color: var(--text-tertiary); }

.fee-payments-list { padding: 2px 20px 12px; }
.fee-payment-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-soft);
}
.fee-payment-row:last-child { border-bottom: none; }
.fee-payment-amount { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.fee-payment-meta { font-size: 11.5px; color: var(--text-tertiary); flex: 1; }
.fee-payment-receipt { margin: 0; }

.draft-text { flex: 1; font-size: 13.5px; }

.empty-row { padding: 20px; text-align: center; color: var(--text-tertiary); font-size: 13px; }

/* ---------------------------------------------------------------- */
/* Search + chips (matters list, clients list)                       */
/* ---------------------------------------------------------------- */

.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }

.search-input {
  flex: 1;
  min-width: 220px;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 12px; color: var(--text-primary);
}
.search-input svg { width: 16px; height: 16px; color: var(--text-tertiary); flex-shrink: 0; }
.search-input input {
  border: none; outline: none; background: none; font-family: var(--font-sans);
  font-size: 13.5px; color: var(--text-primary); width: 100%;
}
.search-input input::placeholder { color: var(--text-tertiary); }
/* The magnifying-glass icon is a real submit button (not just a decorative
   svg), so clicking it works the same as pressing Enter -- see
   matters/list.html and clients/list.html. */
.search-input button {
  display: flex; align-items: center; justify-content: center;
  padding: 0; border: none; background: none; cursor: pointer; flex-shrink: 0;
}

.chips { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; }
.chip {
  flex-shrink: 0; font-size: 12.5px; font-weight: 500; padding: 6px 13px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-secondary); background: var(--surface); white-space: nowrap;
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.list-meta { font-size: 12px; color: var(--text-tertiary); margin: 2px 2px 10px; }

.row-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.row-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.row-foot .row-sub { font-family: var(--font-mono); }
.row-client { font-size: 11.5px; color: var(--text-tertiary); }

/* Pagination footer, shared by every list screen (see _macros.html). */
.pagination {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 14px; padding: 2px 2px 0; flex-wrap: wrap;
}
.pagination-info { font-size: 12px; color: var(--text-tertiary); }
.pagination-controls { display: flex; gap: 8px; }
.pagination-controls .btn-ghost.is-disabled { opacity: 0.4; pointer-events: none; }

/* ---------------------------------------------------------------- */
/* Detail pages: back-row, def-row, timeline, doc-row                */
/* ---------------------------------------------------------------- */

.back-row { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.back-row svg { width: 17px; height: 17px; }
.back-row:hover { color: var(--accent); }

.def-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--border-soft); }
.panel > .def-row:last-child { border-bottom: none; }
.def-label { font-size: 12.5px; color: var(--text-secondary); flex-shrink: 0; }
.def-value { font-size: 13px; font-weight: 500; text-align: right; }
.def-value.mono { font-family: var(--font-mono); font-size: 12.5px; }

.timeline { padding: 6px 20px 14px; }
.tl-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-soft); }
.timeline > .tl-item:last-child { border-bottom: none; }
.tl-rail { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; padding-top: 3px; }
.tl-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.tl-item.latest .tl-dot { background: var(--danger); }
.tl-line { flex: 1; width: 1px; background: var(--border); margin-top: 4px; }
.tl-content { flex: 1; min-width: 0; }
.tl-date { font-family: var(--font-mono); font-size: 12px; font-weight: 600; margin-bottom: 3px; }
.tl-time { font-weight: 400; color: var(--text-tertiary); }
.tl-text { font-size: 13px; line-height: 1.5; margin-bottom: 5px; }
.tl-next { font-size: 11.5px; color: var(--text-secondary); }
.tl-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--success); margin-top: 5px; }
.tl-badge svg { width: 12px; height: 12px; }

.doc-row { display: flex; align-items: center; gap: 11px; padding: 11px 20px; border-bottom: 1px solid var(--border-soft); }
.panel > .doc-row:last-child { border-bottom: none; }
.doc-icon { width: 32px; height: 32px; border-radius: 7px; background: var(--accent-bg); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.doc-icon svg { width: 16px; height: 16px; color: var(--accent); }
.doc-name { font-size: 13px; font-weight: 500; }
.doc-meta { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }

/* ---------------------------------------------------------------- */
/* Forms                                                              */
/* ---------------------------------------------------------------- */

.form-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 1px 2px rgba(16,24,40,0.04); padding: 24px; max-width: 640px; }

.field-group { margin-bottom: 18px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-primary); margin-bottom: 7px; }
.field-hint { font-size: 11.5px; color: var(--text-tertiary); margin-top: 6px; }
.field-error { font-size: 11.5px; color: var(--danger); margin-top: 6px; }

.field-input, select.field-input {
  width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font-family: var(--font-sans); font-size: 13.5px; color: var(--text-primary);
}
.field-input:focus, select.field-input:focus { outline: none; border-color: var(--accent); }
.field-input.mono { font-variant-numeric: tabular-nums; }
.field-input.error { border-color: var(--danger); }
textarea.field-input { resize: vertical; min-height: 96px; line-height: 1.5; font-family: var(--font-sans); height: auto; }

/* Native <select> ships its own OS-drawn chrome (an internal arrow gutter,
   its own vertical centering) that a plain padding/border match against
   .field-input never quite lines up with -- it renders a couple of
   pixels taller than a text input even with identical CSS, and the arrow
   looks like a different design language entirely. `appearance: none`
   strips that chrome so the select becomes a plain bordered box governed
   by the same padding/border/font rules as .field-input above, which is
   what actually makes the two match pixel-for-pixel instead of just
   looking close. We then have to draw our own arrow (a chevron in the
   same outline-icon style used elsewhere in the app -- see layout.html's
   nav icons: 1.7px stroke, rounded caps) since appearance: none removes
   the native one along with the rest of the chrome.
   The *open* options list is a separate matter -- it's native OS
   rendering with no CSS hook in any browser shipping today, so it can't
   be color-matched this way. That's an accepted trade-off, not an
   oversight: a fully custom listbox would need its own keyboard nav,
   focus handling and mobile touch behavior rebuilt by hand, which isn't
   worth it just to reskin a popup most users don't register as "wrong"
   once the closed control matches. */
select.field-input, .custom-select-button {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2398A2B3' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px 16px;
}

/* Client-search combobox (matters/new.html, matters/edit.html) -- a text
   .field-input standing in for the old <select> full of every client,
   plus an absolutely-positioned results panel swapped in by HTMX as the
   user types (see clients/routes.py's search() and the client-search
   script in base.html, which turns a click/keyboard-select on a result
   into filling the hidden client_id input below). position: relative on
   the wrapper is what anchors the results panel to this field specifically
   rather than the page.

   The same visual rules (.client-search-list/-option/-empty below) are
   shared with .custom-select-list/-option/-empty just underneath --
   both are "a small app-styled popup listing choices, one of which gets
   highlighted/clicked", just fed differently (an HTTP search vs. a
   fixed list of <option>s already sitting in the DOM). Sharing one
   ruleset under both class names means fixing/tuning the look once
   fixes it everywhere, and guarantees the two can never quietly drift
   apart into two different "app style" dropdowns. */
.client-search, .custom-select, .lov-combobox { position: relative; }
.client-search-results:empty, .custom-select-results:empty, .lov-combobox-results:empty { display: none; }
.client-search-list, .client-search-empty {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 4px 12px rgba(16,24,40,0.09);
  max-height: 280px; overflow-y: auto;
}
/* .custom-select-list/-empty float via `position: fixed` instead, with
   their on-screen position computed by base.html's script -- see the
   comment on positionList() there for why: anchoring them to their
   wrapper with `position: absolute` (like .client-search-list above)
   left them clipped by `.panel`'s `overflow: hidden` (used for its own
   rounded corners) whenever they opened near the bottom of a card, e.g.
   matters/detail.html's Record payment / Upload document selects --
   both the last control in their panel, so the dropdown had nowhere to
   open without being cut off. */
.custom-select-list, .custom-select-empty, .lov-combobox-list, .lov-combobox-empty {
  position: fixed; z-index: 20;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 4px 12px rgba(16,24,40,0.09);
  max-height: 280px; overflow-y: auto;
}
.client-search-empty, .custom-select-empty, .lov-combobox-empty { padding: 10px 12px; font-size: 13px; color: var(--text-tertiary); }
.client-search-option, .custom-select-option, .lov-combobox-option {
  padding: 9px 12px; font-size: 13.5px; color: var(--text-primary); cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.client-search-option:not(:last-child), .custom-select-option:not(:last-child),
.lov-combobox-option:not(:last-child) { border-bottom: 1px solid var(--border-soft); }
.client-search-option:hover, .client-search-option.is-active,
.custom-select-option:hover, .custom-select-option.is-active,
.lov-combobox-option:hover, .lov-combobox-option.is-active { background: var(--accent-bg); }
.client-search-sub { font-size: 12px; color: var(--text-tertiary); flex-shrink: 0; }
.custom-select-option.is-selected { font-weight: 600; }
/* Search box pinned to the top of a searchable custom-select's open list
   (currently just the dashboard's month picker -- see the
   js-select-searchable comment in base.html). `position: sticky` keeps
   it visible while the option rows below it scroll, inside the same
   rounded/bordered box (.custom-select-list) rather than a second
   floating panel of its own -- matching corners included, hence the
   top-radius here mirroring that container's. */
.custom-select-search {
  display: block; width: 100%; box-sizing: border-box;
  position: sticky; top: 0; z-index: 1;
  border: none; border-bottom: 1px solid var(--border-soft);
  border-top-left-radius: 8px; border-top-right-radius: 8px;
  padding: 9px 12px; font-family: var(--font-sans); font-size: 13.5px;
  color: var(--text-primary); background: var(--surface);
}
.custom-select-search:focus { outline: none; }
/* The trailing "+ Add '<query>'" row every List of values combobox
   (Stage/Document type/Draft type/Client document type -- see the
   lov-combobox script in base.html) always offers when what's typed
   isn't an exact match yet -- same accent used for primary buttons/
   links elsewhere, so it reads as "an action", not just another value,
   without introducing a new color into this popup. */
.lov-combobox-option.is-add { color: var(--accent); font-weight: 600; }
.lov-combobox-option.is-add:hover, .lov-combobox-option.is-add.is-active { background: var(--accent-bg); }

/* Generic replacement for every *other* plain <select class="field-input">
   in the app (Matter type, Assigned advocate, Currency, Payment mode,
   Document type, Aadhaar/PAN, email/storage provider, the dashboard
   month picker) -- see base.html's custom-select script, which finds
   every select.field-input on the page and progressively enhances it
   into one of these on load. The underlying <select> stays in the DOM
   (a form still submits its value normally, and any existing code that
   reads/listens to that select by id -- see settings/index.html's
   provider-switching script -- keeps working untouched) but is visually
   hidden; this button is the thing a person actually sees and clicks,
   styled identically to .field-input/select.field-input (same base
   rule, same appearance:none + chevron treatment) so swapping one
   in for the other is invisible at rest -- the only visible difference
   shows up when it's open, which is the whole point: an app-colored
   list instead of the OS's own unstylable one. */
.custom-select-native {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.custom-select-button {
  /* No `font: inherit` here on purpose -- that shorthand would reset
     font-size/family/weight back to whatever the wrapper div inherits
     (the page's base size, larger than our fields), clobbering the
     13.5px .field-input already sets on this same button since this
     rule sits later in the cascade at equal (class-selector) specificity.
     The shared `.field-input` class handles normalizing the native
     <button> font already -- nothing extra needed here. */
  display: block; width: 100%; text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  /* min-height, not just padding, because renderLabel() sets this
     button's textContent to '' whenever the select's current value is
     the blank/placeholder option (e.g. a select-type custom field like
     "Client Type" before anything's chosen, or its native counterpart
     app/forms/clients.py's id_doc_type with no value on file). Outside
     .inline-form (which sets an explicit height: 36px of its own),
     nothing else was pinning this button's height to a line of text --
     so with no text node at all, the box collapsed to just its own
     vertical padding, visibly shorter than every other selected state.
     min-height keeps every custom-select the same height regardless of
     whether anything's selected yet. */
  min-height: 36px;
}
.custom-select-button:focus { outline: none; border-color: var(--accent); }
.custom-select-button.is-disabled { background-color: var(--bg-soft, #f4f5f7); color: var(--text-tertiary); cursor: not-allowed; }

.dropzone {
  border: 1.5px dashed var(--border); border-radius: 10px; padding: 22px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  background: var(--surface); cursor: pointer;
}
.dropzone svg { width: 26px; height: 26px; color: var(--text-tertiary); }
.dropzone-title { font-size: 13px; font-weight: 500; }
.dropzone-sub { font-size: 11.5px; color: var(--text-tertiary); }
.dropzone input[type="file"] { display: none; }
/* Applied by the file-name-indicator script in base.html once a file is
   actually chosen -- otherwise a click that didn't register (wrong file
   type cancelled, dialog dismissed) looks identical to a successful
   pick, since the dropzone's own text never changed. */
.dropzone.has-file { border-style: solid; border-color: var(--success); background: var(--success-bg); }
.dropzone.has-file svg { color: var(--success); }

/* Same purpose for a plain (non-dropzone) <input type="file">, e.g. the
   Documents panel's inline upload row -- shows the chosen filename right
   next to the input instead of leaving no visible trace of the pick. */
.file-name-indicator { font-size: 11.5px; color: var(--text-tertiary); }
.file-name-indicator.has-file { color: var(--success); font-weight: 500; }

.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

/* Settings screen: one tabbed card (Email sender / Notifications /      */
/* Google Calendar) instead of a single long scroll -- see              */
/* templates/settings/index.html. Tab labels carry the section identity */
/* now, so panels don't repeat it as a heading the way the old stacked  */
/* layout needed to.                                                    */
/* 1040px (was 640px): at 640px the Client fields / Matter fields table
   (see .custom-field-row below) had nowhere near enough room for its
   fixed-width columns and the action-button column got clipped by this
   card's own `overflow: hidden`, and the now-7-wide tab row (Team,
   Client fields, Matter fields all added later) had to horizontally
   scroll -- or, with `flex-wrap` alone, dropped its last tab onto an
   awkward lone second line -- to show its later tabs even on a large
   monitor. Measured: the 7 tabs (icon + label each) need ~982px of
   content width laid out on one line, so 1040px leaves a little slack.
   The simple Email/Notifications/Calendar forms below don't need the
   extra width, but `.field-row` uses `fr` units so they just gain a bit
   of breathing room rather than looking broken. */
.settings-card { max-width: 1040px; padding: 0; overflow: hidden; }
.settings-tabs {
  display: flex; flex-wrap: wrap; row-gap: 4px; gap: 4px; padding: 0 20px; border-bottom: 1px solid var(--border-soft);
  overflow-x: auto;
}
.settings-tab {
  display: flex; align-items: center; gap: 7px;
  font-family: var(--font-sans); font-size: 13.5px; font-weight: 600; color: var(--text-secondary);
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: 15px 6px; margin: 0 12px -1px 0; cursor: pointer; white-space: nowrap;
}
.settings-tab svg { width: 15px; height: 15px; flex-shrink: 0; }
.settings-tab:hover { color: var(--text-primary); }
.settings-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.settings-tab-panels { padding: 22px 24px 24px; }
.settings-tab-panel[hidden] { display: none; }
.settings-tab-dot {
  width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; background: var(--text-tertiary);
}
.settings-tab-dot.on { background: var(--success); }
.settings-subsection-title {
  font-family: var(--font-sans); font-size: 12.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.03em; color: var(--text-tertiary); margin: 20px 0 12px; padding-top: 18px;
  border-top: 1px solid var(--border-soft);
}
.settings-tab-panel > .settings-subsection-title:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.settings-callback-url {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: 8px;
  padding: 9px 12px; margin-bottom: 14px; font-family: var(--font-mono); font-size: 12px;
  color: var(--text-primary); overflow-x: auto; white-space: nowrap;
}
.settings-provider-block { margin-bottom: 18px; }
.checkbox-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 14px;
  font-size: 13px; color: var(--text-primary);
}
.checkbox-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); flex-shrink: 0; }
/* background-color, not the background shorthand -- select.field-input's
   chevron (see above) is a background-image, and the shorthand would
   silently wipe it out on every disabled select. */
fieldset[disabled] .field-input, fieldset[disabled] select.field-input { background-color: var(--bg-soft, #f4f5f7); color: var(--text-tertiary); }

/* Small inline "add a ___" / "record a ___" forms embedded at the foot
   of a panel (fees, drafts, documents). Every control gets the same
   explicit height + box-sizing so a native <select>, a text <input>
   and a <button> line up exactly, instead of relying on each element's
   own (inconsistent) intrinsic height. */
.inline-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 14px 20px;
  border-top: 1px solid var(--border-soft);
}
.inline-form .field-input,
.inline-form select.field-input,
.inline-form .btn-ghost,
.inline-form input[type="file"] {
  height: 36px;
  box-sizing: border-box;
  padding: 0 12px;
}
/* The rule above's `padding: 0 12px` shorthand would otherwise reset the
   right-side room select.field-input/.custom-select-button reserves for
   its chevron (see above) back down to 12px, crowding the arrow into the
   selected text. */
.inline-form select.field-input, .inline-form .custom-select-button { padding-right: 34px; }
.inline-form .btn-ghost {
  display: inline-flex;
  align-items: center;
  border: 1px solid transparent; /* matches .field-input's border box-model so heights match exactly */
  margin-left: auto;
}
.inline-form input[type="file"] {
  padding: 7px 12px;
  line-height: 1.3;
  flex: 1;
  min-width: 160px;
}

.sticky-bar {
  position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--border);
  padding: 12px 18px; display: none; gap: 10px; z-index: 5;
}

/* ---------------------------------------------------------------- */
/* Responsive: below the shell breakpoint, swap sidebar for           */
/* topbar + bottom tabbar, matching the mobile mockups.               */
/* ---------------------------------------------------------------- */

@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar { display: none; }

  .topbar-mobile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--navy);
    color: #fff;
    padding: 14px 16px;
    position: sticky;
    top: 0;
    z-index: 10;
  }
  .topbar-mobile .brand { display: flex; align-items: center; gap: 10px; }
  .topbar-mobile .brand-name { font-size: 13px; font-weight: 600; }
  .topbar-mobile .brand-role { font-size: 11px; color: var(--navy-dim); margin-top: 1px; }

  .main { padding: 16px 16px 90px; max-width: 100%; }

  .page-title { font-size: 19px; }
  .metrics { gap: 8px; margin-bottom: 20px; }
  .metric { padding: 11px 10px; }
  .metric-value { font-size: 16px; }
  .metric-label { font-size: 10.5px; }

  .grid { grid-template-columns: 1fr; gap: 0; }
  .col { gap: 0; }

  .dashboard-grid {
    grid-template-columns: 1fr;
    grid-template-areas: "primary-1" "primary-2" "secondary-1" "secondary-2";
    gap: 0;
  }
  .dashboard-grid .panel { margin-bottom: 20px; }

  .panel-head, .row, .def-row, .doc-row, .panel-foot, .timeline { padding-left: 16px; padding-right: 16px; }

  .tabbar {
    display: flex;
    background: var(--navy);
    padding: 9px 4px 13px;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 10;
  }
  .tab {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
    color: var(--navy-dim); background: none; border: none; font-family: var(--font-sans);
    padding: 0;
  }
  .tab.active { color: #fff; }
  .tab svg { width: 20px; height: 20px; }
  .tab-label { font-size: 10px; font-weight: 500; }

  .sticky-bar { display: flex; margin: 0 -16px -90px; }
  .btn-primary-full { flex: 1; }

  .field-row { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- */
/* Settings > Client fields / Matter fields -- see
   app/templates/settings/_custom_fields_panel.html and the design memo
   ("Practice-Specific Matter Fields", revision 2). */

.custom-field-table {
  display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden;
}
.custom-field-row {
  display: grid; grid-template-columns: minmax(140px, 1.6fr) 90px 130px 90px 90px 132px;
  gap: 10px; align-items: center; padding: 10px 14px; font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.custom-field-row:last-child { border-bottom: none; }
.custom-field-row.header {
  background: var(--bg-soft, #f7f8fa); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .03em; color: var(--text-tertiary);
}
.custom-field-row.is-inactive { opacity: .55; }
.custom-field-name { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.custom-field-actions { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.mk-icon-btn-real {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-secondary); font-size: 13px;
  cursor: pointer; text-decoration: none; line-height: 1;
}
.mk-icon-btn-real:hover { background: var(--bg-soft, #f4f5f7); color: var(--text); }

.custom-field-divider {
  display: flex; align-items: center; gap: 10px; margin: 18px 0 14px;
}
.custom-field-divider .line { flex: 1; height: 1px; background: var(--border); }
.custom-field-divider .label {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-tertiary); white-space: nowrap;
}

@media (max-width: 720px) {
  .custom-field-row {
    grid-template-columns: 1fr; gap: 4px; padding: 12px 14px;
  }
  .custom-field-row.header { display: none; }
  .custom-field-actions { justify-content: flex-start; margin-top: 6px; }
}

/* ---------------------------------------------------------------- */
/* Settings > List of values -- see
   app/templates/settings/_list_of_values_panel.html and
   app/models/list_of_value.py. Same visual language as the Client/
   Matter fields table just above (.custom-field-table/-row,
   .mk-icon-btn-real), just a 3-column layout instead of 6. */

.lov-table {
  display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; margin-bottom: 10px;
}
.lov-row {
  display: grid; grid-template-columns: 1fr 110px 132px;
  gap: 10px; align-items: center; padding: 9px 14px; font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.lov-row:last-child { border-bottom: none; }
.lov-row.header {
  background: var(--bg-soft, #f7f8fa); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .03em; color: var(--text-tertiary);
}
.lov-row.is-inactive { opacity: .55; }
.lov-row.is-pending { background: var(--warning-bg); }
.lov-actions { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.lov-add-row { display: flex; gap: 8px; margin-bottom: 18px; }
.lov-add-row .field-input { flex: 1; }

/* Settings > Roles & permissions -- its own classes rather than reusing
   .lov-table/.lov-row with a per-instance inline grid-template-columns
   override (the previous approach): an inline style always wins over
   the @media rule below, which used to defeat the mobile stacking
   .lov-row otherwise gets -- the fix here isn't a media-query tweak,
   it's simply not fighting the cascade with inline styles in the first
   place. See app/templates/settings/_roles_permissions_panel.html. */
.perm-table {
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 10px;
}
.perm-row {
  display: grid; grid-template-columns: 1fr 90px 90px 90px;
  gap: 10px; align-items: center; padding: 9px 14px; font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.perm-row:last-child { border-bottom: none; }
/* Repeated at the top of every feature group's table (not just once at
   the very top of the panel) -- scrolling past "Clients" into "Fees"
   used to leave no reminder of which column was which role. */
.perm-row-header {
  background: var(--bg-soft, #f7f8fa); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .03em; color: var(--text-tertiary);
}
/* The whole cell is the clickable target (a <label> wrapping its
   checkbox), not just the ~13px checkbox glyph itself -- a few px of
   centered padding around a native checkbox was a real Fitts's-law
   problem, easy to miss on a touch screen especially. */
.perm-cell {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 4px; margin: -8px -4px; border-radius: 6px; cursor: pointer;
}
.perm-cell:hover { background: var(--accent-bg); }
.perm-cell input[type="checkbox"] { width: 15px; height: 15px; cursor: pointer; flex-shrink: 0; }
/* Visible only once stacked to a single column on mobile (see the
   media query below) -- on desktop the header row above already says
   "Advocate"/"Associate"/"Clerk" once per group, so repeating it next
   to every single checkbox would be noise. Screen readers get the role
   name either way, from each checkbox's own aria-label. */
.perm-cell-role { display: none; font-size: 11.5px; color: var(--text-tertiary); }
.perm-cell.is-disabled { cursor: not-allowed; }
.perm-cell.is-disabled:hover { background: none; }

@media (max-width: 720px) {
  .perm-row { grid-template-columns: 1fr; gap: 8px; padding: 12px 14px; }
  .perm-row-header { display: none; }
  .perm-cell { justify-content: flex-start; margin: 0; padding: 4px 0; }
  .perm-cell-role { display: inline; }
}

/* List of values -- left nav (one entry per list_key) + right detail
   pane, replacing the old "every list stacked in one scroll" layout
   (see app/templates/settings/_list_of_values_panel.html). Deliberately
   plain flex, not the .settings-tabs horizontal-tab pattern above --
   this needs to scale to more than a handful of lists without running
   out of horizontal room the way a tab row would. */
.lov-layout { display: flex; gap: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.lov-nav {
  width: 200px; flex-shrink: 0; border-right: 1px solid var(--border);
  padding: 10px; background: var(--bg-soft, #f7f8fa);
}
.lov-nav-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
  padding: 9px 10px; border-radius: 7px; font-size: 12.5px; font-weight: 600;
  color: var(--text-secondary); background: none; border: none; text-align: left; margin-bottom: 2px;
  font-family: inherit; cursor: pointer;
}
.lov-nav-item:hover { color: var(--text-primary); }
.lov-nav-item.active { background: var(--accent-bg); color: var(--accent-hover); }
.lov-nav-meta { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.lov-nav-count { font-size: 11px; font-weight: 600; color: var(--text-tertiary); }
.lov-nav-item.active .lov-nav-count { color: var(--accent-hover); }
.lov-nav-badge {
  font-size: 9.5px; font-weight: 700; background: var(--warning-bg); color: var(--warning);
  border-radius: 20px; padding: 1px 6px;
}
.lov-detail { flex: 1; min-width: 0; padding: 18px 20px 20px; }
.lov-detail-title { font-size: 14.5px; margin: 0 0 12px; }

@media (max-width: 720px) {
  .lov-layout { flex-direction: column; }
  .lov-nav {
    width: auto; border-right: none; border-bottom: 1px solid var(--border);
    display: flex; overflow-x: auto; gap: 4px;
  }
  .lov-nav-item { white-space: nowrap; margin-bottom: 0; }
  .lov-row { grid-template-columns: 1fr; gap: 4px; padding: 12px 14px; }
  .lov-row.header { display: none; }
  .lov-actions { justify-content: flex-start; margin-top: 6px; }
}

/* --- Client intake (staff form, review, public link) ----------------------- */
.intake-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; padding: 16px 20px 4px; }
.intake-full { grid-column: 1 / -1; }
.intake-pad { padding: 14px 20px 16px; }
.intake-error { display: flex; margin: 0 0 12px; padding: 10px 14px; font-size: 13px; }
.intake-consent { padding: 14px 20px 16px; }
.mr { font-size: 11.5px; font-weight: 400; color: var(--text-tertiary); margin-left: 6px; }
.req { color: var(--danger); }
.yesno { display: flex; gap: 18px; padding: 6px 0; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 4px 0; }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 4px 0; }
.check-line-group { display: grid; gap: 4px; margin-bottom: 8px; }
.table-wrap { overflow-x: auto; margin-bottom: 8px; }
.intake-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.intake-table th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--text-secondary); padding: 4px 6px; white-space: nowrap; }
.intake-table td { padding: 3px 6px 3px 0; vertical-align: top; min-width: 110px; }
.chip-x { border: 0; background: transparent; color: var(--text-tertiary); font-size: 18px; cursor: pointer; line-height: 1; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--border-soft); border-radius: 6px; padding: 3px 8px; font-size: 12.5px; margin: 0 6px 6px 0; }
.file-add { display: flex; gap: 8px; align-items: center; }
.file-add .field-input { flex: 1; }
.stickybar.always { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 10px; padding: 12px 0; background: var(--bg-app); }
.view-row { display: grid; grid-template-columns: 240px 1fr; gap: 12px; padding: 8px 20px; border-top: 1px solid var(--border-soft); font-size: 13px; }
.view-label { color: var(--text-secondary); }
.tab-pill { padding: 6px 12px; border-radius: 999px; font-size: 13px; color: var(--text-secondary); text-decoration: none; }
.tab-pill.active { background: var(--accent); color: #fff; }
.settings-tabs-inline { display: flex; gap: 4px; flex-wrap: wrap; }
.count-dot { background: var(--danger); color: #fff; border-radius: 999px; padding: 0 6px; font-size: 11px; margin-left: 4px; }
.public-wrap { max-width: 760px; margin: 0 auto; padding: 24px 16px 80px; }
.public-head h1 { font-size: 22px; margin: 6px 0; }
.public-firm { font-size: 13px; font-weight: 600; color: var(--accent); }
@media (max-width: 700px) {
  .intake-grid { grid-template-columns: 1fr; }
  .view-row { grid-template-columns: 1fr; gap: 2px; }
}

/* --- Intake, mock-style building blocks (prefix ix-) --------------------------
   Choice chips, stat cards, sheets, step bar, notices. Same palette as the app. */
.ix-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0; }
.ix-chip { position: relative; display: inline-flex; }
.ix-chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.ix-chip > span { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 5px 14px; border-radius: 18px; border: 1px solid var(--border); background: var(--surface); font-size: 13px; color: var(--text-primary); }
.ix-chip input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.ix-chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.ix-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.ix-stat { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.ix-stat small { display: block; color: var(--text-secondary); font-size: 12px; margin-bottom: 2px; }
.ix-stat b { font-size: 19px; font-weight: 650; font-variant-numeric: tabular-nums; }
.ix-stat.hl { background: var(--accent-bg); border-color: transparent; }
.ix-sheet { background: var(--bg-app); border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin: 12px 18px; }
.ix-sheet[hidden] { display: none; }
.ix-okb, .ix-warnb, .ix-lockb { border-radius: 8px; padding: 9px 12px; font-size: 13px; margin: 10px 0; }
.ix-okb { background: var(--success-bg); color: var(--success); }
.ix-warnb { background: var(--warning-bg); color: var(--warning); }
.ix-lockb { background: var(--border-soft); color: var(--text-secondary); }
.ix-note { background: var(--accent-bg); border-radius: 10px; padding: 11px 14px; font-size: 13px; margin-bottom: 14px; }
.ix-split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.ix-split > .ix-side { position: sticky; top: 16px; }
.ix-tot { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 14px; }
.ix-tot.big { font-weight: 650; border-top: 1px solid var(--border); margin-top: 4px; padding-top: 10px; }
.ix-tot span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ix-fi { display: flex; gap: 10px; align-items: center; padding: 9px 18px; border-bottom: 1px solid var(--border-soft); }
.ix-fi .b { flex: 1; min-width: 0; }
.ix-fi .a { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.ix-fi input[type=checkbox], .ix-fi input[type=radio] { width: 17px; height: 17px; accent-color: var(--accent); }
.ix-fi select, .ix-fi input.field-input { width: auto; }
.ix-collapsible > .panel-head { cursor: pointer; }
.ix-collapsible.collapsed > :not(.panel-head) { display: none; }
.ix-car { color: var(--text-tertiary); font-size: 12px; margin-left: auto; }
.ix-switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; margin-left: auto; cursor: pointer; }
.ix-switch input { width: 17px; height: 17px; accent-color: var(--accent); }
.ix-diff { display: grid; gap: 6px; font-size: 13.5px; padding: 0 18px 14px; }
.ix-diff > div { display: flex; gap: 10px; align-items: baseline; padding: 6px 10px; border-radius: 6px; background: var(--bg-app); }
.ix-okic { width: 46px; height: 46px; border-radius: 50%; background: var(--success-bg); color: var(--success); display: grid; place-items: center; font-size: 22px; font-weight: 700; }
.ix-pill-link { cursor: pointer; }

/* step bar + step flow (staff form and client link) */
.ix-bar { background: var(--navy); color: #fff; border-radius: 12px 12px 0 0; padding: 14px 18px 12px; }
.ix-bar .r { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: space-between; }
.ix-bar small { color: var(--navy-dim); font-size: 12px; }
.ix-bar .step { font-size: 12.5px; color: #C5CEE0; margin-top: 8px; display: flex; gap: 12px; justify-content: space-between; align-items: baseline; min-height: 18px; }
#ix-step-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ix-bars { display: flex; gap: 4px; margin-top: 8px; }
.ix-bars i { flex: 1; height: 4px; border-radius: 2px; background: #33436A; }
.ix-bars i.on { background: #7FB1E3; }
.ix-lang { display: inline-flex; border: 1px solid #3A4A6E; border-radius: 8px; overflow: hidden; margin-left: auto; }
.ix-lang button { background: transparent; border: 0; color: #C5CEE0; padding: 4px 11px; font-size: 12px; cursor: pointer; min-height: 28px; }
.ix-lang button[aria-pressed="true"] { background: #fff; color: var(--navy); font-weight: 600; }
.ix-flow { background: var(--bg-app); border: 1px solid var(--border); border-top: 0; border-radius: 0 0 12px 12px; padding: 14px; }
.ix-js .ix-step { display: none; }
.ix-js .intake-grid { grid-template-columns: minmax(0, 1fr); max-width: 680px; }
.ix-js .ix-step.current { display: block; }
.ix-nav { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--border); background: var(--bg-app); position: sticky; bottom: 0; border-radius: 0 0 12px 12px; }
.ix-nav .btn-secondary, .ix-nav .btn-primary, .ix-nav .btn-ghost { flex: 1; min-height: 44px; justify-content: center; text-align: center; }
.ix-saved { font-size: 12px; color: var(--navy-dim); flex: none; white-space: nowrap; }
.ix-saved.err { color: #F5B454; }
[data-lang="mr"] .l-en { display: none; }
[data-lang="en"] .l-mr { display: none; }
.l-mr { font-family: 'Noto Sans Devanagari', var(--font-sans); }
@media (max-width: 900px) { .ix-split { grid-template-columns: minmax(0, 1fr); } .ix-split > .ix-side { position: static; } }
.panel .intake-table th:first-child, .panel .intake-table td:first-child { padding-left: 18px; }
.panel .intake-table th:last-child, .panel .intake-table td:last-child { padding-right: 18px; }

/* Form-builder destination list. A real list box, not the app's collapsed
   select: `select.field-input` sets appearance:none, which makes a sized
   <select> render as a one-line box with a chevron instead of a list. */
select.ix-list {
  width: 100%; height: 300px; appearance: listbox; -webkit-appearance: listbox;
  background: var(--surface); background-image: none; border: 1px solid var(--border);
  border-radius: 8px; padding: 4px; font-family: var(--font-sans); font-size: 13.5px;
  color: var(--text-primary); cursor: pointer;
}
select.ix-list:focus { outline: none; border-color: var(--accent); }
select.ix-list optgroup { font-size: 11.5px; color: var(--text-tertiary); font-weight: 600; padding-top: 4px; }
select.ix-list option { padding: 5px 8px; color: var(--text-primary); }
select.ix-list option:checked { background: var(--accent-bg); color: var(--navy); font-weight: 600; }

/* A count carried inside a filter chip ("Draft 2"). Muted, so the eye reads
   the label first and the tally second; a zero chip is dimmed as a whole so
   the buckets with work in them stand out. */
.chip .chip-n { margin-left: 5px; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text-tertiary); }
.chip.active .chip-n { color: #fff; opacity: 0.7; }
.chip.is-zero { color: var(--text-tertiary); border-color: var(--border-soft); }
.chip.is-zero .chip-n { opacity: 0.55; }
/* A row of controls inside a sheet. Kept in CSS, not an inline style: an
   inline `display` beats the `hidden` attribute, which left these open. */
.ix-rowform { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ix-rowform[hidden], .ix-sheet[hidden] { display: none; }
/* Several controls in a page header. `.page-head` spreads its children
   apart, so a screen with more than one action groups them in here. */
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* --- Intake: send back, follow-up requests, review (prefix ix- / rv- / rq-) ----------------
   Same tokens as the rest of the app. Nothing here changes size on click or selection:
   panels open in place, flags tint with padding that is already reserved, checkboxes never
   change the row. */
.ix-ask { background: var(--warning-bg); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; font-size: 13.5px; }
.ix-ask b { color: var(--warning); }
.ix-ask p { margin: 4px 0 0; white-space: pre-line; color: var(--text-primary); }
.ix-ask small { display: block; margin-top: 6px; color: var(--text-secondary); }
.field-group.ix-flag { background: var(--warning-bg); border-radius: 8px; margin: 0 -12px 18px; padding: 10px 12px 12px; }
.ix-flag-hint { font-size: 12px; color: var(--warning); margin: -2px 0 7px; }
/* --- a matter's fees ---------------------------------------------------- */
.fee-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; padding: 14px 18px 4px; }
.fee-totals > div { background: var(--bg-app); border-radius: 10px; padding: 11px 14px; }
.fee-totals > div.hl { background: var(--accent-bg); }
.fee-totals > div.nc b { color: var(--text-tertiary); }
.fee-totals small { display: block; color: var(--text-secondary); font-size: 12px; margin-bottom: 2px; }
.fee-totals b { font-size: 19px; font-weight: 650; font-variant-numeric: tabular-nums; }
.fee-aside { margin: 0; padding: 4px 18px 10px; color: var(--text-secondary); font-size: 13px; }
.fee-group { padding: 14px 18px 4px; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.fee-item { display: flex; align-items: baseline; gap: 12px; padding: 9px 18px; border-bottom: 1px solid var(--border-soft); }
.fee-item-main { flex: 1; min-width: 0; }
.fee-item-name { font-size: 13.5px; font-weight: 500; }
.fee-item-meta { font-size: 12.5px; color: var(--text-tertiary); }
.fee-item-amount { font-size: 13.5px; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.fee-item.is-waived .fee-item-name, .fee-item.is-waived .fee-item-amount { text-decoration: line-through; color: var(--text-tertiary); }
.fee-item-edit { flex: none; }

.ix-sendback > summary { list-style: none; cursor: pointer; display: inline-flex; }
.ix-sendback > summary::-webkit-details-marker { display: none; }
.ix-sendback[open] > summary { margin-bottom: 10px; }
.ix-sendback-body { background: var(--bg-app); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.ix-pick { margin: 0 0 14px; }
.ix-pick > summary { cursor: pointer; font-size: 13px; color: var(--accent); margin-bottom: 8px; }
.ix-pick-sec { font-size: 12.5px; font-weight: 600; margin: 10px 0 2px; color: var(--text-secondary); }
.ix-sendrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ix-sendrow .field-input { width: 240px; max-width: 100%; }

.rv-row { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1fr) 72px; gap: 8px 18px; align-items: start;
  padding: 14px 20px; border-top: 1px solid var(--border-soft); font-size: 13.5px; }
.rv-row.is-conflict { box-shadow: inset 3px 0 0 var(--warning); }
.rv-label { font-weight: 600; }
.rv-note { font-size: 12px; color: var(--text-tertiary); margin-top: 3px; }
.rv-warn { color: var(--warning); }
.rv-bad { color: var(--danger); }
.rv-cap { font-size: 11.5px; color: var(--text-tertiary); margin-bottom: 2px; }
.rv-text { white-space: pre-line; word-break: break-word; }
.rv-new .rv-text { font-weight: 600; }
.rv-apply { display: flex; align-items: center; gap: 6px; justify-content: flex-end; font-size: 13px; cursor: pointer; }
.rv-apply input { width: 17px; height: 17px; accent-color: var(--accent); }
.rv-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 14px; }
.rv-more { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.rv-more > .ix-sendback[open] { flex: 1 1 100%; }

.rq-formpick { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.rq-formpick .field-label { margin: 0; }
.rq-formpick .field-input { width: 280px; max-width: 100%; }
.rq-sec { border-top: 1px solid var(--border-soft); }
.rq-sec > summary { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 12px 20px; cursor: pointer; font-weight: 600; font-size: 13.5px; list-style: none; }
.rq-sec > summary::-webkit-details-marker { display: none; }
.rq-list { padding: 0 20px 10px; }
.rq-q { display: flex; align-items: center; gap: 10px; padding: 7px 0; cursor: pointer; font-size: 13.5px; }
.rq-q input { width: 17px; height: 17px; accent-color: var(--accent); flex: none; }
.rq-text { flex: 1; min-width: 0; }

@media (max-width: 700px) {
  .rv-row { grid-template-columns: minmax(0, 1fr); }
  .rv-apply { justify-content: flex-start; }
}

/* Intake forms: rename / copy popovers open in place, nothing below moves until opened */
.fm-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; align-items: flex-start; }
.fm-pop > summary { list-style: none; cursor: pointer; }
.fm-pop > summary::-webkit-details-marker { display: none; }
.fm-pop[open] { flex: 1 1 100%; }
.fm-form { display: grid; gap: 8px; max-width: 420px; margin-top: 8px; padding: 12px; border: 1px solid var(--border-soft); border-radius: 8px; background: var(--bg-app); }
.fm-inline { margin-top: 8px; }

.tp-gaps { display: flex; gap: 12px; align-items: center; justify-content: space-between; border-top: 1px solid var(--border-soft); }
.tp-gaps-text { font-size: 13px; color: var(--text-muted); min-width: 0; }
.tp-gaps .btn-ghost { flex: none; white-space: nowrap; }
@media (max-width: 640px) { .tp-gaps { flex-direction: column; align-items: flex-start; } }

/* People tables: one card per person, folded to a one-line summary ------------------- */
.ix-people { display: grid; gap: 10px; margin-bottom: 10px; }
.ix-person { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.ix-person > summary { list-style: none; cursor: pointer; display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 10px; }
.ix-person > summary::-webkit-details-marker { display: none; }
.ix-person > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ix-person[open] > summary { border-bottom: 1px solid var(--border-soft); border-radius: 10px 10px 0 0; }
.ix-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-bg); color: var(--accent); font-weight: 700; font-size: 12.5px; display: grid; place-items: center; flex: none; }
.ix-who { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.ix-who b { font-weight: 600; }
.ix-who span { color: var(--text-secondary); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ix-chev { width: 8px; height: 8px; border-right: 1.6px solid var(--text-tertiary); border-bottom: 1.6px solid var(--text-tertiary); transform: rotate(-45deg); margin-right: 4px; flex: none; }
.ix-person[open] .ix-chev { transform: rotate(45deg); }
.ix-pgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; padding: 14px; }
.ix-pgrid .ix-pfull { grid-column: 1 / -1; }
.ix-pgrid .field-group { margin: 0; min-width: 0; }
.ix-pfoot { display: flex; justify-content: flex-end; padding: 0 14px 10px; }
.ix-link { background: none; border: 0; padding: 4px 6px; font: inherit; font-size: 13px; color: var(--text-secondary); cursor: pointer; }
.ix-link:hover { color: var(--danger); }
@media (max-width: 560px) { .ix-pgrid { grid-template-columns: 1fr; } }

/* Read-only people list (intake view, review, trust profile) */
.pl { display: grid; }
.pl-row { display: grid; grid-template-columns: 32px 1fr; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border-soft); }
.pl-row:first-child { border-top: 0; padding-top: 2px; }
.pl-name { font-weight: 600; }
.pl-meta { font-weight: 400; color: var(--text-secondary); }
.pl-extra { display: flex; flex-wrap: wrap; gap: 2px 14px; color: var(--text-secondary); font-size: 13px; margin-top: 2px; }
.pl-extra i { font-style: normal; color: var(--text-tertiary); }

/* Time question: native picker plus a few common times */
.ix-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.ix-q { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 4px 11px; font: inherit; font-size: 12.5px; color: var(--text-secondary); cursor: pointer; }
.ix-q:hover, .ix-q:focus-visible { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); outline: none; }

/* ---- Settings: grouped left nav + cards of rows ---------------------- */
.set-layout { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 28px; align-items: start; max-width: 1180px; }
.set-nav { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 2px; }
.set-nav-group { font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-tertiary); padding: 16px 12px 6px; }
.set-nav-group:first-child { padding-top: 2px; }
.set-nav-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; font: inherit; font-size: 14px; font-weight: 550; color: var(--text-secondary);
  background: none; border: none; border-radius: 9px; padding: 9px 12px; cursor: pointer; }
.set-nav-item svg { width: 17px; height: 17px; flex: none; }
.set-nav-item:hover { background: var(--bg-app); color: var(--text-primary); }
.set-nav-item.active { background: var(--accent-bg); color: var(--accent); font-weight: 650; }
.set-nav-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.set-nav-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-tertiary); margin-left: auto; }
.set-nav-dot.on { background: var(--success); }
.set-main { min-width: 0; }
.set-main .settings-tab-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.set-main .settings-tab-panel[hidden] { display: none; }
.set-head { padding: 20px 24px 14px; }
.set-head h2 { margin: 0; font-size: 18px; font-weight: 650; color: var(--text-primary); }
.set-head p { margin: 3px 0 0; font-size: 13.5px; color: var(--text-secondary); }
.set-main .settings-tab-panels { padding: 4px 24px 24px; }
.set-main form .settings-tab-panel .settings-tab-panels { padding-top: 4px; }
.set-note { margin: 0 0 6px; font-size: 13px; color: var(--text-secondary); }
.set-group { font-size: 13px; font-weight: 650; color: var(--text-primary); padding: 14px 0 4px; border-bottom: 1px solid var(--border); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 15px 0; border-bottom: 1px solid var(--border-soft); }
.set-row:last-of-type { border-bottom: none; }
.set-row-text { min-width: 0; }
.set-row-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.set-row-hint { font-size: 13px; color: var(--text-secondary); margin-top: 1px; }
.set-row-ctl { flex: none; display: flex; flex-direction: column; align-items: flex-end; }
.set-input { width: 280px; }
.set-switch { appearance: none; -webkit-appearance: none; width: 44px; height: 26px; border-radius: 13px; background: #CBD2DC; position: relative; cursor: pointer; margin: 0; transition: background .15s; flex: none; }
.set-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(16,24,40,.25); transition: transform .15s; }
.set-switch:checked { background: var(--accent); }
.set-switch:checked::after { transform: translateX(18px); }
.set-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
fieldset[disabled] .set-switch { opacity: .55; cursor: not-allowed; }
.set-stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); height: 42px; overflow: hidden; }
.set-stepper button { width: 38px; height: 100%; border: none; background: none; font-size: 18px; line-height: 1; color: var(--text-primary); cursor: pointer; }
.set-stepper button:hover { background: var(--bg-app); }
.set-stepper-input { border: none; background: none; width: 3.2ch; text-align: right; font: inherit; font-weight: 650; font-size: 15px; color: var(--text-primary); padding: 0; -moz-appearance: textfield; appearance: textfield; }
.set-stepper-input::-webkit-outer-spin-button, .set-stepper-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.set-stepper-input:focus { outline: none; }
.set-stepper-unit { color: var(--text-secondary); font-size: 14px; padding: 0 4px 0 6px; }
.set-stepper:focus-within { border-color: var(--accent); }
fieldset[disabled] .set-stepper { opacity: .6; }
@media (max-width: 860px) {
  .set-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .set-nav { position: static; flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 4px; }
  .set-nav-group { display: none; }
  .set-nav-item { width: auto; white-space: nowrap; border: 1px solid var(--border-soft); background: var(--surface); }
  .set-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .set-row-ctl { align-items: flex-start; }
  .set-input { width: 100%; }
}
/* email + notifications panels sit directly inside the form (not in a padded wrapper) */
.set-main form > fieldset > .settings-tab-panels { padding: 0; }
.set-main form .settings-tab-panel { padding-bottom: 24px; }
.set-main form .settings-tab-panel > :not(.set-head),
.set-main .settings-tab-panel > form > fieldset > :not(.set-head) { margin-left: 24px; margin-right: 24px; }
.set-main form .settings-tab-panel > .set-head,
.set-main .settings-tab-panel > form > fieldset > .set-head { margin: 0; }
.set-main .settings-tab-panel > form > fieldset { padding-bottom: 24px !important; }
.set-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.set-head-link { flex: none; margin-top: 2px; padding: 7px 12px; border: 1px solid var(--border); border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--accent); background: var(--surface); text-decoration: none; }
.set-head-link:hover { background: var(--accent-bg); }
.set-row-hint { margin-top: 2px; line-height: 1.4; }
.set-main .form-actions { margin-top: 18px; }
@media (max-width: 860px) {
  .set-row:has(.set-switch) { flex-direction: row; align-items: center; }
  .set-row:has(.set-switch) .set-row-ctl { align-items: flex-end; }
}

/* ---- Settings, part 2: every panel on the same rows ------------------ */
.set-body { padding: 0 24px 24px; }
.set-main .settings-tab-panels.set-body { padding: 0 24px 24px; }
.set-input-sm { width: 120px; }
.set-input-lg { width: 400px; max-width: 100%; }
textarea.set-input { height: auto; min-height: 76px; resize: vertical; }
.set-row-ctl .field-error { margin-top: 4px; text-align: right; }
.set-main .settings-subsection-title { font-size: 13px; font-weight: 650; letter-spacing: 0; text-transform: none; color: var(--text-primary);
  margin: 22px 0 6px; padding: 0 0 6px; border-top: none; border-bottom: 1px solid var(--border); }
.set-main .settings-tab-panel > .settings-subsection-title:first-child { margin-top: 0; }
.set-main .settings-tab-panel .field-hint { font-size: 13px; color: var(--text-secondary); }
.set-main .settings-tab-panel .panel { border: none; box-shadow: none; border-radius: 0; background: none; margin: 0; }
.set-main .settings-tab-panel .panel-head { padding: 0 0 10px; border-bottom: none; }
.set-main .settings-tab-panel .panel-head .panel-title { display: none; }
.set-main .settings-tab-panel .panel .row { padding-left: 0; padding-right: 0; }
.set-main .settings-tab-panel .intake-pad { padding-left: 0; padding-right: 0; }
.set-main .settings-tab-panel .table-wrap { margin: 0; }
.set-main .custom-field-table { border-radius: 10px; }
@media (max-width: 860px) { .set-body, .set-main .settings-tab-panels.set-body { padding: 0 16px 20px; } .set-input-lg { width: 100%; } .set-row-ctl .field-error { text-align: left; } }
.set-input, .set-input-lg { width: 360px; max-width: 100%; }
.set-input-sm { width: 120px; }
.set-row-ctl .inline-form { border: none; padding: 0; background: none; margin: 0; }
.set-row-ctl input[type="file"] { font-size: 13px; max-width: 260px; }
.perm-cell input[type="checkbox"], .perm-table input[type="checkbox"] { accent-color: var(--accent); width: 17px; height: 17px; }
.set-more { margin: 4px 0 6px; font-size: 13px; color: var(--text-secondary); }
.set-more summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.set-more p { margin: 6px 0 0; max-width: 70ch; line-height: 1.5; }
.set-main fieldset { min-width: 0; }
@media (max-width: 860px) {
  .set-main form .settings-tab-panel > :not(.set-head),
  .set-main .settings-tab-panel > form > fieldset > :not(.set-head) { margin-left: 16px; margin-right: 16px; }
  .set-head-row { flex-direction: column; gap: 8px; }
  .set-head { padding: 18px 16px 12px; }
  .set-input, .set-input-lg { width: 100%; }
}

.set-main .settings-tab-panels.set-panels-outer { padding: 0; }

.set-nav a.set-nav-item { text-decoration: none; }
.set-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 13px; color: var(--text-secondary); }
.set-crumbs a { color: var(--accent); font-weight: 600; text-decoration: none; }
.set-crumbs a:hover { text-decoration: underline; }
.set-crumbs [aria-current] { color: var(--text-primary); font-weight: 600; }
.set-sub-title { margin: 0; font-size: 20px; font-weight: 650; color: var(--text-primary); }
.set-sub-text { margin: 3px 0 16px; font-size: 13.5px; color: var(--text-secondary); }

/* ---- Fees list: tiles, filters, slim rows, payment form on demand ---------- */
.fee-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.fee-tile { display: block; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; color: var(--text-primary); text-decoration: none; }
.fee-tile-link:hover { border-color: var(--accent); }
.fee-tile-label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.fee-tile-value { font-size: 24px; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: 2px; letter-spacing: -0.01em; }
.fee-tile-note { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; }
.fee-tile.is-late .fee-tile-value { color: var(--danger); }
.fee-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.fee-toolbar .chips { margin-bottom: 0; }
.fee-search .field-input { width: 280px; max-width: 100%; }
.fee-line { padding: 14px 20px; border-bottom: 1px solid var(--border-soft); }
.fee-line:last-child { border-bottom: none; }
.fee-line-top { display: flex; align-items: center; gap: 18px; }
.fee-line .row-main { flex: 1; min-width: 0; }
.fee-line .row-title a { color: var(--text-primary); }
.fee-matter { margin-top: 2px; }
.fee-line .fee-row-right { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; min-width: 150px; }
.fee-line .fee-amount { font-family: inherit; font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; }
.fee-pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--bg-app); color: var(--text-secondary); }
.fee-pill.is-late { background: #FDECEA; color: #B42318; }
.fee-pill.is-soon { background: #FDF0DE; color: #93500A; }
.fee-pill.is-ok { background: var(--accent-bg); color: var(--accent); }
.fee-pay-btn { flex: none; min-height: 38px; }
.fee-actions { display: flex; gap: 8px; flex: none; }
.fee-remind-form { margin: 0; }
.fee-remind-btn { min-height: 38px; white-space: nowrap; background: var(--surface); border: 1px solid var(--border); }
.fee-remind-btn.is-blocked { opacity: .55; cursor: not-allowed; }
.fee-pay-panel { margin-top: 12px; padding: 14px; background: var(--bg-app); border: 1px solid var(--border-soft); border-radius: 10px; }
html.fees-js .fee-pay-panel:not(.open) { display: none; }
.fee-pay-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.fee-pay-field { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.fee-pay-field .field-input { width: 200px; max-width: 100%; }
.fee-pay-amount .field-input { width: 150px; padding-left: 26px; }
.fee-money { position: relative; display: inline-block; }
.fee-money b { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); font-weight: 500; color: var(--text-secondary); }
.fee-pay-note { flex-basis: 100%; font-size: 13px; }
.fee-pay-note summary { cursor: pointer; color: var(--accent); font-weight: 600; width: max-content; }
.fee-pay-note .field-input { margin-top: 8px; width: 360px; max-width: 100%; }
.fee-pay-actions { display: flex; gap: 8px; margin-left: auto; }
@media (max-width: 720px) {
  .fee-tiles { grid-template-columns: 1fr; gap: 8px; }
  .fee-search, .fee-search .field-input { width: 100%; }
  .fee-line { padding: 12px 16px; }
  .fee-line-top { flex-wrap: wrap; gap: 10px; }
  .fee-line .fee-row-right { min-width: 0; margin-left: auto; }
  .fee-actions { flex-basis: 100%; }
  .fee-actions > *, .fee-remind-form { flex: 1; }
  .fee-remind-btn, .fee-pay-btn { width: 100%; min-height: 46px; }
  .fee-pay-field, .fee-pay-field .field-input, .fee-pay-amount .field-input { width: 100%; }
  .fee-pay-actions { margin-left: 0; width: 100%; }
  .fee-pay-actions button { flex: 1; min-height: 46px; }
}

.fee-notice { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; padding: 12px 14px; background: var(--success-bg); border: 1px solid #BFE3CB; border-radius: 12px; color: #054F31; animation: fee-notice-in .25s ease-out; }
.fee-notice-mark { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--success); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; }
.fee-notice-text { flex: 1; min-width: 0; font-size: 14px; line-height: 1.4; }
.fee-notice-full { display: inline-block; margin-left: 8px; padding: 1px 9px; border-radius: 999px; background: #fff; font-size: 12px; font-weight: 700; }
.fee-notice-btn { flex: none; }
.fee-notice-x { flex: none; font-size: 22px; line-height: 1; color: #054F31; text-decoration: none; padding: 0 4px; }
@keyframes fee-notice-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .fee-notice { animation: none; } }
.fee-export { flex: none; margin-left: auto; }
.fee-toolbar .fee-search { margin-left: 0; }
.fee-line .row-title a.fee-statement { margin-left: 10px; font-size: 12px; font-weight: 600; color: var(--accent); text-decoration: none; }
.fee-line .row-title a.fee-statement:hover { text-decoration: underline; }
.fee-reminded { color: var(--text-tertiary); }
@media (max-width: 720px) { .fee-notice { flex-wrap: wrap; position: relative; padding-right: 40px; } .fee-notice-x { position: absolute; top: 8px; right: 10px; } .fee-notice-text { flex-basis: calc(100% - 80px); } .fee-notice-btn { flex-basis: 100%; min-height: 44px; } .fee-export { margin-left: 0; } }
@media print { .toast-stack, .fee-pay-btn, .fee-pay-panel, .fee-toolbar, .fee-notice, .fee-statement { display: none !important; } }

.fee-pill.is-cancelled { background: #F2F4F7; color: #475467; margin-left: 8px; }
.fee-item.is-cancelled .fee-item-amount, .fee-payment-row.is-cancelled .fee-payment-amount { text-decoration: line-through; color: var(--text-tertiary); }
.fee-payment-row.is-cancelled .fee-payment-amount .fee-pill { text-decoration: none; display: inline-block; }
.fee-more { position: relative; flex: none; }
.fee-more > summary { list-style: none; cursor: pointer; padding: 4px 10px; font-size: 18px; line-height: 1; }
.fee-more > summary::-webkit-details-marker { display: none; }
.fee-more-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 190px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 6px 18px rgba(16, 24, 40, .12); }
.fee-more-item { display: block; width: 100%; padding: 8px 12px; border: 0; border-radius: 8px; background: none; text-align: left; font: inherit; font-size: 13px; font-weight: 500; color: var(--text-primary); cursor: pointer; }
.fee-more-item:hover, .fee-more-item:focus-visible { background: var(--bg-app); }
.fee-more-item.is-danger { color: var(--danger); }
.fee-cancel > summary { color: var(--text-primary); }
.fee-cancel-form { position: relative; }
.fee-cancel-x { position: absolute; top: 6px; right: 8px; width: 28px; height: 28px; border: 0; border-radius: 8px; background: none; font-size: 20px; line-height: 1; color: var(--text-secondary); cursor: pointer; }
.fee-cancel-x:hover, .fee-cancel-x:focus-visible { background: var(--border-soft); color: var(--text-primary); }
.fee-cancel-why { color: var(--text-secondary); }
.fee-cancel { margin: -2px 18px 8px; font-size: 13px; }
.fee-cancel > summary { cursor: pointer; width: max-content; font-weight: 600; }
.fee-cancel-form { margin-top: 8px; padding: 12px 14px; background: var(--bg-app); border: 1px solid var(--border-soft); border-radius: 10px; display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.fee-cancel-help { flex-basis: 100%; margin: 0; color: var(--text-secondary); line-height: 1.45; }
.fee-cancel-field { display: flex; flex-direction: column; gap: 4px; font-weight: 600; color: var(--text-secondary); font-size: 12.5px; }
.fee-cancel-field em { font-weight: 400; font-style: normal; }
.fee-cancel-field .field-input { width: 260px; max-width: 100%; }
.btn-danger { background: var(--danger); color: #fff; border: 1px solid var(--danger); border-radius: 9px; padding: 9px 14px; font: inherit; font-weight: 600; cursor: pointer; }
@media (max-width: 720px) { .fee-cancel-field, .fee-cancel-field .field-input, .fee-cancel-form .btn-danger { width: 100%; } .fee-cancel { margin: 0 16px 8px; } }

/* ---- Reports ------------------------------------------------------------------ */
.rp-group-title { margin: 22px 0 10px; font-size: 14px; font-weight: 650; color: var(--text-secondary); }
.rp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.rp-card { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; color: var(--text-primary); text-decoration: none; }
.rp-card:hover { border-color: var(--accent); }
.rp-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rp-card-title { font-size: 15px; font-weight: 650; }
.rp-card-text { font-size: 13px; color: var(--text-secondary); line-height: 1.45; }
.rp-card-go { margin-top: 4px; font-size: 12.5px; font-weight: 600; color: var(--accent); }
.rp-error { margin: 0 0 12px; padding: 10px 14px; border-radius: 10px; background: var(--danger-bg); color: var(--danger); font-size: 13px; }
.rp-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; margin-bottom: 12px; }
.rp-f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.rp-f .field-input { min-width: 140px; }
.rp-grow { flex: 1 1 200px; }
.rp-grow .field-input { width: 100%; }
.rp-check { flex-direction: row; align-items: center; gap: 6px; height: 38px; font-weight: 500; }
.rp-ranges { margin-bottom: 14px; }
.rp-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.rp-tile { padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.rp-tile-label { font-size: 12.5px; color: var(--text-secondary); }
.rp-tile-value { margin-top: 4px; font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.rp-tile-note { margin-top: 2px; font-size: 12px; color: var(--text-tertiary); }
.rp-tile.is-late .rp-tile-value { color: var(--danger); }
.rp-tile.is-quiet .rp-tile-value { font-size: 18px; }
.rp-tile.is-muted { background: var(--bg-app); }
.rp-generated { font-size: 12px; color: var(--text-tertiary); }
.rp-export { margin-left: auto; display: flex; gap: 8px; }
.rp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rp-table th, .rp-table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border-soft); white-space: nowrap; }
.rp-table th { font-size: 12px; font-weight: 600; color: var(--text-secondary); background: var(--bg-app); position: sticky; top: 0; }
.rp-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.rp-table td a { color: var(--accent); text-decoration: none; }
.rp-table td a:hover { text-decoration: underline; }
.rp-table tfoot td { font-weight: 650; border-top: 2px solid var(--navy); border-bottom: none; background: var(--bg-app); }
.rp-table tr.is-cancelled td { color: var(--text-tertiary); text-decoration: line-through; }
.rp-table td.rp-late { color: var(--danger); font-weight: 600; }
.rp-nil { color: var(--text-tertiary); }
.rp-empty { text-align: center; padding: 28px 20px; }
.rp-note { margin: 10px 2px; font-size: 12px; color: var(--text-tertiary); }
@media (max-width: 640px) { .rp-f, .rp-f .field-input { width: 100%; } .rp-apply { width: 100%; } .rp-export { margin-left: 0; } }
@media print { .sidebar, .topbar-mobile, .tabbar, .rp-filters, .rp-ranges, .rp-export, .set-crumbs { display: none !important; } }

/* ---- Fee schedule: one table, headings once ----------------------- */
.fs-top { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; padding: 2px 0 16px; }
.fs-top-actions { display: flex; gap: 8px; flex: none; align-items: center; }
.fs-top-actions form { margin: 0; }
.fs-table { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.fs-row { display: grid; grid-template-columns: minmax(0, 2.2fr) 96px 78px minmax(0, 1.6fr) minmax(0, 1.7fr) 56px; gap: 12px; align-items: center; padding: 11px 14px; border-top: 1px solid var(--border-soft); font-size: 13.5px; }
.fs-row.fs-head { background: var(--bg-app); border-top: none; font-size: 12px; font-weight: 650; color: var(--text-secondary); padding-top: 9px; padding-bottom: 9px; }
.fs-cat { display: flex; justify-content: space-between; padding: 8px 14px; background: #FAFBFC; border-top: 1px solid var(--border); font-size: 12.5px; font-weight: 650; color: var(--text-primary); }
.fs-cat span { color: var(--text-tertiary); font-weight: 500; }
.fs-name { font-weight: 600; color: var(--text-primary); }
.fs-num { text-align: right; font-variant-numeric: tabular-nums; }
.fs-unset { color: var(--text-tertiary); font-style: normal; font-family: var(--font-sans); }
.fs-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.fs-act { text-align: right; }
.fs-row.is-off { opacity: .6; }
.fs-edit { padding: 16px 14px 14px; background: #FAFBFC; border-top: 1px solid var(--border-soft); }
.fs-table > .fs-edit { border-top: 1px solid var(--border-soft); }
#fs-new { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 14px; }
.fs-edit[hidden] { display: none; }
.fs-edit-title { font-size: 14px; font-weight: 650; margin-bottom: 10px; }
.fs-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 14px; }
.fs-f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fs-f > span:first-child { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.fs-wide { grid-column: span 2; }
.fs-edit .checks { padding: 2px 0; }
.fs-edit-actions { display: flex; gap: 8px; margin-top: 14px; }
@media (max-width: 960px) {
  .fs-top { flex-direction: column; }
  .fs-row.fs-head { display: none; }
  .fs-row { grid-template-columns: 1fr auto; gap: 4px 12px; }
  .fs-row > span[data-label]:not(.fs-name):not([data-label="Rate"]) { grid-column: 1 / -1; font-size: 12.5px; color: var(--text-secondary); }
  .fs-row > span[data-label]:not(.fs-name):not([data-label="Rate"])::before { content: attr(data-label) ": "; font-weight: 600; }
  .fs-grid { grid-template-columns: 1fr 1fr; } .fs-wide { grid-column: 1 / -1; }
}
.fs-tag { font-size: 11.5px; line-height: 1; padding: 4px 8px; border-radius: 999px; background: var(--bg-app); color: var(--text-secondary); border: 1px solid var(--border-soft); white-space: nowrap; }
.fs-edit .checks label { font-size: 13px; }
.fs-row > span { min-width: 0; }

/* ---- Settings usability: status line, unsaved bar, dimmed rows ------ */
.set-status { display: block; margin: 0 0 8px; padding: 11px 14px; border-radius: 10px; font-size: 13.5px; line-height: 1.45; border: 1px solid; }
.set-status strong { font-weight: 650; }
.set-status.is-ok { background: var(--success-bg); border-color: #BFE3CB; color: #054F31; }
.set-status.is-warn { background: #FFF6E5; border-color: #F4D58D; color: #7A4B00; }
.set-status.is-off { background: var(--bg-app); border-color: var(--border); color: var(--text-secondary); }
.set-status-link { background: none; border: none; padding: 0; margin-left: 4px; font: inherit; font-weight: 650; color: var(--accent); text-decoration: underline; cursor: pointer; }
.set-row.is-dim .set-row-title, .set-row.is-dim .set-row-hint, .set-row.is-dim .set-row-ctl { opacity: .5; }
.set-dirty { position: sticky; bottom: 14px; z-index: 20; margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #1B2A41; color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: 0 6px 22px rgba(16,24,40,.28); font-size: 14px; font-weight: 550; }
.set-dirty[hidden] { display: none; }
.set-dirty-actions { display: flex; gap: 8px; }
.set-dirty .btn-ghost { background: rgba(255,255,255,.12); color: #fff; }
.set-dirty .btn-primary { background: #fff; color: #1B2A41; }
@media (max-width: 860px) { .set-dirty { bottom: 76px; } }

/* Settings > Intake forms */
.if-wrap { display: grid; gap: 16px; }
.if-card { background: var(--bg-surface, #fff); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.if-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; flex-wrap: wrap; }
.if-id { min-width: 0; display: grid; gap: 6px; }
.if-name { margin: 0; font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.if-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.if-meta { font-size: 12.5px; color: var(--text-secondary); }
.if-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.if-draft { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 20px; background: #fff7e6; border-top: 1px solid #f1dcae; font-size: 13.5px; }
.if-draft-sub { color: var(--text-secondary); }
.if-rows { border-top: 1px solid var(--border-soft); }
.if-row { padding-left: 20px; padding-right: 20px; }
.if-row + .if-row { border-top: 1px solid var(--border-soft); }
.if-ctl { display: flex; gap: 8px; align-items: center; }
.if-ctl .field-input { width: 280px; max-width: 100%; }
.if-adv { border-top: 1px solid var(--border-soft); }
.if-adv > summary { cursor: pointer; padding: 12px 20px; font-size: 13.5px; color: var(--text-secondary); list-style: none; }
.if-adv > summary::-webkit-details-marker { display: none; }
.if-adv > summary span { margin-left: 6px; font-size: 11.5px; padding: 1px 6px; border: 1px solid var(--border); border-radius: 999px; }
.if-adv form { padding: 0 20px 16px; }
.if-json { width: 100%; font-size: 12px; box-sizing: border-box; }
.if-json-foot { display: flex; gap: 8px; margin-top: 8px; }
.if-json-foot .field-input { max-width: 320px; }
.if-empty { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border: 1px dashed var(--border); border-radius: 10px; }
@media (max-width: 720px) {
  .if-head, .if-draft { padding-left: 14px; padding-right: 14px; }
  .if-actions .btn-primary, .if-draft .btn-primary { width: 100%; text-align: center; }
  .if-ctl { flex-wrap: wrap; } .if-ctl .field-input { width: 100%; }
  .if-json-foot { flex-wrap: wrap; } .if-json-foot .field-input { max-width: none; width: 100%; }
}

/* Request details: pick a few questions out of many, rather than untick most. */
.rq-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.rq-tools .search-input { flex: 1; min-width: 220px; }
.rq-badges { display: flex; align-items: center; gap: 8px; }
.rq-picked { font-size: 12px; font-weight: 600; color: var(--accent); }
.rq-sec-all { margin: 4px 0 8px; font-size: 12.5px; }
.rq-q[hidden], .rq-sec[hidden] { display: none; }
.rq-send { gap: 8px; flex-wrap: wrap; }
.rq-send .field-input { width: 220px; max-width: 100%; }
.rq-count { font-size: 13px; color: var(--text-secondary); margin-right: auto; }
.rq-count.on { color: var(--accent); font-weight: 600; }
/* A full Marathi paragraph, beside its English one, where both are shown. */
.mr-block { font-family: 'Noto Sans Devanagari', var(--font-sans); color: var(--text-secondary); font-size: 13.5px; }
/* The send bar stays in view, so the last panel needs room to clear it. */
form:has(> .rq-send) { padding-bottom: 86px; }


/* --- Working indicator (static/js/busy.js) --- */
.bz-bar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 3000; overflow: hidden; background: var(--accent-bg); pointer-events: none; }
.bz-bar[hidden], .bz-pill[hidden] { display: none; }
.bz-bar > i { position: absolute; top: 0; bottom: 0; width: 38%; background: var(--accent); border-radius: 3px; animation: bz-run 1.2s ease-in-out infinite; }
@keyframes bz-run { 0% { left: -40%; } 100% { left: 102%; } }
.bz-pill { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 3000; display: flex; align-items: center; gap: 10px; max-width: min(92vw, 560px); padding: 10px 16px 10px 14px; border-radius: 999px; background: var(--navy); color: #fff; font-size: 13.5px; line-height: 1.35; box-shadow: 0 8px 24px -8px rgba(16,24,40,.45); animation: bz-in .18s ease-out; }
@keyframes bz-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.bz-msg { overflow-wrap: anywhere; }
.bz-spin, .bz-btn-spin { flex: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: bz-turn .7s linear infinite; }
.bz-btn-spin { display: inline-block; vertical-align: -2px; margin-right: 8px; width: 13px; height: 13px; }
@keyframes bz-turn { to { transform: rotate(360deg); } }
.is-busy { pointer-events: none; opacity: .88; cursor: progress; }
html.bz-busy, html.bz-busy body { cursor: progress; }
@media (prefers-reduced-motion: reduce) {
  .bz-bar > i { animation: none; left: 0; width: 100%; opacity: .55; }
  .bz-spin, .bz-btn-spin { animation: none; border-right-color: currentColor; opacity: .7; }
  .bz-pill { animation: none; }
}


/* Fee schedule: rupee sign inside the rate box */
.fs-money { position: relative; display: block; }
.fs-money > b { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-secondary); font-weight: 600; pointer-events: none; }
.fs-money > .field-input { padding-left: 26px; }

/* --- Matter and client pages: summary strip, tabs, header contact --- */
.mh-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 6px; }
.case-chip { font-family: var(--font-mono); font-size: 12.5px; padding: 3px 9px; border-radius: 6px; background: var(--bg-app); border: 1px solid var(--border); color: var(--text-primary); }
.mh-none { color: var(--text-tertiary); }
.mh-client a:not(.mh-contact) { color: var(--accent); font-weight: 600; }
.mh-contact { display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px; margin-left: 6px; border-radius: 999px; border: 1px solid var(--border); font-size: 12.5px; font-weight: 600; color: var(--accent); background: #fff; }
.mh-contact:hover { background: var(--accent-bg); }
.m-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 0 0 18px; }
.m-stat { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; border: 1px solid var(--border); border-radius: 10px; background: #fff; color: inherit; text-decoration: none; }
a.m-stat:hover { border-color: var(--accent); }
.m-stat-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.m-stat-value { font-size: 19px; font-weight: 650; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.m-stat-note { font-size: 12.5px; color: var(--text-secondary); }
.m-stat.is-alert { border-color: var(--danger); background: var(--danger-bg); }
.m-stat.is-alert .m-stat-value, .m-stat.is-alert .m-stat-note { color: var(--danger); }
.m-tabs { display: flex; gap: 4px; margin: 0 0 16px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.m-tabs[hidden], .col[hidden] { display: none; }
.m-tabs button { appearance: none; background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; margin-bottom: -1px; font: inherit; font-size: 14px; font-weight: 600; color: var(--text-secondary); cursor: pointer; white-space: nowrap; }
.m-tabs button:hover { color: var(--text-primary); }
.m-tabs button.is-on { color: var(--accent); border-bottom-color: var(--accent); }
.m-count { margin-left: 4px; padding: 1px 7px; border-radius: 999px; background: var(--border-soft); font-size: 11.5px; font-weight: 600; color: var(--text-secondary); }
html.tabs-on [data-tab]:not(.tab-on) { display: none; }
.grid.one-col { grid-template-columns: minmax(0, 1fr); }
.add-draft { border-top: 1px solid var(--border-soft); }
.add-draft > summary { cursor: pointer; padding: 11px 16px; font-size: 13.5px; font-weight: 600; color: var(--accent); list-style: none; }
.add-draft > summary::-webkit-details-marker { display: none; }
.add-draft[open] > summary { color: var(--text-secondary); }
.upload-pick { max-width: 100%; font-size: 13px; }
.upload-pick::file-selector-button { margin-right: 10px; padding: 7px 12px; border: 1px dashed var(--border); border-radius: 8px; background: var(--bg-app); font: inherit; font-size: 13px; font-weight: 600; color: var(--text-primary); cursor: pointer; }
.upload-pick:hover::file-selector-button { border-color: var(--accent); color: var(--accent); }
.panel-title-note { margin-left: 8px; font-size: 12px; font-weight: 500; color: var(--text-tertiary); }
.id-hint { margin-left: 6px; font-family: var(--font-sans); font-size: 11.5px; color: var(--text-tertiary); }
@media (max-width: 640px) { .m-strip { grid-template-columns: 1fr 1fr; } .m-stat-value { font-size: 17px; } }

/* --- Dashboard (Today): attention cards, tiles, Coming up, case load tabs --- */
.dash-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.dash-actions .btn-primary, .dash-actions .btn-secondary { min-height: 44px; display: inline-flex; align-items: center; gap: 8px; }
.dash-attn { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.dash-attn-card { flex: 1 1 260px; display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 10px; background: var(--danger-bg); border: 1px solid #F3C4BF; color: var(--danger); text-decoration: none; }
.dash-attn-card:hover { border-color: var(--danger); }
.dash-attn-count { font-size: 26px; font-weight: 700; line-height: 1; min-width: 28px; font-variant-numeric: tabular-nums; }
.dash-attn-text { flex-grow: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dash-attn-title { font-size: 14px; font-weight: 600; }
.dash-attn-note { font-size: 12.5px; overflow-wrap: anywhere; }
.dash-clear { flex: 1 1 100%; margin: 0; padding: 12px 16px; border-radius: 10px; background: var(--success-bg); color: var(--success); font-size: 13.5px; font-weight: 500; }
.dash-tiles { margin-bottom: 20px; }
.dash-tiles .m-stat-value { font-size: 24px; }
.dash-cols { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; margin-bottom: 20px; }
.dash-up { flex: 999 1 520px; min-width: 0; margin: 0; }
.dash-side { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.dash-side .panel { margin: 0; }
.dash-g-head { display: flex; justify-content: space-between; padding: 9px 20px; background: #FAFBFC; border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); font-size: 12.5px; font-weight: 650; }
.dash-g-count { font-weight: 500; color: var(--text-secondary); }
.dash-g-past { color: var(--danger); } .dash-g-today { color: var(--text-primary); } .dash-g-tomorrow { color: var(--warning); } .dash-g-later { color: var(--text-secondary); }
.dash-row { display: flex; align-items: center; gap: 16px; padding: 13px 20px; border-bottom: 1px solid var(--border-soft); }
.dash-when { flex: 0 0 84px; font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.dash-main { flex: 1 1 auto; min-width: 0; }
.dash-title { font-size: 14.5px; font-weight: 600; overflow-wrap: anywhere; }
.dash-title a { color: var(--text-primary); text-decoration: none; }
.dash-title a:hover { color: var(--accent); text-decoration: underline; }
.dash-sub { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.dash-btn { flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 104px; min-height: 44px; padding: 0 14px; border-radius: 9px; background: var(--accent-bg); color: var(--accent); font-size: 13px; font-weight: 600; text-decoration: none; }
.dash-btn:hover { background: #D6E5F3; }
.dash-btn-primary { background: var(--accent); color: #fff; } .dash-btn-primary:hover { background: var(--accent-hover); }
.dash-btn-past { background: var(--danger-bg); color: var(--danger); } .dash-btn-past:hover { background: #F9D9D5; }
.dash-late { color: var(--danger); }
.dash-due { flex: none; min-width: 62px; text-align: center; }
.dash-done { min-height: 44px; }
.dash-seg { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--bg-app); margin-left: auto; }
.dash-seg[hidden], .dash-pane[hidden] { display: none; }
.dash-seg button { appearance: none; min-height: 36px; padding: 0 14px; border: 0; border-radius: 7px; background: transparent; font: inherit; font-size: 13px; font-weight: 600; color: var(--text-secondary); cursor: pointer; }
.dash-seg button[aria-selected="true"] { background: #fff; color: var(--accent); box-shadow: 0 1px 2px rgba(16,24,40,.1); }
.dash-pane-title { margin: 0; padding: 12px 20px 0; font-size: 12.5px; font-weight: 650; color: var(--text-secondary); }
html.dash-js .dash-pane-title { display: none; }
.dash-low-left { flex: 1 1 360px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.dash-low-left .panel { margin: 0; }
.dash-month { flex: 2 1 520px; min-width: 0; margin: 0; }
.dash-month .month-stats { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.dash-title .case-no { margin-left: 8px; }
.dash-month-form { display: flex; gap: 8px; align-items: center; margin: 0; }
.dash-month-label { font-size: 13px; color: var(--text-secondary); }
.dash-chart-title { padding: 16px 20px 0; font-size: 13px; font-weight: 600; color: var(--text-secondary); border-top: 1px solid var(--border-soft); }
.dash-chart { height: 170px; }
.chart-bar.is-now { background: var(--accent); }
.dash-chart .chart-bar { background: #A9C2DC; max-width: 56px; }
.dash-chart .chart-bar.is-now { background: var(--accent); }
.dash-chart .chart-bar-value { color: var(--text-primary); font-weight: 600; }
.dash-chart .chart-bar-label { color: var(--text-secondary); }
@media (max-width: 640px) {
  .dash-actions { width: 100%; } .dash-actions > a { flex: 1 1 auto; justify-content: center; }
  .dash-row { flex-wrap: wrap; gap: 6px 12px; padding: 12px 16px; }
  .dash-when { flex: 1 0 100%; } .dash-main { flex: 1 0 100%; }
  .dash-btn { flex: 1 0 100%; }
  .dash-g-head { padding: 9px 16px; }
  .dash-tiles { grid-template-columns: 1fr 1fr; }
}

/* --- Settings: setup checklist, saved-secret mark, lock note, switch text, search --- */
.set-setup { margin: 16px 24px 0; padding: 16px 18px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.set-setup-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.set-setup-head h2 { margin: 0; font-size: 15px; font-weight: 650; }
.set-setup-head span { font-size: 12.5px; color: var(--text-secondary); }
.set-setup-bar { height: 6px; margin: 10px 0 12px; border-radius: 99px; background: var(--border-soft); overflow: hidden; }
.set-setup-bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.set-setup-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.set-setup-list li { display: flex; align-items: center; gap: 6px; font-size: 13.5px; }
.set-setup-list button { appearance: none; border: 0; background: none; padding: 6px 0; font: inherit; font-weight: 600; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.set-setup-list li.is-done button { color: var(--text-secondary); font-weight: 500; text-decoration: none; }
.set-setup-list em { font-style: normal; font-size: 12px; color: var(--text-secondary); }
.set-setup-mark { width: 16px; text-align: center; color: var(--text-secondary); }
.set-setup-list li.is-done .set-setup-mark { color: var(--success); }
.visually-hidden, .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.set-saved { display: inline-flex; align-items: center; gap: 5px; margin-left: 10px; font-size: 12.5px; font-weight: 600; color: var(--success); }
.set-lock { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; padding: 10px 14px; border-radius: 9px; background: var(--bg-app); border: 1px solid var(--border); font-size: 13px; color: var(--text-secondary); }
.set-switch-text { margin-left: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); min-width: 22px; display: inline-block; }
.set-search { padding: 0 6px 10px; }
.set-search input { width: 100%; min-height: 40px; }
.set-search-none { margin: 4px 14px; font-size: 13px; color: var(--text-secondary); }
.set-nav-item[hidden], .set-nav-group[hidden], .set-search-none[hidden] { display: none; }
.set-adv { margin-top: 6px; }
@media (max-width: 640px) { .set-setup { margin: 12px 0 0; } }

/* --- Client-facing intake page (scoped to .public-wrap; staff screens unchanged) --- */
.public-wrap { max-width: 840px; padding: 44px 20px 110px; --pf-r: 14px; }
.public-wrap .public-head { margin-bottom: 26px; }
.public-wrap .public-firm { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; color: var(--text-primary); }
.public-wrap .public-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--navy); color: #fff; display: grid; place-items: center; font-size: 14px; font-weight: 700; }
.public-wrap .public-head h1 { font-size: 32px; line-height: 1.2; letter-spacing: -0.02em; font-weight: 700; margin: 22px 0 10px; }
.public-wrap .public-head p { font-size: 15.5px; line-height: 1.6; color: var(--text-secondary); max-width: 62ch; margin: 0; }

.public-wrap .panel { border-radius: var(--pf-r); border: 1px solid var(--border); box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 8px 24px -12px rgba(16,24,40,.10); overflow: visible; margin-bottom: 0; }
.public-wrap .panel-head { padding: 22px 30px 4px; border-bottom: 0; background: none; }
.public-wrap .panel-title { font-size: 20px; font-weight: 650; letter-spacing: -0.01em; }
.public-wrap .intake-grid, .public-wrap .ix-js .intake-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 26px; padding: 18px 30px 14px; max-width: none; }
.public-wrap .field-group { margin-bottom: 22px; min-width: 0; }
.public-wrap .field-label { font-size: 13.5px; margin-bottom: 8px; }
.public-wrap .field-hint { font-size: 12.5px; line-height: 1.5; margin-top: 7px; }
.public-wrap .field-input, .public-wrap select.field-input { min-height: 46px; font-size: 15px; border-radius: 10px; padding: 10px 14px; border-color: #D0D5DD; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.public-wrap textarea.field-input { min-height: 110px; }
.public-wrap .field-input:hover { border-color: #B5BDC9; }
.public-wrap .field-input:focus, .public-wrap select.field-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-bg); }
.public-wrap .field-input::placeholder { color: #A3ACBA; }
.public-wrap .req { margin-left: 2px; }
.public-wrap p.field-hint.intake-full { font-size: 14px; color: var(--text-secondary); background: var(--bg-app); border-radius: 10px; padding: 12px 14px; margin: 0 0 22px; }

.public-wrap .ix-chips { gap: 8px; }
.public-wrap .ix-chip > span { min-height: 44px; padding: 8px 18px; border-radius: 10px; font-size: 14.5px; border-color: #D0D5DD; transition: background .12s, border-color .12s, color .12s; }
.public-wrap .ix-chip:hover > span { border-color: var(--accent); }
.public-wrap .ix-chip input:checked + span { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }  /* same weight as unselected: bolder text is wider and nudges its neighbours */
.public-wrap .ix-q { min-height: 32px; padding: 5px 13px; }

.public-wrap .file-add { gap: 10px; padding: 14px; border: 1.5px dashed #C3CAD5; border-radius: 12px; background: #FAFBFC; }
.public-wrap .file-add .field-input { background: transparent; border: 0; box-shadow: none; min-height: 40px; padding-left: 0; }
.public-wrap .file-chip { background: var(--accent-bg); color: var(--accent); border-radius: 8px; padding: 6px 10px; font-size: 13px; font-weight: 500; }
.public-wrap .ix-person { border-radius: 12px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.public-wrap .ix-people { gap: 10px; margin-bottom: 12px; }
.public-wrap .btn-ghost, .public-wrap .btn-secondary, .public-wrap .btn-primary { min-height: 44px; border-radius: 10px; font-size: 14.5px; padding-left: 20px; padding-right: 20px; }

/* progress card */
.public-wrap .ix-bar { background: var(--surface); color: var(--text-primary); border: 1px solid var(--border); border-radius: var(--pf-r); padding: 16px 22px 18px; margin-bottom: 16px; }
.public-wrap .ix-bar .step { color: var(--text-secondary); font-size: 13.5px; margin-top: 0; }
.public-wrap .ix-bars { gap: 6px; margin-top: 14px; }
.public-wrap .ix-bars i { height: 5px; border-radius: 3px; background: var(--border-soft); }
.public-wrap .ix-bars i.on { background: var(--accent); }
.public-wrap .ix-saved { color: var(--text-tertiary); }
.public-wrap .ix-saved.err { color: var(--warning); }
.public-wrap .ix-lang { border-color: var(--border); background: var(--bg-app); padding: 2px; border-radius: 10px; }
.public-wrap .ix-lang button { color: var(--text-secondary); border-radius: 8px; min-height: 30px; padding: 4px 14px; font-size: 13px; }
.public-wrap .ix-lang button[aria-pressed="true"] { background: var(--surface); color: var(--text-primary); box-shadow: 0 1px 2px rgba(16,24,40,.12); }
.public-wrap .ix-flow { background: none; border: 0; padding: 0; border-radius: 0; }
.public-wrap .ix-nav { background: rgba(255,255,255,.96); backdrop-filter: blur(6px); border: 1px solid var(--border); border-radius: var(--pf-r); padding: 12px; margin-top: 18px; bottom: 14px; box-shadow: 0 8px 24px -8px rgba(16,24,40,.18); }
.public-wrap .ix-nav .btn-secondary, .public-wrap .ix-nav .btn-primary, .public-wrap .ix-nav .btn-ghost { min-height: 46px; }
.public-wrap .ix-nav .btn-primary { flex: 1.4; }

/* consent */
.public-wrap .pf-consent .panel-head { padding-top: 26px; }
.public-wrap .pf-consent .intake-pad { padding: 14px 30px 28px; max-width: none; }
.public-wrap .pf-consent .intake-pad p { font-size: 15.5px; line-height: 1.65; margin: 0 0 16px; max-width: 64ch; }
.public-wrap .pf-consent .mr-block { font-size: 14.5px; line-height: 1.75; padding: 14px 18px; background: var(--bg-app); border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0; max-width: none; }
.public-wrap .pf-agree { display: flex; gap: 12px; align-items: center; padding: 16px 18px; margin-top: 20px; border: 1px solid #D0D5DD; border-radius: 12px; font-size: 15px; font-weight: 500; cursor: pointer; background: var(--surface); }
.public-wrap .pf-agree:hover { border-color: var(--accent); }
.public-wrap .pf-agree input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.public-wrap .pf-agree:has(input:checked) { background: var(--accent-bg); border-color: var(--accent); }
.public-wrap .pf-agree:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.public-wrap .stickybar.always { padding: 22px 0 0; background: none; position: static; }
.public-wrap .stickybar.always .btn-primary { min-width: 180px; }

@media (max-width: 700px) {
  .public-wrap { padding: 24px 14px 110px; }
  .public-wrap .public-head h1 { font-size: 26px; }
  .public-wrap .intake-grid, .public-wrap .ix-js .intake-grid { grid-template-columns: minmax(0, 1fr); padding: 14px 18px 8px; }
  .public-wrap .panel-head { padding: 18px 18px 2px; }
  .public-wrap .pf-consent .intake-pad { padding: 12px 18px 22px; }
  .public-wrap .ix-bar { padding: 14px 16px 16px; }
  .public-wrap .ix-nav { flex-wrap: wrap; }
  .public-wrap .ix-nav #ix-next, .public-wrap .ix-nav #ix-final { order: -1; flex: 1 1 100%; }
  .public-wrap .stickybar.always .btn-primary { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .public-wrap * { transition: none !important; } }
.public-wrap #ix-back[style*="hidden"] { display: none; }
.public-wrap .field-group:has(.ix-chip:nth-child(5)) { grid-column: 1 / -1; }
.public-wrap .ix-trig, .public-wrap .js-showif[data-showif] { grid-column: 1 / -1; }
.public-wrap .ix-solo { grid-column: 1 / -1; }

/* Public page: "add row" tables (e.g. Documents still to bring) */
.public-wrap .table-wrap { overflow: visible; margin-bottom: 12px; }
.public-wrap .intake-table { border-collapse: separate; border-spacing: 0; }
.public-wrap .intake-table th, .public-wrap .intake-table th:first-child { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); padding: 0 12px 6px 0; }
.public-wrap .intake-table td, .public-wrap .intake-table td:first-child { padding: 0 12px 10px 0; min-width: 150px; }
.public-wrap .intake-table th:last-child, .public-wrap .intake-table td:last-child { min-width: 0; width: 46px; padding-right: 0; }
.public-wrap .intake-table .chip-x { width: 46px; height: 46px; border: 1px solid #D0D5DD; border-radius: 10px; font-size: 22px; color: var(--text-secondary); background: var(--surface); }
.public-wrap .intake-table .chip-x:hover { color: var(--danger); border-color: var(--danger); }
.public-wrap .js-add-row { margin-top: 2px; }


/* --- Staff intake form: same field styling as the client page (scoped to .staff-intake) --- */
.staff-intake { --pf-r: 14px; }

.staff-intake .panel-head { padding: 22px 30px 4px; border-bottom: 0; background: none; }
.staff-intake .panel-title { font-size: 20px; font-weight: 650; letter-spacing: -0.01em; }
.staff-intake .intake-grid, .staff-intake .ix-js .intake-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 26px; padding: 18px 30px 14px; max-width: none; }
.staff-intake .field-group { margin-bottom: 22px; min-width: 0; }
.staff-intake .field-label { font-size: 13.5px; margin-bottom: 8px; }
.staff-intake .field-hint { font-size: 12.5px; line-height: 1.5; margin-top: 7px; }
.staff-intake .field-input, .staff-intake select.field-input { min-height: 46px; font-size: 15px; border-radius: 10px; padding: 10px 14px; border-color: #D0D5DD; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.staff-intake textarea.field-input { min-height: 110px; }
.staff-intake .field-input:hover { border-color: #B5BDC9; }
.staff-intake .field-input:focus, .staff-intake select.field-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-bg); }
.staff-intake .field-input::placeholder { color: #A3ACBA; }
.staff-intake .req { margin-left: 2px; }
.staff-intake p.field-hint.intake-full { font-size: 14px; color: var(--text-secondary); background: var(--bg-app); border-radius: 10px; padding: 12px 14px; margin: 0 0 22px; }

.staff-intake .ix-chips { gap: 8px; }
.staff-intake .ix-chip > span { min-height: 44px; padding: 8px 18px; border-radius: 10px; font-size: 14.5px; border-color: #D0D5DD; transition: background .12s, border-color .12s, color .12s; }
.staff-intake .ix-chip:hover > span { border-color: var(--accent); }
.staff-intake .ix-q { min-height: 32px; padding: 5px 13px; }

.staff-intake .file-add { gap: 10px; padding: 14px; border: 1.5px dashed #C3CAD5; border-radius: 12px; background: #FAFBFC; }
.staff-intake .file-add .field-input { background: transparent; border: 0; box-shadow: none; min-height: 40px; padding-left: 0; }
.staff-intake .file-chip { background: var(--accent-bg); color: var(--accent); border-radius: 8px; padding: 6px 10px; font-size: 13px; font-weight: 500; }
.staff-intake .ix-person { border-radius: 12px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.staff-intake .ix-people { gap: 10px; margin-bottom: 12px; }
.staff-intake .btn-ghost, .staff-intake .btn-secondary, .staff-intake .btn-primary { min-height: 44px; border-radius: 10px; font-size: 14.5px; padding-left: 20px; padding-right: 20px; }

.staff-intake .ix-bar .step { color: var(--text-secondary); font-size: 13.5px; margin-top: 0; }
.staff-intake .ix-bars { gap: 6px; margin-top: 14px; }
.staff-intake .ix-bars i { height: 5px; border-radius: 3px; background: var(--border-soft); }
.staff-intake .ix-bars i.on { background: var(--accent); }
.staff-intake .ix-saved { color: var(--text-tertiary); }
.staff-intake .ix-saved.err { color: var(--warning); }
.staff-intake .ix-lang { border-color: var(--border); background: var(--bg-app); padding: 2px; border-radius: 10px; }
.staff-intake .ix-lang button { color: var(--text-secondary); border-radius: 8px; min-height: 30px; padding: 4px 14px; font-size: 13px; }
.staff-intake .ix-lang button[aria-pressed="true"] { background: var(--surface); color: var(--text-primary); box-shadow: 0 1px 2px rgba(16,24,40,.12); }
.staff-intake .ix-flow { background: none; border: 0; padding: 0; border-radius: 0; }
.staff-intake .ix-nav .btn-secondary, .staff-intake .ix-nav .btn-primary, .staff-intake .ix-nav .btn-ghost { min-height: 46px; }
.staff-intake .ix-nav .btn-primary { flex: 1.4; }


@media (max-width: 700px) {
  .staff-intake .intake-grid, .staff-intake .ix-js .intake-grid { grid-template-columns: minmax(0, 1fr); padding: 14px 18px 8px; }
  .staff-intake .panel-head { padding: 18px 18px 2px; }
  .staff-intake .ix-bar { padding: 14px 16px 16px; }
  .staff-intake .ix-nav { flex-wrap: wrap; }
  .staff-intake .ix-nav #ix-next, .staff-intake .ix-nav #ix-final { order: -1; flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) { .staff-intake * { transition: none !important; } }
.staff-intake #ix-back[style*="hidden"] { display: none; }
.staff-intake .field-group:has(.ix-chip:nth-child(5)) { grid-column: 1 / -1; }
.staff-intake .ix-trig, .staff-intake .js-showif[data-showif] { grid-column: 1 / -1; }
.staff-intake .ix-solo { grid-column: 1 / -1; }

.staff-intake .table-wrap { overflow: visible; margin-bottom: 12px; }
.staff-intake .intake-table { border-collapse: separate; border-spacing: 0; }
.staff-intake .intake-table th, .staff-intake .intake-table th:first-child { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); padding: 0 12px 6px 0; }
.staff-intake .intake-table td, .staff-intake .intake-table td:first-child { padding: 0 12px 10px 0; min-width: 150px; }
.staff-intake .intake-table th:last-child, .staff-intake .intake-table td:last-child { min-width: 0; width: 46px; padding-right: 0; }
.staff-intake .intake-table .chip-x { width: 46px; height: 46px; border: 1px solid #D0D5DD; border-radius: 10px; font-size: 22px; color: var(--text-secondary); background: var(--surface); }
.staff-intake .intake-table .chip-x:hover { color: var(--danger); border-color: var(--danger); }
.staff-intake .js-add-row { margin-top: 2px; }
.staff-intake .ix-note { margin-bottom: 14px; }
.staff-intake .ix-nav { bottom: 0; }
.staff-intake .panel { border-radius: var(--pf-r); border: 1px solid var(--border); box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 8px 24px -12px rgba(16,24,40,.10); overflow: visible; margin-bottom: 0; }
.staff-intake .ix-chip input:checked + span { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.staff-intake .ix-bar { background: var(--surface); color: var(--text-primary); border: 1px solid var(--border); border-radius: var(--pf-r); padding: 16px 22px 18px; margin-bottom: 16px; }
.staff-intake .ix-nav { background: rgba(255,255,255,.96); border: 1px solid var(--border); border-radius: var(--pf-r); padding: 12px; margin-top: 18px; box-shadow: 0 8px 24px -8px rgba(16,24,40,.18); }
.staff-intake .ix-nav .btn-primary { flex: 1.4; }

/* Add-row tables turn into stacked cards according to the room they have, not the screen
   width: the staff page loses 232px to its sidebar, so a laptop screen can still leave a
   wide table (5 columns) cramped. */
.js-table { container-type: inline-size; container-name: ixt; }
@container ixt (max-width: 479px) {
  .public-wrap .intake-table, .public-wrap .intake-table tbody { display: block; }
  .public-wrap .intake-table thead { display: none; }
  .public-wrap .intake-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; position: relative; padding: 14px; margin-bottom: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
  .public-wrap .intake-table td, .public-wrap .intake-table td:first-child { display: block; min-width: 0; padding: 0; }
  .public-wrap .intake-table td:first-child { grid-column: 1 / -1; margin-right: 56px; }
  .public-wrap .intake-table td::before { content: attr(data-label); display: block; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
  .public-wrap .intake-table td:last-child { position: absolute; top: 14px; right: 14px; width: auto; }
  .public-wrap .intake-table td:last-child::before { content: none; }
}
@container ixt (max-width: 479px) {
  .staff-intake .intake-table, .staff-intake .intake-table tbody { display: block; }
  .staff-intake .intake-table thead { display: none; }
  .staff-intake .intake-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; position: relative; padding: 14px; margin-bottom: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
  .staff-intake .intake-table td, .staff-intake .intake-table td:first-child { display: block; min-width: 0; padding: 0; }
  .staff-intake .intake-table td:first-child { grid-column: 1 / -1; margin-right: 56px; }
  .staff-intake .intake-table td::before { content: attr(data-label); display: block; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
  .staff-intake .intake-table td:last-child { position: absolute; top: 14px; right: 14px; width: auto; }
  .staff-intake .intake-table td:last-child::before { content: none; }
}
@container ixt (max-width: 860px) {
  .public-wrap .ix-wide .intake-table, .public-wrap .ix-wide .intake-table tbody { display: block; }
  .public-wrap .ix-wide .intake-table thead { display: none; }
  .public-wrap .ix-wide .intake-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; position: relative; padding: 14px; margin-bottom: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
  .public-wrap .ix-wide .intake-table td, .public-wrap .ix-wide .intake-table td:first-child { display: block; min-width: 0; padding: 0; }
  .public-wrap .ix-wide .intake-table td:first-child { grid-column: 1 / -1; margin-right: 56px; }
  .public-wrap .ix-wide .intake-table td::before { content: attr(data-label); display: block; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
  .public-wrap .ix-wide .intake-table td:last-child { position: absolute; top: 14px; right: 14px; width: auto; }
  .public-wrap .ix-wide .intake-table td:last-child::before { content: none; }
}
@container ixt (max-width: 860px) {
  .staff-intake .ix-wide .intake-table, .staff-intake .ix-wide .intake-table tbody { display: block; }
  .staff-intake .ix-wide .intake-table thead { display: none; }
  .staff-intake .ix-wide .intake-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; position: relative; padding: 14px; margin-bottom: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
  .staff-intake .ix-wide .intake-table td, .staff-intake .ix-wide .intake-table td:first-child { display: block; min-width: 0; padding: 0; }
  .staff-intake .ix-wide .intake-table td:first-child { grid-column: 1 / -1; margin-right: 56px; }
  .staff-intake .ix-wide .intake-table td::before { content: attr(data-label); display: block; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
  .staff-intake .ix-wide .intake-table td:last-child { position: absolute; top: 14px; right: 14px; width: auto; }
  .staff-intake .ix-wide .intake-table td:last-child::before { content: none; }
}
@container ixt (max-width: 479px) {
  .public-wrap .intake-table tr, .staff-intake .intake-table tr { grid-template-columns: minmax(0, 1fr); }
}
