/* SappySleepEditor Studio — 2026-10-15 release. One dark editing-tool theme. */
:root {
  color-scheme: dark;
  --bg: #0b0c0f;
  --panel: #131419;
  --panel-2: #191b21;
  --raised: #1f2229;
  --line: #262931;
  --line-strong: #333743;
  --text: #ecedf1;
  --text-2: #a4a8b4;
  --text-3: #6f7380;
  --accent: #7c6cff;
  --accent-2: #9a8dff;
  --accent-soft: rgba(124, 108, 255, .14);
  --good: #3ecf8e;
  --good-soft: rgba(62, 207, 142, .12);
  --warn: #f5b84a;
  --warn-soft: rgba(245, 184, 74, .12);
  --bad: #ff6b6b;
  --bad-soft: rgba(255, 107, 107, .12);
  --info: #5aa9ff;
  --info-soft: rgba(90, 169, 255, .12);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 12px 32px rgba(0,0,0,.35);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01";
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; font-weight: 600; }
h1 { font-size: 24px; line-height: 1.2; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0; }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.subtle { color: var(--text-2); }
.small { font-size: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-2); margin-bottom: 4px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- buttons ---------- */
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 34px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--raised); color: var(--text);
  font: 500 13px/1 var(--font); cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .12s, border-color .12s, color .12s, opacity .12s;
}
button:hover, .button:hover { background: #262a33; border-color: #3d4250; text-decoration: none; }
button:disabled { opacity: .5; cursor: not-allowed; }
.primary, button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.primary:hover, button.primary:hover, .button.primary:hover { background: #8d7fff; border-color: #8d7fff; }
.ghost, button.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.ghost:hover, button.ghost:hover { background: var(--raised); color: var(--text); }
.danger, button.danger { color: var(--bad); }
button.danger:hover { background: var(--bad-soft); border-color: rgba(255,107,107,.4); }
button.small, .button.small { height: 28px; padding: 0 10px; font-size: 12px; }
.icon-button { width: 32px; padding: 0; }

/* ---------- form controls ---------- */
input, textarea, select {
  width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); padding: 9px 12px; font: 14px/1.45 var(--font);
  transition: border-color .12s, box-shadow .12s;
}
textarea { resize: vertical; min-height: 84px; }
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
label, .label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; }
.field { position: relative; margin-bottom: 18px; }
.counter { position: absolute; right: 0; top: 0; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.error { color: var(--bad); font-size: 13px; }

/* ---------- shell ---------- */
.app-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px;
  padding: 18px 14px; background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; color: var(--text); font-weight: 650; font-size: 15px; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), #4b3fd1); color: #fff; }
.brand-mark svg { width: 18px; height: 18px; }
.side-nav { display: grid; gap: 2px; }
.side-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; }
.side-link:hover { background: var(--raised); color: var(--text); text-decoration: none; }
.side-link.active { background: var(--raised); color: var(--text); }
.side-label { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); padding: 0 10px 8px; }
.channel-list { display: grid; gap: 2px; }
.channel-item {
  justify-content: flex-start; width: 100%; height: auto; padding: 8px 10px; gap: 10px;
  background: transparent; border-color: transparent; color: var(--text-2); text-align: left;
}
.channel-item:hover { background: var(--raised); color: var(--text); }
.channel-item[aria-checked="true"] { background: var(--accent-soft); color: var(--text); border-color: rgba(124,108,255,.35); }
.channel-dot { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; flex: none; }
.channel-item small { display: block; color: var(--text-3); font-size: 11px; font-weight: 500; margin-top: 1px; }
.channel-item span:last-child { line-height: 1.25; }
.side-footer { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 8px 0; border-top: 1px solid var(--line); }
.account { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar-initial { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--raised); border: 1px solid var(--line-strong); font-weight: 600; font-size: 13px; }
.account-text { display: grid; min-width: 0; }
.account-text strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-text small { font-size: 11px; color: var(--text-3); }
.side-footer form { margin: 0; }

