/* Studio admin + client portal — same design language as the website */
:root {
  --ink: #0e0c0a; --ink-2: #16130f; --ink-3: #1f1a15; --ink-4: #2a241d;
  --cream: #efe6d6; --cream-2: #cfc3ae; --muted: #8f8474;
  --gold: #c6a15b; --gold-2: #e2c88f; --line: rgba(198,161,91,.24); --line-2: rgba(239,230,214,.12);
  --ok: #8fb38a; --warn: #e0a95b; --bad: #d98a73; --info: #8fb0c9;
  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --sans: "Jost", "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.2,.7,.1,1);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ink); color: var(--cream); font: 300 16px/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: var(--gold-2); }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 400; line-height: 1.15; margin: 0; }
h1 { font-size: clamp(2rem, 4vw, 2.8rem); }
h2 { font-size: 1.7rem; }
h3 { font-size: 1.35rem; }
p { margin: 0 0 1em; }
[hidden] { display: none !important; }
button { font: inherit; }
.eyebrow { font-size: .66rem; font-weight: 500; letter-spacing: .32em; text-transform: uppercase; color: var(--gold); margin: 0 0 .8rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; font: 500 .7rem var(--sans); letter-spacing: .22em; text-transform: uppercase;
  text-decoration: none; padding: .95em 1.6em; border: 1px solid var(--gold); cursor: pointer; transition: all .3s var(--ease); background: transparent; color: var(--cream); white-space: nowrap; }
.btn-gold { background: var(--gold); color: var(--ink); }
.btn-gold:hover:not(:disabled) { background: var(--gold-2); border-color: var(--gold-2); }
.btn-ghost { border-color: rgba(239,230,214,.3); }
.btn-ghost:hover:not(:disabled) { border-color: var(--gold); color: var(--gold-2); }
.btn-danger { border-color: rgba(217,138,115,.5); color: var(--bad); }
.btn-danger:hover { background: rgba(217,138,115,.12); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-mini { font: 500 .62rem var(--sans); letter-spacing: .18em; text-transform: uppercase; padding: .55em .9em; border: 1px solid var(--line); background: transparent; color: var(--cream-2); cursor: pointer; border-radius: 999px; }
.btn-mini:hover { border-color: var(--gold); color: var(--cream); }
.link-btn { background: none; border: 0; color: var(--gold-2); cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 3px; }

/* Layout */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.grid-main > *, .grid-2 > * { min-width: 0; }
.side { background: var(--ink-2); border-right: 1px solid var(--line-2); padding: 1.6rem 1.2rem; display: flex; flex-direction: column; gap: 2rem; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: var(--cream); }
.brand-mono { width: 40px; height: 40px; flex: none; border-radius: 50%; border: 1px solid var(--gold); display: grid; place-items: center; font-family: var(--serif); font-style: italic; font-size: 1.1rem; color: var(--gold-2); }
.brand b { display: block; font-family: var(--serif); font-weight: 400; font-size: 1.05rem; letter-spacing: .08em; text-transform: uppercase; }
.brand small { display: block; font-size: .58rem; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); }
.side nav { display: grid; gap: .2rem; }
.side nav a { display: flex; align-items: center; gap: .7rem; padding: .7rem .8rem; border-radius: 8px; text-decoration: none; color: var(--cream-2); font-size: .9rem; }
.side nav a:hover { background: rgba(239,230,214,.05); color: var(--cream); }
.side nav a.active { background: rgba(198,161,91,.14); color: var(--gold-2); }
.side nav svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.5; }
.side-foot { margin-top: auto; display: grid; gap: .8rem; font-size: .8rem; color: var(--muted); }
.main { min-width: 0; padding: 2.2rem clamp(1rem, 3vw, 3rem) 5rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 2rem; }
.page-head .crumb { font-size: .78rem; color: var(--muted); text-decoration: none; display: inline-block; margin-bottom: .6rem; }
.page-head .crumb:hover { color: var(--gold-2); }
.topbar { display: none; }

.lang { display: flex; gap: .3rem; align-items: center; color: var(--muted); font-size: .7rem; }
.lang button { background: none; border: 0; color: var(--muted); cursor: pointer; font: 500 .7rem var(--sans); letter-spacing: .18em; padding: .3rem; }
.lang button[aria-pressed="true"] { color: var(--gold-2); }

