/* Dream Home — one stylesheet. Phone first; from 900 px the editor has its tools on the left
   and its panel on the right. Light and dark follow the system unless Settings says otherwise
   (html[data-theme]). Viewport units are divided by --ca-zoom (APP_STANDARD §6.5). */
:root {
  color-scheme: light dark;
  --bg: #f4f2ec;
  --surface: #ffffff;
  --surface-2: #f7f6f2;
  --text: #1b2029;
  --muted: #5d6573;
  --line: rgba(27, 32, 41, 0.12);
  --line-2: rgba(27, 32, 41, 0.2);
  --accent: #1f7a6d;
  --accent-soft: rgba(31, 122, 109, 0.12);
  --danger: #b3372f;
  --shadow: 0 10px 30px -12px rgba(20, 24, 32, 0.28), 0 2px 6px rgba(20, 24, 32, 0.08);
  --on-accent: #ffffff;
  --ca-accent: #1f7a6d; /* the accounts SDK's sheets and chip */
  --r: 14px;
  --bar: 54px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0f1218; --surface: #181c25; --surface-2: #1e232e; --text: #eceef3; --muted: #a2aab8; --line: rgba(236, 238, 243, 0.12); --line-2: rgba(236, 238, 243, 0.22);
    --accent: #48b8a6; --on-accent: #06211d; --accent-soft: rgba(72, 184, 166, 0.16); --danger: #f0877f; --shadow: 0 12px 34px -12px rgba(0, 0, 0, 0.7), 0 2px 6px rgba(0, 0, 0, 0.4);
  }
}
:root[data-theme='dark'] {
  --bg: #0f1218; --surface: #181c25; --surface-2: #1e232e; --text: #eceef3; --muted: #a2aab8; --line: rgba(236, 238, 243, 0.12); --line-2: rgba(236, 238, 243, 0.22);
  --accent: #48b8a6; --on-accent: #06211d; --accent-soft: rgba(72, 184, 166, 0.16); --danger: #f0877f; --shadow: 0 12px 34px -12px rgba(0, 0, 0, 0.7), 0 2px 6px rgba(0, 0, 0, 0.4);
}
* { box-sizing: border-box; }
/* no double-tap zoom on iOS: js/touch-guard.js adds the same rule plus a JS
   fallback; this copy covers Safari before 16.4 under the strict CSP */
:where(html, body, body *) { touch-action: manipulation; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; height: calc(100dvh / var(--ca-zoom, 1)); overflow: hidden;
  background: var(--bg); color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.screen { height: 100%; display: flex; flex-direction: column; padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }

/* ---------- shared controls ---------- */
.icon-btn { width: 40px; height: 40px; min-width: 40px; border-radius: 12px; border: 1px solid transparent; background: transparent; color: var(--text); display: grid; place-items: center; padding: 0; }
.icon-btn:hover { background: var(--accent-soft); }
.icon-btn:disabled { opacity: 0.35; cursor: default; background: transparent; }
.icon-btn.float { background: var(--surface); border-color: var(--line); box-shadow: var(--shadow); width: 44px; height: 44px; }
.icon-btn.danger { color: var(--danger); }
.btn { min-height: 44px; padding: 0 18px; border-radius: 13px; border: 0; background: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line-2); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.small { min-height: 36px; padding: 0 12px; border-radius: 10px; font-size: 14px; }
.btn.wide { width: 100%; }
.field { min-height: 40px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); padding: 0 10px; min-width: 0; -webkit-user-select: text; user-select: text; }
select.field { padding-right: 6px; }
.switch { appearance: none; -webkit-appearance: none; width: 46px; height: 28px; border-radius: 14px; background: var(--line-2); position: relative; margin: 0; flex: none; cursor: pointer; transition: background-color 0.15s; }
.switch::after { content: ''; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.15s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(18px); }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; box-shadow: var(--shadow); }
.seg-btn { min-height: 36px; padding: 0 12px; border: 0; background: transparent; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--muted); white-space: nowrap; }
.seg-btn[aria-pressed='true'] { background: var(--accent); color: var(--on-accent); }
.ebar .seg { box-shadow: none; background: var(--surface-2); }
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translate(-50%, 16px); background: #1d222c; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: min(calc(92vw / var(--ca-zoom, 1)), 460px); opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 60; text-align: center; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- sheets ---------- */
.sheet { border: 0; border-radius: 22px; padding: 0; width: min(calc(94vw / var(--ca-zoom, 1)), 440px); max-height: min(calc(88dvh / var(--ca-zoom, 1)), 760px); background: var(--surface); color: var(--text); box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.6); overflow: hidden; }
.sheet[open] { display: flex; flex-direction: column; }
.sheet.wide { width: min(calc(94vw / var(--ca-zoom, 1)), 640px); }
.sheet.small { width: min(calc(92vw / var(--ca-zoom, 1)), 380px); padding: 22px; gap: 14px; }
.sheet::backdrop { background: rgba(10, 12, 18, 0.5); }
.sheet > h2 { font-size: 18px; padding: 20px 22px 12px; }
.sheet.small > h2 { padding: 0; }
.sheet-body { padding: 0 22px 6px; overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
.sheet-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 22px 20px; margin: 0; }
.sheet.small .sheet-actions { padding: 4px 0 0; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 54px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.row > span { flex: 1; min-width: 0; }
.version { color: var(--muted); font-size: 13px; padding: 12px 0 4px; }
.prose, .prose p, .prose li { -webkit-user-select: text; user-select: text; }
.prose h3 { font-size: 15px; margin: 16px 0 4px; }
.prose p { color: var(--muted); }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 8px 0 4px; align-items: center; }
.keys dt, .keys dd { margin: 0; }
.keys dd { color: var(--muted); }
kbd { display: inline-block; min-width: 30px; text-align: center; padding: 2px 7px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--surface-2); font: 600 12px/1.6 ui-monospace, Menlo, monospace; }
.pop { position: fixed; left: var(--x, 8px); top: var(--y, 8px); z-index: 50; min-width: 220px; max-width: min(calc(92vw / var(--ca-zoom, 1)), 320px); max-height: calc(80dvh / var(--ca-zoom, 1)); overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 8px; }
.pop h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 6px 10px 4px; }
.pop hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
.pop-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 10px; border: 0; background: transparent; border-radius: 10px; text-align: left; }
.pop-item:hover, .pop-item[aria-current='true'] { background: var(--accent-soft); }
.pop-item[aria-current='true'] { color: var(--accent); font-weight: 600; }
.pop-item.danger { color: var(--danger); }
.pop-check { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 44px; padding: 0 10px; }

