/* /admin — the clipboard. Phone first; two columns on a laptop. */

.admin { padding-bottom: calc(120px + env(safe-area-inset-bottom)); }
.admin .toast { bottom: calc(96px + env(safe-area-inset-bottom)); } /* sit above the live bar */
@media (max-width: 560px) { .admin .toast { bottom: calc(150px + env(safe-area-inset-bottom)); } }

/* ------------------------------ top bar ------------------------------ */

.topbar {
  display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; justify-content: space-between;
  width: min(100% - 32px, 76rem); margin: 0 auto; padding: 22px 0 18px;
  border-bottom: 2px solid var(--ink);
}
.topbar__title { font: italic 400 clamp(1.4rem, 5vw, 2rem)/1.05 var(--display); text-transform: uppercase; color: var(--ink); margin-top: 6px; }
.topbar__meta { color: var(--muted); font-style: italic; }
.topbar__nav { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu__pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 16rem;
  display: grid; padding: 6px;
  background: var(--card); border: 2px solid var(--ink); border-radius: 8px; box-shadow: 6px 6px 0 var(--rule);
}
.menu__pop a { padding: 10px 12px; border-radius: 5px; text-decoration: none; font-weight: 600; color: var(--ink); }
.menu__pop a small { display: block; font-weight: 400; font-style: italic; color: var(--muted); }
.menu__pop a:hover, .menu__pop a:focus-visible { background: var(--rule-soft); }

/* ------------------------------ grid ------------------------------ */

.grid {
  display: grid; gap: 18px; align-items: start;
  width: min(100% - 32px, 76rem); margin: 18px auto 0;
}
@media (min-width: 960px) {
  .grid { grid-template-columns: minmax(0, 1fr) 23rem; gap: 24px; }
}
.col-side > .card + .card, .col-main > .card + .card { margin-top: 18px; }

/* ------------------------------ switches ------------------------------ */

.switches { display: grid; gap: 14px; }
@media (min-width: 640px) { .switches { grid-template-columns: 1fr 1fr; } .stats { grid-column: 1 / -1; } }

.switch { display: flex; gap: 12px; align-items: center; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track {
  position: relative; flex: none; width: 58px; height: 34px; border-radius: 999px;
  background: var(--paper-2); border: 2px solid var(--ink); transition: background .2s;
}
.switch__track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--ink); transition: transform .2s ease, background .2s;
}
.switch input:checked + .switch__track { background: var(--btn-bg); border-color: var(--btn-edge); }
.switch input:checked + .switch__track::after { transform: translateX(24px); background: var(--btn-fg); }
.switch input:focus-visible + .switch__track { outline: 3px solid var(--focus); outline-offset: 2px; }
.switch__text { display: grid; line-height: 1.25; }
.switch__text b { color: var(--ink); }
.switch__text small { color: var(--muted); font-style: italic; }

.stats { display: flex; flex-wrap: wrap; gap: 6px 18px; padding-top: 12px; border-top: 1px solid var(--rule); font-size: .95rem; color: var(--muted); }
.stats b { color: var(--ink); font-variant-numeric: tabular-nums; }
.stats .drift.is-late b { color: var(--warn); }

