/* Control panel. freedomlv.church's own look: espresso, cream, Poppins, the orange-to-cyan gradient.
   Every input wears this style; nothing is left as a browser-default box. */

:root {
  --bg-0: #140f0b;
  --bg-1: #1c150d;
  --bg-2: #241a10;
  --line: rgba(247, 239, 226, .10);
  --line-2: rgba(247, 239, 226, .18);
  --cream: #f7efe2;
  --cream-dim: #d9cdb8;
  --muted: #a99b86;
  --orange: #ff8a1f;
  --orange-2: #ffb861;
  --green: #22c39a;
  --cyan: #37d6df;
  --red: #ff5a4e;
  --belong: linear-gradient(90deg, #ff8a1f 0%, #ffb861 30%, #22c39a 66%, #37d6df 100%);
  --r: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(120% 80% at 0% 0%, #2a1c10 0%, var(--bg-0) 55%) fixed, var(--bg-0);
  color: var(--cream);
  font: 500 15px/1.45 'Poppins', 'Segoe UI', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
kbd {
  font: 600 11px/1 'Poppins', sans-serif;
  padding: 3px 6px;
  border-radius: 5px;
  background: rgba(0, 0, 0, .22);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14);
  margin-left: 8px;
  letter-spacing: .02em;
}
kbd.arrow { font: 600 13px/1 system-ui, -apple-system, 'Segoe UI', sans-serif; padding: 2px 6px; }
:focus-visible { outline: 2px solid var(--orange-2); outline-offset: 2px; }

/* ---------------------------------------------------------------- bar */

.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: rgba(20, 15, 11, .92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .01em; white-space: nowrap; }
.brand img { display: block; }

.air {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex: 1;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(247, 239, 226, .05);
  box-shadow: inset 0 0 0 1px var(--line);
  font-weight: 600;
}
.air-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.air-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.air-time { margin-left: auto; color: var(--cream-dim); font-variant-numeric: tabular-nums; }
.air[data-on="true"] { background: rgba(255, 90, 78, .12); box-shadow: inset 0 0 0 1px rgba(255, 90, 78, .45); }
.air[data-on="true"] .air-dot { background: var(--red); box-shadow: 0 0 0 4px rgba(255, 90, 78, .22); }

.links { display: flex; gap: 8px; }
.chip {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px 5px 22px;
  border-radius: 999px;
  position: relative;
  color: var(--cream-dim);
  box-shadow: inset 0 0 0 1px var(--line);
  white-space: nowrap;
}
.chip::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -3.5px;
  border-radius: 50%;
  background: var(--muted);
}
.chip[data-state="ok"]::before { background: var(--green); }
.chip[data-state="wait"]::before { background: var(--orange-2); }
.chip[data-state="bad"]::before { background: var(--red); }

.seg { display: flex; padding: 3px; border-radius: 10px; background: rgba(247, 239, 226, .05); box-shadow: inset 0 0 0 1px var(--line); }
.seg button { border: 0; background: none; padding: 5px 10px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--cream-dim); }
.seg button[aria-pressed="true"] { background: var(--cream); color: var(--bg-0); }

