:root {
  --ink: #0e1b2c;
  --ink-2: #3a4a5e;
  --muted: #6b7a8c;
  --line: #e3e8ee;
  --bg: #f6f8fa;
  --card: #ffffff;
  --brand: #0f766e;
  --brand-2: #0b5c56;
  --brand-soft: #e6f4f2;
  --accent: #f59e0b;
  --accent-soft: #fff4dc;
  --warn: #b45309;
  --warn-soft: #fff7e6;
  --ok: #15803d;
  --ok-soft: #e9f7ee;
  --danger: #b91c1c;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(14, 27, 44, .06), 0 4px 16px rgba(14, 27, 44, .06);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.55; font-size: 16px; }
a { color: var(--brand); }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.8rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
code, .mono { font-family: var(--mono); }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hidden { display: none !important; }

/* Header */
.site-header { background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 50; }
.site-header .wrap { display: flex; align-items: center; gap: 24px; height: 62px; }
.logo { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 800; font-size: 1.25rem; letter-spacing: -.02em; }
.logo-mark { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, var(--brand), #14b8a6); display: grid; place-items: center; font-size: .95rem; }
.logo b { color: var(--accent); font-weight: 800; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { color: #c9d4e0; text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 600; font-size: .93rem; }
.nav a:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.nav a[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, .12); }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid rgba(255, 255, 255, .25); color: #fff; border-radius: 8px; padding: 6px 10px; font: inherit; cursor: pointer; }
@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav { display: none; position: absolute; top: 62px; left: 0; right: 0; background: var(--ink); flex-direction: column; padding: 8px 16px 16px; border-top: 1px solid rgba(255, 255, 255, .1); }
  .nav.open { display: flex; }
  .nav a { padding: 12px; }
}

/* Buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border-radius: 10px; border: 1px solid transparent; background: var(--brand); color: #fff; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; font-size: .95rem; }
.btn:hover { background: var(--brand-2); }
.btn.secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { border-color: var(--brand); color: var(--brand); }
.btn.accent { background: var(--accent); color: var(--ink); }
.btn.accent:hover { background: #e08e06; }
.btn.small { padding: 7px 12px; font-size: .85rem; }
.btn.wa { background: #1fa855; }
.btn.wa:hover { background: #178a45; }
label { display: block; font-weight: 600; font-size: .85rem; color: var(--ink-2); margin-bottom: 5px; }
input, select, textarea { width: 100%; font: inherit; font-size: 1rem; color: var(--ink); background: #fff; border: 1px solid #cfd8e2; border-radius: 10px; padding: 10px 12px; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(15, 118, 110, .25); border-color: var(--brand); }
textarea { resize: vertical; min-height: 70px; }
.field { margin-bottom: 14px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 720px) { .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); } }
@media (min-width: 721px) and (max-width: 960px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.hint { font-size: .8rem; color: var(--muted); margin-top: 4px; }

/* Cards & layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.page-head { padding-top: 34px; padding-bottom: 20px; }
.page-head p { color: var(--ink-2); max-width: 720px; }
section { padding: 8px 0 40px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 22px; align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: minmax(0, 1fr); } }
.sticky { position: sticky; top: 80px; }
@media (max-width: 900px) { .sticky { position: static; } }

/* Hero */
.hero { background: radial-gradient(1200px 400px at 85% -10%, rgba(20, 184, 166, .28), transparent 60%), linear-gradient(180deg, var(--ink), #13263d); color: #fff; padding: 64px 0 72px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); max-width: 760px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { color: #c9d4e0; font-size: 1.12rem; max-width: 640px; }
.hero-search { display: flex; gap: 10px; max-width: 640px; margin-top: 26px; }
.hero-search input { padding: 14px 16px; border: 0; font-size: 1.05rem; }
@media (max-width: 560px) { .hero-search { flex-direction: column; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip { background: rgba(255, 255, 255, .1); color: #e6edf5; border: 1px solid rgba(255, 255, 255, .15); border-radius: 999px; padding: 5px 12px; font-size: .85rem; cursor: pointer; text-decoration: none; }
.chip:hover { background: rgba(255, 255, 255, .18); }
.stats { display: flex; flex-wrap: wrap; gap: 36px; margin-top: 40px; }
.stats b { display: block; font-size: 1.7rem; color: #fff; }
.stats span { color: #9fb0c3; font-size: .9rem; }

.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; margin-top: -36px; }
.tool { display: block; text-decoration: none; color: inherit; transition: transform .15s, box-shadow .15s; }
.tool:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(14, 27, 44, .12); }
.tool .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-size: 1.35rem; margin-bottom: 12px; }
.tool h3 { margin-bottom: 6px; }
.tool p { color: var(--muted); font-size: .92rem; margin: 0; }
.tool .soon { display: inline-block; font-size: .72rem; font-weight: 700; background: var(--accent-soft); color: var(--warn); border-radius: 999px; padding: 2px 8px; margin-left: 6px; vertical-align: middle; }
.steps { counter-reset: s; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.steps .card { position: relative; padding-top: 46px; }
.steps .card::before { counter-increment: s; content: counter(s); position: absolute; top: 16px; left: 22px; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--ink); font-weight: 800; font-size: .85rem; display: grid; place-items: center; }

/* Search results */
.searchbar { display: flex; gap: 10px; }
.searchbar input { font-size: 1.05rem; padding: 13px 14px; }
.results { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.result { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 14px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; text-align: left; font: inherit; color: inherit; width: 100%; }
.result:hover, .result.active { border-color: var(--brand); background: #fbfefd; }
.result .code { font-family: var(--mono); font-weight: 700; color: var(--brand); }
.result .desc { font-size: .93rem; }
.result .ctx { display: block; color: var(--muted); font-size: .8rem; margin-top: 2px; }
.result .tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 600px) { .result { grid-template-columns: minmax(0, 1fr); gap: 4px; } .result .tags { justify-content: flex-start; } }
.tag { font-size: .74rem; font-weight: 700; border-radius: 6px; padding: 2px 7px; background: #eef2f6; color: var(--ink-2); white-space: nowrap; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.brand { background: var(--brand-soft); color: var(--brand); }
mark { background: var(--accent-soft); color: inherit; border-radius: 3px; padding: 0 1px; }

/* Detail panel */
.detail h2 { font-family: var(--mono); color: var(--brand); margin-bottom: 4px; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 14px; }
.crumbs div { padding-left: calc(var(--d, 0) * 14px); }
.crumbs div::before { content: "› "; color: #a5b3c2; }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 16px 0; }
.kpi { border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.kpi span { display: block; font-size: .78rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi b { font-size: 1.35rem; }
.kpi.hi { background: var(--brand-soft); border-color: transparent; }
.notice { border-radius: 12px; padding: 12px 14px; font-size: .88rem; margin: 12px 0; }
.notice.warn { background: var(--warn-soft); color: #7a4207; border: 1px solid #fde3b0; }
.notice.ok { background: var(--ok-soft); color: #14532d; border: 1px solid #c4ead2; }
.notice.info { background: #eef6ff; color: #1e3a5f; border: 1px solid #d3e6fb; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

/* Breakdown table */
table { width: 100%; border-collapse: collapse; }
.breakdown td { padding: 9px 4px; border-bottom: 1px solid var(--line); font-size: .95rem; }
.breakdown td:last-child { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.breakdown tr.sub td { color: var(--muted); font-size: .85rem; padding-top: 3px; }
.breakdown tr.total td { font-weight: 800; font-size: 1.1rem; border-bottom: 0; border-top: 2px solid var(--ink); }
.breakdown tr.sep td { border-bottom: 0; padding: 4px; }
.big-number { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; }
.bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; margin: 10px 0 6px; background: #eef2f6; }
.bar i { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: .8rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* Suggest dropdown */
.suggest-wrap { position: relative; }
.suggest { position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); max-height: 320px; overflow: auto; z-index: 20; }
.suggest button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 12px; font: inherit; font-size: .9rem; cursor: pointer; border-bottom: 1px solid var(--line); color: var(--ink); }
.suggest button:hover, .suggest button.active { background: var(--brand-soft); }
.suggest .code { font-family: var(--mono); font-weight: 700; color: var(--brand); margin-right: 8px; }

/* Tabs */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.tabs button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 14px; font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; color: var(--ink-2); }
.tabs button[aria-selected="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Document items table (editor) */
.items { width: 100%; }
.items th { font-size: .78rem; text-align: left; color: var(--muted); font-weight: 700; padding: 0 4px 6px; text-transform: uppercase; letter-spacing: .03em; }
.items td { padding: 3px; vertical-align: top; }
.items input { padding: 8px; font-size: .9rem; }
.items .del { background: none; border: 0; color: var(--danger); cursor: pointer; font-size: 1.1rem; padding: 8px 4px; }
.items-scroll { overflow-x: auto; }
.items-scroll table { min-width: 720px; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 14px 14px 2px; margin: 0 0 16px; min-width: 0; }
legend { font-weight: 700; padding: 0 6px; font-size: .92rem; }

/* Printable document */
.doc-preview-wrap { background: #e9edf2; border-radius: var(--radius); padding: 18px; overflow-x: auto; }
.doc { width: 210mm; min-height: 297mm; margin: 0 auto; background: #fff; color: #111; padding: 14mm 13mm; font-size: 10.5pt; line-height: 1.4; box-shadow: 0 4px 24px rgba(0, 0, 0, .12); font-family: var(--font); }
.doc-scale { transform-origin: top left; }
.doc h1 { font-size: 20pt; letter-spacing: .02em; margin: 0; text-transform: uppercase; }
.doc .doc-top { display: flex; justify-content: space-between; gap: 20px; border-bottom: 3px solid var(--doc-c, #0f766e); padding-bottom: 10px; margin-bottom: 12px; }
.doc .co-name { font-size: 15pt; font-weight: 800; }
.doc .doc-meta { text-align: right; font-size: 9.5pt; }
.doc .doc-meta table td { padding: 1px 0 1px 10px; }
.doc .boxes { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid #bbb; margin-bottom: 10px; }
.doc .boxes > div { padding: 8px 10px; }
.doc .boxes > div + div { border-left: 1px solid #bbb; }
.doc .boxes.three { grid-template-columns: repeat(3, 1fr); }
.doc .lbl { font-size: 8pt; text-transform: uppercase; letter-spacing: .05em; color: #555; font-weight: 700; margin-bottom: 2px; }
.doc .ship { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid #bbb; border-bottom: 0; margin-bottom: 10px; }
.doc .ship > div { padding: 5px 8px; border-bottom: 1px solid #bbb; border-right: 1px solid #bbb; font-size: 9.5pt; min-height: 38px; }
.doc .ship > div:nth-child(4n) { border-right: 0; }
.doc table.lines { border: 1px solid #bbb; margin-bottom: 10px; }
.doc table.lines th { background: var(--doc-c, #0f766e); color: #fff; font-size: 8.5pt; text-transform: uppercase; padding: 6px; text-align: left; }
.doc table.lines td { padding: 6px; border-top: 1px solid #ddd; font-size: 9.5pt; vertical-align: top; }
.doc table.lines .r { text-align: right; white-space: nowrap; }
.doc table.lines tfoot td { font-weight: 700; background: #f4f6f8; }
.doc .words { font-size: 9.5pt; margin-bottom: 10px; }
.doc .foot { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; margin-top: 14px; font-size: 9.5pt; }
.doc .sign { text-align: right; padding-top: 10px; }
.doc .sign .line { margin-top: 48px; border-top: 1px solid #333; display: inline-block; min-width: 180px; padding-top: 4px; }
.doc .decl { font-size: 8.5pt; color: #333; margin-top: 10px; }
.doc pre { font-family: inherit; white-space: pre-wrap; margin: 0; }

/* Footer */
.site-footer { background: var(--ink); color: #9fb0c3; padding: 40px 0 26px; margin-top: 40px; font-size: .9rem; }
.site-footer .cols { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 26px; }
@media (max-width: 720px) { .site-footer .cols { grid-template-columns: 1fr; } }
.site-footer h4 { color: #fff; margin: 0 0 10px; font-size: .95rem; }
.site-footer a { color: #c9d4e0; text-decoration: none; display: block; padding: 3px 0; }
.site-footer a:hover { color: #fff; }
.site-footer .legal { border-top: 1px solid rgba(255, 255, 255, .1); margin-top: 26px; padding-top: 16px; font-size: .8rem; }
.site-footer .legal a { display: inline; text-decoration: underline; }

.loading { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px; font-size: .9rem; z-index: 100; box-shadow: var(--shadow); }

@media print {
  body { background: #fff; }
  .no-print, .site-header, .site-footer { display: none !important; }
  .doc-preview-wrap { padding: 0; background: none; overflow: visible; }
  .doc { box-shadow: none; margin: 0; padding: 0; width: auto; min-height: 0; }
  .doc-scale { transform: none !important; height: auto !important; }
  .print-only { display: block !important; }
  @page { size: A4; margin: 12mm; }
}
.print-only { display: none; }

/* Documents page: wider canvas so the A4 preview is readable beside the form */
.btn { white-space: nowrap; }
.docs-page .wrap { max-width: 1440px; }
.docs-page .two-col { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); }
@media (max-width: 1100px) { .docs-page .two-col { grid-template-columns: minmax(0, 1fr); } .docs-page .sticky { position: static; } }

/* ---------- Phase 2: buyers, accounts, pricing, admin ---------- */
.stats-row { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; margin-top: 8px; color: var(--ink-2); }
.credits-pill { background: var(--brand-soft); color: var(--brand-2); border-radius: 999px; padding: 4px 12px; font-size: .9rem; }
.filters .field { margin-bottom: 10px; }
.results-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin: 18px 0 10px; }
.buyer-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 14px; }
.buyer { display: flex; flex-direction: column; gap: 6px; padding: 18px; }
.buyer .b-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.buyer h3 { margin: 0; font-size: 1.05rem; }
.buyer .tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.buyer .b-why { margin: 4px 0 0; font-size: .93rem; }
.buyer .b-ev { margin: 0; color: var(--ink-2); background: #f6f8fa; border-radius: 8px; padding: 6px 9px; }
.buyer .b-contact { margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--line); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
dl.contact { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; margin: 0; font-size: .9rem; width: 100%; }
dl.contact dt { color: var(--muted); font-weight: 600; font-size: .8rem; padding-top: 2px; }
dl.contact dd { margin: 0; overflow-wrap: anywhere; }
.pager { display: flex; justify-content: center; gap: 10px; margin-top: 18px; }
.auth { max-width: 480px; }
.auth h1 { font-size: 1.7rem; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.plan { position: relative; display: flex; flex-direction: column; }
.plan .price { font-size: 2.1rem; font-weight: 800; letter-spacing: -.02em; }
.plan ul { padding-left: 18px; margin: 14px 0 18px; font-size: .92rem; color: var(--ink-2); flex: 1; }
.plan li { margin-bottom: 4px; }
.plan.popular { border: 2px solid var(--accent); }
.ribbon { position: absolute; top: -12px; right: 16px; background: var(--accent); color: var(--ink); font-weight: 800; font-size: .75rem; padding: 3px 10px; border-radius: 999px; }
.upi-box { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.qr { width: 150px; height: 150px; background: #fff; }
.qr svg { width: 100%; height: 100%; }
.or { text-align: center; margin: 18px 0; position: relative; color: var(--muted); font-size: .85rem; }
.or::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid var(--line); }
.or span { position: relative; background: #fff; padding: 0 10px; }
.table-scroll { overflow-x: auto; }
table.data { font-size: .9rem; }
table.data th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr.muted td { opacity: .6; }
.tabs a.tab { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 14px; font-weight: 600; font-size: .9rem; color: var(--ink-2); text-decoration: none; }
.tabs a.tab.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.acct-kpis { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.nav a.nav-acct { border: 1px solid rgba(255, 255, 255, .25); }

/* =====================================================================
   Mobile app layer: header CTA, full-screen menu, bottom tab bar,
   sticky result/action bars, stacked tables. Desktop is unchanged.
   ===================================================================== */
.nav-ico, .nav-more, .tabbar, .m-only { display: none; }
.nav-cta { margin-left: 8px; }
.nav-toggle svg { display: block; }

@media (max-width: 860px) {
  body { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  .m-only { display: block; }
  .d-only { display: none !important; }
  .site-header .wrap { height: 58px; gap: 10px; }
  .logo { font-size: 1.2rem; }
  .nav-cta { margin-left: auto; padding: 8px 14px; }
  .nav-toggle { margin-left: 0; border: 0; padding: 8px; border-radius: 10px; }
  .nav-toggle:active { background: rgba(255, 255, 255, .12); }

  /* Full-screen menu */
  .nav { display: none; position: fixed; top: 58px; left: 0; right: 0; bottom: 0; background: #fff; flex-direction: column; gap: 0; padding: 8px 0 calc(90px + env(safe-area-inset-bottom)); overflow-y: auto; border-top: 0; z-index: 60; }
  .nav.open { display: flex; }
  .nav a, .nav a.nav-more { display: flex; align-items: center; gap: 14px; color: var(--ink); font-size: 1.05rem; padding: 15px 20px; border-radius: 0; border-bottom: 1px solid var(--line); }
  .nav a:hover, .nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-2); }
  .nav a.nav-acct { border: 0; border-bottom: 1px solid var(--line); }
  .nav-ico { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); font-weight: 800; flex: none; }
  body.menu-open { overflow: hidden; }

  /* Bottom tab bar */
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -4px 18px rgba(14, 27, 44, .06); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 62px; color: var(--muted); text-decoration: none; font: inherit; font-size: .7rem; font-weight: 700; background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar a[aria-current="page"] { color: var(--brand); }
  .tabbar a[aria-current="page"] svg { stroke-width: 2.3; }

  /* Typography & spacing */
  .page-head { padding-top: 22px; padding-bottom: 12px; }
  .page-head h1 { font-size: 1.75rem; }
  .page-head p { font-size: .95rem; }
  section { padding-bottom: 24px; }
  .card { padding: 16px; border-radius: 16px; }
  .btn { min-height: 46px; }
  .btn.small { min-height: 38px; }
  .site-footer { margin-top: 20px; padding-top: 28px; }

  /* Home */
  .hero { padding: 34px 0 46px; text-align: center; }
  .hero h1 { font-size: 2.15rem; margin-left: auto; margin-right: auto; }
  .hero p { font-size: 1rem; margin-left: auto; margin-right: auto; }
  .hero-search { flex-direction: column; }
  .hero .chips { justify-content: center; }
  .hero-ctas { display: grid; gap: 12px; margin-top: 22px; }
  .hero-ctas .btn { min-height: 56px; font-size: 1.05rem; border-radius: 14px; }
  .hero-ticks { color: #9fb0c3; font-size: .85rem; margin-top: 14px; }
  .stats { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 26px; text-align: left; }
  .stats b { font-size: 1.35rem; }
  .tools { grid-template-columns: 1fr 1fr; gap: 12px; margin-top: -28px; }
  .tool { padding: 14px; }
  .tool .ico { width: 38px; height: 38px; font-size: 1.1rem; margin-bottom: 8px; }
  .tool h3 { font-size: .98rem; }
  .tool p { font-size: .8rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .tool .soon { display: block; width: max-content; margin: 4px 0 0; }
  .steps { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 12px; padding: 0 16px 6px; margin: 0 -16px; }
  .steps .card { flex: 0 0 78%; scroll-snap-align: start; }

  /* Sticky bars above the tab bar */
  .m-sticky { position: fixed; left: 0; right: 0; bottom: calc(62px + env(safe-area-inset-bottom)); z-index: 65; background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(14, 27, 44, .08); padding: 10px 16px; display: flex; align-items: center; gap: 10px; }
  .m-sticky.hidden { display: none; }
  .m-sticky .ms-main { flex: 1; min-width: 0; }
  .m-sticky .ms-label { font-size: .72rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
  .m-sticky .ms-value { font-size: 1.3rem; font-weight: 800; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .m-sticky .ms-sub { font-size: .75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .m-sticky .btn { min-height: 44px; padding: 10px 14px; }
  body.has-sticky { padding-bottom: calc(140px + env(safe-area-inset-bottom)); }

  /* Segmented control (documents edit / preview) */
  .seg { display: grid; grid-template-columns: 1fr 1fr; background: #e9edf2; border-radius: 12px; padding: 4px; margin-bottom: 14px; }
  .seg button { border: 0; background: none; padding: 11px; border-radius: 9px; font: inherit; font-weight: 700; color: var(--ink-2); }
  .seg button[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
  .pane-hidden { display: none !important; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px 14px; padding: 0 16px 4px; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button, .tabs a.tab { flex: none; }

  /* Tables that become cards: cells carry data-label */
  .stack-table, .stack-table tbody, .stack-table tr, .stack-table td { display: block; width: 100%; }
  .stack-table { min-width: 0 !important; }
  .stack-table thead { display: none; }
  .stack-table tr { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; margin-bottom: 10px; background: #fff; position: relative; }
  .stack-table td { padding: 4px 0 !important; border: 0 !important; }
  .stack-table td[data-label]::before { content: attr(data-label); display: block; font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 3px; }
  .stack-table td.cell-del { position: absolute; top: 2px; right: 4px; width: auto; }
  .stack-table td.cell-half { display: inline-block; width: calc(50% - 4px); vertical-align: top; }
  .stack-table td.cell-half.even { margin-left: 8px; }
  .items-scroll { overflow: visible; }

  /* HSN detail as a bottom sheet */
  .sheet-backdrop { position: fixed; inset: 0; background: rgba(14, 27, 44, .45); z-index: 80; }
  .detail.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow-y: auto; z-index: 81; border-radius: 20px 20px 0 0; padding: 0 16px calc(20px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 40px rgba(0, 0, 0, .2); }
  .sheet-grip { display: flex; align-items: center; position: sticky; top: 0; background: #fff; padding: 14px 0 6px; z-index: 1; }
  .sheet-grip::before { content: ""; width: 40px; height: 5px; border-radius: 3px; background: #d5dce4; position: absolute; left: 50%; top: 6px; transform: translateX(-50%); }
  .sheet-close { margin-left: auto; border: 0; background: #eef2f6; width: 36px; height: 36px; border-radius: 50%; font-size: 1.1rem; cursor: pointer; }
  .detail:not(.sheet) { display: none; }

  /* Buyers */
  .filters.collapsed .filters-more { display: none !important; }
  .filters .actions { display: grid; grid-template-columns: 1fr 1fr; }
  .filters .actions label, .filters .actions a { grid-column: 1 / -1; }
  [id] { scroll-margin-top: 72px; }
  .detail h2 { font-size: 1.5rem; }
  .kpis { gap: 8px; }
  .kpi b { font-size: 1.2rem; }
  .buyer-list { grid-template-columns: 1fr; }
  .buyer .b-head { flex-direction: column; gap: 6px; }
  .buyer .tags { justify-content: flex-start; }
  .buyer .b-contact { flex-direction: column; align-items: stretch; }
  .buyer .b-contact .btn { width: 100%; }
  .stats-row { gap: 6px 16px; font-size: .9rem; }

  .plans { grid-template-columns: 1fr; }
  /* Forms made of fieldsets: drop the outer card so each section is one clean card */
  .two-col > form.card { background: none; border: 0; box-shadow: none; padding: 0; }
  .two-col > form.card fieldset { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 14px 14px 4px; box-shadow: var(--shadow); }
  .two-col > form.card legend { background: var(--ink); color: #fff; border-radius: 999px; padding: 3px 12px; font-size: .8rem; }
  .doc-preview-wrap { padding: 8px; border-radius: 14px; }
}
@media (min-width: 861px) {
  .hero-ctas, .hero-ticks, .seg, .filters-toggle, .m-sticky { display: none !important; }
}

/* ---------- Phase 3: dropdown nav, FTA, markets, guides, marketplace, assistant ---------- */
.dd { position: relative; }
.dd-btn { background: none; border: 0; color: #c9d4e0; font: inherit; font-weight: 600; font-size: .93rem; padding: 8px 12px; border-radius: 8px; cursor: pointer; }
.dd-btn:hover, .dd.open .dd-btn { color: #fff; background: rgba(255, 255, 255, .08); }
.dd-menu { display: none; position: absolute; top: calc(100% + 6px); left: 0; min-width: 300px; background: #fff; border-radius: 14px; box-shadow: 0 16px 40px rgba(14, 27, 44, .22); padding: 8px; z-index: 60; }
.dd.open .dd-menu { display: block; }
.dd-menu a { display: flex !important; gap: 12px; align-items: center; color: var(--ink) !important; padding: 9px 10px !important; border-radius: 10px; font-size: .92rem; }
.dd-menu a:hover, .dd-menu a[aria-current="page"] { background: var(--brand-soft) !important; }
.dd-menu a small { display: block; color: var(--muted); font-weight: 500; font-size: .78rem; }
.dd-menu .nav-ico { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--brand-soft); color: var(--brand); font-weight: 800; flex: none; }
@media (max-width: 860px) {
  .dd { position: static; }
  .dd-btn { display: block; width: 100%; text-align: left; color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; padding: 16px 20px 6px; pointer-events: none; background: none !important; }
  .dd-btn span { display: none; }
  .dd-menu { display: block; position: static; box-shadow: none; padding: 0; min-width: 0; border-radius: 0; }
  .dd-menu a { border-radius: 0 !important; padding: 13px 20px !important; border-bottom: 1px solid var(--line); font-size: 1.02rem; }
  .dd-menu .nav-ico { width: 36px; height: 36px; }
}

/* FTA checker */
.fta-layout { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); }
@media (max-width: 900px) { .fta-layout { grid-template-columns: minmax(0, 1fr); } }
.fgroup { margin-bottom: 12px; }
.fgroup-h { font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 4px; }
.frow { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 10px; border-radius: 10px; color: var(--ink); text-decoration: none; border: 1px solid transparent; }
.frow:hover { background: #f6f8fa; }
.frow.on { background: var(--brand-soft); border-color: rgba(15, 118, 110, .25); }
.claim-steps { padding-left: 20px; font-size: .93rem; }
.claim-steps li { margin-bottom: 8px; }
#flist { max-height: 70vh; overflow-y: auto; }
@media (max-width: 860px) { #flist { max-height: none; } }

/* Markets */
.chip-l { background: #f1f5f8; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: .85rem; cursor: pointer; color: var(--ink); }
.chip-l:hover { border-color: var(--brand); color: var(--brand); }
table.mk th button { background: none; border: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; padding: 0; }
.sharebar { display: inline-block; vertical-align: middle; width: 60px; height: 6px; border-radius: 3px; background: #e6ebf0; margin-right: 6px; overflow: hidden; }
.sharebar i { display: block; height: 100%; background: var(--brand); }

/* Guides, videos, marketplace */
.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 14px; }
.guide-card { text-decoration: none; color: inherit; display: block; }
.guide-card:hover { border-color: var(--brand); }
.prose { max-width: 760px; }
.prose h2 { margin-top: 28px; }
.prose li { margin-bottom: 6px; }
.video { position: relative; padding-top: 56.25%; border-radius: 14px; overflow: hidden; background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.sup-head { display: flex; gap: 16px; align-items: center; }
.sup-logo { width: 72px; height: 72px; border-radius: 16px; object-fit: cover; background: var(--brand-soft); display: grid; place-items: center; font-size: 1.8rem; font-weight: 800; color: var(--brand); flex: none; }

/* Assistant */
.ai-box { display: flex; gap: 10px; }
.ai-box textarea { min-height: 54px; font-size: 1.02rem; }
.ai-modes { display: inline-flex; background: #e9edf2; border-radius: 10px; padding: 3px; margin-bottom: 10px; }
.ai-modes button { border: 0; background: none; padding: 8px 14px; border-radius: 8px; font: inherit; font-weight: 700; font-size: .88rem; color: var(--ink-2); cursor: pointer; }
.ai-modes button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.trace { list-style: none; padding: 0; margin: 0; }
.trace li { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; font-size: .92rem; }
.trace li .dot { width: 20px; height: 20px; border-radius: 50%; background: #e6ebf0; flex: none; display: grid; place-items: center; font-size: .7rem; margin-top: 1px; }
.trace li.done .dot { background: var(--ok); color: #fff; }
.trace li.run .dot { background: var(--accent); }
.report h3 { margin-top: 20px; }
.score { font-weight: 800; color: var(--brand); }
@media (max-width: 860px) { .ai-box { flex-direction: column; } }
.sg-h { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 12px 4px; background: #f7f9fb; border-bottom: 1px solid var(--line); }
.suggest .code.small { font-size: .78rem; }
