:root {
  --bg: #060c1c;
  --bg2: #0a1430;
  --panel: #0d1a38;
  --panel2: #112247;
  --panel3: #16295a;
  --line: #1c3263;
  --line2: #26407a;
  --text: #e7eeff;
  --muted: #8ea3cc;
  --dim: #5f749f;
  --accent: #3b82f6;
  --accent2: #60a5fa;
  --accent3: #93c5fd;
  --glow: rgba(var(--accent-rgb), .38);
  --accent-rgb: 59, 130, 246;
  --accent-mid: #2563eb;
  --accent-deep: #1d4ed8;
  --accent-btn: #4b8ff8;
  --accent-btn2: #2f6fe6;
  --on-accent: #fff;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 14px;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
html { transition: background-color .25s; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent2); text-decoration: none; }
.hidden { display: none !important; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
::selection { background: rgba(var(--accent-rgb), .35); }

/* ---------- marka ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -.02em; color: var(--text); }
.brand b { color: var(--accent2); font-weight: 800; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; position: relative; flex: none;
  background: linear-gradient(140deg, var(--accent2), var(--accent-mid) 60%, var(--accent-deep));
  box-shadow: 0 6px 20px var(--glow), inset 0 1px 0 rgba(255,255,255,.35);
}
.brand-mark::before { content: ''; position: absolute; left: 7px; top: 8px; width: 16px; height: 11px; border: 2.2px solid #fff; border-radius: 3px; }
.brand-mark::after { content: ''; position: absolute; left: 11px; bottom: 6px; width: 8px; height: 2.2px; background: #fff; border-radius: 2px; }
.brand.big { font-size: 28px; justify-content: center; }
.brand.big .brand-mark { width: 42px; height: 42px; border-radius: 12px; }
.brand.big .brand-mark::before { left: 10px; top: 11px; width: 22px; height: 15px; }
.brand.big .brand-mark::after { left: 15px; bottom: 8px; width: 12px; }

/* ---------- przyciski / pola ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line2);
  background: var(--panel2); color: var(--text); cursor: pointer; font-weight: 600; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: var(--panel3); border-color: #31508f; }
.btn:active { transform: translateY(1px); }
.btn.primary { color: var(--on-accent); background: linear-gradient(180deg, var(--accent-btn), var(--accent-btn2)); border-color: var(--accent-btn); box-shadow: 0 6px 18px -6px var(--glow), inset 0 1px 0 rgba(255,255,255,.2); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: rgba(248,113,113,.1); border-color: rgba(248,113,113,.4); color: #fecaca; }
.btn.danger:hover { background: rgba(248,113,113,.2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--panel2); color: var(--text); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .45; pointer-events: none; }
.icon-btn {
  width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 9px;
  border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; flex: none;
}
.icon-btn:hover { background: var(--panel2); color: var(--text); border-color: var(--line); }
.icon-btn.active { background: rgba(var(--accent-rgb),.18); color: var(--accent3); border-color: rgba(var(--accent-rgb),.45); }
.field { display: grid; gap: 6px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.input, .field input, select.input {
  height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line2);
  background: var(--bg2); outline: none; transition: border-color .15s, box-shadow .15s; width: 100%;
}
.input:focus, .field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb),.25); }
select.input { appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238ea3cc' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
.input.sm, select.input.sm { height: 32px; font-size: 13px; border-radius: 8px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; background: var(--panel2); color: var(--muted); border: 1px solid var(--line); }
.pill.ok { color: #a7f3d0; background: rgba(52,211,153,.1); border-color: rgba(52,211,153,.35); }
.pill.off { color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(52,211,153,.18), 0 0 10px rgba(52,211,153,.6); }
kbd, code { font-family: var(--mono); font-size: 12.5px; }
code.block { display: block; white-space: pre-wrap; word-break: break-all; padding: 12px 14px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); color: var(--accent3); }

/* ---------- logowanie ---------- */
.login { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; overflow: hidden;
  background:
    radial-gradient(1000px 600px at 20% 10%, rgba(var(--accent-rgb),.28), transparent 60%),
    radial-gradient(800px 600px at 90% 90%, rgba(14,165,233,.16), transparent 60%),
    var(--bg); }
.login::before { content: ''; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(var(--accent-rgb),.06) 1px, transparent 1px), linear-gradient(90deg, rgba(var(--accent-rgb),.06) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%); }
.login-card { position: relative; width: min(400px, 100%); display: grid; gap: 18px; padding: 36px 32px 28px;
  background: linear-gradient(180deg, rgba(17,34,71,.92), rgba(10,20,48,.92)); border: 1px solid var(--line2);
  border-radius: 20px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.7), 0 0 0 1px rgba(var(--accent-rgb),.06), 0 0 60px -20px var(--glow); backdrop-filter: blur(10px); }
