/* Billia — main stylesheet. No frameworks, no build step. */
:root {
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #e2e8f0;
  --line-soft: #eef2f7;
  --bg: #f8fafc;
  --card: #ffffff;
  --accent: #4f46e5;
  --accent-dark: #4338ca;
  --accent-soft: #eef2ff;
  --green: #059669;
  --green-soft: #ecfdf5;
  --amber: #d97706;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 24px -12px rgba(15, 23, 42, .12);
  --shadow-lg: 0 2px 4px rgba(15, 23, 42, .06), 0 20px 44px -16px rgba(15, 23, 42, .18);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --maxw: 1200px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 18px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; color: var(--ink); letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 800;
}
.nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.nav a { color: var(--ink-soft); font-weight: 600; font-size: 14.5px; padding: 8px 12px; border-radius: 8px; }
.nav a:hover { background: var(--line-soft); text-decoration: none; color: var(--ink); }
.nav .btn { margin-left: 8px; }

/* ---------- buttons / inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 10px;
  font: 600 15px/1 var(--font); padding: 12px 20px; cursor: pointer;
  transition: transform .06s ease, box-shadow .15s ease, background .15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 16px -6px rgba(79, 70, 229, .5); }
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-secondary:hover { border-color: #cbd5e1; background: #f8fafc; }
.btn-ghost { background: transparent; color: var(--muted); padding: 8px 10px; font-size: 14px; }
.btn-ghost:hover { color: var(--red); background: var(--red-soft); }
.btn-sm { padding: 8px 14px; font-size: 13.5px; border-radius: 8px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.field input, .field select, .field textarea {
  font: 500 15px var(--font); color: var(--ink);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 12px; background: #fff; width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.field textarea { resize: vertical; min-height: 74px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ---------- hero ---------- */
