/* ═══════════════════════════════════════════════════════════════════
   Financials Studio — Dashboard prototype
   Layered on top of tokens.css + onboarding.css. Adds the two-column
   app shell (fixed left sidebar + flexible main area), the role-aware
   dashboard surfaces (stat cards, approvals queue, activity feed,
   task tiles), and the sidebar user-menu popover.
   Re-uses .field / .cta-primary / .cta-ghost / .alert-* / .spinner /
   .reveal from onboarding.css unchanged.
   ═══════════════════════════════════════════════════════════════════ */

/* ───── reset onboarding's centered-stage layout ──────────────────── */

/* The dashboard is a full-bleed app surface, not a centered card stage.
   Override the body's flex column so the app shell can fill the viewport
   and let the sidebar own its full height. */
body {
  display: block;
  min-height: 100vh;
  background: var(--bg);
}

/* ───── app shell ─────────────────────────────────────────────────── */

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
  width: 100%;
}

@media (max-width: 880px) {
  .app-shell { grid-template-columns: 1fr; }
}

/* ───── sidebar ───────────────────────────────────────────────────── */

.sidebar {
  background: var(--paper);
  border-right: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  /* Don't overflow:hidden — the sidebar-footer's user-menu popover would
     get clipped. Instead let the middle nav scroll on its own. */
}
@media (max-width: 880px) {
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--hairline);
  }
}

/* Brand + page header share a baseline — both have the same min-height
   so the bottom hairline lines up across columns regardless of which
   one's content (eyebrow + title) happens to be taller. */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 22px;
  min-height: 92px;
  box-sizing: border-box;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 18px;
  color: var(--navy);
  letter-spacing: -0.01em;
  border-bottom: 1px solid var(--hairline);
}
.sidebar-brand .brand-logo {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}
.sidebar-brand-mark { line-height: 1.1; }
.sidebar-brand-meta {
  display: block;
  font-family: var(--sans);
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  letter-spacing: var(--ls-upper);
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px 14px;
  display: grid;
  gap: 4px;
  align-content: start;
}

.sidebar-section {
  margin-top: 18px;
  padding: 0 10px 6px;
  font-family: var(--sans);
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  letter-spacing: var(--ls-upper);
  text-transform: uppercase;
  color: var(--muted-2);
}
.sidebar-section:first-of-type { margin-top: 0; }

.sidebar-link {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--r-1);
  font-size: var(--fs-body-sm);
  font-weight: 500;
  color: var(--charcoal);
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.sidebar-link:hover { background: rgba(26, 58, 107, 0.05); color: var(--navy); }
.sidebar-link svg { width: 18px; height: 18px; color: var(--muted); }
.sidebar-link.is-active {
  background: rgba(26, 58, 107, 0.08);
  color: var(--navy);
  font-weight: 600;
}
.sidebar-link.is-active svg { color: var(--navy); }

/* Sub-actions (e.g. Tasks → "View tasks" / "Start new") */
.sidebar-sub {
  display: grid;
  gap: 2px;
  padding: 4px 0 6px 30px;
  border-left: 1px solid var(--hairline);
  margin-left: 21px;
}
.sidebar-sub .sidebar-sublink {
  display: block;
  padding: 6px 10px;
  font-size: var(--fs-meta);
  color: var(--muted);
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
}
.sidebar-sub .sidebar-sublink:hover { background: rgba(26, 58, 107, 0.04); color: var(--navy); }

.sidebar-link-count {
  font-size: var(--fs-meta);
  color: var(--muted);
  font-weight: 500;
  background: var(--bg-soft);
  border-radius: var(--r-pill);
  padding: 2px 8px;
}
.sidebar-link.is-active .sidebar-link-count {
  background: var(--gold-bg);
  color: var(--navy);
}

/* ───── sidebar footer (settings + user) ──────────────────────────── */

.sidebar-foot {
  border-top: 1px solid var(--hairline);
  padding: 12px 14px 14px;
  display: grid;
  gap: 4px;
  position: relative;             /* anchors the user-menu popover */
}

