/* ==========================================================================
   AccountaBill Design System
   Fraunces display serif with
   italic emphasis words, small tracked uppercase eyebrows, arrow-suffixed
   CTAs, pill-chip tags, warm navy/gold/cream palette. Applied here to a
   working tool rather than a marketing page, so the signature move is the
   same eyebrow + italic-emphasis headline treatment carried through every
   screen — the throughline that makes this feel like the same practice,
   not a bolted-on internal app.

   Spacing/type scale + interaction-state additions below are from the
   2026-09-08 UI audit: every component-level rule in this file draws its
   size/spacing from --space-N / --text-N rather than a one-off value, so a
   future adjustment happens once here instead of being rediscovered as a
   "still not enough gap" report against some inline style three files away.
   ========================================================================== */

:root {
  --navy: #0F172A;
  --navy-soft: #1E293B;
  --gold: #C9A24B;
  --gold-deep: #A8842F;
  /* Text-only variant of gold-deep: WCAG AA (4.5:1) against --cream needs
     noticeably darker than the fill/border use of gold-deep, which only
     has to clear the 3:1 non-text-contrast bar. Keeping these as two
     tokens (rather than darkening gold-deep everywhere) means small gold
     UI accents -- borders, chip fills -- stay the lighter brand gold,
     while anything rendering gold AS TEXT (the eyebrow label on every
     page header, chief among them) is guaranteed readable. */
  --gold-text: #6B4F1E;
  --cream: #FAF6EE;
  --paper: #FFFFFF;
  --line: #E9E2D0;
  --ink: #1E293B;
  /* Darkened from the original #7C7566 -- that value passed AA (4.5:1)
     against white/paper but fell to ~4.2:1 against --cream, and this
     color is used for hint text and field captions on both surfaces
     interchangeably. This single darker value clears AA on either
     ground rather than needing two separate "muted" tokens. */
  --ink-muted: #6B6155;
  --danger: #B3452F;
  --success: #15803D;
  --whatsapp: #25D366;
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  /* ---- Spacing scale (base 4px / 0.25rem) ----
     Every margin/padding/gap in this file is one of these eight steps.
     Reach for the nearest one rather than typing a new rem value. */
  --space-1: 0.25rem;  /* 4px  */
  --space-2: 0.5rem;   /* 8px  */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.5rem;   /* 24px */
  --space-6: 2rem;     /* 32px */
  --space-7: 2.5rem;   /* 40px */
  --space-8: 4rem;     /* 64px */

  /* ---- Type scale ----
     Collapses what was 14 near-duplicate sizes (0.85/0.86/0.88/0.9/0.92rem
     all reading as "the same size") into 7 deliberate steps. Display-scale
     text (page h1, .stat-big) is intentionally NOT on this scale -- those
     are one-off headline sizes, not part of the repeating UI vocabulary
     this scale exists to keep consistent. */
  --text-xs: 0.75rem;    /* 12px -- eyebrow, table headers, field captions */
  --text-sm: 0.8125rem;  /* 13px -- hints, secondary labels */
  --text-base: 0.875rem; /* 14px -- the default: buttons, nav, table cells */
  --text-md: 0.9375rem;  /* 15px -- form inputs, section labels */
  --text-lg: 1rem;       /* 16px -- card titles, wordmark */
  --text-xl: 1.125rem;   /* 18px -- stat-row totals */
  --text-2xl: 1.5rem;    /* 24px -- empty-state glyph */
}

* { box-sizing: border-box; margin: 0; padding: 0; color-scheme: light; }
html, body { font-family: var(--font-body); background: var(--cream); color: var(--ink); }
body { min-height: 100vh; }
a { color: inherit; text-decoration: none; }

