/* brand fonts, served with the site (Fontshare's CSS API was returning the wrong family for Gambetta) */
@font-face { font-family: 'Satoshi'; src: url('fonts/Satoshi-Regular.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Satoshi'; src: url('fonts/Satoshi-Medium.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Satoshi'; src: url('fonts/Satoshi-Bold.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Gambetta'; src: url('fonts/Gambetta-Medium.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Gambetta'; src: url('fonts/Gambetta-Semibold.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
:root {
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.8125rem);
  --text-sm: clamp(0.8125rem, 0.78rem + 0.2vw, 0.9rem);
  --text-base: clamp(0.9375rem, 0.9rem + 0.2vw, 1rem);
  --text-lg: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
  --text-xl: clamp(1.375rem, 1.2rem + 0.8vw, 1.75rem);
  --space-1: .25rem; --space-2: .5rem; --space-3: .75rem; --space-4: 1rem;
  --space-5: 1.25rem; --space-6: 1.5rem; --space-8: 2rem; --space-10: 2.5rem;

  /* BellaDesign palette: dark royal blue + gold (Sotheby's-style), on warm ivory */
  --navy: #002349;
  --navy-2: #0c3566;          /* hover on navy */
  --navy-ink: #ffffff;
  --gold: #957c3d;            /* rules, outlines, plan markers (graphics, 4:1 on white) */
  --gold-ink: #7a6530;        /* gold text on light backgrounds (5.2:1) */
  --gold-light: #c9b37a;      /* gold on navy (7.6:1) */
  --gold-soft: #f3eedf;

  --paper: #f8f6f1;
  --paper-2: #efebe2;
  --surface: #ffffff;
  --line: #e2dccf;
  --line-strong: #c4bba8;
  --ink: #1b2433;
  --ink-2: #4a5466;
  --ink-3: #6b7385;
  --accent: var(--navy);
  --accent-ink: var(--navy-ink);
  --accent-soft: var(--gold-soft);
  --ok: oklch(0.55 0.11 150);
  --err: oklch(0.52 0.17 25);

  --font-body: 'Satoshi', 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Gambetta', Georgia, serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --radius: 6px;
  --radius-lg: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font-body); font-size: var(--text-base); color: var(--ink);
  background: var(--paper); -webkit-font-smoothing: antialiased; min-height: 100dvh;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
button, input, select, textarea { font: inherit; color: inherit; }
h2 { font-size: var(--text-sm); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; margin: 0; }

/* top bar */
.topbar {
  display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap;
  padding: var(--space-3) var(--space-5); border-bottom: 1px solid var(--line);
  background: var(--surface); position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: baseline; gap: var(--space-3); }
.wordmark { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 600; letter-spacing: -.01em; }
.tag { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--ink-3); }
.project-name {
  flex: 1 1 200px; max-width: 320px; border: 1px solid transparent; background: transparent;
  padding: var(--space-2) var(--space-3); border-radius: var(--radius); font-weight: 500;
}
.project-name:hover, .project-name:focus { border-color: var(--line); background: var(--paper); outline: none; }
.top-actions { display: flex; gap: var(--space-2); align-items: center; margin-left: auto; flex-wrap: wrap; }
.select-wrap select { max-width: 270px; }

.btn {
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--radius);
  padding: var(--space-2) var(--space-4); font-size: var(--text-sm); font-weight: 500; cursor: pointer;
  transition: background .15s, border-color .15s; white-space: nowrap;
}
.btn:hover { background: var(--paper-2); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { background: var(--navy-2); border-color: var(--navy-2); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--paper-2); }
.btn.small { padding: var(--space-1) var(--space-3); font-size: var(--text-xs); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }

/* layout */
.layout { display: grid; grid-template-columns: minmax(320px, 380px) 1fr; min-height: calc(100dvh - 60px); }
.panel { border-right: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; min-width: 0; }
.tabs { display: flex; flex-wrap: wrap; gap: 2px; padding: var(--space-2) var(--space-3) 0; border-bottom: 1px solid var(--line); }
.tabs button {
  border: 0; background: none; padding: var(--space-2) var(--space-3); font-size: var(--text-sm);
  color: var(--ink-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button[aria-selected="true"] { color: var(--navy); border-bottom-color: var(--gold); font-weight: 700; }
.tab-body { padding: var(--space-4) var(--space-5) var(--space-10); overflow-y: auto; flex: 1; max-height: calc(100dvh - 110px); }

.group { margin-bottom: var(--space-6); }
.group > h3 { font-size: var(--text-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 var(--space-3); }
.row { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); margin-bottom: var(--space-3); }
.field { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.field > span { font-size: var(--text-xs); color: var(--ink-2); }
.field input, .field select, .field textarea, .select-wrap select {
  width: 100%; border: 1px solid var(--line); background: var(--paper); border-radius: var(--radius);
  padding: var(--space-2) var(--space-2); font-size: var(--text-sm); min-width: 0;
}
.field input[type="number"] { font-family: var(--font-mono); }
.field input[type="color"] { padding: 2px; height: 36px; }
.field textarea { resize: vertical; min-height: 64px; }
.check { display: flex; gap: var(--space-2); align-items: center; font-size: var(--text-sm); color: var(--ink-2); cursor: pointer; }

.item {
  border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-3);
  margin-bottom: var(--space-3); background: var(--paper);
}
.item.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.item-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-bottom: var(--space-2); }
.item-head strong { font-size: var(--text-sm); }
.item-head .meta { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--ink-3); }
.add-row { display: flex; gap: var(--space-2); }
.add-row select { flex: 1; }
.note { font-size: var(--text-xs); color: var(--ink-2); line-height: 1.5; margin: 0 0 var(--space-3); }

.slot { display: grid; grid-template-columns: 64px 1fr; gap: var(--space-3); }
.thumb {
  width: 64px; height: 64px; border-radius: var(--radius); border: 1px dashed var(--line-strong);
  background: var(--paper-2) center/cover no-repeat; display: grid; place-items: center;
  font-size: var(--text-xs); color: var(--ink-3); text-align: center;
}
.vendor-links { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); font-size: var(--text-xs); margin-top: var(--space-1); }
.vendor-links a { color: var(--navy); text-decoration: none; }
.vendor-links a:hover { text-decoration: underline; }

/* stage */
.stage { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-5); min-width: 0; }
.explore { display: grid; grid-template-columns: 1.5fr 1fr; gap: var(--space-5); }
.viewport-card, .view-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line); gap: var(--space-2); }
.hint { font-size: var(--text-xs); color: var(--ink-3); }
.explorer { flex: 1; min-height: 340px; background: var(--paper-2); position: relative; }
.webgl-msg { padding: var(--space-6); font-size: var(--text-sm); color: var(--ink-2); }
.explorer canvas { display: block; width: 100% !important; height: 100% !important; }
.plan { flex: 1; display: grid; place-items: center; padding: var(--space-3); min-height: 240px; }
.plan svg { width: 100%; height: 100%; max-height: 420px; touch-action: none; -webkit-user-select: none; user-select: none; }
.plan .prot:active { cursor: grabbing; }

