@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;0,900;1,400;1,700&family=Outfit:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ════════════════════════════════════════════════════════════════
   1. CSS VARIABLES — LIGHT MODE (default)
════════════════════════════════════════════════════════════════ */
:root {
  /* Backgrounds */
  --bg:          #ffffff;
  --bg-1:        #f9f8f6;
  --bg-2:        #f3f1ee;
  --bg-3:        #eceae6;
  --bg-4:        #e4e1dc;

  /* Borders */
  --border:      rgba(26,18,10,0.07);
  --border-2:    rgba(26,18,10,0.13);

  /* Text */
  --ink:         #1a120a;
  --ink-dim:     #5a4d3e;
  --ink-mute:    #9c8d7e;

  /* Aliases used by inner pages (about, terms, contact, etc.) */
  --cream:       #1a120a;
  --cream-dim:   #5a4d3e;
  --cream-mute:  #9c8d7e;

  /* Brand gold */
  --gold:        #c9920a;
  --gold-dim:    #a87608;
  --gold-glow:   rgba(201,146,10,0.10);
  --gold-light:  rgba(201,146,10,0.07);

  /* Utility */
  --red:         #dc2626;
  --green:       #16a34a;
  --white:       #ffffff;

  /* Nav */
  --nav-bg:      rgba(255,255,255,0.92);
  --nav-border:  rgba(26,18,10,0.08);

  /* Card */
  --card-bg:     #ffffff;
  --input-bg:    #f9f8f6;

  /* Shadows */
  --shadow-sm:   0 1px 4px rgba(26,18,10,0.06);
  --shadow-md:   0 4px 20px rgba(26,18,10,0.09);
  --shadow-lg:   0 12px 48px rgba(26,18,10,0.10);
  --shadow-gold: 0 0 40px rgba(201,146,10,0.10);

  /* Typography */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'Outfit', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  /* Radii */
  --r-sm:  6px;
  --r-md:  12px;
  --r-lg:  20px;
  --r-xl:  32px;

  /* Wizard/app white-mode vars (used by index.html inline CSS) */
  --w-bg:        #ffffff;
  --w-bg-1:      #f8f9fc;
  --w-bg-2:      #f1f3f8;
  --w-bg-3:      #e8ecf4;
  --w-text:      #0e0e0f;
  --w-text-2:    #374151;
  --w-text-3:    #6b7280;
  --w-border:    #e5e8f0;
  --w-border-2:  #d1d5db;
  --w-shadow:    0 1px 3px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.06);
  --w-shadow-lg: 0 8px 32px rgba(0,0,0,0.10), 0 2px 8px rgba(0,0,0,0.06);
}

/* ════════════════════════════════════════════════════════════════
   2. CSS VARIABLES — DARK MODE
════════════════════════════════════════════════════════════════ */
[data-theme="dark"] {
  /* Backgrounds */
  --bg:          #0e0e0f;
  --bg-1:        #141415;
  --bg-2:        #1a1a1c;
  --bg-3:        #222225;
  --bg-4:        #2a2a2e;

  /* Borders */
  --border:      rgba(255,255,255,0.07);
  --border-2:    rgba(255,255,255,0.12);

  /* Text */
  --ink:         #f0e8d8;
  --ink-dim:     #a89880;
  --ink-mute:    #6b5f51;

  /* Aliases */
  --cream:       #f0e8d8;
  --cream-dim:   #a89880;
  --cream-mute:  #6b5f51;

  /* Brand gold (brighter in dark mode) */
  --gold:        #e8b84b;
  --gold-dim:    #c49a2f;
  --gold-glow:   rgba(232,184,75,0.15);
  --gold-light:  rgba(232,184,75,0.08);

  /* Utility (same) */
  --red:         #dc2626;
  --green:       #4caf7d;

  /* Nav */
  --nav-bg:      rgba(14,14,15,0.92);
  --nav-border:  rgba(255,255,255,0.07);

  /* Card */
  --card-bg:     #141415;
  --input-bg:    #1a1a1c;

  /* Shadows (darker) */
  --shadow-sm:   0 1px 4px rgba(0,0,0,0.35);
  --shadow-md:   0 4px 20px rgba(0,0,0,0.45);
  --shadow-lg:   0 12px 48px rgba(0,0,0,0.55);
  --shadow-gold: 0 0 40px rgba(232,184,75,0.12);

  /* Wizard dark-mode vars */
  --w-bg:        #0e0e0f;
  --w-bg-1:      #141415;
  --w-bg-2:      #1a1a1c;
  --w-bg-3:      #222225;
  --w-text:      #f0e8d8;
  --w-text-2:    #c8b898;
  --w-text-3:    #7a6f61;
  --w-border:    rgba(255,255,255,0.07);
  --w-border-2:  rgba(255,255,255,0.12);
  --w-shadow:    0 1px 3px rgba(0,0,0,0.35), 0 4px 16px rgba(0,0,0,0.4);
  --w-shadow-lg: 0 8px 32px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.35);
}

/* ════════════════════════════════════════════════════════════════
   3. RESET & BASE
════════════════════════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-width: 0;
  width: 100%;
}

/* Smooth theme transitions */
body,
.navbar,
.mobile-nav,
.footer,
.modal-box,
.settings-card,
.step-panel,
.preview-panel {
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

/* Don't transition invoice templates (PDF rendering) */
.inv-wrap,
.inv-wrap *,
#wInvoiceCanvas,
#wInvoiceCanvas *,
#invoiceCanvas,
#invoiceCanvas * {
  transition: none !important;
}

::selection { background: var(--gold); color: #fff; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-1); }
::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  line-height: 1.2;
  color: var(--ink);
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(2.4rem, 5vw, 4.5rem); font-weight: 700; }
h2 { font-size: clamp(1.8rem, 3vw, 3rem);   font-weight: 700; }
h3 { font-size: clamp(1.3rem, 2vw, 1.8rem); font-weight: 600; }
p  { color: var(--ink-dim); line-height: 1.75; }
a  { color: var(--gold); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--ink); }

input, textarea, select {
  max-width: 100%;
  box-sizing: border-box;
}

/* ════════════════════════════════════════════════════════════════
   4. LAYOUT UTILITIES
════════════════════════════════════════════════════════════════ */
.container { max-width: 1200px; margin: 0 auto; padding: 0 2rem; }
.section    { padding: 100px 0; }
.section-sm { padding: 48px 0; }

.section-label {
  font-family: var(--font-mono);
  font-size: 0.68rem; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 12px; display: block;
}
.section-title { font-size: clamp(1.8rem, 3vw, 2.8rem); margin-bottom: 16px; }

/* ════════════════════════════════════════════════════════════════
   5. NAVBAR
════════════════════════════════════════════════════════════════ */
.navbar {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 1000; padding: 0 2rem; height: 68px;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--nav-border);
  box-sizing: border-box;
  overflow: visible;
  gap: 0;
}