.progress { display: flex; gap: 12px; align-items: center; }
@media (min-width: 640px) { .progress { grid-column: 1 / -1; } }
.progress__bar { flex: 1; height: 10px; border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; background: var(--paper); }
.progress__bar span { display: block; height: 100%; width: 0; background: var(--ok); transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.progress__text { flex: none; font-size: .9rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ------------------------------ list ------------------------------ */

.list-head { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; }
.list-hint { margin-top: 10px; font-size: .9rem; font-style: italic; color: var(--muted); }
.list-hint b { font-style: normal; color: var(--ink); }

.quick-add { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; padding: 12px; border: 2px dashed var(--rule); border-radius: 8px; }
.quick-add .input { flex: 1 1 10rem; }

.rows { margin: 16px 0 0; padding: 0; list-style: none; }
.rows--plain { margin-top: 8px; }

.row {
  display: grid; grid-template-columns: 34px 2.4rem minmax(0, 1fr) auto; gap: 4px 10px; align-items: center;
  padding: 9px 6px 9px 0;
  border-bottom: 1px solid var(--rule-soft);
  background: var(--card);
  transition: background .2s, box-shadow .2s;
}
.row:first-child { border-top: 1px solid var(--rule-soft); }
.row.is-dragging { position: relative; z-index: 5; background: var(--paper-2); box-shadow: 0 10px 24px -10px var(--shadow); border-radius: 6px; }
.row.is-now { background: color-mix(in srgb, var(--live) 12%, var(--card)); box-shadow: inset 4px 0 0 var(--live); }
.row.is-done { background: color-mix(in srgb, var(--ok) 7%, var(--card)); }
.row.is-done .row__num, .row.is-done .row__main, .row.is-done .row__handle { opacity: .5; }
.row.is-done .row__name { text-decoration: line-through; text-decoration-thickness: .08em; }
.row.is-break .row__name { font-style: italic; }
.row.is-flash { animation: row-flash 1.4s ease; }
@keyframes row-flash { from { background: color-mix(in srgb, var(--gold) 45%, var(--card)); } }

.row__handle {
  display: grid; place-items: center; width: 34px; height: 44px; padding: 0; border: 0; background: none;
  color: var(--muted); font-size: 1.2rem; cursor: grab; touch-action: none; -webkit-user-select: none; user-select: none;
}
.row__handle:active { cursor: grabbing; }
.rows--plain .row { grid-template-columns: 0 2.4rem minmax(0, 1fr) auto; }
.rows--plain .row__handle { visibility: hidden; width: 0; }

.row__num { text-align: right; font: italic 400 1.15rem/1 var(--display); color: var(--ink); font-variant-numeric: tabular-nums; }
.row__num small { display: block; margin-top: 3px; font: 400 .72rem/1 var(--body); color: var(--muted); font-style: normal; white-space: nowrap; }

.row__main { min-width: 0; cursor: pointer; border: 0; background: none; padding: 0; text-align: left; }
.row__name { font-size: 1.12rem; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.row__sub { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: .86rem; color: var(--muted); }
.row__note { font-size: .86rem; font-style: italic; color: var(--text); overflow-wrap: anywhere; }

.tag { display: inline-block; padding: 0 .45em; border: 1px solid currentColor; border-radius: 3px; font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.tag--first { color: var(--ok); }
.tag--late { color: var(--warn); }
.tag--lock { color: var(--gold); }
.tag--now { color: var(--live); }

.row__tools { display: flex; gap: 4px; align-items: center; }
.icon-btn {
  display: grid; place-items: center; width: 38px; height: 38px; padding: 0;
  border: 2px solid var(--rule); border-radius: 50%; background: transparent; color: var(--ink);
  font-size: .95rem; cursor: pointer;
}
.icon-btn:hover { border-color: var(--ink); }
.icon-btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.icon-btn:disabled { opacity: .3; cursor: default; }
/* On a phone: drag the handle to move people, tick to mark done. Arrows and lock live in the edit sheet / on bigger screens. */
@media (max-width: 520px) {
  .row__tools .hide-sm { display: none; }
  .list-card { padding-inline: 12px; }
  .row { grid-template-columns: 30px 2.1rem minmax(0, 1fr) auto; gap: 4px 8px; }
  .row__handle { width: 30px; }
}

/* the big tick: done / not done */
.done-btn {
  display: grid; place-items: center; flex: none; width: 46px; height: 46px; margin-left: 4px; padding: 0;
  border: 2px solid var(--ink); border-radius: 50%; background: transparent; color: var(--ink);
  font: 700 1.25rem/1 var(--body); cursor: pointer;
  transition: background .15s, color .15s, transform .12s;
}
.done-btn:hover { background: var(--rule-soft); }
.done-btn:active { transform: scale(.92); }
.done-btn[aria-pressed="true"] { background: var(--ok); border-color: var(--ok); color: #fff; }
.done-btn.is-pop { animation: pop .35s ease; }
@keyframes pop { 50% { transform: scale(1.18); } }

.empty { margin-top: 16px; color: var(--muted); font-style: italic; }
.sub-head { margin-top: 22px; }

/* ------------------------------ settings ------------------------------ */

.settings > summary {
  display: flex; gap: 10px; align-items: center; justify-content: space-between;
  cursor: pointer; list-style: none;
}
.settings > summary::-webkit-details-marker { display: none; }
.settings > summary::after {
  content: ""; flex: none; width: 10px; height: 10px; margin: 0 4px 4px 0;
  border-right: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink);
  transform: rotate(45deg); transition: transform .2s;
}
.settings[open] > summary::after { transform: rotate(-135deg); margin-bottom: -4px; }
.settings > summary .card__title { white-space: nowrap; }
.settings__status { margin-left: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: .82rem; font-style: italic; color: var(--muted); white-space: nowrap; }
.settings__status.is-saved { color: var(--ok); }
.settings__status.is-bad { color: var(--live); }
.settings form { margin-top: 6px; }

.group { margin: 0; padding: 18px 0 0; border: 0; border-top: 1px solid var(--rule); }
.group + .group { margin-top: 20px; }
.group > legend { float: left; width: 100%; padding: 0; margin-bottom: 4px; color: var(--ink); }
.group > legend + * { clear: both; }
.group .field { margin-top: 12px; }
.group > .field__hint { margin-top: 4px; }
.group .linkish { margin-top: 6px; padding-left: 0; text-align: left; }
.field-row { display: flex; gap: 10px; }
.field-row > .field { flex: 1 1 0; min-width: 0; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin-top: 12px; }
.settings .check input, .sheet .check input { width: 20px; height: 20px; }
.prefix--sm > span { left: 10px; font-size: 1rem; }
.prefix--sm > .input { padding-left: 26px; }

/* ------------------------------ wrap up and past shows ------------------------------ */

.past { margin: 8px 0 0; padding: 0; list-style: none; }
.past li + li { border-top: 1px solid var(--rule-soft); }
.past button {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center;
  width: 100%; padding: 10px 4px; border: 0; background: none; text-align: left; cursor: pointer; border-radius: 6px;
}
.past button:hover, .past button:focus-visible { background: var(--rule-soft); }
.past b { font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.past small { grid-column: 1; font-size: .86rem; font-style: italic; color: var(--muted); }
.past i { grid-row: 1 / span 2; grid-column: 2; font-style: normal; color: var(--muted); }
.past .more { width: auto; margin-top: 6px; padding: 6px 4px; display: inline; color: var(--ink); text-decoration: underline; font-size: .9rem; }

.past-rows { margin: 14px 0 0; padding: 0; list-style: none; max-height: min(50vh, 26rem); overflow: auto; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.past-rows li { display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 7px 4px; border-bottom: 1px solid var(--rule-soft); }
.past-rows li:last-child { border-bottom: 0; }
.past-rows .n { text-align: right; font: italic 400 1rem/1 var(--display); color: var(--ink); }
.past-rows .who { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.past-rows .who small { display: block; font-weight: 400; font-size: .85rem; color: var(--muted); }
.past-rows .st { font-size: .8rem; font-style: italic; color: var(--muted); white-space: nowrap; }
.past-rows .is-done .st { color: var(--ok); font-style: normal; font-weight: 700; }
.past-rows .is-out { opacity: .55; }

/* ------------------------------ live bar ------------------------------ */

.livebar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; gap: 10px 16px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 10px max(16px, calc((100% - 76rem) / 2)) calc(10px + env(safe-area-inset-bottom));
  color: #f3e3c4; background: #1d0b12; border-top: 3px solid var(--btn-bg);
  box-shadow: 0 -10px 30px -12px rgba(0, 0, 0, .5);
  --ink: #f3e3c4; --muted: #b9a092; --rule: rgba(243, 227, 196, .3); --focus: #f6d77c;
}
.livebar__now { display: grid; min-width: 0; flex: 1 1 12rem; }
.livebar__now .eyebrow { color: #f6d77c; }
.livebar__name { font: 400 1.6rem/1.1 var(--script); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.livebar__next { font-size: .86rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.livebar__timer { display: grid; justify-items: center; padding: 4px 12px; border-radius: 8px; font: italic 400 1.7rem/1 var(--display); font-variant-numeric: tabular-nums; transition: background .3s, color .3s; }
.livebar__timer small { font: 400 .74rem/1.3 var(--body); color: var(--muted); }
.livebar__timer.is-light { background: #f6d77c; color: #2a1408; }
.livebar__timer.is-light small { color: #5a3a10; }
.livebar__timer.is-over { background: #c22a46; color: #fff; animation: over 1s steps(2) infinite; }
.livebar__timer.is-over small { color: #ffe1e6; }
@keyframes over { 50% { background: #7b1730; } }
.livebar__btns { display: flex; gap: 8px; align-items: center; }
.livebar .btn--ghost { color: #f3e3c4; }
.livebar__go { min-width: 9.5rem; min-height: 48px; font-size: .95rem; }

/* ------------------------------ edit sheet ------------------------------ */

.sheet {
  width: min(100% - 24px, 30rem); max-height: calc(100dvh - 24px); padding: 22px 20px;
  color: var(--text); background: var(--card);
  border: 2px solid var(--ink); border-radius: 10px; box-shadow: 8px 8px 0 var(--rule);
}
.sheet--wide { width: min(100% - 24px, 36rem); }
.sheet::backdrop { background: rgba(30, 8, 14, .55); }
.sheet .field { margin-top: 14px; }
.sheet .card__sub { margin-top: 6px; }
.sheet__lead { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--rule); font-weight: 600; color: var(--ink); }
.sheet__btns { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 20px; }
.sheet__danger { margin-left: auto; color: var(--live); }

/* "TV feed & pics" in the top bar: crowd pictures waiting for the okay (signup/feedbadge.js). */
.navbadge { display: inline-grid; place-items: center; min-width: 1.5em; height: 1.5em; padding: 0 .35em; margin-left: .45em; font: 700 .8em/1 var(--body); font-style: normal; color: #fff; background: var(--live); border-radius: 999px; animation: nudge 2s ease-in-out infinite; }
@keyframes nudge { 0%, 80%, 100% { transform: none; } 88% { transform: scale(1.18); } }

/* Phones: the screen links become one swipeable row instead of three rows of buttons,
   and the Print menu opens as a sheet at the bottom so the scrolling row can't clip it. */
@media (max-width: 640px) {
  .topbar { padding: 14px 0 10px; gap: 8px; }
  .topbar__nav {
    flex-wrap: nowrap; overflow-x: auto; width: calc(100% + 32px); margin: 0 -16px; padding: 4px 16px 8px;
    scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
  }
  .topbar__nav::-webkit-scrollbar { display: none; }
  .topbar__nav > * { flex: none; }
  .menu[open] .menu__pop {
    position: fixed; left: 12px; right: 12px; top: auto; bottom: calc(108px + env(safe-area-inset-bottom));
    width: auto; z-index: 70; box-shadow: 0 -10px 40px rgba(0, 0, 0, .35), 6px 6px 0 var(--rule);
  }
  .menu__pop a { padding: 14px 12px; }
}

/* The TV's music, on the clipboard and /admin/tv (signup/musiccard.js, signup/tvadmin.js). */
.music-card { border-color: var(--gold, #b78d3a); }
.mc-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin-top: 14px; }
.mc-row .field { margin-top: 0; }
.mc-row input[type=range] { width: 100%; accent-color: var(--btn-bg); }
.mc-row output { font-weight: 400; font-style: italic; color: var(--muted); }
.music-now { margin-top: 10px; font-size: .9rem; font-style: italic; color: var(--muted); }
@media (max-width: 480px) { .mc-row { grid-template-columns: 1fr; } }
