:root {
  --bg: #0c0e14; --panel: #12151d; --card: #181c26; --line: #252b3a; --line2: #313a4f;
  --text: #e6e9f0; --muted: #8b93a7; --accent: #f97316; --accent2: #fb923c; --good: #34d399; --warn: #fbbf24; --bad: #f87171;
  --r: 10px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 13px/1.45 Inter, system-ui, sans-serif; display: flex; flex-direction: column; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }
.muted { color: var(--muted); } .small { font-size: 11.5px; } .hidden { display: none !important; }

/* header */
.top { height: 52px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; background: var(--panel); border-bottom: 1px solid var(--line); flex-shrink: 0; gap: 12px; }
.brand { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; white-space: nowrap; }
.brand em { font-style: normal; color: var(--accent2); font-weight: 500; }
.logo { color: var(--accent); }
.top-actions { display: flex; gap: 6px; align-items: center; overflow-x: auto; }

button, .btn { cursor: pointer; border-radius: 8px; padding: 6px 11px; border: 1px solid var(--line2); background: var(--card); white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
button:hover, .btn:hover { border-color: #46506a; }
.primary { background: var(--accent); border-color: var(--accent); color: #1a0d03; font-weight: 600; }
.primary:hover { background: var(--accent2); border-color: var(--accent2); }
.ghost { background: transparent; }
.wide { width: 100%; margin-top: 8px; }
.link { background: none; border: none; padding: 0 2px; color: var(--accent2); font-weight: 500; }
.link:hover { text-decoration: underline; }
.right { float: right; }
select, input[type=text], input[type=number], input[type=search], input:not([type]), textarea {
  background: #0f1219; border: 1px solid var(--line2); border-radius: 8px; padding: 6px 8px; width: 100%; outline: none;
}
select { width: auto; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; line-height: 1.5; }
label { display: block; color: var(--muted); font-size: 11.5px; }
label > input, label > select, label > textarea, label > .suggest { margin-top: 3px; width: 100%; }
label small { display: block; color: var(--muted); font-size: 10.5px; margin-top: 2px; }

/* layout */
.workspace { flex: 1; display: flex; min-height: 0; }
.panel { background: var(--panel); overflow-y: auto; padding: 10px; flex-shrink: 0; }
.panel.left { width: 300px; border-right: 1px solid var(--line); }
.panel.right { width: 360px; border-left: 1px solid var(--line); }
.center { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 11px 12px; margin-bottom: 10px; }
.card h3 { margin: 0 0 9px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); font-weight: 600; }
.card h3 .unit { text-transform: none; letter-spacing: 0; font-weight: 400; opacity: 0.7; }
.count { text-transform: none; letter-spacing: 0; font-weight: 500; margin-left: 6px; }
.count.over { color: var(--bad); }

/* archetypes */
.arch-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin-bottom: 8px; }
.arch-grid button { flex-direction: column; padding: 7px 2px; font-size: 10.5px; gap: 2px; color: var(--muted); }
.arch-grid button .ic { font-size: 18px; filter: grayscale(0.3); }
.arch-grid button.on { border-color: var(--accent); background: rgba(249,115,22,0.1); color: var(--text); }

/* sliders */
.controls { display: flex; flex-direction: column; gap: 9px; }
.ctl-head { display: flex; justify-content: space-between; font-size: 12px; color: #c4cad8; margin-bottom: 3px; }
.ctl-head b { font-family: 'JetBrains Mono', monospace; font-weight: 500; color: var(--accent2); font-size: 11.5px; }
.ctl-help { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 16px; background: transparent; cursor: pointer; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; background: var(--line2); border-radius: 4px; }
input[type=range]::-moz-range-track { height: 4px; background: var(--line2); border-radius: 4px; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; }
input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; }
.check { display: flex; align-items: center; gap: 8px; color: #c4cad8; font-size: 12px; margin: 6px 0; cursor: pointer; }
.check input { width: auto; margin: 0; accent-color: var(--accent); }
.check.tight { margin-top: 18px; }
.quick { display: flex; gap: 4px; align-items: center; margin-top: 9px; font-size: 11px; color: var(--muted); }
.quick button { padding: 2px 8px; font-size: 11px; }
.ctl-select select { width: 100%; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; align-items: start; }

/* viewport */
.vbar { height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 10px; background: var(--panel); border-bottom: 1px solid var(--line); flex-shrink: 0; overflow-x: auto; }
.vbar-group { display: flex; gap: 5px; align-items: center; }
.spacer { flex: 1; }
.seg { display: inline-flex; background: #0f1219; border: 1px solid var(--line2); border-radius: 9px; padding: 2px; }
.seg button { border: none; background: none; padding: 4px 12px; border-radius: 7px; color: var(--muted); }
.seg button.on { background: var(--accent); color: #1a0d03; font-weight: 600; }
.seg.small { display: flex; margin-bottom: 8px; } .seg.small button { flex: 1; padding: 4px 4px; font-size: 11.5px; }
.chip { padding: 3px 10px; font-size: 12px; border-radius: 999px; color: var(--muted); }
.chip.on { color: var(--text); border-color: var(--accent); background: rgba(249,115,22,0.12); }
.color-btn { gap: 8px; max-width: 280px; }
.color-btn #colorName { overflow: hidden; text-overflow: ellipsis; }
.sw { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.35); flex-shrink: 0; display: inline-block; }
.caret { color: var(--muted); }
.viewport { flex: 1; position: relative; min-height: 0; background: radial-gradient(ellipse at 50% 38%, #262c3d 0%, #0d0f16 75%); }
.viewport canvas { display: block; width: 100%; height: 100%; }
.viewport.photo-mode { background: #1a1c22; }
.viewport { overflow: hidden; }
.viewport.photo-mode canvas { box-shadow: 0 0 0 1px rgba(255,255,255,0.18), 0 12px 40px rgba(0,0,0,0.5); }
body.mode-design .photo-only { display: none; }
body.mode-photo .design-only { display: none; }
body.mode-photo .design-only-notice { display: none; }
.notice { background: rgba(249,115,22,0.1); border: 1px solid rgba(249,115,22,0.35); border-radius: var(--r); padding: 8px 10px; margin-bottom: 10px; font-size: 12px; }

.status { height: 30px; display: flex; align-items: center; gap: 16px; padding: 0 12px; background: var(--panel); border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); flex-shrink: 0; white-space: nowrap; overflow: hidden; }
.status b { color: var(--text); font-weight: 500; }
.badge { padding: 1px 8px; border-radius: 999px; font-weight: 600; }
.badge.good { color: var(--good); background: rgba(52,211,153,0.12); }
.badge.bad { color: var(--bad); background: rgba(248,113,113,0.12); }
.warn { color: var(--warn); overflow: hidden; text-overflow: ellipsis; }
.ok { color: var(--good); } .caution { color: var(--warn); }

/* color popover */
.pop { position: absolute; top: 8px; right: 10px; width: 360px; max-height: calc(100% - 16px); background: var(--panel); border: 1px solid var(--line2); border-radius: 12px; z-index: 20; display: flex; flex-direction: column; box-shadow: 0 18px 50px rgba(0,0,0,0.5); }
.pop-head { display: flex; gap: 6px; padding: 10px; border-bottom: 1px solid var(--line); }
.pop-list { overflow-y: auto; padding: 4px; }
.pop-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.pop-item:hover { background: var(--card); }
.pop-item.on { background: rgba(249,115,22,0.14); }
.pop-item .sw { width: 22px; height: 22px; }
.pop-item .nm { font-size: 12.5px; }
.pop-item .meta { font-size: 11px; color: var(--muted); }
.pop-item .qty { margin-left: auto; font-size: 10.5px; color: var(--muted); text-align: right; white-space: nowrap; }
.pop-foot { padding: 8px 10px; border-top: 1px solid var(--line); font-size: 11px; }

/* right tabs */
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: #0f1219; border: 1px solid var(--line); border-radius: 10px; padding: 3px; margin-bottom: 10px; position: sticky; top: -10px; z-index: 2; box-shadow: 0 -10px 0 var(--panel), 0 4px 10px var(--panel); }
.tabs button { border: none; background: none; color: var(--muted); padding: 6px; }
.tabs button.on { background: var(--card); color: var(--text); font-weight: 600; }
.surf-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-bottom: 8px; }
.surf-grid button { height: 44px; font-size: 11px; font-weight: 600; text-shadow: 0 1px 2px rgba(0,0,0,0.6); color: #fff; background-size: cover; }
.surf-grid button.on { outline: 2px solid var(--accent); outline-offset: 1px; }
.ph-row { display: flex; gap: 6px; margin-bottom: 8px; }
.breakdown { width: 100%; border-collapse: collapse; font-size: 12px; }
.breakdown td { padding: 3px 0; color: #c4cad8; }
.breakdown td:last-child { text-align: right; font-family: 'JetBrains Mono', monospace; }
.breakdown tr.total td { border-top: 1px solid var(--line2); padding-top: 6px; font-weight: 600; color: var(--text); }
.breakdown tr.neg td:last-child { color: var(--bad); }
.suggest { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 15px; color: var(--text); }
.profit { margin-top: 10px; padding: 10px; border-radius: 8px; background: #0f1219; display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.profit .big { font-size: 20px; font-family: 'JetBrains Mono', monospace; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.chips span { background: #0f1219; border: 1px solid var(--line2); border-radius: 999px; padding: 2px 8px; font-size: 11px; }
.chips span i { font-style: normal; color: var(--muted); margin-left: 4px; font-size: 10px; }
.chips span.over { border-color: var(--bad); color: var(--bad); }

/* drawer */
.drawer { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 50; display: flex; justify-content: flex-end; }
.drawer-body { width: 440px; max-width: 100%; height: 100%; background: var(--panel); border-left: 1px solid var(--line2); padding: 14px; overflow-y: auto; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.drawer-head h2 { margin: 0; font-size: 16px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
code { background: #0f1219; padding: 1px 5px; border-radius: 4px; font-size: 11px; }

.toast { position: fixed; bottom: 42px; left: 50%; transform: translateX(-50%) translateY(10px); background: #222838; border: 1px solid var(--line2); padding: 8px 14px; border-radius: 10px; opacity: 0; transition: all 0.25s; pointer-events: none; z-index: 60; max-width: 80vw; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.err { border-color: var(--bad); }

@media (max-width: 1200px) { .panel.left { width: 260px; } .panel.right { width: 320px; } }
@media (max-width: 900px) {
  body { overflow: auto; } .workspace { flex-direction: column; } .panel.left, .panel.right { width: 100%; border: none; }
  .center { min-height: 70vh; }
}

/* v2.1 */
.product-select { width: 100%; padding: 8px; font-weight: 600; margin-bottom: 4px; }
#productBlurb { margin: 2px 0 10px; }
.scene-seg { margin-bottom: 10px; }
body:not(.scene-template) .scene-template, body:not(.scene-3d) .scene-3d, body:not(.scene-wall) .scene-wall { display: none; }
body.scene-wall .not-tile { display: none !important; }
.tpl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tpl-grid button { padding: 0; height: 58px; overflow: hidden; position: relative; background-size: cover; background-position: center; border-width: 2px; }
.tpl-grid button span { position: absolute; left: 0; right: 0; bottom: 0; font-size: 10.5px; background: rgba(0,0,0,0.55); color: #fff; padding: 1px 0; }
.tpl-grid button.on { border-color: var(--accent); }
.paint-row { display: flex; gap: 6px; margin: 4px 0 2px; flex-wrap: wrap; }
.paint-row button { width: 30px; height: 30px; border-radius: 50%; padding: 0; border: 2px solid var(--line2); }
.paint-row button.on { border-color: var(--accent); }
.paint-row input[type=color] { width: 30px; height: 30px; padding: 0; border: none; background: none; cursor: pointer; }

body.scene-template .aspect-ctl { display: none; }
body:not(.scene-template) .tpl-aspect-note { display: none; }

/* public demo banner */
.ams-banner { display: none; flex-shrink: 0; padding: 7px 14px; font-size: 12px; background: #1a120a; border-bottom: 1px solid #3a2410; color: #f3d9c2; gap: 10px; align-items: center; justify-content: space-between; }
body.ams-public .ams-banner { display: flex; }
.ams-banner a { color: var(--accent2); text-decoration: none; font-weight: 600; white-space: nowrap; }
.ams-banner a:hover { text-decoration: underline; }
.ams-banner .x { background: none; border: none; color: var(--muted); padding: 0 4px; }
.ams-signout { color: var(--muted); font-size: 12px; text-decoration: none; margin-left: 4px; }
.ams-signout:hover { color: var(--text); }

/* ---- vincentfrisina.com look ---- */
:root { --bg: #0a0c0f; --panel: #0d1014; --card: #12161c; --line: #1c222a; --line2: #232a33; --text: #e8ecf1; --muted: #8a95a5; --accent: #F0393E; --accent2: #ff6b6f; --r: 0px; }
body { font-family: "IBM Plex Sans", system-ui, sans-serif; }
.brand, .drawer-head h2 { font-family: "Space Grotesk", sans-serif; }
.card h3, .status, .ctl-help, label small, .count { font-family: "JetBrains Mono", monospace; }
.card h3 { color: var(--accent); font-weight: 500; letter-spacing: 0.08em; }
button, .btn, select, input[type=text], input[type=number], input[type=search], input:not([type]), textarea, .seg, .seg button, .chip, .tabs, .tabs button,
.pop, .pop-item, .notice, .toast, .profit, .chips span, code, .badge, .tpl-grid button, .surf-grid button, .card { border-radius: 0 !important; }
select, input[type=text], input[type=number], input[type=search], input:not([type]), textarea, .seg, .tabs, .profit, .chips span, code { background: #0a0c0f; }
button:hover, .btn:hover { border-color: var(--accent); }
.primary, .seg button.on { color: #0a0c0f; }
.primary:hover { background: #ff5257; border-color: #ff5257; box-shadow: 0 0 0 1px rgba(240,57,62,0.4), 0 8px 24px rgba(240,57,62,0.22); }
.arch-grid button.on, .chip.on { background: rgba(240,57,62,0.1); }
.pop-item.on { background: rgba(240,57,62,0.14); }
.notice { background: rgba(240,57,62,0.08); border-color: rgba(240,57,62,0.35); }
.ctl-head, .check, .breakdown td { color: #a9b3c1; }
.viewport { background: radial-gradient(ellipse at 50% 38%, #1a1f27 0%, #0a0c0f 75%); }
.viewport.photo-mode { background: #0d1014; }
.toast { background: #12161c; }
.brand em { color: var(--accent); }
.vf-mark { display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--accent); color: var(--accent); font-family: "JetBrains Mono", monospace; font-size: 11px; font-weight: 500; padding: 2px 5px; margin-right: 8px; text-decoration: none; letter-spacing: 0; vertical-align: 1px; transition: background 0.2s, color 0.2s; }
.vf-mark:hover { background: var(--accent); color: #0a0c0f; }
input[type=range]::-webkit-slider-thumb { border-color: #0a0c0f; }
input[type=range]::-moz-range-thumb { border-color: #0a0c0f; }
input[type=range]::-webkit-slider-runnable-track, input[type=range]::-moz-range-track { border-radius: 0; }
.ams-banner { background: #12161c; border-bottom: 1px solid var(--line2); color: #a9b3c1; }
.ams-banner strong { color: var(--text); }
a.shop-link { border-color: var(--accent); color: var(--accent); text-decoration: none; }
a.shop-link:hover { background: rgba(240,57,62,0.1); }
body.ams-private a.shop-link { display: none; }
