/* ============================================================
   InvoiceForge — style.css
   Modern SaaS Invoice Generator
   Design: Deep navy + electric violet + cyan accent
   Typography: Syne (display) + Inter (body)
   ============================================================ */

/* ── DESIGN TOKENS ─────────────────────────────────────────── */
:root {
  /* Palette */
  --clr-bg:        #0c0e1a;
  --clr-surface:   #131627;
  --clr-surface2:  #1a1e35;
  --clr-border:    #252a45;
  --clr-border2:   #2e3455;

  --clr-violet:    #6c63ff;
  --clr-violet-lt: #8a83ff;
  --clr-violet-dk: #5249d0;
  --clr-cyan:      #3ecfcf;
  --clr-cyan-lt:   #5ee0e0;

  --clr-text:      #e8eaf6;
  --clr-text-sub:  #9197b3;
  --clr-text-muted:#5c6282;

  /* Status */
  --clr-paid:      #22c55e;
  --clr-unpaid:    #ef4444;
  --clr-pending:   #f59e0b;

  /* Gradients */
  --grad-brand: linear-gradient(135deg, var(--clr-violet) 0%, var(--clr-cyan) 100%);
  --grad-glow:  radial-gradient(ellipse at 50% 0%, rgba(108,99,255,.18) 0%, transparent 65%);

  /* Invoice doc */
  --inv-bg:        #ffffff;
  --inv-text:      #111827;
  --inv-text-sub:  #6b7280;
  --inv-border:    #e5e7eb;
  --inv-accent:    #6c63ff;
  --inv-head-bg:   #f9fafb;

  /* Spacing */
  --space-xs:  .375rem;
  --space-sm:  .625rem;
  --space-md:  1rem;
  --space-lg:  1.5rem;
  --space-xl:  2.5rem;
  --space-2xl: 4rem;

  /* Typography */
  --font-display: 'Syne', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, sans-serif;

  /* Radius */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  24px;

  /* Shadow */
  --shadow-sm:  0 1px 3px rgba(0,0,0,.4);
  --shadow-md:  0 4px 16px rgba(0,0,0,.5);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.6);
  --shadow-glow:0 0 32px rgba(108,99,255,.25);

  /* Transition */
  --trans: 180ms ease;
}

/* ── RESET & BASE ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--clr-bg);
  color: var(--clr-text);
  font-size: 1rem;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a  { color: var(--clr-violet-lt); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── UTILITY ────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1280px;
  margin-inline: auto;
  padding-inline: clamp(1rem, 5vw, 2.5rem);
}

.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.text-right { text-align: right; }
.required { color: #f87171; }
.optional  { color: var(--clr-text-muted); font-size: .8em; }

/* ── BUTTONS ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-family: var(--font-body);
  font-size: .875rem;
  font-weight: 600;
  padding: .6rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: background var(--trans), border-color var(--trans),
              transform var(--trans), box-shadow var(--trans), color var(--trans);
  white-space: nowrap;
  letter-spacing: .01em;
  text-decoration: none;
}
.btn:focus-visible {
  outline: 2px solid var(--clr-violet);
  outline-offset: 2px;
}
.btn:active { transform: scale(.97); }

.btn-primary {
  background: var(--grad-brand);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 12px rgba(108,99,255,.4);
}
.btn-primary:hover {
  box-shadow: 0 4px 20px rgba(108,99,255,.6);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--clr-surface2);
  color: var(--clr-text);
  border-color: var(--clr-border2);
}
.btn-secondary:hover {
  background: var(--clr-border);
  border-color: var(--clr-violet);
  color: var(--clr-violet-lt);
}

.btn-outline {
  background: transparent;
  color: var(--clr-text-sub);
  border-color: var(--clr-border2);
}
.btn-outline:hover {
  border-color: var(--clr-violet);
  color: var(--clr-violet-lt);
  background: rgba(108,99,255,.06);
}

.btn-sm {
  font-size: .8rem;
  padding: .45rem 1rem;
}

/* Hero buttons */
.btn-hero-primary {
  background: var(--grad-brand);
  color: #fff;
  border: none;
  padding: .8rem 1.75rem;
  font-size: 1rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  box-shadow: 0 0 0 0 rgba(108,99,255,.5);
  transition: transform var(--trans), box-shadow var(--trans);
  font-family: var(--font-body);
}
.btn-hero-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(108,99,255,.55);
}
.btn-hero-secondary {
  background: rgba(62,207,207,.08);
  color: var(--clr-cyan);
  border: 1.5px solid rgba(62,207,207,.35);
  padding: .75rem 1.6rem;
  font-size: 1rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  transition: background var(--trans), border-color var(--trans), transform var(--trans);
  font-family: var(--font-body);
}
.btn-hero-secondary:hover {
  background: rgba(62,207,207,.16);
  border-color: var(--clr-cyan);
  transform: translateY(-2px);
}
.btn-hero-ghost {
  background: transparent;
  color: var(--clr-text-sub);
  border: 1.5px solid var(--clr-border2);
  padding: .75rem 1.6rem;
  font-size: 1rem;
  border-radius: var(--radius-md);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  transition: border-color var(--trans), color var(--trans), background var(--trans);
  font-family: var(--font-body);
}
.btn-hero-ghost:hover {
  border-color: var(--clr-text-sub);
  color: var(--clr-text);
  background: rgba(255,255,255,.04);
}
.btn-hero-primary:focus-visible,
.btn-hero-secondary:focus-visible,
.btn-hero-ghost:focus-visible {
  outline: 2px solid var(--clr-violet);
  outline-offset: 2px;
}

