﻿:root {
  --bg: #050505;
  --sidebar: #0a0a0a;
  --card: #0e0e0e;
  --card-2: #141414;
  --border: rgba(0, 149, 255, 0.22);
  --border-strong: rgba(0, 149, 255, 0.55);
  --text: #f4f7fb;
  --muted: #8b95a8;
  --accent: #0095FF;
  --accent-2: #3bb0ff;
  --accent-soft: rgba(0, 149, 255, 0.14);
  --green: #22c55e;
  --green-h: #16a34a;
  --yellow: #eab308;
  --yellow-h: #ca8a04;
  --red: #ef4444;
  --red-h: #dc2626;
  --radius: 12px;
  --font: "Outfit", system-ui, sans-serif;
  --mono: "JetBrains Mono", Consolas, monospace;
  --glow: 0 0 28px rgba(0, 149, 255, 0.22);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }

/* Dark scrollbars (Firefox + Chromium) */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 149, 255, 0.45) rgba(255, 255, 255, 0.06);
}
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
}
*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(0, 149, 255, 0.55), rgba(0, 119, 204, 0.45));
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #0095FF, #0077CC);
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-corner {
  background: transparent;
}

body {
  font-family: var(--font);
  color: var(--text);
  background-color: #000000;
  background-image:
    radial-gradient(900px 480px at 12% -10%, rgba(0, 149, 255, 0.18), transparent 58%),
    radial-gradient(700px 420px at 96% 8%, rgba(255, 255, 255, 0.05), transparent 55%),
    radial-gradient(600px 380px at 70% 100%, rgba(0, 149, 255, 0.08), transparent 50%),
    radial-gradient(rgba(148, 163, 184, 0.1) 1px, transparent 1px);
  background-size: auto, auto, auto, 22px 22px;
  background-attachment: fixed;
}

html.authed #app-shell { display: grid; }
html.needs-login #app-shell { display: none !important; }
html.authed #login-gate { display: none !important; }
html.needs-login #login-gate { display: flex; }

.shell {
  position: relative;
  z-index: 1;
  display: none;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
  align-items: start;
}
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: linear-gradient(180deg, rgba(12, 12, 12, 0.98), rgba(0, 0, 0, 0.98));
  border-right: 1px solid rgba(0, 149, 255, 0.18);
  padding: 1.1rem 0.75rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  backdrop-filter: blur(8px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.25rem 0.45rem 0.85rem;
  border-bottom: 1px solid rgba(0, 149, 255, 0.18);
}
.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: contain;
  background: transparent;
  border: none;
  box-shadow: none;
  flex-shrink: 0;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: -0.03em;
  color: #fff;
  background: linear-gradient(135deg, #3bb0ff 0%, #0095FF 55%, #0077CC 100%);
  box-shadow: 0 0 16px rgba(0, 149, 255, 0.3);
  flex-shrink: 0;
}
.brand strong {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}
.brand span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
}

