:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #16191f;
  --muted: #646b78;
  --line: #e2e5ea;
  --accent: #c2410c;        /* broadcast orange */
  --accent-ink: #ffffff;
  --accent-soft: #fff1e8;
  --good: #15803d;  --good-soft: #e8f6ed;
  --warn: #a16207;  --warn-soft: #fdf6e0;
  --bad:  #b91c1c;  --bad-soft:  #fdecec;
  --info: #1d4ed8;  --info-soft: #e9effd;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 15px; line-height: 1.45;
  color: var(--ink); background: var(--bg);
}
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }
.hidden { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 20px;
  padding: 0 24px; height: 58px;
  background: #16191f; color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .2px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 7px; background: var(--accent);
  display: grid; place-items: center; font-family: var(--mono); font-size: 13px;
}
.nav { display: flex; gap: 4px; }
.nav button {
  white-space: nowrap;
  background: none; border: 0; color: #c9ced8; padding: 8px 12px; border-radius: 7px;
  font: inherit; font-weight: 500; cursor: pointer;
}
.nav button:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav button.active { color: #fff; background: rgba(255,255,255,.14); }
.topbar .spacer { flex: 1; }
.who { font-size: 13px; color: #c9ced8; display: flex; align-items: center; gap: 12px; }
.who button { background: none; border: 1px solid #3a404c; color: #e6e9ef; border-radius: 7px; padding: 5px 10px; cursor: pointer; font: inherit; font-size: 13px; }

/* ---------- sync strip ---------- */
.syncbar { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 24px; background: var(--panel); border-bottom: 1px solid var(--line); }
.syncpill { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--bg); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.ok { background: var(--good); } .dot.stale { background: var(--bad); }

/* ---------- layout ---------- */
main { max-width: 1180px; margin: 0 auto; padding: 24px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .spacer { flex: 1; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-pad { padding: 20px; }

/* ---------- buttons & inputs ---------- */
button, .btn {
  font: inherit; font-weight: 600; font-size: 14px;
  border-radius: 8px; padding: 9px 16px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
}
button:hover { border-color: #c5cad3; }
button:disabled { opacity: .55; cursor: default; }
.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.primary:hover { background: #a6360a; border-color: #a6360a; }
.danger { color: var(--bad); }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 500; }

input, select, textarea {
  font: inherit; color: var(--ink); background: #fff;
  border: 1px solid #cfd4dc; border-radius: 8px; padding: 9px 11px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
textarea { min-height: 80px; resize: vertical; }
label.field { display: block; }
label.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.req { color: var(--accent); }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px 18px; }
.span-2 { grid-column: span 2; } .span-4 { grid-column: 1 / -1; }
.cart-input { font-family: var(--mono); font-size: 18px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; }

.checks { display: flex; gap: 10px; flex-wrap: wrap; }
.check {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px;
  border: 1px solid #cfd4dc; border-radius: 8px; cursor: pointer; background: #fff; font-weight: 500;
}
.check input { width: auto; margin: 0; }
.check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- drop zone ---------- */
.drop {
  border: 2px dashed #cfd4dc; border-radius: var(--radius); padding: 22px;
  text-align: center; background: #fafbfc; cursor: pointer;
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop strong { display: block; margin-bottom: 4px; }
.fileinfo { display: flex; align-items: center; gap: 12px; justify-content: center; flex-wrap: wrap; }
.fileinfo audio { height: 36px; }

/* ---------- toolbar & table ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input { max-width: 300px; }
.toolbar select { width: auto; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 600; background: #fafbfc; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #fafbfc; }
td.adv { white-space: normal; min-width: 180px; font-weight: 500; }
td .mono { font-weight: 600; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; }
.b-airing   { background: var(--good-soft); color: var(--good); }
.b-upcoming { background: var(--info-soft); color: var(--info); }
.b-expired  { background: #eef0f3; color: var(--muted); }
.b-deleted  { background: var(--bad-soft); color: var(--bad); }
.b-ending   { background: var(--warn-soft); color: var(--warn); }
.st { display: inline-block; font-family: var(--mono); font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 5px; background: #eef0f3; margin-right: 4px; }

/* ---------- notices ---------- */
.notice { padding: 10px 14px; border-radius: 8px; font-size: 14px; margin: 0 0 14px; }
.notice.warn { background: var(--warn-soft); color: #713f12; }
.notice.bad  { background: var(--bad-soft);  color: #7f1d1d; }
.notice.info { background: var(--info-soft); color: #1e3a8a; }

.actions { display: flex; gap: 10px; align-items: center; margin-top: 22px; flex-wrap: wrap; }
.actions .spacer { flex: 1; }

/* ---------- history ---------- */
.history { margin-top: 18px; }
.history li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; list-style: none; }
.history ul { padding: 0; margin: 10px 0 0; }

/* ---------- admin ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.tabs button.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.admin-table td { white-space: normal; vertical-align: middle; }
.admin-table tbody tr { cursor: default; }
.admin-table input, .admin-table select { padding: 6px 8px; font-size: 14px; }
.inline-form { display: grid; grid-template-columns: 2fr 1fr 2fr auto auto; gap: 10px; align-items: end; }

/* ---------- login ---------- */
.center-card { max-width: 400px; margin: 10vh auto; padding: 0 16px; }
.center-card .panel { padding: 28px; }
.center-card h1 { margin-bottom: 4px; }
.center-card form > * + * { margin-top: 14px; }
.center-card .primary { width: 100%; }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: #16191f; color: #fff; padding: 11px 18px; border-radius: 9px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; max-width: 90vw;
}
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.err { background: var(--bad); }

@media (max-width: 760px) {
  .topbar { padding: 0 12px; gap: 6px; }
  .brand-text { display: none; }
  .nav button { padding: 8px 8px; font-size: 14px; }
  .who button { padding: 5px 8px; white-space: nowrap; }
  .who span { display: none; }
  main { padding: 16px; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .span-2 { grid-column: 1 / -1; }
  .inline-form { grid-template-columns: 1fr; }
  .toolbar input { max-width: none; }
}