.nav-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.nav-logo-mark {
  width: 34px; height: 34px; background: var(--gold); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 1.1rem; font-weight: 900; color: #fff;
  flex-shrink: 0;
}
.nav-logo-text {
  font-family: var(--font-display); font-size: 1.1rem; font-weight: 700;
  color: var(--ink);
}
.nav-logo-text span { color: var(--gold); }

.nav-links { display: flex; list-style: none; gap: 32px; }
.nav-links a {
  font-size: 0.875rem; font-weight: 500; color: var(--ink-dim);
  letter-spacing: 0.01em; transition: color 0.2s;
}
.nav-links a:hover,
.nav-links a.active { color: var(--ink); }

.nav-cta { display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-left: auto; }

/* Settings gear button in navbar */
.nav-settings-btn {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--bg-2); border: 1.5px solid var(--border-2);
  font-size: 1rem; text-decoration: none;
  transition: all 0.2s; color: var(--ink-dim); flex-shrink: 0;
}
.nav-settings-btn:hover {
  background: var(--gold-light);
  border-color: rgba(201,146,10,0.3);
  color: var(--gold);
}
[data-theme="dark"] .nav-settings-btn:hover {
  border-color: rgba(232,184,75,0.4);
}

/* ── Theme toggle button ── */
.theme-toggle {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--bg-2); border: 1.5px solid var(--border-2);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: var(--ink-dim); padding: 0;
  transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.15s;
}
.theme-toggle:hover {
  background: var(--gold-light);
  border-color: rgba(201,146,10,0.3);
  color: var(--gold);
  transform: scale(1.06);
}
[data-theme="dark"] .theme-toggle:hover {
  border-color: rgba(232,184,75,0.4);
}
.theme-toggle:active { transform: scale(0.94); }

.theme-icon { width: 15px; height: 15px; display: block; pointer-events: none; }

/* Light mode → show SUN ☀️ (you are in day mode) */
.theme-toggle .icon-sun  { display: block; }
.theme-toggle .icon-moon { display: none; }
/* Dark/Night mode → show MOON 🌙 (you are in night mode) */
[data-theme="dark"] .theme-toggle .icon-sun  { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* Hamburger — hidden by default, shown inside .nav-cta at breakpoints */
.hamburger {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 4px;
  flex-shrink: 0;
}
.hamburger span {
  display: block; width: 24px; height: 2px;
  background: var(--ink); border-radius: 2px; transition: all 0.2s;
}

/* Mobile Nav */
.mobile-nav {
  display: none; flex-direction: column;
  position: fixed; top: 68px; left: 0; right: 0;
  background: var(--bg); border-bottom: 1px solid var(--border);
  padding: 16px 24px; gap: 4px; z-index: 999;
  box-shadow: var(--shadow-md);
  overflow-y: auto; max-height: calc(100vh - 68px);
}
.mobile-nav a {
  padding: 10px 0; color: var(--ink-dim); font-weight: 500;
  border-bottom: 1px solid var(--border); font-size: 0.9rem;
}
.mobile-nav a:last-child { border: none; }

/* ════════════════════════════════════════════════════════════════
   6. BUTTONS
════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 22px; border-radius: var(--r-sm);
  font-family: var(--font-body); font-size: 0.875rem; font-weight: 600;
  cursor: pointer; border: none; transition: all 0.2s;
  text-decoration: none; white-space: nowrap; max-width: 100%;
}
.btn-gold {
  background: var(--gold); color: #fff;
  box-shadow: 0 2px 12px rgba(201,146,10,0.25);
}
.btn-gold:hover {
  background: var(--gold-dim); color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(201,146,10,0.35);
}
[data-theme="dark"] .btn-gold { box-shadow: 0 2px 12px rgba(232,184,75,0.2); }
[data-theme="dark"] .btn-gold:hover { box-shadow: 0 4px 20px rgba(232,184,75,0.3); }

.btn-outline {
  background: transparent; color: var(--ink);
  border: 1.5px solid var(--border-2);
}
.btn-outline:hover {
  border-color: var(--gold); color: var(--gold);
  background: var(--gold-light);
}
.btn-ghost {
  background: transparent; color: var(--ink-dim);
  border: none; padding: 8px 12px;
}
.btn-ghost:hover { color: var(--ink); background: var(--bg-2); }

.btn-sm  { padding: 7px 14px; font-size: 0.8rem; }
.btn-lg  { padding: 14px 32px; font-size: 1rem; }

/* ════════════════════════════════════════════════════════════════
   7. BADGES
════════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.03em;
}
.badge-green {
  background: rgba(22,163,74,0.08);
  border: 1px solid rgba(22,163,74,0.18);
  color: #16a34a;
}
[data-theme="dark"] .badge-green {
  background: rgba(22,163,74,0.12);
  border-color: rgba(22,163,74,0.25);
  color: #4ade80;
}

/* ════════════════════════════════════════════════════════════════
   8. PAGE HERO — inner pages (about, terms, contact, etc.)
════════════════════════════════════════════════════════════════ */
.page-hero {
  padding: 120px 0 72px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.page-hero::before {
  content: '';
  position: absolute; top: -100px; right: -100px;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(201,146,10,0.06) 0%, transparent 65%);
  pointer-events: none;
}
[data-theme="dark"] .page-hero::before {
  background: radial-gradient(circle, rgba(232,184,75,0.06) 0%, transparent 65%);
}
.page-hero-orb {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  width: 600px; height: 300px;
  background: radial-gradient(ellipse, rgba(201,146,10,0.06) 0%, transparent 70%);
  pointer-events: none;
}
[data-theme="dark"] .page-hero-orb {
  background: radial-gradient(ellipse, rgba(232,184,75,0.06) 0%, transparent 70%);
}
.page-hero-content { position: relative; z-index: 1; text-align: center; }
.page-hero h1 { font-size: clamp(2.4rem, 5vw, 3.8rem); margin-bottom: 16px; }
.page-hero p  { font-size: 1rem; color: var(--ink-mute); }

/* ════════════════════════════════════════════════════════════════
   9. LEGAL PAGES (terms, privacy, disclaimer)
════════════════════════════════════════════════════════════════ */
.legal-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 48px; align-items: start;
  padding: 64px 0 100px;
}
.legal-toc { position: sticky; top: 88px; }
.legal-toc h4 {
  font-family: var(--font-mono); font-size: 0.7rem; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-mute); margin-bottom: 16px;
}
.legal-toc ul { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.legal-toc a {
  font-size: 0.82rem; color: var(--ink-dim); text-decoration: none;
  padding: 6px 10px; border-radius: var(--r-sm); display: block;
  transition: all 0.2s; border-left: 2px solid transparent;
}
.legal-toc a:hover {
  color: var(--gold); background: var(--gold-light);
  border-left-color: var(--gold);
}

.legal-content { min-width: 0; }
.legal-meta {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 48px; flex-wrap: wrap;
}
.legal-meta-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-2); border: 1px solid var(--border-2);
  border-radius: 999px; padding: 5px 14px;
  font-family: var(--font-mono); font-size: 0.75rem; color: var(--ink-dim);
}
.legal-meta-badge .dot {
  width: 6px; height: 6px; background: var(--green); border-radius: 50%;
}