.sidebar-user {
  display: grid;
  grid-template-columns: 36px 1fr 12px;
  gap: 10px;
  align-items: center;
  padding: 10px 10px;
  margin-top: 6px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-1);
  cursor: pointer;
  font: inherit;
  text-align: left;
  color: var(--charcoal);
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.sidebar-user:hover,
.sidebar-user[aria-expanded="true"] {
  background: rgba(26, 58, 107, 0.05);
  border-color: var(--hairline);
}

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--r-pill);
  background: linear-gradient(135deg, var(--navy), var(--navy-soft));
  color: var(--paper);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sidebar-user-meta { display: grid; gap: 2px; min-width: 0; }
.sidebar-user-name {
  font-size: var(--fs-body-sm);
  font-weight: 600;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-email {
  font-size: var(--fs-meta);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-caret {
  width: 10px;
  height: 7px;
  color: var(--muted);
}

.role-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: var(--ls-upper-narrow);
  text-transform: uppercase;
  color: var(--navy);
  background: var(--gold-bg);
  border: 1px solid rgba(232, 180, 58, 0.45);
  border-radius: var(--r-pill);
  white-space: nowrap;
}
.role-chip .dot {
  width: 5px;
  height: 5px;
  border-radius: var(--r-pill);
  background: var(--gold);
}

/* User popover anchored above the user button. */
.sidebar-user-pop {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 14px;
  right: 14px;
  display: grid;
  gap: 2px;
  padding: 8px;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--r-1);
  box-shadow: var(--shadow-1);
  z-index: 50;
}
.sidebar-user-pop[hidden] { display: none; }   /* display:grid clobbers HTML hidden without this */
.sidebar-user-pop .user-menu-email {
  display: block;
  padding: 8px 10px 6px;
  font-size: var(--fs-meta);
  color: var(--muted);
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 4px;
}
.sidebar-user-pop .user-menu-item {
  display: block;
  padding: 8px 10px;
  font-size: var(--fs-body-sm);
  color: var(--charcoal);
  border-radius: 6px;
  text-decoration: none;
}
.sidebar-user-pop .user-menu-item:hover { background: rgba(26, 58, 107, 0.05); color: var(--navy); }

/* ───── main app area ─────────────────────────────────────────────── */

.app-main {
  display: flex;
  flex-direction: column;
  min-width: 0;                   /* lets long content shrink instead of overflowing the grid */
}

.app-header {
  display: grid;
  grid-template-columns: 1fr auto auto;     /* title · utilities (search+bell) · actions */
  gap: 20px;
  align-items: center;
  padding: 16px clamp(20px, 3vw, 40px);
  min-height: 92px;
  box-sizing: border-box;
  border-bottom: 1px solid var(--hairline);
  background: var(--paper);
}

