/* SUBMONY Guard — panel. Ciemny granat SUBMONY, czytelny Nunito, spokojne animacje. */
:root {
  --bg: #0A1230;
  --bg2: #0E1839;
  --panel: #131F4A;
  --panel2: #182759;
  --panel3: #1E306B;
  --line: #24386F;
  --line2: #30488C;
  --text: #EAF0FF;
  --muted: #A3B0D6;
  --dim: #7383B3;
  --accent: #F87830;
  --accent2: #FFA25C;
  --ok: #58D080;
  --warn: #F8C830;
  --bad: #F85838;
  --info: #88D0F8;
  --crit: #FF4D7A;
  --sev-high: #F85838;
  --sev-medium: #F8A030;
  --sev-low: #F8C830;
  --sev-info: #88D0F8;
  --radius: 12px;
  --radius-s: 8px;
  --shadow: 0 10px 30px rgba(3, 8, 28, .35);
  --ease: cubic-bezier(.22, .8, .24, 1);
  --mono: ui-monospace, 'Cascadia Mono', 'Consolas', 'SFMono-Regular', monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 700px at 80% -10%, #1A2A66 0%, transparent 60%), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.5 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(248, 120, 48, .35); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--mono); font-size: .92em; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.mt { margin-top: 14px; }
.m0 { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── układ ─────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px 14px;
  background: linear-gradient(180deg, rgba(19, 31, 74, .92), rgba(10, 18, 48, .96));
  border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { width: 38px; height: auto; image-rendering: pixelated; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .35)); }