/* Visible keyboard-focus ring everywhere -- previously only .form-control
   had any focus treatment at all, so tabbing to a button, nav link,
   segmented-toggle option, or tab-bar item fell back to whatever the
   browser's own default outline happens to be (inconsistent across
   Chromium builds, and never designed against this navy/gold palette).
   One rule closes it globally; form-control below still gets its own
   more specific in-place treatment instead of this ring. */
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ---------- Top navigation (mirrors the marketing site's header) ---------- */
.ssa-nav {
  background: var(--navy);
  color: #fff;
  padding: var(--space-4) var(--space-6);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ssa-nav .brand { display: flex; align-items: center; gap: var(--space-3); }
.ssa-nav .logo-mark {
  width: 38px; height: 38px; border-radius: 10px; object-fit: contain; flex: none;
}
.ssa-nav .wordmark { font-family: var(--font-display); font-weight: 600; font-size: var(--text-lg); letter-spacing: 0.01em; }
.ssa-nav .wordmark span { color: var(--gold); font-family: var(--font-body); font-weight: 500; font-size: var(--text-sm); margin-left: var(--space-2); text-transform: uppercase; letter-spacing: 0.06em; }
.ssa-nav .links { display: flex; align-items: center; gap: var(--space-1); list-style: none; }
/* Direct-child combinator (> li > a), not a plain descendant selector --
   the "More" item nests its own dropdown menu (white panel, dark text)
   inside this same <ul>. A bare ".links a" would also match THOSE links,
   painting the navy nav bar's white-on-gold hover state onto a white
   dropdown panel: white text on a near-white background, unreadable. */
.ssa-nav .links > li > a {
  color: #A8B0C0; padding: var(--space-2) var(--space-4); font-weight: 500; font-size: var(--text-base);
  border-radius: 999px; transition: color 0.15s, background 0.15s;
}
.ssa-nav .links > li > a:hover, .ssa-nav .links > li > a.active { color: #fff; background: rgba(201,162,75,0.16); }
.ssa-nav .nav-right { display: flex; align-items: center; gap: var(--space-5); }
.profile-menu { position: relative; }
.profile-badge {
  width: 34px; height: 34px; border-radius: 50%; background: rgba(201,162,75,0.16);
  border: 1px solid rgba(201,162,75,0.4); color: var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 600; font-size: var(--text-md);
  cursor: pointer; user-select: none; transition: background 0.15s;
}
.profile-badge:hover, .profile-badge.open { background: rgba(201,162,75,0.32); }
.profile-dropdown {
  position: absolute; top: calc(100% + var(--space-3)); right: 0; background: #fff; border-radius: 10px;
  box-shadow: 0 14px 30px rgba(15,23,42,0.24); min-width: 170px; padding: var(--space-2); z-index: 200;
  display: none;
}
.profile-dropdown.open { display: block; }
.profile-dropdown a { display: block; padding: var(--space-2) var(--space-3); border-radius: 6px; font-size: var(--text-sm); font-weight: 500; color: var(--ink); transition: background 0.15s, color 0.15s; }
.profile-dropdown a:hover { background: var(--navy); color: #fff; }

/* ---------- Page header: eyebrow + italic-emphasis Fraunces headline ---------- */
.page-header { max-width: 1180px; margin: var(--space-7) auto var(--space-6); padding: 0 var(--space-5); }
.eyebrow {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--gold-text); margin-bottom: var(--space-3);
}
.eyebrow::before { content: "✦"; font-size: 0.85em; }
.page-header h1 {
  font-family: var(--font-display); font-weight: 500; font-size: clamp(1.7rem, 3vw, 2.3rem);
  color: var(--navy); line-height: 1.15; letter-spacing: -0.01em; text-wrap: balance;
}
.page-header h1 em { font-style: italic; color: var(--gold-deep); }
.page-header p.lede { margin-top: var(--space-3); color: var(--ink-muted); font-size: var(--text-md); max-width: 60ch; line-height: 1.55; }

/* ---------- Layout shell ---------- */
html, body { overflow-x: hidden; }
.shell { max-width: 1180px; margin: 0 auto; padding: 0 var(--space-5) var(--space-8); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 340px); gap: var(--space-5); }
@media (max-width: 900px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--space-5); grid-auto-rows: 1fr; }

/* ---------- Cards (same warm, generous spacing as the site's service cards) ---------- */
.ssa-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
  padding: var(--space-6); margin-bottom: var(--space-5);
}
.ssa-card h2 {
  font-family: var(--font-display); font-weight: 600; font-size: var(--text-lg);
  color: var(--navy); margin-bottom: var(--space-4);
}
.ssa-card.feature { position: relative; transition: transform 0.15s, box-shadow 0.15s; display: flex; flex-direction: column; }
.ssa-card.feature:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(15,23,42,0.08); }
.ssa-card.feature .hint { flex: 1; }
.ssa-card .card-arrow {
  position: absolute; top: var(--space-5); right: var(--space-5); width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--line); display: flex; align-items: center; justify-content: center;
  color: var(--gold-text); font-size: var(--text-md); text-decoration: none; transition: background 0.15s;
}
.ssa-card .card-arrow:hover { background: var(--cream); }