.views-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-3); }
.view-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-5); }
.view-card .card-head h2 { display: flex; gap: var(--space-2); align-items: baseline; }
.deg { font-family: var(--font-mono); font-weight: 500; color: var(--gold-ink); letter-spacing: 0; }
.facing { font-size: var(--text-xs); color: var(--ink-3); text-transform: none; letter-spacing: 0; font-weight: 400; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.seg button { border: 0; background: none; padding: var(--space-1) var(--space-3); font-size: var(--text-xs); cursor: pointer; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--navy); color: var(--navy-ink); }
.seg button:disabled { opacity: .4; cursor: not-allowed; }
.frame { position: relative; aspect-ratio: 4 / 3; background: var(--paper-2); }
.frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.frame .status {
  position: absolute; inset: auto var(--space-3) var(--space-3) var(--space-3);
  background: rgb(0 35 73 / .85); color: #fff; padding: var(--space-2) var(--space-3);
  border-radius: var(--radius); font-size: var(--text-xs); display: none;
}
.frame .status.show { display: block; }
.frame .status.err { background: oklch(0.45 0.15 25 / .92); }
.frame.busy::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, oklch(1 0 0 / .35) 50%, transparent 70%);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }
@media (prefers-reduced-motion: reduce) { .frame.busy::after { animation: none; } }
.card-foot { display: flex; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-top: 1px solid var(--line); flex-wrap: wrap; align-items: center; }
.card-foot .meta { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--ink-3); margin-left: auto; }