/* ── search + notification bell (header utilities) ── */
.app-header-utils {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.app-search {
  width: clamp(200px, 28vw, 320px);
  padding: 9px 12px 9px 36px;
  background: var(--bg-soft, #f7f9fc) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%236b7280' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><circle cx='9' cy='9' r='6'/><path d='m17 17-4.35-4.35'/></svg>") no-repeat 12px center;
  background-size: 14px 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  font: inherit;
  font-size: var(--fs-body-sm);
  color: var(--charcoal);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.app-search::placeholder { color: var(--muted-2); }
.app-search:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(26, 58, 107, 0.10);
  background-color: var(--paper);
}

.app-bell {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  color: var(--muted);
  cursor: pointer;
  position: relative;
  transition: border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.app-bell:hover { border-color: var(--navy); color: var(--navy); }
.app-bell svg { width: 18px; height: 18px; }
.app-bell .app-bell-dot {
  /* gold dot when there's an unread — single accent, no green/red noise */
  position: absolute;
  top: 7px;
  right: 9px;
  width: 7px;
  height: 7px;
  background: var(--gold);
  border: 2px solid var(--paper);
  border-radius: var(--r-pill);
}

/* ── header user menu (top-right, mirrors the wizard's user-menu pattern) ── */
.header-user-wrap { position: relative; }

.header-user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  color: var(--navy);
  cursor: pointer;
  font: inherit;
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.header-user:hover,
.header-user[aria-expanded="true"] {
  background: rgba(26, 58, 107, 0.05);
  border-color: var(--navy);
}
.header-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: var(--r-pill);
  background: linear-gradient(135deg, var(--navy), var(--navy-soft));
  color: var(--paper);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.header-user-caret { width: 10px; height: 7px; color: var(--muted); }

.header-user-pop {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  display: grid;
  gap: 4px;
  padding: 8px;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--r-1);
  box-shadow: var(--shadow-2, 0 12px 32px rgba(0,0,0,0.10));
  z-index: 50;
}
.header-user-pop[hidden] { display: none; }       /* display:grid clobbers HTML hidden */
.header-user-email {
  display: block;
  padding: 8px 10px 6px;
  font-size: var(--fs-meta);
  color: var(--muted);
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 4px;
}
.header-user-item {
  display: block;
  padding: 8px 10px;
  font-size: var(--fs-body-sm);
  color: var(--charcoal);
  border-radius: 6px;
  text-decoration: none;
}
.header-user-item:hover { background: rgba(26, 58, 107, 0.05); color: var(--navy); }
.app-header-titles { display: grid; gap: 4px; min-width: 0; }
.app-header-crumb {
  font-family: var(--sans);
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  letter-spacing: var(--ls-upper);
  text-transform: uppercase;
  color: var(--muted);
}
.app-header-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(24px, 2.6vw, 32px);
  line-height: 1.1;
  letter-spacing: var(--ls-tight-2);
  color: var(--navy);
  margin: 0;
}

.app-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.app-header-actions .cta-primary,
.app-header-actions .cta-ghost {
  width: auto;
  min-width: 0;
  padding: 11px 18px;
  font-size: var(--fs-body-sm);
}

.app-body {
  flex: 1 1 auto;
  padding: clamp(24px, 3vw, 40px);
  display: grid;
  gap: clamp(24px, 3vw, 36px);
  align-content: start;
}
.app-body[hidden] { display: none; }   /* display:grid clobbers HTML hidden without this — same gotcha as the wizard popovers */

/* ───── sections (cards) ──────────────────────────────────────────── */

.surface {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--r-2);
  padding: 24px clamp(20px, 2.4vw, 28px);
  display: grid;
  gap: 18px;
}

.surface-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.surface-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: var(--ls-tight-2);
  color: var(--navy);
  margin: 0;
}
.surface-eyebrow {
  font-family: var(--sans);
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  letter-spacing: var(--ls-upper);
  text-transform: uppercase;
  color: var(--muted);
}
.surface-link {
  font-size: var(--fs-meta);
  font-weight: 500;
  color: var(--navy);
  border-bottom: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  background: transparent;
  border-top: none; border-left: none; border-right: none;
  padding: 0;
}
.surface-link:hover { border-bottom-color: var(--navy); }

/* ───── headline figures ──────────────────────────────────────────────
   Replaces the boxy "stat-card" widget look with an editorial-finance
   summary band — like the headline figures at the top of an annual
   report. One paper surface, divided by hairlines, with the numbers
   doing the visual work in Fraunces. */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 1080px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px)  { .stat-grid { grid-template-columns: 1fr; } }

.stat-card {
  padding: 24px clamp(20px, 2vw, 28px);
  display: grid;
  gap: 8px;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--r-2);
}

/* Plain navy icon — no chip background. Sits as a small marker above
   the eyebrow label, monochrome to keep colour discipline. */
.stat-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--navy);
  margin-bottom: 2px;
}
.stat-icon svg { width: 22px; height: 22px; }
@media (max-width: 1080px) {
  .stat-card { border-bottom: 1px solid var(--hairline); }
  .stat-card:nth-child(2n)  { border-right: 0; }
  .stat-card:nth-last-child(-n+2) { border-bottom: 0; }
}
@media (max-width: 520px) {
  .stat-card { border-right: 0; border-bottom: 1px solid var(--hairline); }
  .stat-card:last-child { border-bottom: 0; }
}

