/* Panel U.R.B.A. — przeniesione z projektu w Claude Design (kanwa „U.R.B.A. — panel źródeł”).
   Statusy zawsze słowem i kolorem (nie samym kolorem); kontrast tekstu ≥ 4,5:1. */
:root {
  --ground: #F4F5F7;
  --surface: #FFFFFF;
  --surface-head: #F8F9FA;
  --ink: #15171C;
  --muted: #4A5160;
  --line: #DADDE3;
  --line-soft: #ECEEF1;
  --input-line: #B9BFCC;
  --accent: #1F4FD1;
  --accent-hover: #163A9E;
  --accent-soft: #E8EEFC;
  --ok-fg: #11643A;   --ok-bg: #E3F4EA;
  --warn-fg: #7A4B00; --warn-bg: #FFF1D6; --warn-line: #E9C988;
  --danger-fg: #A3211A; --danger-bg: #FDE7E5; --danger-line: #F0B8B2;
  --neutral-fg: #3D4350; --neutral-bg: #ECEEF1;
  --topbar: #15171C;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
code, .mono { font-family: var(--mono); font-size: 13px; }
h1 { margin: 0; font-size: 28px; font-weight: 600; }
h2 { margin: 0; font-size: 17px; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.break { word-break: break-all; }

/* Pasek górny */
.topbar { background: var(--topbar); color: #FFFFFF; }
.topbar-inner { max-width: 1240px; margin: 0 auto; padding: 0 24px; min-height: 56px; display: flex; align-items: center; gap: 32px; flex-wrap: wrap; }
.brand { color: #FFFFFF; text-decoration: none; font-weight: 700; letter-spacing: 0.04em; }
.brand:hover { color: #FFFFFF; }
.brand span { font-weight: 400; color: #B9BFCC; }
.nav { display: flex; gap: 4px; flex-grow: 1; flex-wrap: wrap; }
.nav a { color: #D6DAE2; text-decoration: none; padding: 8px 14px; border-radius: 6px; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; }
.nav a:hover { color: #FFFFFF; background: #23262E; }
.nav a.active { color: #FFFFFF; background: #2C3039; font-weight: 500; }
.nav-badge { background: #F2B84B; color: var(--ink); border-radius: 10px; padding: 1px 8px; font-size: 12px; font-weight: 600; }
.logout { display: flex; align-items: center; gap: 8px; color: #B9BFCC; font-size: 13px; }
.link-button { font: inherit; background: none; border: 0; color: #D6DAE2; text-decoration: underline; cursor: pointer; padding: 8px 4px; }

/* Strona */
.page { max-width: 1240px; margin: 0 auto; padding: 32px 24px 48px; display: flex; flex-direction: column; gap: 20px; }
.page.narrow { max-width: 880px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; color: var(--muted); }
.back { font-size: 14px; text-decoration: none; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions form { margin: 0; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack.tight { gap: 6px; }
.pre { white-space: pre-line; }
.grow { flex-grow: 1; min-width: 240px; }
.card > h2 + .table-wrap, .card > .table-wrap + h2 { margin-top: 0; }
.card > .table-wrap + h2 { padding-top: 22px; }

/* Komunikaty */
.flash-wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.flash-wrap .flash { margin-top: 20px; }
.flash { border-radius: 8px; padding: 14px 16px; border: 1px solid; }
.flash-ok { background: var(--ok-bg); color: var(--ok-fg); border-color: #B5DEC4; }
.flash-error { background: var(--danger-bg); color: #7D1912; border-color: var(--danger-line); }
.flash-warn { background: var(--warn-bg); color: #5E3A00; border-color: var(--warn-line); }
.flash ul { margin: 6px 0 0; padding-left: 20px; }

/* Przyciski */
.button { font: inherit; font-weight: 600; padding: 10px 16px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.button:hover { border-color: var(--input-line); color: var(--ink); }
.button.primary { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }
.button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #FFFFFF; }
.button.danger { color: var(--danger-fg); border-color: #E8B4AF; }
.button.danger-solid { background: var(--danger-fg); border-color: var(--danger-fg); color: #FFFFFF; }
.button.small { padding: 6px 12px; min-height: 36px; font-size: 14px; }
.button:disabled { opacity: 0.55; cursor: not-allowed; }

/* Filtry */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; min-height: 40px; display: inline-flex; align-items: center; }
.tabs a.active { background: var(--ink); border-color: var(--ink); color: #FFFFFF; }

/* Karty i tabele */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.card.padded { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.card > h2 { padding: 18px 18px 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { background: var(--surface-head); text-align: left; color: var(--muted); font-size: 13px; font-weight: 600; padding: 12px 16px; }
td { padding: 14px 16px; border-top: 1px solid var(--line-soft); vertical-align: top; font-size: 14px; }
td .sub { color: var(--muted); font-size: 13px; }
tr.attention td { background: #FFF8F7; }
.empty { padding: 24px 16px; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 20px; font-weight: 600; }
.split { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.split > .wide { grid-column: span 2; }
dl.definition { margin: 0; display: flex; flex-direction: column; gap: 12px; }
dl.definition dt { color: var(--muted); font-size: 13px; }
dl.definition dd { margin: 2px 0 0; font-size: 14px; }
dl.definition ul { margin: 4px 0 0; padding-left: 18px; }

/* Znaczniki statusu */
.badge { display: inline-block; font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 12px; }
.badge.ok { color: var(--ok-fg); background: var(--ok-bg); }
.badge.warn { color: var(--warn-fg); background: var(--warn-bg); }
.badge.danger { color: var(--danger-fg); background: var(--danger-bg); }
.badge.neutral { color: var(--neutral-fg); background: var(--neutral-bg); }
.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 4px; margin: 0 4px 4px 0; }
.chip.neutral { color: var(--neutral-fg); background: var(--neutral-bg); }
.chip.warn { color: var(--warn-fg); background: var(--warn-bg); }

/* Formularze */
fieldset { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
fieldset.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
fieldset.grid2 .full { grid-column: span 2; }
legend { font-weight: 600; font-size: 17px; padding: 0 6px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid3 .span2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 500; }
.field .hint { font-weight: 400; font-size: 13px; color: var(--muted); }
input[type=text], input[type=password], input[type=url], input[type=number], select, textarea {
  font: inherit; font-weight: 400; padding: 10px 12px; border: 1px solid var(--input-line); border-radius: 6px; background: var(--surface); color: var(--ink); min-height: 44px;
}
input:disabled, select:disabled { background: var(--ground); color: var(--muted); border-color: var(--line); }
input.mono, textarea.mono { font-family: var(--mono); font-size: 14px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .button:focus-visible, a:focus-visible { outline: 3px solid #8FA8F0; outline-offset: 1px; }
.choices { display: flex; gap: 8px; flex-wrap: wrap; }
.choice { display: flex; gap: 8px; align-items: center; padding: 10px 14px; border: 1px solid var(--line); border-radius: 6px; font-weight: 400; min-height: 44px; }
.choice:has(input:checked) { border: 2px solid var(--accent); background: var(--accent-soft); }
.check { display: flex; gap: 10px; align-items: center; font-weight: 400; min-height: 32px; }
.check input { width: 18px; height: 18px; }
.form-actions { display: flex; gap: 12px; justify-content: flex-end; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
details.unblock summary { list-style: none; }
details.unblock summary::-webkit-details-marker { display: none; }
details.unblock[open] { min-width: 320px; }
details.unblock form { margin-top: 12px; }

.toolbar { justify-content: space-between; }
.search input[type=text] { min-width: 240px; }
.card.filters { flex-direction: row; align-items: flex-end; }
.pagination { justify-content: space-between; }
.session-help { padding: 0 18px 18px; display: flex; flex-direction: column; gap: 12px; }
.skip-link { position: absolute; left: 16px; top: -100px; z-index: 10; background: var(--surface); padding: 12px 16px; border-radius: 6px; }
.skip-link:focus { top: 8px; }
.stat .value.small-value { font-size: 16px; }

/* Pulpit i wykresy (specyfikacja: skill dataviz — jedna seria, kolor akcentu, siatka 1 px, tekst w kolorach tekstu) */
.dash-section { display: flex; flex-direction: column; gap: 12px; }
.dash-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
figure.chart { margin: 0; padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
figure.chart figcaption { display: flex; flex-direction: column; gap: 2px; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-svg .grid line { stroke: #E3E6EB; stroke-width: 1; shape-rendering: crispEdges; }
.chart-svg .bars path { fill: var(--accent); }
.chart-svg .bar:hover path { fill: var(--accent-hover); }
.chart-svg .hit { fill: transparent; }
.chart-svg .bar:hover .hit { fill: rgba(31, 79, 209, 0.06); }
.chart-svg text { font-family: 'IBM Plex Sans', system-ui, sans-serif; font-size: 12px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart-svg text.peak { fill: var(--ink); font-weight: 600; }
table.compact th, table.compact td { padding: 6px 10px; font-size: 13px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
details > summary { cursor: pointer; color: var(--accent); }

/* Logowanie */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.login-card h1 { font-size: 22px; font-weight: 700; letter-spacing: 0.04em; }
.login-card h1 span { font-weight: 400; color: var(--muted); }

/* Wąskie ekrany */
@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: minmax(0, 1fr); }
  .split > .wide { grid-column: auto; }
  fieldset.grid2, .grid3 { grid-template-columns: minmax(0, 1fr); }
  .grid3 .span2 { grid-column: auto; }
  fieldset.grid2 .full { grid-column: auto; }
  .page { padding: 20px 16px 32px; }
  .topbar-inner { padding: 8px 16px; gap: 12px; }
  .nav { width: 100%; order: 3; }
  .logout { margin-left: auto; }
  .search input[type=text] { min-width: 0; width: 100%; }
  .filters .field { flex: 1 1 160px; }
  .filters > input[type=text] { flex: 1 1 100%; }
}
