/* Vitu domain overrides on top of toybox shared (tokens, themes, reset,
   atomic, patterns). Loaded after the shared stack so it can introduce
   domain tokens (status pills, vitu-only z-layers) and the layout
   shells / domain components the SPA renders.

   Token bridge: vitu's view CSS was authored against --s-N / --f-* /
   --r-* / --color-accent* names. Aliases keep that vocabulary working
   while the underlying values resolve to shared's --space-* / --text-* /
   --radius-* / --color-brand* ramps. P2 will migrate components off these
   shims; the bridge keeps P1 a pure plumbing swap. */

:root {
  color-scheme: light dark;

  /* spacing -- 1:1 value match with shared */
  --s-1: var(--space-xs);
  --s-2: var(--space-sm);
  --s-3: var(--space-md);
  --s-4: var(--space-lg);
  --s-5: var(--space-xl);
  --s-6: var(--space-2xl);
  --s-7: var(--space-3xl);

  /* type -- shared values within 0.05rem of vitu's */
  --f-sm:  var(--text-sm);
  --f-md:  var(--text-base);
  --f-lg:  var(--text-lg);
  --f-xl:  var(--text-xl);
  --f-2xl: var(--text-2xl);
  --f-stack: var(--font-body);

  /* radii -- r-md adopts shared's 8px (Q2 resolution); r-lg is vitu-only */
  --r-sm: var(--radius-sm);
  --r-md: var(--radius-md);
  --r-lg: 10px;

  /* color aliases -- vitu vocabulary onto shared semantic tokens */
  --color-accent:        var(--color-brand);
  --color-accent-strong: var(--color-brand-hover);
  --color-accent-soft:   var(--color-brand-bg);
  --color-surface:       var(--color-surface-1);
  --color-text-soft:     var(--color-text-muted);
  --color-text-disabled: var(--color-text-subtle);
  --color-text-inverse:  var(--color-text-on-brand);
  --color-danger-soft:   var(--color-danger-bg);
  --color-success-soft:  var(--color-success-bg);
  --color-border-focus:  var(--color-focus);

  /* motion -- shared owns --motion-fast + --motion-easing; vitu adds the
     slower beats and the two named curves its overlays use */
  --motion-normal: 250ms;
  --motion-slow:   400ms;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --ease-out:      cubic-bezier(0, 0, 0.2, 1);

  /* z-layers -- vitu's domain scale predates shared's. Relative order is
     what matters; numeric values stay where the components were authored. */
  --z-bulk-bar:   20;
  --z-dropdown:   30;
  --z-side-sheet: 40;
  --z-modal:      50;
  --z-palette:    60;
  --z-toast:      100;

  /* ---- status pill bg/fg pairs -- domain palette, light + dark variants.
     in_review uses purple (no shared equivalent); other statuses ride
     shared's brand / warning / success / neutral ramps. */
  --color-st-draft-bg:          light-dark(var(--neutral-2),     var(--neutral-10));
  --color-st-draft-fg:          light-dark(var(--neutral-9),     var(--neutral-4));
  --color-st-open-bg:           light-dark(var(--brand-soft),    oklch(0.28 0.08 250));
  --color-st-open-fg:           light-dark(oklch(0.30 0.18 250), oklch(0.85 0.11 250));
  --color-st-clarification-bg:  light-dark(var(--warning-soft),  oklch(0.30 0.08 90));
  --color-st-clarification-fg:  light-dark(var(--warning-strong), oklch(0.88 0.10 90));
  --color-st-in_review-bg:      light-dark(oklch(0.92 0.05 300), oklch(0.30 0.08 300));
  --color-st-in_review-fg:      light-dark(oklch(0.40 0.14 300), oklch(0.85 0.10 300));
  --color-st-done-bg:           light-dark(var(--success-soft),  oklch(0.28 0.08 145));
  --color-st-done-fg:           light-dark(var(--success-strong), oklch(0.78 0.11 145));
  --color-st-cancelled-bg:      light-dark(var(--neutral-2),     var(--neutral-10));
  --color-st-cancelled-fg:      light-dark(var(--neutral-7),     var(--neutral-7));
  --color-st-not_applicable-bg: light-dark(var(--neutral-2),     var(--neutral-10));
  --color-st-not_applicable-fg: light-dark(var(--neutral-7),     var(--neutral-5));
}

