/* ================= tokeny ================= */
:root {
  --bg: #0b0d12; --side: #0e1016; --card: #12151c; --card-2: #171b24; --hover: #1a1f2a;
  --line: #1f2430; --line-2: #2a3040;
  --text: #e7e9ef; --muted: #8b93a7; --faint: #5d6579;
  --accent: #3b82f6; --accent-2: #2563eb; --accent-soft: rgba(59, 130, 246, .14);
  --green: #22c55e; --green-soft: rgba(34, 197, 94, .14);
  --red: #ef4444; --red-soft: rgba(239, 68, 68, .14);
  --amber: #f59e0b; --amber-soft: rgba(245, 158, 11, .14);
  --violet: #8b5cf6; --violet-soft: rgba(139, 92, 246, .14);
  --console: #0a0c10;
  --head: "Outfit", "Inter", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --r: 12px; --r-sm: 8px;
  color-scheme: dark;
}
html[data-theme="light"] {
  --bg: #f4f5f8; --side: #ffffff; --card: #ffffff; --card-2: #f6f7fa; --hover: #eef0f4;
  --line: #e4e7ee; --line-2: #d6dae3;
  --text: #121620; --muted: #5e667a; --faint: #959cad;
  --accent-soft: rgba(59, 130, 246, .10); --console: #0f1218;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { display: flex; background: var(--bg); color: var(--text); font: 14px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
svg { stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--head); margin: 0; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.sm { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.sp { flex: 1; }

/* ================= boczny panel ================= */
.side { width: 236px; flex-shrink: 0; background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 12px 14px; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 20px; }
.logo { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0;
  background: linear-gradient(140deg, #60a5fa, #2563eb); color: #fff; box-shadow: 0 6px 18px rgba(37, 99, 235, .35); }
.logo svg { width: 22px; height: 22px; stroke-width: 1.9; }
.brand-name { font: 700 17px/1.1 var(--head); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.brand-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.nav-sec { color: var(--faint); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; padding: 16px 12px 6px; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav button { all: unset; cursor: pointer; display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--r-sm); color: var(--muted); font-weight: 500; position: relative; }
.side nav button svg { width: 18px; height: 18px; flex-shrink: 0; }
.side nav button:hover { background: var(--hover); color: var(--text); }
.side nav button.active { background: var(--card-2); color: var(--text); }
.side nav button.active svg { color: var(--accent); }
.side nav button.active::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.side nav button:focus-visible { outline: 2px solid var(--accent); }
.badge { margin-left: auto; font-style: normal; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--red-soft); color: var(--red); font-size: 12px; font-weight: 600; display: grid; place-items: center; }
.side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.who-am-i { padding: 6px 12px 10px; display: flex; flex-direction: column; }
.who-am-i b { font-weight: 600; }
.who-am-i small { color: var(--muted); font-size: 12px; }
.side-foot button, .side-foot a { all: unset; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--r-sm); color: var(--muted); font-size: 13.5px; }
.side-foot button:hover, .side-foot a:hover { background: var(--hover); color: var(--text); }
.side-foot svg { width: 16px; height: 16px; }

/* ================= główna część ================= */
main { flex: 1; min-width: 0; height: 100vh; display: flex; flex-direction: column; }
.topbar { padding: 18px 32px 16px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.eyebrow { color: var(--faint); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.topbar h1 { font-size: 22px; font-weight: 600; margin-top: 2px; }
.content { flex: 1; min-height: 0; overflow-y: auto; padding: 24px 32px 32px; display: flex; flex-direction: column; gap: 18px; }

/* karta serwera */
.server-card { position: relative; z-index: 10; display: flex; align-items: center; gap: 18px; padding: 18px 20px; border-radius: var(--r); border: 1px solid var(--line);
  background:
    radial-gradient(600px 160px at 100% 0%, rgba(59, 130, 246, .12), transparent 70%),
    linear-gradient(var(--card), var(--card)); flex-shrink: 0; }
.server-card::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: .35;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 22px 22px; mask-image: linear-gradient(90deg, transparent 45%, #000 100%); -webkit-mask-image: linear-gradient(90deg, transparent 45%, #000 100%); }
.server-card > * { position: relative; z-index: 1; }
.srv-icon { width: 54px; height: 54px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(59, 130, 246, .25); }
.srv-icon svg { width: 30px; height: 30px; stroke-width: 1.6; }
.srv-main { flex: 1; min-width: 0; }
.srv-main h2 { font-size: 24px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 13px; background: var(--card-2); border: 1px solid var(--line); color: var(--muted); font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.pill svg { width: 13px; height: 13px; }
.pill-state i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
[data-state="running"] .pill-state { color: var(--green); background: var(--green-soft); border-color: transparent; }
[data-state="running"] .pill-state i { background: var(--green); box-shadow: 0 0 0 3px rgba(34, 197, 94, .2); }
[data-state="crashed"] .pill-state { color: var(--red); background: var(--red-soft); border-color: transparent; }
[data-state="crashed"] .pill-state i { background: var(--red); }
[data-state="stopping"] .pill-state { color: var(--amber); background: var(--amber-soft); border-color: transparent; }
[data-state="stopping"] .pill-state i { background: var(--amber); }
.srv-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 250px; background: var(--card-2); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 5px; box-shadow: 0 18px 40px rgba(0, 0, 0, .45); }
.menu button { all: unset; cursor: pointer; display: block; width: 100%; box-sizing: border-box; padding: 8px 10px; border-radius: 6px; font-size: 13.5px; }
.menu button:hover { background: var(--hover); }
.menu button[data-action="kill"] { color: var(--red); }

/* przyciski */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--card-2); cursor: pointer; font-weight: 500; font-size: 13.5px; white-space: nowrap; text-decoration: none; transition: background .12s, border-color .12s; }
.btn svg { width: 15px; height: 15px; }
.btn:hover:not(:disabled) { background: var(--hover); border-color: var(--faint); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--accent-2); border-color: var(--accent-2); }
.btn.stop { color: #f87171; background: var(--red-soft); border-color: rgba(239, 68, 68, .25); }
.btn.stop:hover:not(:disabled) { background: rgba(239, 68, 68, .22); border-color: rgba(239, 68, 68, .45); }
.btn.start { color: #4ade80; background: var(--green-soft); border-color: rgba(34, 197, 94, .3); }
.btn.start:hover:not(:disabled) { background: rgba(34, 197, 94, .22); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--hover); border-color: transparent; }
.btn.sm { height: 30px; padding: 0 11px; font-size: 13px; }
.btn.icon { width: 36px; padding: 0; }
.btn.sm.icon { width: 30px; }
.btn.danger { color: var(--red); }
.link { all: unset; cursor: pointer; color: var(--accent); font-size: 13px; font-weight: 500; }
.link:hover { text-decoration: underline; }

/* widoki */
.view { display: none; flex-direction: column; gap: 18px; }
.view.active { display: flex; }
.view.fill.active { flex: 1; min-height: 420px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* karty */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 4px; flex-wrap: wrap; }
.card-head h3 { font-size: 15.5px; font-weight: 600; }
.ch-ic { width: 17px; height: 17px; color: var(--muted); }
.card-body { padding: 12px 18px 18px; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpis.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.kpi { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; min-width: 0; overflow: hidden; }
.kpi-head { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; font-weight: 500; }
.chip { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; }
.chip svg { width: 16px; height: 16px; }
.chip.blue { background: var(--accent-soft); color: var(--accent); }
.chip.green { background: var(--green-soft); color: var(--green); }
.chip.violet { background: var(--violet-soft); color: var(--violet); }
.chip.amber { background: var(--amber-soft); color: var(--amber); }
.chip.red { background: var(--red-soft); color: var(--red); }
.kpi-val { font: 700 30px/1.15 var(--head); margin-top: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi-val small { font-size: 17px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.kpi-sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-spark { position: absolute; right: 16px; bottom: 16px; width: 100px; height: 34px; }
.kpi-spark svg { width: 100%; height: 100%; overflow: visible; }

.row-2 { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; }
.row-2.even { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }

/* wykres */
.chart { position: relative; height: 280px; user-select: none; }
.chart.tall { height: 360px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.c-grid line { stroke: var(--line); }
.c-axis text { fill: var(--faint); font: 11.5px var(--body); }
.c-line { fill: none; stroke-width: 2.2; }
.c-down { opacity: .09; }
.c-cursor { stroke: var(--muted); stroke-dasharray: 3 4; }
.c-dot { stroke: var(--card); stroke-width: 3; }
.c-empty { fill: var(--muted); font: 14px var(--body); }
.c-tip { position: absolute; pointer-events: none; transform: translate(-50%, calc(-100% - 14px)); z-index: 5; background: var(--card-2); border: 1px solid var(--line-2); color: var(--text); border-radius: 8px; padding: 8px 11px; font-size: 12.5px; white-space: nowrap; box-shadow: 0 10px 26px rgba(0, 0, 0, .4); line-height: 1.4; }
.c-tip-t { display: block; color: var(--muted); }
.c-tip b { font: 700 18px var(--head); margin-right: 3px; }
.c-tip-s { display: block; color: var(--muted); }
.c-tip em { color: var(--red); font-style: normal; }
.chart-note { color: var(--faint); font-size: 12px; margin-top: 6px; }

/* lista graczy */
.who { display: flex; flex-direction: column; }
.who-list { list-style: none; margin: 0; padding: 8px 10px 12px; overflow: auto; flex: 1; max-height: 330px; }
.who-list li { display: flex; align-items: center; gap: 10px; padding: 8px 8px; border-radius: var(--r-sm); }
.who-list li:hover { background: var(--hover); }
.av { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font: 600 12px var(--head); color: #fff; flex-shrink: 0; }
.who-list .nick { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.who-list .ping { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.who-list .ping.bad { color: var(--amber); }
.empty { color: var(--muted); padding: 26px 12px; text-align: center; font-size: 13.5px; }
.empty svg { width: 34px; height: 34px; color: var(--faint); display: block; margin: 0 auto 10px; padding: 7px; border-radius: 50%; background: var(--card-2); }

/* zdarzenia */
.events { list-style: none; margin: 0; padding: 6px 18px 14px; }
.events li { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.events li:last-child { border-bottom: 0; }
.events .ev-ic { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: var(--card-2); color: var(--muted); }
.events .ev-ic svg { width: 13px; height: 13px; }
.events .ev-start .ev-ic { background: var(--green-soft); color: var(--green); }
.events .ev-crash .ev-ic, .events .ev-hang .ev-ic, .events .ev-restart_paused .ev-ic { background: var(--red-soft); color: var(--red); }
.events .ev-restart .ev-ic { background: var(--accent-soft); color: var(--accent); }
.events .ev-t { font-weight: 500; font-size: 13.5px; }
.events .ev-d { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.events time { color: var(--faint); font-size: 12px; white-space: nowrap; }

.mini-console { margin: 10px 12px 12px; background: var(--console); border: 1px solid var(--line); border-radius: var(--r-sm); color: #cfd5e1; padding: 10px 12px; font: 11.5px/1.6 var(--mono); height: 262px; overflow: hidden; white-space: pre-wrap; word-break: break-word; display: flex; flex-direction: column; justify-content: flex-end; }

.kv { margin: 0; padding: 6px 18px 14px; }
.kv > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 12px; font-weight: 500; }
.tag.on { background: var(--green-soft); color: var(--green); }
.tag.off { background: var(--card-2); color: var(--muted); border: 1px solid var(--line); }

/* konsola */
.console-card { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.console { flex: 1; min-height: 0; overflow: auto; background: var(--console); color: #cfd5e1; padding: 14px 16px; font: 12.5px/1.65 var(--mono); white-space: pre-wrap; word-break: break-word; margin: 0; }
.l-err { color: #f87171; } .l-warn { color: #fbbf24; } .l-panel { color: #93c5fd; } .l-cmd { color: #c4b5fd; } .l-ok { color: #4ade80; }
.console-bar { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 16px; border-top: 1px solid var(--line); background: var(--card); }
.console-bar .prompt { color: var(--accent); font: 700 18px var(--mono); }
.console-bar input[type=text] { flex: 1; min-width: 0; background: none; border: 0; outline: 0; font: 13px var(--mono); }

/* formularze */
.input { height: 36px; padding: 0 11px; background: var(--card); border: 1px solid var(--line-2); border-radius: var(--r-sm); outline: 0; min-width: 0; font-size: 13.5px; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 13px; color: var(--muted); white-space: nowrap; }
.check input { accent-color: var(--accent); }
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 3px; }
.seg button { all: unset; cursor: pointer; padding: 5px 12px; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--muted); }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--card-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.seg.sm button { padding: 3px 10px; font-size: 12.5px; }
.seg button:focus-visible { outline: 2px solid var(--accent); }
.switch { position: relative; width: 40px; height: 22px; flex-shrink: 0; display: inline-block; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--line-2); border-radius: 11px; transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* statystyki */
.heat { display: grid; grid-template-columns: 26px repeat(24, minmax(0, 1fr)); gap: 3px; font-size: 11px; color: var(--faint); }
.heat .c { aspect-ratio: 1; border-radius: 3px; background: var(--card-2); }
.heat .h { text-align: center; }
.heat .d { align-self: center; }
.heat-scale { display: flex; align-items: center; gap: 8px; margin-top: 12px; color: var(--faint); font-size: 12px; }
.heat-scale span { height: 6px; flex: 0 0 120px; border-radius: 3px; background: linear-gradient(90deg, var(--card-2), var(--accent)); }
.top { list-style: none; margin: 0; padding: 0; counter-reset: top; }
.top li { display: grid; grid-template-columns: 22px 1fr auto; gap: 4px 10px; align-items: center; padding: 6px 0; }
.top li::before { counter-increment: top; content: counter(top); color: var(--faint); font-size: 12.5px; text-align: right; }
.top .n { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .t { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.top .bar { grid-column: 2 / 4; height: 4px; border-radius: 2px; background: var(--card-2); }
.top .bar span { display: block; height: 100%; border-radius: 2px; background: var(--accent); }

/* pliki */
.files { flex: 1; min-height: 0; display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 14px; }
.browser { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.crumbs { padding: 14px 16px 6px; font-size: 13px; color: var(--muted); word-break: break-all; }
.crumbs a { cursor: pointer; color: var(--text); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.browser-tools { display: flex; gap: 6px; padding: 6px 12px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tree { list-style: none; margin: 0; padding: 6px; overflow: auto; flex: 1; }
.tree li { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 6px; cursor: pointer; font-size: 13.5px; }
.tree li:hover { background: var(--hover); }
.tree li.open { background: var(--accent-soft); }
.tree .ic { width: 16px; height: 16px; flex-shrink: 0; color: var(--muted); }
.tree li.dir .ic { color: var(--accent); }
.tree .fn { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree small { color: var(--faint); font-size: 12px; }
.tree .acts { display: none; gap: 2px; }
.tree li:hover .acts, .tree li:focus-within .acts { display: inline-flex; }
.tree li:hover small, .tree li:focus-within small { display: none; }
.tree .acts button { all: unset; cursor: pointer; padding: 2px 6px; border-radius: 4px; color: var(--muted); font-size: 12px; }
.tree .acts button:hover { background: var(--line-2); color: var(--text); }
.editor { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.editor-top { display: flex; align-items: center; gap: 10px; padding: 9px 12px 9px 16px; border-bottom: 1px solid var(--line); min-height: 50px; }
.editor-top .path { font: 12.5px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dirty { color: var(--amber); font-size: 12.5px; white-space: nowrap; }
.editor-host { flex: 1; min-height: 0; position: relative; }
.editor-host textarea { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; resize: none; background: var(--console); color: #cfd5e1; font: 12.5px/1.6 var(--mono); padding: 12px 14px; outline: 0; }
.editor-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--muted); background: var(--card); z-index: 3; padding: 24px; }
.editor-empty svg { width: 40px; height: 40px; color: var(--faint); padding: 9px; border-radius: 50%; background: var(--card-2); }
.editor-empty h3 { font-size: 16px; color: var(--text); margin: 10px 0 4px; }
.editor-empty p { margin: 0; max-width: 40ch; }
.CodeMirror { height: 100%; font: 12.5px/1.6 var(--mono); background: var(--console) !important; }

/* logi i crashe */
.logbox { flex: 1; min-height: 0; border-radius: var(--r); border: 1px solid var(--line); }
.split { flex: 1; min-height: 0; display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 14px; }
.crash-list { list-style: none; margin: 0; padding: 6px; }
.crash-list li { padding: 10px 12px; border-radius: var(--r-sm); cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; }
.crash-list li:hover { background: var(--hover); }
.crash-list li.open { background: var(--red-soft); }
.crash-list b { font-weight: 600; }
.crash-list small { color: var(--muted); font-size: 12.5px; grid-column: 1; }
.crash-list button { all: unset; cursor: pointer; grid-row: 1 / span 2; grid-column: 2; color: var(--faint); padding: 4px 6px; border-radius: 4px; }
.crash-list button:hover { color: var(--red); background: var(--red-soft); }

/* harmonogram */
.sched-form { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1.4fr auto; gap: 12px; align-items: end; }
.sched-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.sched-btns { display: flex; gap: 8px; }
.cron-help { margin: 14px 0 0; color: var(--muted); font-size: 12.5px; }
.cron-help code { font: 12px var(--mono); background: var(--card-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 4px; color: var(--text); }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 13.5px; }
.table tr:last-child td { border-bottom: 0; }
.table tr.off td { opacity: .5; }
.table .acts { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

/* ustawienia */
.settings { display: flex; flex-direction: column; gap: 14px; max-width: 980px; }
.set-group { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.set-group > header { padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.set-group > header h3 { font-size: 15.5px; font-weight: 600; }
.set-group > header p { color: var(--muted); font-size: 13px; margin: 3px 0 0; }
.set-fields { padding: 4px 0; }
.field { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.field:last-child { border-bottom: 0; }
.field .lbl { font-weight: 500; }
.field .help { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.field .ctl { display: flex; justify-content: flex-end; gap: 8px; }
.field .ctl .input { width: 100%; }
.field.locked .ctl .input { opacity: .55; }
.savebar { position: sticky; bottom: -32px; display: flex; align-items: center; gap: 12px; padding: 14px 0 20px; background: linear-gradient(transparent, var(--bg) 35%); }

/* toasty */
#toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { display: flex; align-items: center; gap: 10px; background: var(--card-2); border: 1px solid var(--line-2); color: var(--text); padding: 11px 14px; border-radius: 10px; max-width: 420px; font-size: 13.5px; box-shadow: 0 14px 34px rgba(0, 0, 0, .45); }
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
.toast.err::before { background: var(--red); }

/* logowanie */
.login-body { align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(700px 400px at 50% 0%, rgba(59, 130, 246, .14), transparent 70%), var(--bg); }
.login-wrap { width: 100%; max-width: 380px; }
.login-brand { display: flex; align-items: center; gap: 12px; justify-content: center; margin-bottom: 20px; }
.login-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 26px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); }
.login-card h1 { font-size: 22px; font-weight: 600; }
.login-card p { margin: -8px 0 4px; color: var(--muted); }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
.login-card .input { height: 42px; }
.login-card .btn { height: 42px; font-size: 14px; }
.login-error { background: var(--red-soft); color: #f87171; border-radius: var(--r-sm); padding: 9px 12px; font-size: 13px; }

/* responsywność */
@media (max-width: 1400px) { .kpis.six { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1250px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row-3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .row-3 > :last-child { grid-column: 1 / -1; }
  .server-card { flex-wrap: wrap; }
  .srv-actions { width: 100%; }
}
@media (max-width: 1000px) {
  .row-2, .row-2.even { grid-template-columns: minmax(0, 1fr); }
  .sched-form { grid-template-columns: 1fr 1fr; }
  .field { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .field .ctl { justify-content: flex-start; }
}
.menu-btn, .menu-close, .side-backdrop, .topbar-state { display: none; }
.topbar { display: flex; align-items: center; gap: 12px; }
@media (max-width: 760px) {
  /* boczne menu jako wysuwana szuflada */
  .side { position: fixed; top: 0; left: 0; bottom: 0; z-index: 200; width: min(290px, 84vw); height: 100dvh;
    transform: translateX(-102%); transition: transform .22s ease; box-shadow: 0 0 60px rgba(0, 0, 0, .5); }
  body.menu-open .side { transform: none; }
  .side-backdrop { display: block; position: fixed; inset: 0; z-index: 150; background: rgba(5, 7, 12, .55); opacity: 0; pointer-events: none; transition: opacity .22s; }
  body.menu-open .side-backdrop { opacity: 1; pointer-events: auto; }
  body.menu-open { overflow: hidden; }
  .menu-close { display: grid; place-items: center; margin-left: auto; width: 36px; height: 36px; border-radius: var(--r-sm); border: 0; background: transparent; color: var(--muted); cursor: pointer; }
  .menu-close svg { width: 20px; height: 20px; }
  .side nav button.active::before { left: -12px; }
  main { height: 100dvh; }
  .topbar { position: sticky; top: 0; z-index: 50; padding: 10px 14px; background: var(--bg); }
  .menu-btn { display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--card); color: var(--text); cursor: pointer; }
  .menu-btn svg { width: 20px; height: 20px; }
  .topbar-title { flex: 1; min-width: 0; }
  .topbar h1 { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-state { display: block; }
  .topbar-state i { display: block; width: 10px; height: 10px; border-radius: 50%; background: var(--faint); }
  .topbar-state[data-state="running"] i { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
  .topbar-state[data-state="crashed"] i { background: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
  .topbar-state[data-state="stopping"] i { background: var(--amber); }
  .content { padding: 14px; gap: 14px; }
  .server-card { padding: 14px; gap: 12px; }
  .srv-icon { display: none; }
  .srv-main h2 { font-size: 19px; }
  .srv-actions { display: grid; grid-template-columns: 1fr 1fr 1fr auto; width: 100%; gap: 6px; }
  .srv-actions .btn { padding: 0 8px; }
  body:not([data-view="pulpit"]) .server-card { display: none; }
  .kpis, .kpis.six, .row-3 { grid-template-columns: minmax(0, 1fr); }
  .kpis.six { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: 14px; }
  .kpi-val { font-size: 25px; }
  .files, .split { grid-template-columns: minmax(0, 1fr); }
  .browser { max-height: 40vh; }
  .card { overflow-x: auto; }
  .table th, .table td { padding: 10px 12px; white-space: nowrap; }
  .toolbar > .input, .toolbar > input[type=search] { width: 100% !important; }
  .seg { max-width: 100%; overflow-x: auto; }
  .chart { height: 230px; }
  .chart.tall { height: 280px; }
  .sched-form { grid-template-columns: minmax(0, 1fr); }
  .console-bar { flex-wrap: wrap; }
  .console-bar input[type=text] { flex-basis: 100%; order: -1; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
#settings-form { display: flex; flex-direction: column; gap: 14px; }
.btn.disabled { opacity: .45; }
.chart svg, .kpi-spark svg { stroke: none; }
.kpi.has-spark .kpi-sub { padding-right: 112px; }

/* ================= dodatki ================= */
textarea.input { height: auto; width: 100%; padding: 8px 11px; resize: vertical; font: 12.5px/1.5 var(--mono); }
.addon-drop { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-style: dashed; border-color: var(--line-2); }
.addon-drop h3 { font-size: 15.5px; }
.addon-drop p { margin: 2px 0 0; max-width: 70ch; }
.addon-drop.over { border-color: var(--accent); background: var(--accent-soft); }
.addon-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(440px, 100%), 1fr)); gap: 14px; }
.addon { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.addon.off { opacity: .72; }
.addon-head { display: flex; align-items: center; gap: 12px; }
.addon-meta h3 { font-size: 16px; }
.addon-desc { margin: 0; color: var(--muted); }
.addon-err { background: var(--red-soft); color: #f87171; padding: 8px 10px; border-radius: var(--r-sm); font: 12px/1.5 var(--mono); white-space: pre-wrap; }
.addon-pages { margin: 0; }
.addon-actions { display: flex; gap: 6px; align-items: center; border-top: 1px solid var(--line); padding-top: 12px; flex-wrap: wrap; }
.addon-settings { border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--card-2); }
.addon-settings .field { grid-template-columns: minmax(0, 1fr) minmax(0, 300px); }
.reset-default { all: unset; cursor: pointer; display: inline-block; margin-top: 6px; font-size: 12px; color: var(--accent); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reset-default:hover { text-decoration: underline; }
.reset-default:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.form-actions { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.check .st { color: var(--muted); }

/* wykres wielu serii */
.mc { display: flex; flex-direction: column; gap: 10px; }
.mc svg { stroke: none; }
.mc-legend { display: flex; flex-wrap: wrap; gap: 6px; }
.mc-legend button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 10px; border-radius: 13px; background: var(--card-2); border: 1px solid var(--line); font-size: 12.5px; }
.mc-legend button:hover { border-color: var(--line-2); }
.mc-legend button i { width: 8px; height: 8px; border-radius: 50%; }
.mc-legend button em { font-style: normal; color: var(--muted); }
.mc-legend button.off { opacity: .4; }
.mc-plot { position: relative; flex: 1; min-height: 0; }
.mc .c-tip { transform: translate(-50%, 0); min-width: 170px; }
.mc-row { display: flex; align-items: center; gap: 7px; color: var(--muted); }
.mc-row i { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.mc-row em { margin-left: auto; padding-left: 14px; color: var(--text); font-style: normal; font-weight: 600; }
@media (max-width: 760px) {
  .addon-list { grid-template-columns: minmax(0, 1fr); }
  .addon-drop { flex-wrap: wrap; }
  .addon-drop .btn { width: 100%; }
  .addon { padding: 14px; }
  .addon-head { flex-wrap: wrap; }
  .addon-actions .sp { display: none; }
  .addon-actions .btn { flex: 1 1 auto; }
  .addon-settings .field, .field { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 12px 14px; }
  .field .ctl { justify-content: stretch; }
  .field .ctl .input, .field .ctl textarea, .field .ctl select { width: 100%; }
  .form-actions { padding: 12px 14px; }
  .form-actions .btn { width: 100%; }
  .form-actions .sp { display: none; }
  .savebar .btn { flex: 1; }
}
.card-head > svg { width: 17px; height: 17px; color: var(--muted); flex-shrink: 0; }
.addon:has(.addon-settings:not([hidden])) { grid-column: 1 / -1; }

/* wybór zakresu dat */
.range-picker { position: relative; }
.rp-custom { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--card); }
.rp-custom label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.rp-custom .input { height: 32px; }
.rp-quick { display: flex; gap: 2px; }
.rp-label { font-weight: 500; color: var(--text); }
.stats-hint { margin: -6px 0 0; }
@media (max-width: 760px) {
  .rp-custom { width: 100%; }
  .rp-custom label { flex: 1 1 140px; }
  .rp-custom label .input { flex: 1; }
  .rp-custom > .btn { width: 100%; }
  .range-picker .seg { width: 100%; overflow-x: auto; scrollbar-width: none; }
  .range-picker .seg button { white-space: nowrap; flex: 1 0 auto; }
}
