:root {
  /* The Clarity Agency brand (theclarityagency.com). --brand and --accent switch to a client's colors on her dashboard. */
  --ink: #021726;
  --navy: #003056;
  --sky: #74A7D0;
  --sky-text: #1D5078;
  --stone: #EEF3F8;
  --brand: var(--navy);
  --accent: var(--sky-text);
  --bg: #FBFCFE;
  --panel: #FFFFFF;
  --fg: var(--ink);
  --fg-muted: #4A6077;
  --line: #DBE5EF;
  --rule: #C3D6E7;
  --muted-bar: #C4D6E8;
  --good: #2F7A4F;
  --bad: #B4413C;
  --warn: #8A6100;
  --radius: 4px;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--sans); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
body { font-variant-numeric: tabular-nums; }
a { color: var(--brand); }
.hidden { display: none; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 8px 20px 48px; }
.loading { padding: 80px 0; text-align: center; color: var(--fg-muted); }

/* Top bar */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 16px 20px; max-width: 1180px; margin: 0 auto; border-bottom: 1px solid var(--line); }
.topbar:empty { display: none; }
.wordmark { display: inline-flex; align-items: center; text-decoration: none; color: var(--ink); }
/* Logo lives in /assets (path is relative to this stylesheet, so it works on every page). */
.clarity-logo { display: block; width: 168px; height: 29px; background: url('assets/clarity-logo.png') left center / contain no-repeat; }
.auth .clarity-logo { width: 200px; height: 34px; margin: 0 auto 10px; background-position: center; }
.eyebrow, .tile .lbl, .lbl, th, .auth-brand { text-transform: uppercase; letter-spacing: .16em; font-weight: 600; }
.top-right { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.demo-tag { background: #FFF4C2; color: #5A4500; padding: 3px 10px; border-radius: 2px; font-weight: 600; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.demo-role select { font: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 3px 6px; background: var(--panel); }

/* Header */
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 8px 0 18px; }
.dash-head h1 { font-family: var(--serif); font-weight: 400; font-size: 42px; line-height: 1.05; margin: 0; letter-spacing: -.01em; }
.back { display: inline-block; font-size: 13px; text-decoration: none; color: var(--fg-muted); margin-bottom: 8px; }
.brandline { display: flex; gap: 14px; align-items: center; }
.logo { height: 56px; max-width: 150px; object-fit: contain; border-radius: var(--radius); }
.meta { color: var(--fg-muted); font-size: 13px; margin-top: 4px; }
.badge { display: inline-block; background: var(--stone); color: var(--brand); padding: 3px 10px; border-radius: 2px; font-weight: 600; font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.import-result { flex-basis: 100%; }
.import-result:empty { display: none; }
.banner { border-radius: var(--radius); padding: 14px 18px; font-size: 14px; border: 1px solid transparent; }
.banner ul { margin: 6px 0 0; padding-left: 18px; }
.banner.ok { background: var(--stone); color: var(--ink); border-color: var(--rule); }
.banner.bad { background: #FBEDEC; color: var(--bad); border-color: #F0CFCC; }

/* Buttons and inputs */
.btn { font: inherit; font-size: 11.5px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; border: 1px solid var(--rule); background: var(--panel); color: var(--brand); border-radius: 3px; padding: 11px 18px; cursor: pointer; line-height: 1.2; }
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #FBFCFE; }
.btn.primary:hover { filter: brightness(1.15); }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; padding: 11px; margin-top: 6px; }
.link-btn { font: inherit; font-size: 13px; background: none; border: 0; color: var(--fg-muted); cursor: pointer; text-decoration: underline; padding: 6px 0; }
.icon { border: 0; background: none; color: var(--fg-muted); font-size: 18px; cursor: pointer; line-height: 1; padding: 2px 6px; border-radius: 6px; }
.icon:hover { color: var(--bad); background: #FBEDEC; }
input, select, textarea { font: inherit; color: var(--fg); }
input:not([type=checkbox]), select, textarea { border: 1px solid var(--rule); border-radius: 3px; padding: 8px 10px; background: var(--panel); min-width: 0; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 1px; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }
.cell { width: 100%; border-color: transparent !important; background: transparent !important; padding: 5px 6px !important; }
.cell:hover, .cell:focus { border-color: var(--line) !important; background: var(--panel) !important; }
.cell.num { text-align: right; max-width: 110px; }
.field { display: grid; gap: 4px; font-size: 13px; color: var(--fg-muted); }
.field input, .field select { width: 100%; color: var(--fg); }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--fg-muted); margin-top: 12px; }

/* Summary */
.take { font-family: var(--serif); font-size: 24px; font-weight: 400; line-height: 1.35; color: var(--fg); margin: 0 0 20px; max-width: 860px; }
.take b { color: var(--accent); font-weight: 500; font-style: italic; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 12px; margin-bottom: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; position: relative; min-width: 0; }
.card + .card, .grid + .card, .card + .grid, .grid + .grid { margin-top: 14px; }
.grid > .card { margin-top: 0; }
.card h3 { font-family: var(--serif); font-size: 26px; font-weight: 400; line-height: 1.15; margin: 0; letter-spacing: -.005em; }
.note { font-size: 13px; color: var(--fg-muted); margin: 6px 0 16px; }
.tile .lbl, .lbl { font-size: 10.5px; color: var(--sky-text); }
.big { font-family: var(--serif); font-size: 38px; font-weight: 400; line-height: 1.05; margin-top: 8px; letter-spacing: -.01em; }
.sub { font-size: 12px; color: var(--fg-muted); margin-top: 6px; }
.good { color: var(--good); }
.bad { color: var(--bad); }
.muted { color: var(--fg-muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 14px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 6px 0 18px; overflow-x: auto; }
.tabs a { padding: 12px 16px; text-decoration: none; color: var(--fg-muted); font-weight: 600; font-size: 11.5px; letter-spacing: .18em; text-transform: uppercase; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }

/* Call prep */
.call .row, .note-form .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0 4px; }
.call input[type=date] { font-family: var(--serif); font-size: 26px; padding: 4px 10px; }
.agenda { margin: 0; padding-left: 22px; display: grid; gap: 12px; }
.agenda li { padding-left: 4px; }
.agenda strong { display: block; font-weight: 600; }
.agenda span { color: var(--fg-muted); font-size: 14px; }
.note-form { display: grid; gap: 8px; margin-bottom: 16px; }
.note-form textarea { width: 100%; resize: vertical; }
.note-form .btn { justify-self: start; }
.notes { display: grid; gap: 12px; max-height: 360px; overflow: auto; }
.note-item p { margin: 2px 0 0; white-space: pre-wrap; }
.add-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.add-row input[name=item], .add-row input[name=strategy], .add-row input[name=client_name] { flex: 1 1 240px; }

/* Tables */
.tbl { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 10px; color: var(--fg-muted); border-bottom: 1px solid var(--rule); padding: 6px 10px 9px 0; white-space: nowrap; }
td { padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
td.grow { min-width: 180px; }
.r { text-align: right; }
tr.tot td { font-weight: 600; border-bottom: none; }
tr.done td { color: var(--fg-muted); }
tr.done td.grow:first-of-type input, tr.done td.grow:nth-child(2) { text-decoration: line-through; }
td.empty { color: var(--fg-muted); text-align: center; padding: 18px; }
tr.link { cursor: pointer; }
tr.link:hover td { background: var(--stone); }
.pill { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 2px; white-space: nowrap; background: var(--stone); color: var(--fg-muted); }
.pill.overdue { background: #FBEDEC; color: var(--bad); }
.pill.due-before-call { background: #FFF4C2; color: #5A4500; }
.pill.internal { background: #ECEAF4; color: #4F4A6E; margin-left: 8px; }
tr.internal td { background: color-mix(in srgb, #ECEAF4 45%, transparent); }
.check.inline { margin: 0; }
.pill.done { background: #EAF5EE; color: var(--good); }

/* Charts */
.chart { position: relative; min-height: 200px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--fg-muted); margin-bottom: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
svg text { font-family: var(--sans); }
.axis text { fill: var(--fg-muted); font-size: 12px; }
.axis path, .axis line { stroke: var(--line); }
.grid-l path { display: none; }
.lab { fill: var(--fg); font-size: 12px; }
.lab.muted { fill: var(--fg-muted); }
.lab.strong { font-weight: 600; }
.ref { stroke: var(--rule); stroke-dasharray: 3 3; }
.zero { stroke: var(--rule); }
.tip { position: absolute; display: none; z-index: 5; pointer-events: none; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 8px 24px rgba(2, 23, 38, .10); padding: 8px 10px; font-size: 12px; white-space: nowrap; }
.tip-h { color: var(--fg-muted); margin-bottom: 2px; }
.tip .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.empty-chart { display: flex; align-items: center; justify-content: center; min-height: 160px; color: var(--fg-muted); font-size: 13px; text-align: center; }

/* Settings */
.settings { display: none; margin-bottom: 18px; }
.settings.open { display: block; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; }
.settings-grid input[type=color] { height: 38px; padding: 3px; }
.settings-actions { display: flex; align-items: end; }

/* Auth */
.auth { min-height: 80vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: min(420px, 100%); padding: 32px; }
.auth-card { text-align: center; }
.auth-card form { text-align: left; }
.auth-card h1 { font-family: var(--serif); font-weight: 300; font-size: 40px; line-height: 1.1; margin: 14px 0 18px; }
.auth-card form { display: grid; gap: 12px; }
.auth-brand { font-size: 10.5px; color: var(--sky-text); }
.qr-wrap { display: grid; justify-items: center; gap: 4px; }
.qr { width: 180px; height: 180px; }
.qr-wrap code { font-size: 12px; word-break: break-all; }
.empty-state { max-width: 560px; margin: 60px auto; text-align: center; }
.empty-state h1 { font-family: var(--serif); font-weight: 400; }

/* Where did the money go? (palette validated for color-blind separation; every slice is also labeled) */
:root { --split-product: #2A78D6; --split-team: #EB6834; --split-overhead: #1BAF7A; --split-owner: #EDA100; --split-saved: #E87BA4; --split-kept: #008300; }
.split { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 28px; align-items: center; }
.donut { position: relative; display: flex; justify-content: center; }
.donut-big { font-family: var(--serif); font-size: 40px; fill: var(--ink); }
.split-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.split-legend li { display: grid; grid-template-columns: 12px 58px minmax(0, 1fr) 64px; gap: 12px; align-items: baseline; padding: 9px 4px; border-bottom: 1px solid var(--line); transition: opacity .15s; }
.split-legend li.over { color: var(--bad); }
.split-legend li.over i { background: repeating-linear-gradient(135deg, var(--bad) 0 2px, transparent 2px 4px); border: 1px solid var(--bad); }
.split-legend li.total { border-bottom: 0; border-top: 1px solid var(--rule); font-weight: 600; }
.split-legend li.total i { visibility: hidden; }
.split-legend .cents { text-align: right; }
.bad-fill { fill: var(--bad); }
.split-legend li.dim { opacity: .4; }
.split-legend i { width: 12px; height: 12px; border-radius: 3px; align-self: center; }
.split-legend .cents { font-family: var(--serif); font-size: 26px; line-height: 1; }
.split-legend .amt { text-align: right; font-size: 13px; }
@media (max-width: 640px) { .split { grid-template-columns: 1fr; } }

.access { border-bottom: 1px solid var(--line); padding-bottom: 18px; margin: 14px 0 18px; }
.access h4, .settings h4 { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--sky-text); margin: 0; }

/* QuickBooks detail */
.banner { position: relative; padding-right: 40px; }
.banner strong { display: block; margin-top: 4px; }
.banner .dismiss { position: absolute; top: 8px; right: 8px; color: inherit; }
.acct-list { display: grid; }
.acct { border-bottom: 1px solid var(--line); }
.acct summary { display: grid; grid-template-columns: minmax(120px, 1.3fr) minmax(50px, 1fr) 92px 48px; gap: 12px; align-items: center; padding: 9px 0; cursor: pointer; list-style: none; font-size: 14px; }
.acct summary::-webkit-details-marker { display: none; }
.acct summary .name::before { content: '›'; display: inline-block; width: 14px; color: var(--fg-muted); transition: transform .15s; }
.acct[open] summary .name::before { transform: rotate(90deg); }
.acct .bar { height: 8px; background: color-mix(in srgb, var(--muted-bar) 55%, transparent); border-radius: 99px; overflow: hidden; }
.acct .bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.acct .amt { text-align: right; font-weight: 500; }
.acct .pctrev { text-align: right; font-size: 12px; }
.acct .tbl { margin: 0 0 12px 14px; }
details.edit { margin-top: 14px; }
details.edit > summary { cursor: pointer; font-size: 13px; font-weight: 500; color: var(--brand); padding: 4px 0; }
details.edit[open] > summary { margin-bottom: 8px; }
tr.review td { background: color-mix(in srgb, #FFF4C2 55%, transparent); }
.small { font-size: 12px; }

.foot { text-align: center; color: var(--fg-muted); font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; font-weight: 600; margin-top: 44px; padding-top: 20px; border-top: 1px solid var(--line); }
.foot a { color: inherit; text-decoration: none; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; transition: all .2s ease; background: var(--ink); color: #FBFCFE; padding: 11px 18px; border-radius: 3px; font-size: 14px; z-index: 50; pointer-events: none; max-width: min(92vw, 560px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--bad); }

@media (max-width: 600px) {
  .wrap { padding: 4px 14px 40px; }
  .dash-head h1 { font-size: 32px; }
  .big { font-size: 30px; }
  .take { font-size: 20px; }
  .card { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
/* Cormorant defaults to old-style figures; money reads better with even, lining digits. */
.big, .donut-big, .split-legend .cents, .take, .call input[type=date], .dash-head h1 { font-variant-numeric: lining-nums tabular-nums; }