.legal-section { margin-bottom: 56px; scroll-margin-top: 100px; }
.legal-section h2 {
  font-size: 1.5rem; font-weight: 700; color: var(--ink);
  margin-bottom: 20px; padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.legal-section h2 .sec-num {
  font-family: var(--font-mono); font-size: 0.75rem;
  color: var(--gold); background: var(--gold-light);
  border: 1px solid rgba(201,146,10,0.2);
  border-radius: var(--r-sm); padding: 2px 8px;
}
[data-theme="dark"] .legal-section h2 .sec-num {
  border-color: rgba(232,184,75,0.2);
}
.legal-section p { margin-bottom: 14px; font-size: 0.95rem; }
.legal-section ul {
  padding-left: 0; list-style: none;
  display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px;
}
.legal-section ul li {
  padding: 10px 14px 10px 36px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); font-size: 0.9rem;
  color: var(--ink-dim); position: relative;
}
.legal-section ul li::before {
  content: '→'; position: absolute; left: 14px;
  color: var(--gold); font-size: 0.8rem;
}
.highlight-box {
  background: var(--gold-light);
  border: 1px solid rgba(201,146,10,0.2);
  border-left: 3px solid var(--gold);
  border-radius: var(--r-md); padding: 18px 20px;
  margin: 20px 0; font-size: 0.9rem; color: var(--ink-dim);
}
[data-theme="dark"] .highlight-box {
  background: rgba(232,184,75,0.06);
  border-color: rgba(232,184,75,0.2);
}
.highlight-box strong { color: var(--gold); }
.warning-box {
  background: rgba(220,38,38,0.04);
  border: 1px solid rgba(220,38,38,0.18);
  border-left: 3px solid var(--red);
  border-radius: var(--r-md); padding: 18px 20px;
  margin: 20px 0; font-size: 0.9rem; color: var(--ink-dim);
}
.info-box {
  background: var(--bg-2); border: 1px solid var(--border-2);
  border-radius: var(--r-md); padding: 20px 24px; margin: 20px 0;
}
.info-box p { margin: 0; font-size: 0.9rem; }
a.inline-link { color: var(--gold); font-weight: 500; }
a.inline-link:hover { color: var(--ink); }

/* ════════════════════════════════════════════════════════════════
   10. FOOTER
════════════════════════════════════════════════════════════════ */
.footer {
  background: #0e0e0f;
  color: rgba(255,255,255,0.7);
  padding: 60px 0 0;
}
[data-theme="dark"] .footer { background: #040405; }

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px; padding-bottom: 48px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.footer-brand p {
  font-size: 0.84rem; color: rgba(255,255,255,0.5);
  margin-top: 16px; line-height: 1.7;
}
.footer-brand .nav-logo-text { color: #fff !important; }
.footer-col h5 {
  font-family: var(--font-mono); font-size: 0.67rem; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: rgba(255,255,255,0.4); margin-bottom: 16px;
}
.footer-col ul {
  list-style: none; display: flex; flex-direction: column; gap: 10px;
}
.footer-col a {
  font-size: 0.875rem; color: rgba(255,255,255,0.6); transition: color 0.2s;
}
.footer-col a:hover { color: var(--gold); }
.footer-bottom {
  padding: 20px 0;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 8px;
}
.footer-bottom p { font-size: 0.8rem; color: rgba(255,255,255,0.35); }

/* ════════════════════════════════════════════════════════════════
   11. AD SLOTS
════════════════════════════════════════════════════════════════ */
.ad-slot {
  background: var(--bg-2); border: 1px dashed var(--border-2);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-mute); font-size: 0.75rem;
  font-family: var(--font-mono); letter-spacing: 0.05em;
  width: 100%; max-width: 100%; box-sizing: border-box; overflow: hidden;
}
.ad-slot-banner { height: clamp(50px,10vw,90px); }
.ad-slot-rect   { height: clamp(150px,30vw,280px); max-width: 336px; margin: 0 auto; }
.ad-slot iframe, .ad-slot img, .ad-slot > * { max-width: 100%; height: auto; }

/* ════════════════════════════════════════════════════════════════
   12. COOKIE BAR
════════════════════════════════════════════════════════════════ */
.cookie-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 9500;
  background: var(--bg); border-top: 1px solid var(--border-2);
  padding: 14px 24px;
  transform: translateY(100%); transition: transform 0.4s ease;
  box-shadow: 0 -8px 32px rgba(26,18,10,0.08);
}
[data-theme="dark"] .cookie-bar { box-shadow: 0 -8px 32px rgba(0,0,0,0.4); }
.cookie-bar.show { transform: translateY(0); }
.cookie-bar-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
}
.cookie-bar-inner span { font-size: 0.85rem; color: var(--ink-dim); }
.cookie-btns { display: flex; gap: 10px; flex-shrink: 0; }
.cookie-btn-accept {
  background: var(--gold); color: #fff; border: none;
  border-radius: var(--r-sm); padding: 9px 20px;
  font-family: var(--font-body); font-weight: 700; font-size: 0.85rem;
  cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.cookie-btn-accept:hover { background: var(--gold-dim); }
.cookie-btn-decline {
  background: transparent; color: var(--ink-mute);
  border: 1px solid var(--border-2); border-radius: var(--r-sm);
  padding: 9px 16px; font-family: var(--font-body); font-size: 0.85rem;
  cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.cookie-btn-decline:hover { color: var(--ink); border-color: var(--border-2); }

/* ════════════════════════════════════════════════════════════════
   13. FLOATING DISCLAIMER
════════════════════════════════════════════════════════════════ */
.float-disclaimer {
  position: fixed; bottom: 24px; left: 24px; z-index: 900;
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--bg); border: 1px solid var(--border-2);
  border-radius: 999px; padding: 9px 16px;
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 500;
  color: var(--ink-mute); text-decoration: none; letter-spacing: 0.04em;
  transition: all 0.2s; box-shadow: var(--shadow-md);
}
.float-disclaimer:hover {
  background: var(--gold-light);
  border-color: rgba(201,146,10,0.3);
  color: var(--gold);
  transform: translateY(-2px);
}
[data-theme="dark"] .float-disclaimer:hover {
  border-color: rgba(232,184,75,0.4);
}

/* ════════════════════════════════════════════════════════════════
   14. TOAST NOTIFICATIONS
════════════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 10000; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: var(--r-md);
  font-size: 0.84rem; min-width: 220px;
  box-shadow: var(--shadow-lg);
  animation: fadeUp 0.25s ease;
}
[data-theme="dark"] .toast {
  background: var(--bg-3); color: var(--ink);
  border: 1px solid var(--border-2);
}
.toast.success span { color: #4ade80; }
.toast.error   span { color: #f87171; }
.toast.info    span { color: var(--gold); }

/* ════════════════════════════════════════════════════════════════
   15. MODAL OVERLAY (shared by settings / reward-ad modals)
════════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0,0,0,0.55); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.25s;
  padding: 16px;
}
.modal-overlay.show { opacity: 1; pointer-events: all; }
.modal-box {
  background: var(--bg); border: 1px solid var(--border-2);
  border-radius: 20px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 620px; max-height: 90vh;
  display: flex; flex-direction: column; overflow: hidden;
  animation: fadeUp 0.25s ease both;
}
.modal-box.modal-sm { max-width: 440px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.modal-header h3 {
  font-family: var(--font-display); font-size: 1.15rem; font-weight: 700;
  color: var(--ink); margin: 0;
}
.modal-close {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-2); border: 1px solid var(--border);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; color: var(--ink-mute); transition: all 0.15s;
}
.modal-close:hover { background: var(--bg-3); color: var(--ink); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end; flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════════════
   16. SETTINGS PAGE — settings.html
════════════════════════════════════════════════════════════════ */

/* Layout */
.settings-layout {
  display: grid; grid-template-columns: 200px 1fr;
  gap: 40px; align-items: start; padding: 56px 0 100px;
}

/* Sidebar nav */
.settings-nav { position: sticky; top: 88px; }
.settings-nav h4 {
  font-family: var(--font-mono); font-size: 0.67rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-mute); margin-bottom: 12px;
}
.settings-nav a {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  border-radius: 8px; font-size: 0.84rem; font-weight: 500;
  color: var(--ink-dim); text-decoration: none;
  transition: all 0.2s; border-left: 2px solid transparent; margin-bottom: 2px;
}
.settings-nav a:hover {
  background: var(--bg-2); color: var(--ink); border-left-color: var(--gold);
}
.settings-nav a.active {
  background: var(--gold-light); color: var(--gold);
  border-left-color: var(--gold); font-weight: 600;
}

