/* Crip Designs Studio — Coohom-style light workspace with Crip orange accent.
 * Desktop: top bar · left icon rail + tool drawer · canvas · right properties panel · floating bottom view bar.
 * Tablet/phone: canvas on top, tool drawer below, icon rail becomes the bottom app navigation. */
:root{
  --bg:#f3f4f7; --panel:#ffffff; --panel-2:#f5f6f8; --panel-3:#eceef2; --line:#e2e5ea; --line-2:#d3d7de;
  --text:#1d2129; --text-dim:#6b7280; --text-faint:#9aa1ad;
  --accent:#ee7d26; --accent-strong:#c9620f; --accent-soft:rgba(238,125,38,0.11); --accent-ring:rgba(238,125,38,0.28);
  --ok:#2e9d5b; --warn:#d68a12; --danger:#d64545; --blue:#3a7bd5;
  --radius:8px; --tap:38px; --shadow:0 6px 24px rgba(20,24,33,0.12); --shadow-sm:0 1px 3px rgba(20,24,33,0.10);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --rail-w:72px; --drawer-w:304px; --props-w:272px; --top-h:54px;
}
*{ box-sizing:border-box; }
html,body{ height:100%; }
body{ margin:0; background:var(--bg); color:var(--text); font-family:'IBM Plex Sans',-apple-system,system-ui,sans-serif; font-size:14px; -webkit-tap-highlight-color:transparent; overscroll-behavior:none; }
button{ font:inherit; color:inherit; }
[hidden]{ display:none !important; }
svg{ width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; flex-shrink:0; }

.app{ display:flex; flex-direction:column; height:100vh; height:100dvh; }

