/* =============================================================
   QUICKINVOICE — STYLESHEET
   Mobile-first, responsive, print-aware, template-aware.
   ============================================================= */

:root {
  --color-bg: #f3f4f8;
  --color-surface: #ffffff;
  --color-primary: #4f46e5;
  --color-primary-dark: #4338ca;
  --color-primary-light: #eef0fe;
  --color-text: #1f2333;
  --color-muted: #6b7280;
  --color-border: #e5e7eb;
  --color-danger: #dc2626;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --shadow-md: 0 4px 16px rgba(16, 24, 40, 0.10);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ===================== HEADER ===================== */

.app-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 30;
}

.app-header__inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 10px; }

.brand__mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}

.brand__text { display: flex; flex-direction: column; line-height: 1.2; }
.brand__name { font-weight: 700; font-size: 18px; }
.brand__tagline { font-size: 12px; color: var(--color-muted); }

.mode-toggle {
  display: flex;
  background: var(--color-bg);
  border-radius: 999px;
  padding: 4px;
  gap: 2px;
}

.mode-toggle__btn {
  border: none;
  background: transparent;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-muted);
  cursor: pointer;
  min-height: 36px;
}

.mode-toggle__btn.is-active {
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow);
}

/* ===================== LAYOUT SHELL ===================== */

.app-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: start;
}

@media (min-width: 1040px) {
  .app-shell {
    grid-template-columns: 1fr 320px;
    padding: 24px;
    gap: 24px;
  }
  .editor-sidebar { position: sticky; top: 82px; }
}

/* ===================== EDITOR TOOLBAR ===================== */

.editor-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===================== BUTTONS ===================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  padding: 11px 16px;
  min-height: 44px;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn--primary { background: var(--color-primary); color: #fff; box-shadow: var(--shadow); }
.btn--primary:hover { background: var(--color-primary-dark); }

.btn--secondary { background: var(--color-primary-light); color: var(--color-primary-dark); }
.btn--secondary:hover { background: #e2e4fc; }

.btn--ghost { background: transparent; color: var(--color-text); border: 1px solid var(--color-border); }
.btn--ghost:hover { background: var(--color-bg); }

.btn--text { background: transparent; color: var(--color-danger); padding: 6px 8px; min-height: unset; }

.btn--small { padding: 8px 12px; font-size: 13px; min-height: 38px; }
.btn--full { width: 100%; margin-bottom: 8px; }

.btn--pay {
  background: var(--accent, var(--color-primary));
  color: #fff;
  margin-top: 10px;
  opacity: 0.9;
}

/* ===================== SIDEBAR ===================== */

.editor-sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-section {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 4px 16px;
}

.sidebar-section summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  padding: 14px 0;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-section summary::-webkit-details-marker { display: none; }

.sidebar-section summary::after {
  content: "▾";
  color: var(--color-muted);
  font-size: 12px;
  transition: transform 0.15s ease;
}

.sidebar-section[open] summary::after { transform: rotate(180deg); }

.sidebar-section > *:not(summary) { margin-bottom: 12px; }
.sidebar-section > *:last-child { margin-bottom: 16px; }

.field { margin-bottom: 0; }

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 11px 12px;
  font-size: 15px;
  font-family: var(--font);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--color-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  min-height: 44px;
}

textarea { min-height: unset; resize: vertical; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

input.input-error, textarea.input-error { border-color: var(--color-danger); }

.field-error {
  display: block;
  color: var(--color-danger);
  font-size: 12px;
  margin-top: 4px;
}

.field-hint { font-size: 12px; color: var(--color-muted); margin: 6px 0 0 0; }

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.checkbox-field input { width: auto; min-height: unset; }

/* Template swatches */

.template-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.template-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text);
}

.template-swatch.is-active { border-color: var(--color-primary); background: var(--color-primary-light); }

.template-swatch__preview {
  width: 100%;
  height: 40px;
  border-radius: 4px;
  background: #f1f2f7;
  position: relative;
  overflow: hidden;
}

.template-swatch__preview::before {
  content: "";
  position: absolute;
  top: 6px; left: 6px; right: 6px;
  height: 6px;
  background: #c7c9e0;
  border-radius: 2px;
}