.stat-label {
  font-family: var(--sans);
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  letter-spacing: var(--ls-upper);
  text-transform: uppercase;
  color: var(--muted);
}
.stat-value {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(40px, 4vw, 52px);    /* much bigger — the figure is the story */
  line-height: 1;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--ls-tight-2);
  margin-top: 2px;
}
.stat-value-currency {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin-right: 6px;
  letter-spacing: var(--ls-upper-narrow);
  vertical-align: 0.5em;                /* baseline-aligned, not centred */
}
.stat-meta {
  font-size: var(--fs-meta);
  color: var(--muted);
  margin-top: 4px;
}
.stat-meta strong { color: var(--charcoal); font-weight: 600; }

.stat-card.is-tight .stat-value { font-size: 32px; }

/* ───── activity feed ─────────────────────────────────────────────── */

.activity-feed {
  display: grid;
  gap: 0;
}
.activity-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 12px 0;
  border-bottom: 1px solid var(--hairline);
}
.activity-item:last-child { border-bottom: 0; }

.activity-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--r-pill);
  background: linear-gradient(135deg, var(--navy), var(--navy-soft));
  color: var(--paper);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.activity-avatar.is-warm {
  background: linear-gradient(135deg, #b8842a, var(--gold));
  color: var(--navy);
}
.activity-avatar.is-cool {
  background: linear-gradient(135deg, #4f6c97, #7a8fb0);
}
.activity-text {
  font-size: var(--fs-body-sm);
  color: var(--charcoal);
  line-height: 1.5;
}
.activity-text strong { color: var(--navy); font-weight: 600; }
.activity-time {
  font-size: var(--fs-meta);
  color: var(--muted-2);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ───── approvals queue ───────────────────────────────────────────── */

.approval-list {
  display: grid;
  gap: 10px;
}
.approval-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  background: var(--bg-soft);
  border: 1px solid var(--hairline);
  border-radius: var(--r-1);
  transition: border-color var(--dur-fast) var(--ease-out);
}
.approval-row:hover { border-color: var(--navy); }

.approval-meta { display: grid; gap: 4px; min-width: 0; }
.approval-client {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 18px;
  color: var(--navy);
  letter-spacing: var(--ls-tight-2);
}
.approval-line {
  font-size: var(--fs-body-sm);
  color: var(--charcoal);
}
.approval-line .sep { color: var(--muted-2); margin: 0 8px; }
.approval-tags {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-meta);
  color: var(--muted);
}

.approval-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: var(--ls-upper-narrow);
  text-transform: uppercase;
  border-radius: var(--r-pill);
  border: 1px solid var(--hairline);
  background: var(--paper);
  color: var(--charcoal);
}
.approval-tag.is-statutory { color: var(--navy); border-color: rgba(26, 58, 107, 0.3); }
.approval-tag.is-management { color: var(--info); border-color: rgba(51, 90, 138, 0.3); }
.approval-tag.is-tax { color: var(--warning); border-color: rgba(199, 119, 0, 0.3); }

.approval-actions { display: inline-flex; gap: 8px; }
.approval-actions .cta-primary,
.approval-actions .cta-ghost {
  width: auto;
  min-width: 0;
  padding: 9px 16px;
  font-size: var(--fs-body-sm);
}

/* "Recently signed off" — softer read-only rows. */
.signed-list { display: grid; gap: 0; }
.signed-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--hairline);
  font-size: var(--fs-body-sm);
}
.signed-row:last-child { border-bottom: 0; }
.signed-client { color: var(--navy); font-weight: 600; }
.signed-meta { color: var(--muted); font-size: var(--fs-meta); }
.signed-stamp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: var(--ls-upper-narrow);
  text-transform: uppercase;
  color: var(--success);
}
.signed-stamp .dot {
  width: 6px; height: 6px;
  border-radius: var(--r-pill);
  background: var(--success);
}

/* ───── workflow list (Accountant's "your pending" / SeniorManager) ── */

.workflow-list { display: grid; gap: 10px; }
.workflow-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--r-1);
  transition: border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.workflow-row:hover { border-color: var(--navy); background: rgba(26, 58, 107, 0.02); }