/* Cards & grids */
.card { background: var(--ink-2); border: 1px solid var(--line-2); border-radius: 14px; padding: 1.5rem; }
.card + .card { margin-top: 1.2rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.card-head h2, .card-head h3 { font-size: 1.35rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.grid-main { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 1.2rem; align-items: start; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.2rem; }
.kpi { background: var(--ink-2); border: 1px solid var(--line-2); border-radius: 14px; padding: 1.2rem 1.4rem; text-decoration: none; color: inherit; }
.kpi:hover { border-color: var(--line); }
.kpi b { display: block; font-family: var(--serif); font-size: 2.4rem; font-weight: 400; color: var(--gold-2); line-height: 1.1; }
.kpi span { font-size: .68rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { border-top: 1px solid var(--line-2); }
.list li:first-child { border-top: 0; }
.list a, .list .row { display: flex; justify-content: space-between; gap: 1rem; padding: .8rem 0; text-decoration: none; color: inherit; align-items: center; }
.list a:hover { color: var(--gold-2); }
.list .sub { font-size: .8rem; color: var(--muted); }
.empty { color: var(--muted); font-style: italic; font-family: var(--serif); font-size: 1.1rem; padding: .6rem 0; }

/* Table */
.table-wrap { overflow-x: auto; border: 1px solid var(--line-2); border-radius: 14px; background: var(--ink-2); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-weight: 500; font-size: .62rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); padding: .9rem 1rem; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
td { padding: .85rem 1rem; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { cursor: pointer; }
tbody tr:hover td { background: rgba(239,230,214,.03); }
td .sub { display: block; font-size: .78rem; color: var(--muted); }

.toolbar { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.2rem; }
.toolbar input[type=search] { flex: 1; min-width: 200px; }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip { font: 500 .62rem var(--sans); letter-spacing: .16em; text-transform: uppercase; padding: .6rem .9rem; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--cream-2); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: var(--ink); }

/* Badges */
.badge { display: inline-block; font: 500 .6rem var(--sans); letter-spacing: .14em; text-transform: uppercase; padding: .35rem .65rem; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; color: var(--cream-2); }
.st-visit_scheduled, .st-discovery { color: var(--info); }
.st-designing { color: var(--gold-2); }
.st-awaiting_approval { color: var(--warn); }
.st-changes_requested { color: var(--bad); }
.st-approved, .st-completed { color: var(--ok); }
.st-in_production, .st-delivery_scheduled, .st-installing { color: #c7a9d6; }
.st-on_hold, .st-cancelled { color: var(--muted); }
.stage-lead { color: var(--warn); } .stage-qualified { color: var(--info); } .stage-client { color: var(--ok); } .stage-inactive, .stage-lost { color: var(--muted); }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem 1.2rem; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
label.f { display: grid; gap: .4rem; font-size: .66rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
input, select, textarea {
  width: 100%; background: var(--ink); color: var(--cream); border: 1px solid var(--line-2); border-radius: 10px;
  padding: .75rem .9rem; font: 300 .95rem var(--sans); letter-spacing: normal; text-transform: none; transition: border-color .2s;
}
textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); }
select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%);
  background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2rem; }
.checks { display: flex; flex-wrap: wrap; gap: .4rem; }
.checks label { display: inline-flex; gap: .4rem; align-items: center; font-size: .8rem; letter-spacing: 0; text-transform: none; color: var(--cream-2); border: 1px solid var(--line-2); border-radius: 999px; padding: .35rem .8rem; cursor: pointer; }
.checks input { width: auto; accent-color: var(--gold); }
.form-actions { display: flex; gap: .8rem; justify-content: flex-end; margin-top: 1.4rem; flex-wrap: wrap; }
.sec-title { font-size: .66rem; letter-spacing: .28em; text-transform: uppercase; color: var(--gold); margin: 1.6rem 0 .9rem; grid-column: 1 / -1; }
.sec-title:first-child { margin-top: 0; }
.err { color: var(--bad); font-size: .85rem; min-height: 1.2em; margin: .6rem 0 0; }

/* Auth screens */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem;
  background: radial-gradient(ellipse at 50% 30%, rgba(14,12,10,.55), var(--ink) 75%), url("/assets/img/phillip-at-the-bench.jpg") center/cover; }