.brand b { display: block; font-size: 17px; font-weight: 900; letter-spacing: .06em; }
.brand small { display: block; margin-top: -2px; color: var(--accent2); font-size: 11px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: 9px;
  color: var(--muted); font-weight: 700;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.nav a:hover { background: rgba(255, 255, 255, .05); color: var(--text); text-decoration: none; }
.nav a.on { background: linear-gradient(90deg, rgba(248, 120, 48, .18), rgba(248, 120, 48, .04)); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav .badge { margin-left: auto; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 12px 6px 0; border-top: 1px solid var(--line); font-size: 13px; }
.src-line { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.src-line b { color: var(--text); font-weight: 700; }
.live-state { display: flex; align-items: center; gap: 8px; color: var(--dim); font-size: 12px; }

.main { min-width: 0; padding: 22px 28px 60px; }
.top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.top h1 { margin: 0; font-size: 24px; font-weight: 900; letter-spacing: -.01em; }
.top .sub { color: var(--muted); font-size: 14px; }
.top .spacer { flex: 1; }
.menu-btn { display: none; }

/* ── karty ─────────────────────────────────────────────── */
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-kpi { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.g-auto { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.g-gates { grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); }
.span2 { grid-column: span 2; }
.card {
  position: relative; min-width: 0;
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  animation: rise .35s var(--ease) both;
}
.card h2, .card h3 { margin: 0 0 10px; font-size: 15px; font-weight: 900; letter-spacing: .01em; display: flex; align-items: center; gap: 8px; }
.card h2 .muted, .card h3 .muted { font-weight: 700; font-size: 13px; }
.card .head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.card .head h2, .card .head h3 { margin: 0; }
.card .head .spacer { flex: 1; }
.section-title { margin: 26px 0 10px; font-size: 13px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.kpi { padding: 14px 16px; }
.kpi .label { color: var(--muted); font-size: 12.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.kpi .value { margin-top: 2px; font-size: 30px; font-weight: 900; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi .foot { margin-top: 2px; color: var(--dim); font-size: 12.5px; }
.kpi.accent-bad .value { color: var(--bad); }
.kpi.accent-warn .value { color: var(--warn); }
.kpi.accent-ok .value { color: var(--ok); }

/* stan usług */
.svc { display: flex; gap: 12px; align-items: flex-start; }
.svc .dot { margin-top: 7px; }
.svc b { display: block; font-weight: 900; }
.svc .meta { color: var(--muted); font-size: 13px; }

/* ── drobne elementy ───────────────────────────────────── */
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--dim); box-shadow: 0 0 0 3px rgba(255, 255, 255, .04); }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(88, 208, 128, .15); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px rgba(248, 200, 48, .15); }
.dot.bad { background: var(--bad); box-shadow: 0 0 0 3px rgba(248, 88, 56, .18); animation: pulse 2s ease-in-out infinite; }
.dot.info { background: var(--info); }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(248, 88, 56, .05); } }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 1px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 800; line-height: 20px; white-space: nowrap;
  background: rgba(255, 255, 255, .07); color: var(--muted);
}
.badge.ok { background: rgba(88, 208, 128, .14); color: #8EEAAE; }
.badge.warn, .badge.watch { background: rgba(248, 200, 48, .14); color: #FADB6E; }
.badge.bad, .badge.block { background: rgba(248, 88, 56, .16); color: #FF9A84; }
.badge.info { background: rgba(136, 208, 248, .14); color: #B4E2FB; }
.badge.accent { background: rgba(248, 120, 48, .18); color: var(--accent2); }
.badge.sev-critical { background: rgba(255, 77, 122, .2); color: #FF9DB5; }
.badge.sev-high { background: rgba(248, 88, 56, .18); color: #FF9A84; }
.badge.sev-medium { background: rgba(248, 160, 48, .18); color: #FFC47F; }
.badge.sev-low { background: rgba(248, 200, 48, .14); color: #FADB6E; }
.badge.sev-info { background: rgba(136, 208, 248, .14); color: #B4E2FB; }
.badge.src-site { background: rgba(136, 208, 248, .12); color: #B4E2FB; }
.badge.src-launcher { background: rgba(160, 130, 255, .16); color: #CDBEFF; }
.badge.src-guard { background: rgba(248, 120, 48, .14); color: var(--accent2); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 36px; padding: 6px 14px;
  border: 1px solid var(--line2); border-radius: 9px;
  background: var(--panel3); color: var(--text);
  font-weight: 800; font-size: 14px; cursor: pointer;
  transition: background .18s var(--ease), border-color .18s var(--ease), transform .12s var(--ease), opacity .18s;
}
.btn:hover { background: #253B80; border-color: #3E5AA8; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: linear-gradient(180deg, #FF8A40, #E8641C); border-color: #FF9B5A; color: #fff; }
.btn.primary:hover { background: linear-gradient(180deg, #FF9750, #F06E24); }
.btn.danger { background: rgba(248, 88, 56, .14); border-color: rgba(248, 88, 56, .45); color: #FFB3A3; }
.btn.danger:hover { background: rgba(248, 88, 56, .24); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: rgba(255, 255, 255, .05); color: var(--text); }
.btn.small { min-height: 28px; padding: 3px 10px; font-size: 13px; border-radius: 7px; }
.btn svg { width: 16px; height: 16px; }

.input, select.input, textarea.input {
  width: 100%; min-height: 38px; padding: 7px 11px;
  background: var(--bg2); border: 1px solid var(--line2); border-radius: 9px;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(248, 120, 48, .18); }
textarea.input { min-height: 110px; resize: vertical; font-family: var(--mono); font-size: 13px; }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 800; color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 160px; }
.row > select.input { width: auto; min-width: 150px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--muted); cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }

.seg { display: inline-flex; padding: 3px; gap: 3px; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; }
.seg button {
  border: 0; background: transparent; color: var(--muted);
  padding: 5px 12px; border-radius: 7px; font-weight: 800; font-size: 13px; cursor: pointer;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--panel3); color: var(--text); box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset; }
.seg button.on.m-off { background: #2A3558; }
.seg button.on.m-watch { background: rgba(248, 200, 48, .22); color: #FFE08A; }
.seg button.on.m-block { background: rgba(248, 88, 56, .26); color: #FFC0B2; }

/* ── tabele ────────────────────────────────────────────── */
.tbl-wrap { overflow: auto; border-radius: var(--radius-s); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th {
  position: sticky; top: 0; z-index: 1;
  padding: 8px 10px; text-align: left; white-space: nowrap;
  background: var(--panel); color: var(--dim);
  font-size: 12px; font-weight: 900; letter-spacing: .05em; text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}
.tbl td { padding: 8px 10px; border-bottom: 1px solid rgba(36, 56, 111, .6); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .15s var(--ease); }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover { background: rgba(255, 255, 255, .035); }
.tbl .r { text-align: right; }
.tbl td.msg { max-width: 520px; overflow-wrap: anywhere; }
.tbl tr.fresh { animation: flash 1.6s var(--ease); }
@keyframes flash { from { background: rgba(248, 120, 48, .16); } to { background: transparent; } }
.empty { padding: 22px; text-align: center; color: var(--dim); }

/* ── wykresy, paski ─────────────────────────────────────── */
.chart { width: 100%; height: 190px; display: block; }
.chart .grid-line { stroke: rgba(163, 176, 214, .12); stroke-width: 1; }
.chart .axis { fill: var(--dim); font-size: 11px; font-family: 'Nunito', sans-serif; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.spark { width: 100%; height: 36px; display: block; }

.meter { position: relative; height: 10px; border-radius: 6px; background: #0B1433; border: 1px solid #22356A; overflow: hidden; }
.meter i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 5px; background: linear-gradient(180deg, #7FE3A0, var(--ok)); transition: width .6s var(--ease); }
.meter.mid i { background: linear-gradient(180deg, #FBE08A, var(--warn)); }
.meter.hi i { background: linear-gradient(180deg, #FF9A84, var(--bad)); }
.fill-row { display: grid; grid-template-columns: minmax(90px, 170px) minmax(0, 1fr) 70px; gap: 10px; align-items: center; font-size: 13px; padding: 3px 0; }
.fill-row .k { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.funnel { display: flex; flex-direction: column; gap: 10px; }
.funnel .stage { display: grid; grid-template-columns: 190px minmax(0, 1fr) 150px; gap: 12px; align-items: center; }
.funnel .bar { height: 26px; border-radius: 7px; background: #0B1433; border: 1px solid #22356A; overflow: hidden; position: relative; }
.funnel .bar i { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, #E8641C, #FFA25C); border-radius: 6px; transition: width .8s var(--ease); }
.funnel .bar span { position: absolute; left: 10px; top: 0; line-height: 26px; font-weight: 900; font-size: 13px; text-shadow: 0 1px 2px rgba(0, 0, 0, .45); }
.funnel .lbl { font-weight: 800; }
.funnel .side-note { font-size: 12.5px; color: var(--muted); }

/* ── bramy ──────────────────────────────────────────────── */
.gate { display: flex; flex-direction: column; gap: 12px; }
.gate .top-row { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.gate .title { flex: 1 1 260px; min-width: 0; }
.gate .title b { font-size: 16px; font-weight: 900; }
.gate .title p { margin: 3px 0 0; color: var(--muted); font-size: 13.5px; }
.gate .stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.gate .stat { padding: 7px 9px; border-radius: 8px; background: rgba(10, 18, 48, .45); border: 1px solid rgba(36, 56, 111, .7); }
.gate .stat small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--dim); font-size: 12px; font-weight: 800; }
.gate .stat b { font-size: 18px; font-weight: 900; font-variant-numeric: tabular-nums; }
.gate .stat.w b { color: var(--warn); }
.gate .stat.b b { color: var(--bad); }
.gate details { border-top: 1px solid var(--line); padding-top: 10px; }
.gate summary { cursor: pointer; color: var(--muted); font-weight: 800; font-size: 13.5px; }
.gate .params { display: grid; gap: 10px; margin-top: 10px; }
.gate .hits { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.gate .hits .hit { display: grid; grid-template-columns: 82px 46px minmax(0, 130px) minmax(0, 110px) minmax(0, 1fr); gap: 8px; align-items: baseline; }
.gate .hits .hit > * { overflow-wrap: anywhere; }
.mode-note { font-size: 12.5px; color: var(--dim); }

/* ── ludzie / profil ────────────────────────────────────── */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tabs button {
  border: 0; background: transparent; color: var(--muted);
  padding: 9px 14px; font-weight: 800; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .18s var(--ease), border-color .18s var(--ease);
}
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, .06); border: 1px solid var(--line2);
  font-size: 13px; font-weight: 700; color: var(--text); cursor: pointer;
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
.chip:hover { background: rgba(248, 120, 48, .12); border-color: rgba(248, 120, 48, .5); text-decoration: none; }
.chip small { color: var(--dim); font-weight: 700; }
.chip.flag-banned { border-color: rgba(248, 88, 56, .6); background: rgba(248, 88, 56, .12); }
.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--dim); font-weight: 800; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.profile-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.profile-head .who { font-size: 22px; font-weight: 900; overflow-wrap: anywhere; }
.kind-tag { color: var(--accent2); font-size: 12px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }

/* ── szuflada, okno, powiadomienia ─────────────────────── */
.drawer-back { position: fixed; inset: 0; background: rgba(3, 8, 28, .5); opacity: 0; transition: opacity .22s var(--ease); z-index: 40; }
.drawer-back.show { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); z-index: 41;
  background: var(--panel); border-left: 1px solid var(--line2); box-shadow: -20px 0 50px rgba(3, 8, 28, .5);
  padding: 20px 22px; overflow: auto;
  transform: translateX(100%); transition: transform .28s var(--ease);
}
.drawer.show { transform: none; }
.drawer h2 { margin: 0 0 12px; font-size: 18px; font-weight: 900; }
pre.json { margin: 0; padding: 10px 12px; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; overflow-wrap: anywhere; color: #CFE0FF; }

.modal-back { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(3, 8, 28, .6); animation: fade .2s var(--ease); padding: 16px; }
.modal { width: min(460px, 100%); background: var(--panel2); border: 1px solid var(--line2); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); animation: rise .25s var(--ease); }
.modal h3 { margin: 0 0 8px; font-size: 18px; font-weight: 900; }
.modal p { margin: 0 0 16px; color: var(--muted); }
.modal .row { justify-content: flex-end; }
@keyframes fade { from { opacity: 0; } }

.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 70; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto; max-width: 380px;
  padding: 10px 14px; border-radius: 10px; font-weight: 700; font-size: 14px;
  background: var(--panel3); border: 1px solid var(--line2); box-shadow: var(--shadow);
  animation: toast-in .3s var(--ease);
}
.toast.ok { border-color: rgba(88, 208, 128, .5); }
.toast.bad { border-color: rgba(248, 88, 56, .6); }
.toast.alert { border-color: rgba(248, 120, 48, .7); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.loading { padding: 40px; text-align: center; color: var(--dim); }
.loading::before { content: ''; display: inline-block; width: 16px; height: 16px; margin-right: 10px; vertical-align: -3px; border: 2px solid var(--line2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.err-box { padding: 14px 16px; border-radius: 10px; background: rgba(248, 88, 56, .1); border: 1px solid rgba(248, 88, 56, .4); color: #FFC0B2; }
.note-box { padding: 12px 14px; border-radius: 10px; background: rgba(136, 208, 248, .08); border: 1px solid rgba(136, 208, 248, .3); color: #CFEAFB; font-size: 14px; }
code { font-family: var(--mono); font-size: .92em; background: rgba(255, 255, 255, .06); padding: 1px 5px; border-radius: 5px; }

/* ── logowanie ─────────────────────────────────────────── */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth .card { width: min(400px, 100%); padding: 26px 26px 22px; }
.auth .brand { justify-content: center; padding-bottom: 18px; }
.auth .brand img { width: 52px; }
.auth form { display: flex; flex-direction: column; gap: 14px; }
.auth .msg { min-height: 20px; font-size: 14px; font-weight: 700; color: #FF9A84; }
.auth .hint { margin: 0; color: var(--dim); font-size: 13px; text-align: center; }

/* ── mniejsze ekrany ───────────────────────────────────── */
@media (max-width: 1200px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 50; left: 0; width: 250px; transform: translateX(-100%); transition: transform .25s var(--ease); }
  .side.open { transform: none; box-shadow: 20px 0 50px rgba(3, 8, 28, .5); }
  .menu-btn { display: inline-flex; }
  .main { padding: 16px 16px 60px; }
  .g2, .g3, .g4, .g-gates { grid-template-columns: 1fr; }
  .gate .hits .hit { grid-template-columns: 70px 46px minmax(0, 1fr); }
  .gate .hits .hit > :nth-child(4) { display: none; }
  .span2 { grid-column: auto; }
  .funnel .stage { grid-template-columns: 1fr; gap: 4px; }
  .gate .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kv { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