/* ---------- home ---------- */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; min-height: var(--bar); }
.home-main { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 8px 16px calc(28px + env(safe-area-inset-bottom)); width: 100%; max-width: 1180px; margin: 0 auto; }
.home-main h2 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); font-weight: 650; }
.start { margin-bottom: 26px; }
.start-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.start-card { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); box-shadow: 0 1px 2px rgba(20, 24, 32, 0.05); min-height: 118px; min-width: 0; }
.start-card:hover { border-color: var(--accent); }
.start-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 8px; }
.start-card b { font-size: 15px; }
.start-card small { color: var(--muted); font-size: 13px; line-height: 1.3; }
.mine-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 14px; margin-top: 12px; }
.proj { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; }
.proj-open { border: 0; padding: 0; background: #e7ebdf; display: block; width: 100%; aspect-ratio: 3 / 2; }
.card-pic { width: 100%; height: 100%; display: block; }
.proj-foot { display: flex; align-items: center; gap: 8px; padding: 10px 8px 10px 14px; }
.proj-text { flex: 1; min-width: 0; }
.proj-text h3 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-text p { font-size: 13px; color: var(--muted); }
.empty { color: var(--muted); padding: 22px 4px; }

/* ---------- editor frame ---------- */
.editor { background: var(--bg); }
.ebar { display: flex; align-items: center; gap: 4px; min-height: var(--bar); padding: 6px 8px; background: var(--surface); border-bottom: 1px solid var(--line); }
.proj-name { flex: 1 1 0; min-width: 0; height: 40px; border: 0; background: transparent; border-radius: 10px; text-align: left; padding: 0 8px; font-weight: 650; font-size: 16px; }
.proj-name span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-name:hover { background: var(--accent-soft); }
.ebar-group { display: flex; }
/* the brand comes along into the editor's bar: the mark and the app's icon (the way back to the list
   of homes); the open home's own name follows it instead of the app's */
.ebar .ca-brand-name { display: none; }
.work { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; }
.stage { position: relative; flex: 1; min-height: 0; overflow: hidden; order: 0; background: var(--surface-2); --pad-l: 8px; --pad-r: 8px; --pad-t: 60px; --pad-b: 70px; }
.layer { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#gl { visibility: hidden; }
.stage:not([data-view='plan']) #gl { visibility: visible; }
.stage:not([data-view='plan']) #plan { visibility: hidden; }
.layer.top { outline-offset: -3px; }
.stage[data-tool='wall'] .top, .stage[data-tool='room'] .top, .stage[data-tool='zone'] .top, .stage[data-tool='measure'] .top, .stage[data-tool='opening'] .top { cursor: crosshair; }
.stage[data-tool='paint'] .top { cursor: cell; }
.top[data-cursor='move'] { cursor: move; }
.stage[data-view='3d'] .top { cursor: grab; }
.hud { position: absolute; display: flex; gap: 8px; align-items: center; pointer-events: none; z-index: 3; }
.hud > * { pointer-events: auto; }
.hud.tl { left: 10px; top: 10px; }
.hud.tr { right: 10px; top: 10px; flex-direction: column; align-items: flex-end; }
.hud.bl { left: 10px; bottom: 12px; }
.hud.br { right: 10px; bottom: 12px; }
.hud.bc { left: 50%; bottom: 64px; transform: translateX(-50%); flex-wrap: wrap; justify-content: center; width: max-content; max-width: calc(100% - 20px); }
.float-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px 0 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); font-weight: 600; font-size: 14px; max-width: calc(46vw / var(--ca-zoom, 1)); }
.float-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn.float[aria-pressed='true'] { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.float-btn.shot { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.float-btn[aria-pressed='true'] { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.hintline { position: absolute; left: 50%; top: 62px; transform: translateX(-50%); z-index: 2; max-width: min(calc(100% - 24px), 560px); width: max-content; padding: 7px 12px; border-radius: 11px; background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--line); font-size: 13px; line-height: 1.35; color: var(--muted); text-align: center; pointer-events: none; box-shadow: var(--shadow); }
.hintline:empty { display: none; }
.busy { position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; gap: 14px; align-items: center; justify-content: center; background: color-mix(in srgb, var(--bg) 82%, transparent); color: var(--muted); font-weight: 600; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.selbar { position: absolute; left: 10px; right: 10px; bottom: 64px; z-index: 4; display: flex; align-items: center; gap: 2px; padding: 5px 6px 5px 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.selname { flex: 1; min-width: 0; border: 0; background: transparent; text-align: left; padding: 2px 0; display: flex; flex-direction: column; }
.selname b, .selname small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.selname small { color: var(--muted); font-size: 12px; }
.stick { position: absolute; left: 22px; bottom: 214px; width: 112px; height: 112px; border-radius: 50%; background: color-mix(in srgb, var(--surface) 55%, transparent); border: 1px solid var(--line-2); z-index: 4; touch-action: none; }
.stick i { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px; border-radius: 50%; background: var(--accent); opacity: 0.9; transform: translate(var(--sx, 0px), var(--sy, 0px)); }

/* tools: a bar under the picture on a phone */
.rail { order: 1; display: flex; gap: 2px; padding: 4px 6px calc(4px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); overflow-x: auto; overscroll-behavior: contain; scrollbar-width: none; z-index: 8; position: relative; }
.rail::-webkit-scrollbar { display: none; }
.tool { flex: 1 1 0; min-width: 0; min-height: 52px; border: 0; background: transparent; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10.5px; font-weight: 600; color: var(--muted); padding: 2px; }
.tool span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool[aria-pressed='true'] { background: var(--accent-soft); color: var(--accent); }
.editor[data-view='3d'] .tool[aria-pressed='true'] { background: transparent; color: var(--muted); }
.editor[data-view='iso'] .selbar { bottom: 118px; }

/* the panel: a sheet over the lower half on a phone */
.panel { position: absolute; left: 0; right: 0; bottom: 0; z-index: 7; max-height: 58%; display: flex; flex-direction: column; background: var(--surface); border-radius: 20px 20px 0 0; border-top: 1px solid var(--line); box-shadow: 0 -14px 40px -18px rgba(0, 0, 0, 0.45); transform: translateY(105%); transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1); visibility: hidden; }
.editor.panel-open .panel { transform: none; visibility: visible; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 8px 6px 18px; }
.panel-head h2 { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-body { overflow-y: auto; overscroll-behavior: contain; padding: 4px 16px 20px; min-height: 0; flex: 1; }
.group { padding: 10px 0 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.panel-body > .group:first-child, .panel-body > .actions + .group { border-top: 0; }
.group > h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 650; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.4; padding: 6px 0; -webkit-user-select: text; user-select: text; }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; }
.field-row > span:first-child { color: var(--muted); font-size: 14px; flex: 1; min-width: 0; }
.unit-field { display: inline-flex; align-items: center; gap: 0; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); padding-right: 9px; width: 112px; flex: none; }
.unit-field .field { border: 0; background: transparent; width: 100%; text-align: right; padding: 0 6px 0 8px; font-variant-numeric: tabular-nums; font-weight: 600; }
.unit-field i { font-style: normal; color: var(--muted); font-size: 13px; }
.ro { font-weight: 600; font-variant-numeric: tabular-nums; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
.triple { display: grid; grid-template-columns: 1fr; gap: 0; }
.pair .field-row, .triple .field-row { min-width: 0; }
/* two fields side by side: each label over its field, so that neither is cut */
.pair .field-row { flex-direction: column; align-items: stretch; gap: 2px; padding: 4px 0; }
.pair .unit-field { width: 100%; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 36px; padding: 0 11px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chip[aria-pressed='true'] { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.choice-list { display: grid; gap: 6px; }
.choice { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 46px; padding: 6px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); text-align: left; }
.choice b { font-weight: 600; }
.choice small { color: var(--muted); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.choice[aria-pressed='true'] { border-color: var(--accent); background: var(--accent-soft); }
.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); gap: 6px; padding: 2px 0 12px; }
.act { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 56px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: 12px; font-weight: 600; padding: 4px; }
.act span { max-width: 100%; text-align: center; line-height: 1.15; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.act:hover { border-color: var(--accent); }
.act.danger { color: var(--danger); }
.act.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.facts { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 4px 0 10px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; }
.room-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.room-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 40px; }
.room-list span { color: var(--muted); font-variant-numeric: tabular-nums; }
.link { border: 0; background: transparent; padding: 8px 0; color: var(--accent); font-weight: 600; text-align: left; min-height: 40px; }
.tabs, .cats { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 0 8px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; overscroll-behavior: contain; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 30px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 30px), transparent); }
.tabs::-webkit-scrollbar, .cats::-webkit-scrollbar { display: none; }
.tab { flex: none; min-height: 36px; padding: 0 12px; border-radius: 18px; border: 1px solid var(--line-2); background: var(--surface); font-size: 13.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.tab[aria-selected='true'] { background: var(--text); color: var(--surface); border-color: transparent; }
.search-wrap { position: relative; display: flex; align-items: center; margin: 4px 0 10px; }
.search-wrap .ic { position: absolute; left: 11px; color: var(--muted); width: 18px; height: 18px; pointer-events: none; }
.search { width: 100%; padding-left: 36px; min-height: 42px; border-radius: 12px; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.card { display: flex; flex-direction: column; align-items: stretch; gap: 2px; padding: 6px 6px 8px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); text-align: left; min-width: 0; }
.card:hover { border-color: var(--accent); }
.thumb { width: 100%; aspect-ratio: 1; border-radius: 10px; background: #eef0ea; display: block; }
.card-name { font-size: 12.5px; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.5em; }
.card small { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mat { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.mat-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 50px; padding: 6px 10px; border: 0; background: var(--surface); text-align: left; }
.mat-row .swatch { width: 34px; height: 34px; }
.mat-label { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mat-label b { font-weight: 600; font-size: 14px; }
.mat-label small { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mat .picker { padding: 8px 10px 12px; border-top: 1px solid var(--line); background: var(--surface-2); }
.mat .tabs { margin: 0 -10px; padding-left: 10px; padding-right: 10px; }
.swatch { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line-2); display: block; flex: none; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 8px 6px; }
.sw { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 2px; border: 0; background: transparent; border-radius: 10px; min-width: 0; }
.sw span { font-size: 10.5px; line-height: 1.2; color: var(--muted); text-align: center; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 100%; min-height: 2.4em; overflow-wrap: anywhere; hyphens: auto; }
.sw[aria-pressed='true'] .swatch { outline: 3px solid var(--accent); outline-offset: 1px; }
.color { width: 56px; height: 40px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); padding: 3px; }
.range { flex: 1; max-width: 170px; accent-color: var(--accent); min-height: 40px; }
/* the 3D controls and the picture window */
.slider-box { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.slider-box .range { width: 130px; }
.slider-box b { font-variant-numeric: tabular-nums; font-size: 13px; min-width: 42px; text-align: right; }
.photo-view { display: block; width: auto; height: auto; max-width: 100%; max-height: min(calc(46dvh / var(--ca-zoom, 1)), 520px); margin: 0 auto; border-radius: 14px; background: #10131a; aspect-ratio: 16 / 9; object-fit: contain; }
.photo .sheet-actions { position: sticky; bottom: 0; padding: 12px 0 16px; background: var(--surface); }
.mirror svg { transform: scaleX(-1); }
.photo-row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; justify-content: space-between; padding: 12px 0; }
.photo-row h3 { font-size: 13px; color: var(--muted); font-weight: 600; width: 100%; }
.progress { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin: 12px 0; }
.progress i { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: left; transform: scaleX(var(--p, 0)); transition: transform 0.2s linear; }

@media (min-width: 560px) {
  .triple { grid-template-columns: 1fr 1fr 1fr; gap: 0 12px; }
  .triple .field-row { flex-direction: column; align-items: stretch; gap: 2px; padding: 4px 0; }
  .triple .unit-field { width: 100%; }
}
/* a short screen (a phone on its side): everything a little lower */
@media (max-width: 350px) {
  .tool span { display: none; }
  .tool { min-height: 48px; }
  .hud.tl .seg-btn { padding: 0 8px; font-size: 13px; }
}
@media (max-height: 460px) {
  .photo .sheet-actions { position: static; }
  .photo-view { max-height: calc(38dvh / var(--ca-zoom, 1)); }
  :root { --bar: 46px; }
  .stage { --pad-t: 8px; --pad-b: 8px; }
  .ebar { padding: 3px 8px; }
  .tool { min-height: 44px; }
  .tool span { display: none; }
  .panel { max-height: 86%; }
  .hintline { display: none; }
  .hud.bc, .selbar { bottom: 58px; }
  .start-card { min-height: 0; flex-direction: row; align-items: center; gap: 10px; flex-wrap: wrap; }
  .start-ic { margin: 0; }
  .start-card small { display: none; }
}
@media (max-width: 420px) {
  .ebar { gap: 0; padding-left: 4px; padding-right: 6px; }
  .ebar .icon-btn { width: 36px; min-width: 36px; }
  .ebar .seg-btn { padding: 0 7px; }
  .proj-name { min-width: 44px; }
  .tool { font-size: 10px; }
  .start-row { grid-template-columns: 1fr; }
  .start-card { min-height: 0; flex-direction: row; align-items: center; gap: 12px; flex-wrap: wrap; }
  .start-card small { width: 100%; padding-left: 52px; margin-top: -14px; }
  .start-ic { margin: 0; }
}
@media (max-width: 519.98px) {
  /* undo and redo leave the crowded bar (the brand, the home's name, the views, the chip) for the
     picture's top right corner */
  .editor { position: relative; }
  .ebar-group { position: absolute; right: 10px; top: calc(var(--bar) + 64px + env(safe-area-inset-top)); z-index: 5; gap: 8px; }
  .ebar .ebar-group .icon-btn { width: 44px; min-width: 44px; height: 44px; background: var(--surface); border-color: var(--line); box-shadow: var(--shadow); }
  .hud.tr { top: 118px; }
  .hintline { top: 172px; }
  /* nothing is edited in the 3D view: its picture stays free of them */
  .editor[data-view='3d'] .ebar-group { display: none; }
}
@media (max-width: 359.98px) {
  /* the smallest phones: the home's name leaves the bar (Rename is in the ··· menu) */
  .proj-name { display: none; }
  .ebar .views { margin-left: auto; }
}
/* tablets and up: tools on the left, the panel always there on the right */
@media (min-width: 900px) {
  .stick { bottom: 96px; }
  .work { flex-direction: row; }
  .rail { order: 0; flex-direction: column; width: 78px; padding: 8px 6px; border-top: 0; border-right: 1px solid var(--line); overflow-y: auto; overflow-x: hidden; }
  .tool { flex: none; min-height: 58px; font-size: 11px; }
  .stage { order: 1; --pad-t: 64px; --pad-b: 70px; }
  .panel { order: 2; position: relative; transform: none; visibility: visible; width: 336px; max-height: none; border-radius: 0; border-top: 0; border-left: 1px solid var(--line); box-shadow: none; flex: none; transition: none; }
  .panel-close, .selbar { display: none !important; }
  .hud.bc { bottom: 66px; }
  .hintline { top: auto; bottom: 14px; }
  .editor[data-view='3d'] .hintline, .editor[data-view='iso'] .hintline { bottom: 122px; }
  .ebar { padding: 6px 12px; gap: 8px; }
  .proj-name { flex: 1 1 200px; }
  .toast { bottom: 40px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation-duration: 0.001s !important; } }

/* cloud-apps bar 1.30.0 */
:root { --ca-brand-icon-w: 89px; } /* the brand's width with the icon alone (the mark, the divider, the app's icon) */
.ca-start { display: flex; align-items: center; flex: 0 100 auto; min-width: min(var(--ca-brand-icon-w), 100%); }
.ca-brand { display: flex; align-items: center; min-width: 0; height: 40px; color: inherit; font-family: inherit; }
.ca-brand a { display: flex !important; align-items: center !important; box-sizing: border-box !important; color: inherit !important; text-decoration: none !important; border-radius: 12px !important; -webkit-tap-highlight-color: transparent; transition: background-color .15s ease; }
.ca-brand-home { flex: none !important; justify-content: center !important; width: 40px !important; height: 40px !important; padding: 0 !important; margin: 0 0 0 -5px !important; }
.ca-brand-home img { display: block !important; width: 30px !important; height: 30px !important; margin: 0 !important; transition: transform .38s cubic-bezier(.34, 1.56, .64, 1); }
.ca-brand-sep { flex: none; display: block; width: 1.5px; height: 18px; margin: 0 4px; border-radius: 1px; background: currentColor; opacity: .22; transform: rotate(18deg); }
.ca-brand-app { flex: 0 1 auto !important; min-width: 44px !important; height: 40px !important; padding: 0 9px 0 5px !important; margin: 0 !important; }
.ca-brand-in { display: flex; flex-wrap: wrap; align-items: center; align-content: flex-start; column-gap: 9px; min-width: 0; height: 40px; overflow: hidden; }
.ca-brand-in img { flex: none; display: block !important; width: 30px !important; height: 30px !important; margin: 5px 0 !important; border-radius: 8px; }
.ca-brand[data-ca-icon] .ca-brand-name { display: none !important; }
.ca-brand[data-ca-icon] .ca-brand-app { padding-right: 5px !important; }
.ca-brand-name { display: block; height: 40px; margin: 0 !important; padding: 0 !important; line-height: 40px !important; white-space: nowrap; font-family: var(--ca-brand-font, inherit); font-size: 17px !important; font-weight: 700; letter-spacing: -.015em; color: inherit; text-shadow: var(--ca-brand-shadow, none); }
@media (hover: hover) { .ca-brand a:hover { background-color: color-mix(in srgb, currentColor 7%, transparent); } .ca-brand-home:hover img { transform: rotate(-6deg) scale(1.06); } }
.ca-brand a:focus-visible { outline: 3px solid var(--ca-accent, #4f6bff); outline-offset: -3px; }
.ca-end { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex: none; min-width: 0; }
.ca-tools { display: flex; align-items: center; gap: 6px; }
.ca-tools[hidden] { display: none !important; }
.ca-tool { position: relative; flex: none; display: inline-grid; place-items: center !important; box-sizing: border-box !important; width: 36px !important; height: 36px !important; min-width: 0 !important; min-height: 0 !important; max-width: none !important; padding: 0 !important; margin: 0; border-radius: 50% !important;
  border: 1px solid var(--ca-tool-line, color-mix(in srgb, currentColor 16%, transparent)) !important; background: var(--ca-tool-bg, color-mix(in srgb, currentColor 6%, transparent)) !important; color: var(--ca-tool-ink, inherit) !important;
  font: inherit; line-height: 0 !important; letter-spacing: 0; text-decoration: none !important; box-shadow: none; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background-color .15s ease, transform .12s ease; }
.ca-tool[hidden] { display: none !important; }
.ca-tool::before { content: ""; position: absolute; inset: -4px; }
.ca-tool svg { display: block; width: 20px !important; height: 20px !important; margin: 0 !important; pointer-events: none; }
.ca-tool svg[hidden] { display: none !important; }
@media (hover: hover) { .ca-tool:hover { background: var(--ca-tool-hover, color-mix(in srgb, currentColor 13%, transparent)) !important; } }
.ca-tool:active { transform: scale(.94); }
.ca-tool:focus-visible { outline: 3px solid var(--ca-accent, #4f6bff); outline-offset: 2px; }
.ca-tool-talk { color: var(--ca-accent, #4f6bff) !important; border-color: color-mix(in srgb, var(--ca-accent, #4f6bff) 50%, transparent) !important; background: color-mix(in srgb, var(--ca-accent, #4f6bff) 13%, transparent) !important; }
.ca-tool .ca-tlive { position: absolute; top: 1px; right: 1px; width: 9px; height: 9px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 2px color-mix(in srgb, #22c55e 30%, transparent); }
.ca-tool-talk.ca-new::after { content: ""; position: absolute; inset: -1px; border-radius: 50%; pointer-events: none; animation: ca-bar-ring 1.2s ease-out 2; }
@keyframes ca-bar-ring { from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ca-accent, #4f6bff) 55%, transparent); } to { box-shadow: 0 0 0 11px transparent; } }
.ca-tool .ca-tcount, .ca-tool .ca-tunread { position: absolute; right: -5px; display: grid; place-items: center; box-sizing: border-box; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; color: #fff; font: 700 10.5px/1 -apple-system, BlinkMacSystemFont, Inter, "Segoe UI", Roboto, sans-serif; font-variant-numeric: tabular-nums; letter-spacing: 0; pointer-events: none; }
.ca-tool .ca-tcount { bottom: -5px; background: #1f9d55; }
.ca-tool .ca-tunread { top: -5px; background: #e5484d; }
@media (max-width: 599.98px), (max-height: 499.98px) { .ca-tools-app { display: none !important; } }
.ca-end[data-ca-cramped] .ca-tools-app { display: none !important; }
.ca-end[data-ca-tight] .ca-tool-friends { display: none !important; }
@media (prefers-reduced-motion: reduce) { .ca-tool, .ca-brand a, .ca-brand-home img { transition: none; } .ca-tool-talk.ca-new::after { animation: none; } }
/* end of the cloud-apps bar */
/* ---- cloud-apps: big screens (App Standard §6.5) — written by `cloud-apps vendor-sdk`; do not edit ---- */
/* Past 1584 × 990 the page is laid out at about 1440 × 900 and zoomed to fill the screen; viewport
   units in this file are divided by --ca-zoom. cloud-kit.js turns it off where the engine has no
   standard zoom (html[data-ca-zoom="off"]). */
@media (min-width: 1585px) and (min-height: 991px) { :root { --ca-zoom: 1.1; } }
@media (min-width: 1656px) and (min-height: 1035px) { :root { --ca-zoom: 1.15; } }
@media (min-width: 1728px) and (min-height: 1080px) { :root { --ca-zoom: 1.2; } }
@media (min-width: 1800px) and (min-height: 1125px) { :root { --ca-zoom: 1.25; } }
@media (min-width: 1872px) and (min-height: 1170px) { :root { --ca-zoom: 1.3; } }
@media (min-width: 1945px) and (min-height: 1215px) { :root { --ca-zoom: 1.35; } }
@media (min-width: 2016px) and (min-height: 1260px) { :root { --ca-zoom: 1.4; } }
@media (min-width: 2088px) and (min-height: 1305px) { :root { --ca-zoom: 1.45; } }
@media (min-width: 2160px) and (min-height: 1350px) { :root { --ca-zoom: 1.5; } }
@media (min-width: 2232px) and (min-height: 1395px) { :root { --ca-zoom: 1.55; } }
@media (min-width: 2304px) and (min-height: 1440px) { :root { --ca-zoom: 1.6; } }
@media (min-width: 2376px) and (min-height: 1485px) { :root { --ca-zoom: 1.65; } }
@media (min-width: 2448px) and (min-height: 1530px) { :root { --ca-zoom: 1.7; } }
@media (min-width: 2520px) and (min-height: 1575px) { :root { --ca-zoom: 1.75; } }
@media (min-width: 2592px) and (min-height: 1620px) { :root { --ca-zoom: 1.8; } }
@media (min-width: 2664px) and (min-height: 1665px) { :root { --ca-zoom: 1.85; } }
@media (min-width: 2736px) and (min-height: 1710px) { :root { --ca-zoom: 1.9; } }
@media (min-width: 2808px) and (min-height: 1755px) { :root { --ca-zoom: 1.95; } }
@media (min-width: 2880px) and (min-height: 1800px) { :root { --ca-zoom: 2; } }
@media (min-width: 2952px) and (min-height: 1845px) { :root { --ca-zoom: 2.05; } }
@media (min-width: 3024px) and (min-height: 1890px) { :root { --ca-zoom: 2.1; } }
@media (min-width: 3096px) and (min-height: 1935px) { :root { --ca-zoom: 2.15; } }
@media (min-width: 3169px) and (min-height: 1981px) { :root { --ca-zoom: 2.2; } }
@media (min-width: 3240px) and (min-height: 2025px) { :root { --ca-zoom: 2.25; } }
@media (min-width: 3312px) and (min-height: 2070px) { :root { --ca-zoom: 2.3; } }
@media (min-width: 3384px) and (min-height: 2115px) { :root { --ca-zoom: 2.35; } }
@media (min-width: 3456px) and (min-height: 2160px) { :root { --ca-zoom: 2.4; } }
@media (min-width: 3529px) and (min-height: 2205px) { :root { --ca-zoom: 2.45; } }
@media (min-width: 3600px) and (min-height: 2250px) { :root { --ca-zoom: 2.5; } }
@media (min-width: 3672px) and (min-height: 2295px) { :root { --ca-zoom: 2.55; } }
@media (min-width: 3744px) and (min-height: 2340px) { :root { --ca-zoom: 2.6; } }
@media (min-width: 3816px) and (min-height: 2385px) { :root { --ca-zoom: 2.65; } }
@media (min-width: 3889px) and (min-height: 2430px) { :root { --ca-zoom: 2.7; } }
@media (min-width: 3960px) and (min-height: 2475px) { :root { --ca-zoom: 2.75; } }
@media (min-width: 4032px) and (min-height: 2520px) { :root { --ca-zoom: 2.8; } }
@media (min-width: 4104px) and (min-height: 2565px) { :root { --ca-zoom: 2.85; } }
@media (min-width: 4176px) and (min-height: 2610px) { :root { --ca-zoom: 2.9; } }
@media (min-width: 4248px) and (min-height: 2655px) { :root { --ca-zoom: 2.95; } }
@media (min-width: 4320px) and (min-height: 2700px) { :root { --ca-zoom: 3; } }
@media (min-width: 4392px) and (min-height: 2745px) { :root { --ca-zoom: 3.05; } }
@media (min-width: 4464px) and (min-height: 2790px) { :root { --ca-zoom: 3.1; } }
@media (min-width: 4536px) and (min-height: 2835px) { :root { --ca-zoom: 3.15; } }
@media (min-width: 4608px) and (min-height: 2880px) { :root { --ca-zoom: 3.2; } }
@media (min-width: 4680px) and (min-height: 2925px) { :root { --ca-zoom: 3.25; } }
@media (min-width: 4752px) and (min-height: 2970px) { :root { --ca-zoom: 3.3; } }
@media (min-width: 4824px) and (min-height: 3015px) { :root { --ca-zoom: 3.35; } }
@media (min-width: 4896px) and (min-height: 3060px) { :root { --ca-zoom: 3.4; } }
@media (min-width: 4968px) and (min-height: 3105px) { :root { --ca-zoom: 3.45; } }
@media (min-width: 5040px) and (min-height: 3150px) { :root { --ca-zoom: 3.5; } }
@media (min-width: 5112px) and (min-height: 3195px) { :root { --ca-zoom: 3.55; } }
@media (min-width: 5184px) and (min-height: 3240px) { :root { --ca-zoom: 3.6; } }
@media (min-width: 5256px) and (min-height: 3285px) { :root { --ca-zoom: 3.65; } }
@media (min-width: 5328px) and (min-height: 3330px) { :root { --ca-zoom: 3.7; } }
@media (min-width: 5400px) and (min-height: 3375px) { :root { --ca-zoom: 3.75; } }
@media (min-width: 5472px) and (min-height: 3420px) { :root { --ca-zoom: 3.8; } }
@media (min-width: 5544px) and (min-height: 3465px) { :root { --ca-zoom: 3.85; } }
@media (min-width: 5616px) and (min-height: 3510px) { :root { --ca-zoom: 3.9; } }
@media (min-width: 5688px) and (min-height: 3555px) { :root { --ca-zoom: 3.95; } }
@media (min-width: 5760px) and (min-height: 3600px) { :root { --ca-zoom: 4; } }
@media (min-width: 5832px) and (min-height: 3645px) { :root { --ca-zoom: 4.05; } }
@media (min-width: 5904px) and (min-height: 3690px) { :root { --ca-zoom: 4.1; } }
@media (min-width: 5977px) and (min-height: 3736px) { :root { --ca-zoom: 4.15; } }
@media (min-width: 6048px) and (min-height: 3780px) { :root { --ca-zoom: 4.2; } }
@media (min-width: 6120px) and (min-height: 3825px) { :root { --ca-zoom: 4.25; } }
@media (min-width: 6192px) and (min-height: 3870px) { :root { --ca-zoom: 4.3; } }
@media (min-width: 6264px) and (min-height: 3915px) { :root { --ca-zoom: 4.35; } }
@media (min-width: 6337px) and (min-height: 3961px) { :root { --ca-zoom: 4.4; } }
@media (min-width: 6408px) and (min-height: 4005px) { :root { --ca-zoom: 4.45; } }
@media (min-width: 6480px) and (min-height: 4050px) { :root { --ca-zoom: 4.5; } }
@media (min-width: 6552px) and (min-height: 4095px) { :root { --ca-zoom: 4.55; } }
@media (min-width: 6624px) and (min-height: 4140px) { :root { --ca-zoom: 4.6; } }
@media (min-width: 6697px) and (min-height: 4185px) { :root { --ca-zoom: 4.65; } }
@media (min-width: 6768px) and (min-height: 4230px) { :root { --ca-zoom: 4.7; } }
@media (min-width: 6840px) and (min-height: 4275px) { :root { --ca-zoom: 4.75; } }
@media (min-width: 6912px) and (min-height: 4320px) { :root { --ca-zoom: 4.8; } }
@media (min-width: 6984px) and (min-height: 4365px) { :root { --ca-zoom: 4.85; } }
@media (min-width: 7057px) and (min-height: 4410px) { :root { --ca-zoom: 4.9; } }
@media (min-width: 7128px) and (min-height: 4455px) { :root { --ca-zoom: 4.95; } }
@media (min-width: 7200px) and (min-height: 4500px) { :root { --ca-zoom: 5; } }
@media (min-width: 1585px) and (min-height: 991px) {
  html { zoom: var(--ca-zoom, 1); }
  html[data-ca-zoom='off'] { --ca-zoom: 1 !important; }
}
/* ---- end of big screens ---- */
