/* ============================================================
   Plainvo — styles
   ============================================================ */
:root {
  --accent: #2f4d7d;          /* deep navy ink — refined, harmonizes with the invoice */
  --accent-ink: #213a61;
  --bg: #f5efe3;              /* warm paper stock */
  --panel: #fffdf8;          /* warm white card */
  --ink: #221f1a;            /* warm near-black */
  --ink-soft: #5b5347;       /* warm gray-brown */
  --ink-faint: #9c9384;
  --line: #e7decd;           /* warm hairline rule */
  --line-strong: #d8ccb6;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(60, 50, 35, .05);
  --shadow-md: 0 6px 24px rgba(60, 50, 35, .08);
  --maxw: 1180px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, Charter, "Times New Roman", serif;
  --font-mono: "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* beat author display rules (.modal-backdrop, .btn, etc.) */
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.2; margin: 0; }
/* Editorial: serif headlines + monospace figures, but the invoice sheet keeps its clean sans */
h1, h2, h3 { font-family: var(--font-serif); font-weight: 700; letter-spacing: -.012em; }
.invoice, .invoice h1, .invoice h2, .invoice h3 { font-family: var(--font); }
.pro-price, .js-pro-price, .how-num, .breadcrumb, .hero-points, .pro-tag { font-family: var(--font-mono); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.muted { color: var(--ink-faint); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; border-radius: 8px;
  padding: 10px 16px; transition: transform .04s ease, background .15s ease, box-shadow .15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-ink); text-decoration: none; }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: #f8fafc; text-decoration: none; }