/* ── SITE HEADER ────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13,14,26,.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--clr-border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 62px;
  gap: 1rem;
}
.logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none;
}
.logo-text {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--clr-text);
  letter-spacing: -.01em;
}
.logo-text strong { color: var(--clr-violet-lt); }

.header-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.nav-link {
  font-size: .875rem;
  font-weight: 500;
  color: var(--clr-text-sub);
  text-decoration: none;
  transition: color var(--trans);
}
.nav-link:hover { color: var(--clr-text); text-decoration: none; }

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: .4rem;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--clr-text-sub);
  border-radius: 2px;
  transition: transform var(--trans), opacity var(--trans);
}

/* ── HERO ───────────────────────────────────────────────────── */
.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(4rem, 12vw, 7rem) 0 clamp(3rem, 8vw, 5rem);
  text-align: center;
}
.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
}
.hero-orb--1 {
  width: 500px; height: 500px;
  top: -150px; left: 50%;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(108,99,255,.25) 0%, transparent 70%);
}
.hero-orb--2 {
  width: 300px; height: 300px;
  bottom: -80px; right: 10%;
  background: radial-gradient(circle, rgba(62,207,207,.18) 0%, transparent 70%);
}
.hero-grid-lines {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(108,99,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(108,99,255,.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 0%, transparent 75%);
}
.hero-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-size: .8rem;
  font-weight: 600;
  color: var(--clr-cyan-lt);
  background: rgba(62,207,207,.1);
  border: 1px solid rgba(62,207,207,.25);
  padding: .35rem .9rem;
  border-radius: 100px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.badge-dot {
  width: 7px; height: 7px;
  background: var(--clr-cyan);
  border-radius: 50%;
  animation: pulse-dot 2.2s ease infinite;
}
@keyframes pulse-dot {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .5; transform: scale(1.4); }
}
.hero-headline {
  /* font-family: var(--font-display); */
  font-size: clamp(2rem, 5.5vw, 3.8rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -.03em;
  color: var(--clr-text);
  max-width: 840px;
}
.hero-headline em {
  font-style: normal;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  font-size: clamp(.95rem, 2vw, 1.125rem);
  color: var(--clr-text-sub);
  max-width: 560px;
  line-height: 1.7;
}
.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .75rem;
  margin-top: .5rem;
}
.hero-stats {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-top: 1rem;
  padding: .9rem 2rem;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-xl);
}
.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .1rem;
}
.hero-stat strong {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-stat span {
  font-size: .75rem;
  color: var(--clr-text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.hero-stat-divider {
  width: 1px; height: 32px;
  background: var(--clr-border2);
}

/* ── FEATURES ───────────────────────────────────────────────── */
.features {
  padding: clamp(3rem, 7vw, 5rem) 0;
  border-top: 1px solid var(--clr-border);
}
.section-eyebrow {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2.5vw, 1.35rem);
  font-weight: 700;
  color: var(--clr-text-sub);
  text-align: center;
  margin-bottom: 2.5rem;
  letter-spacing: .02em;
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}
.feature-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: border-color var(--trans), box-shadow var(--trans), transform var(--trans);
}
.feature-card:hover {
  border-color: rgba(108,99,255,.45);
  box-shadow: 0 0 0 1px rgba(108,99,255,.2), var(--shadow-md);
  transform: translateY(-3px);
}
.feature-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px; height: 42px;
  background: rgba(108,99,255,.1);
  border: 1px solid rgba(108,99,255,.2);
  border-radius: var(--radius-md);
  color: var(--clr-violet-lt);
  margin-bottom: 1rem;
}
.feature-card h3 {
  font-size: .95rem;
  font-weight: 700;
  margin-bottom: .35rem;
  color: var(--clr-text);
}
.feature-card p {
  font-size: .85rem;
  color: var(--clr-text-sub);
  line-height: 1.6;
}

