/* Admin area — light, dense, readable for long working sessions. */
:root {
  --bg: #f4f5f7; --card: #fff; --line: #e3e6eb; --text: #1d232c; --muted: #6b7482;
  --accent: #2563eb; --accent-soft: #e8efff; --ok: #15803d; --ok-soft: #e7f6ec;
  --warn: #b45309; --warn-soft: #fff4e0; --danger: #c02626; --danger-soft: #fdecec;
  --radius: 10px; --font: "Hind Siliguri", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.5; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }

.shell { display: flex; min-height: 100vh; }
.nav { width: 220px; flex-shrink: 0; background: #111827; color: #cbd2dd; padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav__brand { color: #fff; font-weight: 700; font-size: 17px; padding: 4px 10px 14px; }
.nav a { color: #cbd2dd; padding: 8px 10px; border-radius: 8px; }
.nav a:hover { background: #1f2937; text-decoration: none; color: #fff; }
.nav a.is-active { background: #2563eb; color: #fff; }
.nav__foot { margin-top: auto; padding: 10px; font-size: 13px; color: #8b95a5; }
.nav__foot button { background: none; border: 0; color: #cbd2dd; padding: 0; cursor: pointer; text-decoration: underline; }
.main { flex: 1; min-width: 0; padding: 22px 26px 40px; }
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .nav { width: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 8px; }
  .nav__brand { padding: 4px 10px; }
  .nav__foot { margin: 0 0 0 auto; }
  .main { padding: 16px; }
}

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 22px; }
.page-head p { margin: 2px 0 0; color: var(--muted); }
h2 { font-size: 17px; margin: 0 0 10px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.grid { display: grid; gap: 14px; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid--stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat b { display: block; font-size: 24px; line-height: 1.2; }
.stat span { color: var(--muted); font-size: 13px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card); border-radius: 8px;
  padding: 6px 12px; cursor: pointer; font-weight: 500; white-space: nowrap; color: var(--text);
}
.btn:hover { background: #f0f2f5; text-decoration: none; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: #1d4ed8; }
.btn--live { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn--live:hover { background: #a31f1f; }
.btn--ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn--small { padding: 2px 8px; font-size: 13px; }
.btn--warn { background: #d97706; border-color: #d97706; color: #fff; }
.btn--warn:hover { background: #b45309; }
.poll-bar { position: relative; display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.poll-bar span, .poll-bar b { position: relative; }
.poll-bar__fill { position: absolute; inset: 0 auto 0 0; background: var(--accent-soft); }
.poll-bar.is-right { border-color: #16a34a; }
.poll-bar.is-right .poll-bar__fill { background: rgba(22, 163, 74, .18); }
.poll-item { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.poll-item.is-live { border-color: #dc2626; box-shadow: 0 0 0 3px rgba(220, 38, 38, .12); }
.poll-form { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.ask { display: grid; gap: 8px; border-color: var(--warn); background: #fffaf0; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: #eef0f3; color: var(--muted); }
.pill--live, .pill--current.pill--live { background: var(--danger-soft); color: var(--danger); }
.pill--video, .pill--current { background: var(--accent-soft); color: var(--accent); }
.pill--waiting_host, .pill--waiting { background: var(--warn-soft); color: var(--warn); }
.pill--done, .pill--ended { background: var(--ok-soft); color: var(--ok); }
.pill--skipped, .pill--cancelled { background: #eee; color: #888; }

table.table { width: 100%; border-collapse: collapse; background: var(--card); }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: 13px; color: var(--muted); font-weight: 600; background: #fafbfc; }
.table tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.empty { color: var(--muted); padding: 18px; text-align: center; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; background: var(--ok-soft); color: var(--ok); }
.flash--error { background: var(--danger-soft); color: var(--danger); }

.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { font-weight: 600; font-size: 14px; }
.field small { color: var(--muted); }
.field input[type=text], .field input[type=email], .field input[type=password], .field input[type=url], .field input[type=number],
.field input[type=time], .field input[type=datetime-local], .field select, .field textarea, .input {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; width: 100%;
}
.field textarea { min-height: 80px; resize: vertical; }
.field .error, .error { color: var(--danger); font-size: 13px; }
.checks { display: flex; gap: 14px; flex-wrap: wrap; }
.checks label { display: inline-flex; gap: 6px; align-items: center; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* Running-order editor */
.segments { display: flex; flex-direction: column; gap: 10px; }
.segment { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fbfcfd; display: grid; gap: 10px; }
.segment--live { border-left: 4px solid var(--danger); }
.segment--video { border-left: 4px solid var(--accent); }
.segment__head { display: flex; gap: 8px; align-items: center; }
.segment__head b { flex: 1; }
.segment__fields { display: grid; gap: 10px; grid-template-columns: 1.2fr 2fr 1fr; }
@media (max-width: 760px) { .segment__fields { grid-template-columns: 1fr; } }
.total-length { color: var(--muted); }

/* Control room */
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.timeline li { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; flex-wrap: wrap; }
.timeline li.is-current { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.timeline li.is-waiting { border-color: var(--warn); box-shadow: 0 0 0 2px var(--warn-soft); }
.timeline .num { width: 26px; height: 26px; border-radius: 50%; background: #eef0f3; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.timeline .what { flex: 1; min-width: 160px; }
.timeline .when { color: var(--muted); font-size: 13px; }
.feed { list-style: none; margin: 0; padding: 0; max-height: 520px; overflow-y: auto; }
.feed li { padding: 8px 4px; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }
.feed li.is-hidden { opacity: .45; }
.feed li.is-answered .body { color: var(--muted); }
.feed li.is-pinned { background: var(--accent-soft); border-radius: 6px; }
.feed .meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.feed .who { font-weight: 600; color: var(--text); }
.feed .host-tag { color: var(--accent); }
.feed .body { margin: 2px 0 4px; word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap; }
.feed .acts { display: flex; gap: 4px; flex-wrap: wrap; }
.compose { display: flex; gap: 8px; margin-top: 10px; }
.compose input[type=text] { flex: 1; }
.alert { padding: 10px 14px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); border: 1px solid #f3d6a6; }
.alert b { color: #7c3a06; }
.chart-box { position: relative; height: 220px; }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 50; background: #111827; color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: 360px; }
.toast--error { background: var(--danger); }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 100%; max-width: 380px; }
.pagination { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 12px; }
.pagination a, .pagination span { padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.pagination .active span { background: var(--accent); color: #fff; border-color: var(--accent); }

.timeline .acts { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.timeline .len { color: var(--muted); font-size: 12.5px; }
.timeline li[data-handle] { cursor: grab; }
.timeline li[data-handle]:active { cursor: grabbing; }
.drag-handle { cursor: grab; color: var(--muted); font-size: 18px; line-height: 1; padding: 2px 4px; user-select: none; }
.drag-handle:active { cursor: grabbing; }
[data-drag].is-dragging { opacity: .45; outline: 2px dashed var(--accent); }
.progress { margin-top: 6px; max-width: 520px; }
.progress__bar { height: 6px; border-radius: 999px; background: #e6eaf2; overflow: hidden; }
.progress__fill { height: 100%; width: 0; background: var(--accent); transition: width .5s linear; }
.progress--live .progress__fill { background: var(--danger); }
.progress--waiting .progress__fill { background: var(--warn); }
.progress__text { margin-top: 3px; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.segment-editor { margin-top: 12px; padding: 12px; border: 1px dashed var(--accent); border-radius: 10px; background: #f8faff; display: grid; gap: 10px; }

.preview { display: grid; gap: 4px; }
.preview-frame { position: relative; width: 100%; max-width: 420px; aspect-ratio: 16 / 9; background: #000; border-radius: 8px; overflow: hidden; }
.preview-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
