/* ============================================================
   Booksy Grant Manager — design system
   Warm editorial palette: charcoal rail, cream canvas, a single
   warm-gold accent, and a serif display face for headings paired
   with a neutral grotesk for UI/body text.
   Motion patterns are modelled on 21st.dev component motion
   (spring drawers, staggered lists, sliding indicators).
   ============================================================ */

:root {
  font-family: "IBM Plex Sans", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: "IBM Plex Sans", "Inter", ui-sans-serif, system-ui, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;

  --rail: #0f172a;
  --rail-deep: #0b1120;
  --rail-line: rgba(255, 255, 255, .08);
  --rail-text: #94a3b8;
  --rail-text-strong: #ffffff;

  --brand: #0f766e;
  --brand-hover: #115e59;
  --brand-soft: #e6f4f1;
  --brand-ring: rgba(15, 118, 110, .22);

  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #556274;
  --muted-soft: #66758a;

  --canvas: #f4f6f8;
  --card: #ffffff;
  --line: #e2e8f0;
  --line-soft: #eef2f6;
  --hover: #f1f5f9;

  --success: #15803d;
  --success-bg: #e8f5ec;
  --warning: #b45309;
  --warning-bg: #fef3e2;
  --danger: #b42318;
  --danger-bg: #fdecea;
  --info: #1d4f91;
  --info-bg: #e8eff9;
  --violet: #6d4fc2;
  --violet-bg: #f0ecfa;
  --amber: #b45309;
  --amber-bg: #fef3e2;
  --teal: #0f766e;
  --teal-bg: #e6f4f1;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-md: 0 10px 28px rgba(15, 23, 42, .12);
  --shadow-lg: 0 24px 64px rgba(15, 23, 42, .22);
  --ease-spring: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }
/* Reserve the vertical scrollbar's gutter permanently so switching between a
   short page (e.g. a short table) and a tall one never shifts page width. */
html { overflow-y: scroll; scrollbar-gutter: stable; }
/* Most pages are taller than the viewport by design (stat cards + a full
   table), so the page scrollbar is legitimately in use most of the time.
   Windows/Chromium's default overlay scrollbar fades out a couple of
   seconds after it last painted, which reads as "flashes and disappears"
   even though the page is still scrollable. Render a persistent, always-
   visible scrollbar instead so it doesn't auto-hide. */
html { scrollbar-width: auto; scrollbar-color: var(--muted-soft) transparent; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background-color: var(--muted-soft); border-radius: 999px; border: 3px solid var(--canvas); background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--muted); }
html, body, #root { min-height: 100%; margin: 0; }
body { min-width: 320px; background: var(--canvas); color: var(--ink); }
/* Applied to <html> whenever any dialog/overlay is open (see overlays.js
   renderOverlay) — the backdrop only hides the page behind it, it doesn't
   stop it from scrolling, so without this, scrolling while a dialog is open
   silently moves the page underneath. */