.template-swatch__preview--classic::before { background: #111827; width: 40%; }
.template-swatch__preview--modern { background: linear-gradient(#4f46e5 0 16px, #f1f2f7 16px); }
.template-swatch__preview--minimal::before { background: #9ca3af; height: 2px; top: 10px; }
.template-swatch__preview--professional { background: linear-gradient(90deg, #4f46e5 0 8px, #f1f2f7 8px); }

/* Color swatches */

.color-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.color-swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  min-height: 32px;
}

.color-swatch.is-active { border-color: var(--color-text); box-shadow: 0 0 0 2px #fff inset; }

.custom-color-input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 4px;
  cursor: pointer;
  background: #fff;
}

/* ===================== INVOICE DOCUMENT ===================== */

.editor-main { min-width: 0; }

.invoice-sheet {
  --accent: #4f46e5;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 22px 18px;
  max-width: 860px;
  margin: 0 auto;
}

@media (min-width: 640px) {
  .invoice-sheet { padding: 36px; }
}

/* Editable "document" inputs: blend into the page until focused */

.doc-input {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 6px;
  padding: 5px 7px;
  font: inherit;
  color: inherit;
  width: 100%;
}

.doc-input:hover { border-color: var(--color-border); }

.doc-input:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.04);
}

.doc-input::placeholder { color: #9ca3af; }

.doc-textarea { resize: vertical; min-height: 46px; }

.doc-input--tight { padding: 3px 6px; font-size: 13px; min-height: unset; }

.doc-input--name { font-size: 16px; font-weight: 700; }

.doc-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-muted);
  margin: 0;
  min-width: 62px;
}

/* Preview / capture mode: hide chrome so it looks like a finished document */

.invoice-sheet.is-previewing .doc-input,
.invoice-sheet.is-capturing .doc-input {
  border-color: transparent !important;
  box-shadow: none !important;
  background: transparent !important;
  pointer-events: none;
}

.invoice-sheet.is-previewing .no-preview,
.invoice-sheet.is-capturing .no-preview {
  display: none !important;
}

/* ===================== DOC TOP ===================== */

.doc-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--color-text);
  padding-bottom: 18px;
  margin-bottom: 22px;
}

.invoice-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

.doc-top__title-block { min-width: 220px; flex: 1; }

.doc-meta-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.doc-meta-inline .doc-input--tight { flex: 1; }

.logo-box {
  width: 96px;
  height: 96px;
  border-radius: var(--radius-sm);
  border: 1.5px dashed var(--color-border);
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
}

.logo-box__img { width: 100%; height: 100%; object-fit: contain; }

.logo-box__placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  color: var(--color-muted);
  cursor: pointer;
  text-align: center;
}

.logo-box__icon { font-size: 18px; }

.logo-box__remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===================== PARTIES ===================== */

.doc-parties {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  margin-bottom: 24px;
}

@media (min-width: 560px) {
  .doc-parties { grid-template-columns: 1fr 1fr; }
}

.doc-party > * { margin-bottom: 4px; }

.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--color-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}

/* ===================== ITEMS TABLE ===================== */

.invoice-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 14px;
  font-size: 13.5px;
}

.invoice-table thead th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.05em;
  color: #fff;
  background: var(--color-text);
  padding: 10px 8px;
}

.invoice-table .col-qty, .invoice-table .col-price, .invoice-table .col-total { text-align: right; white-space: nowrap; width: 90px; }
.invoice-table .col-remove { width: 34px; }

.invoice-table tbody td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.invoice-table tbody tr:last-child td { border-bottom: none; }

.invoice-table .item-total-cell { text-align: right; font-weight: 600; white-space: nowrap; }

.item-remove-btn {
  border: none;
  background: transparent;
  color: var(--color-danger);
  font-size: 15px;
  cursor: pointer;
  padding: 4px;
}

/* Responsive: stack table as cards on narrow screens */

@media (max-width: 560px) {
  .invoice-table thead { display: none; }
  .invoice-table, .invoice-table tbody, .invoice-table tr, .invoice-table td { display: block; width: 100%; }
  .invoice-table tr {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    padding: 8px;
    position: relative;
  }
  .invoice-table td { border-bottom: none; padding: 6px 4px; text-align: left !important; width: auto !important; }
  .invoice-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 10px;
    font-weight: 700;
    color: var(--color-muted);
    text-transform: uppercase;
    margin-bottom: 2px;
  }
  .invoice-table .col-remove, td.item-remove-cell { position: absolute; top: 6px; right: 6px; width: auto !important; padding: 0 !important; }
}

/* ===================== TOTALS ===================== */

.invoice-totals {
  margin-left: auto;
  width: 100%;
  max-width: 300px;
  margin-bottom: 24px;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
  color: var(--color-muted);
}

