/* ============================================================
   invoice44 v2.0 — design system
   Mobile-first, high-quality, light/dark
   ============================================================ */

:root {
  --bg:         #fdfcf7;
  --bg-soft:    #f4f1e8;
  --bg-elev:    #ffffff;
  --ink:        #0d0d0c;
  --ink-soft:   #3a3a37;
  --ink-mute:   #8a8a82;
  --line:       #e4e0d2;
  --line-soft:  #edeae0;
  --accent:     #c9a227;
  --accent-dk:  #a8841d;
  --accent-txt: #1a1305;
  --success:    #1e5a3a;
  --danger:     #b8341e;

  --r:    12px;
  --r-sm: 8px;
  --r-lg: 20px;

  --sh-sm: 0 1px 3px rgba(20,18,10,.07);
  --sh:    0 6px 20px -6px rgba(20,18,10,.13), 0 2px 6px rgba(20,18,10,.05);
  --sh-lg: 0 28px 56px -18px rgba(20,18,10,.22), 0 8px 18px -8px rgba(20,18,10,.1);

  --f-head: 'Syne', sans-serif;
  --f-body: 'DM Sans', sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, monospace;

  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

[data-theme="dark"] {
  --bg:        #0a0a08;
  --bg-soft:   #121210;
  --bg-elev:   #1a1a17;
  --ink:       #f5f3e8;
  --ink-soft:  #c5c2af;
  --ink-mute:  #7a7870;
  --line:      #292822;
  --line-soft: #1e1d1a;
  --accent:    #d9b443;
  --accent-dk: #b8951c;
  --accent-txt:#080600;
  --sh-sm: 0 1px 3px rgba(0,0,0,.45);
  --sh:    0 6px 20px -6px rgba(0,0,0,.65), 0 2px 6px rgba(0,0,0,.3);
  --sh-lg: 0 28px 56px -18px rgba(0,0,0,.75), 0 8px 18px -8px rgba(0,0,0,.5);
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--f-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background .3s, color .3s;
}
h1,h2,h3,h4 {
  font-family: var(--f-head);
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.1;
  margin: 0;
}
a { color: inherit; text-decoration: none; }
input, select, textarea, button { font-family: inherit; font-size: 16px; } /* 16px prevents iOS zoom */
img { max-width: 100%; height: auto; }
.hidden { display: none !important; }
.skip-link {
  position: absolute; top: -100px; left: 0;
  padding: 10px 14px; background: var(--ink); color: var(--bg); z-index: 1000;
}
.skip-link:focus { top: 0; }

/* ============================================================
   Background atmosphere
   ============================================================ */
.bg-grid {
  position: fixed; inset: 0; z-index: -2;
  background-image:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, black 20%, transparent 75%);
  opacity: .55;
}
.bg-glow {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse 700px 500px at 85% 0%, rgba(201,162,39,.11), transparent 60%),
    radial-gradient(ellipse 500px 500px at 0% 35%, rgba(201,162,39,.05), transparent 60%);
}
[data-theme="dark"] .bg-glow {
  background:
    radial-gradient(ellipse 700px 500px at 85% 0%, rgba(217,180,67,.07), transparent 60%),
    radial-gradient(ellipse 500px 500px at 0% 35%, rgba(217,180,67,.03), transparent 60%);
}

/* ============================================================
   Header
   ============================================================ */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  padding-top: calc(14px + var(--safe-top));
  position: sticky; top: 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  z-index: 100;
  border-bottom: 1px solid var(--line-soft);
}
@media (min-width: 768px) { .site-header { padding-inline: 40px; } }

.brand-mark { display: flex; align-items: center; gap: 10px; }
.logo-svg { width: 34px; height: 34px; flex-shrink: 0; }
.logo-svg .logo-bg  { fill: var(--ink); }
.logo-svg .logo-text {
  font-family: var(--f-head); font-weight: 800; font-size: 15px;
  fill: var(--accent); letter-spacing: -.06em;
}
.brand-name { font-family: var(--f-head); font-weight: 700; font-size: 20px; letter-spacing: -.04em; }
.brand-accent { color: var(--accent); }

.header-nav { display: flex; align-items: center; gap: 8px; }

/* ============================================================
   Buttons (min 44×44 touch targets)
   ============================================================ */
.btn-primary, .btn-secondary, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px;
  padding: 11px 18px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-weight: 600; font-size: 15px; letter-spacing: -.005em;
  cursor: pointer; white-space: nowrap;
  transition: all .18s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary { background: var(--ink); color: var(--bg); box-shadow: var(--sh-sm); }
.btn-primary:hover { background: var(--accent); color: var(--accent-txt); transform: translateY(-1px); box-shadow: var(--sh); }
.btn-primary:active { transform: none; }
.btn-secondary { background: var(--bg-elev); border-color: var(--line); color: var(--ink); }
.btn-secondary:hover { border-color: var(--ink); background: var(--bg-soft); }
.btn-ghost { background: transparent; color: var(--ink-soft); border-color: var(--line); }
.btn-ghost:hover { color: var(--ink); background: var(--bg-soft); }
.btn-icon {
  width: 44px; height: 44px; padding: 0; flex-shrink: 0;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: 50%; cursor: pointer; color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .18s; -webkit-tap-highlight-color: transparent;
}
.btn-icon:hover { background: var(--bg-soft); }
.btn-small { padding: 7px 12px; font-size: 13px; min-height: 36px; }
.btn-text { font-weight: 600; font-size: 14px; color: var(--ink-soft); transition: color .18s; }
.btn-text:hover { color: var(--accent); }

