/* ============================================================
   Professional Standards Bureau · LSPD
   System designu: granat + zloto, uklad z bocznym panelem
   ============================================================ */

:root {
  --bg: #0a0d14;
  --bg-2: #0e1219;
  --surface: #121722;
  --surface-2: #181e2c;
  --surface-3: #1f2735;
  --border: #242d3f;
  --border-soft: #1c2331;
  --text: #e9edf5;
  --muted: #8f9cb3;
  --faint: #5c6880;
  --accent: #d9b34a;
  --accent-2: #b8912e;
  --accent-soft: rgba(217, 179, 74, .12);
  --navy: #0b2545;
  --blue: #4a8cff;
  --danger: #e05563;
  --ok: #3fbf7f;
  --review: #e0a63f;
  --invest: #4a8cff;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 34px rgba(0, 0, 0, .38);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, .25);
  --font: 'Segoe UI Variable Text', 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: ui-monospace, 'Cascadia Code', Consolas, monospace;
  --sidebar-w: 248px;
}

/* ---------- Reset / baza ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scrollbar-color: var(--surface-3) var(--bg); }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
}
::selection { background: rgba(217, 179, 74, .3); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0 0 .4em; font-weight: 700; letter-spacing: -.015em; }
h1 { font-size: 1.65rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: .98rem; }
p { margin: 0 0 1em; }
img { max-width: 100%; }

.muted { color: var(--muted); }
.tiny { font-size: .8rem; }
.mono { font-family: var(--mono); letter-spacing: -.02em; }
.link { color: var(--accent); font-weight: 600; }
.link:hover { text-decoration: underline; }

/* ============================================================
   UKLAD APLIKACJI (zalogowani): sidebar + main
   ============================================================ */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #0d1320 0%, #0a0e16 100%);
  border-right: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.side-brand {
  display: flex; align-items: center; gap: .7rem;
  padding: 1.1rem 1.15rem 1rem;
  border-bottom: 1px solid var(--border-soft);
}
.side-logo { height: 44px; width: auto; filter: drop-shadow(0 3px 8px rgba(0,0,0,.5)); }
.side-brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.side-brand-text strong { font-size: 1.05rem; letter-spacing: .04em; color: var(--accent); }
.side-brand-text small { font-size: .68rem; color: var(--muted); letter-spacing: .02em; }

.side-nav { flex: 1; padding: .9rem .7rem 1rem; display: flex; flex-direction: column; gap: 2px; }
.side-label {
  font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .14em;
  color: var(--faint); padding: 1rem .55rem .35rem;
}
.side-label:first-child { padding-top: .1rem; }
.side-nav a {
  display: block; padding: .5rem .8rem; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 600; font-size: .9rem;
  border-left: 2px solid transparent;
  transition: color .12s, background .12s;
}
.side-nav a:hover { color: var(--text); background: var(--surface); }
.side-nav a.active {
  color: var(--accent); background: var(--accent-soft);
  border-left-color: var(--accent);
}
.side-nav a.side-gold { color: var(--accent); }
.side-nav a.side-gold.active { background: var(--accent-soft); }