.auth-card { width: min(440px, 100%); background: rgba(22,19,15,.92); border: 1px solid var(--line); border-radius: 18px; padding: 2.4rem 2rem; backdrop-filter: blur(10px); }
.auth-card .brand { justify-content: center; margin-bottom: 1.8rem; }
.auth-card h1 { text-align: center; font-size: 2.2rem; margin-bottom: .5rem; }
.auth-card .lead { text-align: center; color: var(--cream-2); font-size: .95rem; margin-bottom: 1.8rem; }
.auth-card form { display: grid; gap: 1rem; }
.auth-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 1.6rem; font-size: .8rem; }
.auth-foot a { color: var(--muted); text-decoration: none; }

/* Project: inputs */
.dropzone { display: block; border: 1px dashed var(--line); border-radius: 12px; padding: 1.4rem; text-align: center; color: var(--cream-2); cursor: pointer; transition: all .2s; font-size: .9rem; }
.dropzone.drag, .dropzone:hover { border-color: var(--gold); background: rgba(198,161,91,.06); }
.dropzone svg { width: 28px; height: 28px; stroke: var(--gold); fill: none; stroke-width: 1.4; margin: 0 auto .5rem; display: block; }
.capture { display: grid; gap: 1.1rem; }
.capture-block { border-top: 1px solid var(--line-2); padding-top: 1.1rem; }
.capture-block:first-child { border-top: 0; padding-top: 0; }
.capture-block h4 { font-family: var(--sans); font-size: .7rem; font-weight: 500; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); margin-bottom: .3rem; }
.capture-block p { font-size: .85rem; color: var(--muted); margin-bottom: .8rem; }
.rec { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.mic { width: 64px; height: 64px; border-radius: 50%; border: 1px solid var(--gold); background: rgba(198,161,91,.1); display: grid; place-items: center; cursor: pointer; position: relative; flex: none; color: var(--gold-2); }
.mic svg { width: 26px; height: 26px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.mic.on { background: #b3473b; border-color: #b3473b; color: #fff; }
.mic.on::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid rgba(179,71,59,.6); transform: scale(calc(1 + var(--lvl, 0) * .5)); transition: transform .08s; }
.rec-time { font-family: var(--serif); font-size: 1.6rem; min-width: 4ch; }
.meter { flex: 1; min-width: 80px; height: 4px; background: var(--line-2); border-radius: 2px; overflow: hidden; }
.meter i { display: block; height: 100%; width: calc(var(--lvl, 0) * 100%); background: var(--gold); transition: width .08s; }
.inputs { display: grid; gap: .8rem; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .5rem; }
.photo-grid figure { margin: 0; position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--ink-3); }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.photo-grid .x { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(14,12,10,.8); color: var(--cream); cursor: pointer; font-size: .9rem; line-height: 1; opacity: 0; transition: opacity .2s; }
.photo-grid figure:hover .x, .photo-grid .x:focus { opacity: 1; }
@media (hover: none) { .photo-grid .x { opacity: 1; } }
.input-item { border: 1px solid var(--line-2); border-radius: 12px; padding: .9rem 1rem; background: var(--ink); }
.input-item header { display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin-bottom: .5rem; font-size: .75rem; color: var(--muted); }
.input-item header b { font-weight: 500; letter-spacing: .16em; text-transform: uppercase; font-size: .62rem; color: var(--gold); }
.input-item .txt { white-space: pre-wrap; font-size: .9rem; color: var(--cream-2); max-height: 220px; overflow: auto; }
.input-item audio { width: 100%; height: 36px; margin-bottom: .5rem; }
.input-item .acts { display: flex; gap: .4rem; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: spin 1s linear infinite; vertical-align: -2px; margin-right: .4rem; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Generate */
.gen-box { border: 1px solid var(--line); border-radius: 14px; padding: 1.4rem; background: linear-gradient(160deg, rgba(198,161,91,.1), transparent 70%); }
.gen-box p { color: var(--cream-2); font-size: .9rem; }
.demo-note { font-size: .8rem; color: var(--warn); border: 1px solid rgba(224,169,91,.35); border-radius: 10px; padding: .6rem .8rem; margin-bottom: 1rem; }
.progress { margin-top: 1rem; }
.progress-bar { height: 6px; background: var(--line-2); border-radius: 3px; overflow: hidden; }
.progress-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-2)); transition: width .6s var(--ease); }
.progress p { margin: .6rem 0 0; font-family: var(--serif); font-style: italic; font-size: 1.1rem; color: var(--gold-2); }
.feedback-item { border-left: 2px solid var(--bad); padding: .4rem 0 .4rem 1rem; margin: .8rem 0; }
.feedback-item.approve { border-color: var(--ok); }
.feedback-item p { margin: .2rem 0 0; white-space: pre-wrap; color: var(--cream-2); }
.feedback-item small { color: var(--muted); }