/* Settings cards */
.settings-card {
  background: var(--bg-1); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden; margin-bottom: 20px;
  scroll-margin-top: 96px;
}
.settings-card-header {
  display: flex; align-items: center; gap: 14px;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.settings-card-icon {
  width: 40px; height: 40px; border-radius: var(--r-md);
  background: var(--gold-light);
  border: 1px solid rgba(201,146,10,0.18);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
}
[data-theme="dark"] .settings-card-icon {
  border-color: rgba(232,184,75,0.18);
}
.settings-card-title {
  font-size: 1rem; font-weight: 700; color: var(--ink); margin-bottom: 2px;
}
.settings-card-sub { font-size: 0.78rem; color: var(--ink-mute); }
.settings-card-body { padding: 24px; }

/* Settings form inputs */
.s-form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.s-form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.s-form-group { margin-bottom: 14px; }
.s-form-group:last-child { margin-bottom: 0; }
.s-form-row-1 { margin-bottom: 12px; }

.s-label {
  display: block; font-size: 0.7rem; font-weight: 600;
  color: var(--ink-dim); letter-spacing: 0.06em; text-transform: uppercase;
  margin-bottom: 6px;
}
.s-label .optional {
  color: var(--ink-mute); font-weight: 400;
  text-transform: none; letter-spacing: 0; margin-left: 4px;
}

.s-input, .s-textarea, .s-select {
  box-sizing: border-box; width: 100%;
  background: var(--bg-2); border: 1.5px solid var(--border);
  border-radius: var(--r-sm); padding: 10px 13px;
  color: var(--ink); font-family: var(--font-body); font-size: 0.875rem;
  outline: none; transition: border-color 0.15s, box-shadow 0.15s; display: block;
}
.s-input:focus, .s-textarea:focus, .s-select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}
.s-input::placeholder, .s-textarea::placeholder { color: var(--ink-mute); }
.s-textarea { resize: vertical; min-height: 72px; line-height: 1.5; }
.s-select {
  cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%236b7280' d='M5 7L1 3h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 32px;
}

/* Toggle switch (sw) */
.sw { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.sw input { opacity: 0; width: 0; height: 0; }
.sw-slider {
  position: absolute; inset: 0; background: var(--bg-4);
  border-radius: 24px; cursor: pointer; transition: 0.2s;
  border: 1.5px solid var(--border-2);
}
.sw-slider::before {
  content: ''; position: absolute; height: 16px; width: 16px;
  left: 3px; bottom: 2px; background: #fff; border-radius: 50%;
  transition: 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.sw input:checked + .sw-slider { background: var(--gold); border-color: var(--gold); }
.sw input:checked + .sw-slider::before { transform: translateX(20px); }

/* Toggle row */
.s-toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.s-toggle-row:last-child { border-bottom: none; padding-bottom: 0; }
.s-toggle-info { flex: 1; }
.s-toggle-info strong {
  display: block; font-size: 0.875rem; font-weight: 600;
  color: var(--ink); margin-bottom: 2px;
}
.s-toggle-info span { font-size: 0.78rem; color: var(--ink-mute); line-height: 1.5; }
.s-toggle-label { flex: 1; }
.s-toggle-label strong { display: block; font-size: 0.875rem; color: var(--ink); font-weight: 600; }
.s-toggle-label span { font-size: 0.78rem; color: var(--ink-mute); }

/* Divider inside settings cards */
.s-divider { height: 1px; background: var(--border); margin: 20px 0; }

/* Section label inside settings card */
.s-section-label {
  font-family: var(--font-mono); font-size: 0.67rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold);
  margin-bottom: 14px; display: flex; align-items: center; gap: 8px;
}
.s-section-label::after {
  content: ''; flex: 1; height: 1px; background: var(--gold-light);
}
[data-theme="dark"] .s-section-label::after {
  background: rgba(232,184,75,0.12);
}

/* Info badge in settings */
.info-badge {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--gold-light);
  border: 1px solid rgba(201,146,10,0.15);
  border-left: 3px solid var(--gold);
  border-radius: var(--r-sm); padding: 12px 14px;
  margin-bottom: 18px; font-size: 0.82rem; color: var(--ink-dim); line-height: 1.6;
}
[data-theme="dark"] .info-badge {
  background: rgba(232,184,75,0.05);
  border-color: rgba(232,184,75,0.15);
}
.info-badge strong { color: var(--gold); }