.nav { display: grid; gap: 0.85rem; flex: 1 1 auto; align-content: start; }
.nav-group {
  display: grid;
  gap: 0.3rem;
}
.nav-label {
  display: block;
  padding: 0 0.55rem 0.1rem;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(139, 144, 165, 0.9);
}
.nav button {
  text-align: left;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: transparent;
  border: 1px solid transparent;
  color: #c4c7d4;
  padding: 0.62rem 0.8rem;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.2;
  min-height: 42px;
  height: 42px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.nav button svg {
  width: 17px;
  height: 17px;
  opacity: 0.9;
  flex-shrink: 0;
  color: currentColor;
}
.nav button:hover {
  background: rgba(255, 255, 255, 0.03);
  color: #fff;
}
.nav button.active {
  background: rgba(0, 149, 255, 0.1);
  border-color: rgba(56, 189, 255, 0.55);
  color: #fff;
  box-shadow: 0 0 18px rgba(0, 149, 255, 0.16);
}
.nav button.active svg {
  opacity: 1;
  color: #7dd3fc;
}

.power-row {
  display: inline-grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  padding: 0.28rem;
  border-radius: 14px;
  border: 1px solid rgba(56, 189, 255, 0.22);
  background:
    linear-gradient(180deg, rgba(14, 14, 14, 0.95), rgba(12, 10, 18, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 10px 28px rgba(0, 0, 0, 0.28);
}
.sidebar-foot { margin-top: auto; padding: 0.2rem 0.15rem; }
.sidebar-foot .btn-ghost {
  color: var(--muted);
  border-color: var(--border);
  background: transparent;
  padding: 0.4rem 0.55rem;
  font-size: 0.82rem;
  width: 100%;
}
.sidebar-foot .btn-ghost:hover:not(:disabled) {
  background: rgba(0, 149, 255, 0.1);
  border-color: var(--border-strong);
  color: #fff;
}

.console-card { padding: 0; overflow: hidden; }
.console-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(420px 90px at 0% 0%, rgba(0, 149, 255, 0.18), transparent 70%),
    rgba(14, 12, 20, 0.95);
}
.console-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.console-title h2 {
  margin: 0 !important;
  font-size: 0.95rem !important;
  letter-spacing: -0.02em !important;
  text-transform: none !important;
  color: var(--text) !important;
  font-weight: 700 !important;
}
.console-title p {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}
.console-live {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15), 0 0 12px rgba(34, 197, 94, 0.5);
  flex-shrink: 0;
}
.console-power { min-width: min(300px, 100%); }
.console-window {
  height: min(280px, 40vh);
  overflow: auto;
  padding: 0.75rem 0.9rem 0.9rem;
  background: linear-gradient(180deg, rgba(10, 8, 16, 0.96), rgba(12, 10, 18, 0.98));
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.55;
  color: #f1f5f9;
}
.console-window {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 149, 255, 0.5) rgba(255, 255, 255, 0.04);
}
.console-line {
  white-space: pre-wrap;
  word-break: break-word;
  padding: 0.05rem 0;
  color: #f1f5f9;
}
.console-line.warn { color: #fde68a; }
.console-line.error { color: #fda4a4; }
.console-line.info { color: #f1f5f9; }
.console-line.debug { color: #94a3b8; }
.console-empty {
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.85rem;
  padding: 1.5rem 0;
  text-align: center;
}

.content {
  position: relative;
  padding: 1.5rem 1.75rem 3rem;
  max-width: 1220px;
}
.content::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(520px 220px at 8% 0%, rgba(0, 149, 255, 0.07), transparent 70%),
    radial-gradient(420px 200px at 100% 30%, rgba(0, 119, 204, 0.05), transparent 65%);
  z-index: 0;
}
.content > * { position: relative; z-index: 1; }

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.4rem;
  flex-wrap: wrap;
}
.topbar-copy small {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.topbar h1 {
  margin: 0;
  font-size: clamp(1.55rem, 2.4vw, 2rem);
  font-weight: 750;
  letter-spacing: -0.03em;
  background: linear-gradient(90deg, #fff 15%, #7dd3fc 55%, #c084fc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(15, 12, 22, 0.9);
  font-size: 0.86rem;
  color: var(--muted);
  font-weight: 560;
  box-shadow: var(--glow);
  backdrop-filter: blur(10px);
}
.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
}
.dot.on {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.18), 0 0 14px rgba(34, 197, 94, 0.55);
}
.dot.off {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.16);
}

.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: 1.1fr 0.9fr; }
.grid.stats { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 980px) {
  .grid.two, .grid.stats { grid-template-columns: 1fr; }
}