/* Version tabs (V1, V2 …) */
.vtabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.vtab { font: 500 .66rem var(--sans); letter-spacing: .14em; text-transform: uppercase; padding: .6rem 1rem; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--cream-2); cursor: pointer; display: inline-flex; gap: .4rem; align-items: center; }
.vtab[aria-selected="true"] { border-color: var(--gold); color: var(--gold-2); background: rgba(198,161,91,.1); }
.vtab .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.vtab .dot.sent { background: var(--ok); } .vtab .dot.gen { background: var(--gold-2); animation: pulse 1.2s infinite; } .vtab .dot.fail { background: var(--bad); }
@keyframes pulse { 50% { opacity: .3; } }
.version-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.version-head h3 { font-size: 1.6rem; }

/* Version view */
.vv-summary { font-family: var(--serif); font-size: 1.45rem; line-height: 1.35; color: var(--cream); margin-bottom: .8rem; }
.vv-notes { color: var(--cream-2); }
.vv-changes { border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1.1rem; margin: 1rem 0; background: rgba(198,161,91,.06); }
.vv-changes b { font-weight: 500; font-size: .64rem; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); }
.vv-changes p { margin: .3rem 0 0; color: var(--cream-2); }
.vv-tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--line-2); margin: 1.4rem 0 1.2rem; overflow-x: auto; scrollbar-width: none; }
.vv-tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: .8rem 1rem; color: var(--muted); font: 500 .66rem var(--sans); letter-spacing: .2em; text-transform: uppercase; cursor: pointer; white-space: nowrap; }
.vv-tabs button[aria-selected="true"] { color: var(--gold-2); border-color: var(--gold); }
.vv-sketch { margin: 0; background: #f1e9d8; padding: 10px; border-radius: 6px; box-shadow: 0 20px 50px rgba(0,0,0,.45); transform: rotate(-.4deg); }
.vv-sketch img { width: 100%; cursor: zoom-in; }
.vv-sketch figcaption { color: #6b5a45; font-family: var(--serif); font-style: italic; text-align: center; padding-top: .5rem; }
.vv-3d { position: relative; aspect-ratio: 16/10; border-radius: 12px; overflow: hidden; background: #1a1612; border: 1px solid var(--line-2); }
.vv-3d-canvas, .vv-3d-canvas canvas { width: 100% !important; height: 100% !important; display: block; touch-action: none; }
.vv-3d-bar { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: .8rem; align-items: center; }
.vv-3d-variants, .vv-3d-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.sw-btn { display: inline-flex; gap: .45rem; align-items: center; padding: .35rem .75rem .35rem .4rem; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--cream-2); cursor: pointer; font-size: .78rem; }
.sw-btn i { width: 20px; height: 20px; border-radius: 50%; border: 1px solid rgba(255,255,255,.2); }
.sw-btn[aria-pressed="true"] { border-color: var(--gold); color: var(--cream); }
.vv-hint { font-size: .8rem; color: var(--muted); text-align: center; margin: .8rem 0 0; }
.vv-panel .compare + .compare { margin-top: 1rem; }
.mat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.mat-card { border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; background: var(--ink); transition: border-color .3s, transform .3s; }
.mat-card[role=button] { cursor: pointer; }
.mat-card[role=button]:hover { transform: translateY(-3px); border-color: var(--line); }
.mat-card.selected { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.mat-card.approved { border-color: var(--ok); }
.mat-img { position: relative; aspect-ratio: 3/2; background: var(--ink-3); }
.mat-img img { width: 100%; height: 100%; object-fit: cover; }
.mat-fallback { width: 100%; height: 100%; }
.mat-flag { position: absolute; top: .6rem; left: .6rem; font-size: .56rem; letter-spacing: .2em; text-transform: uppercase; background: rgba(14,12,10,.82); color: var(--gold-2); padding: .3rem .6rem; border-radius: 999px; }
.mat-flag.ok { left: auto; right: .6rem; color: var(--ok); }
.mat-body { padding: 1rem 1.1rem 1.2rem; }
.mat-body h4 { font-size: 1.2rem; margin: .5rem 0 .3rem; }
.mat-body p { font-size: .85rem; color: var(--cream-2); margin: 0; }
.mat-sw { display: flex; gap: .3rem; }
.mat-sw i { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(255,255,255,.18); }
.mat-pick { display: inline-block; margin-top: .8rem; font-size: .6rem; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); }
.vv-specs { margin: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 2rem; }
.vv-specs div { padding: .8rem 0; border-top: 1px solid var(--line-2); }
.vv-specs dt { font-size: .6rem; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); margin-bottom: .2rem; }
.vv-specs dd { margin: 0; font-family: var(--serif); font-size: 1.1rem; }
.vv-internal { margin-top: 1.4rem; border: 1px dashed var(--line); border-radius: 12px; padding: 1rem 1.2rem; font-size: .88rem; color: var(--cream-2); }
.vv-internal b { font-weight: 500; font-size: .62rem; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); }
.vv-internal h5 { font-size: .75rem; font-weight: 500; margin: .8rem 0 .2rem; color: var(--cream); }
.vv-internal ul { margin: 0; padding-left: 1.1rem; }
.lightbox-img { max-height: 80vh; margin: 0 auto; }

