/* Storm Brain A/R dashboard
   Bento layout, soft brand tints. Dark by default (Decisions pages default to light); the Dark/Light button switches
   [data-theme] on <html> and the choice is remembered per page group.
   One data color (brand purple) for every bar, meter, ring and line. Pastel tiles carry the brand colors quietly.
   Type: Sofia Pro, weights 400 and 500 only (installed on the team's machines; never served from here). */

:root {
  /* brand primitives */
  --purple: #5C63FA;
  --violet: #A868FA;
  --cyan: #74DFFF;
  --yellow: #FEE952;
  --mint: #7BF9CA;
  --cream: #E5DBD3;
  --navy: #0D0D29;
  --dark: #1C1C1C;

  /* light theme: surfaces */
  --frame: #F3EFEB;
  --on-frame: #1C1C1C;
  --on-frame-muted: #625B55;
  --frame-line: rgba(28, 28, 28, .14);
  --card: #FFFFFF;
  --card-2: #F7F4F1;
  --card-3: #EEE9E4;
  --border: rgba(28, 28, 28, .06);
  --text: #1C1C1C;
  --muted: #625B55;
  --line: rgba(28, 28, 28, .07);
  --line-strong: rgba(28, 28, 28, .15);
  --link: #3D44D6;
  --hover: rgba(92, 99, 250, .04);
  --shadow: 0 1px 2px rgba(28, 28, 28, .04), 0 6px 20px -10px rgba(28, 28, 28, .10);

  /* light theme: tiles (soft brand tints) */
  --t-lav: #EDEEFE;
  --t-mint: #DFFEF2;
  --t-yellow: #FFF8C8;
  --t-cyan: #E0F8FF;
  --t-violet: #F5EDFE;
  --on-tint-muted: #5A5660;

  /* light theme: pills */
  --p-mint: #C8FCE9;
  --p-yellow: #FEF3A0;
  --p-cyan: #CAF3FF;
  --p-violet: #EADBFE;
  --p-sev: #DEE0FE;
  --on-sev: #2F35B8;

  /* data + actions */
  --data: #5C63FA;
  --data-track: rgba(92, 99, 250, .14);
  --btn: #5C63FA;
  --btn-hover: #4D54EE;
  --on-btn: #FFFFFF;
  --nav-on: #EDEEFE;
  --on-nav-on: #2F35B8;
  --focus: #5C63FA;

  --r-tile: 24px;
  --r-inner: 16px;
  --r-sm: 12px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --font: "Sofia Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --frame: #101128;
  --on-frame: #ECE8F2;
  --on-frame-muted: #A9A7C7;
  --frame-line: rgba(236, 232, 242, .16);
  --card: #1A1B3A;
  --card-2: #212246;
  --card-3: #2A2C54;
  --border: rgba(255, 255, 255, .05);
  --text: #ECE8F2;
  --muted: #A9A7C7;
  --line: rgba(255, 255, 255, .07);
  --line-strong: rgba(255, 255, 255, .15);
  --link: #AEB2FF;
  --hover: rgba(140, 146, 255, .05);
  --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 8px 24px -12px rgba(0, 0, 0, .5);

  --t-lav: #26285D;
  --t-mint: #1E2B42;
  --t-yellow: #23243F;
  --t-cyan: #1F2B48;
  --t-violet: #2B2556;
  --on-tint-muted: #B5B2CF;

  --p-mint: #33555F;
  --p-yellow: #514C40;
  --p-cyan: #314E6D;
  --p-violet: #453274;
  --p-sev: #36398B;
  --on-sev: #DADCFF;

  --data: #8C92FF;
  --data-track: rgba(140, 146, 255, .16);
  --btn: #5C63FA;
  --btn-hover: #6B72FB;
  --on-btn: #FFFFFF;
  --nav-on: #2C2E66;
  --on-nav-on: #DADCFF;
  --focus: #8C92FF;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--frame); }
body { margin: 0; background: var(--frame); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.5; font-weight: 400; -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
strong, b { font-weight: 500; }
h1, h2, h3 { margin: 0 0 12px; font-weight: 500; letter-spacing: -0.015em; }
h1 { font-size: 26px; } h2 { font-size: 17px; } h3 { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-top: 18px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .nowrap { white-space: nowrap; }
.good, .warn { color: inherit; }
.bad { color: inherit; font-weight: 500; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
a, button, .btn, .opt, .qa a, .side-nav a, .theme-btn, .round { transition: background-color .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease), box-shadow .18s var(--ease), transform .18s var(--ease); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ------------------------------------------------------------------ shell */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); gap: 22px; padding: 16px 22px 0 16px; max-width: 1640px; margin: 0 auto; }
.side { position: relative; }
.side-card { position: sticky; top: 16px; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-tile); padding: 20px 14px 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 4px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand .logo { height: 24px; width: auto; display: block; }
.brand .sub { font-size: 12px; font-weight: 500; letter-spacing: .12em; color: var(--muted); padding-left: 10px; border-left: 1px solid var(--line-strong); line-height: 18px; }
.logo-light { display: none !important; }
:root[data-theme="dark"] .logo-dark { display: none !important; }
:root[data-theme="dark"] .logo-light { display: block !important; }

.side-search { display: flex; align-items: center; gap: 8px; background: var(--card-2); border: 1px solid var(--border); border-radius: 999px; padding: 0 14px; color: var(--muted); }
.side-search input { background: transparent; border: 0; padding: 10px 0; flex: 1; min-width: 0; color: var(--text); font-size: 14px; }
.side-search input:focus { outline: none; }
.side-search:focus-within { box-shadow: 0 0 0 2px var(--focus); }

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav .sec { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 14px 14px 6px; }
.side-nav a { display: flex; align-items: center; gap: 12px; padding: 10px 14px; min-height: 44px; border-radius: 999px; color: var(--text); font-weight: 500; font-size: 14.5px; }
.side-nav a svg.i { color: var(--muted); }
.side-nav a:hover { background: var(--card-2); text-decoration: none; }
.side-nav a.on { background: var(--nav-on); color: var(--on-nav-on); }
.side-nav a.on svg.i { color: var(--on-nav-on); }
.side-nav a .count { margin-left: auto; background: var(--p-yellow); color: var(--text); border-radius: 999px; font-size: 12px; padding: 1px 8px; min-width: 24px; text-align: center; }
:root[data-theme="dark"] .side-nav a .count, :root[data-theme="dark"] .pill.warn { background: var(--p-violet); }

.side-sync { background: var(--t-mint); border-radius: var(--r-inner); padding: 14px 16px; display: flex; flex-direction: column; gap: 3px; }
.side-sync .t { font-weight: 500; }
.side-sync .s { font-size: 13px; color: var(--on-tint-muted); }
.side-sync a { color: var(--text); font-weight: 500; font-size: 13px; margin-top: 4px; }

.side-user { display: flex; align-items: center; gap: 10px; padding: 4px 6px 2px; }
.side-user .who { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.side-user .who span { font-size: 12.5px; color: var(--muted); }
.side-user .out { margin-left: auto; color: var(--muted); width: 40px; height: 40px; border-radius: 999px; display: inline-grid; place-items: center; }
.side-user .out:hover { background: var(--card-2); color: var(--text); }

.page { min-width: 0; padding-bottom: 8px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 12px 4px 22px; color: var(--on-frame); flex-wrap: wrap; }
.page-head h1 { font-size: 36px; line-height: 1.1; letter-spacing: -0.03em; margin: 0 0 6px; text-wrap: balance; }
.page-head .lede { margin: 0; color: var(--on-frame-muted); font-size: 15px; }
.page-head .lede a { color: var(--on-frame); text-decoration: underline; text-decoration-color: var(--frame-line); text-underline-offset: 3px; }
.head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding-top: 4px; }
.chip-frame { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--frame-line); color: var(--on-frame); border-radius: 999px; padding: 0 16px; min-height: 44px; font-weight: 500; font-size: 14px; white-space: nowrap; }
.chip-frame .muted { color: var(--on-frame-muted); font-weight: 400; }
.chip-frame svg.i { color: var(--on-frame-muted); }
.theme-btn { display: inline-flex; align-items: center; gap: 8px; background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 999px; padding: 0 18px; min-height: 44px; font-weight: 500; font-size: 14px; box-shadow: var(--shadow); }
.theme-btn:hover { background: var(--card-2); filter: none; }
.theme-btn .when-dark { display: none; }
:root[data-theme="dark"] .theme-btn .when-dark { display: inline-flex; }
:root[data-theme="dark"] .theme-btn .when-light { display: none; }
.theme-btn span { display: inline-flex; align-items: center; gap: 8px; }

main { min-width: 0; }
.foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 22px 6px 26px; font-size: 13px; color: var(--on-frame-muted); }
.foot a { color: var(--on-frame-muted); }

