/* SPM Push – arkusz stylów.
   Jedna rodzina: Archivo (zmienna szerokość). Szeroki i ciężki na nazwę klienta,
   wąski w nagłówkach kolumn, zwykły w tekście. Pomarańcz z logo SPM tylko dla
   „opublikowany” (gwiazda) i głównego przycisku. */

@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url("../fonts/archivo-latin-ext-standard-normal.589f7bc0fac4.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308,
    U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113,
    U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url("../fonts/archivo-latin-standard-normal.de2f1fe81758.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
    U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --paper: #ffffff;
  --ink: #1d1c1a;
  --ink-soft: #5b5852;
  --line: #e2dfd9;
  --mist: #f4f3f0;
  --star: #ef8a00;
  --star-press: #d77b00;
  --lock: #a39e94;
  --danger: #b3261e;
  --focus: #1f5fd6;
  --radius-s: 4px;
  --radius-m: 8px;
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  font-stretch: 100%;
}

a { color: inherit; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.muted { color: var(--ink-soft); }
.nowrap { white-space: nowrap; }
.hint { color: var(--ink-soft); font-size: 13.5px; margin: 6px 0 0; }

/* ---------- Pasek górny ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { display: block; height: 34px; width: auto; }
.brand-name { font-weight: 800; font-stretch: 115%; font-size: 17px; letter-spacing: -0.01em; }

.client-nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.client-nav a {
  padding: 7px 12px;
  border-radius: var(--radius-m);
  text-decoration: none;
  white-space: nowrap;
  color: var(--ink-soft);
  font-weight: 550;
}
.client-nav a:hover { background: var(--mist); color: var(--ink); }
.client-nav a[aria-current="page"] { color: var(--ink); background: var(--mist); }

.user-nav { display: flex; align-items: center; gap: 18px; font-size: 14px; }
.user-nav a { text-decoration: none; color: var(--ink-soft); }
.user-nav a:hover { color: var(--ink); text-decoration: underline; }
.user-nav form { margin: 0; }

.linklike {
  background: none; border: 0; padding: 0; font: inherit; color: var(--ink-soft); cursor: pointer;
}
.linklike:hover { color: var(--ink); text-decoration: underline; }

/* ---------- Układ ---------- */

.page { max-width: 1120px; margin: 0 auto; padding: 28px 24px 64px; }
.page-wide { max-width: 1440px; }
.narrow { max-width: 640px; }

.page-title {
  font-size: 28px;
  line-height: 1.15;
  font-weight: 750;
  font-stretch: 105%;
  letter-spacing: -0.015em;
  margin: 0 0 18px;
}
.back { margin: 0 0 8px; font-size: 14px; }
.back a { color: var(--ink-soft); }

.flash-stack { margin-bottom: 20px; display: grid; gap: 8px; }
.flash {
  margin: 0; padding: 10px 14px; border-radius: var(--radius-m);
  background: var(--mist); border-left: 4px solid var(--ink);
}
.flash-success { border-left-color: var(--star); }
.flash-error { border-left-color: var(--danger); }

/* ---------- Przyciski ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: var(--radius-m);
  border: 1.5px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--mist); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn .icon { width: 18px; height: 18px; }
.btn-primary { background: var(--star); border-color: var(--star); color: #1d1c1a; }
.btn-primary:hover { background: var(--star-press); border-color: var(--star-press); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #8f1e18; border-color: #8f1e18; }
.btn-danger-ghost { border-color: var(--danger); color: var(--danger); }
.btn-danger-ghost:hover { background: #fbeceb; }
.btn-small { min-height: 32px; padding: 4px 12px; font-size: 14px; }
.btn-block { width: 100%; }

/* ---------- Formularze ---------- */

.stack-form { display: grid; gap: 6px; }
.stack-form > label { font-weight: 600; margin-top: 12px; }
.stack-form .btn-primary[type="submit"] { justify-self: start; margin-top: 18px; }

input[type="text"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="email"],
select,
textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-m);
  padding: 9px 12px;
}
input:hover, select:hover, textarea:hover { border-color: #c9c5bd; }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 0; border-color: var(--focus);
}
textarea { resize: vertical; line-height: 1.45; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--ink); margin: 0; }

.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 550; }

fieldset { border: 0; padding: 0; margin: 20px 0 0; }
legend { font-weight: 700; font-size: 17px; padding: 0; margin-bottom: 10px; }

.form-error { color: var(--danger); margin: 6px 0 0; font-weight: 550; }
.form-actions { margin-top: 18px; display: flex; gap: 12px; }