/* Theme icon swap */
.icon-sun  { display: none; }
.icon-moon { display: block; }
[data-theme="dark"] .icon-sun  { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

/* ============================================================
   Hero
   ============================================================ */
.hero {
  padding: 40px 20px 60px;
  display: grid; grid-template-columns: 1fr; gap: 40px;
  max-width: 1360px; margin: 0 auto; align-items: center;
}
@media (min-width: 900px) {
  .hero { grid-template-columns: 1.2fr 1fr; gap: 60px; padding: 80px 40px 100px; }
}
.hero-inner { max-width: 680px; }

.hero-tag {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border: 1px solid var(--line);
  border-radius: 999px; font-size: 11px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft);
  background: var(--bg-elev); margin-bottom: 20px;
}
.pulse {
  width: 7px; height: 7px; background: var(--accent); border-radius: 50%;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); }
  70%  { box-shadow: 0 0 0 9px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.hero-title { font-size: clamp(36px, 7vw, 78px); margin-bottom: 18px; }
.hero-italic { font-style: italic; font-weight: 500; color: var(--accent); }
.hero-sub {
  font-size: clamp(15px, 2vw, 17px); color: var(--ink-soft);
  max-width: 520px; margin: 0 0 28px;
}
.hero-cta { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.hero-features {
  display: flex; gap: 8px; flex-wrap: wrap; margin-top: 36px;
}
.feature-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: 999px;
  background: var(--bg-elev); border: 1px solid var(--line-soft);
  font-size: 12px; color: var(--ink-soft); font-weight: 500;
}
.feature-pill .dot { width: 5px; height: 5px; background: var(--accent); border-radius: 50%; }

/* Receipt mockup */
.hero-preview {
  display: flex; justify-content: center; align-items: center;
}
.receipt-mockup {
  width: 100%; max-width: 300px; aspect-ratio: 3 / 4;
  background: var(--bg-elev); border-radius: 6px;
  padding: 28px 24px; box-shadow: var(--sh-lg);
  display: flex; flex-direction: column; gap: 12px;
  position: relative; transform: rotate(2deg);
  transition: transform .4s ease;
}
.receipt-mockup:hover { transform: rotate(0deg) translateY(-5px); }
.receipt-mockup::before {
  content: "44";
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%) rotate(-15deg);
  font-family: var(--f-head); font-weight: 800; font-size: 110px;
  color: var(--accent); opacity: .07; letter-spacing: -.08em; pointer-events: none;
}
.mock-line  { height: 7px; background: var(--line); border-radius: 2px; width: 80%; }
.mock-line.strong { background: var(--ink); height: 11px; width: 55%; }
.mock-line.short  { width: 38%; }
.mock-line.tiny   { height: 5px; }
.mock-line.mock-amount { width: 28%; }
.mock-divider { height: 1px; background: var(--line); background-image: linear-gradient(to right, var(--line) 50%, transparent 50%); background-size: 7px 1px; margin: 2px 0; }
.mock-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.mock-row .mock-line { width: auto; flex: 1; }
.mock-row .mock-amount { flex: 0 0 28%; }

/* ============================================================
   Ad slots
   ============================================================ */
.ad-slot {
  margin: 16px 20px; min-height: 70px;
  border: 1px dashed var(--line); border-radius: var(--r);
  background: var(--bg-soft);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-mute); font-size: 10px; letter-spacing: .12em;
  text-transform: uppercase;
}
@media (min-width: 768px) {
  .ad-slot { margin: 20px 40px; max-width: 940px; margin-inline: auto; min-height: 90px; }
}

/* ============================================================
   App container
   ============================================================ */
.app { display: none; padding: 0 16px 60px; padding-bottom: calc(60px + var(--safe-bottom)); }
.app.is-active { display: block; }
@media (min-width: 768px) { .app { padding-inline: 40px; max-width: 980px; margin: 0 auto; } }

/* ============================================================
   Steps nav — horizontal scroll on mobile
   ============================================================ */
.steps {
  display: flex; gap: 6px;
  padding: 6px;
  background: var(--bg-soft);
  border-radius: var(--r);
  margin-bottom: 24px;
  overflow-x: auto; scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.steps::-webkit-scrollbar { display: none; }

.step {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 7px;
  padding: 11px 14px;
  border: 0; background: transparent; cursor: pointer;
  border-radius: var(--r-sm);
  font-weight: 600; font-size: 13px; color: var(--ink-mute);
  min-height: 44px;
  transition: all .2s; white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.step span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--bg-elev); border: 1px solid var(--line);
  font-size: 11px; font-weight: 700; font-family: var(--f-mono);
  flex-shrink: 0;
}
.step.active { background: var(--bg-elev); color: var(--ink); box-shadow: var(--sh-sm); }
.step.active span { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.step.done span   { background: var(--accent); border-color: var(--accent); color: var(--accent-txt); }
.step.done        { color: var(--ink-soft); }

/* ============================================================
   Step panels
   ============================================================ */
.step-panel {
  display: none;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--r); padding: 20px 16px;
  box-shadow: var(--sh-sm);
  animation: panelIn .3s ease;
}
@media (min-width: 600px) { .step-panel { padding: 28px; } }
@media (min-width: 768px) { .step-panel { padding: 36px; } }
.step-panel.active { display: block; }
@keyframes panelIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.panel-head {
  margin-bottom: 22px; padding-bottom: 18px;
  border-bottom: 1px solid var(--line-soft);
}
.panel-head h2 { font-size: clamp(20px, 4vw, 28px); margin-bottom: 5px; }
.panel-head p  { color: var(--ink-mute); font-size: 13px; margin: 0; }

.panel-actions {
  margin-top: 24px; padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  flex-wrap: wrap;
}

/* ============================================================
   Forms — mobile-first
   ============================================================ */
.form-grid {
  display: grid; grid-template-columns: 1fr; gap: 14px;
}
@media (min-width: 600px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .field.full { grid-column: 1 / -1; }
}

.field { display: flex; flex-direction: column; gap: 5px; }
.field label {
  font-size: 11px; font-weight: 700; color: var(--ink-soft);
  letter-spacing: .04em; text-transform: uppercase;
}

input[type="text"], input[type="tel"], input[type="email"],
input[type="number"], input[type="date"], select, textarea {
  width: 100%;
  padding: 12px 13px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg);
  color: var(--ink);
  font-size: 16px; /* prevents iOS zoom */
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
  appearance: auto; -webkit-appearance: auto;
  min-height: 48px; /* touch target */
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
input::placeholder { color: var(--ink-mute); }
textarea { resize: vertical; min-height: 70px; font-size: 15px; }

.input-row { display: flex; gap: 8px; }
.input-row select { flex: 0 0 100px; }

/* ============================================================
   Logo zone
   ============================================================ */
.logo-zone {
  margin-top: 24px; padding: 18px 16px;
  border: 1.5px dashed var(--line);
  border-radius: var(--r); display: flex;
  align-items: center; gap: 16px; flex-wrap: wrap;
}
.logo-preview {
  width: 88px; height: 88px; flex-shrink: 0;
  border-radius: var(--r-sm); background: var(--bg-soft);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.logo-placeholder {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  color: var(--ink-mute); font-size: 10px; text-align: center;
}
.logo-controls {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center; flex: 1;
}
.logo-colors {
  width: 100%; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line);
}
.color-label {
  font-size: 11px; color: var(--ink-mute); font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
}
.color-chip {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid var(--bg-elev);
  box-shadow: 0 0 0 1px var(--line);
  cursor: pointer; padding: 0;
  transition: transform .15s;
  -webkit-tap-highlight-color: transparent;
}
.color-chip:hover { transform: scale(1.12); }
.color-chip.active { box-shadow: 0 0 0 2.5px var(--accent); }

/* ============================================================
   Items table — mobile-first stacked layout
   ============================================================ */
.items-wrap { margin-bottom: 24px; }

.items-header {
  display: none; /* hidden on mobile */
  padding: 0 4px 8px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--ink-mute);
}
@media (min-width: 640px) {
  .items-header {
    display: grid;
    grid-template-columns: 1fr 70px 110px 110px 40px;
    gap: 8px;
  }
}

