/* Panel ZWYŻKA — kolory z palety aplikacji (zwyzka-design-tokens.json): granat, żółć, szarości. */
:root {
  --navy: #15191f;
  --navy-2: #25313a;
  --yellow: #f4b000;
  --yellow-soft: #fff4d6;
  --grey: #eef1f3;
  --grey-2: #f6f8f9;
  --line: #d5dbe0;
  --text: #15191f;
  --muted: #5a6670;
  --ok: #1d7a46;
  --ok-soft: #e3f4ea;
  --err: #b3261e;
  --err-soft: #fdecea;
  --warn: #8a5a00;
  --warn-soft: #fff4d6;
  --radius: 10px;
  font-family: Montserrat, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: var(--grey);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; line-height: 1.45; font-size: 15px; background: var(--grey); }
a { color: var(--navy-2); }
h1 { font-size: 1.6rem; margin: 0 0 1rem; line-height: 1.25; overflow-wrap: anywhere; }
h2 { font-size: 1.15rem; margin: 1.4rem 0 .6rem; }
h3 { font-size: 1rem; margin: 0 0 .7rem; }
img, video { max-width: 100%; }

/* ─── Nagłówek: marka · menu · konto; na węższych ekranach menu w drugim wierszu ─── */
.top {
  background: var(--navy); color: #fff; padding: .55rem 1.2rem;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "brand nav who";
  align-items: center; gap: .4rem 1rem;
}
.top.bare { grid-template-columns: 1fr; grid-template-areas: "brand"; }
.brand { grid-area: brand; color: #fff; text-decoration: none; font-weight: 600; white-space: nowrap; padding: .35rem 0; }
.brand span { color: var(--yellow); font-weight: 800; letter-spacing: .04em; }
.nav { grid-area: nav; display: flex; flex-wrap: wrap; gap: .2rem; }
.nav a { color: #d9dfe4; text-decoration: none; padding: .45rem .7rem; border-radius: 8px; white-space: nowrap; }
.nav a:hover, .nav a[aria-current] { background: var(--navy-2); color: #fff; }
.nav a[aria-current] { box-shadow: inset 0 -3px 0 var(--yellow); }
.who { grid-area: who; color: #d9dfe4; font-size: .9rem; white-space: nowrap; justify-self: end; }
.who a { color: #fff; }
@media (max-width: 1320px) {
  .top { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "brand who" "nav nav"; padding-bottom: .45rem; }
  .nav { margin: 0 -.7rem; }
}
@media (max-width: 640px) {
  .top { padding: .45rem 1rem .4rem; }
  .nav { gap: .15rem; margin: 0 -.5rem; }
  .nav a { padding: .35rem .5rem; font-size: .92rem; }
  .who .role { display: none; }
}

.main { max-width: 1180px; margin: 0 auto; padding: 1.5rem 1.2rem 4rem; }
@media (max-width: 640px) {
  .main { padding: 1.1rem 1rem 3rem; }
  h1 { font-size: 1.35rem; }
}

/* ─── Karty i formularze ─── */
.card { background: #fff; border-radius: var(--radius); padding: 1.1rem 1.3rem; margin: 0 0 1rem; border: 1px solid var(--line); }
.card.sub { background: #fafbfc; }
.card.warn { border-color: var(--yellow); background: var(--yellow-soft); }
.card.narrow { max-width: 460px; }
.card > h2:first-child, .card > form > h2:first-child, .card h3:first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.card.placeholder { color: var(--muted); text-align: center; padding: 2.5rem 1rem; border-style: dashed; }
@media (max-width: 640px) { .card { padding: 1rem; } }
.field { display: flex; flex-direction: column; gap: .25rem; margin: 0 0 .9rem; min-width: 0; }
.field > span { font-weight: 600; font-size: .9rem; }
.field small, .muted { color: var(--muted); }
.field small { font-size: .82rem; }
input, select, textarea, button, .button { font: inherit; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=url], input:not([type]), select, textarea {
  border: 1px solid var(--line); border-radius: 8px; padding: .55rem .65rem; background: #fff; width: 100%; color: var(--text); min-height: 2.6rem;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible, .file-pick:focus-within { outline: 3px solid var(--yellow); outline-offset: 1px; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem; min-height: 2.6rem;
  border: 1px solid var(--navy-2); background: #fff; color: var(--navy); border-radius: 8px; padding: .5rem 1rem;
  cursor: pointer; text-decoration: none; font-weight: 600; line-height: 1.2; text-align: center;
}
button:hover, .button:hover { background: var(--grey-2); }
button.primary, .button.primary { background: var(--yellow); border-color: var(--yellow); color: var(--navy); }
button.primary:hover, .button.primary:hover { background: #e3a400; border-color: #e3a400; }
button.danger, .button.danger { border-color: var(--err); color: var(--err); }
button.danger:hover { background: var(--err-soft); }
button.small, .button.small { padding: .3rem .65rem; font-size: .85rem; min-height: 2rem; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.link { background: none; border: none; color: #fff; text-decoration: underline; padding: 0; font-weight: 400; min-height: 0; display: inline; }
button.link:hover { background: none; color: var(--yellow); }
form.inline { display: inline; }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 0 0 .5rem; }
.row .grow { flex: 1; min-width: 200px; width: auto; }
.row select { width: auto; }
.row input[type=number] { width: 5.5rem; }
.mini { font-size: .85rem; color: var(--muted); display: inline-flex; align-items: center; gap: .3rem; }
.grid2, .grid3, .grid4 { display: grid; gap: 0 1rem; }
.grid2 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: minmax(0, 1fr); } }
/* Pasek przycisków formularza: zapis z lewej, usuwanie (klasa end) dosunięte do prawej. */
.actions-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .4rem 0 0; }
.actions-row > .end { margin-left: auto; }
.head-row { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; margin: 0 0 .6rem; }
.head-row > form { flex: 1; min-width: 260px; margin: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 0 0 1rem; }
.toolbar > .end { margin-left: auto; }
.filters { background: #fff; padding: .6rem; border-radius: var(--radius); border: 1px solid var(--line); margin-bottom: 1rem; }
.filters select { width: auto; max-width: 100%; }
.status-line { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: 0 0 1rem; color: var(--muted); }
.check { display: flex; gap: .5rem; align-items: center; margin: .5rem 0 .8rem; }
.checks { display: flex; flex-wrap: wrap; gap: .4rem 1rem; }
.checks label { display: inline-flex; gap: .35rem; align-items: center; }
.file-pick { position: relative; overflow: hidden; }
.file-pick input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
/* Fakty „etykieta: wartość” na kartach kursanta, kodu, zgłoszenia. */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .6rem 1.2rem; margin: 0 0 1rem; }
.facts dt { font-size: .8rem; color: var(--muted); font-weight: 600; }
.facts dd { margin: 0; overflow-wrap: anywhere; }

/* ─── Tabele: na wąskim ekranie przewijane w poziomie, nie rozpychają strony ─── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 0 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.table { width: 100%; border-collapse: collapse; background: #fff; }
.table th, .table td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--grey); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table th { background: var(--grey-2); font-size: .85rem; color: var(--muted); white-space: nowrap; }
.table .num { text-align: right; white-space: nowrap; }
.table .nowrap { white-space: nowrap; }
.table .wrap { overflow-wrap: anywhere; min-width: 12rem; }
.table td .row { margin: 0; }
.table tr.error td, .table tr.err td { background: var(--err-soft); }
.table tr.new td { background: var(--ok-soft); }
.table tr.changed td { background: var(--yellow-soft); }
.table tr.muted td { color: var(--muted); }
@media (max-width: 760px) { .table { min-width: 620px; } }
.actions { white-space: nowrap; }
.actions form.inline + form.inline { margin-left: .3rem; }
.actions details { white-space: normal; min-width: 17rem; }
.actions details .access-form { margin: .5rem 0; flex-wrap: nowrap; }
.actions details .access-form input:not([type=date]) { min-width: 9rem; }
.actions details .access-form input[type=date] { width: auto; }

.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .8rem; background: var(--grey); color: var(--muted); font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.flash { padding: .7rem 1rem; border-radius: 8px; margin: 0 0 1rem; font-weight: 600; }
.flash.ok { background: var(--ok-soft); color: var(--ok); border: 1px solid #b9e2c9; }
.flash.err { background: var(--err-soft); color: var(--err); border: 1px solid #f3c4c0; }
.err-text { color: var(--err); }
.empty { color: var(--muted); font-style: italic; background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); padding: .8rem 1rem; margin: 0 0 1rem; }
.card .empty { background: transparent; }
.tabs { display: flex; flex-wrap: wrap; gap: .25rem; margin: 0 0 1rem; border-bottom: 2px solid var(--line); }
.tabs a { padding: .5rem .8rem; text-decoration: none; color: var(--muted); border-radius: 8px 8px 0 0; white-space: nowrap; }
.tabs a:hover { color: var(--navy); background: #fff; }
.tabs a[aria-current] { color: var(--navy); font-weight: 700; box-shadow: inset 0 -3px 0 var(--yellow); }
@media (max-width: 640px) {
  .tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -1rem 1rem; padding: 0 1rem; }
  .tabs a { padding: .5rem .6rem; }
}
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin: 0 0 1rem; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; text-decoration: none; color: var(--text); display: flex; flex-direction: column; }
.tile.link:hover { border-color: var(--navy-2); }
.tile.warn { border-color: var(--yellow); background: var(--yellow-soft); }
.tile-value { font-size: 2rem; font-weight: 800; line-height: 1.2; }
.tile-label { color: var(--muted); }
@media (max-width: 640px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .tile-value { font-size: 1.6rem; }
}
.code-big { font-size: 2rem; font-weight: 800; letter-spacing: .12em; background: var(--grey); padding: .8rem 1rem; border-radius: 8px; text-align: center; font-family: Consolas, monospace; margin: 0 0 1rem; overflow-wrap: anywhere; }
@media (max-width: 640px) { .code-big { font-size: 1.5rem; letter-spacing: .08em; } }
.code-state { margin: 0 0 .8rem; }
.qr svg { width: 220px; height: 220px; max-width: 100%; }
.list { padding-left: 1.4rem; margin: .3rem 0 .8rem; }
.list li { margin: .3rem 0; }
.title-input { font-weight: 700; }
.preview { max-width: 100%; border-radius: 8px; border: 1px solid var(--line); background: #000; display: block; }
img.preview { background: #fff; }
.mono { font-family: Consolas, monospace; word-break: break-all; }
blockquote { margin: .5rem 0; padding: .5rem 1rem; border-left: 4px solid var(--yellow); background: var(--grey); white-space: pre-wrap; }
.uploads { list-style: none; padding: 0; margin: .8rem 0 0; }
.uploads li { margin: .5rem 0; display: flex; flex-direction: column; gap: .25rem; overflow-wrap: anywhere; }
.uploads progress { width: 100%; height: 10px; accent-color: var(--yellow); }
.phone { position: sticky; top: 1rem; }
.phone-screen { background: #fff; border: 10px solid var(--navy); border-radius: 28px; padding: 1rem; min-height: 420px; }
@media (max-width: 860px) { .phone { position: static; max-width: 420px; } .phone-screen { min-height: 0; } }
.pv-text { font-weight: 700; font-size: 1.05rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.pv-text:empty::before { content: "Treść pytania pojawi się tutaj."; color: var(--muted); font-weight: 400; }
.pv-answer { border: 2px solid var(--line); border-radius: 12px; padding: .8rem; margin: .5rem 0; min-height: 48px; white-space: pre-wrap; overflow-wrap: anywhere; }
.pv-answer:empty { display: none; }
.pv-answer::before { content: attr(data-key) ". "; font-weight: 800; }
.pv-answer.correct { border-color: var(--ok); background: var(--ok-soft); }
details summary { cursor: pointer; color: var(--navy-2); font-weight: 600; margin: .3rem 0; }
code { background: var(--grey); padding: .05rem .3rem; border-radius: 4px; overflow-wrap: anywhere; }
@media (max-width: 640px) { .actions-row > .end, .toolbar > .end { margin-left: 0; } }
.card > :first-child { margin-top: 0; }
.mini input[type=number], .row .mini input[type=number] { width: 4.6rem; }
.table td .row .grow { min-width: 240px; }
