/* Bath Builder — standalone */
:root { --bg: #f6f7f9; --card: #fff; --line: #e3e6ea; --muted: #6b7280; --text: #111827; --brand: #b86b3a; --brand-dark: #8e4f28; --ok: #0f7b3e; --warn: #b4581b; --err: #b3261e; --radius: 10px; --shadow: 0 1px 3px rgba(0,0,0,.06); }
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif; color: var(--text); background: var(--bg); }
header { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; background: #fff; border-bottom: 1px solid var(--line); gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 36px; height: 36px; border-radius: 8px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; }
h1 { font-size: 18px; margin: 0; }
.tag { margin: 0; font-size: 12px; color: var(--muted); }
.auth { font-size: 12px; color: var(--muted); }
main { max-width: 1200px; margin: 20px auto; padding: 0 16px; display: grid; gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
:root { --panel: #1f8a78; --tile: #376a87; --panel-soft: #e6f4f1; --tile-soft: #e8f0f5; }
.pill { font-size: 11px; background: var(--brand); color: #fff; padding: 2px 8px; border-radius: 10px; vertical-align: middle; margin-left: 6px; }
.auth a { color: var(--brand-dark); text-decoration: none; font-weight: 600; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; min-width: 0; }
.col { display: grid; gap: 16px; min-width: 0; }
.card { padding: 16px; min-width: 0; }
.card h2 { font-size: 16px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.card h3 { font-size: 14px; margin: 18px 0 8px; }
.step { width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 12px; display: inline-grid; place-items: center; font-weight: 700; }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; }
p.hint { margin: -4px 0 10px; }
label { display: grid; gap: 4px; font-size: 13px; font-weight: 500; }
input[type=text], input[type=number], input:not([type]), select, textarea {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); width: 100%; min-width: 0;
}
input[type=number] { font-variant-numeric: tabular-nums; }
textarea { resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 10px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; gap: 8px 18px; }
.row.end { justify-content: flex-end; align-self: end; }
.chk { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.chk input { width: 18px; height: 18px; accent-color: var(--brand); }
.seg { display: flex; gap: 6px; }
.seg label { flex: 1; display: flex; gap: 6px; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 8px; padding: 7px 6px; cursor: pointer; font-weight: 500; white-space: nowrap; }
.seg label:has(input:checked) { border-color: var(--brand); background: #fbf1ea; }
.seg input { accent-color: var(--brand); }
.calc { font-size: 13px; color: var(--muted); margin-left: auto; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opts.two { grid-template-columns: 1fr 1fr; }
.opt { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 11px; cursor: pointer; font-weight: 400; }
.opt input[type=radio] { margin-top: 3px; accent-color: var(--brand); }
.opt > span { display: grid; gap: 6px; flex: 1; }
.opt b { font-weight: 600; }
.opt small { color: var(--muted); font-size: 12px; }
.opt:has(> input:checked) { border-color: var(--brand); background: #fbf1ea; box-shadow: inset 0 0 0 1px var(--brand); }
.opt.sys-panel:has(> input:checked) { border-color: var(--panel); background: var(--panel-soft); box-shadow: inset 0 0 0 1px var(--panel); }
.opt.sys-tile:has(> input:checked) { border-color: var(--tile); background: var(--tile-soft); box-shadow: inset 0 0 0 1px var(--tile); }
button { font: inherit; font-weight: 600; border-radius: 8px; padding: 9px 14px; cursor: pointer; border: 1px solid var(--brand); background: var(--brand); color: #fff; }
button.ghost { background: transparent; color: var(--brand-dark); border-color: var(--line); }
button:disabled { opacity: .5; cursor: not-allowed; }
.status { font-size: 12.5px; color: var(--muted); min-height: 1.2em; }
.status.ok { color: var(--ok); } .status.err { color: var(--err); }
.hidden { display: none !important; }

/* compare cards */
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cmp { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: grid; gap: 4px; border-top: 4px solid var(--c); cursor: pointer; }
.cmp.sys-panel { --c: var(--panel); } .cmp.sys-tile { --c: var(--tile); }
.cmp.selected { background: color-mix(in srgb, var(--c) 8%, #fff); box-shadow: inset 0 0 0 1px var(--c); }
.cmp .name { font-weight: 700; color: var(--c); display: flex; justify-content: space-between; align-items: center; }
.cmp .tagsel { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; background: var(--c); color: #fff; padding: 2px 7px; border-radius: 10px; }
.cmp .price { font-size: 26px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cmp .sub { font-size: 12px; color: var(--muted); }
.cmp .delta { font-size: 12px; font-weight: 600; }

/* items table */
.tscroll { overflow-x: auto; }
#itemsTable { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
#itemsTable th, #itemsTable td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; vertical-align: top; }
#itemsTable th:first-child, #itemsTable td:first-child { text-align: left; }
#itemsTable thead th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
#itemsTable tr.grp td { font-weight: 700; background: var(--bg); text-align: left; }
#itemsTable tr.total td { font-weight: 700; border-top: 2px solid var(--text); }
#itemsTable td.muted { color: var(--muted); }

/* timeline */
ol.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; counter-reset: s; }
ol.steps li { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 13px; counter-increment: s; }
ol.steps li::before { content: counter(s); font-size: 11px; color: var(--muted); }
ol.steps li.cure { color: var(--muted); font-style: italic; }
ol.steps li.ready { font-weight: 700; color: var(--ok); }
ol.steps .when { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--muted); font-size: 12px; }

#quoteText { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.45; white-space: pre; }

/* side summary */
.sticky { position: sticky; top: 16px; }
#summary { display: grid; gap: 10px; }
#summary .big { font-size: 30px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
#summary .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
#summary .kv { display: flex; justify-content: space-between; font-size: 13px; gap: 8px; }
#summary .kv b { font-variant-numeric: tabular-nums; }
#summary .bar { height: 1px; background: var(--line); }
#summary .sysname { font-weight: 700; }
#summary .sysname.panel { color: var(--panel); } #summary .sysname.tile { color: var(--tile); }

/* saved */
.saved { display: grid; gap: 6px; }
.saved .q { display: flex; justify-content: space-between; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.saved .q small { color: var(--muted); display: block; }
.saved .q .acts { display: flex; gap: 6px; }
.saved .q button { padding: 5px 10px; font-size: 12px; }

/* assumptions */
details.card summary { cursor: pointer; font-weight: 700; font-size: 15px; }
.agrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px 18px; margin: 12px 0; }
.agrid label { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12.5px; font-weight: 400; }
.agrid input { width: 90px; text-align: right; padding: 5px 7px; }
.agrid h4 { grid-column: 1 / -1; margin: 8px 0 0; font-size: 13px; }

/* bottom bar (phone) */
.bottombar { display: none; }
.print-only { display: none; }

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .opts, .opts.two { grid-template-columns: 1fr; }
  .compare { grid-template-columns: 1fr; }
  main { padding-bottom: 72px; }
  .bottombar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: 10px max(16px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-bottom)); justify-content: space-between; align-items: center; gap: 10px; z-index: 5; }
  .bottombar .big { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
  .bottombar .sub { font-size: 11px; color: var(--muted); }
}
@media (max-width: 520px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
  header { padding: 12px 16px; }
}
@media print {
  header, main, .bottombar { display: none !important; }
  .print-only { display: block; font: 12px/1.45 system-ui, sans-serif; white-space: pre-wrap; }
}