.view { display: none !important; }
.view.active { display: grid !important; gap: 0.75rem; animation: rise 0.28s ease; }
@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(240, 171, 252, 0.35), transparent);
  pointer-events: none;
}
.card h2, .card-head h2 {
  margin: 0 0 0.7rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.card-head h2 { margin: 0; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0.45rem;
}

.hero-card {
  padding: 0.95rem 1rem;
  background:
    linear-gradient(135deg, rgba(0, 149, 255, 0.1), transparent 55%),
    var(--card);
}

.grid.stats { gap: 0.65rem; }

.stat {
  padding: 0.65rem 0.75rem 0.65rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-2);
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(180deg, #0095FF, #0095FF, #0077CC);
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(0, 149, 255, 0.45);
}
.stat span {
  display: block;
  color: var(--muted);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.2rem;
  font-weight: 600;
}
.stat b {
  font-weight: 700;
  font-family: var(--mono);
  font-size: 0.9rem;
  letter-spacing: -0.02em;
  color: #fff;
  line-height: 1.25;
}

.mini-card {
  padding: 0;
  background: transparent;
  border: none;
}
.mini-card > span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.mini-card .value {
  font-size: 1.35rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  color: #fff;
  line-height: 1.15;
  margin: 0.2rem 0 0.3rem;
}
.mini-card .hint {
  margin-top: 0.2rem;
  font-size: 0.76rem;
}

label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}
input, select, textarea {
  width: 100%;
  padding: 0.72rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.8);
  color: var(--text);
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea {
  min-height: 96px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 0.82rem;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px rgba(0, 149, 255, 0.18);
}
select option { background: #0e0e0e; color: var(--text); }

/* Custom file picker (hides native ugly "Wybierz plik") */
.file-field { min-width: 0; }
.file-field-control {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 2.7rem;
  padding: 0.35rem 0.45rem 0.35rem 0.35rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.8);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  overflow: hidden;
}
.file-field-control:hover {
  border-color: rgba(0, 149, 255, 0.45);
}
.file-field-control:focus-within {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px rgba(0, 149, 255, 0.18);
}
.file-field-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  padding: 0;
  border: 0;
  margin: 0;
  z-index: 2;
}
.file-field-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.8rem;
  border-radius: 8px;
  background: linear-gradient(135deg, #0095FF, #0077CC);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  box-shadow: 0 0 14px rgba(0, 149, 255, 0.25);
  pointer-events: none;
}
.file-field-name {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.74rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.file-field-name.has-file {
  color: #dbeafe;
}

.upload-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr auto;
  gap: 0.75rem;
  align-items: end;
}
@media (max-width: 800px) {
  .upload-row { grid-template-columns: 1fr; }
}

button {
  border: none;
  border-radius: 10px;
  padding: 0.65rem 0.95rem;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.14s ease, transform 0.08s ease, opacity 0.12s ease, box-shadow 0.14s ease;
}
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.42; cursor: not-allowed; transform: none; }

.power-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.35rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  transition:
    background 0.16s ease,
    color 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.08s ease;
}
.power-btn svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  opacity: 0.9;
}
.power-btn:hover:not(:disabled) {
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
}
.power-btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
}
.power-btn:disabled {
  opacity: 0.35;
}

.btn-start {
  color: #86efac;
}
.btn-start:hover:not(:disabled),
.btn-start:focus-visible {
  color: #ecfdf5;
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.28), rgba(22, 163, 74, 0.16));
  border-color: rgba(74, 222, 128, 0.45);
  box-shadow:
    0 0 0 1px rgba(34, 197, 94, 0.12),
    0 8px 20px rgba(34, 197, 94, 0.18);
}
.btn-start:not(:disabled) {
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.2), rgba(22, 163, 74, 0.1));
  border-color: rgba(74, 222, 128, 0.28);
  color: #bbf7d0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.btn-restart {
  color: #fde68a;
}
.btn-restart:not(:disabled) {
  background: linear-gradient(180deg, rgba(234, 179, 8, 0.2), rgba(202, 138, 4, 0.1));
  border-color: rgba(250, 204, 21, 0.28);
  color: #fef08a;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.btn-restart:hover:not(:disabled),
.btn-restart:focus-visible {
  color: #fffbeb;
  background: linear-gradient(180deg, rgba(234, 179, 8, 0.3), rgba(202, 138, 4, 0.16));
  border-color: rgba(250, 204, 21, 0.5);
  box-shadow:
    0 0 0 1px rgba(234, 179, 8, 0.12),
    0 8px 20px rgba(234, 179, 8, 0.16);
}
.btn-restart:not(:disabled):active svg {
  animation: power-spin 0.55s ease;
}

.btn-stop {
  color: #fca5a5;
}
.btn-stop:not(:disabled) {
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.22), rgba(220, 38, 38, 0.12));
  border-color: rgba(248, 113, 113, 0.3);
  color: #fecaca;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.btn-stop:hover:not(:disabled),
