/* QuoteFlow Global — mobile-first, high-contrast job-site UI */
:root {
  --ink: #1c1917; --ink-2: #44403c; --muted: #6b6560; --line: #e2ddd6; --line-2: #cfc8bf;
  --bg: #f6f3ee; --card: #ffffff; --soft: #f1ede6;
  --brand: #c2410c; --brand-hi: #ea580c; --brand-soft: #fff1e7;
  --ok: #15803d; --ok-soft: #e7f6ec; --warn: #a16207; --warn-soft: #fdf6dc;
  --bad: #b91c1c; --bad-soft: #fde9e9; --info: #1d4ed8; --info-soft: #e8efff;
  --r: 14px; --r-sm: 10px; --tap: 52px;
  --shadow: 0 1px 2px rgba(28,25,23,.06), 0 4px 16px rgba(28,25,23,.06);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 .5rem; }
h1 { font-size: 1.65rem; font-weight: 800; }
h2 { font-size: 1.2rem; font-weight: 750; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 .75rem; }
a { color: var(--brand); font-weight: 600; text-underline-offset: 3px; }
.num, .money { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid var(--brand-hi); outline-offset: 2px; }

.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner { width: 34px; height: 34px; border: 4px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
.btn .spinner { width: 18px; height: 18px; border-width: 3px; border-color: rgba(255,255,255,.4); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--ink); color: #fff; }
.topbar::after { content: ""; display: block; height: 4px; background: repeating-linear-gradient(-45deg, var(--brand-hi) 0 10px, var(--ink) 10px 20px); }
.topbar-in { max-width: 1080px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 10px 16px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 800; letter-spacing: -0.02em; font-size: 1.05rem; }
.brand img { width: 32px; height: 32px; }
.brand small { display: block; font-weight: 600; font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: #fdba74; }
.topnav { display: none; gap: 4px; margin-left: 12px; }
.topnav a { color: #e7e5e4; text-decoration: none; padding: 10px 14px; border-radius: 10px; font-weight: 600; }
.topnav a[aria-current="page"], .topnav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.spacer { flex: 1; }
.lang-select { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.1); border: 1.5px solid rgba(255,255,255,.28); border-radius: 12px; padding: 0 4px 0 10px; height: 44px; color: #fff; }
.lang-select svg { flex: none; }
.lang-select select { appearance: none; background: transparent; color: #fff; border: 0; font: 700 15px var(--font); height: 100%; padding: 0 22px 0 2px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='white' stroke-width='2' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 4px center; }
.lang-select select option { color: var(--ink); }
.lang-select.light { background: var(--card); border-color: var(--line-2); color: var(--ink); }
.lang-select.light select { color: var(--ink); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%231c1917' stroke-width='2' fill='none'/%3E%3C/svg%3E"); }
.icon-btn { background: transparent; border: 0; color: inherit; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: rgba(255,255,255,.1); }

/* ---------- Bottom tab bar (mobile) ---------- */
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--card); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px 6px calc(6px + var(--safe-b)); }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; color: var(--muted); text-decoration: none; font-size: .7rem; font-weight: 700; border-radius: 10px; min-height: var(--tap); justify-content: center; }
.tabbar a[aria-current="page"] { color: var(--ink); }
.tabbar a.new { color: #fff; background: var(--brand); margin: -18px 4px 0; border-radius: 16px; box-shadow: 0 6px 16px rgba(194,65,12,.35); }
.has-tabbar main { padding-bottom: calc(96px + var(--safe-b)); }

/* ---------- Layout ---------- */
main { max-width: 1080px; margin: 0 auto; padding: 20px 16px 40px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); }
.card + .card, .stack > * + * { margin-top: 14px; }
.grid-2 { display: grid; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }

/* ---------- Forms ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 6px; color: var(--ink-2); }
label.field > span em { font-style: normal; font-weight: 500; color: var(--muted); }
input, select, textarea { width: 100%; font: 16px/1.4 var(--font); color: var(--ink); background: #fff; border: 1.5px solid var(--line-2); border-radius: var(--r-sm); padding: 12px 14px; min-height: var(--tap); }
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(234,88,12,.25); }
input[type=checkbox] { width: 24px; height: 24px; min-height: 0; accent-color: var(--brand); flex: none; }
.check { display: flex; gap: 12px; align-items: flex-start; font-weight: 600; cursor: pointer; }
.hint { font-size: .82rem; color: var(--muted); margin-top: 4px; }
.err { color: var(--bad); font-weight: 600; font-size: .9rem; margin: 6px 0 10px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 0 20px; border-radius: 12px; border: 1.5px solid transparent; font: 750 16px var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform .06s, background .15s; user-select: none; }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: #9a3412; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #000; }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-danger { background: #fff; color: var(--bad); border-color: #f3b4b4; }
.btn-ok { background: var(--ok); color: #fff; }
.btn-block { width: 100%; }
.btn-lg { min-height: 60px; font-size: 1.08rem; border-radius: 14px; }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: .9rem; border-radius: 10px; }
.link-btn { background: none; border: 0; color: var(--brand); font: 700 15px var(--font); cursor: pointer; padding: 8px 0; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; }
.auth-top { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; max-width: 520px; margin: 0 auto; width: 100%; }
.auth-top .brand { color: var(--ink); }
.auth-top .brand small { color: var(--brand); }
.auth-card { width: 100%; max-width: 460px; margin: 4vh auto 40px; padding: 0 16px; }
.auth-card .card { padding: 24px 20px; }
.auth-hero { margin-bottom: 18px; }
.auth-hero p { color: var(--muted); font-size: 1.02rem; }
.auth-foot { text-align: center; margin-top: 18px; color: var(--muted); }
.devbox { background: var(--warn-soft); border: 1px dashed #d4a72c; border-radius: 10px; padding: 12px; font-size: .88rem; word-break: break-all; margin-top: 12px; }

/* ---------- Stepper ---------- */
.steps { display: flex; gap: 8px; margin-bottom: 18px; }
.steps .s { flex: 1; display: flex; flex-direction: column; gap: 6px; font-size: .78rem; font-weight: 700; color: var(--muted); }
.steps .s::before { content: ""; height: 6px; border-radius: 6px; background: var(--line); }
.steps .s.on { color: var(--ink); }
.steps .s.on::before { background: var(--brand); }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; box-shadow: var(--shadow); min-height: 104px; display: flex; flex-direction: column; justify-content: space-between; }
.kpi .k { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kpi .v { font-size: 1.55rem; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.kpi.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.kpi.dark .k { color: #d6d3d1; }
.kpi .sub { font-size: .75rem; color: var(--muted); }
.kpi.dark .sub { color: #a8a29e; }
.trial-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--brand-soft); border: 1px solid #fed7aa; color: #7c2d12; padding: 12px 14px; border-radius: var(--r); margin-bottom: 16px; font-weight: 650; }
.new-quote-cta { display: flex; }

/* ---------- Filters & quote list ---------- */
.filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 42px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--line-2); background: #fff; font: 700 14px var(--font); color: var(--ink-2); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.search { margin-bottom: 12px; position: relative; }
.search input { padding-left: 44px; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.qlist { display: grid; gap: 10px; }
.qitem { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; text-decoration: none; color: inherit; box-shadow: var(--shadow); }
.qitem:hover { border-color: var(--line-2); }
.qitem .t { font-weight: 750; line-height: 1.3; }
.qitem .meta { font-size: .85rem; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.qitem .amt { font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.qitem .actions { grid-column: 1 / -1; display: flex; gap: 8px; margin-top: 6px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.b-draft { background: var(--soft); color: var(--ink-2); }
.b-sent { background: var(--info-soft); color: var(--info); }
.b-approved { background: var(--ok-soft); color: var(--ok); }
.b-declined { background: var(--bad-soft); color: var(--bad); }
.b-demo { background: #f3e8ff; color: #6b21a8; }
.b-demo::before { display: none; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }

/* ---------- Quote editor ---------- */
.notes-box textarea { min-height: 170px; font-size: 17px; }
.ai-loading { display: flex; align-items: center; gap: 14px; padding: 22px; }
.ai-loading .bar { flex: 1; height: 8px; border-radius: 8px; background: var(--soft); overflow: hidden; position: relative; }
.ai-loading .bar::after { content: ""; position: absolute; inset: 0; width: 40%; background: var(--brand-hi); border-radius: 8px; animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.notice { padding: 12px 14px; border-radius: var(--r-sm); font-weight: 600; font-size: .92rem; margin-bottom: 14px; }
.notice.info { background: var(--info-soft); color: #1e3a8a; }
.notice.ok { background: var(--ok-soft); color: #14532d; }
.notice.warn { background: var(--warn-soft); color: #713f12; }
.notice.bad { background: var(--bad-soft); color: #7f1d1d; }
.section-title { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 10px; }
.cat-head { font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--brand); margin: 16px 0 8px; }
.items { display: grid; gap: 10px; }
.item { border: 1.5px solid var(--line); border-radius: var(--r-sm); padding: 12px; background: #fff; display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.item .desc { grid-column: 1 / -1; }
.item .desc textarea { min-height: 52px; }
.item .cat { grid-column: 1 / -1; }
.item label { margin: 0; }
.item label > span { font-size: .75rem; margin-bottom: 4px; }
.item .lt { grid-column: 1 / 2; display: flex; flex-direction: column; justify-content: center; }
.item .lt b { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.item .rm { grid-column: 2 / 3; justify-self: end; align-self: center; }
.totals { display: grid; gap: 6px; font-variant-numeric: tabular-nums; }
.totals .tr { display: flex; justify-content: space-between; gap: 10px; }
.totals .grand { font-size: 1.3rem; font-weight: 800; border-top: 2px solid var(--ink); padding-top: 8px; margin-top: 4px; }
.totals .dep { color: var(--brand); font-weight: 750; }
.sticky-actions { position: sticky; bottom: calc(84px + var(--safe-b)); z-index: 20; background: rgba(246,243,238,.94); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; display: flex; gap: 8px; align-items: center; margin-top: 16px; box-shadow: 0 -4px 20px rgba(28,25,23,.08); }
.sticky-actions .tot { flex: 1; font-weight: 800; font-size: 1.1rem; padding-left: 6px; font-variant-numeric: tabular-nums; }
.sticky-actions .tot small { display: block; font-size: .7rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.share-box { display: flex; gap: 8px; }
.share-box input { font-size: 14px; background: var(--soft); }
.timeline { display: grid; gap: 6px; font-size: .9rem; }
.timeline div { display: flex; gap: 8px; align-items: center; }

/* ---------- Share & dictation ---------- */
.btn-wa { background: #128c4a; color: #fff; }
.btn-wa:hover { background: #0e6e3a; }
.share-row .btn { flex: 1 1 140px; }
.notes-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.notes-head label { font-weight: 700; font-size: .9rem; color: var(--ink-2); }
.btn-mic { background: #fff; color: var(--ink); border-color: var(--line-2); min-height: 44px; }
.btn-mic.on { background: var(--bad); border-color: var(--bad); color: #fff; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(185,28,28,.45); } 50% { box-shadow: 0 0 0 8px rgba(185,28,28,0); } }
.dictate-status:empty { display: none; }

/* ---------- Public quote page ---------- */
.pub { max-width: 820px; margin: 0 auto; padding: 0 0 120px; }
.pub-top { display: flex; justify-content: flex-end; padding: 12px 16px; }
.pub-head { background: var(--card); border-top: 6px solid var(--brand); padding: 22px 18px; display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.pub-head img { max-height: 64px; max-width: 180px; object-fit: contain; }
.pub-head .co { text-align: right; font-size: .9rem; color: var(--muted); white-space: pre-line; }
.pub-head .co b { color: var(--ink); font-size: 1.05rem; display: block; }
.pub-body { padding: 18px 16px; }
.pub-title { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.pub-title .kicker { font-size: .78rem; font-weight: 800; letter-spacing: .1em; color: var(--brand); text-transform: uppercase; }
.pub .scope { white-space: pre-line; font-size: 1.02rem; color: var(--ink-2); }
.pub-items .line { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.pub-items .line .d { font-weight: 600; }
.pub-items .line .q { font-size: .85rem; color: var(--muted); }
.pub-items .line .a { font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pub-total { background: var(--ink); color: #fff; border-radius: var(--r); padding: 18px; margin-top: 16px; }
.pub-total .tr { display: flex; justify-content: space-between; padding: 3px 0; color: #d6d3d1; font-variant-numeric: tabular-nums; }
.pub-total .grand { color: #fff; font-size: 1.6rem; font-weight: 850; border-top: 1px solid #57534e; margin-top: 8px; padding-top: 10px; }
.pub-total .dep { color: #fdba74; font-weight: 750; }
.terms { white-space: pre-line; font-size: .9rem; color: var(--muted); }
.sig-pad { position: relative; border: 2px dashed var(--line-2); border-radius: var(--r-sm); background: #fff; touch-action: none; height: 170px; }
.sig-pad canvas { width: 100%; height: 100%; display: block; cursor: crosshair; }
.sig-pad .ph { position: absolute; inset: auto 12px 10px; border-top: 1.5px solid var(--line-2); padding-top: 4px; font-size: .78rem; color: var(--muted); pointer-events: none; }
.sig-pad button { position: absolute; top: 6px; right: 6px; }
.approve-box { border: 2px solid var(--ink); }
.approved-stamp { display: flex; gap: 14px; align-items: center; background: var(--ok-soft); border: 2px solid var(--ok); color: #14532d; border-radius: var(--r); padding: 16px; font-weight: 700; }
.approved-stamp .big { font-size: 2rem; }
.pub-cta { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 16px calc(10px + var(--safe-b)); background: rgba(255,255,255,.96); backdrop-filter: blur(8px); border-top: 1px solid var(--line); display: flex; gap: 10px; z-index: 20; }
.pub-foot { text-align: center; font-size: .8rem; color: var(--muted); padding: 20px; }

/* ---------- Billing ---------- */
.plans { display: grid; gap: 14px; }
.plan { position: relative; }
.plan.current { border: 2px solid var(--ink); }
.plan.featured { border: 2px solid var(--brand); }
.plan .price { font-size: 2.2rem; font-weight: 850; letter-spacing: -0.03em; }
.plan .price small { font-size: 1rem; color: var(--muted); font-weight: 600; }
.plan ul { list-style: none; padding: 0; margin: 12px 0 18px; display: grid; gap: 8px; }
.plan li { display: flex; gap: 10px; align-items: flex-start; }
.plan li::before { content: "✓"; color: var(--ok); font-weight: 900; }
.plan .tag { position: absolute; top: -12px; right: 14px; background: var(--brand); color: #fff; font-size: .72rem; font-weight: 800; padding: 4px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: .05em; }

/* ---------- Settings ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; overflow-x: auto; }
.logo-prev { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.logo-prev .box { width: 150px; height: 70px; border: 1.5px dashed var(--line-2); border-radius: var(--r-sm); display: grid; place-items: center; background: #fff; overflow: hidden; }
.logo-prev img { max-width: 100%; max-height: 100%; object-fit: contain; }
.tpl { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px; }
.tpl pre { white-space: pre-wrap; font: .88rem/1.45 var(--font); margin: 6px 0 0; color: var(--muted); }
.locked { position: relative; }
.locked-note { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; background: var(--soft); border-radius: var(--r-sm); padding: 12px; font-weight: 650; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(100px + var(--safe-b)); z-index: 100; display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 14px 16px; border-radius: 12px; font-weight: 650; box-shadow: 0 10px 30px rgba(0,0,0,.25); animation: pop .2s ease-out; }
.toast.bad { background: var(--bad); }
.toast.ok { background: var(--ok); }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Larger screens ---------- */
@media (max-width: 899px) {
  .editor-layout { display: flex; flex-direction: column; gap: 14px; }
  .editor-layout > .stack { display: contents; }
  .editor-layout .card { margin-top: 0 !important; }
  .editor-layout .o-items { order: 3; } .editor-layout .o-pricing { order: 4; } .editor-layout .o-terms { order: 5; }
}
@media (min-width: 640px) {
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .item { grid-template-columns: 2.6fr 1.2fr .7fr 1fr 1fr auto; align-items: end; }
  .item .desc { grid-column: auto; }
  .item .cat { grid-column: auto; }
  .item .lt { grid-column: auto; text-align: right; padding-bottom: 12px; }
  .item .rm { grid-column: auto; padding-bottom: 6px; }
  .item .desc textarea { min-height: 52px; height: 52px; }
  .plans { grid-template-columns: repeat(3, 1fr); }
  .pub-body { padding: 26px 28px; }
  .pub-head { padding: 26px 28px; }
}
@media (min-width: 900px) {
  .topnav { display: flex; }
  .tabbar { display: none; }
  .has-tabbar main { padding-bottom: 40px; }
  .sticky-actions { bottom: 12px; }
  #toasts { bottom: 24px; }
  .pub-cta { display: none; }
  .editor-layout { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
  .editor-side { position: sticky; top: 84px; }
}
@media print {
  .topbar, .tabbar, .pub-cta, .pub-top, .approve-box, .no-print { display: none !important; }
  body { background: #fff; }
}

/* ---------- Photos ---------- */
.photo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.photo-grid:empty { display: none; }
.ph-item { margin: 0; position: relative; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.ph-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--soft); }
.ph-item input { border: 0; border-top: 1px solid var(--line); border-radius: 0; min-height: 44px; font-size: 14px; padding: 8px 10px; }
.ph-del { position: absolute; top: 6px; right: 6px; width: 36px; height: 36px; background: rgba(28,25,23,.72); color: #fff; }
.ph-del:hover { background: var(--bad); }
.kind-row { display: flex; gap: 4px; padding: 6px; }
.kind { flex: 1; min-height: 34px; border: 1.5px solid var(--line-2); border-radius: 8px; background: #fff; font: 700 12px var(--font); color: var(--ink-2); cursor: pointer; padding: 0 4px; }
.kind[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.photo-grid.readonly figcaption { padding: 8px 10px; font-size: .85rem; display: flex; flex-direction: column; gap: 2px; }
.kind-tag { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--brand); }
@media (min-width: 640px) { .photo-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 899px) { .editor-layout .o-photos { order: 4; } .editor-layout .o-pricing { order: 5; } .editor-layout .o-terms { order: 6; } }

/* ---------- Invoices ---------- */
.b-unpaid { background: var(--warn-soft); color: var(--warn); }
.b-partial { background: var(--info-soft); color: var(--info); }
.b-paid { background: var(--ok-soft); color: var(--ok); }
.b-void { background: var(--soft); color: var(--muted); text-decoration: line-through; }
.b-overdue { background: var(--bad-soft); color: var(--bad); }
.pay-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.pay-row:last-child { border-bottom: 0; }
.pay-row .amt { margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; }
.pay-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.pay-form .full { grid-column: 1 / -1; }
.pay-form label.field { margin: 0; }
.balance-box { background: var(--brand); color: #fff; border-radius: var(--r-sm); padding: 12px 14px; display: flex; justify-content: space-between; font-weight: 800; font-size: 1.15rem; margin-top: 8px; font-variant-numeric: tabular-nums; }
.balance-box.zero { background: var(--ok); }
.paid-stamp { display: inline-block; border: 3px solid var(--ok); color: var(--ok); font-weight: 900; font-size: 1.6rem; letter-spacing: .1em; padding: 4px 16px; border-radius: 8px; transform: rotate(-6deg); }
.invoice-cta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: var(--ok-soft); border: 1px solid #b7e2c4; border-radius: var(--r-sm); padding: 12px; margin-top: 12px; }
.tabbar { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 899px) { .inv-layout .o-pay { order: -1; } }
.kind-select { min-height: 38px; padding: 4px 30px 4px 10px; font: 800 12px var(--font); text-transform: uppercase; letter-spacing: .05em; border-radius: 8px; border-width: 1.5px; }
.kind-select.k-before { color: var(--warn); } .kind-select.k-progress { color: var(--info); } .kind-select.k-after { color: var(--ok); }

/* ---------- Public homepage ---------- */
.lp { background: var(--bg); }
.lp-nav { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--ink); color: #fff; }
.lp-nav::after { content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 4px; background: repeating-linear-gradient(-45deg, var(--brand-hi) 0 10px, var(--ink) 10px 20px); }
.lp-login { color: #fff; text-decoration: none; font-weight: 700; padding: 10px 6px; white-space: nowrap; }
.lp-hero { background: var(--ink); color: #fff; padding: 36px 16px 0; overflow: hidden; }
.lp-hero-in { max-width: 1080px; margin: 0 auto; display: grid; gap: 28px; }
.lp-kicker { display: inline-block; font-size: .75rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: #fdba74; border: 1.5px solid #7c2d12; border-radius: 999px; padding: 4px 12px; margin-bottom: 14px; }
.lp-hero h1 { font-size: clamp(2.1rem, 8.5vw, 3.6rem); line-height: 1.02; letter-spacing: -0.035em; font-weight: 850; margin: 0 0 14px; }
.lp-sub { font-size: 1.1rem; color: #d6d3d1; max-width: 34em; margin-bottom: 22px; }
.lp-note { color: #a8a29e; font-size: .9rem; margin-top: 12px; }
.lp-phones { position: relative; height: 380px; max-width: 420px; margin: 0 auto; width: 100%; }
.lp-phone { margin: 0; border-radius: 28px; overflow: hidden; border: 6px solid #0c0a09; box-shadow: 0 24px 60px rgba(0,0,0,.45); background: #fff; width: 230px; }
.lp-phone img { display: block; width: 100%; height: auto; }
.lp-phones .lp-phone { position: absolute; }
.lp-phones .back { left: 0; top: 30px; transform: rotate(-5deg); opacity: .92; }
.lp-phones .front { right: 0; top: 0; transform: rotate(3deg); }
.lp-sec { max-width: 1080px; margin: 0 auto; padding: 56px 16px; }
.lp-sec h2, .lp-final h2 { font-size: clamp(1.6rem, 6vw, 2.3rem); letter-spacing: -0.03em; font-weight: 850; margin-bottom: 18px; }
.lp-lead { color: var(--muted); font-size: 1.05rem; margin-top: -8px; }
.lp-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.lp-steps li { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); }
.lp-steps h3 { font-size: 1.15rem; margin: 10px 0 6px; }
.lp-steps p { color: var(--ink-2); margin: 0; }
.lp-num { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--brand); color: #fff; font-weight: 900; font-size: 1.15rem; }
.lp-band { max-width: none; background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.lp-split, .lp-split2 { max-width: 1080px; margin: 0 auto; display: grid; gap: 28px; align-items: start; }
.lp-split > .lp-phone, .lp-split2 > .lp-phone { margin: 0 auto; width: 250px; }
.lp-feats { display: grid; gap: 16px; }
.lp-feat { display: flex; gap: 14px; }
.lp-feat h3 { margin: 2px 0 4px; font-size: 1.02rem; }
.lp-feat p { margin: 0; color: var(--muted); font-size: .95rem; }
.lp-ico { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.lp-trades { text-align: center; }
.lp-trades p { font-size: 1.1rem; font-weight: 700; color: var(--ink-2); line-height: 1.8; }
.lp-faq details { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 0 16px; margin-bottom: 10px; }
.lp-faq summary { cursor: pointer; font-weight: 750; padding: 16px 0; min-height: var(--tap); list-style-position: outside; }
.lp-faq details p { color: var(--ink-2); margin: 0 0 16px; }
.lp-final { background: var(--brand); color: #fff; text-align: center; padding: 56px 16px; }
.lp-final p { font-size: 1.1rem; max-width: 34em; margin: 0 auto 22px; color: #ffedd5; }
.lp-cta-light { background: #fff !important; color: var(--brand) !important; }
.lp-foot { background: var(--ink); color: #d6d3d1; padding: 32px 16px calc(32px + var(--safe-b)); text-align: center; display: grid; gap: 14px; justify-items: center; }
.lp-foot .brand { color: #fff; }
.lp-foot nav { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.lp-foot a { color: #fdba74; }
.auth-legal { font-size: .82rem; color: var(--muted); text-align: center; margin-top: 12px; }
@media (min-width: 900px) {
  .lp-hero { padding-top: 64px; }
  .lp-hero-in { grid-template-columns: 1.1fr .9fr; align-items: center; }
  .lp-phones { height: 470px; }
  .lp-phone { width: 260px; }
  .lp-steps { grid-template-columns: repeat(3, 1fr); }
  .lp-split { grid-template-columns: 300px 1fr; gap: 56px; }
  .lp-split2 { grid-template-columns: 1fr 300px; gap: 56px; }
  .lp-split2 > .lp-phone { order: 2; }
  .lp-feats { grid-template-columns: 1fr 1fr; gap: 22px 28px; }
}