/* Compare slider */
.compare { position: relative; overflow: hidden; border-radius: 12px; border: 1px solid var(--line-2); touch-action: pan-y; background: var(--ink-3); }
.compare-img { display: block; width: 100%; height: auto; aspect-ratio: 3/2; object-fit: cover; user-select: none; -webkit-user-drag: none; }
.compare-after-layer { position: absolute; inset: 0; clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.compare-after-layer .compare-img { height: 100%; }
.compare-label { position: absolute; top: .8rem; padding: .35rem .7rem; font-size: .56rem; letter-spacing: .22em; text-transform: uppercase; background: rgba(14,12,10,.78); color: var(--cream); border-radius: 999px; pointer-events: none; }
.compare-after { left: .8rem; color: var(--gold-2); }
.compare-before { right: .8rem; }
.compare-handle { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; background: var(--gold-2); transform: translateX(-1px); pointer-events: none; }
.compare-handle i { position: absolute; top: 50%; left: 50%; width: 44px; height: 44px; transform: translate(-50%, -50%); border-radius: 50%; background: var(--gold); box-shadow: 0 6px 20px rgba(0,0,0,.45); }
.compare-handle i::before, .compare-handle i::after { content: ""; position: absolute; top: 50%; border: 6px solid transparent; transform: translateY(-50%); }
.compare-handle i::before { left: 6px; border-right-color: var(--ink); }
.compare-handle i::after { right: 6px; border-left-color: var(--ink); }
.compare-range { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }

/* Activity */
.timeline-list { list-style: none; margin: 0; padding: 0; }
.timeline-list li { position: relative; padding: 0 0 1rem 1.4rem; font-size: .88rem; color: var(--cream-2); }
.timeline-list li::before { content: ""; position: absolute; left: 3px; top: .5rem; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.timeline-list li::after { content: ""; position: absolute; left: 6px; top: 1.1rem; bottom: 0; width: 1px; background: var(--line-2); }
.timeline-list li:last-child::after { display: none; }
.timeline-list time { display: block; font-size: .72rem; color: var(--muted); }

/* Portal */
.portal-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem clamp(1rem, 4vw, 3rem); background: rgba(14,12,10,.9); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line-2); }
.portal-top .right { display: flex; align-items: center; gap: 1.2rem; }
.portal-main { width: min(1120px, 100% - 32px); margin: 0 auto; padding: 2.5rem 0 6rem; }
.p-hero { margin-bottom: 2.4rem; }
.p-hero h1 { margin-bottom: .4rem; }
.p-hero p { color: var(--cream-2); }
.p-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.2rem; }
.p-card { display: block; text-decoration: none; color: inherit; border: 1px solid var(--line-2); border-radius: 16px; overflow: hidden; background: var(--ink-2); transition: transform .4s var(--ease), border-color .4s; }
.p-card:hover { transform: translateY(-4px); border-color: var(--gold); }
.p-card-img { aspect-ratio: 3/2; background: linear-gradient(135deg, var(--ink-3), var(--ink-4)); display: grid; place-items: center; overflow: hidden; }
.p-card-img img { width: 100%; height: 100%; object-fit: cover; }
.p-card-img .ph { font-family: var(--serif); font-style: italic; color: var(--muted); }
.p-card-body { padding: 1.2rem 1.4rem 1.4rem; }
.p-card-body h3 { margin: .6rem 0 .3rem; }
.tracker { display: grid; grid-template-columns: repeat(6, 1fr); gap: .4rem; margin: 1rem 0 0; padding: 0; list-style: none; counter-reset: s; }
.tracker li { position: relative; padding-top: 1.4rem; font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); text-align: center; }
.tracker li::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; border-radius: 2px; background: var(--line-2); }
.tracker li.done::before { background: var(--gold); }
.tracker li.now::before { background: linear-gradient(90deg, var(--gold), var(--gold-2)); box-shadow: 0 0 12px rgba(226,200,143,.5); }
.tracker li.done, .tracker li.now { color: var(--cream); }
.decision { border: 1px solid var(--gold); border-radius: 16px; padding: 1.6rem; background: linear-gradient(160deg, rgba(198,161,91,.12), transparent 70%); margin-top: 1.6rem; }
.decision h3 { font-size: 1.6rem; margin-bottom: .4rem; }
.decision .row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; margin-top: 1rem; }
.notice { border-radius: 12px; padding: 1rem 1.2rem; border: 1px solid var(--line); background: rgba(198,161,91,.06); margin: 1rem 0; }
.notice.ok { border-color: rgba(143,179,138,.5); background: rgba(143,179,138,.08); }