/* Logo upload */
.logo-upload-area {
  border: 2px dashed var(--border-2); border-radius: var(--r-md);
  padding: 28px 20px; text-align: center; cursor: pointer;
  transition: all 0.2s; background: var(--bg-2); position: relative;
}
.logo-upload-area:hover { border-color: var(--gold); background: var(--gold-light); }
.logo-upload-icon { font-size: 2rem; margin-bottom: 8px; }
.logo-upload-text { font-size: 0.85rem; font-weight: 600; color: var(--ink-dim); margin-bottom: 4px; }
.logo-upload-hint { font-size: 0.75rem; color: var(--ink-mute); }
.logo-preview-wrap {
  display: none; align-items: center; gap: 16px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 14px 16px; margin-top: 12px;
}
.logo-preview-wrap.show { display: flex; }
.logo-preview-img { width: 64px; height: 40px; object-fit: contain; border-radius: 4px; background: #fff; padding: 4px; }
.logo-preview-name { font-size: 0.8rem; color: var(--ink-dim); flex: 1; }
.logo-remove-btn {
  font-size: 0.75rem; color: var(--red); background: none; border: none;
  cursor: pointer; font-family: var(--font-body); padding: 4px 8px;
}
.logo-remove-btn:hover { background: rgba(220,38,38,0.08); border-radius: 4px; }

/* Theme selector */
.theme-options { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 6px; }
.theme-option {
  border: 2px solid var(--border); border-radius: var(--r-md);
  overflow: hidden; cursor: pointer; transition: all 0.2s; position: relative;
}
.theme-option:hover { border-color: var(--border-2); }
.theme-option.active {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-glow);
}
.theme-option-preview { height: 52px; display: flex; flex-direction: column; padding: 6px 8px; gap: 4px; }
.theme-option-label {
  padding: 7px 10px; font-size: 0.75rem; font-weight: 600;
  color: var(--ink-dim); border-top: 1px solid var(--border);
  background: var(--bg-2);
}
.theme-check {
  display: none; position: absolute; top: 5px; right: 5px;
  width: 16px; height: 16px; background: var(--gold); border-radius: 50%;
  align-items: center; justify-content: center; font-size: 9px;
  color: #0e0e0f; font-weight: 700;
}
.theme-option.active .theme-check { display: flex; }

/* Currency picker */
.currency-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.currency-btn {
  padding: 8px 16px; border-radius: var(--r-sm);
  border: 1.5px solid var(--border); background: var(--bg-2);
  color: var(--ink-dim); font-family: var(--font-mono);
  font-size: 0.82rem; font-weight: 600; cursor: pointer; transition: all 0.15s;
}
.currency-btn:hover { border-color: var(--border-2); color: var(--ink); }
.currency-btn.active {
  background: var(--gold-light); border-color: var(--gold); color: var(--gold);
}

/* GST rate chips (settings + wizard shared) */
.rate-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.rate-chip {
  padding: 5px 12px; border-radius: 999px;
  border: 1.5px solid var(--border); background: var(--bg-2);
  color: var(--ink-dim); font-family: var(--font-mono);
  font-size: 0.78rem; font-weight: 600; cursor: pointer; transition: all 0.15s;
}
.rate-chip:hover { border-color: var(--border-2); color: var(--ink); }
.rate-chip.active {
  background: var(--gold-light); border-color: var(--gold); color: var(--gold);
}

/* Danger zone */
.danger-zone .settings-card-header { background: rgba(220,38,38,0.03); }
[data-theme="dark"] .danger-zone .settings-card-header { background: rgba(220,38,38,0.05); }
.danger-action {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; border-bottom: 1px solid rgba(220,38,38,0.1);
}
.danger-action:last-child { border-bottom: none; padding-bottom: 0; }
.danger-action-info strong { display: block; font-size: 0.875rem; color: var(--ink); margin-bottom: 2px; }
.danger-action-info span  { font-size: 0.78rem; color: var(--ink-mute); }
.btn-danger {
  background: transparent; color: var(--red);
  border: 1px solid rgba(220,38,38,0.3); border-radius: var(--r-sm);
  padding: 8px 16px; font-family: var(--font-body); font-size: 0.82rem;
  font-weight: 600; cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.btn-danger:hover { background: rgba(220,38,38,0.08); border-color: var(--red); }

/* Settings save bar */
.settings-save-bar {
  position: sticky; bottom: 0; z-index: 100;
  background: var(--bg); border-top: 1px solid var(--border);
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  box-shadow: 0 -6px 24px rgba(0,0,0,0.06);
}
[data-theme="dark"] .settings-save-bar { box-shadow: 0 -6px 24px rgba(0,0,0,0.3); }
.save-bar-status {
  font-size: 0.82rem; color: var(--ink-mute);
  display: flex; align-items: center; gap: 6px;
}
.save-bar-status .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-mute); }
.save-bar-status.saved { color: var(--green); }
.save-bar-status.saved .dot { background: var(--green); }
.save-bar-actions { display: flex; gap: 10px; }

/* Settings section title label */
.settings-section-title {
  font-family: var(--font-mono); font-size: 0.67rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold);
  margin-bottom: 14px; display: flex; align-items: center; gap: 8px;
}

/* ════════════════════════════════════════════════════════════════
   17. APP SHELL (app.html / index.html wizard layout)
════════════════════════════════════════════════════════════════ */
.app-shell {
  display: grid; grid-template-columns: 60% 40%;
  min-height: calc(100vh - 68px); width: 100%; overflow: hidden;
}
.app-shell > * { min-width: 0; }

.panel-left {
  background: var(--bg-1); border-right: 1px solid var(--border);
  overflow-y: auto; overflow-x: hidden;
  height: calc(100vh - 68px); position: sticky; top: 68px; min-width: 0;
}
.panel-right {
  background: var(--bg); padding: 16px;
  overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column; gap: 14px; min-width: 0;
  contain: layout;
}

/* Invoice canvas in app.html */
#invoiceCanvas {
  background: #fff; border-radius: 10px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.45);
  overflow: hidden; width: 100%; min-width: 0;
  position: relative;
}
#invoiceCanvas .inv-wrap { width: 100%; box-sizing: border-box; }
#invoiceCanvas .inv-scale-wrap { transform-origin: top left; width: 794px; }

/* Panel tabs */
.panel-tabs { overflow-x: auto; scrollbar-width: none; }
.panel-tabs::-webkit-scrollbar { display: none; }
.panel-tabs > * { min-width: 0; }
.panel-tab { flex-shrink: 0; }

/* Preview toolbar */
.preview-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px;
}
.preview-toolbar > * { min-width: 0; }