.toast {
  position: fixed; bottom: var(--space-5); left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--navy); color: #fff; border-bottom: 2px solid var(--gold); padding: var(--space-3) var(--space-5); border-radius: var(--radius);
  font-size: var(--text-sm); opacity: 0; pointer-events: none; transition: all .2s; z-index: 50; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 1100px) {
  .explore { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .tab-body { max-height: none; }
  .view-grid { grid-template-columns: 1fr; }
  .stage { padding: var(--space-3); }
  .topbar { padding: var(--space-3); position: static; }
  .top-actions { margin-left: 0; width: 100%; }
  .select-wrap { flex: 1 1 100%; }
  .select-wrap select { max-width: none; }
  .project-name { max-width: none; }
}

/* Sherwin-Williams color picker */
.sw-field { margin-bottom: var(--space-3); }
.sw-btn {
  display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: var(--space-3);
  width: 100%; text-align: left; border: 1px solid var(--line); background: var(--paper);
  border-radius: var(--radius); padding: var(--space-2); cursor: pointer;
}
.sw-btn:hover { border-color: var(--line-strong); }
.sw-btn[aria-expanded="true"] { border-color: var(--accent); }
.chip { width: 36px; height: 36px; border-radius: 4px; border: 1px solid oklch(0 0 0 / .12); display: inline-block; flex: none; }
.sw-name { display: flex; flex-direction: column; min-width: 0; }
.sw-name strong { font-size: var(--text-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sw-code { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--ink-3); }
.sw-caret { color: var(--ink-3); font-size: var(--text-xs); }
.sw-picker { border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); padding: var(--space-3); background: var(--surface); margin-top: -2px; }
.sw-search { width: 100%; border: 1px solid var(--line); background: var(--paper); border-radius: var(--radius); padding: var(--space-2); font-size: var(--text-sm); }
.sw-fams { display: flex; flex-wrap: wrap; gap: var(--space-1); margin: var(--space-2) 0; }
.sw-fams button { border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 2px var(--space-3); font-size: var(--text-xs); cursor: pointer; color: var(--ink-2); }
.sw-fams button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.sw-results { max-height: 320px; overflow-y: auto; }
.sw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: var(--space-2); }
.sw-swatch { display: flex; flex-direction: column; gap: 2px; border: 1px solid transparent; background: none; padding: 3px; border-radius: var(--radius); cursor: pointer; text-align: left; min-width: 0; }
.sw-swatch:hover { border-color: var(--line-strong); }
.sw-swatch.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.sw-swatch .chip { width: 100%; height: 44px; }
.sw-n { font-size: var(--text-xs); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sw-c { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--ink-3); }
.sw-count { margin: var(--space-2) 0 0; }
.sw-count a, .paint-list a { color: var(--navy); }
.paint-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.paint-list li { display: grid; grid-template-columns: 28px 1fr auto; gap: var(--space-2); align-items: center; font-size: var(--text-sm); }
.paint-list .chip { width: 28px; height: 28px; }