/* ---- Layout shells ---- */

.app {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-3) var(--s-5);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}
.topbar .brand  { font-weight: 600; font-size: var(--f-lg); color: var(--color-text); }
.topbar .tenant { color: var(--color-text-soft); font-size: var(--f-sm); }
.topbar .spacer { flex: 1; }
.topbar .lang   { display: flex; gap: var(--s-1); }
.topbar .user   { color: var(--color-text-soft); font-size: var(--f-sm); }

.shell-firm {
  display: grid;
  grid-template-columns: 14rem 1fr;
  min-height: 0;
}
.shell-client {
  display: block;
  max-width: 56rem;
  margin: 0 auto;
  padding: var(--s-4);
}
@media (max-width: 40rem) {
  .shell-client { padding: var(--s-3); }
}

/* Pre-auth pages (login, link_expired, etc.) -- centered card, no chrome. */
.shell-public {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--s-4);
}
.shell-public .card { width: min(28rem, 92vw); }
/* A scannable QR and a column of codes that must not wrap mid-code both
   outgrow the 28rem sign-in card (#92). */
.shell-public .card-wide { width: min(38rem, 92vw); }
.totp-qr { display: block; margin-inline: auto; max-width: 100%; }
/* Each action on the 2FA status page is its own <form>, so the gap has to
   come from the wrapper rather than form-stack. */
.totp-actions { display: flex; flex-direction: column; gap: var(--s-4); }

/* A quiet centred link row at the foot of an auth card: the legal links
   (#59) and the dev-only demo link. The links carry .touch-target in the
   markup for the 44px tap box the mobile QA suite enforces (#72); this is
   only the row that holds them. */
/* Signup / auth card extras (#14): the page title under the wordmark
   and the bot honeypot, kept off-screen rather than display:none so
   autofill bots still see it. */
.auth-title { font-family: var(--font-display); font-size: var(--f-lg); margin: 0; }
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.auth-card-links {
  display: flex;
  /* The row has to wrap: the four legal links (#59, #60) outgrow the 28rem
     sign-in card, and .touch-target's min-width replaces the automatic
     min-content floor, so an unwrapped row shrinks the items below their
     label width and the labels run together into one string. Row gap stays
     0 -- the legal row's 44px tap boxes already separate its lines -- so the
     column gap is the one that spaces links along a row. */
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 var(--s-4);
  margin-top: var(--s-4);
  font-size: var(--f-sm);
}

.sidebar {
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  padding: var(--s-4) var(--s-3);
}
.sidebar nav { display: flex; flex-direction: column; gap: var(--s-1); }
.sidebar a {
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  color: var(--color-text-soft);
}
.sidebar a:hover { background: var(--color-surface-2); text-decoration: none; }
.sidebar a.active { background: var(--color-accent-soft); color: var(--color-accent-strong); }

.main {
  padding: var(--s-5) var(--s-6);
  min-width: 0;
}

@media (max-width: 48rem) {
  .shell-firm { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: var(--s-4); }
}

.btn-block { width: 100%; }
.btn-spinner-text { letter-spacing: 0.15em; }

/* Anchors styled as buttons sometimes wrap their visible chrome; keep links
   underline-free when they carry .btn so the buttoned anchors don't read as
   text links. */
a.btn { text-decoration: none; }

/* ---- Status pill (domain) ---- */