/* ------------------------------------------------------------------ cards */
.card, .tile { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-tile); padding: 24px 26px; box-shadow: var(--shadow); min-width: 0; }
.card { margin-bottom: 18px; overflow-x: auto; }
.card > h2:first-child, .tile > h2:first-child { margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.rowhead { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.rowhead h1, .rowhead h2 { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.empty { text-align: center; padding: 90px 20px; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-tile); box-shadow: var(--shadow); }
.viewall { display: inline-flex; align-items: center; gap: 4px; font-size: 13.5px; color: var(--text); font-weight: 500; }
.viewall svg.i { width: 15px; height: 15px; }

/* tinted tiles */
.t-lav { background: var(--t-lav); } .t-mint { background: var(--t-mint); } .t-yellow { background: var(--t-yellow); } .t-cyan { background: var(--t-cyan); } .t-violet { background: var(--t-violet); }
.t-lav, .t-mint, .t-yellow, .t-cyan, .t-violet { border-color: transparent; }
/* dark: warm/cool glows instead of muddy flat tints */
:root[data-theme="dark"] .t-yellow { background-image: radial-gradient(120% 100% at 100% 0%, rgba(254, 233, 82, .13), transparent 62%); }
:root[data-theme="dark"] .t-mint { background-image: radial-gradient(120% 100% at 100% 0%, rgba(123, 249, 202, .12), transparent 62%); }
:root[data-theme="dark"] .t-cyan { background-image: radial-gradient(120% 100% at 100% 0%, rgba(116, 223, 255, .13), transparent 62%); }
:root[data-theme="dark"] .side-sync { background-image: radial-gradient(140% 120% at 100% 0%, rgba(123, 249, 202, .12), transparent 62%); }
.t-lav .muted, .t-mint .muted, .t-yellow .muted, .t-cyan .muted, .t-violet .muted { color: var(--on-tint-muted); }

/* ------------------------------------------------------------------ bento (overview) */
.bento { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 18px; }
.b-hero { grid-column: span 5; grid-row: span 2; display: flex; flex-direction: column; }
.b-donut { grid-column: span 3; }
.b-trend { grid-column: span 4; }
.b-run { grid-column: span 4; }
.b-cta { grid-column: span 3; }
.b-table { grid-column: span 12; overflow-x: auto; }
.b-num { grid-column: span 2; }
.b-quick { grid-column: span 4; }
.b-replies { grid-column: span 7; }
.b-since { grid-column: span 5; }

.tile-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.tile-head h2 { margin: 0; font-size: 16.5px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 500; white-space: nowrap; background: var(--card-3); color: var(--text); }
.tile[class*="t-"] .chip { background: var(--card); }
.chip svg.i { width: 14px; height: 14px; }

.mega { font-size: 68px; line-height: 1; font-weight: 500; letter-spacing: -0.045em; font-variant-numeric: tabular-nums; margin: 18px 0 12px; white-space: nowrap; }
.big { font-size: 44px; line-height: 1; font-weight: 500; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; margin: 8px 0 6px; }
.tile-sub { margin: 0; font-size: 14px; }
.big-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.big-row .big { margin: 6px 0 2px; }

/* bucket bars in the hero tile: one series, one color, values labeled directly */
.bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: end; margin-top: auto; padding-top: 26px; height: 270px; }
.bar-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.bar-val { font-size: 13.5px; font-weight: 500; font-variant-numeric: tabular-nums; }
.bar { width: 100%; max-width: 72px; border-radius: 14px; min-height: 10px; background: var(--data); }
.bar-lbl { font-size: 13px; color: var(--on-tint-muted); white-space: nowrap; }
.goal { margin-top: 20px; }
.goal-row { display: flex; justify-content: space-between; font-weight: 500; margin-bottom: 8px; font-size: 14px; }
.meter { height: 8px; border-radius: 999px; background: var(--data-track); overflow: hidden; }
.meter > div { height: 100%; border-radius: 999px; background: var(--data); }

/* donut */
.donut-row { display: flex; align-items: center; gap: 16px; margin-top: 14px; }
.donut { position: relative; width: 92px; height: 92px; flex: none; }
.donut svg { width: 92px; height: 92px; transform: rotate(-90deg); }
.donut .track { stroke: var(--data-track); }
.donut .val { stroke: var(--data); }
.donut span { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 500; font-size: 19px; letter-spacing: -0.02em; }
.donut-txt { font-size: 13.5px; line-height: 1.4; }
.donut-txt strong { display: block; font-size: 14px; }

/* sparkline */
.spark { width: 100%; height: 96px; display: block; margin: 6px 0 8px; overflow: visible; }
.spark .area { fill: var(--data); opacity: .10; }
.spark .line { fill: none; stroke: var(--data); stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.spark .dot { fill: var(--card); stroke: var(--data); stroke-width: 2.25; }
:root[data-theme="dark"] .spark .area { opacity: .16; }
.spark-empty { height: 96px; display: grid; place-items: center; border: 1px dashed var(--line-strong); border-radius: var(--r-inner); margin: 6px 0 8px; font-size: 13.5px; color: var(--muted); text-align: center; padding: 0 16px; }

/* run list (mint tile) */
.runlist { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 13px; }
.runlist li { display: grid; grid-template-columns: minmax(0, 1fr) 80px 30px; align-items: center; gap: 12px; font-size: 14px; }
.runlist .meter { height: 6px; background: rgba(28, 28, 28, .07); }
:root[data-theme="dark"] .runlist .meter { background: rgba(255, 255, 255, .08); }
.runlist .n { text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }

/* call-to-action tile */
.b-cta { display: flex; flex-direction: column; }
.cta-title { font-size: 28px; line-height: 1.1; letter-spacing: -0.03em; font-weight: 500; margin: 0 0 10px; text-wrap: balance; }
.cta-foot { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding-top: 18px; }
.cta-foot p { margin: 0; font-size: 13.5px; }
.cta-foot p a { color: var(--text); font-weight: 500; }
a.round { width: 48px; height: 48px; border-radius: 999px; background: var(--btn); color: var(--on-btn); display: grid; place-items: center; flex: none; }
a.round:hover { background: var(--btn-hover); transform: translateX(2px); text-decoration: none; }
a.round svg.i { width: 20px; height: 20px; }

/* number tiles */
.b-num { display: flex; flex-direction: column; min-height: 220px; padding: 22px 22px 20px; }
.b-num .big { font-size: 46px; margin: 0; }
.b-num .lbl { margin-top: auto; font-weight: 500; font-size: 14px; }
.b-num .sub { font-size: 13px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* quick actions */
.qa { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 4px; }
.qa a { background: var(--card); color: var(--text); border-radius: var(--r-inner); padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 12px; font-weight: 500; min-height: 84px; font-size: 14px; box-shadow: 0 1px 2px rgba(28, 28, 28, .04); }
.qa a svg.i { color: var(--data); width: 20px; height: 20px; }
.qa a:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); }
:root[data-theme="dark"] .qa a { background: rgba(255, 255, 255, .06); box-shadow: none; }
:root[data-theme="dark"] .qa a:hover { background: rgba(255, 255, 255, .10); }

/* avatar lists (replies, since last run) */
.av { width: 34px; height: 34px; border-radius: 999px; display: inline-grid; place-items: center; font-size: 11.5px; font-weight: 500; letter-spacing: .02em; flex: none; background: var(--card-3); color: var(--text); }
.av.b-1-30 { background: var(--p-cyan); }
.av.b-31-60 { background: var(--p-yellow); }
.av.b-61-90 { background: var(--p-violet); }
.av.b-91 { background: var(--p-sev); color: var(--on-sev); }
.av.good { background: var(--p-mint); }
.av.ink { background: var(--nav-on); color: var(--on-nav-on); }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 14px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }
.feed .body { flex: 1; min-width: 0; padding-top: 6px; }
.feed .body a { color: var(--text); font-weight: 500; }
.feed .when { font-size: 12.5px; color: var(--muted); white-space: nowrap; padding-top: 8px; }
.notes { margin: 14px 0 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; }

