/* ============================================================
   SDCOG BROADCAST — operator dashboard
   ============================================================ */

:root {
  --bg:     #14181d;
  --panel:  #1d232a;
  --sunken: #12161b;
  --line:   #2c343d;
  --text:   #e8edf2;
  --muted:  #8b97a4;
  --blue:   #1a7ab8;
  --gold:   #f7de6e;
  --green:  #1a9e28;
  --red:    #c4453c;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 'Segoe UI', system-ui, sans-serif;
  padding: 22px 20px 70px;
}

.wrap { max-width: 1080px; margin: 0 auto; }
.narrow { max-width: 460px; }

/* ---------------- header ---------------- */
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.topbar h1 { font-size: 19px; font-weight: 600; letter-spacing: .3px; }
.topbar a { color: var(--blue); text-decoration: none; font-size: 13px; }
.topbar a:hover { text-decoration: underline; }
/* The name is a link to your own account, but it reads as a label — after
   the rule above, so it wins on the colour. */
.topbar a.who { margin-left: auto; font-size: 13px; color: var(--muted); }

.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: 0 0 auto; }
.dot.ok   { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot.fail { background: var(--red);   box-shadow: 0 0 8px var(--red); }

.status { font-size: 13px; color: var(--muted); }
.status.err { color: #e88; }

/* ============================================================
   On-air strip — what is live, and the way to clear it
   ============================================================ */
.onair {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 11px 14px; margin-bottom: 14px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 9px;
}
.onair.live { border-color: #2c6b36; background: #16221a; }

/* The eight source URLs for one device, folded out under its row. Setting a
   machine up means copying them one after another; a dialog that has to be
   reopened for each is worse than a list. */
.device-urls {
  padding: 4px 12px 14px 12px;
  border-left: 2px solid var(--line); margin: 0 0 10px 10px;
}
.device-urls .field { margin-top: 10px; }
.device-urls input { font-size: 12px; }

/* A step counting itself down. Amber rather than green: something is about
   to happen that nobody is going to press. */
.auto-tick {
  display: inline-block; margin-left: 10px; padding: 1px 9px;
  border-radius: 20px; background: rgba(247,222,110,.16);
  color: var(--gold); font-size: 11.5px; font-weight: 700;
  white-space: nowrap;
}

/* ============================================================
   Quick-fire — one box across every library
   ============================================================ */
.quickfire { position: relative; margin-bottom: 10px; }
.quickfire input {
  width: 100%; padding: 10px 13px;
  background: var(--sunken); border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); font-size: 14px;
}
.quickfire input:focus { outline: none; border-color: var(--blue); }

/* Over the page rather than pushing it down: the strip below must not move
   while the operator is reading it. */
.qf-hits {
  display: none; position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px);
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 12px 30px rgba(0,0,0,.45); overflow: hidden;
}
.qf-hits.open { display: block; }
.qf-hit {
  display: flex; align-items: baseline; gap: 10px; width: 100%;
  padding: 9px 13px; text-align: left; cursor: pointer;
  background: transparent; border: 0; border-bottom: 1px solid var(--line);
  color: var(--text); font: inherit;
}
.qf-hit:last-child { border-bottom: 0; }
.qf-hit:hover, .qf-hit.sel { background: #232b33; }
.qf-hit .kind {
  flex: 0 0 68px; font-size: 10.5px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--gold);
}
.qf-hit .label { font-weight: 600; }
.qf-hit .detail { color: var(--muted); font-size: 12.5px; margin-left: auto; text-align: right; }
.qf-hit.unusable .label { color: var(--muted); text-decoration: line-through; }

/* One step back for a single graphic. Hidden until the chip is hovered —
   eight always-visible undo buttons would be noise on a strip whose job is
   to be read at a glance. */
.chip-undo {
  margin-left: 7px; padding: 0 5px;
  font-size: 12px; line-height: 1.3;
  background: transparent; border: 1px solid var(--line); border-radius: 4px;
  color: var(--muted); cursor: pointer;
  opacity: 0; transition: opacity .12s;
}
.chip:hover .chip-undo { opacity: 1; }
.chip-undo:hover { color: var(--text); border-color: var(--blue); }

.onair-label {
  font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--muted); font-weight: 600; flex: 0 0 auto;
}
.onair-chips { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; min-width: 0; }
.onair button { margin-left: auto; }