/* Modal & toasts */
.app-modal { width: min(560px, calc(100% - 32px)); max-height: calc(100dvh - 32px); border: 1px solid var(--line); border-radius: 18px; padding: 0; background: var(--ink-2); color: var(--cream); }
.app-modal.wide { width: min(1100px, calc(100% - 32px)); }
.app-modal::backdrop { background: rgba(8,7,6,.78); backdrop-filter: blur(4px); }
.app-modal-inner { padding: 1.6rem; }
.app-modal h2 { margin-bottom: 1rem; }
.app-modal-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.4rem; flex-wrap: wrap; }
.secret { font-family: ui-monospace, Menlo, monospace; font-size: 1.1rem; background: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1rem; letter-spacing: .06em; color: var(--gold-2); word-break: break-all; }
.toasts { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); display: grid; gap: .5rem; z-index: 100; }
.toast { background: var(--ink-4); border: 1px solid var(--line); color: var(--cream); padding: .8rem 1.2rem; border-radius: 999px; font-size: .88rem; box-shadow: 0 10px 30px rgba(0,0,0,.4); transition: opacity .5s, transform .5s; }
.toast.error { border-color: var(--bad); }
.toast.out { opacity: 0; transform: translateY(8px); }
.loading { color: var(--muted); padding: 3rem 0; text-align: center; }

@media (max-width: 1100px) {
  .grid-main { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; flex-direction: row; align-items: center; padding: .8rem 1rem; gap: 1rem; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line-2); }
  .side .brand small, .side .brand b { display: none; }
  .side nav { display: flex; gap: .2rem; }
  .side nav a { padding: .55rem .7rem; white-space: nowrap; font-size: .8rem; }
  .side nav a span { display: none; }
  .side nav a.active span { display: inline; }
  .side-foot { margin: 0 0 0 auto; display: flex; align-items: center; gap: .8rem; }
  .side-foot .who { display: none; }
  .grid-2, .form-grid, .form-grid.three, .vv-specs { grid-template-columns: 1fr; }
  .main { padding-top: 1.4rem; }
  .tracker { grid-template-columns: repeat(3, 1fr); row-gap: 1rem; }
  td, th { padding: .7rem .7rem; }
  .hide-sm { display: none; }
}
@media (max-width: 640px) {
  .portal-top { padding: .8rem 16px; }
  .portal-top .brand > span:last-child { display: none; }
  .portal-top .right { gap: .9rem; font-size: .85rem; }
}

