/* ---------- Theme tokens: "Refined Paper" — ink on warm paper, premium ---------- */
:root {
  --bg: #F3EBDD;          /* page — warm cream, a touch deeper for contrast */
  --surface: #FFFDF8;     /* cards — bright raised paper */
  --surface-2: #EAE0CE;   /* secondary buttons, chips, recessed */
  --line: #E2D7C3;        /* warm hairline */
  --text: #1C1814;        /* deep ink — higher contrast */
  --muted: #877B6B;       /* faded ink */
  --accent: #C2562E;      /* burnt orange — punchier than the old terracotta */
  --accent-weak: rgba(194,86,46,.12);
  --accent-ink: #FFF8F2;  /* text on burnt orange */
  /* Dark espresso "anchor" — the top bar + bottom nav. The dark/cream contrast is what
     reads premium-rugged (Carhartt energy). Light text rides on it. */
  --anchor: #2B231C;
  --anchor-ink: #F3EAD9;
  --anchor-muted: rgba(243,234,217,.55);
  --anchor-accent: #E8814E;   /* brighter burnt-orange for the active nav item on dark */
  --anchor-line: rgba(0,0,0,.22);
  --green: #5C7850;       /* sage — won / convert / money */
  --green-weak: rgba(92,120,80,.14);
  --amber: #B8772A;
  --red: #AE3826;
  --red-weak: rgba(174,56,38,.12);
  /* Layered, soft shadow — the single biggest "raised paper" tell */
  --shadow: 0 1px 1px rgba(50,35,18,.04), 0 2px 4px rgba(50,35,18,.04), 0 10px 28px rgba(70,48,24,.06);
  --shadow-lift: 0 2px 6px rgba(50,35,18,.07), 0 18px 44px rgba(70,48,24,.12);
  --radius: 16px;
  --radius-sm: 11px;
  --serif: "Zilla Slab", Rockwell, "Roboto Slab", Georgia, serif;  /* sturdy slab display */
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.035 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Warm sepia night mode.
   Tokens live in one place (--dark-tokens isn't a thing in CSS, so we apply the
   same declaration block via two selectors): the OS preference governs only when
   the user hasn't made an explicit choice (:root:not([data-theme])); the toggle
   sets [data-theme="dark"|"light"] on <html> to override the OS either way. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #1E1A16;
    --surface: #2A2520;
    --surface-2: #382F27;
    --line: #3A332B;
    --text: #F0E7DA;
    --muted: #AB9E8A;
    --accent: #DC8252;
    --accent-weak: rgba(220,130,82,.18);
    --accent-ink: #241710;
    --anchor: #16120D;
    --anchor-ink: #F0E7DA;
    --anchor-muted: rgba(240,231,218,.5);
    --anchor-accent: #E8884E;
    --anchor-line: rgba(255,255,255,.07);
    --green: #8FA97F;
    --green-weak: rgba(143,169,127,.18);
    --amber: #D6A552;
    --red: #E4775F;
    --red-weak: rgba(228,119,95,.18);
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 28px rgba(0,0,0,.36);
    --shadow-lift: 0 2px 6px rgba(0,0,0,.36), 0 18px 44px rgba(0,0,0,.5);
    /* lighter grain so texture reads on dark surfaces */
    --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.025 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  }
}
:root[data-theme="dark"] {
  --bg: #1E1A16;
  --surface: #2A2520;
  --surface-2: #382F27;
  --line: #3A332B;
  --text: #F0E7DA;
  --muted: #AB9E8A;
  --accent: #DC8252;
  --accent-weak: rgba(220,130,82,.18);
  --accent-ink: #241710;
  --anchor: #16120D;
  --anchor-ink: #F0E7DA;
  --anchor-muted: rgba(240,231,218,.5);
  --anchor-accent: #E8884E;
  --anchor-line: rgba(255,255,255,.07);
  --green: #8FA97F;
  --green-weak: rgba(143,169,127,.18);
  --amber: #D6A552;
  --red: #E4775F;
  --red-weak: rgba(228,119,95,.18);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 28px rgba(0,0,0,.36);
  --shadow-lift: 0 2px 6px rgba(0,0,0,.36), 0 18px 44px rgba(0,0,0,.5);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.025 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { margin: 0; height: 100%; }
/* min-height (not height) so the body GROWS with content — otherwise a fixed-height body
   eats padding-bottom and the last items end up trapped under the fixed tab bar. */
body { margin: 0; min-height: 100%; }
body {
  background-color: var(--bg);
  background-image: var(--grain);     /* faint paper grain, tiled */
  color: var(--text);
  font: 16px/1.5 var(--sans);
  letter-spacing: -0.006em;           /* Inter sits better very slightly tightened */
  padding-bottom: calc(96px + var(--safe-bottom));   /* clear the fixed tab bar + breathing room so bottom items aren't hidden / bounce-trapped */
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv05" 1;    /* Inter: lowercase l with tail — clearer */
}

/* Display face — Zilla Slab (sturdy slab). Used for titles, names, headers. */
.topbar h1, .card .name, .cal-item-main .name, .auth-brand,
.setup-head strong, .sheet-head strong, #profileTitle, #sheetTitle {
  font-family: var(--serif);
  font-optical-sizing: auto;
}
.topbar h1, .auth-brand { letter-spacing: -0.018em; }

