:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --text: #1c2430;
  --muted: #6a7686;
  --line: #e2e7ee;
  --accent: #2f6fde;
  --accent-ink: #ffffff;
  --good: #1f9d55;
  --warn: #c98a06;
  --bad: #d64545;
  --code-bg: #eef2f7;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(20, 30, 50, 0.06), 0 2px 8px rgba(20, 30, 50, 0.04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --surface: #1a2029;
    --text: #e3e8ef;
    --muted: #8c97a6;
    --line: #2a323e;
    --accent: #5b8ff0;
    --code-bg: #232b36;
    --shadow: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 15px; margin: 0 0 10px; }
code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

button, .button, select, input {
  font: inherit; color: inherit; border-radius: 6px; border: 1px solid var(--line); background: var(--surface);
}
button, .button { padding: 6px 12px; cursor: pointer; display: inline-block; white-space: nowrap; }
button:hover, .button:hover { border-color: var(--accent); text-decoration: none; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.danger { color: var(--bad); }
button.danger:hover { border-color: var(--bad); }
#confirm button.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
button.small, .button.small { padding: 2px 8px; font-size: 12.5px; }
button.link { border: 0; background: none; color: var(--accent); padding: 0; }
button.wide { width: 100%; padding: 9px; }
select, input { padding: 6px 8px; }
input[type="checkbox"] { padding: 0; }
label { display: block; margin-bottom: 12px; color: var(--muted); font-size: 13px; }
label input, label select { display: block; width: 100%; margin-top: 4px; color: var(--text); }
label.check { display: inline-flex; gap: 6px; align-items: center; margin: 0; color: var(--text); }
label.check input { width: auto; margin: 0; }
label.button { margin: 0; color: inherit; font-size: inherit; }

.topbar { display: flex; align-items: center; gap: 20px; padding: 0 20px; height: 52px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; color: var(--text); }
.brand span { font-weight: 400; color: var(--muted); margin-left: 6px; }
.site-switch { display: flex; gap: 4px; overflow-x: auto; }
.site-switch a { padding: 4px 10px; border-radius: 6px; color: var(--muted); white-space: nowrap; }
.site-switch a.active { background: var(--code-bg); color: var(--text); }
.user { margin-left: auto; display: flex; gap: 14px; align-items: center; }
.user form { margin: 0; }

.layout { display: grid; grid-template-columns: 210px 1fr; min-height: calc(100vh - 52px); }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 18px 12px; }
.site-name { font-weight: 600; padding: 0 10px 14px; word-break: break-all; }
.tabs a { display: block; padding: 8px 10px; border-radius: 6px; color: var(--text); }
.tabs a:hover { background: var(--code-bg); text-decoration: none; }
.tabs a.active { background: var(--accent); color: var(--accent-ink); }
.content { padding: 22px 26px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.container { max-width: 1000px; margin: 0 auto; padding: 26px 20px; }
.container.narrow { max-width: 480px; }
.container h1 { margin-bottom: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.site-card { display: flex; flex-direction: column; gap: 4px; color: var(--text); }
.site-card:hover { border-color: var(--accent); text-decoration: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2 .card { margin: 0; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.tile .label { color: var(--muted); font-size: 12.5px; }
.tile strong { font-size: 20px; margin: 2px 0; }
.tile .sub { color: var(--muted); font-size: 12px; }
.tile.good strong { color: var(--good); }
.tile.bad strong { color: var(--bad); }
.tile.warn strong { color: var(--warn); }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; }
.seg button.active { background: var(--accent); color: var(--accent-ink); }
.chart svg { width: 100%; height: 180px; display: block; }
.chart polyline { fill: none; stroke-width: 1.8; vector-effect: non-scaling-stroke; }
.chart polyline.req, .sw.req { stroke: var(--accent); background: var(--accent); }
.chart polyline.err, .sw.err { stroke: var(--bad); background: var(--bad); }
.axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 4px; }
.legend { color: var(--muted); font-size: 12px; margin-top: 6px; display: flex; gap: 6px; align-items: center; }
.sw { display: inline-block; width: 12px; height: 3px; margin-left: 8px; }

.table { width: 100%; border-collapse: collapse; background: var(--surface); }
.card .table { background: none; }
.content > section > .table, .dropzone .table { border: 1px solid var(--line); border-radius: var(--radius); }
.table th, .table td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-weight: 600; color: var(--muted); font-size: 12.5px; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; }
.table.kv th { width: 130px; }
.table td.detail { max-width: 380px; overflow-wrap: anywhere; font-size: 12.5px; color: var(--muted); }
.files td:nth-child(2) { overflow-wrap: anywhere; }
.files .sel { width: 28px; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions > * { margin-left: 4px; }
.files a.dir { font-weight: 500; }
.crumbs { margin-bottom: 10px; font-family: ui-monospace, monospace; font-size: 13px; }
.dropzone { border-radius: var(--radius); }
.dropzone.over { outline: 2px dashed var(--accent); outline-offset: 4px; }
.bulk { position: sticky; bottom: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; margin-top: 10px; display: flex; gap: 12px; align-items: center; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: var(--code-bg); color: var(--muted); margin-left: 6px; }
.badge.good { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good); margin: 0; }
.badge.bad { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); margin: 0; }
.badge.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.alert { padding: 10px 12px; border-radius: 6px; margin-bottom: 12px; }
.alert.error { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); }
.alert.warn { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.alert.ok { background: color-mix(in srgb, var(--good) 12%, transparent); color: var(--good); }
#cf-text { white-space: pre-line; }

.progress { position: relative; height: 22px; background: var(--code-bg); border-radius: 6px; overflow: hidden; margin: 10px 0; }
.progress div { height: 100%; background: var(--accent); width: 0; transition: width 0.2s; }
.progress span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; mix-blend-mode: difference; color: #fff; }
.job pre { max-height: 220px; overflow: auto; margin: 0; font-size: 12.5px; white-space: pre-wrap; }
.job.done { border-color: var(--good); }
.job.error { border-color: var(--bad); }
.limits { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.limits button { grid-column: 1 / -1; justify-self: start; }
#php-version-form { display: flex; gap: 8px; margin-bottom: 8px; }
pre.logs { background: #0f1319; color: #cfd6e0; padding: 12px 14px; border-radius: var(--radius); height: calc(100vh - 210px); min-height: 300px; overflow: auto; font-size: 12px; line-height: 1.45; white-space: pre-wrap; word-break: break-all; margin: 0; }
#log-filter { width: 180px; }

dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 0; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25); }
dialog::backdrop { background: rgba(10, 15, 25, 0.45); }
.modal { width: min(460px, calc(100vw - 32px)); }
.modal form { padding: 18px 20px; }
.modal p { overflow-wrap: anywhere; }
.modal .row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.editor { width: calc(100vw - 40px); height: calc(100vh - 40px); max-width: none; max-height: none; }
.editor[open] { display: flex; flex-direction: column; }
.editor-head { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); margin: 0; }
.editor-head .spacer { flex: 1; }
.editor textarea { flex: 1; border: 0; resize: none; padding: 12px 14px; font: 13px/1.5 ui-monospace, "Cascadia Code", Menlo, monospace; background: var(--surface); color: var(--text); outline: none; tab-size: 4; }