/* ================= Motion ================= */
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.97); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-8px); } }
@keyframes glow { 50% { box-shadow: 0 0 0 6px rgba(198,161,91,.12); } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes stripes { to { background-position: 40px 0; } }

/* page & content entrance */
#view > *, .portal-main > *, .auth-card { animation: fadeUp .55s var(--ease) both; }
#view > *:nth-child(2), .portal-main > *:nth-child(2) { animation-delay: .06s; }
#view > *:nth-child(3), .portal-main > *:nth-child(3) { animation-delay: .12s; }
#view > *:nth-child(4), .portal-main > *:nth-child(4) { animation-delay: .18s; }
.kpis > *, .grid-2 > *, .p-list > *, .mat-grid > *, .grid-main > * > .card { animation: fadeUp .6s var(--ease) both; }
.kpis > *:nth-child(2), .grid-2 > *:nth-child(2), .p-list > *:nth-child(2), .mat-grid > *:nth-child(2), .grid-main > * > .card:nth-child(2) { animation-delay: .07s; }
.kpis > *:nth-child(3), .grid-2 > *:nth-child(3), .p-list > *:nth-child(3), .mat-grid > *:nth-child(3), .grid-main > * > .card:nth-child(3) { animation-delay: .14s; }
.kpis > *:nth-child(4), .grid-2 > *:nth-child(4), .p-list > *:nth-child(4), .mat-grid > *:nth-child(4) { animation-delay: .21s; }
tbody tr { animation: fadeIn .45s var(--ease) both; }
tbody tr:nth-child(2) { animation-delay: .03s; } tbody tr:nth-child(3) { animation-delay: .06s; } tbody tr:nth-child(4) { animation-delay: .09s; } tbody tr:nth-child(n+5) { animation-delay: .12s; }
.input-item, .photo-grid figure, .feedback-item, .timeline-list li, .notice { animation: fadeUp .45s var(--ease) both; }
.vv-panel:not([hidden]) { animation: fadeIn .4s var(--ease); }
[data-vbody] > * { animation: fadeIn .45s var(--ease); }
.app-modal[open] { animation: modalIn .35s var(--ease); }
.app-modal[open]::backdrop { animation: fadeIn .3s ease; }
.toast { animation: fadeUp .35s var(--ease); }
.tracker li.now::before { animation: glow 2s ease-in-out infinite; }
.card, .kpi, .btn, .chip, .vtab, .mat-card, .input-item { transition: border-color .3s var(--ease), background-color .3s var(--ease), color .3s var(--ease), transform .3s var(--ease), box-shadow .3s var(--ease); }
.badge { transition: color .4s, border-color .4s; }

/* busy buttons */
.is-busy { position: relative; pointer-events: none; }
.btn.is-busy, .btn-mini.is-busy, .link-btn.is-busy, .chip.is-busy { color: transparent !important; }
.btn.is-busy::after, .btn-mini.is-busy::after, .link-btn.is-busy::after, .chip.is-busy::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%;
  border: 2px solid rgba(239,230,214,.25); border-top-color: var(--gold-2); animation: spin .8s linear infinite;
}
.btn-gold.is-busy::after { border-color: rgba(14,12,10,.25); border-top-color: var(--ink); }
.btn:disabled.is-busy { opacity: 1; }
select.is-busy { opacity: .6; }

/* skeleton */
.skel { background: linear-gradient(90deg, var(--ink-2) 0%, var(--ink-4) 50%, var(--ink-2) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: 10px; }
.skel-title { height: 42px; width: 50%; margin-bottom: 1rem; }
.skel-line { height: 14px; margin-bottom: 2rem; }
.skel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.2rem; }
.skel-card { height: 180px; border-radius: 14px; }