.workflow-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.workflow-client {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 17px;
  color: var(--navy);
  letter-spacing: var(--ls-tight-2);
}
.workflow-task {
  font-size: var(--fs-body-sm);
  color: var(--charcoal);
}
.workflow-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-meta);
  color: var(--muted);
  margin-top: 4px;
}
.workflow-status .dot {
  width: 6px; height: 6px;
  border-radius: var(--r-pill);
  background: var(--gold);
}
.workflow-status.is-blocked .dot   { background: var(--warning); }
.workflow-status.is-running .dot   { background: var(--info); }
.workflow-status.is-waiting .dot   { background: var(--gold); }
.workflow-status.is-done .dot      { background: var(--success); }

.workflow-actions .cta-ghost {
  width: auto; min-width: 0;
  padding: 8px 14px;
  font-size: var(--fs-body-sm);
}

.workflow-group {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  background: var(--bg-soft);
  border: 1px solid var(--hairline);
  border-radius: var(--r-1);
}
.workflow-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.workflow-group-name {
  font-family: var(--sans);
  font-size: var(--fs-body-sm);
  font-weight: 600;
  color: var(--navy);
}
.workflow-group-meta {
  font-size: var(--fs-meta);
  color: var(--muted);
}

/* ───── start-a-task quick-start tiles (Accountant) ───────────────── */

.task-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 880px)  { .task-tiles { grid-template-columns: 1fr; } }

.task-tile {
  display: grid;
  gap: 8px;
  padding: 18px 18px 20px;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--r-1);
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition:
    border-color var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
}
.task-tile:hover {
  border-color: var(--navy);
  transform: translateY(-1px);
  box-shadow: var(--shadow-1);
}
.task-tile-icon {
  width: 36px; height: 36px;
  border-radius: var(--r-1);
  background: var(--gold-bg);
  color: var(--navy);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.task-tile-icon svg { width: 20px; height: 20px; }
.task-tile-title {
  font-family: var(--sans);
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--navy);
  margin: 0;
}
.task-tile-meta {
  font-size: var(--fs-meta);
  color: var(--muted);
  line-height: 1.5;
}

/* ───── hero card (Partner's "X items waiting") ──────────────────── */

.hero-card {
  background: linear-gradient(135deg, var(--navy), #2a4a7b);
  color: var(--paper);
  border: 1px solid var(--navy);
  border-radius: var(--r-2);
  padding: 32px clamp(28px, 3vw, 40px);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 24px;
}
@media (max-width: 720px) {
  .hero-card { grid-template-columns: 1fr; }
}
.hero-card-eyebrow {
  font-family: var(--sans);
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  letter-spacing: var(--ls-upper);
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
}
.hero-card-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(28px, 3.4vw, 38px);
  line-height: 1.1;
  letter-spacing: var(--ls-tight-2);
  color: var(--paper);
  margin: 0 0 8px;
}
.hero-card-title .num { color: var(--gold); }
.hero-card-lede {
  font-size: var(--fs-body);
  color: rgba(255, 255, 255, 0.78);
  margin: 0;
  max-width: 50ch;
}
.hero-card .cta-primary {
  width: auto;
  min-width: 0;
  padding: 13px 24px;
  background: var(--gold);
  color: var(--navy);
  border-color: var(--gold);
}
.hero-card .cta-primary:hover {
  background: var(--gold-soft);
  border-color: var(--gold-soft);
}

/* ───── team preview (Admin) ──────────────────────────────────────── */

.team-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 880px) { .team-grid { grid-template-columns: 1fr; } }

.team-card {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--r-1);
}
.team-meta { min-width: 0; }                 /* lets long names truncate without pushing the status pill off-card */

/* Status pill at the right edge of each team card — mute grey, single
   accent rule kept (no green/yellow noise); the visual signal is the
   word + the slightly different ink for Invited (uppercase + dimmer). */