.chip {
  padding: 5px 12px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
  background: #232b33; color: var(--muted);
  white-space: nowrap;
}
.chip.on {
  background: var(--green); color: #06210b;
  box-shadow: 0 0 0 3px rgba(26,158,40,.18);
}
.chip .what { opacity: .75; font-weight: 500; }

/* A graphic the server believes is on screen that no browser source has
   asked for recently. Amber rather than red: the usual cause is that OBS is
   not open yet, which is not an emergency at ten past nine. */
.chip.stale {
  background: #4a3714; color: #f0d89a;
  box-shadow: 0 0 0 3px rgba(240,216,154,.12);
}
.chip.stale::after { content: ' ⚠'; }

/* ============================================================
   Next up, and the service clock
   ============================================================ */
.nextup {
  display: flex; align-items: flex-start; gap: 12px;
  margin-top: 16px; padding: 12px 14px;
  background: var(--sunken); border: 1px solid var(--line);
  border-left: 3px solid var(--blue); border-radius: 8px;
}
.nextup.finished { border-left-color: var(--muted); opacity: .65; }
.nextup-tag {
  flex: 0 0 auto; font-size: 10.5px; letter-spacing: 1.3px;
  text-transform: uppercase; color: var(--muted); font-weight: 600;
  padding-top: 3px;
}
.nextup-body { flex: 1; min-width: 0; }
.nextup-body b { display: block; font-size: 15px; }
.nextup-body span { display: block; font-size: 12.5px; color: var(--muted); }
.nextup-body .meta { font-size: 11.5px; color: var(--gold); margin-top: 3px; }

