:root {
  color-scheme: dark;
  --bg: #0c0c0c;
  --surface: #151515;
  --surface-2: #1b1b1b;
  --line: #2f2f2f;
  --text: #ededed;
  --muted: #b0b0b0;
  --blue-row: #2b4dd0;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, system-ui, sans-serif; background: var(--bg); color: var(--text); }
.app { padding: 8px; min-height: 100vh; }
input, button, select { background: #1b1b1b; color: var(--text); border: 1px solid var(--line); border-radius: 3px; font-size: 12px; padding: 6px 8px; }
button { cursor: pointer; }
button:hover { background: #242424; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.top-left { display: grid; gap: 6px; }
.room-title-input { background: transparent; border: none; font-size: 24px; padding: 0; min-width: 320px; }
.top-nav { display: flex; gap: 6px; }
.nav-btn, .mini-btn { height: 28px; min-width: 70px; }
.nav-btn.active { background: #101010; border-color: #3f3f3f; }
.nav-btn.muted { color: #8c8c8c; }
.top-right { display: flex; gap: 6px; }
.user-label {
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--muted);
  font-size: 12px;
}
.grid { display: grid; grid-template-columns: 300px 1fr; gap: 10px; }
.left, .right { display: grid; gap: 8px; align-content: start; }
.card { background: linear-gradient(180deg, var(--surface), var(--surface-2)); border: 1px solid var(--line); border-radius: 3px; padding: 6px; }
.dashboard-panel { margin-bottom: 10px; padding: 10px; }
.dashboard-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.dashboard-sub { margin: 0 0 8px; font-size: 12px; color: var(--muted); }
.saved-session-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.saved-session-item { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 4px; background: #171717; }
.saved-session-item.active-session { border-color: #5e80f1; box-shadow: 0 0 0 1px rgba(94, 128, 241, 0.5); }
.saved-session-meta { display: grid; gap: 2px; }
.saved-session-name { font-size: 13px; font-weight: 600; }
.saved-session-time { font-size: 11px; color: var(--muted); }
.saved-session-actions { display: flex; gap: 6px; }
.users-toolbar { display: flex; gap: 6px; }
.users-toolbar input { min-width: 180px; }
.users-access-wrap { overflow-x: auto; }
.users-access-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.users-access-table th,
.users-access-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.users-access-table td select { min-width: 110px; }
.card.active-pulse { box-shadow: 0 0 0 2px rgba(98, 132, 236, 0.65); transition: box-shadow 140ms ease; }
.preview { position: relative; overflow: hidden; }
.preview-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.preview-label { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.preview-select-wrap select { width: 110px; height: 24px; }
.countdown { font-size: 84px; line-height: 1; font-weight: 700; letter-spacing: 1px; margin: 6px 0; text-align: center; }
.cue-title {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: #bfc7d4;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-align: center;
}
.countdown.warn-yellow { color: #d6a543; }
.countdown.warn-red { color: #d24a4a; }
.countdown.warn-red.blink-60bpm { animation: red-blink-60bpm 1s steps(1, end) infinite; }
.message-banner { display: block; width: fit-content; margin: 0 auto 4px; font-size: 11px; color: #d7efd8; background: #28412d; padding: 2px 6px; border-radius: 3px; text-align: center; }
.message-banner.white { background: #f2f2f2; color: #111; }
.message-banner.red { background: #b43838; color: #fff3f3; }
.message-banner.green { background: #28412d; color: #d7efd8; }
.message-banner.bold { font-weight: 700; }
.preview-time-graphic {
  position: relative;
  height: 28px;
  margin: 6px 2px 8px;
}

.time-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 20px;
  background: #232626;
  border: 1px solid #3a3d3d;
  border-radius: 4px;
}

.time-zones {
  position: absolute;
  left: 1px;
  bottom: 1px;
  height: 18px;
  width: calc(100% - 2px);
  display: flex;
  overflow: hidden;
  border-radius: 0 3px 3px 0;
}

.zone.green { background: #5fc865; width: 80%; }
.zone.yellow { background: #d4a244; width: 13.3333%; }
.zone.red { background: #c8534d; width: 6.6667%; }

.time-marker {
  position: absolute;
  bottom: 22px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 10px solid #f1f1f1;
  filter: drop-shadow(0 1px 0 #111);
  transform: translateX(-50%);
  left: 0%;
  transition: left 100ms linear;
}
.timestamp-row { display: flex; flex-wrap: wrap; gap: 6px; font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.timestamp-row.compact { justify-content: space-between; }
.timeline-card { padding-top: 8px; padding-bottom: 8px; }
#playhead, progress { width: 100%; }
progress { height: 6px; }
.transport-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.transport-row button { height: 30px; }
.nudge-row { display: grid; grid-template-columns: 1fr auto; gap: 5px; margin-top: 5px; }
.on-air-row { margin-top: 5px; display: flex; justify-content: flex-start; }
#btn-on-air { min-width: 80px; }
#btn-on-air.active { background: #8f2727; border-color: #aa3a3a; color: #ffdede; }
.live-connections { font-size: 14px; padding: 10px; }
.output-links .link-row { display: grid; grid-template-columns: 54px 1fr auto; gap: 4px; margin-bottom: 4px; }
.timers { min-height: calc(100vh - 90px); }
.timers-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.timers-title-row { display: flex; gap: 8px; align-items: center; }
.mini-inline { height: 24px; font-size: 11px; }
h2 { margin: 0; font-size: 18px; font-weight: 600; }
.timer-actions button { height: 28px; }
.bulk-actions { display: flex; gap: 6px; margin-bottom: 8px; }
.timer-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.timer-item { background: #171717; border: 1px solid #323232; border-radius: 4px; padding: 10px; display: grid; grid-template-columns: 1fr auto; align-items: center; }
.timer-item.current { background: #1f4b2a; border-color: #2f6e3e; }
.timer-item.current.running { background: #7a2424; border-color: #a03434; }
.timer-main { display: flex; gap: 16px; align-items: center; }
.timer-main-edit { gap: 8px; }
.timer-main-edit input,
.timer-main-edit select { height: 28px; padding: 4px 6px; min-width: 90px; }
.timer-main-edit input[data-field="title"] { min-width: 180px; }
.timer-index { opacity: .8; font-size: 13px; min-width: 10px; }
.timer-extra { color: #87a6ff; font-size: 14px; }
.timer-title { font-size: 16px; font-weight: 600; }
.timer-meta { font-size: 18px; font-weight: 700; }
.timer-buttons { display: flex; gap: 5px; }
.timer-buttons button { width: 30px; height: 26px; padding: 0; }
.timer-item.current .timer-buttons button { background: #1b1f1b; }
.timer-item.current.running .timer-buttons button { background: #2a1b1b; }
.timer-item.selected { outline: 2px solid #d5a13f; }
.legacy-hidden, .help, #column-splitter { display: none !important; }
.message-row label { display: inline-flex; gap: 4px; align-items: center; font-size: 11px; color: var(--muted); }
.message-toggle-btn {
  min-width: 78px;
  font-weight: 700;
}
.message-toggle-btn.active {
  background: #9e2d2d;
  border-color: #c44646;
  color: #fff3f3;
}
.hidden { display: none !important; }
.flash-overlay, .blackout-overlay { position: absolute; inset: 0; z-index: 20; pointer-events: none; border-radius: 2px; }
.flash-overlay { background: white; opacity: 0; }
.flash-overlay.active { animation: flash 280ms linear 3; }
.blackout-overlay { background: black; display: grid; place-items: center; }
dialog { border: 1px solid var(--line); border-radius: 6px; background: #171717; color: var(--text); width: min(440px, 90vw); }
#timer-form { display: grid; gap: 10px; }
menu { display: flex; justify-content: flex-end; gap: 8px; margin: 0; padding: 0; }
.auth-form {
  display: grid;
  gap: 10px;
}
.auth-sub {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}
.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.timer-settings-form { display: grid; gap: 12px; }
#timer-settings-dialog { width: min(588px, 94vw); background: #1a1b1c; border-color: #2f2f2f; }
.settings-header { display: flex; justify-content: space-between; align-items: center; }
.settings-close-btn { width: 36px; height: 36px; }
.settings-meta { display: grid; gap: 8px; }
.settings-meta textarea { resize: vertical; min-height: 60px; background: #111; border: 1px solid var(--line); color: var(--text); border-radius: 4px; padding: 8px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.settings-grid fieldset { border: 1px solid var(--line); border-radius: 6px; padding: 10px; display: grid; gap: 8px; }
.settings-grid legend { padding: 0 6px; color: #d4d4d4; font-weight: 700; }
.duration-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.wrapup-section { border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 8px; }
.wrapup-section h4 { margin: 0; font-size: 14px; }
.wrapup-bar { display: grid; grid-template-columns: 3fr 1fr 0.5fr; height: 14px; border-radius: 3px; overflow: hidden; border: 1px solid #333; }
.wrapup-bar .start { background: #4ea36d; }
.wrapup-bar .yellow { background: #d4a244; }
.wrapup-bar .red { background: #c8534d; }
.wrapup-rows { display: grid; gap: 6px; }
.wrapup-row { display: grid; grid-template-columns: auto 1fr 1fr 1fr; gap: 8px; align-items: center; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot.green { background: #4ea36d; }
.dot.red { background: #c8534d; }
.settings-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#settings-confirm-btn { background: #125f3b; border-color: #1f8a57; }
#settings-confirm-btn:hover { background: #167247; }

/* Settings dialog polish */
#timer-settings-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(1px);
}

#timer-settings-dialog {
  padding: 0;
  overflow: hidden;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.5);
  max-height: calc(100vh - 24px);
}

.timer-settings-form {
  gap: 8px;
  padding: 10px;
  max-height: calc(100vh - 24px);
  overflow: hidden;
}

.settings-header {
  padding-bottom: 6px;
  border-bottom: 1px solid #2a2a2a;
}

.settings-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.settings-close-btn {
  border-radius: 999px;
  width: 34px;
  min-width: 34px;
  padding: 0;
}

.settings-meta,
.settings-grid fieldset,
.wrapup-section {
  background: #171819;
}

.settings-meta {
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 8px;
  gap: 6px;
  grid-template-columns: 1fr 1fr;
}

.settings-meta label:nth-child(1),
.settings-meta label:nth-child(2),
.settings-meta label:nth-child(3),
.settings-meta label:nth-child(4) {
  grid-column: auto;
}

.settings-meta label:nth-child(3),
.settings-meta label:nth-child(4) {
  grid-column: 1 / -1;
}

.settings-meta label,
.settings-grid label,
.wrapup-row label {
  display: grid;
  gap: 2px;
  font-size: 11px;
  color: #b8bcc4;
}

.settings-meta input,
.settings-meta textarea,
.settings-grid input,
.settings-grid select,
.wrapup-row input,
.wrapup-row select {
  height: 30px;
  border-radius: 6px;
  background: #121313;
  border: 1px solid #303236;
  color: #ececec;
}

.settings-meta textarea {
  min-height: 54px;
  height: auto;
}

.settings-grid { gap: 8px; }

.settings-grid fieldset {
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 8px;
  gap: 6px;
}

.settings-grid legend {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #aeb3bb;
}

.duration-row { gap: 6px; }

.wrapup-section {
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 8px;
  gap: 6px;
}

.wrapup-row {
  grid-template-columns: auto 1fr 1fr 1fr;
  gap: 6px;
}

.settings-actions { margin-top: 2px; }

.settings-actions button {
  height: 34px;
  border-radius: 8px;
  font-size: 14px;
}
@keyframes flash { 0%,100% { opacity: 0; } 50% { opacity: .8; } }
@keyframes red-blink-60bpm { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0.35; } }
@media (max-width: 980px) { .grid { grid-template-columns: 1fr; } .countdown { font-size: 64px; } }