html.scroll-locked, html.scroll-locked body { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.02em; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

/* ---------- Auth ---------- */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: minmax(400px, 46%) 1fr; background: #fff; }
.auth-aside { position: relative; overflow: hidden; background: linear-gradient(165deg, var(--rail) 0%, var(--rail-deep) 100%); color: #fff; padding: 36px 48px; display: flex; flex-direction: column; }
.auth-aside::before { content: ""; position: absolute; width: 520px; height: 520px; right: -180px; top: -160px; border-radius: 50%; background: radial-gradient(circle, rgba(15, 118, 110, .34), transparent 68%); animation: floatGlow 14s ease-in-out infinite; }
.auth-aside::after { content: ""; position: absolute; width: 420px; height: 420px; left: -160px; bottom: -140px; border-radius: 50%; background: radial-gradient(circle, rgba(210, 180, 140, .22), transparent 70%); animation: floatGlow 18s ease-in-out infinite reverse; }
.auth-aside > * { position: relative; z-index: 1; }
.auth-message { margin: auto 0; max-width: 560px; }
.auth-message h1 { font-family: var(--font-serif); font-size: clamp(28px, 3.2vw, 40px); font-weight: 700; line-height: 1.18; margin: 18px 0 18px; letter-spacing: -.01em; }
.auth-message p { color: #cbd5e1; font-size: 14px; line-height: 1.7; max-width: 500px; }
.auth-proof { display: grid; gap: 14px; margin-top: 34px; }
.auth-proof div { display: flex; align-items: center; gap: 11px; color: #e2e8f0; font-size: 12px; }
.auth-proof svg { color: #5eb9ad; flex: none; }
.auth-footnote { color: #94a3b8; font-size: 10px; }
.auth-panel { display: grid; place-items: center; padding: 44px; background: #f8fafc; }
.auth-card { width: min(100%, 460px); }
.auth-card-header h2 { font-family: var(--font-serif); font-size: 26px; font-weight: 700; letter-spacing: -.005em; margin: 10px 0 8px; }
.auth-card-header p { color: var(--muted); margin-bottom: 26px; font-size: 12px; line-height: 1.6; }
.auth-switch { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); text-align: center; color: var(--muted); font-size: 12px; }
.auth-switch button { border: 0; background: none; color: var(--brand); font-weight: 600; padding: 0 2px; }
.auth-switch button:hover { text-decoration: underline; }
.auth-inline { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: -4px; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; color: var(--ink-soft); font-weight: 500; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--brand); }
.link-button { border: 0; background: none; color: var(--brand); font-size: 11px; font-weight: 600; padding: 0; }
.link-button:hover { text-decoration: underline; }
.mobile-brand { display: none; margin-bottom: 28px; }

/* ---------- Brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); transition: gap .24s var(--ease-spring); }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(140deg, #d9efec, #a7d8d1); color: var(--ink); display: grid; place-items: center; box-shadow: 0 6px 16px rgba(15, 23, 42, .18); flex: none; }
.brand-text { display: inline-block; opacity: 1; max-width: 150px; overflow: hidden; white-space: nowrap; transition: opacity .2s ease-out, max-width .24s var(--ease-spring); }
.brand-text strong { display: block; font-family: var(--font-serif); font-size: 18px; font-weight: 700; letter-spacing: -.01em; line-height: 1.1; }
.brand-text span { display: block; font-size: 9px; margin-top: 2px; color: var(--muted); letter-spacing: .01em; }
.brand-light { color: #fff; }
.brand-light .brand-text span { color: #94a3b8; }

/* ---------- Shell ---------- */
/* .sidebar is position:fixed, so it never actually occupies grid/flex space -
   .app-shell just needs to be a plain block and .app-main reserves the gap
   with margin-left. margin-left animates reliably in every browser; CSS Grid
   track-size transitions (the previous approach) do not - that's what showed
   up as the sidebar "jumping" instead of easing. */
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 220px; z-index: 60; background: linear-gradient(180deg, var(--rail) 0%, var(--rail-deep) 100%); display: flex; flex-direction: column; }
.sidebar-brand { padding: 22px 20px; }
/* client workspace: the rail identifies the open client */
.sidebar-client { padding: 18px 20px 16px; border-bottom: 1px solid var(--rail-line); animation: clientIn .3s var(--ease-spring) both; opacity: 1; max-height: 200px; transition: opacity .2s ease-out, max-height .24s var(--ease-spring); }
.client-back { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: #94a3b8; font-size: 10.5px; font-weight: 500; padding: 0 0 10px; transition: color .16s; }
.client-back:hover { color: #fff; }
.client-back svg { transition: transform .18s var(--ease-spring); }
.client-back:hover svg { transform: translateX(-3px); }
.sidebar-client strong { display: block; color: #fff; font-size: 14px; font-weight: 650; letter-spacing: -.02em; line-height: 1.25; }
.sidebar-client > span { display: block; color: #94a3b8; font-size: 10px; margin-top: 4px; }
@keyframes clientIn { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
.sidebar-nav { padding: 6px 12px 18px; display: grid; gap: 3px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.16) transparent; }
.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.16); border-radius: 4px; }
.nav-item { position: relative; width: 100%; border: 0; background: transparent; color: var(--rail-text); display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--r-sm); text-align: left; font-size: 11.5px; font-weight: 500; transition: color .18s ease, background .18s ease; }
.nav-item > * { position: relative; z-index: 1; }
.nav-item svg { flex: none; }
.nav-item:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.nav-item.active { color: #fff; font-weight: 600; }
.nav-item.active:hover { background: transparent; }
.nav-pill { position: absolute; inset: 0; border-radius: var(--r-sm); background: rgba(255, 255, 255, .1); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); z-index: 0; animation: pillIn .26s var(--ease-spring) both; }
.nav-label { display: inline-block; opacity: 1; max-width: 170px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; transition: opacity .16s ease, max-width .22s var(--ease-spring); }
.nav-caret { margin-left: auto; flex: none; opacity: 1; max-width: 20px; overflow: hidden; transition: transform .22s var(--ease-spring), opacity .16s ease, max-width .22s var(--ease-spring); }
.nav-caret.open { transform: rotate(90deg); }
.nav-sub { display: grid; gap: 1px; padding: 3px 0 5px 34px; animation: subIn .22s var(--ease-spring) both; }
.nav-sub button { border: 0; background: none; color: #94a3b8; text-align: left; font-size: 11px; padding: 8px 11px; border-radius: 7px; transition: color .16s, background .16s; }
.nav-sub button:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-sub button.active { color: #fff; background: rgba(255, 255, 255, .12); font-weight: 600; }
.sidebar-foot { margin-top: auto; padding: 14px; opacity: 1; max-height: 260px; transition: opacity .2s ease-out, max-height .24s var(--ease-spring); }
.plan-card { border: 1px solid var(--rail-line); border-radius: var(--r-md); padding: 14px; background: rgba(255, 255, 255, .04); }
.plan-org { display: flex; align-items: center; gap: 10px; }
.plan-org-mark { width: 32px; height: 32px; border-radius: 8px; background: rgba(255,255,255,.1); color: #e2e8f0; display: grid; place-items: center; flex: none; }
.plan-org strong { display: block; color: #fff; font-size: 11px; font-weight: 600; line-height: 1.3; }
.plan-org span { display: block; color: #94a3b8; font-size: 9px; margin-top: 2px; }
.plan-divider { height: 1px; background: var(--rail-line); margin: 13px 0; }
.plan-row { margin-bottom: 11px; }
.plan-row span { display: block; color: #94a3b8; font-size: 9px; }
.plan-row strong { display: block; color: #fff; font-size: 11px; font-weight: 600; margin-top: 2px; }
.plan-button { width: 100%; border: 1px solid var(--rail-line); background: rgba(255, 255, 255, .05); color: #fff; border-radius: var(--r-sm); min-height: 38px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; font-size: 11px; font-weight: 500; transition: background .18s, border-color .18s; }
.plan-button:hover { background: rgba(255, 255, 255, .12); border-color: rgba(255,255,255,.2); }
.plan-button svg { transition: transform .2s var(--ease-spring); }
.plan-button:hover svg { transform: translateX(3px); }
.sidebar-reset { width: 100%; border: 0; background: none; color: #94a3b8; font-size: 10px; padding: 10px 4px 2px; text-align: left; }
.sidebar-reset:hover { color: #fff; }

/* Collapsed (icon-rail) sidebar: the desktop click target for .topbar-menu.
   .sidebar is fixed-position, so both it and the grid column it reserves in
   .app-shell have to shrink together for the content area to actually gain
   the freed width. Scoped to >900px only - below that the sidebar is already
   an off-canvas drawer (see the max-width:900px block) and must not fight it.
   Enter (expand) and exit (collapse) use different timing/easing on purpose:
   ease-out + the full duration going out, ease-in + ~65% of that duration
   coming back - an asymmetric pair reads as more responsive than mirroring
   the same curve both ways. CSS picks up whichever `transition` is declared
   on the state being transitioned *into*, so the collapsed-state rules carry
   their own faster/ease-in values instead of inheriting the base one. */
.sidebar, .app-main { transition: width .24s var(--ease-spring), margin-left .24s var(--ease-spring); }
.nav-label, .nav-caret { transition: opacity .2s ease-out, max-width .24s var(--ease-spring); }
@media (min-width: 901px) {
  .app-shell.sidebar-collapsed .sidebar, .app-shell.sidebar-collapsed .app-main { transition: width .16s cubic-bezier(.4, 0, 1, 1), margin-left .16s cubic-bezier(.4, 0, 1, 1); }
  .app-shell.sidebar-collapsed .sidebar { width: 76px; }
  .app-shell.sidebar-collapsed .app-main { margin-left: 76px; }
  /* The brand-mark icon's position never changes (no justify-content swap) so
     it can't visually jump ahead of the still-animating text next to it -
     only its own box (brand-text) shrinks, in step with everything else. */
  .app-shell.sidebar-collapsed .brand { gap: 0; transition: gap .16s cubic-bezier(.4, 0, 1, 1); }
  .app-shell.sidebar-collapsed .brand-text { opacity: 0; max-width: 0; transition: opacity .13s ease-in, max-width .16s cubic-bezier(.4, 0, 1, 1); }
  .app-shell.sidebar-collapsed .sidebar-client, .app-shell.sidebar-collapsed .sidebar-foot { opacity: 0; max-height: 0; overflow: hidden; pointer-events: none; }
  .app-shell.sidebar-collapsed .sidebar-nav { padding-left: 0; padding-right: 0; }
  .app-shell.sidebar-collapsed .nav-item { justify-content: center; padding: 12px; gap: 0; }
  .app-shell.sidebar-collapsed .nav-label, .app-shell.sidebar-collapsed .nav-caret { opacity: 0; max-width: 0; transition: opacity .13s ease-in, max-width .16s cubic-bezier(.4, 0, 1, 1); }
  /* The caret's margin-left:auto still absorbs the row's free space even at
     max-width:0, which would drag the Data Management icon off-centre (flush
     left) while every other rail icon stays centred. Drop it with the caret. */
  .app-shell.sidebar-collapsed .nav-caret { margin-left: 0; }
  .app-shell.sidebar-collapsed .nav-sub { display: none; }
}

.app-main { margin-left: 220px; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 68px; position: sticky; top: 0; z-index: 40; background: rgba(255, 255, 255, .92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 16px; padding: 0 24px; }
.topbar-menu { border: 0; background: none; color: var(--ink-soft); width: 38px; height: 38px; border-radius: var(--r-sm); display: grid; place-items: center; transition: background .16s; }
.topbar-menu:hover { background: var(--hover); }
.command-trigger { margin: 0 auto; width: min(430px, 40vw); height: 40px; border: 1px solid var(--line); background: var(--hover); border-radius: 999px; padding: 0 8px 0 16px; display: flex; align-items: center; gap: 10px; color: var(--muted-soft); font-size: 12px; transition: border-color .18s, box-shadow .18s; }
.command-trigger:hover { border-color: #cbd5e1; box-shadow: var(--shadow-xs); }
.command-trigger span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
kbd { margin-left: auto; border: 1px solid var(--line); background: var(--hover); border-radius: 6px; padding: 3px 7px; font-size: 9px; font-family: inherit; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 6px; position: relative; }
.icon-button { border: 1px solid transparent; background: transparent; color: var(--ink-soft); width: 38px; height: 38px; border-radius: var(--r-sm); display: inline-grid; place-items: center; transition: background .16s, color .16s, border-color .16s; }
.icon-button:hover { background: var(--hover); color: var(--ink); border-color: var(--line); }
.icon-button.small { width: 32px; height: 32px; }
.icon-button.tiny { width: 22px; height: 22px; border-radius: 6px; }
.section-heading h3 .icon-button.tiny { margin-left: 5px; vertical-align: -6px; color: var(--muted-soft); }
.section-heading h3 .icon-button.tiny:hover { color: var(--ink); background: var(--hover); }
.icon-button.ghost:hover { border-color: transparent; }
.icon-button.danger-hover:hover { color: var(--danger); background: var(--danger-bg); border-color: #f3c2bd; }
.status-switch { position: relative; flex: none; width: 38px; height: 22px; padding: 0; border: 0; border-radius: 999px; background: var(--danger, #ef4444); cursor: pointer; transition: background .18s ease; }
.status-switch:hover { filter: brightness(.92); }
.status-switch:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.status-switch.on { background: var(--success, #22c55e); }
.status-switch-knob { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .18s var(--ease-spring); }
.status-switch.on .status-switch-knob { transform: translateX(16px); }
.bell { position: relative; }
.bell-count { position: absolute; top: 2px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 8px; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; }
.profile-button { border: 0; background: none; display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 4px; border-radius: 999px; transition: background .16s; }
.profile-button:hover { background: var(--hover); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(140deg, var(--ink-soft), var(--ink)); color: #fff; display: grid; place-items: center; font-size: 10px; font-weight: 700; letter-spacing: .02em; flex: none; }
.profile-copy { display: grid; text-align: left; line-height: 1.25; }
.profile-copy strong { font-size: 11.5px; font-weight: 600; }
.profile-copy small { color: var(--muted); font-size: 9.5px; }
.profile-menu { position: absolute; right: 0; top: calc(100% + 10px); width: 250px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-md); padding: 7px; z-index: 50; }
.menu-heading { display: block; padding: 8px 10px 6px; font-size: 8.5px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; color: var(--muted-soft); }
.profile-menu button { width: 100%; border: 0; background: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 10px; border-radius: 7px; text-align: left; font-size: 11.5px; transition: background .14s; }
.profile-menu button:hover { background: var(--hover); }
.profile-menu button svg { color: var(--brand); }
.menu-separator { height: 1px; background: var(--line); margin: 6px 2px; }
.page-container { padding: 22px 28px 36px; max-width: 1560px; width: 100%; margin: 0 auto; flex: 1; }
.mobile-scrim { display: none; }

/* ---------- Page furniture ---------- */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.page-header h1 { font-family: var(--font-serif); font-size: 30px; font-weight: 700; letter-spacing: -.01em; }
.page-header p { color: var(--muted); font-size: 12px; margin-top: 6px; }
.page-header-actions { display: flex; gap: 10px; flex: none; }
.breadcrumb { display: flex; align-items: center; gap: 7px; margin-bottom: 14px; color: var(--muted); font-size: 11px; }
.breadcrumb button { border: 0; background: none; color: var(--muted); padding: 0; font-size: 11px; }
.breadcrumb button:hover { color: var(--brand); }
.breadcrumb svg { color: var(--muted-soft); }
.breadcrumb strong { color: var(--ink-soft); font-weight: 600; }

.button { border: 1px solid transparent; border-radius: var(--r-sm); min-height: 36px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-size: 11.5px; font-weight: 600; white-space: nowrap; transition: background .18s, border-color .18s, color .18s, box-shadow .18s, transform .12s; }
.button:active { transform: translateY(1px); }
.button.primary { background: var(--ink); color: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .3); }
.button.primary:hover { background: var(--ink-soft); box-shadow: 0 6px 18px rgba(15, 23, 42, .28); }
.button.secondary { background: #fff; color: var(--ink-soft); border-color: var(--line); box-shadow: var(--shadow-xs); }
.button.secondary:hover { background: var(--hover); border-color: #cbd5e1; }
.button.subtle { background: var(--hover); color: var(--ink-soft); }
.button.subtle:hover { background: #e6ebf1; }
.button.danger { background: #fff; color: var(--danger); border-color: #f3c2bd; }
.button.danger:hover { background: var(--danger-bg); }
.button.wide { width: 100%; }
.button.sm { min-height: 34px; padding: 0 12px; font-size: 11px; }
.button.xs { min-height: 30px; padding: 0 10px; font-size: 10px; border-radius: 7px; }
.button.lg { min-height: 48px; padding: 0 22px; font-size: 13px; border-radius: var(--r-md); gap: 9px; }
.button.violet { background: var(--violet); color: #fff; box-shadow: 0 1px 2px rgba(111, 90, 168, .3); }
.button.violet:hover { background: #5c4a8c; box-shadow: 0 6px 18px rgba(111, 90, 168, .35); }
.text-button { border: 0; background: none; color: var(--brand); font-size: 11.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; padding: 0; }
.text-button svg { transition: transform .18s var(--ease-spring); }
.text-button:hover svg { transform: translateX(3px); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); }
.card-pad { padding: 18px; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-heading h3 { font-size: 14px; font-weight: 650; }
.section-heading p { color: var(--muted); font-size: 11px; margin-top: 4px; }
.subtle { color: var(--muted); font-size: 11px; }

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 22px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); padding: 16px; display: flex; align-items: center; gap: 13px; transition: transform .22s var(--ease-spring), box-shadow .22s ease, border-color .22s ease; }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: #dde3ea; }
/* One consistent warm badge for every KPI tile — the metric's own numbers
   and label carry the meaning, so the icon doesn't need to recolor per tone. */
.stat-icon { width: 44px; height: 44px; border-radius: 999px; display: grid; place-items: center; flex: none; background: var(--brand-soft); color: var(--ink-soft); }
.stat-icon.blue, .stat-icon.green, .stat-icon.amber, .stat-icon.violet, .stat-icon.teal { background: var(--brand-soft); color: var(--ink-soft); }
.stat-body { min-width: 0; }
.stat-body > span { display: block; color: var(--muted); font-size: 10.5px; font-weight: 500; }
.stat-body > strong { display: block; font-size: 20px; font-weight: 700; letter-spacing: -.02em; margin: 3px 0 2px; font-variant-numeric: tabular-nums; }
.stat-body > small { display: block; color: var(--muted-soft); font-size: 9.5px; }

/* ---------- Toolbar + table ---------- */
.table-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); overflow: hidden; }
.table-toolbar { padding: 18px 20px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.search-field { width: min(380px, 100%); height: 42px; display: flex; align-items: center; gap: 10px; padding: 0 14px; border: 1px solid var(--line); background: #fff; border-radius: var(--r-sm); color: var(--muted-soft); transition: border-color .18s, box-shadow .18s; }
.search-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search-row .search-field { flex: 1; }
.search-row .button { flex: none; }
.search-field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.search-field input { width: 100%; border: 0; outline: 0; background: transparent; font-size: 12px; }
.search-field input::placeholder { color: var(--muted-soft); }
.toolbar-right { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.select-field { display: grid; gap: 6px; min-width: 168px; }
.select-field > span { font-size: 10.5px; color: var(--muted); font-weight: 500; }
select, .field input, .field textarea, .inline-add input { width: 100%; min-height: 42px; border: 1px solid var(--line); background: #fff; border-radius: var(--r-sm); padding: 0 12px; outline: none; font-size: 12px; transition: border-color .18s, box-shadow .18s; }
select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
select:focus, .field input:focus, .field textarea:focus, .inline-add input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.gl-clean-col-select { min-height: 54px; font-size: 15px; font-weight: 600; border-width: 2px; border-color: var(--violet); box-shadow: 0 0 0 3px var(--violet-bg); }
.gl-clean-col-select:focus { border-color: var(--violet); box-shadow: 0 0 0 4px var(--violet-bg); }

/* ---------- Combobox: searchable, scrollable dropdown ---------- */
/* Drop-in for a native select/datalist on any field backed by a list that
   can grow (master data, donors, templates, headings). The hidden input
   underneath carries the real id/name/value — this is purely the visible
   control. */
.combobox { position: relative; width: 100%; }
.combobox-control { position: relative; display: flex; align-items: center; }
.combobox-search-icon { position: absolute; left: 12px; color: var(--muted-soft); display: grid; pointer-events: none; }
.combobox-input { width: 100%; min-height: 42px; border: 1px solid var(--line); background: #fff; border-radius: var(--r-sm); padding: 0 34px 0 34px; outline: none; font-size: 12px; transition: border-color .18s, box-shadow .18s; }
.combobox-input::placeholder { color: var(--muted-soft); }
.combobox:focus-within .combobox-input, .combobox.open .combobox-input { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.combobox-toggle { position: absolute; right: 4px; width: 30px; height: 30px; border: 0; background: none; color: var(--muted); display: grid; place-items: center; border-radius: 7px; transition: transform .18s var(--ease-spring), background .16s, color .16s; }
.combobox-toggle:hover { background: var(--hover); color: var(--ink-soft); }
.combobox.open .combobox-toggle { transform: rotate(180deg); color: var(--brand); }
.combobox-panel { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-md); overflow: hidden; }
.combobox-list { list-style: none; margin: 0; padding: 6px; max-height: 248px; overflow-y: auto; overscroll-behavior: contain; display: grid; gap: 1px; }
.combobox-option { display: block; width: 100%; border: 0; background: none; text-align: left; padding: 8px 10px; border-radius: 7px; font-size: 12px; color: var(--ink-soft); white-space: normal; word-break: break-word; transition: background .12s, color .12s; }
.combobox-option:hover, .combobox-option.highlighted { background: var(--hover); color: var(--ink); }
.combobox-option.active { color: var(--brand); font-weight: 600; background: var(--brand-soft); }
.combobox-empty { padding: 14px 12px; text-align: center; color: var(--muted); font-size: 11px; line-height: 1.5; }
.col-type-legend { display: flex; flex-wrap: wrap; gap: 8px; }
.col-type-chip { display: inline-flex; align-items: center; gap: 7px; background: var(--hover); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 6px 10px; font-size: 10.5px; color: var(--ink-soft); }
.col-type-chip b { color: var(--muted); font-weight: 700; font-size: 10px; }
.field textarea { min-height: 92px; padding: 10px 12px; resize: vertical; line-height: 1.55; }

.table-wrap { overflow-x: auto; overscroll-behavior: contain; }
/* tables fit their card: secondary fields move into the expandable detail row */
table { min-width: 0; table-layout: auto; }
.expand-col, .expand-cell { width: 46px; padding-left: 14px; padding-right: 0; }
.expand-toggle { width: 28px; height: 28px; border: 1px solid var(--line); background: #fff; border-radius: 7px; display: grid; place-items: center; color: var(--muted); transition: transform .22s var(--ease-spring), background .16s, color .16s, border-color .16s; }
.expand-toggle:hover { background: var(--hover); color: var(--ink); border-color: #cbd5e1; }
.expand-toggle.open { transform: rotate(180deg); background: var(--brand-soft); color: var(--brand); border-color: #a7d8d1; }
tr.detail-row > td.detail-cell { padding: 0 20px; background: var(--hover); }
tr.detail-row.open > td.detail-cell { border-bottom: 1px solid var(--line-soft); }
/* Height can't be transitioned to/from "auto" directly, so the row's actual
   height comes from a grid track instead: 0fr collapses it to nothing, 1fr
   opens it to the content's natural height, and the track size itself is
   what's animated. overflow:hidden on the inner wrapper clips the content
   while the track is mid-collapse. */
.detail-collapse { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s var(--ease-spring); }
tr.detail-row.open .detail-collapse { grid-template-rows: 1fr; }
.detail-collapse-inner { overflow: hidden; min-height: 0; }
.detail-panel { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px 22px; margin: 12px 0 16px; padding: 16px 18px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); text-align: center; }
.detail-panel > div { min-width: 0; }
.detail-panel span { display: block; color: var(--muted); font-size: 10px; }
.detail-panel strong { display: block; font-size: 11.5px; font-weight: 600; margin-top: 3px; white-space: normal; word-break: break-word; }
/* an open row menu has to escape the card and the horizontal scroller */
.table-card.menu-open, .table-wrap.menu-open { overflow: visible; }
/* Fixed-width columns, same reasoning as .record-table below: a table
   settles at roughly 6 visible columns in a normal-width viewport instead of
   every column shrinking to cram everything in, the rest reachable via
   .table-wrap's horizontal scroll. */
/* width: 100% — a table with fewer columns than would fill the container
   still reaches the card's full width instead of stopping short partway
   across, empty on the right. max-width on the cells is what keeps this from
   reintroducing the old blow-out bug: table-layout:fixed distributes any
   leftover width across columns proportionally to their declared width, and
   without a ceiling that used to balloon a 2-3 column table's cells far past
   a comfortable reading width. With the cap, columns still grow to fill the
   row, just not past it. */
table { table-layout: fixed; width: 100%; border-collapse: collapse; }
/* Full grid lines on every cell, spreadsheet-style, same as .record-table. */
th, td { width: 190px; max-width: 260px; border: 1px solid var(--line); }
th { text-align: center; padding: 10px 16px; background: var(--hover); font-size: 8.5px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
th.sortable { cursor: pointer; user-select: none; transition: color .16s; }
th.sortable:hover { color: var(--ink-soft); }
th .th-inner { display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 100%; }
.sort-mark { display: inline-flex; flex-direction: column; gap: 1px; color: var(--muted-soft); transition: color .16s; }
.sort-mark i { width: 0; height: 0; border-left: 3.5px solid transparent; border-right: 3.5px solid transparent; }
.sort-mark i:first-child { border-bottom: 4px solid currentColor; }
.sort-mark i:last-child { border-top: 4px solid currentColor; }
.sort-mark.asc i:first-child, .sort-mark.desc i:last-child { color: var(--brand); }
.sort-mark.asc i:last-child, .sort-mark.desc i:first-child { opacity: .3; }
/* Long text truncates with an ellipsis rather than wrapping/widening the
   column — the value is still there (native title tooltip, or widen the
   window); this keeps a column's width predictable. */
td { padding: 12px 16px; text-align: center; font-size: 11px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
tbody tr { transition: background .16s ease; }
tbody tr:hover { background: var(--hover); }
.row-link { border: 0; background: none; padding: 0; font-size: 12px; font-weight: 600; color: var(--ink); text-align: center; transition: color .16s; }
.row-link:hover { color: var(--brand); }
/* Every table's cells are center-aligned (see the base td rule above) — this
   overrides these two classes' usual right-align so numeric/amount columns
   fall in line with the rest instead of being the one exception. */
.num-cell { font-variant-numeric: tabular-nums; text-align: center; }
.amount-cell { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); text-align: center; }
.muted-cell { color: var(--muted); }
.row-actions { display: flex; align-items: center; gap: 4px; }
.table-footer { padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; flex-wrap: wrap; }
.pagination { display: flex; align-items: center; gap: 6px; }
.pagination button { min-width: 34px; height: 34px; padding: 0 8px; border: 1px solid var(--line); background: #fff; border-radius: var(--r-sm); display: grid; place-items: center; color: var(--ink-soft); font-size: 11px; font-weight: 500; transition: background .16s, border-color .16s, color .16s; }
.pagination button:hover:not(:disabled):not(.active) { background: var(--hover); border-color: #cbd5e1; }
.pagination button.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* row action menu — anchored under the kebab, above every later row */
/* white-space:normal is required — the cell sets nowrap, which would keep the items inline */
.row-menu { position: absolute; top: calc(100% - 14px); right: 16px; z-index: 45; width: 196px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-md); padding: 6px; transform-origin: top right; white-space: normal; display: grid; gap: 1px; }
.row-menu button { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; border: 0; background: none; text-align: left; padding: 9px 10px; border-radius: 7px; font-size: 11.5px; color: var(--ink-soft); white-space: nowrap; transition: background .14s, color .14s; }
.row-menu button svg { color: var(--brand); flex: none; }
.row-menu button:hover { background: var(--hover); color: var(--ink); }
.row-menu button.danger { color: var(--danger); }
.row-menu button.danger:hover { background: var(--danger-bg); }
tr:nth-last-child(-n+3) .row-menu { top: auto; bottom: calc(100% - 14px); transform-origin: bottom right; }

/* client team management */
.assign-bar { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; padding: 16px 20px; background: var(--hover); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.assign-copy { display: flex; align-items: center; gap: 12px; color: var(--ink-soft); }
.assign-copy svg { color: var(--brand); flex: none; }
.assign-copy strong { display: block; font-size: 11.5px; font-weight: 600; }
.assign-copy small { display: block; color: var(--muted); font-size: 10.5px; margin-top: 2px; }
.assign-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.assign-controls select { min-width: 260px; background-color: #fff; }
.user-cell strong { display: block; font-size: 11.5px; font-weight: 600; color: var(--ink); }
.user-cell small { display: block; color: var(--muted); font-size: 10px; margin-top: 2px; }

/* employee / client access picker */
.picker-list { display: grid; gap: 8px; max-height: 320px; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px; }
.picker-item { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: var(--r-sm); cursor: pointer; transition: background .14s; }
.picker-item:hover { background: var(--hover); }
.picker-item input { width: 17px; height: 17px; accent-color: var(--brand); flex: none; }
.picker-item:has(input:checked) { background: var(--brand-soft); }
.picker-body { flex: 1; min-width: 0; }
.picker-body strong { display: block; font-size: 11.5px; font-weight: 600; }
.picker-body small { display: block; color: var(--muted); font-size: 10px; margin-top: 1px; }
.avatar.sm { width: 30px; height: 30px; font-size: 9px; }

/* grant team — always full names, never initials */
.name-list { display: flex; flex-wrap: wrap; gap: 5px; }
.name-list > span { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 999px; background: var(--hover); border: 1px solid var(--line); color: var(--ink-soft); font-size: 10.5px; font-weight: 500; white-space: nowrap; }
.wrap-cell { white-space: normal; min-width: 190px; }
.grant-count { display: inline-flex; align-items: center; height: 25px; padding: 0 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: 10px; font-weight: 600; font-variant-numeric: tabular-nums; }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 25px; padding: 0 10px; border-radius: 999px; font-size: 10px; font-weight: 600; }
.pill.success { background: var(--success-bg); color: var(--success); }
.pill.warning { background: var(--warning-bg); color: var(--warning); }
.pill.danger { background: var(--danger-bg); color: var(--danger); }
.pill.info { background: var(--info-bg); color: var(--info); }
.pill.violet { background: var(--violet-bg); color: var(--violet); }
.pill.neutral { background: #eef2f6; color: #475569; }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-button { border: 0; cursor: pointer; transition: filter .16s; }
.pill-button:hover { filter: brightness(0.95); }
.status-pill { width: 74px; justify-content: center; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 26px; border-bottom: 1px solid var(--line); margin-bottom: 22px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { position: relative; border: 0; background: none; color: var(--muted); padding: 0 2px 13px; font-size: 12px; font-weight: 600; white-space: nowrap; transition: color .18s; }
.tabs button:hover { color: var(--ink-soft); }
.tabs button.active { color: var(--brand); }
.tab-indicator { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--brand); animation: indicatorIn .28s var(--ease-spring) both; }
.tab-count { margin-left: 6px; background: #eef2f6; color: var(--muted); border-radius: 999px; padding: 1px 7px; font-size: 9.5px; font-weight: 650; }
.tabs button.active .tab-count { background: var(--brand-soft); color: var(--brand); }

/* ---------- Dashboard / overview ---------- */
.split-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); gap: 18px; }
.span-all { grid-column: 1 / -1; }
.progress-list { display: grid; gap: 16px; }
.progress-row > div { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; margin-bottom: 8px; }
.progress-row strong { font-weight: 600; }
.progress-row span { color: var(--muted); font-variant-numeric: tabular-nums; }
.progress-track { height: 8px; border-radius: 999px; background: #e6ebf1; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: var(--brand); animation: growBar .8s var(--ease-spring) both; }
.progress-fill.green { background: var(--success); }
.progress-fill.amber { background: var(--amber); }
.progress-fill.violet { background: var(--violet); }
.stack-list { display: grid; }
.stack-item { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.stack-item:last-child { border-bottom: 0; }
.stack-item .stack-mark { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--brand-soft); color: var(--brand); }
.stack-item .stack-mark.amber { background: var(--amber-bg); color: var(--amber); }
.stack-item .stack-mark.green { background: var(--success-bg); color: var(--success); }
.stack-item .stack-mark.violet { background: var(--violet-bg); color: var(--violet); }
.stack-body { min-width: 0; flex: 1; }
.stack-body strong { display: block; font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stack-body small { display: block; color: var(--muted); font-size: 10.5px; margin-top: 2px; }
.callout { display: flex; gap: 11px; align-items: flex-start; background: var(--brand-soft); border: 1px solid #bfe3dd; border-radius: var(--r-md); padding: 14px; margin-top: 18px; }
.callout svg { color: var(--brand); flex: none; margin-top: 1px; }

/* ---------- Pricing / subscriptions ---------- */
.pricing-hero { position: relative; text-align: center; padding: 30px 20px 24px; overflow: hidden; border-radius: var(--r-lg); background: #f8fafc; border: 1px solid var(--line-soft); margin-bottom: 4px; }
.pricing-glow { position: absolute; top: -60%; left: 15%; right: 15%; height: 220%; z-index: 0; pointer-events: none; background: radial-gradient(circle at center, var(--brand-ring) 0%, transparent 68%); }
.pricing-title { position: relative; z-index: 1; font-size: 24px; font-weight: 700; letter-spacing: -.01em; line-height: 1.3; margin-bottom: 8px; }
.pricing-title-mark { display: inline-block; border: 1.5px dashed var(--brand); background: var(--brand-soft); color: var(--brand); padding: 1px 9px; border-radius: 8px; }
.pricing-subtitle { position: relative; z-index: 1; color: var(--muted); font-size: 11.5px; max-width: 520px; margin: 0 auto 20px; line-height: 1.55; }
.billing-switch { position: relative; z-index: 1; display: inline-grid; grid-template-columns: repeat(2, 1fr); background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 4px; box-shadow: var(--shadow-xs); }
.billing-switch button { position: relative; z-index: 1; border: 0; background: none; padding: 9px 18px; border-radius: 999px; font-size: 11px; font-weight: 650; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; cursor: pointer; transition: color .2s ease; }
.billing-switch button.active { color: #fff; }
.billing-switch .billing-save { background: var(--success-bg); color: var(--success); border-radius: 999px; padding: 2px 7px; font-size: 8.5px; font-weight: 700; }
.billing-switch button.active .billing-save { background: rgba(255, 255, 255, .3); color: #fff; }
.billing-thumb { position: absolute; top: 4px; left: 4px; bottom: 4px; width: calc(50% - 4px); border-radius: 999px; transition: transform .28s var(--ease-spring); background: linear-gradient(180deg, var(--brand-hover), var(--brand)); box-shadow: 0 6px 16px rgba(15, 118, 110, .4); }
.billing-thumb.right { transform: translateX(100%); }

.pricing-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: stretch; margin-top: 18px; }
.pricing-card { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); padding: 20px; display: flex; flex-direction: column; gap: 13px; transition: transform .22s var(--ease-spring), box-shadow .22s ease, border-color .22s ease; }
.pricing-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: #dde3ea; }
.pricing-card.popular { border: 2px solid var(--brand); box-shadow: var(--shadow-md); background: var(--brand-soft); }
.pricing-card.popular:hover { transform: translateY(-5px); }
.pricing-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pricing-card-top h3 { font-size: 15px; font-weight: 700; }
.pricing-badge { background: var(--brand); color: #fff; font-size: 9px; font-weight: 700; letter-spacing: .01em; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.plan-blurb { color: var(--muted); font-size: 10.5px; line-height: 1.5; min-height: 36px; }
.plan-price { display: flex; align-items: baseline; gap: 2px; }
.plan-price-currency { font-size: 15px; font-weight: 700; color: var(--ink-soft); }
.plan-price-amount { font-size: 28px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.plan-price-suffix { font-size: 11px; color: var(--muted); font-weight: 600; margin-left: 2px; }
.pricing-cta { width: 100%; border: 0; border-radius: var(--r-md); padding: 11px; font-size: 11.5px; font-weight: 700; color: #fff; cursor: pointer; background: linear-gradient(180deg, var(--ink-soft), var(--ink)); box-shadow: 0 8px 18px rgba(15, 23, 42, .22); transition: transform .18s var(--ease-spring), box-shadow .18s ease; }
.pricing-cta:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(15, 23, 42, .28); }
.pricing-cta.primary { background: linear-gradient(180deg, var(--brand-hover), var(--brand)); box-shadow: 0 8px 18px rgba(15, 118, 110, .32); }
.pricing-cta.primary:hover { box-shadow: 0 10px 22px rgba(15, 118, 110, .38); }
.plan-bullets { display: grid; gap: 10px; padding: 2px 0; }
.plan-bullets li { display: flex; align-items: center; gap: 10px; font-size: 10.5px; font-weight: 600; color: var(--ink-soft); }
.plan-bullets li svg { color: var(--ink-soft); flex: none; width: 16px; height: 16px; }
.plan-includes { padding-top: 13px; border-top: 1px solid var(--line-soft); }
.plan-includes h4 { font-size: 10.5px; font-weight: 700; margin-bottom: 10px; }
.plan-checklist { display: grid; gap: 9px; }
.plan-checklist li { display: flex; align-items: center; gap: 9px; font-size: 10.5px; color: var(--ink-soft); }
.plan-checklist .check-mark { width: 22px; height: 22px; border-radius: 999px; background: var(--brand-soft); border: 1px solid var(--brand); color: var(--brand); display: grid; place-items: center; flex: none; }
@keyframes priceIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.callout strong { display: block; font-size: 11px; }
.callout p { color: #0b5a54; font-size: 10.5px; line-height: 1.55; margin-top: 3px; }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.kv { border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; background: var(--hover); }
.kv span { display: block; color: var(--muted); font-size: 10.5px; }
.kv strong { display: block; font-size: 13px; font-weight: 600; margin-top: 4px; }

/* ---------- Booksy support access ---------- */
/* Sits directly under .topbar (height 68px, z-index 40) and stays put while the
   page scrolls: during a support session there must be no scroll position where
   the workspace looks like an ordinary company admin session. */
.support-banner { position: sticky; top: 68px; z-index: 39; display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: var(--brand-soft); border-bottom: 1px solid #bfe3dd; }
.support-banner-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--brand); color: #fff; display: grid; place-items: center; flex: none; }
.support-banner-copy { display: grid; gap: 2px; min-width: 0; }
.support-banner-copy strong { font-size: 11.5px; font-weight: 650; color: var(--ink); }
.support-banner-copy > span { font-size: 10.5px; color: #0b5a54; }
.support-banner button { margin-left: auto; flex: none; }

/* .split-grid is two columns; the card carries a form plus a history list. */
.split-grid .support-card { grid-column: 1 / -1; }
.support-toggle { display: flex; align-items: flex-start; gap: 11px; cursor: pointer; }
.support-toggle input { width: 18px; height: 18px; accent-color: var(--brand); flex: none; margin-top: 1px; }
.support-toggle strong { display: block; font-size: 11.5px; font-weight: 600; }
.support-toggle small { display: block; color: var(--muted); font-size: 10.5px; line-height: 1.55; margin-top: 3px; }
.support-log-heading { font-size: 10.5px; font-weight: 600; color: var(--muted); margin: 20px 0 2px; }
.support-log { list-style: none; display: grid; }
.support-log li { display: flex; align-items: baseline; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.support-log li:first-child { border-top: 0; }
.support-log-body { min-width: 0; }
.support-log-body strong { display: block; font-size: 11px; font-weight: 600; }
.support-log-body small { display: block; color: var(--muted); font-size: 10.5px; line-height: 1.5; margin-top: 2px; }
.support-log-when { margin-left: auto; flex: none; color: var(--muted); font-size: 10px; white-space: nowrap; }
.support-session-row { flex-wrap: wrap; }
.support-session-actions { margin-left: auto; flex: none; display: flex; gap: 8px; }
.subtle-note { display: block; color: var(--muted-soft); font-size: 9.5px; margin-top: 3px; }

/* ---------- Data management ---------- */
.data-layout { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 18px; align-items: start; }
/* grant names need more room than the short module names */
.data-layout.wide { grid-template-columns: 290px minmax(0, 1fr); }
.data-rail { padding: 12px; display: grid; gap: 2px; }
.data-rail > span { padding: 8px 10px 6px; }
.data-rail button { position: relative; width: 100%; overflow: hidden; border: 0; background: none; display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 12px; border-radius: var(--r-sm); color: var(--ink-soft); font-size: 12px; text-align: left; transition: background .16s, color .16s; }
.data-rail button > svg { flex: none; }
.data-rail button:hover { background: var(--hover); }
.data-rail button.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
/* the label must be allowed to shrink, or it pushes the count out of the rail */
.data-rail button b { flex: none; margin-left: auto; font-weight: 600; font-size: 10px; color: var(--muted); background: #eef2f6; border-radius: 999px; padding: 2px 8px; }
.data-rail button.active b { background: #fff; color: var(--brand); }
/* one field per column, however many the list has */
.inline-add { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-bottom: 14px; }
.inline-add .inline-field { flex: 1 1 190px; min-width: 0; display: grid; gap: 5px; }
.inline-add .inline-field span { font-size: 9.5px; font-weight: 650; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
.inline-add .button { flex: none; }
/* The hidden-by-default extra fields (see ui/pages/data.js's addRecordForm)
   need their own flex row, not to become one squeezed flex item alongside
   the always-visible fields — .inline-field's own styling still applies to
   them either way, since it's a plain descendant selector. */
.inline-add-more { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; flex: 1 1 100%; }
.rail-divider { padding: 14px 12px 6px; }
.rail-divider span { font-size: 8.5px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; color: var(--muted-soft); }
.data-rail button span { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* COA/GL top bar: replaces the old left-side rail with a horizontal one, so
   the account table below gets the full page width. */
.ledger-topbar { padding: 12px 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin-bottom: 18px; }
.ledger-topbar .rail-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ledger-topbar .rail-label { font-size: 8.5px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; color: var(--muted-soft); margin-right: 2px; }
.ledger-tab { display: inline-flex; align-items: center; gap: 7px; border: 1px solid transparent; background: var(--hover); border-radius: 999px; padding: 7px 13px; font-size: 10.5px; font-weight: 600; color: var(--ink-soft); white-space: nowrap; max-width: 220px; transition: background .16s, color .16s, border-color .16s; }
.ledger-tab span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ledger-tab:hover { background: var(--line-soft); }
.ledger-tab.active { background: var(--brand-soft); color: var(--brand); border-color: var(--brand-ring); font-weight: 650; }
.ledger-tab b { flex: none; font-weight: 600; font-size: 8px; color: var(--muted); background: #fff; border-radius: 999px; padding: 1px 7px; }
.ledger-tab.active b { color: var(--brand); }

/* COA headings: two big cards per row instead of a long vertical list —
   click one to open its accounts below. */
.heading-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.heading-box { display: flex; align-items: center; gap: 14px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--hover); padding: 22px 24px; text-align: left; cursor: pointer; box-shadow: var(--shadow-xs); transition: background .16s, border-color .16s, box-shadow .16s; }
.heading-box:hover { background: var(--line-soft); box-shadow: var(--shadow-sm); }
.heading-box.active { background: var(--brand-soft); border-color: var(--brand); }
.heading-box.drag-over { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-ring); }
.heading-box strong { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.heading-box .subtle { flex: none; font-size: 12px; font-weight: 600; color: var(--muted); background: #fff; border-radius: 999px; padding: 3px 10px; }
.heading-box .icon-button { flex: none; margin-left: 2px; opacity: 0; transition: opacity .16s; }
.heading-box:hover .icon-button, .heading-box:focus-within .icon-button { opacity: 1; }
@media (max-width: 560px) {
  .heading-grid { grid-template-columns: 1fr; }
}
.heading-detail-panel { display: grid; gap: 12px; }
.heading-detail-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.heading-detail-title { display: flex; align-items: center; gap: 8px; }
.heading-detail-title strong { font-size: 12.5px; }
.heading-detail-title .subtle { font-size: 10px; }
.heading-detail-children { display: grid; gap: 8px; }
.range-assign-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding: 12px; border: 1px dashed var(--line); border-radius: var(--r-sm); background: var(--hover); }
.range-assign-form .inline-field { min-width: 0; }
.range-assign-form .inline-field input { width: 100px; }
.range-assign-form .hint { flex: 1 1 200px; font-size: 9.5px; color: var(--muted); }
.boundary-toggle { display: flex; gap: 3px; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: #fff; flex: none; }
.boundary-option { display: flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 999px; font-size: 9.5px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; transition: background .14s, color .14s; }
.boundary-option input { accent-color: var(--brand); width: 12px; height: 12px; }
.boundary-option:has(input:checked) { background: var(--brand-soft); color: var(--brand); }
.heading-picker { min-height: 34px; border: 1px solid var(--line); border-radius: 7px; padding: 0 8px; font-size: 10.5px; background: #fff; max-width: 170px; }

/* COA/GL headings: drag records or headings onto a heading to group them */
.heading-tree { display: grid; gap: 14px; margin-top: 4px; }
.heading-section { display: grid; gap: 8px; }
.heading-section-head { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--hover); cursor: grab; transition: background .16s, border-color .16s; }
.heading-section-head:active { cursor: grabbing; }
.heading-section-head strong { font-size: 11.5px; }
.heading-section-head .subtle { margin-left: auto; font-size: 10px; }
.heading-section-head.ungrouped { cursor: default; border-style: dashed; }
.heading-section-head.drag-over,
.heading-empty.drag-over { background: var(--brand-soft); border-color: var(--brand); }
.heading-empty { padding: 10px 12px; border: 1px dashed var(--line); border-radius: var(--r-sm); }
[data-drag-kind="record"] { cursor: grab; }
[data-drag-kind="record"]:active { cursor: grabbing; }

/* file import */
.file-input { width: 100%; min-height: 46px; border: 1px dashed var(--line); border-radius: var(--r-sm); padding: 11px 12px; background: var(--hover); font-size: 11.5px; cursor: pointer; transition: border-color .18s, background .18s; }
.file-input:hover { border-color: var(--brand); background: var(--brand-soft); }
.file-input::file-selector-button { margin-right: 12px; border: 1px solid var(--line); background: #fff; color: var(--ink-soft); border-radius: 7px; padding: 6px 12px; font: inherit; font-size: 11px; font-weight: 600; cursor: pointer; }
.file-input::file-selector-button:hover { background: var(--hover); }
.heading-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.radio-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.radio-card { display: flex; align-items: flex-start; gap: 11px; border: 1px solid var(--line); border-radius: var(--r-md); padding: 13px 14px; cursor: pointer; transition: border-color .16s, background .16s, box-shadow .16s; }
.radio-card:hover { border-color: #cbd5e1; background: var(--hover); }
.radio-card.on { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px var(--brand-ring); }
.radio-card input { width: 17px; height: 17px; accent-color: var(--brand); margin-top: 1px; flex: none; }
.radio-card strong { display: block; font-size: 11.5px; font-weight: 600; }
.radio-card small { display: block; color: var(--muted); font-size: 10px; line-height: 1.5; margin-top: 3px; }

.import-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; background: var(--hover); }
.import-summary span { display: block; color: var(--muted); font-size: 10px; }
.import-summary strong { display: block; font-size: 13px; font-weight: 650; margin-top: 3px; word-break: break-word; }
.import-controls { display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; }
.import-preview { max-height: 230px; }
.preview-scroll { max-height: 250px; overflow: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: var(--r-md); }
.preview-table { width: max-content; min-width: 100%; border-collapse: collapse; font-size: 10.5px; }
.preview-table th { position: sticky; top: 0; z-index: 2; background: var(--hover); border-bottom: 1px solid var(--line); padding: 9px 12px; text-align: left; white-space: nowrap; font-size: 10px; font-weight: 600; color: var(--ink-soft); text-transform: none; letter-spacing: 0; }
.preview-table th label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.preview-table th input { width: 15px; height: 15px; accent-color: var(--brand); }
.preview-table th b { color: var(--muted); font-weight: 700; }
.preview-table td { padding: 8px 12px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; color: var(--ink-soft); max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.preview-table tr:last-child td { border-bottom: 0; }
.preview-table .col-on { background: var(--brand-soft); }
.preview-table td.col-off { color: var(--muted-soft); background: #f8fafc; text-decoration: line-through; }
.preview-table th { vertical-align: top; }
.preview-table th small { display: block; margin-top: 3px; padding-left: 24px; color: var(--muted-soft); font-weight: 600; }
/* a column header is a switch: tick it to bring the column in */
.col-toggle { display: inline-flex; align-items: center; gap: 8px; background: transparent; border: 0; padding: 0; font: inherit; font-weight: 650; color: var(--brand); cursor: pointer; }
.col-toggle .tick { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 5px; border: 1.5px solid var(--brand); background: var(--brand); color: #fff; flex: none; }
.col-off .col-toggle { color: var(--muted-soft); }
.col-off .col-toggle .tick { background: #fff; border-color: var(--line); }
.col-toggle:hover span { text-decoration: underline; }

/* master data record table */
/* Fixed-width columns (not max-content) so a table with many columns settles
   at roughly 6 visible at once in a normal-width viewport, the rest reachable
   by the horizontal scroll .table-wrap already provides, rather than every
   column shrinking to cram everything in at once. */
/* width: 100% so a table with few columns still reaches the card's full
   width rather than stopping short partway across. The max-width on cells
   below is what keeps this from reintroducing the old blow-out bug: without
   a ceiling, table-layout:fixed dumps 100% of the leftover space onto
   whichever columns exist, which used to balloon a short table's columns far
   past a comfortable reading width. .code-col/.actions-col/.select-col
   further down pin their own max-width to their natural size, so the extra
   space always flows to the real content columns instead. */
.record-table { table-layout: fixed; width: 100%; border-collapse: collapse; }
/* Full grid lines on every cell, not just row-bottom borders — same
   spreadsheet-style treatment as the Org Budget table below. */
.record-table th, .record-table td { width: 190px; max-width: 260px; border: 1px solid var(--line); }
.record-table th { position: sticky; top: 0; z-index: 1; background: var(--hover); border-bottom: 1px solid var(--line); padding: 10px 16px; text-align: center; font-size: 9px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); font-weight: 650; }
/* Long text truncates with an ellipsis instead of wrapping and pushing the
   row taller — a column's real value is still there on hover (native title
   tooltip) or by widening the browser; this is about the column staying a
   predictable, consistent width, not hiding data permanently. */
.record-table td { padding: 12px 16px; text-align: center; vertical-align: middle; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Every table's cells are center-aligned (see the base th/td rules) —
   amount/numeric columns are no exception. */
.record-table td.num-col, .record-table td.amount-cell { text-align: center; }
.record-table tbody tr { transition: background .16s; }
.record-table tbody tr:hover { background: var(--hover); }
.record-table strong { display: block; font-size: 11.5px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
.record-table small { display: block; color: var(--muted); font-size: 10px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }
.record-table .code-col { width: 110px; max-width: 110px; white-space: nowrap; }
.record-table th .col-head { display: inline-flex; align-items: center; justify-content: center; gap: 4px; width: 100%; }
.record-table th .icon-button.tiny { width: 20px; height: 20px; border-radius: 5px; opacity: 0; transition: opacity .16s, background .16s, color .16s; }
.record-table th:hover .icon-button.tiny { opacity: 1; }
.record-table td.name-col { min-width: 220px; }
.record-table td.num-col { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted-cell { color: var(--muted-soft); }
.record-table .actions-col { width: 90px; max-width: 90px; white-space: nowrap; }
.record-table .select-col { width: 40px; max-width: 40px; white-space: nowrap; padding-right: 4px; }
.record-table .select-col input { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }
.code-chip { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 6px; background: var(--violet-bg); color: var(--violet); font-size: 10.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
.inline-add .inline-field:has(.code-input) { flex: 0 1 150px; }
/* the list scrolls inside the card so the page keeps a stable height */
/* many columns scroll sideways inside the card rather than stretching the page */
.record-list { border: 1px solid var(--line); border-radius: var(--r-md); overflow: auto; max-height: 460px; scrollbar-width: thin; }
.record-list::-webkit-scrollbar { width: 10px; height: 10px; }
.record-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; border: 3px solid #fff; }
.record-list::-webkit-scrollbar-thumb:hover { background: #b6c2d2; }
.record-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 16px; border-bottom: 1px solid var(--line-soft); transition: background .16s; }
.record-item:last-child { border-bottom: 0; }
.record-item:hover { background: var(--hover); }
.record-item strong { display: block; font-size: 11.5px; font-weight: 600; }
.record-item small { display: block; color: var(--muted); font-size: 10px; margin-top: 2px; }
.record-actions { display: flex; align-items: center; gap: 10px; flex: none; }

/* ---------- Forms / drawer ---------- */
.form-stack { display: grid; gap: 18px; }
.field { display: grid; gap: 7px; font-size: 11px; font-weight: 500; color: var(--ink-soft); }
.field > span { display: flex; align-items: center; gap: 6px; }
.field .hint { color: var(--muted-soft); font-weight: 400; font-size: 10px; }
.form-grid { display: grid; gap: 16px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.currency-input { position: relative; }
.currency-input > span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 12px; }
.currency-input input { padding-left: 28px; }

.drawer-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(20, 17, 14, .45); display: flex; justify-content: flex-end; }
.drawer { position: relative; width: min(780px, 96vw); background: #fff; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.drawer-header { padding: 22px 26px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.drawer-header h2 { font-size: 19px; font-weight: 650; }
.drawer-header p { color: var(--muted); font-size: 11px; margin-top: 5px; }
.eyebrow { display: inline-block; font-size: 8.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--brand); }
.page-header .eyebrow { display: block; font-size: 10px; margin-bottom: 7px; }
.eyebrow.light { color: #7fd0c5; }
.drawer-form { flex: 1; overflow-y: auto; padding: 0 26px 24px; }
.form-section { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 26px; padding: 24px 0; border-bottom: 1px solid var(--line-soft); }
.form-section:last-of-type { border-bottom: 0; }
.form-section-heading h3 { font-size: 12.5px; font-weight: 650; }
.form-section-heading p { color: var(--muted); font-size: 10.5px; line-height: 1.6; margin-top: 6px; }
.form-section-body { display: grid; gap: 16px; }
.drawer-actions { border-top: 1px solid var(--line); background: #fff; padding: 16px 26px; display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- New Opportunity: chrome-free full page, no sidebar/topbar ---------- */
.create-opportunity-page { min-height: 100vh; background: var(--canvas); display: flex; flex-direction: column; align-items: center; }
.create-opportunity-header { width: 100%; max-width: 1560px; padding: 24px 32px 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.create-opportunity-header h1 { font-size: 20px; font-weight: 650; margin-top: 4px; }
.create-opportunity-form { width: 100%; max-width: 1560px; background: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow-lg); margin: 18px 32px 40px; padding: 6px 32px 0; }
.create-opportunity-form .form-section:last-of-type { border-bottom: 0; }
.create-opportunity-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 20px 0; border-top: 1px solid var(--line); }
/* Budget table: fixed layout with wide text columns and compact year columns
   so a normal multi-year grant (2-6 years) fits without a horizontal scroll. */
#budget-table { table-layout: fixed; width: 100%; }
#budget-table th:nth-child(1), #budget-table td:nth-child(1) { width: 22%; }
#budget-table th:nth-child(2), #budget-table td:nth-child(2) { width: 14%; }
#budget-table th:nth-child(3), #budget-table td:nth-child(3) { width: 26%; }
#budget-table th:last-child, #budget-table td:last-child { width: 44px; }
#budget-table input, #budget-table select { width: 100%; }
#budget-table tfoot td { padding: 8px 10px; font-size: 11px; color: var(--ink-soft); border-top: 1px solid var(--line); }
#budget-table tfoot tr:first-child td { border-top: 2px solid var(--line); }
#budget-table .budget-grand-row td { font-weight: 700; color: var(--ink); background: var(--brand-soft); }
.budget-grand-total-line { display: flex; justify-content: flex-end; align-items: baseline; gap: 10px; padding: 12px 4px 0; font-size: 11.5px; color: var(--ink-soft); }
.budget-grand-total-line strong { font-size: 14px; color: var(--ink); }
.budget-grand-total-line.over-budget strong { color: var(--danger); }
@media (max-width: 1024px) {
  .create-opportunity-header, .create-opportunity-form { padding-left: 18px; padding-right: 18px; margin-left: 12px; margin-right: 12px; }
}

/* ---------- Dialog ---------- */
.dialog-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(20, 17, 14, .5); display: grid; place-items: center; padding: 24px; overflow-y: auto; overscroll-behavior: contain; }
.dialog { width: min(540px, 100%); background: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; max-height: min(88vh, 940px); overflow: hidden; }
.dialog-large { width: min(820px, 100%); }
.dialog-xl { width: min(1000px, 100%); }
.dialog-header { padding: 22px 24px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.dialog-header h2 { font-size: 17px; font-weight: 650; }
.dialog-header p { color: var(--muted); font-size: 11px; margin-top: 5px; line-height: 1.55; }
.dialog-body { padding: 22px 24px; overflow-y: auto; overscroll-behavior: contain; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.sticky-actions { position: sticky; bottom: -22px; margin: 20px -24px -22px; padding: 16px 24px; background: #fff; border-top: 1px solid var(--line); }
.attachment-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.attachment-row { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px 10px; background: var(--hover); }
.attachment-icon { color: var(--brand); flex: none; display: flex; }
.attachment-name { flex: 1; font-size: 11.5px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-size { color: var(--muted); font-size: 10px; flex: none; }
.attachment-add { cursor: pointer; }
.attachment-frame { width: 100%; height: min(75vh, 800px); border: 0; border-radius: var(--r-sm); background: var(--hover); }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.detail-full { grid-column: 1 / -1; }
.detail-group { border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px; }
.detail-group h4 { font-size: 11.5px; font-weight: 650; margin-bottom: 8px; }
.detail-group > div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-top: 1px solid var(--line-soft); font-size: 11px; }
.detail-group span { color: var(--muted); }
.detail-group strong { font-weight: 600; word-break: break-word; }

/* ---------- Validation ---------- */
.validation-banner { display: flex; gap: 12px; align-items: flex-start; background: var(--warning-bg); border: 1px solid #fde68a; border-radius: var(--r-md); padding: 14px; margin-bottom: 18px; }
.validation-banner svg { color: var(--amber); flex: none; margin-top: 1px; }
.validation-banner strong { display: block; font-size: 11.5px; color: #92400e; }
.validation-banner p { color: #a16207; font-size: 10.5px; line-height: 1.55; margin-top: 3px; }
.validation-list { display: grid; gap: 12px; }
.validation-row { border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px; display: grid; grid-template-columns: minmax(0, 1fr) 230px minmax(0, 1.2fr); gap: 18px; align-items: center; transition: border-color .18s, box-shadow .18s; }
.validation-row:hover { border-color: #cbd5e1; box-shadow: var(--shadow-xs); }
.validation-field strong { display: block; font-size: 12px; font-weight: 600; margin: 4px 0 3px; }
.validation-field small { color: var(--muted); font-size: 10px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; background: #eef2f6; border-radius: var(--r-sm); padding: 3px; }
.segmented button { border: 0; background: transparent; border-radius: 6px; min-height: 32px; font-size: 10.5px; font-weight: 600; color: var(--muted); transition: background .2s, color .2s, box-shadow .2s; }
.segmented button.active { background: #fff; color: var(--brand); box-shadow: var(--shadow-xs); }
.validation-action label { display: grid; gap: 6px; font-size: 10px; font-weight: 600; color: var(--ink-soft); }
.validation-action select { min-height: 38px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.suggestion-chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 10px; font-size: 9.5px; color: var(--ink-soft); transition: background .16s, border-color .16s, color .16s; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggestion-chip:hover { background: var(--brand-soft); border-color: #a7d8d1; color: var(--brand); }
.add-confirm { display: flex; align-items: flex-start; gap: 9px; color: var(--success); font-size: 10.5px; line-height: 1.5; background: var(--success-bg); border-radius: var(--r-sm); padding: 11px 12px; }
.add-confirm svg { flex: none; margin-top: 1px; }

/* ---------- Command palette ---------- */
.command-backdrop { align-items: flex-start; padding-top: 12vh; }
.command-panel { width: min(620px, 96vw); background: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow-lg); overflow: hidden; }
.command-input { height: 58px; display: flex; align-items: center; gap: 12px; padding: 0 16px; border-bottom: 1px solid var(--line); color: var(--muted-soft); }
.command-input input { flex: 1; border: 0; outline: 0; font-size: 13px; min-height: 0; }
.command-results { padding: 8px; max-height: 380px; overflow-y: auto; }
.command-results button { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 0; background: none; padding: 10px 12px; border-radius: var(--r-sm); text-align: left; transition: background .14s; }
.command-results button:hover { background: var(--hover); }
.command-results button > span { display: grid; gap: 2px; min-width: 0; }
.command-results strong { font-size: 11.5px; font-weight: 600; }
.command-results small { color: var(--muted); font-size: 10px; }

/* ---------- Empty + toast ---------- */
.empty-state { display: grid; place-items: center; align-content: center; text-align: center; padding: 54px 24px; color: var(--muted); }
.empty-state.compact { padding: 30px 20px; }
.empty-mark { width: 52px; height: 52px; border-radius: 14px; background: var(--hover); color: var(--muted-soft); display: grid; place-items: center; margin-bottom: 14px; }
.empty-state strong { color: var(--ink); font-size: 13px; font-weight: 650; }
.empty-state p { font-size: 11.5px; max-width: 360px; line-height: 1.6; margin-top: 5px; }
.toast-stack { position: fixed; right: 22px; bottom: 22px; z-index: 200; display: grid; gap: 10px; }
.toast { min-width: 300px; max-width: 420px; background: #0f172a; color: #fff; border-radius: var(--r-md); box-shadow: var(--shadow-md); display: flex; align-items: center; gap: 11px; padding: 13px 16px; font-size: 11.5px; opacity: 0; transform: translateY(14px) scale(.97); transition: opacity .24s var(--ease-spring), transform .24s var(--ease-spring); }
.toast.visible { opacity: 1; transform: none; }
.toast svg { flex: none; color: #4ade80; }
.toast.warning svg { color: #fbbf24; }
.toast.neutral svg { color: #cbd5e1; }

/* ---------- Motion ---------- */
.page-enter { animation: pageIn .3s var(--ease-spring) both; }
.tab-panel { animation: tabIn .26s var(--ease-spring) both; }
.overlay-enter { animation: fadeIn .18s ease both; }
.dialog-enter, .command-enter { animation: dialogIn .28s var(--ease-spring) both; }
.drawer-enter { animation: drawerIn .36s var(--ease-spring) both; }
.menu-enter { animation: menuIn .18s var(--ease-spring) both; transform-origin: top right; }
.rise { animation: riseIn .4s var(--ease-spring) both; }
.stagger > * { animation: riseIn .42s var(--ease-spring) both; }
.stagger > *:nth-child(1) { animation-delay: .02s; }
.stagger > *:nth-child(2) { animation-delay: .06s; }
.stagger > *:nth-child(3) { animation-delay: .1s; }
.stagger > *:nth-child(4) { animation-delay: .14s; }
.stagger > *:nth-child(5) { animation-delay: .18s; }
.stagger > *:nth-child(6) { animation-delay: .22s; }
tbody.stagger-rows tr { animation: rowIn .38s var(--ease-spring) both; }
tbody.stagger-rows tr:nth-child(1) { animation-delay: .02s; }
tbody.stagger-rows tr:nth-child(2) { animation-delay: .05s; }
tbody.stagger-rows tr:nth-child(3) { animation-delay: .08s; }
tbody.stagger-rows tr:nth-child(4) { animation-delay: .11s; }
tbody.stagger-rows tr:nth-child(5) { animation-delay: .14s; }
tbody.stagger-rows tr:nth-child(6) { animation-delay: .17s; }
tbody.stagger-rows tr:nth-child(7) { animation-delay: .2s; }
tbody.stagger-rows tr:nth-child(8) { animation-delay: .23s; }

/* live-filtering re-render: keep the result instant instead of replaying entrances */
.no-anim, .no-anim *, .no-anim *::before, .no-anim *::after { animation: none !important; }

/* These four run on every page's own in-flow content (not an overlay), so a
   transform here briefly counts toward the document's scrollable height while
   it's mid-animation (confirmed by measurement: a short page like Companies
   spends its first ~180ms reporting real overflow, then settles to none) -
   that's what read as a scrollbar flashing in and out. Opacity-only avoids it. */
@keyframes pageIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes riseIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes rowIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes tabIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes dialogIn { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes drawerIn { from { transform: translateX(100%); } to { transform: none; } }
@keyframes menuIn { from { opacity: 0; transform: translateY(-8px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes pillIn { from { opacity: 0; transform: scaleX(.85); } to { opacity: 1; transform: none; } }
@keyframes subIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes indicatorIn { from { transform: scaleX(.4); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes growBar { from { width: 0 !important; } }
@keyframes floatGlow { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-24px, 26px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-grid { grid-template-columns: 1fr; }
  .pricing-grid { grid-template-columns: 1fr; max-width: 460px; margin-inline: auto; }
  .pricing-card.popular { transform: none; }
}
@media (max-width: 1080px) {
  .validation-row { grid-template-columns: 1fr; }
  .data-layout, .data-layout.wide { grid-template-columns: 1fr; }
  .data-rail { display: flex; overflow-x: auto; gap: 6px; }
  .data-rail > span, .data-rail .rail-divider { display: none; }
  .data-rail button { min-width: 160px; flex: none; }
}
@media (max-width: 900px) {
  .app-main { margin-left: 0; }
  .sidebar { transform: translateX(-100%); transition: transform .3s var(--ease-spring); }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .mobile-scrim { display: block; position: fixed; inset: 0; z-index: 55; border: 0; background: rgba(20, 17, 14, .45); opacity: 0; visibility: hidden; transition: opacity .24s ease, visibility .24s ease; }
  .mobile-scrim.visible { opacity: 1; visibility: visible; }
  .topbar { padding: 0 16px; gap: 8px; }
  .command-trigger { width: auto; flex: 1; margin: 0; }
  .profile-copy { display: none; }
  .page-container { padding: 24px 18px 40px; }
  .auth-page { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .mobile-brand { display: block; }
  .form-section { grid-template-columns: 1fr; gap: 14px; }
  /* .topbar keeps height:68px here, so the banner's sticky top still lines up. */
  .support-banner { flex-wrap: wrap; padding: 12px 16px; }
  .support-banner button { margin-left: 0; width: 100%; }
}
@media (max-width: 680px) {
  .stat-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: stretch; }
  .page-header-actions .button { width: 100%; }
  .table-toolbar { flex-direction: column; align-items: stretch; }
  .search-field { width: 100%; }
  .toolbar-right { display: grid; grid-template-columns: 1fr 1fr; }
  .select-field { min-width: 0; }
  .toolbar-right > .button { grid-column: 1 / -1; }
  .form-grid.two, .form-grid.three { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-group > div { grid-template-columns: 1fr; gap: 3px; }
  .auth-panel { padding: 22px; }
  .drawer-form, .drawer-header, .drawer-actions { padding-left: 18px; padding-right: 18px; }
  .toast-stack { left: 14px; right: 14px; bottom: 14px; }
  .toast { min-width: 0; width: 100%; }
  .command-trigger span, .command-trigger kbd { display: none; }
  .support-log li { flex-wrap: wrap; gap: 8px; }
  .support-log-when { margin-left: 0; width: 100%; }
}

/* ---------------- Data Mapping: relationship canvas ---------------- */
.mapping-canvas { position: relative; padding: 0; }
/* Below .mapping-boxes in paint order (no z-index — plain DOM order already
   puts it under .mapping-boxes below), so a line connecting two distant boxes
   ducks behind whichever box cards sit between them instead of visibly
   cutting across their column text. Hit-testing is handled separately from
   paint order: .mapping-boxes has pointer-events:none (its own bounding box
   spans the whole grid, including the gaps between boxes, where lines and the
   "x" live), with pointer-events:auto put back just on .mapping-box itself —
   so a click on empty gap space now falls straight through the flex
   container to the line/"x" underneath, while a click on an actual box still
   hits that box like normal. */
.mapping-lines { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.mapping-line { stroke: var(--brand); stroke-width: 2; opacity: .55; }
.mapping-drag-line { stroke: var(--brand); stroke-width: 2; stroke-dasharray: 6 5; opacity: .8; }
.mapping-line-remove { pointer-events: auto; cursor: pointer; }
.mapping-line-remove circle { fill: var(--card); stroke: var(--danger); stroke-width: 1.5; }
.mapping-line-remove text { font-size: 11px; font-weight: 700; fill: var(--danger); user-select: none; }
.mapping-line-remove:hover circle { fill: var(--danger-bg); }
.mapping-boxes { position: relative; display: flex; flex-wrap: wrap; gap: 20px; pointer-events: none; }
.mapping-box { width: 210px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-xs); padding: 12px; cursor: pointer; user-select: none; pointer-events: auto; transition: border-color .16s, box-shadow .16s; }
.mapping-box:hover { border-color: var(--brand); box-shadow: 0 4px 14px rgba(15, 23, 42, .1); }
.mapping-box-head { display: flex; align-items: center; justify-content: space-between; font-weight: 600; font-size: 13px; color: var(--ink); margin-bottom: 8px; }
.mapping-box-head .subtle { font-weight: 500; font-size: 10.5px; color: var(--muted-soft); }
.mapping-box-fields { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.mapping-box-fields li { font-size: 11.5px; color: var(--ink-soft); background: var(--hover); border-radius: 6px; padding: 5px 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mapping-box-more { margin-top: 8px; font-size: 10.5px; color: var(--brand); font-weight: 600; text-align: center; }
.mapping-rel-remove { border: 1px solid var(--line); background: var(--card); color: var(--danger); width: 26px; height: 26px; border-radius: 999px; font-size: 14px; line-height: 1; cursor: pointer; transition: background .16s, border-color .16s; }
.mapping-rel-remove:hover { background: var(--danger-bg); border-color: var(--danger); }

/* ---------------- draggable table column headers ---------------- */
.record-table th.draggable-col { cursor: grab; }
.record-table th.draggable-col:active { cursor: grabbing; }
.record-table th.drag-over { background: var(--brand-soft); box-shadow: inset 0 0 0 2px var(--brand); }

/* ---------------- Org Budget table ---------------- */
/* Full grid lines already come from .record-table above (org-budget-table is
   applied together with it — see ui/pages/orgBudget.js). */
.org-budget-table input { width: 100%; min-width: 90px; }
.org-budget-table td { min-width: 130px; }
.org-budget-table tr.org-budget-auto-row td { font-weight: 600; background: var(--brand-soft); }
.org-budget-table tr.org-budget-auto-row td.amount-cell { font-variant-numeric: tabular-nums; }
/* The Revenue/Expense label — spans down over every row in its group (see
   ui/pages/orgBudget.js's labelCell), so it sits once in the leftmost column
   with that section's line items running down to its right, rather than as
   its own full-width divider row. */
.org-budget-table td.org-budget-label { width: 90px; min-width: 90px; max-width: 90px; text-align: center; vertical-align: middle; background: var(--hover); text-transform: uppercase; font-size: 11px; letter-spacing: .04em; }
/* Invisible end-of-group marker each section's "Add Line" inserts before —
   [hidden] already does this in every current browser; explicit here too
   since table rows sometimes get their display value fought over. */
.org-budget-table tr.org-budget-section-end { display: none; }

/* ---------------- Budgets list + report (see ui/pages/orgBudgets.js) ---------------- */
table tr.row-click { cursor: pointer; transition: background .14s; }
table tr.row-click:hover { background: var(--hover); }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; background: var(--hover); border: 1px solid var(--line); color: var(--muted); font-size: 10px; font-weight: 600; }
.budget-report-section { padding: 18px 0; border-bottom: 1px solid var(--line); }
.budget-report-section:last-child { border-bottom: 0; }
.budget-report-section h3 { font-size: 13px; font-weight: 700; margin-bottom: 12px; }
.budget-report-line { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.budget-report-section > .budget-report-line:first-child { border-top: 0; }
.budget-report-line-main { display: flex; flex-direction: column; gap: 2px; min-width: 160px; }
.budget-report-line-main span { color: var(--muted); font-size: 11px; }
.budget-report-line-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.budget-report-line-amounts { display: flex; flex-wrap: wrap; gap: 16px; margin-left: auto; }
.budget-report-amount { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; min-width: 90px; }
.budget-report-amount span { font-size: 9px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted-soft); }
.budget-report-amount strong { font-variant-numeric: tabular-nums; }
.budget-report-total { margin-top: 4px; border-top: 2px solid var(--line); font-weight: 700; }

/* ---------------- Financial Reports (see ui/pages/financialReports.js) ---------------- */
.fin-builder, .fin-settings, .fin-statement, #fin-drill { margin-bottom: 20px; }
.fin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; align-items: end; }
.fin-top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin: 0 0 20px; border-bottom: 1px solid var(--line); }
.fin-top .tabs { border-bottom: 0; margin-bottom: 0; flex-wrap: wrap; row-gap: 4px; }
.fin-open { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 11px; font-weight: 500; color: var(--muted); }
.fin-open select { width: 180px; min-height: 34px; }
.fin-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 18px; margin-bottom: 14px; }
.fin-bar > .field { min-width: 210px; flex: 0 1 250px; }
.fin-bar > .fin-date { flex: 0 0 170px; min-width: 170px; }
.fin-ctl { display: grid; gap: 7px; font-size: 11px; font-weight: 500; color: var(--ink-soft); }
.fin-ctl > span, .field > span .hint { display: inline; }
.fin-ctl .hint, .fin-bar .hint { margin-left: 4px; color: var(--muted-soft); font-weight: 400; font-size: 10px; }
.fin-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-height: 42px; }
.fin-chip { position: relative; display: inline-flex; align-items: center; height: 32px; padding: 0 13px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink-soft); font-size: 11px; font-weight: 600; cursor: pointer; user-select: none; transition: background .14s, border-color .14s, color .14s; }
.fin-chip:hover { border-color: #cbd5e1; }
.fin-chip input { position: absolute; opacity: 0; width: 0; height: 0; min-height: 0; margin: 0; pointer-events: none; }
.fin-chip:has(input:checked) { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.fin-chip:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--brand-ring); }
.fin-more { margin: 4px 0 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.fin-more summary { display: flex; align-items: center; gap: 8px; width: max-content; cursor: pointer; color: var(--ink-soft); font-size: 11.5px; font-weight: 600; list-style: none; }
.fin-more summary::-webkit-details-marker { display: none; }
.fin-more summary::before { content: '▸'; color: var(--muted-soft); font-size: 10px; transition: transform .16s; }
.fin-more[open] summary::before { transform: rotate(90deg); }
.fin-more .fin-grid { margin: 14px 0; }
.fin-badge { padding: 1px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: 9.5px; font-weight: 700; }
.fin-save { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.fin-name { flex: 1 1 260px; max-width: 420px; }
.fin-h4 { margin: 22px 0 10px; font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.fin-digits { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.fin-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 18px; }
.fin-spacer { flex: 1; }
.fin-verdict { margin-bottom: 20px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; font-size: 11.5px; }
.fin-verdict.ok { display: flex; align-items: center; gap: 12px; color: var(--ink-soft); }
.fin-verdict.warn { background: #fffaf0; border-color: #ecd9ab; }
.fin-verdict.bad { background: #fff6f5; border-color: #ecc4c0; }
.fin-verdict summary { display: flex; align-items: center; gap: 12px; cursor: pointer; list-style: none; font-weight: 600; color: var(--ink); }
.fin-verdict summary::-webkit-details-marker { display: none; }
.fin-verdict summary em { margin-left: auto; color: var(--muted); font-size: 10.5px; font-style: normal; font-weight: 500; }
.fin-verdict[open] summary em { display: none; }
.fin-checks { list-style: none; margin: 14px 0 2px; padding: 0; display: grid; gap: 10px; }
.fin-checks li { display: flex; align-items: flex-start; gap: 12px; font-size: 11.5px; line-height: 1.55; color: var(--ink-soft); }
.fin-checks .pill { flex: none; }
.fin-statement-head { margin-bottom: 16px; text-align: center; }
.fin-statement-head h2 { font-size: 17px; }
.fin-statement-head p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.fin-table td { font-variant-numeric: tabular-nums; }
.fin-table th .fin-sub { font-size: 9px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.fin-table tr.fin-title td { background: var(--hover); color: var(--ink); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.fin-table tr.fin-group td { color: var(--ink); font-weight: 600; }
.fin-table tr.fin-total td { background: #f8fafc; color: var(--ink); font-weight: 700; border-top: 2px solid var(--line); }
.fin-table tr.fin-net td { background: var(--brand-soft); color: var(--ink); font-weight: 700; }
.fin-table td.fin-neg { color: var(--danger); }
.fin-table td.fin-drillable { cursor: pointer; }
.fin-table td.fin-drillable:hover { background: var(--brand-soft); text-decoration: underline; }
.fin-note { margin: 12px 0 0; color: var(--muted); font-size: 10.5px; line-height: 1.6; }
.fin-statement-head .fin-headnote { margin-top: 8px; color: var(--ink-soft); font-style: italic; }
.fin-note.fin-foot { color: var(--ink-soft); font-style: italic; }
.fin-grow { flex: 1 1 280px; max-width: 520px; }
.fin-notes { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 8px; }
.fin-notes li { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; font-size: 11.5px; }
.fin-notes li strong { flex: none; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fin-notes li span { flex: 1; color: var(--ink-soft); }
.fin-table td.fin-notation { color: var(--ink-soft); font-style: italic; }
.fin-issue { border-top: 0; padding-top: 10px; }
.fin-access { flex: 0 1 220px; }
.fin-frozen { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; background: #f4f8f1; border-color: #c9dcc0; font-weight: 500; color: var(--ink-soft); }
.fin-issued { margin-top: 20px; }

/* ---------------- readability & accessibility pass ----------------
   Raised from the original sizes after reviewing the UI against WCAG AA:
   the greys used for hints/placeholders were below 4.5:1 on white, table
   headers were 8.5-9px, and icon buttons were smaller than a fingertip. */
th { font-size: 10.5px; letter-spacing: .04em; }
.record-table th { font-size: 10.5px; }
td { font-size: 12px; }
.button { font-size: 12px; }
.field .hint, .hint { font-size: 10.5px; }
.subtle, .subtle-note { font-size: 11px; }
[data-action], [data-nav] { cursor: pointer; }
button:disabled, [disabled] { cursor: not-allowed; }
@media (pointer: coarse) {
  .icon-button, .icon-button.small { width: 44px; height: 44px; }
  .icon-button.tiny { width: 32px; height: 32px; }
  .button { min-height: 44px; }
}

/* ---------------- identity: slate + teal, Swiss-minimal ----------------
   Chosen with the ui-ux-pro-max design search (Minimalism & Swiss Style for
   dense enterprise dashboards): hairline borders instead of shadows, one
   accent colour, strong type hierarchy, generous but disciplined spacing. */
.card { box-shadow: none; }
.button.primary { background: var(--brand); box-shadow: none; }
.button.primary:hover { background: var(--brand-hover); box-shadow: 0 4px 14px rgba(15, 118, 110, .28); }
.page-header h1 { font-size: 28px; font-weight: 600; letter-spacing: -.025em; }
.page-header p { font-size: 12.5px; max-width: 70ch; }
.eyebrow { letter-spacing: .12em; }
.nav-item.active { background: rgba(255, 255, 255, .07); color: var(--rail-text-strong); }
th { background: #f8fafc; }
.record-table th { background: #f8fafc; }
tbody tr:hover { background: #f8fafc; }
.stat-card { border-radius: var(--r-md); }

/* Inputs that sit directly in a table cell (Budget lines etc.) get the same
   field styling as every other input, instead of the browser default. */
.record-table input:not([type="checkbox"]):not([type="hidden"]):not([type="radio"]):not([data-combobox-input]) { min-height: 36px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; padding: 0 10px; font-size: 12px; outline: none; transition: border-color .16s, box-shadow .16s; }
.record-table input:not([type="checkbox"]):not([type="hidden"]):not([type="radio"]):not([data-combobox-input]):focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }

/* ---------------- Financial reports list (Sage Intacct-style) ---------------- */
.link-button { border: 0; background: none; padding: 0; color: var(--brand); font-size: 12px; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.link-button:hover { color: var(--brand-hover); }
.link-button.danger { color: var(--danger); }
.fin-listcard { overflow: visible; }
.fin-filterbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.fin-search { display: flex; align-items: center; gap: 8px; width: 260px; height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; color: var(--muted); }
.fin-search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; font-size: 12px; }
.fin-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.fin-filterbar select { width: 240px; min-height: 32px; font-size: 12px; }
.fin-count { color: var(--muted); font-size: 11.5px; }
.fin-list { table-layout: auto; width: 100%; border-collapse: collapse; }
.fin-list th, .fin-list td { width: auto; max-width: none; border: 0; border-bottom: 1px solid var(--line-soft); text-align: left; padding: 6px 12px; font-size: 12.5px; white-space: nowrap; }
.fin-list th { background: #f8fafc; color: var(--ink); font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: none; border-bottom: 1px solid var(--line); }
.fin-list tbody tr:hover { background: #f8fafc; }
.fin-list td:nth-child(2) { max-width: 270px; overflow: hidden; text-overflow: ellipsis; }
.fin-list th, .fin-list td { padding-left: 8px; padding-right: 8px; }
.fin-list .fin-l-edit, .fin-list .fin-l-del { width: 52px; }
.fin-list .fin-l-edit, .fin-list .fin-l-del { width: 64px; }
.fin-list .fin-l-run { position: relative; width: 92px; overflow: visible; }
.fin-list .fin-l-empty { padding: 28px 12px; text-align: center; color: var(--muted); white-space: normal; }
.fin-list .row-menu { right: 12px; left: auto; }

/* ---------------- density: use the screen like an accounting workstation ----------------
   Less chrome, more data: the content fills the width instead of sitting in a
   centred column, headers and paddings are tighter, rows are shorter. */
.topbar { height: 48px; padding: 0 16px; }
.page-container { max-width: none; padding: 12px 16px 24px; }
.page-header { margin-bottom: 12px; gap: 16px; }
.page-header h1 { font-size: 22px; }
.page-header p { font-size: 11.5px; margin-top: 3px; }
.page-header .eyebrow { margin-bottom: 3px; }
.card-pad { padding: 12px 14px; }
.section-heading { margin-bottom: 10px; }
.stat-grid { gap: 10px; margin-bottom: 12px; }
.stat-card { padding: 10px 14px; }
.stat-card:hover { transform: none; }
th { padding: 7px 12px; }
.record-table th { padding: 7px 12px; }
td { padding: 6px 12px; }
.record-table td { padding: 6px 12px; }
.sidebar-brand { padding: 14px 16px; }
.nav-item { padding: 7px 12px; }
.form-grid { gap: 12px; }
.data-layout { gap: 12px; }
.fin-builder, .fin-settings, .fin-statement, #fin-drill, .fin-issued, .fin-packs { margin-bottom: 12px; }
.fin-verdict { margin-bottom: 12px; }
.fin-top { margin-bottom: 12px; }
.fin-bar { gap: 10px 14px; margin-bottom: 10px; }
.fin-more { margin: 2px 0 10px; padding-top: 8px; }
.fin-save { padding-top: 10px; }

/* Run screen: the report fills the whole window above the list */
.fin-runscreen { position: fixed; inset: 0; z-index: 900; background: var(--canvas); display: flex; flex-direction: column; }
.fin-run-bar { display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); flex-shrink: 0; }
.fin-run-bar h2 { margin: 0; font-size: 16px; font-weight: 600; }
.fin-run-body { flex: 1; overflow: auto; padding: 12px 16px 24px; }

/* ---- record tables: header pinned flush, last column always reachable, quiet account-number chip ----
   border-collapse:collapse makes a sticky <th> lose its top border, so rows scroll
   through the gap above the header. Separate borders (drawn right/bottom per cell,
   top/left on the table) keep the header opaque and flush at top:0. */
.record-list { background: var(--card); }
.record-table { border-collapse: separate; border-spacing: 0; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.record-table th, .record-table td { border-width: 0 1px 1px 0; }
.record-table th { top: 0; z-index: 3; background: #f1f5f9; box-shadow: 0 1px 0 var(--line); }
/* the last column must never be cut by the scroll edge: keep every column its
   full width and let .record-list scroll sideways instead of squeezing */
.record-table { min-width: max-content; }
.record-list { scrollbar-gutter: stable; }
.record-table td:last-child, .record-table th:last-child { border-right: 1px solid var(--line); }
.code-chip { height: 22px; padding: 0 8px; background: var(--hover); border: 1px solid var(--line); color: var(--ink); font-size: 11.5px; font-weight: 600; }

/* header labels like "ACCOUNT NUMBER" must fit: the 110px code column was narrower than
   label + sort arrow, so centred text overflowed and lost its first letters */
.record-table th.code-col, .record-table td.code-col { width: 160px; min-width: 160px; max-width: 160px; }
.record-table th { padding-left: 10px; padding-right: 10px; white-space: nowrap; }
.record-table th .col-head { width: auto; max-width: 100%; justify-content: center; }

/* grid lines were --line (#e2e8f0): nearly invisible on white. Table grids use a visibly darker slate. */
:root { --grid: #b8c4d3; }
.record-table, .record-table th, .record-table td,
.org-budget-table th, .org-budget-table td, .fin-table th, .fin-table td,
.table-wrap table:not(.fin-list) th, .table-wrap table:not(.fin-list) td { border-color: var(--grid); }
.record-table th { box-shadow: 0 1px 0 var(--grid); }

/* every table, everywhere, gets the visible grid (the Intacct-style reports list is the one deliberate exception) */
table:not(.fin-list) th, table:not(.fin-list) td { border-color: var(--grid); }
