/*
 * Wygląd panelu VirtHub.
 *
 * Zwykły plik statyczny, bez kroku budowania: panel musi wstać na świeżym
 * serwerze bez npm/Vite. Kolory są tokenami — motyw ciemny i jasny różnią się
 * tylko wartościami zmiennych, a domyślnie panel idzie za ustawieniem systemu.
 */

:root {
    color-scheme: light;
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-2: #f7f9fb;
    --surface-3: #eef2f5;
    --border: #e1e6eb;
    --border-strong: #cfd7df;
    --text: #0f1a26;
    --text-2: #3b4a5a;
    --muted: #677789;
    --accent: #0e8f80;
    --accent-strong: #0a7266;
    --accent-soft: #e3f4f1;
    --accent-contrast: #ffffff;
    --ok: #16874d;
    --warn: #a45f10;
    --critical: #c0333a;
    --info: #2f6bd6;
    /* Serie wykresów — zwalidowane pod kątem daltonizmu na obu tłach. */
    --series-1: #2a78d6;
    --series-2: #eb6834;
    --grid: #e9edf1;
    --shadow: 0 1px 2px rgba(15, 26, 38, .05), 0 4px 16px rgba(15, 26, 38, .04);
    --radius: 12px;
    --radius-sm: 8px;
    --sidebar: 248px;
    /* Szerokość treści: płynna, z limitem tylko na bardzo szerokich ekranach. */
    --page-max: 1840px;
    --gap: 16px;
    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --mono: "JetBrains Mono", "Cascadia Code", "SF Mono", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        --bg: #0b1017;
        --surface: #121922;
        --surface-2: #161e29;
        --surface-3: #1c2531;
        --border: #232e3b;
        --border-strong: #2f3c4b;
        --text: #e8edf3;
        --text-2: #c2ccd7;
        --muted: #8595a7;
        --accent: #3fd2bd;
        --accent-strong: #5fe0cd;
        --accent-soft: rgba(63, 210, 189, .12);
        --accent-contrast: #062421;
        --ok: #4cc98a;
        --warn: #e7a85c;
        --critical: #f0787e;
        --info: #78a6ff;
        --series-1: #3987e5;
        --series-2: #d95926;
        --grid: #1f2935;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .18);
    }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 14.5px/1.6 var(--font);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--surface-3); padding: 1px 6px; border-radius: 5px; }
.icon { flex: none; vertical-align: middle; }
[hidden] { display: none !important; }

/* --- szkielet: pasek boczny + treść -------------------------------------- */

.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
    position: sticky; top: 0; height: 100vh;
    display: flex; flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 18px 14px;
    overflow-y: auto;
}
.brand {
    display: flex; align-items: center; gap: 10px;
    padding: 4px 10px 18px;
    font-weight: 700; font-size: 16px; letter-spacing: -.01em; color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-mark {
    width: 30px; height: 30px; border-radius: 9px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--info)));
    color: var(--accent-contrast);
}
.nav-section {
    margin: 18px 10px 6px;
    font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
    color: var(--muted);
}
.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; margin: 1px 0;
    border-radius: var(--radius-sm);
    color: var(--text-2); font-size: 14px; font-weight: 500;
}
.nav-link:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sidebar-footer {
    margin-top: auto; padding-top: 14px;
    border-top: 1px solid var(--border);
    display: flex; align-items: center; gap: 10px;
}
.avatar {
    width: 32px; height: 32px; border-radius: 50%; flex: none;
    display: grid; place-items: center;
    background: var(--surface-3); color: var(--text-2);
    font-weight: 700; font-size: 13px; text-transform: uppercase;
}
img.avatar { object-fit: cover; }
.avatar.avatar-lg { width: 72px; height: 72px; font-size: 26px; }
.account-link { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; color: inherit; text-decoration: none;
    border-radius: var(--radius-sm); }
.account-link:hover strong { color: var(--accent); }
.user-meta { min-width: 0; flex: 1; line-height: 1.3; }
.user-meta strong { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta span { font-size: 12px; color: var(--muted); }
.icon-btn {
    display: inline-grid; place-items: center;
    width: 34px; height: 34px; border-radius: var(--radius-sm);
    border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }

.mobile-bar { display: none; }

main.content { min-width: 0; padding: clamp(20px, 2.2vw, 36px) clamp(16px, 2.4vw, 44px) 56px; }
.page { max-width: var(--page-max); margin: 0 auto; }

/* --- nagłówek strony ------------------------------------------------------ */

.page-header {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    margin-bottom: 24px;
}
.page-header .actions { display: flex; flex-wrap: wrap; gap: 8px; }
h1 { font-size: 24px; line-height: 1.25; margin: 0 0 6px; letter-spacing: -.02em; font-weight: 700; }
h2 { font-size: 16px; margin: 32px 0 12px; letter-spacing: -.01em; }
h3 { font-size: 15px; }
.lede { color: var(--muted); margin: 0 0 24px; max-width: 760px; }
.page-header .lede { margin-bottom: 0; }
.meta-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: 13.5px; }
.meta-line .sep { opacity: .5; }

/* --- karty i siatki ------------------------------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}
.card > h3:first-child, .card-title {
    display: flex; align-items: center; gap: 8px;
    margin: 0 0 14px; font-size: 14.5px; font-weight: 650;
}
.card-title .icon { color: var(--muted); }
.card.flush { padding: 0; overflow: hidden; }

.grid { display: grid; gap: var(--gap); }
/* Siatki z limitem kolumn: na szerokim ekranie pola i karty rosną, zamiast
   rozsypywać się na kilkanaście wąskich kolumn. */
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(max(300px, calc((100% - var(--gap)) / 2)), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(max(220px, calc((100% - 2 * var(--gap)) / 3)), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(max(180px, calc((100% - 3 * var(--gap)) / 4)), 1fr)); }
/* Rząd kafelków liczbowych: tyle w rzędzie, ile się zmieści. */
.stat-strip { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: var(--gap); }
/* Karty, które nie rozciągają się na całą szerokość, gdy jest ich mało (np. jeden węzeł). */
.card-grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.card-grid > .card { margin-bottom: 0; }