/* Pella / Andersen window picker */
.win-field { margin-top: var(--space-3); }
.win-btn { display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: var(--space-3); width: 100%; text-align: left; border: 1px solid var(--line); background: var(--paper); border-radius: var(--radius); padding: var(--space-2); cursor: pointer; }
.win-btn:hover { border-color: var(--line-strong); }
.win-btn[aria-expanded="true"] { border-color: var(--accent); }
.win-thumb { width: 48px; height: 48px; display: grid; place-items: center; background: oklch(0.86 0.04 235); border-radius: 4px; overflow: hidden; font-size: var(--text-xs); color: var(--ink-3); }
.win-thumb img { max-width: 44px; max-height: 44px; object-fit: contain; }
.win-thumb.sm { width: 28px; height: 28px; }
.win-thumb.sm img { max-width: 26px; max-height: 26px; }
.win-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: var(--space-2); }
.win-card { display: flex; flex-direction: column; gap: 2px; border: 1px solid transparent; background: none; padding: 4px; border-radius: var(--radius); cursor: pointer; text-align: left; min-width: 0; }
.win-card:hover { border-color: var(--line-strong); }
.win-card.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.win-img { height: 96px; display: grid; place-items: center; background: oklch(0.86 0.04 235); border-radius: 4px; }
.win-img { overflow: hidden; }
.win-img img { max-width: 100px; max-height: 86px; width: auto; height: auto; object-fit: contain; }
.win-img.generic { font-size: var(--text-xs); color: var(--ink-3); }
.win-card .sw-n { white-space: normal; font-weight: 600; }
.win-card .sw-c { font-family: var(--font-body); white-space: normal; line-height: 1.25; }
.win-custom { border-top: 1px solid var(--line); margin-top: var(--space-3); padding-top: var(--space-3); }
.win-custom input { width: 100%; border: 1px solid var(--line); background: var(--paper); border-radius: var(--radius); padding: var(--space-2); font-size: var(--text-sm); min-width: 0; }
.win-custom .row { display: grid; grid-template-columns: 1fr auto; gap: var(--space-2); align-items: center; }
.win-pictured { margin: var(--space-2) 0; }
.win-pictured a { color: var(--navy); }
.fit { margin: 0; padding: var(--space-2) 0; font-size: var(--text-xs); color: var(--ink-2); }

/* Lumber Liquidators flooring */
.fl-thumb img, .fl-img img { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; }
.fl-img { height: 96px; overflow: hidden; }
.fl-info { margin-top: var(--space-3); }
.fl-room { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius); display: block; }
.fl-specs { display: grid; grid-template-columns: auto 1fr; gap: 4px var(--space-3); margin: var(--space-3) 0; font-size: var(--text-xs); }
.fl-specs dt { color: var(--ink-3); }
.fl-specs dd { margin: 0; color: var(--ink-2); }
.fl-info .note a { color: var(--navy); }

