/* Framed sheet: one tinted L-frame (top bar on the frame ground), the work on a white sheet.
   Grid: sheet padding 24, one 24px gap everywhere; the builder uses 8px outer + 12px panel gap. */
:root {
  --ground: #f4f3f0; /* plaster: the frame tinted from the product's world */
  --surface: #ffffff;
  --raised: #f4f6f8;
  --well: #f1f2f0;
  --active: #ebedee;
  --border: #e6e5e1;
  --rule: #f0efec;
  --control: #cdced1;
  --text: #131416;
  --muted: #5d5f60;
  --accent: #1b6c80;
  --accent-soft: #e3eff2;
  --positive: #1e7b4f;
  --negative: #c4242a;
  --pill-positive-bg: #dcfae5; --pill-positive-ink: #04250e;
  --pill-negative-bg: #ffedea; --pill-negative-ink: #831c1e;
  --pill-neutral-bg: #ebedee; --pill-neutral-ink: #353736;
  --radius-card: 8px;
  --radius-control: 6px;
  --radius-sheet: 16px;
  --gap: 24px;
  --pad: 24px;
  --control-height: 32px;
  --fs-title: 22px;
  --fs-section: 16px;
  --fs-kpi: 28px;
  --fs-body: 14px;
  --fs-small: 12px;
  font-family: "IBM Plex Sans", Inter, system-ui, sans-serif;
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--text);
  background: var(--ground);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
a { color: inherit; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-small); }
[hidden] { display: none !important; }

/* shell */
.topbar { height: 48px; display: flex; align-items: center; gap: 24px; padding: 0 16px 0 20px; flex: none; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 600; font-size: 15px; }
.mark { width: 20px; height: 20px; color: var(--text); }
.nav { display: flex; gap: 4px; height: 100%; }
.nav a { display: flex; align-items: center; padding: 0 10px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px; }
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--text); font-weight: 600; border-bottom-color: var(--text); }
.account { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 600; font-size: 12px; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.sheet { flex: 1; margin: 0 8px 8px 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sheet); padding: var(--pad); min-width: 0; outline: none; }
.sheet.flush { padding: 0; background: transparent; border: 0; margin: 0; display: flex; flex-direction: column; }