.pill {
  display: inline-block;
  padding: 0 var(--s-2);
  border-radius: 999px;
  font-size: var(--f-sm);
  background: var(--color-st-draft-bg);
  color: var(--color-st-draft-fg);
  line-height: 1.8;
}
.pill[data-status="draft"]          { background: var(--color-st-draft-bg);          color: var(--color-st-draft-fg); }
.pill[data-status="open"]           { background: var(--color-st-open-bg);           color: var(--color-st-open-fg); }
.pill[data-status="clarification"]  { background: var(--color-st-clarification-bg);  color: var(--color-st-clarification-fg); }
.pill[data-status="in_review"]      { background: var(--color-st-in_review-bg);      color: var(--color-st-in_review-fg); }
.pill[data-status="done"]           { background: var(--color-st-done-bg);           color: var(--color-st-done-fg); }
.pill[data-status="cancelled"]      { background: var(--color-st-cancelled-bg);      color: var(--color-st-cancelled-fg); text-decoration: line-through; }
.pill[data-status="not_applicable"] { background: var(--color-st-not_applicable-bg); color: var(--color-st-not_applicable-fg); }
.pill.pill-overdue { background: var(--color-danger-soft); color: var(--color-danger); }
.pill.pill-error {
  background: var(--color-danger-soft);
  color: var(--color-danger);
  border: 1px solid var(--color-danger);
}

/* .card still used by static auth/demo HTML and .client-complete; the JS
   Card component swapped to shared .surface-1. */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  padding: var(--s-4);
  box-shadow: var(--shadow-sm);
}
.card + .card,
.surface-1 + .surface-1 { margin-top: var(--s-3); }
.card-header {
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}

/* ---- Forms: keep vitu's inline form variants. The base .field /
   .input / .select / .textarea shapes are inherited from shared/patterns,
   which already match vitu's earlier paint within tolerance. */

.field label { font-size: var(--f-sm); color: var(--color-text-soft); }
.field-desc  { font-size: var(--f-sm); color: var(--color-text-muted); }

.form-stack { display: flex; flex-direction: column; gap: var(--s-3); max-width: 28rem; }
.form-inline { display: flex; align-items: flex-end; gap: var(--s-3); flex-wrap: wrap; }
.form-inline .field { min-width: 12rem; }
.form-actions { display: flex; gap: var(--s-2); justify-content: flex-end; margin-top: var(--s-4); }

/* Login page divider with centered "tai" label. */
.divider {
  display: flex; align-items: center; gap: var(--s-3);
  margin: var(--s-3) 0;
  color: var(--color-text-soft);
  font-size: var(--f-sm);
}
.divider::before, .divider::after {
  content: ""; flex: 1; height: 1px; background: var(--color-border);
}

/* Invitation link surfaced after onboarding (F5.c3). Monospace + wrap so
   the full URL is visible and easy to select; user-select:all makes a
   click-drag grab the whole link. */
.onboard-link-box {
  font-family: var(--font-mono);
  font-size: var(--f-sm);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--r-sm);
  padding: var(--s-2) var(--s-3);
  margin: var(--s-3) 0;
  overflow-wrap: anywhere;
  word-break: break-all;
  user-select: all;
}

.inline-expansion {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  padding: var(--s-5);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--s-4);
}
.inline-expansion:focus { outline: none; }

/* Modal / Toast / Empty paint owned by shared/css/patterns.css. */

.toast-close {
  margin-left: auto;
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: var(--s-1);
  font-size: var(--f-lg);
  line-height: 1;
  opacity: 0.7;
}
.toast-close:hover { opacity: 1; }

/* ---- Dropzone ---- */

.dropzone {
  border: 2px dashed var(--color-border-strong);
  border-radius: var(--r-md);
  padding: var(--s-5);
  text-align: center;
  color: var(--color-text-soft);
  background: var(--color-surface);
  cursor: pointer;
}
.dropzone.is-over { border-color: var(--color-accent); background: var(--color-accent-soft); color: var(--color-accent-strong); }

/* ---- Lists (domain styling -- shared's .list has card chrome, vitu's
   has per-row chrome with gaps) ---- */

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s-2); background: transparent; border: none; }
.list > li { border: none; }
.list-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
}
.list-row .grow { flex: 1; min-width: 0; }
.list-row .meta { color: var(--color-text-muted); font-size: var(--f-sm); }

