/* PlayFM Music Desk
   Palette: PlayFM Dublin brand (playfmdublin.com). Near-black ink, PlayFM pink for
   "on air" and actions, periwinkle for scheduled shows, amber for problems. */
:root {
  --ink: #050508;
  --panel: #0e0e16;
  --panel-2: #16161f;
  --line: #26263a;
  --paper: #f4f4f8;
  --mute: #9a9aab;
  --tally: #ff0066;
  --mint: #9e9eff;
  --alarm: #ffb020;
  --wave: #3a3a52;

  /* Roboto, as on playfmdublin.com: headings in Black (900), capitals, tight spacing */
  --display: 'Roboto', system-ui, sans-serif;
  --body: 'Roboto', system-ui, sans-serif;
  --mono: 'Roboto Mono', ui-monospace, monospace;
  --r: 10px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--ink);
  color: var(--paper);
  font: 15px/1.45 var(--body);
  min-height: 100vh;
}
body.has-player { padding-bottom: 84px; }
h2, h3, h4 { margin: 0; font-weight: 600; }
small { font-size: 12.5px; }
.muted { color: var(--mute); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.right { text-align: right; }
.empty { color: var(--mute); padding: 18px 0; margin: 0; }
.warn { color: var(--alarm); margin: 0; }
:focus-visible { outline: 2px solid var(--tally); outline-offset: 2px; }

/* ---------- wordmark ---------- */
.wordmark {
  font-family: var(--display);
  font-weight: 900;
  font-size: 24px;
  letter-spacing: -.02em;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
}
.wordmark span { color: var(--tally); }

/* ---------- buttons ---------- */
.btn {
  font: 600 14px var(--body);
  border-radius: 999px;
  padding: 9px 16px;
  border: 1px solid transparent;
  cursor: pointer;
  color: var(--paper);
  background: none;
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-primary { background: var(--tally); color: #fff; }
.btn-primary:hover { background: #ff3385; }
.btn-ghost { border-color: var(--line); }
.btn-ghost:hover { border-color: var(--mute); background: var(--panel-2); }
.btn-danger { color: var(--alarm); }
.btn:disabled { opacity: .4; cursor: default; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--paper);
  font-size: 16px; cursor: pointer; flex: none;
}
.icon-btn:hover { border-color: var(--tally); color: var(--tally); }
.link { background: none; border: 0; color: var(--paper); font: inherit; cursor: pointer; padding: 0; text-align: left; }
.link:hover { color: var(--tally); text-decoration: underline; }

/* ---------- header ---------- */
.top {
  display: flex; align-items: center; gap: 24px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
}
.tallies { display: flex; align-items: center; gap: 10px; flex: 1; justify-content: center; flex-wrap: wrap; }
.tally {
  display: grid; grid-template-columns: auto auto; column-gap: 8px; align-items: center;
  padding: 6px 14px 6px 10px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel);
}
.tally i {
  grid-row: span 2;
  width: 12px; height: 12px; border-radius: 50%;
  background: #2c2c3a;
}
.tally b { font-family: var(--display); font-weight: 900; font-size: 14px; text-transform: uppercase; letter-spacing: .01em; line-height: 1; }
.tally small { color: var(--mute); font-size: 11.5px; }
.tally.is-on { border-color: var(--tally); }
.tally.is-on i { background: var(--tally); box-shadow: 0 0 0 4px rgba(255, 0, 102, .2), 0 0 14px var(--tally); animation: glow 2.4s ease-in-out infinite; }
.tally.is-on b { color: var(--tally); }
@keyframes glow { 50% { box-shadow: 0 0 0 6px rgba(255, 0, 102, .08), 0 0 22px var(--tally); } }
.listeners { display: flex; flex-direction: column; align-items: center; padding: 0 8px; }
.listeners span { font-family: var(--display); font-size: 22px; font-weight: 900; line-height: 1; }
.listeners small { color: var(--mute); font-size: 11px; }
.top-right { display: flex; align-items: center; gap: 16px; }
.clock { font-family: var(--mono); font-size: 18px; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.clock small { font-family: var(--body); color: var(--mute); font-size: 11px; }
.top form { margin: 0; }

/* ---------- programme ribbon (signature) ---------- */
.ribbon-wrap { padding: 18px 24px 8px; }
.ribbon-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.ribbon-head h2 { font-family: var(--display); font-size: 17px; font-weight: 900; text-transform: uppercase; letter-spacing: -.01em; }
.legend { color: var(--mute); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 10px; border-radius: 2px; display: inline-block; margin-left: 10px; }
.lg-show { background: var(--mint); }
.lg-random { background: repeating-linear-gradient(135deg, #22222e 0 3px, #191923 3px 6px); }
.ribbon {
  position: relative; height: 56px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: repeating-linear-gradient(135deg, #1b1b27 0 4px, #13131c 4px 9px);
  overflow: hidden;
}
.ribbon::before { /* hour grid */
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .06) 0 1px, transparent 1px calc(100% / 24));
  pointer-events: none;
}
.rb-block {
  position: absolute; top: 6px; bottom: 6px;
  background: var(--mint); color: #12123a;
  border: 0; border-radius: 6px;
  font: 600 12.5px var(--body);
  padding: 0 8px; text-align: left; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  cursor: pointer;
}
.rb-block span { overflow: hidden; text-overflow: ellipsis; display: block; }
.rb-block:hover { filter: brightness(1.08); }
.rb-block.is-clash { box-shadow: inset 0 -4px 0 var(--alarm); }
.rb-block.is-skipped { background: transparent; color: var(--mute); outline: 1px dashed var(--mute); text-decoration: line-through; }
.rb-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--tally); transition: left 1s linear; box-shadow: 0 0 10px var(--tally); }
.rb-now span {
  position: absolute; top: 2px; left: 5px;
  font: 500 10px var(--mono); text-transform: uppercase; color: var(--tally);
  background: var(--ink); padding: 0 4px; border-radius: 3px;
}
.ribbon-hours { position: relative; height: 18px; font: 11px var(--mono); color: var(--mute); }
.ribbon-hours span { position: absolute; transform: translateX(-50%); top: 3px; }
.ribbon-hours span:first-child { transform: none; }
.ribbon-hours span:last-child { transform: translateX(-100%); }

/* ---------- now / next ---------- */
.nowbar {
  margin: 8px 24px 0;
  display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr) 160px; gap: 24px; align-items: center;
  padding: 14px 18px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
}
.eyebrow { font: 500 10.5px var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--mute); margin-bottom: 4px; }
.nb-track { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.nb-track strong, .nb-next strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-track small, .nb-next small { color: var(--mute); white-space: nowrap; }
.kind { font: 500 10.5px var(--mono); text-transform: uppercase; padding: 2px 7px; border-radius: 4px; flex: none; }
.kind-show { background: var(--mint); color: #12123a; }
.kind-random { background: var(--line); color: var(--paper); }
.meter { height: 6px; background: var(--ink); border-radius: 3px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--mint); border-radius: 3px; transition: width .3s; }
.meter i.is-low { background: var(--alarm); }
.nb-disk small { color: var(--mute); }

/* ---------- on air deck ---------- */
.deck { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding-right: 24px; border-right: 1px solid var(--line); }
.deck .eyebrow { margin-bottom: 0; }
.deck-title { font-size: 18px; font-weight: 700; }
.deck-progress { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; margin: 8px 0 4px; }
.deck-progress .mono { color: var(--mute); font-variant-numeric: tabular-nums; }
.deck-meter { height: 8px; background: var(--panel-2); }
.deck-meter i { background: var(--tally); transition: width 1s linear; }
.deck-controls, .deck-pick { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.deck-pick select { flex: 1 1 220px; min-width: 0; }
.deck-note { color: var(--mute); font-size: 12px; }
.upnext { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.upnext li { display: grid; grid-template-columns: 52px auto minmax(0, 1fr) auto; gap: 8px; align-items: center; font-size: 13.5px; }
.upnext .un-at { color: var(--paper); font-variant-numeric: tabular-nums; }
.upnext .un-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upnext small { color: var(--mute); }
.upnext li.is-booked { padding-top: 8px; border-top: 1px dashed var(--line); }
.upnext li.is-booked .un-title { font-weight: 700; }
.deck button[aria-pressed="true"] { border-color: var(--tally); color: var(--tally); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; padding: 20px 24px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button {
  font: 600 14px var(--body); color: var(--mute);
  background: none; border: 0; padding: 10px 14px; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs button:hover { color: var(--paper); }
.tabs button.is-active { color: var(--paper); border-bottom-color: var(--tally); }
main { padding: 20px 24px 40px; }

/* ---------- schedule ---------- */
.schedule { display: grid; grid-template-columns: 280px 1fr; gap: 20px; }
.library { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; align-self: start; position: sticky; top: 12px; }
.lib-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.search, input, select, textarea {
  width: 100%; font: 14px var(--body); color: var(--paper);
  background: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px;
}
input:focus, select:focus, textarea:focus { border-color: var(--tally); outline: none; }
.lib-list { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; max-height: 60vh; overflow-y: auto; }
.lib-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px; border-radius: 8px; border: 1px solid transparent;
  cursor: grab; background: var(--panel-2);
}
.lib-item:hover { border-color: var(--mint); }
.lib-item:active { cursor: grabbing; }
.lib-meta { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.lib-meta strong { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-meta small { color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art {
  width: 40px; height: 40px; border-radius: 6px; flex: none;
  background: linear-gradient(135deg, #3a0a24, #141428) center / cover no-repeat;
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 900; color: var(--mint); font-size: 16px;
}
.art-lg { width: 100%; height: auto; aspect-ratio: 1; border-radius: 8px; font-size: 44px; position: relative; }

.cal-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; min-width: 0; }
.upcoming { grid-column: 1 / -1; }
.upcoming h3, .history h3 { font-family: var(--display); font-weight: 900; font-size: 17px; text-transform: uppercase; letter-spacing: -.01em; margin-bottom: 10px; }
.up-row {
  display: grid; grid-template-columns: 150px 1fr auto; gap: 16px; align-items: center;
  padding: 10px 0; border-top: 1px solid var(--line);
}
.up-when { display: flex; flex-direction: column; font-family: var(--mono); font-size: 13px; }
.up-when span { color: var(--mute); }
.up-what { display: flex; flex-direction: column; min-width: 0; }
.up-what small { color: var(--mute); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.up-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.up-row.is-skipped .up-what strong { text-decoration: line-through; color: var(--mute); }
.tag { font: 500 11px var(--mono); padding: 2px 7px; border-radius: 4px; background: var(--panel-2); border: 1px solid var(--line); color: var(--paper); }
.tag-alarm { border-color: var(--alarm); color: var(--alarm); background: rgba(255, 176, 32, .08); }

/* FullCalendar theme */
.fc { --fc-border-color: var(--line); --fc-page-bg-color: var(--panel); --fc-neutral-bg-color: var(--panel-2);
      --fc-today-bg-color: rgba(255, 0, 102, .06); --fc-now-indicator-color: var(--tally);
      --fc-event-bg-color: var(--mint); --fc-event-border-color: var(--mint); --fc-event-text-color: #12123a;
      --fc-list-event-hover-bg-color: var(--panel-2); --fc-highlight-color: rgba(158, 158, 255, .18);
      font-size: 13px; }
.fc .fc-toolbar-title { font-family: var(--display); font-weight: 900; font-size: 19px; text-transform: uppercase; letter-spacing: -.01em; }
.fc .fc-button { background: var(--panel-2); border-color: var(--line); color: var(--paper); font: 600 13px var(--body); text-transform: none; border-radius: 8px; box-shadow: none !important; }
.fc .fc-button:hover { background: var(--line); }
.fc .fc-button-primary:not(:disabled).fc-button-active, .fc .fc-button-primary:not(:disabled):active { background: var(--tally); border-color: var(--tally); color: #fff; }
.fc .fc-col-header-cell-cushion, .fc .fc-timegrid-slot-label-cushion { font-family: var(--mono); font-size: 11.5px; color: var(--mute); }
.fc .fc-day-today .fc-col-header-cell-cushion { color: var(--tally); }
.fc-event { border-radius: 6px; cursor: pointer; }
.fc .ev { padding: 2px 4px; line-height: 1.25; overflow: hidden; }
.fc .ev b { display: block; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc .ev small { font-family: var(--mono); font-size: 10.5px; opacity: .8; }
.fc .ev-weekly { background: repeating-linear-gradient(135deg, var(--mint) 0 10px, #8a8af0 10px 20px); }
.fc .is-clash { box-shadow: inset 4px 0 0 var(--alarm); }
.fc .is-skipped { background: transparent !important; border: 1px dashed var(--mute) !important; opacity: .7; }
.fc .is-skipped .ev { color: var(--mute); text-decoration: line-through; }
.fc .is-missed, .fc .is-error { box-shadow: inset 0 0 0 2px var(--alarm); }
.fc .is-sent { opacity: .65; }
.fc .fc-list-event-title, .fc .fc-list-event-time { color: var(--paper); }
.fc .fc-list-day-cushion { background: var(--panel-2); }

/* ---------- uploads ---------- */
.drop {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  padding: 26px; border: 1.5px dashed var(--line); border-radius: var(--r);
  background: var(--panel); cursor: pointer; transition: border-color .15s, background .15s;
}
.drop strong { font-family: var(--display); font-weight: 900; font-size: 18px; text-transform: uppercase; letter-spacing: -.01em; }
.drop span { color: var(--mute); font-size: 13px; }
.drop:hover, .drop.is-over { border-color: var(--tally); background: var(--panel-2); }
.uploads { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.upload { display: grid; grid-template-columns: minmax(0, 1fr) 200px 180px; gap: 12px; align-items: center; font-size: 13px; }
.upload > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload small { color: var(--mute); }
.upload.is-error small { color: var(--alarm); }
.upload.is-error .meter i { background: var(--alarm); }
.upload.is-done small { color: var(--mint); }

/* ---------- shows grid ---------- */
.show-grid { margin-top: 20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.show-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.show-card h4 { font-size: 16px; line-height: 1.25; }
.sc-body { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.sc-body .mono { color: var(--mute); }
.desc { margin: 0; font-size: 13px; color: #c9c9d6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.sc-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.play-fab {
  position: absolute; right: 10px; bottom: 10px;
  width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: var(--tally); color: #fff; font-size: 16px; cursor: pointer;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .35);
  opacity: .92;
}
.play-fab:hover { opacity: 1; transform: scale(1.05); }

/* ---------- backup table ---------- */
.intro { margin: 0 0 12px; }
.table { width: 100%; border-collapse: collapse; margin-top: 18px; }
.table th { font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--mute); text-align: left; padding: 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }

/* ---------- history ---------- */
.hist-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; }
.hist { list-style: none; margin: 0; padding: 0; }
.hist li { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.hist li .mono { color: var(--mute); min-width: 120px; }
.hist li.is-problem span:last-child { color: var(--mute); }

/* ---------- player ---------- */
.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 24px; background: #0a0a10; border-top: 1px solid var(--line);
}
.play-toggle { width: 44px; height: 44px; background: var(--tally); color: #fff; border: 0; }
.play-toggle:hover { color: #fff; }
.pl-meta { display: flex; flex-direction: column; width: 220px; min-width: 0; }
.pl-meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.pl-meta small { color: var(--mute); }
.wave { flex: 1; min-width: 0; }

/* ---------- dialogs ---------- */
.dlg {
  width: min(480px, calc(100vw - 32px));
  background: var(--panel); color: var(--paper);
  border: 1px solid var(--line); border-radius: 14px; padding: 22px;
}
.dlg::backdrop { background: rgba(5, 5, 8, .75); backdrop-filter: blur(3px); }
.dlg h3 { font-family: var(--display); font-weight: 900; font-size: 20px; text-transform: uppercase; letter-spacing: -.01em; margin-bottom: 14px; }
.dlg form { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.dlg label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 500; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button { font: 600 13px var(--body); border: 0; border-radius: 999px; padding: 8px; background: none; color: var(--mute); cursor: pointer; }
.seg button.is-active { background: var(--tally); color: #fff; }
.hint { margin: 0; padding: 10px 12px; background: var(--ink); border-radius: 8px; color: var(--mint); font-size: 13px; }
.hint:empty { display: none; }
.form-error { margin: 0; color: var(--alarm); font-size: 13px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.dlg-actions.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.edit-art { display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: end; }
.edit-art .art-lg { width: 96px; font-size: 30px; }
.edit-art label { align-self: end; justify-self: start; flex-direction: row; }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
body.has-player .toasts { bottom: 92px; }
.toast { background: var(--paper); color: var(--ink); padding: 10px 14px; border-radius: 8px; font-weight: 500; font-size: 14px; max-width: 360px; box-shadow: 0 10px 24px rgba(0, 0, 0, .35); }
.toast.is-error { background: var(--alarm); color: #2a1a00; }

/* ---------- login ---------- */
body.login { display: grid; place-items: center; padding: 16px; background:
  repeating-linear-gradient(135deg, #0f0f17 0 6px, var(--ink) 6px 14px); }
.login-card { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.login-card .wordmark { font-size: 34px; }
.login-card form { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.login-card label { font-size: 13px; font-weight: 500; }
.login-card .btn { justify-content: center; margin-top: 6px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .nowbar { grid-template-columns: 1fr 1fr; }
  .deck { grid-column: 1 / -1; padding-right: 0; border-right: 0; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
}
@media (max-width: 860px) {
  .top { flex-wrap: wrap; gap: 12px; padding: 14px 16px; }
  .tallies { order: 3; flex-basis: 100%; justify-content: flex-start; }
  .top-right { margin-left: auto; }
  .ribbon-wrap { padding: 14px 16px 6px; }
  .nowbar { margin: 6px 16px 0; grid-template-columns: 1fr; gap: 12px; }
  .tabs { padding: 14px 16px 0; }
  main { padding: 16px 16px 40px; }
  .schedule { grid-template-columns: 1fr; }
  .library { position: static; }
  .lib-list { max-height: 260px; }
  .up-row { grid-template-columns: 1fr; gap: 6px; }
  .up-actions { justify-content: flex-start; }
  .hist-cols { grid-template-columns: 1fr; }
  .upload { grid-template-columns: 1fr; gap: 4px; }
  .player { padding: 10px 16px; gap: 10px; }
  .pl-meta { width: 110px; }
  .fc .fc-toolbar { flex-direction: column; gap: 8px; }
  .wordmark { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