/* controls */
.btn { height: var(--control-height); padding: 0 14px; border-radius: var(--radius-control); border: 1px solid var(--control); background: var(--surface); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; white-space: nowrap; transition: background .15s, transform .1s; }
.btn:hover { background: var(--raised); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--text); border-color: var(--text); color: #fff; }
.btn.primary:hover { background: #2c2d30; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--active); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.lg { height: 40px; padding: 0 18px; font-size: 15px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-weight: 500; }
.input, select.input, textarea.input { height: var(--control-height); padding: 0 10px; border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface); width: 100%; }
textarea.input { height: auto; min-height: 96px; padding: 8px 10px; resize: vertical; line-height: 1.5; }
.input:hover { border-color: #b4b5b8; }
.pill { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px; font-size: var(--fs-small); background: var(--pill-neutral-bg); color: var(--pill-neutral-ink); white-space: nowrap; }
.pill.ok { background: var(--pill-positive-bg); color: var(--pill-positive-ink); }
.pill.bad { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.error { color: var(--negative); }

/* title row */
.titlerow { display: flex; align-items: center; gap: 16px; margin-bottom: var(--gap); }
.titlerow h1 { font-size: var(--fs-title); font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.titlerow .actions { margin-left: auto; display: flex; gap: 8px; }
h2 { font-size: var(--fs-section); font-weight: 600; margin: 0 0 12px; }

/* landing */
.landing { display: grid; grid-template-columns: minmax(320px, 5fr) 7fr; gap: var(--gap); min-height: calc(100vh - 106px); }
.landing .pitch { display: flex; flex-direction: column; justify-content: center; padding: 24px 24px 24px 16px; max-width: 520px; }
.landing h1 { font-size: 32px; line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 16px; font-weight: 600; }
.landing .lede { font-size: 16px; margin: 0 0 28px; max-width: 44ch; }
.landing .demo { position: relative; background: var(--well); border-radius: 12px; overflow: hidden; min-height: 420px; }
.demo-caption { position: absolute; left: 16px; bottom: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-control); padding: 6px 10px; font-size: var(--fs-small); }
.steps-list { margin: 36px 0 0; padding: 0; list-style: none; display: grid; gap: 14px; }
.steps-list li { display: grid; grid-template-columns: 140px 1fr; gap: 12px; padding-top: 14px; border-top: 1px solid var(--rule); }
.steps-list b { font-weight: 600; }
#gbtn { min-height: 44px; }

/* projects */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--gap); }
.card { border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; text-decoration: none; display: flex; flex-direction: column; background: var(--surface); transition: border-color .15s; }
.card:hover { border-color: var(--control); }
.card .thumb { aspect-ratio: 16 / 10; background: var(--well); display: grid; place-items: center; overflow: hidden; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.card:hover .thumb img { transform: scale(1.03); }
.card .body { padding: 12px 14px 14px; display: grid; gap: 2px; }
.card .t { font-weight: 600; font-size: 15px; }
.empty { border: 1px dashed var(--control); border-radius: var(--radius-card); padding: 48px 24px; display: grid; gap: 12px; justify-items: start; max-width: 560px; }
.empty h2 { margin: 0; }

/* new room */
.wizard { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 40px; align-items: start; }
.wizard section { padding: 0 0 28px; margin: 0 0 28px; border-bottom: 1px solid var(--rule); }
.wizard section:last-of-type { border-bottom: 0; }
.wizard .hint { margin: -6px 0 12px; color: var(--muted); }
.drop { border: 1px dashed var(--control); border-radius: var(--radius-card); padding: 16px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; min-height: 120px; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.ref { position: relative; width: 120px; height: 88px; border-radius: 6px; overflow: hidden; background: var(--well); }
.ref img { width: 100%; height: 100%; object-fit: cover; }
.ref button { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(19,20,22,.7); color: #fff; cursor: pointer; line-height: 1; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.row2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.openings { width: 100%; border-collapse: collapse; margin: 16px 0 8px; }
.openings th { text-align: left; font-weight: 400; color: var(--muted); font-size: var(--fs-small); padding: 0 8px 6px 0; }
.openings td { padding: 4px 8px 4px 0; border-top: 1px solid var(--rule); }
.openings .input { min-width: 64px; }
.aside { position: sticky; top: 16px; border: 1px solid var(--border); border-radius: var(--radius-card); padding: 20px; display: grid; gap: 16px; }
.plan { background: var(--well); border-radius: 6px; padding: 12px; }
.plan svg { width: 100%; height: auto; display: block; }
.facts { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

/* builder */
.bbar { height: 44px; display: flex; align-items: center; gap: 12px; padding: 0 12px 0 8px; }
.bbar .title { font-size: 16px; font-weight: 600; border: 1px solid transparent; background: transparent; border-radius: var(--radius-control); padding: 2px 6px; min-width: 120px; max-width: 360px; }
.bbar .title:hover, .bbar .title:focus { border-color: var(--control); background: var(--surface); }
.bbar .right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.bbar .divider { width: 1px; height: 20px; background: var(--border); }
.builder { flex: 1; display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 12px; padding: 0 8px 8px; min-height: 0; height: calc(100vh - 92px); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sheet); min-height: 0; overflow: auto; }
.panel-pad { padding: 16px; }
.canvaswrap { position: relative; background: var(--well); border: 1px solid var(--border); border-radius: var(--radius-sheet); overflow: hidden; min-height: 320px; }
.canvas { position: absolute; inset: 0; }
.overlay { position: absolute; display: flex; gap: 6px; }
.overlay.tl { top: 16px; left: 16px; }
.overlay.br { bottom: 16px; right: 16px; }
.overlay .btn { background: var(--surface); }
.seg { display: inline-flex; border: 1px solid var(--control); border-radius: var(--radius-control); overflow: hidden; background: var(--surface); }
.seg button { height: 30px; padding: 0 12px; border: 0; background: transparent; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--text); color: #fff; }

.budget { padding: 16px 16px 18px; border-bottom: 1px solid var(--rule); }
.budget .fig { font-size: var(--fs-kpi); font-weight: 400; line-height: 1.1; font-variant-numeric: tabular-nums; }
.budget .line { margin: 4px 0 12px; }
.strip { position: relative; height: 20px; display: flex; gap: 2px; border-radius: 4px; background: var(--raised); }
.strip span { display: block; height: 100%; background: var(--accent); opacity: .85; min-width: 2px; transition: flex-basis .3s; cursor: pointer; }
.strip span:first-child { border-radius: 4px 0 0 4px; }
.strip span.sel { opacity: 1; background: #0f4655; }
.strip .cap { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--text); }
.strip.over span { background: var(--negative); }

.items { list-style: none; margin: 0; padding: 4px 0 16px; }
.item { border-bottom: 1px solid var(--rule); }
.item > button { all: unset; box-sizing: border-box; width: 100%; display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: center; padding: 10px 16px; cursor: pointer; }
.item > button:hover { background: var(--raised); }
.item > button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.item.sel > button { background: var(--raised); }
.swatch { width: 12px; height: 12px; border-radius: 3px; border: 1px solid rgba(0,0,0,.12); }
.item .name { font-weight: 500; }
.item .sub { color: var(--muted); font-size: var(--fs-small); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 210px; }
.item .price { font-variant-numeric: tabular-nums; text-align: right; }
.options { display: grid; gap: 8px; padding: 4px 16px 16px; }
.opt { display: grid; grid-template-columns: 64px 1fr; gap: 12px; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-card); cursor: pointer; background: var(--surface); text-align: left; transition: border-color .15s; }
.opt:hover { border-color: var(--control); }
.opt[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.opt img { width: 64px; height: 64px; object-fit: contain; background: #fff; border-radius: 4px; }
.opt .tier { font-size: var(--fs-small); color: var(--muted); display: flex; justify-content: space-between; }
.opt .ptitle { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px; line-height: 1.35; }
.opt .meta { display: flex; justify-content: space-between; align-items: baseline; margin-top: 2px; }
.opt .meta a { font-size: var(--fs-small); color: var(--accent); }
.itemtools { display: flex; gap: 6px; padding: 0 16px 14px; }

.progress { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(241,242,240,.85); }
.progress ol { list-style: none; padding: 20px 24px; margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); display: grid; gap: 10px; min-width: 300px; box-shadow: 0 8px 24px rgba(0,0,0,.06); }
.progress li { display: flex; gap: 10px; align-items: center; color: var(--muted); }
.progress li.doing { color: var(--text); font-weight: 500; }
.progress li.done { color: var(--text); }
.dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--control); flex: none; }
.doing .dot { border-color: var(--accent); border-right-color: transparent; animation: spin .8s linear infinite; }
.done .dot { background: var(--accent); border-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

dialog { border: 1px solid var(--border); border-radius: 12px; padding: 0; width: min(720px, 94vw); box-shadow: 0 16px 48px rgba(0,0,0,.14); }
dialog::backdrop { background: rgba(19,20,22,.35); }
dialog header { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--rule); }
dialog header h2 { margin: 0; }
dialog header .btn { margin-left: auto; }
.list { width: 100%; border-collapse: collapse; }
.list th { text-align: left; font-weight: 400; color: var(--muted); font-size: var(--fs-small); padding: 10px 20px 6px; }
.list td { padding: 10px 20px; border-top: 1px solid var(--rule); vertical-align: middle; }
.list td.r, .list th.r { text-align: right; font-variant-numeric: tabular-nums; }
.list tfoot td { font-weight: 600; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: 10px 16px; border-radius: var(--radius-control); box-shadow: 0 8px 24px rgba(0,0,0,.2); z-index: 10; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

@media (max-width: 900px) {
  .landing, .wizard { grid-template-columns: 1fr; }
  .landing .demo { min-height: 320px; order: -1; }
  .aside { position: static; }
  .builder { grid-template-columns: 1fr; grid-template-rows: 55vh auto; height: auto; }
  .builder .panel { order: 2; }
  .row3 { grid-template-columns: 1fr 1fr; }
  .nav a { padding: 0 6px; }
  .account .who { display: none; }
  .bbar .hide-sm { display: none; }
}
@media (max-width: 480px) {
  .sheet { margin: 0; border-radius: 0; border-left: 0; border-right: 0; padding: 16px; }
  .steps-list li { grid-template-columns: 1fr; gap: 2px; }
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.demo > canvas, .canvas > canvas { position: absolute; inset: 0; display: block; }
