:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-muted: #f1f3f6;
  --text: #0f172a;
  --muted: #5b6475;
  --border: #e3e7ed;
  --primary: #1f5eff;
  --primary-pressed: #1749cc;
  --primary-soft: #eaf0ff;
  --on-primary: #ffffff;
  --success: #157f3d;
  --success-soft: #e6f4ec;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e131a;
    --surface: #161d27;
    --surface-muted: #1d2632;
    --text: #e8edf4;
    --muted: #9aa6b6;
    --border: #2a3441;
    --primary: #5b8cff;
    --primary-pressed: #7aa2ff;
    --primary-soft: #1b2a4a;
    --on-primary: #0b1020;
    --success: #4cc27a;
    --success-soft: #16301f;
    --danger: #f07a70;
    --danger-soft: #3a1c1a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.wrap { max-width: 960px; margin: 0 auto; padding: 24px 16px calc(var(--actions-h, 0px) + 32px); }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }
p { margin: 0; }
a { color: var(--primary); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

/* Loading and messages */
.loading { display: flex; align-items: center; gap: 12px; justify-content: center; padding: 80px 0; color: var(--muted); }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--primary); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.message { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px 24px; text-align: center; display: grid; gap: 12px; justify-items: center; margin-top: 40px; }
.message h1 { font-size: 22px; }
.message .icon { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; font-weight: 700; }
.icon.ok { background: var(--success-soft); color: var(--success); }
.icon.info { background: var(--surface-muted); color: var(--muted); }

/* Business header */
.biz { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; align-items: baseline; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.biz-name { font-size: 18px; font-weight: 700; }
.biz-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; color: var(--muted); }

/* Quote title */
.title { display: grid; gap: 6px; padding: 24px 0 8px; }
.title h1 { font-size: 28px; letter-spacing: -0.02em; }
.title .meta { color: var(--muted); font-size: 15px; }
.notes { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-top: 12px; white-space: pre-wrap; }
.status-banner { margin-top: 12px; padding: 12px 16px; border-radius: var(--radius); font-weight: 600; }
.status-banner.ok { background: var(--success-soft); color: var(--success); }
.status-banner.info { background: var(--surface-muted); color: var(--muted); }

/* Options */
.options-head { display: flex; justify-content: space-between; align-items: baseline; margin: 24px 0 12px; gap: 12px; }
.options-head h2 { font-size: 18px; }
.options { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) { .options { grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); align-items: start; } }
.option {
  position: relative; text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius);
  padding: 20px; display: grid; gap: 12px; box-shadow: var(--shadow);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.option:hover { border-color: var(--muted); }
.option[aria-checked="true"] { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft), var(--shadow); }
.option[disabled] { cursor: default; }
.option.chosen { border-color: var(--success); box-shadow: 0 0 0 4px var(--success-soft), var(--shadow); }
.option-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.option-label { font-size: 17px; font-weight: 700; }
.badge { font-size: 12px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); white-space: nowrap; }
.badge.ok { background: var(--success-soft); color: var(--success); }
.price { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; }
.price-sub { font-size: 13px; color: var(--muted); margin-top: -8px; }
.items { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; border-top: 1px solid var(--border); padding-top: 12px; }
.items li { display: grid; grid-template-columns: 18px 1fr; gap: 8px; font-size: 15px; }
.items li::before { content: "✓"; color: var(--success); font-weight: 700; }
.items .desc { display: block; color: var(--muted); font-size: 13px; }
.select-hint { font-size: 14px; font-weight: 600; color: var(--primary); }
.option[aria-checked="true"] .select-hint::before { content: "● "; }

/* Action bar */
.actions {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
}
.actions-in { max-width: 960px; margin: 0 auto; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.actions .summary { font-size: 14px; color: var(--muted); }
.actions .summary strong { color: var(--text); font-size: 16px; }
.actions .buttons { display: flex; gap: 8px; align-items: center; flex: 1 1 280px; justify-content: flex-end; }
@media (max-width: 520px) { .actions .buttons { flex-direction: column-reverse; align-items: stretch; } .actions .summary { width: 100%; } }

.btn { font: inherit; font-weight: 600; min-height: 48px; padding: 0 20px; border-radius: 10px; border: 1px solid transparent; cursor: pointer; }
.btn.primary { background: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-pressed); }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.link { background: none; color: var(--muted); text-decoration: underline; min-height: 44px; padding: 0 8px; }
.btn.danger { background: var(--danger); color: #fff; }
.btn:disabled { opacity: 0.55; cursor: wait; }

/* Dialogs */
dialog { border: none; padding: 0; border-radius: 16px; max-width: min(480px, calc(100vw - 32px)); width: 100%; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(15, 23, 42, 0.45); }
.sheet { padding: 24px; display: grid; gap: 14px; }
.sheet h2 { font-size: 20px; }
.sheet-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.field { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
.field textarea { font: inherit; color: var(--text); background: var(--surface-muted); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; resize: vertical; }
.error { color: var(--danger); font-size: 14px; }

footer { margin-top: 32px; text-align: center; font-size: 13px; color: var(--muted); }

/* Privacy notes in the dialogs, and the privacy notice page */
.fine { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.fine a, footer a { color: var(--primary); }
.prose { max-width: 680px; line-height: 1.55; }
.prose h1 { font-size: 26px; margin: 24px 0 4px; }
.prose h2 { font-size: 18px; margin: 28px 0 8px; }
.prose ul { padding-left: 20px; }
.prose li { margin-bottom: 8px; }
