/* Immersion Creator dashboard. One set of tokens; light and dark. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --border: #e2e5ea;
  --text: #16181d;
  --text-2: #5b6170;
  --accent: #3b5bdb;
  --accent-text: #ffffff;
  --ok: #1e7a46;
  --ok-bg: #e5f5ec;
  --warn: #9a5b00;
  --warn-bg: #fff4dc;
  --bad: #b42318;
  --bad-bg: #fde8e7;
  --info-bg: #eaf0ff;
  --busy: #3b5bdb;
  --busy-bg: #eaf0ff;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a20;
    --surface-2: #1e222a;
    --border: #2a2f39;
    --text: #e8eaf0;
    --text-2: #9aa1b1;
    --accent: #7b93ff;
    --accent-text: #0f1115;
    --ok: #5dd39e;
    --ok-bg: #12301f;
    --warn: #f3b24c;
    --warn-bg: #33270f;
    --bad: #ff8a80;
    --bad-bg: #3a1614;
    --info-bg: #1a2240;
    --busy: #9db0ff;
    --busy-bg: #1a2240;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 16px; margin: 0; }
h3 { font-size: 16px; margin: 0; }
pre { margin: 0; }

/* ── Top bar ── */
.topbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; color: var(--text); }
.brand:hover { text-decoration: none; }
.env { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.env-dev { background: var(--warn-bg); color: var(--warn); }
.env-prod { background: var(--bad-bg); color: var(--bad); }
.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav-link { padding: 6px 10px; border-radius: 8px; color: var(--text-2); font-weight: 500; }
.nav-link:hover { background: var(--surface-2); text-decoration: none; }
.nav-link.is-on { color: var(--text); background: var(--surface-2); }
.nav-old { font-size: 13px; }

main { max-width: 1200px; margin: 0 auto; padding: 24px; min-width: 0; }
.page, .section, .overview-main, .overview-side { min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.page-actions, .head-pills { display: flex; gap: 8px; }
.crumb { margin: 0 0 6px; font-size: 14px; }
.hint { color: var(--text-2); font-size: 13px; margin: 2px 0 0; }
.summary { margin: 0 0 12px; }
.right { text-align: right; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.text-ok { color: var(--ok); }
.text-bad { color: var(--bad); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  font: inherit; font-weight: 600; font-size: 14px; line-height: 1;
  padding: 9px 14px; border-radius: 8px; border: 1px solid transparent; cursor: pointer;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn-small { padding: 6px 10px; font-size: 13px; }

/* ── Pills ── */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-bad { background: var(--bad-bg); color: var(--bad); }
.pill-busy { background: var(--busy-bg); color: var(--busy); }
.pill-muted { background: var(--surface-2); color: var(--text-2); }

/* ── Notices ── */
.notice { padding: 10px 14px; border-radius: var(--radius); margin: 0 0 16px; font-size: 14px; }
.notice-info { background: var(--info-bg); }
.notice-ok { background: var(--ok-bg); color: var(--ok); }
.notice-warn { background: var(--warn-bg); color: var(--warn); }
.notice-bad { background: var(--bad-bg); color: var(--bad); }
.notice details { margin-top: 6px; }

/* ── Loading ── */
.loading { display: flex; align-items: center; gap: 10px; color: var(--text-2); padding: 24px 0; }
.spinner {
  width: 18px; height: 18px; border-radius: 50%; display: inline-block; flex: none;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.8s linear infinite;
}
.spinner-sm { width: 11px; height: 11px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Sections ── */
.section {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.section-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.disclosure { background: none; border: 0; font: inherit; font-weight: 600; cursor: pointer; padding: 0; color: var(--text); }

/* ── Cards (home) ── */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-bottom: 24px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.card-media { aspect-ratio: 4 / 3; background: var(--surface-2); display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.card-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 30%; display: block; }
.card-noimg { color: var(--text-2); font-size: 13px; }
.card-body { padding: 14px 16px 6px; flex: 1; }
.card-body h3 a { color: var(--text); }
.lines { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.card-foot { display: flex; gap: 8px; padding: 10px 16px 14px; flex-wrap: wrap; }
.card-foot .btn-ghost { margin-left: auto; }

/* ── Tabs ── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tab { padding: 10px 14px; color: var(--text-2); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.is-on { color: var(--text); border-bottom-color: var(--accent); }

/* ── Overview ── */
.overview { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.hero { width: 100%; border-radius: var(--radius); display: block; margin-bottom: 16px; border: 1px solid var(--border); }
.hero-empty { aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; color: var(--text-2); background: var(--surface-2); }
.steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.step { padding: 8px 12px; border-radius: 8px; border-left: 3px solid; }
.step-bad { background: var(--bad-bg); border-color: var(--bad); }
.step-warn { background: var(--warn-bg); border-color: var(--warn); }
.step-info { background: var(--info-bg); border-color: var(--accent); }
.status-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.status-lines li { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.prompt {
  white-space: pre-wrap; font: 13px/1.55 var(--mono); background: var(--surface-2);
  padding: 12px 14px; border-radius: 8px; margin-bottom: 12px; max-height: 360px; overflow: auto;
}
.facts { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.fact { display: grid; grid-template-columns: 140px 1fr; gap: 12px; }
.fact dt { color: var(--text-2); font-size: 14px; }
.fact dd { margin: 0; font-size: 14px; min-width: 0; }

/* ── Test ── */
.drop {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 22px; cursor: pointer;
  text-align: center; margin-bottom: 14px; font-weight: 600;
}
.drop:hover { border-color: var(--accent); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.prompt-choice { margin-bottom: 14px; }
.check { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; cursor: pointer; }
.field { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; font-weight: 600; font-size: 14px; }
textarea {
  font: 13px/1.5 var(--mono); padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); width: 100%; resize: vertical;
}
textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.results { display: flex; flex-direction: column; gap: 12px; }
.result {
  display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 16px;
  padding: 12px; border: 1px solid var(--border); border-radius: var(--radius);
}
.result-input { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; min-width: 0; }
.result-name { font-size: 13px; color: var(--text-2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-out { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Thumbnails + lightbox ── */
.thumb {
  display: block; width: 160px; aspect-ratio: 4 / 3; padding: 0; border: 1px solid var(--border);
  border-radius: 8px; overflow: hidden; background: var(--surface-2); cursor: zoom-in;
}
.thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.thumb-missing { display: flex; align-items: center; justify-content: center; cursor: default; color: var(--bad); font-size: 13px; font-weight: 600; }
.lightbox {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.82); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.lightbox figure { margin: 0; max-width: 100%; max-height: 100%; display: flex; flex-direction: column; gap: 10px; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 110px); object-fit: contain; border-radius: 6px; background: #222; }
.lightbox figcaption { display: flex; justify-content: space-between; gap: 12px; color: #fff; font-size: 14px; flex-wrap: wrap; align-items: center; }
.lightbox-actions { display: flex; gap: 12px; align-items: center; }
.lightbox-actions a { color: #c9d4ff; }

/* ── Images tab ── */
.inputs { display: flex; gap: 16px; flex-wrap: wrap; }
.input-fig { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.input-fig .thumb { width: 220px; }
.input-fig figcaption { font-size: 13px; color: var(--text-2); }
.variant-grid {
  display: grid; grid-template-columns: 130px repeat(4, minmax(110px, 1fr)) 110px;
  gap: 8px; align-items: center; overflow-x: auto;
}
.vg-head { font-size: 13px; font-weight: 600; color: var(--text-2); }
.vg-label { font-size: 14px; font-weight: 600; }
.vg-cell .thumb { width: 100%; }
.vg-mark { font-size: 13px; font-weight: 600; }

/* ── Tables ── */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-2); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.table td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table-compact td, .table-compact th { padding: 4px 8px; font-size: 13px; }

/* ── History ── */
.events { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.event { display: grid; grid-template-columns: 110px 1fr; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.event:last-child { border-bottom: 0; }
.event-when { color: var(--text-2); font-size: 13px; padding-top: 3px; }
.event details { margin-top: 6px; font-size: 13px; }

/* ── Forms ── */
.page-narrow { max-width: 820px; }
.input {
  font: inherit; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); width: 100%; max-width: 420px;
}
.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.picks { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.pick { display: flex; flex-direction: column; gap: 6px; cursor: pointer; }
.pick-label { font-weight: 600; font-size: 14px; }
.pick-box {
  position: relative; overflow: hidden; aspect-ratio: 4 / 3; border: 2px dashed var(--border); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; color: var(--text-2); background: var(--surface-2);
}
.pick-box:hover { border-color: var(--accent); }
.pick-box img { width: 100%; height: 100%; object-fit: contain; }
.pick-box input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.more { margin-top: 12px; }
.more summary { cursor: pointer; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.sticky-actions {
  position: sticky; bottom: 0; display: flex; gap: 10px; align-items: center; justify-content: flex-end; flex-wrap: wrap;
  padding: 12px 0; background: linear-gradient(transparent, var(--bg) 30%);
}

/* ── Framing (crops) ── */
.crops { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.crop-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 14px; }
.crop { position: relative; border-radius: 8px; overflow: hidden; background: var(--surface-2); cursor: crosshair; touch-action: none; user-select: none; }
.crop img { display: block; width: 100%; pointer-events: none; }
.crop-empty { aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; color: var(--text-2); font-size: 13px; }
.crop-box { position: absolute; border: 2px solid #ffd43b; box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45); pointer-events: none; }

/* ── Builds ── */
.presets { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.preset { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.build-grid { display: grid; gap: 4px; align-items: center; overflow-x: auto; margin-top: 8px; }
.step-cell { font-size: 12px; font-weight: 600; padding: 4px 6px; border-radius: 6px; white-space: nowrap; }
.step-ok { background: var(--ok-bg); color: var(--ok); }
.step-busy { background: var(--busy-bg); color: var(--busy); }
.step-muted { background: var(--surface-2); color: var(--text-2); }
.step-warn { background: var(--warn-bg); color: var(--warn); }
.step-bad { background: var(--bad-bg); color: var(--bad); }
.fail-list { margin: 10px 0 0; padding-left: 18px; font-size: 13px; color: var(--bad); }

/* ── Image cells ── */
.cell { position: relative; display: flex; flex-direction: column; gap: 4px; }
.cell-wide .thumb { width: 220px; }
.cell-actions { display: flex; gap: 10px; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-size: 13px; color: var(--accent); cursor: pointer; }
.link-btn:disabled { color: var(--text-2); cursor: default; }
.lock-badge {
  position: absolute; top: 6px; left: 6px; font-size: 11px; font-weight: 700; padding: 2px 6px;
  border-radius: 6px; background: var(--warn-bg); color: var(--warn);
}

/* ── History extras ── */
.event-actions { margin-top: 8px; }
td.pre { white-space: pre-wrap; max-width: 380px; font-size: 12px; }

.run-pick { display: inline-flex; align-items: center; gap: 6px; }
.run-pick select {
  font: inherit; font-size: 13px; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); max-width: 100%;
}

.helper { margin-top: 10px; }
.helper-steps { margin: 6px 0 10px; padding-left: 20px; font-size: 14px; }
.helper-text { max-height: 260px; }

/* ── Narrow screens ── */
@media (max-width: 860px) {
  .overview { grid-template-columns: minmax(0, 1fr); }
  .overview-side { order: -1; }
  .hero { max-height: 260px; object-fit: cover; object-position: center 30%; }
}
@media (max-width: 600px) {
  main { padding: 16px; }
  .topbar { padding: 10px 16px; }
  .nav { margin-left: 0; width: 100%; }
  .result { grid-template-columns: minmax(0, 1fr); }
  .thumb { width: 130px; }
  .fact { grid-template-columns: 1fr; gap: 0; }
  .event { grid-template-columns: 1fr; gap: 2px; }
  .variant-grid { grid-template-columns: 100px repeat(4, 100px) 90px; }
}
.file-list { margin: 6px 0; padding-left: 18px; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.head-pills { align-items: center; flex-wrap: wrap; }
.field select {
  font: inherit; font-weight: 400; font-size: 14px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); max-width: 320px;
}
.field .row .check { font-weight: 400; }
.route-line { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
code.route { font: 13px/1.5 var(--mono); background: var(--surface-2); padding: 6px 10px; border-radius: 8px; overflow-wrap: anywhere; }
.customer-api > .hint, .customer-api > .more, .customer-api > .row { margin-bottom: 10px; }
.route-test { margin-top: 12px; }
.route-test > summary { font-weight: 600; cursor: pointer; }
.lines .pill { white-space: normal; border-radius: 12px; max-width: 100%; }
.mirror-line { margin: 4px 0 12px; }
.versions { margin-top: 6px; font-size: 13px; }
.versions summary { cursor: pointer; color: var(--text-2); }
.versions ul { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-direction: column; gap: 6px; }
.versions li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.versions .thumb { width: 72px; }

/* ── Group try-on templates (groups.js) ── */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 20px; max-width: 100%; }
.seg-btn { font: inherit; font-size: 14px; font-weight: 600; color: var(--text-2); background: none; border: 0; border-radius: 7px; padding: 6px 12px; cursor: pointer; }
.seg-btn:hover { color: var(--text); }
.seg-btn.is-on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg-count { font-weight: 400; color: var(--text-2); margin-left: 2px; }
.group-title { font-size: 15px; margin: 8px 0 12px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; }
.page-wide { max-width: none; }
main:has(.page-wide) { max-width: 1640px; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.two-col h3 { margin: 0 0 8px; font-size: 14px; }
.hero-button { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.two-col .fact { grid-template-columns: 64px 1fr; }

/* ── Group test and new group template (group-test.js, group-new.js) ── */
.btn-danger { background: var(--surface); color: var(--bad); border-color: var(--bad); }
.btn-danger:hover:not(:disabled) { background: var(--bad-bg); }
.danger-box { border: 1px solid var(--bad); border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.danger-box p { margin: 0 0 8px; }
.danger-box input { flex: 1; min-width: 0; }
.text-bad { color: var(--bad); }
.gt { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 20px; align-items: start; }
.gt-side { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.gt-side input[type=text], .gt-side input[type=number], .gt-side select, .gt-side textarea, .danger-box input {
  font: inherit; font-size: 14px; padding: 7px 9px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); width: 100%;
}
.gt-side input:focus, .gt-side select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.gt-side input[type=file] { font-size: 13px; max-width: 100%; }
.gt-side h4 { margin: 8px 0 0; font-size: 14px; }
.gt-side .hint { margin: 0; }
.field-label { font-weight: 600; font-size: 13px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 10px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.part { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--text-2); }
.part textarea { min-height: 0; resize: vertical; }
.fold { margin-top: 6px; }
.fold > summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; }
.fold > summary em { font-style: normal; text-transform: none; letter-spacing: 0; color: var(--accent); font-weight: 600; }
.fold[open] > summary { margin-bottom: 8px; }
.fold > .part, .fold > h4 { margin-bottom: 6px; }
.gt-photo { width: 100%; max-height: 220px; object-fit: contain; border-radius: 8px; background: var(--surface-2); }
.gt-strength { display: flex; align-items: center; gap: 10px; }
.gt-strength input { flex: 1; accent-color: var(--accent); }
.gt-strength output { width: 44px; text-align: right; font-variant-numeric: tabular-nums; }
.gt-actions { display: flex; gap: 8px; margin-top: 12px; }
.gt-actions .btn-primary { flex: 1; }
.gt-status { margin: 0; display: flex; align-items: center; gap: 6px; font-size: 14px; font-variant-numeric: tabular-nums; }
.gt-main { min-width: 0; }
.stage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.stage-card {
  font: inherit; color: inherit; text-align: left; padding: 0; cursor: pointer; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.stage-card:hover { border-color: var(--text-2); }
.stage-card.is-on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.stage-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
.stage-head > span { color: var(--text-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.stage-img {
  flex: 1; min-height: 180px; display: grid; place-items: center; color: var(--text-2); font-size: 13px;
  background-image: conic-gradient(var(--surface-2) 25%, var(--surface) 0 50%, var(--surface-2) 0 75%, var(--surface) 0);
  background-size: 16px 16px;
}
.stage-img img { max-width: 100%; max-height: 360px; display: block; }
.stage-wait { display: inline-flex; align-items: center; gap: 6px; }
.stage-note { padding: 8px 12px; font-size: 12px; color: var(--text-2); border-top: 1px solid var(--border); display: block; }
.chips { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; }
.chip { min-width: 22px; padding: 0 5px; border-radius: 4px; color: #fff; font-size: 11px; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; }
.chip-male { background: #195aeb; }
.chip-female { background: #e61e3c; }
.chip-unsure { outline: 2px dashed var(--warn); outline-offset: 1px; }
.gt-summary { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; font-size: 14px; }
.gt-summary code { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; }
.gt-viewer { margin-top: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.gt-viewer-img { min-height: 320px; }
.gt-viewer-img img { max-height: 78vh; cursor: zoom-in; }
.box-editor { position: relative; display: block; line-height: 0; user-select: none; }
.box-editor img { width: 100%; height: auto; display: block; border-radius: 6px; }
.box-editor .box {
  position: absolute; border: 2px dashed var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent);
  cursor: move; touch-action: none; box-sizing: border-box;
}
.box-editor .box:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.box-editor .handle { position: absolute; width: 12px; height: 12px; background: var(--accent); border: 2px solid #fff; border-radius: 2px; }
.handle-nw { left: -7px; top: -7px; cursor: nwse-resize; }
.handle-n { left: calc(50% - 6px); top: -7px; cursor: ns-resize; }
.handle-ne { right: -7px; top: -7px; cursor: nesw-resize; }
.handle-e { right: -7px; top: calc(50% - 6px); cursor: ew-resize; }
.handle-se { right: -7px; bottom: -7px; cursor: nwse-resize; }
.handle-s { left: calc(50% - 6px); bottom: -7px; cursor: ns-resize; }
.handle-sw { left: -7px; bottom: -7px; cursor: nesw-resize; }
.handle-w { left: -7px; top: calc(50% - 6px); cursor: ew-resize; }
.empty-drop { min-height: 280px; display: grid; place-items: center; color: var(--text-2); border: 1px dashed var(--border); border-radius: 8px; }
@media (max-width: 900px) {
  .gt { grid-template-columns: minmax(0, 1fr); }
}

/* ── Group settings (group-settings.js) ── */
.gs input[type=text], .gs input[type=number], .gs select {
  font: inherit; font-size: 14px; padding: 7px 9px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); width: 100%;
}
.gs input[aria-invalid=true] { border-color: var(--bad); }
.gs .part { margin-bottom: 10px; }
.gs-placement { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.gs-fields { display: flex; flex-direction: column; gap: 6px; }
.gs-fields .field-label:first-child { margin-top: 0; }
.gs-fields .hint { margin: 0; }
.gs-savebar {
  position: sticky; bottom: 0; z-index: 2; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 18px; margin: 0 0 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 -2px 8px rgba(16, 24, 40, 0.06);
}
.gs-next { display: flex; flex-direction: column; gap: 10px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
label.btn { position: relative; margin-top: 6px; }
label.btn.is-disabled { opacity: 0.55; cursor: not-allowed; }
@media (max-width: 860px) {
  .gs-placement { grid-template-columns: minmax(0, 1fr); }
}

/* ── Group quality check and release (group-quality.js, group-release.js) ── */
.qc-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.qc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.qc-photo { margin: 0; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.qc-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.qc-pair .thumb { width: 100%; }
.qc-photo figcaption { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.release-bg { margin-top: 12px; }
.release-bg .thumb { width: 260px; }

/* Delete card: what blocks a delete */
.blockers { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; font-size: 14px; }
.blockers li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.gs-extra-line { margin-top: 12px; display: flex; gap: 12px; align-items: baseline; }
.gs-extra-line > .hint:first-child { min-width: 110px; }
