/* Emisja RPS – emocje.tv
   Barwy: konsola #0e2233, papier #e8edf1, atrament #16222e, akcent #0b7285, sygnały: zielony #1e9a57, bursztyn #e58a00, czerwień #d62839.
   Nagłówek aplikacji (pasek górny i nagłówek tabeli) jest czarny (--bar). */
:root {
  --console: #0e2233;
  --console-2: #183850;
  --console-ink: #cfe0ec;
  --bar: #000000;
  --bar-2: #1a1a1a;
  --paper: #e8edf1;
  --panel: #ffffff;
  --ink: #16222e;
  --muted: #5a6b7b;
  --line: #d2dae1;
  --line-2: #e4e9ee;
  --accent: #0b7285;
  --accent-2: #095c6b;
  --accent-soft: #dff1f4;
  --on-accent: #ffffff;
  --field: #ffffff;
  --ok-ink: #137a43; --warn-ink: #9a5b00; --bad-ink: #a81b2a;
  --ok: #1e9a57;
  --ok-soft: #dff4e8;
  --warn: #e58a00;
  --warn-soft: #fdf0d9;
  --bad: #d62839;
  --bad-soft: #fbe3e6;
  --radius: 6px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, Menlo, monospace;
  --bar-h: 54px;
}
* { box-sizing: border-box; }
html, body, #app { height: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink); font: 14px/1.4 var(--font);
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-2); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- przyciski i pola ---------- */
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); padding: 7px 12px;
  cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; line-height: 1.2; white-space: nowrap;
}
.btn:hover { border-color: #aab6c1; background: #f6f9fb; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent-2); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { background: var(--bad); border-color: #a81b2a; color: #fff; }
.btn.ghost { background: transparent; }
.btn.small, .mini { padding: 3px 8px; font-size: 12px; }
.mini {
  appearance: none; border: 1px solid var(--line); background: var(--panel); border-radius: 4px; cursor: pointer; font-weight: 600; color: var(--muted);
}
.mini:hover { color: var(--ink); border-color: #aab6c1; }
.mini.ok { color: var(--ok); border-color: #a9dcc0; background: var(--ok-soft); }
.mini.no { color: var(--bad); border-color: #efb4bb; background: var(--bad-soft); }
.icon-btn { appearance: none; border: 0; background: transparent; font-size: 22px; line-height: 1; padding: 4px 8px; cursor: pointer; color: var(--muted); border-radius: 4px; }
.icon-btn:hover { background: var(--line-2); color: var(--ink); }
input[type=text], input[type=password], input[type=search], input[type=tel], input[type=number], input[type=date], input[type=time], input[type=url], select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 9px; background: var(--field); min-height: 34px;
}
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--accent); vertical-align: middle; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; min-width: 0; }
.field .lbl { font-weight: 600; font-size: 12.5px; color: var(--muted); }
.field .hint { font-size: 12px; color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
.row-flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--line-2); color: var(--muted); }
.chip.ok { background: var(--ok-soft); color: #137a43; }
.chip.warn { background: var(--warn-soft); color: #9a5b00; }
.chip.bad { background: var(--bad-soft); color: #a81b2a; }
.chip.accent { background: var(--accent-soft); color: var(--accent-2); }

/* ---------- logowanie ---------- */
.login-wrap { min-height: 100%; display: grid; grid-template-columns: minmax(320px, 1.1fr) minmax(340px, 480px); background: var(--console); }
.login-brand { padding: 56px clamp(24px, 6vw, 88px); color: var(--console-ink); display: flex; flex-direction: column; justify-content: center; gap: 28px; background:
  linear-gradient(180deg, rgba(255,255,255,.03), transparent 30%), var(--console); }
.login-brand h1 { font-size: clamp(28px, 4vw, 46px); color: #fff; letter-spacing: -.01em; font-weight: 700; }
.login-brand p { max-width: 46ch; margin: 0; font-size: 16px; line-height: 1.55; }
.rundown { display: grid; gap: 8px; max-width: 460px; }
.rundown .rd { display: grid; grid-template-columns: 76px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; background: var(--console-2); border-radius: 6px; border-left: 4px solid var(--c, #5fd3e0); }
.rundown .tc { font-family: var(--mono); font-size: 20px; color: #fff; font-weight: 600; }
.rundown .nm { color: #fff; font-weight: 600; }
.rundown .sb { font-size: 12.5px; color: #9db6c8; }
.rundown .st { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 4px; }
.rundown .rd.live { animation: onair 1s steps(2, jump-none) infinite; outline: 2px solid transparent; outline-offset: -2px; }
.rundown .st.green { background: rgba(30,154,87,.25); color: #7be0a8; }
.rundown .st.red { background: rgba(214,40,57,.28); color: #ff9aa5; }
.rundown .st.dim { background: rgba(255,255,255,.08); color: #9db6c8; }
.login-form-side { background: var(--paper); display: flex; align-items: center; padding: 32px; }
.login-card { width: 100%; max-width: 380px; margin: 0 auto; }
.login-card h2 { font-size: 22px; margin-bottom: 4px; }
.login-card .sub { color: var(--muted); margin: 0 0 22px; }
.login-card .btn { width: 100%; justify-content: center; padding: 10px 12px; font-size: 15px; }
.err-box { background: var(--bad-soft); color: #8d1523; border: 1px solid #efb4bb; padding: 8px 11px; border-radius: var(--radius); margin-bottom: 12px; }
.login-help { margin-top: 18px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
@media (max-width: 860px) { .login-wrap { grid-template-columns: 1fr; } .login-brand { padding: 28px 22px; } .rundown { display: none; } .login-brand p { display: none; } }
@keyframes onair { 0%, 100% { outline-color: var(--bad); } 50% { outline-color: transparent; } }

/* ---------- układ aplikacji ---------- */
.shell { height: 100%; display: flex; flex-direction: column; }
.topbar { height: var(--bar-h); flex: none; display: flex; align-items: center; gap: 4px; padding: 0 14px; background: var(--bar); color: var(--console-ink); }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; color: #fff; margin-right: 14px; white-space: nowrap; }
.brand img { width: 26px; height: 26px; }
.brand small { font-weight: 500; color: #8aa5ba; }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; align-self: stretch; }
.nav::-webkit-scrollbar { display: none; }
.nav a { display: flex; align-items: center; padding: 0 13px; color: var(--console-ink); text-decoration: none; font-weight: 600; white-space: nowrap; border-bottom: 3px solid transparent; }
.nav a:hover { background: var(--bar-2); }
.nav a[aria-current=page] { color: #fff; border-bottom-color: #5fd3e0; background: rgba(255,255,255,.05); }
.userbtn { flex: none; appearance: none; background: transparent; border: 1px solid #333333; color: #fff; border-radius: 999px; padding: 4px 12px 4px 4px; display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; }
.userbtn:hover { background: var(--bar-2); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: #5fd3e0; color: #000; display: grid; place-items: center; font-size: 12px; font-weight: 800; }
.menu { position: absolute; right: 12px; top: calc(var(--bar-h) - 4px); z-index: 40; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.25); min-width: 230px; padding: 6px; }
.menu .who { padding: 8px 10px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }
.menu .who span { display: block; color: var(--muted); font-size: 12.5px; }
.menu button { width: 100%; text-align: left; background: transparent; border: 0; padding: 8px 10px; border-radius: 4px; cursor: pointer; }
.menu button:hover { background: var(--line-2); }
.main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.page { flex: 1; min-height: 0; overflow: auto; padding: 18px clamp(14px, 3vw, 32px) 40px; }
.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { font-size: 22px; }
.page-head p { margin: 2px 0 0; color: var(--muted); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; margin-bottom: 16px; }
.panel > h2 { font-size: 16px; margin-bottom: 12px; }
.panel > h3 { font-size: 14px; margin: 14px 0 8px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 16px; align-items: start; }
.banner { background: var(--accent-soft); border-bottom: 1px solid #b5dde4; padding: 8px 18px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; flex: none; }
.page > .banner { margin: 0 0 16px; border: 1px solid #b5dde4; border-radius: 8px; }
.banner.warn { background: var(--warn-soft); border-color: #f1d49d; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty strong { display: block; font-size: 16px; color: var(--ink); margin-bottom: 4px; }
.empty p { margin: 0 0 14px; }
.toolbar-note { font-size: 12.5px; color: var(--muted); }

/* ---------- arkusz emisji ---------- */
.sheet-bar { flex: none; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px clamp(14px, 3vw, 32px); background: var(--panel); border-bottom: 1px solid var(--line); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.seg button { appearance: none; border: 0; background: var(--field); padding: 7px 13px; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed=true] { background: var(--console); color: #fff; }
.sheet-bar select, .sheet-bar input[type=search] { width: auto; min-width: 150px; }
.sheet-bar input[type=search] { min-width: 190px; }
.sheet { flex: 1; min-height: 0; overflow: auto; background: var(--paper); position: relative; --cols: 78px 118px minmax(200px, 1.4fr) minmax(222px, 1.2fr) minmax(150px, 1fr) minmax(160px, 1.1fr) minmax(170px, 1.1fr) 66px 64px minmax(150px, 1fr) 78px 96px minmax(110px, 1fr) 96px; }
.sheet.with-sel { --cols: 26px 78px 118px minmax(200px, 1.4fr) minmax(222px, 1.2fr) minmax(150px, 1fr) minmax(160px, 1.1fr) minmax(170px, 1.1fr) 66px 64px minmax(150px, 1fr) 78px 96px minmax(110px, 1fr) 96px; }
.sheet-inner { min-width: 1950px; padding-bottom: 60px; }
.hrow, .row { display: grid; grid-template-columns: var(--cols); column-gap: 8px; align-items: start; padding: 0 16px 0 18px; }
.hrow { position: sticky; top: 0; z-index: 6; background: var(--bar); color: var(--console-ink); font-size: 12px; font-weight: 700; letter-spacing: .02em; height: 32px; align-items: center; }
.day { position: sticky; top: 32px; z-index: 5; display: flex; align-items: baseline; gap: 12px; padding: 7px 18px; background: #dbe3ea; border-bottom: 1px solid var(--line); border-top: 1px solid #c5d0da; font-weight: 700; }
.day small { font-weight: 500; color: var(--muted); }
.day.today { background: #cfe9ee; }
.row { position: relative; background: var(--panel); border-bottom: 1px solid var(--line-2); padding-top: 9px; padding-bottom: 9px; }
.row::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--lc, #9aa9b7); }
.row:hover { background: #fbfdfe; }
.row.mine { background: #f3fafb; }
.row.mine::after { content: ""; position: absolute; left: 5px; top: 0; bottom: 0; width: 2px; background: var(--accent); }
.row.st-soon { box-shadow: inset 0 0 0 2px var(--ok); background: #f1faf5; }
.row.st-live { box-shadow: inset 0 0 0 3px var(--bad); background: #fff5f6; animation: blink 1s steps(2, jump-none) infinite; }
.row.st-done { opacity: .62; }
@keyframes blink { 0%, 100% { box-shadow: inset 0 0 0 3px var(--bad); } 50% { box-shadow: inset 0 0 0 3px transparent; } }
.cell { min-width: 0; }
.cell .lbl { display: none; }
.tc { display: inline-block; font-family: var(--mono); font-weight: 700; font-size: 17px; background: var(--console); color: #fff; padding: 3px 8px; border-radius: 4px; letter-spacing: .02em; }
.st-soon .tc { background: var(--ok); }
.st-live .tc { background: var(--bad); }
.count { display: block; margin-top: 3px; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.st-soon .count { color: #137a43; }
.st-live .count { color: var(--bad); }
.lg { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; line-height: 1.25; }
.lg i { width: 9px; height: 9px; border-radius: 50%; background: var(--lc); flex: none; }
.match { font-weight: 700; font-size: 15px; line-height: 1.25; cursor: pointer; background: none; border: 0; padding: 0; text-align: left; }
.match:hover { color: var(--accent-2); text-decoration: underline; }
.sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.person { cursor: help; border-bottom: 1px dotted #8ea0b0; font-weight: 600; }
.person.none { color: var(--muted); border: 0; cursor: default; font-weight: 400; }
.tel { display: block; font-size: 12.5px; color: var(--muted); text-decoration: none; }
.tel:hover { color: var(--accent-2); text-decoration: underline; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; background: #b9c4ce; flex: none; }
.dot.green { background: var(--ok); } .dot.orange { background: var(--warn); } .dot.red { background: var(--bad); }
.dot.asked { background: transparent; border: 2px solid #7f93a5; }
.late { display: inline-block; background: var(--warn-soft); color: #8a5200; font-size: 12px; font-weight: 700; padding: 0 6px; border-radius: 4px; margin-left: 6px; }
.late-form { display: flex; gap: 4px; margin-top: 5px; align-items: center; }
.late-form input { width: 70px; min-height: 28px; padding: 3px 6px; }
.cell-input { min-height: 30px; padding: 4px 7px; }
.cell select { min-height: 30px; padding: 3px 5px; }
.cell .stack { display: flex; flex-direction: column; gap: 4px; }
.sugg { display: flex; flex-direction: column; align-items: stretch; gap: 2px; font-size: 12px; background: var(--accent-soft); border-radius: 4px; padding: 4px 7px 5px; }
.sugg-lbl { font-size: 11px; color: var(--muted); }
.sugg-name { font-size: 13px; line-height: 1.25; overflow-wrap: anywhere; }
.sugg-acts { display: flex; gap: 4px; margin-top: 2px; }
.sugg .mini { padding: 1px 8px; }
.compn { font-weight: 800; font-size: 16px; font-family: var(--mono); }
.claim { display: block; font-size: 12.5px; color: #8d1523; margin-top: 3px; }
.claimbtn { appearance: none; border: 1px dashed #c4ced8; background: transparent; padding: 2px 8px; border-radius: 4px; cursor: pointer; color: var(--muted); font-size: 12.5px; }
.claimbtn.has { border: 1px solid #efb4bb; background: var(--bad-soft); color: #8d1523; font-weight: 600; max-width: 100%; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.claimbtn:hover { border-color: var(--accent); color: var(--accent-2); }
.gfx-link { font-family: var(--mono); font-weight: 600; text-decoration: none; }
.gfx-link:hover { text-decoration: underline; }
.lock { font-size: 11px; color: var(--muted); }

@media (max-width: 900px) {
  .sheet { overflow: auto; --cols: 1fr; }
  .sheet-inner { min-width: 0; }
  .hrow { display: none; }
  .day { top: 0; }
  .row { grid-template-columns: 1fr 1fr; row-gap: 8px; padding-top: 12px; padding-bottom: 12px; }
  .row .cell { grid-column: span 1; }
  .row .cell.c-time, .row .cell.c-match { grid-column: span 2; }
  .cell .lbl { display: block; font-size: 11px; color: var(--muted); font-weight: 700; margin-bottom: 2px; }
  .cell.c-time { display: flex; align-items: center; gap: 10px; }
  .cell.c-time .count { margin: 0; }
  .sheet-bar { gap: 8px; }
  .sheet-bar input[type=search] { min-width: 140px; flex: 1; }
  .sheet-bar select { max-width: 100%; }
}

/* ---------- panel boczny transmisji ---------- */
.drawer-back { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100vw); background: var(--paper); z-index: 51; box-shadow: -12px 0 40px rgba(0,0,0,.35); display: flex; flex-direction: column; animation: slidein .18s ease-out; }
@keyframes slidein { from { transform: translateX(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.drawer > header { background: var(--console); color: #fff; padding: 14px 16px 12px; border-left: 6px solid var(--lc, #5fd3e0); display: flex; gap: 10px; }
.drawer > header h2 { font-size: 18px; }
.drawer > header .meta { color: #9db6c8; font-size: 13px; margin-top: 3px; }
.drawer > header .icon-btn { color: #cfe0ec; }
.drawer-body { flex: 1; overflow: auto; padding: 14px 16px 40px; }
.sec { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 12px; }
.sec > h3 { font-size: 13px; margin-bottom: 10px; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.sec > h3 .spacer { flex: 1; }
.cand { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 8px 0; border-top: 1px solid var(--line-2); align-items: center; }
.cand:first-of-type { border-top: 0; }
.cand .nm { font-weight: 700; }
.cand .why { font-size: 12.5px; color: var(--muted); grid-column: 1; }
.cand.off .nm { color: var(--muted); }
.cand .acts { grid-row: 1 / span 2; grid-column: 2; display: flex; gap: 6px; align-items: center; }
.bubble { max-width: 86%; padding: 7px 10px; border-radius: 10px; margin: 6px 0; font-size: 13.5px; background: var(--field); border: 1px solid var(--line); }
.bubble.out { margin-left: auto; background: var(--accent-soft); border-color: #b5dde4; }
.bubble small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.qq { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.note-row { display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; border-top: 1px solid var(--line-2); }
.note-row:first-of-type { border-top: 0; }
.note-row small { color: var(--muted); display: block; }

/* ---------- okna dialogowe ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 80; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 14px 14px; overflow: auto; }
.modal { background: var(--panel); border-radius: 10px; width: min(480px, 100%); box-shadow: 0 24px 60px rgba(0,0,0,.45); }
.modal.wide { width: min(860px, 100%); }
.modal > header { display: flex; align-items: center; padding: 14px 18px 8px; }
.modal > header h2 { font-size: 18px; flex: 1; }
.modal-body { padding: 6px 18px 14px; }
.modal > footer { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px 16px; border-top: 1px solid var(--line-2); }
#toasts { position: fixed; right: 14px; bottom: 14px; z-index: 120; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 28px)); }
.toast { background: var(--console); color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.25); border-left: 5px solid #5fd3e0; transition: opacity .4s, transform .4s; }
.toast.ok { border-left-color: var(--ok); } .toast.bad { border-left-color: var(--bad); background: #3a1017; }
.toast.out { opacity: 0; transform: translateY(8px); }
#tip { position: fixed; z-index: 130; background: var(--console); color: #fff; padding: 5px 9px; border-radius: 5px; font-size: 13px; font-weight: 600; pointer-events: none; box-shadow: 0 6px 18px rgba(0,0,0,.3); max-width: 280px; }

/* ---------- tabele i panele ---------- */
.tbl-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); padding: 8px 10px; background: #f3f6f8; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #f6fafb; }
.tbl tr.off td { color: var(--muted); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs button { appearance: none; background: transparent; border: 0; border-bottom: 3px solid transparent; padding: 9px 14px; cursor: pointer; font-weight: 600; color: var(--muted); white-space: nowrap; }
.tabs button[aria-selected=true] { color: var(--ink); border-bottom-color: var(--accent); }
.avail-grid { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: auto; }
.av-row { display: grid; grid-template-columns: 170px repeat(var(--n), minmax(74px, 1fr)); background: var(--line); gap: 1px; }
.av-row > div { background: var(--panel); padding: 6px 7px; font-size: 12.5px; min-height: 40px; }
.av-row.head > div { background: #f3f6f8; font-weight: 700; position: sticky; top: 0; }
.av-row .nm { font-weight: 700; display: flex; align-items: center; }
.av-cell.yes { background: var(--ok-soft); color: #0f6a38; font-weight: 600; }
.av-cell.part { background: var(--warn-soft); color: #8a5200; font-weight: 600; }
.av-cell.we { background-color: #f6f8fa; }
.av-cell small { display: block; color: var(--muted); font-weight: 500; }
.dayboxes { display: flex; gap: 6px; flex-wrap: wrap; }
.dayboxes label { border: 1px solid var(--line); border-radius: 4px; padding: 4px 9px; cursor: pointer; user-select: none; }
.dayboxes input { position: absolute; opacity: 0; }
.dayboxes label:has(input:checked) { background: var(--accent); color: var(--on-accent); border-color: var(--accent-2); }
.dayboxes label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
pre.code { background: var(--console); color: #d5e6f2; padding: 10px 12px; border-radius: 6px; overflow: auto; font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; word-break: break-all; }
.kpi { display: flex; gap: 22px; flex-wrap: wrap; margin: 6px 0 10px; }
.kpi div b { display: block; font-size: 22px; line-height: 1.1; }
.kpi div span { color: var(--muted); font-size: 12.5px; }
ul.plain { margin: 6px 0; padding-left: 18px; }
ul.plain li { margin: 2px 0; }
.warn-list { background: var(--warn-soft); border: 1px solid #f1d49d; border-radius: 6px; padding: 8px 12px; margin: 8px 0; max-height: 220px; overflow: auto; font-size: 13px; }
.big-export { font-size: 15px; padding: 12px 18px; }

@media (max-width: 760px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .brand small { display: none; }
  .topbar { padding: 0 8px; }
  .av-row { grid-template-columns: 120px repeat(var(--n), minmax(70px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .row.st-live { animation: none; box-shadow: inset 0 0 0 4px var(--bad); }
  .rundown .rd.live { animation: none; outline-color: var(--bad); }
  .drawer { animation: none; }
  .toast { transition: none; }
}

/* =====================================================================
   Wersja 0.2: logo, motyw ciemny, trzy kanały, obsada robocza/potwierdzona,
   zaznaczanie, sprawdzanie dat, formularz publiczny
   ===================================================================== */
.brand .logo { height: 22px; width: auto; display: block; }
.brand-name { font-weight: 800; letter-spacing: .04em; font-size: 13px; color: #fff; padding-left: 10px; border-left: 1px solid #333333; }
.theme-btn { flex: none; appearance: none; background: transparent; border: 1px solid #333333; color: #e6e6e6; border-radius: 999px; padding: 5px 12px; margin-right: 8px; cursor: pointer; font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.theme-btn:hover { background: var(--console-2); }
.theme-btn.theme-float { position: absolute; top: 14px; right: 14px; color: var(--ink); border-color: var(--line); margin: 0; }
.theme-btn.theme-float:hover { background: var(--line-2); }
.login-form-side { position: relative; }
.login-brand .logo-big { width: 220px; height: auto; }
.login-brand .quote { font-size: 18px; line-height: 1.5; max-width: 34ch; font-style: italic; color: #dbe8f2; border-left: 3px solid #E94A11; padding-left: 14px; margin: 0; }

/* kanały: emocje / partner / slot */
.chans { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.ch { display: inline-flex; align-items: stretch; border-radius: 4px; overflow: hidden; font: inherit; border: 0; padding: 0; text-align: left; background: none; line-height: 1.15; }
button.ch { cursor: copy; }
.ch .ch-l { padding: 3px 6px; font-size: 10.5px; font-weight: 800; letter-spacing: .06em; display: flex; align-items: center; }
.ch .ch-v { padding: 3px 8px; font-family: var(--mono); font-weight: 700; font-size: 14px; display: flex; align-items: center; min-width: 38px; }
.ch.emocje .ch-l { background: var(--console-2); color: #fff; } .ch.emocje .ch-v { background: var(--console); color: #fff; font-size: 17px; }
.ch.partner .ch-l { background: var(--accent-2); color: #fff; } .ch.partner .ch-v { background: var(--accent-soft); color: #073f49; border: 1px solid #b5dde4; border-left: 0; }
.ch.slot .ch-l { background: #6b4c9a; color: #fff; } .ch.slot .ch-v { background: #ece6f6; color: #2f1d52; border: 1px solid #d3c6ea; border-left: 0; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch.miss .ch-v { background: transparent; color: var(--muted); border: 1px dashed var(--line); border-left: 0; font-weight: 500; }
.ch.partner:hover .ch-v { background: #fff; } button.ch.slot:hover .ch-v { background: #fff; }
.chans.big .ch .ch-v { font-size: 16px; } .chans.big .ch .ch-l { font-size: 11px; padding: 5px 8px; }
.sub.ext { font-style: italic; }

/* obsada RPS: robocza = pomarańczowa, potwierdzona = zielona */
.rps-box { border-radius: 6px; padding: 4px; border: 2px solid transparent; }
.rps-box.draft { border-color: var(--warn); background: var(--warn-soft); }
.rps-box.confirmed { border-color: var(--ok); background: var(--ok-soft); }
.rps-box select { background: var(--field); }
.rps-state { display: flex; align-items: center; gap: 6px; padding: 4px 2px 0; font-size: 12px; flex-wrap: wrap; }
.rps-box.draft .rps-state b { color: var(--warn-ink); text-transform: uppercase; letter-spacing: .04em; font-size: 11px; }
.rps-box.confirmed .rps-state b { color: var(--ok-ink); }
.person.own { border-bottom: 0; }
button.person { appearance: none; background: none; border: 0; border-bottom: 1px dotted #8ea0b0; padding: 0; font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
button.person:hover { color: var(--accent-2); border-bottom-style: solid; }
.addr { display: block; appearance: none; background: none; border: 0; padding: 0; margin-top: 2px; font-family: var(--mono); font-size: 12px; color: var(--muted); text-align: left; cursor: copy; word-break: break-all; }
.addr:hover { color: var(--ink); text-decoration: underline; }
.weblink { font-weight: 700; text-decoration: none; white-space: nowrap; }
.weblink:hover { text-decoration: underline; }
.weblink.light { color: #fff; }
.bad-text { color: var(--bad-ink); font-weight: 600; } .ok-text { color: var(--ok-ink); }
.mono { font-family: var(--mono); font-size: 12.5px; }

/* zaznaczanie transmisji */
.cell.c-sel { display: flex; justify-content: center; padding-top: 6px; }
.row.selected { background: #e3f1f4; }
.row.selected::before { width: 8px; }
.selbox { cursor: pointer; }
#sel-note { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; }

/* sprawdzanie dat: zgodna = zielone przez 10 s, błędna = czerwone do odwołania */
.row.dc-ok { outline: 3px solid var(--ok); outline-offset: -3px; background: var(--ok-soft); animation: dcfade 10s ease-out forwards; }
@keyframes dcfade { 0%, 85% { outline-color: var(--ok); } 100% { outline-color: transparent; } }
.row.dc-bad { background: var(--bad-soft); box-shadow: inset 6px 0 0 var(--bad); }
.dc-bad-box { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; background: var(--bad); color: #fff; padding: 4px 8px; border-radius: 4px; font-size: 12px; }
.dc-bad-box .mini { background: #fff; color: #7a0f1b; border-color: #fff; }
.dc-sec { border-color: var(--bad); background: var(--bad-soft); color: var(--bad-ink); }

/* panel boczny: adresy, historia zmian */
.addrs { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.addr-row { display: grid; grid-template-columns: 150px 1fr auto; gap: 8px; align-items: center; }
.addr-row .al { font-size: 12px; font-weight: 700; color: var(--muted); }
.addr-row code, .addr-row .mono-link { font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
.addr-row input { min-height: 30px; padding: 4px 7px; }
.hist-row { padding: 6px 0; border-top: 1px solid var(--line-2); font-size: 13px; }
.hist-row:first-of-type { border-top: 0; }
.hist-row .hw { font-size: 12px; color: var(--muted); }
.src { padding: 10px 0; border-top: 1px solid var(--line-2); }
.src:first-of-type { border-top: 0; }
.src-rep { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* ---------- motyw ciemny ---------- */
:root[data-theme="dark"] {
  --paper: #0b141c; --panel: #13212c; --field: #0e1a24; --ink: #e6eef4; --muted: #9db0c0;
  --line: #2a3d4d; --line-2: #213140; --accent: #2aa3b8; --accent-2: #5cc4d6; --accent-soft: #123a44; --on-accent: #02161b;
  --ok-soft: #12301f; --warn-soft: #382a0b; --bad-soft: #3a161c;
  --ok-ink: #6fdca0; --warn-ink: #f0b45a; --bad-ink: #ff9aa5;
  --console: #0a1620; --console-2: #183850; --bar: #000000; --bar-2: #1a1a1a;
  color-scheme: dark;
}
:root[data-theme="dark"] .btn:hover, :root[data-theme="dark"] .menu button:hover, :root[data-theme="dark"] .icon-btn:hover { background: #1b3040; border-color: #3d556a; }
:root[data-theme="dark"] .mini { background: #1b2c3a; }
:root[data-theme="dark"] .mini.ok { color: var(--ok-ink); border-color: #1f5a3a; background: var(--ok-soft); }
:root[data-theme="dark"] .mini.no { color: var(--bad-ink); border-color: #6a2a33; background: var(--bad-soft); }
:root[data-theme="dark"] .chip.ok { color: var(--ok-ink); } :root[data-theme="dark"] .chip.warn { color: var(--warn-ink); } :root[data-theme="dark"] .chip.bad { color: var(--bad-ink); }
:root[data-theme="dark"] .err-box { color: var(--bad-ink); border-color: #6a2a33; }
:root[data-theme="dark"] .warn-list, :root[data-theme="dark"] .banner.warn { border-color: #6a5420; }
:root[data-theme="dark"] .banner, :root[data-theme="dark"] .page > .banner { border-color: #25505b; }
:root[data-theme="dark"] .day { background: #1a2c3a; border-color: #2a3d4d; } :root[data-theme="dark"] .day.today { background: #174250; }
:root[data-theme="dark"] .row:hover { background: #172836; } :root[data-theme="dark"] .row.mine { background: #14303a; }
:root[data-theme="dark"] .row.st-soon { background: #14281f; } :root[data-theme="dark"] .row.st-live { background: #2a1317; }
:root[data-theme="dark"] .row.selected { background: #174250; }
:root[data-theme="dark"] .tc { border: 1px solid #2a3d4d; }
:root[data-theme="dark"] .tbl th, :root[data-theme="dark"] .av-row.head > div { background: #1a2c3a; }
:root[data-theme="dark"] .tbl tr.click:hover td { background: #172836; }
:root[data-theme="dark"] .av-cell.we { background-color: #112230; }
:root[data-theme="dark"] .late { color: var(--warn-ink); }
:root[data-theme="dark"] .claim, :root[data-theme="dark"] .claimbtn.has { color: var(--bad-ink); border-color: #6a2a33; }
:root[data-theme="dark"] .st-soon .count { color: var(--ok-ink); }
:root[data-theme="dark"] .ch.partner .ch-v { background: #123a44; color: #bfeaf2; border-color: #25505b; }
:root[data-theme="dark"] .ch.slot .ch-v { background: #2b2145; color: #e2d8f5; border-color: #45366b; }
:root[data-theme="dark"] .ch.slot .ch-l { background: #7d5bb5; }
:root[data-theme="dark"] .ch.emocje .ch-v { border: 1px solid #2a3d4d; }
:root[data-theme="dark"] .theme-btn.theme-float { color: var(--ink); }
:root[data-theme="dark"] .login-form-side { background: var(--paper); }
:root[data-theme="dark"] .drawer-back, :root[data-theme="dark"] .backdrop { background: rgba(0,0,0,.65); }
:root[data-theme="dark"] .bubble { background: #172836; } :root[data-theme="dark"] .bubble.out { background: #123a44; border-color: #25505b; }
:root[data-theme="dark"] .dc-bad-box .mini { color: #7a0f1b; }
:root[data-theme="dark"] .btn.primary:hover { background: var(--accent-2); }
@media (prefers-reduced-motion: reduce) { .row.dc-ok { animation: none; } }
@media (max-width: 900px) { .sheet.with-sel { --cols: 1fr; } .cell.c-sel { justify-content: flex-start; } .addr-row { grid-template-columns: 1fr; } }
.ch.miss .ch-v { background: transparent !important; color: var(--muted) !important; }
.ch.slot .ch-v { max-width: 230px; }
.ch.slot.miss .ch-v { max-width: none; border: 1px dashed #c3b5de; border-left: 0; color: var(--muted); }
:root[data-theme="dark"] .ch.partner .ch-l { background: #1d6f80; color: #fff; }
:root[data-theme="dark"] .ch.slot.miss .ch-v { border-color: #45366b; color: var(--muted); }
:root[data-theme="dark"] .dc-bad-box .mini { background: #fff; color: #7a0f1b; border-color: #fff; }

/* propozycje asystentów grup */
.prop-box { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.prop-box select { min-height: 28px; font-size: 12.5px; }
.prop-box.pending select { border-color: var(--accent); background: var(--accent-soft); }
.prop-lbl { font-size: 11px; color: var(--muted); }
.sugg.prop { border-left: 3px solid var(--accent); margin-top: 4px; }

.grp-box { margin-top: 4px; }
.grp-box select { min-height: 26px; font-size: 12px; color: var(--muted); }
.grp-box.set select { color: var(--ink, inherit); border-color: var(--accent); font-weight: 600; }
.chip.grp { background: var(--accent-soft); color: var(--accent); font-weight: 700; }

/* Przełącznik Podgląd / Edycja (producent) */
.mode-seg { flex: none; margin-right: 8px; border-color: #333333; background: transparent; }
.mode-seg button { background: transparent; color: #e6e6e6; padding: 5px 12px; font-size: 12.5px; }
.mode-seg button + button { border-left-color: #333333; }
.mode-seg button:hover { background: var(--console-2); }
.mode-seg button[aria-pressed=true] { background: #E94A11; color: #fff; }
.banner.preview { background: var(--warn-soft); color: var(--ink); border-bottom: 1px solid #f1d49d; }
@media (max-width: 760px) { .mode-seg button { padding: 5px 8px; } }

.claimwrap { display: flex; gap: 4px; align-items: center; min-width: 0; }
.claimwrap .claimbtn.has { flex: 1; min-width: 0; }
.claimadd { flex: none; appearance: none; border: 1px dashed #c4ced8; background: transparent; width: 24px; height: 24px; line-height: 1; border-radius: 4px; cursor: pointer; color: var(--muted); font-weight: 700; }
.claimadd:hover { border-color: var(--accent); color: var(--accent-2); }
.modal textarea { width: 100%; min-height: 96px; resize: vertical; }

/* ---------- telefon ---------- */
.bar-actions { display: contents; }
.burger, .view-title { display: none; }
.burger { flex: none; appearance: none; place-items: center; width: 40px; height: 40px; border: 1px solid #333333; border-radius: 8px; background: transparent; color: #fff; font-size: 20px; line-height: 1; cursor: pointer; }
.burger:hover { background: var(--bar-2); }
.view-title { flex: 1; min-width: 0; color: #fff; font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-left: 4px; }
.navmenu-root { position: fixed; inset: 0; z-index: 70; }
.navmenu-back { position: absolute; inset: 0; background: rgba(0,0,0,.55); }
.navmenu { position: absolute; top: 0; bottom: 0; left: 0; width: min(310px, 86vw); background: var(--bar); color: var(--console-ink); display: flex; flex-direction: column; overflow-y: auto; box-shadow: 12px 0 40px rgba(0,0,0,.4); animation: navin .16s ease-out; }
@keyframes navin { from { transform: translateX(-30px); opacity: .4; } to { transform: none; opacity: 1; } }
.navmenu-head { display: flex; align-items: center; gap: 8px; padding: 14px 10px 12px 16px; border-bottom: 1px solid #333333; }
.navmenu-head .who { flex: 1; min-width: 0; }
.navmenu-head .who strong { display: block; color: #fff; }
.navmenu-head .who span { display: block; color: #9aa7b3; font-size: 12.5px; }
.navmenu-head .icon-btn { color: #cfe0ec; }
.navmenu nav { padding: 6px 0; }
.navmenu nav a { display: flex; align-items: center; min-height: 48px; padding: 0 18px; color: var(--console-ink); text-decoration: none; font-weight: 600; font-size: 16px; border-left: 4px solid transparent; }
.navmenu nav a:hover { background: var(--bar-2); }
.navmenu nav a[aria-current=page] { color: #fff; background: rgba(255,255,255,.07); border-left-color: #E94A11; }
.navmenu-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 14px; border-top: 1px solid #333333; }
.navmenu-row .mode-seg, .navmenu-row .theme-btn { margin: 0; }
.navmenu-acts { border-top: 1px solid #333333; padding: 6px 0 14px; margin-top: auto; }
.navmenu-acts button { display: block; width: 100%; text-align: left; background: transparent; border: 0; color: var(--console-ink); padding: 0 18px; min-height: 46px; font-weight: 600; font-size: 15px; cursor: pointer; }
.navmenu-acts button:hover { background: var(--bar-2); }
@media (prefers-reduced-motion: reduce) { .navmenu { animation: none; } }
@media (max-width: 760px) {
  /* górny pasek w jednym rzędzie: ☰, logo, nazwa widoku, tryb pracy, konto; reszta w menu ☰ */
  .topbar { flex-wrap: nowrap; gap: 6px; padding: 0 8px; }
  .burger { display: grid; }
  .nav, .topbar .theme-btn { display: none; }
  .brand { margin-right: 0; }
  .mode-seg { margin-right: 0; }
  .mode-seg button { padding: 6px 9px; }
  .userbtn { padding: 3px; }
  .userbtn .uname { display: none; }
  .page { padding: 14px 12px 40px; }
  .banner { padding: 8px 12px; }
  .page-head h1 { font-size: 20px; }
  .panel { padding: 14px 12px; }

  /* pasek arkusza: filtry zajmują całą szerokość, przyciski akcji w jednym przewijanym rzędzie */
  .sheet-bar { padding: 8px 10px; gap: 6px 8px; }
  .sheet-bar .spacer { display: none; }
  .sheet-bar select, .sheet-bar input[type=search] { flex: 1 1 150px; min-width: 0; width: auto; }
  .sheet-bar .toolbar-note { flex: 1 0 100%; }
  .bar-actions { display: flex; gap: 6px; flex: 1 0 100%; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
  .bar-actions::-webkit-scrollbar { display: none; }
  .bar-actions .btn { flex: none; padding: 7px 11px; font-size: 13px; }

  /* karty transmisji: zaznaczenie w rogu zamiast osobnego rzędu */
  .row .cell.c-sel { position: absolute; top: 10px; right: 12px; z-index: 1; }
  .row .cell.c-sel input { width: 22px; height: 22px; }
  .row .cell.c-tech, .row .cell.c-rps, .row .cell.c-comm, .row .cell.c-claim { grid-column: span 2; }
  .day { padding: 7px 12px; flex-wrap: wrap; row-gap: 2px; }

  /* pola i przyciski wygodne dla palca; 16 px zapobiega powiększaniu strony w iOS przy wejściu w pole */
  input[type=text], input[type=password], input[type=search], input[type=tel], input[type=number], input[type=date], input[type=time], input[type=url], input[type=email], select, textarea, .cell-input { font-size: 16px; }
  .cell select, .cell-input { min-height: 38px; }

  /* panel boczny i okna dialogowe */
  .drawer-body { padding: 12px 10px 40px; }
  .drawer > header { padding: 12px 10px 10px; }
  .backdrop { padding: 3vh 10px 10px; }
  .modal > header { padding: 12px 14px 6px; }
  .modal-body { padding: 6px 14px 12px; }
  .modal > footer { flex-wrap: wrap; padding: 10px 14px 14px; }
  .modal > footer .btn { flex: 1 1 auto; justify-content: center; }
  .cand { grid-template-columns: 1fr; }
  .cand .acts { grid-row: auto; grid-column: 1; }
  #toasts { left: 10px; right: 10px; bottom: 10px; max-width: none; }
}
@media (max-width: 520px) {
  .brand-name { display: none; }
}
@media (pointer: coarse) {
  .btn { min-height: 38px; }
  .btn.small, .mini { min-height: 32px; }
  .seg button { min-height: 38px; }
  .claimadd { width: 32px; height: 32px; }
}
@media (min-width: 421px) and (max-width: 760px) { .view-title { display: block; } }
@media (max-width: 420px) { .brand { margin-right: auto; } }
