/* Anybody (OFL), hostowany lokalnie: osie wdth 50-150 i wght 100-900 */
@font-face {
  font-family: 'Anybody';
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 50% 150%;
  font-display: swap;
  src: url('fonts/anybody-latin-ext.woff2') format('woff2');
  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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Anybody';
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 50% 150%;
  font-display: swap;
  src: url('fonts/anybody-latin.woff2') format('woff2');
  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;
}
/* Martian Mono (OFL), hostowany lokalnie: dane techniczne */
@font-face {
  font-family: 'Martian Mono';
  font-style: normal;
  font-weight: 100 800;
  font-stretch: 75% 112%;
  font-display: swap;
  src: url('fonts/martian-mono-latin-ext.woff2') format('woff2');
  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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Martian Mono';
  font-style: normal;
  font-weight: 100 800;
  font-stretch: 75% 112%;
  font-display: swap;
  src: url('fonts/martian-mono-latin.woff2') format('woff2');
  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;
}

/* ---------- Kolory (te same co na wizytówce) ---------- */
:root {
  color-scheme: light;
  --paper: #E8EAF3;
  --ink: #12142A;
  --muted: #4A4E6E;
  --accent: #2B35E8;
  --series2: #f47230;
  --good: #0aac23;
  --warning: #fbb315;
  --critical: #dc3c3d;
  --line: color-mix(in srgb, var(--ink) 14%, var(--paper));
  --track: color-mix(in srgb, var(--accent) 16%, var(--paper));
  --wash: color-mix(in srgb, var(--accent) 6%, var(--paper));
  --font: 'Anybody', system-ui, sans-serif;
  --mono: 'Martian Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --gap: 1rem;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --paper: #0E1022; --ink: #E8EAF3; --muted: #A3A8C8; --accent: #8791FF; --series2: #e76624;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0E1022; --ink: #E8EAF3; --muted: #A3A8C8; --accent: #8791FF; --series2: #e76624;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font); font-weight: 450; font-size: 0.875rem; line-height: 1.4;
  padding-bottom: 5rem;
}
a { color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible, .plot svg:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 3px;
}
h1, h2, p { margin: 0; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.state-ok .is-bad-only, .state-bad .is-ok-only { display: none; }
.mono, .logs, .kv dd, .host dd, .tiles .v, .kpis .v, .clock { font-family: var(--mono); font-weight: 450; }
.mono { font-size: 0.6875rem; }
.r { text-align: right; }
.crit { color: var(--critical); }

/* ---------- Nagłówek ---------- */
.top {
  display: grid; grid-template-columns: auto auto minmax(10rem, 18rem) 1fr auto;
  gap: 1.5rem; align-items: center;
  padding: 0.75rem var(--gap); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; font-weight: 800; font-size: 1.5rem; line-height: 1; letter-spacing: -0.02em; text-decoration: none; }
.brand span:nth-child(1) { font-stretch: 75%; }
.brand span:nth-child(2) { font-stretch: 50%; }
.brand span:nth-child(3) { font-stretch: 100%; }
.brand span:nth-child(4), .brand span:nth-child(5) { font-stretch: 150%; color: var(--accent); }
.brand span:nth-child(6) { font-stretch: 75%; }
.host { display: flex; gap: 1.25rem; margin: 0; }
.host div { display: flex; flex-direction: column; }
.host dt { font-size: 0.6875rem; color: var(--muted); }
.host dd { margin: 0; font-size: 0.75rem; }
.jump { position: relative; display: block; }
.jump input {
  width: 100%; padding: 0.45rem 2rem 0.45rem 0.7rem; font: inherit; color: var(--ink);
  background: transparent; border: 1px solid var(--line); border-radius: 6px; appearance: none;
}
.jump input::placeholder { color: var(--muted); }
.jump input::-webkit-search-cancel-button { display: none; }
.jump kbd { position: absolute; right: 0.6rem; top: 50%; transform: translateY(-50%); font-family: var(--mono); font-size: 0.6875rem; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 0.35rem; }
.clock { justify-self: end; text-align: right; display: flex; flex-direction: column; font-size: 0.8125rem; }
.live { font-family: var(--font); font-size: 0.6875rem; color: var(--muted); display: inline-flex; gap: 0.4rem; align-items: center; justify-content: flex-end; }
.live i { width: 6px; height: 6px; border-radius: 50%; background: var(--good); }
.live b { font-family: var(--mono); font-weight: 450; }
.me { display: flex; gap: 0.6rem; align-items: center; }
.me img { border-radius: 50%; display: block; }
.who { display: flex; flex-direction: column; line-height: 1.15; }
.who small { color: var(--muted); font-size: 0.6875rem; }

/* ---------- Werdykt + KPI ---------- */
.banner { padding: 1.25rem var(--gap) 1rem; border-bottom: 1px solid var(--line); }
.verdict { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1.25rem; margin-bottom: 1rem; }
.verdict h1 { font-weight: 800; font-stretch: 125%; font-size: clamp(1.5rem, 3.2vw, 2.25rem); line-height: 1.05; letter-spacing: -0.02em; display: inline-flex; align-items: center; gap: 0.6rem; }
.verdict h1 .ico { width: 1.1em; height: 1.1em; flex: none; }
.verdict p { color: var(--muted); }
.kpis { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.kpis li { position: relative; padding: 0.55rem 0.75rem 0.6rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.kpis .k { font-size: 0.6875rem; color: var(--muted); }
.kpis .v { font-size: 1.25rem; line-height: 1.25; letter-spacing: -0.02em; font-feature-settings: "tnum"; }
.kpis .sub { font-size: 0.6875rem; color: var(--muted); }
.spark { position: absolute; right: 0.5rem; top: 0.55rem; width: 3.5rem; height: 1.6rem; }
.spark svg { display: block; }

/* ---------- Siatka paneli ---------- */
.console {
  display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  grid-template-areas: "svc srv" "pipes srv" "logs http" "ops tasks";
  border-left: 1px solid var(--line); margin-left: var(--gap); margin-right: var(--gap);
}
.p-svc { grid-area: svc; } .p-srv { grid-area: srv; } .p-pipes { grid-area: pipes; }
.p-logs { grid-area: logs; } .p-ops { grid-area: ops; } .p-http { grid-area: http; } .p-tasks { grid-area: tasks; }
.panel { min-width: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 0 0 0.75rem; }
.panel > header { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: 0.7rem 0.75rem 0.5rem; }
.panel h2 { font-weight: 750; font-size: 0.9375rem; letter-spacing: -0.005em; }
.src { font-family: var(--mono); font-size: 0.6875rem; color: var(--muted); display: inline-flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.src a { text-underline-offset: 2px; }
.empty { padding: 0.75rem; color: var(--muted); }

/* Tabele */
.tablewrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; }
.grid th { text-align: left; font-weight: 600; font-size: 0.6875rem; color: var(--muted); padding: 0.3rem 0.75rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.grid th.r { text-align: right; }
.grid td { padding: 0.42rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.grid tr:last-child td { border-bottom: 0; }
.grid tbody tr:hover td { background: var(--wash); }
.grid td.name { font-weight: 700; font-stretch: 112%; }
.grid td.name a { text-decoration: none; }
.grid td.name a:hover { text-decoration: underline; text-underline-offset: 3px; }
.grid td.msg { white-space: normal; min-width: 12rem; max-width: 20rem; position: relative; }
.grid td.hi { font-weight: 700; }
.grid.compact td { padding-block: 0.38rem; }
.grid tr[hidden] { display: none; }

/* Statusy: ikona + etykieta */
.st { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.75rem; }
.st .ico { width: 0.95rem; height: 0.95rem; flex: none; }
.st-ok .ico, .verdict .st-ok { color: var(--good); }
.st-warn .ico { color: var(--warning); }
.st-bad .ico, .verdict .st-bad { color: var(--critical); }
.st-run .ico { color: var(--accent); }
.st-skip .ico { color: var(--muted); }
.st-bad { font-weight: 700; }
.prog { display: block; height: 3px; margin-top: 0.3rem; background: var(--track); border-radius: 2px; overflow: hidden; }
.prog > span { display: block; height: 100%; width: var(--p); background: var(--accent); border-radius: 2px; }

/* Serwer */
.kv { margin: 0; padding: 0 0.75rem 0.5rem; display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem 1rem; }
.kv div { display: flex; flex-direction: column; }
.kv dt { font-size: 0.6875rem; color: var(--muted); }
.kv dd { margin: 0; font-size: 0.75rem; }
.meters { list-style: none; margin: 0; padding: 0.25rem 0.75rem 0.5rem; }
.meters li { display: grid; grid-template-columns: 9rem 1fr 3rem; gap: 0.75rem; align-items: center; padding: 0.3rem 0; }
.mname { font-weight: 700; font-size: 0.8125rem; line-height: 1.15; }
.mname small { display: block; font-family: var(--mono); font-weight: 450; font-size: 0.6875rem; color: var(--muted); }
.meter { display: block; height: 6px; background: var(--track); border-radius: 3px; overflow: hidden; }
.meter > span { display: block; width: var(--v); height: 100%; background: var(--accent); border-radius: 3px; }
.meter[data-level="warn"] > span { background: var(--warning); }
.meter[data-level="crit"] > span { background: var(--critical); }
.mval { font-family: var(--mono); font-size: 0.8125rem; text-align: right; font-feature-settings: "tnum"; }
.sub-h { padding: 0.5rem 0.75rem 0.3rem; font-weight: 700; font-size: 0.75rem; color: var(--muted); }
.seg { display: flex; gap: 2px; height: 10px; margin: 0 0.75rem; }
.seg span { width: var(--w); background: var(--c); border-radius: 2px; }
.legend { list-style: none; margin: 0.4rem 0 0; padding: 0 0.75rem; display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; font-family: var(--mono); font-size: 0.6875rem; color: var(--muted); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--c); margin-right: 0.4rem; }
.cores { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; padding: 0 0.75rem; height: 3.25rem; align-items: end; }
.cores .core { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; gap: 2px; }
.cores .bar { background: var(--accent); border-radius: 2px 2px 0 0; min-height: 2px; }
.cores .lbl { font-family: var(--mono); font-size: 0.625rem; color: var(--muted); text-align: center; }

/* Wykresy */
.chart { margin: 0.75rem 0 0; padding: 0 0.75rem; }
.chart figcaption { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 0.75rem; margin-bottom: 0.25rem; }
.chart button, .seg-btn button {
  font: inherit; font-size: 0.6875rem; color: var(--ink); background: transparent;
  border: 1px solid var(--line); padding: 0.15rem 0.5rem; cursor: pointer;
}
.chart button { border-radius: 4px; }
.chart button[aria-pressed="true"], .seg-btn button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.plot { position: relative; }
.plot svg { display: block; width: 100%; overflow: visible; }
.plot text { font-family: var(--mono); font-size: 10px; fill: var(--muted); }
.plot line.grid { stroke: var(--line); stroke-width: 1; }
.plot .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.plot .s1 { stroke: var(--accent); }
.plot .s2 { stroke: var(--series2); }
.plot .area { fill: color-mix(in srgb, var(--accent) 14%, transparent); }
.plot .cross { stroke: var(--ink); stroke-width: 1; opacity: 0.45; }
.plot .dot { stroke: var(--paper); stroke-width: 2; }
.plot .endlabel { fill: var(--ink); font-weight: 600; }
.tip { position: absolute; pointer-events: none; z-index: 2; background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 0.3rem 0.5rem; box-shadow: 0 4px 14px color-mix(in srgb, var(--ink) 18%, transparent); font-family: var(--mono); font-size: 0.6875rem; white-space: nowrap; }
.tip strong { display: block; font-size: 0.8125rem; font-weight: 600; }
.tip .row { display: flex; align-items: center; gap: 0.4rem; color: var(--muted); }
.tip .row i { width: 10px; height: 2px; display: inline-block; }
.tip .at { color: var(--muted); display: block; margin-top: 0.1rem; }
.chart-legend { list-style: none; margin: 0.3rem 0 0; padding: 0; display: flex; gap: 1rem; font-family: var(--mono); font-size: 0.6875rem; color: var(--muted); }
.chart-legend i { display: inline-block; width: 12px; height: 2px; margin-right: 0.4rem; vertical-align: middle; }
.tbl table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 0.75rem; }
.tbl th, .tbl td { text-align: left; padding: 0.2rem 0; border-bottom: 1px solid var(--line); }

/* Logi */
.seg-btn { display: inline-flex; }
.seg-btn button { border-radius: 0; margin-left: -1px; }
.seg-btn button:first-child { border-radius: 4px 0 0 4px; margin-left: 0; }
.seg-btn button:last-child { border-radius: 0 4px 4px 0; }
.logs { list-style: none; margin: 0; padding: 0 0.75rem; font-size: 0.6875rem; line-height: 1.55; max-height: 15rem; overflow: auto; }
.logs li { display: grid; grid-template-columns: 4.5rem 2.4rem 7.5rem 1fr; gap: 0.6rem; padding: 0.1rem 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent); }
.logs .t { color: var(--muted); }
.logs .lv { font-weight: 600; }
.logs .lv.ERR { color: var(--critical); }
.logs .lv.WRN { color: color-mix(in srgb, var(--warning) 60%, var(--ink)); }
.logs .c { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logs .m { overflow-wrap: anywhere; }

/* Ruch HTTP */
.tiles { list-style: none; margin: 0 0 0.5rem; padding: 0 0.75rem; display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.5rem; }
.tiles .k { display: block; font-size: 0.6875rem; color: var(--muted); }
.tiles .v { font-size: 1.0625rem; letter-spacing: -0.02em; }
.tiles small { font-size: 0.6875rem; color: var(--muted); margin-left: 0.15rem; }

/* Stopka i panel makiety */
.foot { padding: 1rem var(--gap); color: var(--muted); font-size: 0.75rem; }
.foot code { font-family: var(--mono); }
.mock { position: fixed; right: 0.75rem; bottom: 0.75rem; display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; padding: 0.4rem 0.6rem; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 24px color-mix(in srgb, var(--ink) 20%, transparent); z-index: 10; }
.mock-label { font-size: 0.6875rem; color: var(--muted); }

/* ---------- Responsywność ---------- */
@media (max-width: 75rem) {
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .top { grid-template-columns: auto minmax(8rem, 1fr) auto auto; }
  .host { display: none; }
}
@media (max-width: 62rem) {
  .console { grid-template-columns: minmax(0, 1fr); grid-template-areas: "svc" "srv" "pipes" "logs" "http" "ops" "tasks"; }
}
@media (max-width: 40rem) {
  .top { grid-template-columns: 1fr auto; }
  .jump { grid-column: 1 / -1; order: 5; }
  .clock { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .logs li { grid-template-columns: 4.2rem 2.2rem 1fr; }
  .logs .c { display: none; }
  .tiles { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Logowanie i elementy aplikacji (poza makietą) ---------- */
body.login { min-height: 100vh; display: grid; place-items: center; padding-bottom: 0; }
.login main { display: grid; gap: 1.1rem; justify-items: start; max-width: 22rem; padding: 2rem; }
.brand-big { margin: 0; display: flex; align-items: baseline; font-weight: 800; font-size: 4rem; line-height: 1; letter-spacing: -0.02em; }
.brand-big span:nth-child(1) { font-stretch: 75%; } .brand-big span:nth-child(2) { font-stretch: 50%; }
.brand-big span:nth-child(3) { font-stretch: 100%; } .brand-big span:nth-child(4), .brand-big span:nth-child(5) { font-stretch: 150%; color: var(--accent); }
.brand-big span:nth-child(6) { font-stretch: 75%; }
.btn { display: inline-block; padding: 0.6rem 1rem; border-radius: 6px; background: var(--ink); color: var(--paper); font-weight: 700; text-decoration: none; border: 0; font-family: inherit; font-size: 0.875rem; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.err { color: var(--critical); font-weight: 600; }
.stale { color: var(--muted); font-family: var(--mono); font-size: 0.6875rem; }
.stale.error { color: var(--critical); }
.chartsvg { display: block; width: 100%; height: 150px; }
.chartsvg .l1 { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chartsvg .l2 { fill: none; stroke: var(--series2); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chartsvg .g { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chartsvg .a { fill: color-mix(in srgb, var(--accent) 14%, transparent); }
.axis { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 0.625rem; color: var(--muted); }
.form-grid { display: grid; gap: 0.75rem; max-width: 36rem; padding: 0.75rem; }
.form-grid label { display: grid; gap: 0.25rem; font-weight: 600; font-size: 0.8125rem; }
.form-grid input, .form-grid select { font: inherit; padding: 0.45rem 0.6rem; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--ink); }
.form-grid small { color: var(--muted); font-weight: 450; }
.ok-msg { color: var(--good); font-weight: 600; }

/* Układ paneli aplikacji (bez paneli "Stan operacyjny" i "Ruch HTTP", które nie mają jeszcze źródeł) */
.console { grid-template-areas: "svc srv" "pipes srv" "logs srv" "tasks tasks"; }
.p-tasks { grid-column: auto !important; }
@media (max-width: 62rem) { .console { grid-template-areas: "svc" "srv" "pipes" "logs" "tasks"; } }