/* Mobile PDF button (hidden on desktop) */
.btn-pdf-mobile { display: none; }

/* ════════════════════════════════════════════════════════════════
   18. ITEM LIBRARY (autocomplete / saved items)
════════════════════════════════════════════════════════════════ */
.item-lib-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 8px; transition: border-color 0.15s;
}
.item-lib-row:hover { border-color: rgba(201,146,10,0.3); }
[data-theme="dark"] .item-lib-row:hover { border-color: rgba(232,184,75,0.3); }
.item-lib-info { flex: 1; min-width: 0; }
.item-lib-name { font-size: 0.875rem; font-weight: 600; color: var(--ink); }
.item-lib-meta { font-size: 0.75rem; color: var(--ink-mute); margin-top: 2px; }
.item-lib-actions { display: flex; gap: 6px; flex-shrink: 0; }
.item-lib-btn {
  padding: 4px 10px; border-radius: 6px; font-size: 0.72rem; font-weight: 600;
  cursor: pointer; border: 1px solid var(--border-2); background: var(--bg);
  color: var(--ink-dim); transition: all 0.15s; font-family: var(--font-body);
}
.item-lib-btn:hover { border-color: var(--gold); color: var(--gold); background: var(--gold-light); }
.item-lib-btn.del:hover { border-color: var(--red); color: var(--red); background: rgba(220,38,38,0.06); }

/* Autocomplete */
.autocomplete-wrap { position: relative; }
.autocomplete-list {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 500;
  background: var(--bg); border: 1.5px solid var(--border-2);
  border-radius: 10px; box-shadow: var(--shadow-lg);
  max-height: 200px; overflow-y: auto; display: none; margin-top: 2px;
}
.autocomplete-list.open { display: block; }
.autocomplete-item {
  padding: 9px 12px; cursor: pointer; font-size: 0.85rem;
  color: var(--ink-dim); border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover,
.autocomplete-item.focused { background: var(--gold-light); color: var(--ink); }
.autocomplete-item .ac-price {
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--gold); float: right;
}

/* ════════════════════════════════════════════════════════════════
   19. REWARD AD MODAL
════════════════════════════════════════════════════════════════ */
.reward-ad-modal .modal-box { max-width: 380px; }
.ad-slot-modal {
  width: 100%; height: 200px; background: var(--bg-2);
  border: 1px dashed var(--border-2); border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; color: var(--ink-mute); font-family: var(--font-mono);
  margin: 16px 0; position: relative; overflow: hidden;
}
.ad-timer-wrap { text-align: center; padding: 8px 0; }
.ad-timer-text { font-size: 0.82rem; color: var(--ink-mute); margin-bottom: 12px; }
.ad-timer-num {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--gold-light); border: 2px solid var(--gold);
  font-family: var(--font-display); font-size: 1.1rem; font-weight: 700;
  color: var(--gold); margin: 0 auto 12px;
}
.btn-ad-download {
  width: 100%; padding: 13px; background: var(--gold); color: #fff;
  border: none; border-radius: 10px; font-family: var(--font-body);
  font-size: 0.95rem; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all 0.2s; box-shadow: 0 4px 16px var(--gold-glow);
}
.btn-ad-download:hover:not(:disabled) { background: var(--gold-dim); transform: translateY(-1px); }
.btn-ad-download:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* ════════════════════════════════════════════════════════════════
   20. HISTORY ITEMS (app + wizard shared)
════════════════════════════════════════════════════════════════ */
.history-item { flex-wrap: wrap; gap: 8px; }
.history-item > div:first-child { flex: 1; min-width: 0; }

/* ════════════════════════════════════════════════════════════════
   21. TOTALS / FORM / TEMPLATE UTILITY CLASSES
════════════════════════════════════════════════════════════════ */
.totals-box  { width: 100%; box-sizing: border-box; max-width: 100%; }
.items-wrap  { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; box-sizing: border-box; }
.items-table { min-width: 360px; }
.template-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; max-width: 100%; box-sizing: border-box; }
.color-palette { flex-wrap: wrap; max-width: 100%; box-sizing: border-box; }
.form-row, .form-row-3 { min-width: 0; }
.form-row > *, .form-row-3 > * { min-width: 0; }

.form-section, .tab-content, .totals-box, .items-wrap,
.template-grid, .color-palette, .history-item { max-width: 100%; box-sizing: border-box; }