/* Numerals line up in money/counts */
.status, .badge, .count, .li-total, .li-grand, .inv-amt, .snap-row span:last-child,
.kpi-num, .time-hrs { font-variant-numeric: tabular-nums; }

/* Icons (Lucide) — scale with surrounding font-size by default */
.ico { width: 1em; height: 1em; flex: 0 0 auto; vertical-align: -0.14em; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--anchor);
  padding: calc(8px + var(--safe-top)) 16px 8px;
  border-bottom: 1px solid var(--anchor-line);
}
.topbar h1 { margin: 0 0 8px; font-size: 26px; font-family: var(--serif); font-weight: 600; letter-spacing: .2px; color: var(--anchor-ink); }
#search {
  width: 100%; padding: 10px 14px; font-size: 16px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  transition: border-color .15s ease, box-shadow .15s ease;
}
#search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }

/* Filter chips (Leads tab) */
.filterbar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
/* Quiet "N follow-ups due → Today" jump under the Customers filters. */
.due-jump { display: inline-flex; align-items: center; gap: 6px; margin: -4px 0 12px; padding: 7px 12px;
  border: 1px solid var(--red-weak); border-radius: 10px; background: transparent; color: var(--red);
  font-weight: 600; font-size: 13px; cursor: pointer; }
.due-jump .ico { width: 15px; height: 15px; }
/* Small "Company" tag beside a company customer's name. */
.kind-tag { font-size: 11px; font-weight: 600; color: var(--muted); border: 1px solid var(--line);
  border-radius: 6px; padding: 1px 6px; margin-left: 6px; vertical-align: middle; }