/* Carpet picker */
.cp-mosaic { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 1px; padding: 0; background: var(--line); }
.cp-mosaic img { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; }
.cp-style-head { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; font-size: var(--text-xs); margin-bottom: var(--space-2); }
.cp-colors { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: var(--space-2); }
.cp-chip { display: flex; flex-direction: column; gap: 2px; background: none; border: 1px solid transparent; border-radius: var(--radius); padding: 3px; cursor: pointer; text-align: left; min-width: 0; }
.cp-chip img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 3px; display: block; }
.cp-chip span { font-size: 11px; line-height: 1.2; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-chip:hover { border-color: var(--line-strong); }
.cp-chip.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

/* Lighting picker */
.lt-thumb { background: #f4f1ec; }
.lt-thumb img, .lt-img img { object-fit: contain; }
.lt-img { background: #f4f1ec; padding: 6px; }
.lt-img img { width: 100%; height: 100%; }
.lt-fins { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: var(--space-2); margin-bottom: var(--space-2); }
.lt-fin img { object-fit: contain; background: #f4f1ec; }

/* Drapes */
.dr-swatches { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dr-sw { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line-strong); cursor: pointer; padding: 0; }
.dr-sw.on { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--accent); }
.dr-custom { width: 26px; height: 26px; border-radius: 50%; overflow: hidden; border: 1px dashed var(--line-strong); display: inline-block; position: relative; background: conic-gradient(#e66, #ec6, #6c6, #6ce, #66e, #e6e, #e66); }
.dr-custom input { opacity: 0; width: 100%; height: 100%; cursor: pointer; border: 0; padding: 0; }

/* ---------------- sign-in, account menu, dialogs ---------------- */
.auth-gate { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: var(--space-4);
  background: radial-gradient(1100px 650px at 18% 8%, #0c3566, transparent 62%), radial-gradient(900px 600px at 90% 100%, rgb(149 124 61 / .22), transparent 60%), var(--navy); }
.auth-gate[hidden] { display: none; }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--gold); border-radius: 14px;
  padding: var(--space-8) var(--space-8) var(--space-6); box-shadow: 0 18px 50px rgb(0 35 73 / .12); display: grid; gap: var(--space-3); }
.auth-brand { display: flex; align-items: baseline; gap: var(--space-2); flex-wrap: wrap; }
.auth-title { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 600; margin: var(--space-2) 0 0; color: var(--ink); }
.auth-msg { margin: 0; padding: var(--space-2) var(--space-3); background: var(--gold-soft); border-left: 3px solid var(--gold); border-radius: 8px; font-size: var(--text-sm); color: var(--ink); }
.auth-msg[hidden] { display: none; }
.auth-err { margin: 0; min-height: 1.2em; color: var(--err); font-size: var(--text-sm); }
.auth-err:empty { min-height: 0; }
.auth-submit { width: 100%; justify-content: center; padding-block: var(--space-3); font-size: var(--text-base); }
.auth-foot { margin: 0; color: var(--ink-3); font-size: var(--text-xs); text-align: center; }
.auth-card .field, .auth-dialog .field { display: grid; gap: var(--space-1); font-size: var(--text-sm); color: var(--ink-2); }
.auth-card .field input, .auth-dialog .field input, .auth-dialog .field select { width: 100%; padding: var(--space-2) var(--space-3); border: 1px solid var(--line-strong);
  border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-size: var(--text-base); }
.auth-card .check { display: flex; gap: var(--space-2); align-items: center; font-size: var(--text-sm); color: var(--ink-2); }

.acct { position: relative; }
.acct[hidden] { display: none; }
.acct-btn { display: inline-flex; gap: var(--space-2); align-items: center; white-space: nowrap; }
.acct-btn .credits { font-size: var(--text-xs); padding: 1px var(--space-2); border-radius: 999px; background: var(--paper-2); color: var(--ink-2); border: 1px solid var(--line); }
.acct-btn .credits.low { background: oklch(0.95 0.04 25); color: var(--err); border-color: oklch(0.85 0.06 25); }
.acct-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 270px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 14px 34px rgb(0 35 73 / .16); padding: var(--space-2); display: grid; }
.acct-menu[hidden] { display: none; }
.acct-menu button { text-align: left; background: none; border: 0; padding: var(--space-2) var(--space-3); border-radius: 6px; font: inherit; font-size: var(--text-sm); color: var(--ink); cursor: pointer; }
.acct-menu button:hover, .acct-menu button:focus-visible { background: var(--paper-2); outline: none; }
.acct-menu button[hidden] { display: none; }
.acct-info { display: grid; gap: 2px; padding: var(--space-2) var(--space-3) var(--space-3); margin-bottom: var(--space-1); border-bottom: 1px solid var(--line); font-size: var(--text-xs); color: var(--ink-2); }
.acct-info strong { font-size: var(--text-sm); color: var(--ink); }

.auth-dialog { border: 1px solid var(--line); border-radius: 12px; padding: var(--space-6); width: min(440px, calc(100vw - 2rem)); background: var(--surface); color: var(--ink);
  box-shadow: 0 24px 60px rgb(0 35 73 / .22); }
.auth-dialog.wide { width: min(860px, calc(100vw - 2rem)); }
.auth-dialog::backdrop { background: rgb(0 35 73 / .35); }
.auth-dialog h2 { font-family: var(--font-display); font-size: var(--text-lg); margin: 0 0 var(--space-2); }
.auth-dialog h3 { font-size: var(--text-sm); margin: var(--space-4) 0 var(--space-2); }
.auth-dialog form { display: grid; gap: var(--space-3); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); }
.dlg-actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-2); }
.dlg-actions [hidden] { display: none; }
.design-list, .user-list { max-height: 55vh; overflow: auto; }
.auth-dialog table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.auth-dialog th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: var(--text-xs); padding: var(--space-2); border-bottom: 1px solid var(--line); }
.auth-dialog td { padding: var(--space-2); border-bottom: 1px solid var(--line); vertical-align: middle; }
.auth-dialog tr.off td { color: var(--ink-3); }
td.row-acts { text-align: right; white-space: nowrap; }
td.row-acts .btn + .btn { margin-left: var(--space-1); }
.add-user { border-top: 1px solid var(--line); margin-top: var(--space-3); }
.add-user-row { display: grid; grid-template-columns: 2fr 1.5fr 1fr auto; gap: var(--space-2); align-items: end; }
@media (max-width: 640px) { .add-user-row { grid-template-columns: 1fr; } }
.temp-pw { display: flex; gap: var(--space-2); align-items: center; margin: var(--space-2) 0; }
.temp-pw code { font-family: var(--font-mono); font-size: var(--text-lg); padding: var(--space-2) var(--space-3); background: var(--paper-2); border-radius: 8px; user-select: all; letter-spacing: .04em; }
.auth-on #importBtn, .auth-on #exportBtn { display: none; }
.acct-info span { overflow-wrap: anywhere; }
/* account menu pinned to the top-right corner of the page header */
.auth-on .topbar { padding-right: calc(var(--space-5) + var(--acct-w, 250px)); }
.topbar .acct { position: absolute; top: var(--space-3); right: var(--space-5); z-index: 30; }
.topbar .acct .acct-btn { min-height: 38px; }
@media (max-width: 860px) {
  .topbar { position: relative; }
  .auth-on .topbar { padding-right: var(--space-3); padding-top: calc(var(--space-3) + 48px); }
  .topbar .acct { right: var(--space-3); }
}