/* Mobile: card-style items */
.item-row {
  display: grid;
  grid-template-areas:
    "desc desc del"
    "qty  price total";
  grid-template-columns: 80px 1fr 1fr;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  background: var(--bg);
  margin-bottom: 8px;
}
@media (min-width: 640px) {
  .item-row {
    display: grid;
    grid-template-areas: unset;
    grid-template-columns: 1fr 70px 110px 110px 40px;
    align-items: center;
    padding: 8px 6px;
  }
  .item-desc      { grid-area: unset; }
  .item-qty-wrap  { grid-area: unset; }
  .item-price-wrap{ grid-area: unset; }
  .item-total-wrap{ grid-area: unset; }
  .item-del-btn   { grid-area: unset; align-self: center; }
}

.item-desc      { grid-area: desc; min-width: 0; }
.item-qty-wrap  { grid-area: qty; }
.item-price-wrap{ grid-area: price; }
.item-total-wrap{ grid-area: total; }
.item-del-btn   { grid-area: del; }

.item-mobile-label {
  display: block;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--ink-mute); margin-bottom: 3px;
}
@media (min-width: 640px) { .item-mobile-label { display: none; } }

.item-row input {
  padding: 9px 10px; font-size: 15px; min-height: 42px;
  min-width: 0; width: 100%;
}

.item-total-display {
  font-family: var(--f-mono); font-weight: 600; font-size: 13px;
  padding: 9px 6px; text-align: right; color: var(--ink);
  white-space: nowrap;
}

.item-del-btn {
  width: 40px; height: 40px;
  border: 0; background: transparent; border-radius: var(--r-sm);
  cursor: pointer; color: var(--ink-mute);
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .15s; -webkit-tap-highlight-color: transparent;
  justify-self: end; align-self: start;
}
@media (min-width: 640px) { .item-del-btn { align-self: center; } }
.item-del-btn:hover {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}

.btn-add {
  width: 100%; justify-content: center;
  margin-top: 4px; padding: 14px;
  border-style: dashed; font-size: 14px;
}

/* Totals summary grid */
.totals-grid {
  display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 24px;
}
@media (min-width: 600px) {
  .totals-grid { grid-template-columns: repeat(3, 1fr); }
  .totals-grid .field.full { grid-column: 1 / -1; }
}

.totals-summary {
  background: var(--bg-soft); border-radius: var(--r);
  padding: 18px 20px; display: flex; flex-direction: column; gap: 7px;
  font-family: var(--f-mono); font-size: 13px;
}
.totals-summary > div { display: flex; justify-content: space-between; color: var(--ink-soft); }
.totals-summary .grand {
  border-top: 1px dashed var(--line); padding-top: 11px; margin-top: 3px;
  color: var(--ink); font-size: 17px; font-weight: 700;
}
.totals-summary .grand span:first-child {
  font-family: var(--f-head); letter-spacing: -.02em;
}

/* ============================================================
   Template picker
   ============================================================ */
.template-picker {
  display: flex; gap: 7px; margin-bottom: 20px;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}
.template-picker::-webkit-scrollbar { display: none; }
.tpl-chip {
  padding: 10px 16px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--bg);
  color: var(--ink-soft); font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap; min-height: 44px;
  transition: all .15s; -webkit-tap-highlight-color: transparent;
}
.tpl-chip:hover  { border-color: var(--ink); color: var(--ink); }
.tpl-chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ============================================================
   Preview area
   ============================================================ */
