:root {
  --bg: #1a1d21;
  --panel: #22262b;
  --cyan: #7aa2c4;
  --red: #d16b6b;
  --red-dim: rgba(209, 107, 107, 0.22);
  --amber: #c4a35a;
  --green: #9db89a;
  --text: #e6e8eb;
  --muted: #8b939c;
  --line: #2e343c;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; background: var(--bg); color: var(--text); font-family: var(--sans); }
body { display: flex; flex-direction: column; min-height: 100vh; }
html.login, body.login { overflow: auto; }

.topbar {
  height: 64px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; border-bottom: 1px solid var(--line); background: #1e2227; position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.brand-mark { width: 40px; height: 40px; border-radius: 8px; }
.brand h1 { font-size: 17px; font-weight: 600; }
.brand .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.nav { display: flex; gap: 6px; margin-left: 18px; }
.nav-link {
  color: var(--muted); text-decoration: none; font-size: 13px; padding: 6px 10px; border-radius: 4px;
}
.nav-link.on, .nav-link:hover { color: var(--text); background: var(--panel); }
.status-cluster { display: flex; align-items: center; gap: 10px; }
.pill {
  border: 1px solid var(--line); background: var(--bg); border-radius: 4px;
  padding: 5px 10px; font-size: 12px; color: var(--muted);
}
.pill.live { color: var(--green); border-color: #3a4a3a; }
.clock { font-family: var(--mono); font-size: 14px; min-width: 72px; text-align: right; }
.logout-bar { display: inline; }
.logout-bar button { cursor: pointer; font-family: inherit; }

.login-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 16px; }
.login-card {
  width: min(400px, 92vw); background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 28px 24px;
}
.login-card h2 { font-size: 18px; margin-bottom: 6px; }
.login-card p { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.login-card label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 6px; }
.login-card input {
  width: 100%; padding: 9px 10px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: inherit;
}
.login-btn, .btn {
  font: inherit; font-weight: 600; font-size: 13px; cursor: pointer;
  border: 1px solid var(--red); background: var(--red); color: #faf6f5;
  padding: 8px 12px; border-radius: 6px;
}
.login-btn { width: 100%; margin-top: 18px; padding: 10px; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-row { padding: 4px 8px; font-size: 12px; }
.login-err, .err {
  background: var(--red-dim); color: var(--red); padding: 8px 10px; border-radius: 6px; margin-bottom: 12px; font-size: 13px;
}

.wrap { width: min(1500px, calc(100% - 2rem)); margin: 0 auto; padding: 1.2rem 0 3rem; flex: 1; }
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 16px;
}
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.stat .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-size: 22px; font-weight: 600; font-family: var(--mono); margin-top: 4px; }
.stat.high .v { color: var(--red); }
.stat.med .v { color: var(--amber); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.toolbar label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.toolbar select, .toolbar input {
  background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 4px;
  padding: 5px 8px; font: inherit; font-size: 13px;
}
.lede { color: var(--muted); font-size: 13px; margin-bottom: 12px; }

.table-scroll { overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td {
  text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line); vertical-align: top;
  overflow-wrap: break-word; line-height: 1.35;
}
th {
  color: var(--muted); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .03em;
  position: sticky; top: 0; background: #252a30; white-space: nowrap;
}
td.mono, .mono { font-family: var(--mono); font-size: 12px; }
.when { max-width: 8.2rem; min-width: 7rem; }
.kind { font-family: var(--mono); font-size: 12px; min-width: 8.2rem; max-width: 10rem; }
td.ip-cell { white-space: nowrap; }
.clip { min-width: 9rem; max-width: 14rem; }
.clip-from { min-width: 7rem; max-width: 11rem; }
.clip-to { min-width: 8rem; max-width: 12rem; }
.clip-text {
  display: block;
  overflow-wrap: anywhere;
  white-space: normal;
}
.mail-list { display: flex; flex-direction: column; gap: 6px; }
.mail { display: block; overflow-wrap: anywhere; }
.mail-local { color: var(--text); }
.mail-dom { display: block; color: var(--cyan); }
.geo-ext {
  display: inline-flex;
  align-items: center;
  margin-left: 5px;
  color: var(--muted);
  text-decoration: none;
  vertical-align: -1px;
}
.geo-ext:hover,
.geo-ext:focus-visible { color: var(--cyan); }
.geo-ext-icon { display: block; }
.auth-h, .auth-cell {
  width: 0;
  max-width: 3.4rem;
  white-space: nowrap;
  padding-left: 4px;
  padding-right: 4px;
}
.auth-h { letter-spacing: 0; font-size: 10px; }
.auth { display: inline-flex; align-items: center; gap: 3px; }
.auth-item {
  display: inline-flex;
  color: var(--muted);
  line-height: 0;
  cursor: help;
}
.auth-item.pass { color: var(--green); }
.auth-item.fail { color: var(--red); }
.auth-item.soft, .auth-item.other { color: var(--amber); }
.auth-item.none, .auth-item.neutral { color: var(--muted); }
.auth-icon { display: block; }
.hover-tip {
  position: fixed;
  z-index: 80;
  max-width: 16rem;
  padding: 5px 8px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: #2a3038;
  color: var(--text);
  font-size: 12px;
  line-height: 1.3;
  box-shadow: 0 8px 20px rgba(0,0,0,.35);
  pointer-events: none;
}
.sev-h, .sev-cell { width: 0; white-space: nowrap; }
.sev {
  display: inline-block;
  width: calc(4.8rem - 10px);
  padding: 2px 0;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  white-space: nowrap;
  text-align: center;
}
.sev.high { background: var(--red-dim); color: var(--red); }
.sev.medium { background: rgba(196,163,90,.2); color: var(--amber); }
.sev.low { background: rgba(122,162,196,.18); color: var(--cyan); }
.yes { color: var(--red); }
.no { color: var(--muted); }
.onf { color: var(--green); font-size: 11px; }
.onf-widen { color: var(--cyan); }
.row-widen td { background: rgba(122, 162, 196, 0.05); }
.row-widen td:first-child { box-shadow: inset 3px 0 0 var(--cyan); }
.widen-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(122, 162, 196, 0.45);
  background: rgba(122, 162, 196, 0.16);
  color: var(--cyan);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  vertical-align: middle;
}
.filter-table td {
  vertical-align: middle;
  padding: 8px 8px 6px;
}
.filter-table th { padding: 8px; }
td.filter-value { white-space: nowrap; }
.muted { color: var(--muted); }
.reason { min-width: 11rem; max-width: 16rem; color: var(--muted); }
td.actions {
  width: 1%;
  vertical-align: top;
}
.action-btns {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}
.action-btns .btn-row {
  width: 3.7rem;
  min-width: 3.7rem;
  padding: 4px 0;
  text-align: center;
}
.btn.on {
  background: var(--red);
  border-color: var(--red);
  color: #faf6f5;
}
.btn-ghost.on {
  background: rgba(209, 107, 107, 0.28);
  border-color: var(--red);
  color: var(--text);
}
th.acts-h, td.filter-acts {
  width: 1%;
  white-space: nowrap;
}
td.filter-created { white-space: nowrap; }
.filter-act-btns {
  display: flex;
  flex-direction: row;
  gap: 4px;
  align-items: center;
  justify-content: flex-end;
}
.filter-act-btns .btn-row {
  width: 4.4rem;
  min-width: 4.4rem;
  padding: 4px 0;
  text-align: center;
}
.empty { padding: 28px; text-align: center; color: var(--muted); }

.filter-form { display: grid; grid-template-columns: 120px 1fr 1fr auto; gap: 8px; margin-bottom: 16px; }
@media (max-width: 720px) {
  .filter-form { grid-template-columns: 1fr; }
  .nav { display: none; }
}
