* { box-sizing: border-box; }
body { font-family: -apple-system, "Segoe UI", Roboto, sans-serif; margin: 0; background: #14161a; color: #e7e9ee; }
a { color: #7cb3ff; text-decoration: none; }
a:hover { text-decoration: underline; }

nav { display: flex; align-items: center; gap: 1rem; padding: 0.6rem 1rem; background: #1d2026; border-bottom: 1px solid #2c3038; }
nav .brand { font-weight: 700; margin-right: 1rem; }
nav a { color: #aab2c0; padding: 0.25rem 0.5rem; border-radius: 4px; }
nav a.active { background: #2c3038; color: #fff; }
nav .logout { margin-left: auto; }

main { padding: 1rem 1.5rem; max-width: 1200px; margin: 0 auto; }
h1 { font-size: 1.3rem; } h2 { font-size: 1.1rem; margin-top: 1.5rem; }

table { width: 100%; border-collapse: collapse; margin: 0.75rem 0; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.45rem 0.6rem; border-bottom: 1px solid #2c3038; vertical-align: top; }
th { color: #8b93a3; font-weight: 600; }
tr:hover td { background: #1b1e24; }

.flash { padding: 0.5rem 1rem; margin: 0.5rem 1rem; border-radius: 6px; font-size: 0.9rem; }
.flash.success { background: #143d24; color: #8ee6ae; }
.flash.error { background: #43181c; color: #ff9ba3; }
.flash.info { background: #1c2c45; color: #9cc2ff; }

.chip { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 10px; font-size: 0.75rem; font-weight: 600; }
.chip.discovered { background: #2c3038; color: #aab2c0; }
.chip.ranked { background: #1c2c45; color: #9cc2ff; }
.chip.approved { background: #143d24; color: #8ee6ae; }
.chip.rejected { background: #3a2530; color: #d6a3b5; }
.chip.downloaded, .chip.rendered { background: #33301a; color: #e6d98e; }
.chip.posted { background: #143d3d; color: #8ee6da; }
.chip.failed { background: #43181c; color: #ff9ba3; }
.chip.live { background: #4a1220; color: #ff7d9a; }
.chip.offline { background: #23262c; color: #6c7484; }

form.inline { display: inline; }
input, select, textarea, button { font: inherit; background: #23262c; color: #e7e9ee; border: 1px solid #363b45; border-radius: 5px; padding: 0.35rem 0.6rem; }
textarea { width: 100%; min-height: 4rem; }
button { cursor: pointer; background: #2b5f9e; border-color: #2b5f9e; color: #fff; }
button:hover { filter: brightness(1.15); }
button.danger { background: #8e2c38; border-color: #8e2c38; }
button.subtle { background: #23262c; border-color: #363b45; color: #aab2c0; }

.card { background: #1b1e24; border: 1px solid #2c3038; border-radius: 8px; padding: 1rem; margin: 0.75rem 0; }
.card.confirm { border-color: #2b5f9e; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0.75rem; }
.muted { color: #8b93a3; font-size: 0.85rem; }
.score { font-weight: 700; font-variant-numeric: tabular-nums; }
.avatar { width: 28px; height: 28px; border-radius: 50%; vertical-align: middle; margin-right: 0.4rem; }
.avatar-lg { width: 72px; height: 72px; border-radius: 50%; flex-shrink: 0; }
.profile-head { display: flex; gap: 1rem; align-items: center; }
.twitch-out { text-decoration: none; margin-left: 0.15rem; }
.queue-controls { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; margin-bottom: 0.5rem; }
.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; margin: 1rem 0; }

.meter { background: #23262c; border-radius: 6px; height: 14px; overflow: hidden; max-width: 300px; }
.meter > div { background: #2b8e57; height: 100%; }
.meter.warn > div { background: #b58f2c; }
.meter.crit > div { background: #8e2c38; }

.login-box { max-width: 320px; margin: 15vh auto; text-align: center; }
.login-box input { width: 100%; margin-bottom: 0.6rem; }
.login-box button { width: 100%; }

details summary { cursor: pointer; color: #8b93a3; }
.caption-option { border: 1px solid #2c3038; border-radius: 6px; padding: 0.6rem; margin: 0.4rem 0; }
.caption-option.selected { border-color: #2b8e57; background: #14251b; }
iframe.clip-embed { width: 100%; max-width: 640px; aspect-ratio: 16/9; border: 0; border-radius: 8px; }

/* Vertical framing adjuster (review page). The mask darkens what gets cropped
   away, so the bright region is literally what will be posted. */
.crop-wrap { position: relative; display: inline-block; max-width: 100%; margin: 0.5rem 0; }
.crop-wrap img { display: block; max-width: 100%; height: auto; }
.crop-mask { position: absolute; top: 0; background: rgba(10, 12, 16, 0.72); pointer-events: none; }
#crop-box { position: absolute; top: 0; border: 2px solid #8ee6ae; box-sizing: border-box;
            pointer-events: none; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6); }
#crop-form label { display: block; margin: 0.5rem 0; font-size: 0.9rem; }
#crop-form input[type=range] { width: 320px; max-width: 100%; vertical-align: middle; margin-left: 0.5rem; }
#crop-form input[type=range]:disabled { opacity: 0.4; }

/* Live rows on the dashboard: whoever is streaming right now is the only
   thing that can produce a clip in the next minute. */
tr.is-live td { background: rgba(74, 18, 32, 0.28); }
tr.is-live td:first-child { box-shadow: inset 3px 0 0 #ff7d9a; }
th a { color: inherit; text-decoration: none; border-bottom: 1px dotted #6c7484; }
th a.active { color: #8ee6ae; border-bottom-color: #8ee6ae; }

/* Chat-spike stat cards */
.stat-row { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.stat-row .stat { flex: 1 1 180px; }
.stat-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: #6c7484; }
.stat-big { font-size: 2rem; font-weight: 700; line-height: 1.1; }
.good { color: #8ee6ae; }
.bad { color: #ff9ba3; }

/* Clip freshness. Aging is the loud one on purpose: it is the only band that
   is still actionable AND running out, so it is where attention belongs. */
.chip.fresh-fresh { background: #143d24; color: #8ee6ae; }
.chip.fresh-aging { background: #4a3a12; color: #ffd479; }
.chip.fresh-stale { background: #3a2530; color: #d6a3b5; }
.chip.fresh-expired { background: #23262c; color: #6c7484; }

/* Traceback on the error page. Scrolls on its own so a deep stack cannot
   push the page sideways on a phone. */
pre.traceback {
  background: #14161a; border: 1px solid #2a2e36; border-radius: 6px;
  padding: 0.75rem; overflow-x: auto; font-size: 0.78rem; line-height: 1.45;
  white-space: pre; color: #d6a3b5; max-height: 60vh; overflow-y: auto;
}

/* Multiview: as many live players as fit, 16:9 each. One column on phones. */
.multiview-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
}
.multiview-cell { background: #14161a; border: 1px solid #2a2e36; border-radius: 8px; padding: 0.6rem; }
.multiview-head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.multiview-head form { margin-left: auto; }
.multiview-player { position: relative; padding-top: 56.25%; }
.multiview-player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 4px; }
.multiview-title { margin-top: 0.4rem; }

/* Streamer profile — weekly stream-heat strip */
.week-strip { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0.6rem 0 0; }
.day-cell { flex: 1 1 100px; max-width: 150px; display: block; padding: 0.5rem;
  background: #14161a; border: 1px solid #2a2e36; border-radius: 8px; color: inherit; }
.day-cell:hover { text-decoration: none; border-color: #2b5f9e; background: #1a1d24; }
.day-cell.today { border-color: #7cb3ff; }
.day-thumb { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 5px; display: block; background: #23262c; }
.day-thumb.day-empty { display: flex; align-items: center; justify-content: center; color: #6c7484; font-size: 0.75rem; }
.day-tri { width: 100%; height: 46px; margin: 0.4rem 0 0.1rem; display: block; }
.day-label { display: flex; justify-content: space-between; align-items: baseline; }
.day-initial { font-weight: 700; }

/* Heat level chips (day page) + source-platform chips (profile/roster) */
.chip.none-heat { background: #23262c; color: #6c7484; }
.chip.cool-heat { background: #1c2c45; color: #9cc2ff; }
.chip.warm-heat { background: #33301a; color: #e6d98e; }
.chip.hot-heat  { background: #43181c; color: #ff9ba3; }
.chip.twitch-src  { background: #2a2140; color: #c9b8ff; }
.chip.kick-src    { background: #143d24; color: #8ee6ae; }
.chip.youtube-src { background: #3a1518; color: #ff9ba3; }

/* System status dot (dashboard: system diagnostics collapse to one dot). */
.status-dot-drawer { margin: 1em 0; border: 1px solid #2c3038; border-radius: 6px; padding: .5em .8em; }
.status-dot-drawer summary { cursor: pointer; list-style: none; }
.status-dot-drawer summary::-webkit-details-marker { display: none; }
.status-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .5em; vertical-align: middle; }
.status-dot.success { background: #4caf50; }
.status-dot.info    { background: #7cb3ff; }
.status-dot.error   { background: #e5484d; box-shadow: 0 0 0 3px rgba(229,72,77,.25); }
.status-dot-drawer[open] summary { margin-bottom: .6em; }
.advanced-drawer summary { cursor: pointer; margin: 1.5em 0 .5em; }

/* The Board (spec §4.1) — a decision surface, not a queue. Card language
   mirrors the week-strip's rounded-card / dark-panel vocabulary. */
.board-title { margin-bottom: 0.15rem; }
.board-sub { margin-top: 0; }
.board-grid { display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-top: 1rem; }
.board-card { background: #1b1e24; border: 1px solid #2c3038; border-radius: 8px;
              overflow: hidden; display: flex; flex-direction: column; }
.board-thumb-link { display: block; background: #14161a; }
.board-thumb { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }
.board-thumb-empty { aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center;
                     color: #6c7484; font-size: 0.8rem; background: #23262c; }
.board-card-body { padding: 0.7rem 0.8rem 0.85rem; display: flex; flex-direction: column; gap: 0.55rem; }
.board-streamer { display: flex; align-items: center; gap: 0.4rem; font-weight: 600; font-size: 0.95rem; }
.board-heat-row { display: flex; align-items: baseline; justify-content: space-between; gap: 0.7rem; }
.board-heat { font-size: 2.2rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; color: #ffd479; }
.board-meta { text-align: right; }
.board-velocity { font-size: 0.8rem; color: #aab2c0; font-variant-numeric: tabular-nums; }
.board-countdown { font-size: 0.75rem; color: #8b93a3; font-variant-numeric: tabular-nums; }
.board-action button { width: 100%; padding: 0.55rem; font-weight: 600; font-size: 1rem; }
.board-empty { text-align: center; }
.board-footer { text-align: center; margin-top: 1rem; }