.btn-lg { padding: 13px 22px; font-size: 1.02rem; }
.btn-tiny { padding: 7px 11px; font-size: .85rem; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-add { background: #efe6d4; color: var(--accent-ink); border-color: #ddd0b8; margin-top: 6px; }
.btn-add:hover { background: #e8ddc6; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Header ---------- */
.site-header { background: var(--panel); border-bottom: 1px solid var(--line); border-top: 3px solid var(--accent); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.38rem; color: var(--ink); font-family: var(--font-serif); letter-spacing: -.015em; }
.brand:hover { text-decoration: none; }
.brand-mark { display: none; } /* typographic wordmark — emoji removed for the editorial look */
.header-nav { display: flex; align-items: center; gap: 12px; }
.pro-badge { background: linear-gradient(135deg, #f59e0b, #f97316); color: #fff; font-weight: 700; font-size: .8rem; padding: 4px 10px; border-radius: 999px; }

/* ---------- Hero ---------- */
.hero { padding: 40px 0 16px; text-align: center; }
.hero h1 { font-size: 2.5rem; letter-spacing: -.02em; }
.hero-sub { max-width: 620px; margin: 14px auto 0; color: var(--ink-soft); font-size: 1.08rem; }
.hero-points { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 22px; justify-content: center; padding: 0; margin: 20px 0 0; color: var(--ink-soft); font-weight: 500; font-size: .82rem; letter-spacing: .01em; }

/* ---------- App grid ---------- */
.app-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 26px; align-items: start; padding-top: 26px; padding-bottom: 50px; }
.editor { display: flex; flex-direction: column; gap: 18px; }

/* ---------- Cards & fields ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 20px; box-shadow: var(--shadow-sm); }
.card-title { font-size: 1.02rem; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-top: 12px; font-size: .9rem; }
.field:first-of-type { margin-top: 0; }
.field > span, .field-label { color: var(--ink-soft); font-weight: 600; display: flex; align-items: center; gap: 6px; }
input, textarea, select {
  font: inherit; color: var(--ink); background: var(--panel);
  border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px 11px; width: 100%;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
textarea { resize: vertical; }
input[type="color"] { padding: 4px; height: 40px; }
input[type="file"].file-input { border: 1px dashed var(--line-strong); background: #fafbff; padding: 8px; font-size: .82rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.hint { font-size: .78rem; color: var(--ink-faint); margin: 4px 0 0; }
.hint-inline { font-weight: 400; font-size: .76rem; color: var(--ink-faint); }
.inv-pay { margin-top: 18px; text-align: center; }
.inv-pay a { display: inline-block; background: var(--inv-accent); color: #fff; font-weight: 700; padding: 9px 22px; border-radius: 8px; text-decoration: none; }
.saved-note { font-size: .8rem; color: #16a34a; margin-left: 10px; }

/* ---------- Logo (Pro) ---------- */
.pro-logo-row { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 14px; }
.logo-preview { width: 72px; height: 72px; flex: none; border: 1px dashed var(--line-strong); border-radius: 10px; display: grid; place-items: center; color: var(--ink-faint); font-size: .78rem; background: #fafbff; overflow: hidden; }
.logo-preview img { width: 100%; height: 100%; object-fit: contain; }
.logo-controls { flex: 1; }
.pro-tag { background: #fef3c7; color: #92400e; font-size: .68rem; font-weight: 700; padding: 2px 7px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; }

/* ---------- Line items ---------- */
.items-head, .item-row { display: grid; grid-template-columns: 1fr 64px 96px 96px 30px; gap: 8px; align-items: center; }
.items-head { font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-faint); font-weight: 700; padding: 0 2px 6px; }
.item-row { margin-bottom: 8px; }
.item-row .amt { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-soft); font-weight: 600; padding-right: 4px; }
.item-row input { padding: 8px 9px; }
.del-item { background: none; border: none; color: var(--ink-faint); font-size: 1.2rem; cursor: pointer; line-height: 1; padding: 4px; }
.del-item:hover { color: #ef4444; }
.totals-inputs { margin-top: 14px; }

/* ---------- Template picker ---------- */
.template-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.tpl-opt { font: inherit; font-weight: 600; cursor: pointer; background: #fff; border: 1px solid var(--line-strong); border-radius: 9px; padding: 8px 13px; display: inline-flex; gap: 6px; align-items: center; }
.tpl-opt.is-active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, #fff); color: var(--accent-ink); }

/* ---------- Preview column ---------- */
.preview-col { position: sticky; top: 84px; }
.preview-actions { display: flex; gap: 10px; margin-bottom: 14px; }
.sheet-scroll { background: #ece2d1; border-radius: var(--radius); padding: 22px; overflow: auto; max-height: calc(100vh - 160px); box-shadow: inset 0 1px 4px rgba(60,50,35,.10); }

/* ============================================================
   Invoice sheet (the printable thing)
   ============================================================ */
.invoice {
  --inv-accent: var(--accent);
  background: #fff; color: #1e293b; width: 100%; max-width: 720px; margin: 0 auto;
  padding: 44px; border-radius: 6px; box-shadow: var(--shadow-md); font-size: 14px;
}
.inv-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.inv-logo { max-width: 150px; max-height: 70px; object-fit: contain; }
.inv-biz-name { font-size: 1.3rem; font-weight: 800; }
.inv-muted { color: #64748b; white-space: pre-line; font-size: .9em; }
.inv-title { text-align: right; }
.inv-title h2 { font-size: 1.9rem; letter-spacing: .04em; color: var(--inv-accent); text-transform: uppercase; }
.inv-meta { margin-top: 8px; font-size: .9em; color: #475569; }
.inv-meta b { color: #1e293b; }
.inv-parties { display: flex; gap: 30px; margin: 30px 0 24px; }
.inv-party { flex: 1; }
.inv-party .lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: #94a3b8; font-weight: 700; margin-bottom: 4px; }
.inv-party .who { font-weight: 700; }

table.inv-table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.inv-table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: #fff; background: var(--inv-accent); padding: 9px 12px; }
.inv-table th.num, .inv-table td.num { text-align: right; }
.inv-table td { padding: 10px 12px; border-bottom: 1px solid #eef2f7; vertical-align: top; }
.inv-table tbody tr:last-child td { border-bottom: 1px solid #e2e8f0; }

.inv-totals { margin-left: auto; width: 280px; margin-top: 16px; }
.inv-totals .row { display: flex; justify-content: space-between; padding: 6px 0; font-size: .95em; }
.inv-totals .row.grand { border-top: 2px solid var(--inv-accent); margin-top: 6px; padding-top: 10px; font-size: 1.15em; font-weight: 800; color: var(--inv-accent); }
.inv-notes { margin-top: 30px; padding-top: 16px; border-top: 1px solid #eef2f7; color: #475569; font-size: .9em; white-space: pre-line; }
.inv-notes .lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: #94a3b8; font-weight: 700; margin-bottom: 4px; }
.inv-footer-brand { margin-top: 28px; text-align: center; font-size: .78rem; color: #b6c0cf; }

/* Template: Modern (accent header band) */
.invoice.tpl-modern { padding: 0; overflow: hidden; }
.invoice.tpl-modern .inv-band { background: var(--inv-accent); color: #fff; padding: 34px 44px; display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.invoice.tpl-modern .inv-band .inv-muted, .invoice.tpl-modern .inv-band .inv-title h2 { color: #fff; }
.invoice.tpl-modern .inv-band .inv-title h2 { opacity: .92; }
.invoice.tpl-modern .inv-band .inv-meta, .invoice.tpl-modern .inv-band .inv-meta b { color: rgba(255, 255, 255, .92); }
.invoice.tpl-modern .inv-body { padding: 30px 44px 44px; }
.invoice.tpl-modern .inv-parties { margin-top: 0; }
.invoice.tpl-modern .inv-table th { background: #f1f5f9; color: #334155; }

/* Template: Minimal (clean, no fills) */
.invoice.tpl-minimal .inv-title h2 { color: #1e293b; font-weight: 800; }
.invoice.tpl-minimal .inv-table th { background: transparent; color: #94a3b8; border-bottom: 2px solid #1e293b; }
.invoice.tpl-minimal .inv-totals .row.grand { color: #1e293b; border-top-color: #1e293b; }

/* Template: Bold (big accent block) */
.invoice.tpl-bold .inv-title h2 { font-size: 2.4rem; }
.invoice.tpl-bold .inv-top { border-bottom: 4px solid var(--inv-accent); padding-bottom: 18px; }
.invoice.tpl-bold .inv-table th { background: #1e293b; }
.invoice.tpl-bold .inv-table th.is-accent { background: var(--inv-accent); }

/* ---------- Pro section ---------- */
.pro-section { background: linear-gradient(135deg, #241f18, #34291d); color: #fff; padding: 54px 0; margin-top: 10px; }
.pro-inner { display: flex; align-items: center; gap: 40px; justify-content: space-between; }
.pro-copy { max-width: 560px; }
.pro-copy h2 { font-size: 1.9rem; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pro-price { background: rgba(255,255,255,.12); padding: 4px 12px; border-radius: 999px; font-size: 1rem; font-weight: 700; }
.pro-copy p { color: #cbd5e1; margin: 12px 0 18px; font-size: 1.05rem; }
.pro-features { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 9px; }
.pro-features li { color: #e2e8f0; }
.pro-cta-row { display: flex; gap: 12px; flex-wrap: wrap; }
.pro-refund { margin: 12px 0 0; color: rgba(255, 255, 255, .55); font-size: .85rem; }
.pro-refund:empty { display: none; }
.pro-section .btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.3); }
.pro-section .btn-ghost:hover { background: rgba(255,255,255,.08); }
.pro-art { font-size: 6rem; opacity: .9; }

/* ---------- Footer ---------- */
.site-footer { background: #fff; border-top: 1px solid var(--line); padding: 26px 0; }
.footer-inner { text-align: center; }
.footer-inner p { margin: 4px 0; color: var(--ink-soft); }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: #fff; border-radius: 16px; padding: 28px; width: 100%; max-width: 420px; position: relative; box-shadow: var(--shadow-md); }
.modal h3 { font-size: 1.3rem; }
.modal-sub { color: var(--ink-soft); margin: 8px 0 16px; }
.modal-close { position: absolute; top: 12px; right: 14px; border: none; background: none; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--ink-faint); }
.modal-close:hover { color: var(--ink); }
.modal-msg { min-height: 20px; font-size: .9rem; margin: 10px 0; }
.modal-msg.ok { color: #16a34a; }
.modal-msg.err { color: #dc2626; }
.modal-foot { text-align: center; margin: 16px 0 0; color: var(--ink-soft); font-size: .9rem; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .app-grid { grid-template-columns: 1fr; }
  .preview-col { position: static; }
  .sheet-scroll { max-height: none; }
  .hero h1 { font-size: 2rem; }
  .pro-inner { flex-direction: column; text-align: center; }
  .pro-art { display: none; }
  .pro-cta-row { justify-content: center; }
}
@media (max-width: 480px) {
  .grid-3 { grid-template-columns: 1fr; }
  .invoice { padding: 24px; }
  .invoice.tpl-modern .inv-band, .invoice.tpl-modern .inv-body { padding-left: 24px; padding-right: 24px; }
  .inv-parties { flex-direction: column; gap: 16px; }
  /* line items: reflow so the fixed columns never overflow narrow phones */
  .items-head { display: none; }
  .item-row {
    grid-template-columns: 1fr 44px 70px 26px;
    grid-template-areas: "desc qty price del" "amt amt amt amt";
    gap: 4px 6px;
  }
  .item-row .i-desc { grid-area: desc; }
  .item-row .i-qty { grid-area: qty; }
  .item-row .i-price { grid-area: price; }
  .item-row .del-item { grid-area: del; }
  .item-row .amt { grid-area: amt; text-align: right; font-size: .82rem; color: var(--ink-faint); }
}

/* ============================================================
   Print — only the invoice sheet prints
   ============================================================ */
@media print {
  body { background: #fff; }
  .site-header, .hero, .editor, .preview-actions, .pro-section, .site-footer, .modal-backdrop { display: none !important; }
  .app-grid, .wrap { display: block; max-width: none; padding: 0; margin: 0; }
  .sheet-scroll { background: none; padding: 0; box-shadow: none; max-height: none; overflow: visible; }
  .invoice { box-shadow: none; max-width: none; width: 100%; padding: 0; border-radius: 0; }
  @page { margin: 16mm; }
}

/* ============================================================
   Article / guide pages (SEO content)
   ============================================================ */
.article-wrap { max-width: 760px; margin: 0 auto; padding: 44px 20px 64px; }
.breadcrumb { font-size: .88rem; color: var(--ink-faint); margin-bottom: 18px; }
.breadcrumb a { color: var(--ink-soft); }
.article-wrap h1 { font-size: 2.2rem; letter-spacing: -.02em; margin-bottom: 8px; }
.article-lede { color: var(--ink-soft); font-size: 1.15rem; margin: 6px 0 26px; }
.article-wrap h2 { font-size: 1.4rem; margin: 34px 0 10px; }
.article-wrap p, .article-wrap li { color: var(--ink-soft); font-size: 1.05rem; line-height: 1.65; }
.article-wrap ul, .article-wrap ol { padding-left: 22px; }
.article-wrap li { margin: 7px 0; }
.article-wrap strong { color: var(--ink); }
.cta-box { background: linear-gradient(135deg, #eff6ff, #eef2ff); border: 1px solid #dbeafe; border-radius: var(--radius); padding: 24px; margin: 34px 0; text-align: center; }
.cta-box h3 { margin-bottom: 6px; font-size: 1.2rem; }
.cta-box p { margin: 0 0 14px; }
.guides-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; margin-top: 24px; }
.guide-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); }
.guide-card h3 { font-size: 1.1rem; margin-bottom: 8px; }
.guide-card h3 a { color: var(--ink); }
.guide-card p { color: var(--ink-soft); font-size: .96rem; margin: 0; }

/* ---------- FAQ ---------- */
.faq-section { padding: 52px 0; background: var(--bg); }
.faq-section h2 { text-align: center; font-size: 1.85rem; letter-spacing: -.01em; }
.faq-sub { text-align: center; color: var(--ink-soft); margin: 8px 0 30px; }
.faq-list { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.faq-item { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px 22px; box-shadow: var(--shadow-sm); }
.faq-item h3 { font-size: 1.05rem; margin-bottom: 6px; }
.faq-item p { color: var(--ink-soft); margin: 0; }

/* ---------- How it works ---------- */
.how-section { padding: 52px 0; }
.how-section h2 { text-align: center; font-size: 1.85rem; margin-bottom: 28px; }
.how-steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.how-steps li { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); }
.how-num { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 800; margin-bottom: 10px; }
.how-steps h3 { font-size: 1.05rem; margin-bottom: 4px; }
.how-steps p { color: var(--ink-soft); margin: 0; font-size: .95rem; }

/* ---------- Comparison table ---------- */
.compare-section { padding: 52px 0; background: var(--panel); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.compare-section h2 { text-align: center; font-size: 1.85rem; }
.compare-sub { text-align: center; color: var(--ink-soft); margin: 8px 0 26px; }
.compare-scroll { overflow-x: auto; }
.compare-table { width: 100%; max-width: 880px; margin: 0 auto; border-collapse: collapse; min-width: 560px; }
.compare-table th, .compare-table td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--line); }
.compare-table thead th { font-size: .92rem; color: var(--ink-soft); font-weight: 700; }
.compare-table th.us, .compare-table td.us { background: color-mix(in srgb, var(--accent) 8%, #fff); color: var(--accent-ink); font-weight: 700; }
.compare-table thead th.us { font-size: 1.05rem; }
.compare-table tbody td:first-child { color: var(--ink); font-weight: 600; }

@media (max-width: 760px) { .how-steps { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .how-steps { grid-template-columns: 1fr; } }