/* ── GENERATOR SECTION ──────────────────────────────────────── */
.generator-section {
  padding: clamp(2.5rem, 6vw, 4rem) 0 clamp(3rem, 7vw, 5rem);
  border-top: 1px solid var(--clr-border);
}
.generator-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}
.generator-title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  font-weight: 700;
  color: var(--clr-text);
  letter-spacing: -.02em;
}
.generator-toolbar {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
}

/* Layout: form + preview */
.generator-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}

/* ── FORM PANEL ─────────────────────────────────────────────── */
.form-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-section {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: border-color var(--trans);
  min-width: 0;
}
.form-section:hover { border-color: var(--clr-border2); }

/* Fieldset reset */
fieldset.form-section {
  border-radius: var(--radius-lg);
}

.section-label {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--clr-text-muted);
  margin-bottom: 1.25rem;
}
.section-label svg { color: var(--clr-violet-lt); }

/* Form grid */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .85rem;
}
.form-group--full { grid-column: 1 / -1; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  min-width: 0;
}
.form-group label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--clr-text-sub);
}

/* Inputs */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
select,
textarea {
  background: var(--clr-bg);
  border: 1.5px solid var(--clr-border);
  color: var(--clr-text);
  border-radius: var(--radius-sm);
  padding: .55rem .8rem;
  font-family: var(--font-body);
  font-size: .875rem;
  width: 100%;
  transition: border-color var(--trans), box-shadow var(--trans);
  outline: none;
  line-height: 1.5;
  -webkit-appearance: none;
  appearance: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--clr-violet);
  box-shadow: 0 0 0 3px rgba(108,99,255,.18);
}
input::placeholder, textarea::placeholder { color: var(--clr-text-muted); }
input.readonly-field {
  color: var(--clr-text-muted);
  cursor: default;
  background: var(--clr-surface2);
}
textarea { resize: vertical; min-height: 60px; }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239197b3' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
  padding-right: 2.2rem;
  cursor: pointer;
}

/* Currency bar */
.currency-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.currency-label {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--clr-text-muted);
  white-space: nowrap;
}
.currency-label svg { color: var(--clr-cyan); }
.select-currency {
  flex: 1;
  background: var(--clr-bg);
}

/* Logo upload */
.logo-upload-area {
  border: 1.5px dashed var(--clr-border2);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color var(--trans), background var(--trans);
  min-height: 88px;
  position: relative;
  overflow: hidden;
}
.logo-upload-area:hover {
  border-color: var(--clr-violet);
  background: rgba(108,99,255,.04);
}
.logo-upload-area:focus-visible {
  outline: 2px solid var(--clr-violet);
  outline-offset: 2px;
}
.logo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  color: var(--clr-text-muted);
  pointer-events: none;
  text-align: center;
}
.logo-placeholder svg { opacity: .5; }
.logo-placeholder span { font-size: .85rem; font-weight: 500; }
.logo-placeholder small { font-size: .75rem; opacity: .7; }
.logo-thumb {
  max-height: 60px;
  max-width: 100%;
  object-fit: contain;
  border-radius: 4px;
}
.btn-remove-logo {
  margin-top: .4rem;
  background: none;
  border: none;
  color: var(--clr-unpaid);
  font-size: .78rem;
  cursor: pointer;
  font-family: var(--font-body);
  padding: .25rem 0;
  text-decoration: underline;
}
.btn-remove-logo:hover { opacity: .8; }