/* ---------- Tag pills (mirrors the little chips under each service on the site) ---------- */
.tag-pill {
  display: inline-block; padding: var(--space-1) var(--space-3); border-radius: 999px;
  font-size: var(--text-xs); font-weight: 600; background: var(--cream); color: var(--navy);
  border: 1px solid var(--line); margin: 0 var(--space-2) var(--space-2) 0;
}
.tag-pill.gold { background: #FBF2DD; color: var(--gold-text); border-color: #EEDCB0; }
.tag-pill.navy { background: var(--navy); color: #fff; border-color: var(--navy); }
.tag-pill.mono { font-family: var(--font-mono); }
.tag-pill.danger { background: #F7E3DC; color: var(--danger); border-color: #EBC3B2; }

/* ---------- Buttons (pill-shaped with arrow suffix, matching "Book Consultation ↗") ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: var(--space-3) var(--space-5); border-radius: 999px; font-weight: 600; font-size: var(--text-base);
  border: none; cursor: pointer; text-align: center; transition: transform 0.12s, background 0.15s;
  font-family: var(--font-body);
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-soft); }
.btn-gold { background: linear-gradient(135deg, var(--gold), var(--gold-deep)); color: var(--navy); }
.btn-outline { background: var(--paper); border: 1px solid var(--line); color: var(--ink); }
.btn-outline:hover { border-color: var(--gold); }
.btn-whatsapp { background: var(--whatsapp); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: var(--space-2) var(--space-3); font-size: var(--text-sm); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn .arrow { transition: transform 0.15s; }

/* ---------- Segmented control (two/three-way toggle, e.g. Yes/No, Credit/Debit) ---------- */
.seg {
  display: inline-flex; background: var(--cream); border: 1px solid var(--line);
  border-radius: 999px; padding: var(--space-1); gap: var(--space-1);
}
.seg button {
  border: none; background: transparent; color: var(--ink-muted);
  padding: var(--space-2) var(--space-4); border-radius: 999px; font-weight: 600; font-size: var(--text-sm);
  font-family: var(--font-body); cursor: pointer; transition: background 0.15s, color 0.15s;
}
.seg button:hover { color: var(--ink); }
.seg button.active { background: var(--navy); color: #fff; }
.btn:hover .arrow { transform: translateX(3px); }

/* ---------- Forms ---------- */
/* Sub-heading within a card, grouping the fields below it (e.g. "Payment
   Details", "Cancellation Policy") -- a step down from .ssa-card h2 (the
   card's own title), with a top rule so each group reads as a distinct
   break in a long form rather than just another field. */
.section-label {
  font-family: var(--font-display); font-weight: 600; font-size: var(--text-md);
  color: var(--navy); margin-top: var(--space-6); margin-bottom: var(--space-5);
  padding-top: var(--space-5); border-top: 1px solid var(--line);
}
.field { margin-bottom: var(--space-4); }
.field label {
  display: block; font-size: var(--text-xs); font-weight: 600; color: var(--ink-muted);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: var(--space-2);
}
/* Marks a mandatory field right on its label, so the requirement is known
   before submitting rather than discovered from a post-submit error.
   Fields with no marker are optional -- deliberately the only signal,
   so "(Optional)" suffixes in label text are redundant once this is used
   consistently and should be removed rather than kept alongside it. */
.field label .req { color: var(--danger); margin-left: 2px; }
/* Reusable version of the same eyebrow caption above, for places that
   need the label WITHOUT the surrounding .field spacing rules (the
   Dashboard's stat tiles previously retyped this declaration inline,
   verbatim, three times). */
.stat-caption {
  font-size: var(--text-xs); font-weight: 600; color: var(--ink-muted);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: var(--space-2);
}
/* Bigger than a native checkbox's default ~13px (which reads as an
   unfinished/last-minute control next to this form's other inputs),
   themed to match the rest of the palette instead of the browser's blue. */
.field input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--navy); cursor: pointer; flex-shrink: 0; }
.field .form-control {
  width: 100%; padding: var(--space-3) var(--space-3); border: 1px solid var(--line); border-radius: 8px;
  font-size: var(--text-md); font-family: var(--font-body); color: var(--ink) !important; background: var(--paper);
  outline: none; transition: border-color 0.15s;
}
.field .form-control:focus { border-color: var(--gold); }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-4); }
@media (max-width: 640px) { .field-row { grid-template-columns: minmax(0, 1fr); } }
.hint { font-size: var(--text-sm); color: var(--ink-muted); margin-top: var(--space-2); line-height: 1.5; }

