:root {
  color-scheme: dark;
  --bg: #071019;
  --panel: #121d28;
  --panel2: #0e1822;
  --line: #294158;
  --line2: #35516a;
  --text: #f7fbff;
  --muted: #a9bdd2;
  --blue: #159bd3;
  --green: #22c55e;
  --green2: #10883a;
  --yellow: #facc15;
  --amber: #9f7a05;
  --red: #ef4444;
  --red2: #8e1d28;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Bahnschrift, "Segoe UI", sans-serif;
}

.shell {
  min-height: 100vh;
  padding: 8px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: #080f17;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand img {
  width: 82px;
  height: 48px;
  object-fit: contain;
  display: none;
}

.eyebrow,
.section-title {
  color: #28b8f2;
  font-size: 11px;
  font-weight: 900;
}

h1 {
  margin: 2px 0 0;
  font-size: 30px;
  line-height: 1;
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

#connectionDot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--red);
}

#connectionDot.connected { background: var(--green); }

.grid {
  display: grid;
  grid-template-columns: minmax(270px, 360px) minmax(360px, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.panel,
.onair-card,
.log-panel {
  border: 1px solid var(--line);
  background: var(--panel);
}

.panel {
  padding: 14px;
  min-width: 0;
  overflow: hidden;
}

label {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  color: var(--muted);
  font-weight: 800;
  min-width: 0;
}

input,
select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #30485e;
  background: #0c1218;
  color: var(--text);
  font: inherit;
}

button {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line2);
  background: #142235;
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
}

button.primary { background: #056ca2; border-color: #38bdf8; }
button.danger { background: var(--red2); border-color: var(--red); }
button:disabled { opacity: .55; cursor: not-allowed; }

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.meter {
  height: 16px;
  border: 1px solid #30485e;
  background: #081018;
  margin-top: 14px;
  overflow: hidden;
}

.meter-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.meter-label strong {
  color: var(--text);
}

.remote-mic-meter {
  height: 20px;
  margin-top: 5px;
}

#meterFill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--yellow), var(--red));
}

.remote-mic-led {
  display: grid;
  grid-template-columns: repeat(24, minmax(5px, 1fr));
  gap: 3px;
  height: 18px;
  margin-top: 7px;
  border: 1px solid #1f3346;
  background: #081018;
  padding: 2px;
}

.remote-mic-led span {
  background: #18334a;
}

.remote-mic-led span.active { background: var(--green); }
.remote-mic-led span.yellow.active { background: var(--yellow); }
.remote-mic-led span.red.active { background: var(--red); }

.hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.air-state {
  display: inline-flex;
  margin-top: 10px;
  padding: 8px 12px;
  border: 1px solid var(--line2);
  color: var(--yellow);
  font-weight: 900;
}

.return-quality {
  margin-top: 12px;
  padding: 8px 10px;
  border: 1px solid #30485e;
  background: #0c1218;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.participants {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.participant {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  padding: 9px;
  background: #0d1721;
}

.host-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
}

.onair-card {
  display: grid;
  grid-template-columns: 146px minmax(0, 1fr);
  gap: 14px;
  padding: 12px;
}

.cover-wrap {
  aspect-ratio: 1 / 1;
  background: #06101a;
  border: 1px solid var(--line);
  overflow: hidden;
}

#nowCover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.program-main {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 5px;
}

.program-label,
.now small,
.log-row small,
.time-row,
#logDate {
  color: var(--muted);
}

#nowTitle {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 22px;
  line-height: 1.08;
}

#nowMeta {
  display: block;
  min-height: 18px;
  font-size: 13px;
  font-weight: 800;
}