/* Items table */
.items-table-wrap {
  margin-bottom: .85rem;
}
.items-table-header {
  display: grid;
  grid-template-columns: 1fr 70px 90px 90px 38px;
  gap: .4rem;
  padding: .5rem .6rem;
  background: var(--clr-surface2);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  border: 1px solid var(--clr-border);
  border-bottom: none;
}
.items-table-header span {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--clr-text-muted);
}

.item-row {
  display: grid;
  grid-template-columns: 1fr 70px 90px 90px 38px;
  gap: .4rem;
  align-items: start;
  padding: .65rem .6rem;
  border: 1px solid var(--clr-border);
  border-top: none;
  background: var(--clr-bg);
  transition: background var(--trans);
}
.item-row:hover { background: rgba(255,255,255,.015); }
.item-row:last-child { border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
.item-row input { font-size: .82rem; }

.item-cell {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  min-width: 0;
}
.item-cell input { width: 100%; }
.item-description {
  font-size: .75rem;
  padding: .4rem .7rem;
  min-height: 36px;
}
.item-total-display {
  padding: .55rem .7rem;
  background: var(--clr-surface2);
  border: 1.5px solid var(--clr-border);
  color: var(--clr-text);
  border-radius: var(--radius-sm);
  font-size: .82rem;
  font-weight: 600;
  min-width: 0;
  word-break: break-all;
}

.btn-remove-item {
  background: none;
  border: 1.5px solid transparent;
  color: var(--clr-text-muted);
  cursor: pointer;
  padding: .4rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
  transition: color var(--trans), border-color var(--trans), background var(--trans);
}
.btn-remove-item:hover {
  color: var(--clr-unpaid);
  border-color: rgba(239,68,68,.3);
  background: rgba(239,68,68,.08);
}

.btn-add-item {
  display: flex;
  align-items: center;
  gap: .45rem;
  background: none;
  border: 1.5px dashed var(--clr-border2);
  color: var(--clr-violet-lt);
  border-radius: var(--radius-sm);
  padding: .6rem 1rem;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  justify-content: center;
  transition: border-color var(--trans), background var(--trans);
  font-family: var(--font-body);
}
.btn-add-item:hover {
  background: rgba(108,99,255,.06);
  border-color: var(--clr-violet);
  border-style: solid;
}
.btn-add-item:focus-visible {
  outline: 2px solid var(--clr-violet);
  outline-offset: 2px;
}

/* Tax & Discount */
.tax-discount-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .85rem;
}
.toggle-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .6rem .85rem;
  background: var(--clr-bg);
  border: 1.5px solid var(--clr-border);
  border-radius: var(--radius-sm);
}
.toggle-label {
  font-size: .875rem;
  font-weight: 600;
  color: var(--clr-text-sub);
}
/* Toggle switch */
.toggle-switch { display: flex; align-items: center; }
.toggle-switch input { display: none; }
.toggle-track {
  display: flex;
  align-items: center;
  width: 40px; height: 22px;
  background: var(--clr-border2);
  border-radius: 100px;
  padding: 2px;
  cursor: pointer;
  transition: background var(--trans);
  position: relative;
}
.toggle-switch input:checked + .toggle-track {
  background: var(--clr-violet);
}
.toggle-thumb {
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.4);
  transition: transform var(--trans);
  position: absolute;
  left: 2px;
}
.toggle-switch input:checked + .toggle-track .toggle-thumb {
  transform: translateX(18px);
}
.gst-field { grid-column: 1 / -1; }

/* Form actions */
.form-actions {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}
.btn-action {
  flex: 1;
  min-width: 130px;
  justify-content: center;
  padding: .75rem 1rem;
  font-size: .9rem;
}

/* ── PREVIEW PANEL ──────────────────────────────────────────── */
.preview-panel {
  min-width: 0;
}
.preview-sticky {
  position: sticky;
  top: 80px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--clr-border2) transparent;
}

