:root {
  --bg: #0f172a;
  --bg-elev: #1e293b;
  --bg-elev-2: #334155;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --accent: #3b82f6;
  --accent-2: #2563eb;
  --accent-hot: #ef4444;
  --border: #334155;
  --sev-low: #fde68a;
  --sev-med: #fb923c;
  --sev-high: #ef4444;
  --sev-crit: #7f1d1d;
  --header-h: 64px;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

.container { max-width: 1200px; margin: 0 auto; padding: 1rem; }

.site-header {
  position: sticky; top: 0; z-index: 1500;
  display: flex; align-items: center; gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  min-height: var(--header-h);
}
.site-logo { font-weight: 700; font-size: 1.1rem; color: var(--text); flex-shrink: 0; }
.site-nav {
  display: flex; gap: 0.25rem; flex: 1;
  overflow-x: auto; scrollbar-width: none;
}
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a {
  color: var(--text-muted); padding: 0.4rem 0.8rem; border-radius: 6px;
  white-space: nowrap; transition: background 150ms, color 150ms;
}
.site-nav a:hover { color: var(--text); background: var(--bg-elev-2); text-decoration: none; }
.site-nav a.is-active { color: var(--text); background: var(--bg-elev-2); font-weight: 500; }
.site-user { display: flex; gap: 0.5rem; align-items: center; font-size: 0.9rem; flex-shrink: 0; }
.btn-cta {
  background: var(--accent); color: white !important;
  padding: 0.45rem 0.95rem; border-radius: 6px;
  font-weight: 500; white-space: nowrap;
  transition: filter 120ms, transform 80ms;
}
.btn-cta:hover { filter: brightness(1.1); text-decoration: none; }
.btn-cta:active { transform: translateY(1px); }

.site-footer { color: var(--text-muted); font-size: 0.85rem; text-align: center; padding: 2rem 1rem; }

.alert-card {
  display: grid; grid-template-columns: 48px 1fr auto; gap: 0.75rem; align-items: center;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 6px;
  padding: 0.75rem; margin-bottom: 0.5rem;
}
.alert-card.is-new { animation: alertPulse 1500ms ease-out 1; }
@keyframes alertPulse {
  0%   { background: rgba(59,130,246,0.45); transform: translateX(-12px); opacity: 0; }
  60%  { background: rgba(59,130,246,0.15); transform: translateX(0); opacity: 1; }
  100% { background: var(--bg-elev); }
}
.alert-icon { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; }
.alert-icon img { width: 100%; height: 100%; }
.alert-body h3 { margin: 0 0 0.25rem 0; font-size: 1rem; }
.alert-body .meta { color: var(--text-muted); font-size: 0.85rem; }
.alert-time { color: var(--text-muted); font-size: 0.85rem; white-space: nowrap; }

.sev-low      .alert-body h3 { color: var(--sev-low); }
.sev-medium   .alert-body h3 { color: var(--sev-med); }
.sev-high     .alert-body h3 { color: var(--sev-high); }
.sev-critical .alert-body h3 { color: var(--sev-crit); font-weight: 700; }

.sev-tag {
  display: inline-block; padding: 0.05rem 0.45rem; border-radius: 10px;
  font-size: 0.72rem; font-weight: 600; margin-right: 0.35rem;
  background: var(--bg-elev-2); color: var(--text);
  vertical-align: middle;
}
.sev-tag.sev-medium   { background: rgba(251,146,60,0.25);  color: var(--sev-med); }
.sev-tag.sev-high     { background: rgba(239,68,68,0.25);   color: var(--sev-high); }
.sev-tag.sev-critical { background: rgba(127,29,29,0.6);    color: #fecaca; }
.sev-tag.sev-low      { background: rgba(253,230,138,0.18); color: var(--sev-low); }

.alert-source { margin-top: 0.25rem; font-size: 0.8rem; }
.alert-source a { color: var(--accent); }
.alert-source:empty { display: none; }

.empty-state { color: var(--text-muted); text-align: center; padding: 3rem 1rem; }

form.stack { display: flex; flex-direction: column; gap: 0.75rem; max-width: 480px; }
label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.9rem; color: var(--text-muted); }
input, select, textarea {
  background: var(--bg-elev); color: var(--text);
  border: 1px solid var(--border); border-radius: 4px; padding: 0.5rem;
  font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
button {
  background: var(--accent); color: white; border: 0;
  padding: 0.55rem 1rem; border-radius: 4px; cursor: pointer; font: inherit;
}
button:hover { filter: brightness(1.1); }
button.secondary { background: var(--bg-elev-2); }

.flash { padding: 0.75rem 1rem; border-radius: 4px; margin-bottom: 1rem; }
.flash.success { background: rgba(34,197,94,0.18); color: #86efac; }
.flash.error   { background: rgba(239,68,68,0.18); color: #fca5a5; }
.flash.info    { background: rgba(59,130,246,0.18); color: #93c5fd; }

.card {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 6px;
  padding: 1rem; margin-bottom: 1rem;
}
.card h2 { margin-top: 0; }
.muted { color: var(--text-muted); }

/* ── Mobile ────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .container { padding: 0.75rem; }
  .site-header { padding: 0.55rem 0.75rem; gap: 0.5rem; }
  .site-logo { font-size: 1rem; }
  .site-nav { gap: 0.15rem; }
  .site-nav a { padding: 0.3rem 0.5rem; font-size: 0.85rem; }
  .site-user { font-size: 0.8rem; gap: 0.35rem; }
  /* Hide email username on narrow screens; keep the logout link reachable
     but compact so nav items stay visible. */
  .site-user > span { display: none; }
  .site-user a:not(.btn-cta) {
    padding: 0.3rem 0.5rem;
    background: var(--bg-elev-2);
    border-radius: 6px;
    color: var(--text);
  }
  .btn-cta { padding: 0.4rem 0.7rem; font-size: 0.85rem; }

  .alert-card {
    grid-template-columns: 40px 1fr;
    grid-template-rows: auto auto;
    gap: 0.5rem 0.65rem;
  }
  .alert-icon { width: 40px; height: 40px; grid-row: 1 / 3; }
  .alert-body { min-width: 0; }
  .alert-body h3 { font-size: 0.95rem; line-height: 1.3; }
  .alert-time {
    grid-column: 2; grid-row: 2;
    text-align: left; font-size: 0.78rem; opacity: 0.85;
  }

  form.stack { max-width: none; }
}

@media (max-width: 480px) {
  .site-header { padding: 0.55rem 0.65rem; }
  .site-logo { font-size: 0.95rem; }
  .container { padding: 0.6rem; }
}