/* Per-row status tint -- second redundant signal alongside the status pill. */
.list-row[data-status] {
  background: color-mix(in oklch, var(--row-tint, var(--color-surface)) 40%, var(--color-surface));
}
.list-row[data-status="open"]           { --row-tint: var(--color-st-open-bg); }
.list-row[data-status="clarification"]  { --row-tint: var(--color-st-clarification-bg); }
.list-row[data-status="in_review"]      { --row-tint: var(--color-st-in_review-bg); }
.list-row[data-status="done"]           { --row-tint: var(--color-st-done-bg); }
.list-row[data-status="cancelled"]      { --row-tint: var(--color-st-cancelled-bg); }
.list-row[data-status="not_applicable"] { --row-tint: var(--color-st-not_applicable-bg); }
.list-row[data-status="draft"]          { --row-tint: var(--color-st-draft-bg); }

.cell-amount {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

/* ---- Disclosure groups ---- */

.group { margin-bottom: var(--s-3); }
.group > summary {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  cursor: pointer;
  font-weight: 600;
  border-radius: var(--r-sm);
}
.group > summary:hover { background: var(--color-surface-2); }
.group > .list { margin-top: var(--s-2); }
.group-meta {
  margin-left: auto;
  display: flex;
  gap: var(--s-3);
  align-items: center;
}

/* ---- Misc helpers ---- */

.stack { display: flex; flex-direction: column; gap: var(--s-4); }
.row   { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.muted { color: var(--color-text-muted); }
.section-title { margin: var(--s-5) 0 var(--s-2); }

/* ---- Client portal ---- */

.client-hero {
  margin-bottom: var(--s-4);
}
.client-hero h1 {
  font-size: var(--f-xl);
  line-height: 1.3;
  margin-bottom: var(--s-3);
}

.progress {
  margin-top: var(--s-2);
}
.progress-bar {
  background: var(--color-surface-2);
  border-radius: var(--r-sm);
  height: 8px;
  overflow: hidden;
}
.progress-bar-fill {
  background: var(--color-accent);
  height: 100%;
  transition: width 200ms ease-out;
}
.progress-label {
  margin: var(--s-1) 0 0;
  color: var(--color-text-soft);
  font-size: var(--f-sm);
}

.client-complete {
  background: var(--color-success-soft);
  border-color: var(--color-success);
}
.client-complete h2 { color: var(--color-success); }

.task-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  padding: var(--s-4);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.task-card.is-overdue { border-color: var(--color-danger); }
.task-card-head {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  flex-wrap: wrap;
}
.task-card-title { flex: 1; min-width: 0; }
.task-card-title h3 {
  font-size: var(--f-lg);
  margin: 0;
  overflow-wrap: anywhere;
}
.task-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  margin-top: var(--s-1);
  font-size: var(--f-sm);
  color: var(--color-text-soft);
}
.task-card-pills {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--s-1);
}
.task-card-actions {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

/* Client-side comment thread on each ClientTaskRow. Chat-bubble shape:
   client (self) leans right with brand-tinted bg, firm leans left with
   neutral surface. Kept simple -- the demo is for two-party threads,
   not group chat. */
.client-comments {
  margin-top: var(--s-3);
  padding-top: var(--s-3);
  border-top: 1px solid var(--color-border);
}
.client-comments-title {
  font-size: var(--f-sm);
  color: var(--color-text-muted);
  margin: 0 0 var(--s-2);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.client-comments-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.client-comment {
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-md);
  max-width: 85%;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
}
.client-comment.is-self {
  align-self: flex-end;
  background: var(--color-accent-soft);
  border-color: color-mix(in oklch, var(--color-accent) 30%, var(--color-border));
}
.client-comment-head {
  display: flex;
  gap: var(--s-2);
  align-items: baseline;
  font-size: var(--f-sm);
  margin-bottom: var(--s-1);
}
.client-comment-head strong { font-weight: 600; }
.client-comment-body { margin: 0; white-space: pre-wrap; }

/* Reply form sits under the thread (or alone, when there are no
   comments yet but the task is still open). Same width budget as the
   bubbles for visual continuity. */
.client-comment-form {
  margin-top: var(--s-3);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.client-comment-form .textarea { resize: vertical; }
.upload-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}
.upload-btn {
  flex: 1 1 8rem;
  min-height: 2.75rem;
  justify-content: center;
  cursor: pointer;
}

.thumb-strip {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}
.thumb-tile {
  display: inline-block;
  width: 64px;
  height: 64px;
  border: 1px solid var(--color-border);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--color-surface-2);
}
.thumb-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.thumb-tile.thumb-doc {
  width: auto;
  height: auto;
  padding: var(--s-1) var(--s-2);
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--f-sm);
  color: var(--color-text-soft);
}
.thumb-doc-icon {
  font-weight: 600;
  font-size: 0.75rem;
  padding: 2px 4px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--r-sm);
  color: var(--color-text);
  background: var(--color-surface);
}
.thumb-doc-name {
  max-width: 18ch;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.check-row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2);
  border-radius: var(--r-sm);
  cursor: pointer;
}
.check-row:hover { background: var(--color-surface-2); }