.preview-label {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--clr-text-muted);
  margin-bottom: .75rem;
}
.preview-label svg { color: var(--clr-cyan); }

.invoice-preview {
  background: #d0d5e8;
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,.1);
}

/* ── INVOICE DOCUMENT ───────────────────────────────────────── */
.inv-doc {
  background: var(--inv-bg);
  color: var(--inv-text);
  font-family: var(--font-body);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,.3);
}

/* Invoice header */
.inv-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.5rem 1.75rem 1.25rem;
  border-bottom: 2px solid var(--inv-accent);
  background: var(--inv-head-bg);
}
.inv-brand {
  display: flex;
  align-items: flex-start;
  gap: .85rem;
  flex: 1;
}
.inv-logo {
  max-height: 56px;
  max-width: 140px;
  object-fit: contain;
  border-radius: 4px;
}
.inv-company-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--inv-text);
  line-height: 1.2;
  margin-bottom: .25rem;
}
.inv-address, .inv-contact {
  font-size: .78rem;
  color: var(--inv-text-sub);
  line-height: 1.5;
  white-space: pre-line;
}
.inv-gst {
  font-size: .75rem;
  color: var(--inv-text-sub);
  margin-top: .2rem;
}
.inv-meta {
  text-align: right;
  min-width: 170px;
}
.inv-title-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .35rem;
  margin-bottom: .75rem;
}
.inv-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--inv-accent);
  letter-spacing: .06em;
}
.inv-status-badge {
  display: inline-block;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  padding: .2rem .6rem;
  border-radius: 100px;
  background: #fee2e2;
  color: #dc2626;
}
.inv-status-badge.paid    { background: #dcfce7; color: #16a34a; }
.inv-status-badge.pending { background: #fef9c3; color: #ca8a04; }
.inv-status-badge.unpaid  { background: #fee2e2; color: #dc2626; }

.inv-meta-row {
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
  font-size: .8rem;
  margin-bottom: .2rem;
}
.inv-meta-label { color: var(--inv-text-sub); }
.inv-meta-val   { font-weight: 600; color: var(--inv-text); }

/* Bill To */
.inv-bill-section {
  padding: 1rem 1.75rem;
  border-bottom: 1px solid var(--inv-border);
}
.inv-section-heading {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--inv-accent);
  margin-bottom: .4rem;
}
.inv-customer-name {
  font-weight: 700;
  font-size: .95rem;
  color: var(--inv-text);
  margin-bottom: .15rem;
}

/* Items table */
.inv-items { padding: 0 1.75rem; }
.inv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
  margin: .75rem 0;
}
.inv-table thead tr {
  background: var(--inv-head-bg);
  border-top: 1px solid var(--inv-border);
  border-bottom: 1px solid var(--inv-border);
}
.inv-table th {
  padding: .5rem .6rem;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--inv-text-sub);
  text-align: left;
}
.inv-table th:not(:first-child) { text-align: right; }
.inv-table td {
  padding: .6rem .6rem;
  color: var(--inv-text);
  border-bottom: 1px solid var(--inv-border);
  vertical-align: top;
}
.inv-table td:not(:first-child):not(:nth-child(2)) { text-align: right; }
.inv-table .item-name-cell { font-weight: 600; }
.inv-table .item-desc-cell {
  font-size: .72rem;
  color: var(--inv-text-sub);
  margin-top: .15rem;
}
.inv-empty-row {
  text-align: center;
  color: var(--inv-text-sub);
  padding: 1.5rem;
  font-style: italic;
}

/* Totals section */
.inv-totals-section {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: .85rem 1.75rem 1rem;
  border-top: 1px solid var(--inv-border);
}
.inv-notes-col { flex: 1; }
.inv-notes-block {
  margin-bottom: .75rem;
}
.inv-notes-block h4 {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--inv-accent);
  margin-bottom: .3rem;
}
.inv-notes-block p {
  font-size: .78rem;
  color: var(--inv-text-sub);
  line-height: 1.6;
  white-space: pre-line;
}