/* Układ pulpitu: treść główna i kolumna boczna na szerokich ekranach. */
.dash-layout { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr); align-items: start; }
.dash-main, .dash-aside { min-width: 0; }
.dash-aside > .card { margin-bottom: var(--gap); }
.dash-aside .card-grid { grid-template-columns: minmax(0, 1fr); }
.node-meters { display: grid; gap: 10px; margin-bottom: 10px; }
.node-meter { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 13.5px; }
.node-meter > span:first-child { color: var(--muted); }
.node-meter .meter { grid-column: 1 / -1; margin: 0; }
@media (min-width: 1480px) {
    .dash-layout { grid-template-columns: minmax(0, 1fr) clamp(320px, 24vw, 420px); }
    .dash-aside { position: sticky; top: 20px; }
}
.grid > .card { margin-bottom: 0; }

.stat {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
}
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.stat-value { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12.5px; color: var(--muted); }

/* --- tabele --------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th {
    font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em;
    color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap;
}
tbody tr:hover td { background: color-mix(in srgb, var(--surface-3) 45%, transparent); }
tr:last-child td { border-bottom: none; }
td.num, .num { font-variant-numeric: tabular-nums; }
.card[style*="padding:0"] th:first-child, .card.flush th:first-child,
.card[style*="padding:0"] td:first-child, .card.flush td:first-child { padding-left: 22px; }

/* --- znaczniki stanu ------------------------------------------------------ */

.pill {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 600; line-height: 1.5;
    padding: 2px 10px; border-radius: 999px;
    background: var(--surface-3); color: var(--muted);
    white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 13%, transparent); }
.pill.warning { color: var(--warn); background: color-mix(in srgb, var(--warn) 15%, transparent); }
.pill.critical { color: var(--critical); background: color-mix(in srgb, var(--critical) 13%, transparent); }
.pill.info { color: var(--info); background: color-mix(in srgb, var(--info) 13%, transparent); }
.pill.neutral { color: var(--muted); }
.pill.plain::before { display: none; }

/* --- przyciski ------------------------------------------------------------ */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 8px 14px; min-height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--surface); color: var(--text);
    font: inherit; font-size: 13.5px; font-weight: 550;
    cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: background .12s, border-color .12s, filter .12s;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); font-weight: 650; }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-danger { color: var(--critical); border-color: color-mix(in srgb, var(--critical) 40%, var(--border)); }
.btn-danger:hover { background: color-mix(in srgb, var(--critical) 10%, transparent); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-sm { min-height: 30px; padding: 4px 10px; font-size: 12.5px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* --- formularze ----------------------------------------------------------- */

label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-2); }
.hint { font-size: 12.5px; color: var(--muted); font-weight: 400; margin-top: 5px; line-height: 1.5; }
input:not([type]), input[type=text], input[type=datetime-local], input[type=date], input[type=search], input[type=email], input[type=password], input[type=number], input[type=url], select, textarea {
    width: 100%; padding: 9px 12px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    background: var(--surface-2); color: var(--text);
    font: inherit; font-size: 14px;
    transition: border-color .12s, box-shadow .12s;
}
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
textarea { font-family: var(--mono); font-size: 13px; }
.field { margin-bottom: 18px; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius-sm); }

details.form-block { margin-bottom: 16px; }
details.form-block > summary {
    cursor: pointer; list-style: none;
    display: flex; align-items: center; gap: 8px;
    font-weight: 650; font-size: 14px; color: var(--text);
}
details.form-block > summary::-webkit-details-marker { display: none; }
details.form-block > summary::before {
    content: "+"; display: grid; place-items: center;
    width: 22px; height: 22px; border-radius: 6px;
    background: var(--accent-soft); color: var(--accent); font-weight: 700;
}
details.form-block[open] > summary::before { content: "–"; }
details.form-block[open] > summary { margin-bottom: 16px; }

/* --- komunikaty ----------------------------------------------------------- */

.alert {
    display: block;
    padding: 12px 16px; border-radius: var(--radius); margin-bottom: 20px; font-size: 14px;
    border: 1px solid transparent;
}
.alert-info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 28%, transparent); }
.alert-error { background: color-mix(in srgb, var(--critical) 9%, transparent); border-color: color-mix(in srgb, var(--critical) 32%, transparent); }
.alert-warning { background: color-mix(in srgb, var(--warn) 10%, transparent); border-color: color-mix(in srgb, var(--warn) 32%, transparent); }
.alert ul { margin: 4px 0 0; padding-left: 18px; }
.alert p { margin: 6px 0 0; }

