/* Panel serwera — wygląd „A · Kokpit” (ciemny, menu z boku). */
:root {
  --bg: #0e1116; --side: #12161d; --card: #161b22; --card2: #1a2029; --line: #222a35; --line2: #2c3644;
  --text: #e6e9ef; --muted: #9aa4b2; --dim: #7b8594;
  --acc: #2bb39b; --acc-ink: #062b25; --link: #7dd3c0; --link-h: #a7f3e4; --nav-on: #1d2f2c;
  --ok: #3fb950; --ok-bg: #183a24; --ok-ink: #8ff0a8;
  --bad: #f85149; --bad-bg: #2a1619; --bad-line: #5c2a2f; --bad-tag: #4a1f24; --bad-ink: #ffb4b0;
  --warn: #e3a93b; --warn-bg: #261f12; --warn-line: #5a4620; --warn-tag: #463614; --warn-ink: #ffd98a;
  --info-bg: #141d2b; --info-line: #2a3d5c; --info-tag: #1d2a3d; --info-ink: #a8c8ff;
  --bar: #262f3b; --r: 14px;
  --font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --head: "Space Grotesk", Inter, system-ui, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); -webkit-text-size-adjust: 100%; }
a { color: var(--link); text-decoration: none; } a:hover { color: var(--link-h); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--head); margin: 0; line-height: 1.2; }
h1 { font-size: 30px; } h2 { font-size: 18px; } h3 { font-size: 16px; }
.mono { font-family: var(--mono); font-size: 13px; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .small { font-size: 13px; }
.nowrap { white-space: nowrap; } .grow { flex: 1 1 auto; min-width: 0; } .ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

/* układ */
.shell { min-height: 100vh; display: flex; }
.side { width: 240px; flex: none; background: var(--side); border-right: 1px solid var(--line); padding: 22px 14px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.brand-ico { width: 36px; height: 36px; border-radius: 10px; background: #1f6f62; display: grid; place-items: center; flex: none; }
.brand b { font-family: var(--head); font-size: 17px; display: block; } .brand span { font-size: 12px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 10px; color: #c9d1dc; }
.nav a svg { flex: none; opacity: .75; }
.nav a .cnt { margin-left: auto; font-size: 12px; color: var(--muted); }
.nav a:hover { background: #171d26; color: var(--text); }
.nav a.on { background: var(--nav-on); color: var(--link-h); font-weight: 600; } .nav a.on svg { opacity: 1; }
.nav a .dot { width: 8px; height: 8px; border-radius: 4px; background: var(--bad); margin-left: auto; }
.who { margin-top: auto; padding: 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.who b { color: var(--text); }
.main { flex: 1 1 auto; min-width: 0; padding: 30px 32px 60px; display: flex; flex-direction: column; gap: 22px; max-width: 1400px; }
.topbar { display: none; }

.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; }
.head .sub { color: var(--muted); font-size: 14px; margin-top: 6px; }
.acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* przyciski */
.btn { min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line2); background: var(--card); color: var(--text); font-weight: 600; font-size: 14px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; }
.btn:hover { background: #1c232d; border-color: #3a4656; }
.btn.pri { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); font-weight: 700; } .btn.pri:hover { background: #35c7ad; }
.btn.danger { background: #3a1a1e; border-color: #6b2c33; color: #ffc9c5; } .btn.danger:hover { background: #4a1f24; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn.ico { min-width: 44px; padding: 0; }
.btn.sm.ico { min-width: 36px; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; }

/* karty */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; min-width: 0; }
.card > .card-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.cols { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.cols > * { flex: 1 1 380px; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); min-width: 0; }
.card-h + .row, .rows > .row:first-child { border-top: 0; }
.row .t { font-weight: 600; } .row .s { font-size: 13px; color: var(--muted); }
.stack { display: flex; flex-direction: column; min-width: 0; }
.list-empty { color: var(--muted); padding: 14px 0; }

/* alarmy */
.alerts { display: flex; flex-direction: column; gap: 8px; }
.alert { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 11px 16px; border-radius: 12px; border: 1px solid; }
.alert .tag { font-size: 12px; font-weight: 700; letter-spacing: .04em; padding: 4px 8px; border-radius: 6px; }
.alert .txt { flex: 1 1 240px; }
.alert.error { background: var(--bad-bg); border-color: var(--bad-line); } .alert.error .tag { background: var(--bad-tag); color: var(--bad-ink); }
.alert.warn { background: var(--warn-bg); border-color: var(--warn-line); } .alert.warn .tag { background: var(--warn-tag); color: var(--warn-ink); }
.alert.info { background: var(--info-bg); border-color: var(--info-line); } .alert.info .tag { background: var(--info-tag); color: var(--info-ink); }
.alert.ok { background: #13221a; border-color: #24452f; } .alert.ok .tag { background: var(--ok-bg); color: var(--ok-ink); }

/* wskaźniki */
.gauges { display: flex; flex-wrap: wrap; gap: 16px; }
.gauge { flex: 1 1 200px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: flex; flex-direction: column; gap: 9px; }
.gauge .l { font-size: 13px; color: var(--muted); }
.gauge .v { font-family: var(--head); font-size: 27px; font-weight: 700; }
.bar { height: 8px; border-radius: 4px; background: var(--bar); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: var(--acc); }
.bar.warn > i { background: var(--warn); } .bar.bad > i { background: var(--bad); }
.spark { height: 26px; width: 100%; display: block; }

/* znaczniki */
.pill { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; font-size: 12px; font-weight: 700; padding: 4px 8px; border-radius: 6px; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok-ink); } .pill.bad { background: var(--bad-tag); color: var(--bad-ink); }
.pill.warn { background: var(--warn-tag); color: var(--warn-ink); } .pill.info { background: var(--info-tag); color: var(--info-ink); }
.pill.off { background: #262b33; color: #b5bdc9; }
.dot { width: 10px; height: 10px; border-radius: 5px; flex: none; background: var(--ok); }
.dot.bad { background: var(--bad); } .dot.off { background: #5b6472; } .dot.warn { background: var(--warn); }

/* formularze */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; color: var(--muted); }
.input, select.input { min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line2); background: #0f141a; color: var(--text); width: 100%; }
.input:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px rgba(43,179,155,.2); }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--acc); }
.form-grid { display: flex; flex-wrap: wrap; gap: 14px; } .form-grid > * { flex: 1 1 180px; }

/* tabele i logi */
.scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--card2); position: sticky; top: 0; }
table.t td { padding: 8px 12px; border-bottom: 1px solid #1d242e; vertical-align: top; max-width: 320px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logs-table td { white-space: normal; overflow-wrap: anywhere; }
table.t td.null { color: var(--dim); font-style: italic; }
.logbox { background: #0a0d11; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font: 12.5px/1.55 var(--mono); white-space: pre-wrap; word-break: break-word; max-height: 70vh; overflow: auto; color: #cfd6e0; }
.logbox .e { color: #ff9d97; } .logbox .w { color: #ffd98a; } .logbox .ok { color: #8ff0a8; }
.out { background: #0a0d11; border-radius: 10px; padding: 10px 12px; font: 12px/1.5 var(--mono); white-space: pre-wrap; max-height: 260px; overflow: auto; margin-top: 8px; color: #cfd6e0; }

/* drzewo dysku */
.du-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.du-row .nm { flex: 0 1 260px; min-width: 0; } .du-row .br { flex: 1 1 120px; } .du-row .sz { width: 84px; text-align: right; font-variant-numeric: tabular-nums; }
.crumbs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-family: var(--mono); font-size: 13px; }
.crumbs a { padding: 6px 4px; }

/* okna, powiadomienia, zadania */
.modal-bg { position: fixed; inset: 0; background: rgba(5,7,10,.72); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { width: min(520px, 100%); background: var(--card); border: 1px solid var(--line2); border-radius: 16px; padding: 22px; display: flex; flex-direction: column; gap: 14px; max-height: 90vh; overflow: auto; }
.modal p { margin: 0; color: #c9d1dc; white-space: pre-line; }
.modal .acts { justify-content: flex-end; }
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; width: min(560px, calc(100% - 32px)); }
.toast { background: #202834; border: 1px solid var(--line2); border-radius: 12px; padding: 12px 16px; box-shadow: 0 10px 30px rgba(0,0,0,.4); white-space: pre-line; }
.toast.bad { background: #331a1e; border-color: #6b2c33; } .toast.ok { background: #15281d; border-color: #2a5a3a; }
.jobs { position: fixed; right: 16px; bottom: 16px; width: min(400px, calc(100% - 32px)); display: flex; flex-direction: column; gap: 8px; z-index: 40; }
.job { background: #1a212b; border: 1px solid var(--line2); border-radius: 14px; padding: 12px 14px; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.job-h { display: flex; align-items: center; gap: 10px; }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #3a4656; border-top-color: var(--acc); animation: sp 0.8s linear infinite; flex: none; }
@keyframes sp { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 3s; } }

/* logowanie */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login { width: min(420px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.login .err { background: var(--bad-bg); border: 1px solid var(--bad-line); color: var(--bad-ink); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.qr { background: #fff; border-radius: 12px; padding: 10px; width: 220px; height: 220px; align-self: center; }
.secret { font-family: var(--mono); font-size: 15px; letter-spacing: .04em; background: #0f141a; border: 1px dashed var(--line2); border-radius: 10px; padding: 10px 12px; text-align: center; user-select: all; overflow-wrap: anywhere; }
.loading { color: var(--muted); padding: 40px 0; display: flex; gap: 12px; align-items: center; }

/* telefon */
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; background: var(--side); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
  .side { position: fixed; inset: 0 30% 0 0; min-width: 260px; height: 100%; z-index: 45; transform: translateX(-105%); transition: transform .2s; box-shadow: 10px 0 40px rgba(0,0,0,.5); }
  .side.open { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 44; }
  .main { padding: 18px 16px 90px; gap: 18px; }
  h1 { font-size: 26px; }
  .gauge { flex-basis: calc(50% - 8px); padding: 14px; } .gauge .v { font-size: 22px; }
  .card { padding: 14px; }
  .du-row .nm { flex-basis: 140px; }
}
@media (max-width: 420px) { .gauge { flex-basis: calc(50% - 6px); padding: 12px; gap: 7px; } .gauges { gap: 12px; } .gauge .v { font-size: 18px; } .gauge .small { font-size: 12px; } }