/* ════════════════════════════════════════════════════════════════
   22. ANIMATIONS
════════════════════════════════════════════════════════════════ */
@keyframes fadeUp  { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes pulse   { 0%,100% { opacity:1; transform:scale(1); } 50% { opacity:0.5; transform:scale(0.8); } }
.animate-fade-up   { animation: fadeUp 0.6s ease both; }

/* ════════════════════════════════════════════════════════════════
   23. DARK MODE — page-specific overrides
       These fix elements that use hardcoded light values in HTML
════════════════════════════════════════════════════════════════ */

/* Navbar in dark mode */
[data-theme="dark"] .navbar {
  background: var(--nav-bg) !important;
  border-bottom-color: var(--nav-border) !important;
}
[data-theme="dark"] .mobile-nav {
  background: var(--bg) !important;
  border-bottom-color: var(--border) !important;
}

/* index.html wizard section white theme → dark override */
[data-theme="dark"] .wizard-section {
  background: linear-gradient(180deg, #0e0e0f 0%, #111112 100%) !important;
  border-bottom-color: var(--border) !important;
}
[data-theme="dark"] .step-panel {
  background: var(--bg-1) !important;
  border-color: var(--border) !important;
}
[data-theme="dark"] .step-card { background: var(--bg-1) !important; }
[data-theme="dark"] .step-nav  {
  background: var(--bg-2) !important;
  border-top-color: var(--border) !important;
}
[data-theme="dark"] .preview-panel {
  background: var(--bg-1) !important;
  border-color: var(--border) !important;
}
[data-theme="dark"] .preview-panel-header {
  background: var(--bg-2) !important;
  border-bottom-color: var(--border) !important;
}
[data-theme="dark"] .preview-panel-canvas { background: var(--bg-2) !important; }
[data-theme="dark"] .download-bar {
  background: var(--bg-1) !important;
  border-top-color: var(--border) !important;
}
[data-theme="dark"] .btn-save-inv {
  background: var(--bg-2) !important;
  border-color: var(--border) !important;
  color: var(--ink-dim) !important;
}
[data-theme="dark"] .btn-save-inv:hover { border-color: var(--gold) !important; color: var(--gold) !important; }

/* Wizard form inputs dark */
[data-theme="dark"] .w-input,
[data-theme="dark"] .w-textarea,
[data-theme="dark"] .w-select {
  background: var(--bg-2) !important;
  border-color: var(--border) !important;
  color: var(--ink) !important;
}
[data-theme="dark"] .w-input:focus,
[data-theme="dark"] .w-textarea:focus,
[data-theme="dark"] .w-select:focus {
  border-color: var(--gold) !important;
  box-shadow: 0 0 0 3px rgba(232,184,75,0.12) !important;
}
[data-theme="dark"] .w-item-input {
  background: var(--bg-2) !important;
  border-color: var(--border) !important;
  color: var(--ink) !important;
}
[data-theme="dark"] .w-item-input:focus { border-color: var(--gold) !important; }
[data-theme="dark"] .w-totals-box {
  background: var(--bg-2) !important;
  border-color: var(--border) !important;
}
[data-theme="dark"] .w-total-row { color: var(--ink-dim) !important; border-bottom-color: var(--border) !important; }
[data-theme="dark"] .w-total-row.grand { color: var(--ink) !important; border-color: var(--border-2) !important; }
[data-theme="dark"] .w-history-item {
  background: var(--bg-2) !important;
  border-color: var(--border) !important;
}
[data-theme="dark"] .w-history-client { color: var(--ink) !important; }
[data-theme="dark"] .w-history-amount { color: var(--ink) !important; }
[data-theme="dark"] .w-history-date   { color: var(--ink-mute) !important; }

/* Tax breakdown dark */
[data-theme="dark"] .tax-breakdown {
  background: linear-gradient(135deg, rgba(232,184,75,0.06), rgba(232,184,75,0.02)) !important;
  border-color: rgba(232,184,75,0.2) !important;
}
[data-theme="dark"] .tax-info-box { background: var(--bg-2) !important; color: var(--ink-dim) !important; }
[data-theme="dark"] .tax-type-btn {
  background: var(--bg-2) !important;
  border-color: var(--border) !important;
  color: var(--ink-dim) !important;
}
[data-theme="dark"] .tax-type-btn:hover { border-color: var(--gold) !important; color: var(--gold) !important; }
[data-theme="dark"] .tax-type-btn.active { background: var(--gold) !important; color: #0e0e0f !important; }
[data-theme="dark"] .tax-rate-chip {
  background: var(--bg-2) !important;
  border-color: var(--border) !important;
  color: var(--ink-dim) !important;
}
[data-theme="dark"] .tax-rate-chip.active {
  background: rgba(232,184,75,0.12) !important;
  border-color: var(--gold) !important;
  color: var(--gold-dim) !important;
}

/* Template picker dark */
[data-theme="dark"] .w-tpl-thumb {
  border-color: var(--border) !important;
  background: var(--bg-2) !important;
}
[data-theme="dark"] .w-tpl-thumb.selected { border-color: var(--gold) !important; }
[data-theme="dark"] .w-tpl-label { background: var(--bg-3) !important; color: var(--ink-dim) !important; border-top-color: var(--border) !important; }
[data-theme="dark"] .sp-circle { background: var(--bg-3) !important; border-color: var(--border) !important; color: var(--ink-mute) !important; }
[data-theme="dark"] .sp-item.active .sp-circle { background: var(--gold) !important; border-color: var(--gold) !important; color: #0e0e0f !important; }
[data-theme="dark"] .sp-item.done .sp-circle { background: var(--bg-4) !important; border-color: var(--border-2) !important; color: var(--ink) !important; }
[data-theme="dark"] .sp-label { color: var(--ink-mute) !important; }
[data-theme="dark"] .sp-item.active .sp-label { color: var(--gold) !important; }

/* Hero (index.html) dark */
[data-theme="dark"] .hero {
  background: linear-gradient(160deg, #0e0e0f 60%, #111108 100%) !important;
}
[data-theme="dark"] .hero-grid {
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px) !important;
}
[data-theme="dark"] .invoice-preview {
  background: var(--bg-1) !important;
  border-color: var(--border) !important;
}
[data-theme="dark"] .preview-header { border-bottom-color: var(--border) !important; }
[data-theme="dark"] .preview-row { border-bottom-color: var(--border) !important; color: var(--ink-dim) !important; }
[data-theme="dark"] .preview-total { background: var(--bg-2) !important; }

/* Sections dark */
[data-theme="dark"] .w-section       { background: var(--bg) !important; }
[data-theme="dark"] .w-section-alt   { background: var(--bg-1) !important; border-color: var(--border) !important; }
[data-theme="dark"] .cta-section     { background: var(--bg-1) !important; border-color: var(--border) !important; }

/* Features, testimonials, cards dark */
[data-theme="dark"] .feature-item    { background: var(--bg) !important; }
[data-theme="dark"] .feature-item:hover { background: var(--bg-1) !important; }
[data-theme="dark"] .features-grid   { background: var(--border) !important; }
[data-theme="dark"] .testimonial     { background: var(--bg-1) !important; border-color: var(--border) !important; }
[data-theme="dark"] .home-tpl-card   { background: var(--bg-1) !important; border-color: var(--border) !important; }
[data-theme="dark"] .home-article-card { background: var(--bg-1) !important; border-color: var(--border) !important; }
[data-theme="dark"] .step-num        { background: var(--bg-1) !important; border-color: var(--border) !important; }

/* Sticky bar dark */
[data-theme="dark"] .sticky-dl-bar {
  background: rgba(14,14,15,0.95) !important;
  border-top-color: var(--border) !important;
}

/* Cookie bar dark */
[data-theme="dark"] .cookie-bar {
  background: var(--bg) !important;
  border-top-color: var(--border-2) !important;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.4) !important;
}

/* About page dark */
[data-theme="dark"] .about-hero      { background: var(--bg) !important; }
[data-theme="dark"] .value-card      { background: var(--bg-1) !important; border-color: var(--border) !important; }
[data-theme="dark"] .team-card       { background: var(--bg-1) !important; border-color: var(--border) !important; }
[data-theme="dark"] .stat-card       { background: var(--bg-1) !important; border-color: var(--border) !important; }

/* Contact page dark */
[data-theme="dark"] .contact-form-wrap { background: var(--bg-1) !important; border-color: var(--border) !important; }
[data-theme="dark"] .contact-info-card { background: var(--bg-1) !important; border-color: var(--border) !important; }

/* Profile autofill bar (index.html wizard) */
.profile-autofill-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--gold-light);
  border: 1px solid rgba(201,146,10,0.18);
  border-radius: var(--r-md); padding: 10px 14px; margin-bottom: 18px;
  font-size: 0.8rem; color: var(--ink-dim);
}
[data-theme="dark"] .profile-autofill-bar {
  background: rgba(232,184,75,0.06);
  border-color: rgba(232,184,75,0.18);
}
.profile-autofill-bar strong { color: var(--gold); }
.profile-autofill-bar .btn-fill-profile {
  background: var(--gold); color: #0e0e0f; border: none; border-radius: 6px;
  padding: 5px 12px; font-family: var(--font-body); font-size: 0.75rem;
  font-weight: 700; cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.profile-autofill-bar .btn-fill-profile:hover { background: var(--gold-dim); }

/* Items count badge */
.items-count-badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--gold-light);
  border: 1px solid rgba(201,146,10,0.18);
  border-radius: 999px; padding: 3px 10px;
  font-size: 0.7rem; font-weight: 700; color: var(--gold);
  font-family: var(--font-mono);
}
[data-theme="dark"] .items-count-badge { border-color: rgba(232,184,75,0.18); }