.hero { padding: 72px 0 40px; text-align: center; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--green-soft); color: var(--green);
  font-weight: 700; font-size: 13.5px; padding: 7px 14px; border-radius: 999px;
  border: 1px solid #a7f3d0; margin-bottom: 20px;
}
.hero h1 { font-size: clamp(32px, 5vw, 52px); letter-spacing: -.03em; line-height: 1.12; margin: 0 0 16px; }
.hero h1 .free { color: var(--accent); }
.hero p.sub { font-size: 18px; color: var(--muted); max-width: 640px; margin: 0 auto 28px; }
.hero-ctas { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-trust { margin-top: 22px; color: var(--faint); font-size: 13.5px; display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }
.hero-trust span::before { content: "✓ "; color: var(--green); font-weight: 700; }

/* ---------- builder ---------- */
.builder { padding: 24px 0 72px; }
.builder-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.builder-head h2 { margin: 0; font-size: 22px; letter-spacing: -.02em; }

.seg { display: inline-flex; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button {
  border: 0; background: transparent; border-radius: 8px; cursor: pointer;
  font: 700 13.5px var(--font); color: var(--muted); padding: 9px 16px;
  display: inline-flex; align-items: center; gap: 7px;
}
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.seg .dot { width: 22px; height: 16px; border-radius: 4px; border: 1px solid var(--line); display: inline-block; }

.builder-grid { display: grid; grid-template-columns: 430px 1fr; gap: 22px; align-items: start; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-pad { padding: 22px; }
.panel h3 { margin: 0 0 4px; font-size: 16px; letter-spacing: -.01em; }
.panel .hint { color: var(--muted); font-size: 13.5px; margin: 0 0 16px; }
.section-title { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin: 22px 0 12px; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.section-title:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

.logo-row { display: flex; align-items: center; gap: 12px; }
.logo-thumb { width: 52px; height: 52px; border-radius: 10px; border: 1.5px dashed var(--line); object-fit: contain; background: #fff; display: none; }
.logo-thumb.show { display: block; }

.items-head { display: grid; grid-template-columns: 1fr 64px 90px 26px; gap: 8px; font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); margin-bottom: 6px; padding: 0 2px; }
.item-row { display: grid; grid-template-columns: 1fr 64px 90px 26px; gap: 8px; margin-bottom: 8px; align-items: center; }
.item-row input { font: 500 14px var(--font); border: 1.5px solid var(--line); border-radius: 8px; padding: 9px 10px; width: 100%; }
.item-row input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.item-del { border: 0; background: transparent; color: var(--faint); font-size: 18px; cursor: pointer; border-radius: 6px; line-height: 1; padding: 4px; }
.item-del:hover { color: var(--red); background: var(--red-soft); }
.add-item { width: 100%; margin-top: 4px; border-style: dashed; }

/* ---------- preview ---------- */
.preview-col { position: sticky; top: 84px; }
.preview-toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.preview-shell { background: #e8edf3; border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); }
.doc { background: #fff; border-radius: 6px; box-shadow: var(--shadow-lg); padding: 48px 52px; min-height: 640px; font-size: 14px; color: var(--ink); }
.doc table { width: 100%; border-collapse: collapse; }
.doc .meta-row { display: flex; justify-content: space-between; gap: 24px; }

/* template: minimal */
.tpl-minimal .doc-kind { font-size: 30px; font-weight: 800; letter-spacing: .14em; color: #cbd5e1; text-align: right; margin: 0; }
.tpl-minimal .biz-name { font-size: 19px; font-weight: 800; margin: 0 0 4px; }
.tpl-minimal .small { color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.tpl-minimal .doc-meta { text-align: right; font-size: 13px; color: var(--ink-soft); line-height: 1.9; }
.tpl-minimal .doc-meta b { color: var(--ink); }
.tpl-minimal .billto { margin: 30px 0 6px; font-size: 11px; font-weight: 800; letter-spacing: .1em; color: var(--faint); text-transform: uppercase; }
.tpl-minimal .billto-name { font-weight: 700; font-size: 15px; }
.tpl-minimal table.items { margin-top: 18px; }
.tpl-minimal table.items th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 10px 8px; border-bottom: 2px solid var(--ink); }
.tpl-minimal table.items td { padding: 12px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.tpl-minimal .num { text-align: right; font-variant-numeric: tabular-nums; }
.tpl-minimal .totals { width: 260px; margin: 18px 0 0 auto; font-size: 13.5px; }
.tpl-minimal .totals td { padding: 5px 0; }
.tpl-minimal .totals .grand td { font-size: 17px; font-weight: 800; border-top: 2px solid var(--ink); padding-top: 10px; }
.tpl-minimal .notes { margin-top: 34px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line-soft); padding-top: 14px; white-space: pre-line; }

/* template: modern */
.tpl-modern .doc { padding: 0; overflow: hidden; }
.tpl-modern .band { background: linear-gradient(120deg, #4f46e5, #7c3aed); color: #fff; padding: 36px 52px; display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.tpl-modern .doc-kind { font-size: 34px; font-weight: 800; letter-spacing: .1em; margin: 0; }
.tpl-modern .biz-name { font-size: 18px; font-weight: 800; margin: 0 0 4px; }
.tpl-modern .band .small { color: rgba(255,255,255,.82); font-size: 12.5px; line-height: 1.6; }
.tpl-modern .body { padding: 34px 52px 48px; }
.tpl-modern .doc-meta { display: flex; gap: 34px; font-size: 13px; margin-bottom: 8px; flex-wrap: wrap; }
.tpl-modern .doc-meta .k { font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); display: block; }
.tpl-modern .doc-meta .v { font-weight: 700; }
.tpl-modern .billto { margin: 22px 0 4px; font-size: 11px; font-weight: 800; letter-spacing: .1em; color: var(--accent); text-transform: uppercase; }
.tpl-modern .billto-name { font-weight: 700; font-size: 15px; }
.tpl-modern .small { color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.tpl-modern table.items { margin-top: 16px; border-radius: 8px; overflow: hidden; }
.tpl-modern table.items th { background: var(--ink); color: #fff; text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; padding: 11px 12px; }
.tpl-modern table.items td { padding: 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.tpl-modern table.items tr:nth-child(even) td { background: #f8fafc; }
.tpl-modern .num { text-align: right; font-variant-numeric: tabular-nums; }
.tpl-modern .totals { width: 260px; margin: 18px 0 0 auto; font-size: 13.5px; }
.tpl-modern .totals td { padding: 5px 0; }
.tpl-modern .totals .grand td { font-size: 17px; font-weight: 800; color: var(--accent-dark); border-top: 2px solid var(--accent); padding-top: 10px; }
.tpl-modern .notes { margin-top: 30px; font-size: 12.5px; color: var(--muted); background: var(--accent-soft); border-radius: 8px; padding: 14px 16px; white-space: pre-line; }

/* template: classic */
.tpl-classic .doc-head { text-align: center; border-bottom: 3px double var(--ink); padding-bottom: 18px; margin-bottom: 8px; }
.tpl-classic .biz-name { font-size: 24px; font-weight: 800; margin: 0 0 4px; font-family: Georgia, "Times New Roman", serif; }
.tpl-classic .small { color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.tpl-classic .doc-kind { font-size: 22px; font-weight: 800; letter-spacing: .22em; margin: 22px 0 4px; font-family: Georgia, "Times New Roman", serif; }
.tpl-classic .doc-meta { font-size: 13px; color: var(--ink-soft); line-height: 1.9; }
.tpl-classic .billto { margin: 24px 0 4px; font-size: 11px; font-weight: 800; letter-spacing: .1em; color: var(--faint); text-transform: uppercase; }
.tpl-classic .billto-name { font-weight: 700; font-size: 15px; }
.tpl-classic table.items { margin-top: 16px; border: 1px solid var(--line); }
.tpl-classic table.items th { text-align: left; font-size: 12px; padding: 10px 12px; border: 1px solid var(--line); background: #f1f5f9; }
.tpl-classic table.items td { padding: 11px 12px; border: 1px solid var(--line); vertical-align: top; }
.tpl-classic .num { text-align: right; font-variant-numeric: tabular-nums; }
.tpl-classic .totals { width: 280px; margin: 0 0 0 auto; font-size: 13.5px; border: 1px solid var(--line); border-top: 0; }
.tpl-classic .totals td { padding: 7px 12px; border-bottom: 1px solid var(--line-soft); }
.tpl-classic .totals .grand td { font-size: 16px; font-weight: 800; background: #f1f5f9; }
.tpl-classic .notes { margin-top: 28px; font-size: 12.5px; color: var(--muted); white-space: pre-line; }
.tpl-classic .notes .k { font-weight: 800; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); display: block; margin-bottom: 4px; }

/* template: bold (Pro) */
.tpl-bold .doc { padding: 0; overflow: hidden; }
.tpl-bold .band { background: #171a29; color: #fff; padding: 36px 52px; display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; border-bottom: 6px solid #cc1a33; }
.tpl-bold .doc-kind { font-size: 13px; font-weight: 800; letter-spacing: .28em; margin: 0; color: #cc1a33; }
.tpl-bold .doc-num { font-size: 38px; font-weight: 800; margin: 6px 0 0; letter-spacing: -.01em; }
.tpl-bold .kind-wrap { text-align: right; }
.tpl-bold .biz-name { font-size: 18px; font-weight: 800; margin: 0 0 4px; }
.tpl-bold .band .small { color: rgba(255,255,255,.75); font-size: 12.5px; line-height: 1.6; }
.tpl-bold .body { padding: 30px 52px 48px; }
.tpl-bold .doc-meta { display: flex; gap: 34px; font-size: 13px; margin-bottom: 8px; flex-wrap: wrap; }
.tpl-bold .doc-meta .k { font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); display: block; }
.tpl-bold .doc-meta .v { font-weight: 700; }
.tpl-bold .billto { margin: 22px 0 4px; font-size: 11px; font-weight: 800; letter-spacing: .1em; color: #cc1a33; text-transform: uppercase; }
.tpl-bold .billto-name { font-weight: 700; font-size: 15px; }
.tpl-bold .small { color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.tpl-bold table.items { margin-top: 16px; }
.tpl-bold table.items th { background: #171a29; color: #fff; text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; padding: 11px 12px; border-bottom: 3px solid #cc1a33; }
.tpl-bold table.items td { padding: 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.tpl-bold table.items tr:nth-child(even) td { background: #f8fafc; }
.tpl-bold .num { text-align: right; font-variant-numeric: tabular-nums; }
.tpl-bold .totals { width: 260px; margin: 18px 0 0 auto; font-size: 13.5px; }
.tpl-bold .totals td { padding: 5px 0; }
.tpl-bold .totals .grand td { font-size: 18px; font-weight: 800; color: #cc1a33; border-top: 3px solid #cc1a33; padding-top: 10px; }
.tpl-bold .notes { margin-top: 30px; font-size: 12.5px; color: var(--muted); background: #fff1f2; border-radius: 8px; padding: 14px 16px; white-space: pre-line; }
.tpl-bold .notes .k { font-weight: 800; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #cc1a33; display: block; margin-bottom: 4px; }

/* template: elegant (Pro) */
.tpl-elegant .doc-head { text-align: center; padding: 28px 0 6px; }
.tpl-elegant .rule { width: 200px; margin: 18px auto 4px; border-top: 1px solid #947848; }
.tpl-elegant .rule:after { content: ""; display: block; border-top: 1px solid #947848; margin-top: 3px; }
.tpl-elegant .biz-name { font-size: 27px; font-weight: 700; margin: 0 0 6px; font-family: Georgia, "Times New Roman", serif; }
.tpl-elegant .small { color: var(--muted); font-size: 13px; line-height: 1.8; }
.tpl-elegant .doc-kind { font-size: 21px; font-weight: 700; letter-spacing: .3em; text-indent: .3em; margin: 26px 0 6px; font-family: Georgia, "Times New Roman", serif; color: #73706b; }
.tpl-elegant .doc-meta { text-align: center; font-size: 13px; color: var(--ink-soft); line-height: 2; margin-bottom: 10px; }
.tpl-elegant .doc-meta .num-line { display: block; font-family: Georgia, "Times New Roman", serif; font-size: 14.5px; }
.tpl-elegant .billto { margin: 34px 0 6px; font-size: 11px; font-weight: 700; letter-spacing: .24em; text-indent: .24em; color: #947848; text-transform: uppercase; }
.tpl-elegant .billto-name { font-weight: 700; font-size: 16px; font-family: Georgia, "Times New Roman", serif; }
.tpl-elegant table.items { margin-top: 20px; }
.tpl-elegant table.items th { text-align: left; font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; color: #73706b; padding: 12px 6px; border-top: 1px solid #947848; border-bottom: 1px solid #947848; font-family: Georgia, "Times New Roman", serif; }
.tpl-elegant table.items td { padding: 14px 6px; border-bottom: 1px solid var(--line-soft); vertical-align: top; font-size: 14px; }
.tpl-elegant .num { text-align: right; font-variant-numeric: tabular-nums; }
.tpl-elegant .totals { width: 280px; margin: 20px 0 0 auto; font-size: 14px; }
.tpl-elegant .totals td { padding: 7px 0; }
.tpl-elegant .totals .grand td { font-size: 18px; font-weight: 700; font-family: Georgia, "Times New Roman", serif; color: #947848; border-top: 1px solid #947848; border-bottom: 1px solid #947848; padding: 12px 0; }
.tpl-elegant .notes { margin-top: 40px; font-size: 13px; color: var(--muted); white-space: pre-line; line-height: 1.8; }
.tpl-elegant .notes .k { font-family: Georgia, "Times New Roman", serif; font-weight: 700; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: #947848; display: block; margin-bottom: 6px; }

/* template: compact (Pro) */
.tpl-compact { font-size: 13px; }
.tpl-compact .meta-row { align-items: flex-start; border-bottom: 2px solid var(--ink); padding-bottom: 12px; }
.tpl-compact .doc-kind { font-size: 17px; font-weight: 800; letter-spacing: .1em; margin: 0; text-align: right; }
.tpl-compact .biz-name { font-size: 15px; font-weight: 800; margin: 0 0 2px; }
.tpl-compact .small { color: var(--muted); font-size: 11px; line-height: 1.5; }
.tpl-compact .doc-meta { text-align: right; font-size: 11.5px; color: var(--ink-soft); line-height: 1.7; }
.tpl-compact .doc-meta b { color: var(--ink); }
.tpl-compact .billto { margin: 14px 0 2px; font-size: 10px; font-weight: 800; letter-spacing: .1em; color: var(--faint); text-transform: uppercase; }
.tpl-compact .billto-name { font-weight: 700; font-size: 13px; }
.tpl-compact table.items { margin-top: 10px; }
.tpl-compact table.items th { text-align: left; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); padding: 6px; border-bottom: 1px solid var(--ink); }
.tpl-compact table.items td { padding: 6px; border-bottom: 1px solid var(--line-soft); vertical-align: top; font-size: 12.5px; }
.tpl-compact .num { text-align: right; font-variant-numeric: tabular-nums; }
.tpl-compact .totals { width: 230px; margin: 10px 0 0 auto; font-size: 12.5px; }
.tpl-compact .totals td { padding: 3px 0; }
.tpl-compact .totals .grand td { font-size: 15px; font-weight: 800; border-top: 2px solid var(--ink); padding-top: 6px; }
.tpl-compact .notes { margin-top: 18px; font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--line-soft); padding-top: 10px; white-space: pre-line; }
.tpl-compact .notes .k { font-weight: 800; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); display: block; margin-bottom: 2px; }

/* Pro badge in the template picker */
.pro-badge { display: inline-block; font-size: 9px; font-weight: 800; letter-spacing: .08em; background: var(--accent-soft); color: var(--accent-dark); border-radius: 5px; padding: 2px 6px; margin-left: 5px; vertical-align: 2px; }
.seg button[aria-pressed="true"] .pro-badge { background: rgba(255,255,255,.22); color: #fff; }

.doc-logo { max-height: 56px; max-width: 180px; object-fit: contain; margin-bottom: 10px; display: block; }
.empty-line { color: var(--faint); font-style: italic; }

/* ---------- saved invoices ---------- */
.saved { padding: 0 0 72px; }
.saved-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.saved-head h2 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.saved-head p { margin: 0; color: var(--muted); font-size: 14px; }
.saved-list { display: grid; gap: 10px; }
.saved-row {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
}
.saved-row .n { font-weight: 800; }
.saved-row .t { color: var(--muted); font-size: 13.5px; }
.saved-row .amt { margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; }
.saved-row .actions { display: flex; gap: 6px; }
.icon-btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; font: 600 13px var(--font); color: var(--ink-soft); padding: 7px 11px; cursor: pointer; }
.icon-btn:hover { border-color: #cbd5e1; background: #f8fafc; }
.icon-btn.danger:hover { color: var(--red); border-color: #fecaca; background: var(--red-soft); }
.saved-empty { text-align: center; color: var(--muted); padding: 34px; border: 1.5px dashed var(--line); border-radius: 12px; background: #fff; font-size: 14.5px; }

/* ---------- faq / footer ---------- */
.faq { padding: 0 0 72px; }
.faq h2 { font-size: 22px; letter-spacing: -.02em; margin: 0 0 16px; }
.faq details { background: #fff; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; padding: 16px 18px; }
.faq summary { font-weight: 700; cursor: pointer; font-size: 15.5px; }
.faq summary::marker { color: var(--accent); }
.faq details p { color: var(--muted); margin: 10px 0 0; font-size: 14.5px; }

.site-footer { border-top: 1px solid var(--line); background: #fff; padding: 36px 0; color: var(--muted); font-size: 14px; }
.site-footer .wrap { display: flex; gap: 24px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.site-footer nav { display: flex; gap: 18px; }

/* ---------- pricing page ---------- */
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; max-width: 860px; margin: 36px auto 72px; }
.plan { background: #fff; border: 1.5px solid var(--line); border-radius: 16px; padding: 32px; box-shadow: var(--shadow); position: relative; }
.plan.pro { border-color: var(--accent); }
.plan .flag { position: absolute; top: -13px; left: 50%; transform: translateX(-50%); background: var(--accent); color: #fff; font: 700 12px var(--font); letter-spacing: .06em; text-transform: uppercase; padding: 5px 14px; border-radius: 999px; }
.plan h2 { margin: 0 0 4px; font-size: 20px; }
.plan .price { font-size: 40px; font-weight: 800; letter-spacing: -.03em; margin: 12px 0 4px; }
.plan .price small { font-size: 15px; color: var(--muted); font-weight: 600; }
.plan ul { list-style: none; padding: 0; margin: 20px 0 24px; }
.plan li { padding: 8px 0 8px 28px; position: relative; font-size: 14.5px; color: var(--ink-soft); border-bottom: 1px solid var(--line-soft); }
.plan li::before { content: "✓"; position: absolute; left: 4px; color: var(--green); font-weight: 800; }
.plan li.soon::before { content: "◷"; color: var(--amber); }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; font: 600 14px var(--font);
  padding: 12px 20px; border-radius: 10px; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: all .25s ease; z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- responsive ---------- */
@media (max-width: 1020px) {
  .builder-grid { grid-template-columns: 1fr; }
  .preview-col { position: static; }
}
@media (max-width: 640px) {
  .hero { padding: 48px 0 28px; }
  .nav a:not(.btn) { display: none; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .preview-shell { padding: 12px; }
  .doc { padding: 28px 22px; min-height: 0; }
  .tpl-modern .band { padding: 26px; flex-direction: column; }
  .tpl-modern .body { padding: 24px 22px 32px; }
  .plans { grid-template-columns: 1fr; }
  .preview-toolbar .btn { flex: 1; }
  .doc .meta-row { flex-direction: column; }
  .tpl-minimal .doc-kind, .tpl-minimal .doc-meta { text-align: left; }
}

/* ---------- print: only the invoice ---------- */
@media print {
  .site-header, .hero, .builder-head, .form-col, .preview-toolbar,
  .saved, .faq, .site-footer, .toast { display: none !important; }
  body { background: #fff; }
  .builder, .builder-grid { display: block; padding: 0; }
  .preview-shell { border: 0; padding: 0; box-shadow: none; background: #fff; }
  .doc { box-shadow: none; border-radius: 0; }
  .wrap { max-width: none; padding: 0; }
}

/* ---------- Billia account layer (Phase 1, additive) ---------- */
.acct-slot { display: inline-flex; align-items: center; gap: 8px; margin-left: 6px; }
.acct-email { font-size: 13px; color: #475569; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bacct-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; }
.bacct-modal { background: #fff; border-radius: 12px; padding: 24px; max-width: 400px; width: 100%; position: relative; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.bacct-modal h3 { margin: 0 0 8px; }
.bacct-modal .muted { color: #64748b; font-size: 14px; margin: 0 0 12px; }
.bacct-modal form { display: flex; flex-direction: column; gap: 10px; }
.bacct-modal input[type="email"] { padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 15px; }
.bacct-msg { font-size: 13px; color: #475569; min-height: 18px; margin: 8px 0 0; }
.bacct-close { position: absolute; top: 8px; right: 12px; border: 0; background: none; font-size: 22px; cursor: pointer; color: #94a3b8; }
.bacct-backup { position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; z-index: 80; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.18); padding: 16px 18px; max-width: 420px; width: calc(100% - 32px); }
.bacct-backup .muted { color: #64748b; font-size: 13px; margin: 6px 0 10px; }
.bacct-backup form { display: flex; gap: 8px; }
.bacct-backup input[type="email"] { flex: 1; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 14px; min-width: 0; }
.bacct-toast { position: fixed; left: 50%; transform: translateX(-50%) translateY(10px); bottom: 24px; background: #0f172a; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 14px; opacity: 0; transition: opacity .3s, transform .3s; z-index: 100; pointer-events: none; max-width: calc(100% - 32px); text-align: center; }
.bacct-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.cloud-wrap { margin-top: 18px; }
.cloud-wrap h3 { font-size: 16px; margin: 0 0 10px; color: #334155; }
@media print { .bacct-backup, .bacct-toast, .bacct-overlay { display: none !important; } }

/* Billia workspace dashboard (Phase 2 Pro) */
.dash-head { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; }
.dash-head h3 { font-size: 17px; margin: 0; color: #334155; }
.pro-badge { display: inline-block; background: #4f46e5; color: #fff; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; padding: 3px 9px; border-radius: 999px; }
.dash-tabs { display: flex; gap: 4px; border-bottom: 2px solid #e2e8f0; margin-bottom: 16px; }
.dash-tab { border: none; background: none; font: 600 14px var(--font); color: var(--muted); padding: 10px 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.dash-tab:hover { color: var(--ink); }
.dash-tab.active { color: #4f46e5; border-bottom-color: #4f46e5; }
.dash-body { min-height: 120px; }
.dash-actions { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.dash-row { align-items: center; }
.dash-row .actions { flex-wrap: wrap; }
.pill { display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; padding: 3px 10px; border-radius: 999px; background: #f1f5f9; color: #64748b; white-space: nowrap; }
.pill-paid { background: #dcfce7; color: #15803d; }
.pill-over { background: #fee2e2; color: #b91c1c; }
.stripe-card { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; padding: 12px 16px; margin: 12px 0 4px; font-size: 14px; }
.linklike { background: none; border: none; color: #4f46e5; cursor: pointer; font-size: 13px; text-decoration: underline; padding: 0; }
.icon-btn.on { border-color: #4f46e5; color: #4f46e5; background: #eef2ff; }
.pro-lock { border: 1px dashed #c7d2fe; background: #eef2ff; border-radius: 12px; padding: 28px 20px; text-align: center; max-width: 520px; margin: 8px auto; }
.pro-lock p { margin: 8px 0 16px; }
.bacct-modal label { display: block; font-size: 13.5px; font-weight: 600; color: #334155; margin: 10px 0; }
.bacct-modal input, .bacct-modal select, .bacct-modal textarea { width: 100%; box-sizing: border-box; margin-top: 4px; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 15px; font-family: inherit; }
.bacct-modal textarea { resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row label { margin: 10px 0; }
