/* MD2020 admin: tabs, the Stations split screen, the Units table and dialogs.
   Builds on scan_viewer.css (colours, buttons, tables). */

.tabs { display: flex; gap: 4px; }
.tab {
  font: inherit;
  font-weight: 600;
  padding: 6px 14px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: #fff;
  cursor: pointer;
}
.tab:hover { background: var(--musicdata-blue-dark); }
.tab.active { background: #fff; color: var(--musicdata-blue-dark); }

.pane-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 10px;
}
.pane-bar label { font-weight: 500; }
.pane-bar select, .pane-bar input[type="search"] {
  font: inherit;
  padding: 5px 8px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
}
.pane-bar #device, .pane-bar #se-market, .pane-bar #se-unit { min-width: 220px; max-width: 100%; }
.pane-title { margin: 0; font-size: 18px; color: var(--musicdata-blue-dark); }
.freshness.stale { background: #fff3cd; color: var(--warn); padding: 2px 8px; border-radius: 10px; }
.check { display: inline-flex; align-items: center; gap: 4px; font-weight: 400 !important; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; }
.bad-text { color: var(--bad); font-weight: 600; }

.btn-plain, .btn-small {
  font: inherit;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  background: #fff;
  border: 1px solid var(--musicdata-blue);
  color: var(--musicdata-blue-dark);
  padding: 6px 14px;
}
.btn-plain:hover, .btn-small:hover { background: var(--musicdata-blue-tint); }
.btn-small { padding: 2px 8px; font-size: 12px; }
.btn-small:not(.btn-plain) { background: var(--musicdata-blue); color: #fff; }
.btn-small:not(.btn-plain):hover { background: var(--musicdata-blue-dark); }
button:disabled { opacity: 0.45; cursor: default; }

.flash { min-height: 1.2em; margin: 0 0 8px; }
.flash-ok { color: var(--ok); }
.flash-bad { color: var(--bad); font-weight: 600; }
.waiting { background: #fff3cd; color: #664d03; padding: 6px 10px; border-radius: 4px; margin: 0 0 8px; }

.badge {
  display: inline-block;
  margin: 0 4px 0 0;
  padding: 0 6px;
  border-radius: 8px;
  background: var(--musicdata-blue-tint);
  color: var(--musicdata-blue-dark);
  font-size: 12px;
  white-space: nowrap;
}
.badge.new { background: #d1e7dd; color: #0f5132; }
.badge.warn { background: #fff3cd; color: #664d03; margin-left: 6px; }

/* ---------------------------------------------------------------- Stations split screen */

.split { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .split { grid-template-columns: minmax(0, 1fr); } }
.split-left, .split-right { min-width: 0; }
.split-right { position: sticky; top: 64px; }
@media (max-width: 1100px) { .split-right { position: static; } }

.edit-grid td { vertical-align: middle; padding: 3px 6px; }
.edit-grid th { position: sticky; top: 0; z-index: 2; }
/* Calls stays at the left while the row scrolls sideways (th.stick/td.stick
   in scan_viewer.css); the header cell sits above both scroll directions. */
.edit-grid .stick-calls { left: 0; box-shadow: 1px 0 0 var(--rule), 4px 0 4px -2px rgba(33, 37, 41, 0.12); }
.edit-grid th.stick-calls { z-index: 3; }
.edit-grid th.ro, .edit-grid td.ro { background: var(--panel); color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.edit-grid tr.off td { color: var(--muted); background: #fafafa; }
.edit-grid tr.dirty td { background: #fff8e1; }
.edit-grid tr[draggable="true"] { cursor: grab; }
.in {
  font: inherit;
  font-size: 13px;
  padding: 3px 5px;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: #fff;
  width: 100%;
  min-width: 60px;
}
.in:focus { outline: 2px solid var(--musicdata-blue-light); border-color: var(--musicdata-blue); }
.in-calls { width: 84px; min-width: 84px; text-transform: uppercase; }
.in-freq { width: 72px; min-width: 72px; }
.in-mediumCode { width: 72px; min-width: 72px; }
.in-phone { width: 120px; }
.in-subFormatCode, .in-pd { min-width: 110px; }
.in-ownerId, .in-marketId, .in-timezoneIana, .in-formatCode { min-width: 140px; }
.in-notes, .in-branding { min-width: 160px; }
.in-program { min-width: 240px; width: auto; }
.in-period { width: 80px; }
.in-unit-notes { min-width: 200px; width: auto; }
.row-actions { white-space: nowrap; }
.row-actions button + button { margin-left: 4px; }

.rules-row > td { background: #f4fbfe !important; padding: 8px 10px; }
.rules { display: flex; flex-direction: column; gap: 6px; position: sticky; left: 0; width: max-content; max-width: calc(100vw - 60px); }
.rules-title { font-weight: 600; color: var(--musicdata-blue-dark); white-space: normal; }
.rule { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 4px 0; border-top: 1px dashed var(--rule); }
.rule.off { opacity: 0.6; }
.rule select, .rule input[type="date"] { font: inherit; font-size: 13px; padding: 2px 4px; border: 1px solid var(--rule); border-radius: 3px; }
.days { display: inline-flex; gap: 2px; }
.day { border: 1px solid var(--rule); border-radius: 3px; padding: 0 3px; font-size: 12px; }

.paste { margin-bottom: 10px; }
.paste summary { cursor: pointer; color: var(--musicdata-blue-dark); font-weight: 600; margin-bottom: 6px; }
.paste textarea { width: 100%; font: inherit; font-family: ui-monospace, Consolas, monospace; padding: 6px; border: 1px solid var(--rule); border-radius: 4px; }
.paste-line { margin: 4px 0; white-space: normal; }

.draft-list { border: 1px solid var(--rule); border-radius: 6px; padding: 8px; background: #fff; }
.drop-zone { min-height: 120px; border-radius: 4px; overflow-x: auto; }
.drop-zone.live { outline: 2px dashed transparent; }
.drop-zone.over { outline-color: var(--musicdata-blue); background: var(--musicdata-blue-tint); }
.draft-grid { width: 100%; }
.draft-grid td { vertical-align: middle; padding: 3px 6px; white-space: normal; }
.draft-grid td.small { max-width: 240px; }
.draft-grid td.row-actions, .draft-grid td.market { white-space: nowrap; }
.draft-grid tr.problem td { background: var(--bad-tint); }
.handle { cursor: grab; color: var(--muted); user-select: none; }

/* ---------------------------------------------------------------- dialogs */

.dialog {
  border: 1px solid var(--rule);
  border-top: 4px solid var(--musicdata-blue);
  border-radius: 6px;
  padding: 20px 24px;
  width: min(420px, calc(100vw - 32px));
  color: var(--ink);
  font: inherit;
}
.dialog-wide { width: min(760px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(33, 37, 41, 0.45); }
.dialog h2 { margin: 0 0 10px; font-size: 18px; color: var(--musicdata-blue-dark); }
.dialog-text { margin: 0 0 10px; }
.dialog input#code-input {
  font: inherit;
  font-size: 22px;
  letter-spacing: 6px;
  text-align: center;
  width: 100%;
  padding: 8px;
  border: 1px solid var(--rule);
  border-radius: 4px;
}
.dialog-buttons { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.dialog .field { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0; }
.dialog .field .in { width: auto; }
.changes td { white-space: normal; }
pre.key {
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: 15px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow-x: auto;
  user-select: all;
}