.side-user {
  display: flex; align-items: center; gap: .6rem;
  padding: .9rem 1rem;
  border-top: 1px solid var(--border-soft);
  background: rgba(0, 0, 0, .18);
}
.side-user-meta { display: flex; flex-direction: column; gap: .2rem; min-width: 0; flex: 1; align-items: flex-start; }
.side-user-meta .badge { white-space: normal; line-height: 1.25; font-size: .68rem; }
.user-name { font-weight: 600; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-logout { margin: 0; }
.btn-icon {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 1rem; line-height: 1;
  transition: .15s;
}
.btn-icon:hover { color: var(--danger); border-color: rgba(224, 85, 99, .5); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: .65rem 1.6rem;
  background: rgba(10, 13, 20, .82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
  position: sticky; top: 0; z-index: 40;
}
.top-title { font-weight: 700; font-size: .98rem; letter-spacing: -.01em; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.nav-toggle {
  display: none; background: transparent; border: 1px solid var(--border);
  color: var(--text); width: 36px; height: 36px; border-radius: 8px; cursor: pointer; font-size: 1rem;
}
.scrim { display: none; }

.container { width: 100%; max-width: 1160px; margin: 0 auto; padding: 1.8rem 1.6rem 2.5rem; flex: 1; }

.footer {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem;
  padding: 1.1rem 1.6rem;
  border-top: 1px solid var(--border-soft);
  color: var(--faint); font-size: .8rem;
}

/* ============================================================
   UKLAD PUBLICZNY (goscie)
   ============================================================ */
.pubbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .8rem clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--border-soft);
  background: rgba(10, 13, 20, .85);
  backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 40;
  border-top: 3px solid var(--accent);
}
.brand { display: flex; align-items: center; gap: .7rem; }
.brand-logo { height: 44px; width: auto; filter: drop-shadow(0 3px 8px rgba(0,0,0,.5)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: .95rem; }
.brand-text small { font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.pub-nav { display: flex; align-items: center; gap: .9rem; }
.pub-link { color: var(--muted); font-weight: 600; font-size: .9rem; }
.pub-link:hover, .pub-link.active { color: var(--accent); }
.container-pub { max-width: 1080px; }
.footer-pub { max-width: 1080px; margin: 0 auto; width: 100%; }
@media (max-width: 560px) { .brand-text { display: none; } }

/* ============================================================
   PRZYCISKI
   ============================================================ */
.btn-primary, .btn-ghost, .btn-danger, .btn-discord {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .6rem 1.15rem; border-radius: 10px; font-weight: 600; font-size: .9rem;
  cursor: pointer; border: 1px solid transparent; font-family: inherit;
  transition: transform .12s, filter .15s, background .15s, border-color .15s;
}
.btn-primary {
  background: linear-gradient(165deg, var(--accent), var(--accent-2));
  color: #191104;
  box-shadow: 0 3px 14px rgba(217, 179, 74, .22);
}
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); border-color: #33405a; }
.btn-danger { background: transparent; color: var(--danger); border-color: rgba(224, 85, 99, .45); }
.btn-danger:hover { background: rgba(224, 85, 99, .12); }
.btn-sm { padding: .38rem .8rem; font-size: .82rem; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-discord { background: #5865F2; color: #fff; width: 100%; padding: .8rem; font-size: .95rem; }
.btn-discord:hover { background: #4a56d6; }
button:disabled { opacity: .4; cursor: not-allowed; transform: none !important; }

/* ============================================================
   KOMUNIKATY
   ============================================================ */
.flash {
  padding: .8rem 1.1rem; border-radius: var(--radius-sm); font-weight: 600; font-size: .9rem;
  margin-bottom: 1.2rem; border: 1px solid;
}
.flash-success { background: rgba(63, 191, 127, .1); color: var(--ok); border-color: rgba(63, 191, 127, .3); }
.flash-error { background: rgba(224, 85, 99, .1); color: var(--danger); border-color: rgba(224, 85, 99, .3); }
.notice {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 1rem 1.2rem; color: var(--muted); font-size: .88rem; text-align: left;
}
.notice code { color: var(--accent); }

/* ============================================================
   PANELE / KARTY / STATYSTYKI
   ============================================================ */
.page-head { margin-bottom: 1.5rem; }
.page-head.row, .row { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.split { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.2rem; align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

.panel {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 1.4rem; box-shadow: var(--shadow-sm);
  margin-bottom: 1.2rem;
}
.panel > h2, .panel-head h2 { border-left: 3px solid var(--accent); padding-left: .65rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .9rem; }
.panel-head h2 { margin: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: .9rem; margin-bottom: 1.4rem; }
.stat {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 1.05rem 1.15rem; display: flex; flex-direction: column; gap: .15rem;
  position: relative; overflow: hidden; transition: border-color .15s, transform .15s;
}
.stat::before {
  content: ''; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: linear-gradient(180deg, var(--accent), transparent);
  opacity: .55;
}
.stat:hover { border-color: rgba(217, 179, 74, .35); transform: translateY(-2px); }
.stat-num { font-size: 1.85rem; font-weight: 800; color: var(--accent); font-family: var(--mono); line-height: 1.15; }
.stat-lbl { color: var(--muted); font-size: .82rem; }
.stat-action { border-style: dashed; justify-content: center; align-items: center; text-align: center; }
.stat-action::before { display: none; }
.stat-action:hover { border-color: var(--accent); background: var(--surface-2); }

/* ---------- Skroty na panelu ---------- */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: .8rem; margin-bottom: 1.4rem; }
.quick {
  display: flex; flex-direction: column; gap: .18rem;
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: .95rem 1.1rem;
  transition: transform .15s, border-color .15s, background .15s;
}
.quick:hover { transform: translateY(-2px); border-color: rgba(217, 179, 74, .4); background: var(--surface-2); }
.quick-t { font-weight: 700; font-size: .95rem; color: var(--accent); }
.quick-d { font-size: .8rem; color: var(--muted); line-height: 1.4; }

/* ============================================================
   STRONA GLOWNA (hero)
   ============================================================ */
.hero { text-align: center; padding: 3.5rem 1rem 2.5rem; }
.hero-logo { height: 140px; width: auto; margin-bottom: 1.3rem; filter: drop-shadow(0 10px 32px rgba(0, 0, 0, .55)); }
.hero-eyebrow {
  display: block; text-transform: uppercase; letter-spacing: .24em; font-size: .76rem;
  font-weight: 700; color: var(--accent); margin-bottom: .45rem;
}
.hero h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); margin-bottom: .3rem; }
.lead { max-width: 640px; margin: .6rem auto 1.7rem; color: var(--muted); font-size: 1.07rem; }
.hero-actions { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; }

.cards-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; margin: 2.6rem 0; }
@media (max-width: 800px) { .cards-3 { grid-template-columns: 1fr; } }
.card {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 1.5rem; transition: transform .15s, border-color .15s;
}
.card:hover { transform: translateY(-3px); border-color: rgba(217, 179, 74, .35); }
.card-icon { font-family: var(--mono); color: var(--accent); font-size: 1.35rem; font-weight: 700; margin-bottom: .5rem; }
.card h3 { font-size: 1.05rem; }
.card p { color: var(--muted); margin: 0; font-size: .92rem; }

.info-band {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem;
  padding: 1.9rem 2rem; background: var(--surface);
  border: 1px solid var(--border-soft); border-radius: var(--radius);
}
@media (max-width: 700px) { .info-band { grid-template-columns: 1fr; } }
.info-band strong { display: block; color: var(--accent); margin-bottom: .2rem; }
.info-band span { color: var(--muted); font-size: .9rem; }

/* ============================================================
   LOGOWANIE / STATUS PUBLICZNY
   ============================================================ */
.auth-wrap { display: grid; place-items: center; padding: 2.5rem 1rem; }
.auth-card {
  width: 100%; max-width: 410px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 2.2rem 2rem; text-align: center; box-shadow: var(--shadow);
}
.auth-logo { height: 100px; width: auto; margin-bottom: .9rem; filter: drop-shadow(0 5px 16px rgba(0, 0, 0, .5)); }
.dev-login { margin-top: 1.6rem; padding-top: 1.5rem; border-top: 1px dashed var(--border); }
.dev-login-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); margin-bottom: .6rem; font-weight: 700; }
.dev-login-form { display: flex; gap: .5rem; }
.dev-login-form select { flex: 1; }

.status-wrap { max-width: 480px; margin: 1.5rem auto; text-align: center; }
.status-form { display: flex; gap: .5rem; margin: 1.3rem 0; }
.status-form input {
  flex: 1; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); padding: .75rem .9rem; font-size: 1rem;
  font-family: var(--mono); text-align: center; letter-spacing: .06em;
}
.status-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.2rem 1.4rem; text-align: left; box-shadow: var(--shadow-sm);
}
.status-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--border-soft); }
.status-row:last-child { border-bottom: none; }
.status-row span:first-child { color: var(--muted); font-size: .85rem; }
.status-back { margin-top: 1.2rem; }

