/* ============================================================
   navimon — Brand Threat Console (dark SOC theme)
   ============================================================ */
:root {
  --bg: #0a0e14;
  --bg-2: #0e131c;
  --panel: #121824;
  --panel-2: #161d2b;
  --border: #212a3a;
  --border-2: #2b3650;
  --text: #e6edf3;
  --muted: #8b98ad;
  --faint: #5c6a80;
  --accent: #22d3ee;
  --accent-dim: #0e7490;
  --risk-high: #ff5c6c;
  --risk-high-bg: #351119;
  --risk-med: #f4b740;
  --risk-med-bg: #332810;
  --risk-low: #39d98a;
  --risk-low-bg: #0f2a1f;
  --live: #39d98a;
  --dead: #44506a;
  --official: #58a6ff;
  --official-bg: #0d2440;
  --shadow: 0 1px 3px rgba(0,0,0,.5), 0 8px 24px rgba(0,0,0,.35);
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, monospace; }

/* ---------- App shell: sidebar + main ---------- */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

.sidebar {
  background: linear-gradient(180deg, #0c111a, #0a0e14);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  background: radial-gradient(circle at 30% 30%, #22d3ee, #0e7490);
  box-shadow: 0 0 14px rgba(34,211,238,.5);
}
.brand .name { font-weight: 700; letter-spacing: .04em; font-size: 15px; }
.brand .sub { color: var(--faint); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }

.navlink {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 8px;
  color: var(--muted); font-weight: 500; font-size: 13.5px;
}
.navlink:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.navlink.active { background: var(--panel-2); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.navlink .ic { width: 17px; text-align: center; opacity: .85; }
.sidebar .spacer { flex: 1; }
.sidebar .user { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 10px; color: var(--muted); font-size: 12.5px; }
.sidebar .user b { color: var(--text); display: block; font-size: 13px; }
.btn-logout { background: none; border: 0; color: var(--faint); font: inherit; cursor: pointer; padding: 6px 0 0; }
.btn-logout:hover { color: var(--risk-high); }

/* ---------- Main ---------- */
.main { min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 28px; border-bottom: 1px solid var(--border);
  background: rgba(10,14,20,.8); backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 18px; margin: 0; font-weight: 650; }
.topbar .live-dot { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.topbar .live-dot i { width: 8px; height: 8px; border-radius: 50%; background: var(--live); box-shadow: 0 0 8px var(--live); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.35} }
.topbar .grow { flex: 1; }
.content { padding: 22px 28px 60px; }

/* ---------- KPI tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi {
  background: linear-gradient(160deg, var(--panel), var(--bg-2));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px 17px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi::after { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--kpi-accent, var(--accent)); opacity: .8; }
.kpi .v { font-size: 30px; font-weight: 700; line-height: 1; letter-spacing: -.02em; }
.kpi .l { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; margin-top: 7px; }
.kpi.k-high { --kpi-accent: var(--risk-high); }
.kpi.k-live { --kpi-accent: var(--live); }
.kpi.k-new  { --kpi-accent: var(--accent); }
.kpi.k-off  { --kpi-accent: var(--official); }

/* ---------- Panel + toolbar ---------- */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.toolbar .title { font-weight: 600; margin-right: 6px; }
.search { position: relative; flex: 1; min-width: 180px; max-width: 360px; }
.search input { width: 100%; padding: 8px 12px 8px 32px; background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 8px; color: var(--text); font: inherit; }
.search input:focus { outline: none; border-color: var(--accent-dim); box-shadow: 0 0 0 2px rgba(34,211,238,.18); }
.search::before { content: "⌕"; position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); }
select.filter { background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 8px; color: var(--text); font: inherit; padding: 8px 10px; }
select.filter:focus { outline: none; border-color: var(--accent-dim); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border-2); background: var(--panel-2); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; }
.btn:hover { border-color: var(--accent-dim); background: var(--panel); text-decoration: none; }
.btn-primary { background: linear-gradient(180deg, #22d3ee, #0ea5c4); border-color: #0891b2; color: #04222b; font-weight: 650; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-ghost { background: none; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--panel-2); }
.btn-danger:hover { border-color: var(--risk-high); color: var(--risk-high); }
form.inline { display: inline; }

/* ---------- Data table ---------- */
.tablewrap { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: 13px; }
table.data thead th {
  text-align: left; padding: 10px 14px; color: var(--muted);
  font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  background: var(--bg-2); border-bottom: 1px solid var(--border); white-space: nowrap;
  position: sticky; top: 0;
}
table.data thead th.sortable { cursor: pointer; user-select: none; }
table.data thead th.sortable:hover { color: var(--text); }
table.data thead th .car { opacity: .4; font-size: 9px; }
table.data tbody td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr:hover { background: var(--panel-2); }
table.data tbody tr.official { opacity: .72; }
table.data tbody tr.unreg { opacity: .55; }
.empty { padding: 40px; text-align: center; color: var(--faint); }

/* risk pill */
.risk { display: inline-block; min-width: 34px; text-align: center; padding: 3px 8px; border-radius: 6px; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 12px; }
.risk.hi { color: var(--risk-high); background: var(--risk-high-bg); box-shadow: inset 0 0 0 1px rgba(255,92,108,.3); }
.risk.md { color: var(--risk-med); background: var(--risk-med-bg); box-shadow: inset 0 0 0 1px rgba(244,183,64,.3); }
.risk.lo { color: var(--risk-low); background: var(--risk-low-bg); box-shadow: inset 0 0 0 1px rgba(57,217,138,.25); }
.risk.na { color: var(--faint); background: var(--bg-2); }

/* dots / chips / badges */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: middle; }
.dot.on { background: var(--live); box-shadow: 0 0 7px rgba(57,217,138,.6); }
.dot.off { background: var(--dead); }
tr.live-row { background: rgba(57,217,138,.05); }
tr.live-row td.domain { color: var(--live); }
.scan-status { display: inline-flex; align-items: center; gap: 7px; margin-left: 14px; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--accent); background: rgba(34,211,238,.08); border: 1px solid rgba(34,211,238,.3); }
.scan-status[hidden] { display: none; }
.scan-status .spin { width: 11px; height: 11px; border-radius: 50%; border: 2px solid rgba(34,211,238,.25); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.thumb.ph.blank { display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--risk-med); background: repeating-linear-gradient(45deg, rgba(244,183,64,.06) 0 6px, transparent 6px 12px); border: 1px dashed rgba(244,183,64,.4); text-decoration: none; }
.blank-shot { max-width: 640px; padding: 28px 20px; text-align: center; color: var(--risk-med); background: repeating-linear-gradient(45deg, rgba(244,183,64,.05) 0 10px, transparent 10px 20px); border: 1px dashed rgba(244,183,64,.4); border-radius: 8px; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; background: var(--panel-2); color: var(--muted); border: 1px solid var(--border-2); }
.chip.src { text-transform: lowercase; }
.chip.ok { color: var(--risk-low); border-color: rgba(57,217,138,.35); }
.chip.warn { color: var(--risk-med); border-color: rgba(244,183,64,.35); }
.domain { font-family: "SF Mono", ui-monospace, Menlo, monospace; font-size: 13px; color: var(--text); }
.badge { display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 10px; font-weight: 700; letter-spacing: .04em; vertical-align: middle; }
.badge-official { background: var(--official-bg); color: var(--official); border: 1px solid rgba(88,166,255,.4); }
.thumb { width: 104px; height: 64px; object-fit: cover; object-position: top; border: 1px solid var(--border-2); border-radius: 6px; display: block; background: var(--bg-2); }
.thumb.ph { display: flex; align-items: center; justify-content: center; color: var(--faint); font-size: 18px; }
.reasons { color: var(--muted); font-size: 12px; max-width: 320px; }
.when { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 12px; }