.ghost {
  border: 0;
  border-radius: 10px;
  padding: 9px 14px;
  font-weight: 600;
  background: rgba(247, 239, 226, .06);
  box-shadow: inset 0 0 0 1px var(--line-2);
  color: var(--cream);
  white-space: nowrap;
}
.ghost:hover { background: rgba(247, 239, 226, .1); }
.ghost.small { padding: 6px 11px; font-size: 13px; }
.ghost.danger { color: #ffb3ad; }

/* ---------------------------------------------------------------- desk */

.desk {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
  min-height: 0;
}

.rundown {
  background: rgba(28, 21, 13, .7);
  border-radius: var(--r);
  box-shadow: inset 0 0 0 1px var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: calc(100vh - 100px);
  position: sticky;
  top: 80px;
}
.rundown-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 10px; }
.rundown-head h1 { margin: 0; font: 400 24px/1 'Anton', sans-serif; letter-spacing: .02em; }
.rundown-head h1 span { display: block; margin-top: 6px; font: 500 12px/1.2 'Poppins', sans-serif; letter-spacing: .02em; color: var(--muted); }
.list { list-style: none; margin: 0; padding: 0 8px 12px; overflow: auto; scrollbar-width: thin; scrollbar-color: rgba(247, 239, 226, .2) transparent; }
.list .sec {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--orange-2);
  padding: 14px 10px 6px;
}
.row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  padding: 10px 10px;
  border-radius: 10px;
  color: var(--cream);
}
.row:hover { background: rgba(247, 239, 226, .05); }
.row[aria-selected="true"] { background: rgba(247, 239, 226, .1); box-shadow: inset 0 0 0 1.5px rgba(255, 184, 97, .55); }
.row .k {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--cream-dim);
  padding: 4px 0 4px 8px;
  border-left: 3px solid var(--muted);
}
.row[data-theme="getup"] .k { border-color: #ffb45e; }
.row[data-theme="freedomlv"] .k { border-image: var(--belong) 1; }
.row .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.row .live {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
  color: #fff;
  background: var(--red);
  padding: 3px 7px;
  border-radius: 5px;
  visibility: hidden;
}
.row[data-on="true"] .live { visibility: visible; }
.row[data-edited="true"] .t::after { content: ' · edited'; color: var(--muted); font-size: 12px; }

.deck { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.monitors { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.desk[data-aspect="9x16"] .monitors { grid-template-columns: repeat(2, minmax(0, 300px)); }
.mon { margin: 0; min-width: 0; }
.mon figcaption { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 12px; }
.tag { font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; padding: 3px 8px; border-radius: 5px; }
.tag.pv { background: rgba(34, 195, 154, .16); color: #7be6c8; }
.tag.pg { background: rgba(255, 90, 78, .16); color: #ffb3ad; }
.note { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.screen {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: #000 url(/img/backdrop-16x9.jpg) center / cover;
  box-shadow: 0 0 0 1px var(--line-2), 0 10px 30px rgba(0, 0, 0, .35);
}
.desk[data-aspect="9x16"] .screen { aspect-ratio: 9 / 16; background-image: url(/img/backdrop-9x16.jpg); }
.screen > div { position: absolute; left: 0; top: 0; }

.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.take, .clear {
  border: 0;
  border-radius: 12px;
  padding: 14px 22px;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.take { background: var(--cream); color: var(--bg-0); box-shadow: 0 6px 18px rgba(0, 0, 0, .3); }
.take:hover { background: #fff; }
.take:active { transform: translateY(1px); }
.clear { background: rgba(255, 90, 78, .14); color: #ffb3ad; box-shadow: inset 0 0 0 1.5px rgba(255, 90, 78, .45); }
.take kbd { background: rgba(20, 15, 11, .1); box-shadow: inset 0 0 0 1px rgba(20, 15, 11, .2); }

.auto { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--cream-dim); }

/* the house select: no browser box */
.select { position: relative; display: inline-block; }
.select select {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: 10px;
  padding: 9px 36px 9px 13px;
  background: var(--bg-2);
  box-shadow: inset 0 0 0 1px var(--line-2);
  color: var(--cream);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.select select:focus-visible { outline: 2px solid var(--orange-2); outline-offset: 2px; }
.select::after {
  content: '';
  position: absolute;
  right: 14px;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -6px;
  border-right: 2px solid var(--cream-dim);
  border-bottom: 2px solid var(--cream-dim);
  transform: rotate(45deg);
  pointer-events: none;
}
.select option { background: var(--bg-1); color: var(--cream); }

/* ---------------------------------------------------------------- editor */

.editor {
  background: rgba(28, 21, 13, .7);
  border-radius: var(--r);
  box-shadow: inset 0 0 0 1px var(--line);
  padding: 16px;
}
.editor-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.editor-head h2 { margin: 0 auto 0 0; font-size: 15px; font-weight: 700; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field > span { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; }
.field > span em { font-style: normal; letter-spacing: 0; text-transform: none; font-weight: 500; }
.field input, .field textarea {
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 11px 13px;
  background: var(--bg-2);
  box-shadow: inset 0 0 0 1px var(--line-2);
  color: var(--cream);
  font-size: 15px;
  outline: none;
  resize: vertical;
}
.field textarea { min-height: 92px; line-height: 1.45; }
.field input:focus, .field textarea:focus { box-shadow: inset 0 0 0 1.5px var(--orange-2), 0 0 0 3px rgba(255, 184, 97, .15); }
.field input::placeholder, .field textarea::placeholder { color: rgba(217, 205, 184, .4); }
.fit-note { margin: 12px 0 0; font-size: 13px; color: #ffb3ad; }

/* ---------------------------------------------------------------- setup */

.setup {
  border: 0;
  padding: 0;
  width: min(720px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  border-radius: 18px;
  background: var(--bg-1);
  color: var(--cream);
  box-shadow: 0 0 0 1px var(--line-2), 0 30px 80px rgba(0, 0, 0, .6);
}
.setup::backdrop { background: rgba(10, 7, 5, .7); }
.setup-inner { padding: 22px 24px 26px; display: grid; gap: 22px; }
.setup-head { display: flex; align-items: center; justify-content: space-between; }
.setup h2 { margin: 0; font: 400 28px/1 'Anton', sans-serif; letter-spacing: .02em; }
.setup h3 { margin: 0 0 6px; font-size: 15px; }
.setup p { margin: 0 0 10px; color: var(--cream-dim); font-size: 14px; }
.setup .muted, .muted { color: var(--muted); font-size: 13px; }
.copy { display: flex; gap: 8px; margin-bottom: 8px; }
.copy input {
  flex: 1;
  min-width: 0;
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--bg-2);
  box-shadow: inset 0 0 0 1px var(--line-2);
  color: var(--cyan);
  font: 500 13px/1.2 ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
}
.phone { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 18px; align-items: start; }
.phone-qr { background: #fffaf2; border-radius: 14px; padding: 10px; aspect-ratio: 1; }
.phone-qr svg { display: block; width: 100%; height: 100%; }

.sheet-bar { display: none; }

/* ---------------------------------------------------------------- phone */

@media (max-width: 900px) {
  .bar { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .air { order: 5; flex-basis: 100%; }
  .links { display: none; }
  .desk { grid-template-columns: 1fr; padding: 12px 12px 110px; gap: 12px; }
  /* phone order: what is on the screen, then the rundown to pick from, then the editor */
  .deck { display: contents; }
  .monitors { order: 1; }
  .actions { order: 2; }
  .rundown { order: 3; }
  .editor { order: 4; }
  .monitors { grid-template-columns: 1fr; }
  .mon:nth-child(2) { display: none; }
  .desk[data-aspect="9x16"] .monitors { grid-template-columns: minmax(0, 220px); justify-content: center; }
  .desk { flex: none; min-height: auto; }
  .rundown { position: static; max-height: none; min-height: auto; }
  .list { overflow: visible; }
  .actions .take, .actions .clear, .actions kbd { display: none; }
  .auto { margin-left: 0; }
  .fields { grid-template-columns: 1fr; }
  .phone { grid-template-columns: 1fr; }
  .phone-qr { max-width: 200px; }
  .sheet-bar {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 10px;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    padding: 12px 12px max(12px, env(safe-area-inset-bottom));
    background: rgba(20, 15, 11, .94);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(10px);
  }
  .sheet-bar .take, .sheet-bar .clear { padding: 18px; font-size: 18px; }
  .sheet-sel { grid-column: 1 / -1; font-size: 13px; color: var(--cream-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sheet-sel b { color: var(--cream); font-weight: 600; }
}