/* ---- Firm: dashboard ---- */

.dash-counts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: var(--s-3);
  margin: var(--s-4) 0;
}
.dash-count-card {
  padding: var(--s-3) var(--s-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}
.dash-count-card[data-status="open"]          { border-left: 4px solid var(--color-st-open-fg); }
.dash-count-card[data-status="clarification"] { border-left: 4px solid var(--color-st-clarification-fg); }
.dash-count-card[data-status="in_review"]     { border-left: 4px solid var(--color-st-in_review-fg); }
.dash-count-num { font-size: var(--f-2xl); font-weight: 600; color: var(--color-text); }
.dash-count-label { color: var(--color-text-soft); font-size: var(--f-sm); }
.dash-small { font-size: var(--f-sm); }

/* Recent uploads grouped per customer. The group head sits above each
   list and carries a status pill; baseline-align reads cleanest when the
   name is heavier than the pill. */
.dash-recent-groups { display: flex; flex-direction: column; gap: var(--s-4); }
.dash-recent-head {
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
  padding: var(--s-2) 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--s-1);
}
.dash-recent-head .grow { font-weight: 600; }

/* ---- Firm: customers grid ---- */

.customer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: var(--s-3);
}
.customer-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding: var(--s-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  color: inherit;
}
.customer-card:hover { background: var(--color-surface-2); text-decoration: none; }
.customer-card h3 { margin: 0; font-size: var(--f-lg); }
.customer-card-meta {
  display: flex;
  gap: var(--s-2);
  align-items: center;
  flex-wrap: wrap;
  font-size: var(--f-sm);
  color: var(--color-text-soft);
}

/* ---- Firm: customer detail ---- */

.head-row { margin-bottom: var(--s-3); }
.head-row h1 { margin: 0; }

button.inline-text {
  cursor: text;
  padding: var(--s-1) 0;
  font: inherit;
  font-size: var(--f-sm);
  color: var(--color-text-soft);
  background: transparent;
  border: none;
  text-align: left;
  display: block;
  width: 100%;
  max-width: 36rem;
  margin-bottom: var(--s-2);
}
button.inline-text:hover { color: var(--color-text); }
.inline-text-input {
  font-size: var(--f-sm);
  width: 100%;
  max-width: 36rem;
}