/* --- różne ---------------------------------------------------------------- */

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 10px 24px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.meter { height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; margin-top: 8px; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.meter.hot > i { background: var(--warn); }

.subnav {
    display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
}
.subnav a {
    padding: 8px 14px; color: var(--muted); font-size: 14px; font-weight: 500;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.subnav a:hover { color: var(--text); text-decoration: none; }
.subnav a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .icon { color: var(--border-strong); margin-bottom: 8px; }
.muted { color: var(--muted); }
.secret {
    font-family: var(--mono); font-size: 14px;
    background: var(--surface-3); border: 1px dashed var(--border-strong);
    padding: 10px 14px; border-radius: var(--radius-sm);
    word-break: break-all; user-select: all; margin: 0;
}
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.list-plain li:last-child { border-bottom: none; }

/* --- konsola -------------------------------------------------------------- */

.console-frame {
    position: relative;
    background: #000; border-radius: var(--radius); overflow: hidden;
    border: 1px solid var(--border); box-shadow: var(--shadow);
    display: flex; flex-direction: column;
}
.console-toolbar {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    padding: 8px 10px; background: #0d1219; border-bottom: 1px solid #1d2733; color: #c2ccd7;
    font-size: 13px;
}
.console-toolbar .btn { background: #161e29; border-color: #2a3644; color: #e8edf3; }
.console-toolbar .btn:hover { background: #1f2a37; }
.console-status { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; }
.console-screen { position: relative; height: calc(100vh - 240px); min-height: 420px; }
.console-screen > div { position: absolute; inset: 0; }
.console-terminal { padding: 8px; }
.console-toolbar .btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.console-toolbar .btn.recording { border-color: var(--critical); color: var(--critical); }
.console-toolbar .btn.recording .icon { animation: vh-blink 1s steps(2, start) infinite; }
@keyframes vh-blink { to { visibility: hidden; } }
.console-sep { width: 1px; height: 20px; background: #2a3644; margin: 0 2px; }
.console-quality select { background: #161e29; border: 1px solid #2a3644; color: #e8edf3; border-radius: var(--radius-sm); font-size: 13px; padding: 4px 8px; height: 30px; }
.console-panel { background: #0d1219; border-bottom: 1px solid #1d2733; padding: 8px 10px; color: #c2ccd7; }
.console-panel .hint { color: #8595a7; margin: 6px 0 0; }
.console-keys { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.console-panel .btn { background: #161e29; border-color: #2a3644; color: #e8edf3; min-width: 38px; justify-content: center; }
.console-panel .btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.snippet-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.snippet-list li { display: inline-flex; align-items: stretch; }
.snippet-type { background: #161e29; border: 1px solid #2a3644; color: #e8edf3; border-radius: var(--radius-sm) 0 0 var(--radius-sm); padding: 4px 10px; cursor: pointer; font: inherit; font-size: 13px; }
.snippet-type:hover { border-color: var(--accent); }
.snippet-list .snippet-del { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-left: 0; min-width: 30px; }
.snippet-form { display: grid; grid-template-columns: minmax(160px, 240px) minmax(0, 1fr) auto; gap: 8px; align-items: start; }
.snippet-form input, .snippet-form textarea { background: #0b1017; border: 1px solid #2a3644; color: #e8edf3; border-radius: var(--radius-sm); padding: 6px 8px; font: inherit; font-size: 13px; }
.snippet-form textarea { font-family: var(--mono); resize: vertical; }
@media (max-width: 700px) { .snippet-form { grid-template-columns: 1fr; } }
.console-vk { position: absolute; opacity: 0; width: 1px; height: 1px; left: -100px; }
.console-touch-only { display: none; }
@media (pointer: coarse) { .console-touch-only { display: inline-flex; } }
.view-only .console-screen canvas { cursor: default !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.console-frame:fullscreen .console-screen { height: calc(100vh - 50px); }

/* --- ekran logowania ------------------------------------------------------ */

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 400px; }

/* --- telefon -------------------------------------------------------------- */

@media (max-width: 900px) {
    .shell { grid-template-columns: minmax(0, 1fr); }
    .sidebar {
        position: fixed; inset: 0 auto 0 0; width: min(84vw, 300px); z-index: 30;
        transform: translateX(-100%); transition: transform .2s ease;
        box-shadow: var(--shadow);
    }
    body.nav-open .sidebar { transform: none; }
    body.nav-open::after {
        content: ""; position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .45);
    }
    .mobile-bar {
        display: flex; align-items: center; gap: 10px;
        position: sticky; top: 0; z-index: 10;
        padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
    }
    .mobile-bar .brand { padding: 0; }
    main.content { padding: 20px 16px 64px; }
    th, td { padding: 10px 12px; }
    .console-screen { height: 70vh; }
}

/* --- wykresy zużycia ------------------------------------------------------- */

.segmented {
    display: inline-flex; padding: 3px; gap: 2px;
    background: var(--surface-3); border-radius: var(--radius-sm);
}
.segmented button {
    border: 0; background: transparent; color: var(--muted);
    font: inherit; font-size: 13px; font-weight: 600;
    padding: 5px 12px; border-radius: 6px; cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 32px 0 12px; }
.section-head h2 { margin: 0; }
.chart-card { padding: 16px 18px 10px; }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.chart-title { font-size: 13.5px; font-weight: 650; }
.chart-now { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chart { min-height: 170px; }
.chart-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.chart-grid > .card { margin-bottom: 0; }
@media (max-width: 800px) { .chart-grid { grid-template-columns: minmax(0, 1fr); } }
.chart .u-legend { font-size: 12.5px; color: var(--text-2); text-align: left; margin: 4px 0 0; }
.chart .u-legend .u-series { padding: 0 14px 0 0; }
.chart .u-legend .u-series:first-child { display: none; }
.chart .u-legend th, .chart .u-legend td {
    padding: 2px 0; border: 0; background: none; text-transform: none;
    letter-spacing: 0; font-size: 12.5px; color: var(--muted); font-weight: 500;
}
.chart .u-legend td { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; padding-left: 6px; }
.chart .u-legend .u-marker { width: 14px; height: 3px; border-radius: 2px; border: 0 !important; margin-right: 6px; }
.chart tbody tr:hover td { background: none; }
.chart .u-select { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.chart-empty { display: grid; place-items: center; height: 170px; color: var(--muted); font-size: 13px; }
.stat-value .unit { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 2px; }

/* Formularze w wąskich kartach: kilka krótkich pól w rzędzie. */
.grid-compact { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); }
.grid-compact > .field { margin-bottom: 12px; }

/* --- strona maszyny: zakładki ------------------------------------------- */
.tabs {
    display: flex; gap: 2px; margin: 8px 0 20px; border-bottom: 1px solid var(--border);
    overflow-x: auto; scrollbar-width: none;
}
.tabs button {
    appearance: none; background: none; border: 0; border-bottom: 2px solid transparent;
    margin-bottom: -1px; padding: 10px 14px; font: inherit; font-size: 14px; font-weight: 500;
    color: var(--muted); cursor: pointer; white-space: nowrap;
}
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 650; }

.settings-list { display: grid; gap: 16px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.setting-row h3 { margin: 0 0 4px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.setting-row p { margin: 0; font-size: 13.5px; max-width: 640px; }
.setting-text { flex: 1 1 320px; min-width: 0; }
.check-line { font-weight: 400 !important; display: flex !important; gap: 8px; align-items: center; }
.check-line input { width: auto; }

.btn-danger-solid { background: #c0333a; border-color: #c0333a; color: #fff; font-weight: 650; }
.btn-danger-solid:hover { filter: brightness(1.08); }

/* --- okno reinstalacji ---------------------------------------------------- */
.modal {
    border: 1px solid var(--border); border-radius: 16px; padding: 0;
    width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
    background: var(--surface); color: var(--text); box-shadow: 0 24px 64px rgba(0, 0, 0, .25);
}
.modal::backdrop { background: rgba(8, 14, 22, .55); backdrop-filter: blur(3px); }
.modal[open] { animation: modal-in .18s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal-body { padding: 22px 24px; display: grid; gap: 16px; }
.modal-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.modal-head h2 { margin: 0 0 4px; font-size: 19px; }
.modal-head p { margin: 0; font-size: 13.5px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.modal-more summary { cursor: pointer; font-size: 13.5px; color: var(--text-2); }
.modal-more textarea { margin-top: 8px; }
/* Potwierdzenia i pytania (vh-dialog.js) zamiast confirm()/prompt() */
.vh-dialog { width: min(460px, calc(100vw - 32px)); }
.vh-dialog .modal-head p { font-size: 14px; line-height: 1.5; color: var(--text-2); white-space: pre-line; }
.vh-dialog .vh-dialog-input { width: 100%; }

.os-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); padding: 2px; }
.modal .os-grid { max-height: 46vh; overflow: auto; }
.os-card {
    position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px;
    border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
    cursor: pointer; transition: border-color .12s, background .12s, box-shadow .12s;
}
.os-card:hover { border-color: var(--border-strong); }
.os-card input { position: absolute; opacity: 0; pointer-events: none; }
.os-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.os-card:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.os-name { font-size: 14px; font-weight: 600; line-height: 1.3; }
.os-current { margin-left: auto; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.os-badge {
    flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
    background: var(--os); font-weight: 700; font-size: 13px; letter-spacing: .02em;
}
.confirm-line { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; font-weight: 400; color: var(--text-2);
    padding: 12px 14px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--critical) 7%, transparent);
    border: 1px solid color-mix(in srgb, var(--critical) 25%, transparent); }
.confirm-line input { width: auto; margin-top: 3px; }

/* --- ekran postępu ------------------------------------------------------ */
.progress-panel { display: flex; gap: 32px; align-items: center; padding: 36px; margin-top: 8px; }
.progress-main { flex: 1; min-width: 0; }
.progress-main h2 { margin: 0 0 6px; font-size: 22px; }
.progress-main > p { margin: 0 0 20px; }
.progress-visual { flex: none; }
.progress-orb {
    width: 104px; height: 104px; border-radius: 50%; display: grid; place-items: center; color: var(--accent);
    background: var(--accent-soft); position: relative;
}
/* Pierścień z „ogonem" kręcący się wokół ikony — widać ruch nawet kątem oka. */
.orb-ring {
    position: absolute; inset: -7px; border-radius: 50%;
    background: conic-gradient(from 0deg, transparent 0deg, transparent 150deg, var(--accent) 360deg);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
            mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
    animation: spin 1.1s linear infinite;
}
.orb-icon { display: grid; place-items: center; animation: spin 2.2s linear infinite; }
.is-done .progress-orb { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.is-failed .progress-orb { color: var(--critical); background: color-mix(in srgb, var(--critical) 12%, transparent); }
.is-done .orb-ring, .is-failed .orb-ring { display: none; }
.is-done .orb-icon, .is-failed .orb-icon { animation: pop .35s ease-out; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.progress-main > .progress-foot { margin: 18px 0 0; }
.progress-bar { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; margin-bottom: 22px; }
.progress-bar i {
    display: block; height: 100%; width: 0; border-radius: 4px;
    background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #fff), var(--accent));
    background-size: 200% 100%; animation: shimmer 1.6s linear infinite;
}
.is-done .progress-bar i { background: var(--ok); animation: none; }
.is-failed .progress-bar i { background: var(--critical); animation: none; }
.progress-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.progress-steps li { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14.5px; transition: color .2s; }
.progress-steps li.active { color: var(--text); font-weight: 600; }
.progress-steps li.done { color: var(--text-2); }
.step-dot {
    flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border-strong);
    display: grid; place-items: center; position: relative;
}
.active .step-dot { border-color: var(--accent); border-top-color: transparent; animation: spin .8s linear infinite; }
.done .step-dot { border-color: var(--ok); background: var(--ok); }
.done .step-dot::after {
    content: ""; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0;
    transform: translateY(-1px) rotate(45deg);
}
.spinner {
    flex: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor;
    border-top-color: transparent; animation: spin .8s linear infinite; margin-top: 2px;
}
.job-watch { align-items: center; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (max-width: 700px) {
    .progress-panel { flex-direction: column; text-align: center; padding: 28px 20px; }
    .progress-steps { text-align: left; }
}
/* Przy ograniczonych animacjach kręci się wolniej, ale się kręci — to jedyny
   znak, że operacja żyje. Znika tylko migotanie paska. */
@media (prefers-reduced-motion: reduce) {
    .orb-ring { animation-duration: 2.4s; }
    .orb-icon { animation: none; }
    .progress-bar i { animation: none; }
}

/* --- akcje zbiorcze ------------------------------------------------------- */
.bulk-bar {
    position: sticky; top: 8px; z-index: 5; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 10px 14px; margin-bottom: 12px; border-radius: var(--radius-sm);
    background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow);
}
.bulk-bar[hidden] { display: none; }
.bulk-bar > span { margin-right: auto; font-size: 13.5px; }

/* --- wybór systemu: grupa + wersja -------------------------------------- */
.os-picker .os-card { align-items: flex-start; }
.os-card-body { display: grid; gap: 6px; min-width: 0; flex: 1; }
.os-card.is-selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.os-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.os-version { min-height: 30px; padding: 3px 8px; font-size: 13px; width: 100%; }
.os-version-one { font-size: 13px; color: var(--muted); }
.os-picker.needs-choice .os-grid { outline: 2px solid var(--critical); outline-offset: 4px; border-radius: var(--radius-sm); }
.os-picker.needs-choice::after { content: attr(data-needs-choice); display: block; color: var(--critical); font-size: 13px; margin-top: 8px; }
.danger-zone { border-color: color-mix(in srgb, var(--critical) 35%, var(--border)); }
.row-actions { text-align: right; }
.row-actions .btn { display: block; width: 100%; margin: 3px 0; white-space: nowrap; }
.os-current-note { font-size: 11.5px; color: var(--accent); font-weight: 600; }

/* --- pobieranie na węzłach ------------------------------------------------ */
.dl { min-width: 190px; margin: 2px 0 8px; }
.dl-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.dl-node { font-weight: 600; }
.dl-pct { font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 600; }
.dl-bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; margin: 4px 0 2px; }
.dl-bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .6s ease; }
.dl-bar.is-indeterminate i { width: 35% !important; animation: dl-slide 1.2s ease-in-out infinite; }
.dl-detail { margin-top: 2px; font-variant-numeric: tabular-nums; }
@keyframes dl-slide { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
.os-inline { display: inline-flex; align-items: center; gap: 8px; }
.os-inline .os-badge { width: 24px; height: 24px; border-radius: 7px; }
.os-inline .os-badge svg { width: 14px; height: 14px; }
.os-title { display: flex; align-items: center; gap: 12px; }
.os-title .os-badge { width: 34px; height: 34px; }
.text-critical { color: var(--critical); font-weight: 600; }
.text-warn { color: var(--warn); font-weight: 600; }

/* --- przełącznik języka ---------------------------------------------------- */
.locale-switch { display: inline-flex; gap: 2px; margin: 0 0 10px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); align-self: flex-start; }
.locale-switch button { appearance: none; border: 0; background: none; font: inherit; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; color: var(--muted); padding: 3px 8px; border-radius: 6px; cursor: pointer; }
.locale-switch button[aria-current="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* --- aplikacje (serwery gier, boty) ---------------------------------------- */
.tabs a {
    padding: 10px 14px; margin-bottom: -1px; border-bottom: 2px solid transparent;
    font-size: 14px; font-weight: 500; color: var(--muted); text-decoration: none; white-space: nowrap;
}
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 650; }
.app-badge { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
    background: var(--accent-soft); color: var(--accent); }
.os-inline .app-badge { width: 24px; height: 24px; border-radius: 7px; }
.os-inline .app-badge svg { width: 14px; height: 14px; }
.copyable { cursor: copy; }
.install-error { white-space: pre-wrap; font-size: 12.5px; max-height: 220px; overflow: auto; margin: 8px 0; }
.app-console-frame { background: #0b0f14; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.app-console-frame:fullscreen { border-radius: 0; display: flex; flex-direction: column; }
.app-console-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid #1c2530; }
.app-console { height: calc(100vh - 420px); min-height: 360px; padding: 8px 4px 8px 12px; }
.app-console-frame:fullscreen .app-console { flex: 1; height: auto; }
.abuse-findings { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.abuse-findings li { margin: 4px 0; word-break: break-all; }
.console-input { display: flex; gap: 8px; margin-top: 10px; }
.console-input input { flex: 1; font-family: "JetBrains Mono", Consolas, monospace; }
.app-stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 16px; }
.app-stats .stat { padding: 12px 14px; }
.file-table td.name a { display: inline-flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; }
.file-table td.name a:hover { color: var(--accent); }
.file-table .icon { color: var(--muted); }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 14px; margin-bottom: 12px; }
.breadcrumbs a { color: var(--accent); text-decoration: none; }
.file-editor { width: 100%; min-height: calc(100vh - 330px); font: 13px/1.5 "JetBrains Mono", Consolas, monospace; tab-size: 4; }
.egg-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.egg-card { position: relative; display: block; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; cursor: pointer; background: var(--surface); }
.egg-card:hover { border-color: var(--border-strong); }
.egg-card input[type=radio] { position: absolute; opacity: 0; pointer-events: none; }
.egg-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.egg-card strong { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.egg-card p { margin: 0; font-size: 13px; color: var(--muted); }
.egg-card select { margin-top: 10px; }

/* --- instalator modpacków i pluginów --- */
.segmented a { color: var(--muted); font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 6px; text-decoration: none; }
.segmented a[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.catalog-search { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.catalog-search input[type=search] { flex: 1; min-width: 180px; }
.catalog-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.catalog-card { display: flex; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); text-decoration: none; min-width: 0; }
.catalog-card:hover { border-color: var(--accent); text-decoration: none; }
.catalog-card img, .catalog-icon { width: 48px; height: 48px; border-radius: 10px; flex: none; object-fit: cover; background: var(--surface-3); display: grid; place-items: center; color: var(--muted); }
.catalog-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.catalog-body strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.catalog-meta { font-size: 12px; display: inline-flex; gap: 4px; align-items: center; }
.catalog-summary { font-size: 13px; color: var(--muted); line-height: 1.4; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 16px; }
.content-hero { display: flex; gap: 16px; align-items: center; }
.content-hero img { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; }
.version-list { display: grid; gap: 6px; max-height: 420px; overflow: auto; margin: 12px 0; }
.version-list label { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; }
.version-list label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.version-list .tags { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }

/* Pasek ładowania przy przejściu w katalogu treści */
body.is-loading { cursor: progress; }
body.is-loading::before {
    content: ""; position: fixed; top: 0; left: 0; z-index: 1000; height: 3px; width: 35%;
    background: var(--accent); border-radius: 0 2px 2px 0; animation: vh-loading 1.1s ease-in-out infinite;
}
body.is-loading .catalog-grid, body.is-loading .version-list { opacity: .6; transition: opacity .2s; }
@keyframes vh-loading { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
@media (prefers-reduced-motion: reduce) { body.is-loading::before { animation: none; width: 100%; opacity: .6; } }

/* --- administracja: grupy w pasku bocznym i pulpit ------------------------- */

.nav-group > summary { list-style: none; cursor: pointer; user-select: none; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::after {
    content: ""; margin-left: auto; width: 7px; height: 7px;
    border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor;
    transform: rotate(-45deg); opacity: .55; transition: transform .15s;
}
.nav-group[open] > summary::after { transform: rotate(45deg); }
.nav-sub { padding-left: 38px; font-size: 13.5px; }

.dash-tiles { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin-bottom: 16px; }
.dash-card .card-title { display: flex; align-items: center; gap: 8px; }
.card-more { margin-left: auto; font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.status-list { list-style: none; margin: 4px 0 0; padding: 0; font-size: 14px; }
.status-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; }
.status-list li + li { border-top: 1px solid var(--grid); }
.status-list li > span, .status-list li > a:first-child { display: inline-flex; align-items: center; gap: 9px; color: var(--text-2); }
.status-list li > a:first-child:hover { color: var(--text); }
.status-list b { font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--ok); }
.dot.warning { background: var(--warn); }
.dot.critical { background: var(--critical); }
.dot.info { background: var(--info); }

.dash-section { margin-bottom: 16px; }
.dash-section.grid > .card { margin-bottom: 0; }
.dash-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 22px 12px; }
.dash-head .card-title { margin: 0; }
.metric-cell { min-width: 92px; }
.metric-cell .meter { margin-top: 4px; width: 84px; }
.meter.critical > i { background: var(--critical); }
.segmented a {
    color: var(--muted); font-size: 13px; font-weight: 600;
    padding: 4px 11px; border-radius: 6px; text-decoration: none; font-variant-numeric: tabular-nums;
}
.segmented a[aria-current="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.empty-note { color: var(--muted); font-size: 14px; margin: 6px 0 2px; }
.card.flush > .empty-note { padding: 0 22px 18px; margin: 0; }
.nowrap { white-space: nowrap; }

.task-list { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.task-list li { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 8px 0; }
.task-list li + li { border-top: 1px solid var(--grid); }
.task-list .mono { font-size: 12.5px; color: var(--text-2); margin: 0 4px; }

.user-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.user-chip {
    display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px;
    border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 13.5px;
}
.user-chip:hover { border-color: var(--accent); text-decoration: none; }
.user-chip strong { display: block; font-weight: 600; }
.user-chip .hint { display: block; margin: 0; }

.filter-bar { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.filter-bar select { min-width: 160px; }
.filter-bar .field label { display: block; margin: 0 0 6px; line-height: 1.3; }

/* --- monitorowanie węzła ---------------------------------------------------- */

.mon-tiles { margin-bottom: 16px; }
.spark { display: block; width: 100%; height: 28px; margin-top: 8px; overflow: visible; }
.stack-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--surface-3); margin: 6px 0 8px; }
.stack-bar > i { display: block; height: 100%; transition: width .3s; }
.legend-row { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }
.legend-row span { display: inline-flex; align-items: center; gap: 6px; }
.core-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px 14px; }
.core { display: grid; grid-template-columns: 22px 1fr 38px; align-items: center; gap: 6px; font-size: 12px; }
.core span { color: var(--muted); font-variant-numeric: tabular-nums; }
.core b { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.core .meter { margin: 0; }
.psi-row { display: grid; grid-template-columns: 90px 56px 1fr; align-items: center; gap: 10px; font-size: 14px; padding: 4px 0; }
.psi-row .meter { margin: 0; }
.kv dd .meter { margin-top: 4px; max-width: 220px; }
table.sortable th[aria-sort="ascending"]::after { content: " ▲"; font-size: 9px; }
table.sortable th[aria-sort="descending"]::after { content: " ▼"; font-size: 9px; }

/* --- sieć: kafelki-filtry adresów --------------------------------------------- */
.stat-link { color: inherit; text-decoration: none; display: block; }
.stat-link:hover { border-color: var(--accent); text-decoration: none; }
.stat-link[aria-current="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.stat-link .stat-label { display: flex; align-items: center; gap: 7px; }

/* --- bezpieczeństwo węzłów ------------------------------------------------------- */
.plain-list { margin: 0; padding-left: 18px; font-size: 14px; color: var(--text-2); }
.plain-list li { margin: 4px 0; }
.finding-list { list-style: none; margin: 12px 0 0; padding: 0; font-size: 13.5px; }
.finding-list li { padding: 6px 0; border-top: 1px solid var(--grid); }
.nested-box { margin: 4px 0 16px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }

/* --- szablony e-mail --------------------------------------------------------------- */
.var-list { display: flex; flex-wrap: wrap; gap: 6px; }
.var-list code { font-size: 12px; padding: 3px 7px; border-radius: 6px; background: var(--surface-3); cursor: pointer; }
.mail-preview { width: 100%; height: 460px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #f4f6f8; }

/* --- zgłoszenia --------------------------------------------------------------- */

.ticket-thread { display: grid; gap: 12px; }
.ticket-msg {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px 18px; border-left: 3px solid var(--border);
}
.ticket-msg.staff { border-left-color: var(--accent); }
.ticket-msg.internal { border-left-color: var(--warn); background: color-mix(in srgb, var(--warn) 6%, var(--surface)); }
.ticket-msg header { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.ticket-msg header .hint { margin: 2px 0 0; }
.ticket-body { white-space: normal; overflow-wrap: anywhere; line-height: 1.55; font-size: 14.5px; }
.ticket-files { list-style: none; padding: 10px 0 0; margin: 10px 0 0; border-top: 1px dashed var(--border); display: flex; flex-wrap: wrap; gap: 6px 16px; }
.ticket-files a { display: inline-flex; align-items: center; gap: 4px; }
textarea.prose-input { font-family: inherit; font-size: 14.5px; line-height: 1.5; }
.ticket-side .field { margin-bottom: 12px; }
.ticket-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 960px) { .ticket-layout { grid-template-columns: 1fr; } }
tr.ticket-awaiting td:first-child { box-shadow: inset 3px 0 0 var(--warn); }

/* --- sklep i rozliczenia ---------------------------------------------------- */

.section-title { font-size: 17px; margin: 0 0 12px; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.product-card {
    display: flex; flex-direction: column; justify-content: space-between; gap: 14px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px;
}
.product-card h3 { margin: 8px 0 10px; font-size: 17px; }
.spec-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
.spec-list strong { color: var(--text); }
.product-desc { font-size: 13.5px; margin: 10px 0 0; }
.price-line { display: flex; align-items: baseline; gap: 6px; }
.price { font-size: 22px; font-weight: 700; }
.price-sm { display: block; font-weight: 600; }
.order-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.order-summary { position: sticky; top: 16px; }
@media (max-width: 960px) { .order-layout { grid-template-columns: 1fr; } .order-summary { position: static; } }
.cycle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.cycle-option { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; }
.cycle-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.cycle-option input { margin-top: 3px; }
.cycle-option .hint { display: block; margin: 2px 0 0; }
.check-columns { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 2px 12px; margin-top: 6px; }
.invoice-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 960px) { .invoice-layout { grid-template-columns: 1fr; } }
.invoice-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.invoice-dates { margin: 0; }
.invoice-parties { margin-bottom: 18px; }
.invoice-doc tfoot td { border-bottom: 0; }
@media print {
    .sidebar, .mobile-bar, .no-print, .alert { display: none !important; }
    .shell { display: block; }
    .invoice-layout { display: block; }
    .invoice-doc { border: 0; box-shadow: none; }
}
.cycle-admin { display: grid; gap: 8px; margin-bottom: 14px; }
.cycle-admin-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 140px; gap: 10px; align-items: center; }
.cycle-admin-row.is-blocked .check-line { opacity: .55; }
.cycle-admin-row input:disabled { opacity: .5; }
@media (max-width: 560px) { .cycle-admin-row { grid-template-columns: 1fr; } }
.cycle-pop { position: relative; }
.cycle-pop > summary { list-style: none; }
.cycle-pop > summary::-webkit-details-marker { display: none; }
.cycle-pop[open] { flex-basis: 100%; }
.cycle-pop-body {
    margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: center;
    padding: 10px 12px; border: 1px dashed var(--border); border-radius: var(--radius-sm);
}
.cycle-pop-body .hint { flex-basis: 100%; margin: 0 0 4px; }
dialog.edit-modal { text-align: left; white-space: normal; padding: 22px 24px; width: min(640px, calc(100vw - 32px)); }
dialog.edit-modal .grid-3 { gap: 0 14px; }
@media (max-width: 640px) { dialog.edit-modal .grid-3 { grid-template-columns: 1fr 1fr; } }
.period-list { display: grid; gap: 8px; margin-bottom: 4px; }
.period-row { display: grid; grid-template-columns: 80px 130px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
.period-row .cycle-blocked { grid-column: 1 / -1; margin: -4px 0 0; color: var(--warn); }
.period-row.is-blocked > input, .period-row.is-blocked > select { border-color: var(--warn); }
@media (max-width: 560px) { .period-row { grid-template-columns: 70px 1fr; } }

/* --- potwierdzanie aktywności usługi ---------------------------------------- */
.keepalive-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.keepalive-bar { height: 10px; border-radius: 6px; background: var(--surface-3); overflow: hidden; margin: 14px 0 8px; }
.keepalive-bar > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 1s linear; }
.keepalive.is-open .keepalive-bar > i { background: var(--warn); }
.keepalive.is-suspended { border-color: color-mix(in srgb, var(--critical) 40%, var(--border)); }
.keepalive-meta { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; }
.keepalive.is-suspended .keepalive-bar > i { background: var(--critical); }

/* --- wykresy słupkowe (pulpit, billing) ---------------------------------------- */
.bar-chart { position: relative; margin: 0; }
.bar-chart svg { display: block; width: 100%; height: 150px; overflow: visible; }
.bar-chart-bar { fill: var(--accent); pointer-events: none; }
.bar-chart-hit { fill: transparent; cursor: default; }
.bar-chart-hit.is-hover { fill: color-mix(in srgb, var(--accent) 10%, transparent); }
.bar-chart-grid { stroke: var(--border); stroke-dasharray: 3 4; stroke-width: 1; vector-effect: non-scaling-stroke; }
.bar-chart-axis { stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.bar-chart-labels { position: relative; height: 18px; font-size: 11.5px; color: var(--muted); }
.bar-chart-labels span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.bar-chart-labels span:first-child { transform: none; left: 0 !important; }
.bar-chart-labels span:last-child:not(:first-child) { transform: none; left: auto !important; right: 0; }
.bar-chart-max { position: absolute; top: -2px; right: 0; font-size: 11.5px; color: var(--muted); background: var(--surface); padding-left: 4px; }
.bar-chart-tip {
    position: absolute; top: -8px; transform: translate(-50%, -100%); pointer-events: none; z-index: 5;
    background: var(--text); color: var(--surface); border-radius: 8px; padding: 6px 10px; font-size: 12.5px;
    display: flex; flex-direction: column; align-items: center; white-space: nowrap; box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
.bar-chart-tip span { opacity: .8; font-size: 11.5px; }
.bar-chart-table { margin-top: 6px; font-size: 12.5px; }
.bar-chart-table summary { cursor: pointer; color: var(--muted); }
.bar-chart-table table { margin-top: 6px; }
.hbar-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.hbar-list li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) auto; gap: 10px; align-items: center; font-size: 13.5px; }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 8px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.hbar-track i { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.hbar-value { min-width: 2ch; text-align: right; color: var(--muted); }
@media (max-width: 1100px) { .grid-3.dash-section { grid-template-columns: 1fr; } }

.impersonation-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    margin: 0 0 18px; padding: 10px 14px; border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--warn) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent);
    font-size: 14px; font-weight: 600;
}
.impersonation-bar > span { display: inline-flex; align-items: center; gap: 8px; }

/* Bazy danych aplikacji */
.db-item { padding: 16px 20px; border-top: 1px solid var(--border); }
.db-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.db-head .hint { display: block; margin-top: 2px; }
.db-kv { font-size: 13px; }
.input-prefix { display: flex; align-items: stretch; }
.input-prefix > span { display: flex; align-items: center; padding: 0 10px; border: 1px solid var(--border); border-right: 0; border-radius: 8px 0 0 8px; background: var(--surface-2); color: var(--muted); font-size: 13px; }
.input-prefix > input { border-radius: 0 8px 8px 0; flex: 1; min-width: 0; }
.sql-editor { width: 100%; min-height: 140px; font-family: var(--mono); font-size: 13px; resize: vertical; }
.db-grid td, .db-grid th { font-family: var(--mono); font-size: 12px; white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.db-grid td.null { color: var(--muted); font-style: italic; }
.db-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: start; }
.db-tables { list-style: none; margin: 0; padding: 6px 0; max-height: 70vh; overflow: auto; }
.db-tables a { display: flex; justify-content: space-between; gap: 8px; padding: 6px 14px; color: inherit; text-decoration: none; font-size: 13px; }
.db-tables a:hover, .db-tables a[aria-current] { background: var(--surface-3); }
.db-tables .hint { font-size: 11px; }
@media (max-width: 800px) { .db-layout { grid-template-columns: 1fr; } .db-tables { max-height: 240px; } }

/* --- dokumentacja API ------------------------------------------------------- */

.docs-wrap { max-width: 1280px; margin: 0 auto; padding: 24px 16px; }
.api-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; align-items: start; }
.api-layout > * { min-width: 0; }
.api-nav { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; font-size: 13px; }
.api-nav h4 { margin: 14px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }
.api-nav a { display: flex; gap: 6px; align-items: center; padding: 3px 6px; border-radius: 6px; color: var(--text); text-decoration: none; }
.api-nav a:hover { background: var(--surface-2); }
.api-nav input { width: 100%; margin-bottom: 6px; }
.method { display: inline-block; min-width: 52px; text-align: center; font: 600 11px var(--mono); padding: 2px 6px; border-radius: 4px; color: #fff; }
.method.get { background: #0e8f80; } .method.post { background: #2563eb; } .method.put { background: #b7791f; }
.method.patch { background: #9333ea; } .method.delete { background: #c53030; }
.api-endpoint { scroll-margin-top: 16px; }
.api-endpoint .path { font: 600 14px var(--mono); word-break: break-all; }
.api-params { width: 100%; font-size: 13px; }
.api-params td, .api-params th { padding: 6px 8px; vertical-align: top; }
.api-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 10px 0 6px; }
.api-tabs button { font-size: 12px; padding: 4px 10px; border: 1px solid var(--border); background: var(--surface); border-radius: 6px; cursor: pointer; color: var(--text); }
.api-tabs button[aria-selected="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.api-code { position: relative; }
.api-code pre { margin: 0; background: #0f1a26; color: #e6edf3; padding: 12px 14px; border-radius: 8px; font: 12.5px/1.5 var(--mono); overflow: auto; max-height: 420px; white-space: pre; }
.api-code .copy { position: absolute; top: 6px; right: 6px; font-size: 11px; }
.api-console { scroll-margin-top: 16px; }
.api-console textarea, .api-console input, .api-console select { font-family: var(--mono); font-size: 12.5px; }
.api-response-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; margin: 8px 0; }
.api-history-item { cursor: pointer; border-radius: 4px; }
.api-history-item:hover { background: var(--surface-2); }
@media (max-width: 900px) { .api-layout { grid-template-columns: 1fr; } .api-nav { position: static; max-height: none; } }
.api-main { display: flex; flex-direction: column; gap: 16px; }
.api-main > .card { margin: 0; }
.api-group-head { margin-top: 12px; }
.api-group-head h2 { margin: 0 0 4px; }
.api-nav a[aria-current="true"] { background: var(--accent-soft, var(--surface-2)); color: var(--accent); }
.api-main.api-single .api-console { order: 2; }

/* --- duże ekrany: odrobinę większe pismo i oddech w tabelach -------------- */
@media (min-width: 1700px) {
    body { font-size: 15px; }
    h1 { font-size: 26px; }
    .stat-value { font-size: 24px; }
    table { font-size: 14.5px; }
    .card { padding: 22px 24px; }
}

/* --- klucze dostępu ----------------------------------------------------------- */
.or-sep { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; margin: 14px 0; }
.or-sep::before, .or-sep::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

/* --- migracja: etapy ------------------------------------------------------------ */
.migration-state { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface-2); }
.migration-steps { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 4px; font-size: 13.5px; }
.migration-steps li { display: flex; justify-content: space-between; gap: 12px; padding-left: 22px; position: relative; }
.migration-steps li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--border-strong); }
.migration-steps .step-done::before { background: var(--ok); }
.migration-steps .step-active::before { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 25%, transparent); }
.migration-steps .step-failed::before { background: var(--critical); }

/* --- porty NAT: siatka port zewnętrzny → port w maszynie --- */
.ports-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.ports-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin: 16px 0; }
.port-tile { border: 1px solid var(--border); border-radius: 10px; padding: 14px 12px 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; background: var(--surface); }
.port-tile.is-active { border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); }
.port-tile.is-closed .port-endpoint { opacity: .55; }
.port-tile.is-changed { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent, #3b82f6) 35%, transparent); }
.port-map { display: flex; align-items: center; gap: 10px; }
.port-ext { font-weight: 700; font-size: 15px; }
.port-tile .port-box, .port-tile input.port-box { width: 76px; min-width: 0; text-align: center; padding: 6px 4px; border-radius: 8px; border: 1.5px dashed var(--border-strong, var(--border)); background: transparent; color: var(--text); font-size: 14px; }
.port-tile.is-active .port-box, .port-tile.is-active input.port-box { border-color: var(--ok); }
.port-tile.is-fixed .port-box { border-style: solid; color: var(--muted); }
.port-box::placeholder { color: var(--muted); opacity: .7; }
.port-tile input.port-box:focus { outline: none; border-style: solid; box-shadow: none; }
.port-endpoint { font-size: 12px; color: var(--muted); }
.icon-btn.is-copied { color: var(--ok); }