/* ------------------------------------------------------------------ tables */
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl th { color: var(--muted); font-weight: 400; font-size: 13px; white-space: nowrap; padding-top: 4px; padding-bottom: 10px; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--hover); }
.tbl td a { color: var(--text); font-weight: 500; }
.tbl td.small a, .tbl td .small a { font-weight: 400; color: var(--link); }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl td.num { font-weight: 500; }
.tbl tr.dim { opacity: .6; }
.sortable th { cursor: pointer; user-select: none; }
.sortable th:hover { color: var(--text); }
.sortable th.asc::after { content: " ▲"; font-size: 9px; } .sortable th.desc::after { content: " ▼"; font-size: 9px; }
.events td { font-size: 14px; }
.tbl td.plan { max-width: 420px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.who-cell { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.who-cell .av { width: 32px; height: 32px; font-size: 11px; }

/* ------------------------------------------------------------------ pills + tags */
.pill { display: inline-block; min-width: 24px; padding: 1px 9px; border-radius: 999px; background: var(--card-3); color: var(--text); font-size: 12.5px; font-weight: 500; text-align: center; vertical-align: middle; letter-spacing: 0; }
.pill.warn { background: var(--p-yellow); }
.tag { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--card-3); color: var(--text); font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.tag.good, .tag.paid_detected, .tag.email_replied, .tag.payment_promised, .tag.books_check_cleared { background: var(--p-mint); }
.tag.bad, .tag.new_overdue, .tag.bad_debt_marked, .tag.bad_debt_requested, .tag.bad_debt_pending, .tag.bad_debt_written_off, .tag.written_off_detected { background: var(--p-sev); color: var(--on-sev); }
.tag.warn, .tag.flagged, .tag.hold, .tag.books_check_requested { background: var(--p-yellow); }
.tag.qb_reminder_sent, .tag.email_sent, .tag.decision { background: var(--p-violet); }
.tag.qb_reminder_queued, .tag.email_drafted, .tag.invoice_viewed { background: var(--p-cyan); }
.tag.muted { color: var(--muted); }
.bucket { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 500; white-space: nowrap; color: var(--text); }
.bucket.current { color: var(--muted); background: var(--card-3); }
.bucket.\31 -30 { background: var(--p-cyan); }
.bucket.\33 1-60 { background: var(--p-yellow); }
.bucket.\36 1-90 { background: var(--p-violet); }
.bucket.\39 1\+ { background: var(--p-sev); color: var(--on-sev); }
a.ext { display: inline-block; font-size: 11px; font-weight: 500; letter-spacing: .04em; padding: 1px 7px; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--muted); margin-left: 6px; vertical-align: 1px; }
a.ext:hover { color: var(--text); border-color: var(--data); text-decoration: none; }
.tbl td a.ext { font-weight: 500; color: var(--muted); }

/* ------------------------------------------------------------------ lists + facts */
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 8px; }
.facts > div { display: flex; flex-direction: column; gap: 3px; background: var(--card-2); border-radius: var(--r-inner); padding: 14px 16px; min-width: 0; overflow-wrap: anywhere; }
.facts .wide { grid-column: span 2; }
.facts .label { color: var(--muted); font-size: 12.5px; }
.facts strong { font-size: 16px; }
.decision { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.decision:last-of-type { border-bottom: 0; }

/* KPI tiles (invoice page) */
.kpis { display: grid; grid-template-columns: 2fr repeat(4, 1fr); gap: 18px; margin-bottom: 18px; }
.kpis.four { grid-template-columns: repeat(4, 1fr); }
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-tile); padding: 20px 22px; box-shadow: var(--shadow); min-height: 150px; display: flex; flex-direction: column; }
.kpi:nth-child(1) { background: var(--t-lav); border-color: transparent; }
.kpi:nth-child(2) { background: var(--t-cyan); border-color: transparent; }
.kpi:nth-child(1) .muted, .kpi:nth-child(2) .muted, .kpi:nth-child(1) .label, .kpi:nth-child(2) .label { color: var(--on-tint-muted); }
.kpi .label { color: var(--muted); font-size: 13.5px; font-weight: 500; order: 3; margin-top: auto; padding-top: 14px; }
.kpi .value { font-size: 28px; font-weight: 500; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .value.small { font-size: 24px; }
.kpi .sub { font-size: 13px; order: 4; }

/* ------------------------------------------------------------------ decisions */
.decision-form { padding: 20px 0; border-bottom: 1px solid var(--line); }
.decision-form:first-of-type { padding-top: 6px; }
.decision-form:last-of-type { border-bottom: 0; padding-bottom: 4px; }
.dtitle { font-size: 17px; font-weight: 500; margin-bottom: 4px; letter-spacing: -0.01em; }
.dtitle a { color: var(--text); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.dnote { margin-bottom: 12px; max-width: 900px; }
.options { display: flex; flex-direction: column; gap: 8px; max-width: 900px; }
.opt { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; background: var(--card-2); border: 1.5px solid transparent; border-radius: var(--r-inner); cursor: pointer; color: var(--text); font-size: 15px; flex-direction: row; }
.opt:hover { border-color: var(--line-strong); }
.opt:has(input:checked) { border-color: var(--data); background: var(--t-lav); }
.opt.rec { box-shadow: inset 3px 0 0 var(--mint); }
.opt.bad { border-style: dashed; border-color: var(--line-strong); }
.opt.bad:has(input:checked) { border-color: var(--data); }
.dinv { max-width: 900px; margin: 6px 0 12px; padding: 12px 16px; background: var(--card-2); border-radius: var(--r-inner); }
.dinv .label { color: var(--muted); font-size: 12.5px; margin-bottom: 6px; }
.dinv .inv { display: flex; gap: 10px; align-items: center; flex-direction: row; font-size: 14px; color: var(--text); padding: 3px 0; }
.dinv .inv input, .opt input { accent-color: var(--purple); }
.opt input { margin-top: 4px; }
.otext { display: flex; flex-direction: column; gap: 2px; }
.oline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.options textarea { background: var(--card-2); color: var(--text); border: 1.5px solid transparent; border-radius: var(--r-inner); padding: 12px 16px; font: inherit; resize: vertical; }
.options textarea:focus { outline: none; border-color: var(--data); }
.dactions { display: flex; gap: 12px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.dactions .muted { flex: 1; min-width: 240px; }
.wizard .decision-form { border-bottom: 0; }
.progress { height: 8px; background: var(--data-track); border-radius: 999px; overflow: hidden; margin: 2px 0 16px; }
.progress div { height: 100%; background: var(--data); border-radius: 999px; }

/* ------------------------------------------------------------------ rules */
.ladder { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 4px 0 16px; }
.rung { background: var(--card-2); border-radius: var(--r-inner); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.rung.own { background: var(--t-lav); }
.rung .label, .instr .label, .rnotes .label, .rhist .label { color: var(--muted); font-size: 12.5px; }
.rung .acts { display: flex; flex-wrap: wrap; gap: 6px; }
.act { display: inline-block; padding: 2px 9px; border-radius: 999px; background: var(--card); font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.instr { margin: 0 0 12px; }
.instr ul, .rhist ul { margin: 4px 0 0; padding-left: 18px; }
.instr li, .rhist li { margin: 3px 0; }
.rnotes { margin: 0 0 12px; display: flex; flex-direction: column; gap: 2px; max-width: 980px; }
.rhist { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13.5px; }
details.edit { margin-top: 6px; }
details.edit > summary { list-style: none; cursor: pointer; display: inline-block; }
details.edit > summary::-webkit-details-marker { display: none; }
details.edit[open] > summary .btn { background: var(--card-2); }
.rules-form { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; max-width: 980px; }
.rules-form textarea { background: var(--card-2); color: var(--text); border: 1.5px solid var(--border); border-radius: var(--r-sm); padding: 10px 12px; font: inherit; font-size: 14.5px; resize: vertical; }
.rules-form textarea:focus { outline: none; border-color: var(--data); }
textarea.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; line-height: 1.5; tab-size: 2; }
.form-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form-row .grow { flex: 1; min-width: 220px; }
.saved { background: var(--t-mint); border-radius: var(--r-sm); padding: 8px 12px; margin: 0 0 12px; }
.banner { margin-bottom: 16px; }
.tag.instr-tag { background: var(--p-violet); }
.instr-line { margin-bottom: 4px; }
.options .keep { flex-direction: row; align-items: flex-start; gap: 10px; font-size: 13.5px; color: var(--text); padding: 6px 2px 0; cursor: pointer; }
.options .keep input { margin-top: 3px; accent-color: var(--purple); min-height: 0; }
@media (max-width: 960px) { .ladder { grid-template-columns: 1fr 1fr; } }

/* ------------------------------------------------------------------ forms + buttons */
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--btn); color: var(--on-btn); border: 0; border-radius: 999px; padding: 0 20px; min-height: 44px; font: inherit; font-size: 14.5px; font-weight: 500; cursor: pointer; line-height: 1.2; white-space: nowrap; }
button:hover, .btn:hover { text-decoration: none; background: var(--btn-hover); }
.btn.ghost, button.ghost { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--text); }
.btn.ghost:hover, button.ghost:hover { background: var(--card-2); }
.btn.small, button.small { padding: 0 14px; min-height: 34px; font-size: 13px; }
input, select { background: var(--card-2); color: var(--text); border: 1.5px solid var(--border); border-radius: var(--r-sm); padding: 9px 12px; min-height: 42px; font: inherit; font-size: 14.5px; }
input:focus, select:focus { outline: none; border-color: var(--data); }
input[type="checkbox"], input[type="radio"] { min-height: 0; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
form.inline { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
form.inline .grow { flex: 1; min-width: 220px; }
form.inline.compact { gap: 8px; align-items: center; }
.filter { min-width: 280px; border-radius: 999px; padding-left: 16px; }
.error { color: var(--text); background: var(--t-yellow); border-radius: var(--r-sm); padding: 8px 12px; margin: 0; }

/* ------------------------------------------------------------------ login */
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-top { position: fixed; top: 18px; right: 20px; }
.login { width: min(400px, 100%); background: var(--card); border: 1px solid var(--border); border-radius: var(--r-tile); padding: 34px 30px 30px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); }
.login .brand { justify-content: center; padding: 0 0 4px; }
.login .brand .logo { height: 28px; }
.login p { margin: 0; text-align: center; }
.login button { margin-top: 6px; }
/* one-click answer confirm page (from the email) */
.login.answer { width: min(460px, 100%); gap: 16px; }
.login.answer h1 { font-size: 22px; margin: 0; text-align: center; }
.login.answer p { text-align: left; }
.login.answer form { display: flex; flex-direction: column; gap: 12px; }
.login.answer .btn { justify-content: center; text-align: center; }
.login.answer textarea { background: var(--card-2); color: var(--text); border: 1.5px solid var(--border); border-radius: var(--r-sm); padding: 10px 12px; font: inherit; font-size: 14.5px; resize: vertical; }
.login.answer textarea:focus, .login.answer select:focus { outline: none; border-color: var(--data); }
.answer-q, .answer-a { border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; line-height: 1.45; }
.answer-q { background: var(--card-2); }
.answer-a { background: var(--t-lav, #EDEEFE); }
.answer-q .label, .answer-a .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.login-note { color: var(--on-frame-muted); font-size: 13px; text-align: center; margin-top: 16px; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1279px) {
  .bento { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .b-hero { grid-column: span 6; grid-row: auto; }
  .b-donut, .b-trend, .b-run, .b-cta, .b-num { grid-column: span 3; }
  .b-table, .b-quick, .b-replies, .b-since { grid-column: span 6; }
  .bars { height: 220px; }
  .b-num { min-height: 180px; }
  .kpis { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); padding: 12px 12px 0; gap: 14px; }
  .side-card { position: static; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px; }
  .side-card .brand { order: 1; }
  .side-user { order: 2; margin-left: auto; padding: 0; }
  .side-user .who { display: none; }
  .side-search { order: 4; flex: 1 1 100%; }
  .side-nav { order: 3; flex: 1 1 100%; flex-direction: row; overflow-x: auto; gap: 4px; scrollbar-width: none; }
  .side-nav::-webkit-scrollbar { display: none; }
  .side-nav .sec { display: none; }
  .side-nav { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); padding-right: 24px; }
  .side-nav a { padding: 9px 14px; white-space: nowrap; }
  .side-sync { display: none; }
  .page-head { padding: 6px 4px 16px; }
  .page-head h1 { font-size: 30px; }
  .grid2, .facts { grid-template-columns: 1fr 1fr; }
  .kpis, .kpis.four { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .bento { grid-template-columns: 1fr 1fr; gap: 12px; }
  .b-hero, .b-donut, .b-trend, .b-run, .b-cta, .b-table, .b-quick, .b-replies, .b-since { grid-column: span 2; }
  .b-num { grid-column: span 1; min-height: 160px; padding: 18px; }
  .b-num .big { font-size: 38px; }
  .card, .tile { padding: 20px 18px; border-radius: 22px; }
  .mega { font-size: 50px; }
  .bars { height: 190px; gap: 10px; }
  .page-head h1 { font-size: 28px; }
  .page-head .chip-frame { display: none; }
  .head-actions { gap: 8px; }
  .grid2, .facts { grid-template-columns: 1fr; }
  .facts .wide { grid-column: auto; }
  .filter { min-width: 0; width: 100%; }
  .rowhead > .filter { flex: 1 1 100%; }
  .card { margin-bottom: 12px; }
  .kpis, .kpis.four { gap: 12px; }
  .kpi { min-height: 130px; padding: 16px 18px; }
  .kpi .value, .kpi .value.small { font-size: 22px; }
}