.btn-stop:focus-visible {
  color: #fff;
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.34), rgba(220, 38, 38, 0.18));
  border-color: rgba(248, 113, 113, 0.55);
  box-shadow:
    0 0 0 1px rgba(239, 68, 68, 0.14),
    0 8px 20px rgba(239, 68, 68, 0.2);
}

@keyframes power-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(-360deg); }
}
.btn-primary {
  background: linear-gradient(135deg, #0095FF, #0095FF 45%, #0077CC);
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 149, 255, 0.32);
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.06);
  box-shadow: 0 10px 28px rgba(0, 149, 255, 0.42);
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) {
  background: rgba(0, 149, 255, 0.1);
  border-color: var(--border-strong);
}
.btn-danger {
  background: rgba(239, 68, 68, 0.14);
  color: #fda4a4;
  border: 1px solid rgba(239, 68, 68, 0.28);
}
.btn-danger:hover:not(:disabled) {
  background: var(--red);
  color: #fff;
  border-color: transparent;
}
.btn-sm { padding: 0.38rem 0.7rem; font-size: 0.8rem; border-radius: 8px; }

.actions { display: flex; gap: 0.45rem; flex-wrap: wrap; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td {
  text-align: left;
  padding: 0.85rem 0.55rem;
  border-bottom: 1px solid rgba(0, 149, 255, 0.12);
  vertical-align: middle;
  font-size: 0.9rem;
}
th {
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 700;
}
tbody tr { transition: background 0.12s ease; }
tbody tr:hover { background: rgba(0, 149, 255, 0.06); }
code {
  font-family: var(--mono);
  font-size: 0.78rem;
  background: rgba(0, 0, 0, 0.8);
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: #dbeafe;
}
.ips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.chip {
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  color: #7dd3fc;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
}
.badge.ok {
  background: rgba(34, 197, 94, 0.14);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.25);
}
.badge.miss {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.22);
}
.badge.warn {
  background: rgba(234, 179, 8, 0.14);
  color: #fde68a;
  border: 1px solid rgba(234, 179, 8, 0.28);
}

.empty {
  color: var(--muted);
  padding: 1.5rem 0.25rem;
  text-align: center;
  font-weight: 500;
}
.hint { color: var(--muted); font-size: 0.8rem; margin: 0.45rem 0 0; line-height: 1.45; }

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  padding: 0.85rem 1.05rem;
  border-radius: 12px;
  background: rgba(15, 12, 22, 0.95);
  border: 1px solid var(--border);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), var(--glow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  transform: translateY(8px);
  max-width: min(420px, calc(100vw - 2rem));
  z-index: 90;
  font-weight: 560;
  backdrop-filter: blur(12px);
  color: #fff;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.ok { border-color: rgba(34, 197, 94, 0.45); }
.toast.err { border-color: rgba(239, 68, 68, 0.5); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(4, 4, 8, 0.72);
  backdrop-filter: blur(10px);
}
.modal-backdrop.open { display: flex; }
.modal {
  width: min(540px, 100%);
  background: linear-gradient(180deg, #1a1524 0%, #100e18 100%);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 60px rgba(0, 149, 255, 0.2);
  overflow: hidden;
}
.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(500px 120px at 10% 0%, rgba(0, 149, 255, 0.25), transparent 60%),
    linear-gradient(180deg, rgba(36, 22, 48, 0.9), transparent);
}
.modal-header h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: #fff;
}
.modal-header p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}
.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}
.modal-close:hover {
  background: rgba(0, 149, 255, 0.12);
  color: var(--text);
  border-color: var(--border-strong);
}
.modal-body {
  padding: 1.15rem 1.25rem;
  display: grid;
  gap: 0.9rem;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
  padding: 0.95rem 1.25rem 1.2rem;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.45);
}

