/* SellerReceipt — site styles.
 * Layout: form on the left, a true-size paper preview on the right (scaled to fit);
 * on phones the two become Edit / Preview tabs with a bottom bar. */
:root {
  --ink: #101a33;
  --ink-2: #33405c;
  --muted: #64708a;
  --line: #dde3ee;
  --line-2: #c9d2e3;
  --bg: #f2f4f8;
  --surface: #ffffff;
  --brand: #2f5bea;
  --brand-ink: #1f43c4;
  --brand-soft: #e9eefd;
  --ok: #0b8a5c;
  --err: #c0392b;

  --fam-inv: #2f5bea; --fam-inv-bg: #e9eefd;
  --fam-rct: #0b8a5c; --fam-rct-bg: #e2f4eb;
  --fam-qte: #b45309; --fam-qte-bg: #fcefdc;
  --fam-ord: #6d28d9; --fam-ord-bg: #efe8fd;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 26, 51, .06), 0 8px 24px rgba(16, 26, 51, .06);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--ink);
}
a { color: var(--brand); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid rgba(47, 91, 234, .35); outline-offset: 2px; }

.wrap {
  max-width: 1320px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* ---------- header ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 750; font-size: 19px; letter-spacing: -.01em; }
.brand svg { flex: none; }
.brand b { color: var(--brand); font-weight: 750; }
.badges { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.badge { font-size: 12.5px; font-weight: 600; color: var(--ink-2); background: var(--bg); border: 1px solid var(--line); padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
@media (max-width: 640px) { .badges .badge:not(:first-child) { display: none; } }

.hero { padding-block: 22px 6px; }
.hero h1 { margin: 0; font-size: clamp(24px, 3.2vw, 32px); letter-spacing: -.02em; line-height: 1.15; text-wrap: balance; }
.hero p { margin: 6px 0 0; color: var(--muted); max-width: 62ch; }

/* ---------- document picker ---------- */
.picker-wrap { padding-block: 14px 4px; }
.picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 8px;
}
@media (min-width: 1240px) { .picker { grid-template-columns: repeat(11, minmax(0, 1fr)); } }
.pick {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 12px 6px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  text-decoration: none;
  font-size: 13px; font-weight: 600; text-align: center; line-height: 1.2;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.pick:hover { border-color: var(--line-2); box-shadow: var(--shadow); transform: translateY(-1px); }
.pick-ico { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; }
.fam-inv .pick-ico { color: var(--fam-inv); background: var(--fam-inv-bg); }
.fam-rct .pick-ico { color: var(--fam-rct); background: var(--fam-rct-bg); }
.fam-qte .pick-ico { color: var(--fam-qte); background: var(--fam-qte-bg); }
.fam-ord .pick-ico { color: var(--fam-ord); background: var(--fam-ord-bg); }
.pick.active { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); color: var(--ink); }
.pick.active .pick-ico { color: #fff; background: var(--brand); }
@media (prefers-reduced-motion: reduce) { .pick { transition: none; } .pick:hover { transform: none; } }

/* phones: one "Change document" button instead of the grid */
.doc-switch { display: none; }
@media (max-width: 640px) {
  .picker { display: none; }
  .doc-switch {
    display: flex; align-items: center; gap: 12px; width: 100%;
    padding: 10px 12px; border-radius: 12px;
    border: 1px solid var(--line); background: var(--surface);
    text-align: left; cursor: pointer;
  }
  .doc-switch .pick-ico { flex: none; }
  .doc-switch-txt { display: grid; flex: 1; min-width: 0; line-height: 1.2; }
  .doc-switch-txt small { font-size: 12px; color: var(--muted); font-weight: 600; }
  .doc-switch-txt strong { font-size: 16px; }
  .doc-switch-cta { display: inline-flex; align-items: center; gap: 4px; font-weight: 650; color: var(--brand); font-size: 14px; }
}

.sheet { position: fixed; inset: 0; z-index: 80; background: rgba(16, 26, 51, .45); display: flex; align-items: flex-end; justify-content: center; }
.sheet-box {
  width: min(560px, 100%); max-height: 88vh; overflow-y: auto;
  background: var(--surface); border-radius: 18px 18px 0 0;
  padding: 8px max(16px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  box-shadow: 0 -10px 40px rgba(16, 26, 51, .25);
  animation: sheet-up .22s ease-out;
}
@media (min-width: 641px) { .sheet { align-items: center; } .sheet-box { border-radius: 18px; } }
@keyframes sheet-up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet-box { animation: none; } }
.sheet-head { position: sticky; top: -8px; background: var(--surface); display: flex; align-items: center; justify-content: space-between; padding: 10px 0 6px; }
.sheet-head h3 { margin: 0; font-size: 18px; }
.sheet-group { margin-top: 10px; }
.sheet-label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.sheet-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 360px) { .sheet-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sheet .pick:hover { transform: none; }
body.no-scroll { overflow: hidden; }

/* ---------- workspace ---------- */
.app {
  display: grid;
  grid-template-columns: minmax(0, 470px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  padding-block: 14px 40px;
}
.editor { display: grid; gap: 14px; min-width: 0; }
.preview { min-width: 0; }
.pv-sticky { position: sticky; top: 12px; display: grid; gap: 12px; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px 0; }
.card-head h2 { margin: 0; font-size: 15px; font-weight: 700; }
.card-num {
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
  color: var(--brand); background: var(--brand-soft);
  font-variant-numeric: tabular-nums;
}
.card-body { padding: 12px 18px 18px; display: grid; gap: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .grid2 { grid-template-columns: 1fr; } }

/* fields */
.field { display: grid; gap: 5px; min-width: 0; }
label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.hint { font-size: 12.5px; color: var(--muted); }
input, textarea, select {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  font: inherit; font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 9px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; line-height: 1.45; }
input:hover, textarea:hover, select:hover { border-color: #aeb9cf; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input[type="number"] { font-variant-numeric: tabular-nums; }
.input-group { display: flex; }
.input-group input { border-radius: 9px 0 0 9px; }
.input-group select { width: auto; flex: none; border-left: 0; border-radius: 0 9px 9px 0; background: var(--bg); font-weight: 600; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.check input { width: 18px; height: 18px; min-height: 0; accent-color: var(--brand); }

/* logo */
.logo-field { display: flex; align-items: center; gap: 14px; }
.logo-drop {
  position: relative; flex: none;
  width: 132px; height: 72px;
  border: 1.5px dashed var(--line-2); border-radius: 10px;
  display: grid; place-items: center;
  color: var(--brand); font-weight: 650; font-size: 14px;
  background: var(--bg);
  overflow: hidden;
}
.logo-drop:hover { border-color: var(--brand); }
.logo-drop.has-logo { border-style: solid; background: var(--surface); }
.logo-drop img { max-width: 112px; max-height: 56px; object-fit: contain; }
.logo-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; }
.link-btn { border: 0; background: none; padding: 0; color: var(--err); font-weight: 600; cursor: pointer; text-decoration: underline; }

/* items */
.items-head, .item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 62px 92px 88px 34px;
  gap: 8px;
  align-items: center;
}
.items-head.no-price, .item-row.no-price { grid-template-columns: minmax(0, 1fr) 90px 34px; }
.items-head { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
#items { display: grid; gap: 8px; }
.i-amt { font-weight: 650; font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r { text-align: right; }
.icon-btn {
  width: 34px; height: 34px; border: 0; border-radius: 8px;
  display: grid; place-items: center;
  background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: #fdecea; color: var(--err); }
@media (max-width: 520px) {
  .items-head { display: none; }
  .item-row { grid-template-columns: 1fr 1fr 34px; grid-template-areas: "d d x" "q p p" "a a a"; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
  .item-row.no-price { grid-template-columns: 1fr 90px 34px; grid-template-areas: "d q x"; }
  .i-desc { grid-area: d; } .i-qty { grid-area: q; } .i-rate { grid-area: p; } .item-row .icon-btn { grid-area: x; }
  .i-amt { grid-area: a; text-align: right; }
  .i-qty::placeholder, .i-rate::placeholder { color: var(--muted); }
}

.total-line {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-top: 12px; border-top: 1px solid var(--line);
  font-weight: 600; color: var(--ink-2);
}
.total-line strong { font-size: 20px; color: var(--ink); font-variant-numeric: tabular-nums; }
.editor-end { display: flex; justify-content: center; padding-top: 4px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 16px;
  border: 1px solid var(--line-2); border-radius: 10px;
  background: var(--surface); color: var(--ink);
  font-weight: 650; font-size: 14.5px;
  cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--bg); }
.btn:disabled { opacity: .7; cursor: progress; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-ink); border-color: var(--brand-ink); }
.btn-lg { min-height: 48px; padding: 0 22px; font-size: 15.5px; }
.btn-add { justify-self: start; border-style: dashed; color: var(--brand); }

/* preview toolbar */
.pv-bar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
.pv-group { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--ink); color: #fff; }
.swatches { display: flex; gap: 6px; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--surface); background: var(--c); box-shadow: 0 0 0 1px var(--line-2); cursor: pointer; padding: 0; }
.swatch.on { box-shadow: 0 0 0 2px var(--ink); }
.cur { width: auto; min-height: 36px; padding: 5px 8px; font-size: 13.5px; font-weight: 600; }

.paper-frame {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(16, 26, 51, .1), 0 14px 40px rgba(16, 26, 51, .12);
  background: #fff;
}
.paper-scaler { transform-origin: top left; width: max-content; }
.pv-actions { display: flex; gap: 10px; }
.pv-actions .btn-primary { flex: 1; }
.pv-note { margin: 0; text-align: center; font-size: 12.5px; color: var(--muted); }
.pv-new { display: none; }
.editor-end .btn, .pv-new .btn { width: 100%; max-width: 360px; }

/* ---------- the document (fixed px so preview = PDF) ---------- */
.paper {
  --accent: #2f5bea;
  position: relative;
  background: #fff;
  color: #1a2236;
  font-family: var(--font);
  font-size: 12.5px;
  line-height: 1.5;
  padding: 56px 60px 48px;
  display: flex; flex-direction: column;
}
/* tabular digits only where numbers line up; in running text they confuse the PDF renderer */
.paper .r, .d-totals td, .sum-amt { font-variant-numeric: tabular-nums; }
.paper .lbl { font-size: 10px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: #7a849a; margin-bottom: 4px; }
.d-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; min-height: 64px; }
.d-brand img { max-height: 72px; max-width: 220px; object-fit: contain; display: block; }
.d-title { text-align: right; margin-left: auto; }
.d-title h1 { margin: 0; font-size: 30px; line-height: 1.1; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; color: var(--accent); }
.d-num { margin-top: 4px; color: #6b7489; font-size: 13px; font-weight: 600; }

.d-info { display: flex; justify-content: space-between; gap: 32px; margin-top: 30px; }
.d-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; flex: 1; min-width: 0; }
.who { white-space: pre-line; color: #3a4459; overflow-wrap: anywhere; }
.who strong { display: block; color: #1a2236; font-size: 13.5px; }
.d-meta { width: 230px; flex: none; }
.d-meta table { width: 100%; border-collapse: collapse; }
.d-meta th, .d-meta td { padding: 3px 0; font-size: 12px; vertical-align: top; }
.d-meta th { text-align: left; font-weight: 500; color: #7a849a; padding-right: 12px; white-space: nowrap; }
.d-meta td { text-align: right; font-weight: 650; overflow-wrap: anywhere; }
.sum-box { margin-top: 12px; padding: 10px 12px; border-radius: 6px; background: #f3f5f9; border-left: 3px solid var(--accent); }
.sum-lbl { font-size: 10px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: #6b7489; }
.sum-amt { font-size: 20px; font-weight: 800; color: #1a2236; margin-top: 2px; }

.d-items { width: 100%; border-collapse: collapse; margin-top: 26px; }
.d-items th {
  text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: #fff; background: var(--accent);
  padding: 9px 10px;
}
.d-items td { padding: 10px; border-bottom: 1px solid #e8ecf3; vertical-align: top; }
.d-items .r { text-align: right; white-space: nowrap; }
.d-items .c-n { width: 32px; color: #8b93a6; }
.d-items .c-q { width: 60px; } .d-items .c-p { width: 110px; } .d-items .c-a { width: 120px; }
.d-items td.desc { overflow-wrap: anywhere; }
.d-items tbody tr:nth-child(even) td { background: #fafbfd; }

.d-totals { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-top: 18px; }
.d-stamp { flex: 1; display: flex; align-items: center; padding-top: 10px; }
.d-totals table { width: 290px; border-collapse: collapse; }
.d-totals th, .d-totals td { padding: 6px 10px; font-size: 12.5px; }
.d-totals th { text-align: left; font-weight: 500; color: #4f5a70; }
.d-totals td { text-align: right; font-weight: 650; white-space: nowrap; }
.d-totals .grand th, .d-totals .grand td { font-size: 15px; font-weight: 800; color: #1a2236; border-top: 2px solid var(--accent); padding-top: 10px; }
.d-totals .due th, .d-totals .due td { background: #f3f5f9; font-weight: 800; color: #1a2236; }
.stamp {
  transform: rotate(-10deg);
  border: 3px solid #13925f; color: #13925f;
  font-size: 30px; font-weight: 900; letter-spacing: .14em;
  padding: 2px 16px; border-radius: 8px; opacity: .85;
  margin-left: 12px;
}

.d-notes { display: grid; gap: 14px; margin-top: 28px; padding-top: 16px; border-top: 1px solid #e8ecf3; }
.d-notes .txt { white-space: pre-line; color: #3a4459; overflow-wrap: anywhere; }
.d-sign { display: flex; gap: 48px; margin-top: 52px; }
.d-sign > div { width: 230px; display: grid; gap: 2px; }
.d-sign .line { border-bottom: 1px solid #9aa3b5; height: 40px; margin-bottom: 6px; }
.d-sign span { font-size: 10.5px; color: #8b93a6; }
.d-foot { margin-top: auto; padding-top: 28px; text-align: center; color: #8b93a6; font-size: 11px; }

/* template: modern — colour header band, bleeds to the side edges */
.paper.tpl-modern { padding-top: 45px; }
.tpl-modern .d-head { background: var(--accent); margin: 0 -60px; padding: 26px 60px 24px; color: #fff; }
.tpl-modern .d-title h1, .tpl-modern .d-num { color: #fff; }
.tpl-modern .d-num { opacity: .85; }
.tpl-modern .d-brand img { background: #fff; padding: 6px 8px; border-radius: 6px; }
.tpl-modern .d-items th { background: #eef1f6; color: #1a2236; }
.tpl-modern .d-items th:first-child { box-shadow: inset 3px 0 0 var(--accent); }

/* template: minimal — no fills, hairlines only */
.tpl-minimal .d-title h1 { color: #1a2236; font-weight: 300; letter-spacing: .18em; font-size: 28px; }
.tpl-minimal .d-items th { background: transparent; color: #1a2236; border-bottom: 1.5px solid #1a2236; padding-left: 0; padding-right: 0; }
.tpl-minimal .d-items td { padding-left: 0; padding-right: 0; }
.tpl-minimal .d-items .r { padding-left: 10px; }
.tpl-minimal .d-items tbody tr:nth-child(even) td { background: transparent; }
.tpl-minimal .sum-box { background: transparent; border: 1px solid #d5dbe6; border-left: 3px solid var(--accent); }
.tpl-minimal .d-totals .grand th, .tpl-minimal .d-totals .grand td { border-top-color: #1a2236; }

/* PDF export: an unscaled copy rendered off-screen */
.export-host { position: fixed; left: -10000px; top: 0; z-index: -1; }

/* ---------- content ---------- */
.content { padding-block: 8px 48px; }
.content-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 28px; }
@media (max-width: 860px) { .content-grid { grid-template-columns: minmax(0, 1fr); } }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.feature h3 { margin: 0 0 6px; font-size: 15.5px; }
.feature p { margin: 0; color: var(--muted); }
.article { max-width: 760px; color: var(--ink-2); line-height: 1.65; }
.article h2 { color: var(--ink); font-size: 21px; letter-spacing: -.01em; margin: 28px 0 8px; text-wrap: balance; }
.article ol { padding-left: 22px; }
.article h3 { color: var(--ink); font-size: 16px; margin: 18px 0 4px; }
.article h3 + p { margin-top: 0; }
.ticks { list-style: none; padding: 0; display: grid; gap: 6px; }
.ticks li { position: relative; padding-left: 26px; }
.ticks li::before { content: ""; position: absolute; left: 2px; top: 7px; width: 12px; height: 7px; border-left: 2px solid var(--ok); border-bottom: 2px solid var(--ok); transform: rotate(-45deg); }
.related { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.related a { display: inline-block; padding: 7px 14px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); text-decoration: none; font-weight: 600; font-size: 14px; }
.related a:hover { border-color: var(--brand); }

.site-footer { border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 13px; }
.site-footer .wrap { padding-block: 22px; display: grid; gap: 10px; }
.foot-legal a { color: var(--muted); }

/* ---------- About / Contact / Privacy / Terms ---------- */
.header-cta { min-height: 38px; padding: 0 14px; font-size: 14px; text-decoration: none; }
.info-main { padding-block: 28px 56px; }
.info-article { max-width: 760px; }
.info-article h1 { font-size: clamp(26px, 3.4vw, 34px); letter-spacing: -.02em; margin: 0 0 14px; color: var(--ink); text-wrap: balance; }
.info-article .updated { color: var(--muted); font-size: 14px; margin-top: -6px; }
.contact-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 18px 0 8px; }
.contact-label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.contact-email { display: inline-block; font-size: 20px; font-weight: 700; margin-top: 4px; overflow-wrap: anywhere; }
.contact-note { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.foot-links a { color: var(--ink-2); text-decoration: none; }
.foot-links a:hover { color: var(--brand); text-decoration: underline; }

/* ---------- feedback ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 60;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 32px);
  background: var(--ink); color: #fff;
  padding: 11px 18px; border-radius: 10px; font-weight: 600; font-size: 14px;
  box-shadow: 0 10px 30px rgba(16, 26, 51, .25);
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok::before { content: "✓ "; color: #6ee7b7; }
.toast.err { background: var(--err); }

.modal { position: fixed; inset: 0; z-index: 70; background: rgba(16, 26, 51, .45); display: grid; place-items: center; padding: 16px; }
.modal-box { background: var(--surface); border-radius: 14px; padding: 22px; width: min(420px, 100%); box-shadow: 0 20px 60px rgba(16, 26, 51, .3); }
.modal-box h3 { margin: 0 0 6px; font-size: 18px; }
.modal-box p { margin: 0 0 18px; color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

.tabbar { display: none; }

/* ---------- tablet & phone ---------- */
@media (max-width: 1080px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  body[data-view="edit"] .preview { display: none; }
  body[data-view="preview"] .editor { display: none; }
  .pv-sticky { position: static; }
  .pv-actions { display: none; }
  .pv-new { display: flex; justify-content: center; }
  .tabbar {
    display: flex; gap: 8px; align-items: center;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    padding: 10px max(16px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
    background: var(--surface); border-top: 1px solid var(--line);
    box-shadow: 0 -6px 20px rgba(16, 26, 51, .08);
  }
  .tab { flex: 1; min-height: 44px; border: 1px solid var(--line-2); background: var(--surface); border-radius: 10px; font-weight: 650; cursor: pointer; }
  .tab.on { background: var(--ink); border-color: var(--ink); color: #fff; }
  .tab span { font-weight: 500; opacity: .8; font-variant-numeric: tabular-nums; }
  .tabbar .btn-primary { min-height: 44px; }
  .site-footer { padding-bottom: 72px; }
  .toast { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- print: only the document, at true size ----------
 * Every page has a 12 mm top/bottom margin (set with @page in app.js); the paper's
 * own top/bottom padding shrinks by the same amount so page 1 matches the preview. */
@media print {
  html, body { background: #fff !important; }
  body > *:not(#app) { display: none !important; }
  #app { display: block !important; padding: 0 !important; margin: 0 !important; max-width: none !important; }
  #app > .editor { display: none !important; }
  #app > .preview { display: block !important; }
  .pv-sticky { display: block !important; position: static !important; }
  .pv-sticky > :not(.paper-frame) { display: none !important; }
  .paper-frame { box-shadow: none !important; border-radius: 0 !important; height: auto !important; overflow: visible !important; }
  .paper-scaler { transform: none !important; width: auto !important; }
  .paper { min-height: 0 !important; padding-top: 11px !important; padding-bottom: 3px !important; margin: 0 auto; }
  .paper.tpl-modern { padding-top: 0 !important; }
  .d-items tr, .d-totals, .d-notes > div, .d-sign { break-inside: avoid; }
  .d-items thead { display: table-header-group; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