.totals-row--grand {
  border-top: 2px solid var(--color-text);
  margin-top: 6px;
  padding-top: 10px;
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text);
}

.totals-row--balance {
  font-weight: 700;
  color: var(--accent);
  font-size: 15px;
}

/* ===================== NOTES ===================== */

.doc-notes { margin-bottom: 16px; }

/* ===================== PAYMENT BLOCK ===================== */

.doc-payment {
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 20px;
}

.doc-payment__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  font-size: 13px;
  margin-bottom: 8px;
}

.doc-payment__grid span { display: block; color: var(--color-muted); font-size: 11px; }
.doc-payment__grid strong { word-break: break-word; }

.doc-payment__instructions { font-size: 13px; color: var(--color-muted); margin: 6px 0 0; }

/* ===================== SIGNATURE ===================== */

.doc-signature { margin-bottom: 22px; }

.signature-display {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.signature-display__img {
  max-width: 200px;
  max-height: 80px;
  object-fit: contain;
  border-bottom: 1px solid var(--color-border);
}

.signature-panel {
  margin-top: 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: var(--color-bg);
  max-width: 420px;
}

.signature-panel__tabs { display: flex; gap: 6px; margin-bottom: 12px; }

.signature-tab {
  border: none;
  background: transparent;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.signature-tab.is-active { background: #fff; color: var(--color-text); box-shadow: var(--shadow); }

.signature-canvas {
  width: 100%;
  height: 150px;
  background: #fff;
  border: 1px dashed var(--color-border);
  border-radius: 6px;
  touch-action: none;
  cursor: crosshair;
}

.signature-panel__actions { display: flex; gap: 8px; margin-top: 10px; }

/* ===================== PHOTOS ===================== */

.doc-photos { margin-bottom: 10px; }

.photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.photo-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-bg);
}

.photo-card__img { width: 100%; height: 90px; object-fit: cover; display: block; }

.photo-card__caption {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 11px;
  padding: 6px 6px 2px;
  text-align: center;
}

.photo-card__remove {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--color-danger);
  font-size: 11px;
  padding: 0 0 6px;
  cursor: pointer;
}

/* ===================== FOOTER ===================== */

.invoice-footer {
  text-align: center;
  font-size: 11.5px;
  color: var(--color-muted);
  border-top: 1px solid var(--color-border);
  padding-top: 16px;
  margin-top: 8px;
}

.privacy-note { font-size: 12.5px; color: var(--color-muted); text-align: center; padding: 14px 4px; }

.app-footer { text-align: center; padding: 24px 16px 40px; font-size: 12.5px; color: var(--color-muted); }

/* =============================================================
   TEMPLATE VARIANTS
   ============================================================= */

