:root {
  --bg: #f2f4f6;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --text: #1c2228;
  --muted: #65707b;
  --line: #dde2e7;
  --accent: #1f5f8b;
  --accent-ink: #ffffff;
  --accent-soft: #e3eef6;
  --danger: #b4322b;
  --warn-bg: #fff4d6;
  --warn-ink: #6b4d00;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 30, 40, .06), 0 2px 8px rgba(20, 30, 40, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161a; --surface: #1b2127; --surface-2: #222a31; --text: #e6eaee; --muted: #9aa5af;
    --line: #2f3841; --accent: #5aa7dc; --accent-ink: #0d1a24; --accent-soft: #1d3446;
    --danger: #ff8a80; --warn-bg: #3a3012; --warn-ink: #ffd877;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12161a; --surface: #1b2127; --surface-2: #222a31; --text: #e6eaee; --muted: #9aa5af;
  --line: #2f3841; --accent: #5aa7dc; --accent-ink: #0d1a24; --accent-soft: #1d3446;
  --danger: #ff8a80; --warn-bg: #3a3012; --warn-ink: #ffd877; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 17px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; gap: 6px; }
.brand-mark { width: 28px; height: 28px; border-radius: 7px; background: url(icon.svg) center/cover; flex: none; }

.wrap { max-width: 920px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }

/* controls */
.btn, .icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
  -webkit-tap-highlight-color: transparent; white-space: nowrap;
}
.btn:hover, .icon-btn:hover { border-color: var(--accent); }
.btn:focus-visible, .icon-btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .op:focus-visible, .tpl-pick:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; }
.btn.sm, .icon-btn.sm { min-height: 38px; padding: 0 10px; font-size: 14px; }
.btn.block { width: 100%; }
.btn.danger, .icon-btn.danger { color: var(--danger); }
.btn.armed, .icon-btn.armed { background: var(--danger); border-color: var(--danger); color: #fff; }
.icon-btn { width: 42px; padding: 0; font-size: 22px; }
.icon-btn.sm { width: 38px; font-size: 18px; }
.icon-btn.ghost { background: transparent; border-color: transparent; }
.icon-btn.ghost:hover { border-color: var(--line); }
@media (pointer: coarse) {
  .btn, .icon-btn { min-height: 46px; }
  .icon-btn { width: 46px; }
  .btn.sm, .icon-btn.sm { min-height: 44px; }
  .icon-btn.sm { width: 44px; }
}
button:disabled { opacity: .35; cursor: default; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-row.end { justify-content: flex-end; }
.btn-row .lbl { font-size: 13px; color: var(--muted); margin-left: 4px; }

label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 500; min-width: 0; }
label.inline { flex-direction: row; align-items: center; gap: 6px; font-size: 15px; color: var(--text); }
input, select, textarea {
  font: inherit; font-size: 16px; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; width: 100%; min-width: 0;
}
textarea { resize: vertical; }
input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--accent); flex: none; padding: 0; }
input[type="color"] { padding: 2px; height: 40px; }
input.n { text-align: right; max-width: 110px; }

.grid2, .grid3, .grid4 { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.grid3 { grid-template-columns: 1fr; }
.grid4 { grid-template-columns: repeat(3, 1fr); }
.span2 { grid-column: 1 / -1; }
@media (min-width: 640px) {
  .grid3 { grid-template-columns: repeat(3, 1fr); }
  .grid4 { grid-template-columns: 2fr 1fr 1fr 1fr; }
  .grid4 .span2 { grid-column: auto; }
}

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.card-title { font-size: 16px; margin-bottom: 6px; }
.section-title { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 8px 2px -4px; }
h3.sub { font-size: 14px; margin: 16px 0 6px; }
.cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.empty { text-align: center; color: var(--muted); padding: 24px 8px; margin: 0; }
.note { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); font-size: 14px; }
.warn { margin: 8px 0 0; padding: 8px 12px; border-radius: 8px; background: var(--warn-bg); color: var(--warn-ink); font-size: 14px; }