.login-sub { margin: -8px 0 6px; text-align: center; color: var(--muted); }
.login-err { margin: 0; min-height: 20px; text-align: center; color: var(--danger); font-weight: 600; font-size: 13px; }

/* ---------- układ ---------- */
.app { display: grid; grid-template-columns: 272px minmax(0, 1fr); height: 100vh; height: 100dvh; }
.sidebar { display: flex; flex-direction: column; background: linear-gradient(180deg, #0a1533, #081129); border-right: 1px solid var(--line); min-height: 0; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 14px; }
.side-label { display: flex; align-items: center; justify-content: space-between; padding: 10px 20px 8px; font-size: 11.5px; font-weight: 700; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; }
.computer-list { flex: 1; overflow-y: auto; padding: 4px 10px; display: grid; align-content: start; gap: 4px; }
.c-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px; color: var(--text); border: 1px solid transparent; transition: background .12s; }
.c-item:hover { background: var(--panel); }
.c-item.active { background: linear-gradient(90deg, rgba(var(--accent-rgb),.2), rgba(var(--accent-rgb),.06)); border-color: rgba(var(--accent-rgb),.35); }
.c-item .c-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--panel2); color: var(--accent2); border: 1px solid var(--line); position: relative; }
.c-item .c-ico .dot { position: absolute; right: -2px; bottom: -2px; border: 2px solid #091330; width: 11px; height: 11px; }
.c-item .c-meta { min-width: 0; }
.c-item .c-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-item .c-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-empty { padding: 16px 12px; color: var(--dim); font-size: 13px; }
.sidebar-foot { padding: 14px; display: grid; gap: 6px; border-top: 1px solid var(--line); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background:
  radial-gradient(900px 500px at 100% -10%, rgba(var(--accent-rgb),.12), transparent 60%), var(--bg); }
.topbar { display: flex; align-items: center; gap: 14px; height: 62px; padding: 0 22px; border-bottom: 1px solid var(--line); flex: none; }
.crumb { display: flex; align-items: center; gap: 10px; min-width: 0; font-weight: 700; font-size: 16px; white-space: nowrap; }
.crumb > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; }
.crumb .muted { color: var(--muted); font-weight: 500; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-tabs { margin-left: auto; display: flex; gap: 4px; padding: 4px; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; }
.top-tabs:empty { display: none; }
.tab { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 14px; border-radius: 9px; color: var(--muted); font-weight: 600; cursor: pointer; border: none; background: none; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--panel3); color: var(--text); box-shadow: inset 0 0 0 1px var(--line2), 0 4px 14px -6px var(--glow); }
.tab.active svg { color: var(--accent2); }
.view { flex: 1; min-height: 0; overflow: auto; }
.only-mobile { display: none; }