/* ============================================================
   TABELE
   ============================================================ */
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th {
  text-align: left; padding: .55rem .75rem; color: var(--faint); font-weight: 700;
  font-size: .72rem; text-transform: uppercase; letter-spacing: .07em;
  border-bottom: 1px solid var(--border);
}
.table td { padding: .68rem .75rem; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.clickable { cursor: pointer; transition: background .12s; }
.clickable:hover { background: var(--surface-2); }
.row-disabled { opacity: .5; }
.user-cell { display: flex; align-items: center; gap: .6rem; }
.user-cell div { display: flex; flex-direction: column; line-height: 1.2; }
.actions { display: flex; gap: .4rem; align-items: center; }
.inline { display: inline; }

.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); flex-shrink: 0; }
.avatar-sm { width: 30px; height: 30px; }
.avatar-fallback { display: grid; place-items: center; background: var(--navy); color: var(--accent); font-weight: 700; }

/* ============================================================
   ZNACZNIKI (badge)
   ============================================================ */
.badge {
  display: inline-block; padding: .18rem .62rem; border-radius: 999px;
  font-size: .74rem; font-weight: 700; white-space: nowrap; letter-spacing: .01em;
}
.badge-lg { padding: .35rem .95rem; font-size: .85rem; }
.badge-stack { display: flex; flex-direction: column; gap: .3rem; align-items: flex-end; }
.st-new { background: rgba(143, 156, 179, .16); color: #b8c2d9; }
.st-review { background: rgba(224, 166, 63, .16); color: var(--review); }
.st-invest { background: rgba(74, 140, 255, .16); color: var(--invest); }
.st-ok { background: rgba(63, 191, 127, .16); color: var(--ok); }
.st-bad { background: rgba(224, 85, 99, .16); color: var(--danger); }
.role-obywatel { background: rgba(143, 156, 179, .16); color: #b8c2d9; }
.role-inspektor { background: rgba(74, 140, 255, .16); color: var(--invest); }
.role-dyrektor { background: var(--accent-soft); color: var(--accent); }
.role-zarzad {
  background: linear-gradient(90deg, rgba(217, 179, 74, .25), rgba(184, 145, 46, .18));
  color: var(--accent); border: 1px solid rgba(217, 179, 74, .5);
}

/* ============================================================
   FORMULARZE
   ============================================================ */
label { font-size: .84rem; font-weight: 600; margin-bottom: .35rem; color: var(--text); }
input, select, textarea {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); padding: .58rem .75rem; font-family: inherit; font-size: .92rem; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(217, 179, 74, .14);
}
textarea { resize: vertical; }
.form .field { margin-bottom: 1rem; display: flex; flex-direction: column; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .field-row { grid-template-columns: 1fr; } }
.form-actions { display: flex; gap: .8rem; margin-top: .5rem; align-items: center; flex-wrap: wrap; }
.card-form {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 1.6rem; max-width: 680px; box-shadow: var(--shadow-sm);
}
.field-hint { display: block; font-size: .75rem; color: var(--faint); margin-top: .3rem; }
.note-form { display: flex; gap: .6rem; margin-bottom: 1.2rem; }
.note-form textarea { flex: 1; }
.search { display: flex; gap: .5rem; }
.search input { width: 250px; }
.add-block { margin-bottom: 1.2rem; }
.add-block summary { display: inline-flex; list-style: none; cursor: pointer; }
.add-block summary::-webkit-details-marker { display: none; }
.add-form {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 1.3rem; margin-top: 1rem;
}
.list-search { display: flex; gap: .5rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }
.list-search input[type="search"] { flex: 1; min-width: 220px; }

/* Sekcje i grupy pol w formularzu skargi (z formularzy Google) */
.form-section {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.3rem 1.4rem;
  background: var(--surface-2);
  margin: 0 0 1.4rem 0;
}
.form-section legend {
  font-weight: 700;
  font-size: .95rem;
  color: var(--accent);
  padding: .25rem .75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
}
.radio-group, .checkbox-group {
  display: flex;
  gap: .8rem;
  flex-wrap: wrap;
  margin-top: .4rem;
}
.radio-group-vertical {
  flex-direction: column;
  gap: .5rem;
}
.radio-label, .checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  font-size: .9rem;
  color: var(--text);
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: .6rem .8rem;
  border-radius: var(--radius-sm);
  transition: border-color .15s, background .15s;
}
.radio-label:hover, .checkbox-label:hover {
  border-color: var(--accent);
  background: var(--surface-3);
}
.radio-label input, .checkbox-label input {
  width: auto;
  margin-top: .2rem;
  accent-color: var(--accent);
}
.declarations-list {
  list-style: none;
  padding: 0;
  margin: .5rem 0 1rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.declarations-list li {
  font-size: .85rem;
  color: var(--ok);
  background: rgba(63, 191, 127, .08);
  border: 1px solid rgba(63, 191, 127, .2);
  padding: .5rem .75rem;
  border-radius: var(--radius-sm);
}

/* ============================================================
   FILTRY / DROBNE
   ============================================================ */
.filters { display: flex; gap: .45rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.chip {
  padding: .35rem .85rem; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--border); color: var(--muted); font-size: .8rem; font-weight: 600;
  transition: .15s;
}
.chip:hover { color: var(--text); border-color: #33405a; }
.chip.active { background: var(--accent); color: #191104; border-color: var(--accent); }
.empty { color: var(--muted); text-align: center; padding: 2rem 1rem; }
.deflist { display: grid; grid-template-columns: auto 1fr; gap: .5rem 1.5rem; margin: 0 0 1rem; }
.deflist dt { color: var(--muted); font-size: .85rem; }
.deflist dd { margin: 0; font-weight: 500; }
.prose { white-space: pre-wrap; word-break: break-word; }
.sep { border: none; border-top: 1px solid var(--border-soft); margin: 1.2rem 0; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { border-left: 2px solid var(--border); padding: 0 0 1.2rem 1.2rem; position: relative; }
.timeline li::before {
  content: ''; position: absolute; left: -6px; top: 5px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--accent);
}
.timeline li:last-child { padding-bottom: 0; }
.timeline-head { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: .2rem; }

.error-page { text-align: center; padding: 4rem 1rem; }
.error-code { font-size: 4rem; font-weight: 800; color: var(--accent); font-family: var(--mono); }

/* ============================================================
   MODUL DOKUMENTY
   ============================================================ */
.doc-choose { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.doc-choice {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 1.4rem; display: flex; flex-direction: column; gap: .3rem; transition: .15s;
}
.doc-choice:hover { border-color: var(--accent); background: var(--surface-2); transform: translateY(-2px); }
.doc-code { font-family: var(--mono); color: var(--accent); font-weight: 700; font-size: .82rem; }
.doc-choice strong { font-size: 1.02rem; }

.doc-form-head { display: flex; align-items: center; gap: .9rem; }
.doc-shield {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 11px;
  background: linear-gradient(160deg, #14335f, var(--navy)); color: #fff;
  font-weight: 800; font-size: .85rem; letter-spacing: .5px;
  border: 1px solid #274a7a; flex-shrink: 0;
}

.doc-form { display: flex; flex-direction: column; gap: 1.2rem; }
.doc-section {
  border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 1.2rem 1.3rem 1.4rem; background: var(--surface); margin: 0;
}
.doc-section legend {
  font-weight: 700; font-size: .92rem; color: var(--accent); padding: .2rem .7rem;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 7px;
}
.doc-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: .9rem 1rem; }
.col-full { grid-column: span 6; }
.col-half { grid-column: span 3; }
.col-third { grid-column: span 2; }
@media (max-width: 640px) { .col-half, .col-third { grid-column: span 6; } }
.doc-grid .field, .doc-grid > div { display: flex; flex-direction: column; }

.radio-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.radio-pill {
  display: inline-flex; align-items: center; gap: .38rem; padding: .34rem .75rem;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2);
  cursor: pointer; font-size: .84rem; font-weight: 500; margin: 0; transition: .12s;
}
.radio-pill input { width: auto; margin: 0; accent-color: var(--accent); }
.radio-pill:hover { border-color: #33405a; }
.radio-pill:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.check-inline { display: flex; align-items: flex-start; gap: .5rem; font-weight: 500; cursor: pointer; margin: 0; font-size: .9rem; }
.check-inline input { width: auto; margin-top: .18rem; accent-color: var(--accent); }

.doc-table-wrap { overflow-x: auto; }
.doc-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.doc-table th {
  text-align: left; padding: .4rem .5rem; color: var(--faint); font-size: .7rem;
  text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--border); font-weight: 700;
}
.doc-table td { padding: .3rem .35rem; vertical-align: middle; }
.doc-table .rownum { width: 32px; text-align: center; color: var(--faint); font-family: var(--mono); }
.doc-table .rowdel { width: 34px; }
.doc-table input, .doc-table select { padding: .4rem .5rem; font-size: .85rem; }
.btn-row-del {
  background: transparent; border: 1px solid var(--border); color: var(--danger);
  width: 26px; height: 26px; border-radius: 7px; cursor: pointer; font-size: 1rem; line-height: 1;
}
.btn-row-del:hover { background: rgba(224, 85, 99, .12); }
.add-row { margin-top: .7rem; }
.sticky-actions {
  position: sticky; bottom: 0; z-index: 10;
  background: linear-gradient(0deg, var(--bg) 55%, transparent);
  padding: 1rem 0 .6rem;
}
.doc-toolbar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.4rem; }
.status-form.inline select, .doc-toolbar select { width: auto; }
.doc-view-section h2 { font-size: 1rem; }
.doc-deflist { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem 1.5rem; margin: 0; }
.doc-defitem.full { grid-column: span 2; }
@media (max-width: 640px) { .doc-deflist { grid-template-columns: 1fr; } .doc-defitem.full { grid-column: span 1; } }
.doc-defitem dt { color: var(--muted); font-size: .78rem; margin-bottom: .1rem; }
.doc-defitem dd { margin: 0; font-weight: 500; }

/* ============================================================
   REGULAMIN / PROCEDURY
   ============================================================ */
.reg-logo { height: 58px; width: auto; filter: drop-shadow(0 3px 10px rgba(0, 0, 0, .5)); }
.reg-toolbar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.reg-search { position: relative; flex: 1; min-width: 230px; display: flex; align-items: center; gap: .6rem; }
#regSearch { padding: .65rem .95rem; font-size: .95rem; border-radius: 10px; }
.reg-count { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.reg-list { display: grid; gap: .8rem; }
.reg-item {
  display: flex; gap: 1rem; background: var(--surface);
  border: 1px solid var(--border-soft); border-left: 3px solid var(--accent);
  border-radius: var(--radius); padding: 1.15rem 1.3rem;
  transition: transform .15s;
}
.reg-item:hover { transform: translateX(2px); }
.reg-num { font-family: var(--mono); font-size: 1.45rem; font-weight: 800; color: var(--accent); line-height: 1; min-width: 2ch; }
.reg-body { min-width: 0; flex: 1; }
.reg-body h2 { margin: 0 0 .1rem; font-size: 1.02rem; }
.reg-en { display: block; font-size: .74rem; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .4rem; }
.reg-body p { margin: 0; color: var(--muted); font-size: .9rem; }
.reg-points {
  list-style: none; margin: .8rem 0 0; padding: .65rem 0 0;
  border-top: 1px solid var(--border-soft);
  display: grid; grid-template-columns: 1fr 1fr; gap: .3rem 1.2rem;
}
@media (max-width: 700px) { .reg-points { grid-template-columns: 1fr; } }
.reg-points li { font-size: .87rem; color: var(--text); padding: .14rem 0; }
.reg-ref { display: inline-block; min-width: 2.6em; font-family: var(--mono); font-size: .78rem; font-weight: 700; color: var(--accent); }
.reg-item mark { background: rgba(217, 179, 74, .38); color: #fff; border-radius: 3px; padding: 0 1px; }
.reg-note {
  margin-top: 1.5rem; padding: 1rem 1.2rem; background: var(--surface-2);
  border: 1px solid var(--border-soft); border-radius: var(--radius);
  font-size: .88rem; color: var(--muted);
}
.reg-note strong { color: var(--text); }

/* ============================================================
   WYKRESY
   ============================================================ */
.bars {
  display: flex; flex-direction: column; gap: .55rem;
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 1.1rem 1.3rem; margin-bottom: 1.2rem;
}
.panel .bars { background: transparent; border: none; padding: 0; margin-bottom: 0; }
.bar-row { display: grid; grid-template-columns: 175px 1fr 42px; align-items: center; gap: .8rem; }
@media (max-width: 560px) { .bar-row { grid-template-columns: 105px 1fr 32px; } }
.bar-lbl { font-size: .84rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 11px; background: var(--bg-2); border-radius: 6px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); border-radius: 6px; }
.bar-fill.bar-ok { background: linear-gradient(90deg, #2f9c66, var(--ok)); }
.bar-val { font-family: var(--mono); font-size: .84rem; font-weight: 700; text-align: right; }

.col-chart { display: flex; align-items: flex-end; gap: .6rem; height: 160px; padding-top: 1rem; }
.col-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: .3rem; }
.col-val { font-size: .78rem; font-weight: 700; font-family: var(--mono); }
.col-bar { width: 100%; max-width: 46px; min-height: 3px; background: linear-gradient(180deg, var(--accent), var(--accent-2)); border-radius: 6px 6px 0 0; }
.col-cap { font-size: .72rem; color: var(--faint); font-family: var(--mono); }

.stackbar { display: flex; height: 26px; border-radius: 8px; overflow: hidden; margin: .8rem 0; border: 1px solid var(--border-soft); }
.stackbar-seg { height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: .8rem; }
.legend-item { display: inline-flex; align-items: center; gap: .35rem; font-size: .82rem; color: var(--muted); }
.legend-dot { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

/* ============================================================
   EWS / ZARZADZANIE DANYMI / KADRA
   ============================================================ */
.officer-meta {
  color: var(--muted); font-size: .9rem; margin: -.5rem 0 1rem;
  padding: .6rem .95rem; background: var(--surface);
  border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
}
.ews {
  display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap;
  padding: 1rem 1.3rem; border-radius: var(--radius); border: 1px solid var(--border);
  margin-bottom: 1.2rem;
}
.ews-niskie { background: rgba(63, 191, 127, .08); border-color: rgba(63, 191, 127, .35); }
.ews-srednie { background: rgba(224, 166, 63, .08); border-color: rgba(224, 166, 63, .4); }
.ews-wysokie { background: rgba(224, 85, 99, .1); border-color: rgba(224, 85, 99, .45); }
.ews-main { display: flex; flex-direction: column; }
.ews-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.ews-level { font-size: 1.4rem; font-weight: 800; }
.ews-niskie .ews-level { color: var(--ok); }
.ews-srednie .ews-level { color: var(--review); }
.ews-wysokie .ews-level { color: var(--danger); }
.ews-score { display: flex; flex-direction: column; align-items: center; margin-left: auto; }
.ews-score .stat-num { font-size: 1.6rem; }
.ews-flag { background: var(--danger); color: #fff; padding: .35rem .85rem; border-radius: 999px; font-weight: 700; font-size: .82rem; }
.ews-badge-niskie { background: rgba(63, 191, 127, .16); color: var(--ok); }
.ews-badge-srednie { background: rgba(224, 166, 63, .16); color: var(--review); }
.ews-badge-wysokie { background: rgba(224, 85, 99, .18); color: var(--danger); }

.data-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: .9rem; margin-bottom: 1.5rem; }
.data-card {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 1rem 1.2rem;
}
.data-card.data-danger { border-color: rgba(224, 85, 99, .4); }
.data-info { display: flex; align-items: center; gap: .9rem; min-width: 0; }
.data-count { font-family: var(--mono); font-size: 1.45rem; font-weight: 800; color: var(--accent); min-width: 2ch; text-align: center; }
.data-info strong { display: block; }
.data-info .tiny { display: block; }
.data-nuke { border-color: rgba(224, 85, 99, .4); }

/* ============================================================
   RESPONSYWNOSC (sidebar mobilny)
   ============================================================ */
@media (max-width: 920px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 60;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: var(--shadow);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .scrim {
    display: block; position: fixed; inset: 0; z-index: 50;
    background: rgba(0, 0, 0, .55); backdrop-filter: blur(2px);
  }
  .nav-toggle { display: grid; place-items: center; }
  .container { padding: 1.3rem 1rem 2rem; }
  .topbar { padding: .6rem 1rem; }
}