/* ---------- Detail / KV ---------- */
.kv { width: 100%; border-collapse: collapse; }
.kv th { text-align: left; color: var(--muted); font-weight: 500; padding: 9px 14px; width: 200px; border-bottom: 1px solid var(--border); vertical-align: top; }
.kv td { padding: 9px 14px; border-bottom: 1px solid var(--border); }
.card-pad { padding: 18px; }
.section-h { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 24px 0 10px; }

/* ---------- Flash / alerts ---------- */
.flash, .notice { color: var(--risk-low); background: var(--risk-low-bg); border: 1px solid rgba(57,217,138,.3); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.error { color: var(--risk-high); background: var(--risk-high-bg); border: 1px solid rgba(255,92,108,.3); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.note { color: var(--faint); font-size: 12.5px; }
.crumb { color: var(--muted); font-size: 12.5px; margin-bottom: 14px; }

/* ---------- Login ---------- */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login { width: 340px; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 30px 28px; box-shadow: var(--shadow); }
.login .brand { justify-content: center; padding-bottom: 8px; }
.login h2 { text-align: center; margin: 2px 0 20px; font-size: 16px; color: var(--muted); font-weight: 500; }
.login label { display: block; margin: 14px 0 6px; color: var(--muted); font-size: 12.5px; }
.login input { display: block; width: 100%; padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 8px; color: var(--text); font: inherit; }
.login input:focus { outline: none; border-color: var(--accent-dim); box-shadow: 0 0 0 2px rgba(34,211,238,.18); }
.login .btn-primary { width: 100%; justify-content: center; margin-top: 20px; }

/* small screens */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sidebar .spacer, .sidebar .user { display: none; }
}
