/* Citadel: grafit + błękit. Zwykły CSS, bez narzędzi budujących. */
:root {
  /* Paleta „Grafit i błękit”: ciemny grafit, chłodny błękitny akcent. Wszystkie kolory w jednym miejscu. */
  --bg: #0f1216;
  --bg-side: #0a0d10;
  --bg-inset: #0b0e12;
  --card: #171c22;
  --card-2: #1f262e;
  --line: #2a323c;
  --line-soft: #222a33;
  --text: #dfe6ee;
  --muted: #98a3b0;
  --faint: #707b89;
  --accent: #5aa2e6;
  --accent-d: #3d7fbf;
  --accent-hi: #7ab6ee;
  --accent-text: #8fc0f0;
  --accent-bg: #14263a;
  --accent-line: #254a72;
  --on-accent: #08121e;
  --glow: #172433;
  --hover: #141a20;
  --track: #28303a;
  --btn-bg: #232b34;
  --btn-line: #3a4552;
  --paper: #dfe6ee;
  --ok: #5fc08a;
  --warn: #e0b04a;
  --bad: #ec6f68;
  --ok-bg: #15291f; --ok-line: #2f5a42; --ok-text: #b5e3c9;
  --warn-bg: #2b2413; --warn-line: #5a4a1f; --warn-text: #ecd29a;
  --bad-bg: #2d1819; --bad-line: #5e2c2c; --bad-text: #f4b8b4;
  --radius: 12px;
  --serif: Georgia, "Times New Roman", serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
body.app { display: flex; min-height: 100vh; background: radial-gradient(900px 500px at 85% -10%, var(--glow), transparent 60%), var(--bg); }
a { color: var(--accent); }
code { font: 13px/1.4 ui-monospace, "Cascadia Code", Consolas, monospace; background: var(--bg-inset); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
h1, h2 { margin: 0; font-weight: 600; }
small, .small { font-size: 12px; }
.mut { color: var(--muted); }
.ok { color: var(--ok); } .warn { color: var(--warn); } .bad { color: var(--bad); }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.ic { flex: none; vertical-align: -3px; }

/* --- znak i nawigacja ------------------------------------------------------ */
.wordmark { font: 700 20px/1 var(--serif); letter-spacing: .16em; color: var(--accent-text); margin: 0; }
.side { width: 232px; flex: none; background: var(--bg-side); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; margin: 0 6px 26px; text-decoration: none; }
.brand-logo { width: 38px; height: 38px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; margin-bottom: 2px; }
.nav-item:hover { color: var(--text); background: var(--hover); }
.nav-item.on { background: var(--card-2); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; padding: 12px 8px 0; border-top: 1px solid var(--line); }
.ver { color: var(--faint); font-size: 11px; }
.link { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 0; display: inline-flex; align-items: center; gap: 6px; }
.link:hover { color: var(--text); }

.main { flex: 1; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding: 26px 28px 8px; flex-wrap: wrap; }
.page-title { font-size: 22px; }
.content { padding: 12px 28px 48px; }

/* --- siatka widgetów ------------------------------------------------------- */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.span-4 { grid-column: span 4; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }
.widget { min-width: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; height: 100%; }
.card-title { font-size: 15px; display: flex; align-items: baseline; gap: 8px; margin-bottom: 12px; }
.count { background: var(--warn-bg); color: var(--warn); font-size: 11px; padding: 1px 8px; border-radius: 10px; }

/* --- kondycja -------------------------------------------------------------- */
.health { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.ring { width: 132px; height: 132px; }
.ring-bg { fill: none; stroke: var(--track); stroke-width: 9; }
.ring-fg { fill: none; stroke-width: 9; stroke-linecap: round; }
.ring-fg.ok { stroke: var(--ok); } .ring-fg.warn { stroke: var(--warn); } .ring-fg.bad { stroke: var(--bad); }
.ring-num { fill: var(--text); font: 700 26px var(--serif); text-anchor: middle; }
.ring-lab { fill: var(--muted); font-size: 8px; text-anchor: middle; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; width: 100%; font-size: 13px; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; text-align: right; font-weight: 600; }

/* --- lista „wymaga uwagi” -------------------------------------------------- */
.item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--card-2); margin-bottom: 8px; }
.item:last-child { margin-bottom: 0; }
.bubble { width: 32px; height: 32px; flex: none; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; background: var(--track); }
.bubble.bad { background: var(--bad-bg); color: var(--bad); } .bubble.warn { background: var(--warn-bg); color: var(--warn); }
.bubble.ok { background: var(--ok-bg); color: var(--ok); } .bubble.accent { background: var(--warn-bg); color: var(--accent); }

/* --- karty aplikacji ------------------------------------------------------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.app-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
.app-name { font-size: 19px; }
.versions { font-size: 15px; margin-bottom: 12px; display: flex; gap: 8px; align-items: baseline; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 4px 9px; border-radius: 8px; background: var(--card-2); color: var(--text); }
.chip.ok { color: var(--ok); } .chip.bad { color: var(--bad); background: var(--bad-bg); }
a.chip { text-decoration: none; }
.chip.accent { color: var(--accent); background: var(--accent-bg); border: 1px solid var(--accent-line); }
.tag { font-size: 11px; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.tag.ok { background: var(--ok-bg); color: var(--ok); } .tag.warn { background: var(--warn-bg); color: var(--warn); } .tag.bad { background: var(--bad-bg); color: var(--bad); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.app.add { border-style: dashed; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); min-height: 180px; background: transparent; }
.plus { font-size: 30px; line-height: 1; }

/* --- tabele i zdarzenia ---------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line-soft); }
.table tr.bad td { color: var(--bad); }
.events { list-style: none; margin: 0; padding: 0; }
.ev { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.ev:last-child { border: 0; }
.ev time { color: var(--muted); width: 84px; flex: none; white-space: nowrap; }
.ev-app { width: 70px; flex: none; color: var(--accent); }
.ev.bad .grow { color: var(--bad); } .ev.warn .grow { color: var(--warn); } .ev.ok .grow { color: var(--ok); }
.coming { display: flex; gap: 16px; align-items: flex-start; max-width: 720px; }
.coming p { margin: 0 0 8px; }

/* --- przyciski i formularze ------------------------------------------------ */
.btn { display: inline-block; background: var(--btn-bg); border: 1px solid var(--btn-line); color: var(--text); padding: 8px 14px; border-radius: 8px; font: inherit; cursor: pointer; text-decoration: none; text-align: center; }
.btn:hover:not(:disabled) { border-color: var(--accent-d); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: var(--accent-hi); }
.btn.wide { width: 100%; margin-top: 10px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.field label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 13px; }
.field input { width: 100%; background: var(--bg-inset); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 10px 12px; font: inherit; }
.field input:focus { outline: 2px solid var(--accent-d); outline-offset: 1px; border-color: transparent; }
.code-input { letter-spacing: .25em; text-align: center; font-size: 20px; }
.alert { padding: 10px 12px; border-radius: 8px; margin: 0 0 14px; font-size: 13px; }
.alert.bad { background: var(--bad-bg); border: 1px solid var(--bad-line); color: var(--bad-text); }
.alert.warn { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-text); }

