/* ── Azuvyn Studio — Midnight Marble, the internal dark theme ─────────────
   Token values mirror crm/staff-v2/src/styles.css (contrast-gated there). The
   studio shell is Azuvyn's; every client website gets its own design system. */
:root {
  --accent-gold: #f3a81b;
  --accent-teal: #4fd1c0;
  --focus-ring: #53e0cd;
  --surface-action: #0d6a63;
  --surface-card: #10161f;
  --surface-navy: #0d131c;
  --surface-page: #0a0e14;
  --surface-inset: #0c1119;
  --surface-raised: #161e2a;
  --danger-action: #a62639;
  --danger-text: #ff8d9d;
  --success-text: #4fc47f;
  --warn-text: #e6b04b;
  --text-primary: #e9eef4;
  --text-muted: #9ab0bf;
  --line-hairline: rgba(154, 176, 191, 0.16);
  --line-strong: rgba(154, 176, 191, 0.38);
  --wash-teal: rgba(79, 209, 192, 0.09);
  --glow-teal: rgba(79, 209, 192, 0.22);
  --font-display: "Sora", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --rail: 15rem;
  --side: 22rem;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--surface-page); color: var(--text-primary); font-family: var(--font-body); font-size: 15px; line-height: 1.5; }
a { color: var(--accent-teal); }
h1, h2, h3 { font-family: var(--font-display); margin: 0 0 .5rem; letter-spacing: -0.01em; }
h1 { font-size: 1.4rem; } h2 { font-size: 1.1rem; } h3 { font-size: .95rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--text-muted); } .small { font-size: .82rem; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 1rem; top: 1rem; background: var(--surface-action); color: #fff; padding: .5rem 1rem; z-index: 100; }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
[hidden] { display: none !important; }

/* Top bar */
.top { display: flex; align-items: center; gap: 1.5rem; padding: 0 1.25rem; height: 3.5rem; background: var(--surface-navy); border-bottom: 1px solid var(--line-hairline); position: sticky; top: 0; z-index: 20; }
.brand { font-family: var(--font-display); font-weight: 700; color: var(--text-primary); text-decoration: none; display: inline-flex; align-items: center; gap: .55rem; font-size: 1.05rem; }
.brand__mark { width: 1.1rem; height: 1.1rem; border-radius: 3px; background: linear-gradient(135deg, var(--accent-teal), var(--surface-action)); box-shadow: 0 0 0 3px var(--wash-teal); }
.brand__thin { font-weight: 400; color: var(--text-muted); }
.top__nav a { color: var(--text-muted); text-decoration: none; font-weight: 500; padding: .35rem .6rem; border-radius: 6px; }
.top__nav a[aria-current="page"], .top__nav a:hover { color: var(--text-primary); background: var(--surface-raised); }
.top__right { margin-left: auto; display: flex; align-items: center; gap: .75rem; }
.lane { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; padding: .2rem .5rem; border-radius: 4px; background: var(--wash-teal); color: var(--accent-teal); border: 1px solid var(--glow-teal); }
.lane--qa { background: rgba(230,176,75,.12); color: var(--warn-text); border-color: rgba(230,176,75,.4); }
.who { color: var(--text-muted); font-size: .9rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .55rem 1rem; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface-raised); color: var(--text-primary); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--accent-teal); }
.btn--primary { background: var(--surface-action); border-color: var(--surface-action); color: #fff; }
.btn--primary:hover { box-shadow: 0 0 0 3px var(--glow-teal); }
.btn--ghost { background: transparent; }
.btn--danger { border-color: var(--danger-action); color: var(--danger-text); }
.btn--sm { padding: .35rem .7rem; font-size: .85rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn.is-busy::after { content: ""; width: .9em; height: .9em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Layout */
.main { min-height: calc(100vh - 3.5rem); }
.gate { display: grid; place-items: center; min-height: 70vh; padding: 2rem; }
.gate__card { max-width: 32rem; background: var(--surface-card); border: 1px solid var(--line-hairline); border-radius: 14px; padding: 2rem; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; padding: 1.5rem 1.5rem .75rem; }
.notice { margin: 0 1.5rem 1rem; padding: .7rem 1rem; border-radius: 8px; border: 1px solid var(--line-hairline); background: var(--surface-card); font-size: .9rem; }
.notice--warn { border-color: rgba(230,176,75,.4); color: var(--warn-text); }
.notice--danger { border-color: var(--danger-action); color: var(--danger-text); }
.notice--ok { border-color: rgba(79,196,127,.4); color: var(--success-text); }
.tablewrap { overflow-x: auto; padding: 0 1.5rem 1.5rem; }
table.queue { width: 100%; border-collapse: collapse; background: var(--surface-card); border: 1px solid var(--line-hairline); border-radius: 12px; overflow: hidden; }
table.queue th, table.queue td { text-align: left; padding: .8rem .9rem; border-bottom: 1px solid var(--line-hairline); vertical-align: top; }
table.queue th { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); font-weight: 600; background: var(--surface-navy); }
table.queue tbody tr { cursor: pointer; }
table.queue tbody tr:hover { background: var(--surface-raised); }
table.queue td a { color: var(--text-primary); text-decoration: none; font-weight: 600; font-family: var(--font-display); }
.pill { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; border: 1px solid var(--line-strong); color: var(--text-muted); white-space: nowrap; }
.pill--stage { background: var(--wash-teal); color: var(--accent-teal); border-color: var(--glow-teal); }
.pill--warn { color: var(--warn-text); border-color: rgba(230,176,75,.5); }
.pill--danger { color: var(--danger-text); border-color: var(--danger-action); }
.pill--ok { color: var(--success-text); border-color: rgba(79,196,127,.5); }
.pill--run { color: var(--accent-teal); border-color: var(--glow-teal); }

/* Project layout: rail / stage / side */
#project { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr) var(--side); min-height: calc(100vh - 3.5rem); }
.rail { background: var(--surface-navy); border-right: 1px solid var(--line-hairline); padding: 1rem; display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 3.5rem; height: calc(100vh - 3.5rem); overflow: auto; }
.rail__back { color: var(--text-muted); text-decoration: none; font-size: .85rem; }
.rail__title { font-size: 1.15rem; margin: 0; }
.rail__meta { color: var(--text-muted); font-size: .8rem; margin: 0; }
.stepper { list-style: none; margin: 0; padding: 0; display: grid; gap: .25rem; }
.stepper li { font-size: .82rem; color: var(--text-muted); padding: .3rem .5rem .3rem 1.4rem; position: relative; }
.stepper li::before { content: ""; position: absolute; left: .35rem; top: .7rem; width: .55rem; height: .55rem; border-radius: 50%; border: 1px solid var(--line-strong); }
.stepper li.is-done { color: var(--text-primary); } .stepper li.is-done::before { background: var(--success-text); border-color: var(--success-text); }
.stepper li.is-current { color: var(--accent-teal); font-weight: 600; } .stepper li.is-current::before { background: var(--accent-teal); border-color: var(--accent-teal); box-shadow: 0 0 0 3px var(--glow-teal); }
.views { display: grid; gap: .15rem; }
.views a { display: block; padding: .5rem .6rem; border-radius: 6px; color: var(--text-muted); text-decoration: none; font-weight: 500; cursor: pointer; }
.views a[aria-current="page"] { background: var(--surface-raised); color: var(--text-primary); }
.views a:hover { color: var(--text-primary); }
.rail__assign { display: grid; gap: .35rem; font-size: .9rem; border-top: 1px solid var(--line-hairline); padding-top: .75rem; }
.jobs { display: grid; gap: .4rem; font-size: .8rem; }
.job { padding: .5rem .6rem; border-radius: 8px; background: var(--surface-card); border: 1px solid var(--line-hairline); }
.job--running { border-color: var(--glow-teal); }
.job--failed { border-color: var(--danger-action); }
.job__err { color: var(--danger-text); word-break: break-word; }

.stage { padding: 1.25rem 1.5rem; min-width: 0; }
.side { border-left: 1px solid var(--line-hairline); background: var(--surface-navy); padding: 1rem; position: sticky; top: 3.5rem; height: calc(100vh - 3.5rem); overflow: auto; display: grid; align-content: start; gap: 1rem; }
@media (max-width: 80rem) { #project { grid-template-columns: var(--rail) minmax(0, 1fr); } .side { grid-column: 1 / -1; position: static; height: auto; border-left: 0; border-top: 1px solid var(--line-hairline); } }
@media (max-width: 56rem) { #project { grid-template-columns: 1fr; } .rail { position: static; height: auto; } }

/* Stage content */
.stagehead { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.stagehead h2 { margin: 0; }
.stagehead .spacer { flex: 1; }
.select { font: inherit; background: var(--surface-raised); color: var(--text-primary); border: 1px solid var(--line-strong); border-radius: 8px; padding: .45rem .6rem; }
.card { background: var(--surface-card); border: 1px solid var(--line-hairline); border-radius: 12px; padding: 1rem; }
.card + .card { margin-top: 1rem; }
.grid2 { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 64rem) { .grid2 { grid-template-columns: 1fr 1fr; } }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; font-size: .92rem; }
.kv dt { color: var(--text-muted); } .kv dd { margin: 0; white-space: pre-wrap; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { font-size: .8rem; padding: .25rem .6rem; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface-inset); }
.chip--missing { border-color: var(--danger-action); color: var(--danger-text); }
.chip--decide { border-color: rgba(230,176,75,.5); color: var(--warn-text); }
.uploads { display: grid; grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); gap: .6rem; }
.upload { display: block; border: 1px solid var(--line-hairline); border-radius: 8px; overflow: hidden; background: var(--surface-inset); color: var(--text-muted); text-decoration: none; font-size: .75rem; }
.upload img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: #000; }
.upload span { display: block; padding: .35rem .5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload__file { aspect-ratio: 1; display: grid; place-items: center; font-size: 1.6rem; }

/* Concept viewer */
.viewer { display: grid; gap: 1rem; }
.viewer--compare { grid-template-columns: 1fr 1fr; }
.shot { background: var(--surface-inset); border: 1px solid var(--line-hairline); border-radius: 12px; overflow: hidden; position: relative; }
.shot__bar { display: flex; align-items: center; gap: .6rem; padding: .5rem .75rem; font-size: .82rem; color: var(--text-muted); border-bottom: 1px solid var(--line-hairline); }
.shot__bar strong { color: var(--text-primary); }
.shot__img { position: relative; cursor: crosshair; user-select: none; }
.shot__img img { width: 100%; display: block; }
.shot__img--mobile img { max-height: 70vh; width: auto; margin: 0 auto; }
.region { position: absolute; border: 2px solid var(--accent-gold); background: rgba(243,168,27,.12); pointer-events: none; }
.region__n { position: absolute; top: -.75rem; left: -.75rem; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--accent-gold); color: #000; font-size: .75rem; font-weight: 700; display: grid; place-items: center; }
.region--draft { border-style: dashed; }
.spec { font-size: .92rem; }
.spec h3 { margin-top: 1rem; color: var(--accent-teal); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }
.spec ul { margin: 0; padding-left: 1.1rem; }
.swatchrow { display: flex; flex-wrap: wrap; gap: .5rem; }
.swatch { display: inline-flex; align-items: center; gap: .45rem; font-size: .8rem; padding: .25rem .5rem .25rem .3rem; border: 1px solid var(--line-hairline); border-radius: 999px; }
.swatch i { width: 1.1rem; height: 1.1rem; border-radius: 50%; border: 1px solid var(--line-strong); }

/* Frames (design system / website) */
.framebar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.framebar .seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.framebar .seg button { background: transparent; color: var(--text-muted); border: 0; padding: .4rem .7rem; font: inherit; cursor: pointer; }
.framebar .seg button[aria-pressed="true"] { background: var(--surface-raised); color: var(--text-primary); }
.framebar input[type="range"] { width: 12rem; accent-color: var(--accent-teal); }
.framewrap { background: #3a4250; background-image: linear-gradient(45deg, rgba(255,255,255,.03) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.03) 75%), linear-gradient(45deg, rgba(255,255,255,.03) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.03) 75%); background-size: 20px 20px; background-position: 0 0, 10px 10px; border-radius: 12px; padding: 1rem; overflow: auto; display: flex; gap: 1rem; justify-content: center; }
.frame { background: #fff; border-radius: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.4); overflow: hidden; flex: none; resize: horizontal; max-width: 100%; }
.frame iframe { display: block; width: 100%; height: 70vh; border: 0; background: #fff; }
.frame__label { font-size: .72rem; color: #cbd5e1; text-align: center; padding: .25rem; background: #1f2733; }
.check { width: 100%; border-collapse: collapse; font-size: .88rem; }
.check th, .check td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--line-hairline); vertical-align: top; }
.check th { color: var(--text-muted); font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; }
.status--implemented { color: var(--success-text); } .status--partial { color: var(--warn-text); } .status--missing { color: var(--danger-text); } .status--needs_dependency { color: var(--warn-text); }
.pass { color: var(--success-text); } .fail { color: var(--danger-text); font-weight: 600; }

/* Side panel */
.side h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: .4rem; }
.actions { display: grid; gap: .5rem; }
.textarea { width: 100%; min-height: 5.5rem; font: inherit; background: var(--surface-inset); color: var(--text-primary); border: 1px solid var(--line-strong); border-radius: 8px; padding: .55rem .7rem; resize: vertical; }
.notes { display: grid; gap: .5rem; }
.note { background: var(--surface-card); border: 1px solid var(--line-hairline); border-radius: 8px; padding: .55rem .7rem; font-size: .88rem; }
.note__meta { display: flex; gap: .5rem; font-size: .72rem; color: var(--text-muted); margin-bottom: .2rem; }
.note--assumption { border-left: 3px solid var(--warn-text); }
.note--direction { border-left: 3px solid var(--accent-teal); }
.note--revision_request, .note--feedback { border-left: 3px solid var(--accent-gold); }
.note--decision { border-left: 3px solid var(--success-text); }
.approval { font-size: .85rem; padding: .5rem .7rem; border-radius: 8px; border: 1px solid rgba(79,196,127,.4); background: rgba(79,196,127,.06); }
.approval--invalid { border-color: var(--danger-action); background: rgba(166,38,57,.08); }
.hint { font-size: .82rem; color: var(--warn-text); }

/* History */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.timeline li { display: grid; grid-template-columns: 11rem 1fr; gap: 1rem; font-size: .88rem; padding: .4rem 0; border-bottom: 1px solid var(--line-hairline); }
.timeline time { color: var(--text-muted); font-size: .8rem; }
.timeline code { font-size: .78rem; color: var(--accent-teal); }

/* Lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 50; display: grid; place-items: center; overflow: auto; padding: 2rem; }
.lightbox img { max-width: none; width: auto; height: auto; cursor: zoom-out; }
.lightbox__close { position: fixed; top: 1rem; right: 1rem; font-size: 1.6rem; background: var(--surface-raised); color: #fff; border: 1px solid var(--line-strong); border-radius: 50%; width: 2.5rem; height: 2.5rem; cursor: pointer; }