.team-status {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--charcoal);
  background: var(--bg-soft, #eef2f8);
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  white-space: nowrap;
}
.team-status.is-invited {
  color: var(--muted);
  background: transparent;
}
.team-avatar {
  width: 44px; height: 44px;
  border-radius: var(--r-pill);
  background: linear-gradient(135deg, var(--navy), var(--navy-soft));
  color: var(--paper);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.team-avatar.is-warm { background: linear-gradient(135deg, #b8842a, var(--gold)); color: var(--navy); }
.team-avatar.is-cool { background: linear-gradient(135deg, #4f6c97, #7a8fb0); }
.team-name {
  font-family: var(--sans);
  font-size: var(--fs-body-sm);
  font-weight: 600;
  color: var(--navy);
}
.team-role {
  font-size: var(--fs-meta);
  color: var(--muted);
  margin-top: 2px;
}

/* ───── two-column dashboard layout (left main, right rail) ───────── */

.dashboard-content-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: clamp(20px, 2.4vw, 28px);
  align-items: start;
}
.dashboard-primary-column,
.dashboard-secondary-column {
  display: grid;
  align-content: start;
  gap: clamp(20px, 2.4vw, 28px);
  min-width: 0;
}
@media (max-width: 1080px) { .dashboard-content-grid { grid-template-columns: 1fr; } }

/* ───── empty state ───────────────────────────────────────────────── */

.empty-state {
  display: grid;
  gap: 8px;
  padding: 32px 24px;
  text-align: center;
  color: var(--muted);
  background: var(--bg-soft);
  border: 1px dashed var(--hairline);
  border-radius: var(--r-1);
}
.empty-state strong {
  display: block;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 18px;
  color: var(--navy);
}

/* ───── inline utility (rare — only for one-off colour shifts) ───── */

.muted { color: var(--muted); }

/* ───── role-scoped visibility ────────────────────────────────────── */

/* Each role-aware element declares one or more roles. The body's
   data-role attribute drives visibility — JS doesn't have to touch
   `display` per element, the CSS just queries the body.
   The descendant combinator below scopes to children of body so we
   don't accidentally hide <body> itself (which carries data-role to
   drive the cascade). */
body [data-role] { display: none; }

body[data-role="Admin"]         [data-role*="Admin"],
body[data-role="Partner"]       [data-role*="Partner"],
body[data-role="SeniorManager"] [data-role*="SeniorManager"],
body[data-role="Accountant"]    [data-role*="Accountant"],
body[data-role="Viewer"]        [data-role*="Viewer"] {
  /* Restore each element's intended display. Most are grid surfaces
     (.surface, .dashboard-content-grid, .hero-card, plain <section> wrappers around a
     single grid child), so default to grid. */
  display: grid;
}

/* Org-type toggling for sidebar: the Clients link only shows for
   AccountingFirm + Freelancer; Statements link only for Cfo + Sme. */
body[data-org="Cfo"]            [data-org*="Firm"],
body[data-org="Sme"]            [data-org*="Firm"],
body[data-org="AccountingFirm"] [data-org*="OwnBooks"],
body[data-org="Freelancer"]     [data-org*="OwnBooks"] {
  display: none;
}

/* The Team link is admin-only. */
body:not([data-role="Admin"]) [data-admin-only] { display: none; }

/* ───── reveal animation override (sidebar shouldn't fade-in) ────── */

.app-shell.reveal { transform: none; }   /* no slide for the whole app shell */
.app-shell.reveal { transition-property: opacity; }

/* ───── dev controls (prototype-only) ─────────────────────────────── */

.dev-controls {
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 99;
  background: rgba(26, 58, 107, 0.96);
  color: white;
  padding: 14px 16px;
  border-radius: var(--r-1);
  font-size: var(--fs-meta);
  display: grid;
  gap: 10px;
  min-width: 240px;
  box-shadow: var(--shadow-2, 0 12px 32px rgba(0,0,0,0.18));
}
.dev-controls h4 {
  margin: 0 0 4px;
  font-size: var(--fs-meta);
  letter-spacing: var(--ls-upper);
  text-transform: uppercase;
  font-weight: 600;
  opacity: 0.7;
}
.dev-controls label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.dev-controls select {
  background: rgba(255, 255, 255, 0.12);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  padding: 4px 6px;
  font-size: var(--fs-meta);
  min-width: 130px;
}