.channel-pick { display: grid; gap: 10px; }
.channel-option {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-m);
  padding: 12px 14px;
}
.channel-option details { margin-top: 8px; }
.channel-option summary { cursor: pointer; color: var(--ink-soft); font-size: 14px; }
.channel-option textarea { margin-top: 8px; }
.channel-line { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

.state { font-size: 13.5px; color: var(--ink-soft); display: inline-flex; align-items: center; gap: 6px; }
.state .star { width: 16px; height: 16px; fill: var(--star); }
.state-locked { color: var(--lock); }

/* ---------- Logowanie ---------- */

.auth { background: var(--mist); }
.auth-main { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-panel {
  width: 100%;
  max-width: 400px;
  background: var(--paper);
  border-radius: 12px;
  padding: 32px;
  border: 1px solid var(--line);
}
.auth-panel h1 { font-size: 24px; font-stretch: 105%; margin: 18px 0 10px; letter-spacing: -0.01em; }
.auth-panel form { display: grid; gap: 6px; }
.auth-panel label { font-weight: 600; margin-top: 10px; }
.auth-panel .btn-block { margin-top: 20px; }
.auth-logo { display: block; width: 150px; height: auto; }
.auth-lead { margin: 0 0 6px; color: var(--ink-soft); }
.auth-note { margin: 18px 0 0; font-size: 14px; color: var(--ink-soft); }
.setup-steps { padding-left: 20px; margin: 0 0 12px; color: var(--ink-soft); }
.setup-steps li { margin-bottom: 4px; }
.qr { display: block; margin: 8px auto; image-rendering: pixelated; border: 1px solid var(--line); border-radius: var(--radius-m); }
.secret { margin: 8px 0 4px; font-size: 14px; }
.secret summary { cursor: pointer; color: var(--ink-soft); }
.secret code { display: block; margin-top: 6px; font-size: 15px; letter-spacing: 0.06em; word-break: break-all; }

/* ---------- Strona klienta ---------- */

.client-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.client-title {
  margin: 0;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1;
  font-weight: 850;
  font-stretch: 118%;
  letter-spacing: -0.025em;
}
.client-rule { margin: 10px 0 0; color: var(--ink-soft); }

.interrupted {
  border: 1.5px solid var(--star);
  border-radius: var(--radius-m);
  padding: 12px 16px;
  margin-bottom: 22px;
}
.interrupted h2 { font-size: 16px; margin: 0 0 8px; }
.interrupted ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.interrupted li { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: var(--radius-m);
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 600;
}
.tabs a:hover { background: var(--mist); color: var(--ink); }
.tabs a[aria-current="page"] { background: var(--ink); color: var(--paper); }
.count { font-variant-numeric: tabular-nums; font-weight: 500; opacity: 0.75; }
.search input { width: 240px; min-height: 38px; padding: 6px 12px; }

/* ---------- Tabela filmów ---------- */

.table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-m); }

.grid { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 640px; }
.grid thead th {
  position: sticky;
  top: 0;
  background: var(--paper);
  border-bottom: 1.5px solid var(--ink);
  padding: 12px 10px 10px;
  text-align: center;
  vertical-align: bottom;
  font-stretch: 78%;
  line-height: 1.15;
}
.grid thead .col-film { text-align: left; padding-left: 16px; font-stretch: 100%; font-weight: 700; }
.col-ch { width: 112px; }
.ch-platform { display: block; font-size: 12.5px; font-weight: 500; color: var(--ink-soft); }
.ch-name { display: block; font-size: 15px; font-weight: 700; }

.grid tbody th,
.grid tbody td { border-bottom: 1px solid var(--line); }
.grid tbody tr:last-child th,
.grid tbody tr:last-child td { border-bottom: 0; }
.grid tbody tr:hover { background: var(--mist); }