/* --- strony wewnętrzne: formularze, sekcje -------------------------------- */
.bad-text { color: var(--bad); margin: -4px 0 12px; }
.chip.mut, .tag.mut { color: var(--muted); }
.tag.mut { background: var(--card-2); }
.alert.ok { background: var(--ok-bg); border: 1px solid var(--ok-line); color: var(--ok-text); }
a.app.add { text-decoration: none; }
a.app.add:hover { border-color: var(--accent-d); color: var(--text); }
.table a { color: var(--accent); text-decoration: none; } .table a:hover { text-decoration: underline; }
.stack { display: flex; flex-direction: column; gap: 16px; max-width: 920px; }
.stack .card { height: auto; }
.lead { color: var(--muted); margin: -4px 0 14px; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field .help { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.field.check label { display: flex; align-items: center; gap: 8px; color: var(--text); margin: 0; }
.field.check input { width: auto; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row.end { justify-content: flex-end; }
.btn.danger { border-color: var(--bad-line); color: var(--bad-text); }
.btn.danger:hover:not(:disabled) { border-color: var(--bad); }
.btn.inline { margin: 0; width: auto; }
.log { background: var(--bg-inset); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font: 12px/1.45 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow: auto; margin: 8px 0 0; }
.status-line { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; }
.status-line .dot { flex: none; margin-top: 5px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
details > summary.card-title { list-style: none; cursor: pointer; }
details > summary.card-title::-webkit-details-marker { display: none; }
details > summary.card-title::after { content: "+"; margin-left: auto; color: var(--accent); font-size: 20px; line-height: 1; }
details[open] > summary.card-title::after { content: "\2013"; }
details:not([open]) > summary.card-title { margin-bottom: 0; }
@media (max-width: 760px) { .form-grid { grid-template-columns: 1fr; } }

/* --- ekrany logowania ------------------------------------------------------ */
body.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px 16px; background: radial-gradient(800px 500px at 50% -10%, var(--glow), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 28px 26px; }
.auth-logo { display: block; width: 84px; height: 84px; margin: 0 auto 10px; }
.auth-card .wordmark { text-align: center; font-size: 24px; margin-bottom: 14px; }
.auth-lead { color: var(--muted); text-align: center; margin: 0 0 16px; }
.auth-alt { text-align: center; margin-top: 16px; }
.auth-foot { color: var(--faint); font-size: 12px; }
.qr { width: 210px; max-width: 100%; margin: 6px auto 8px; border-radius: 10px; overflow: hidden; background: var(--paper); }
.qr svg { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; }
.secret { display: flex; gap: 8px; align-items: center; justify-content: center; margin: 4px 0 16px; flex-wrap: wrap; }
.secret code { font-size: 13px; letter-spacing: .02em; text-align: center; }
.codes { list-style: none; margin: 0 0 12px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.codes li { text-align: center; } .codes code { display: block; padding: 8px 4px; font-size: 14px; letter-spacing: .08em; }

/* --- telefon --------------------------------------------------------------- */
.tabbar { display: none; }
@media (max-width: 1000px) { .span-4, .span-8 { grid-column: span 12; } }
@media (max-width: 760px) {
  body.app { display: block; padding-bottom: 76px; }
  .side { display: none; }
  .topbar { padding: 18px 16px 6px; } .content { padding: 10px 16px 24px; }
  .page-title { font-size: 20px; }
  .grid { gap: 12px; } .cards { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .health { flex-direction: row; justify-content: flex-start; gap: 18px; }
  .ring { width: 92px; height: 92px; }
  .item { flex-wrap: wrap; } .item .grow { flex-basis: calc(100% - 50px); } .item .btn { margin-left: 44px; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; background: var(--bg-inset); border-top: 1px solid var(--line); justify-content: space-around; padding: 6px 0 calc(8px + env(safe-area-inset-bottom)); z-index: 5; }
  .tab { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); text-decoration: none; font-size: 11px; padding: 4px 8px; list-style: none; cursor: pointer; }
  .tab.on { color: var(--accent); }
  .tab summary { display: flex; flex-direction: column; align-items: center; gap: 2px; list-style: none; cursor: pointer; }
  .tab summary::-webkit-details-marker { display: none; }
  .more { position: relative; }
  .more-menu { position: absolute; right: 0; bottom: 54px; min-width: 200px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 4px; box-shadow: 0 8px 24px #000a; }
  .more-menu a, .more-menu .link { display: flex; align-items: center; gap: 8px; padding: 9px 10px; color: var(--text); text-decoration: none; font-size: 14px; border-radius: 6px; }
  .more-menu a:hover, .more-menu .link:hover { background: var(--card-2); }
}

.log.tall { max-height: 460px; overflow: auto; }
.table tr.sel td { background: var(--card-2); }
.stack.wide { max-width: none; }
