:root {
  --bg: #f6f5f3; --panel: #fff; --ink: #1c1917; --muted: #6b645d; --line: #e4e0db; --soft: #f1eeea;
  --brand: #c2410c; --brand-ink: #fff; --focus: #2563eb;
  --event: #2563eb; --contest: #ea580c; --content: #16a34a;
  --ok: #15803d; --warn: #b45309; --bad: #b91c1c; --warnbg: #fef3c7; --badbg: #fee2e2; --okbg: #dcfce7;
  --r: 8px; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 14px rgba(0,0,0,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--focus); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 22px 0 8px; }
h3 { font-size: 15px; margin: 16px 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.pre { white-space: pre-wrap; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.loading { padding: 40px; color: var(--muted); text-align: center; }

/* header */
header#top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 0 16px; height: 52px; background: #1c1917; color: #fff; }
.brand { color: #fff; font-weight: 700; font-size: 16px; white-space: nowrap; }
.brand span { font-weight: 400; opacity: .7; margin-left: 6px; }
.brand:hover { text-decoration: none; }
nav#nav { display: flex; gap: 2px; flex: 1; align-items: center; }
.navmore .menu-pop { left: 0; right: auto; top: 38px; }
.navmore .menu-pop a { color: var(--ink); }
.navmore .menu-pop a.on { background: var(--soft); color: var(--ink); }
.navflat { display: none; }
nav#nav a { color: #d6d3d1; padding: 6px 10px; border-radius: 6px; white-space: nowrap; }
nav#nav a:hover { background: #292524; color: #fff; text-decoration: none; }
nav#nav a.on { background: var(--brand); color: #fff; }
.topright { display: flex; align-items: center; gap: 4px; }
.iconbtn { position: relative; background: none; border: 0; color: #fff; font: inherit; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.iconbtn:hover { background: #292524; text-decoration: none; }
.iconbtn b { position: absolute; top: 0; right: 0; background: var(--bad); color: #fff; font-size: 10px; border-radius: 9px; padding: 0 5px; line-height: 16px; }
.menu { position: relative; }
.menu-pop { position: absolute; right: 0; top: 40px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); min-width: 170px; padding: 4px; }
.menu-pop a { display: block; padding: 8px 10px; color: var(--ink); border-radius: 6px; }
.menu-pop a:hover { background: var(--soft); text-decoration: none; }
.navtoggle { display: none; background: none; border: 0; color: #fff; font-size: 20px; }
@media (max-width: 1180px) {
  .navtoggle { display: block; }
  header#top { justify-content: space-between; }
  nav#nav { display: none; position: absolute; top: 52px; left: 0; right: 0; flex-direction: column; align-items: stretch; background: #1c1917; padding: 8px; max-height: calc(100vh - 52px); overflow-y: auto; }
  nav#nav.open { display: flex; }
  .navmore { display: none; }
  .navflat { display: contents; }
}

main { max-width: 1400px; margin: 0 auto; padding: 18px 16px 60px; }
.pagehead { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.pagehead h1 { flex: 1; min-width: 200px; margin: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.spacer { flex: 1; }

/* controls */
button, .btn { font: inherit; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 6px 12px; border-radius: 6px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; line-height: 1.3; white-space: nowrap; }
button:hover, .btn:hover { background: var(--soft); text-decoration: none; }
button.primary, .btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.primary:hover { filter: brightness(1.08); }
button.good { background: var(--ok); border-color: var(--ok); color: #fff; }
button.danger { color: var(--bad); border-color: #fecaca; }
button.danger.solid { background: var(--bad); color: #fff; }
button.link { border: 0; background: none; padding: 2px 4px; color: var(--focus); }
button.sm, .btn.sm { padding: 3px 8px; font-size: 12px; }
button:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid #d6d1cb; border-radius: 6px; padding: 6px 8px; width: 100%; }
textarea { min-height: 70px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: auto; margin: 0 4px 0 0; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
label { display: block; font-weight: 600; font-size: 13px; margin: 10px 0 4px; }
label .req { color: var(--bad); }
.check { display: inline-flex; align-items: center; font-weight: 400; margin: 4px 14px 4px 0; }
.help { font-size: 12px; color: var(--muted); margin-top: 2px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 16px; }
@media (max-width: 700px) { .grid2, .grid3, .grid4 { grid-template-columns: 1fr; } }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 20px; padding: 3px 10px; background: #fff; cursor: pointer; font-weight: 400; margin: 0; user-select: none; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.chip:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }
.chip:has(input:checked) { background: var(--ink); color: #fff; border-color: var(--ink); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; }
.seg button.on { background: var(--ink); color: #fff; }

/* panels & tables */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; margin-bottom: 14px; }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
table.t { width: 100%; border-collapse: collapse; background: var(--panel); }
table.t th, table.t td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.t th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; background: #faf9f7; position: sticky; top: 52px; }
table.t tr:hover td { background: #fcfbfa; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); }
.tablewrap table.t th { top: 0; }
.empty { padding: 26px; text-align: center; color: var(--muted); }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; white-space: pre-wrap; }

/* badges */
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 10px; background: var(--soft); color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.badge.live, .badge.won, .badge.sold, .badge.read, .badge.ok { background: var(--okbg); color: var(--ok); }
.badge.pending, .badge.warn, .badge.scheduled { background: var(--warnbg); color: var(--warn); }
.badge.denied, .badge.cancelled, .badge.forfeited, .badge.bad, .badge.missed { background: var(--badbg); color: var(--bad); }
.badge.tracked { background: #e0e7ff; color: #3730a3; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; vertical-align: 1px; }
.dot.event { background: var(--event); } .dot.contest { background: var(--contest); } .dot.content { background: var(--content); }
.alert { border-radius: var(--r); padding: 10px 12px; margin: 10px 0; }
.alert.warn { background: var(--warnbg); color: #78350f; }
.alert.bad { background: var(--badbg); color: #7f1d1d; }
.alert.ok { background: var(--okbg); color: #14532d; }
.alert.info { background: #e0f2fe; color: #0c4a6e; }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-left: 1px solid var(--line); border-top: 1px solid var(--line); background: var(--panel); border-radius: var(--r); overflow: hidden; }
.cal .dow { font-size: 11px; text-transform: uppercase; color: var(--muted); padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #faf9f7; }
.cal .day { min-height: 110px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px; }
.cal .day.other { background: #fbfaf9; }
.cal .day.other .num { opacity: .4; }
.cal .day.today .num { background: var(--brand); color: #fff; border-radius: 10px; padding: 0 6px; }
.cal .num { font-size: 12px; font-weight: 600; display: inline-block; margin-bottom: 2px; }
.ev { display: block; font-size: 12px; border-radius: 4px; padding: 1px 5px; margin: 2px 0; color: #fff; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; }
.ev.event { background: var(--event); } .ev.contest { background: var(--contest); } .ev.content { background: var(--content); }
.ev.pending { opacity: .45; } .ev.denied { background: #9ca3af; text-decoration: line-through; } .ev.cancelled { background: #d1d5db; color: #4b5563; text-decoration: line-through; }
.ev:hover { filter: brightness(1.1); text-decoration: none; }
.more { font-size: 11px; color: var(--muted); cursor: pointer; }
.nez { font-size: 11px; background: repeating-linear-gradient(45deg, #fee2e2, #fee2e2 5px, #fff 5px, #fff 10px); color: var(--bad); border-radius: 4px; padding: 1px 5px; margin: 2px 0; }
@media (max-width: 700px) { .cal .day { min-height: 70px; } .ev { font-size: 10px; } }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 14px 0; overflow-x: auto; }
.tabs a { padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--ink); border-color: var(--brand); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.steps { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 14px; counter-reset: s; }
.steps a { counter-increment: s; border: 1px solid var(--line); background: #fff; border-radius: 20px; padding: 4px 12px 4px 6px; color: var(--ink); }
.steps a::before { content: counter(s); display: inline-block; width: 20px; height: 20px; border-radius: 50%; background: var(--soft); text-align: center; line-height: 20px; margin-right: 6px; font-size: 12px; }
.steps a.done::before { content: "✓"; background: var(--okbg); color: var(--ok); }
.steps a.on { border-color: var(--brand); }
.steps a:hover { text-decoration: none; }

/* on air */
.oa { display: grid; grid-template-columns: 1fr 340px; gap: 16px; }
@media (max-width: 1000px) { .oa { grid-template-columns: 1fr; } }
.oa-item { background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--line); border-radius: var(--r); padding: 10px 12px; margin-bottom: 8px; }
.oa-item.liner { border-left-color: var(--content); }
.oa-item.play, .oa-item.solicit { border-left-color: var(--contest); }
.oa-item.feature { border-left-color: #eab308; background: #fefce8; }
.oa-item.done { opacity: .55; }
.oa-item.now { box-shadow: 0 0 0 2px var(--brand); }
.oa-time { font-weight: 700; font-size: 16px; margin-right: 8px; }
.oa-copy { font-size: 17px; line-height: 1.5; margin: 6px 0; white-space: pre-wrap; }
.oa-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.big { font-size: 15px; padding: 9px 16px; }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(28,25,23,.45); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 40px 12px; overflow-y: auto; }
.modal { background: var(--panel); border-radius: 10px; box-shadow: 0 20px 50px rgba(0,0,0,.25); width: 100%; max-width: 640px; }
.modal.wide { max-width: 960px; }
.modal-h { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.modal-h h2 { margin: 0; flex: 1; }
.modal-b { padding: 6px 16px 16px; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: #faf9f7; border-radius: 0 0 10px 10px; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 60; box-shadow: var(--shadow); max-width: 90vw; }
#toast.err { background: var(--bad); }

/* login */
.login { max-width: 360px; margin: 10vh auto; background: var(--panel); padding: 28px; border-radius: 12px; box-shadow: var(--shadow); }
.login h1 { margin-bottom: 14px; }
.login button { width: 100%; justify-content: center; margin-top: 16px; padding: 9px; }

/* misc */
.list-results { border: 1px solid var(--line); border-radius: 6px; max-height: 260px; overflow-y: auto; margin-top: 4px; }
.list-results > div { padding: 7px 10px; border-bottom: 1px solid var(--line); cursor: pointer; }
.list-results > div:hover, .list-results > div.sel { background: #eff6ff; }
.blog-msg { border-bottom: 1px solid var(--line); padding: 8px 0; }
.fieldrow { display: grid; grid-template-columns: 1.4fr 1fr 70px auto; gap: 6px; align-items: start; padding: 8px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 6px; background: #fcfbfa; }
.fieldrow .opts { grid-column: 1 / -1; }
.slotgrid { display: grid; grid-template-columns: 60px repeat(7, 1fr); font-size: 12px; }
.slotgrid div { border-bottom: 1px solid var(--line); padding: 3px; }
.stat { display: inline-block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px; margin: 0 8px 8px 0; min-width: 130px; }
.stat b { display: block; font-size: 22px; }
@media print { header#top, .toolbar, .noprint, .tabs { display: none !important; } main { padding: 0; } }