.main { min-width: 0; padding: 28px 36px 64px; max-width: 1360px; width: 100%; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-header .subtle { margin-top: 4px; }

/* ---------- status pill ---------- */
.status-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 12px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line); color: var(--text-2); font-size: 12px; font-weight: 500; white-space: nowrap;
}
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.status-pill.ready::before { background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.status-pill.warning::before { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }

/* ---------- cards & layout ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { margin-bottom: 20px; }
.card-head p { margin-top: 4px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; margin-bottom: 20px; }
.composer { padding: 22px 24px; }
.channel-card { padding: 20px; position: sticky; top: 20px; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }
.mini-head { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin-bottom: 10px; }

/* duration segmented control */
.segmented { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--bg); border: 1px solid var(--line-strong); border-radius: 10px; }
.segment { margin: 0; flex: 1 1 auto; }
.segment input { position: absolute; opacity: 0; pointer-events: none; }
.segment span {
  display: block; text-align: center; padding: 7px 10px; border-radius: 7px; color: var(--text-2);
  font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background .12s, color .12s;
}
.segment span:hover { color: var(--text); }
.segment input:checked + span { background: var(--raised); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.4), 0 0 0 1px var(--line-strong) inset; }
.segment input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

/* thumbnail templates */
.thumbnails legend { display: flex; gap: 8px; align-items: baseline; margin-bottom: 8px; }
.thumbnails legend .subtle { font-weight: 500; font-size: 11px; color: var(--text-3); }
.template-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 8px; }
.template { margin: 0; cursor: pointer; }
.template input { position: absolute; opacity: 0; pointer-events: none; }
.template-card { display: block; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; background: var(--bg); transition: border-color .12s, box-shadow .12s; }
.template-card img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; opacity: .8; transition: opacity .12s; }
.template-copy { display: grid; gap: 1px; padding: 8px 10px; }
.template-copy strong { font-size: 12px; color: var(--text); }
.template-copy small { font-size: 11px; color: var(--text-3); font-weight: 400; line-height: 1.3; }
.template:hover .template-card img { opacity: 1; }
.template input:checked + .template-card { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.template input:checked + .template-card img { opacity: 1; }
.template input:focus-visible + .template-card { outline: 2px solid var(--accent); outline-offset: 2px; }
.form-foot { display: flex; align-items: center; justify-content: flex-end; gap: 16px; padding-top: 18px; border-top: 1px solid var(--line); }
.form-foot .error { margin-right: auto; }
.form-foot .primary { height: 38px; padding: 0 18px; }

/* settings switches */
.setting { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; }
.setting + .setting { border-top: 1px solid var(--line); }
.setting strong { font-size: 13px; font-weight: 600; }
.setting p { font-size: 12px; margin-top: 2px; line-height: 1.4; }
.switch { position: relative; flex: none; width: 38px; height: 22px; margin: 2px 0 0; cursor: pointer; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch input + span { position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong); transition: background .15s; }
.switch input + span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.4); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + span { opacity: .55; }
#settings-status { min-height: 18px; }
.voices { display: grid; gap: 10px; }
.voice { display: grid; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.voice audio { width: 100%; height: 32px; color-scheme: dark; }
.includes { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 7px; }
.includes li { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-2); }
.includes li svg { color: var(--good); width: 14px; height: 14px; }
.includes li.off { color: var(--text-3); text-decoration: line-through; text-decoration-color: rgba(255,255,255,.2); }
.includes li.off svg { color: var(--text-3); }

/* ---------- production panel ---------- */
.production { padding: 22px 24px; margin-bottom: 28px; }
.production-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.production-head h2 { font-size: 18px; }
.production-head .head-right { display: flex; align-items: center; gap: 10px; }
.percent { font: 600 22px/1 var(--font); font-variant-numeric: tabular-nums; color: var(--text); }
.progress { height: 6px; border-radius: 999px; background: var(--raised); overflow: hidden; }
.progress > div { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #b3a9ff); transition: width .6s ease; }
.stage-line { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 12px 0 0; color: var(--text-2); font-size: 13px; }
.stage-line strong { color: var(--text); font-weight: 600; }
.finished { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 20px; }
.finished video { width: 100%; max-height: 520px; background: #000; border-radius: 10px; border: 1px solid var(--line); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.production-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 20px; }
.production-grid > :only-child { grid-column: 1 / -1; }
.subpanel { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 16px; min-width: 0; }
.subpanel h3 { margin-bottom: 10px; }
.subpanel .subtle { font-size: 12px; }
.job-thumbnail img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); margin: 10px 0; }
.intro-panel { grid-column: 1 / -1; }
.intro-panel textarea { background: var(--bg); font-size: 13px; margin: 10px 0; }