/* ---------------- 360° view ---------------- */
.pano-actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin-left: auto; }
.pano-status { font-size: var(--text-xs); color: var(--ink-3); max-width: 34ch; }
.pano-hint { margin: calc(-1 * var(--space-2)) 0 var(--space-3); text-align: right; font-size: var(--text-xs); color: var(--ink-3); }
.pano-hint[hidden] { display: none; }
.pano-status.err { color: oklch(0.5 0.17 28); }
.pano-overlay { position: fixed; inset: 0; z-index: 1000; background: #111; }
.pano-overlay[hidden] { display: none; }
.pano-overlay iframe { width: 100%; height: 100%; border: 0; display: block; }
body.pano-open { overflow: hidden; }

/* ---- navy header with gold rule ---- */
.topbar { background: var(--navy); color: var(--navy-ink); border-bottom: 0; box-shadow: inset 0 -2px 0 var(--gold); }
.topbar .wordmark { color: #fff; }
.topbar .select-wrap select, .topbar .project-name { background-color: rgb(255 255 255 / .07); border: 1px solid rgb(255 255 255 / .22); color: #fff; }
.topbar .select-wrap select option { color: var(--ink); background: #fff; }
.topbar .select-wrap select:hover, .topbar .project-name:hover, .topbar .project-name:focus { border-color: var(--gold-light); background-color: rgb(255 255 255 / .12); }
.topbar .project-name::placeholder { color: rgb(255 255 255 / .6); }
.topbar .btn { background: transparent; color: #fff; border-color: rgb(255 255 255 / .35); }
.topbar .btn:hover { background: rgb(255 255 255 / .1); }
.topbar .btn.primary { background: var(--gold); border-color: var(--gold); color: #fff; font-weight: 600; text-shadow: 0 1px 0 rgb(0 0 0 / .18); }
.topbar .btn.primary:hover { background: #a68a45; border-color: #a68a45; }
.topbar .btn.ghost { border-color: transparent; }
.topbar .acct-btn .credits { background: transparent; color: var(--gold-light); border-color: rgb(201 179 122 / .55); }
.topbar .acct-btn .credits.low { background: oklch(0.95 0.04 25); color: var(--err); border-color: oklch(0.85 0.06 25); }
.topbar .acct-menu { color: var(--ink); }
.topbar :focus-visible { outline-color: var(--gold-light); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.topbar .select-wrap select { color-scheme: dark; }

/* logo (Option C: Allura "Bella" in gold, DESIGN STUDIO in Satoshi) */
.brand .logo { display: block; height: 44px; width: auto; }
.auth-brand .logo { display: block; height: 64px; width: auto; margin-bottom: var(--space-1); }
@media (max-width: 860px) { .brand .logo { height: 38px; } }

/* client chip in the header: which client the current design is filed under (click to change) */
.client-chip { flex: 0 1 auto; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: var(--space-1) var(--space-3); min-height: 30px; border-radius: 999px; font-size: var(--text-xs); font-weight: 600; letter-spacing: .02em;
  background: rgb(201 179 122 / .16); color: var(--gold-light); border: 1px solid rgb(201 179 122 / .5); cursor: pointer; }
.client-chip:hover { background: rgb(201 179 122 / .26); }
.client-chip.empty { background: transparent; color: rgb(255 255 255 / .7); border-style: dashed; border-color: rgb(255 255 255 / .35); font-weight: 500; }
.client-chip[hidden] { display: none; }
.client-chip + .project-name { margin-left: calc(-1 * var(--space-2)); }

/* clients and save dialogs */
.auth-dialog.mid { width: min(620px, calc(100vw - 2rem)); }
.auth-dialog .field textarea { width: 100%; padding: var(--space-2) var(--space-3); border: 1px solid var(--line-strong); border-radius: var(--radius); font: inherit; color: var(--ink); background: var(--paper); resize: vertical; }
.cf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.cf-grid .cf-wide { grid-column: 1 / -1; }
.cf-pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.cf-prices { border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-3) var(--space-4); margin: 0; display: grid; gap: var(--space-2); background: var(--gold-soft); }
.cf-prices legend { font-size: var(--text-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--gold-ink); padding: 0 var(--space-1); }
.cf-markup { max-width: 220px; }
.cf-pct { display: flex; align-items: center; gap: var(--space-2); }
.cf-pct input { max-width: 110px; }
.cf-pct input:disabled { opacity: .5; }
.cf-prices .note { margin: 0; }
.dlg-head-acts { display: flex; gap: var(--space-2); }
.dlg-filter { display: flex; align-items: end; gap: var(--space-4); margin: var(--space-2) 0 var(--space-3); }
.dlg-filter .field { min-width: 240px; }
.dlg-filter .note { margin: 0 0 var(--space-2); }
.sd-client-info { margin: calc(-1 * var(--space-2)) 0 0; }
.row-acts { white-space: nowrap; text-align: right; }
.row-acts .btn + .btn { margin-left: var(--space-1); }
@media (max-width: 560px) { .cf-grid { grid-template-columns: 1fr; } .dlg-filter { flex-direction: column; align-items: stretch; } }
/* keep the header on one row with the client chip */
.topbar #roomKind { max-width: 180px; }
.topbar #modelSelect { max-width: 230px; }
.topbar .project-name { flex: 1 1 150px; max-width: 280px; min-width: 120px; }
.topbar { gap: var(--space-3); }

/* ---------- client gallery dialog ---------- */
#galleryForm { display: grid; gap: var(--space-3); }
#galleryForm .note { margin: 0; }
.gd-link { border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-3); display: grid; gap: var(--space-2); background: var(--gold-soft); }
.gd-status { font-size: var(--text-sm); color: var(--ink-2); display: flex; align-items: center; gap: var(--space-2); }
.gd-dot { width: 8px; height: 8px; border-radius: 50%; background: #2f8a57; box-shadow: 0 0 0 3px rgb(47 138 87 / .18); }
.gd-link-row { display: flex; gap: var(--space-2); align-items: center; }
.gd-link-row input { flex: 1; min-width: 0; font: inherit; font-size: var(--text-xs); padding: .45rem .6rem; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink); }
.gd-link-row .btn { text-decoration: none; }
.gd-rooms { border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-3) var(--space-4); margin: 0; display: grid; gap: var(--space-2); }
.gd-rooms legend { font-size: var(--text-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--gold-ink); padding: 0 var(--space-1); }
.gd-room-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: 34vh; overflow: auto; }
.gd-room-list li { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-2) 0; border-top: 1px solid var(--line); }
.gd-room-list li:first-child { border-top: 0; }
.gd-room-list li.is-empty strong { color: var(--ink-3); }
.gd-room-list .check { align-items: flex-start; }
.gd-room-list .check input { margin-top: .2rem; }
.gd-move { display: flex; gap: 2px; flex: none; }
.gd-move .btn.icon { min-width: 30px; padding-inline: 0; justify-content: center; }
.gd-opts { display: flex; gap: var(--space-4); flex-wrap: wrap; }
.gd-actions { justify-content: space-between; }
.gd-danger { display: flex; gap: var(--space-1); }
#galleryDialog [hidden] { display: none !important; }
#galleryDialog a.btn { color: var(--navy); }
#galleryDialog a.btn:hover { color: var(--navy); }

/* ---------- client feedback (gallery comments and approvals) ---------- */
.badge { display: inline-grid; place-items: center; min-width: 1.35em; height: 1.35em; padding: 0 .35em; border-radius: 999px; background: #b4432b; color: #fff; font-size: .72rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; margin-left: .3em; vertical-align: .05em; }
.btn.has-new { border-color: #b4432b; }
.acct-btn { position: relative; }
.acct-btn.has-new::after { content: ''; position: absolute; top: 3px; right: 3px; width: 9px; height: 9px; border-radius: 50%; background: #d4553a; box-shadow: 0 0 0 2px var(--navy, #002349); }
.gd-fbline { display: inline-block; margin-top: 2px; }
.gd-ok { color: #2f6b45; font-weight: 600; }
.gd-new { display: inline-block; padding: 0 .45em; border-radius: 999px; background: #fbe6e1; color: #9c3420; font-size: .7rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; vertical-align: .08em; }
.gd-fb { border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-3) var(--space-4); display: grid; gap: var(--space-3); background: var(--surface); }
.gd-fb-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2); }
.gd-fb-head h3 { margin: 0; font-size: var(--text-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--gold-ink); }
#gdFbRooms { display: grid; gap: var(--space-3); max-height: 46vh; overflow: auto; padding-right: 2px; }
.gd-fb-room { display: grid; gap: var(--space-2); padding-top: var(--space-3); border-top: 1px solid var(--line); }
.gd-fb-room:first-child { border-top: 0; padding-top: 0; }
.gd-fb-room h4 { margin: 0; font-size: var(--text-sm); color: var(--navy); }
.gd-appr { margin: 0; font-size: var(--text-xs); display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.gd-appr::before { content: ''; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.gd-appr.ok { color: #2f6b45; } .gd-appr.ok::before { background: #2f8a57; }
.gd-appr.stale { color: #8a5a12; } .gd-appr.stale::before { background: #c58b22; }
.gd-appr.none { color: var(--ink-3); } .gd-appr.none::before { border: 1.5px solid var(--ink-3); width: 6px; height: 6px; }
.gd-cms { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.gd-cm { padding: .5rem .7rem; border-radius: 4px 10px 10px 10px; background: var(--paper); border: 1px solid var(--line); max-width: 92%; }
.gd-cm.mine { justify-self: end; background: var(--gold-soft); border-color: rgb(149 124 61 / .25); border-radius: 10px 4px 10px 10px; }
.gd-cm.new { border-color: #e3a595; box-shadow: inset 3px 0 0 #d4553a; }
.gd-cm-head { display: flex; align-items: center; flex-wrap: wrap; gap: .15rem .5rem; font-size: var(--text-xs); color: var(--ink-3); }
.gd-cm-head strong { color: var(--ink); font-size: var(--text-sm); }
.gd-tag { padding: 0 .4em; border-radius: 999px; background: var(--navy); color: #fff; font-size: .66rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.gd-about { color: var(--gold-ink); font-weight: 600; }
.gd-cm-head time { margin-left: auto; }
.gd-cm .gd-del { min-height: 0; padding: .1rem .45rem; font-size: .7rem; opacity: 0; transition: opacity .15s; }
.gd-cm:hover .gd-del, .gd-cm:focus-within .gd-del { opacity: 1; }
@media (hover: none) { .gd-cm .gd-del { opacity: 1; } }
.gd-cm p { margin: .25rem 0 0; font-size: var(--text-sm); white-space: pre-wrap; overflow-wrap: anywhere; }
.gd-reply { display: grid; gap: 6px; }
.gd-reply textarea { font: inherit; font-size: var(--text-sm); padding: .45rem .6rem; border: 1px solid var(--line); border-radius: var(--radius); resize: vertical; min-height: 52px; background: #fff; color: var(--ink); }
.gd-reply textarea:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: transparent; }
.gd-reply-row { display: flex; gap: var(--space-2); justify-content: flex-end; align-items: center; }
.gd-reply-row select { font: inherit; font-size: var(--text-xs); padding: .35rem .5rem; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink); }
.gd-fb-head .note, .gd-fbline, .gd-fb-room h4 .note { margin: 0; }
