:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-2: #efeee9;
  --ink: #1b1c1f;
  --ink-2: #5a5d65;
  --ink-3: #8a8d95;
  --line: #dddbd4;
  --accent: #2f5fd0;
  --accent-ink: #ffffff;
  --accent-soft: rgba(47, 95, 208, 0.11);
  --good: #2b8a3e;
  --warn: #b35c00;
  --dim: #d62828;
  --dim-op: 1;
  --num-op: 1;
  --dim-w: 1;   /* line thickness, x */
  --num-wt: 650;   /* the numbers' font weight */
  --canvas: #e4e2dc;
  --shadow: 0 8px 28px rgba(20, 20, 30, 0.14);
  --radius: 12px;
  --bar-h: 56px;
  --gutter: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151619; --surface: #1e2024; --surface-2: #272a2f; --ink: #ecedef; --ink-2: #a8acb4;
    --ink-3: #777b84; --line: #32353b; --accent: #7aa2ff; --accent-ink: #0c1326;
    --accent-soft: rgba(122, 162, 255, 0.15); --good: #69db7c; --warn: #ffa94d;
    --canvas: #0e0f11; --shadow: 0 8px 28px rgba(0, 0, 0, 0.5); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151619; --surface: #1e2024; --surface-2: #272a2f; --ink: #ecedef; --ink-2: #a8acb4;
  --ink-3: #777b84; --line: #32353b; --accent: #7aa2ff; --accent-ink: #0c1326;
  --accent-soft: rgba(122, 162, 255, 0.15); --good: #69db7c; --warn: #ffa94d;
  --canvas: #0e0f11; --shadow: 0 8px 28px rgba(0, 0, 0, 0.5); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink); min-height: 100dvh;
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%;
}
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
a { color: var(--accent); text-decoration: none; }
[hidden] { display: none !important; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- top bar */
#bar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 8px;
  min-height: calc(var(--bar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
#title { flex: 1; min-width: 0; }
#title h1 { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#title h1 a { color: inherit; }
#subtitle { margin: 0; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#subtitle:empty { display: none; }
#actions { display: flex; gap: 6px; }
.icon {
  flex: none; display: inline-grid; place-items: center; width: 40px; height: 40px; margin-left: -8px;
  border: 0; border-radius: 10px; background: transparent; color: var(--ink); cursor: pointer;
}
.icon:hover { background: var(--surface-2); }
.icon svg { width: 22px; height: 22px; }

main { padding: 0 max(var(--gutter), env(safe-area-inset-right)) calc(40px + env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left)); max-width: 1240px; margin: 0 auto; }
main.full { max-width: none; padding: 0; }

/* ---------- buttons, chips, inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px;
  padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); cursor: pointer; font-weight: 550; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn svg { width: 18px; height: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  min-height: 34px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2); cursor: pointer; font-size: 14px;
}
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.bedSel { appearance: none; -webkit-appearance: none; padding-right: 30px; cursor: pointer;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23777b84' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 14px; }
.bedSel[aria-pressed="true"] { background-color: var(--accent-soft); }
.search {
  display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface);
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search svg { width: 18px; height: 18px; color: var(--ink-3); flex: none; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); }
.badge.good { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.badge.mine { background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }

/* ---------- home and condo lists */
.hero { padding: 28px 0 14px; }
.hero h2 { font-size: clamp(24px, 4vw, 34px); }
.hero p { margin: 6px 0 0; color: var(--ink-2); max-width: 60ch; }
.filters.top { padding-top: 16px; }
.filters { display: flex; flex-direction: column; gap: 10px; padding: 8px 0 6px; }
.filterRow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.section { margin-top: 22px; }
.section > h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); font-weight: 650; margin-bottom: 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card {
  display: flex; flex-direction: column; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--line); overflow: hidden; color: var(--ink); position: relative;
  transition: border-color .15s, box-shadow .15s;
}
.card:hover { border-color: var(--ink-3); box-shadow: var(--shadow); }
.card .thumb { position: relative; aspect-ratio: 4 / 3; background: #fff; overflow: hidden; border-bottom: 1px solid var(--line); }
/* Absolute: Safari doesn't resolve height: 100% in an aspect-ratio box, so tall plans overflowed it, cropped. */
.card .thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.card .thumb .badge { position: absolute; top: 8px; left: 8px; background: #fff; color: #555; box-shadow: 0 0 0 1px #d8d8d8; }   /* on the paper: light either theme */
.card .thumb .badge.mine { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.card .thumb.cover img { object-fit: cover; padding: 0; }
.card .thumb .credit { position: absolute; left: 0; bottom: 0; padding: 1px 4px; font-size: 5.5px; letter-spacing: .02em; color: rgba(255, 255, 255, .85);
  background: rgba(0, 0, 0, .22); border-top-right-radius: 3px; white-space: nowrap; }   /* half size, quiet (user's call 2026-10-20) */
.card.lcard .t1 { display: block; line-height: 1.3; }
.card.lcard .t1 .nm { color: var(--ink-2); font-size: 14px; }
.card .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 3px; }
.card .t1 { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.card .t1 b { font-size: 17px; }
.card .t2 { color: var(--ink-2); font-size: 14px; }
.card .t3 { color: var(--ink-3); font-size: 13px; }
button.card { padding: 0; font: inherit; text-align: left; cursor: pointer; width: 100%; }
button.card:disabled { opacity: .55; cursor: default; }
button.card:disabled:hover { border-color: var(--line); box-shadow: none; }
.empty { padding: 36px 0; text-align: center; color: var(--ink-2); }
.group + .group { margin-top: 26px; }
/* Condo groups flow side by side, each as wide as its cards: no half-empty rows. */
.condoGroups { --cw: 230px; display: flex; flex-wrap: wrap; gap: 22px 14px; }
.condoGroup { flex: 0 1 calc(var(--n) * var(--cw) + (var(--n) - 1) * 14px); max-width: 100%; min-width: 0; }
.condoGroup .grid { grid-template-columns: repeat(auto-fill, var(--cw)); }
.condoGroup h4 { margin: 0 0 10px; font-size: 16px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.condoGroup h4 a { color: var(--ink); }
.condoGroup h4 a:hover { color: var(--accent); }
.condoGroup h4 span { color: var(--ink-3); font-weight: 500; }
.group h3 { font-size: 15px; margin-bottom: 10px; }
.group h3 span { color: var(--ink-3); font-weight: 500; }

/* ---------- plan viewer */
.viewer { position: relative; overflow: hidden; background: var(--canvas); touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.viewer:active { cursor: grabbing; }
.viewer .stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.viewer .sheet { position: absolute; background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,.18); }
.viewer img { position: absolute; left: 0; top: 0; display: block; pointer-events: none; }
.viewer img.mirror { transform: scaleX(-1); }
.viewer .overlay { position: absolute; overflow: visible; pointer-events: none; }
.viewer .dim line { stroke: var(--dim); stroke-width: calc(1.5px * var(--dim-w)); vector-effect: non-scaling-stroke; opacity: var(--dim-op); }
.viewer .dim line.ext { stroke-dasharray: 4 3; stroke-width: calc(1px * var(--dim-w)); opacity: calc(var(--dim-op) * .65); }
.viewer .dim text {
  fill: var(--dim); fill: color-mix(in srgb, var(--dim) 75%, #000); fill-opacity: var(--num-op); stroke-opacity: var(--num-op); font-weight: var(--num-wt); text-anchor: middle; dominant-baseline: central; stroke: #fff;
  paint-order: stroke; stroke-linejoin: round; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.viewer.noDims .overlay { display: none; }
.viewer .overlay.focus .dim { opacity: .18; }
.viewer .overlay.focus .dim.on { opacity: 1; }
.viewer .overlay.focus .dim.on line { stroke-width: calc(2.5px * var(--dim-w)); }
/* Editing: a selected line is bolder, with a dot at each end to drag. */
.viewer.editing { cursor: default; }
.viewer.editing:active { cursor: grabbing; }
.viewer.adding, .viewer.adding:active { cursor: crosshair; }
.viewer.editing .overlay .dim { opacity: .8; }
.viewer.editing .overlay .dim.sel { opacity: 1; }
.viewer .dim.sel line:not(.ext) { stroke-width: 3px; }
.viewer .dim circle.handle { fill: #fff; stroke: var(--dim); stroke-width: 2.5px; vector-effect: non-scaling-stroke; opacity: 1; }
.viewer .dim.sel line:not(.ext) { opacity: max(var(--dim-op), .6); }
.viewer .dim rect.labelBox { fill: none; stroke: var(--dim); stroke-width: 1px; stroke-dasharray: 3 2; vector-effect: non-scaling-stroke; }
.viewer .overlay line.guide { stroke: var(--accent); stroke-width: 1px; stroke-dasharray: 6 4; vector-effect: non-scaling-stroke; }
.editBar {
  position: absolute; z-index: 4; top: 12px; left: 12px; width: min(470px, calc(100% - 400px)); min-width: 300px;
  display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 14px; background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow); cursor: default;
}
.ebRow, .ebSel { display: flex; align-items: center; gap: 6px; }
.ebRow .grow { flex: 1; }
.editBar .btn { min-height: 36px; padding: 0 10px; }
.editBar .btn:disabled { opacity: .45; cursor: default; }
.editBar .btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.editBar .btn.primary { padding: 0 16px; }
.ebSel input {
  min-width: 0; flex: 1.4; height: 36px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--surface); font-size: 16px; outline: 0;
}
.ebSel input + input { flex: 1; }
.ebSel input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ebLen { flex: none; min-width: 52px; text-align: right; color: var(--dim); }
.ebHint { margin: 0; font-size: 12.5px; color: var(--ink-2); }
.ebHint.warn { color: var(--warn); font-weight: 600; }
.note.mine { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.side h3 .badge { margin-left: 8px; text-transform: none; letter-spacing: 0; vertical-align: 1px; }

/* The colour of the sizes: swatches. */
.colourTool { display: flex; }   /* not positioned: the pop-up lines up with the toolbar's right edge, so it stays on screen */
.vtools .dot { display: block; width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 2px rgba(255,255,255,.5); }
.palettePop {
  position: absolute; right: 0; bottom: 46px; z-index: 5; padding: 10px; border-radius: 12px; background: var(--surface);
  width: max-content; max-width: calc(100vw - 20px); box-sizing: border-box;   /* as wide as its widest row */
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.paletteWrap { display: flex; flex-direction: column; gap: 10px; }
.palette { display: grid; grid-template-columns: repeat(9, 30px); gap: 7px; }
.opacity { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); }
.opacity span:first-child { flex: none; }
.opacity input { flex: 1; min-width: 80px; accent-color: var(--dim); }
.opacity .num { flex: none; width: 36px; text-align: right; }
.seg2 { display: flex; gap: 4px; }
.seg2 .chip { min-height: 28px; padding: 0 10px; font-size: 13px; }
.paletteWrap > .chip { align-self: flex-start; min-height: 28px; padding: 0 10px; font-size: 13px; }
.palettePop .palette { grid-template-columns: repeat(5, 30px); }
.swatch {
  width: 30px; height: 30px; padding: 0; border-radius: 50%; border: 2px solid var(--surface); cursor: pointer;
  box-shadow: 0 0 0 1px var(--line); position: relative; overflow: hidden;
}
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ink); }
.swatch.custom { background: conic-gradient(#d62828, #e8590c, #f2c94c, #2b8a3e, #1c7ed6, #7048e8, #c2255c, #d62828); }
.swatch.custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }

/* Export: a sheet with a preview. */
.dialog {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px;
  background: rgba(10, 12, 16, .45); padding-bottom: max(16px, env(safe-area-inset-bottom));
}
.dlgBox {
  width: min(760px, 100%); max-height: 100%; display: flex; flex-direction: column; gap: 12px; padding: 14px 16px 16px;
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); overflow: auto;
}
.dlgHead { display: flex; align-items: center; justify-content: space-between; }
.dlgHead b { font-size: 17px; }
.dlgHead .icon { margin: 0 -8px 0 0; }
.dlgPrev { min-height: 120px; display: grid; place-items: center; background: var(--canvas); border-radius: 10px; padding: 8px; }
.dlgPrev img { display: block; max-width: 100%; max-height: min(52dvh, 480px); background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,.18); }
.dlgOpts { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.dlgFoot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.dlgFoot > span { font-size: 13px; color: var(--ink-2); }
.btn:disabled { opacity: .5; cursor: default; }

.vtools { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 6px; z-index: 5; }   /* over the panel and the edit bar: the colour pop-up */
.vtools button {
  height: 38px; min-width: 38px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent); color: var(--ink); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.vtools button svg { width: 18px; height: 18px; }
.vtools button[aria-pressed="false"] { color: var(--ink-3); }
.vtools button.mode[aria-pressed="false"] { color: var(--ink); }   /* a mode to enter, not a layer that's off */
.vtools button.mode[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.vtools button.saveTool { color: var(--accent); border-color: var(--accent); }
.vtools button.saveTool[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.vtools button.saveTool[aria-pressed="true"] svg, .saveBtn[aria-pressed="true"] svg { fill: currentColor; }   /* a filled bookmark once saved */
.scalebar { position: absolute; left: 12px; bottom: 14px; z-index: 2; font-size: 12px; font-weight: 600; color: var(--ink-2); pointer-events: none; }
.scalebar i { display: block; height: 6px; border: 2px solid var(--ink-2); border-top: 0; margin-top: 2px; }

/* ---------- layout page: the plan fills the screen, details in a panel over it */
.layoutPage { position: relative; overflow: hidden; height: calc(100dvh - var(--bar-h) - env(safe-area-inset-top) - 1px); }
.layoutPage > .viewer { position: absolute; inset: 0; }
.side {
  position: absolute; z-index: 3; top: 12px; right: 12px; width: 360px; max-height: calc(100% - 24px);
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow); overflow: hidden;
}
.sideHead {
  flex: none; display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px 10px 16px;
  border: 0; background: transparent; text-align: left; cursor: pointer; min-height: 56px;
}
.sideHead div { flex: 1; min-width: 0; }
.sideHead b { display: block; font-size: 17px; }
.sideHead span { display: block; font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sideHead .chev, .sizesHead .chev { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: var(--surface-2); color: var(--ink-2); transition: transform .2s; }
.sideHead .chev svg, .sizesHead .chev svg { width: 18px; height: 18px; }
.side.open .chev, .sizes.open .chev { transform: rotate(180deg); }
.side:not(.open) { width: auto; max-width: 360px; }   /* folded: just its line */
.layoutPage .side { max-height: calc(100% - 24px - 52px); }   /* a long rooms list stops above the plan's buttons */
.sideHead i { font-style: normal; }
.side:not(.open) .sideHead .nm { display: none; }
.sideBody { display: none; overflow-y: auto; overscroll-behavior: contain; padding: 4px 16px 16px; flex-direction: column; gap: 18px; border-top: 1px solid var(--line); }
.side.open .sideBody { display: flex; padding-top: 14px; }
.side .more { margin: 0; font-size: 14px; }
.floatBack { display: none; }
.facts { display: flex; flex-wrap: wrap; gap: 6px; }
.fact { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; font-size: 13px; color: var(--ink-2); }
.fact b { display: block; color: var(--ink); font-size: 16px; }
.side h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); margin-bottom: 8px; }
table.rooms { width: 100%; border-collapse: collapse; font-size: 14px; }
table.rooms th { text-align: left; font-weight: 600; color: var(--ink-3); font-size: 12px; padding: 0 6px 6px 0; }
table.rooms td { padding: 7px 6px 7px 0; border-top: 1px solid var(--line); vertical-align: top; }
table.rooms td.size { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }
table.rooms td .ex { display: block; font-size: 12.5px; color: var(--ink-2); font-weight: 400; }
table.rooms tr.pick { cursor: pointer; }
table.rooms tr.pick:hover td { background: var(--surface-2); }
table.rooms tr.on td { background: var(--accent-soft); }
.note { font-size: 13px; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.note.warn { border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
.units { font-size: 13.5px; color: var(--ink-2); display: flex; flex-direction: column; gap: 2px; }
.units b { color: var(--ink); font-weight: 600; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- compare: the plans over a drawer of room sizes, filling the screen */
.cmpPage { display: flex; flex-direction: column; height: calc(100dvh - var(--bar-h) - env(safe-area-inset-top) - 1px); overflow: hidden; }
.panes { position: relative; flex: 1; min-height: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.pane { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; border-left: 1px solid var(--line); }
.pane:first-child { border-left: 0; }
.pane .ph { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 14px; background: var(--surface); border-bottom: 1px solid var(--line); min-height: 52px; }
.pane .ph div { flex: 1; min-width: 0; }
.pane .ph b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pane .ph span { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.pane .ph .icon { margin: 0; width: 36px; height: 36px; }
.pane .ph .icon[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.pane .viewer { flex: 1; min-height: 0; }
.seg { flex: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--surface); }
.seg .addChip { display: none; }   /* desktop: the Add column */
.segItem { display: inline-flex; align-items: stretch; }
.segItem .segName { border-radius: 999px 0 0 999px; border-right: 0; padding-right: 8px; }
.segX { display: grid; place-items: center; width: 32px; min-height: 34px; border: 1px solid var(--line); border-left: 0; border-radius: 0 999px 999px 0;
  background: var(--surface); color: var(--ink-3); cursor: pointer; }
.segX:hover { color: var(--warn, #c92a2a); }
.segX svg { width: 14px; height: 14px; }
.segName[aria-pressed="true"] + .segX { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
@media (min-width: 701px) {   /* desktop shows every plan: no "current" one */
  .seg .segName[aria-pressed="true"] { background: var(--surface); border-color: var(--line); color: var(--ink-2); font-weight: 400; }
  .seg .segName[aria-pressed="true"] + .segX { border-color: var(--line); background: var(--surface); color: var(--ink-3); }
}
.cmpStage { max-width: 1240px; margin: 0 auto; padding: 18px 0 40px; }
.cmpStage .stageHead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-bottom: 16px; }
.cmpStage .lead { margin: 0; color: var(--ink-2); max-width: 62ch; }
.cmpStage .grid { grid-template-columns: repeat(auto-fill, minmax(230px, 260px)); }
.card .cardX { position: absolute; top: 6px; right: 6px; z-index: 2; width: 24px; height: 24px; padding: 0; border-radius: 999px; border: 0;
  background: rgba(255, 255, 255, .8); color: #777; display: grid; place-items: center; cursor: pointer; opacity: .75; }   /* quiet (user's call 2026-10-20) */
.card .cardX:hover { opacity: 1; color: #333; }
.card .cardX svg { width: 12px; height: 12px; stroke-width: 2.4; }
.card .cardX::after { content: ''; position: absolute; inset: -8px; }   /* a finger-sized target round the small mark */
.addCard { border-style: dashed; color: var(--accent); }
.addCard .thumb { display: grid; place-items: center; background: var(--accent-soft); }
.addCard .thumb svg { width: 44px; height: 44px; padding: 12px; box-sizing: content-box; border-radius: 999px; border: 2px dashed currentColor; }
.addCard .t1 b { color: var(--accent); }
.sizes {
  flex: none; display: flex; flex-direction: column; min-height: 0; background: var(--surface);
  border-top: 1px solid var(--line); box-shadow: 0 -4px 14px rgba(0,0,0,.07); padding-bottom: env(safe-area-inset-bottom);
}
.sizes.open { max-height: 55%; }
.sizes:not(.open) { cursor: pointer; }
.sizesBar { flex: none; display: flex; align-items: center; }
.sizesBar .sizesHead { flex: 1; min-width: 0; width: auto; }
.sizesBar .fullBtn { flex: none; margin-right: 12px; padding: 5px 12px; font-size: 13px; }
.cmpPage.tableOnly :is(.panes, .seg) { display: none; }
.cmpPage.tableOnly .sizes { flex: 1; max-height: none; border-top: 0; box-shadow: none; }
.sizesHead {
  flex: none; display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 12px 6px 14px; min-height: 46px;
  border: 0; background: transparent; color: var(--ink); text-align: left; cursor: pointer;
}
.sizesHead b { font-size: 15px; white-space: nowrap; }
.sizesHead span:not(.chev) { flex: 1; min-width: 0; font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sizesBody { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.sizes:not(.open) .sizesBody { overflow: hidden; }
.sizesTools { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 14px 10px; }
.sizes:not(.open) :is(.sizesTools, thead, tbody:not(.total), .note, .allSame) { display: none; }
table.sizeTable { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 14px; }
table.sizeTable thead th { position: sticky; top: 0; z-index: 1; padding: 0; background: var(--surface); border-bottom: 1px solid var(--line); text-align: left; }
.colHead {
  display: block; width: 100%; padding: 6px 8px 6px 14px; border: 0; background: transparent; text-align: left; cursor: default;
  font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.colHead b { display: block; color: var(--ink); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; }
table.sizeTable tr.lab th {
  padding: 8px 14px 1px; border-top: 1px solid var(--line); text-align: left;
  font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-3);
}
table.sizeTable thead + tbody tr.lab th { border-top: 0; }
table.sizeTable td { padding: 1px 8px 8px 14px; vertical-align: top; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
table.sizeTable td + td { border-left: 1px solid var(--line); }
table.sizeTable td .v { font-weight: 600; }
table.sizeTable td .ex { display: block; font-size: 12.5px; color: var(--ink-2); }
table.sizeTable td.top .v { color: var(--accent); font-weight: 750; }
table.sizeTable td.top .v::after { content: " ▲"; font-size: 10px; vertical-align: 1px; }
table.sizeTable td.na { color: var(--ink-3); }
table.sizeTable:not(.withAreas) .ex.area { display: none; }
table.sizeTable.diff tbody.same:not(.total) { display: none; }
table.sizeTable tbody[data-room] { cursor: pointer; }
@media (hover: hover) { table.sizeTable tbody[data-room]:hover :is(th, td) { background: var(--surface-2); } }
table.sizeTable tbody[data-room].on :is(th, td) { background: var(--accent-soft); }
.sizes .note { margin: 10px 14px 14px; }
.allSame { margin: 12px 14px 0; font-size: 14px; color: var(--ink-2); }
.linkish { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- compare: the top bar's button, the picker, room for more */
.barBtn { min-height: 36px; padding: 0 12px; gap: 6px; }
.barBtn .count { font-style: normal; font-size: 12px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
  display: inline-grid; place-items: center; background: var(--accent); color: var(--accent-ink); }
.picker .dlgBox { width: min(1100px, 100%); height: 100%; gap: 6px; }
.picker .pickList { min-height: 0; padding-bottom: 8px; }
.picker .section:first-child { margin-top: 12px; }
.pickCrumb { display: flex; align-items: baseline; gap: 12px; margin-top: 12px; }
.pickCrumb b { font-size: 17px; }
.addCol { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border: 0; border-left: 1px solid var(--line);
  background: var(--surface-2); color: var(--ink-2); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 12px 8px; }
.addCol:hover { color: var(--accent); background: var(--accent-soft); }
.addCol svg { width: 26px; height: 26px; padding: 8px; box-sizing: content-box; border-radius: 999px; border: 1.5px dashed currentColor; }
.cmpPage.hasAdd .panes { grid-template-columns: repeat(var(--n, 1), minmax(0, 1fr)) 104px; }
.cmpPage.hasAdd table.sizeTable { width: calc(100% - 104px); }
.cmpPage.hasAdd .panes > .vtools { right: 114px; }
.addChip { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); border-style: dashed; }
.addChip svg { width: 16px; height: 16px; }
.cmpEmpty { max-width: 520px; margin: 0 auto; padding-top: 12vh; }
.cmpEmpty h2 { font-size: 24px; margin-bottom: 6px; color: var(--ink); }
.cmpEmpty p { margin: 0 0 18px; }

@media (max-width: 700px) {
  :root { --bar-h: 52px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .condoGroups { gap: 18px 10px; }
  .condoGroup { flex-basis: 100%; }
  .condoGroup.one { flex-basis: calc(50% - 5px); }
  .condoGroup .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .condoGroup.one .grid { grid-template-columns: minmax(0, 1fr); }
  .card .t1 b { font-size: 15px; }
  .card.lcard .t1 .nm { font-size: 13px; }
  .card .t2 { font-size: 13px; }
  .card .t3 { font-size: 12px; }
  .card .body { padding: 8px 10px 10px; }
  .hero { padding: 18px 0 8px; }
  .panes { grid-auto-flow: row; grid-auto-columns: auto; }
  .cmpPage.hasAdd .panes { grid-template-columns: none; }
  .cmpPage.hasAdd table.sizeTable { width: 100%; }
  .addCol { display: none; }
  .cmpPage.hasAdd .panes > .vtools { right: 10px; }
  .pane { display: none; border-left: 0; }
  .pane.on { display: flex; }
  .seg { flex-wrap: nowrap; overflow-x: auto; padding: 10px var(--gutter); }
  .seg .chip, .segItem { flex: none; }
  .seg .addChip { display: inline-flex; }
  .cmpStage { padding-top: 14px; }
  .cmpStage .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cmpStage .cmpGo { width: 100%; }   /* the pick and the Add card side by side */
  .vtools button span { display: none; }   /* icons only: the title names them */
  .vtools button.saveTool span { display: inline; }   /* but Save says so: how to keep a layout */
  .vtools button { padding: 0 9px; }
  .palette { grid-template-columns: repeat(5, 30px); }
  /* One plan at a time: its column in the sizes is shaded, a column's head shows its plan. */
  .sizes.open { max-height: 62%; }
  table.sizeTable { font-size: 13px; }
  table.sizeTable td { padding: 1px 5px 8px 8px; }
  table.sizeTable td .ex { font-size: 11.5px; }
  table.sizeTable tr.lab th { padding: 8px 8px 1px; }
  .colHead { padding: 6px 5px 6px 8px; cursor: pointer; }
  table.sizeTable :is(td, th).cur { background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
  table.sizeTable thead th.cur .colHead b { color: var(--accent); }
  .cmpPage.tableOnly table.sizeTable :is(td, th).cur { background: none; }
  .cmpPage.tableOnly table.sizeTable thead th.cur { background: var(--surface); }
  .cmpPage.tableOnly table.sizeTable thead th.cur .colHead b { color: var(--ink); }
}

/* Phones upright: the details are a bottom sheet over the plan, folded to one line. */
@media (max-width: 700px) and (min-height: 501px) {
  .side, .side:not(.open), .layoutPage .side { top: auto; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); width: auto; max-width: none; max-height: 58%; }
  .layoutPage .vtools { top: 10px; bottom: auto; }
  .layoutPage .scalebar { top: 62px; bottom: auto; }   /* under the toolbar: its labelled Save reaches the left edge */
  .layoutPage .palettePop { top: 46px; bottom: auto; }
  .editBar { top: 58px; left: 8px; right: 8px; width: auto; min-width: 0; }
}
/* Phones on their side: little height, so a slim bar and a narrower panel. */
@media (max-height: 500px) {
  :root { --bar-h: 44px; }
  #title h1 { font-size: 15px; }
  #subtitle { display: none; }
  .side { width: 300px; top: 8px; right: 8px; max-height: calc(100% - 16px); }
  .layoutPage .side { max-height: calc(100% - 16px - 52px); }
  .sideHead { min-height: 48px; padding: 6px 10px 6px 14px; }
  .sideHead b { font-size: 15px; }
  .side:not(.open) .sideHead span.num { display: none; }   /* folded: the type alone */
  .sizes.open { max-height: 72%; }
  /* The plan page gets the whole height: no top bar, a floating back button instead. */
  body.planPage #bar { display: none; }
  body.planPage .layoutPage { height: 100dvh; }
  .floatBack {
    display: grid; position: absolute; z-index: 3; top: 8px; left: max(8px, env(safe-area-inset-left)); margin: 0;
    background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--line); box-shadow: 0 2px 8px rgba(0,0,0,.15);
  }
  .layoutPage .scalebar { left: max(14px, env(safe-area-inset-left)); }
  .editBar { top: 8px; left: max(56px, calc(env(safe-area-inset-left) + 48px)); width: auto; right: 320px; min-width: 0; padding: 8px; gap: 6px; }
  .ebHint { display: none; }
}