.clock {
  font: 700 22px/1 'Segoe UI', system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.clock.behind { color: #f0b3ae; }
.clock.ahead  { color: #b6e8bf; }

/* ============================================================
   Picture library
   ============================================================ */
.media-row .thumb {
  flex: 0 0 auto; width: 64px; height: 40px;
  object-fit: cover; border-radius: 5px;
  background: var(--bg); border: 1px solid var(--line);
}
.media-row.missing { border-left-color: var(--red); }
.media-row.on-air  { border-left-color: var(--green); }

.media-preview {
  margin-bottom: 16px; padding: 10px; border-radius: 8px;
  background: repeating-conic-gradient(#20262d 0% 25%, #1a1f25 0% 50%) 50% / 20px 20px;
  border: 1px solid var(--line); text-align: center;
}
.media-preview img { max-width: 100%; max-height: 220px; border-radius: 5px; }

/* ---------------- verse stepper ---------------- */
.stepper {
  margin-top: 16px; padding: 14px;
  background: var(--sunken); border: 1px solid var(--line); border-radius: 8px;
}
.stepper-head { display: flex; align-items: baseline; gap: 10px; font-size: 13.5px; }
.stepper-head .spacer { margin-left: auto; }
.stepper .meta { font-size: 12px; color: var(--muted); }

/* ---------------- hymn library ---------------- */
.hymn-row .num {
  flex: 0 0 auto; min-width: 42px;
  font-size: 12px; font-weight: 700; color: var(--gold);
}
.hymn-body {
  font-size: 12px; color: var(--muted); white-space: pre-line;
  max-height: 0; overflow: hidden; transition: max-height .2s ease;
}
.hymn-row.open .hymn-body { max-height: 400px; overflow-y: auto; margin-top: 8px; }

/* ============================================================
   Songs — library on the left, slides on the right

   Clicking a song loads the deck; clicking a slide is what puts
   something on air. Keeping those two apart is what makes it
   safe to look for the next hymn while one is still up.
   ============================================================ */
.song-split {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 16px;
  align-items: start;
}
@media (max-width: 900px) { .song-split { grid-template-columns: 1fr; } }

.song-list {
  max-height: 470px; overflow-y: auto; overscroll-behavior: contain;
  background: var(--sunken); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px;
}
.song-list .item { background: var(--panel); }
.song-list .item.loaded { border-left-color: var(--blue); }

.slides {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
  max-height: 470px; overflow-y: auto; overscroll-behavior: contain;
}
.slides .empty { grid-column: 1 / -1; }

.slide {
  display: flex; flex-direction: column; gap: 7px;
  padding: 11px 12px; min-height: 118px;
  background: var(--sunken); border: 1px solid var(--line);
  border-radius: 8px; cursor: pointer; text-align: left;
  font: inherit; color: var(--text);
}
.slide:hover { border-color: var(--blue); filter: none; }
/* Green for what is on screen right now, blue for where the deck is
   parked — the same distinction as a preview and a program bus. */
.slide.live { border-color: var(--green); box-shadow: 0 0 0 1px var(--green) inset; }

.slide .tag {
  font-size: 10.5px; letter-spacing: 1.2px; text-transform: uppercase;
  font-weight: 700; color: var(--gold);
}
.slide.live .tag { color: var(--green); }
.slide .words {
  font-size: 12px; line-height: 1.45; color: var(--muted);
  white-space: pre-line; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical;
}

/* Only the panel for the chosen kind of step is shown. */
.kind-panel { display: none; }
.kind-panel.on { display: block; }

/* ---------------- OBS ---------------- */
.scene-btn { margin: 0 7px 7px 0; }
.scene-btn.current { background: var(--blue); border-color: var(--blue); }
.obs-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%;
           background: var(--muted); margin-right: 6px; }
.obs-dot.on { background: var(--green); }

/* ---------------- tabs ---------------- */
.tabs {
  display: flex; gap: 2px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line); margin-bottom: 18px;
}
.tab {
  padding: 11px 18px; cursor: pointer;
  font: 600 14px 'Segoe UI', sans-serif;
  color: var(--muted); background: none; border: none;
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--blue); }
.page { display: none; }
.page.active { display: block; }

/* ---------------- cards ---------------- */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 20px; margin-bottom: 16px;
}
.card h2 {
  font-size: 12px; font-weight: 600; letter-spacing: 1.4px;
  text-transform: uppercase; color: var(--muted);
  margin-bottom: 14px; display: flex; align-items: center; gap: 10px;
}
.card h2 .spacer { margin-left: auto; }

/* ---------------- form controls ---------------- */
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
input[type=text], input[type=password], input[type=email],
input[type=number], input[type=datetime-local], select, textarea {
  width: 100%; padding: 11px 13px;
  background: var(--sunken); color: var(--text);
  border: 1px solid var(--line); border-radius: 7px; font: inherit;
}
textarea { resize: vertical; min-height: 76px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); }
.field + .field { margin-top: 13px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 13px; }
@media (max-width: 700px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

.row { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 16px; align-items: center; }

button, .btn {
  padding: 11px 18px; border: 1px solid var(--line); border-radius: 7px;
  background: #262e37; color: var(--text); text-decoration: none;
  font: 600 14px/1 'Segoe UI', sans-serif; cursor: pointer;
  transition: filter .15s; display: inline-block;
}
button:hover, .btn:hover  { filter: brightness(1.25); }
button:active { filter: brightness(0.9); }
button.primary { background: var(--blue); border-color: var(--blue); }
button.danger  { background: var(--red);  border-color: var(--red); }
button.go      { background: var(--green); border-color: var(--green); }
button.ghost   { background: transparent; color: var(--muted); }
button.sm      { padding: 6px 11px; font-size: 12px; }
button.big     { padding: 16px 30px; font-size: 17px; }

.hint { font-size: 12px; color: var(--muted); margin-top: 12px; }
.hint a { color: var(--blue); }
code {
  background: var(--sunken); padding: 1px 5px;
  border-radius: 4px; font-size: 12.5px; word-break: break-all;
}
kbd {
  background: var(--sunken); border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 4px; padding: 1px 6px; font: 12px monospace;
}

.checks { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 14px; }
.checks label {
  display: flex; align-items: center; gap: 7px;
  color: var(--text); font-size: 13.5px; margin: 0; cursor: pointer;
}
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--blue); cursor: pointer; }
input[type=range] { width: 100%; accent-color: var(--blue); }