/* ---------- pulpit ---------- */
.dash { padding: 28px; max-width: 1400px; }
.dash h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: -.02em; }
.dash .lead { color: var(--muted); margin: 0 0 24px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat { padding: 16px 18px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.stat .k { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.stat .v { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; }
.stat .v small { font-size: 14px; color: var(--muted); font-weight: 600; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.card { border-radius: 16px; background: var(--panel); border: 1px solid var(--line); overflow: hidden; display: flex; flex-direction: column; transition: transform .15s, border-color .15s, box-shadow .15s; color: var(--text); }
.card:hover { transform: translateY(-2px); border-color: #31508f; box-shadow: 0 16px 40px -18px rgba(0,0,0,.8), 0 0 40px -22px var(--glow); }
.thumb { aspect-ratio: 16/9; background: linear-gradient(135deg, #0b1a3d, #07112a); display: grid; place-items: center; position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .ph { color: var(--dim); display: grid; justify-items: center; gap: 8px; font-size: 13px; }
.thumb .ph svg { width: 34px; height: 34px; stroke-width: 1.5; }
.thumb .badge { position: absolute; left: 10px; top: 10px; z-index: 1; background: rgba(6,12,28,.82); backdrop-filter: blur(6px); }
.card-body { padding: 14px 16px 16px; display: grid; gap: 4px; }
.card-body .t { font-weight: 700; font-size: 15.5px; display: flex; align-items: center; gap: 8px; }
.card-body .s { color: var(--muted); font-size: 12.5px; }
.card.add { border-style: dashed; border-color: var(--line2); background: transparent; display: grid; place-items: center; min-height: 230px; cursor: pointer; color: var(--muted); }
.card.add:hover { color: var(--accent3); background: rgba(var(--accent-rgb),.05); }
.card.add .plus { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; margin: 0 auto 10px; background: rgba(var(--accent-rgb),.12); color: var(--accent2); }
.empty-hero { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty-hero h2 { color: var(--text); margin: 18px 0 6px; }

/* ---------- ekran ---------- */
.screen { display: flex; flex-direction: column; height: 100%; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 18px; border-bottom: 1px solid var(--line); background: rgba(10,20,48,.6); }
.toolbar .sep { width: 1px; height: 24px; background: var(--line); }
.toolbar .grow { flex: 1; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); }
.seg button { height: 28px; padding: 0 12px; border: none; background: none; color: var(--muted); border-radius: 7px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.seg button.active { background: var(--accent); color: #fff; box-shadow: 0 4px 12px -4px var(--glow); }
.ctl { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stage { flex: 1; min-height: 0; position: relative; display: grid; place-items: center; padding: 16px; overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #0c1a3c, #050a17 70%); }
.stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; box-shadow: 0 20px 60px -20px #000, 0 0 0 1px var(--line); image-rendering: auto; background: #000; }
.stage.fit-actual { place-items: start; overflow: auto; }
.stage.fit-actual img { max-width: none; max-height: none; }
.stage .overlay { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); text-align: center; pointer-events: none; }
.stage .overlay .box { padding: 22px 28px; border-radius: 16px; background: rgba(10,20,48,.85); border: 1px solid var(--line2); display: grid; gap: 10px; justify-items: center; pointer-events: auto; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid rgba(var(--accent-rgb),.2); border-top-color: var(--accent2); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.statusbar { display: flex; gap: 18px; align-items: center; padding: 8px 18px; border-top: 1px solid var(--line); font: 12px var(--mono); color: var(--muted); background: rgba(10,20,48,.6); flex-wrap: wrap; }
.statusbar b { color: var(--accent3); font-weight: 500; }
.live-badge { display: inline-flex; align-items: center; gap: 6px; color: #fecaca; font-weight: 700; font-family: var(--sans); letter-spacing: .05em; }
.live-badge::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #ef4444; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.screen:fullscreen .stage { padding: 0; background: #000; }
.screen:fullscreen .stage img { border-radius: 0; box-shadow: none; }

/* ---------- pliki ---------- */
.files { display: grid; grid-template-columns: minmax(300px, var(--explorer-w, 420px)) 6px 1fr; height: 100%; min-height: 0; }
.explorer { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: rgba(10,20,48,.45); }
.resizer { cursor: col-resize; background: transparent; transition: background .15s; }
.resizer:hover, .resizer.drag { background: rgba(var(--accent-rgb),.4); }
.pathbar { display: flex; align-items: center; gap: 6px; padding: 10px 10px 8px; }
.crumbs { flex: 1; min-width: 0; display: flex; align-items: center; gap: 2px; overflow-x: auto; scrollbar-width: none; height: 34px; padding: 0 6px; border-radius: 9px; background: var(--bg2); border: 1px solid var(--line); cursor: text; }
.crumbs::-webkit-scrollbar { display: none; }
.crumbs button { border: none; background: none; color: var(--muted); padding: 3px 6px; border-radius: 6px; cursor: pointer; white-space: nowrap; font-size: 13px; font-weight: 600; }
.crumbs button:hover { background: var(--panel3); color: var(--text); }
.crumbs button:last-child { color: var(--text); }
.crumbs .chev { color: var(--dim); font-size: 12px; }
.crumbs input { flex: 1; border: none; background: none; outline: none; font: 13px var(--mono); }
.ex-tools { display: flex; align-items: center; gap: 2px; padding: 0 10px 8px; }
.ex-tools .input { margin-left: auto; width: 150px; }
.ex-head, .ex-row { display: grid; grid-template-columns: 1fr 78px 96px; gap: 8px; align-items: center; padding: 0 14px; }
.ex-head { height: 30px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--dim); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ex-head span:nth-child(n+2), .ex-row .sz, .ex-row .dt { text-align: right; }
.ex-list { flex: 1; overflow-y: auto; padding: 4px 6px 20px; position: relative; }
.ex-row { height: 34px; border-radius: 8px; cursor: default; user-select: none; padding: 0 8px; position: relative; }
.ex-row:hover { background: var(--panel2); }
.row-dl { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; display: none;
  place-items: center; border: 1px solid var(--line2); border-radius: 7px; background: var(--panel3); color: var(--accent2); cursor: pointer; padding: 0; }
.row-dl svg { width: 15px; height: 15px; }
.ex-row:hover .row-dl { display: grid; }
.row-dl:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
@media (hover: none) { .ex-row .row-dl { display: grid; } .ex-row .dt { display: none; } }
.ex-row.sel { background: rgba(var(--accent-rgb),.2); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb),.4); }
.ex-row.open-file .nm span { color: var(--accent3); }
.ex-row .nm { display: flex; align-items: center; gap: 9px; min-width: 0; }
.ex-row .nm span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex-row .sz, .ex-row .dt { font: 11.5px var(--mono); color: var(--muted); white-space: nowrap; }
.ex-row.hidden-f { opacity: .62; }
.ficon { width: 18px; height: 18px; flex: none; }
.ex-empty { padding: 30px; text-align: center; color: var(--dim); }
.ex-list.dragover { background: rgba(var(--accent-rgb),.08); outline: 2px dashed rgba(var(--accent-rgb),.55); outline-offset: -8px; border-radius: 12px; }
.ex-foot { padding: 7px 14px; font-size: 12px; color: var(--dim); border-top: 1px solid var(--line); }

.editor-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #0a1430; }
.ed-tabs { display: flex; align-items: stretch; height: 38px; background: #081129; border-bottom: 1px solid var(--line); overflow-x: auto; flex: none; scrollbar-width: thin; }
.ed-tab { display: flex; align-items: center; gap: 8px; padding: 0 10px 0 14px; border-right: 1px solid var(--line); color: var(--muted); cursor: pointer; white-space: nowrap; font-size: 13px; position: relative; max-width: 240px; }
.ed-tab span.n { overflow: hidden; text-overflow: ellipsis; }
.ed-tab:hover { color: var(--text); background: rgba(17,34,71,.6); }
.ed-tab.active { background: #0a1430; color: var(--text); }
.ed-tab.active::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--accent); }
.ed-tab .x { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 5px; border: none; background: none; color: var(--muted); cursor: pointer; padding: 0; }
.ed-tab .x:hover { background: var(--panel3); color: var(--text); }
.ed-tab.dirty .x .i { display: none; }
.ed-tab.dirty .x::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent3); }
.ed-tab.dirty .x:hover::before { display: none; }
.ed-tab.dirty .x:hover .i { display: block; }
.ed-bar { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-bottom: 1px solid var(--line); background: #0b1736; font-size: 12.5px; color: var(--muted); flex: none; }
.ed-bar .path { font-family: var(--mono); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.ed-host { flex: 1; min-height: 0; position: relative; }
.ed-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--dim); padding: 20px; }
.ed-empty .big-ico { width: 72px; height: 72px; margin: 0 auto 16px; border-radius: 20px; display: grid; place-items: center; background: rgba(var(--accent-rgb),.08); color: var(--accent2); border: 1px solid var(--line); }
.ed-empty .big-ico svg { width: 34px; height: 34px; stroke-width: 1.5; }
.ed-status { display: flex; gap: 16px; white-space: nowrap; overflow: hidden; align-items: center; height: 26px; padding: 0 12px; background: var(--accent-deep); color: #fff; font-size: 12px; flex: none; }
.ed-status .grow { flex: 1; }
.ed-status button { border: none; background: none; color: inherit; cursor: pointer; padding: 0 4px; height: 100%; font-size: 12px; }
.ed-status button:hover { background: rgba(255,255,255,.15); }

/* ---------- ustawienia ---------- */
.settings { padding: 28px; max-width: 760px; display: grid; gap: 18px; }
.panel { padding: 20px 22px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); display: grid; gap: 14px; }
.panel h3 { margin: 0; font-size: 15px; }
.panel p { margin: 0; color: var(--muted); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.panel.danger-zone { border-color: rgba(248,113,113,.3); }

/* ---------- modale / toasty / menu ---------- */
.modal-root:empty { display: none; }
.modal-back { position: fixed; inset: 0; background: rgba(3,7,18,.7); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade .15s; }
.modal { width: min(480px, 100%); max-height: calc(100vh - 32px); overflow: auto; border-radius: 18px; background: linear-gradient(180deg, #112247, #0c1938); border: 1px solid var(--line2); box-shadow: 0 30px 80px -10px rgba(0,0,0,.8); padding: 22px; display: grid; gap: 16px; animation: pop .18s cubic-bezier(.2,.9,.3,1.2); }
.modal.wide { width: min(680px, 100%); }
.modal h2 { margin: 0; font-size: 18px; }
.modal p { margin: 0; color: var(--muted); }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; }
.steps { display: grid; gap: 14px; counter-reset: s; }
.steps > div { display: grid; gap: 8px; padding-left: 34px; position: relative; }
.steps > div::before { counter-increment: s; content: counter(s); position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; background: rgba(var(--accent-rgb),.2); color: var(--accent3); font-weight: 800; font-size: 12px; }
.copy-wrap { position: relative; }
.copy-wrap .icon-btn { position: absolute; right: 6px; top: 6px; background: var(--panel2); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(6px); } }
.toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 60; }
.toast { min-width: 240px; max-width: 380px; padding: 12px 14px; border-radius: 12px; background: #13254f; border: 1px solid var(--line2); box-shadow: 0 16px 40px -10px #000; display: flex; gap: 10px; align-items: flex-start; animation: pop .2s; font-size: 13.5px; }
.toast.err { border-color: rgba(248,113,113,.5); }
.toast.err svg { color: var(--danger); }
.toast.ok svg { color: var(--ok); }
.ctx-menu { position: fixed; z-index: 70; min-width: 190px; padding: 6px; border-radius: 12px; background: #112247; border: 1px solid var(--line2); box-shadow: 0 20px 50px -10px #000; }
.ctx-menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border: none; background: none; border-radius: 7px; cursor: pointer; text-align: left; font-size: 13.5px; }
.ctx-menu button:hover { background: var(--panel3); }
.ctx-menu button.danger { color: #fca5a5; }
.ctx-menu hr { border: none; border-top: 1px solid var(--line); margin: 5px 4px; }

/* ---------- mobile ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 40; transform: translateX(-100%); transition: transform .2s; box-shadow: 20px 0 60px #000; }
  .app.side-open .sidebar { transform: none; }
  .only-mobile { display: inline-grid; }
  .topbar { padding: 0 12px; gap: 8px; }
  .tab .lbl { display: none; }
  .dash, .settings { padding: 18px 16px; }
  .files { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(240px, 42%) minmax(0, 1fr); }
  .crumb .muted { display: none; }
  .ex-tools .input { width: 110px; }
  .resizer { display: none; }
  .explorer { border-right: none; border-bottom: 1px solid var(--line); }
  .ex-head, .ex-row { grid-template-columns: 1fr 70px; }
  .ex-head span:nth-child(3), .ex-row .dt { display: none; }
  .toolbar { padding: 10px 12px; }
  .kv { grid-template-columns: 1fr; }
  .ed-status { gap: 10px; }
  .ed-status .hide-m { display: none; }
}

/* ============================================================ konta / panel administratora */
svg.i.sm { width: 14px; height: 14px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 12px; background: var(--bg2); border: 1px solid var(--line); }
.auth-tabs button { height: 34px; border: none; background: none; border-radius: 9px; color: var(--muted); font-weight: 700; cursor: pointer; }
.auth-tabs button.active { background: var(--panel3); color: var(--text); box-shadow: inset 0 0 0 1px var(--line2); }
.setup-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 13px; color: var(--muted);
  background: rgba(var(--accent-rgb),.1); border: 1px solid rgba(var(--accent-rgb),.35); }
.setup-note svg { color: var(--accent2); margin-top: 1px; }
.setup-note b { color: var(--text); }
.login-err.ok { color: var(--ok); }

.side-nav { display: grid; gap: 2px; padding: 0 10px 8px; }
.nav-item { display: flex; align-items: center; gap: 11px; height: 38px; padding: 0 12px; border-radius: 10px; color: var(--muted); font-weight: 600; }
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.active { background: var(--panel2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line2); }
.nav-item.active svg { color: var(--accent2); }
.badge-n { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--warn); color: #1c1300; font-size: 11.5px; font-weight: 800; display: grid; place-items: center; }

.user-chip { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 8px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.uc-main { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: var(--text); }
.uc-meta { display: grid; min-width: 0; line-height: 1.25; }
.uc-meta b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uc-meta small { color: var(--muted); font-size: 11.5px; }
.avatar { width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center; font-weight: 800; color: #fff;
  background: linear-gradient(140deg, var(--accent2), var(--accent-mid)); box-shadow: inset 0 1px 0 rgba(255,255,255,.25); }
.avatar.sm { width: 28px; height: 28px; border-radius: 8px; font-size: 12.5px; }
.avatar.lg { width: 52px; height: 52px; border-radius: 15px; font-size: 22px; }
.avatar.adm { background: linear-gradient(140deg, #fbbf24, #f59e0b); color: #2b1b00; }

.admin { padding: 28px; max-width: 1200px; display: grid; gap: 18px; align-content: start; }
.admin.narrow { max-width: 760px; }
.admin h1 { margin: 0 0 2px; font-size: 24px; letter-spacing: -.02em; }
.admin .lead { margin: 0; color: var(--muted); }
.admin .stats { margin: 0; }
.admin-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.stat.hl { border-color: rgba(251,191,36,.5); background: rgba(251,191,36,.07); }
.panel.tight { padding: 6px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12px; word-break: break-all; }
.nowrap { white-space: nowrap; }
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11px; font-weight: 700; color: var(--dim); text-transform: uppercase; letter-spacing: .07em; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid rgba(28,50,99,.6); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: rgba(17,34,71,.5); }
.tbl tr.row-hl td { background: rgba(251,191,36,.06); }
.tbl td.act { text-align: right; white-space: nowrap; }
.tbl td.act > * { vertical-align: middle; margin-left: 4px; }
.tbl.log td { vertical-align: top; }
.who { display: grid; gap: 8px; }
.who-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pill.adm { color: #fde68a; background: rgba(251,191,36,.1); border-color: rgba(251,191,36,.4); }
.pill.st-active { color: #a7f3d0; background: rgba(52,211,153,.1); border-color: rgba(52,211,153,.35); }
.pill.st-pending { color: #fde68a; background: rgba(251,191,36,.1); border-color: rgba(251,191,36,.4); }
.pill.st-blocked { color: #fecaca; background: rgba(248,113,113,.1); border-color: rgba(248,113,113,.4); }
.ev { display: inline-block; padding: 2px 9px; border-radius: 7px; font-size: 12px; font-weight: 700; background: var(--panel2); color: var(--accent3); white-space: nowrap; }
.ev.good { background: rgba(52,211,153,.12); color: #a7f3d0; }
.ev.bad { background: rgba(248,113,113,.12); color: #fecaca; }
.ev.file { background: rgba(167,139,250,.12); color: #ddd6fe; }
.banner { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 12px; background: rgba(251,191,36,.08); border: 1px solid rgba(251,191,36,.35); color: #fde68a; margin-bottom: 14px; }
.grid-form { display: grid; gap: 14px; }
textarea.input.ta { height: auto; min-height: 58px; padding: 9px 12px; font: 12.5px/1.5 var(--mono); resize: vertical; }

.access-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 18px; align-items: start; }
.user-pick { display: grid; gap: 2px; position: sticky; top: 0; }
.pick { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--text); }
.pick:hover { background: var(--panel2); }
.pick.active { background: linear-gradient(90deg, rgba(var(--accent-rgb),.22), rgba(var(--accent-rgb),.06)); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb),.4); }
.pick-meta { display: grid; line-height: 1.3; min-width: 0; }
.pick-meta small { color: var(--muted); font-size: 11.5px; }
.pick-note { display: flex; gap: 6px; align-items: center; padding: 10px; font-size: 12px; color: var(--dim); border-top: 1px solid var(--line); margin-top: 4px; }
#accessEd { display: grid; gap: 12px; }
.acc-card { border-radius: 14px; background: var(--panel); border: 1px solid var(--line); overflow: hidden; transition: border-color .2s, box-shadow .3s; }
.acc-card.on { border-color: rgba(var(--accent-rgb),.45); }
.acc-card.saved { box-shadow: 0 0 0 3px rgba(52,211,153,.35); }
.acc-head { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.acc-title { display: grid; line-height: 1.3; flex: 1; min-width: 0; }
.acc-title small { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.acc-state { font-size: 12px; font-weight: 700; color: var(--dim); }
.acc-card.on .acc-state { color: var(--accent3); }
.acc-body { display: none; border-top: 1px solid var(--line); padding: 6px 16px 14px; }
.acc-card.on .acc-body { display: grid; }
.acc-opt { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }
.acc-opt:last-child { border-bottom: none; }
.acc-opt > div:first-child { display: grid; line-height: 1.35; }
.acc-opt b { display: flex; align-items: center; gap: 7px; }
.acc-opt small { color: var(--muted); font-size: 12px; }
.acc-opt.col { flex-direction: column; align-items: stretch; gap: 8px; }
.acc-opt.dim { opacity: .45; pointer-events: none; }
.warn { color: var(--warn) !important; display: flex; align-items: center; gap: 6px; }
.switch { position: relative; width: 42px; height: 24px; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--panel3); border: 1px solid var(--line2); transition: background .15s; pointer-events: none; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.switch input:checked + span { background: var(--accent); border-color: var(--accent2); }
.switch input:checked + span::after { transform: translateX(18px); background: #fff; }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px rgba(var(--accent-rgb),.35); }

.radio-cards { display: grid; gap: 10px; }
.rcard { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line2); background: var(--bg2); cursor: pointer; position: relative; }
.rcard input { position: absolute; opacity: 0; }
.rcard .rc-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--panel2); color: var(--muted); flex: none; }
.rcard small { display: block; color: var(--muted); margin-top: 2px; }
.rcard:has(input:checked) { border-color: var(--accent); background: rgba(var(--accent-rgb),.1); box-shadow: 0 0 0 1px var(--accent); }
.rcard:has(input:checked) .rc-ico { background: var(--accent); color: #fff; }

@media (max-width: 900px) {
  .admin { padding: 18px 16px; }
  .access-grid { grid-template-columns: 1fr; }
  .user-pick { position: static; }
  .tbl th:nth-child(5), .tbl td:nth-child(5) { display: none; }
}

/* ============================================================ aplikacja / PWA */
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; color: var(--muted); font-size: 13.5px; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.install-help { display: grid; gap: 8px; font-size: 13px; color: var(--muted); padding: 12px 14px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); }
.install-help b { color: var(--text); }
/* w aplikacji: uwzględnij wycięcia ekranu (notch) i pasek systemowy */
html.in-app body { padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
html.in-app .app { height: calc(100dvh - env(safe-area-inset-top)); }

/* ---- okno podłączania komputera ---- */
.win-box { display: grid; gap: 10px; padding: 16px; border-radius: 14px; background: rgba(var(--accent-rgb),.08); border: 1px solid rgba(var(--accent-rgb),.4); }
.win-head { display: flex; align-items: center; gap: 9px; }
.win-head svg { color: var(--accent2); }
.win-head .pill { margin-left: auto; }
.win-box p { margin: 0; }
.small { font-size: 12.5px; }
code.block.ps { max-height: 120px; overflow: auto; padding-right: 46px; }
details.manual { border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; }
details.manual summary { cursor: pointer; padding: 12px 0; color: var(--muted); font-weight: 600; }
details.manual[open] summary { color: var(--text); }
details.manual .steps { padding-bottom: 14px; }

/* ============================================================ konsola (terminal) */
.term-wrap { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.term { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px; background: #05091a; white-space: pre-wrap; word-break: break-word;
  font: 13px/1.5 var(--mono); color: #cfe0ff; }
.term span { white-space: pre-wrap; }
.term .term-echo { color: #8ab4ff; }
.term .term-sys { color: var(--warn); }
.term-input { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-top: 1px solid var(--line); background: #070d22; }
.term-caret { color: var(--accent2); font-family: var(--mono); font-weight: 700; }
.term-input input { flex: 1; border: none; background: none; outline: none; color: var(--text); font: 13px var(--mono); }
.term-input input:disabled { opacity: .5; }

/* ============================================================ motywy kolorystyczne */
:root[data-theme="violet"] { --bg:#0b0a1f; --bg2:#120f2e; --panel:#17123a; --panel2:#211a52; --panel3:#2b2168; --line:#2c2566; --line2:#3b327f; --accent:#8b5cf6; --accent2:#a78bfa; --accent3:#c4b5fd; --accent-rgb:139, 92, 246; --accent-mid:#7c3aed; --accent-deep:#6d28d9; --accent-btn:#9b6cff; --accent-btn2:#7c4fe6; --on-accent:#fff; --glow:rgba(139, 92, 246, .4); }
:root[data-theme="emerald"] { --bg:#04140e; --bg2:#07201a; --panel:#0a2a20; --panel2:#0e3a2c; --panel3:#13503c; --line:#164a38; --line2:#1e6a50; --accent:#10b981; --accent2:#34d399; --accent3:#6ee7b7; --accent-rgb:16, 185, 129; --accent-mid:#059669; --accent-deep:#047857; --accent-btn:#17c48d; --accent-btn2:#0ea371; --on-accent:#04140e; --glow:rgba(16, 185, 129, .4); }
:root[data-theme="cyan"] { --bg:#041518; --bg2:#07232a; --panel:#0a2e38; --panel2:#0e3f4c; --panel3:#135562; --line:#164e5c; --line2:#1e6e80; --accent:#06b6d4; --accent2:#22d3ee; --accent3:#67e8f9; --accent-rgb:6, 182, 212; --accent-mid:#0891b2; --accent-deep:#0e7490; --accent-btn:#1ec7e0; --accent-btn2:#0a9fbd; --on-accent:#041518; --glow:rgba(6, 182, 212, .4); }
:root[data-theme="rose"] { --bg:#1a0812; --bg2:#28101c; --panel:#331426; --panel2:#471a33; --panel3:#5e2244; --line:#5a2342; --line2:#7a3058; --accent:#f43f5e; --accent2:#fb7185; --accent3:#fda4af; --accent-rgb:244, 63, 94; --accent-mid:#e11d48; --accent-deep:#be123c; --accent-btn:#ff5873; --accent-btn2:#e63957; --on-accent:#fff; --glow:rgba(244, 63, 94, .4); }
:root[data-theme="amber"] { --bg:#171203; --bg2:#241b06; --panel:#30250a; --panel2:#44340e; --panel3:#5b4513; --line:#574416; --line2:#78601f; --accent:#f59e0b; --accent2:#fbbf24; --accent3:#fcd34d; --accent-rgb:245, 158, 11; --accent-mid:#d97706; --accent-deep:#b45309; --accent-btn:#ffab1f; --accent-btn2:#e08f0a; --on-accent:#1a1203; --glow:rgba(245, 158, 11, .4); }

/* ---- wybór motywu ---- */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.theme-opt { display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line2); background: var(--bg2); color: var(--text); font-weight: 600; font-size: 13.5px; text-align: left; }
.theme-opt:hover { border-color: var(--accent); }
.theme-opt.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 6px 18px -8px var(--glow); }
.theme-sw { width: 26px; height: 26px; border-radius: 8px; flex: none; position: relative; overflow: hidden;
  background: var(--swbg); box-shadow: inset 0 0 0 1px rgba(255,255,255,.1); }
.theme-sw::after { content: ''; position: absolute; right: -6px; bottom: -6px; width: 22px; height: 22px; border-radius: 50%; background: var(--sw); }