/* ---------- Numbered steps (only used where the content IS a real sequence,
   e.g. the invoice-creation flow -- not decorative elsewhere) ---------- */
.step { display: flex; gap: var(--space-4); align-items: flex-start; }
.step-num {
  flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: var(--gold);
  font-family: var(--font-display); font-weight: 600; font-size: var(--text-md);
  display: flex; align-items: center; justify-content: center;
}

/* ---------- Stat / summary display ---------- */
.stat-row { display: flex; justify-content: space-between; padding: var(--space-3) 0; border-bottom: 1px solid var(--line); font-size: var(--text-base); }
.stat-row .label { color: var(--ink-muted); }
.stat-row.total { border-bottom: none; padding-top: var(--space-4); font-size: var(--text-xl); font-weight: 700; color: var(--navy); }
.stat-big { font-family: var(--font-display); font-size: 2rem; font-weight: 600; color: var(--navy); }

/* ---------- Tables ---------- */
table.ssa-table { width: 100%; border-collapse: collapse; font-size: var(--text-base); }
table.ssa-table.table-fixed { table-layout: fixed; }
.table-scroll { width: 100%; overflow-x: auto; }
table.ssa-table th {
  text-align: left; padding: var(--space-3) var(--space-3); background: var(--cream); color: var(--ink-muted);
  font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.ssa-table td { padding: var(--space-3) var(--space-3); border-bottom: 1px solid var(--line); }
table.ssa-table td .form-control { min-width: 0; width: 100%; }
/* No hover feedback previously existed on any list table in the app
   (Invoices, Quotations, Payments, Audit Trail) -- scanning a long list
   had no visual anchor for which row the cursor was over. */
table.ssa-table tbody tr { transition: background 0.12s; }
table.ssa-table tbody tr:hover { background: var(--cream); }

/* ---------- Tabs ---------- */
.tabbar { display: flex; gap: var(--space-1); border-bottom: 1px solid var(--line); margin-bottom: var(--space-6); flex-wrap: wrap; }
.tabbar button {
  background: none; border: none; padding: var(--space-3) var(--space-4); font-weight: 600; font-size: var(--text-base);
  color: var(--ink-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
  font-family: var(--font-body);
}
.tabbar button.active { color: var(--gold-text); border-bottom-color: var(--gold); }

/* ---------- Onboarding tour ----------
   Reusable spotlight-tour engine (theme.css owns the look; each page that
   wants a tour defines its own step list and calls startTour(), see
   index.html for the reference implementation). Three layered pieces per
   step: an invisible full-screen blocker (catches stray clicks so the
   tour can't be clicked past), a spotlight box-shadow ring around the
   real target element (visual only), and the tooltip itself. */
.tour-blocker { position: fixed; inset: 0; z-index: 3000; background: transparent; }
/* Position is now set exactly once per step -- after the page has
   scrolled the target into view and settled (see waitForStableRect in
   index.html), not on every scroll tick, since the tour locks the page
   from scrolling independently while a step is showing. That's what
   makes a transition safe here: it plays once, for a real step-to-step
   move, instead of chasing a manual scroll and visibly lagging behind
   it (the earlier, since-removed scroll-tracking approach). */
.tour-spotlight {
  position: fixed; z-index: 3001; border-radius: 12px; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(15,23,42,0.68);
  transition: top 0.32s cubic-bezier(0.34, 1.06, 0.64, 1), left 0.32s cubic-bezier(0.34, 1.06, 0.64, 1),
    width 0.32s cubic-bezier(0.34, 1.06, 0.64, 1), height 0.32s cubic-bezier(0.34, 1.06, 0.64, 1);
}
.tour-tooltip {
  position: fixed; z-index: 3002; background: var(--paper); border-radius: 12px;
  box-shadow: 0 20px 44px rgba(15,23,42,0.32); padding: var(--space-5); width: 300px; max-width: calc(100vw - 2 * var(--space-4));
  transition: opacity 0.2s ease;
}
/* Position jumps straight to the new step's spot (its text is different
   content, not the same box in a new place, so sliding it would drag
   stale copy across the screen); it cross-fades instead, out just before
   the move starts and back in once the spotlight has landed. */
.tour-tooltip.stepping { opacity: 0; pointer-events: none; }
.tour-tooltip .eyebrow { margin-bottom: var(--space-2); }
.tour-tooltip h3 { font-family: var(--font-display); font-weight: 600; font-size: var(--text-lg); color: var(--navy); margin-bottom: var(--space-2); }
.tour-tooltip p { font-size: var(--text-base); color: var(--navy-soft); margin-bottom: var(--space-4); line-height: 1.5; }
.tour-footer { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.tour-dots { display: flex; gap: 6px; }
.tour-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.tour-dot.active { background: var(--gold); }
.tour-skip { font-size: var(--text-sm); color: var(--ink-muted); background: none; border: none; cursor: pointer; padding: var(--space-2) 0; }
.tour-skip:hover { color: var(--ink); }

.empty-state { text-align: center; padding: var(--space-7) var(--space-4); color: var(--ink-muted); }
.empty-state .glyph { font-family: var(--font-display); font-style: italic; font-size: var(--text-2xl); color: var(--gold-text); margin-bottom: var(--space-2); }
/* Distinct from .empty-state -- "still fetching" and "genuinely nothing
   here" previously rendered as the exact same markup, so a slow load and
   a truly empty account were indistinguishable. The pulse gives motion to
   look for; prefers-reduced-motion (top of file) turns it into a static
   state automatically. */
.loading-state { text-align: center; padding: var(--space-7) var(--space-4); color: var(--ink-muted); }
.loading-state .glyph {
  font-family: var(--font-display); font-style: italic; font-size: var(--text-2xl); color: var(--ink-muted);
  margin-bottom: var(--space-2); animation: loading-pulse 1.3s ease-in-out infinite;
}
@keyframes loading-pulse { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }

/* ---------- Modal / overlay scrim ----------
   Was copy-pasted as an identical ~200-character inline style on 7
   separate <div>s across 3 files (_nav.html, business_details.html,
   customer_manage.html), plus a 4th, page-local copy of THIS class inside
   credit_debit_note.html. One definition here replaces all of them, and
   is also the one place the open/close transition needs to exist for
   every overlay in the app to get it at once. */
.mode-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,0.6); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: var(--space-4);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.18s ease, visibility 0s linear 0.18s;
}
/* One class toggles the whole thing -- JS call sites just do
   classList.add('open') / .remove('open') instead of touching
   style.display directly, so the fade-in/out and the show/hide are the
   same action instead of two things that can drift out of sync. */
.mode-overlay.open {
  opacity: 1; visibility: visible; pointer-events: auto;
  transition: opacity 0.18s ease;
}
.mode-overlay .ssa-card { transform: scale(0.94) translateY(6px); transition: transform 0.18s ease; }
.mode-overlay.open .ssa-card { transform: scale(1) translateY(0); }