/* ---------------- lists ---------------- */
.cat-title {
  font-size: 11px; letter-spacing: 1.3px; text-transform: uppercase;
  color: var(--gold); margin: 18px 0 8px; font-weight: 600;
}
.cat-title:first-child { margin-top: 0; }

.item {
  display: flex; align-items: center; gap: 10px;
  background: var(--sunken); border: 1px solid var(--line);
  border-left: 3px solid var(--gold); border-radius: 7px;
  padding: 10px 12px; margin-bottom: 7px;
}
.item.on-air { border-color: var(--green); border-left-color: var(--green); }
.item.done   { opacity: .5; border-left-color: var(--muted); }
.item.next   { border-left-color: var(--blue); box-shadow: 0 0 0 1px var(--blue) inset; }
.item .txt { flex: 1; min-width: 0; cursor: pointer; }
.item .txt b {
  display: block; font-size: 14.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.item .txt span {
  font-size: 12px; color: var(--muted); display: block;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.item .grip { color: var(--muted); font-size: 15px; cursor: grab; user-select: none; }
.item.dragging { opacity: .4; }
.item .meta { font-size: 11px; color: var(--muted); white-space: nowrap; }

.empty { color: var(--muted); font-size: 13.5px; padding: 8px 0; }

/* ---------------- import drop zone ---------------- */
.drop {
  border: 2px dashed var(--line); border-radius: 10px;
  padding: 30px 20px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--blue); background: rgba(26,122,184,.07); }
.drop b { display: block; font-size: 15px; margin-bottom: 4px; }
.drop span { font-size: 12.5px; color: var(--muted); }
input[type=file] { display: none; }

/* ---------------- notices ---------------- */
.notice { padding: 11px 13px; border-radius: 7px; font-size: 13px; margin-bottom: 14px; }
.notice.ok   { background: #16301b; border: 1px solid #2c6b36; color: #b6e8bf; }
.notice.warn { background: #3a2f18; border: 1px solid #6b5520; color: #f0d89a; }
.notice.bad  { background: #3a1e1c; border: 1px solid #7a3330; color: #f0b3ae; }

/* ---------------- preview pane ---------------- */
.preview {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  background: repeating-conic-gradient(#20262d 0% 25%, #1a1f25 0% 50%) 50% / 26px 26px;
  border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
}
.preview iframe {
  position: absolute; top: 0; left: 0;
  width: 1920px; height: 1080px; border: 0;
  transform-origin: top left;
}
.preview-note {
  font-size: 11.5px; color: var(--muted); margin-top: 8px;
  display: flex; align-items: center; gap: 8px;
}

/* ============================================================
   Program monitor — every graphic stacked, the way OBS sends it
   ============================================================ */
.monitor { background-color: #0d1013; }
.monitor.grey {
  background: #3a4048;
}
.monitor #monBackdrop {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
}
/* Layered in the order OBS stacks them: the picture at the back, the corner
   logo on top. Each is a real display page, transparent where it has nothing
   to draw, so the stack composites exactly as the stream will. */
.mon-layer {
  position: absolute; top: 0; left: 0;
  width: 1920px; height: 1080px; border: 0;
  transform-origin: top left;
  pointer-events: none;          /* the stack is for looking at, not clicking */
}

.mon-guides { position: absolute; inset: 0; pointer-events: none; }
.mon-guides .guide { position: absolute; border: 1px dashed rgba(247,222,110,.45); }
/* Percentages of the frame, so they hold at any scale. */
.mon-guides .action-safe { inset: 3.5%; }
.mon-guides .title-safe  { inset: 5%; border-color: rgba(247,222,110,.7); }
/* Where the lower third sits — the line a face should stay above. */
.mon-guides .third {
  left: 0; right: 0; top: 66.6%; bottom: auto; height: 0;
  border-width: 1px 0 0 0; border-color: rgba(26,122,184,.8);
}

/* ============================================================
   Scripture tab — compose on the left, the bible on the right
   ============================================================ */
.scripture-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
@media (max-width: 900px) {
  .scripture-split { grid-template-columns: 1fr; }
}

.bible-pane {
  height: 520px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}

/* Book list, grouped by testament */
.bible-book {
  display: flex; align-items: baseline; gap: 8px;
  width: 100%; text-align: left;
  padding: 8px 11px; margin-bottom: 3px;
  background: none; border: none; border-radius: 6px;
  color: var(--text); font: 500 14px 'Segoe UI', sans-serif;
  cursor: pointer;
}
.bible-book:hover { background: #232b33; filter: none; }
.bible-book .n { margin-left: auto; font-size: 11.5px; color: var(--muted); }

/* Chapter picker */
.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  gap: 6px;
}
.chapter-grid button {
  padding: 9px 0; font-size: 13px; font-weight: 600;
  background: #232b33; border-color: transparent;
}
.chapter-grid button.current {
  background: var(--blue); border-color: var(--blue);
}

/* Verse rows */
.verse-row {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 8px 9px; border-radius: 6px; margin-bottom: 2px;
  cursor: pointer;
}
.verse-row:hover { background: #232b33; }
.verse-row.picked { background: #1b3347; box-shadow: 0 0 0 1px var(--blue) inset; }
/* The verse actually on screen, marked the way a live song slide is. */
.verse-row.live { background: #16221a; box-shadow: 0 0 0 1px var(--green) inset; }
.verse-row.live .num { color: var(--green); }
.onair-tag {
  display: inline-block; margin-left: 8px; vertical-align: 1px;
  font-size: 10px; font-weight: 700; letter-spacing: 1px;
  color: var(--green); white-space: nowrap;
}
.verse-row .num {
  flex: 0 0 34px; text-align: right;
  font-size: 12px; font-weight: 700; color: var(--gold);
  padding-top: 2px;
}
.verse-row .txt { flex: 1; font-size: 14px; line-height: 1.5; }
.verse-row .add {
  flex: 0 0 auto; padding: 3px 9px; font-size: 13px; line-height: 1.2;
  background: transparent; border-color: var(--line); color: var(--muted);
  opacity: 0; transition: opacity .12s;
}
.verse-row:hover .add { opacity: 1; }

/* Search results carry their own reference */
.verse-row .ref {
  flex: 0 0 auto; font-size: 11.5px; font-weight: 700;
  color: var(--gold); padding-top: 3px; min-width: 92px;
}
.verse-row mark {
  background: rgba(247, 222, 110, .22);
  color: #ffeaa0; border-radius: 3px; padding: 0 2px;
}

.bible-section {
  font-size: 11px; letter-spacing: 1.3px; text-transform: uppercase;
  color: var(--gold); font-weight: 600;
  margin: 12px 0 7px; padding-left: 4px;
}
.bible-section:first-child { margin-top: 2px; }

.chapter-nav {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 10px;
}
.chapter-nav .spacer { margin-left: auto; }

/* ---------------- tables ---------------- */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11px; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--muted);
  padding: 0 10px 9px; font-weight: 600;
}
td { padding: 11px 10px; border-top: 1px solid var(--line); font-size: 14px; }
td.right, th.right { text-align: right; }
.pill {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600; letter-spacing: .4px;
}
.pill.admin    { background: #2a3f57; color: #9ecbf5; }
.pill.operator { background: #2b3239; color: var(--muted); }
.pill.off      { background: #40282a; color: #eaa8a3; }

dialog {
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 22px; width: min(480px, 92vw);
}
dialog::backdrop { background: rgba(0,0,0,.6); }

.errors { list-style: none; }
.errors li { color: #f0b3ae; font-size: 13px; }
