/* Run of show: shared dark styles for the producer console and the crew view */
@font-face { font-family: 'Anton'; src: url('../fonts/anton-400.woff2') format('woff2'); font-display: block; }
@font-face { font-family: 'Inter'; src: url('../fonts/inter-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('../fonts/inter-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }
:root { --bg: #0B0B0C; --panel: #151517; --panel2: #1B1B1E; --line: #2A2A2F; --text: #EDEDED; --dim: #8B8B93; --blue: #1F4FE0; --orange: #F59B00; --red: #FF3B30; --green: #2ECC71; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 500 14px/1.45 'Inter', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
body { overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
input:focus-visible, button:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.lbl { margin: 0 0 8px; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }
.hide, [hidden] { display: none !important; }

/* Top bar */
.top { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 10px 18px; border-bottom: 1px solid var(--line); background: rgba(11, 11, 12, .94); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; }
.brand img { width: 24px; height: 24px; }
.code { font: 400 24px/1 'Anton', sans-serif; letter-spacing: .14em; user-select: all; }
.status { display: flex; align-items: center; gap: 6px; color: var(--dim); font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: none; }
.lost .dot { background: var(--red); }

/* Buttons and fields */
.b { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); font-weight: 700; font-size: 13px; text-decoration: none; white-space: nowrap; }
.b:hover { border-color: #55555c; }
.b:active { transform: translateY(1px); }
.b:disabled { opacity: .4; cursor: default; }
.b-blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.b-go { min-height: 64px; padding: 0 22px; font-size: 18px; letter-spacing: .06em; text-transform: uppercase; background: var(--green); border-color: var(--green); color: #000; }
.b-hold { background: var(--orange); border-color: var(--orange); color: #000; }
.b-red { background: transparent; border-color: rgba(255, 59, 48, .5); color: #FF7A72; }
.b.on { background: var(--text); border-color: var(--text); color: #000; }
.ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.f { display: block; width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: #0E0E10; }
textarea.f { height: auto; min-height: 70px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
select.f { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%), linear-gradient(-45deg, transparent 50%, var(--dim) 50%); background-position: calc(100% - 16px) 17px, calc(100% - 11px) 17px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.fl { display: block; margin: 0 0 5px; font-size: 11px; color: var(--dim); }
.card { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }

/* Now / next */
.now { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 18px; align-items: end; }
.now-kicker { grid-column: 1 / -1; margin: 0; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--green); }
.now-title { margin: 0; font-size: clamp(20px, 2.4vw, 30px); font-weight: 700; line-height: 1.15; }
.now-who { margin: 2px 0 0; color: var(--dim); }
.now-clock { text-align: right; }
.now-clock .big { display: block; font: 400 clamp(54px, 7vw, 96px)/.9 'Anton', sans-serif; font-variant-numeric: tabular-nums; }
.now-clock small { color: var(--dim); font-size: 12px; }
.is-warn .now-clock .big { color: var(--orange); }
.is-over .now-clock .big { color: var(--red); }
.held .now-clock .big { opacity: .5; }
.bar { grid-column: 1 / -1; height: 6px; margin-top: 10px; border-radius: 6px; background: #26262b; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--green); transition: width .25s linear; }
.is-warn .bar i { background: var(--orange); }
.is-over .bar i { width: 100% !important; background: var(--red); }
.now-cues { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.next-line { margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--line); color: var(--dim); }
.next-line b { color: var(--text); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.stat { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.stat span { display: block; font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }
.stat b { display: block; margin-top: 2px; font: 400 24px/1.1 'Anton', sans-serif; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.stat .over { color: #FF7A72; } .stat .under { color: var(--green); }

/* Rundown list */
.rs-list { position: relative; list-style: none; margin: 0; padding: 0; }
.rs-row { display: grid; grid-template-columns: 88px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 12px 14px; border-bottom: 1px solid var(--line); border-left: 3px solid transparent; }
.rs-row.is-done { opacity: .45; }
.rs-row.is-current { border-left-color: var(--green); background: rgba(46, 204, 113, .09); opacity: 1; }
.rs-row.is-next { border-left-color: rgba(245, 155, 0, .7); }
.rs-row.is-mine { box-shadow: inset 3px 0 0 var(--orange); }
.rs-row.is-current.is-mine { box-shadow: none; }
.rs-row[aria-selected="true"], .rs-head[aria-selected="true"] { outline: 2px solid var(--blue); outline-offset: -2px; }
.rs-time { display: flex; flex-direction: column; gap: 2px; color: var(--dim); font-size: 12px; font-variant-numeric: tabular-nums; }
.rs-num { color: var(--text); font: 400 20px/1 'Anton', sans-serif; }
.rs-title { margin: 0; font-size: 15px; font-weight: 700; }
.rs-who { margin-left: 6px; color: var(--dim); font-weight: 500; }
.rs-notes { margin: 3px 0 0; color: #b6b6bd; font-size: 13px; white-space: pre-wrap; }
.rs-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.rs-chips:empty { display: none; }
.rs-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; text-align: right; font-variant-numeric: tabular-nums; }
.rs-dur { font-weight: 700; }
.rs-act { font-size: 11px; color: var(--dim); }
.rs-act.over { color: #FF7A72; } .rs-act.under { color: var(--green); }
.rs-edit { padding: 3px 9px; border: 1px solid var(--line); border-radius: 6px; background: none; color: var(--dim); font-size: 12px; font-weight: 700; }
.rs-edit:hover { color: var(--text); border-color: #55555c; }
.rs-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 14px 8px; border-bottom: 1px solid var(--line); color: var(--orange); font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.rs-empty { padding: 24px 14px; color: var(--dim); }
.cue { display: inline-block; max-width: 100%; padding: 3px 8px; border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); border-radius: 6px; background: color-mix(in srgb, var(--c) 10%, transparent); font-size: 12px; }
.cue b { margin-right: 5px; color: var(--c); font-weight: 700; white-space: nowrap; }
.cue.is-mine { background: color-mix(in srgb, var(--c) 26%, transparent); border-color: var(--c); }
.tag { display: inline-block; padding: 3px 8px; border-radius: 100px; background: color-mix(in srgb, var(--c) 18%, transparent); color: var(--c); font-size: 11px; font-weight: 700; }

/* Filters */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chip { padding: 5px 11px; border: 1px solid var(--line); border-radius: 100px; background: none; color: var(--dim); font-size: 12px; font-weight: 700; }
.chip.on { background: var(--text); border-color: var(--text); color: #000; }

/* Messages */
.msgs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 92%; padding: 8px 11px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); }
.msg.is-me { align-self: flex-end; background: rgba(31, 79, 224, .22); border-color: rgba(31, 79, 224, .5); }
.msg.is-alert { border-color: var(--orange); background: rgba(245, 155, 0, .14); }
.m-meta { margin: 0 0 2px; font-size: 11px; color: var(--dim); }
.m-meta time { margin-left: 4px; }
.m-role { margin-left: 2px; padding: 1px 6px; border-radius: 4px; background: color-mix(in srgb, var(--c, #9CA3AF) 20%, transparent); color: var(--c, #ddd); font-weight: 700; }
.m-to { color: var(--dim); }
.m-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.quick .b { min-height: 32px; padding: 0 10px; font-weight: 500; }
.send-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px; }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: 20px; max-width: min(520px, calc(100% - 24px)); transform: translateX(-50%); padding: 12px 16px; border-radius: 10px; background: var(--text); color: #000; font-weight: 700; opacity: 0; pointer-events: none; transition: opacity .2s; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.toast.show { opacity: 1; pointer-events: auto; }
.toast.alert { background: var(--orange); }
.flash-screen { animation: flashscreen .9s ease-out 2; }
@keyframes flashscreen { 0% { box-shadow: inset 0 0 0 6px var(--orange); } 100% { box-shadow: inset 0 0 0 0 transparent; } }

/* View switch */
.view-switch { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: #0E0E10; }
.view-switch button { padding: 5px 12px; border: 0; border-radius: 6px; background: none; color: var(--dim); font-size: 12px; font-weight: 700; }
.view-switch button.on { background: var(--text); color: #000; }

/* Grid view: a classic run-of-show spreadsheet */
.rs-grid-wrap { overflow: auto; max-height: calc(100vh - 170px); overscroll-behavior: contain; }
.rs-grid { position: relative; min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; line-height: 1.4; }
.rs-grid th { position: sticky; top: 0; z-index: 3; padding: 9px 10px; background: #1D1D21; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); color: var(--dim); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; text-align: left; white-space: nowrap; }
.rs-grid th.g-role { color: var(--c); box-shadow: inset 0 3px 0 var(--c); }
.rs-grid td { min-width: 130px; max-width: 280px; padding: 0; border-bottom: 1px solid var(--line); border-right: 1px solid rgba(255, 255, 255, .06); vertical-align: top; background: var(--panel); }
.rs-grid .g-cell { min-height: 100%; padding: 8px 10px; white-space: pre-wrap; overflow-wrap: anywhere; outline: none; }
.rs-grid .g-cell[contenteditable]:hover { background: rgba(255, 255, 255, .03); cursor: text; }
.rs-grid .g-cell[contenteditable]:focus { background: #0E0E10; box-shadow: inset 0 0 0 2px var(--blue); }
.rs-grid .g-num { position: sticky; left: 0; z-index: 2; min-width: 56px; width: 56px; padding: 8px 8px 8px 10px; font: 400 17px/1.2 'Anton', sans-serif; white-space: nowrap; border-left: 3px solid transparent; }
.rs-grid th.g-num { z-index: 4; font: 700 11px/1 'Inter', sans-serif; }
.rs-grid .g-time { min-width: 74px; width: 74px; padding: 8px 10px; color: var(--dim); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rs-grid .g-dur { min-width: 72px; width: 72px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rs-grid .g-dur .rs-act { display: block; padding: 0 10px 8px; font-weight: 500; }
.rs-grid .g-title { min-width: 200px; font-weight: 700; }
.rs-grid .g-notes { min-width: 220px; color: #b6b6bd; }
.rs-grid td.is-mycol, .rs-grid th.is-mycol { background: color-mix(in srgb, var(--c) 16%, var(--panel)); }
.rs-grid th.is-mycol { background: color-mix(in srgb, var(--c) 24%, #1D1D21); }
.rs-grid td.g-role .g-cell:not(:empty) { color: color-mix(in srgb, var(--c) 35%, #fff); }
.rs-grid tr.is-done td { opacity: .45; }
.rs-grid tr.is-current td { background: color-mix(in srgb, #2ECC71 14%, var(--panel)); opacity: 1; }
.rs-grid tr.is-current td.g-num { border-left-color: var(--green); }
.rs-grid tr.is-next td.g-num { border-left-color: rgba(245, 155, 0, .8); }
.rs-grid tr[aria-selected="true"] td { box-shadow: inset 0 1px 0 var(--blue), inset 0 -1px 0 var(--blue); }
.rs-grid tr.g-head td { background: #121214; color: var(--orange); font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.rs-grid tr.g-head td.g-num { font: inherit; }
.rs-grid .tag { margin: 6px 0 0 8px; }
.rs-grid td:last-child { padding-bottom: 6px; }

/* Drag to reorder (producer) */
.drag { display: inline-block; margin-right: 6px; padding: 0 2px; color: #5c5c64; font: 700 13px/1 'Inter', sans-serif; letter-spacing: -3px; cursor: grab; touch-action: none; user-select: none; vertical-align: middle; }
.drag:hover { color: var(--text); }
.rs-time .drag { margin: 0 0 4px; }
.dragging { opacity: .35; }
.drop-line { position: fixed; z-index: 60; height: 3px; border-radius: 2px; background: var(--blue); box-shadow: 0 0 0 3px rgba(31, 79, 224, .25); pointer-events: none; }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select: none; }
.rs-time .drag { align-self: flex-start; }
