:root {
  --ink: #14212e;
  --ink-soft: #4a5a6a;
  --line: #dde3ea;
  --bg: #f4f6f8;
  --card: #ffffff;
  --brand: #12263a;
  --accent: #f5a623;
  --accent-ink: #3d2800;
  --ok: #1f8a4c;
  --warn: #b25e00;
  --warn-bg: #fff4e0;
  --danger: #c0392b;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 33, 46, 0.06), 0 4px 16px rgba(20, 33, 46, 0.06);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e8edf2; --ink-soft: #a7b4c1; --line: #2c3a48; --bg: #0f1820; --card: #17222d;
    --brand: #0b1622; --warn-bg: #3a2a10; --shadow: none;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); line-height: 1.5; }
a { color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; }
.hidden { display: none !important; }
.muted { color: var(--ink-soft); }
.small { font-size: 0.875rem; }

/* Layout */
.topbar { background: var(--brand); color: #fff; padding: 12px 16px; display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 10; }
.logo { font-weight: 800; letter-spacing: -0.02em; font-size: 1.2rem; text-decoration: none; color: #fff; }
.logo span { color: var(--accent); }
.topbar nav { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.topbar nav button, .topbar nav a { background: none; border: 0; color: #d6e0ea; padding: 8px 10px; border-radius: 8px; font: inherit; cursor: pointer; text-decoration: none; }
.topbar nav .active, .topbar nav button:hover { background: rgba(255,255,255,0.12); color: #fff; }
.wrap { max-width: 880px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.narrow { max-width: 420px; margin: 0 auto; }
.center-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row.spread { justify-content: space-between; }
.gap-y { margin: 12px 0; }
.grid2 { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } }

/* Forms */
label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 4px; }
input, textarea, select { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
textarea { min-height: 120px; resize: vertical; }
.field { margin-bottom: 12px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.check input { width: auto; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; text-decoration: none; min-height: 44px; }
.btn:hover { border-color: var(--ink-soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(0.96); }
.btn.dark { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger { color: var(--danger); }
.btn.big { padding: 14px 22px; font-size: 1.05rem; width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn.mic.listening { background: var(--danger); border-color: var(--danger); color: #fff; }

/* Status */
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; text-transform: capitalize; }
.pill.sent { background: #e6eef7; color: #24527a; }
.pill.accepted { background: #e3f5ea; color: var(--ok); }
.pill.invoiced { background: #f1e8fb; color: #6b3fa0; }
.banner { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.banner.info { background: #e6eef7; color: #24527a; }
.error { color: var(--danger); font-weight: 600; margin-top: 8px; }
.notice { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 12px 16px; margin-bottom: 12px; }
.notice ul { margin: 6px 0 0; padding-left: 20px; }

/* Quote list */
.quote-list { display: grid; gap: 10px; }
.quote-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); cursor: pointer; text-align: left; font: inherit; color: inherit; width: 100%; }
.quote-item:hover { border-color: var(--accent); }
.quote-item .amount { font-weight: 800; white-space: nowrap; }
.empty { text-align: center; padding: 32px 16px; }

/* Line items editor */
.items { width: 100%; border-collapse: collapse; }
.items th { text-align: left; font-size: 0.8rem; color: var(--ink-soft); font-weight: 600; padding: 4px; }
.items td { padding: 4px; vertical-align: top; }
.items tr.estimated td:first-child input { border-color: var(--accent); background: var(--warn-bg); }
.items .num { width: 90px; }
.items .unit { width: 90px; }
.items .vat { width: 84px; }
@media (max-width: 640px) {
  .items thead { display: none; }
  .items tr { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .items td { padding: 0; }
  .items td:first-child { grid-column: 1 / -1; }
  .items .num, .items .unit, .items .vat { width: 100%; }
}
.totals { margin-left: auto; max-width: 280px; }
.totals div { display: flex; justify-content: space-between; padding: 4px 0; }
.totals .grand { font-size: 1.25rem; font-weight: 800; border-top: 2px solid var(--ink); margin-top: 4px; padding-top: 8px; }
.share-box { display: flex; gap: 8px; }
.share-box input { font-family: ui-monospace, monospace; font-size: 0.85rem; }

/* Public document */
.doc { max-width: 800px; margin: 24px auto; background: var(--card); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.doc-head { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; border-bottom: 3px solid var(--accent); padding-bottom: 16px; margin-bottom: 20px; }
.doc-type { font-size: 2rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.doc table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.doc th { text-align: left; border-bottom: 2px solid var(--line); padding: 8px 4px; font-size: 0.85rem; color: var(--ink-soft); }
.doc td { border-bottom: 1px solid var(--line); padding: 10px 4px; }
.doc td.r, .doc th.r { text-align: right; }
.accept-box { margin-top: 24px; padding: 20px; border: 2px solid var(--accent); border-radius: var(--radius); }
.accepted-box { margin-top: 24px; padding: 16px 20px; border-radius: var(--radius); background: #e3f5ea; color: var(--ok); font-weight: 700; }
.pre { white-space: pre-wrap; }
@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  .doc { box-shadow: none; border: 0; margin: 0; padding: 0; }
}

/* Landing */
.hero { background: var(--brand); color: #fff; padding: 56px 16px 64px; }
.hero h1 { font-size: clamp(2rem, 6vw, 3.2rem); letter-spacing: -0.03em; max-width: 720px; }
.hero h1 em { color: var(--accent); font-style: normal; }
.hero p { font-size: 1.15rem; color: #c9d6e2; max-width: 600px; }
.steps { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step-num { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 800; margin-bottom: 8px; }
.price { font-size: 2.6rem; font-weight: 800; }
.price small { font-size: 1rem; color: var(--ink-soft); font-weight: 600; }
.ticks { list-style: none; padding: 0; }
.ticks li { padding: 6px 0 6px 28px; position: relative; }
.ticks li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 800; }
footer { text-align: center; padding: 32px 16px; color: var(--ink-soft); font-size: 0.875rem; }