/* Validation error state */
.w-input.error, .w-textarea.error {
  border-color: var(--red) !important;
  box-shadow: 0 0 0 2px rgba(220,38,38,0.1) !important;
}

/* ════════════════════════════════════════════════════════════════
   24. PRINT STYLES
════════════════════════════════════════════════════════════════ */
@media print {
  .navbar, .panel-tabs, .panel-left, .btn-pdf-mobile,
  .preview-toolbar, .cookie-bar, .float-disclaimer,
  .toast-container { display: none !important; }
  .app-shell { display: block; }
  .panel-right { padding: 0; }
  #invoiceCanvas { box-shadow: none; border-radius: 0; }
}

/* ════════════════════════════════════════════════════════════════
   25. RESPONSIVE — BREAKPOINTS
════════════════════════════════════════════════════════════════ */

/* Large screens */
@media (min-width: 1600px) {
  .app-shell { grid-template-columns: 55% 45%; }
}
@media (min-width: 1920px) {
  .app-shell { max-width: 1920px; margin: 0 auto; grid-template-columns: 50% 50%; }
}

/* ≤ 1200px */
@media (max-width: 1200px) {
  .app-shell { grid-template-columns: 58% 42%; }
}

/* ≤ 1100px — Tablet landscape / small desktop */
@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 1fr; grid-template-rows: auto auto; }
  .panel-left { height: auto; position: relative; top: 0; overflow-y: visible; border-right: none; border-bottom: 1px solid var(--border); }
  .panel-right { height: auto; min-height: 500px; }
  .btn-pdf-mobile { display: flex; width: 100%; justify-content: center; margin-bottom: 4px; }
  .preview-toolbar { justify-content: space-between; }
  .legal-layout { grid-template-columns: 1fr; }
  .legal-toc    { display: none; }
}

/* ≤ 900px — Tablet portrait */
@media (max-width: 900px) {
  .hamburger    { display: flex !important; flex-shrink: 0; }
  .nav-links    { display: none !important; }
  .nav-settings-btn { display: none !important; }
  /* CRITICAL: Hide CTA btn at 900px to prevent navbar overflow & hamburger being pushed off-screen */
  .nav-cta .btn,
  .nav-cta .btn-gold { display: none !important; }
  .template-grid { grid-template-columns: repeat(2,1fr); }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .items-table colgroup col.c-desc { width: 38%; }
  .items-table colgroup col.c-qty  { width: 14%; }
  .items-table colgroup col.c-rate { width: 20%; }
  .items-table colgroup col.c-amt  { width: 20%; }
  .items-table colgroup col.c-del  { width: 8%; }
  .ad-slot-banner { height: 60px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
  /* Settings */
  .settings-layout { grid-template-columns: 1fr; gap: 24px; padding: 32px 0 80px; }
  .settings-nav { position: static; }
  .s-form-row, .s-form-row-3 { grid-template-columns: 1fr; }
  .theme-options { grid-template-columns: 1fr 1fr; }
}

/* ≤ 640px — Mobile */
@media (max-width: 640px) {
  body { padding-top: 60px; padding-bottom: 76px; }
  /* overflow:visible so nav-cta children aren't clipped */
  .navbar { padding: 0 14px !important; height: 60px; max-width: 100vw; overflow: visible; box-sizing: border-box; }
  .nav-logo-text { font-size: 0.97rem; }
  /* All nav items hidden except theme toggle + hamburger */
  .nav-links { display: none !important; }
  .nav-cta .btn,
  .nav-cta .btn-gold,
  .nav-cta .nav-settings-btn { display: none !important; }
  /* .theme-toggle stays visible, hamburger now inside nav-cta */
  .hamburger { display: flex !important; flex-shrink: 0; }
  .mobile-nav { top: 60px; }
  .app-shell { grid-template-columns: 1fr; }
  .panel-left { padding-bottom: 0; }
  .tab-content { padding: 16px; }
  .panel-tab { flex-shrink: 0; font-size: 0.65rem; padding: 12px 10px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; gap: 8px; }
  .template-grid { grid-template-columns: repeat(2,1fr); }
  .btn-pdf-mobile {
    display: flex !important; position: sticky; bottom: 0; left: 0; right: 0;
    z-index: 500; width: 100%; margin: 0; border-radius: 0; padding: 14px 20px;
    font-size: 1rem; min-height: 52px; justify-content: center;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.5);
  }
  .panel-right { padding: 12px; }
  #invoiceCanvas { border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
  #invoiceCanvas .inv-wrap { font-size: 11px !important; }
  .totals-box { padding: 10px 12px; }
  .history-item { padding: 9px 11px; }
  .ad-slot-banner { height: 50px; }
  .ad-slot-rect   { height: 150px; }
  .toast-container { bottom: 64px; right: 12px; left: 12px; }
  .toast { min-width: 0; max-width: 100%; }
  .float-disclaimer { bottom: 80px; }
  .cookie-bar-inner { flex-direction: column; align-items: flex-start; }
}

/* ≤ 480px */
@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
  .container { padding: 0 1rem; }
  .modal-box { margin: 8px; }
  .modal-header { padding: 16px 18px; }
  .modal-body   { padding: 16px 18px; }
  .modal-footer { padding: 12px 18px; }
}

/* ≤ 380px — Tiny mobile */
@media (max-width: 380px) {
  .template-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .template-thumb-preview { height: 72px; }
  .template-thumb-label { font-size: 0.62rem; padding: 4px 6px; }
  .panel-tab { font-size: 0.6rem; padding: 11px 7px; letter-spacing: 0; }
  .items-table { min-width: 300px; }
  .items-table colgroup col.c-desc { width: 40%; }
  .items-table colgroup col.c-qty  { width: 12%; }
  .items-table colgroup col.c-rate { width: 18%; }
  .items-table colgroup col.c-amt  { width: 20%; }
  .items-table colgroup col.c-del  { width: 10%; }
}

/* High zoom stability */
.app-shell > *, .panel-tabs > *, .form-row > *, .form-row-3 > *,
.preview-toolbar > * { min-width: 0; }
.nav-links, .nav-cta { flex-shrink: 0; }
input, textarea, select { max-width: 100%; box-sizing: border-box; }