/* =====================================================================
   RoomCraft AI: design system
   RoomCraft brand: primary purple #6A11CB, secondary purple #9D35C2,
   accent orange #FF7A3D, text #1F1F1F, light background #F5F5F7.
   Montserrat for headings and UI, Roboto for body text. Floating panels.
   ===================================================================== */

/* Brand fonts, self-hosted (SIL Open Font License / Apache 2.0) */
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 400 800; font-display: swap; src: url("../fonts/montserrat-latin.woff2") format("woff2"); }
@font-face { font-family: "Roboto"; font-style: normal; font-weight: 300 700; font-display: swap; src: url("../fonts/roboto-latin.woff2") format("woff2"); }
@font-face { font-family: "Roboto"; font-style: italic; font-weight: 300 700; font-display: swap; src: url("../fonts/roboto-italic-latin.woff2") format("woff2"); }

:root {
  /* palette */
  --paper: #F5F5F7;
  --paper-2: #ECEAF2;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-solid: #FFFFFF;
  --surface-2: #FAFAFC;
  --ink: #1F1F1F;
  --ink-2: #3C3946;
  --muted: #6F6A7B;
  --faint: #A9A3B5;
  --line: rgba(74, 52, 120, 0.12);
  --line-2: rgba(74, 52, 120, 0.22);
  --clay: #6A11CB;
  --clay-ink: #520C9E;
  --clay-soft: #F0E7FB;
  --sand: #E4D6F5;
  --sage: #8C9A84;
  --sage-soft: #E7EBE1;
  --olive: #5F6F55;
  --gold: #FF7A3D;
  --warn: #D9480F;
  --warn-soft: #FFE9DE;
  --good: #5F7A55;
  --brand: #6A11CB;
  --brand-2: #9D35C2;
  --accent: #FF7A3D;
  --grad: linear-gradient(100deg, #6A11CB 0%, #9D35C2 48%, #FF7A3D 100%);
  --grad-deep: linear-gradient(140deg, #2A0B52 0%, #4A0F96 55%, #6A11CB 100%);

  /* shape and depth */
  --r-xl: 30px;
  --r-lg: 24px;
  --r-md: 18px;
  --r-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(38, 18, 72, 0.05), 0 4px 12px -6px rgba(38, 18, 72, 0.12);
  --shadow: 0 1px 1px rgba(38, 18, 72, 0.03), 0 10px 24px -12px rgba(38, 18, 72, 0.18), 0 30px 60px -30px rgba(38, 18, 72, 0.22);
  --shadow-lg: 0 2px 4px rgba(38, 18, 72, 0.04), 0 24px 48px -16px rgba(38, 18, 72, 0.28), 0 60px 100px -40px rgba(38, 18, 72, 0.28);
  --ring: 0 0 0 4px rgba(106, 17, 203, 0.16);

  /* type */
  --serif: "Montserrat", "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, system-ui, sans-serif;
  --sans: "Roboto", "Segoe UI", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;

  /* motion */
  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.4, .5, 1);

  --header-h: 76px;
  --gap: 22px;
  --pad-x: 32px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(1100px 620px at 88% -12%, #EDE3FA 0%, rgba(237, 227, 250, 0) 62%),
    radial-gradient(900px 600px at -8% 108%, #FDEBDF 0%, rgba(253, 235, 223, 0) 60%),
    linear-gradient(180deg, #F7F7FA 0%, var(--paper) 40%, #F0EFF5 100%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
/* paper grain, drawn inline so no external asset is needed */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .5; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .36 0 0 0 0 .26 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
body > * { position: relative; z-index: 1; }
body > .topbar { position: sticky; z-index: 40; }
body > .toasts, body > .tabbar { position: fixed; }

h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -0.015em; margin: 0; color: var(--ink); }
h1 { font-size: 35.2px; line-height: 1.02; }
h2 { font-size: 19.2px; line-height: 1.15; }
h3 { font-size: 15.2px; line-height: 1.2; }
h1 em, h2 em { font-style: italic; color: var(--clay); font-weight: 400; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--clay); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--clay-soft); color: var(--ink); }

.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.flip { transform: scaleX(-1); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hint { font-size: 13px; color: var(--muted); }
.eyebrow { display: flex; align-items: center; gap: 10px; font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.eyebrow .sep { width: 18px; height: 1px; background: var(--faint); display: inline-block; }

/* ---------- pills, chips, buttons ---------- */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: .03em; white-space: nowrap; font-family: var(--sans); line-height: 1.5; }
.pill.xs { padding: 0 7px; font-size: 9.5px; line-height: 17px; }
.pill-demo { background: rgba(232, 214, 176, .55); color: #7A5A1E; box-shadow: inset 0 0 0 1px rgba(255, 122, 61, .35); text-transform: uppercase; letter-spacing: .12em; }
.pill-soft { background: rgba(236, 233, 244, .8); color: var(--ink-2); }
.pill-accent { background: var(--clay-soft); color: var(--clay-ink); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface-solid); color: var(--ink);
  font-weight: 600; font-size: 13.5px; letter-spacing: .01em; white-space: nowrap;
  transition: background .25s var(--ease), border-color .25s, transform .25s var(--ease), box-shadow .25s var(--ease), color .2s;
}
.btn:hover { border-color: rgba(74, 52, 120, .38); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0) scale(.98); }
.btn-primary { background: var(--ink); color: #FFFFFF; border-color: var(--ink); box-shadow: 0 10px 22px -12px rgba(31, 22, 48, .7); }
.btn-primary:hover { background: #2A2236; border-color: #2A2236; box-shadow: 0 14px 26px -12px rgba(31, 22, 48, .75); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: rgba(255, 255, 255, .7); border-color: var(--line); box-shadow: none; }
.btn-sm { height: 32px; padding: 0 13px; font-size: 12.5px; }
.btn-sm .ic { width: 15px; height: 15px; }
.btn-glass { background: rgba(255, 255, 255, .5); border-color: rgba(255, 255, 255, .55); color: inherit; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.btn-glass:hover { background: rgba(255, 255, 255, .78); }

.iconbtn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 999px;
  border: 1px solid transparent; background: transparent; color: var(--ink-2);
  transition: background .2s, color .2s, transform .2s var(--ease);
}
.iconbtn:hover { background: rgba(236, 233, 244, .8); color: var(--ink); }
.iconbtn:active { transform: scale(.92); }
.iconbtn:disabled { opacity: .3; cursor: default; background: transparent; transform: none; }
.iconbtn.sm { width: 30px; height: 30px; }
.iconbtn.sm .ic { width: 15px; height: 15px; }
.iconbtn.danger:hover { background: var(--warn-soft); color: var(--warn); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips-scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -4px; padding: 2px 4px 6px; }
.chips-scroll::-webkit-scrollbar { display: none; }
.chip {
  height: 32px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, .7); color: var(--ink-2); font-size: 12.5px; font-weight: 600; white-space: nowrap;
  transition: all .25s var(--ease);
}
.chip span { color: var(--faint); font-weight: 500; margin-left: 3px; }
.chip:hover { border-color: rgba(74, 52, 120, .4); color: var(--ink); background: var(--surface-solid); }
.chip.is-on { background: var(--ink); border-color: var(--ink); color: #FFFFFF; }
.chip.is-on span { color: #BFB3A4; }

/* ---------- top bar ---------- */
.topbar {
  top: 0; height: var(--header-h);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px; padding: 0 var(--pad-x);
  background: rgba(245, 245, 247, .72); backdrop-filter: saturate(1.3) blur(18px); -webkit-backdrop-filter: saturate(1.3) blur(18px);
  border-bottom: 1px solid transparent; transition: box-shadow .35s var(--ease), border-color .35s, background .35s;
}
.topbar.is-scrolled { border-bottom-color: var(--line); box-shadow: 0 10px 30px -22px rgba(38, 18, 72, .45); background: rgba(247, 247, 250, .86); }
.brand { display: flex; align-items: center; gap: 13px; text-decoration: none; color: var(--ink); min-width: 0; justify-self: start; }
.brand-mark { width: 40px; height: 40px; color: var(--clay); flex: none; filter: drop-shadow(0 8px 14px rgba(106, 17, 203, .28)); transition: transform .5s var(--ease-spring); }
.brand:hover .brand-mark { transform: rotate(-6deg) scale(1.05); }
.brand-mark svg { width: 100%; height: 100%; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.brand-name { font-family: var(--serif); font-size: 19.2px; font-weight: 500; letter-spacing: -0.01em; white-space: nowrap; }
.brand-name em { font-style: italic; color: var(--clay); }
.brand-sub { font-size: 10px; letter-spacing: .26em; text-transform: uppercase; color: var(--muted); white-space: nowrap; margin-top: 3px; }

.mainnav { position: relative; display: flex; gap: 2px; padding: 5px; background: rgba(255, 255, 255, .66); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow-sm); }
.nav-ind { position: absolute; left: 0; top: 5px; bottom: 5px; width: 0; border-radius: 999px; background: var(--ink); box-shadow: 0 8px 18px -8px rgba(31, 22, 48, .6); transition: transform .5s var(--ease), width .5s var(--ease), opacity .3s; opacity: 0; }
.navbtn { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 18px; border-radius: 999px; border: 0; background: transparent; color: var(--ink-2); font-weight: 600; font-size: 13.5px; letter-spacing: .01em; transition: color .35s var(--ease); }
.navbtn:hover { color: var(--ink); }
.navbtn[aria-current="page"] { color: #FFFFFF; }

.topbar-actions { display: flex; align-items: center; gap: 2px; justify-self: end; }
.save-state { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-right: 10px; white-space: nowrap; }
.save-state .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--sage); box-shadow: 0 0 0 3px var(--sage-soft); transition: background .3s; }
.save-state.busy .dot { background: var(--gold); box-shadow: 0 0 0 3px #FFE6D9; animation: pulse 1s ease-in-out infinite; }
.save-state.warn .dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.save-state.warn { color: var(--warn); }
@keyframes pulse { 50% { transform: scale(.7); opacity: .6; } }

.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 10px); min-width: 260px; padding: 6px;
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); z-index: 60;
  animation: menuIn .28s var(--ease); transform-origin: top right;
}
@keyframes menuIn { from { opacity: 0; transform: translateY(-6px) scale(.97); } }
.menu button { display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px 12px; border: 0; background: none; border-radius: 12px; text-align: left; font-size: 13.5px; color: var(--ink-2); transition: background .2s, color .2s; }
.menu button:hover { background: var(--surface-2); color: var(--ink); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }

.demo-banner {
  display: flex; align-items: center; gap: 12px; max-width: 1760px; margin: 14px auto 0; width: calc(100% - var(--pad-x) * 2); padding: 8px 8px 8px 14px;
  background: rgba(251, 243, 226, .7); border: 1px solid rgba(255, 122, 61, .28); border-radius: 999px; font-size: 12.5px; color: #6B5A3C;
  animation: fadeDown .6s var(--ease) both;
}
.demo-banner p { flex: 1; }
@keyframes fadeDown { from { opacity: 0; transform: translateY(-8px); } }

/* ---------- layout ---------- */
.app {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--gap);
  padding: var(--gap) var(--pad-x) 56px; align-items: start; max-width: 1760px; margin: 0 auto;
}
.view { display: none; min-width: 0; }
.app[data-view="design"] .view-design { display: grid; }
.app[data-view="mood"] .view-mood { display: block; }
.app[data-view="budget"] .view-budget { display: block; }

.panel {
  background: var(--surface); border: 1px solid rgba(255, 255, 255, .7); border-radius: var(--r-xl);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .8);
  backdrop-filter: blur(20px) saturate(1.1); -webkit-backdrop-filter: blur(20px) saturate(1.1);
}

.view-design { grid-template-columns: 296px minmax(0, 1fr); gap: var(--gap); align-items: start; }

/* entrance motion when a view opens */
@keyframes riseIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.view.is-entering > *, .dashboard.is-entering { animation: riseIn .6s var(--ease) both; }
.view-design.is-entering > .stage { animation-delay: .06s; }
.view.is-entering .fcard, .view.is-entering .mcard, .view.is-entering .mslot, .view.is-entering .kpi { animation: riseIn .55s var(--ease) both; animation-delay: calc(var(--i, 0) * 35ms + 120ms); }
.view.is-entering .kpi:nth-child(2) { --i: 1; } .view.is-entering .kpi:nth-child(3) { --i: 2; } .view.is-entering .kpi:nth-child(4) { --i: 3; }
body.is-ready .dashboard { animation: riseIn .7s var(--ease) .12s both; }
body.is-ready .tools { animation: riseIn .7s var(--ease) both; }

/* ---------- tools panel ---------- */
.tools {
  position: sticky; top: calc(var(--header-h) + var(--gap)); max-height: calc(100vh - var(--header-h) - var(--gap) * 2);
  display: flex; flex-direction: column; overflow: hidden;
}
.seg { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; margin: 14px 14px 0; padding: 4px; background: rgba(236, 233, 244, .7); border-radius: 16px; }
.seg-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; border: 0; border-radius: 12px; background: transparent; font-weight: 600; font-size: 12.5px; color: var(--muted); transition: all .3s var(--ease); }
.seg-btn .ic { width: 15px; height: 15px; }
.seg-btn:hover { color: var(--ink); }
.seg-btn[aria-selected="true"] { background: var(--surface-solid); color: var(--ink); box-shadow: 0 4px 12px -4px rgba(38, 18, 72, .22); }
.tool-pane { padding: 20px 20px 24px; overflow-y: auto; flex: 1; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; animation: fadeIn .35s var(--ease); }
.pane-head { margin-bottom: 16px; }
.pane-head h2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 20px; }
.pane-head p { font-size: 12.5px; color: var(--muted); margin-top: 4px; line-height: 1.45; }
.pane-head.mt { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); }