.toast { position: fixed; right: 20px; bottom: 20px; max-width: 420px; padding: 10px 14px; border-radius: 6px; background: var(--text); color: var(--surface); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2); z-index: 10; }
.toast.error { background: var(--bad); color: #fff; }

.login-page { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 16px; }
.login-box { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 28px; box-shadow: var(--shadow); }
.login-box h1 span { display: block; font-size: 15px; font-weight: 400; color: var(--muted); }

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 16px; }
  .site-name { padding: 0 0 8px; }
  .tabs { display: flex; overflow-x: auto; gap: 4px; }
  .tabs a { white-space: nowrap; }
  .content { padding: 16px; }
  .grid2, .limits { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; gap: 12px; }
  .site-switch, .brand span { display: none; }
  .files th:nth-child(4), .files td:nth-child(4), .files th:nth-child(5), .files td:nth-child(5) { display: none; }
  .row-actions { white-space: normal; }
}

/* administracja i 2FA */
.container.wide { max-width: 1280px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.inline-form label { margin: 0; min-width: 200px; }
.inline-form label.check { min-width: 0; }
.site-picks { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; width: 100%; }
.site-picks label.check { font-size: 13px; }
.modal .site-picks { flex-direction: column; align-items: flex-start; margin: 10px 0; }
.card.secret { border-color: var(--warn); }
code.big { font-size: 15px; padding: 3px 8px; user-select: all; }
img.qr { display: block; margin: 10px 0; border-radius: 6px; background: #fff; }
tr.dim td { opacity: 0.55; }
.row-actions.wrap { white-space: normal; text-align: left; }
.row-actions.wrap > * { margin: 2px 4px 2px 0; }
.admin-link { font-weight: 600; }
.filters { margin-bottom: 12px; }

/* pakiet, nowa strona */
.advice { border: 1px solid var(--line); border-left: 4px solid var(--muted); border-radius: var(--radius); background: var(--surface); padding: 10px 14px; margin-bottom: 10px; }
.advice p { margin: 4px 0; }
.advice.bad { border-left-color: var(--bad); }
.advice.warn { border-left-color: var(--warn); }
.advice.ok { border-left-color: var(--good); }
.advice .row { display: flex; gap: 8px; margin-top: 6px; }
.meter { height: 6px; background: var(--code-bg); border-radius: 3px; overflow: hidden; margin: 6px 0 2px; }
.meter .fill { height: 100%; width: 0; background: var(--accent); }
.tile.usage.warn .fill { background: var(--warn); }
.tile.usage.bad .fill { background: var(--bad); }
.wide-modal { width: min(560px, calc(100vw - 32px)); }
.kind-pick { display: flex; gap: 18px; margin-bottom: 12px; }
.grid2.tight { gap: 0 14px; }
.grid2.tight label { margin-bottom: 12px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px 0; margin: 0 0 12px; }
legend { color: var(--muted); font-size: 13px; padding: 0 4px; }
.danger-zone { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.num-in { width: 80px; }
/* zakładka Aplikacja */
.mono { font-family: ui-monospace, "Cascadia Code", Menlo, monospace; font-size: 13px; }
textarea.mono { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); margin-bottom: 8px; }
#ap-run { display: flex; gap: 8px; }
#ap-run input { flex: 1; }
.card h3 { font-size: 14px; margin: 14px 0 6px; }
/* słupki dzienne (Bezpieczeństwo): jedna seria, cienkie, zaokrąglone od góry, odstęp między słupkami */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 170px; padding-top: 18px; }
.bars .bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; padding-bottom: 20px; }
.bars .fill { width: min(42px, 70%); background: var(--accent); border-radius: 4px 4px 0 0; min-height: 0; }
.bars .bar:hover .fill { filter: brightness(1.15); }
.bars .v { font-size: 12px; color: var(--text); margin-bottom: 4px; }
.bars .d { position: absolute; bottom: 0; font-size: 12px; color: var(--muted); white-space: nowrap; }
.waf-modes { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.waf-mode { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; cursor: pointer; }
.waf-mode.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.waf-mode input { width: auto; margin-top: 3px; }
.waf-mode span { display: flex; flex-direction: column; gap: 4px; }
.node-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-bottom: 16px; }
.meter { height: 6px; border-radius: 3px; background: var(--code-bg); overflow: hidden; margin: 2px 0 8px; }
.meter > div { height: 100%; background: var(--accent); border-radius: 3px; }
.meter.warn > div { background: var(--warn); }
.meter.bad > div { background: var(--bad); }
.table tr.sub-row td { border-top: 0; padding-top: 0; } .table tr.sub-row label.check { display: inline-flex; margin-right: 10px; }
.banner { padding: 10px 16px; text-align: center; font-size: 14px; }
.banner.bad { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.banner.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.chart polyline.limit, .sw.lim { stroke: var(--warn); background: var(--warn); stroke-dasharray: 6 4; }
.sw.lim { opacity: .8; }
.grid2 + .card { margin-top: 16px; }