.film {
  position: sticky;
  left: 0;
  background: inherit;
  text-align: left;
  font-weight: inherit;
  padding: 8px 10px 8px 16px;
  min-width: 300px;
  z-index: 1;
}
.film-inner { display: flex; align-items: center; gap: 8px; }
.grid tbody tr { background: var(--paper); }
.film-link { display: flex; align-items: center; gap: 12px; text-decoration: none; flex: 1; min-width: 0; }
.film-link:hover .film-title { text-decoration: underline; }
.thumb {
  flex: none;
  width: 40px;
  height: 71px;
  border-radius: var(--radius-s);
  background: var(--mist) center / 18px no-repeat url("../img/favicon.55e51f02cbcb.svg");
  overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.film-text { display: grid; min-width: 0; }
.film-title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.film-meta { color: var(--ink-soft); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.dl {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-m);
  color: var(--ink-soft);
}
.dl:hover { background: var(--paper); color: var(--ink); }
.dl .icon { width: 20px; height: 20px; }
.row-archived .film-title, .row-archived .thumb { opacity: 0.6; }

.cell { text-align: center; padding: 6px 4px; }
.mark {
  display: inline-grid;
  justify-items: center;
  gap: 3px;
  min-width: 72px;
  min-height: 60px;
  padding: 8px 6px 6px;
  border: 0;
  border-radius: var(--radius-m);
  background: transparent;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.mark:hover:not(:disabled) { background: var(--paper); box-shadow: inset 0 0 0 1.5px var(--line); }
.mark:disabled { cursor: not-allowed; opacity: 0.35; }
.box {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 2px solid var(--ink);
  background: var(--paper);
}
.mark:hover:not(:disabled) .box { border-color: var(--star); }
.cell-note { font-size: 12.5px; line-height: 1.2; color: var(--ink-soft); font-variant-numeric: tabular-nums; min-height: 15px; }
.cell-note abbr { text-decoration: none; font-weight: 650; color: var(--ink); }
.override-flag { color: var(--danger); font-weight: 800; }

.cell-locked .box {
  border-color: var(--lock);
  background: repeating-linear-gradient(-45deg, #e7e4de 0 3px, #f6f5f2 3px 6px);
}
.cell-locked .cell-note { color: var(--lock); }

.cell-posted .box { border: 0; background: transparent; width: 32px; height: 32px; }
.cell-posted .star { width: 32px; height: 32px; fill: var(--star); }
.cell-posted .mark:hover .star { fill: var(--star-press); }

.na { display: inline-block; width: 16px; height: 2px; background: var(--line); vertical-align: middle; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin: 14px 2px 0;
  font-size: 13.5px;
  color: var(--ink-soft);
}
.legend > span { display: inline-flex; align-items: center; gap: 8px; }
.legend-box { width: 16px; height: 16px; border: 2px solid var(--ink); border-radius: 4px; }
.legend-locked { border-color: var(--lock); background: repeating-linear-gradient(-45deg, #e7e4de 0 2px, #f6f5f2 2px 4px); }
.legend .star { width: 18px; height: 18px; fill: var(--star); }
.legend-dash { width: 14px; height: 2px; background: var(--line); }

.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 16px; color: var(--ink-soft); }

.empty {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-m);
  padding: 40px 24px;
  text-align: center;
  color: var(--ink-soft);
}
.empty p { margin: 0 0 14px; }

/* ---------- Okna dialogowe ---------- */

.dialog {
  width: min(560px, calc(100vw - 32px));
  border: 0;
  border-radius: 12px;
  padding: 0;
  color: var(--ink);
  box-shadow: 0 24px 64px rgba(29, 28, 26, 0.28);
}
.dialog-small { width: min(460px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(29, 28, 26, 0.45); }
.dialog[open] { animation: rise 160ms ease-out; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.dialog-body { padding: 24px; }
.dialog h2 { margin: 0; font-size: 20px; font-stretch: 105%; line-height: 1.2; }
.dialog-film { margin: 4px 0 16px; color: var(--ink-soft); }
.note { border-radius: var(--radius-m); padding: 12px 14px; margin-bottom: 16px; }
.note p { margin: 0; }
.note-lock { background: repeating-linear-gradient(-45deg, #efede9 0 6px, #f7f6f3 6px 12px); border: 1.5px solid var(--lock); }
.note-lock .check { margin-top: 10px; }
.note-posted { background: #fff4e5; border: 1.5px solid var(--star); }
.note-posted .star { width: 18px; height: 18px; fill: var(--star); vertical-align: -3px; }
.desc-block { display: grid; gap: 6px; }
.desc-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.desc-head label { font-weight: 650; }
.desc-block textarea { background: var(--mist); border-color: var(--mist); }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; align-items: center; }
.spacer { flex: 1; }

/* ---------- Wysyłanie ---------- */

.drop {
  position: relative;
  border: 2px dashed #cfcac1;
  border-radius: 12px;
  background: var(--mist);
  margin-bottom: 8px;
}
.drop.is-over { border-color: var(--star); background: #fff4e5; }
.drop-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.drop-label { display: grid; gap: 4px; padding: 30px 24px; text-align: center; cursor: pointer; }
.drop-label strong { font-size: 18px; font-stretch: 105%; }
.drop-label span { color: var(--ink-soft); font-size: 14px; }
.drop-file { padding: 0 24px 20px; text-align: center; font-weight: 650; }
.drop:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }

.progress-panel { margin-top: 28px; border: 1.5px solid var(--line); border-radius: 12px; padding: 20px; }
.progress-panel h2 { margin: 0 0 12px; font-size: 18px; }
.bar { height: 12px; border-radius: 6px; background: var(--mist); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--star); transition: width 300ms linear; }
.progress-stats { display: flex; justify-content: space-between; gap: 12px; margin: 10px 0 0; font-variant-numeric: tabular-nums; }
.progress-stats [data-percent] { font-weight: 750; }
.progress-actions { display: flex; gap: 10px; margin-top: 16px; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 16px 0; font-size: 14px; }
.facts dt { color: var(--ink-soft); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- Strona filmu ---------- */

.video-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.video-layout { display: grid; grid-template-columns: minmax(260px, 380px) 1fr; gap: 36px; margin-top: 8px; }
.player { width: 100%; max-height: 70vh; background: #000; border-radius: var(--radius-m); display: block; }
.player-v { aspect-ratio: 9 / 16; object-fit: contain; }
.player-gone { border: 1.5px dashed var(--line); border-radius: var(--radius-m); padding: 16px; text-align: center; color: var(--ink-soft); }
.player-gone img { max-width: 160px; border-radius: var(--radius-s); opacity: 0.6; }

.history { margin-top: 40px; }
.history h2, .danger-zone h2 { font-size: 18px; margin: 0 0 10px; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.timeline time { color: var(--ink-soft); font-variant-numeric: tabular-nums; margin-right: 8px; }

.danger-zone { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); display: grid; gap: 12px; }
.danger-zone form { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0; }
.danger-zone .hint { margin: 0; }

/* ---------- Listy (dziennik, ustawienia) ---------- */

.list { border-collapse: collapse; width: 100%; font-size: 14.5px; }
.list th { text-align: left; font-weight: 700; padding: 10px 12px; border-bottom: 1.5px solid var(--ink); }
.list td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.list tbody tr:last-child td { border-bottom: 0; }
.channel-edit td { min-width: 110px; }
.channel-edit input[type="number"] { width: 90px; }
.settings-form { max-width: 820px; }

.client-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; max-width: 640px; }
.client-list a {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 16px 18px; border: 1.5px solid var(--line); border-radius: var(--radius-m); text-decoration: none;
}
.client-list a:hover { border-color: var(--ink); }
.client-list-name { font-weight: 800; font-stretch: 112%; font-size: 19px; }
.client-list-count { color: var(--ink-soft); }

.error-page { padding-top: 40px; }

/* ---------- Telefon ---------- */

@media (max-width: 820px) {
  .topbar { flex-wrap: wrap; gap: 10px 16px; padding: 10px 16px; position: static; }
  .client-nav { order: 3; flex-basis: 100%; }
  .user-nav { margin-left: auto; gap: 12px; }
  .page { padding: 20px 16px 48px; }
  .video-layout { grid-template-columns: 1fr; }
  .search, .search input { width: 100%; }
  .film { min-width: 220px; }
  .film-meta { display: none; }
  .grid thead th { top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .dialog[open] { animation: none; }
  .bar span { transition: none; }
}

/* ---------- Język, konto, członkowie ---------- */

.lang-switch { display: flex; justify-content: center; gap: 4px; margin-top: 16px; }
.lang-switch button {
  background: none;
  border: 0;
  padding: 6px 10px;
  border-radius: var(--radius-m);
  font: inherit;
  font-size: 14px;
  color: var(--ink-soft);
  cursor: pointer;
}
.lang-switch button:hover { color: var(--ink); background: var(--paper); }
.lang-switch button[aria-current="true"] { color: var(--ink); font-weight: 700; }
.auth-main { align-content: center; }

.inline-row { display: flex; gap: 10px; align-items: center; }
.inline-row select { max-width: 260px; }
.account-links { margin-top: 24px; }

.secret-box { padding: 16px 18px; border: 1.5px solid var(--star); border-radius: var(--radius-m); background: #fff8ee; font-size: 15px; }
.one-time { font-size: 18px; font-weight: 700; letter-spacing: 0.04em; user-select: all; }

.account-section { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); }
.account-section h2 { font-size: 18px; margin: 0 0 10px; }
.status-on { font-weight: 700; }
.setup-box { border: 1.5px solid var(--line); border-radius: var(--radius-m); padding: 16px 18px; margin: 16px 0; }
.inline-row input[type="password"] { max-width: 280px; }