.preview-wrap {
  background: var(--bg-soft); border-radius: var(--r);
  padding: 16px; margin-bottom: 24px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
@media (min-width: 600px) { .preview-wrap { padding: 24px; } }
.preview-frame { min-width: 300px; display: flex; justify-content: center; }

/* Receipt canvas base */
.receipt-canvas {
  background: #fff; color: #111;
  padding: 28px 24px;
  width: 100%; max-width: 620px;
  min-height: 600px;
  box-shadow: var(--sh-lg);
  position: relative; overflow: hidden;
}
@media (min-width: 640px) { .receipt-canvas { padding: 36px 32px; } }

/* ============================================================
   Download buttons — 2-column grid on mobile
   ============================================================ */
.download-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
@media (min-width: 480px) { .download-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 768px) { .download-grid { grid-template-columns: repeat(6, 1fr); } }

.dl-btn {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 3px; padding: 14px 13px;
  border: 1.5px solid var(--line); border-radius: var(--r);
  background: var(--bg); cursor: pointer; color: var(--ink);
  text-align: left; transition: all .15s; min-height: 80px;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.dl-btn:hover:not(:disabled) {
  border-color: var(--accent); background: var(--bg-soft);
  transform: translateY(-2px); box-shadow: var(--sh);
}
.dl-btn:active:not(:disabled) { transform: none; }
.dl-btn:disabled { opacity: .5; cursor: not-allowed; }
.dl-btn.loading { opacity: .7; }
.dl-btn.loading::after {
  content: '';
  position: absolute; top: 6px; right: 8px;
  width: 12px; height: 12px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.dl-btn svg { color: var(--accent); margin-bottom: 2px; }
.dl-btn .dl-name { font-family: var(--f-head); font-weight: 700; font-size: 16px; }
.dl-btn .dl-desc { font-size: 11px; color: var(--ink-mute); line-height: 1.3; }

/* ============================================================
   Receipt template — CLASSIC
   ============================================================ */
.tpl-classic {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px; line-height: 1.5; color: #111;
}
.tpl-classic .r-head {
  text-align: center; border-bottom: 2px dashed #222;
  padding-bottom: 14px; margin-bottom: 14px;
}
.tpl-classic .r-logo {
  display: block; max-width: 72px; max-height: 72px;
  margin: 0 auto 10px; border-radius: 6px; object-fit: contain;
}
.tpl-classic .r-brand {
  font-family: 'Syne', sans-serif; font-weight: 800; font-size: 20px;
  letter-spacing: -.02em; margin-bottom: 3px;
}
.tpl-classic .r-tagline { font-size: 10px; color: #555; }
.tpl-classic .r-contact { font-size: 10.5px; color: #444; margin-top: 6px; line-height: 1.45; }
.tpl-classic .r-doctype {
  text-align: center; font-family: 'Syne', sans-serif; font-weight: 800;
  font-size: 16px; letter-spacing: .18em;
  padding: 7px 0; border-top: 1px solid #222; border-bottom: 1px solid #222;
  margin: 10px 0;
}
.tpl-classic .r-meta {
  display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 10px; margin-bottom: 10px;
}
.tpl-classic .r-meta strong { display: block; font-size: 8px; text-transform: uppercase; color: #777; }
.tpl-classic .r-bill-to {
  font-size: 11px; padding: 8px; background: #f8f7f2;
  border-left: 3px solid #c9a227; margin-bottom: 10px; line-height: 1.45;
}
.tpl-classic .r-items { margin: 8px 0; }
.tpl-classic .r-item {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 5px 0; border-bottom: 1px dotted #ddd; font-size: 11.5px;
}
.tpl-classic .r-item-desc { flex: 1; padding-right: 8px; line-height: 1.35; }
.tpl-classic .r-item-desc small { display: block; color: #888; font-size: 9.5px; }
.tpl-classic .r-item-amt { font-weight: 700; white-space: nowrap; }
.tpl-classic .r-totals {
  border-top: 1px dashed #222; padding-top: 7px; margin-top: 7px;
}
.tpl-classic .r-totals > div { display: flex; justify-content: space-between; padding: 2px 0; font-size: 11.5px; }
.tpl-classic .r-grand {
  border-top: 1.5px solid #222; margin-top: 4px; padding-top: 5px;
  font-size: 15px; font-weight: 700;
  font-family: 'Syne', sans-serif; letter-spacing: -.01em;
}
.tpl-classic .r-status-badge {
  display: inline-block; margin-top: 8px;
  padding: 3px 10px; border: 1.5px solid #222; border-radius: 3px;
  font-size: 9px; font-weight: 700; letter-spacing: .12em;
}
.tpl-classic .r-foot {
  text-align: center; font-size: 10.5px; color: #555;
  border-top: 2px dashed #222; padding-top: 12px; margin-top: 14px;
}
.tpl-classic .r-thanks { font-family: 'Syne'; font-weight: 700; font-size: 12px; color: #111; }
.tpl-classic .r-status-row  { margin-top: 8px; }
.tpl-classic .r-status-badge  { display:inline-block; padding:3px 10px; border:1.5px solid #222; border-radius:3px; font-size:9px; font-weight:700; letter-spacing:.12em; }
.tpl-classic .r-poweredby { font-size: 9.5px; color: #aaa; margin-top: 4px; }

/* ============================================================
   Receipt template — MODERN
   ============================================================ */
.tpl-modern { font-family: 'DM Sans', sans-serif; color: #0d0d0d; font-size: 12.5px; }
.tpl-modern .r-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  flex-wrap: wrap; gap: 12px;
  padding-bottom: 22px; border-bottom: 3px solid #0d0d0d; margin-bottom: 22px;
}
.tpl-modern .r-head-left  { display: flex; gap: 14px; align-items: center; }
.tpl-modern .r-logo { width: 54px; height: 54px; object-fit: contain; border-radius: 8px; }
.tpl-modern .r-brand { font-family: 'Syne'; font-weight: 800; font-size: 22px; letter-spacing: -.03em; line-height: 1; }
.tpl-modern .r-tagline { font-size: 11px; color: #666; margin-top: 3px; }
.tpl-modern .r-head-right { text-align: right; }
.tpl-modern .r-doctype { font-family: 'Syne'; font-size: 28px; font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.tpl-modern .r-num { font-family: 'JetBrains Mono'; font-size: 10.5px; color: #888; margin-top: 4px; }
.tpl-modern .r-meta-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 22px;
}
.tpl-modern .r-meta-grid h4 {
  font-size: 9px; text-transform: uppercase; letter-spacing: .14em;
  color: #888; margin: 0 0 5px; font-weight: 700; font-family: 'DM Sans';
}
.tpl-modern .r-meta-grid p { margin: 0; font-size: 11.5px; line-height: 1.5; }
.tpl-modern table { width: 100%; border-collapse: collapse; }
.tpl-modern thead th {
  text-align: left; font-size: 9px; text-transform: uppercase; letter-spacing: .1em;
  color: #888; font-weight: 700; padding: 9px 7px;
  border-bottom: 2px solid #0d0d0d;
}
.tpl-modern tbody td { padding: 10px 7px; border-bottom: 1px solid #eee; font-size: 11.5px; vertical-align: top; }
.tpl-modern tbody td:nth-child(3),
.tpl-modern tbody td:nth-child(4) { font-family: 'JetBrains Mono'; font-size: 11px; }
.tpl-modern .r-summary { margin-top: 20px; display: flex; justify-content: flex-end; }
.tpl-modern .r-summary-box { width: 58%; max-width: 260px; font-size: 11.5px; }
.tpl-modern .r-summary-box > div {
  display: flex; justify-content: space-between;
  padding: 4px 0; color: #555; font-family: 'JetBrains Mono'; font-size: 11px;
}
.tpl-modern .r-grand {
  background: #0d0d0d; color: #fff;
  padding: 12px 14px; margin-top: 6px;
  font-family: 'Syne'; font-size: 16px; font-weight: 700; letter-spacing: -.01em;
  display: flex; justify-content: space-between;
}
.tpl-modern .r-foot {
  margin-top: 28px; padding-top: 16px; border-top: 1px solid #eee;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  font-size: 10.5px; color: #666; flex-wrap: wrap;
}
.tpl-modern .r-status-badge.modern {
  font-family: 'Syne'; font-weight: 800; font-size: 11px;
  padding: 5px 12px; border: 2px solid currentColor; border-radius: 4px;
  letter-spacing: .05em; white-space: nowrap;
}

/* ============================================================
   Receipt template — THERMAL
   ============================================================ */
.tpl-thermal {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px; line-height: 1.4;
  background: #fff; color: #000;
  max-width: 310px !important; margin: 0 auto !important;
  padding: 18px 16px !important;
}
.tpl-thermal .r-head { text-align: center; margin-bottom: 8px; }
.tpl-thermal .r-logo {
  display: block; max-width: 52px; max-height: 52px;
  margin: 0 auto 7px; border-radius: 4px; object-fit: contain;
}
.tpl-thermal .r-brand { font-family: 'Syne'; font-weight: 800; font-size: 16px; letter-spacing: -.02em; }
.tpl-thermal .r-tagline { font-size: 9.5px; }
.tpl-thermal .r-contact { font-size: 9.5px; line-height: 1.4; margin-top: 3px; }
.tpl-thermal .r-divider { border-top: 1px dashed #000; margin: 6px 0; }
.tpl-thermal .r-doctype { text-align: center; font-weight: 700; font-size: 12px; letter-spacing: .14em; }
.tpl-thermal .r-meta { display: flex; justify-content: space-between; font-size: 9.5px; margin: 3px 0; }
.tpl-thermal .r-item { display: flex; justify-content: space-between; font-size: 10.5px; padding: 2px 0; }
.tpl-thermal .r-item-desc { flex: 1; padding-right: 5px; line-height: 1.3; }
.tpl-thermal .r-item-desc small { display: block; font-size: 9px; color: #555; }
.tpl-thermal .r-item-amt { font-weight: 700; white-space: nowrap; }
.tpl-thermal .r-totals > div { display: flex; justify-content: space-between; font-size: 10.5px; padding: 1.5px 0; }
.tpl-thermal .r-grand { font-family: 'Syne'; font-weight: 700; font-size: 13.5px; padding-top: 4px; }
.tpl-thermal .r-barcode-strip {
  height: 24px; margin: 8px 0 4px;
  background: repeating-linear-gradient(90deg, #000 0,#000 2px, transparent 2px, transparent 5px, #000 5px, #000 7px, transparent 7px, transparent 11px);
}
.tpl-thermal .r-foot { text-align: center; font-size: 9.5px; margin-top: 8px; }
.tpl-thermal .r-thanks { font-family: 'Syne'; font-weight: 700; font-size: 11px; margin-bottom: 3px; }

/* ============================================================
   Receipt template — ELEGANT
   ============================================================ */
.tpl-elegant {
  font-family: 'DM Sans', sans-serif; color: #111; font-size: 12px;
  background: #fafaf6 !important; padding: 44px 36px !important;
}
.tpl-elegant::before {
  content: ''; position: absolute;
  top: 16px; left: 16px; right: 16px; bottom: 16px;
  border: 1px solid #c9a227; pointer-events: none;
}
.tpl-elegant .r-head {
  text-align: center; padding-bottom: 20px;
  border-bottom: 1px solid #c9a227; margin-bottom: 22px;
}
.tpl-elegant .r-logo {
  display: block; max-width: 64px; max-height: 64px;
  margin: 0 auto 12px; border-radius: 6px; object-fit: contain;
}
.tpl-elegant .r-brand {
  font-family: 'Syne'; font-weight: 700; font-size: 24px; letter-spacing: .04em;
}
.tpl-elegant .r-tagline { font-style: italic; color: #777; font-size: 12px; margin-top: 3px; }
.tpl-elegant .r-contact { font-size: 10.5px; color: #555; margin-top: 7px; line-height: 1.5; }
.tpl-elegant .r-doctype {
  text-align: center; font-family: 'Syne'; font-weight: 700;
  font-size: 12px; letter-spacing: .35em; color: #c9a227;
  margin: 16px 0 20px; text-transform: uppercase;
}
.tpl-elegant .r-meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.tpl-elegant .r-meta-grid h4 {
  font-size: 8.5px; text-transform: uppercase; letter-spacing: .2em;
  color: #c9a227; margin: 0 0 4px; font-weight: 700;
}
.tpl-elegant .r-meta-grid p { margin: 0; font-size: 11.5px; line-height: 1.5; }
.tpl-elegant table { width: 100%; border-collapse: collapse; }
.tpl-elegant thead th {
  text-align: left; font-size: 8.5px; text-transform: uppercase; letter-spacing: .18em;
  color: #c9a227; font-weight: 700; padding: 7px 5px;
  border-bottom: 1px solid #c9a227;
}
.tpl-elegant tbody td { padding: 9px 5px; border-bottom: 1px dotted #d4c89c; font-size: 11.5px; }
.tpl-elegant .r-summary { margin-top: 18px; display: flex; justify-content: flex-end; }
.tpl-elegant .r-summary-box { width: 55%; max-width: 230px; font-size: 11.5px; }
.tpl-elegant .r-summary-box > div {
  display: flex; justify-content: space-between;
  padding: 4px 0; color: #555;
}
.tpl-elegant .r-grand {
  border-top: 2px solid #c9a227; border-bottom: 2px solid #c9a227;
  padding: 7px 0; margin-top: 4px;
  font-family: 'Syne'; font-weight: 700; font-size: 15px; letter-spacing: .01em;
  color: #111; display: flex; justify-content: space-between;
}
.tpl-elegant .r-foot { margin-top: 28px; text-align: center; font-size: 10.5px; color: #666; }
.tpl-elegant .r-thanks { font-family: 'Syne'; font-style: italic; font-weight: 500; font-size: 13px; color: #c9a227; margin-bottom: 6px; }
.tpl-elegant .r-poweredby { font-size: 9.5px; color: #aaa; margin-top: 6px; }

/* Shared watermark */
.r-watermark {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%) rotate(-22deg);
  font-family: 'Syne', sans-serif; font-weight: 800;
  font-size: clamp(60px, 16vw, 120px);
  color: #000; opacity: 0.04; letter-spacing: -.05em;
  pointer-events: none; white-space: nowrap; z-index: 0;
  user-select: none;
}
.receipt-canvas > *:not(.r-watermark) { position: relative; z-index: 1; }

/* ============================================================
   Features section
   ============================================================ */
.features-section {
  padding: clamp(50px, 8vw, 100px) 20px;
  border-top: 1px solid var(--line-soft);
}
@media (min-width: 768px) { .features-section { padding-inline: 40px; } }
.features-inner { max-width: 1160px; margin: 0 auto; }
.section-head { margin-bottom: 40px; max-width: 560px; }
.eyebrow {
  display: inline-block; font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .18em;
  color: var(--accent); margin-bottom: 12px;
}
.section-head h2 { font-size: clamp(26px, 4.5vw, 48px); }
.features-grid {
  display: grid; grid-template-columns: 1fr;
  gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
}
@media (min-width: 560px)  { .features-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .features-grid { grid-template-columns: repeat(3, 1fr); } }
.feature-card { background: var(--bg); padding: 28px 24px; transition: background .2s; }
.feature-card:hover { background: var(--bg-soft); }
.feature-num { font-family: var(--f-mono); font-size: 11px; color: var(--accent); font-weight: 600; margin-bottom: 14px; }
.feature-card h3 { font-size: 19px; margin-bottom: 7px; }
.feature-card p  { color: var(--ink-soft); font-size: 13.5px; margin: 0; line-height: 1.55; }

/* ============================================================
   FAQ
   ============================================================ */
.faq-section { padding: clamp(40px, 7vw, 80px) 20px clamp(60px, 9vw, 100px); }
@media (min-width: 768px) { .faq-section { padding-inline: 40px; } }
.faq-inner { max-width: 780px; margin: 0 auto; }
.faq-item { border-bottom: 1px solid var(--line); padding: 18px 0; }
.faq-item summary {
  cursor: pointer; font-family: var(--f-head); font-weight: 600; font-size: 17px;
  letter-spacing: -.01em; list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  padding-right: 4px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+'; font-family: var(--f-mono); font-size: 22px;
  color: var(--accent); transition: transform .2s; flex-shrink: 0;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { margin: 10px 0 0; color: var(--ink-soft); font-size: 14.5px; max-width: 700px; }

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  background: var(--bg-soft); border-top: 1px solid var(--line);
  padding: 50px 20px 24px; padding-bottom: calc(24px + var(--safe-bottom));
}
@media (min-width: 768px) { .site-footer { padding-inline: 40px; } }
.footer-inner {
  max-width: 1160px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr; gap: 32px;
}
@media (min-width: 680px) { .footer-inner { grid-template-columns: 1fr 2fr; } }
.footer-brand p { font-size: 13px; color: var(--ink-soft); margin: 10px 0 0; max-width: 280px; }
.footer-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.footer-links h4 {
  font-family: var(--f-body); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--ink-mute); margin-bottom: 10px;
}
.footer-links a {
  display: block; font-size: 13px; color: var(--ink-soft);
  padding: 3px 0; transition: color .15s;
}
.footer-links a:hover { color: var(--accent); }
.footer-bottom {
  max-width: 1160px; margin: 32px auto 0;
  padding-top: 20px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--ink-mute); text-align: center;
}

/* ============================================================
   Toast
   ============================================================ */
.toast {
  position: fixed; bottom: calc(24px + var(--safe-bottom)); left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--ink); color: var(--bg);
  padding: 11px 20px; border-radius: 999px;
  font-size: 13.5px; font-weight: 500;
  box-shadow: var(--sh-lg); z-index: 1000;
  opacity: 0; transition: all .3s ease;
  pointer-events: none; white-space: nowrap;
  max-width: calc(100vw - 40px); text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ============================================================
   Print
   ============================================================ */
@media print {
  .site-header, .steps, .panel-head, .panel-actions, .ad-slot,
  .features-section, .faq-section, .site-footer, .bg-grid, .bg-glow,
  .template-picker, .download-grid { display: none !important; }
  body { background: #fff; }
  .receipt-canvas { box-shadow: none; max-width: 100%; }
}

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

/* ============================================================
   invoice44 v4 additions — template grid, hero downloads,
   receipt template families, ad slots
   ============================================================ */

/* ── Hero download chips ───────────────────────────────── */
.hero-downloads { margin-top: 32px; }
.hero-dl-label  {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--ink-mute); margin-bottom: 10px;
}
.hero-dl-row { display: flex; gap: 8px; flex-wrap: wrap; }
.hero-dl-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px;
  background: var(--bg-elev); border: 1.5px solid var(--line);
  font-size: 13px; font-weight: 600; color: var(--ink-soft);
  transition: all .15s;
}
.hero-dl-chip svg { color: var(--accent); }
.hero-dl-chip:hover { border-color: var(--accent); color: var(--ink); }

/* ── Ad slots ──────────────────────────────────────────── */
.ad-slot {
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--line); border-radius: var(--r);
  background: var(--bg-soft); color: var(--ink-mute);
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
}
.ad-slot-top, .ad-slot-bottom {
  min-height: 90px; margin: 16px 20px;
}
@media (min-width: 768px) { .ad-slot-top, .ad-slot-bottom { margin: 20px auto; max-width: 960px; } }
.ad-slot-inline { min-height: 70px; margin-bottom: 20px; }

/* ── Step label ─────────────────────────────────────────── */
.step-label { display: none; }
@media (min-width: 480px) { .step-label { display: inline; } }

/* ── btn-accent ─────────────────────────────────────────── */
.btn-accent {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 11px 18px;
  border-radius: var(--r-sm); border: 1px solid var(--accent);
  background: transparent; color: var(--accent);
  font-weight: 600; font-size: 15px; cursor: pointer;
  transition: all .18s; -webkit-tap-highlight-color: transparent;
}
.btn-accent:hover { background: var(--accent); color: var(--accent-txt); }

/* ── btn-lg ─────────────────────────────────────────────── */
.btn-lg { padding: 14px 24px; font-size: 16px; }

/* ── Template categories ────────────────────────────────── */
.tpl-categories {
  display: flex; gap: 6px; margin-bottom: 16px;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}
.tpl-categories::-webkit-scrollbar { display: none; }
.tpl-cat {
  flex: 0 0 auto; padding: 8px 14px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--bg);
  color: var(--ink-mute); font-size: 12px; font-weight: 600;
  cursor: pointer; white-space: nowrap; min-height: 36px;
  transition: all .15s; -webkit-tap-highlight-color: transparent;
}
.tpl-cat:hover  { border-color: var(--ink); color: var(--ink); }
.tpl-cat.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ── Template grid ──────────────────────────────────────── */
.tpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  padding: 4px 2px 4px 2px;
  margin-bottom: 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
@media (min-width: 480px) { .tpl-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); } }
@media (min-width: 768px) { .tpl-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); max-height: 380px; } }

.tpl-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 0; border: 2px solid var(--line); border-radius: var(--r-sm);
  background: var(--bg-elev); cursor: pointer;
  transition: all .15s; -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
.tpl-card:hover  { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--sh); }
.tpl-card.active { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }

.tpl-thumb {
  width: 100%; padding: 10px 10px 8px;
  display: flex; flex-direction: column; gap: 4px;
  min-height: 80px;
}
.tpl-thumb-line    { height: 5px; border-radius: 2px; width: 75%; }
.tpl-thumb-line.short { width: 45%; }
.tpl-thumb-line.tiny  { height: 4px; flex: 1; }
.tpl-thumb-sep { border-top: 1px dashed; opacity: .3; margin: 2px 0; }
.tpl-thumb-row { display: flex; justify-content: space-between; gap: 4px; }
.tpl-thumb-total {
  margin-top: 4px; padding: 4px 6px; border-radius: 2px;
  font-size: 8px; font-weight: 700; text-align: center; letter-spacing: .05em;
}
.tpl-name {
  padding: 0 6px 8px; font-size: 10px; font-weight: 600; text-align: center;
  color: var(--ink-soft); line-height: 1.3; width: 100%;
}

/* ── Download section heading ───────────────────────────── */
.download-section { margin-top: 4px; }
.download-heading {
  font-size: 14px; font-weight: 700; color: var(--ink-mute);
  text-transform: uppercase; letter-spacing: .06em;
  margin: 0 0 12px; font-family: var(--f-body);
}

/* ── Receipt canvas — generic template base ─────────────── */
.r-tpl { font-family: 'DM Sans', sans-serif; }
.r-tpl * { box-sizing: border-box; }

/* All templates share these utility classes */
.rt-row  { display: flex; justify-content: space-between; padding: 2.5px 0; font-size: 11.5px; color: #555; }
.rt-block { border-top: 1px dashed; padding-top: 7px; margin-top: 7px; }
.rt-total {
  display: flex; justify-content: space-between;
  font-size: 16px; font-weight: 800; padding: 6px 0;
  border-top: 2px solid; margin-top: 5px;
}

/* ── Classic family ─────────────────────────────────────── */
.r-classic    { font-family: 'JetBrains Mono', monospace; font-size: 12.5px; }
.rc-head      { text-align: center; padding-bottom: 14px; margin-bottom: 14px; }
.r-logo       { display: block; max-width: 70px; max-height: 70px; margin: 0 auto 10px; object-fit: contain; border-radius: 6px; }
.rc-brand     { font-family: 'Syne', sans-serif; font-size: 20px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 3px; }
.rc-tag       { font-size: 10px; color: #666; }
.rc-contact   { font-size: 10.5px; color: #555; margin-top: 5px; line-height: 1.45; }
.rc-doctype   { text-align: center; font-family: 'Syne', sans-serif; font-weight: 800; font-size: 15px; letter-spacing: .16em; padding: 6px 0; margin: 10px 0; }
.rc-meta      { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 10px; margin-bottom: 9px; }
.rc-meta b    { display: block; font-size: 8px; text-transform: uppercase; color: #888; font-style: normal; }
.rc-bill      { font-size: 11px; padding: 7px 9px; margin-bottom: 9px; line-height: 1.45; }
.rc-items     { margin: 8px 0; }
.ri-row       { display: flex; justify-content: space-between; align-items: flex-start; padding: 5px 0; border-bottom: 1px dotted rgba(0,0,0,.15); font-size: 11.5px; }
.ri-desc      { flex: 1; padding-right: 8px; line-height: 1.35; }
.ri-desc small{ display: block; color: #888; font-size: 9.5px; }
.ri-amt       { font-weight: 700; white-space: nowrap; }
.rc-foot      { text-align: center; font-size: 10px; color: #666; padding-top: 12px; margin-top: 14px; }
.rc-thanks    { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 12px; color: #111; }
.rc-status    { display: inline-block; padding: 2px 9px; border: 1.5px solid; border-radius: 3px; font-size: 9px; font-weight: 700; letter-spacing: .1em; margin-top: 6px; }
.rc-powered   { font-size: 9px; color: #bbb; margin-top: 3px; }

/* ── Modern family ──────────────────────────────────────── */
.r-modern { font-family: 'DM Sans', sans-serif; font-size: 12.5px; }
.rm-head  { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px; padding-bottom: 20px; margin-bottom: 20px; }
.rm-hl    { display: flex; gap: 14px; align-items: center; }
.r-logo.rm { width: 54px; height: 54px; }
.rm-brand { font-family: 'Syne', sans-serif; font-size: 22px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.rm-tag   { font-size: 11px; color: #666; margin-top: 3px; }
.rm-hr    { text-align: right; }
.rm-doctype { font-family: 'Syne', sans-serif; font-size: 26px; font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.rm-num   { font-family: 'JetBrains Mono', monospace; font-size: 10.5px; color: #888; margin-top: 4px; }
.rm-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 22px; }
.rm-grid h4 { font-size: 9px; text-transform: uppercase; letter-spacing: .14em; color: #888; margin: 0 0 5px; font-weight: 700; font-family: 'DM Sans', sans-serif; }
.rm-grid p  { margin: 0; font-size: 11.5px; line-height: 1.5; }
.rm-table   { width: 100%; border-collapse: collapse; }
.rm-table thead th { text-align: left; font-size: 9px; text-transform: uppercase; letter-spacing: .1em; color: #888; font-weight: 700; padding: 9px 7px; }
.rm-table tbody td { padding: 10px 7px; border-bottom: 1px solid #eee; font-size: 11.5px; }
.rm-summary { margin-top: 20px; display: flex; justify-content: flex-end; }
.rm-sbox    { width: 55%; max-width: 260px; font-size: 11.5px; }
.rm-total   { padding: 12px 14px; margin-top: 6px; font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 700; letter-spacing: -.01em; display: flex; justify-content: space-between; color: #fff; }
.rm-foot    { margin-top: 28px; padding-top: 16px; border-top: 1px solid #eee; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; font-size: 10.5px; color: #666; flex-wrap: wrap; }
.rm-status  { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 11px; padding: 5px 12px; border: 2px solid; border-radius: 4px; letter-spacing: .05em; white-space: nowrap; }
.rm-pw      { font-size: 9px; color: #bbb; margin-top: 4px; }

/* ── Thermal family ─────────────────────────────────────── */
.r-thermal { font-family: 'JetBrains Mono', monospace; font-size: 11.5px; line-height: 1.4; max-width: 310px !important; margin: 0 auto !important; padding: 18px 16px !important; }
.rth-head  { text-align: center; margin-bottom: 8px; }
.rth-brand { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 800; letter-spacing: -.02em; }
.rth-tag   { font-size: 9.5px; }
.rth-contact { font-size: 9.5px; line-height: 1.4; margin-top: 3px; }
.rth-div   { border-top: 1px dashed; margin: 6px 0; }
.rth-doctype { text-align: center; font-weight: 700; font-size: 12px; letter-spacing: .14em; }
.rth-meta  { display: flex; justify-content: space-between; font-size: 9.5px; margin: 3px 0; }
.rth-cust  { font-size: 10px; margin: 3px 0; }
.rth-item  { display: flex; justify-content: space-between; font-size: 10.5px; padding: 2px 0; }
.rth-desc  { flex: 1; padding-right: 5px; line-height: 1.3; }
.rth-desc small { display: block; font-size: 9px; color: #555; }
.rth-amt   { font-weight: 700; white-space: nowrap; }
.rth-totals > div { display: flex; justify-content: space-between; font-size: 10.5px; padding: 1.5px 0; }
.rth-total { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 13.5px; padding-top: 3px; }
.rth-status > span + span { font-size: 10px; }
.rth-barcode { height: 22px; margin: 7px 0 3px; background: repeating-linear-gradient(90deg, #000 0,#000 2px, transparent 2px, transparent 5px, #000 5px, #000 7px, transparent 7px, transparent 11px); }
.rth-foot  { text-align: center; font-size: 9.5px; margin-top: 7px; }
.rth-thanks { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 11px; margin-bottom: 3px; }
.rth-powered { font-size: 8.5px; color: #bbb; margin-top: 2px; }

/* ── Elegant family ─────────────────────────────────────── */
.r-elegant  { font-family: 'DM Sans', sans-serif; font-size: 12px; background: #fafaf6; padding: 44px 36px !important; position: relative; }
.rel-frame  { position: absolute; top: 16px; left: 16px; right: 16px; bottom: 16px; border: 1px solid var(--ea, #c9a227); pointer-events: none; }
.rel-head   { text-align: center; padding-bottom: 18px; border-bottom: 1px solid var(--ea, #c9a227); margin-bottom: 20px; }
.rel-logo-wrap .r-logo { border-radius: 6px; }
.rel-brand  { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 24px; letter-spacing: .04em; }
.rel-tag    { font-style: italic; color: #777; font-size: 12px; margin-top: 3px; }
.rel-contact { font-size: 10.5px; color: #555; margin-top: 7px; line-height: 1.5; }
.rel-doctype { text-align: center; font-weight: 700; font-size: 12px; letter-spacing: .35em; color: var(--ea, #c9a227); margin: 16px 0 20px; }
.rel-meta   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.rel-meta h4 { font-size: 8.5px; text-transform: uppercase; letter-spacing: .2em; color: var(--ea, #c9a227); margin: 0 0 4px; font-weight: 700; font-family: 'DM Sans', sans-serif; }
.rel-meta p { margin: 0; font-size: 11.5px; line-height: 1.5; }
.rel-table  { width: 100%; border-collapse: collapse; }
.rel-table thead th { text-align: left; font-size: 8.5px; text-transform: uppercase; letter-spacing: .18em; color: var(--ea, #c9a227); font-weight: 700; padding: 7px 5px; border-bottom: 1px solid var(--ea, #c9a227); }
.rel-table tbody td { padding: 9px 5px; border-bottom: 1px dotted #d4c89c; font-size: 11.5px; }
.rel-summary { margin-top: 18px; display: flex; justify-content: flex-end; }
.rel-sbox   { width: 55%; max-width: 230px; font-size: 11.5px; }
.rel-total  { border-top: 2px solid var(--ea, #c9a227); border-bottom: 2px solid var(--ea, #c9a227); padding: 7px 0; margin-top: 4px; font-family: 'Syne', sans-serif; font-weight: 700; font-size: 15px; letter-spacing: .01em; color: #111; display: flex; justify-content: space-between; }
.rel-foot   { margin-top: 28px; text-align: center; font-size: 10.5px; color: #666; }
.rel-thanks { font-family: 'Syne', sans-serif; font-style: italic; font-weight: 500; font-size: 13px; color: var(--ea, #c9a227); margin-bottom: 6px; }
.rel-powered { font-size: 9px; color: #bbb; margin-top: 5px; }

/* ── Bold family ────────────────────────────────────────── */
.r-bold     { font-family: 'DM Sans', sans-serif; }
.rb-header  { padding: 24px; text-align: center; }
.rb-logo-wrap .r-logo { max-width: 60px; max-height: 60px; margin: 0 auto 8px; display: block; border-radius: 8px; }
.rb-brand   { font-family: 'Syne', sans-serif; font-size: 26px; font-weight: 900; letter-spacing: -.02em; margin-bottom: 3px; }
.rb-tag     { font-size: 11px; opacity: .85; }
.rb-doctype { font-size: 13px; font-weight: 700; letter-spacing: .12em; margin-top: 8px; opacity: .85; }
.rb-body    { padding: 20px; }
.rb-meta    { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; font-size: 11px; }
.rb-meta label { display: block; font-size: 9px; text-transform: uppercase; color: #999; font-weight: 700; margin-bottom: 2px; }
.rb-bill    { padding: 8px 10px; margin-bottom: 14px; font-size: 11.5px; line-height: 1.5; }
.rb-items   { margin-bottom: 14px; }
.rb-items-hdr { display: grid; grid-template-columns: 1fr 50px 90px 90px; gap: 8px; padding: 8px 10px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.rb-item    { display: grid; grid-template-columns: 1fr 50px 90px 90px; gap: 8px; padding: 8px 10px; font-size: 11.5px; align-items: center; }
.rb-item span:nth-child(n+2) { text-align: right; font-family: 'JetBrains Mono', monospace; font-size: 11px; }
.rb-subtotals { font-size: 11px; margin-bottom: 6px; }
.rb-total-box { display: flex; justify-content: space-between; padding: 12px 16px; font-family: 'Syne', sans-serif; font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.rb-foot    { text-align: center; font-size: 10px; color: #aaa; margin-top: 14px; padding-top: 10px; border-top: 1px solid rgba(0,0,0,.1); }

/* ── Minimal family ─────────────────────────────────────── */
.r-minimal  { font-family: 'DM Sans', sans-serif; font-size: 12.5px; padding: 20px; }
.rmin-top   { margin-bottom: 20px; }
.rmin-logo .r-logo { max-width: 60px; max-height: 60px; border-radius: 6px; margin-bottom: 8px; }
.rmin-brand { font-family: 'Syne', sans-serif; font-size: 20px; font-weight: 800; letter-spacing: -.03em; margin-bottom: 3px; }
.rmin-sub   { font-size: 10px; color: #888; line-height: 1.5; }
.rmin-rule  { height: 2px; margin: 16px 0; border-radius: 1px; }
.rmin-info  { display: flex; justify-content: space-between; font-size: 11px; color: #888; margin-bottom: 10px; }
.rmin-cust  { font-size: 12px; font-weight: 600; margin-bottom: 14px; }
.rmin-items { margin: 12px 0; }
.rmin-item  { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid rgba(0,0,0,.07); font-size: 12px; }
.rmin-item small { font-size: 10px; color: #999; margin-left: 5px; }
.rmin-subs  { margin-bottom: 4px; }
.rmin-total { display: flex; justify-content: space-between; font-family: 'Syne', sans-serif; font-size: 18px; font-weight: 800; margin-top: 12px; letter-spacing: -.02em; }
.rmin-foot  { font-size: 10px; color: #bbb; margin-top: 16px; text-align: center; line-height: 1.6; }

/* ── Colorful family ────────────────────────────────────── */
.r-colorful { font-family: 'DM Sans', sans-serif; font-size: 12px; padding: 28px; }
.rcol-head  { text-align: center; margin-bottom: 16px; }
.rcol-head .r-logo { margin-bottom: 8px; }
.rcol-brand { font-family: 'Syne', sans-serif; font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 3px; }
.rcol-tag   { font-size: 10px; color: #666; }
.rcol-contact { font-size: 10px; color: #666; margin-top: 5px; line-height: 1.45; }
.rcol-badge { padding: 8px 16px; text-align: center; font-size: 11px; font-weight: 700; letter-spacing: .06em; margin-bottom: 14px; border-radius: 4px; }
.rcol-cust  { font-size: 11px; padding: 7px 10px; border-left: 3px solid; margin-bottom: 12px; background: rgba(255,255,255,0.5); border-radius: 0 4px 4px 0; }
.rcol-items { margin: 12px 0; }
.rcol-item  { display: flex; justify-content: space-between; padding: 8px 10px; font-size: 12px; border-radius: 4px; margin-bottom: 4px; }
.rcol-item div:first-child { flex: 1; }
.rcol-item small { display: block; font-size: 9px; color: #666; }
.rcol-total { display: flex; justify-content: space-between; padding: 14px 12px; font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 800; margin-top: 12px; border-radius: 4px; }
.rcol-foot  { text-align: center; font-size: 10px; color: #888; margin-top: 12px; }

/* ── Business family ────────────────────────────────────── */
.r-business  { font-family: 'DM Sans', sans-serif; font-size: 12px; }
.rbus-head   { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px; padding: 20px; border-bottom: 4px solid; }
.rbus-hl     { display: flex; gap: 14px; align-items: flex-start; }
.rbus-hl .r-logo { width: 54px; height: 54px; object-fit: contain; border-radius: 6px; }
.rbus-brand  { font-family: 'Syne', sans-serif; font-size: 20px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 2px; }
.rbus-tag    { font-size: 10px; color: #666; }
.rbus-contact { font-size: 9px; color: #555; margin-top: 5px; line-height: 1.5; }
.rbus-hr     { text-align: right; }
.rbus-type   { display: inline-block; padding: 5px 12px; font-size: 11px; font-weight: 700; letter-spacing: .1em; border-radius: 3px; margin-bottom: 8px; }
.rbus-ref    { font-size: 10px; color: #666; margin-top: 3px; font-family: 'JetBrains Mono', monospace; }
.rbus-divider { height: 3px; margin: 0 0 16px; }
.rbus-bill   { padding: 10px 14px; margin: 16px 20px; background: #f8f9fa; line-height: 1.5; }
.rbus-bill-label { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; margin-bottom: 4px; }
.rbus-table  { width: 100%; border-collapse: collapse; margin: 0 0 0; }
.rbus-table thead th { padding: 9px 12px; text-align: left; font-size: 9px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.rbus-table tbody td { padding: 9px 12px; border-bottom: 1px solid #eee; font-size: 11.5px; vertical-align: top; }
.rbus-summary { display: flex; justify-content: flex-end; padding: 0 20px 20px; }
.rbus-sbox   { width: 55%; max-width: 260px; font-size: 11.5px; }
.rbus-total  { display: flex; justify-content: space-between; padding: 12px 14px; font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 800; color: #fff; margin-top: 6px; }
.rbus-foot   { padding: 12px 20px; border-top: 1px solid #eee; font-size: 10px; color: #666; }
.rbus-pay    { margin-bottom: 4px; font-weight: 600; }
.rbus-notes  { color: #aaa; }