.key-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
}
.note-cell {
  color: var(--muted);
  font-size: 0.84rem;
  max-width: 280px;
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.note-cell .note-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
  word-break: break-word;
  overflow-wrap: anywhere;
}
#attacks-wrap {
  overflow-x: auto;
}
#attacks-wrap table {
  table-layout: fixed;
  width: 100%;
  min-width: 1120px;
  border-collapse: separate;
  border-spacing: 0;
}
#attacks-wrap th,
#attacks-wrap td {
  padding: 0.7rem 0.7rem;
  vertical-align: top;
  overflow: hidden;
}
#attacks-wrap th:nth-child(1),
#attacks-wrap td:nth-child(1) { width: 148px; }
#attacks-wrap th:nth-child(2),
#attacks-wrap td:nth-child(2) { width: 78px; }
#attacks-wrap th:nth-child(3),
#attacks-wrap td:nth-child(3) { width: 168px; }
#attacks-wrap th:nth-child(4),
#attacks-wrap td:nth-child(4) { width: 132px; }
#attacks-wrap th:nth-child(5),
#attacks-wrap td:nth-child(5) { width: 88px; }
#attacks-wrap th:nth-child(6),
#attacks-wrap td:nth-child(6) { width: 148px; }
#attacks-wrap th:nth-child(7),
#attacks-wrap td.note-cell {
  width: auto;
  max-width: none;
}
#attacks-wrap th:nth-child(8),
#attacks-wrap td.attack-actions {
  width: 92px;
  white-space: nowrap;
  text-align: right;
  padding-left: 0.5rem;
  overflow: visible;
}
#attacks-wrap .attack-time {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
  white-space: normal;
}
#attacks-wrap code.attack-code {
  display: inline-block;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: top;
  font-size: 0.7rem;
  line-height: 1.3;
  padding: 0.18rem 0.4rem;
}
#attacks-wrap td.note-cell {
  padding-right: 0.85rem;
}
#attacks-wrap .note-text {
  color: var(--muted);
  font-size: 0.82rem;
}

.license-stack { display: grid; gap: 0.85rem; }
.license-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(14, 14, 14, 0.55);
  overflow: hidden;
}
.license-card.is-disabled {
  opacity: 0.72;
  border-color: rgba(239, 68, 68, 0.35);
}
.license-card.is-disabled .license-meta code {
  text-decoration: line-through;
  text-decoration-color: rgba(239, 68, 68, 0.55);
}
.license-meta code.key-copy {
  cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease;
  border-radius: 6px;
  padding: 0.1rem 0.25rem;
}
.license-meta code.key-copy:hover {
  color: #dbeafe;
  background: rgba(0, 149, 255, 0.14);
}
.license-folder {
  --folder-accent: #0095FF;
  --folder-accent-rgb: 232, 121, 249;
  margin-bottom: 1rem;
  border: 1px solid rgba(var(--folder-accent-rgb), 0.35);
  border-radius: 14px;
  background:
    linear-gradient(145deg, rgba(var(--folder-accent-rgb), 0.12), transparent 42%),
    rgba(10, 10, 10, 0.55);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}
.license-folder.is-root {
  --folder-accent: #94a3b8;
  --folder-accent-rgb: 148, 163, 184;
  border-color: rgba(148, 163, 184, 0.22);
  background:
    linear-gradient(145deg, rgba(148, 163, 184, 0.06), transparent 42%),
    rgba(10, 10, 10, 0.4);
}
.license-folder-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.9rem 1rem;
  background: rgba(0, 0, 0, 0.35);
  border-bottom: 1px solid rgba(var(--folder-accent-rgb), 0.22);
}
.license-folder.is-root .license-folder-head {
  border-bottom-color: rgba(148, 163, 184, 0.16);
}
.license-folder-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}
.folder-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: linear-gradient(145deg, rgba(var(--folder-accent-rgb), 0.35), rgba(var(--folder-accent-rgb), 0.1));
  border: 1px solid rgba(var(--folder-accent-rgb), 0.45);
  color: var(--folder-accent);
  box-shadow: 0 0 18px rgba(var(--folder-accent-rgb), 0.22);
}
.license-folder.is-root .folder-icon {
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.28);
  color: #cbd5e1;
  box-shadow: none;
}
.folder-icon svg {
  width: 20px;
  height: 20px;
}
.license-folder-title strong {
  display: block;
  font-size: 1rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.license-folder-title .hint {
  margin: 0.15rem 0 0;
}
.folder-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.55rem;
  height: 1.35rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  background: rgba(var(--folder-accent-rgb), 0.22);
  border: 1px solid rgba(var(--folder-accent-rgb), 0.4);
}
.license-folder.is-root .folder-count {
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.25);
}
.folder-color-field {
  display: grid;
  gap: 0.55rem;
}
.folder-color-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}
.folder-color-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.55rem;
}
.folder-color-row input[type="color"] {
  width: 3rem;
  height: 2.55rem;
  padding: 0.2rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.65);
  cursor: pointer;
}
.folder-rgb {
  display: grid;
  gap: 0.25rem;
  min-width: 4.2rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.folder-rgb input {
  width: 4.2rem;
  margin: 0;
}
.folder-hex {
  display: inline-flex;
  align-items: center;
  height: 2.55rem;
  padding: 0 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.55);
  color: #dbeafe;
  font-size: 0.82rem;
}
.folder-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.folder-swatch {
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  background: var(--sw);
  cursor: pointer;
  padding: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}