.totals-strip {
  display: flex;
  gap: var(--s-4);
  margin: var(--s-3) 0 var(--s-4);
  flex-wrap: wrap;
}
.totals-cell {
  padding: var(--s-2) var(--s-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
}
.totals-cell.muted { background: var(--color-surface-2); }
.totals-num { font-size: var(--f-xl); font-weight: 600; }
.totals-label { font-size: var(--f-sm); color: var(--color-text-soft); }

.filter-pills {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
  margin-bottom: var(--s-3);
}
.filter-pills .pill {
  cursor: pointer;
  border: 1px solid var(--color-border);
  font: inherit;
  padding: 0 var(--s-2);
}
.filter-pills .pill.is-active { outline: 2px solid var(--color-accent); }

.list-row.is-overdue { border-color: var(--color-danger); }
.list-row.is-drag-over,
.task-card.is-drag-over {
  outline: 2px dashed var(--color-accent);
  outline-offset: -2px;
  background: var(--color-accent-soft);
}

.event-log pre {
  margin: var(--s-1) 0 0;
  padding: var(--s-2);
  background: var(--color-surface-2);
  border-radius: var(--r-sm);
  font-size: var(--f-sm);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---- Tabs (domain styling -- shared .tabs uses tab-list child) ---- */

.tabs {
  display: flex;
  gap: var(--s-2);
  border-bottom: 1px solid var(--color-border);
  margin: var(--s-3) 0 var(--s-4);
}
.tabs .tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: var(--s-2) var(--s-3);
  font: inherit;
  color: var(--color-text-soft);
  cursor: pointer;
}
.tabs .tab.is-active {
  color: var(--color-text);
  border-bottom-color: var(--color-accent);
  font-weight: 600;
}

/* ---- Status dropdown ---- */

.status-dropdown { position: relative; display: inline-block; }
.status-trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  padding: var(--s-2) var(--s-3);
  font: inherit;
  color: var(--color-text);
  cursor: pointer;
}
.status-trigger[data-status="open"]            { background: var(--color-st-open-bg);          color: var(--color-st-open-fg); }
.status-trigger[data-status="clarification"]   { background: var(--color-st-clarification-bg); color: var(--color-st-clarification-fg); }
.status-trigger[data-status="in_review"]       { background: var(--color-st-in_review-bg);     color: var(--color-st-in_review-fg); }
.status-trigger[data-status="done"]            { background: var(--color-st-done-bg);          color: var(--color-st-done-fg); }
.status-trigger[data-status="cancelled"]       { background: var(--color-st-cancelled-bg);     color: var(--color-st-cancelled-fg); }
.status-trigger[data-status="draft"]           { background: var(--color-st-draft-bg);         color: var(--color-st-draft-fg); }
.status-trigger[data-status="not_applicable"]  { background: var(--color-st-not_applicable-bg); color: var(--color-st-not_applicable-fg); }
.status-trigger:disabled { opacity: 0.6; cursor: progress; }
.status-trigger .caret { font-size: 0.7em; }
.status-dropdown.is-compact .status-trigger { padding: var(--s-1) var(--s-2); font-size: var(--f-sm); }

/* Status dropdown menu inherits paint from shared .menu / .menu-item
   (Portal-rendered, position handled by anchor utils). Local override
   strikes through disabled items so blocked transitions read as
   blocked at a glance -- shared's opacity-only treatment is too
   subtle for a status picker where ~half the entries are typically
   disabled per the firm transition matrix. */