/* --- Classic: serif title, plain lines, accent only on total/table --- */
.invoice-sheet[data-template="classic"] .invoice-title { font-family: var(--font-serif); text-transform: none; letter-spacing: 0; }
.invoice-sheet[data-template="classic"] .invoice-table thead th { background: var(--color-text); color: #fff; }

/* --- Modern: bold sans title, accent header band, rounded --- */
.invoice-sheet[data-template="modern"] { border-radius: var(--radius); }
.invoice-sheet[data-template="modern"] .doc-top {
  background: var(--accent);
  color: #fff;
  border-bottom: none;
  border-radius: var(--radius-sm);
  padding: 20px;
  margin: -22px -18px 22px;
}
.invoice-sheet[data-template="modern"] .invoice-title { color: #fff; }
.invoice-sheet[data-template="modern"] .doc-label { color: rgba(255,255,255,0.8); }
.invoice-sheet[data-template="modern"] .doc-meta-inline .doc-input { color: #fff; }
.invoice-sheet[data-template="modern"] .doc-meta-inline .doc-input::placeholder { color: rgba(255,255,255,0.7); }
.invoice-sheet[data-template="modern"] .doc-meta-inline .doc-input:hover { border-color: rgba(255,255,255,0.5); }
.invoice-sheet[data-template="modern"] .logo-box { background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.4); }
.invoice-sheet[data-template="modern"] .logo-box__placeholder { color: #fff; }
.invoice-sheet[data-template="modern"] .invoice-table thead th { background: var(--accent); color: #fff; }
@media (min-width: 640px) {
  .invoice-sheet[data-template="modern"] .doc-top { margin: -36px -36px 24px; padding: 28px 36px; }
}

/* --- Minimal: thin lines, no filled headers, lots of whitespace --- */
.invoice-sheet[data-template="minimal"] .doc-top { border-bottom: 1px solid var(--color-border); }
.invoice-sheet[data-template="minimal"] .invoice-title { color: var(--color-text); font-weight: 600; letter-spacing: 0.15em; }
.invoice-sheet[data-template="minimal"] .invoice-table thead th { background: transparent; color: var(--color-muted); border-bottom: 1.5px solid var(--color-text); }
.invoice-sheet[data-template="minimal"] .totals-row--grand { border-top: 1px solid var(--color-text); }
.invoice-sheet[data-template="minimal"] .section-label { font-weight: 600; letter-spacing: 0.12em; }

/* --- Professional: accent side bar + structured header --- */
.invoice-sheet[data-template="professional"] { border-left: 8px solid var(--accent); }
.invoice-sheet[data-template="professional"] .invoice-title { color: var(--color-text); }
.invoice-sheet[data-template="professional"] .doc-top { border-bottom: 3px solid var(--accent); }
.invoice-sheet[data-template="professional"] .invoice-table thead th { background: var(--color-bg); color: var(--color-text); border-bottom: 2px solid var(--accent); }
.invoice-sheet[data-template="professional"] .section-label { color: var(--accent); }

/* ===================== PRINT ===================== */

@media print {
  .no-print { display: none !important; }

  body { background: #fff; }

  .app-shell { display: block; padding: 0; max-width: none; }

  .invoice-sheet {
    box-shadow: none;
    max-width: none;
    padding: 0;
    margin: 0;
  }

  .invoice-sheet[data-template="modern"] .doc-top { margin: 0 0 22px; }
  .invoice-sheet[data-template="professional"] { border-left: none; }

  .invoice-sheet .doc-input {
    border-color: transparent !important;
    box-shadow: none !important;
    background: transparent !important;
  }

  .no-preview { display: none !important; }
}

/* =============================================================
   SITE CHROME — nav, breadcrumbs, footer links (additive only,
   does not modify any selector above this line)
   ============================================================= */

.site-nav {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  scrollbar-width: none;
}

.site-nav::-webkit-scrollbar { display: none; }

.site-nav a {
  color: var(--color-muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  flex-shrink: 0;
  min-height: 36px;
  display: flex;
  align-items: center;
}

.site-nav a:hover, .site-nav a[aria-current="page"] {
  color: var(--color-text);
  background: var(--color-bg);
}

.breadcrumbs {
  max-width: 1000px;
  margin: 0 auto;
  padding: 14px 16px 0;
  font-size: 12.5px;
  color: var(--color-muted);
}

.breadcrumbs a { color: var(--color-muted); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs span[aria-current] { color: var(--color-text); font-weight: 600; }

.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 32px 16px 40px;
  margin-top: 32px;
}

.site-footer__inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 720px) {
  .site-footer__inner { grid-template-columns: 1.4fr 1fr 1fr 1fr; }
}

.site-footer h3 { font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-muted); margin: 0 0 10px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.site-footer a { color: var(--color-text); text-decoration: none; font-size: 13.5px; }
.site-footer a:hover { color: var(--color-primary); text-decoration: underline; }
.site-footer p { font-size: 13px; color: var(--color-muted); margin: 0 0 8px; }
.site-footer__bottom { max-width: 1200px; margin: 24px auto 0; padding-top: 16px; border-top: 1px solid var(--color-border); font-size: 12px; color: var(--color-muted); text-align: center; }

/* =============================================================
   SEO / ARTICLE CONTENT (below-the-fold, on tool pages)
   ============================================================= */

.seo-content {
  max-width: 800px;
  margin: 48px auto 0;
  padding: 0 16px 48px;
}

.seo-content h2 { font-size: 22px; margin: 40px 0 14px; }
.seo-content h2:first-child { margin-top: 0; }
.seo-content h3 { font-size: 17px; margin: 24px 0 10px; }
.seo-content p { font-size: 15px; color: #374151; margin: 0 0 14px; }
.seo-content ul, .seo-content ol { font-size: 15px; color: #374151; margin: 0 0 14px; padding-left: 22px; }
.seo-content li { margin-bottom: 6px; }
.seo-content a { color: var(--color-primary); font-weight: 600; text-decoration: none; }
.seo-content a:hover { text-decoration: underline; }

.faq-list { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }

.faq-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 4px 16px;
  background: var(--color-surface);
}

.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 14.5px;
  padding: 14px 0;
  list-style: none;
}

.faq-item summary::-webkit-details-marker { display: none; }
.faq-item p { padding-bottom: 14px; margin: 0; color: #374151; font-size: 14.5px; }

.related-tools {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 16px 0 8px;
}

@media (min-width: 560px) { .related-tools { grid-template-columns: 1fr 1fr; } }

.related-tool-card {
  display: block;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  text-decoration: none;
  background: var(--color-surface);
  box-shadow: var(--shadow);
}

.related-tool-card:hover { border-color: var(--color-primary); }
.related-tool-card__title { font-weight: 700; color: var(--color-text); font-size: 15px; margin-bottom: 4px; }
.related-tool-card__desc { font-size: 13px; color: var(--color-muted); }

.doc-type-banner {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 18px;
}

/* =============================================================
   HOMEPAGE
   ============================================================= */

.hero {
  max-width: 1100px;
  margin: 0 auto;
  padding: 56px 20px 24px;
  text-align: center;
}

.hero h1 { font-size: clamp(30px, 5vw, 46px); font-weight: 800; margin: 0 0 16px; letter-spacing: -0.01em; }
.hero p.hero-sub { font-size: 17px; color: var(--color-muted); max-width: 640px; margin: 0 auto 28px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }
.hero-actions .btn { padding: 14px 26px; font-size: 15.5px; }
.hero-note { font-size: 12.5px; color: var(--color-muted); margin-top: 10px; }

.tool-grid {
  max-width: 1100px;
  margin: 40px auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 640px) { .tool-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .tool-grid { grid-template-columns: repeat(3, 1fr); } }

.tool-card {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 22px;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 0.1s ease, border-color 0.1s ease;
}

.tool-card:hover { border-color: var(--color-primary); transform: translateY(-1px); }
.tool-card__icon { font-size: 26px; margin-bottom: 10px; display: block; }
.tool-card__title { font-weight: 700; font-size: 16.5px; color: var(--color-text); margin-bottom: 6px; }
.tool-card__desc { font-size: 13.5px; color: var(--color-muted); line-height: 1.5; }

.how-it-works {
  max-width: 900px;
  margin: 48px auto;
  padding: 0 20px;
}

.how-it-works h2 { text-align: center; font-size: 24px; margin-bottom: 32px; }

.steps-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 720px) { .steps-grid { grid-template-columns: repeat(4, 1fr); } }

.step-card { text-align: center; }
.step-card__num {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--color-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; margin: 0 auto 12px;
}
.step-card h3 { font-size: 14.5px; margin: 0 0 6px; }
.step-card p { font-size: 13px; color: var(--color-muted); margin: 0; }

.trust-strip {
  max-width: 900px;
  margin: 0 auto 48px;
  padding: 0 20px;
  display: flex;
  justify-content: center;
  gap: 28px;
  flex-wrap: wrap;
  text-align: center;
}

.trust-strip .trust-item { font-size: 12.5px; color: var(--color-muted); max-width: 140px; }
.trust-strip .trust-item strong { display: block; font-size: 20px; color: var(--color-text); margin-bottom: 2px; }

/* =============================================================
   TEMPLATE GALLERY PAGE
   ============================================================= */

.template-gallery {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 8px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 640px) { .template-gallery { grid-template-columns: repeat(2, 1fr); } }

.template-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.template-card__preview {
  height: 140px;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.template-card__preview-doc {
  width: 100%;
  height: 100%;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
  padding: 10px;
}

.template-card__preview-doc .bar { height: 6px; border-radius: 2px; background: #dcdfef; margin-bottom: 6px; }
.template-card__preview-doc .bar.accent { background: var(--tpl-accent, #4f46e5); width: 40%; }
.template-card__preview-doc .bar.short { width: 55%; }

.template-card__body { padding: 16px 18px 18px; }
.template-card__title { font-weight: 700; font-size: 15.5px; margin-bottom: 4px; }
.template-card__desc { font-size: 13px; color: var(--color-muted); margin-bottom: 14px; }

/* Page-level heading used above tools (kept distinct from invoice-title inside the document) */
.page-heading {
  max-width: 900px;
  margin: 0 auto;
  padding: 28px 20px 4px;
  text-align: center;
}

.page-heading h1 { font-size: clamp(24px, 4vw, 32px); margin: 0 0 10px; }
.page-heading p { font-size: 15px; color: var(--color-muted); max-width: 620px; margin: 0 auto; }