/* ---------- top bar ---------- */
.topbar{ display:flex; align-items:center; gap:6px; padding:0 12px; height:var(--top-h); background:var(--panel); border-bottom:1px solid var(--line); flex-shrink:0; position:relative; z-index:20; }
.brand{ display:flex; align-items:center; gap:8px; text-decoration:none; color:var(--text); white-space:nowrap; margin-right:2px; }
.brand .logo{ width:30px; height:30px; border-radius:8px; background:var(--accent); color:#fff; display:flex; align-items:center; justify-content:center; font-family:'Manrope',sans-serif; font-weight:800; font-size:1.05rem; }
.brand b{ font-family:'Manrope',sans-serif; font-weight:800; font-size:1.02rem; }
.brand .brand-sub{ font-family:'Manrope',sans-serif; font-weight:700; font-size:1.02rem; color:var(--accent); }
.tb-div{ width:1px; height:24px; background:var(--line); margin:0 6px; }
.proj-name{ color:var(--text-dim); font-size:0.84rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; min-width:0; max-width:260px; padding:0 6px; }
.spacer{ flex:1; }
.tb-btn{ display:flex; align-items:center; gap:6px; background:none; border:1px solid transparent; border-radius:8px; padding:0 10px; height:36px; cursor:pointer; color:var(--text); font-size:0.84rem; font-weight:500; white-space:nowrap; }
.tb-btn:hover,.menu.open > .tb-btn{ background:var(--panel-3); }
.tb-btn svg{ width:18px; height:18px; }
.caret{ width:0; height:0; border-left:4px solid transparent; border-right:4px solid transparent; border-top:5px solid currentColor; opacity:.6; }
button.ghost{ background:var(--panel); border:1px solid var(--line); color:var(--text); border-radius:8px; padding:0 12px; height:36px; font-size:0.82rem; font-weight:500; cursor:pointer; white-space:nowrap; }
button.ghost:hover{ border-color:var(--accent); color:var(--accent-strong); }
.tb-primary{ display:flex; align-items:center; gap:6px; background:var(--accent); color:#fff; border:none; border-radius:8px; padding:0 14px; height:36px; font-family:'Manrope',sans-serif; font-weight:800; font-size:0.84rem; cursor:pointer; white-space:nowrap; }
.tb-primary:hover{ background:var(--accent-strong); }
.tb-primary svg{ width:17px; height:17px; stroke-width:2; }
.banner{ background:#fff4e5; color:#8a4b06; font-size:0.8rem; padding:8px 16px; border-bottom:1px solid #f5d7ad; line-height:1.45; }

/* dropdown menus */
.menu{ position:relative; }
.menu-pop{ display:none; position:absolute; top:calc(100% + 6px); left:0; min-width:250px; background:var(--panel); border:1px solid var(--line); border-radius:10px; box-shadow:var(--shadow); padding:6px; z-index:40; }
.menu.open .menu-pop{ display:block; }
.menu.up .menu-pop{ top:auto; bottom:calc(100% + 8px); left:auto; right:0; min-width:220px; }
.menu-pop > button{ display:flex; align-items:flex-start; gap:10px; width:100%; background:none; border:none; text-align:left; padding:9px 10px; border-radius:7px; cursor:pointer; font-size:0.84rem; line-height:1.3; }
.menu-pop > button:hover{ background:var(--accent-soft); }
.menu-pop > button small{ display:block; color:var(--text-dim); font-size:0.72rem; margin-top:2px; }
.menu-pop .check{ padding:6px 8px; margin:0; }

/* ---------- layout ---------- */
.layout{ flex:1; min-height:0; display:grid; grid-template-columns:var(--rail-w) var(--drawer-w) minmax(0,1fr) var(--props-w); }
body.drawer-closed .layout{ grid-template-columns:var(--rail-w) 0 minmax(0,1fr) var(--props-w); }
body.drawer-closed .drawer{ display:none; }

/* left icon rail */
.rail{ grid-column:1; display:flex; flex-direction:column; gap:2px; padding:8px 6px; background:var(--panel); border-right:1px solid var(--line); overflow-y:auto; scrollbar-width:none; }
.rail::-webkit-scrollbar{ display:none; }
.rail button{ display:flex; flex-direction:column; align-items:center; gap:4px; background:none; border:none; border-radius:10px; padding:10px 2px 8px; cursor:pointer; color:var(--text-dim); font-size:0.7rem; font-weight:500; position:relative; }
.rail button svg{ width:23px; height:23px; }
.rail button:hover{ background:var(--panel-2); color:var(--text); }
.rail button.active{ background:var(--accent-soft); color:var(--accent-strong); }
.rail button.active::before{ content:''; position:absolute; left:-6px; top:10px; bottom:10px; width:3px; border-radius:0 3px 3px 0; background:var(--accent); }

/* tool drawer */
.panel{ display:flex; flex-direction:column; min-height:0; background:var(--panel); }
.drawer{ grid-column:2; border-right:1px solid var(--line); min-width:0; }
.drawer-head{ display:flex; align-items:center; justify-content:space-between; padding:12px 12px 10px 16px; border-bottom:1px solid var(--line); flex-shrink:0; font-family:'Manrope',sans-serif; font-weight:800; font-size:0.95rem; }
.icon-btn.plain{ border:none; background:none; font-size:1.3rem; color:var(--text-dim); }
.tab-body{ display:none; padding:14px 16px 20px; overflow-y:auto; flex:1; min-height:0; -webkit-overflow-scrolling:touch; }
.tab-body.active{ display:block; }

h2{ font-family:'Manrope',sans-serif; font-size:0.72rem; text-transform:uppercase; letter-spacing:0.06em; color:var(--text-dim); margin:0 0 9px; font-weight:800; }
h2.mt{ margin-top:22px; }
.hint{ font-size:0.76rem; color:var(--text-dim); line-height:1.5; margin:6px 0 0; }
.field{ display:flex; flex-direction:column; gap:5px; margin-bottom:10px; min-width:0; }
.field label{ font-size:0.76rem; color:var(--text-dim); }
.field input,.field select,.search,.modal input,.modal select,.modal textarea{
  background:var(--panel); border:1px solid var(--line-2); color:var(--text); border-radius:7px; padding:8px 10px;
  font-family:'IBM Plex Sans',sans-serif; font-size:16px; width:100%; min-width:0; min-height:38px;
}
.field input[type=number],.modal input[type=number]{ font-family:'IBM Plex Mono',monospace; }
.field input:focus,.search:focus,.modal input:focus,.modal select:focus,.modal textarea:focus{ outline:none; border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-ring); }
.row3{ display:grid; grid-template-columns:1fr 1fr 1fr; gap:8px; }
button.primary{ background:var(--accent); color:#fff; border:none; border-radius:8px; padding:10px 14px; font-family:'Manrope',sans-serif; font-weight:800; font-size:0.86rem; cursor:pointer; width:100%; min-height:var(--tap); }
button.primary:hover{ background:var(--accent-strong); }
button.primary:disabled{ opacity:.5; cursor:default; }
button.secondary{ background:var(--panel); color:var(--text); border:1px solid var(--line-2); border-radius:8px; padding:8px 10px; font-size:0.8rem; font-weight:500; cursor:pointer; min-height:var(--tap); line-height:1.2; }
button.secondary:hover{ border-color:var(--accent); color:var(--accent-strong); }
button.secondary.active{ border-color:var(--accent); color:var(--accent-strong); background:var(--accent-soft); }
button.secondary.full{ width:100%; }
button.danger-text{ color:var(--danger); }
.btn-row{ display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:8px; }
.btn-grid{ display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:10px; }
.status{ font-size:0.76rem; color:var(--text-dim); margin-top:8px; line-height:1.5; min-height:1.1em; }
.status.ok{ color:var(--ok); } .status.err{ color:var(--danger); }
.empty-note{ color:var(--text-dim); font-size:0.8rem; line-height:1.5; }
.check{ display:flex; align-items:center; gap:8px; font-size:0.84rem; margin:6px 0 10px; cursor:pointer; }
.check input{ width:17px; height:17px; accent-color:var(--accent); }

.chips{ display:flex; flex-wrap:wrap; gap:6px; }
.chip{ background:var(--panel); border:1px solid var(--line-2); color:var(--text); border-radius:999px; padding:6px 12px; font-size:0.78rem; cursor:pointer; min-height:32px; }
.chip:hover{ border-color:var(--accent); }
.chip.active{ border-color:var(--accent); color:var(--accent-strong); background:var(--accent-soft); font-weight:600; }
.chip.add{ border-style:dashed; color:var(--text-dim); }
.proj-card{ background:var(--panel-2); border:1px solid var(--line); border-radius:var(--radius); padding:10px 12px; font-size:0.82rem; margin-bottom:14px; line-height:1.5; }
.proj-card b{ font-family:'Manrope',sans-serif; }

.list{ margin-top:8px; }
.row-item{ display:flex; align-items:center; justify-content:space-between; gap:8px; padding:8px 10px; border:1px solid var(--line); border-radius:8px; margin-bottom:6px; background:var(--panel); min-height:44px; }
.row-item .name{ font-size:0.8rem; min-width:0; overflow:hidden; text-overflow:ellipsis; flex:1; }
.row-item .name small{ display:block; color:var(--text-dim); font-family:'IBM Plex Mono',monospace; font-size:0.7rem; margin-top:2px; }
.row-item.click{ cursor:pointer; }
.row-item.click:hover{ border-color:var(--accent); box-shadow:var(--shadow-sm); }
.icon-btn{ background:var(--panel); border:1px solid var(--line-2); color:var(--text); border-radius:6px; min-width:32px; height:32px; font-size:0.9rem; cursor:pointer; flex-shrink:0; }
.icon-btn:hover{ border-color:var(--accent); color:var(--accent-strong); }
.icon-btn.del{ color:var(--danger); }
.qty-ctrl{ display:flex; align-items:center; gap:5px; }
.qty-ctrl span{ font-family:'IBM Plex Mono',monospace; font-size:0.8rem; min-width:18px; text-align:center; }

/* model library */
.search{ margin-bottom:10px; padding-left:34px !important; background:var(--panel-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa1ad' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4-4'/%3E%3C/svg%3E") no-repeat 10px center / 16px !important; border-color:var(--line) !important; }
#catalogChips{ margin-bottom:6px; }
.cat-group{ margin-bottom:14px; }
.cat-group h3{ font-size:0.7rem; text-transform:uppercase; letter-spacing:0.06em; color:var(--text-dim); margin:12px 0 6px; font-family:'Manrope',sans-serif; }
#catalogList .cat-group{ display:grid; grid-template-columns:1fr 1fr; gap:8px; }
#catalogList .cat-group h3{ grid-column:1 / -1; margin-bottom:0; }
#catalogList .row-item.cat-item{ flex-direction:column; align-items:stretch; justify-content:flex-start; margin:0; padding:0; overflow:hidden; min-height:0; cursor:pointer; }
#catalogList .cat-item .thumb{ display:flex; align-items:center; justify-content:center; aspect-ratio:4/3; background:linear-gradient(160deg,#f8f6f3,#eceef2); font-size:1.9rem; }
#catalogList .cat-item .thumb img{ width:100%; height:100%; object-fit:contain; display:block; }
#catalogList .cat-item .thumb i{ width:62%; height:62%; border-radius:8px; box-shadow:inset 0 0 0 1px rgba(0,0,0,.06); }
#catalogList .cat-item .name{ padding:6px 8px 0; white-space:normal; line-height:1.25; font-size:0.76rem; }
#catalogList .cat-item .name small{ display:none; }
#catalogList .cat-item .price{ padding:2px 8px 8px; }
#catalogList .cat-item .add-btn{ position:absolute; top:6px; right:6px; min-width:28px; height:28px; border-radius:50%; border:none; background:var(--accent); color:#fff; font-weight:700; box-shadow:var(--shadow-sm); opacity:0; transition:opacity .15s; }
#catalogList .cat-item:hover .add-btn{ opacity:1; }
@media (hover:none){ #catalogList .cat-item .add-btn{ opacity:1; } }
#catalogList .cat-item{ position:relative; }
#catalogList .cat-item:hover{ border-color:var(--accent); box-shadow:var(--shadow-sm); }
.cat-item .price{ font-size:0.72rem; color:var(--accent-strong); font-family:'IBM Plex Mono',monospace; }
.cat-item .add-btn{ color:var(--accent); font-size:1.1rem; }

.preset-card{ border:1px solid var(--line); border-radius:10px; padding:12px; margin-bottom:10px; background:var(--panel); }
.preset-card:hover{ box-shadow:var(--shadow-sm); }
.preset-card .pc-head{ display:flex; justify-content:space-between; align-items:baseline; gap:8px; }
.preset-card .pc-name{ font-family:'Manrope',sans-serif; font-weight:800; }
.preset-card .pc-cost{ font-family:'IBM Plex Mono',monospace; font-size:0.78rem; color:var(--accent-strong); }
.preset-card .pc-strip{ display:flex; height:28px; border-radius:6px; overflow:hidden; margin:8px 0; }
.preset-card .pc-items{ font-size:0.74rem; color:var(--text-dim); line-height:1.5; margin-bottom:10px; }
.swatches{ display:flex; flex-wrap:wrap; gap:8px; }
.swatch{ width:34px; height:34px; border-radius:50%; border:2px solid #fff; box-shadow:0 0 0 1px var(--line-2); cursor:pointer; }
.swatch.active{ box-shadow:0 0 0 2px var(--accent); }
.swatch.custom{ display:flex; align-items:center; justify-content:center; background:var(--panel-2); font-size:1rem; position:relative; overflow:hidden; }
.swatch.custom input{ position:absolute; inset:0; opacity:0; cursor:pointer; }

/* ---------- canvas ---------- */
.viewport-wrap{ grid-column:3; display:flex; flex-direction:column; min-width:0; min-height:0; position:relative; }
.viewport{ position:relative; background:#e6e8ec; overflow:hidden; flex:1; min-height:220px; touch-action:none; }
.viewport canvas{ display:block; width:100%; height:100%; touch-action:none; outline:none; }
.vp-bottom{ position:absolute; left:12px; right:12px; bottom:12px; display:flex; align-items:flex-end; justify-content:space-between; gap:8px; pointer-events:none; z-index:3; }
.vp-bottom > *{ pointer-events:auto; }
.vp-right{ display:flex; gap:6px; align-items:center; }
.seg{ display:flex; background:var(--panel); border:1px solid var(--line); border-radius:10px; padding:3px; gap:2px; box-shadow:var(--shadow-sm); }
.seg button{ background:none; border:none; color:var(--text-dim); padding:0 13px; height:32px; border-radius:7px; font-family:'Manrope',sans-serif; font-weight:800; font-size:0.8rem; cursor:pointer; }
.seg button:hover{ color:var(--text); }
.seg button.active{ background:var(--accent); color:#fff; }
.vp-btn{ background:var(--panel); border:1px solid var(--line); color:var(--text); border-radius:9px; padding:0 11px; height:38px; font-size:0.8rem; font-weight:600; cursor:pointer; box-shadow:var(--shadow-sm); }
select.vp-btn{ font-weight:500; max-width:140px; }
.vp-btn:hover{ border-color:var(--accent); }
.vp-btn.active{ border-color:var(--accent); color:var(--accent-strong); background:#fff7f0; }
.viewport-hint{ position:absolute; top:12px; left:12px; right:12px; font-size:0.74rem; color:var(--text-dim); pointer-events:none; text-align:left; z-index:2; }
.viewport-hint span{ background:rgba(255,255,255,0.92); padding:5px 10px; border-radius:7px; display:inline-block; box-shadow:var(--shadow-sm); }
.viewport.sel .viewport-hint{ display:none; }
.place-banner{ position:absolute; top:12px; left:50%; transform:translateX(-50%); background:var(--accent); color:#fff; font-family:'Manrope',sans-serif; font-weight:700; font-size:0.8rem; padding:6px 6px 6px 14px; border-radius:999px; display:none; align-items:center; gap:10px; white-space:nowrap; max-width:94%; box-shadow:var(--shadow); z-index:4; }
.place-banner.active{ display:flex; }
.place-banner button{ background:rgba(255,255,255,0.22); border:none; border-radius:999px; padding:5px 10px; font-weight:700; cursor:pointer; color:#fff; }
.draw-toolbar,.select-toolbar,.mode-toolbar{ position:absolute; left:50%; transform:translateX(-50%); background:var(--panel); border:1px solid var(--line); border-radius:12px; padding:8px; display:none; flex-direction:column; align-items:center; gap:6px; max-width:calc(100% - 16px); box-shadow:var(--shadow); z-index:4; }
.draw-toolbar,.mode-toolbar{ top:12px; }
.select-toolbar{ bottom:62px; }
.draw-toolbar.active,.select-toolbar.active,.mode-toolbar.active{ display:flex; }
.draw-toolbar span,.select-toolbar span,.mode-toolbar span{ font-size:0.76rem; color:var(--text); font-family:'IBM Plex Mono',monospace; text-align:center; max-width:100%; }
.tb-row{ display:flex; gap:4px; flex-wrap:wrap; justify-content:center; }
.tb-row button{ background:var(--panel-2); border:1px solid transparent; color:var(--text); border-radius:8px; padding:6px 11px; font-size:0.78rem; cursor:pointer; white-space:nowrap; min-height:34px; }
.tb-row button:hover{ border-color:var(--accent); color:var(--accent-strong); background:#fff7f0; }
.tb-row button.ok{ color:#fff; background:var(--ok); }
.tb-row button.del{ color:var(--danger); }
.joystick{ position:absolute; left:16px; bottom:64px; width:120px; height:120px; border-radius:50%; background:rgba(255,255,255,0.55); border:1px solid var(--line-2); display:none; touch-action:none; z-index:3; }
.joystick .knob{ position:absolute; left:40px; top:40px; width:40px; height:40px; border-radius:50%; background:rgba(238,125,38,0.9); pointer-events:none; }
.rec-badge{ position:absolute; top:12px; left:50%; transform:translateX(-50%); background:#d63b2f; color:#fff; font-weight:700; font-size:0.8rem; padding:5px 12px; border-radius:999px; z-index:5; }
.loading{ position:absolute; inset:0; display:flex; align-items:center; justify-content:center; background:rgba(243,244,247,0.7); font-size:0.9rem; z-index:6; }

/* ---------- right properties panel ---------- */
.panel-props{ grid-column:4; display:flex; flex-direction:column; min-height:0; background:var(--panel); border-left:1px solid var(--line); }
.props-head{ padding:14px 16px 10px; border-bottom:1px solid var(--line); font-family:'Manrope',sans-serif; font-weight:800; font-size:0.95rem; flex-shrink:0; }
.props-scroll{ overflow-y:auto; flex:1; min-height:0; }
.props-sec{ padding:14px 16px; border-bottom:1px solid var(--line); }
.props-sec:last-child{ border-bottom:none; }
.props-kv{ display:grid; grid-template-columns:auto 1fr; gap:7px 12px; font-size:0.8rem; }
.props-kv span{ color:var(--text-dim); }
.props-kv b{ font-family:'IBM Plex Mono',monospace; font-weight:500; text-align:right; }
.props-name{ font-family:'Manrope',sans-serif; font-weight:800; font-size:1rem; margin-bottom:2px; word-break:break-word; }
.props-sub{ color:var(--text-dim); font-size:0.76rem; margin-bottom:12px; }
.props-actions{ display:grid; grid-template-columns:1fr 1fr; gap:6px; margin-top:12px; }
.props-actions button{ background:var(--panel); border:1px solid var(--line-2); border-radius:8px; padding:7px 6px; font-size:0.78rem; cursor:pointer; min-height:34px; }
.props-actions button:hover{ border-color:var(--accent); color:var(--accent-strong); }
.props-actions button.del{ color:var(--danger); }
.props-actions button.ok{ grid-column:1 / -1; background:var(--accent); border-color:var(--accent); color:#fff; font-weight:700; }
.props-dims{ display:grid; grid-template-columns:repeat(3,1fr); gap:6px; }
.props-dims div{ background:var(--panel-2); border-radius:7px; padding:7px 8px; }
.props-dims small{ display:block; color:var(--text-faint); font-size:0.66rem; text-transform:uppercase; letter-spacing:0.05em; }
.props-dims b{ font-family:'IBM Plex Mono',monospace; font-weight:500; font-size:0.82rem; }
.props-empty{ padding:22px 16px; color:var(--text-dim); font-size:0.82rem; line-height:1.55; }
.props-empty .big{ font-size:2rem; display:block; margin-bottom:8px; }
.props-finish{ display:flex; align-items:center; gap:10px; font-size:0.8rem; margin-bottom:8px; }
.props-finish i{ width:26px; height:26px; border-radius:6px; border:1px solid var(--line-2); display:inline-block; flex-shrink:0; }
.props-finish span{ flex:1; }
.props-finish button{ background:none; border:none; color:var(--accent-strong); cursor:pointer; font-size:0.78rem; font-weight:600; }
.stats-grid{ display:grid; grid-template-columns:1fr 1fr; gap:6px; }
.stat-chip{ background:var(--panel-2); border-radius:7px; padding:7px 9px; font-size:0.68rem; color:var(--text-faint); text-transform:uppercase; letter-spacing:0.04em; display:flex; flex-direction:column; gap:2px; }
.stat-chip b{ color:var(--text); font-family:'IBM Plex Mono',monospace; font-weight:500; font-size:0.82rem; text-transform:none; letter-spacing:0; }
.props-total{ display:flex; justify-content:space-between; align-items:baseline; margin-bottom:10px; }
.props-total span{ color:var(--text-dim); font-size:0.82rem; }
.props-total b{ font-family:'IBM Plex Mono',monospace; font-size:1.25rem; color:var(--accent-strong); }

/* ---------- quote ---------- */
.quote-room{ margin-bottom:12px; }
.quote-room h4{ margin:8px 0 4px; font-size:0.8rem; color:var(--accent-strong); font-family:'Manrope',sans-serif; }
.quote-table{ width:100%; border-collapse:collapse; font-size:0.76rem; }
.quote-table th{ text-align:left; color:var(--text-dim); font-weight:500; padding:5px 0; border-bottom:1px solid var(--line); }
.quote-table td{ padding:6px 0; border-bottom:1px solid var(--line); vertical-align:top; }
.quote-table td.num,.quote-table th.num{ text-align:right; font-family:'IBM Plex Mono',monospace; font-variant-numeric:tabular-nums; white-space:nowrap; padding-left:6px; }
.quote-total{ display:flex; justify-content:space-between; align-items:baseline; padding:12px 12px; margin:6px 0; background:#fff7f0; border:1px solid #f7d9bf; border-radius:10px; }
.quote-total .label{ color:var(--text-dim); font-size:0.85rem; }
.quote-total .amount{ font-family:'IBM Plex Mono',monospace; font-size:1.3rem; font-weight:600; color:var(--accent-strong); }

.share-out{ margin-top:10px; background:var(--panel-2); border:1px solid var(--line); border-radius:var(--radius); padding:10px; font-size:0.78rem; word-break:break-all; }
.share-out .btn-grid{ margin-top:8px; }
.views{ display:grid; grid-template-columns:repeat(2,1fr); gap:8px; margin-top:10px; }
.view-thumb{ position:relative; border:1px solid var(--line); border-radius:8px; overflow:hidden; cursor:pointer; background:var(--panel); }
.view-thumb img{ display:block; width:100%; aspect-ratio:4/3; object-fit:cover; }
.view-thumb span{ display:block; font-size:0.7rem; padding:4px 6px; color:var(--text-dim); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.view-thumb .x{ position:absolute; top:4px; right:4px; background:rgba(0,0,0,0.55); border:none; color:#fff; border-radius:50%; width:24px; height:24px; cursor:pointer; }

/* ---------- modal / toast ---------- */
.modal-back{ position:fixed; inset:0; background:rgba(20,24,33,0.42); display:flex; align-items:center; justify-content:center; z-index:50; padding:16px; }
.modal{ background:var(--panel); border:1px solid var(--line); border-radius:14px; width:100%; max-width:440px; max-height:calc(100dvh - 32px); display:flex; flex-direction:column; box-shadow:0 24px 64px rgba(20,24,33,0.28); }
.modal.wide{ max-width:980px; }
.modal h3{ margin:0; padding:16px 18px 10px; font-family:'Manrope',sans-serif; font-size:1rem; }
.modal-fields{ padding:4px 18px 8px; overflow-y:auto; }
.modal-actions{ display:flex; gap:8px; padding:12px 18px 16px; border-top:1px solid var(--line); }
.modal-actions button{ flex:1; }
.modal .mf{ margin-bottom:12px; }
.modal .mf > label{ display:block; font-size:0.76rem; color:var(--text-dim); margin-bottom:5px; }
.modal .mf .help{ font-size:0.72rem; color:var(--text-dim); margin-top:4px; line-height:1.4; }
.ftin{ display:flex; align-items:center; gap:6px; }
.ftin input{ flex:1; }
.ftin span{ font-size:0.76rem; color:var(--text-dim); }
.opt-cards{ display:flex; flex-wrap:wrap; gap:6px; }
.opt-cards label{ flex:1 1 auto; border:1px solid var(--line-2); border-radius:8px; padding:9px 10px; font-size:0.8rem; cursor:pointer; text-align:center; background:var(--panel); min-width:70px; }
.opt-cards input{ display:none; }
.opt-cards input:checked + span{ color:var(--accent-strong); font-weight:600; }
.opt-cards label:has(input:checked){ border-color:var(--accent); background:var(--accent-soft); }
.mf-row{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.parts-table{ width:100%; border-collapse:collapse; font-size:0.8rem; }
.parts-table td,.parts-table th{ padding:6px 4px; border-bottom:1px solid var(--line); text-align:left; }
.parts-table td.num{ font-family:'IBM Plex Mono',monospace; text-align:right; white-space:nowrap; }
.drawing-sheets{ display:flex; flex-direction:column; gap:14px; }
.drawing-sheets canvas{ width:100%; height:auto; background:#fff; border-radius:6px; border:1px solid var(--line); }
.sheet-actions{ display:flex; gap:8px; flex-wrap:wrap; margin-top:6px; }
.toasts{ position:fixed; left:50%; bottom:calc(24px + var(--safe-b)); transform:translateX(-50%); display:flex; flex-direction:column; gap:8px; z-index:60; pointer-events:none; width:max-content; max-width:92vw; }
.toast{ background:#1d2129; color:#fff; padding:10px 14px; border-radius:10px; font-size:0.84rem; box-shadow:0 8px 24px rgba(0,0,0,0.25); pointer-events:auto; border-left:4px solid var(--accent); }
.toast.ok{ border-left-color:var(--ok); } .toast.err{ border-left-color:var(--danger); }

/* sign-in screen */
.auth-back{ position:fixed; inset:0; z-index:80; background:#f3f4f7; display:flex; align-items:stretch; justify-content:center; overflow:auto; }
.auth-split{ display:grid; grid-template-columns:minmax(0,1.1fr) minmax(360px,480px); width:100%; min-height:100%; }
.auth-hero{ background:radial-gradient(120% 90% at 0% 0%,#ffb877 0%,#ee7d26 38%,#b8520c 100%); color:#fff; padding:48px 56px; display:flex; flex-direction:column; justify-content:center; gap:18px; position:relative; overflow:hidden; }
.auth-hero::after{ content:''; position:absolute; right:-80px; bottom:-80px; width:360px; height:360px; border-radius:40px; border:2px solid rgba(255,255,255,.25); transform:rotate(18deg); }
.auth-hero h2{ font-family:'Manrope',sans-serif; font-size:2.3rem; line-height:1.15; margin:0; max-width:520px; text-transform:none; letter-spacing:-0.01em; color:#fff; font-weight:800; }
.auth-hero ul{ margin:0; padding:0; list-style:none; display:grid; gap:10px; font-size:0.98rem; max-width:460px; }
.auth-hero li{ padding-left:28px; position:relative; }
.auth-hero li::before{ content:'✓'; position:absolute; left:0; top:0; width:20px; height:20px; border-radius:50%; background:rgba(255,255,255,.22); display:flex; align-items:center; justify-content:center; font-size:0.72rem; font-weight:800; }
.auth-card{ width:100%; background:var(--panel); padding:40px 36px 26px; display:flex; flex-direction:column; justify-content:center; }
.auth-brand{ display:flex; align-items:center; gap:8px; font-family:'Manrope',sans-serif; font-size:1.1rem; }
.auth-brand .logo{ width:34px; height:34px; border-radius:9px; background:var(--accent); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:800; }
.auth-brand.light .logo{ background:#fff; color:var(--accent); }
.auth-brand b{ font-weight:800; } .auth-brand span:last-child{ font-weight:700; opacity:.9; }
.auth-card h1{ font-family:'Manrope',sans-serif; font-size:1.6rem; margin:0 0 4px; }
.auth-card > .hint{ margin-bottom:22px; }
.google-btn{ display:flex; align-items:center; justify-content:center; gap:10px; width:100%; min-height:46px; background:#fff; border:1px solid var(--line-2); border-radius:10px; font-weight:600; font-size:0.95rem; cursor:pointer; box-shadow:var(--shadow-sm); }
.google-btn:hover{ border-color:#9aa1ad; background:#fafbfc; }
.auth-or{ display:flex; align-items:center; gap:10px; color:var(--text-faint); font-size:0.76rem; margin:20px 0 14px; }
.auth-or::before,.auth-or::after{ content:''; flex:1; height:1px; background:var(--line); }
.auth-foot{ margin-top:14px !important; border-top:1px solid var(--line); padding-top:12px; }
button.linkish{ background:none; border:none; padding:0; color:var(--accent-strong); font-weight:600; cursor:pointer; font-size:inherit; }
@media (max-width:860px){ .auth-split{ grid-template-columns:1fr; } .auth-hero{ padding:28px 22px; gap:10px; } .auth-hero h2{ font-size:1.45rem; } .auth-hero ul{ display:none; } .auth-card{ padding:26px 20px 22px; justify-content:flex-start; } }

/* home dashboard */
body.home-open{ overflow:hidden; }
.home{ position:fixed; inset:0; z-index:30; display:grid; grid-template-columns:232px minmax(0,1fr); background:#f5f6f8; }
.home-side{ background:var(--panel); border-right:1px solid var(--line); display:flex; flex-direction:column; gap:6px; padding:16px 12px; min-height:0; overflow:auto; }
.home-logo{ display:flex; align-items:center; gap:8px; font-family:'Manrope',sans-serif; font-size:1.05rem; padding:2px 6px 12px; }
.home-logo .logo{ width:30px; height:30px; border-radius:8px; background:var(--accent); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:800; }
.home-logo b{ font-weight:800; } .home-logo span:last-child{ color:var(--accent); font-weight:700; }
.home-new{ background:linear-gradient(135deg,#f59a45,#ee7d26); color:#fff; border:none; border-radius:10px; min-height:42px; font-family:'Manrope',sans-serif; font-weight:800; cursor:pointer; margin-bottom:8px; box-shadow:0 4px 12px rgba(238,125,38,.3); }
.home-nav{ display:flex; flex-direction:column; gap:2px; }
.home-nav button{ display:flex; align-items:center; gap:10px; background:none; border:none; border-radius:8px; padding:9px 10px; cursor:pointer; color:var(--text); font-size:0.9rem; text-align:left; }
.home-nav button svg{ width:18px; height:18px; color:var(--text-dim); }
.home-nav button:hover{ background:var(--panel-2); }
.home-nav button.active{ background:var(--accent-soft); color:var(--accent-strong); font-weight:600; }
.home-nav button.active svg{ color:var(--accent-strong); }
.home-plan{ margin-top:auto; background:linear-gradient(160deg,#fff4ea,#fff); border:1px solid #f7d9bf; border-radius:12px; padding:12px; display:flex; flex-direction:column; gap:4px; font-size:0.82rem; }
.home-plan small{ color:var(--text-dim); line-height:1.4; }
.home-plan .linkish{ align-self:flex-start; margin-top:4px; font-size:0.8rem; }
.home-user{ display:flex; align-items:center; gap:8px; padding:10px 4px 0; border-top:1px solid var(--line); margin-top:8px; }
.avatar{ width:34px; height:34px; border-radius:50%; overflow:hidden; background:#7c5cff; color:#fff; display:flex; align-items:center; justify-content:center; font-weight:700; flex-shrink:0; }
.avatar img{ width:100%; height:100%; object-fit:cover; }
.home-user .who{ min-width:0; flex:1; display:flex; flex-direction:column; font-size:0.82rem; }
.home-user .who b,.home-user .who small{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.home-user .who small{ color:var(--text-dim); font-size:0.72rem; }
.home-main{ display:flex; flex-direction:column; min-height:0; min-width:0; }
.home-top{ display:flex; align-items:center; gap:8px; padding:12px 28px; background:var(--panel); border-bottom:1px solid var(--line); min-height:58px; }
.home-top-title{ font-family:'Manrope',sans-serif; font-weight:800; font-size:1.1rem; }
.home-top-logo{ display:none; align-items:center; gap:6px; font-family:'Manrope',sans-serif; font-weight:800; }
.home-top-logo .logo{ width:28px; height:28px; border-radius:8px; background:var(--accent); color:#fff; display:flex; align-items:center; justify-content:center; }
.home-cta{ background:#1d2129; color:#fff; border:none; border-radius:999px; padding:0 18px; height:38px; font-weight:700; cursor:pointer; white-space:nowrap; }
.home-cta:hover{ background:#000; }
.home-page{ flex:1; min-height:0; overflow:auto; padding:22px 28px 60px; }
.home-hello h1{ font-family:'Manrope',sans-serif; font-size:1.6rem; margin:6px 0 2px; }
.home-hello p{ margin:0 0 18px; color:var(--text-dim); }
.hsec{ margin-bottom:28px; }
.hsec-head{ display:flex; align-items:baseline; gap:12px; margin-bottom:12px; }
.hsec-head h3{ font-family:'Manrope',sans-serif; font-size:1.05rem; margin:0; }
.hsec-head .linkish{ margin-left:auto; }
.hsec-sub{ color:var(--text-dim); font-size:0.8rem; }
.create-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(230px,1fr)); gap:12px; }
.create-card{ display:flex; align-items:center; gap:12px; background:var(--panel); border:1px solid var(--line); border-radius:12px; padding:14px; cursor:pointer; text-align:left; transition:box-shadow .15s, transform .15s, border-color .15s; }
.create-card:hover{ box-shadow:var(--shadow); transform:translateY(-1px); border-color:#f3c9a3; }
.cc-icon{ width:42px; height:42px; border-radius:10px; display:flex; align-items:center; justify-content:center; font-size:1.3rem; flex-shrink:0; }
.cc-text{ display:flex; flex-direction:column; gap:2px; min-width:0; flex:1; }
.cc-text b{ font-size:0.92rem; } .cc-text small{ color:var(--text-dim); font-size:0.76rem; line-height:1.35; }
.cc-plus{ width:26px; height:26px; border-radius:7px; background:var(--panel-2); display:flex; align-items:center; justify-content:center; color:var(--text-dim); font-weight:700; }
.kitchen-strip{ display:flex; align-items:center; gap:10px; margin-top:12px; background:linear-gradient(90deg,#fffaf3,#fff); border:1px solid #f4e1c7; border-radius:12px; padding:12px 14px; overflow-x:auto; }
.kitchen-strip.big{ margin-top:0; background:var(--panel); border-color:var(--line); }
.ks-label{ display:flex; flex-direction:column; min-width:170px; font-size:0.86rem; } .ks-label small{ color:var(--text-dim); font-size:0.74rem; }
.ks-item{ display:flex; flex-direction:column; align-items:center; gap:4px; background:var(--panel); border:1px solid var(--line); border-radius:10px; padding:8px 10px; cursor:pointer; font-size:0.74rem; min-width:84px; }
.ks-item:hover{ border-color:var(--accent); }
.ks-item svg{ width:56px; height:50px; fill:none; }
.ks-room{ fill:#f5f6f8; stroke:#c9ced6; stroke-width:1.5; }
.ks-cab{ stroke:#e5a21a; stroke-width:7; stroke-linecap:square; fill:none; }
.pgrid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(210px,1fr)); gap:14px; }
.pcard{ background:var(--panel); border:1px solid var(--line); border-radius:12px; overflow:visible; cursor:pointer; position:relative; transition:box-shadow .15s, transform .15s; }
.pcard:hover{ box-shadow:var(--shadow); transform:translateY(-1px); }
.pcard-img{ aspect-ratio:3/2; background:linear-gradient(160deg,#f7f3ee,#eceef2); border-radius:12px 12px 0 0; overflow:hidden; position:relative; }
.pcard-img img{ width:100%; height:100%; object-fit:cover; display:block; }
.pcard-empty{ width:100%; height:100%; display:flex; align-items:center; justify-content:center; font-size:2.2rem; opacity:.7; }
.pcard-tag{ position:absolute; left:8px; top:8px; background:rgba(29,33,41,.75); color:#fff; font-size:0.66rem; padding:3px 7px; border-radius:6px; }
.pcard-body{ padding:10px 12px 12px; display:flex; flex-direction:column; gap:2px; padding-right:36px; }
.pcard-body b{ font-size:0.88rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.pcard-body small{ color:var(--text-dim); font-size:0.74rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.pcard-menu{ position:absolute; right:6px; bottom:10px; }
.pcard-pop{ display:none; position:absolute; right:0; bottom:34px; background:var(--panel); border:1px solid var(--line); border-radius:10px; box-shadow:var(--shadow); padding:5px; min-width:160px; z-index:5; }
.pcard.menu-open .pcard-pop{ display:block; }
.pcard-pop button{ display:block; width:100%; text-align:left; background:none; border:none; padding:8px 10px; border-radius:6px; cursor:pointer; font-size:0.84rem; }
.pcard-pop button:hover{ background:var(--panel-2); }
.style-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); gap:12px; }
.style-card{ display:flex; flex-direction:column; gap:4px; background:var(--panel); border:1px solid var(--line); border-radius:12px; padding:10px 10px 12px; cursor:pointer; text-align:left; }
.style-card:hover{ box-shadow:var(--shadow); }
.sc-strip{ display:flex; height:74px; border-radius:8px; overflow:hidden; margin-bottom:6px; } .sc-strip i{ flex:1; }
.style-card small{ color:var(--text-dim); font-size:0.76rem; }
.tips{ display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:12px; }
.tips div{ background:var(--panel); border:1px solid var(--line); border-radius:12px; padding:12px 14px; display:flex; flex-direction:column; gap:4px; font-size:0.86rem; }
.tips small{ color:var(--text-dim); line-height:1.45; }
.proj-bar{ display:flex; gap:10px; margin-bottom:16px; } .proj-bar .search{ margin:0; max-width:420px; } .proj-bar .secondary{ white-space:nowrap; }
.settings-card{ background:var(--panel); border:1px solid var(--line); border-radius:12px; padding:16px 18px; max-width:860px; }
.settings-grid{ display:grid; grid-template-columns:1fr 1fr; gap:0 14px; }
.settings-card textarea{ background:var(--panel); border:1px solid var(--line-2); border-radius:7px; padding:8px 10px; font:inherit; font-size:15px; width:100%; }
.settings-card .status{ display:inline-block; margin-left:12px; }
.logo-row{ display:flex; gap:14px; align-items:center; margin-bottom:14px; }
.logo-prev{ width:72px; height:72px; border-radius:12px; border:1px dashed var(--line-2); display:flex; align-items:center; justify-content:center; color:var(--text-faint); font-size:0.78rem; overflow:hidden; background:var(--panel-2); }
.logo-prev img{ width:100%; height:100%; object-fit:contain; }
.kv{ display:grid; grid-template-columns:120px 1fr; gap:6px 12px; font-size:0.86rem; margin-bottom:8px; } .kv span{ color:var(--text-dim); }
.pw-row{ display:flex; gap:8px; flex-wrap:wrap; margin-top:8px; }
.pw-row input{ flex:1 1 180px; background:var(--panel); border:1px solid var(--line-2); border-radius:7px; padding:8px 10px; font-size:15px; min-height:38px; }
.plan-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:14px; max-width:860px; }
.plan-card{ background:var(--panel); border:1px solid var(--line); border-radius:14px; padding:18px; display:flex; flex-direction:column; gap:6px; }
.plan-card.current{ border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft); }
.plan-card.pro{ background:linear-gradient(160deg,#1d2129,#343a46); color:#fff; border-color:#1d2129; }
.plan-card .price{ font-family:'Manrope',sans-serif; font-weight:800; font-size:1.5rem; }
.plan-card ul{ margin:6px 0; padding-left:18px; font-size:0.86rem; line-height:1.7; }
.pill{ align-self:flex-start; background:var(--accent-soft); color:var(--accent-strong); border-radius:999px; padding:3px 10px; font-size:0.74rem; font-weight:700; }
.pill.soon{ background:rgba(255,255,255,.15); color:#fff; }
.drive-row{ display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.drive-row .drive-ic{ width:40px; height:40px; border-radius:10px; background:#f1f5ff; display:flex; align-items:center; justify-content:center; font-size:1.3rem; }
.vlist .row-item{ align-items:flex-start; }
@media (max-width:900px){
  .home{ grid-template-columns:1fr; grid-template-rows:minmax(0,1fr) auto; }
  .home-side{ grid-row:2; flex-direction:row; align-items:center; padding:6px 8px calc(6px + var(--safe-b)); border-right:none; border-top:1px solid var(--line); overflow:visible; }
  .home-logo,.home-new,.home-plan,.home-user,.hsec-sub{ display:none; }
  .home-top-logo{ display:flex; }
  .home-cta{ height:34px; padding:0 14px; font-size:0.84rem; }
  .home-nav{ flex-direction:row; flex:1; justify-content:space-around; }
  .home-nav button{ flex-direction:column; gap:2px; font-size:0.7rem; padding:6px 10px; }
  .home-user{ border:none; margin:0; padding:0; }
  .home-top{ padding:10px 14px; min-height:52px; }
  .home-page{ padding:16px 14px 40px; }
  .settings-grid{ grid-template-columns:1fr; }
  .pgrid{ grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
  .create-grid{ grid-template-columns:1fr; }
  .home-hello h1{ font-size:1.3rem; }
}

/* viewer (client link) mode */
body.viewer .edit-only,body.viewer [data-tab="build"],body.viewer [data-tab="style"],body.viewer [data-tab="catalog"],body.viewer [data-tab="share"],body.viewer #projectsBtn{ display:none !important; }
body.viewer.no-prices [data-tab="quote"],body.viewer.no-prices #propsQuoteSec{ display:none !important; }
@media (min-width:1100px){ body.viewer .layout{ grid-template-columns:var(--rail-w) var(--drawer-w) minmax(0,1fr) 0; } body.viewer .panel-props{ display:none; }
  body.viewer.drawer-closed .layout{ grid-template-columns:var(--rail-w) 0 minmax(0,1fr) 0; } }

/* ---------- small desktop / tablet landscape ---------- */
@media (max-width:1360px) and (min-width:1100px){
  :root{ --rail-w:64px; --drawer-w:280px; --props-w:244px; }
  .tb-btn .lbl{ display:none; }
  .proj-name{ max-width:170px; }
}

/* ---------- tablet portrait & phone: canvas on top, drawer below, rail = bottom nav ---------- */
@media (max-width:1099px){
  :root{ --top-h:50px; }
  .topbar{ padding:0 8px; gap:4px; }
  .tb-div,.proj-name{ display:none; }
  .brand .brand-sub{ display:none; }
  .tb-btn{ padding:0 8px; }
  .tb-btn .lbl{ display:none; }
  .layout{ display:flex; flex-direction:column; }
  .viewport-wrap{ order:1; flex:0 0 auto; height:50dvh; border-bottom:1px solid var(--line); }
  .drawer{ order:2; flex:1 1 0; border:none; }
  body.drawer-closed .drawer{ display:flex; }
  .drawer-head{ padding:10px 14px 8px; font-size:0.88rem; }
  #drawerClose{ display:none; }
  .panel-props{ display:none; }
  .rail{ order:3; flex-direction:row; justify-content:space-around; padding:4px 4px calc(4px + var(--safe-b)); border-right:none; border-top:1px solid var(--line); overflow-x:auto; overflow-y:hidden; flex-shrink:0; }
  .rail button{ flex:1 0 auto; min-width:54px; padding:6px 2px 4px; font-size:0.68rem; gap:2px; }
  .rail button svg{ width:22px; height:22px; }
  .rail button.active::before{ left:22%; right:22%; top:-4px; bottom:auto; width:auto; height:3px; border-radius:0 0 3px 3px; }
  .tab-body{ padding:12px 14px 16px; }
  .modal-back{ align-items:flex-end; padding:0; }
  .modal{ max-width:none; border-radius:16px 16px 0 0; max-height:88dvh; padding-bottom:var(--safe-b); }
  .modal.wide{ max-width:none; }
  .menu-pop{ position:fixed; top:calc(var(--top-h) + 4px); left:8px; right:8px; min-width:0; }
  .menu.up .menu-pop{ position:absolute; left:auto; right:0; top:auto; bottom:calc(100% + 8px); min-width:210px; }
  .toasts{ bottom:calc(76px + var(--safe-b)); }
}
@media (min-width:700px) and (max-width:1099px){
  .viewport-wrap{ height:56dvh; }
  .tab-body{ padding:14px 22px; }
  .btn-grid{ grid-template-columns:repeat(3,1fr); }
  .views{ grid-template-columns:repeat(3,1fr); }
  #catalogList .cat-group{ grid-template-columns:repeat(4,1fr); }
  .rail{ justify-content:center; gap:10px; }
  .rail button{ flex:0 0 84px; }
}
@media (max-width:699px){
  .draw-toolbar,.select-toolbar,.mode-toolbar{ width:calc(100% - 16px); padding:6px; gap:4px; border-radius:12px; }
  .draw-toolbar span,.select-toolbar span,.mode-toolbar span{ width:100%; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-size:0.7rem; }
  .tb-row{ flex-wrap:nowrap; overflow-x:auto; justify-content:flex-start; width:100%; scrollbar-width:none; -webkit-overflow-scrolling:touch; }
  .tb-row::-webkit-scrollbar{ display:none; }
  .tb-row button{ flex:0 0 auto; padding:6px 10px; min-height:34px; }
  .draw-toolbar,.mode-toolbar{ top:8px; }
  .select-toolbar{ bottom:54px; }
  .viewport-hint{ top:8px; left:8px; font-size:0.68rem; }
  .vp-bottom{ left:8px; right:8px; bottom:8px; }
  .vp-btn .lbl{ display:none; }
  .joystick{ bottom:56px; }
  button.ghost{ padding:0 9px; }
  #installBtn .lbl,#projectsBtn .lbl,#logoutBtn .lbl{ display:none; }
  .tb-primary{ padding:0 10px; }
  .tb-primary .lbl{ display:none; }
}
.viewport.walking .viewport-hint{ left:146px; }
@media (max-width:420px){
  .seg button{ padding:0 8px; font-size:0.76rem; height:30px; }
  .vp-right{ gap:4px; }
  select.vp-btn{ max-width:70px; padding:0 4px; }
  .vp-btn{ padding:0 8px; height:36px; }
  .brand b{ display:none; }
  .rail button{ min-width:48px; font-size:0.64rem; }
}
/* phone landscape: canvas left, drawer right, rail along the bottom of the drawer */
@media (max-width:1099px) and (orientation:landscape) and (max-height:560px){
  .layout{ display:grid; grid-template-columns:minmax(0,1.35fr) minmax(0,1fr); grid-template-rows:minmax(0,1fr) auto; }
  .viewport-wrap{ grid-column:1; grid-row:1 / span 2; height:auto; border-bottom:none; border-right:1px solid var(--line); }
  .drawer{ grid-column:2; grid-row:1; }
  .rail{ grid-column:2; grid-row:2; }
  :root{ --top-h:44px; }
}

/* ---------- print ---------- */
#printArea{ display:none; }
@media print{
  body{ background:#fff; }
  .app,#modalRoot,#toastRoot{ display:none !important; }
  #printArea{ display:block !important; color:#000; font-family:'IBM Plex Sans',sans-serif; padding:0; }
  #printArea h1{ font-family:'Manrope',sans-serif; margin:0; }
  #printArea table{ width:100%; border-collapse:collapse; font-size:12px; }
  #printArea th,#printArea td{ padding:6px; border-bottom:1px solid #ccc; text-align:left; }
  #printArea td.num,#printArea th.num{ text-align:right; }
  #printArea img{ max-width:100%; page-break-inside:avoid; }
  .page-break{ page-break-before:always; }
}
.tb-btn.icon-only{ padding:0 8px; }
.tb-btn:disabled{ opacity:.35; cursor:default; background:none; }
.btn-grid.three{ grid-template-columns:repeat(3,1fr); }
.range-row{ display:flex; align-items:center; gap:10px; padding:4px 8px; font-size:0.82rem; }
.range-row span{ width:44px; color:var(--text-dim); } .range-row input{ flex:1; accent-color:var(--accent); }
.zoom-grp{ display:flex; } .zoom-grp .vp-btn{ border-radius:0; width:36px; padding:0; } .zoom-grp .vp-btn:first-child{ border-radius:9px 0 0 9px; } .zoom-grp .vp-btn:last-child{ border-radius:0 9px 9px 0; border-left:none; }
.pip{ position:absolute; border:2px solid #fff; border-radius:10px; box-shadow:var(--shadow); cursor:pointer; z-index:3; pointer-events:auto; }
.pip span{ position:absolute; left:6px; top:6px; background:rgba(29,33,41,.75); color:#fff; font-size:0.68rem; padding:2px 7px; border-radius:6px; font-weight:700; }
@media (max-width:699px){ .zoom-grp{ display:none; } }
@media (max-width:699px){
  #logoutBtn{ display:none !important; }
  .topbar .caret{ display:none; }
  .topbar{ gap:2px; }
  .tb-btn{ padding:0 7px; }
}
@media (max-width:380px){ #installBtn{ display:none !important; } }
/* boot splash — hides the editor until we know whether to show sign-in, dashboard or a project */
.boot{ position:fixed; inset:0; z-index:90; background:#f5f6f8; display:flex; align-items:center; justify-content:center; transition:opacity .25s; }
.boot-in{ display:flex; flex-direction:column; align-items:center; gap:14px; font-family:'Manrope',sans-serif; font-size:1.25rem; }
.boot-in b{ font-weight:800; } .boot-in b span{ color:var(--accent); }
.boot-logo{ width:56px; height:56px; border-radius:16px; background:var(--accent); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:800; font-size:1.8rem; box-shadow:0 10px 30px rgba(238,125,38,.35); }
.boot-bar{ width:140px; height:3px; border-radius:3px; background:#e6e8ec; overflow:hidden; position:relative; }
.boot-bar::after{ content:''; position:absolute; left:-40%; top:0; bottom:0; width:40%; background:var(--accent); border-radius:3px; animation:bootbar 1s ease-in-out infinite; }
@keyframes bootbar{ to{ left:100%; } }
.boot.gone{ opacity:0; pointer-events:none; }
#catalogList .cat-item .thumb.photo{ background:#fff; }
#catalogList .cat-item .thumb.photo img{ object-fit:contain; padding:6px; }
#phCredit{ margin-top:10px; }

.plan-card .price small{ font-size:.8rem; font-weight:600; opacity:.7; }
.pro-buy{ display:flex; flex-direction:column; }
.pro-buy button{ width:100%; }