.transport {
  display: grid;
  grid-template-columns: repeat(4, minmax(90px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.mode-transport {
  display: grid;
  grid-template-columns: repeat(2, minmax(90px, 160px));
  gap: 8px;
  margin-top: 10px;
}

.mode-transport button.active-mode {
  background: #056ca2;
  border-color: #38bdf8;
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, .35);
}

.progress-track {
  height: 9px;
  margin-top: 4px;
  background: #e5e7eb;
  overflow: hidden;
}

#progressFill {
  width: 0%;
  height: 100%;
  background: #20bd3c;
}

.time-row {
  display: flex;
  gap: 0;
  font-size: 12px;
  font-weight: 900;
}

.led-meter {
  display: grid;
  grid-template-columns: repeat(34, minmax(5px, 1fr));
  gap: 3px;
  height: 17px;
  border: 1px solid #1f3346;
  background: #081018;
  padding: 2px;
}

.led-meter span {
  background: #18334a;
}

.led-meter span.active { background: var(--green); }
.led-meter span.yellow.active { background: var(--yellow); }
.led-meter span.red.active { background: var(--red); }

.log-panel {
  min-height: 420px;
}

.cart-panel,
.suite-board {
  border: 1px solid var(--line);
  background: var(--panel);
}

.cart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #132235;
}

.cart-bank-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
}

.cart-bank-tabs button {
  min-height: 32px;
  padding: 6px 10px;
}

.cart-bank-tabs button.active-bank {
  background: #056ca2;
  border-color: #38bdf8;
}

.cart-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  gap: 8px;
  padding: 12px;
}

.cart-pad {
  min-height: 78px;
  display: grid;
  align-content: space-between;
  gap: 4px;
  text-align: left;
  border-color: #23415a;
  background: linear-gradient(145deg, #0d8b65, #14304a);
  overflow: hidden;
}

.cart-pad.empty {
  background: #142235;
}

.cart-pad.active-cart {
  border-color: #22c55e;
  box-shadow: inset 0 0 0 2px rgba(34, 197, 94, .6);
}

.cart-pad.loop-cart strong::after {
  content: " LOOP";
  color: var(--yellow);
}

.cart-pad strong,
.cart-pad small,
.cart-pad span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cart-pad small,
.cart-pad span {
  color: #d7ecff;
  font-size: 11px;
}

.suite-now {
  grid-template-columns: 112px minmax(0, 1fr);
}

.log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #132235;
}

.log-title {
  margin-right: 10px;
  font-size: 24px;
  font-weight: 900;
}

.log-actions {
  display: flex;
  gap: 8px;
}

.log {
  display: grid;
  gap: 1px;
  max-height: 62vh;
  overflow: auto;
  padding: 3px 4px;
  background: #08121c;
}

.log-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) 58px;
  gap: 10px;
  align-items: center;
  min-height: 27px;
  border: 1px solid #263c50;
  border-radius: 4px;
  background: #1b2a38;
  padding: 3px 7px;
  margin: 1px 2px;
  cursor: default;
}

.log-row:hover,
.log-row.selected {
  border-color: #59bfff;
}

.log-row.dragging {
  opacity: .45;
}

.log-row.drop-target {
  border-color: #38bdf8;
  box-shadow: inset 0 0 0 2px rgba(56, 189, 248, .8);
}

.log-row.role-next {
  background: #8a6a08;
  border-color: #b88a11;
}

.log-row.anchor,
.log-row.role-softtime,
.log-row.soft-time {
  background: #b48608;
  border-color: #eab308;
}

.log-row.role-past {
  background: #101821;
  border-color: #1c2a36;
  opacity: .72;
}

.log-row.commercial {
  background: #7a4e08;
  border-color: #f59e0b;
}

.log-row.commercial.role-past {
  background: #3a2a13;
  border-color: #8a5a12;
  opacity: .86;
}

.log-row.role-current,
.log-row.current,
.log-row.anchor.role-current,
.log-row.commercial.role-current,
.log-row.soft-time.role-current {
  background: #0f7f37;
  border-color: #22c55e;
  min-height: 34px;
  padding: 5px 8px;
  opacity: 1;
}

.row-time {
  color: #d9e9f8;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
}