.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field > span { font-size: 10.5px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.field input[type="text"], .field input[type="number"], .field input[type="url"], .field input[type="email"], .search input {
  height: 44px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line-2); background: rgba(249, 248, 252, .8);
  outline: none; transition: border-color .2s, box-shadow .25s var(--ease), background .2s; width: 100%; min-width: 0;
}
.field input:hover, .search input:hover { border-color: rgba(74, 52, 120, .36); }
.field input:focus, .search input:focus { border-color: var(--clay); background: var(--surface-solid); box-shadow: var(--ring); }
.field.inline { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; }
.field.inline > span { text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 13px; color: var(--ink-2); }
.field.inline input { width: 110px; flex: none; height: 38px; text-align: right; }

.dims { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.dims .field:last-child { grid-column: 1 / -1; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: 14px; background: rgba(249, 248, 252, .8); overflow: hidden; height: 44px; transition: border-color .2s, box-shadow .25s; }
.stepper:focus-within { border-color: var(--clay); box-shadow: var(--ring); }
.stepper input { border: 0 !important; background: transparent !important; box-shadow: none !important; text-align: center; height: 42px !important; padding: 0 4px !important; -moz-appearance: textfield; font-family: var(--serif); font-size: 15.2px; font-weight: 600; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper button { width: 40px; height: 100%; border: 0; background: transparent; display: grid; place-items: center; color: var(--ink-2); flex: none; transition: background .2s; }
.stepper button:hover { background: rgba(236, 233, 244, .9); }
.stepper button:active .ic { transform: scale(.8); }
.stepper button .ic { width: 14px; height: 14px; transition: transform .15s; }
#roomStats { margin: -6px 0 18px; font-family: var(--sans); font-style: italic; font-size: 13.8px; color: var(--muted); }

.check { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--ink-2); cursor: pointer; margin-top: 12px; }
.check input { width: 17px; height: 17px; accent-color: var(--clay); }

.style-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.style-card { text-align: left; padding: 12px; border-radius: 16px; border: 1px solid var(--line); background: rgba(249, 248, 252, .7); display: flex; flex-direction: column; gap: 1px; transition: all .3s var(--ease); }
.style-card:hover { border-color: var(--line-2); transform: translateY(-2px); box-shadow: var(--shadow-sm); background: var(--surface-solid); }
.style-card.is-on { border-color: var(--clay); background: #FBF8FF; box-shadow: var(--ring); }
.style-card strong { font-family: var(--serif); font-size: 13.6px; font-weight: 600; }
.style-card small { color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.style-sw { display: flex; margin-bottom: 9px; }
.style-sw i { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #FBF7F1; margin-right: -6px; box-shadow: 0 1px 3px rgba(0, 0, 0, .12); transition: margin .3s var(--ease); }
.style-card:hover .style-sw i { margin-right: -2px; }

.search { display: flex; align-items: center; position: relative; margin-bottom: 12px; }
.search .ic { position: absolute; left: 14px; color: var(--muted); pointer-events: none; width: 16px; height: 16px; }
.search input { padding-left: 40px; border-radius: 999px; }

/* furniture catalog */
.catalog { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.fcard {
  position: relative; display: flex; flex-direction: column; text-align: left; padding: 6px 6px 11px; border-radius: 18px;
  border: 1px solid var(--line); background: rgba(249, 248, 252, .75); cursor: grab; user-select: none; -webkit-user-select: none;
  touch-action: pan-y; -webkit-touch-callout: none;
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .3s, background .3s;
}
.fcard:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: rgba(255, 255, 255, .9); background: var(--surface-solid); }
.fcard:active { cursor: grabbing; transform: translateY(-1px) scale(.98); }
.fcard.is-source { opacity: .4; transform: scale(.95); }
.fcard-badge { position: absolute; top: 11px; left: 11px; z-index: 1; opacity: .9; }
.fcard-art {
  position: relative; display: grid; place-items: center; height: 92px; border-radius: 13px; margin-bottom: 9px; padding: 14px 12px 18px;
  background: radial-gradient(120% 90% at 50% 20%, #FFFFFF 0%, #F1EFF6 70%, #EDE4D6 100%);
  overflow: hidden;
}
.fcard-art::after { content: ""; position: absolute; left: 22%; right: 22%; bottom: 10px; height: 8px; border-radius: 50%; background: radial-gradient(closest-side, rgba(50, 30, 90, .18), transparent); }
.fcard-art .thumb { position: relative; z-index: 1; width: 100%; height: 100%; max-height: 60px; pointer-events: none; transition: transform .5s var(--ease); }
.fcard:hover .fcard-art .thumb { transform: scale(1.08) rotate(-2deg); }
.fcard-body { display: flex; flex-direction: column; gap: 0; line-height: 1.25; padding: 0 6px; }
.fcard-body strong { font-size: 13px; font-weight: 600; letter-spacing: .005em; }
.fcard-body small { font-size: 11px; color: var(--muted); margin-top: 1px; }
.fcard-body em { font-style: normal; font-family: var(--serif); font-weight: 600; font-size: 13.6px; color: var(--clay-ink); margin-top: 3px; }
.fcard-add {
  position: absolute; right: 10px; bottom: 11px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ink); color: #FFFFFF; opacity: 0; transform: scale(.6) rotate(-90deg); transition: all .35s var(--ease-spring);
}
.fcard-add .ic { width: 14px; height: 14px; stroke-width: 2; }
.fcard:hover .fcard-add, .fcard:focus-visible .fcard-add { opacity: 1; transform: none; }

/* swatches */
.swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.swatches.small { grid-template-columns: repeat(5, 1fr); margin-top: 12px; }
.swatch {
  position: relative; aspect-ratio: 3 / 4; border-radius: 12px 12px 14px 14px; border: 0; background: var(--c);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .07), inset 0 -18px 18px -14px rgba(0, 0, 0, .12); transition: transform .35s var(--ease), box-shadow .3s; padding: 0; overflow: hidden;
}
.swatches.small .swatch { border-radius: 50%; aspect-ratio: 1; }
.swatch span { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 5px; font-size: 9px; font-weight: 600; letter-spacing: .02em; background: rgba(255, 255, 255, .9); color: var(--ink-2); opacity: 0; transform: translateY(100%); transition: all .3s var(--ease); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.swatch:hover { transform: translateY(-3px); }
.swatch:hover span, .swatch.is-on span { opacity: 1; transform: none; }
.swatch.is-on { box-shadow: 0 0 0 2px #FFFFFF, 0 0 0 3.5px var(--ink); }
.color-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 8px; border-radius: 16px; background: rgba(249, 248, 252, .8); border: 1px solid var(--line); cursor: pointer; transition: border-color .2s; }
.color-row:hover { border-color: var(--line-2); }
.color-row input[type="color"] { width: 44px; height: 44px; border: 0; padding: 0; background: none; border-radius: 12px; cursor: pointer; flex: none; }
.color-row input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-row input[type="color"]::-webkit-color-swatch { border: 1px solid rgba(0, 0, 0, .1); border-radius: 12px; }
.color-row input[type="color"]::-moz-color-swatch { border: 1px solid rgba(0, 0, 0, .1); border-radius: 12px; }
.color-row span { display: flex; flex-direction: column; line-height: 1.2; }
.color-row strong { font-family: var(--serif); font-size: 14.4px; font-weight: 600; }
.color-row small { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.materials { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mat { display: flex; align-items: center; gap: 10px; padding: 7px; border-radius: 16px; border: 1px solid var(--line); background: rgba(249, 248, 252, .75); text-align: left; transition: all .3s var(--ease); }
.mat svg { width: 40px; height: 40px; border-radius: 11px; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); transition: transform .4s var(--ease); }
.mat:hover svg { transform: scale(1.06) rotate(3deg); }
.mat span { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.mat strong { font-size: 12px; }
.mat small { font-size: 10.5px; color: var(--muted); }
.mat:hover { border-color: var(--line-2); background: var(--surface-solid); }
.mat.is-on { border-color: var(--clay); box-shadow: var(--ring); background: #FBF8FF; }

/* ---------- stage: the planner centerpiece ---------- */
.stage { position: relative; padding: 26px 26px 18px; min-width: 0; }
.stage-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; flex-wrap: wrap; padding: 0 4px; }
.stage-title { min-width: 0; }
.stage-title h1 { font-size: 36.8px; }
.stage-meta { color: var(--muted); font-family: var(--sans); font-style: italic; font-size: 15.6px; margin-top: 6px; }
.stage-stats { display: flex; gap: 0; border: 1px solid var(--line); border-radius: 18px; background: rgba(249, 248, 252, .7); overflow: hidden; }
.stat { display: flex; flex-direction: column; padding: 10px 18px; line-height: 1.15; min-width: 0; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat span { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-weight: 600; white-space: nowrap; }
.stat strong { font-family: var(--serif); font-size: 19.2px; font-weight: 600; margin-top: 3px; font-variant-numeric: tabular-nums; }
.stat-total { background: var(--ink); color: #FFFFFF; }
.stat-total span { color: #C9BBA9; }

.plan-wrap {
  position: relative; height: clamp(440px, calc(100vh - 330px), 1040px); border-radius: 24px; overflow: hidden; padding-top: 52px;
  background:
    radial-gradient(70% 60% at 50% 45%, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 70%),
    radial-gradient(circle at 1px 1px, rgba(120, 112, 140, .2) 1px, transparent 0) 0 0 / 20px 20px,
    linear-gradient(180deg, #F7F7FA, #ECEAF3);
  box-shadow: inset 0 0 0 1px var(--line), inset 0 2px 12px rgba(38, 18, 72, .05);
  touch-action: none;
}
.plan { width: 100%; height: 100%; display: block; position: relative; z-index: 1; user-select: none; -webkit-user-select: none; touch-action: none; animation: fadeIn .6s var(--ease); }
.plan .item { cursor: grab; outline: none; }
.plan .item .pop { transform-box: fill-box; transform-origin: center; transition: filter .25s; }
.plan .item:hover .pop { filter: brightness(1.04) saturate(1.05); }
.plan .item.is-new .pop { animation: dropIn .55s var(--ease-spring) both; }
@keyframes dropIn { from { opacity: 0; transform: scale(.72); } to { opacity: 1; transform: none; } }
.plan .item:focus-visible .hit { stroke: var(--clay); stroke-width: 1; stroke-dasharray: 2 2; }
.plan-wrap.is-dragging .item, .plan-wrap.is-dragging { cursor: grabbing; }
.plan .item-label text { fill: #2E2A25; font-family: var(--sans); font-weight: 600; paint-order: stroke; stroke: rgba(255, 255, 255, .92); stroke-width: 1.2px; pointer-events: none; }
.dim-line, .dim-tick { stroke: #9A93A8; stroke-width: .4; }
.dim-bg { fill: #FFFFFF; stroke: #DCCFBF; stroke-width: .35; }
.dim-text { fill: #4A4458; font-family: var(--sans); font-weight: 600; font-style: italic; }
.sb-dark { fill: #2A2236; }
.sb-light { fill: #FFFFFF; stroke: #2A2236; stroke-width: .3; }
.sb-text { fill: #6E6258; font-family: var(--sans); font-weight: 600; letter-spacing: .04em; }
.sb-north { fill: #FFFFFF; stroke: #9A93A8; stroke-width: .35; }
.sb-arrow { fill: #2A2236; }
.sel-box { fill: rgba(106, 17, 203, .05); stroke: var(--clay); stroke-width: .7; stroke-dasharray: 2.4 1.6; pointer-events: none; animation: ants 1.4s linear infinite; }
@keyframes ants { to { stroke-dashoffset: -8; } }
.sel-corner { fill: #FFFFFF; stroke: var(--clay); stroke-width: .6; pointer-events: none; }
.sel-stem { stroke: var(--clay); stroke-width: .6; pointer-events: none; }
.rot-handle { cursor: grab; }
.rot-hit { fill: transparent; }
.rot-dot { fill: var(--clay); stroke: #FFFFFF; stroke-width: .8; filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, .25)); transition: fill .2s; }
.rot-handle:hover .rot-dot { fill: var(--clay-ink); }
.rot-icon { fill: none; stroke: #FFFFFF; stroke-width: .45; stroke-linecap: round; pointer-events: none; }
.sel-tag { fill: var(--ink); opacity: .92; pointer-events: none; }
.sel-tag-text { fill: #FFFFFF; font-family: var(--sans); font-weight: 600; pointer-events: none; }
.guide { stroke: var(--clay); stroke-width: .5; stroke-dasharray: 1.5 1.2; }
.guide-bg { fill: var(--clay); }
.guide-text { fill: #FFFFFF; font-family: var(--sans); font-weight: 700; }

.plan-toolbar {
  position: absolute; top: 14px; right: 14px; display: flex; gap: 4px; padding: 4px; border-radius: 999px;
  background: rgba(255, 255, 255, .82); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, .8); box-shadow: var(--shadow-sm); z-index: 3;
}
.toggle { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; border: 0; background: transparent; font-size: 12px; font-weight: 600; color: var(--muted); transition: all .3s var(--ease); }
.toggle .ic { width: 15px; height: 15px; }
.toggle:hover { color: var(--ink); background: rgba(236, 233, 244, .7); }
.toggle[aria-pressed="true"] { background: var(--sage-soft); color: var(--olive); }
.plan-legend { position: absolute; left: 18px; top: 20px; display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); letter-spacing: .04em; pointer-events: none; z-index: 2; }

.drop-hint { position: absolute; inset: 12px; border: 1.5px dashed rgba(106, 17, 203, .55); border-radius: 18px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 18px; background: rgba(239, 230, 250, .22); opacity: 0; pointer-events: none; transition: opacity .25s var(--ease); z-index: 2; }
.drop-hint span { padding: 7px 16px; border-radius: 999px; background: var(--clay); color: #FFFFFF; font-weight: 600; font-size: 12.5px; box-shadow: 0 10px 22px -10px rgba(106, 17, 203, .8); transform: translateY(8px); transition: transform .35s var(--ease-spring); }
.plan-wrap.drop-active .drop-hint { opacity: 1; }
.plan-wrap.drop-active .drop-hint span { transform: none; }
.empty-hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; color: var(--muted); max-width: 270px; pointer-events: none; font-family: var(--sans); font-size: 16.6px; font-style: italic; line-height: 1.35; animation: fadeIn .5s var(--ease); }
.empty-hint .ic { width: 34px; height: 34px; margin-bottom: 10px; stroke-width: 1.2; }

.drag-ghost {
  position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none; display: grid; place-items: center;
  border-radius: 10px; background: rgba(255, 255, 255, .55); outline: 1.5px dashed rgba(106, 17, 203, .55);
  filter: drop-shadow(0 18px 22px rgba(38, 18, 72, .3)); transition: outline-color .2s, background .2s;
  animation: ghostIn .25s var(--ease-spring);
}
@keyframes ghostIn { from { opacity: 0; scale: .8; } }
.drag-ghost .ghost-art { width: 100%; height: 100%; }
.drag-ghost span { position: absolute; top: 100%; margin-top: 8px; white-space: nowrap; font-size: 11.5px; font-weight: 600; color: #FFFFFF; background: var(--ink); padding: 3px 10px; border-radius: 999px; }
.drag-ghost.over { background: transparent; outline-color: var(--clay); }
body.is-palette-dragging, body.is-palette-dragging * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }

.selbar {
  position: absolute; left: 50%; bottom: 60px; transform: translateX(-50%); z-index: 5;
  display: flex; align-items: center; gap: 14px; padding: 7px 7px 7px 8px; max-width: calc(100% - 80px);
  background: rgba(255, 255, 255, .9); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, .9); border-radius: 999px; box-shadow: var(--shadow-lg); animation: rise .4s var(--ease-spring);
}
@keyframes rise { from { opacity: 0; transform: translate(-50%, 12px) scale(.96); } to { opacity: 1; transform: translate(-50%, 0); } }
.selbar-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.selbar-thumb { width: 44px; height: 44px; border-radius: 50%; background: radial-gradient(#FFFFFF, #ECEAF3); display: grid; place-items: center; padding: 7px; flex: none; }
.selbar-thumb svg { width: 100%; height: 100%; }
.selbar-info > span:last-child { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.selbar-info strong { font-family: var(--serif); font-size: 14.4px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.selbar-info small { font-size: 11px; color: var(--muted); white-space: nowrap; }
.selbar-actions { display: flex; align-items: center; gap: 2px; padding-left: 10px; border-left: 1px solid var(--line); }
.colorchip { position: relative; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; cursor: pointer; transition: background .2s; }
.colorchip:hover { background: rgba(236, 233, 244, .8); }
.colorchip input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.colorchip span { width: 22px; height: 22px; border-radius: 50%; box-shadow: 0 0 0 2px #FFFFFF, 0 0 0 3px var(--line-2); pointer-events: none; transition: transform .3s var(--ease-spring); }
.colorchip:hover span { transform: scale(1.12); }
.stage-foot { font-size: 12px; color: var(--muted); margin-top: 14px; text-align: center; letter-spacing: .01em; }

/* ---------- dashboard ---------- */
.dashboard {
  position: sticky; top: calc(var(--header-h) + var(--gap)); max-height: calc(100vh - var(--header-h) - var(--gap) * 2);
  overflow-y: auto; padding: 24px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.dash-head h2 { font-size: 25.6px; line-height: 1.05; }
.dash-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.preview { position: relative; margin: 18px 0 14px; border-radius: 20px; overflow: hidden; aspect-ratio: 16 / 11; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .04), 0 18px 34px -18px rgba(38, 18, 72, .45); background: var(--paper-2); }
.preview svg { width: 100%; height: 100%; display: block; transition: transform 1.2s var(--ease); }
.preview:hover svg { transform: scale(1.04); }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.metrics div { padding: 11px 8px; border-radius: 16px; background: rgba(249, 248, 252, .8); border: 1px solid var(--line); text-align: center; display: flex; flex-direction: column; line-height: 1.1; }
.metrics strong { font-family: var(--serif); font-size: 19.2px; font-weight: 600; }
.metrics span { font-size: 9.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .14em; margin-top: 4px; font-weight: 600; }

.dash-total { position: relative; margin-top: 14px; padding: 18px; border-radius: 22px; background: linear-gradient(140deg, #2A0B52 0%, #5A1AA8 100%); color: #FFFFFF; box-shadow: 0 20px 36px -18px rgba(31, 22, 48, .7); overflow: hidden; }
.dash-total::after { content: ""; position: absolute; right: -40px; top: -60px; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 122, 61, .28), transparent); pointer-events: none; }
.dash-total-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.dash-total-row span { white-space: nowrap; font-size: 10px; text-transform: uppercase; letter-spacing: .18em; color: #D9CCF0; font-weight: 600; }
.dash-total-row strong { font-family: var(--serif); font-size: 25.6px; font-weight: 500; font-variant-numeric: tabular-nums; }
.dash-total .muted { color: #D9CCF0; margin-top: 9px; }
.meter { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, .14); margin-top: 12px; overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #C6D1B8, #8C9A84); transition: width .9s var(--ease); }
.meter.is-near span { background: linear-gradient(90deg, #E8D29C, #BF9C5A); }
.meter.is-over span { background: linear-gradient(90deg, #E9A37F, #C5603A); }

.dash-section { margin-top: 24px; }
.dash-section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 11px; }
.dash-section-head h3 { display: flex; align-items: center; gap: 7px; font-size: 16px; }
.dash-section-head h3 .ic { width: 16px; height: 16px; color: var(--clay); }
.palette-row { display: flex; gap: 0; flex-wrap: wrap; }
.pal { width: 38px; height: 38px; border-radius: 50%; background: var(--c); margin-right: -8px; border: 3px solid #FAFAFC; box-shadow: 0 4px 10px -4px rgba(38, 18, 72, .35); transition: transform .35s var(--ease-spring), margin .35s var(--ease); }
.palette-row:hover .pal { margin-right: 4px; }
.pal:hover { transform: translateY(-4px) scale(1.08); }
.dash-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.dash-items li { display: flex; align-items: center; gap: 4px; padding: 4px 4px 4px 6px; border-radius: 14px; transition: background .25s, transform .25s var(--ease); }
.dash-items li:hover { background: rgba(249, 248, 252, .95); transform: translateX(2px); }
.dash-items li.is-active { background: var(--clay-soft); }
.dash-items li.empty { color: var(--muted); font-size: 13px; padding: 12px; background: rgba(249, 248, 252, .8); border: 1px dashed var(--line-2); }
.di-main { display: flex; align-items: center; gap: 11px; flex: 1; min-width: 0; border: 0; background: none; text-align: left; padding: 2px; }
.di-main svg { width: 38px; height: 38px; padding: 5px; border-radius: 12px; background: radial-gradient(#FFFFFF, #ECEAF3); flex: none; }
.di-main > span { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; align-items: flex-start; }
.di-main strong { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.di-main small { font-size: 11px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.di-price { font-family: var(--serif); font-weight: 600; font-size: 12.8px; color: var(--ink-2); }
.tips { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tip { display: flex; gap: 10px; padding: 11px 13px; border-radius: 14px; background: rgba(249, 248, 252, .85); border: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); line-height: 1.45; animation: riseIn .5s var(--ease) both; }
.tip:nth-child(2) { animation-delay: .05s; } .tip:nth-child(3) { animation-delay: .1s; } .tip:nth-child(4) { animation-delay: .15s; }
.tip-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); margin-top: 6px; flex: none; }
.tip-warn { background: rgba(252, 239, 231, .9); border-color: rgba(180, 84, 47, .18); }
.tip-warn .tip-dot { background: var(--warn); }
.tip-good { background: rgba(240, 244, 235, .9); border-color: rgba(95, 122, 85, .18); }
.tip-good .tip-dot { background: var(--good); }

/* ---------- mood board and budget views ---------- */
.view-panel { padding: 34px; min-height: 60vh; position: relative; }
.view-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin-bottom: 26px; }
.view-head h1 { font-size: 43.2px; }
.view-head p { color: var(--muted); margin-top: 10px; max-width: 520px; font-size: 14.5px; }
.mood-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.mood-hero { padding-bottom: 26px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.mood-strips { display: flex; gap: 28px; flex-wrap: wrap; }
.strip { display: flex; flex-direction: column; gap: 10px; }
.strip-label { font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.strip-dots, .strip-mats { display: flex; min-height: 46px; align-items: center; }
.sdot { width: 46px; height: 46px; border-radius: 50%; background: var(--c); margin-right: -12px; border: 3px solid #FAFAFC; box-shadow: 0 6px 14px -6px rgba(38, 18, 72, .4); transition: transform .4s var(--ease-spring), margin .4s var(--ease); animation: riseIn .5s var(--ease) both; animation-delay: calc(var(--i) * 50ms); }
.smat { width: 46px; height: 46px; border-radius: 50%; overflow: hidden; margin-right: -12px; border: 3px solid #FAFAFC; box-shadow: 0 6px 14px -6px rgba(38, 18, 72, .4); transition: transform .4s var(--ease-spring), margin .4s var(--ease); animation: riseIn .5s var(--ease) both; animation-delay: calc(var(--i) * 50ms + 150ms); }
.smat img { width: 100%; height: 100%; object-fit: cover; }
.strip-dots:hover .sdot, .strip-mats:hover .smat { margin-right: 4px; }
.sdot:hover, .smat:hover { transform: translateY(-4px) scale(1.06); }
.strip-empty { font-family: var(--sans); font-style: italic; color: var(--faint); font-size: 14.7px; }

.mood-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }

.mood-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); grid-auto-rows: 92px; grid-auto-flow: dense; gap: 14px; }
.mcard {
  position: relative; margin: 0; border-radius: 22px; background: var(--paper-2); overflow: hidden; isolation: isolate;
  box-shadow: 0 1px 2px rgba(38, 18, 72, .06), 0 14px 30px -20px rgba(38, 18, 72, .45);
  transition: transform .5s var(--ease), box-shadow .5s var(--ease), opacity .3s;
}
.mcard:hover { transform: translateY(-4px); box-shadow: 0 2px 4px rgba(38, 18, 72, .06), 0 28px 50px -24px rgba(38, 18, 72, .5); }
.mcard-image { grid-column: span 2; grid-row: span 3; }
.mcard-material { grid-row: span 2; }
.mcard-color { grid-row: span 2; }
.mcard-note { grid-row: span 3; }
.mcard.is-moving { opacity: .3; transform: scale(.97); }
.mcard.is-leaving { opacity: 0; transform: scale(.9); }
.mcard-ghost { position: fixed; left: 0; top: 0; z-index: 120; pointer-events: none; box-shadow: var(--shadow-lg); opacity: .96; transition: none; }
.mcard-tools { position: absolute; top: 10px; right: 10px; left: 10px; display: flex; justify-content: space-between; z-index: 3; opacity: 0; transform: translateY(-4px); transition: all .3s var(--ease); }
.mcard:hover .mcard-tools, .mcard:focus-within .mcard-tools { opacity: 1; transform: none; }
@media (hover: none) { .mcard-tools { opacity: 1; transform: none; } }
.mtool { width: 32px; height: 32px; border-radius: 50%; border: 0; display: grid; place-items: center; background: rgba(255, 255, 255, .85); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: var(--ink-2); box-shadow: 0 4px 12px -4px rgba(0, 0, 0, .3); transition: transform .2s; }
.mtool:hover { transform: scale(1.08); }
.mtool .ic { width: 15px; height: 15px; }
.mtool.grip { cursor: grab; touch-action: none; }

.mimg { position: absolute; inset: 0; background: var(--paper-2); }
.mimg img { width: 100%; height: 100%; object-fit: cover; user-select: none; -webkit-user-drag: none; transition: transform 1.2s var(--ease); }
.mcard:hover .mimg img { transform: scale(1.05); }
.mimg.broken { display: grid; place-items: center; }
.mimg.broken img { display: none; }
.mimg.broken::after { content: "Image could not load"; color: var(--muted); font-size: 12px; font-family: var(--sans); font-style: italic; }

/* caption overlays the visual */
.mcap { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: 34px 14px 13px; display: flex; flex-direction: column; gap: 5px; background: linear-gradient(180deg, rgba(20, 10, 40, 0) 0%, rgba(20, 10, 40, .55) 100%); color: #FFFFFF; }
.mtitle { border: 0; background: transparent; outline: none; font-family: var(--serif); font-weight: 600; font-size: 14.4px; line-height: 1.15; padding: 2px 4px; margin: 0 -4px; border-radius: 8px; width: 100%; color: inherit; text-overflow: ellipsis; }
.mtitle::placeholder { color: inherit; opacity: .6; }
.mtitle:focus { background: rgba(255, 255, 255, .16); }
.mmeta { display: flex; gap: 6px; align-items: center; }
.mtag { font-size: 9.5px; letter-spacing: .18em; text-transform: uppercase; font-weight: 600; opacity: .85; }
.mcard-material .mcap { padding-top: 26px; }
.mcard-material .mtitle { font-size: 16px; }

.mcard-color .mswatch { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; padding: 52px 16px 16px; }
.mcard-color .mswatch .hex { font-family: var(--serif); font-size: 12px; letter-spacing: .08em; opacity: .85; }
.mcard-color .btn-glass { opacity: 0; transform: translateY(6px); transition: all .35s var(--ease); }
.mcard-color:hover .btn-glass, .mcard-color:focus-within .btn-glass { opacity: 1; transform: none; }
@media (hover: none) { .mcard-color .btn-glass { opacity: 1; transform: none; } }
.mcard-color .mcap { background: none; padding-top: 0; }
.mcard-color.is-light .mcap, .mcard-color.is-light .mswatch { color: #2A2236; }
.mcard-color.is-dark .mcap, .mcard-color.is-dark .mswatch { color: #FFFFFF; }
.mcard-color .mswatch .btn-glass { position: absolute; left: 14px; bottom: 64px; }

.mcard-note { background: linear-gradient(170deg, #FBF8FF 0%, #F1EAFB 100%); box-shadow: inset 0 0 0 1px var(--line), 0 14px 30px -22px rgba(38, 18, 72, .4); }
.mnote { position: absolute; inset: 0; padding: 50px 18px 60px; display: flex; flex-direction: column; gap: 6px; }
.mnote-mark { font-size: 9.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--clay); font-weight: 700; }
.mtext { flex: 1; border: 0; background: transparent; resize: none; outline: none; font-family: var(--sans); font-size: 16.6px; font-style: italic; line-height: 1.4; color: var(--ink-2); }
.mcard-note .mcap { background: none; color: var(--ink); padding-top: 0; border-top: 1px solid var(--line); margin: 0 14px; padding: 10px 0 13px; }
.mcard-note .mtitle { font-size: 15px; }

/* placeholder tiles */
.mslot {
  position: relative; grid-row: span 2; border-radius: 22px; border: 1.5px dashed rgba(74, 52, 120, .3); background: rgba(249, 248, 252, .55);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 16px; text-align: center; color: var(--muted);
  transition: all .4s var(--ease);
}
.mslot:hover { border-color: var(--clay); background: rgba(253, 247, 241, .95); color: var(--ink); transform: translateY(-3px); }
.mslot strong { font-family: var(--serif); font-size: 15.2px; font-weight: 600; color: var(--ink-2); }
.mslot small { font-size: 11.5px; }
.mslot-image { grid-column: span 2; }
.mslot-art { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-solid); box-shadow: var(--shadow-sm); margin-bottom: 8px; transition: transform .5s var(--ease-spring); }
.mslot:hover .mslot-art { transform: scale(1.1) rotate(-6deg); }
.mslot-art .ic { width: 22px; height: 22px; color: var(--clay); }
.mslot-chips, .mslot-fan { display: flex; margin-bottom: 10px; height: 44px; align-items: center; }
.mslot-chips i { width: 40px; height: 40px; border-radius: 12px; margin-right: -14px; border: 3px solid #FAFAFC; box-shadow: var(--shadow-sm); transition: transform .45s var(--ease-spring), margin .45s var(--ease); }
.mslot-chips i:nth-child(1) { background: #C9A27A; transform: rotate(-8deg); }
.mslot-chips i:nth-child(2) { background: #E6D8C2; }
.mslot-chips i:nth-child(3) { background: #DCCFBC; transform: rotate(8deg); }
.mslot:hover .mslot-chips i { margin-right: -4px; }
.mslot-fan i { width: 18px; height: 44px; border-radius: 9px; margin-right: -4px; border: 2px solid #FAFAFC; transform-origin: bottom center; transition: transform .45s var(--ease-spring); }
.mslot-fan i:nth-child(1) { background: #EDE6DA; transform: rotate(-18deg); }
.mslot-fan i:nth-child(2) { background: #D8C3A5; transform: rotate(-6deg); }
.mslot-fan i:nth-child(3) { background: #C98E6B; transform: rotate(6deg); }
.mslot-fan i:nth-child(4) { background: #8C9A84; transform: rotate(18deg); }
.mslot:hover .mslot-fan i:nth-child(1) { transform: rotate(-28deg); }
.mslot:hover .mslot-fan i:nth-child(4) { transform: rotate(28deg); }

.mood-empty { grid-column: 1 / -1; grid-row: span 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; color: var(--muted); }
.mood-empty h3 { font-size: 20.8px; }
.mood-empty p { max-width: 400px; margin-bottom: 6px; }
.mood-drop { position: absolute; inset: 14px; border-radius: 26px; border: 2px dashed var(--clay); background: rgba(239, 230, 250, .88); display: flex; align-items: center; justify-content: center; gap: 12px; font-family: var(--sans); font-size: 25.8px; font-style: italic; color: var(--clay-ink); opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 10; }
.view-mood.is-dropping .mood-drop { opacity: 1; }

/* budget */
.budget-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.kpi { padding: 18px 20px; border-radius: 22px; background: rgba(249, 248, 252, .8); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; min-width: 0; transition: transform .35s var(--ease), box-shadow .35s var(--ease); }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.kpi-label { font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.kpi-value { font-family: var(--serif); font-size: 27.2px; font-weight: 500; line-height: 1.05; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12px; color: var(--muted); }
.kpi-total { background: linear-gradient(140deg, #2A0B52 0%, #5A1AA8 100%); border-color: transparent; color: #FFFFFF; box-shadow: 0 20px 36px -20px rgba(31, 22, 48, .7); }
.kpi-total .kpi-label, .kpi-total .kpi-sub { color: #D9CCF0; }
.kpi-total.is-over .kpi-sub { color: #F3B596; }

.budget-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
.budget-side { display: flex; flex-direction: column; gap: 18px; }
.card { background: rgba(249, 248, 252, .75); border: 1px solid var(--line); border-radius: 22px; padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h3 { font-size: 16.8px; }
.table-wrap { overflow-x: auto; margin: 0 -6px; }
.btable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.btable th { text-align: left; font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 6px; border-bottom: 1px solid var(--line); }
.btable td { padding: 11px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.btable tbody tr { transition: background .2s; }
.btable tbody tr:hover { background: rgba(255, 255, 255, .7); }
.btable .num { text-align: right; white-space: nowrap; }
.btable td.num strong { font-family: var(--serif); font-size: 13.6px; font-weight: 600; }
.btable .sum-row td { border-bottom: 0; padding-top: 16px; font-weight: 600; }
.btable .sum-row:hover { background: none; }
.btable .empty-row { text-align: center; color: var(--muted); padding: 34px 10px; font-family: var(--sans); font-style: italic; font-size: 15.6px; }
.line-item { display: flex; align-items: center; gap: 11px; min-width: 180px; }
.line-item svg { width: 44px; height: 44px; padding: 6px; border-radius: 13px; background: radial-gradient(#FFFFFF, #ECEAF3); flex: none; }
.line-item > span { display: flex; flex-direction: column; line-height: 1.25; }
.line-item small { color: var(--muted); font-size: 11.5px; display: flex; gap: 6px; align-items: center; }
.qty { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface-solid); padding: 2px; }
.qty button { width: 26px; height: 26px; border-radius: 50%; border: 0; background: transparent; display: grid; place-items: center; color: var(--ink-2); transition: background .2s; }
.qty button:hover { background: rgba(236, 233, 244, .9); }
.qty button .ic { width: 13px; height: 13px; }
.qty span { min-width: 22px; text-align: center; font-weight: 700; }
.price-in { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface-solid); padding: 0 9px; height: 34px; transition: border-color .2s, box-shadow .25s; }
.price-in span { color: var(--muted); font-size: 13px; }
.price-in input { width: 74px; border: 0; background: transparent; outline: none; text-align: right; font-weight: 600; -moz-appearance: textfield; }
.price-in input::-webkit-outer-spin-button, .price-in input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.price-in:focus-within { border-color: var(--clay); box-shadow: var(--ring); }
.price-in.is-custom { border-color: var(--gold); background: #FCF7EA; }
.finish-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; }
.finish-line .check { margin-top: 0; font-weight: 600; color: var(--ink); }
.finish-line .num { font-family: var(--serif); font-weight: 600; font-size: 14.4px; }
.card .hint { margin: 2px 0 10px 26px; }
.card .field.inline { margin: 0 0 18px 26px; }
.extras { display: flex; flex-direction: column; gap: 8px; }
.extra { display: flex; align-items: center; gap: 8px; animation: riseIn .35s var(--ease); }
.extra > input { flex: 1; min-width: 0; height: 34px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface-solid); padding: 0 11px; outline: none; transition: border-color .2s; }
.extra > input:focus { border-color: var(--clay); }
.extra .price-in input { width: 64px; }

/* ---------- dialogs ---------- */
.modal { border: 0; padding: 0; border-radius: 28px; background: rgba(255, 255, 255, .97); color: var(--ink); box-shadow: var(--shadow-lg); width: min(580px, calc(100vw - 32px)); max-height: calc(100vh - 40px); }
.modal[open] { animation: modalIn .4s var(--ease-spring); }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.modal::backdrop { background: rgba(31, 22, 48, .32); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.modal form { padding: 28px; display: flex; flex-direction: column; gap: 12px; }
.modal h3 { font-size: 22.4px; display: flex; align-items: center; gap: 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.material-lib { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; max-height: 54vh; overflow-y: auto; padding: 4px; }
.mat-item { display: flex; flex-direction: column; text-align: left; border: 1px solid var(--line); background: rgba(249, 248, 252, .8); border-radius: 18px; overflow: hidden; padding: 0; transition: all .35s var(--ease); }
.mat-item img { aspect-ratio: 1; object-fit: cover; width: 100%; transition: transform .8s var(--ease); }
.mat-item.insp img { aspect-ratio: 4 / 3; }
.mat-item span { padding: 9px 11px; display: flex; flex-direction: column; line-height: 1.25; }
.mat-item strong { font-family: var(--serif); font-size: 12.8px; font-weight: 600; }
.mat-item small { font-size: 11px; color: var(--muted); }
.mat-item:hover { border-color: var(--clay); transform: translateY(-3px); box-shadow: var(--shadow-sm); }
.mat-item:hover img { transform: scale(1.06); }
.mat-item.added { box-shadow: 0 0 0 3px var(--sage); }
.color-pick { display: flex; gap: 14px; align-items: flex-end; }
.color-pick input[type="color"] { width: 84px; height: 84px; border: 0; padding: 0; background: none; cursor: pointer; flex: none; }
.color-pick input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-pick input[type="color"]::-webkit-color-swatch { border-radius: 20px; border: 1px solid rgba(0, 0, 0, .1); }
.color-pick .field { flex: 1; margin: 0; }
.modal .swatches.small { grid-template-columns: repeat(6, 1fr); }

/* toasts */
.toasts { left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { background: rgba(31, 22, 48, .94); backdrop-filter: blur(8px); color: #FFFFFF; padding: 10px 20px; border-radius: 999px; font-size: 13px; font-weight: 600; letter-spacing: .01em; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(12px) scale(.96); transition: all .4s var(--ease-spring); max-width: calc(100vw - 32px); text-align: center; }
.toast.show { opacity: 1; transform: none; }
.toast-warn { background: var(--warn); }

.tabbar { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1440px) {
  .app { grid-template-columns: minmax(0, 1fr) 300px; }
  .view-design { grid-template-columns: 280px minmax(0, 1fr); }
  .stage-title h1 { font-size: 32px; }
}

@media (max-width: 1280px) {
  :root { --pad-x: 22px; }
  .budget-kpis { grid-template-columns: repeat(2, 1fr); }
  .stat { padding: 9px 14px; }
  .stat strong { font-size: 21px; }
}

@media (max-width: 1120px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .dashboard { position: static; max-height: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; }
  .dash-head, .preview, .metrics, .dash-total { grid-column: 1; }
  .dash-head { grid-row: 1; } .preview { grid-row: 2; } .metrics { grid-row: 3; } .dash-total { grid-row: 4; }
  .dashboard .dash-section { grid-column: 2; }
  .dashboard .dash-section:nth-of-type(1) { margin-top: 0; }
  .budget-grid { grid-template-columns: minmax(0, 1fr); }
  .save-state .txt { display: none; }
  .view-head h1 { font-size: 36.8px; }
}

@media (max-width: 960px) {
  .topbar { grid-template-columns: auto 1fr auto; }
  .mainnav { justify-self: center; }
  .mainnav .navbtn span { display: none; }
  .mainnav .navbtn { padding: 0 14px; }
  .brand-sub { display: none; }
  .view-design { grid-template-columns: 260px minmax(0, 1fr); }
  .stage { padding: 20px 18px 16px; }
  .stage-stats .stat:not(.stat-total) { display: none; }
}

@media (max-width: 760px) {
  :root { --header-h: 60px; --gap: 14px; --pad-x: 14px; }
  body { font-size: 14.5px; padding-bottom: calc(80px + env(safe-area-inset-bottom)); background-attachment: scroll; }
  h1 { font-size: 24px; }
  .topbar { display: flex; gap: 6px; }
  .brand { margin-right: auto; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-name { font-size: 21px; }
  .mainnav { display: none; }
  .hide-sm { display: none; }
  .btn-ghost { padding: 0 10px; }
  .iconbtn { width: 38px; height: 38px; }
  .demo-banner { border-radius: 18px; font-size: 12px; padding: 9px 8px 9px 12px; gap: 10px; align-items: flex-start; }
  .app { padding: var(--gap) var(--pad-x) 24px; }
  .panel { border-radius: 24px; }

  .view-design { grid-template-columns: minmax(0, 1fr); }
  .stage { order: -1; padding: 12px 10px 10px; position: sticky; top: calc(var(--header-h) + 6px); z-index: 20; box-shadow: var(--shadow-lg); }
  .stage-head { align-items: center; margin-bottom: 8px; flex-wrap: nowrap; gap: 8px; padding: 0 4px; }
  .stage-title .eyebrow { display: none; }
  .stage-title h1 { font-size: 19.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .stage-meta { font-size: 13px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .stage-stats { flex: none; border-radius: 14px; }
  .stage-stats .stat:not(.stat-total) { display: none; }
  .stat { padding: 6px 11px; }
  .stat span { font-size: 8.5px; letter-spacing: .12em; }
  .stat strong { font-size: 17px; margin-top: 1px; }
  .plan-wrap { width: 100%; height: auto; aspect-ratio: var(--plan-ar, 1.1); max-height: 42vh; border-radius: 16px; }
  .plan-wrap { padding-top: 44px; }
  .plan-toolbar { top: 7px; right: 7px; padding: 3px; }
  .toggle { width: 30px; height: 30px; padding: 0; justify-content: center; }
  .toggle span { display: none; }
  .plan-legend { top: 15px; left: 12px; font-size: 10px; }
  .selbar { position: static; transform: none; margin: 8px auto 0; max-width: 100%; width: 100%; border-radius: 16px; animation: none; justify-content: space-between; padding: 4px 4px 4px 6px; gap: 6px; box-shadow: var(--shadow-sm); }
  .selbar-thumb { width: 34px; height: 34px; padding: 4px; }
  .selbar-info strong { font-size: 16px; }
  .selbar-info small { display: none; }
  .selbar-actions { padding-left: 4px; }
  .selbar .iconbtn, .selbar .colorchip { width: 36px; height: 36px; }
  .stage-foot { display: none; }

  .tools { position: static; max-height: none; overflow: visible; }
  .tool-pane { overflow: visible; padding: 16px 14px 18px; }
  .drag-hint::after { content: " Swipe sideways to browse, drag upward to place."; }
  .catalog { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 136px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; margin: 6px -14px 0; padding: 6px 14px 12px; scrollbar-width: none; }
  .catalog::-webkit-scrollbar { display: none; }
  .fcard { touch-action: pan-x; scroll-snap-align: start; }
  .fcard:hover { transform: none; }
  .fcard-add { opacity: 1; transform: none; width: 24px; height: 24px; }
  .fcard-art { height: 66px; padding: 8px 8px 12px; }
  .fcard-art .thumb { max-height: 44px; }
  .swatches { grid-template-columns: repeat(6, 1fr); }

  .dashboard { display: none; position: static; max-height: none; padding: 20px; }
  .app[data-view="summary"] .dashboard { display: block; }

  .view-panel { padding: 22px 14px; }
  .view-head { margin-bottom: 18px; gap: 18px; }
  .view-head h1 { font-size: 30.4px; }
  .mood-strips { gap: 20px; }
  .sdot, .smat { width: 38px; height: 38px; }
  .mood-toolbar { flex-direction: column; align-items: stretch; }
  .mood-actions { width: 100%; }
  .mood-actions .btn { flex: 1 1 auto; height: 38px; padding: 0 12px; font-size: 12.5px; }
  .mood-filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; width: 100%; max-width: 100%; min-width: 0; padding-bottom: 2px; }
  .mood-filters::-webkit-scrollbar { display: none; }
  .mood-board { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 78px; gap: 10px; }
  .mcard, .mslot { border-radius: 18px; }
  .mtitle { font-size: 15px; }
  .mcard-material .mtitle { font-size: 14px; }
  .mtext { font-size: 15px; }
  .mnote { padding: 46px 14px 56px; }
  .mcard-color .mswatch .btn-glass { bottom: 56px; left: 10px; }
  .mslot strong { font-size: 16px; }
  .mslot small { display: none; }
  .budget-kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 13px 14px; border-radius: 18px; }
  .kpi-value { font-size: 25px; }
  .card { padding: 15px; border-radius: 18px; }
  .btable { font-size: 13px; }
  .line-item { min-width: 150px; }
  .line-item svg { width: 34px; height: 34px; }
  .price-in input { width: 58px; }
  .card .hint, .card .field.inline { margin-left: 0; }

  .tabbar {
    display: grid; grid-template-columns: repeat(4, 1fr); left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 50;
    background: rgba(255, 255, 255, .88); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, .9); border-radius: 24px; box-shadow: var(--shadow-lg); padding: 6px;
  }
  .tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: none; padding: 7px 4px; border-radius: 18px; font-size: 10.5px; font-weight: 600; letter-spacing: .02em; color: var(--muted); transition: all .35s var(--ease); }
  .tabbar button[aria-current="page"] { background: var(--ink); color: #FFFFFF; box-shadow: 0 8px 18px -8px rgba(31, 22, 48, .6); }
  .toasts { bottom: calc(96px + env(safe-area-inset-bottom)); }
}

@media (max-width: 400px) {
  .brand-name { font-size: 19px; }
  .save-state { display: none; }
  .budget-kpis { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- print (budget) ---------- */
@media print {
  body { background: #fff; padding: 0; }
  body::before { display: none; }
  .topbar, .tabbar, .demo-banner, .dashboard, .view-design, .view-mood, .mood-actions, .toasts, .qty button, #addExtra, .extra [data-del] { display: none !important; }
  .app { display: block; padding: 0; }
  .app .view-budget { display: block !important; }
  .panel, .card, .kpi { box-shadow: none; border-color: #ddd; backdrop-filter: none; }
  .kpi-total { background: #f3f3f7; color: var(--ink); }
  .kpi-total .kpi-label, .kpi-total .kpi-sub { color: var(--muted); }
  .budget-grid { grid-template-columns: 1fr; }
  .price-in { border: 0; background: none; }
}

/* ---------- modern wall and floor pairings ---------- */
.combos { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.combo { display: flex; align-items: center; gap: 11px; padding: 7px 10px 7px 7px; border-radius: 16px; border: 1px solid var(--line); background: rgba(249, 248, 252, .75); text-align: left; transition: all .3s var(--ease); min-width: 0; }
.combo:hover { border-color: var(--line-2); background: var(--surface-solid); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.combo.is-on { border-color: var(--ink); background: var(--surface-solid); box-shadow: 0 0 0 1px var(--ink); }
.combo-chip { position: relative; display: grid; grid-template-rows: 1fr 1fr; width: 44px; height: 44px; border-radius: 12px; overflow: hidden; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.combo-chip i { display: block; }
.combo-chip svg { width: 100%; height: 100%; display: block; }
.combo-txt { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.combo-txt strong { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.combo-txt small { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- running budget in the side panel ---------- */
.dash-delta { position: absolute; left: 14px; top: 57px; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; padding: 3px 9px; border-radius: 999px; opacity: 0; transform: translateY(6px); transition: opacity .35s var(--ease), transform .45s var(--ease-spring); pointer-events: none; z-index: 1; }
.dash-delta.is-up { background: rgba(198, 209, 184, .22); color: #D9E3CC; }
.dash-delta.is-down { background: rgba(233, 163, 127, .2); color: #F1C1A6; }
.dash-delta.show { opacity: 1; transform: none; }
.dash-target { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .12); }
.dash-target span { font-size: 10px; text-transform: uppercase; letter-spacing: .18em; color: #D9CCF0; font-weight: 600; }
.dash-target input { width: 120px; height: 32px; padding: 0 10px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .08); color: #FFFFFF; font: inherit; font-size: 13.5px; font-variant-numeric: tabular-nums; text-align: right; }
.dash-target input::placeholder { color: rgba(255, 255, 255, .5); }
.dash-target input:focus { outline: none; border-color: #BF9C5A; background: rgba(255, 255, 255, .12); }
.linkbtn { border: 0; background: none; padding: 0; color: var(--clay); font-size: 12px; font-weight: 600; letter-spacing: .01em; cursor: pointer; }
.linkbtn:hover { color: var(--clay-ink); text-decoration: underline; text-underline-offset: 3px; }
.cat-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 11px; }
.cat-bars .empty { font-size: 13px; color: var(--muted); }
.cat-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.cat-row span { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.cat-row strong { font-size: 13px; font-weight: 600; }
.cat-row small { font-size: 11px; color: var(--muted); white-space: nowrap; }
.cat-row em { font-style: normal; font-family: var(--serif); font-weight: 600; font-size: 12.8px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cat-bar { height: 5px; margin-top: 6px; border-radius: 999px; background: rgba(74, 52, 120, .1); overflow: hidden; }
.cat-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #D8C3A5, var(--clay)); transition: width .8s var(--ease); }

/* material dialog modes */
#dlgMaterial[data-mode="material"] .mat-item.insp, #dlgMaterial[data-mode="inspiration"] .mat-item:not(.insp) { display: none; }
@media print { .dash-target, .dash-delta { display: none !important; } }
.dash-total .meter { margin-top: 24px; }
@media (max-width: 1120px) and (min-width: 761px) {
  .dashboard { display: block; columns: 2; column-gap: 28px; }
  .dashboard > * { break-inside: avoid; }
  .dashboard .dash-section:first-of-type, .dashboard .dash-section { margin-top: 0; padding-top: 4px; margin-bottom: 22px; }
  .dashboard .dash-total { margin-bottom: 22px; }
}

/* ---------- review fixes ---------- */
/* toasts sit under the header on wider screens so they never cover the selection toolbar */
@media (min-width: 761px) {
  .toasts { top: calc(var(--header-h) + 14px); bottom: auto; }
  .toast { transform: translateY(-12px) scale(.96); }
  .toast.show { transform: none; }
}
/* empty room hint stays readable over any floor finish */
.empty-hint { z-index: 2; background: rgba(255, 255, 255, .9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, .8); border-radius: 22px; padding: 20px 22px 18px; box-shadow: var(--shadow); color: var(--ink-2); max-width: 300px; width: calc(100% - 40px); }
.empty-hint .ic { color: var(--clay); }
.empty-hint p { margin: 0; }
/* phones: keep the sticky planner compact so the furniture strip and panels stay usable */
@media (max-width: 760px) {
  .plan-wrap { max-height: 34vh; padding-top: 40px; }
  .stage { padding: 10px 10px 8px; }
  .stage-meta { display: none; }
  .stage-title h1 { font-size: 17.6px; }
  .stage-head { margin-bottom: 6px; }
  .plan-legend { display: none; }
  .plan-toolbar { top: 5px; }
  .selbar { margin-top: 6px; padding: 3px 3px 3px 5px; }
  .selbar-thumb { width: 30px; height: 30px; }
  .selbar .iconbtn, .selbar .colorchip { width: 34px; height: 34px; }
  .empty-hint { font-size: 15px; padding: 12px 14px; max-width: 250px; }
  .empty-hint .ic { width: 24px; height: 24px; margin-bottom: 4px; }
}
/* corner resize handles */
.rs-handle { cursor: var(--rs-cursor, nwse-resize); }
.rs-hit { fill: transparent; }
.rs-handle .sel-corner { transition: fill .2s, stroke-width .2s; }
.rs-handle:hover .sel-corner { fill: var(--clay); stroke: #FFFFFF; stroke-width: .8; }
.plan-wrap.is-dragging .rs-handle { cursor: inherit; }

/* =====================================================================
   RoomCraft brand layer (brand guide colors and type)
   ===================================================================== */
body {
  background:
    radial-gradient(1100px 620px at 92% -14%, rgba(157, 53, 194, .13) 0%, rgba(157, 53, 194, 0) 62%),
    radial-gradient(900px 600px at -8% 108%, rgba(255, 122, 61, .10) 0%, rgba(255, 122, 61, 0) 60%),
    var(--paper);
}
h1, h2, h3 { font-weight: 700; letter-spacing: -0.02em; }
h1 em, h2 em { font-style: normal; font-weight: 700; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.eyebrow { font-family: var(--serif); letter-spacing: .18em; }

/* header logo */
.brand-logo { height: 46px; width: auto; display: block; transition: transform .5s var(--ease-spring); }
.brand:hover .brand-logo { transform: translateY(-1px) scale(1.02); }

/* primary actions and active states use the brand purple */
.btn, .navbtn, .seg-btn, .chip, .tabbar button, .toggle { font-family: var(--serif); }
.btn-primary { background: var(--grad); border-color: transparent; color: #FFFFFF; box-shadow: 0 12px 24px -12px rgba(106, 17, 203, .6); background-size: 140% 100%; background-position: 0 0; transition: background-position .5s var(--ease), box-shadow .3s, transform .3s; }
.btn-primary:hover { background: var(--grad); background-size: 140% 100%; background-position: 100% 0; border-color: transparent; box-shadow: 0 16px 28px -12px rgba(106, 17, 203, .65); }
.nav-ind { background: var(--brand); box-shadow: 0 8px 18px -8px rgba(106, 17, 203, .7); }
.chip.is-on { background: var(--brand); border-color: var(--brand); }
.chip.is-on span { color: rgba(255, 255, 255, .7); }
.tabbar button[aria-current="page"] { background: var(--brand) !important; box-shadow: 0 8px 18px -8px rgba(106, 17, 203, .7) !important; }
.seg-btn[aria-selected="true"] { color: var(--brand); }
.stat-total { background: var(--grad-deep); }
.stat-total span { color: rgba(255, 255, 255, .72); }
.fcard-add { background: var(--brand); }
.fcard-body em { color: var(--brand); }
.toggle[aria-pressed="true"] { background: var(--clay-soft); color: var(--brand); }

/* dark summary card and meters */
.dash-total { background: var(--grad-deep); box-shadow: 0 20px 36px -18px rgba(74, 15, 150, .7); }
.dash-total::after { background: radial-gradient(closest-side, rgba(255, 122, 61, .35), transparent); }
.dash-total-row span, .dash-total .muted, .dash-target span { color: rgba(255, 255, 255, .74); }
.dash-target input:focus { border-color: var(--accent); }
.meter span { background: linear-gradient(90deg, #B98CF0, #FFFFFF); }
.meter.is-near span { background: linear-gradient(90deg, #FFB48C, #FF7A3D); }
.meter.is-over span { background: linear-gradient(90deg, #FF9A6B, #FF5A1F); }
.cat-bar span { background: var(--grad); }
.kpi-total { background: var(--grad-deep) !important; }

/* demo pills pick up the accent orange */
.pill-demo { background: rgba(255, 122, 61, .12); color: #B8471A; box-shadow: inset 0 0 0 1px rgba(255, 122, 61, .35); }
.pill-accent { background: var(--clay-soft); color: var(--brand); }

/* links and small accents */
.linkbtn { color: var(--brand); }
.linkbtn:hover { color: var(--clay-ink); }
.mnote-mark, .mood-hero .eyebrow { color: var(--brand); }

@media (max-width: 760px) {
  .brand-logo { height: 38px; }
}
@media (max-width: 400px) {
  .brand-logo { height: 32px; }
}
.brand-logo { height: 56px; }
.demo-banner { background: rgba(255, 122, 61, .07); color: var(--ink-2); }
@media (max-width: 1120px) { .brand-logo { height: 48px; } }
@media (max-width: 760px) { .brand-logo { height: 40px; } }
@media (max-width: 400px) { .brand-logo { height: 34px; } }

/* selection bar docks below the plan instead of floating over it */
.plan-wrap { height: clamp(440px, calc(100vh - 376px), 1060px); }
.stage-dock { min-height: 62px; margin-top: 12px; display: flex; align-items: center; justify-content: center; }
.selbar { position: static; transform: none; max-width: 100%; bottom: auto; left: auto; box-shadow: var(--shadow); border-color: var(--line); background: #FFFFFF; }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
.stage-dock .stage-foot { margin: 0; }
@media (max-width: 760px) { .stage-dock { min-height: 0; margin-top: 0; display: block; } .plan-wrap { height: auto; } }

/* editable piece label in the selection bar */
.selname { position: relative; display: flex; align-items: center; gap: 4px; min-width: 0; cursor: text; }
.selname input { font: 600 14.4px/1.2 var(--serif); color: var(--ink); background: transparent; border: 0; border-radius: 6px; padding: 2px 4px; margin: -2px -4px; width: 15ch; min-width: 0; text-overflow: ellipsis; outline: none; transition: background .2s, box-shadow .2s; }
.selname input::placeholder { color: var(--muted); font-weight: 500; }
.selname:hover input { background: var(--clay-soft); }
.selname input:focus { background: #FFFFFF; box-shadow: 0 0 0 2px var(--clay); text-overflow: clip; }
.selname .ic { width: 13px; height: 13px; flex: none; color: var(--muted); margin-left: 4px; transition: color .2s; }
.selname:hover .ic, .selname input:focus + .ic { color: var(--clay); }
.plan .item-label.is-custom text { font-weight: 600; }
@media (max-width: 760px) { .selname input { font-size: 16px; width: 12ch; } }

/* ---------- room switcher ---------- */
.rooms-wrap { margin-right: 8px; }
.room-btn { display: inline-flex; align-items: center; gap: 9px; height: 44px; padding: 0 10px 0 12px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, .7); color: var(--ink); box-shadow: var(--shadow-sm); transition: border-color .2s, box-shadow .25s, transform .3s var(--ease); max-width: 240px; }
.room-btn:hover { border-color: var(--line-2); box-shadow: var(--shadow); transform: translateY(-1px); }
.room-btn > .ic { width: 18px; height: 18px; color: var(--clay); flex: none; }
.room-btn .chev { width: 14px; height: 14px; color: var(--muted); }
.room-btn-txt { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; min-width: 0; }
.room-btn-txt strong { font: 600 13.5px var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.room-btn-txt small { font-size: 10.5px; color: var(--muted); letter-spacing: .02em; }
.room-menu { width: 360px; max-width: calc(100vw - 24px); }
.menu-label { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin: 8px 10px 6px; font-weight: 600; }
.room-list { list-style: none; margin: 0; padding: 0; max-height: 46vh; overflow: auto; }
.room-list li { display: flex; align-items: center; gap: 2px; border-radius: 14px; }
.room-list li.is-on { background: var(--clay-soft); }
.menu .room-pick { flex: 1; min-width: 0; gap: 10px; padding: 8px 8px 8px 10px; }
.room-list li.is-on .room-pick:hover { background: transparent; }
.room-sw { width: 30px; height: 30px; border-radius: 9px; flex: none; background: linear-gradient(180deg, var(--w) 0 55%, var(--f) 55%); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); }
.room-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.room-txt strong { font-family: var(--serif); font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-txt small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-pick em { font-style: normal; font-weight: 600; font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.room-ord { display: flex; flex-direction: column; gap: 0; padding-right: 4px; }
.menu .room-ord .iconbtn { width: 22px; height: 18px; padding: 0; border-radius: 6px; justify-content: center; }
.room-ord .ic { width: 13px; height: 13px; }
.ic.flipv { transform: scaleY(-1); }
.room-ord .iconbtn:disabled { opacity: .25; }
.room-grand { display: flex; justify-content: space-between; align-items: baseline; margin: 8px 10px 4px; font-size: 12px; color: var(--muted); }
.room-grand strong { font-family: var(--serif); font-size: 17px; color: var(--ink); }
.menu button.danger { color: var(--warn); }
.menu button:disabled { opacity: .4; pointer-events: none; }
.starter-row { align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--clay-soft); }
.starter-row span { display: flex; flex-direction: column; gap: 2px; }
.starter-row small { color: var(--muted); font-size: 12px; }

/* ---------- planner modes and wall view ---------- */
.stage-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; flex-wrap: wrap; }
.mode-seg, .wall-picker { display: inline-flex; gap: 2px; padding: 4px; border-radius: 999px; background: rgba(236, 233, 244, .7); border: 1px solid var(--line); }
.mode-seg button, .wall-picker button { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--ink-2); font-weight: 600; font-size: 12.5px; transition: background .25s, color .25s, box-shadow .25s; }
.mode-seg .ic { width: 15px; height: 15px; }
.mode-seg button[aria-pressed="true"] { background: var(--grad); color: #FFFFFF; box-shadow: 0 6px 14px -6px rgba(106, 17, 203, .55); }
.wall-picker button[aria-pressed="true"] { background: #FFFFFF; color: var(--clay); box-shadow: var(--shadow-sm); }
.wall-picker em { font-style: normal; font-size: 10px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--clay-soft); color: var(--clay); display: inline-grid; place-items: center; padding: 0 4px; }
.wall-picker em:empty { display: none; }
.app:not(.is-walls) .wall-picker { opacity: .55; }
.app:not(.is-walls) .wall-picker:hover { opacity: 1; }
.wall-wrap { display: none; position: relative; height: clamp(440px, calc(100vh - 376px), 1060px); border-radius: 24px; overflow: hidden; padding: 46px 14px 10px;
  background: radial-gradient(circle at 1px 1px, rgba(120, 112, 140, .18) 1px, transparent 0) 0 0 / 20px 20px, linear-gradient(180deg, #F7F7FA, #ECEAF3);
  box-shadow: inset 0 0 0 1px var(--line), inset 0 2px 12px rgba(38, 18, 72, .05); touch-action: none; }
.app.is-walls .wall-wrap { display: block; }
.app.is-walls .plan-wrap, .app.is-walls #selbar { display: none !important; }
.wall-wrap.drop-active { box-shadow: inset 0 0 0 2px var(--clay), inset 0 2px 12px rgba(38, 18, 72, .05); }
.wall-view, .wall-view svg { width: 100%; height: 100%; display: block; }
.wall-svg { user-select: none; -webkit-user-select: none; touch-action: none; animation: fadeIn .4s var(--ease); }

.wv-dim line { stroke: #8A7C9A; stroke-width: .45; }
.wv-dim text, .bk-dim text { fill: #4E4859; font-family: var(--serif); font-weight: 600; }
.wv-dim-bg { fill: #FFFFFF; stroke: var(--line-2); stroke-width: .3; }
.wv-frame { opacity: .55; }
.wv-grid line { stroke: #000; stroke-opacity: .07; stroke-width: .3; }
.wv-eye line { stroke: var(--gold); stroke-width: .5; stroke-dasharray: 3 2; }
.wv-eye rect { fill: rgba(255, 255, 255, .92); stroke: rgba(255, 122, 61, .5); stroke-width: .3; }
.wv-eye text { fill: #B3531F; font-family: var(--sans); font-weight: 600; }
.wv-empty { fill: var(--ink-2); opacity: .55; font-family: var(--serif); font-weight: 600; }
.wv-item { cursor: grab; outline: none; }
.wv-item:hover > g { filter: brightness(1.05); }
.wv-labels text, .wv-sil-labels text { fill: #2E2A25; font-family: var(--sans); font-weight: 600; paint-order: stroke; stroke: rgba(255, 255, 255, .92); stroke-width: 1.1px; }
.wv-sel .sel-box { fill: none; stroke: var(--clay); stroke-width: .5; stroke-dasharray: 2 1.4; }
.wv-sel .sel-corner { fill: #FFFFFF; stroke: var(--clay); stroke-width: .5; }
.wv-sel .rs-hit { fill: transparent; }
.wv-sel .rs-handle { cursor: var(--rs-cursor, nwse-resize); }
.wv-hline { stroke: var(--clay); stroke-width: .4; stroke-dasharray: 1.4 1; }
.wv-hdot { fill: var(--clay); }
.wv-tag { fill: #2A1E3A; }
.wv-tag-text { fill: #FFFFFF; font-family: var(--sans); font-weight: 600; }
.wv-gap { stroke: var(--gold); stroke-width: .5; marker-start: none; }
.wv-gap-text { fill: #B3531F; font-family: var(--sans); font-weight: 700; paint-order: stroke; stroke: rgba(255, 255, 255, .9); stroke-width: 1px; }
.wall-mark { cursor: pointer; stroke: rgba(0, 0, 0, .28); stroke-width: .3; transition: opacity .2s; }
.wall-mark:hover { opacity: .75; }
.stage-dock:has(#selbar:not([hidden])) .stage-foot, .stage-dock:has(#wallbar:not([hidden])) .stage-foot { display: none; }
.app.is-walls .stage-foot-plan, .app:not(.is-walls) .stage-foot-wall { display: none; }

/* ---------- design book ---------- */
.app[data-view="book"] { grid-template-columns: minmax(0, 1fr); }
.app[data-view="book"] .dashboard { display: none !important; }
.app[data-view="book"] .view-book { display: block; }
.book-bar { min-height: 0; }
.book-bar .view-head { margin-bottom: 18px; }
.book-bar .hero-copy p:last-child { max-width: 640px; color: var(--muted); }
.view-head h1 em { font-style: normal; }
.book-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.book-actions small { width: 100%; text-align: right; color: var(--muted); font-size: 12px; }
.book-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.book-fields .field { margin: 0; }
.book-pages { display: flex; flex-direction: column; align-items: center; gap: 28px; margin-top: var(--gap); }
.book-page { width: 100%; max-width: 1040px; background: #FFFFFF; border-radius: 6px; box-shadow: var(--shadow); padding: 48px 52px; color: var(--ink); position: relative; }
.book-page h2 { font-size: 32px; margin: 2px 0 4px; }
.book-page h3 { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--clay); margin: 22px 0 10px; font-weight: 700; }
.cover-page { min-height: 760px; display: flex; flex-direction: column; justify-content: center; padding: 64px 72px; background: radial-gradient(900px 520px at 100% 0%, #F1E7FC 0%, rgba(241, 231, 252, 0) 60%), radial-gradient(700px 420px at 0% 100%, #FFEDE3 0%, rgba(255, 237, 227, 0) 60%), #FFFFFF; overflow: hidden; }
.cover-page::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 10px; background: var(--grad); }
.cover-logo { width: 280px; height: auto; margin-bottom: 52px; }
.cover-page h1 { font-size: 56px; line-height: 1.02; margin: 6px 0 14px; max-width: 760px; }
.cover-client { font-size: 20px; color: var(--ink-2); margin: 0 0 6px; }
.cover-meta { color: var(--muted); margin: 0 0 36px; }
.cover-rooms { list-style: none; counter-reset: rm; padding: 0; margin: 0 0 28px; max-width: 560px; border-top: 1px solid var(--line); }
.cover-rooms li { counter-increment: rm; display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-family: var(--serif); font-weight: 600; }
.cover-rooms li span::before { content: counter(rm, decimal-leading-zero); color: var(--clay); margin-right: 14px; font-size: 12px; letter-spacing: .1em; }
.cover-rooms em { font-style: normal; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cover-total { display: inline-flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.cover-total span { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.cover-total strong { font-family: var(--serif); font-size: 34px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cover-total small { color: var(--muted); }
.cover-demo { margin-top: 32px; font-size: 11.5px; color: var(--muted); }
.bp-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; padding-bottom: 18px; border-bottom: 2px solid var(--ink); margin-bottom: 22px; }
.bp-meta { color: var(--muted); margin: 0; font-size: 14px; }
.bp-total { text-align: right; flex: none; }
.bp-total span { display: block; font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.bp-total strong { font-family: var(--serif); font-size: 28px; }
.bp-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(220px, 1fr); gap: 30px; align-items: start; }
.bp-plan { margin: 0; }
.book-plan { width: 100%; height: auto; max-height: 520px; display: block; }
.bp-plan figcaption, .bp-wall-grid figcaption { font-size: 11.5px; color: var(--muted); margin-top: 6px; text-align: center; }
.bp-side h3:first-child { margin-top: 0; }
.bp-pal { list-style: none; padding: 0; margin: 0; display: grid; gap: 7px; }
.bp-pal li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 10px; font-size: 13px; }
.bp-pal i { width: 26px; height: 26px; border-radius: 7px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
.bp-pal span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bp-pal code { font-size: 11px; color: var(--muted); }
.bp-note { font-size: 14px; line-height: 1.55; color: var(--ink-2); margin: 0; }
.bp-budget { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0; font-size: 13.5px; }
.bp-budget dt { color: var(--ink-2); } .bp-budget dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.bp-budget .t { font-weight: 700; color: var(--ink); border-top: 1px solid var(--line-2); padding-top: 6px; }
.bp-wall-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 24px; }
.bp-wall-grid figure { margin: 0; }
.book-wall { width: 100%; height: auto; max-height: 260px; display: block; }
.bp-items table, .bp-sum { width: 100%; border-collapse: collapse; font-size: 13px; }
.bp-items th, .bp-sum th { text-align: left; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 0 8px 8px 0; border-bottom: 1px solid var(--line-2); }
.bp-items td, .bp-sum td { padding: 8px 8px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.bp-items td small { font-size: 10px; color: var(--clay); text-transform: uppercase; letter-spacing: .1em; margin-left: 4px; }
.bp-sum td small { display: block; font-size: 11px; color: var(--muted); }
.bp-sum tfoot td { font-weight: 700; border-bottom: 0; border-top: 2px solid var(--ink); }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.bk-dim line { stroke: #8A7C9A; stroke-width: .45; }
.bk-labels text { fill: #2E2A25; font-family: var(--sans); font-weight: 600; paint-order: stroke; stroke: rgba(255, 255, 255, .92); stroke-width: 1.1px; }
.bk-north circle { fill: #FFFFFF; stroke: #4E4859; stroke-width: .4; }
.bk-north text { fill: #4E4859; font-weight: 700; font-family: var(--sans); }

@media (max-width: 1280px) { .save-state .txt { display: none; } .save-state { margin-right: 4px; } .navbtn { padding: 0 13px; } }
@media (max-width: 1120px) { .room-btn-txt small { display: none; } .room-btn-txt strong { max-width: 110px; } }
@media (max-width: 960px) { .book-page { padding: 32px; } .bp-grid { grid-template-columns: minmax(0, 1fr); } .book-fields { grid-template-columns: minmax(0, 1fr); } .cover-page h1 { font-size: 42px; } }
@media (max-width: 760px) {
  .rooms-wrap { margin-right: 0; margin-left: auto; }
  .room-btn { height: 38px; padding: 0 8px 0 9px; gap: 6px; border-radius: 12px; }
  .room-btn-txt strong { max-width: 92px; font-size: 13px; }
  .room-menu { position: fixed; left: 12px; right: 12px; top: calc(var(--header-h) + 4px); width: auto; }
  .stage-bar { margin: 0 2px 8px; gap: 6px; }
  .mode-seg button, .wall-picker button { height: 30px; padding: 0 10px; font-size: 12px; }
  .mode-seg .ic { display: none; }
  .wall-picker button { padding: 0 8px; }
  .wall-wrap { height: auto; aspect-ratio: 1.35; max-height: 34vh; padding: 34px 6px 6px; border-radius: 16px; }
  .wall-wrap .plan-legend { display: none; }
  .book-page { padding: 22px 18px; border-radius: 4px; }
  .cover-page { min-height: 0; padding: 32px 22px; }
  .cover-logo { width: 200px; margin-bottom: 30px; }
  .cover-page h1 { font-size: 32px; }
  .bp-head { flex-direction: column; align-items: flex-start; }
  .bp-total { text-align: left; }
  .bp-wall-grid { grid-template-columns: minmax(0, 1fr); }
  .bp-sum { font-size: 11.5px; } .bp-sum th:nth-child(6), .bp-sum td:nth-child(6), .bp-sum th:nth-child(3), .bp-sum td:nth-child(3) { display: none; }
  .book-actions small { text-align: left; }
}
@media (max-width: 400px) { .wall-picker button { padding: 0 6px; font-size: 11.5px; } .mode-seg button { padding: 0 8px; } }

/* printing from the design book prints only the book pages */
@media print {
  .app[data-view="book"] .view-budget, .app[data-view="book"] .book-bar { display: none !important; }
  .app[data-view="book"] .view-book { display: block !important; }
  .book-pages { gap: 0; margin: 0; display: block; }
  .book-page { box-shadow: none; border-radius: 0; max-width: none; padding: 0.2in 0.1in; break-after: page; page-break-after: always; }
  .book-page:last-child { break-after: auto; page-break-after: auto; }
  .cover-page { min-height: 9.4in; background: #FFFFFF; }
  .cover-page::after { height: 6px; }
  .bp-grid { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
  .book-plan { max-height: 4.4in; }
  .book-wall { max-height: 2.1in; }
  .bp-walls, .bp-items, .bp-wall-grid figure, tr { break-inside: avoid; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
@page { size: letter; margin: 0.5in; }
@media (max-width: 760px) { .tabbar { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; } .tabbar button { padding: 7px 2px; font-size: 10px; } }
@media print { html, body { background: #FFFFFF !important; } .book-plan { max-height: 3.9in; } .book-wall { max-height: 1.8in; } }
.brand { min-width: max-content; }
.brand-logo { max-width: none; flex: none; }
@media (max-width: 1120px) and (min-width: 761px) { .navbtn .ic { display: none; } .navbtn { padding: 0 12px; } .topbar { gap: 12px; } }
@media (max-width: 760px) { .plan-wrap, .wall-wrap { max-height: 30vh; } .stage-bar { margin-bottom: 6px; } }

/* ---------- your palettes ---------- */
.field input[type="password"], .field select, .field textarea {
  min-height: 44px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line-2); background: rgba(249, 248, 252, .8);
  outline: none; transition: border-color .2s, box-shadow .25s var(--ease), background .2s; width: 100%; min-width: 0;
}
.field textarea { padding: 12px 14px; resize: vertical; line-height: 1.5; font-size: 13.5px; }
.field select { appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236A11CB' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; cursor: pointer; }
.field textarea:focus, .field select:focus, .field input[type="password"]:focus { border-color: var(--clay); background-color: var(--surface-solid); box-shadow: var(--ring); }
.field input[type="color"] { width: 100%; height: 44px; border: 1px solid var(--line-2); border-radius: 14px; padding: 4px; background: rgba(249, 248, 252, .8); cursor: pointer; }
.field input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.field input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 10px; }
.pal-top-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pal-top-row .btn { flex: none; }
.pal-apply { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.pal-apply > span { font-size: 11.5px; color: var(--muted); margin-right: 2px; }
.pal-apply .chip { height: 30px; padding: 0 12px; font-size: 12px; }
.pal-list { display: flex; flex-direction: column; gap: 10px; }
.pal-empty { padding: 14px; border: 1px dashed var(--line-2); border-radius: 16px; background: rgba(249, 248, 252, .6); line-height: 1.5; }
.upal { padding: 10px; border: 1px solid var(--line); border-radius: 18px; background: rgba(249, 248, 252, .75); }
.pal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.pal-txt { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.pal-txt strong { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-txt small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-acts { display: flex; flex: none; gap: 2px; }
.pal-sw { grid-template-columns: repeat(6, 1fr); gap: 7px; }
.pal-sw .swatch { aspect-ratio: 1; }
.modal-wide { width: min(640px, calc(100vw - 32px)); }
.modal-wide form { max-height: calc(100vh - 40px); overflow-y: auto; }
.pal-tabs { margin: 4px 0 6px; }
.pal-drop { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 26px 20px; border: 1.5px dashed var(--line-2); border-radius: 20px; background: rgba(249, 248, 252, .7); cursor: pointer; transition: all .25s var(--ease); }
.pal-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.pal-drop .ic { width: 26px; height: 26px; color: var(--brand, #6A11CB); }
.pal-drop strong { font-size: 14px; }
.pal-drop small { font-size: 12px; color: var(--muted); max-width: 440px; line-height: 1.5; }
.pal-drop:hover, .pal-drop.is-over { border-color: var(--brand, #6A11CB); background: rgba(106, 17, 203, .05); }
.pal-drop:focus-within { box-shadow: var(--ring); }
.pal-api-grid { display: grid; grid-template-columns: 1fr 1.6fr .8fr; gap: 10px; }
.pal-api-grid.two { grid-template-columns: 1fr 1fr; }
.pal-api-grid .field { margin-bottom: 12px; }
[data-ppane] > .btn { align-self: flex-start; }
[data-ppane] { display: flex; flex-direction: column; }
[data-ppane][hidden] { display: none; }
#palApiCustom .check { margin: 0 0 10px; align-items: flex-start; }
#palApiCustom .check span { display: flex; flex-direction: column; gap: 2px; }
#palApiCustom .check small { color: var(--muted); font-size: 12px; }
#palApiCustom .hint { margin-bottom: 12px; line-height: 1.5; }
.pal-status { font-size: 12.5px; color: var(--muted); min-height: 1px; margin: 0; }
.pal-status:empty { display: none; }
.pal-status.is-ok { color: var(--ink-2); }
.pal-status.is-warn { color: var(--warn); }
.is-busy .pal-status::before { content: ''; display: inline-block; width: 11px; height: 11px; margin-right: 7px; vertical-align: -1px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: palspin .8s linear infinite; }
@keyframes palspin { to { transform: rotate(360deg); } }
.pal-preview { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; max-height: 38vh; overflow-y: auto; padding: 2px; }
.pal-pv { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pal-chip { width: 30px; height: 30px; border-radius: 9px; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); }
.pal-pv input { flex: 1; min-width: 0; height: 32px; padding: 0 9px; border-radius: 10px; border: 1px solid var(--line); background: rgba(249, 248, 252, .8); font-size: 12.5px; outline: none; }
.pal-pv input:focus { border-color: var(--clay); box-shadow: var(--ring); }
.pal-pv code { font-size: 11px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
@media (max-width: 760px) {
  .pal-preview { grid-template-columns: 1fr; }
  .pal-api-grid { grid-template-columns: 1fr 1fr; }
  .pal-api-grid .field:first-child { grid-column: 1 / -1; }
  .pal-api-grid.two { grid-template-columns: 1fr; }
  .pal-sw { grid-template-columns: repeat(8, 1fr); }
}
#palSave:disabled { opacity: .4; cursor: default; box-shadow: none; transform: none; }
@media (max-width: 760px) {
  .pal-tabs .ic { display: none; }
  .pal-tabs .seg-btn { font-size: 12px; padding: 0 4px; }
  .topbar-actions { gap: 0; }
  .topbar-actions .iconbtn { width: 34px; }
}

/* ---------- mood board inside the design book ---------- */
.app[data-view="book"] .mood-panel { display: block; }
.mood-panel { margin: var(--gap) auto 0; max-width: 1040px; min-height: 0; }
.mood-panel .mood-h { font-size: 43.2px; line-height: 1.02; }
.book-cover-host:empty { display: none; }
.mood-page.is-live { display: none; }
.mp-pal-row { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px 22px; }
.mp-notes { display: grid; gap: 10px; }
.mp-note { padding: 14px 16px; border-left: 3px solid var(--brand); background: #F8F6FC; border-radius: 0 10px 10px 0; }
.mp-note strong { display: block; font-size: 13px; margin-bottom: 4px; }
.mp-note p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--ink-2); white-space: pre-line; }
.mp-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.mp-card { margin: 0; border: 1px solid #ECE9F2; border-radius: 10px; overflow: hidden; break-inside: avoid; }
.mp-img { aspect-ratio: 4 / 3; background: #F1EEF6; overflow: hidden; }
.mp-material .mp-img { aspect-ratio: 1 / 1; }
.mp-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mp-card figcaption { padding: 8px 10px; display: flex; flex-direction: column; line-height: 1.3; }
.mp-card strong, .mp-col strong { font-size: 12.5px; font-weight: 600; }
.mp-card small { font-size: 11px; color: var(--muted); }
.mp-colgrid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.mp-col { margin: 0; break-inside: avoid; }
.mp-col i { display: block; aspect-ratio: 1; border-radius: 10px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); }
.mp-col figcaption { display: flex; flex-direction: column; margin-top: 6px; line-height: 1.25; }
.mp-col code { font-size: 10.5px; color: var(--muted); }
@media (max-width: 760px) {
  .mood-panel .mood-h { font-size: 30.4px; }
  .mp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mp-colgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tabbar { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
}
@media print {
  .app[data-view="book"] .mood-panel { display: none !important; }
  .mood-page.is-live { display: block; }
  .book-cover-host { display: block; margin: 0; }
  .book-cover-host .book-page { break-after: page; page-break-after: always; }
  .mp-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .mp-colgrid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .mp-vis, .mp-cols, .mp-notes, .mp-pal { break-inside: auto; }
}
.pill-brand { background: var(--brand); color: #FFFFFF; text-transform: uppercase; letter-spacing: .1em; }

/* ---------- homes ---------- */
.app[data-view="homes"] { grid-template-columns: minmax(0, 1fr); }
.app[data-view="homes"] .dashboard { display: none !important; }
.app[data-view="homes"] .view-homes { display: block; }
body[data-view="homes"] .rooms-wrap, body[data-view="homes"] #btnUndo, body[data-view="homes"] #btnRedo,
body[data-view="homes"] #demoBanner, body[data-view="homes"] #tabBanner, body[data-view="homes"] .in-home { display: none !important; }
.menu-label { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin: 6px 12px 4px; }
.homes-bar { min-height: 0; }
.homes-bar .view-head { margin-bottom: 18px; }
.homes-bar .hero-copy p:last-child { max-width: 640px; color: var(--muted); }
.homes-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.homes-search { flex: 1 1 280px; margin: 0; }
.homes-tools .chips { flex: 2 1 340px; }
.homes-tools .chip small { opacity: .6; font-weight: 500; margin-left: 2px; }
.homes-sort { flex: 0 0 auto; display: flex; flex-direction: row; align-items: center; gap: 8px; margin: 0; }
.homes-sort span { margin: 0; }
.homes-sort select { min-width: 150px; }
.homes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: var(--gap); margin-top: var(--gap); }
.hcard { position: relative; background: var(--surface-solid); border: 1px solid var(--line); border-radius: var(--r-xl); overflow: hidden; display: flex; flex-direction: column;
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .3s; animation: riseIn .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms); }
.hcard:hover { transform: translateY(-3px); box-shadow: 0 18px 40px -22px rgba(42, 11, 82, .45); border-color: var(--line-2); }
.hcard.is-open { border-color: rgba(106, 17, 203, .45); box-shadow: 0 0 0 3px rgba(106, 17, 203, .1); }
.hcard-main { display: flex; flex-direction: column; border: 0; background: none; padding: 0; text-align: left; color: inherit; cursor: pointer; flex: 1; font: inherit; }
.hcard-plan { display: block; height: 170px; background: var(--surface-2); border-bottom: 1px solid var(--line); padding: 10px; }
.hcard-plan svg { width: 100%; height: 100%; display: block; }
.hcard-plan .bk-labels, .hcard-plan .bk-dim, .hcard-plan .bk-north { display: none; }
.hcard-body { display: flex; flex-direction: column; gap: 3px; padding: 14px 16px 10px; }
.hcard-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.hcard-here { font-size: 11px; color: var(--brand); font-weight: 600; }
.hcard-name { font-family: var(--serif); font-size: 19px; line-height: 1.2; color: var(--ink); }
.hcard-client { font-size: 13.5px; color: var(--ink-2); }
.hcard-client em { color: var(--faint); font-style: normal; }
.hcard-addr { font-size: 12.5px; color: var(--muted); }
.hcard-stats { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.hcard-stats b { color: var(--ink); font-weight: 600; font-size: 14px; }
.hcard-est { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.hcard-est small { font-size: 11px; }
.hcard-est small.over { color: var(--warn); }
.hcard-time { font-size: 11.5px; color: var(--faint); margin-top: 6px; }
.hcard-acts { display: flex; gap: 4px; padding: 0 10px 10px 12px; justify-content: flex-end; }
.hcard-acts .danger:hover { color: var(--warn); }
.hstatus { background: var(--surface-2); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.hstatus.st-concept { background: #F0E7FB; color: #520C9E; box-shadow: none; }
.hstatus.st-in-progress { background: #E6F0FB; color: #1D4E89; box-shadow: none; }
.hstatus.st-presented { background: #FFF0E2; color: #A6460F; box-shadow: none; }
.hstatus.st-approved { background: #E7EBE1; color: #3F5535; box-shadow: none; }
.hstatus.st-archived { background: #EEEDF1; color: #6F6A7B; box-shadow: none; }
.homes-empty { grid-column: 1 / -1; text-align: center; padding: 48px 20px; color: var(--muted); background: var(--surface); border-radius: var(--r-xl); border: 1px dashed var(--line-2); }
.homes-empty h3 { font-family: var(--serif); color: var(--ink); font-size: 22px; margin: 0 0 6px; }
.homes-storage { margin: 18px 4px 0; text-align: center; }
.homes-storage.warn { color: var(--warn); }
.home-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.home-form .span2 { grid-column: 1 / -1; }
.home-form .field { margin: 0; }
.home-start { margin-bottom: 14px; }
.home-start select { margin-top: 10px; width: 100%; }
.home-start[hidden] { display: none; }
.cover-address { color: var(--muted); margin: 0 0 6px; font-size: 14px; }
.pill-warn { background: var(--warn-soft); color: var(--warn); text-transform: uppercase; letter-spacing: .1em; }
.tab-banner { background: rgba(255, 233, 222, .8); }
.room-btn-txt small { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
@media (max-width: 760px) {
  .tabbar { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
  .homes-tools { gap: 10px; }
  .homes-tools .chips { flex-wrap: nowrap; overflow-x: auto; flex: 1 1 100%; padding-bottom: 2px; }
  .homes-tools .chip { flex: 0 0 auto; }
  .homes-sort { flex: 1 1 100%; }
  .homes-sort select { flex: 1; }
  .homes-grid { grid-template-columns: minmax(0, 1fr); }
  .home-form { grid-template-columns: minmax(0, 1fr); }
  .home-form .span2 { grid-column: auto; }
  .tab-banner .btn { padding: 0 10px; }
}
@media print { .view-homes, .tab-banner { display: none !important; } }

/* ---------- your catalogs ---------- */
.cat-bar { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.fcard-art.has-photo { display: flex; align-items: center; justify-content: center; }
.fcard-art.has-photo img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
svg.is-photo { background: transparent; }
.cat-modal { width: min(1000px, calc(100vw - 32px)); }
.cat-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 20px; margin-top: 8px; min-height: 360px; }
.cat-side { display: flex; flex-direction: column; gap: 10px; }
.cat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cat-list li { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 14px; padding: 4px 8px 4px 4px; background: var(--surface-solid); transition: border-color .2s, box-shadow .2s; }
.cat-list li.is-on { border-color: rgba(106, 17, 203, .45); box-shadow: 0 0 0 3px rgba(106, 17, 203, .08); }
.cat-pick { flex: 1; min-width: 0; text-align: left; border: 0; background: none; padding: 8px 8px; border-radius: 10px; display: flex; flex-direction: column; cursor: pointer; font: inherit; color: inherit; }
.cat-pick strong { font-size: 14px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-pick small { font-size: 11.5px; color: var(--muted); }
.cat-demo { border-style: dashed !important; }
.toggle-sw { flex: 0 0 auto; width: 38px; height: 22px; border-radius: 999px; border: 0; background: var(--line-2); position: relative; cursor: pointer; transition: background .25s; padding: 0; }
.toggle-sw i { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .25s var(--ease); }
.toggle-sw[aria-checked="true"] { background: var(--brand); }
.toggle-sw[aria-checked="true"] i { transform: translateX(16px); }
.cat-main { min-width: 0; }
.cat-head { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 12px; align-items: end; }
.cat-head h4 { margin: 0 0 4px; font-family: var(--serif); font-size: 18px; }
.cat-head .field { margin: 0; }
.cat-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 12px; }
.danger-text { color: var(--warn) !important; }
.cat-search { margin: 0 0 10px; }
.cat-items { list-style: none; margin: 0; padding: 0; max-height: 380px; overflow: auto; border: 1px solid var(--line); border-radius: 14px; }
.cat-items li { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.cat-items li:last-child { border-bottom: 0; }
.ci-img { flex: 0 0 52px; height: 52px; border-radius: 10px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.ci-img img, .ci-img svg { max-width: 46px; max-height: 46px; width: 46px; height: 46px; object-fit: contain; }
.ci-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ci-txt strong { font-size: 13.5px; color: var(--ink); }
.ci-txt small { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci-price { display: flex; flex-direction: column; align-items: flex-end; font-size: 13px; }
.ci-price small { font-size: 11px; color: var(--muted); }
.cat-empty { border: 1px dashed var(--line-2); border-radius: 14px; padding: 28px; text-align: center; color: var(--muted); }
.pc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 20px; }
.pc-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; align-content: start; }
.pc-form .span2 { grid-column: 1 / -1; }
.pc-form .field { margin: 0; }
.pc-form input[type="color"] { width: 100%; height: 42px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface-solid); padding: 4px; }
.pc-dims { display: flex; gap: 8px; align-items: flex-start; }
.pc-dims label { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pc-dims label small { font-size: 11px; color: var(--muted); }
.pc-dims input { width: 100%; }
.pc-unit { flex: 0 0 auto; margin: 0; }
.pc-unit .seg-btn { padding: 0 12px; }
.pc-side { display: flex; flex-direction: column; gap: 10px; }
.pc-photo { height: 180px; border-radius: 16px; background: repeating-conic-gradient(#F1EEF5 0% 25%, #FFFFFF 0% 50%) 0 0 / 16px 16px; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--faint); font-size: 13px; overflow: hidden; }
.pc-photo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pc-photo-actions { display: flex; gap: 8px; }
.pc-side .field, .pc-side .check { margin: 0; }
.pc-plan-label { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 4px 0 0; }
.pc-plan { height: 130px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 10px; gap: 4px; }
.pc-plan svg { width: 100%; height: 96px; }
.pc-plan small { font-size: 11px; color: var(--muted); text-align: center; }
#dlgPiece .modal-actions { display: flex; align-items: center; }
#dlgPiece .grow { flex: 1; }
.drop-zone { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 36px 20px; border: 1.5px dashed var(--line-2); border-radius: 18px; text-align: center; cursor: pointer; background: var(--surface-2); transition: border-color .2s, background .2s; }
.drop-zone:hover, .drop-zone.is-over { border-color: var(--brand); background: var(--clay-soft); }
.drop-zone .ic { width: 26px; height: 26px; color: var(--brand); }
.drop-zone small { color: var(--muted); font-size: 12px; }
.im-sample { display: inline-block; margin-top: 10px; color: var(--brand); }
.im-top { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 14px; }
.im-top .field, .im-map .field { margin: 0; }
.im-h { font-size: 13px; margin: 16px 0 8px; font-weight: 700; color: var(--ink); }
.im-h small { font-weight: 400; color: var(--muted); margin-left: 6px; }
.im-map { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 12px; }
.im-map select { font-size: 13px; }
.im-preview { border: 1px solid var(--line); border-radius: 14px; overflow: auto; max-height: 300px; }
.im-preview table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.im-preview th, .im-preview td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.im-preview th { font-size: 11px; color: var(--muted); font-weight: 600; background: var(--surface-2); position: sticky; top: 0; }
.im-preview td small { display: block; color: var(--muted); font-size: 11px; }
.im-preview .num { text-align: right; }
.im-preview tr.is-check td { background: rgba(255, 233, 222, .45); }
.im-art svg { width: 44px; height: 34px; display: block; }
.bp-ph { width: 46px; padding-right: 0 !important; }
.bp-ph img { width: 40px; height: 40px; object-fit: contain; display: block; }
.wv-photo image { pointer-events: none; }
@media (max-width: 760px) {
  .cat-layout, .pc-layout { grid-template-columns: minmax(0, 1fr); }
  .cat-head { grid-template-columns: minmax(0, 1fr); }
  .cat-items { max-height: none; }
  .pc-form { grid-template-columns: minmax(0, 1fr); }
  .pc-form .span2 { grid-column: auto; }
  .pc-dims { flex-wrap: wrap; }
  .pc-dims label { flex: 1 1 28%; }
  .im-top, .im-map { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ci-price small { display: none; }
}
#dlgPiece, #dlgImport { width: min(920px, calc(100vw - 32px)); }

/* ---------- account, sign in, team ---------- */
.acct-btn.is-in { padding: 0 6px 0 4px; gap: 0; }
.acct-btn.is-in .ic { display: none; }
.acct-btn.is-in #accountLabel { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--brand, #4A3478); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .03em; }
.acct-menu { min-width: 250px; }
.acct-who { display: grid; gap: 2px; padding: 10px 12px 6px; }
.acct-who strong { font-size: 14px; }
.acct-who small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
body:not(.is-owner) .owner-only { display: none !important; }
.auth-modal { width: min(440px, calc(100vw - 32px)); }
.auth-modal form { display: grid; gap: 12px; }
.auth-modal h3, .auth-modal .muted { margin: 0; }
.auth-fixed { margin: 0; font-weight: 600; font-size: 13.5px; overflow-wrap: anywhere; }
.auth-err, .warn-text { margin: 0; padding: 9px 12px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); font-size: 13px; }
.warn-text { background: none; padding: 0; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.auth-modal .field[hidden], .auth-modal [hidden] { display: none !important; }
#dlgTeam { width: min(720px, calc(100vw - 32px)); }
.team-wrap { display: grid; gap: 14px; }
.team-wrap h3, .team-wrap h4, .team-wrap .muted { margin: 0; }
.team-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.team-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-solid); }
.team-row > div:first-child { display: grid; gap: 2px; min-width: 0; }
.team-row small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.team-row.is-pending { border-style: dashed; }
.team-row.is-off { opacity: .6; }
.team-acts { display: flex; gap: 6px; flex-shrink: 0; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; }
.team-invite { display: grid; gap: 8px; padding-top: 4px; border-top: 1px solid var(--line); }
.team-invite h4 { padding-top: 10px; font-size: 14px; }
.team-invite-row { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 10px; align-items: end; }
.team-link { display: grid; gap: 8px; padding: 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.team-link p { margin: 0; font-size: 13px; }
.team-link-row { display: flex; gap: 8px; }
.team-link-row input { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
@media (max-width: 760px) {
  .team-invite-row { grid-template-columns: 1fr; }
  .team-row { flex-direction: column; align-items: stretch; }
  .acct-btn:not(.is-in) #accountLabel { display: none; }
}
.team-wrap { padding: 28px; max-height: calc(100vh - 40px); overflow: auto; }
.auth-modal .field, .team-invite .field, #dlgPassword .field { margin-bottom: 0; }
.auth-modal .hint { margin: -4px 0 0; }
#dlgTeam form.team-invite { padding: 4px 0 0; }