/* dashboard */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-bottom: 12px; }
.metric { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.metric span { display: block; font-size: 11px; color: var(--text-3); font-weight: 500; }
.metric strong { display: block; font-size: 15px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.dash-note { font-size: 12px; color: var(--text-3); margin: 6px 0; }
.dash-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 13px; color: var(--text-2); }
.dash-row b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
details.disclosure { margin-top: 10px; }
details.disclosure summary { cursor: pointer; font-size: 12px; font-weight: 600; color: var(--text-2); padding: 6px 0; list-style: none; display: flex; align-items: center; gap: 6px; }
details.disclosure summary::-webkit-details-marker { display: none; }
details.disclosure summary::before { content: ""; width: 6px; height: 6px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(-45deg); transition: transform .15s; }
details.disclosure[open] summary::before { transform: rotate(45deg); }
.checks { display: grid; gap: 4px; margin-top: 8px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.check::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex: none; }
.check.fail::before { background: var(--warn); }
.quality-head { display: flex; align-items: center; gap: 8px; margin-top: 14px; }

/* ---------- library ---------- */
.library-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.library-head h2 { font-size: 18px; }
.library-head .subtle { font-size: 12px; margin-top: 2px; }
.filters { display: flex; gap: 4px; padding: 3px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.chip { height: 28px; padding: 0 12px; background: transparent; border-color: transparent; color: var(--text-2); font-size: 12px; }
.chip:hover { background: var(--raised); }
.chip.active { background: var(--raised); color: var(--text); border-color: var(--line-strong); }
.chip .count { color: var(--text-3); font-variant-numeric: tabular-nums; }
.empty { padding: 48px 20px; text-align: center; color: var(--text-3); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.video-card { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: border-color .15s, transform .15s; min-width: 0; }
.video-card:hover { border-color: var(--line-strong); }
.video-card.selected { border-color: rgba(124,108,255,.55); box-shadow: 0 0 0 3px var(--accent-soft); }
.poster { position: relative; aspect-ratio: 16 / 9; background: radial-gradient(120% 120% at 0% 0%, #23263a 0%, #121318 60%); display: block; width: 100%; height: auto; padding: 0; border: 0; border-radius: 0; border-bottom: 1px solid var(--line); overflow: hidden; }
.poster:hover { background: radial-gradient(120% 120% at 0% 0%, #2a2d45 0%, #14151b 60%); }
.poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.poster .poster-mark { position: absolute; inset: 0; display: grid; place-items: center; color: #3a3e52; }
.poster .poster-mark svg { width: 44px; height: 44px; stroke-width: 1.4; }
.poster .poster-mark strong { font-size: 26px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.poster .play { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; transition: opacity .15s; background: rgba(0,0,0,.35); }
.poster .play svg { width: 44px; height: 44px; padding: 12px; border-radius: 50%; background: rgba(255,255,255,.92); color: #111; fill: #111; stroke: none; }
.poster:hover .play { opacity: 1; }
.poster .duration { position: absolute; right: 8px; bottom: 8px; padding: 2px 6px; border-radius: 4px; background: rgba(0,0,0,.75); color: #fff; font-size: 11px; font-weight: 600; }
.card-body { padding: 14px 14px 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 0; }
.card-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card-title { all: unset; cursor: pointer; font-size: 14px; font-weight: 600; line-height: 1.35; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.card-title:hover { color: #fff; text-decoration: underline; text-decoration-color: var(--text-3); }
.card-title:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.meta { font-size: 12px; color: var(--text-3); }
.detail { font-size: 12px; color: var(--text-2); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mini-progress { height: 3px; border-radius: 999px; background: var(--raised); overflow: hidden; }
.mini-progress span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: auto; padding-top: 6px; }
.card-actions .spacer { flex: 1; }
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; background: var(--raised); color: var(--text-2); flex: none; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.complete { background: var(--good-soft); color: var(--good); }
.badge.running, .badge.recovering { background: var(--accent-soft); color: var(--accent-2); }
.badge.queued { background: var(--info-soft); color: var(--info); }
.badge.attention { background: var(--warn-soft); color: var(--warn); }
.badge.failed, .badge.rejected { background: var(--bad-soft); color: var(--bad); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: 11px; color: var(--text-3); border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; line-height: 18px; }
.approval { background: var(--warn-soft); border: 1px solid rgba(245,184,74,.25); border-radius: 8px; padding: 10px; display: grid; gap: 8px; font-size: 12px; color: var(--text-2); }
.approval .actions { gap: 6px; }

/* overflow menu */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel {
  position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 30; min-width: 210px; padding: 6px;
  background: var(--raised); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: 0 16px 40px rgba(0,0,0,.55);
  display: grid; gap: 1px;
}
.menu-panel button, .menu-panel a {
  justify-content: flex-start; width: 100%; height: 32px; padding: 0 10px; background: transparent; border: 0; border-radius: 6px;
  color: var(--text); font: 500 13px/1 var(--font); display: flex; align-items: center; gap: 10px; text-decoration: none;
}
.menu-panel button:hover, .menu-panel a:hover { background: var(--line-strong); text-decoration: none; }
.menu-panel hr { border: 0; height: 1px; background: var(--line-strong); margin: 4px 2px; }

/* ---------- dialogs ---------- */
dialog {
  width: min(680px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; color: var(--text);
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
dialog::backdrop { background: rgba(5, 6, 9, .72); backdrop-filter: blur(3px); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 1; }
.dialog-head p { margin-top: 4px; font-size: 13px; color: var(--text-2); }
.dialog-body { padding: 18px 20px; display: grid; gap: 14px; }
.dialog-body img { width: 100%; border-radius: 8px; border: 1px solid var(--line); }
.dialog-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--panel-2); position: sticky; bottom: 0; }
.dialog-foot .status { margin-right: auto; align-self: center; font-size: 12px; color: var(--text-2); }
dialog.player { width: min(1100px, calc(100vw - 32px)); }
dialog.player video { display: block; width: 100%; max-height: 70vh; background: #000; }
.story-beats { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.story-beats li { display: grid; grid-template-columns: 32px 1fr; gap: 4px 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.story-beats li > span { grid-row: span 2; font: 600 12px/22px var(--mono); color: var(--accent-2); }
.story-beats li p { color: var(--text-2); font-size: 13px; }
.story-beats li details { grid-column: 2; display: grid; gap: 8px; }
.story-beats li details[open] > * + * { margin-top: 8px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; max-width: calc(100vw - 32px);
  padding: 10px 16px; border-radius: 10px; background: var(--raised); border: 1px solid var(--line-strong); color: var(--text);
  box-shadow: 0 16px 40px rgba(0,0,0,.5); font-size: 13px; font-weight: 500;
}
.toast.bad { border-color: rgba(255,107,107,.45); }

/* ---------- auth + admin pages ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(80% 60% at 50% 0%, #1a1832 0%, var(--bg) 70%); }
.auth-card { width: min(400px, 100%); padding: 28px; }
.auth-card .brand { padding: 0; margin-bottom: 22px; }
.auth-card h1 { font-size: 20px; margin-bottom: 6px; }
.auth-card > p { color: var(--text-2); margin-bottom: 20px; font-size: 13px; }
.auth-card button[type="submit"] { width: 100%; height: 40px; margin-top: 4px; }
.auth-card code { font: 12px var(--mono); background: var(--bg); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line); }
.auth-note { font-size: 12px; color: var(--text-3); margin-bottom: 16px; }
.admin-main { max-width: 980px; }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.admin-card { padding: 20px 22px; }
.admin-card + .admin-card { margin-top: 0; }
.wide { grid-column: 1 / -1; }
.rows { display: grid; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.row .who div { min-width: 0; }
.row strong { font-size: 13px; }
.row small { display: block; color: var(--text-3); font-size: 12px; }
.request { padding: 14px 0; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.request:first-child { border-top: 0; padding-top: 0; }
.request p { color: var(--text-2); font-size: 13px; white-space: pre-wrap; max-height: 7.5em; overflow: auto; }
.policy { font-size: 13px; color: var(--text-2); display: grid; gap: 8px; }
.policy li { margin-left: 2px; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .channel-card { position: static; }
  .template-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side-nav { display: flex; flex-wrap: wrap; order: 3; width: 100%; }
  .side-section { order: 4; width: 100%; }
  .side-label { display: none; }
  .channel-list { display: flex; gap: 6px; overflow-x: auto; }
  .channel-item { width: auto; }
  .side-footer { margin: 0 0 0 auto; border: 0; padding: 0; order: 2; }
  .account-text { display: none; }
  .main { padding: 20px 16px 48px; }
  .page-header { flex-direction: column; }
  .production-grid, .admin-grid { grid-template-columns: minmax(0, 1fr); }
  .composer, .production { padding: 18px 16px; }
}
@media (max-width: 520px) {
  .template-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .template-copy small { display: none; }
  .filters { width: 100%; overflow-x: auto; }
  .form-foot { flex-direction: column; align-items: stretch; }
  .form-foot .primary { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- channels + connections (2026-10-15) ---------- */
.side-add { justify-content: flex-start; width: 100%; height: 34px; margin-top: 6px; padding: 0 10px; gap: 10px; background: transparent; border: 1px dashed var(--line-strong); color: var(--text-2); }
.side-add:hover { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
.banner { display: grid; gap: 8px; margin-bottom: 20px; padding: 12px 16px; border-radius: var(--radius); background: var(--warn-soft); border: 1px solid rgba(245,184,74,.3); }
.banner-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.host-line { display: flex; align-items: center; gap: 8px; }
.host-photo { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; object-position: 50% 30%; border: 1px solid var(--line-strong); }
.hint { font-size: 11px; color: var(--text-3); margin-top: 5px; }
.mono { font-family: var(--mono); font-size: 13px; letter-spacing: .02em; }
dialog.channel-editor { width: min(820px, calc(100vw - 32px)); }
.host-editor { display: grid; gap: 0; padding: 16px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; }
.host-editor h3 { margin-bottom: 12px; }
.host-editor .field { margin-bottom: 12px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.voice-test { align-items: center; margin: -2px 0 12px; }
.voice-test audio { height: 30px; flex: 1; min-width: 180px; color-scheme: dark; }
.portrait-block { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px; display: grid; gap: 8px; }
.portrait-block h4 { margin: 0; font-size: 12px; font-weight: 600; color: var(--text-2); }
.portrait-frame img, .portrait-empty { width: 100%; max-width: 420px; aspect-ratio: 16 / 9; border-radius: 8px; border: 1px solid var(--line); object-fit: cover; display: block; }
.portrait-empty { display: grid; place-items: center; color: var(--text-3); font-size: 12px; background: var(--bg); border-style: dashed; }
.connection-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.connection { display: grid; gap: 10px; align-content: start; }
.connection-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.key-hint { font-size: 13px; color: var(--text-2); }
.key-hint code { font: 12px var(--mono); background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; }
@media (max-width: 640px) { .two-col { grid-template-columns: minmax(0, 1fr); } }

dialog { overflow-x: hidden; }

/* ---------- member site (sappysleepeditor.com) ---------- */
.site { max-width: 980px; margin: 0 auto; padding: 28px 20px 64px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 28px; }
.topbar .actions { gap: 8px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.hero h1 { font-size: 30px; line-height: 1.15; margin-bottom: 12px; }
.hero .lead { font-size: 15px; color: var(--text-2); line-height: 1.6; }
.pillars { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 10px; }
.pillars li { display: flex; gap: 10px; font-size: 14px; color: var(--text-2); }
.pillars li svg { color: var(--good); margin-top: 3px; }
.form-card { padding: 22px; display: grid; gap: 4px; }
.form-card h2 { margin-bottom: 4px; }
.form-card .subtle { margin-bottom: 14px; font-size: 13px; }
.form-card button[type=submit] { width: 100%; height: 40px; }
.form-msg { font-size: 13px; min-height: 18px; margin-top: 8px; }
.form-msg.ok { color: var(--good); }
.form-msg.bad { color: var(--bad); }
.tabs { display: flex; gap: 4px; padding: 3px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 16px; }
.tabs button { flex: 1; height: 30px; background: transparent; border-color: transparent; color: var(--text-2); font-size: 13px; }
.tabs button.active { background: var(--raised); color: var(--text); border-color: var(--line-strong); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.section { padding: 22px; margin-bottom: 20px; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.checklist li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.checklist li:first-child { border-top: 0; }
.step-list { margin: 0; padding-left: 20px; display: grid; gap: 10px; color: var(--text-2); font-size: 14px; line-height: 1.5; }
.step-list strong { color: var(--text); }
.notice { padding: 12px 14px; border-radius: 10px; background: var(--info-soft); border: 1px solid rgba(90,169,255,.25); color: var(--text-2); font-size: 13px; line-height: 1.5; }
.welcome-box { width: 100%; min-height: 260px; font: 12px/1.5 var(--mono); }
table.members { width: 100%; border-collapse: collapse; font-size: 13px; }
table.members th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.members td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.members td .actions { flex-wrap: nowrap; }
.dots { display: flex; gap: 4px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); }
.dot.on { background: var(--good); }
@media (max-width: 760px) { .hero, .grid-2 { grid-template-columns: minmax(0, 1fr); } table.members { display: block; overflow-x: auto; } }

.portrait-thumb { width: 100%; max-width: 320px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; margin-bottom: 8px; }