.row-main {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.row-main strong,
.row-main small {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-main strong {
  font-size: 12px;
  line-height: 1.05;
}

.row-main small {
  color: #d7ecff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.duration-pill {
  justify-self: end;
  min-width: 44px;
  padding: 3px 5px 2px;
  border-radius: 3px;
  background: #718394;
  text-align: center;
  font-size: 11px;
  font-weight: 900;
}

.log-row.role-current .duration-pill,
.log-row.current .duration-pill { background: #11642e; color: #fff; }
.log-row.role-next .duration-pill,
.log-row.anchor .duration-pill,
.log-row.role-softtime .duration-pill,
.log-row.soft-time .duration-pill { background: #fde047; color: #17300d; }
.log-row.role-past .duration-pill { background: #394756; }
.log-row.commercial .duration-pill { background: #b45309; color: #fff; }

.row-progress {
  height: 4px;
  margin-top: 2px;
  background: rgba(255, 255, 255, .82);
  overflow: hidden;
}

.row-progress span {
  display: block;
  height: 100%;
  background: #d9ffe1;
}

.context-menu {
  position: fixed;
  z-index: 1000;
  min-width: 210px;
  border: 1px solid #45647f;
  background: #0b1520;
  box-shadow: 0 14px 36px rgba(0, 0, 0, .42);
  padding: 5px;
}

.context-menu button {
  display: block;
  width: 100%;
  min-height: 32px;
  border: 0;
  background: transparent;
  text-align: left;
}

.context-menu button:hover { background: #16314b; }
.context-menu button.danger-item { color: #fecaca; }
.context-menu button.danger-item:hover { background: #5b1620; }

.menu-separator {
  height: 1px;
  margin: 4px 0;
  background: #284156;
}

.suite-placeholder {
  min-height: 260px;
}

.suite-body {
  padding: 24px;
  color: var(--muted);
}

.suite-body strong {
  display: block;
  color: var(--text);
  font-size: 26px;
  margin-bottom: 10px;
}

.suite-body p {
  margin: 0;
  max-width: 760px;
  line-height: 1.45;
  font-weight: 800;
}

.suite-app {
  display: grid;
  gap: 12px;
}

.suite-app-head {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) 250px;
  gap: 18px;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--line);
  background: #080f17;
}

.suite-logo-mark {
  width: 132px;
  color: #f8fbff;
  font-size: 32px;
  font-weight: 1000;
  font-style: italic;
  line-height: .85;
  text-shadow: 0 2px 0 #0ea5e9;
}

.suite-logo-mark span {
  color: #93c5fd;
  font-size: 13px;
  letter-spacing: 2px;
}

.suite-title-block h2 {
  margin: 3px 0 14px;
  font-size: 32px;
  line-height: 1;
}

.suite-tabs,
.suite-actions,
.traffic-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.suite-tabs button,
.suite-actions button,
.traffic-tabs button {
  min-width: 120px;
}

.suite-tabs button.active,
.traffic-tabs button.active {
  background: #056ca2;
  border-color: #38bdf8;
}

.suite-clock-card {
  justify-self: end;
  min-width: 220px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 16px;
  background: #0b1420;
  display: grid;
  gap: 3px;
}

.suite-clock-card small {
  color: var(--muted);
  font-weight: 900;
}

.suite-clock-card strong {
  font-size: 30px;
}

.suite-clock-card::before {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--green);
  position: absolute;
}

.programing-grid {
  display: grid;
  grid-template-columns: 300px minmax(520px, 1fr) 360px;
  gap: 10px;
}

.programing-library,
.clock-workspace,
.clock-elements,
.traffic-state-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 12px;
}

.danger-label {
  color: #ff4b4b;
}

.programing-library h3,
.clock-elements h3,
.traffic-state-panel h3 {
  margin: 0 0 12px;
  font-size: 24px;
}

.category-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.category-card {
  display: grid;
  grid-template-columns: 14px 1fr 48px;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 0 10px;
  min-height: 54px;
  text-align: left;
  background: #1d2b37;
  border-radius: 6px;
}

.category-card span {
  grid-row: 1 / 3;
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.category-card small {
  color: var(--muted);
}

.category-card b {
  grid-row: 1 / 3;
  justify-self: end;
}

.clock-toolbar {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  padding: 14px;
  background: #142235;
}

.clock-toolbar label {
  margin: 0;
}

.clock-stage {
  display: grid;
  justify-items: center;
  padding: 28px 0 16px;
  background: #111;
}

.clock-wheel {
  width: min(430px, 70vw);
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at center, #071019 0 24%, transparent 24%),
    conic-gradient(#0ea5e9 0 12deg, #dc2626 12deg 28deg, #d29200 28deg 45deg, #a855f7 45deg 58deg, #ea580c 58deg 74deg, #22c55e 74deg 92deg, #d29200 92deg 110deg, #dc2626 110deg 127deg, #a855f7 127deg 144deg, #ea580c 144deg 166deg, #0ea5e9 166deg 180deg, #dc2626 180deg 205deg, #d29200 205deg 226deg, #a855f7 226deg 246deg, #ea580c 246deg 270deg, #22c55e 270deg 292deg, #d29200 292deg 316deg, #dc2626 316deg 340deg, #0ea5e9 340deg 360deg);
  border: 5px solid #333;
  box-shadow: inset 0 0 0 2px #111, 0 0 0 2px #22313f;
}

.clock-wheel > div {
  width: 150px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-content: center;
  text-align: center;
  background: #081018;
  border: 4px solid #dc2626;
}

.clock-wheel strong { font-size: 31px; }
.clock-wheel span { color: var(--muted); font-size: 20px; font-weight: 900; }
.clock-wheel em { color: #ef4444; font-style: normal; font-weight: 900; }
.clock-wheel small { color: var(--muted); font-weight: 900; }

.clock-legend {
  margin-top: 16px;
  font-size: 12px;
  font-weight: 900;
}

.clock-legend span {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-left: 10px;
}

.red-dot { background: #dc2626; }
.blue-dot { background: #0ea5e9; }
.green-dot { background: #22c55e; }
.purple-dot { background: #a855f7; }
.amber-dot { background: #d29200; }

.clock-elements {
  position: relative;
  overflow: hidden;
}

.clock-elements > button {
  position: absolute;
  top: 15px;
  right: 88px;
}

.clock-slot-list {
  display: grid;
  gap: 8px;
  max-height: 590px;
  overflow: auto;
  padding-right: 4px;
}

.clock-slot {
  min-height: 44px;
  border-radius: 5px;
  display: grid;
  grid-template-columns: 58px 1fr 28px 48px;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 0 8px;
  padding: 7px 9px;
  font-weight: 900;
}

.clock-slot span,
.clock-slot em {
  font-size: 11px;
}

.clock-slot em {
  grid-column: 1;
  color: #d7ecff;
  font-style: normal;
}

.clock-slot small {
  grid-row: 1 / 3;
  grid-column: 4;
  justify-self: end;
}

.clock-slot button {
  grid-row: 1 / 3;
  grid-column: 3;
  min-height: 24px;
  border: 0;
  background: transparent;
}

.traffic-tabs {
  padding: 8px 12px 0;
  border-bottom: 1px solid var(--line);
}

.traffic-state-panel {
  padding: 0;
}

.traffic-filter {
  display: grid;
  grid-template-columns: 86px 320px;
  gap: 14px;
  align-items: center;
  padding: 14px;
  background: #1a2a3a;
  border-bottom: 1px solid var(--line);
}

.traffic-table {
  min-height: 540px;
  background: #0b1721;
}

.traffic-row {
  display: grid;
  grid-template-columns: 90px minmax(240px, 1fr) 220px 220px 70px 70px 120px;
  gap: 10px;
  align-items: center;
  min-height: 36px;
  padding: 7px 10px;
  border-bottom: 1px solid #20374d;
}

.traffic-header {
  min-height: 32px;
  background: #172838;
  color: #d8ebff;
  font-weight: 900;
}

.traffic-status {
  padding: 8px 10px;
  color: var(--muted);
  border: 1px solid var(--line);
  background: #080f17;
}

.hidden { display: none; }

@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .onair-card { grid-template-columns: 112px minmax(0, 1fr); }
  #nowTitle { font-size: 18px; }
  .transport { grid-template-columns: repeat(2, minmax(90px, 1fr)); }
  .suite-app-head,
  .programing-grid {
    grid-template-columns: 1fr;
  }
  .suite-clock-card {
    justify-self: stretch;
  }
  .clock-toolbar {
    grid-template-columns: 1fr 1fr;
  }
  .traffic-row {
    grid-template-columns: 72px minmax(180px, 1fr) 120px 120px 56px 56px 90px;
  }
}

@media (max-width: 560px) {
  .shell { padding: 4px; }
  .onair-card { grid-template-columns: 1fr; }
  .cover-wrap {
    width: 132px;
    max-width: 45vw;
  }
  .log-head { align-items: flex-start; flex-direction: column; }
  .log-actions { width: 100%; }
  .log-actions button { flex: 1; }
}