.folder-swatch:hover {
  transform: scale(1.08);
}
.folder-swatch.is-active {
  box-shadow: 0 0 0 2px var(--sw), 0 0 0 4px rgba(255, 255, 255, 0.2);
}
.license-folder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}
.license-folder-body {
  display: grid;
  gap: 0.85rem;
  padding: 0.9rem;
}
.license-folder.is-collapsed .license-folder-head {
  border-bottom: none;
}
.license-folder.is-collapsed .license-folder-body {
  display: none;
}
.check-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 0.55rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.check-row input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--accent);
  cursor: pointer;
}
.chip.off {
  background: rgba(239, 68, 68, 0.16);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.35);
}
.license-card-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  align-items: start;
}
.license-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.7rem;
  align-items: center;
  margin-bottom: 0.45rem;
}
.license-logs {
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.55);
  padding: 0.55rem 0.85rem 0.8rem;
}
.license-logs.is-collapsed {
  padding-bottom: 0.55rem;
}
.license-logs-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  margin: 0 0 0.45rem;
  padding: 0.2rem 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  cursor: pointer;
  text-align: left;
}
.license-logs.is-collapsed .license-logs-title {
  margin-bottom: 0;
}
.license-logs-title:hover {
  color: #dbeafe;
}
.license-logs-title .folder-count {
  margin-left: 0.35rem;
  vertical-align: middle;
}
.license-logs-toggle {
  color: #0095FF;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
}
.license-logs.is-collapsed .license-logs-body {
  display: none;
}
.log-list {
  display: grid;
  gap: 0.35rem;
  max-height: 180px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 0.76rem;
}
.log-row {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  gap: 0.55rem;
  align-items: center;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: rgba(15, 12, 22, 0.7);
  color: var(--text);
}
.sev-badge {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 0.14rem 0.4rem;
  border-radius: 999px;
  font-family: var(--font);
}
.sev-badge.INFO {
  background: rgba(34, 197, 94, 0.16);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.28);
}
.sev-badge.WARN {
  background: rgba(234, 179, 8, 0.14);
  color: #fde68a;
  border: 1px solid rgba(234, 179, 8, 0.28);
}
.sev-badge.ERROR {
  background: rgba(239, 68, 68, 0.14);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.28);
}
.log-time { color: var(--muted); white-space: nowrap; }
.log-msg { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-ip { color: #7dd3fc; white-space: nowrap; }
.log-empty {
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.8rem;
  padding: 0.35rem 0.15rem;
}

.confirm-modal { width: min(420px, 100%); }
.history-modal { width: min(720px, 100%); }
.history-modal .table-wrap { max-height: min(50vh, 420px); overflow: auto; }
.confirm-icon { display: none; }
.confirm-detail {
  display: block;
  margin-top: 0.25rem;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.82rem;
  color: #dbeafe;
  word-break: break-all;
}
.confirm-modal .modal-footer button { min-width: 110px; }

.login-gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background-color: #000000;
  background-image:
    radial-gradient(820px 420px at 50% 12%, rgba(0, 149, 255, 0.22), transparent 58%),
    radial-gradient(560px 320px at 80% 80%, rgba(0, 119, 204, 0.12), transparent 55%),
    radial-gradient(rgba(148, 163, 184, 0.12) 1px, transparent 1px);
  background-size: auto, auto, 22px 22px;
}
.login-card {
  width: min(400px, 100%);
  background:
    radial-gradient(420px 180px at 15% 0%, rgba(0, 149, 255, 0.16), transparent 60%),
    linear-gradient(180deg, rgba(16, 16, 16, 0.98), rgba(0, 0, 0, 0.98));
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  padding: 1.55rem 1.45rem 1.4rem;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.5), var(--glow);
  animation: login-in 0.35s ease both;
}
@keyframes login-in {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.15rem;
}
.login-brand strong {
  display: block;
  font-size: 1rem;
  letter-spacing: -0.02em;
}
.login-brand span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 0.1rem;
}
.login-card h2 {
  margin: 0 0 1rem;
  font-size: 1.35rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  color: #fff;
}
.login-card form {
  display: grid;
  gap: 0.95rem;
}
.login-card label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}
.login-token-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.45rem;
  align-items: center;
}
.login-card input {
  width: 100%;
  margin: 0;
  font-family: var(--mono);
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}
.login-submit {
  width: 100%;
  margin-top: 0.15rem;
  padding: 0.8rem 1rem;
  font-size: 0.95rem;
}