.status-menu .menu-item[aria-disabled="true"],
.status-menu .menu-item:disabled {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

/* ---- Inline NA picker (shared by dropdown + client row) ---- */

.na-inline {
  margin-top: var(--s-3);
  padding: var(--s-3);
  background: var(--color-surface-2);
  border-radius: var(--r-md);
  border: 1px solid var(--color-border);
}
.na-inline-help { margin-bottom: var(--s-2); }

/* ---- Inline due-date ---- */

.inline-due-date {
  width: auto;
  min-width: 9rem;
}

/* ---- Multi-select + bulk bar ---- */

.list-checkbox {
  margin-right: var(--s-2);
  width: 1.1em;
  height: 1.1em;
  cursor: pointer;
}
.list-row.is-selected {
  background: var(--color-accent-soft);
  border-color: var(--color-accent);
}

.bulk-bar {
  position: sticky;
  bottom: var(--s-3);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  margin-top: var(--s-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  z-index: var(--z-bulk-bar);
}
.bulk-bar-label { font-weight: 600; }
.bulk-bar-actions {
  display: flex;
  gap: var(--s-2);
  flex-grow: 1;
}

.section-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

/* ---- Side sheet ---- */

.side-sheet-backdrop {
  position: fixed; inset: 0;
  background: color-mix(in oklch, var(--neutral-12) 20%, transparent);
  z-index: var(--z-side-sheet);
}
@media (prefers-reduced-transparency: reduce) {
  .side-sheet-backdrop { background: var(--neutral-12); }
}
.side-sheet {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: var(--w-side-sheet, 480px);
  max-width: 100vw;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  animation: sheet-in var(--motion-normal) var(--ease-out);
}
.side-sheet:focus { outline: none; }
.side-sheet-header {
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--color-border);
}
.side-sheet-header h2 { flex: 1; margin: 0; }
.side-sheet-close {
  background: transparent;
  border: none;
  color: var(--color-text-soft);
  cursor: pointer;
  padding: var(--s-1);
  font-size: var(--f-lg);
  line-height: 1;
  margin: calc(var(--s-1) * -1);
}
.side-sheet-close:hover { color: var(--color-text); }
.side-sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--s-4) var(--s-5);
}
@keyframes sheet-in {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

/* ---- Task table ---- */

.task-table {
  width: 100%;
  border-collapse: collapse;
}
.task-table th {
  text-align: left;
  padding: var(--s-2) var(--s-3);
  font-size: var(--f-sm);
  font-weight: 600;
  color: var(--color-text-soft);
  border-bottom: 2px solid var(--color-border);
  white-space: nowrap;
  user-select: none;
}
.task-table th.sortable { cursor: pointer; }
.task-table th.sortable:hover { color: var(--color-text); }
.task-table th[aria-sort="ascending"]::after  { content: " \2191"; }
.task-table th[aria-sort="descending"]::after { content: " \2193"; }
.task-table th.col-checkbox { width: 2.5rem; }
.task-table th.col-amount,
.task-table td.col-amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.task-table td {
  padding: var(--s-2) var(--s-3);
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
.task-table tr[data-status] {
  background: color-mix(in oklch, var(--row-tint, var(--color-surface)) 40%, var(--color-surface));
}
.task-table tr[data-status="open"]           { --row-tint: var(--color-st-open-bg); }
.task-table tr[data-status="clarification"]  { --row-tint: var(--color-st-clarification-bg); }
.task-table tr[data-status="in_review"]      { --row-tint: var(--color-st-in_review-bg); }
.task-table tr[data-status="done"]           { --row-tint: var(--color-st-done-bg); }
.task-table tr[data-status="cancelled"]      { --row-tint: var(--color-st-cancelled-bg); }
.task-table tr[data-status="not_applicable"] { --row-tint: var(--color-st-not_applicable-bg); }
.task-table tr[data-status="draft"]          { --row-tint: var(--color-st-draft-bg); }
.task-table tr:hover td { background: var(--color-surface-2); }
.task-table tr.is-selected td { background: var(--color-accent-soft); }
.task-table tr.is-overdue td { border-left: 3px solid var(--color-danger); }
/* Row whose task is currently shown in the side sheet. Brand-tinted
   background + brand left stripe so the firm can see at a glance which
   row the sheet is bound to. Distinct from .is-selected (checkbox
   bulk-select) and .is-overdue (deadline signal). */
.task-table tr.is-sheet-open td {
  background: var(--color-accent-soft);
  box-shadow: inset 3px 0 0 0 var(--color-accent);
}
.task-table tr.is-drag-over td {
  outline: 2px dashed var(--color-accent);
  outline-offset: -2px;
  background: var(--color-accent-soft);
}
.task-table .task-title-link { color: var(--color-text); font-weight: 500; }
.task-table .task-title-link:hover { color: var(--color-accent); text-decoration: underline; }
.task-table .task-meta { color: var(--color-text-muted); font-size: var(--f-sm); }

/* ---- Skip link ---- */

main:focus { outline: none; }

.skip-link {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus-visible {
  position: fixed;
  left: var(--s-4);
  top: var(--s-4);
  width: auto;
  height: auto;
  overflow: visible;
  padding: var(--s-2) var(--s-4);
  background: var(--color-surface);
  border: 2px solid var(--color-border-focus);
  border-radius: var(--r-sm);
  color: var(--color-text);
  font-size: var(--f-sm);
  z-index: 999;
  text-decoration: none;
}

/* ---- Focus rings for vitu-only interactive surfaces.
   Shared/patterns owns .btn, .tab, .input etc. -- the selectors here cover
   domain components not in the shared library. */

.status-trigger:focus-visible,
.tabs .tab:focus-visible,
.sidebar a:focus-visible,
.customer-card:focus-visible,
.upload-btn:focus-visible,
.check-row:focus-visible,
.filter-pills .pill:focus-visible,
.group > summary:focus-visible,
button.inline-text:focus-visible,
.toast-close:focus-visible,
.side-sheet-close:focus-visible {
  outline: 2px solid var(--color-border-focus);
  outline-offset: 2px;
}
