/* ============================================================
   Panel Antyspam — wspólne style (wg makiet design/*.dc.html)
   Jasny motyw · IBM Plex Sans / IBM Plex Mono
   ============================================================ */

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: #f4f4f1;
  color: #0b0b0b;
  font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  font-size: 13.5px;
}

a { color: #256abf; text-decoration: none; }
a:hover { color: #1c5cab; }

.mono { font-family: 'IBM Plex Mono', Consolas, 'Courier New', monospace; }

/* ---------- Układ strony ---------- */

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: #0d1b2a;
  color: #e8eef5;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  padding: 18px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 11px;
}
.brand-name { font-weight: 700; font-size: 12px; letter-spacing: 0.05em; color: #e8eef5; white-space: nowrap; }
.brand-host { font-size: 10.5px; color: #7d93a8; }

.nav { padding: 12px 0; display: flex; flex-direction: column; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  font-size: 13.5px;
  color: #a9bccd;
  border-left: 3px solid transparent;
}
a.nav-item:hover { color: #dce7f2; }
.nav-item.active {
  color: #ffffff;
  background: rgba(57,135,229,0.14);
  border-left-color: #3987e5;
  font-weight: 600;
}
.nav-item.nav-off { opacity: 0.45; cursor: default; }
.nav-spacer { flex: 1; }

/* podmenu (grupa nawigacji z pozycjami potomnymi) */
.nav-group {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px 5px;
  font-size: 13.5px;
  color: #7d93a8;
}
.nav-item.nav-child {
  padding: 8px 20px 8px 37px;
  font-size: 13px;
}

.user {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #25415c;
  color: #cfe1f3;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  flex-shrink: 0;
}
.user-name { font-size: 12.5px; font-weight: 600; }
.user-role { font-size: 11px; color: #7d93a8; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 60px;
  flex-shrink: 0;
  background: #fcfcfb;
  border-bottom: 1px solid rgba(11,11,11,0.10);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.page-title { font-size: 17px; font-weight: 600; }
.topbar-spacer { flex: 1; }

.content {
  flex: 1;
  padding: 20px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* ---------- Elementy wspólne ---------- */

.card {
  background: #fcfcfb;
  border: 1px solid rgba(11,11,11,0.10);
  border-radius: 8px;
}
.card-title { font-size: 14px; font-weight: 600; }
.card-sub { font-size: 11.5px; color: #898781; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  padding: 0 14px;
  height: 32px;
  border-radius: 999px;
  background: #fcfcfb;
  border: 1px solid rgba(11,11,11,0.10);
  color: #52514e;
  white-space: nowrap;
}

.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.b-rspamd { background: #e8f0fb; color: #1c5cab; }
.b-pmg    { background: #efe9fb; color: #5b3ba8; }
.b-typ    { background: #f0efec; color: #52514e; }
.b-cert   { background: #e2f5ee; color: #0c6b4b; }
.b-ok     { background: #e3f4e3; color: #006300; }
.b-warn   { background: #fdf3d7; color: #7a5c00; }
.b-info   { background: #e8f0fb; color: #1c5cab; }
.b-err    { background: #fbe7e7; color: #8f1d1d; }
.b-muted  { background: #f0efec; color: #898781; }

.mini {
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  background: #f0efec;
  color: #52514e;
}

.muted { color: #898781; }
.sec { color: #52514e; }

/* ---------- Przyciski i formularze ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn-primary { background: #256abf; color: #ffffff; }
.btn-primary:hover { background: #1c5cab; }
.btn-ghost { background: #fcfcfb; color: #0b0b0b; border: 1px solid rgba(11,11,11,0.14); }
.btn-ghost:hover { background: #f0efec; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  border-radius: 4px;
}
.icon-btn:hover { background: #f0efec; }

.input {
  height: 38px;
  border: 1px solid rgba(11,11,11,0.16);
  border-radius: 6px;
  background: #ffffff;
  padding: 0 12px;
  font-size: 13px;
  font-family: inherit;
  color: #0b0b0b;
}
.input:focus, .search:focus-within {
  outline: none;
  border-color: #256abf;
  box-shadow: 0 0 0 3px rgba(37,106,191,0.14);
}
.input::placeholder { color: #898781; }
select.input { cursor: pointer; }

.search { display: flex; align-items: center; gap: 8px; }
.search input {
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  flex: 1;
  min-width: 0;
  padding: 0;
  height: 100%;
  color: #0b0b0b;
}
.search input::placeholder { color: #898781; }

.field-label {
  font-size: 12px;
  font-weight: 600;
  color: #52514e;
  display: block;
  margin-bottom: 6px;
}

/* przełącznik (toggle) — mały formularz POST z buttonem */
.tgl {
  width: 36px; height: 20px;
  border-radius: 999px;
  position: relative;
  display: inline-block;
  border: none;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
}
.tgl-on  { background: #256abf; }
.tgl-off { background: #c3c2b7; }
.knob-on  { position: absolute; top: 2.5px; right: 2.5px; width: 15px; height: 15px; border-radius: 50%; background: #ffffff; }
.knob-off { position: absolute; top: 2.5px; left: 2.5px;  width: 15px; height: 15px; border-radius: 50%; background: #ffffff; }

/* segment Czarna/Biała */
.seg {
  display: inline-flex;
  border: 1px solid rgba(11,11,11,0.16);
  border-radius: 6px;
  overflow: hidden;
  height: 38px;
  flex-shrink: 0;
}
.seg-opt {
  display: flex;
  align-items: center;
  padding: 0 14px;
  font-size: 12.5px;
  font-weight: 600;
  background: #ffffff;
  color: #52514e;
  cursor: pointer;
  position: relative;
}
.seg-opt + .seg-opt { border-left: 1px solid rgba(11,11,11,0.10); }
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt:has(input:checked) { background: #2b2a27; color: #ffffff; }

/* przełącznik zakresu (statystyki) */
.rng-group {
  display: inline-flex;
  border: 1px solid rgba(11,11,11,0.14);
  border-radius: 6px;
  overflow: hidden;
}
.rng {
  display: flex;
  align-items: center;
  height: 36px;
  padding: 0 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: #52514e;
  background: #ffffff;
}
.rng + .rng { border-left: 1px solid rgba(11,11,11,0.10); }
a.rng:hover { color: #0b0b0b; }
.rng.active { background: #2b2a27; color: #ffffff; }
a.rng.active:hover { color: #ffffff; }

/* karty wyboru typu serwera */
.kind-card {
  border: 1px solid rgba(11,11,11,0.14);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  gap: 10px;
  cursor: pointer;
  position: relative;
}
.kind-card input { position: absolute; opacity: 0; pointer-events: none; }
.kind-card:has(input:checked) { border: 1.5px solid #256abf; background: #f4f8fd; }
.kind-title { font-size: 13px; font-weight: 600; }
.kind-desc { font-size: 11.5px; color: #52514e; margin-top: 3px; }
.radio {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid #c3c2b7;
  flex-shrink: 0;
  margin-top: 1px;
  position: relative;
}
.kind-card:has(input:checked) .radio { border-color: #256abf; }
.kind-card:has(input:checked) .radio::after {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: #256abf;
}

/* wysuwana sekcja formularza dodawania */
.drawer { display: none; }
.drawer.open { display: block; }

/* ---------- Tabele ---------- */

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #898781;
  font-weight: 600;
  padding: 10px 16px;
  border-bottom: 1px solid #e1e0d9;
  white-space: nowrap;
}
.tbl td {
  padding: 9px 16px;
  border-bottom: 1px solid #eceae4;
  vertical-align: middle;
}
.tbl tbody tr:last-child td { border-bottom: none; }
.td-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.tbl-card { overflow-x: auto; }

/* ---------- Zakładki ---------- */

.tabs {
  display: flex;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid #e1e0d9;
}
.tab {
  font-size: 13.5px;
  font-weight: 600;
  color: #52514e;
  padding: 10px 2px;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -1px;
}
a.tab:hover { color: #0b0b0b; }
.tab.active { color: #0b0b0b; border-bottom-color: #256abf; }

/* ---------- Pulpit ---------- */

.kpi-label { font-size: 12px; color: #52514e; }
.kpi-value { font-size: 29px; font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12px; color: #52514e; margin-top: 4px; }
.delta-down { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: #006300; font-weight: 600; margin-top: 4px; }
.delta-up   { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: #a11d1d; font-weight: 600; margin-top: 4px; }

.evt {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #eceae4;
  align-items: flex-start;
}
.evt:last-child { border-bottom: none; }
.evt-ic {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.evt-msg { font-size: 12.5px; line-height: 1.35; }
.evt-meta { font-size: 11px; color: #898781; margin-top: 2px; }

.srv-row { display: flex; align-items: center; gap: 7px; font-size: 12px; color: #52514e; }
.srv-val { font-size: 12.5px; font-weight: 600; color: #0b0b0b; font-variant-numeric: tabular-nums; }

.add-tile {
  border: 1.5px dashed rgba(11,11,11,0.18);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #898781;
  font-size: 12.5px;
  font-weight: 600;
  min-height: 76px;
}
a.add-tile:hover { color: #52514e; border-color: rgba(11,11,11,0.32); }

/* siatki */
.grid-kpi5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.grid-kpi4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.grid-main { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.grid-srv  { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.grid-sync { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; }

/* ---------- Statusy przy serwerach ---------- */

.st-on { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; }
.sync { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: #52514e; }
.sync-ok { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #52514e; }

/* ---------- Miniaturowe paski (statystyki) ---------- */

.mrow { display: flex; align-items: baseline; gap: 8px; }
.mtrack { height: 4px; border-radius: 2px; background: #f0efec; margin-top: 5px; }
.mfill { height: 4px; border-radius: 2px; background: #6da7ec; }
.mval { font-size: 12px; color: #52514e; font-variant-numeric: tabular-nums; }

/* poziome słupki per serwer */
.bar-row { display: flex; align-items: center; gap: 12px; }
.bar-label {
  width: 200px;
  flex-shrink: 0;
  text-align: right;
  font-size: 11px;
  color: #0b0b0b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-track { flex: 1; border-left: 1px solid #c3c2b7; padding-left: 0; min-width: 0; }
.bar-fill {
  height: 18px;
  background: #2a78d6;
  border-radius: 0 4px 4px 0;
  min-width: 2px;
}
.bar-val {
  width: 72px;
  flex-shrink: 0;
  font-size: 11.5px;
  color: #52514e;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

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

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
}
.flash svg { flex-shrink: 0; }
.flash-ok  { background: #e3f4e3; border: 1px solid rgba(0,99,0,0.25); color: #006300; }
.flash-err { background: #fbe7e7; border: 1px solid rgba(143,29,29,0.25); color: #8f1d1d; }

.empty {
  padding: 34px 20px;
  text-align: center;
  color: #898781;
  font-size: 13px;
  line-height: 1.5;
}

.footnote { font-size: 11.5px; color: #898781; }

/* ---------- Responsywność ---------- */

@media (max-width: 1320px) {
  .grid-kpi5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-srv { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1080px) {
  .grid-main, .grid-sync { grid-template-columns: 1fr; }
  .grid-kpi4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-srv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* mobil: menu wysuwane hamburgerem zamiast ukrytego paska */
.nav-toggle { display: none; }
.nav-backdrop { display: none; }
@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    top: 0; bottom: 0; left: -280px;
    width: 260px;
    z-index: 60;
    transition: left 0.22s ease;
    overflow-y: auto;
    box-shadow: 2px 0 18px rgba(0,0,0,0.35);
  }
  body.nav-open .sidebar { left: 0; }
  .nav-backdrop {
    position: fixed; inset: 0; z-index: 50;
    background: rgba(13,27,42,0.45);
  }
  body.nav-open .nav-backdrop { display: block; }
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; margin-right: 10px; flex-shrink: 0;
    border: 1px solid #e4e2dd; border-radius: 8px; background: #ffffff; cursor: pointer;
  }
  .grid-kpi5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main, .grid-sync { grid-template-columns: 1fr; }
  .grid-srv { grid-template-columns: 1fr; }
  .grid-collapse { grid-template-columns: minmax(0, 1fr) !important; }
  .topbar { flex-wrap: wrap; gap: 6px; }
}
