:root {
  --bg: #FBFAF7;
  --paper: #F4F2EC;
  --card: #FFFFFF;
  --ink: #2B2A28;
  --ink-2: #57534C;
  --ink-3: #5F5B54;
  --line: #E8E4DC;
  --line-2: #E2DDD3;
  --soft: #F1EEE7;
  --accent: #2F6F62;
  --accent-soft: #EEF5F2;
  --warn: #B4410C;
  --warn-soft: #FBEEE6;
  --danger: #A33A0A;
  --radius: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 13px;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); display: flex; flex-direction: column; overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.spacer { flex: 1; }

/* Top bar */
.topbar { height: 56px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 20px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; }
.brand .ic { width: 22px; height: 22px; stroke-width: 2.2; }
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--ink-3); }
.crumbs select { border: 0; background: transparent; font-weight: 600; color: var(--ink); padding: 4px; border-radius: 6px; max-width: 220px; }
.crumbs select:hover { background: var(--soft); }
.chip { padding: 4px 10px; border-radius: 999px; background: var(--soft); color: var(--ink-2); font-size: 12px; white-space: nowrap; }
.save-status { display: flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 12px; white-space: nowrap; }
.save-status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.save-status.saving .dot { background: #C9A227; }
.save-status.error .dot { background: var(--warn); }
.icon-btn { width: 36px; height: 36px; border: 1px solid var(--line-2); background: var(--card); border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: var(--soft); }
.icon-btn:disabled { opacity: .4; cursor: default; }
.dark-btn { height: 36px; padding: 0 16px; border: 0; background: var(--ink); color: #fff; border-radius: 10px; font-weight: 600; }
.accent-btn { height: 36px; padding: 0 14px; border: 0; background: var(--accent); color: #fff; border-radius: 9px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.accent-btn.small { height: 32px; padding: 0 12px; font-size: 12px; }
.accent-btn .ic { width: 14px; height: 14px; }
.ghost-btn { height: 36px; padding: 0 12px; border: 1px solid var(--line-2); background: var(--card); border-radius: 9px; font-weight: 600; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.ghost-btn:hover { background: var(--soft); }
.ghost-btn.danger { color: var(--danger); border-color: #F0D2C2; }
.ghost-btn .ic { width: 15px; height: 15px; }
.menu { position: relative; }
.menu-items { display: none; position: absolute; top: 42px; left: 0; z-index: 30; min-width: 200px; background: var(--card); border: 1px solid var(--line-2); border-radius: 12px; padding: 6px; box-shadow: 0 12px 32px rgba(43,42,40,.14); }
.menu-items.right { left: auto; right: 0; }
.menu-items.open { display: block; }
.menu-items button { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: transparent; border-radius: 8px; }
.menu-items button:hover { background: var(--soft); }
.menu-items button.danger { color: var(--danger); }
.menu-items hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.menu-items[hidden], .menu-items button[hidden] { display: none; }
.menu-label { margin: 0; padding: 6px 10px 8px; font-size: 12px; color: var(--ink-3); border-bottom: 1px solid var(--line); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-label b { color: var(--ink); }
.chip.role { background: var(--accent-soft); color: #1F4D44; font-weight: 600; }
.chip[hidden] { display: none; }

/* Layout */
.layout { flex: 1; min-height: 0; display: flex; gap: 16px; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.library, .inspector { flex: 0 0 280px; display: flex; flex-direction: column; gap: 12px; padding: 16px; min-height: 0; overflow: auto; }
.card-head { display: flex; align-items: center; justify-content: space-between; }
.card-head h2 { margin: 0; font-size: 15px; }
.search { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 10px; color: var(--ink-3); background: var(--bg); }
.search input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); font-size: 12px; font-weight: 500; }
.chips button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.asset-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.asset { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); text-align: left; min-width: 0; }
.asset:hover { border-color: #CFC8BB; }
.asset.on { border: 2px solid var(--accent); background: var(--accent-soft); padding: 9px; }
.asset.custom { border-style: dashed; border-color: #BFB8AC; background: var(--card); }
.asset svg { width: 48px; height: 32px; }
.asset .nm { font-weight: 600; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.asset .dm { font-size: 11px; color: var(--ink-3); }
.asset .edit { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border: 0; border-radius: 6px; background: transparent; color: var(--ink-3); display: none; align-items: center; justify-content: center; }
.asset:hover .edit, .asset:focus-within .edit { display: flex; }
.asset .edit:hover { background: var(--soft); }
.asset .edit .ic { width: 14px; height: 14px; }
.empty { color: var(--ink-3); font-size: 12px; grid-column: span 2; }

/* Canvas */
.canvas-card { flex: 1; min-width: 0; position: relative; overflow: hidden; display: flex; flex-direction: column;
  background-color: var(--paper); }
.canvas-top { position: absolute; top: 14px; left: 14px; right: 14px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; pointer-events: none; z-index: 5; }
.canvas-top > * { pointer-events: auto; }
.floors { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.seg { display: flex; gap: 2px; padding: 4px; background: var(--card); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 4px 16px rgba(43,42,40,.08); }
.seg button { height: 36px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); font-weight: 500; font-size: 12px; white-space: nowrap; }
.seg button.on { background: var(--ink); color: #fff; font-weight: 600; }
.seg button.add { width: 36px; padding: 0; background: var(--soft); color: var(--ink); display: flex; align-items: center; justify-content: center; }
.seg.small { padding: 3px; background: var(--soft); border: 0; box-shadow: none; border-radius: 9px; }
.seg.small button { height: 30px; padding: 0 10px; border-radius: 7px; }
.seg.small button.on { background: var(--card); color: var(--ink); }
.check { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); background: rgba(255,255,255,.85); padding: 6px 10px; border-radius: 9px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.pill { display: flex; align-items: center; gap: 2px; padding: 5px; background: var(--card); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: 0 4px 16px rgba(43,42,40,.08); }
.pill > button { width: 44px; height: 44px; border: 0; border-radius: 10px; background: transparent; display: flex; align-items: center; justify-content: center; }
.pill > button:hover { background: var(--soft); }
.pill > button.on { background: var(--ink); color: #fff; }
.pill .sep { width: 1px; height: 24px; background: var(--line-2); margin: 0 6px; }
#canvas { flex: 1; width: 100%; min-height: 0; display: block; touch-action: none; user-select: none; outline: none; }
#canvas.tool-select { cursor: default; }
#canvas.tool-wall, #canvas.tool-room, #canvas.tool-measure, #canvas.tool-door, #canvas.tool-window, #canvas.placing { cursor: crosshair; }
#canvas.tool-text { cursor: text; }
#canvas.panning { cursor: grabbing; }
.canvas-bottom { position: absolute; left: 14px; right: 14px; bottom: 14px; display: flex; align-items: center; gap: 12px; pointer-events: none; z-index: 5; flex-wrap: wrap; }
.canvas-bottom > * { pointer-events: auto; }
.canvas-bottom .hint { margin: 0; padding: 8px 12px; background: rgba(255,255,255,.92); border: 1px solid var(--line); border-radius: 10px; font-size: 12px; color: var(--ink-2); max-width: 60%; }
.canvas-bottom .warn:empty { display: none; }
.canvas-bottom .warn { padding: 8px 12px; background: var(--warn-soft); color: #8A3209; border-radius: 10px; font-size: 12px; font-weight: 600; }
.zoom { margin-left: auto; display: flex; align-items: center; gap: 2px; background: var(--card); border: 1px solid var(--line-2); border-radius: 10px; padding: 3px; }
.zoom button { width: 32px; height: 32px; border: 0; background: transparent; border-radius: 7px; font-size: 16px; font-weight: 600; }
.zoom button:hover { background: var(--soft); }
.zoom .fit { width: auto; padding: 0 10px; background: var(--soft); font-size: 12px; }
#statusZoom { min-width: 48px; text-align: center; font-size: 12px; font-weight: 600; }

/* Inspector */
.inspector .eyebrow { margin: 0 0 2px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
.inspector h2 { margin: 0; font-size: 17px; }
.inspector .sub { margin: 2px 0 0; font-size: 12px; color: var(--ink-3); }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--ink-2); min-width: 0; }
.field input, .field select, .field textarea { height: 36px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 8px; font-weight: 400; font-size: 13px; color: var(--ink); background: var(--card); min-width: 0; width: 100%; }
.field input[type=color] { padding: 2px 4px; }
.field input:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.row { display: flex; gap: 6px; align-items: flex-end; flex-wrap: wrap; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line-2); }
.swatches button.on { border: 2px solid var(--ink); }
.section { border-top: 1px solid #EEEAE3; padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.section h3 { margin: 0; font-size: 12px; color: var(--ink-2); }
.kv { display: flex; justify-content: space-between; gap: 8px; }
.kv b { font-weight: 600; }
.kv.warn { color: var(--warn); }
.note { margin: 0; display: flex; gap: 8px; padding: 10px; border-radius: 10px; background: var(--warn-soft); color: #8A3209; font-size: 12px; line-height: 1.4; }
.note.info { background: var(--accent-soft); color: #1F4D44; }
.actions { margin-top: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.actions .wide { grid-column: span 2; }
.keys { margin: 0; padding-left: 16px; color: var(--ink-2); font-size: 12px; line-height: 1.7; }
kbd { font: 600 11px ui-monospace, monospace; background: var(--soft); border: 1px solid var(--line-2); border-radius: 4px; padding: 0 4px; }

/* Dialog */
dialog { border: 1px solid var(--line-2); border-radius: 16px; padding: 20px; width: min(420px, 92vw); box-shadow: 0 24px 64px rgba(43,42,40,.25); }
dialog::backdrop { background: rgba(43,42,40,.35); }
dialog form { display: flex; flex-direction: column; gap: 12px; }
dialog h3 { margin: 0; font-size: 16px; }
dialog label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
dialog input, dialog select { height: 36px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 8px; font-weight: 400; color: var(--ink); background: #fff; }
dialog .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
dialog .hint { margin: 0; font-size: 12px; color: var(--ink-3); line-height: 1.4; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.dialog-actions button[value=cancel] { height: 36px; padding: 0 14px; border: 1px solid var(--line-2); background: #fff; border-radius: 9px; }

dialog.wide { width: min(640px, 94vw); }
dialog.ask { width: min(400px, 92vw); }
.ask-msg { margin: 0; font-size: 13px; color: var(--ink-2); line-height: 1.5; white-space: pre-line; }
dialog [hidden] { display: none; }

/* Toasts: in-app notices, shown in the top layer so they sit above open dialogs too */
.toasts { position: fixed; inset: 68px auto auto 50%; transform: translateX(-50%); margin: 0; padding: 0; border: 0; background: transparent; overflow: visible;
  display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 50; pointer-events: none; }
.toasts:popover-open { display: flex; }
.toasts:empty { display: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; width: max-content; max-width: min(460px, calc(100vw - 32px));
  padding: 11px 8px 11px 14px; background: var(--card); color: var(--ink); border: 1px solid var(--line-2); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(43,42,40,.16); font-size: 13px; line-height: 1.45; animation: toast-in .18s ease-out; }
.toast > .ic { margin-top: 1px; color: var(--accent); }
.toast.error > .ic { color: var(--warn); }
.toast.error { border-color: #F0D2C2; }
.toast .msg { flex: 1; min-width: 0; padding-top: 1px; overflow-wrap: anywhere; }
.toast button { width: 24px; height: 24px; flex: none; border: 0; border-radius: 6px; background: transparent; color: var(--ink-3); display: flex; align-items: center; justify-content: center; }
.toast button:hover { background: var(--soft); color: var(--ink); }
.toast button .ic { width: 14px; height: 14px; }
.toast.leaving { opacity: 0; transform: translateY(-4px); transition: opacity .15s, transform .15s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } }
dialog .note[hidden] { display: none; }
.danger-btn { background: var(--danger); }
.share-add { display: flex; gap: 8px; }
.share-add input { flex: 1; min-width: 0; }
.share-list, .user-list { display: flex; flex-direction: column; max-height: 50vh; overflow: auto; }
.share-row, .user-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.share-row .who, .user-row .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.user-row .who small { font-weight: 400; color: var(--ink-3); margin-left: 6px; }
.user-row .ghost-btn, .share-row .ghost-btn { height: 30px; }
.share-row select { height: 30px; }
.check.plain { flex-direction: row; padding: 0; background: none; font-weight: 500; }

/* Read-only (view access to a shared plan) */
.readonly .library, .readonly #btnUndo, .readonly #btnRedo, .readonly #floorTabs .add,
.readonly #toolbar [data-tool]:not([data-tool=select]):not([data-tool=measure]) { display: none; }
.inspector fieldset.ro { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 12px; flex: 1; }

/* Welcome screen (no plans yet) */
.no-plan .layout, .no-plan .crumbs, .no-plan #planMenuWrap, .no-plan #exportWrap, .no-plan #summaryChip,
.no-plan #roleChip, .no-plan #saveStatus, .no-plan #btnUndo, .no-plan #btnRedo { display: none; }
.welcome { flex: 1; min-height: 0; overflow: auto; display: flex; padding: 32px 16px; }
.welcome[hidden] { display: none; }
.welcome-inner { margin: auto; width: 100%; max-width: 860px; display: flex; flex-direction: column; }
.welcome h1 { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.welcome-sub { margin: 8px 0 28px; font-size: 15px; color: var(--ink-3); max-width: 560px; line-height: 1.5; }
.welcome-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; }
.welcome-side { display: grid; gap: 16px; }
.welcome-card { padding: 24px; display: flex; flex-direction: column; align-items: stretch; gap: 14px; text-align: left; min-width: 0; }
.welcome-card h2 { margin: 0; font-size: 17px; }
.welcome-card .field input { height: 42px; font-size: 14px; }
.welcome-card .seg { align-self: flex-start; }
.welcome-card .accent-btn { justify-content: center; height: 44px; font-size: 14px; margin-top: auto; }
.welcome-card.option { gap: 6px; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.welcome-card.option:hover { border-color: #CFC8BB; box-shadow: 0 10px 28px rgba(43,42,40,.08); transform: translateY(-1px); }
.welcome-card.option:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.welcome-card.option h3 { margin: 8px 0 0; font-size: 15px; }
.welcome-card.option p { margin: 0; font-size: 13px; color: var(--ink-3); line-height: 1.45; }
.welcome-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.welcome-icon .ic { width: 20px; height: 20px; }
.welcome-tip { margin: 24px 0 0; font-size: 13px; color: var(--ink-3); line-height: 1.6; }
@media (max-width: 720px) {
  .welcome-grid { grid-template-columns: minmax(0, 1fr); }
  .welcome h1 { font-size: 24px; }
}

/* Sign-in page: form on the left, a plan drawing on the right; one column on small screens. */
body.auth-page { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); height: auto; min-height: 100%; overflow: auto; font-size: 14px; }
.auth-page [hidden] { display: none !important; }
.auth-main { display: flex; flex-direction: column; gap: 24px; padding: 28px clamp(20px, 5vw, 64px); min-width: 0; }
.auth-box { width: 100%; max-width: 380px; margin: auto; padding: 24px 0; display: flex; flex-direction: column; }
.auth-box h1 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.auth-sub { margin: 8px 0 28px; color: var(--ink-3); font-size: 15px; line-height: 1.45; }
.auth-box form { display: flex; flex-direction: column; gap: 16px; }
.auth-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.auth-field input { width: 100%; height: 46px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--card); font-size: 15px; font-weight: 400; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.auth-field input:hover { border-color: #D3CCBF; }
.auth-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(47, 111, 98, .14); }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 48px; }
.pw-toggle { position: absolute; top: 5px; right: 5px; width: 36px; height: 36px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-3); display: flex; align-items: center; justify-content: center; }
.pw-toggle:hover { background: var(--soft); color: var(--ink); }
.pw-toggle.on { color: var(--accent); }
.pw-toggle:focus-visible { outline: 2px solid var(--accent); }
.auth-hint { margin: -4px 0 0; font-size: 13px; color: var(--ink-3); line-height: 1.45; }
.auth-hint.warn { color: var(--warn); font-weight: 600; }
.auth-box .note { font-size: 13px; }
.auth-submit { justify-content: center; height: 48px; margin-top: 6px; border-radius: 12px; font-size: 15px; transition: background .15s, transform .05s; }
.auth-submit:hover { background: #285F54; }
.auth-submit:active { transform: translateY(1px); }
.auth-submit:disabled { opacity: .6; cursor: default; }
.auth-submit:focus-visible { outline: 3px solid rgba(47, 111, 98, .35); outline-offset: 2px; }
.auth-switch { margin: 24px 0 0; text-align: center; color: var(--ink-3); }
.auth-box > .auth-hint { margin-top: 24px; text-align: center; }
.link-btn { border: 0; padding: 2px 0; background: none; color: var(--accent); font-weight: 600; }
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
.auth-foot { margin: 0; font-size: 12px; color: var(--ink-3); }
.auth-aside { margin: 16px 16px 16px 0; border-radius: 28px; padding: clamp(32px, 5vw, 64px); display: flex; flex-direction: column; justify-content: center; gap: 36px; min-width: 0; overflow: hidden;
  background-color: var(--paper); background-image: radial-gradient(#D9D4C9 1px, transparent 1.2px); background-size: 22px 22px; }
.auth-plan { width: 100%; max-width: 560px; align-self: center; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 18px; box-shadow: 0 24px 60px rgba(43, 42, 40, .12); }
.auth-plan svg { display: block; width: 100%; height: auto; }
.auth-pitch { width: 100%; max-width: 560px; align-self: center; }
.auth-pitch h2 { margin: 0 0 16px; font-size: clamp(22px, 2.2vw, 30px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.auth-pitch ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; color: var(--ink-2); font-size: 15px; }
.auth-pitch li { display: flex; align-items: center; gap: 10px; }
.auth-pitch .ic { color: var(--accent); stroke-width: 2.4; width: 18px; height: 18px; padding: 3px; box-sizing: content-box; border-radius: 50%; background: var(--accent-soft); }
@media (max-width: 960px) {
  body.auth-page { grid-template-columns: minmax(0, 1fr); }
  .auth-aside { display: none; }
  .auth-main { align-items: center; }
  .auth-main > .brand, .auth-foot { align-self: stretch; }
}
@media (max-width: 480px) {
  .auth-main { padding: 20px 16px; gap: 16px; }
  .auth-box { padding: 8px 0; }
  .auth-box h1 { font-size: 24px; }
  .auth-sub { margin-bottom: 20px; }
}

@media (max-width: 1100px) {
  .library, .inspector { flex-basis: 240px; }
}
@media (max-width: 860px) {
  body { overflow: auto; }
  .layout { flex-direction: column; height: auto; }
  .canvas-card { min-height: 70vh; order: -1; }
  .library, .inspector { flex: none; max-height: none; }
  .chip, .save-status span:last-child { display: none; }
  .topbar { padding: 0 12px; gap: 8px; }
}