/* ================= Live generation panel ================= */
.gen-live { border: 1px solid var(--line); border-radius: 14px; padding: 1.3rem 1.4rem; background: linear-gradient(160deg, rgba(198,161,91,.08), rgba(14,12,10,.2) 60%); }
.gen-live-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.gen-live-head b { font-family: var(--serif); font-weight: 400; font-size: 1.35rem; }
.gen-live-head .live { display: inline-flex; align-items: center; gap: .45rem; font-size: .6rem; letter-spacing: .24em; text-transform: uppercase; color: var(--gold-2); margin-right: .7rem; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #d35a4a; box-shadow: 0 0 0 0 rgba(211,90,74,.6); animation: livePulse 1.6s infinite; }
@keyframes livePulse { 70% { box-shadow: 0 0 0 8px rgba(211,90,74,0); } 100% { box-shadow: 0 0 0 0 rgba(211,90,74,0); } }
.gen-elapsed { font-family: ui-monospace, Menlo, monospace; font-size: .8rem; color: var(--muted); }
.gen-bar { position: relative; height: 10px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.gen-bar i {
  position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 999px; transition: width 1.2s var(--ease);
  background: linear-gradient(90deg, var(--gold), var(--gold-2));
  box-shadow: 0 0 18px rgba(226,200,143,.45);
}
.gen-bar i::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: repeating-linear-gradient(-45deg, rgba(255,255,255,.18) 0 10px, transparent 10px 20px); background-size: 40px 100%; animation: stripes 1s linear infinite;
}
.gen-pct { display: flex; justify-content: space-between; font-size: .72rem; color: var(--muted); margin: .45rem 0 1.1rem; }
.gen-pct b { color: var(--gold-2); font-weight: 500; font-variant-numeric: tabular-nums; }
.gen-stages { list-style: none; margin: 0 0 1.1rem; padding: 0; display: grid; gap: .5rem; }
.gen-stage { display: grid; grid-template-columns: 30px 1fr auto; gap: .8rem; align-items: center; padding: .65rem .8rem; border-radius: 10px; border: 1px solid transparent; transition: all .5s var(--ease); }
.gen-stage .ic { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-2); color: var(--muted); font-size: .8rem; transition: all .5s var(--ease); }
.gen-stage h5 { margin: 0; font-family: var(--sans); font-weight: 500; font-size: .85rem; color: var(--cream-2); }
.gen-stage p { margin: 0; font-size: .75rem; color: var(--muted); }
.gen-stage .cnt { font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.gen-stage.active { border-color: var(--line); background: rgba(198,161,91,.07); }
.gen-stage.active .ic { border-color: var(--gold); }
.gen-stage.active .ic::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--gold-2); animation: spin .8s linear infinite; }
.gen-stage.active h5 { color: var(--cream); }
.gen-stage.done .ic { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.gen-stage.done .ic::before { content: "✓"; font-weight: 600; }
.gen-stage.failed .ic { border-color: var(--bad); color: var(--bad); }
.gen-stage.failed .ic::before { content: "!"; }
.gen-stage.pending { opacity: .55; }
.gen-log { background: #0b0a08; border: 1px solid var(--line-2); border-radius: 10px; padding: .8rem .9rem; max-height: 190px; overflow-y: auto; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .76rem; line-height: 1.65; scroll-behavior: smooth; }
.gen-log p { margin: 0; color: var(--cream-2); animation: slideIn .4s var(--ease) both; }
.gen-log time { color: var(--muted); margin-right: .7rem; }
.gen-log p.new .txt::after { content: "▍"; color: var(--gold-2); margin-left: 2px; animation: blink 1s step-end infinite; }
.gen-log p.ok { color: var(--gold-2); }
.gen-log p.bad { color: var(--bad); }
.version-error { border: 1px solid rgba(217,138,115,.4); border-radius: 12px; padding: 1rem 1.2rem; color: var(--bad); background: rgba(217,138,115,.06); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .is-busy::after, .spinner, .gen-stage.active .ic::before { animation-duration: .8s !important; animation-iteration-count: infinite !important; }
}
.net-bar { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 200; pointer-events: none; opacity: 0; transition: opacity .3s; overflow: hidden; }
.net-bar::before { content: ""; position: absolute; top: 0; bottom: 0; width: 35%; background: linear-gradient(90deg, transparent, var(--gold-2), transparent); animation: netbar 1.1s ease-in-out infinite; }
.net-bar.on { opacity: 1; }
@keyframes netbar { from { left: -35%; } to { left: 100%; } }
.grid-2 > .card + .card, .grid-main > .card + .card { margin-top: 0; }