.inv-totals { min-width: 200px; }
.inv-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .3rem 0;
  font-size: .82rem;
  color: var(--inv-text);
  border-bottom: 1px solid var(--inv-border);
}
.inv-total-row span:first-child { color: var(--inv-text-sub); }
.inv-total-row:last-child { border-bottom: none; }
.inv-grand-total {
  font-weight: 700;
  font-size: 1rem;
  color: var(--inv-text) !important;
  border-top: 2px solid var(--inv-accent);
  margin-top: .2rem;
  padding-top: .5rem;
}
.inv-grand-total span { color: var(--inv-text) !important; }

/* Terms */
.inv-terms {
  padding: .75rem 1.75rem;
  border-top: 1px solid var(--inv-border);
  background: var(--inv-head-bg);
}
.inv-terms h4 {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--inv-text-sub);
  margin-bottom: .3rem;
}
.inv-terms p {
  font-size: .75rem;
  color: var(--inv-text-sub);
  line-height: 1.6;
  white-space: pre-line;
}

/* Invoice footer */
.inv-footer {
  padding: .65rem 1.75rem;
  background: var(--inv-accent);
  text-align: center;
}
.inv-footer p {
  font-size: .72rem;
  color: rgba(255,255,255,.8);
}
.inv-footer strong { color: #fff; }

/* ── SITE FOOTER ─────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--clr-border);
  padding: 2.5rem 0;
  margin-top: 2rem;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.footer-brand .logo-text {
  font-size: 1.1rem;
  display: block;
  margin-bottom: .3rem;
}
.footer-brand p {
  font-size: .8rem;
  color: var(--clr-text-muted);
}
.footer-copy {
  font-size: .8rem;
  color: var(--clr-text-muted);
}

/* ── TOAST ─────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  background: var(--clr-surface2);
  border: 1px solid var(--clr-border2);
  color: var(--clr-text);
  padding: .75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: .875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .25s ease, transform .25s ease;
  pointer-events: none;
  max-width: 320px;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
.toast.success { border-color: rgba(34,197,94,.4); background: rgba(34,197,94,.08); }
.toast.error   { border-color: rgba(239,68,68,.4);  background: rgba(239,68,68,.08); }

/* ── PRINT STYLES ─────────────────────────────────────────── */
@media print {
  body * { visibility: hidden; }
  #invDoc, #invDoc * { visibility: visible; }
  #invDoc {
    position: fixed;
    inset: 0;
    margin: 0;
    padding: 0;
    box-shadow: none;
    border-radius: 0;
  }
  .inv-footer { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .inv-status-badge { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ── RESPONSIVE ────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .generator-layout {
    grid-template-columns: 1fr;
  }
  .preview-sticky {
    position: static;
    max-height: none;
    overflow: visible;
  }
  .preview-panel { order: -1; }
}

@media (max-width: 768px) {
  .header-nav { display: none; }
  .hamburger  { display: flex; }
  .header-nav.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 62px;
    left: 0; right: 0;
    background: var(--clr-surface);
    border-bottom: 1px solid var(--clr-border);
    padding: 1rem 1.5rem;
    gap: .75rem;
    z-index: 99;
  }
  .form-grid { grid-template-columns: 1fr; }
  .form-group--full { grid-column: 1; }
  .items-table-header,
  .item-row {
    grid-template-columns: 1fr 55px 75px 75px 34px;
    gap: .3rem;
  }
  .tax-discount-grid { grid-template-columns: 1fr; }
  .gst-field { grid-column: 1; }
  .hero-stats { flex-direction: column; gap: .75rem; }
  .hero-stat-divider { width: 60px; height: 1px; }
  .generator-toolbar { width: 100%; }
  .generator-toolbar .btn { flex: 1; justify-content: center; }
  .inv-header { flex-direction: column; }
  .inv-meta { text-align: left; min-width: 0; }
  .inv-title-block { align-items: flex-start; }
  .inv-totals-section { flex-direction: column; }
  .inv-totals { width: 100%; }
}

@media (max-width: 480px) {
  .form-actions { flex-direction: column; }
  .btn-action   { min-width: 0; }
  .hero-ctas { flex-direction: column; align-items: center; }
  .hero-ctas > * { width: 100%; max-width: 320px; justify-content: center; }
  .features-grid { grid-template-columns: 1fr; }
}

/* ── REDUCED MOTION ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  .badge-dot { animation: none; }
}
