:root {
  --bg: #0d1117; --panel: #161b22; --panel2: #1c2330; --line: #2a3240; --text: #e6edf3; --muted: #8b96a5;
  --accent: #3b82f6; --red: #ef4444; --green: #22c55e; --amber: #f59e0b; --radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--accent); }
.hidden { display: none !important; }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input[type=checkbox] { width: auto; }
label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; }
label input, label select, label textarea { color: var(--text); font-size: 14px; }
label.inline { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }

.btn { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn.danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn.go { background: var(--green); border-color: var(--green); color: #04130a; font-weight: 600; }
.btn.rec { background: var(--red); border-color: var(--red); color: white; font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.small { padding: 3px 8px; font-size: 12px; }
.btn.big { padding: 12px 22px; font-size: 16px; }
.btn:disabled { opacity: .4; cursor: default; }
.icon { background: none; border: none; color: var(--muted); cursor: pointer; padding: 2px 5px; border-radius: 4px; font-size: 14px; }
.icon:hover { color: var(--text); background: var(--panel2); }

.top { display: flex; align-items: center; gap: 14px; padding: 8px 16px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.brand small { font-weight: 400; color: var(--muted); }
.brand.big { font-size: 26px; justify-content: center; margin-bottom: 10px; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.on { background: var(--red); box-shadow: 0 0 10px var(--red); animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
nav { display: flex; gap: 2px; flex-wrap: wrap; }
nav a { padding: 6px 10px; border-radius: 6px; color: var(--muted); text-decoration: none; cursor: pointer; }
nav a:hover { color: var(--text); background: var(--panel2); }
nav a.active { color: var(--text); background: var(--panel2); box-shadow: inset 0 -2px var(--accent); }
.spacer { flex: 1; }
.clock { font-variant-numeric: tabular-nums; font-size: 18px; font-weight: 600; }
main { padding: 16px; max-width: 1400px; margin: 0 auto; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card h3 { margin: 0 0 12px; font-size: 15px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { margin-left: auto; }
.mt { margin-top: 16px; }
h2 { margin: 0 0 14px; font-size: 20px; display: flex; align-items: center; gap: 10px; }
h2 .row { margin-left: auto; }

.login { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { width: 340px; display: flex; flex-direction: column; gap: 12px; }
.err { color: var(--red); min-height: 1em; }

table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); }
table.t td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:hover td { background: rgba(255,255,255,.02); }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.chip { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px; font-weight: 600; color: #fff; margin-right: 3px; }
.tag { display: inline-block; padding: 0 5px; border-radius: 4px; font-size: 11px; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); margin-left: 4px; }
.warn { color: var(--amber); }

/* on air */
.onair { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.now { padding: 22px; }
.now .label { text-transform: uppercase; letter-spacing: .1em; font-size: 11px; color: var(--muted); }
.now .artist { font-size: 30px; font-weight: 700; margin-top: 6px; }
.now .title { font-size: 22px; color: var(--muted); margin-bottom: 18px; }
.bar { height: 10px; background: var(--panel2); border-radius: 5px; overflow: hidden; position: relative; }
.bar > div { height: 100%; background: var(--accent); }
.bar .intro { position: absolute; top: 0; bottom: 0; background: rgba(34,197,94,.35); }
.times { display: flex; justify-content: space-between; margin-top: 6px; font-variant-numeric: tabular-nums; }
.times .big { font-size: 28px; font-weight: 700; }
.introcount { color: var(--green); font-weight: 700; }
.live-banner { background: var(--red); color: white; padding: 10px 14px; border-radius: 6px; font-weight: 700; margin-bottom: 12px; }
.up-list .item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); align-items: center; }
.up-list .time { width: 48px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* log */
.hours { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; margin-bottom: 12px; }
.hours button { padding: 6px 0; background: var(--panel); border: 1px solid var(--line); border-radius: 5px; cursor: pointer; font-variant-numeric: tabular-nums; position: relative; font-size: 12px; }
.hours button.active { background: var(--accent); border-color: var(--accent); color: white; }
.hours button.now { box-shadow: inset 0 -3px var(--red); }
.hours button .badge { position: absolute; top: -5px; right: -3px; background: var(--amber); color: #000; border-radius: 6px; font-size: 9px; padding: 0 3px; }
.hours button .badge.vt { background: var(--red); color: white; left: -3px; right: auto; }
tr.log-played td { opacity: .45; }
tr.log-skipped td { opacity: .3; text-decoration: line-through; }
tr.log-playing td { background: rgba(239,68,68,.13) !important; }
tr.log-queued td { background: rgba(59,130,246,.10); }
tr.log-marker td { background: var(--panel2); color: var(--amber); font-weight: 600; }
tr.log-vt td { background: rgba(168,85,247,.08); }
tr.dragging { opacity: .4; }
tr.dropbefore td { border-top: 2px solid var(--accent); }
.handle { cursor: grab; color: var(--muted); user-select: none; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: flex-start; justify-content: center; z-index: 50; padding: 40px 16px; overflow: auto; }
.modal-box { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 20px; width: 100%; max-width: 720px; }
.modal-box.wide { max-width: 1000px; }
.modal-box h3 { margin: 0 0 14px; display: flex; align-items: center; }
.modal-box .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 8px; z-index: 60; }
.toast.bad { border-color: var(--red); color: #fecaca; }

/* clocks */
.clocks { display: grid; grid-template-columns: 240px 1fr 300px; gap: 16px; align-items: start; }
.clock-list .c { padding: 8px 10px; border-radius: 6px; cursor: pointer; display: flex; gap: 8px; align-items: center; }
.clock-list .c:hover { background: var(--panel2); }
.clock-list .c.active { background: var(--panel2); box-shadow: inset 3px 0 var(--accent); }
.swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex: none; }
.slot { display: flex; gap: 8px; align-items: center; padding: 5px 6px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 4px; background: var(--panel2); }
.slot select, .slot input { padding: 3px 6px; }

/* grid */
.gridtable { border-collapse: collapse; width: 100%; }
.gridtable td, .gridtable th { border: 1px solid var(--line); padding: 0; text-align: center; font-size: 11px; height: 24px; }
.gridtable th { color: var(--muted); font-weight: 500; padding: 4px; }
.gridtable td { cursor: pointer; user-select: none; overflow: hidden; white-space: nowrap; max-width: 120px; padding: 0 4px; }
.palette { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.palette .p { padding: 5px 10px; border-radius: 6px; border: 2px solid transparent; cursor: pointer; background: var(--panel2); display: flex; gap: 6px; align-items: center; }
.palette .p.active { border-color: var(--text); }

/* vt */
.vt-side { background: var(--panel2); border-radius: 8px; padding: 12px; }
.meter { height: 14px; background: var(--bg); border-radius: 7px; overflow: hidden; }
.meter > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--green) 70%, var(--amber) 85%, var(--red)); transition: width 60ms; }
.wave { width: 100%; height: 90px; background: var(--bg); border-radius: 6px; cursor: crosshair; display: block; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 10px; }
pre.log { background: var(--bg); padding: 10px; border-radius: 6px; max-height: 320px; overflow: auto; font-size: 11px; white-space: pre-wrap; }
.codebox { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 10px; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }

@media (max-width: 900px) {
  .onair, .grid2, .clocks { grid-template-columns: 1fr; }
  .grid3, .grid4 { grid-template-columns: 1fr 1fr; }
  .hours { grid-template-columns: repeat(12, 1fr); }
}
h2 .row { font-size: 14px; font-weight: 400; }
.row label.inline { margin-right: 10px; }
.dot.ok { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dot.bad { background: var(--red); }
label input, label select { width: 100%; min-width: 0; }