.proj { display: flex; align-items: center; gap: 12px; }
.thumbs { display: flex; gap: 4px; flex: none; }
.thumbs svg { width: 34px; height: 44px; }
.thumb-empty { width: 34px; height: 44px; border: 1.5px dashed var(--line); border-radius: 4px; }
.proj-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.proj-info span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.proj-price, .win-price { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }

.win-card { padding: 10px 12px; }
.win-link { display: flex; align-items: center; gap: 12px; }
.win-info > span:nth-child(2) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win-thumb { width: 64px; height: 64px; flex: none; display: flex; align-items: center; justify-content: center; }
.win-thumb svg { width: 100%; height: 100%; }
.win-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.win-info .small { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.win-actions { display: flex; gap: 6px; justify-content: flex-end; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }

.item-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.item-row input.n { max-width: 90px; }
@media (max-width: 560px) {
  .item-row { display: grid; grid-template-columns: 1fr 1fr 44px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
  .item-row .grow { grid-column: 1 / -1; }
  .item-row input.n { max-width: none; }
}

.totals .trow, .trow { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 0; font-variant-numeric: tabular-nums; }
.trow.big { font-weight: 700; font-size: 17px; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px; }
.trow.struck span { text-decoration: line-through; color: var(--muted); }
.plines .trow { font-size: 14px; }
.totals .n { max-width: 70px; padding: 6px 8px; }

/* editor */
.drawing-wrap { margin: 8px 0; }
.drawing { display: flex; justify-content: center; align-items: center; background: var(--surface-2); border-radius: 10px; padding: 12px; touch-action: manipulation; }
.drawing svg { width: 100%; height: auto; max-height: min(46vh, 480px); }
.win-svg { display: block; }
.win-svg text { user-select: none; }
.hit { fill: transparent; stroke: transparent; cursor: pointer; }
.hit:hover { fill: rgba(31, 95, 139, .08); }
.hit.sel { fill: rgba(31, 95, 139, .16); stroke: #1f8fe0; stroke-width: 3.5; }

.ft { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; display: flex; flex-direction: column; gap: 12px; }
.opening-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.op {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 4px; padding: 8px 2px 6px; cursor: pointer; min-height: 88px;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; font-size: 11.5px; line-height: 1.2; text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.op svg { width: 30px; height: 42px; flex: none; }
.op:active { background: var(--accent-soft); }
.op.active { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.extras { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.extra-row { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); }
.extra-row:last-child { border-bottom: 0; }
.extra { flex: 1; flex-direction: row; align-items: center; gap: 12px; color: var(--text); font-size: 15px; min-height: 52px; padding: 4px 0; cursor: pointer; }
.qty-pill { min-width: 56px; min-height: 40px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--accent); background: var(--accent-soft); color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
.wrap-row { row-gap: 8px; }

/* layout presets */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.tpl { position: relative; }
.tpl-pick { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--text); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; text-align: center; }
.tpl-pick:hover { border-color: var(--accent); }
.tpl-svg { height: 84px; width: 100%; }
.tpl-svg svg { width: 100%; height: 100%; }
.tpl-del { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1; padding: 0; }
.tpl-del.armed { background: var(--danger); color: #fff; border-color: var(--danger); width: auto; padding: 0 8px; border-radius: 13px; }

/* prices tables */
.ctable { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.chead, .crow { display: grid; grid-template-columns: var(--cols); gap: 6px; align-items: center; }
.chead span { font-size: 12px; color: var(--muted); font-weight: 600; }
.crow input.n { max-width: none; }
.crow input[type="checkbox"] { justify-self: center; }
@media (max-width: 560px) {
  .chead { display: none; }
  .crow { grid-template-columns: 1fr 1fr 36px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
  .crow > :first-child { grid-column: 1 / -1; }
}
.logo-box { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.logo-box img { max-height: 48px; max-width: 140px; background: #fff; border-radius: 6px; padding: 4px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: #1c2228; color: #fff; padding: 10px 16px; border-radius: 10px; opacity: 0; transition: .2s; pointer-events: none; z-index: 99; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
body.has-wizbar .toast { bottom: calc(96px + env(safe-area-inset-bottom)); }


/* ---------- progressive flow ---------- */
.mt { margin-top: 12px; }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 99px; background: var(--warn-bg); color: var(--warn-ink); vertical-align: middle; }
.fold > summary { list-style: none; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary .fold-title { font-weight: 700; font-size: 16px; display: flex; justify-content: space-between; }
.fold > summary .fold-title::after { content: '▾'; color: var(--muted); transition: transform .15s; }
.fold:not([open]) > summary .fold-title::after { transform: rotate(-90deg); }
.fold[open] > summary { margin-bottom: 12px; }
.room-card { display: flex; align-items: center; gap: 12px; }
.room-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.room-card strong { font-size: 16px; }
.chev { font-size: 24px; color: var(--muted); line-height: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 16px; }
.chip { min-height: 42px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.chip:hover { border-color: var(--accent); }
.chip.used { color: var(--muted); font-weight: 500; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; }
.btn-row.split { margin-top: 6px; }
.btn-row.nowrap { flex-wrap: nowrap; }
@media (max-width: 520px) { .btn-row.split .grow { display: none; } .btn-row.split > .btn { flex: 1; } }

.stepper { position: sticky; top: 63px; z-index: 9; background: var(--surface); border-bottom: 1px solid var(--line); padding: 8px 16px 10px; }
.stepper .step-count { max-width: 920px; margin: 0 auto 6px; font-size: 13px; color: var(--muted); }
.stepper .step-count strong { color: var(--text); }
.stepper ol { list-style: none; margin: 0 auto; padding: 0; display: flex; gap: 4px; max-width: 920px; }
.stepper li { flex: 1; min-width: 0; }
.stepper button { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 3px; background: none; border: 0; padding: 0; font: inherit; color: var(--muted); cursor: pointer; }
.stepper button:disabled { cursor: default; opacity: 1; }
.stepper .dot { width: 100%; height: 6px; border-radius: 3px; background: var(--line); font-size: 0; }
.stepper .done .dot { background: var(--accent); opacity: .45; }
.stepper .cur .dot { background: var(--accent); }
.stepper .lbl { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.stepper .cur .lbl { color: var(--text); font-weight: 700; }
.stepper .done:not(:disabled):hover .lbl { color: var(--accent); }
@media (max-width: 420px) { .stepper .lbl { display: none; } .stepper .cur .lbl { display: block; } }

body.has-wizbar .wrap { padding-bottom: 150px; }
.wizbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line); padding: 10px 16px; padding-bottom: max(10px, env(safe-area-inset-bottom)); box-shadow: 0 -2px 10px rgba(0,0,0,.06); }
.wizbar-in { max-width: 920px; margin: 0 auto; display: flex; gap: 8px; }
.wizbar-in.col { flex-direction: column; }
.wizbar .btn { min-height: 48px; font-size: 16px; }
.wizbar .btn.grow { flex: 1; }

.big-inputs input { font-size: 22px; font-weight: 600; padding: 12px; text-align: center; }
.grid3.always3 { grid-template-columns: 1.3fr 1.3fr 1fr; }
.drawing.small svg { max-height: min(32vh, 300px); }
.drawing-empty { padding: 40px 12px; color: var(--muted); text-align: center; font-size: 14px; }

.tpl-pick.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }

.field-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fields-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 2px; }
.fields-list.pick { list-style: none; padding: 0; }
.fields-list.pick { margin-top: 10px; gap: 6px; }
.fields-list.pick button { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; min-height: 52px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; font-size: 14px; cursor: pointer; }
.fields-list.pick .grow { display: flex; flex-direction: column; }
.fields-list.pick .small { margin-left: 0; }
.fields-list .fl-icon svg { width: 22px; height: 30px; display: block; }
.fields-list.pick button.on { border-color: var(--accent); background: var(--accent-soft); }
.fields-list .num { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex: none; background: var(--surface); }
.fields-list:not(.pick) .small { margin-left: auto; }

.rv { border-top: 1px solid var(--line); padding: 10px 0 4px; }
.rv-head { display: flex; justify-content: space-between; align-items: center; }
.rv h3 { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.rv p { margin: 4px 0; }
.m-room { font-size: 13pt; margin: 6mm 0 0; padding-bottom: 1mm; border-bottom: 1.5px solid #222; break-after: avoid; page-break-after: avoid; }

/* ---------- document (quote / measurement list) ---------- */
.doc-bar { position: sticky; top: 0; z-index: 10; display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.seg { display: flex; gap: 4px; }
.doc-scroll { padding: 16px; overflow-x: auto; }
.doc {
  background: #fff; color: #1a1a1a; max-width: 210mm; margin: 0 auto; padding: 14mm 13mm;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .15); font-size: 10pt; line-height: 1.4; color-scheme: light;
}
@media (max-width: 640px) { .doc { padding: 16px 14px; font-size: 9pt; } .doc-scroll { padding: 8px; } }
.doc-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 8mm; }
.doc-company { display: flex; gap: 10px; align-items: flex-start; font-size: 9pt; }
.doc-logo { max-height: 18mm; max-width: 45mm; }
.doc-meta h1 { font-size: 18pt; margin-bottom: 4px; text-align: right; }
.doc-meta table { border-collapse: collapse; margin-left: auto; font-size: 9pt; }
.doc-meta td { padding: 1px 0 1px 10px; }
.doc-meta td:first-child { color: #555; }
.doc-customer { margin-bottom: 6mm; min-height: 14mm; }
.doc-subject { font-size: 12pt; margin-bottom: 3mm; }
.doc-text { margin: 0 0 5mm; }
.doc-table { width: 100%; border-collapse: collapse; margin-bottom: 4mm; }
.doc-table th { text-align: left; font-size: 8.5pt; color: #444; border-bottom: 1.5px solid #222; padding: 4px; }
.doc-table td { border-bottom: 1px solid #ccc; padding: 6px 4px; vertical-align: top; }
.doc-table tr { break-inside: avoid; page-break-inside: avoid; }
.doc-table .c { text-align: center; width: 8mm; }
.doc-table .r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.doc-table .sk { width: 40mm; }
.doc-table .sk svg { width: 40mm; height: auto; max-height: 48mm; }
.doc .d { font-size: 8.5pt; color: #444; margin-top: 2px; }
.doc .i { font-style: italic; }
.doc-totals { margin-left: auto; border-collapse: collapse; min-width: 75mm; margin-bottom: 6mm; font-variant-numeric: tabular-nums; }
.doc-totals td { padding: 2px 4px; }
.doc-totals td:last-child { text-align: right; }
.doc-totals tr.g td { font-weight: 700; font-size: 11pt; border-top: 1.5px solid #222; padding-top: 4px; }
.doc-sign { display: flex; justify-content: flex-end; margin: 12mm 0 6mm; break-inside: avoid; }
.doc-sign div { width: 75mm; border-top: 1px solid #333; padding-top: 3px; font-size: 8.5pt; color: #444; }
.doc-foot { border-top: 1px solid #ccc; padding-top: 3mm; font-size: 7.5pt; color: #666; text-align: center; }
.m-block { display: flex; gap: 6mm; padding: 5mm 0; border-bottom: 1px solid #ccc; break-inside: avoid; page-break-inside: avoid; }
.m-draw { width: 72mm; flex: none; }
.m-draw svg { width: 100%; height: 72mm; }
.m-info { flex: 1; min-width: 0; }
.m-info h3 { font-size: 12pt; margin-bottom: 2mm; }
.m-info table { border-collapse: collapse; font-size: 9pt; margin-bottom: 2mm; }
.m-info td { padding: 1px 8px 1px 0; vertical-align: top; }
.m-info td:first-child { color: #555; }
.m-fields { margin: 0; padding-left: 18px; font-size: 9pt; }
@media (max-width: 640px) { .m-block { flex-direction: column; } .m-draw { width: 100%; max-width: 320px; } }

@page { size: A4; margin: 12mm 12mm 14mm; }
@media print {
  :root { color-scheme: light; }
  body { background: #fff; font-size: 10pt; }
  .no-print { display: none !important; }
  .doc-scroll { padding: 0; overflow: visible; }
  .doc { box-shadow: none; padding: 0; max-width: none; font-size: 10pt; }
  .m-block { flex-direction: row; }
  .m-draw { width: 72mm; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}


/* ---------- mobile: option rows, sheets, field popover ---------- */
.opt-list { display: flex; flex-direction: column; }
.opt-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 54px; padding: 8px 2px; background: none; border: 0; border-bottom: 1px solid var(--line); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.opt-list .opt-row:last-child { border-bottom: 0; }
.opt-label { color: var(--muted); font-size: 14px; flex: none; }
.opt-val { flex: 1; min-width: 0; text-align: right; font-weight: 600; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.opt-val .clip, .opt-val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opt-row:hover .chev { color: var(--accent); }
.swatch { width: 18px; height: 18px; border-radius: 5px; border: 1px solid var(--line); flex: none; display: inline-block; }
.swatch.lg { width: 28px; height: 28px; border-radius: 7px; }

.more-fold { margin-top: 12px; }
.more-fold > summary { list-style: none; cursor: pointer; display: flex; flex-direction: column; gap: 2px; min-height: 44px; justify-content: center; }
.more-fold > summary::-webkit-details-marker { display: none; }
.more-fold > summary > span:first-child { color: var(--accent); font-weight: 600; }
.more-fold[open] > summary > span:first-child { color: var(--muted); }
.more-fold > summary .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.more-fold[open] > summary { margin-bottom: 10px; }
.win-card { display: flex; align-items: center; gap: 4px; }
.win-card .win-link { flex: 1; min-width: 0; }

.tap-hint { margin: 2px 0 0; font-size: 14px; color: var(--accent); font-weight: 600; }
.drawing.tappable { cursor: pointer; box-shadow: inset 0 0 0 1.5px var(--accent-soft); }
.drawing.tappable .hit { fill: rgba(31, 95, 139, .03); stroke: rgba(31, 143, 224, .35); stroke-width: 1.5; stroke-dasharray: 6 5; }
.drawing.tappable .hit.sel { fill: rgba(31, 95, 139, .16); stroke: #1f8fe0; stroke-width: 3.5; stroke-dasharray: none; }

@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes sheetUp { from { transform: translateY(100%); } }
@keyframes sheetDown { to { transform: translateY(100%); } }
@keyframes popIn { from { opacity: 0; transform: scale(.92); } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(31, 143, 224, 0); } 50% { box-shadow: 0 0 0 6px rgba(31, 143, 224, .35); } }
.pulse { animation: pulse .7s ease-in-out 2; }
body.sheet-open { overflow: hidden; }

.sheet-bg, .pop-bg { position: fixed; inset: 0; z-index: 50; animation: fadeIn .18s ease-out; }
.sheet-bg { background: rgba(10, 15, 20, .45); display: flex; align-items: flex-end; justify-content: center; }
.pop-bg { background: rgba(10, 15, 20, .22); }
.sheet-bg.closing, .pop-bg.closing { animation: fadeOut .18s ease-in forwards; pointer-events: none; }
.sheet { width: 100%; max-width: 620px; max-height: 88vh; max-height: 88dvh; display: flex; flex-direction: column; background: var(--surface); color: var(--text); border-radius: 18px 18px 0 0; box-shadow: 0 -6px 30px rgba(0, 0, 0, .2); outline: none; animation: sheetUp .24s cubic-bezier(.2, .8, .2, 1); }
.sheet-bg.closing .sheet { animation: sheetDown .18s ease-in forwards; }
.sheet-bg.still, .sheet-bg.still .sheet, .pop-bg.still, .pop-bg.still .pop { animation: none; }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 8px auto 0; flex: none; }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 6px 8px 6px 16px; flex: none; }
.sheet-head h2 { font-size: 18px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sheet-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sheet-body { overflow: auto; padding: 4px 16px 16px; overscroll-behavior: contain; flex: 1 1 auto; display: flex; flex-direction: column; gap: 10px; }
.sheet-body:last-child { padding-bottom: max(18px, env(safe-area-inset-bottom)); }
.sheet-foot { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 16px; padding-bottom: max(10px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); flex: none; }
.sheet-foot .btn { min-height: 48px; }
.sheet-foot .btn.grow { flex: 1; }
.sheet-draw { width: 64px; height: 64px; flex: none; background: var(--surface-2); border-radius: 10px; padding: 4px; }
.sheet-draw svg { width: 100%; height: 100%; }
.x { font-size: 26px; color: var(--muted); flex: none; }
@media (min-width: 700px) { .sheet-bg { align-items: center; } .sheet { border-radius: 18px; } .grab { display: none; } }

.pick-list { display: flex; flex-direction: column; gap: 6px; }
.pick-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; font-size: 15px; text-align: left; cursor: pointer; }
.pick-row .grow { display: flex; flex-direction: column; }
.pick-row.on { border-color: var(--accent); background: var(--accent-soft); }
.pick-row .check { color: var(--accent); font-weight: 700; font-size: 18px; width: 18px; }
.pick-row.menu { font-weight: 600; }
.pick-row.danger { color: var(--danger); }
.pick-row.armed { background: var(--danger); border-color: var(--danger); color: #fff; }
.pick-row:disabled { opacity: .4; }
.num-edit { display: flex; gap: 10px; align-items: center; }
.num-edit input { font-size: 24px; font-weight: 700; text-align: center; padding: 10px; }
.num-edit .icon-btn { width: 56px; min-height: 56px; font-size: 26px; flex: none; }
.sheet textarea { min-height: 120px; }

.pop { position: fixed; left: 8px; top: 8px; width: min(320px, calc(100vw - 16px)); max-height: calc(100vh - 16px); overflow: auto; background: var(--surface); color: var(--text); border-radius: 18px; box-shadow: 0 10px 40px rgba(0, 0, 0, .3), 0 0 0 1px var(--line); outline: none; animation: popIn .16s ease-out; padding: 6px 8px 10px; }
.pop.moving { transition: left .22s ease, top .22s ease; }
.pop-head { display: flex; align-items: center; gap: 4px; padding: 0 0 6px 6px; }
.pop-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; text-align: center; }
.pop-title .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pop .x { width: 44px; min-height: 44px; }
.act-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px 2px; }
.act { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px 0; background: none; border: 0; color: var(--text); font: inherit; font-size: 11.5px; line-height: 1.15; text-align: center; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.act svg { width: 52px; height: 52px; padding: 6px; border-radius: 50%; background: var(--surface-2); border: 1.5px solid var(--line); color: var(--text); flex: none; }
.act:hover svg, .act:active svg { border-color: var(--accent); background: var(--accent-soft); }
.act.danger { color: var(--danger); }
.act.danger svg { color: var(--danger); }
.btn.btn-ml { white-space: normal; text-align: center; padding-top: 6px; padding-bottom: 6px; }
.sub-row { display: flex; align-items: center; justify-content: space-between; margin: 10px 0 6px; }
.sub-row h3.sub { margin: 0; }
.tpl-del { width: 32px; height: 32px; }

/* layout presets: one compact horizontal strip, so the drawing stays on the first screen */
.preset-strip { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; margin: 0 -14px; padding: 2px 14px 6px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.preset-strip .tpl { flex: 0 0 84px; scroll-snap-align: start; }
.preset-strip .tpl-pick { padding: 6px 4px; gap: 4px; font-size: 11px; font-weight: 600; line-height: 1.2; height: 100%; justify-content: flex-start; }
.preset-strip .tpl-pick span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.preset-strip .tpl-svg { height: 50px; }
.preset-strip .tpl-del { top: 2px; right: 2px; }
@media (min-width: 700px) { .preset-strip { flex-wrap: wrap; overflow: visible; margin: 0; padding: 2px 0; } .preset-strip .tpl { flex-basis: 96px; } }

/* room page cards: on narrow screens the price moves under the size so the size stays on one line */
@media (max-width: 480px) {
  .win-link { display: grid; grid-template-columns: 56px minmax(0, 1fr); grid-template-areas: "thumb info" "thumb price"; column-gap: 10px; row-gap: 2px; align-items: center; }
  .win-thumb { grid-area: thumb; width: 56px; height: 56px; }
  .win-info { grid-area: info; }
  .win-price { grid-area: price; font-size: 14px; }
  .win-card { padding: 10px 4px 10px 10px; }
}
.win-card > .icon-btn { flex: none; width: 44px; min-height: 44px; }
.drawing.tappable svg { max-height: min(34vh, 460px); } /* keeps the bottom dimension line above the wizard bar on phones */

/* install */
.install-only { display: none !important; }
body.can-install .install-only { display: flex !important; }
.btn.install-only { gap: 6px; align-items: center; justify-content: center; }
.ico { width: 20px; height: 20px; flex: none; }
.ico.share { display: inline-block; vertical-align: -4px; color: var(--accent); }
.install-banner { gap: 12px; align-items: flex-start; border-color: var(--accent); background: var(--accent-soft); }
.install-banner img { border-radius: 11px; flex: none; }
.install-banner p { margin: 2px 0 10px; }
.install-steps { margin: 0 0 12px; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; line-height: 1.45; }
@media (max-width: 560px) { .hide-narrow { display: none; } .btn.install-only { padding: 0 10px; } }
@media print { .install-only { display: none !important; } }

/* login + account */
.login { min-height: 100dvh; max-width: 420px; margin: 0 auto; padding: 32px 24px calc(24px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; }
.login img { border-radius: 20px; box-shadow: var(--shadow); }
.login h1 { font-size: 26px; }
.login h2 { font-size: 18px; font-weight: 600; }
.login p { line-height: 1.5; margin-bottom: 8px; }
.btn.google { width: 100%; min-height: 52px; gap: 12px; justify-content: center; align-items: center; display: flex;
  background: #fff; color: #1f1f1f; border: 1px solid #747775; font-weight: 600; font-size: 16px; }
.btn.link { border: 0; color: var(--muted); font-size: 14px; text-decoration: underline; white-space: normal; }
.acct-btn { position: relative; }
.acct-btn img, .acct-btn > span { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; object-fit: cover; }
.acct-btn > span { background: var(--accent); color: var(--accent-ink); font-size: 15px; font-weight: 700; }
.acct-btn::after { content: ''; position: absolute; right: 4px; bottom: 4px; width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid var(--surface); display: none; }
.acct-btn:not([data-status="ok"]):not([data-status="off"])::after { display: block; }
.acct-btn[data-status="syncing"]::after { background: var(--accent); }
.acct-btn[data-status="offline"]::after { background: #9aa5af; }
.acct-btn[data-status="error"]::after, .acct-btn[data-status="expired"]::after { background: var(--danger); }
.acct-head { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.acct-head img { width: 48px; height: 48px; border-radius: 50%; }
.acct-head div { display: flex; flex-direction: column; min-width: 0; }
.sync-line { margin-bottom: 12px; }
@media (max-width: 560px) {
  .topbar .topbar-actions .btn.ghost { padding: 0 9px; }
  .topbar .topbar-actions { gap: 2px; }
}