.modules-field {
  display: grid;
  gap: 0.45rem;
}
.modules-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.4rem;
  padding: 0.55rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.45);
  max-height: 180px;
  overflow: auto;
}
.modules-check-grid:empty::after {
  content: "Brak modułów w katalogu — dodaj w zakładce Modules.";
  color: var(--muted);
  font-size: 0.8rem;
}
.module-check {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  padding: 0.35rem 0.45rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text);
  cursor: pointer;
}
.module-check:hover {
  background: rgba(0, 149, 255, 0.1);
}
.module-check input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
  cursor: pointer;
}
.module-check small {
  color: var(--muted);
  font-weight: 500;
}
.chip.module {
  background: rgba(56, 189, 248, 0.14);
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.35);
}

.protection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.65rem;
  margin-top: 0.85rem;
}
.protection-card {
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(34, 197, 94, 0.25);
  background:
    linear-gradient(145deg, rgba(34, 197, 94, 0.1), transparent 55%),
    rgba(10, 10, 10, 0.55);
}
.protection-card strong {
  display: block;
  font-size: 0.88rem;
  margin-bottom: 0.35rem;
  color: #bbf7d0;
}
.protection-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}
.sev-badge.CRITICAL {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.45);
}
.sev-badge.CRITICAL,
.sev-badge.ERROR {
  background: rgba(239, 68, 68, 0.16);
  color: #fca5a5;
}
.sev-badge.WARN {
  background: rgba(234, 179, 8, 0.16);
  color: #fde68a;
}

.license-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 0.85rem;
}
.license-toolbar input {
  flex: 1 1 220px;
  width: auto;
  max-width: 420px;
}

.live-list { display: grid; gap: 0.45rem; }
.live-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(14, 14, 14, 0.65);
  font-size: 0.86rem;
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.55);
}
.live-dot.pulse {
  background: #eab308;
  box-shadow: 0 0 10px rgba(234, 179, 8, 0.55);
  animation: live-pulse 1.1s ease infinite;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.85); }
}
.live-status {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.tile { display: contents; }
.meta-strip { display: contents; }

/* Upload progress overlay */
.upload-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
}
.upload-overlay[hidden] { display: none !important; }
.upload-panel {
  width: min(420px, 100%);
  border: 1px solid rgba(0, 149, 255, 0.35);
  border-radius: 16px;
  background:
    radial-gradient(420px 180px at 20% 0%, rgba(0, 149, 255, 0.18), transparent 60%),
    #0a0a0a;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 0 40px rgba(0, 149, 255, 0.12);
  padding: 1.5rem 1.35rem 1.25rem;
  text-align: center;
}
.upload-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 12px;
  background: transparent;
  border: none;
  box-shadow: none;
  margin-bottom: 0.85rem;
}
.upload-panel h3 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.upload-file {
  margin: 0 0 1rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
  word-break: break-all;
}
.upload-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  border: 1px solid rgba(0, 149, 255, 0.22);
}
.upload-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0077CC, #0095FF 45%, #3bb0ff);
  box-shadow: 0 0 16px rgba(0, 149, 255, 0.45);
  transition: width 0.12s linear;
}
.upload-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.7rem;
  font-size: 0.78rem;
  font-family: var(--mono);
  color: #cfe9ff;
}
.upload-hint {
  margin: 0.85rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}