/* The contact person on a company card. */
.meta.contact { color: var(--text); font-weight: 600; }
.kind-seg { margin-bottom: 14px; }
.chip {
  flex: 1; padding: 8px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  font-size: 13px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.chip.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip .count {
  font-size: 12px; min-width: 20px; padding: 1px 7px; border-radius: 999px;
  background: var(--surface-2); color: var(--text);
}
.chip.active .count { background: rgba(0,0,0,.16); color: var(--accent-ink); }
/* "Due" chip with outstanding items — quietly insists without shouting */
.chip.urgent { color: var(--red); border-color: var(--red-weak); }
.chip.urgent .count { background: var(--red-weak); color: var(--red); }
.chip.urgent.active { background: var(--red); color: #fff; border-color: var(--red); }
.chip.urgent.active .count { background: rgba(0,0,0,.2); color: #fff; }

/* List */
/* No top padding: the sticky .topbar already provides the boundary, so content sits flush
   under it. (A top gap here would visibly "scroll away" under the sticky bar.) */
main { padding: 0 12px 12px; }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 13px 15px; margin-bottom: 10px;
  box-shadow: var(--shadow);
  transition: box-shadow .18s ease, transform .12s ease;
}
.card[data-id]:active, .cal-item:active, .mini-row:active { transform: translateY(1px); }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.card-top .name { font-size: 18px; font-weight: 600; font-family: var(--serif); }
.card .meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.card .followup.overdue { color: var(--red); font-weight: 600; }
.card .followup.soon { color: var(--amber); }

.badge { font-size: 12px; padding: 3px 9px; border-radius: 999px; white-space: nowrap; font-weight: 700; }
.tier-A { background: #F2D7C9; color: #9A3B22; }
.tier-B { background: #F1E3C2; color: #87661B; }
.tier-C { background: #E7DDCC; color: #6E6353; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .tier-A { background: #4A2A20; color: #F0BBA6; }
  :root:not([data-theme]) .tier-B { background: #43381F; color: #EBCF8E; }
  :root:not([data-theme]) .tier-C { background: #39332B; color: #C9BBA3; }
}
:root[data-theme="dark"] .tier-A { background: #4A2A20; color: #F0BBA6; }
:root[data-theme="dark"] .tier-B { background: #43381F; color: #EBCF8E; }
:root[data-theme="dark"] .tier-C { background: #39332B; color: #C9BBA3; }

.status { display: inline-block; font-size: 12px; color: var(--muted); margin-top: 6px; }
.win { color: var(--accent); font-weight: 700; }

/* Quick actions */
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.actions a, .actions button {
  flex: 1 1 64px; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 4px; border-radius: 10px; font-size: 14px; font-weight: 600;
  background: var(--surface-2); color: var(--text); border: none;
  transition: background-color .15s ease, color .15s ease, transform .1s ease;
}
.actions .ico { width: 16px; height: 16px; }
.actions a:active, .actions button:active { background: var(--accent); color: var(--accent-ink); transform: scale(.97); }
.actions .disabled { opacity: .35; pointer-events: none; }

/* FAB */
.fab {
  position: fixed; right: 18px; bottom: calc(76px + var(--safe-bottom));
  width: 58px; height: 58px; border-radius: 50%; border: none;
  background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center; z-index: 20;
  box-shadow: 0 2px 4px rgba(120,60,30,.24), 0 10px 24px rgba(120,60,30,.3);
  transition: transform .12s cubic-bezier(.2,.8,.2,1), box-shadow .15s ease;
}
.fab .ico { width: 28px; height: 28px; }
.fab:active { transform: scale(.9); box-shadow: 0 1px 3px rgba(120,60,30,.3); }

/* Tab bar */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 15;
  display: flex; background: var(--anchor);
  border-top: 1px solid var(--anchor-line);
  padding-bottom: var(--safe-bottom);
}
.tab {
  flex: 1; border: none; background: none; color: var(--anchor-muted);
  padding: 9px 0 6px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  transition: color .15s ease;
}
.tab .ico { width: 23px; height: 23px; }
.tab span { font-size: 11px; }
.tab.active { color: var(--anchor-accent); }

/* Dashboard */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.kpi .label { color: var(--muted); font-size: 12px; }
.kpi .value { font-size: 26px; font-weight: 700; margin-top: 4px; font-family: var(--serif); }
.section-title { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 18px 4px 8px; }

/* Dashboard — enhanced (callout, hero KPIs, bar panels) */
.dash-alert {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 12px 14px; margin-bottom: 14px;
  background: var(--accent-weak); color: var(--accent);
  border: none; border-radius: var(--radius);
  font-size: 15px; font-weight: 600;
  transition: transform .1s ease;
}
.dash-alert span { flex: 1; }
.dash-alert strong { font-weight: 800; }
.dash-alert .ico { width: 18px; height: 18px; }
.dash-alert:active { transform: scale(.99); }

.kpi .value { font-variant-numeric: tabular-nums; }
.kpis-hero { grid-template-columns: 1fr 1fr; }
.kpi.hero { padding: 16px; }
.kpi.hero .value { font-size: 30px; line-height: 1.1; color: var(--accent); }
.kpi .value .per { font-size: 14px; font-weight: 600; color: var(--muted); margin-left: 1px; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 6px; }
.kpis-3 { grid-template-columns: 1fr 1fr 1fr; }
.kpi .value.sm { font-size: 21px; }

.bars { padding: 14px; }
.bar-row { margin-bottom: 13px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-row.zero { opacity: .4; }
.bar-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; margin-bottom: 5px; }
.bar-top .bar-val { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-track { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width .4s cubic-bezier(.22,.61,.36,1); }
.bar-fill.alt { background: var(--green); }

/* Gentle entrance for dashboard blocks (dashboard-only classes; reduced-motion is honored below) */
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.dash-alert, .kpis, .section-title, .bars { animation: fade-up .26s ease both; }

/* Sheet (edit modal) */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(40,28,16,.45); display: flex; align-items: flex-end;
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.sheet-backdrop[hidden] { display: none; }
.sheet {
  background: var(--bg); width: 100%; max-height: 92vh;
  border-radius: 22px 22px 0 0; display: flex; flex-direction: column;
  box-shadow: 0 -10px 44px rgba(40,28,16,.26);
  animation: up .26s cubic-bezier(.22,.61,.36,1);
}
@keyframes up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.sheet-head strong { font-family: var(--serif); font-size: 18px; font-weight: 600; }
.link { background: none; border: none; color: var(--accent); font-size: 16px; }
.link.primary { font-weight: 700; }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 12px 16px calc(24px + var(--safe-bottom)); }

/* When an overlay is open, freeze the page behind it (no background scroll, no 2nd scrollbar). */
body.modal-open { overflow: hidden; }

/* First-login welcome tour */
.onboard-backdrop { position: fixed; inset: 0; z-index: 1100; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(20,14,8,.6); padding-bottom: calc(20px + var(--safe-bottom)); }
.onboard-card { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 22px; box-shadow: var(--shadow-lift); padding: 30px 24px 20px; text-align: center; position: relative; }
.onboard-skip { position: absolute; top: 13px; right: 15px; background: none; border: none; color: var(--muted);
  font: inherit; font-size: 14px; cursor: pointer; padding: 4px; }
.onboard-emoji { font-size: 46px; line-height: 1; }
.onboard-title { font-family: var(--serif); font-weight: 700; font-size: 23px; letter-spacing: -.01em; margin: 14px 0 8px; }
.onboard-body { color: var(--text); font-size: 15.5px; line-height: 1.55; min-height: 96px; }
.onboard-body a { color: var(--accent); font-weight: 600; }
.onboard-dots { display: flex; gap: 7px; justify-content: center; margin: 18px 0 16px; }
.onboard-dots i { width: 7px; height: 7px; border-radius: 999px; background: var(--line); transition: width .2s ease, background-color .2s ease; }
.onboard-dots i.on { background: var(--accent); width: 20px; }
.onboard-actions { display: flex; gap: 10px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.field input, .field select, .field textarea {
  width: 100%; min-width: 0; padding: 11px 12px; font-size: 16px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak);
}
.field textarea { min-height: 80px; resize: vertical; }
/* iOS Safari sizes native date inputs to their own control width and ignores width:100%,
   so two side by side in a .row2 overflow/overlap. Dropping the native appearance makes them
   honor the grid cell like a normal text box. */
.field input[type="date"] { -webkit-appearance: none; appearance: none; }
.row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
/* display:grid above beats the UA [hidden] rule — force it hidden when toggled off. */
.row2[hidden] { display: none; }
.sheet-foot { display: flex; gap: 10px; margin-top: 8px; }
.btn {
  flex: 1; padding: 12px; border-radius: var(--radius-sm); border: none; font-size: 15px; font-weight: 600;
  background: var(--surface-2); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: background-color .15s ease, color .15s ease, transform .1s ease, box-shadow .15s ease;
}
.btn .ico { width: 16px; height: 16px; }
.btn:active { transform: scale(.98); }
.btn.danger { background: var(--red-weak); color: var(--red); }
.btn.convert { background: var(--green-weak); color: var(--green); }
/* Accent + reactivate buttons get a hint of lift to read as the primary action */
.btn.primary, .billing-banner .btn { box-shadow: 0 1px 2px rgba(120,60,30,.18), 0 4px 12px rgba(120,60,30,.18); }
.btn.primary:active { box-shadow: 0 1px 2px rgba(120,60,30,.2); }

/* Keyboard focus — visible, on-brand */
button:focus-visible, a:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.btn.enrich { background: var(--surface); border: 1px solid var(--accent); color: var(--accent); }
.btn.enrich .ico { width: 17px; height: 17px; }
.btn:disabled { opacity: .5; }

/* Settings — pricing toggles & tier editor */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 2px; font-size: 15px; font-weight: 600; }
.switch-row input[type="checkbox"] { width: 44px; height: 26px; -webkit-appearance: none; appearance: none; background: var(--surface-2); border-radius: 999px; position: relative; flex: 0 0 auto; transition: background-color .15s ease; }
.switch-row input[type="checkbox"]::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; background: var(--surface); border-radius: 50%; box-shadow: var(--shadow); transition: transform .15s ease; }
.switch-row input[type="checkbox"]:checked { background: var(--accent); }
.switch-row input[type="checkbox"]:checked::after { transform: translateX(18px); }
.tier-row { display: grid; grid-template-columns: 1fr 92px 40px; gap: 8px; align-items: center; margin-bottom: 8px; }
.tier-row input { width: 100%; padding: 10px 12px; font-size: 16px; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 10px; }
.tier-row input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.tier-del { background: var(--surface-2); border: none; color: var(--muted); height: 40px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; }
.tier-del .ico { width: 18px; height: 18px; }
.tier-del:active { background: var(--red-weak); color: var(--red); }

/* In-app confirm dialog */
.confirm-backdrop { align-items: center; justify-content: center; z-index: 40; padding: 24px; }
.confirm-box {
  background: var(--bg); width: 100%; max-width: 340px;
  border: 1px solid var(--line); border-radius: 16px; padding: 20px;
  box-shadow: var(--shadow);
  animation: up .2s cubic-bezier(.22,.61,.36,1);
}
.confirm-msg { margin: 0 0 16px; font-size: 16px; line-height: 1.45; }
.confirm-foot { display: flex; gap: 10px; }

/* Calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 4px 12px; font-size: 19px; font-family: var(--serif); }
.cal-nav { background: var(--surface); border: 1px solid var(--line); color: var(--text); width: 44px; height: 38px; border-radius: 10px; font-size: 20px; }
/* minmax(0, 1fr) — NOT 1fr — so columns can shrink below the cells' aspect-ratio
   minimum. With plain 1fr, iOS Safari sizes each square to its content/aspect min and
   the 7 columns overflow the screen (and misalign with the weekday header row). */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.cal-wd { margin-bottom: 5px; }
.cal-wdc { text-align: center; font-size: 11px; color: var(--muted); }
.cal-cell {
  position: relative; aspect-ratio: 1 / 1; min-width: 0; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); font-size: 14px; text-align: left;
}
.cal-cell.today { border-color: var(--accent); }
.cal-cell.sel { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.cal-dot {
  position: absolute; right: 5px; bottom: 5px; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 9px; background: var(--accent); color: var(--accent-ink);
  font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.cal-dot.overdue { background: var(--red); color: #fff; }
.cal-cell.sel .cal-dot { background: var(--accent-ink); color: var(--accent); }
.cal-item {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px; padding: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow);
}
.cal-item-main { flex: 1; min-width: 0; }
.cal-item-main .name { font-family: var(--serif); font-weight: 600; }

/* ---------- Today (home) ---------- */
.today-date { color: var(--muted); font-size: 14px; font-weight: 600; margin: 2px 2px 12px; }
.section-title.is-overdue { color: var(--red); }
.cal-kind.k-money { background: var(--green-weak); color: var(--green); }
.today-go { color: var(--muted); font-size: 22px; line-height: 1; flex: 0 0 auto; }
/* Follow-up quick actions on agenda rows: snooze + done, with a 1d/3d/1wk menu */
.fu-actions, .fu-snooze-menu { flex: 0 0 auto; display: flex; align-items: center; gap: 5px; margin-left: 6px; }
/* The display:flex above would otherwise beat the `hidden` attribute, leaving BOTH the
   buttons and the snooze menu on screen and crushing the row text. Make hidden win. */
.fu-actions[hidden], .fu-snooze-menu[hidden] { display: none; }
.fu-btn { width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--surface-2);
  color: var(--muted); font-size: 17px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.fu-done { border-color: var(--green); background: var(--green-weak); color: var(--green); font-weight: 800; }
.fu-btn:active { transform: scale(.92); }
.fu-snz { height: 40px; min-width: 38px; padding: 0 9px; border-radius: 12px; border: 1.5px solid var(--accent);
  background: var(--accent-weak); color: var(--accent); font-weight: 700; font-size: 13px; cursor: pointer; }
.fu-snz:active { transform: scale(.95); }
.card.setup { padding: 14px; }
.setup-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.setup-head strong { font-family: var(--serif); font-size: 17px; }
.setup-step {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: none; border: none; border-top: 1px solid var(--line);
  padding: 12px 2px; color: var(--text); font-size: 15px; cursor: pointer;
}
.setup-label { flex: 1; }
.setup-step.done { color: var(--muted); }
.setup-step.done .setup-label { text-decoration: line-through; }
.setup-tick {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 999px;
  border: 2px solid var(--line); display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: var(--accent-ink);
}
.setup-step.done .setup-tick { background: var(--green); border-color: var(--green); color: #fff; }
.setup-go { color: var(--muted); font-size: 20px; line-height: 1; }
.setup-dismiss { margin-top: 10px; font-size: 13px; color: var(--muted); }
.cal-item .btn.ics { flex: 0 0 auto; width: auto; padding: 10px 14px; }
.cal-item .btn.ics .ico { width: 18px; height: 18px; }

/* Google lookup — candidate picker */
.enrich-results { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.enrich-results:empty { display: none; }
.enrich-hint { font-size: 12px; color: var(--muted); }
.enrich-pick {
  text-align: left; display: flex; flex-direction: column; gap: 2px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px;
  transition: border-color .15s ease;
}
.enrich-pick strong { font-size: 14px; }
.enrich-pick span { font-size: 12px; color: var(--muted); }
.enrich-pick:active { border-color: var(--accent); }

.empty { text-align: center; color: var(--muted); padding: 48px 16px; font-size: 15px; }

/* Activity journal (lead sheet) */
.act-add { display: flex; gap: 8px; margin-bottom: 10px; }
.act-add input {
  flex: 1; padding: 11px 12px; font-size: 16px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
}
.act-add input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.act-add .btn { flex: 0 0 auto; width: auto; padding: 11px 16px; }
.activity-log { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.act-empty { color: var(--muted); font-size: 13px; padding: 2px 4px; }
.act-row {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 11px;
}
.act-icon { color: var(--accent); display: inline-flex; padding-top: 2px; }
.act-icon .ico { width: 15px; height: 15px; }
.act-body { flex: 1; font-size: 14px; white-space: pre-wrap; }
.act-date { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.act-del { background: none; border: none; color: var(--muted); padding: 0 2px; display: inline-flex; }
.act-del .ico { width: 18px; height: 18px; }
.act-del:active { color: var(--red); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(86px + var(--safe-bottom)); transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 18px;
  border-radius: 999px; z-index: 40; font-size: 14px; box-shadow: 0 6px 18px rgba(40,28,16,.28);
  max-width: 88vw; text-align: center;
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ---------- Estimates (Preact island) ---------- */
.est-badge {
  padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  white-space: nowrap; align-self: flex-start;
}
.est-Draft    { background: var(--surface-2); color: var(--muted); }
.est-Sent     { background: var(--accent-weak); color: var(--accent); }
.est-Accepted { background: var(--green-weak);  color: var(--green); }
.est-Declined { background: var(--red-weak);    color: var(--red); }

/* Line-item rows: description on its own line, then qty / price / total / delete. */
.li-row {
  display: grid;
  grid-template-columns: 64px 92px 1fr 28px;
  gap: 6px; align-items: center;
  margin: 8px 0; padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.li-row .li-desc { grid-column: 1 / -1; }
/* Tech read-only view: price/total/delete columns are gone, leaving just description + qty. */
.li-row.li-ro { grid-template-columns: 1fr; }
.li-row.li-ro .li-num { width: auto; min-width: 72px; justify-self: start; text-align: left; }
.li-num { width: 100%; text-align: right; }
.li-total { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.li-del {
  background: none; border: none; color: var(--muted);
  font-size: 17px; line-height: 1; cursor: pointer; padding: 4px;
}
.li-totals { margin-top: 14px; }
.li-totals > div { display: flex; justify-content: space-between; align-items: center; padding: 4px 2px; }
.li-totals .li-tax input { width: 56px; margin-right: 2px; }
.li-totals .li-grand {
  border-top: 1px solid var(--line); margin-top: 4px; padding-top: 8px;
  font-weight: 700; font-size: 18px;
}

/* Price book picker + the line-item add buttons */
.li-add { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.pb-row { display: flex; align-items: center; gap: 2px; border-bottom: 1px solid var(--line); }
.pb-pick {
  flex: 1; min-width: 0; text-align: left; background: none; border: none;
  color: var(--text); padding: 14px 4px; display: flex; flex-direction: column; gap: 3px; cursor: pointer;
}
.pb-name { font-weight: 600; font-size: 16px; line-height: 1.25; }
.pb-meta { font-size: 13px; color: var(--muted); }
/* Proper iOS tap targets (≥44px) for the edit/delete glyphs. */
.pb-icon { background: none; border: none; color: var(--muted); font-size: 20px; min-width: 44px; height: 48px;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.pb-hint { color: var(--muted); font-size: 14px; margin: 4px 2px 14px; }
.pb-starter { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; margin-bottom: 8px; cursor: pointer; }
.pb-starter:active { transform: scale(.99); }

/* "More details" disclosure on the lean customer form */
.more-details { margin-top: 6px; border-top: 1px solid var(--line); }
.more-details > summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 14px; padding: 12px 2px 6px; list-style: none; }
.more-details > summary::-webkit-details-marker { display: none; }
.more-details > summary::after { content: ' ▾'; }
.more-details[open] > summary::after { content: ' ▴'; }

/* Work tab: Estimates|Jobs segmented control + job status badges */
.seg { display: flex; gap: 4px; background: var(--surface-2); border-radius: 10px; padding: 4px; margin-bottom: 12px; }
.seg button {
  flex: 1; border: none; background: none; color: var(--muted);
  padding: 9px; border-radius: 7px; font-weight: 600; font-size: 15px; cursor: pointer;
}
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.est-Quote       { background: var(--surface-2); color: var(--muted); }
.est-Scheduled   { background: var(--accent-weak); color: var(--accent); }
.est-In-Progress { background: rgba(176,122,46,.16); color: var(--amber); }
.est-Complete    { background: var(--green-weak); color: var(--green); }
.est-Invoiced    { background: rgba(176,122,46,.16); color: var(--amber); }
.est-Paid        { background: var(--green-weak); color: var(--green); font-weight: 700; }
.est-Canceled    { background: var(--surface-2); color: var(--muted); }
/* Share-quote popup buttons */
.share-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.share-grid > * { flex: 1 1 130px; text-align: center; }

/* Collapsible quote/items block — open while quoting, a summary once the job is scheduled */
.quote-block { border: 1px solid var(--line); border-radius: 12px; padding: 2px 12px 8px; margin: 8px 0; }
.quote-block > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; padding: 10px 2px; font-weight: 600; font-family: var(--serif); }
.quote-block > summary::-webkit-details-marker { display: none; }
.quote-block > summary::after { content: '▾'; color: var(--muted); }
.quote-block[open] > summary::after { content: '▴'; }
.quote-sum-total { margin-left: auto; color: var(--muted); font-weight: 600; }

/* "Logged X hrs vs quote total" nudge at invoice time — informs, never auto-bills */
.hours-note { background: rgba(176,122,46,.10); border: 1px solid rgba(176,122,46,.28);
  border-radius: 12px; padding: 12px 14px; margin: 10px 0; font-size: 15px; }

/* Calendar agenda: item-kind tag + today header */
.cal-kind { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 3px 7px; border-radius: 6px; align-self: flex-start; white-space: nowrap; }
.cal-kind.k-job { background: var(--accent-weak); color: var(--accent); }
.cal-kind.k-fu { background: var(--surface-2); color: var(--muted); }
.section-title.is-today { color: var(--accent); }

/* Review request note */
.review-note { font-size: 13px; color: var(--muted); padding: 0 4px 10px; }
.linkish { background: none; border: none; color: var(--accent); font-weight: 600; cursor: pointer; padding: 0; }

/* Top-bar Settings gear (Settings left the bottom nav) */
.top-actions { display: flex; gap: 8px; align-items: center; }
.top-actions #search { flex: 1; min-width: 0; }
.icon-btn { flex: 0 0 auto; width: 42px; height: 42px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--text); display: flex; align-items: center; justify-content: center; }
/* display:flex above beats the UA [hidden] rule, so a hidden icon-btn (e.g. the
   platform-admin approvals button for non-admins) would still show. Force it hidden. */
.icon-btn[hidden] { display: none; }
.icon-btn .ico { width: 20px; height: 20px; }

/* Settings accordion (collapsed by default; tap to reveal) */
.acc { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 10px; overflow: hidden; }
.acc > summary { list-style: none; cursor: pointer; padding: 14px; display: flex; flex-direction: column; gap: 2px; }
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary::after { content: "▸"; position: absolute; right: 18px; color: var(--muted); transition: transform .15s ease; }
.acc[open] > summary::after { transform: rotate(90deg); }
.acc > summary { position: relative; }
.acc-title { font-weight: 600; font-family: var(--serif); font-size: 17px; }
.acc-hint { font-size: 13px; color: var(--muted); }
.acc-body { padding: 0 14px 14px; border-top: 1px solid var(--line); }
.acc-body .section-title:first-child { margin-top: 12px; }

/* Customer profile */
.snap { padding: 4px 14px; }
.snap-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.snap-row:last-child { border-bottom: none; }
.snap-row > span:first-child { color: var(--muted); flex: 0 0 auto; }
.snap-row > span:last-child { text-align: right; min-width: 0; word-break: break-word; }
.mini-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 12px; margin-bottom: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.mini-row .name { font-weight: 600; }
.mini-row .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.empty.sm { padding: 8px 4px; font-size: 13px; }

/* Pipeline stage type select (in the .tier-row grid) */
.tier-row select { width: 100%; padding: 10px 6px; font-size: 15px; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 10px; }

/* Job documents — photo/file thumbnails inside the job sheet */
.muted { color: var(--muted); font-size: 13px; padding: 4px; }
.docs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin: 4px 0 10px; }
.doc-tile { position: relative; aspect-ratio: 1 / 1; border-radius: 10px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.doc-tile a { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; text-decoration: none; color: var(--muted); }
.doc-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.doc-file a { flex-direction: column; gap: 5px; padding: 8px; text-align: center; }
.doc-ico { font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--accent); border: 1px solid var(--accent); border-radius: 6px; padding: 2px 5px; }
.doc-name { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.doc-x { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border: none; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; font-size: 15px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.doc-x:active { transform: scale(.9); }
.doc-add { width: 100%; cursor: pointer; }

/* ---------- Job invoice (Phase 7) ---------- */
.inv-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px; margin: 4px 0 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.inv-main { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; flex: 1 1 auto; }
.inv-amt { font-weight: 600; font-variant-numeric: tabular-nums; }
.inv-meta { color: var(--muted); font-size: 13px; }
.inv-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.inv-badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.inv-badge.inv-paid { color: #0a7d28; border-color: #9bd9ad; background: #eafaef; }
.inv-badge.inv-open { color: #8a5a00; border-color: #e6c98a; background: #fdf4e3; }
.inv-badge.inv-refunded { color: var(--muted); }

/* ---------- Job time entries ---------- */
.time-list { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 10px; }
.time-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.time-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-width: 0; flex: 1 1 auto; }
.time-hrs { font-weight: 600; }
.time-meta { color: var(--muted); font-size: 13px; }
.time-note { flex-basis: 100%; color: var(--muted); font-size: 13px; }
.time-row .doc-x { position: static; flex: 0 0 auto; }
.time-add { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.time-add .time-in-note { grid-column: 1 / -1; }
.time-add .btn { grid-column: 1 / -1; }

/* ---------- Auth gate (passwordless login / sign-up) ---------- */
.auth-gate { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; overflow-y: auto;
  padding: calc(24px + var(--safe-top)) 24px calc(24px + var(--safe-bottom)); background: radial-gradient(125% 125% at 50% 0%, var(--surface) 0%, var(--bg) 62%); }
.auth-gate[hidden] { display: none; }
body.auth-locked { overflow: hidden; }
/* Cold-load: until bootAuth() resolves who you are, hide the app chrome so the
   home screen never flashes for a frame behind the sign-in gate. */
body.booting .topbar,
body.booting #billingBanner,
body.booting #view,
body.booting .tabbar,
body.booting #fab { display: none !important; }
.auth-card { width: 100%; max-width: 384px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 12px 44px rgba(60,40,20,.13); padding: 32px 26px 20px; text-align: center; }
.auth-logo { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 15px; overflow: hidden; box-shadow: var(--shadow); }
.auth-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.auth-brand { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.auth-tagline { color: var(--muted); font-size: 13px; margin: 4px 0 22px; }

/* Each step is one container; only the active one is shown. The [hidden] rule must beat the
   class display below — note .auth-step[hidden] has higher specificity than .auth-form etc. */
.auth-step[hidden] { display: none; }
.auth-form, .auth-signup { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.auth-pending { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.auth-h { font-size: 17px; font-weight: 700; margin: 0; text-align: center; }
.auth-sub { color: var(--muted); font-size: 13px; line-height: 1.45; margin: -4px 0 6px; text-align: center; }
.auth-label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.auth-label input { padding: 13px 14px; font-size: 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text); transition: border-color .15s, box-shadow .15s; }
.auth-label input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.auth-code { text-align: center; letter-spacing: .4em; font-size: 22px !important; font-weight: 700; font-variant-numeric: tabular-nums; }
.auth-divider { position: relative; text-align: center; margin: 4px 0 2px; }
.auth-divider::before { content: ""; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: var(--line); }
.auth-divider span { position: relative; background: var(--surface); padding: 0 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.auth-link { background: none; border: none; color: var(--accent); font-size: 13px; font-weight: 600; padding: 6px; cursor: pointer; }
.auth-check { width: 48px; height: 48px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 26px; font-weight: 700; display: flex; align-items: center; justify-content: center; margin-top: 6px; }
.auth-foot { color: var(--muted); font-size: 11px; margin: 22px 0 0; }

.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.block { width: 100%; flex: none; }

/* ---------- Signup approvals (admin) ---------- */
.icon-btn { position: relative; }
.badge-count { position: absolute; top: 0; right: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; }
.approval-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.approval-info { min-width: 0; }
.approval-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.approval-actions .btn { flex: 0 0 auto; padding: 8px 12px; font-size: 13px; }

/* ---------- Billing (Phase 6) ---------- */
.btn.sm { flex: 0 0 auto; padding: 7px 12px; font-size: 13px; }

/* Banner under the top bar: trial countdown / read-only prompt. */
.billing-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 16px; font-size: 14px; font-weight: 600;
  background: var(--accent-weak); color: var(--text); border-bottom: 1px solid var(--line);
}
/* The class sets display:flex, which would otherwise override the `hidden` attribute and
   leave an empty tinted strip under the topbar. Make hidden actually hide it. */
.billing-banner[hidden] { display: none; }
.billing-banner.danger { background: var(--red-weak); color: var(--red); }
.billing-banner .btn { background: var(--accent); color: var(--accent-ink); }
.billing-banner.danger .btn { background: var(--red); color: #fff; }
/* In read-only mode, hide the primary create affordance (server still enforces). */
body.read-only .fab { display: none !important; }

/* Pricing / plan cards */
.seg-group { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: 0 4px 12px; }
.seg { padding: 8px 16px; border: none; background: var(--surface); color: var(--muted); font-weight: 600; font-size: 14px; }
.seg.active { background: var(--accent); color: var(--accent-ink); }
.plan-grid { display: flex; flex-direction: column; gap: 12px; }
.plan-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--surface); }
.plan-card.current { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-weak); }
.plan-name { font-weight: 700; font-size: 16px; }
.plan-price { font-size: 28px; font-weight: 800; margin: 4px 0; }
.plan-per { font-size: 14px; font-weight: 600; color: var(--muted); }
.plan-seats { font-size: 13px; color: var(--accent); font-weight: 600; }
.plan-blurb { font-size: 13px; color: var(--muted); margin: 4px 0 12px; }

/* Team portal */
.team-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.team-info { min-width: 0; flex: 1 1 200px; }
.team-actions { display: flex; gap: 6px; flex: 0 0 auto; margin-left: auto; }
.team-add { display: flex; flex-direction: column; gap: 8px; }
.team-add input { padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); }
.check-list { display: flex; flex-direction: column; gap: 2px; max-height: 50vh; overflow: auto; }
.check-row { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); font-size: 15px; }
.check-row input { width: 18px; height: 18px; flex: 0 0 auto; }
