@font-face {
  font-family: "Geist";
  src: url("fonts/geist-latin-ext-wght-normal.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-display: swap;
  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: "Geist";
  src: url("fonts/geist-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-display: swap;
  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;
}
@font-face {
  font-family: "Geist Mono";
  src: url("fonts/geist-mono-latin-ext-wght-normal.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-display: swap;
  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: "Geist Mono";
  src: url("fonts/geist-mono-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-display: swap;
  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 {
  color-scheme: light;
  --bg: #f3f4f5;
  --surface: #fcfcfb;
  --surface-2: #eef0f2;
  --line: #dcdfe3;
  --line-strong: #c4c8ce;
  --text: #17181a;
  --text-2: #4b4e54;
  --muted: #62666d;
  --accent: #1f5fae;
  --link: #1f5fae;
  --accent-ink: #ffffff;
  --accent-soft: #e4edf8;
  --ok: #1a6e47;
  --ok-soft: #e1f1e8;
  --warn: #8a5300;
  --warn-soft: #fbefd9;
  --bad: #b42318;
  --bad-soft: #fbe5e3;
  --focus: #1f5fae;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #8b8f96;
  --radius: 6px;
  --sans: "Geist", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #111113;
    --surface: #1a1a19;
    --surface-2: #232322;
    --line: #2f2f2d;
    --line-strong: #44443f;
    --text: #f0efec;
    --text-2: #c9c8c0;
    --muted: #a4a39b;
    --accent: #2f6fc0;
    --link: #8fbaf2;
    --accent-ink: #ffffff;
    --accent-soft: #1d2a3b;
    --ok: #6fd3a0;
    --ok-soft: #173326;
    --warn: #f0b552;
    --warn-soft: #3a2a10;
    --bad: #ff8f84;
    --bad-soft: #3d1c19;
    --focus: #8fbaf2;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #77776f;
  }
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
.num, td.num, .mono, td.t { font-family: var(--mono); font-variant-numeric: tabular-nums; }
th.num { font-family: var(--sans); }
td.t { white-space: nowrap; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

/* układ */
.shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: 100dvh; }
.side {
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 18px 12px;
  position: sticky; top: 0; height: 100dvh;
  display: flex; flex-direction: column; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; font-weight: 600; letter-spacing: -0.01em; }
.brand-mark {
  width: 26px; height: 26px; border-radius: var(--radius);
  background: var(--text); color: var(--surface);
  display: grid; place-items: center; font: 600 12px var(--mono);
}
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a {
  display: block; padding: 7px 10px; border-radius: var(--radius);
  color: var(--text-2); text-decoration: none; font-weight: 500;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.side-foot { margin-top: auto; font-size: 13px; color: var(--muted); display: grid; gap: 12px; border-top: 1px solid var(--line); padding: 14px 8px 0; }
.side-user { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-login { display: grid; min-width: 0; padding: 4px 6px; margin: -4px -6px; border-radius: var(--radius); text-decoration: none; color: var(--text); }
.side-login:hover { background: var(--surface-2); }
.side-login[aria-current="page"] { background: var(--accent-soft); }
.side-login-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-login-hint { font-size: 12px; color: var(--muted); }
.side-meta { display: flex; gap: 16px; margin: 0; font-size: 12px; }
.side-meta dt { color: var(--muted); }
.side-meta dd { margin: 0; color: var(--text-2); }
.side-author { margin: 0; font-size: 12px; }
.main { min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  padding: 10px 28px; border-bottom: 1px solid var(--line); background: var(--surface);
  font-size: 13px; color: var(--text-2);
}
.topbar .state { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; color: var(--text); }
.state .pip { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.state.down .pip { background: var(--bad); }
.content { padding: 24px 28px 48px; max-width: 1320px; }
h1 { font-size: 1.6rem; letter-spacing: -0.02em; margin: 0 0 4px; line-height: 1.2; }
h2 { font-size: 1.05rem; margin: 0 0 10px; letter-spacing: -0.01em; }
.lead { color: var(--text-2); margin: 0 0 22px; max-width: 70ch; }
.head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.head-row .lead { margin: 0; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel > header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.panel > header h2 { margin: 0; }
.panel-body { padding: 14px 16px; }
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }
.stack { display: grid; gap: 16px; }

/* liczby na pulpicie: bez kart, jedna linia z podziałami */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; }
.figure { padding: 14px 16px; border-left: 1px solid var(--line); }
.figure:first-child { border-left: 0; }
.figure .label { font-size: 13px; color: var(--muted); }
.figure .value { font: 600 1.6rem/1.2 var(--mono); letter-spacing: -0.02em; margin-top: 2px; }
.figure .sub { font-size: 12.5px; color: var(--text-2); }

/* tabele */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
td.num, th.num { text-align: right; }
.clip { max-width: 44ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wrap-text { white-space: pre-wrap; word-break: break-word; max-width: 60ch; }
.empty { padding: 28px 16px; color: var(--muted); text-align: center; }

/* znaczniki stanu: zawsze tekst, kolor tylko wspiera */
.tag { display: inline-block; padding: 1px 7px; border-radius: var(--radius); font-size: 12.5px; font-weight: 500; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.accent { background: var(--accent-soft); color: var(--text); }

/* formularze */
form.inline { display: inline; }
.form { display: grid; gap: 14px; max-width: 560px; }
.field { display: grid; gap: 5px; }
.field label, .field legend { font-weight: 500; font-size: 14px; }
.field .help { font-size: 13px; color: var(--muted); }
.field .err { font-size: 13px; color: var(--bad); }
input[type=text], input[type=password], input[type=url], input[type=number], input[type=search], select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 7px 10px; width: 100%;
}
textarea { min-height: 80px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.check input { margin-top: 3px; accent-color: var(--accent); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters .field { min-width: 140px; }
.filters .field input, .filters .field select { padding: 6px 9px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  font: 500 14px var(--sans); padding: 7px 14px; border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.small { padding: 3px 10px; font-size: 13px; }
.btn.link { border: 0; background: none; padding: 0; color: inherit; text-decoration: underline; font-weight: 400; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.notice { padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); margin-bottom: 16px; }
.notice.ok { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); background: var(--ok-soft); }
.notice.warn { border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); background: var(--warn-soft); }
.secret {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  font: 500 14px var(--mono); background: var(--surface); border: 1px dashed var(--line-strong);
  border-radius: var(--radius); padding: 8px 10px; word-break: break-all;
}
.secret code { flex: 1; min-width: 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: flex-end; padding: 10px 16px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); }
pre.detail { margin: 0; font: 12.5px/1.45 var(--mono); white-space: pre-wrap; word-break: break-all; color: var(--text-2); max-width: 70ch; }
details summary { cursor: pointer; color: var(--text-2); }

/* wykresy */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis-label { fill: var(--muted); font: 11px var(--mono); }
.chart .s1 { fill: var(--series-1); }
.chart .s2 { fill: var(--series-2); }
.chart .s3 { fill: var(--series-3); }
.chart .s4 { fill: var(--series-4); }
.chart .hit { fill: transparent; }
.chart g.bar:hover rect:not(.hit), .chart g.bar:focus rect:not(.hit) { opacity: .78; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); margin: 0 0 8px; padding: 0; list-style: none; }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.legend .s1 { background: var(--series-1); }
.legend .s2 { background: var(--series-2); }
.legend .s3 { background: var(--series-3); }
.legend .s4 { background: var(--series-4); }

/* logowanie */
.auth { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.auth-aside { background: var(--text); color: var(--surface); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-aside p { max-width: 36ch; color: color-mix(in srgb, var(--surface) 78%, transparent); margin: 0; }
.auth-aside .brand-mark { background: var(--surface); color: var(--text); }
.auth-main { display: grid; place-items: center; padding: 32px 20px; }
.auth-box { width: 100%; max-width: 380px; display: grid; gap: 18px; }
.qr { background: #ffffff; padding: 10px; border-radius: var(--radius); width: max-content; border: 1px solid var(--line); }
.qr img { display: block; width: 200px; height: 200px; }

@media (max-width: 960px) {
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; gap: 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .side-foot { margin: 0; border-top: 0; padding: 0; width: 100%; }
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
  .auth { grid-template-columns: 1fr; }
  .auth-aside { padding: 24px 20px; }
  .figure { border-left: 0; border-top: 1px solid var(--line); }
  .topbar { gap: 6px 16px; }
  .filters .field { min-width: 0; flex: 1 1 140px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .btn:active { transform: none; }
}
@media (forced-colors: active) {
  .tag, .btn { border: 1px solid CanvasText; }
}
.flush { margin: 0; }
.gap-top { margin-top: 16px; }
