:root {
  --bg: #eaf4ff;
  --panel: #ffffff;
  --ink: #102a43;
  --muted: #52667d;
  --brand: #2a6df4;
  --brand-2: #1454d1;
  --brand-soft: #e6f0ff;
  --ok: #157347;
  --warn: #bb6f04;
  --danger: #c92a2a;
  --line: #d8e2eb;
  --radius: 22px;
  --shadow: 0 24px 60px rgba(20, 50, 90, 0.12);
}

body.dark {
  --bg: #081827;
  --panel: #111f36;
  --ink: #f3f8ff;
  --muted: #9ab4d0;
  --brand: #4d86ff;
  --brand-2: #2aa2ff;
  --brand-soft: rgba(77, 134, 255, 0.12);
  --line: #203452;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  background: radial-gradient(circle at top right, #f3f8ff 0%, var(--bg) 40%, #eef4fb 100%);
  color: var(--ink);
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--danger); font-weight: 700; }

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: min(520px, 100%);
  background: var(--panel);
  border: 1px solid rgba(16, 42, 67, 0.08);
  border-radius: var(--radius);
  padding: 36px;
  box-shadow: var(--shadow);
}
.brand-head {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand-head h1,
.brand-head h2 {
  margin: 0;
  font-size: 1.9rem;
  letter-spacing: -0.04em;
}
.brand-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

#panel-view {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: linear-gradient(180deg, #153f86 0%, #102847 100%);
  color: #f8fbff;
  padding: 28px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 18px;
}
.ghost {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #f8fbff;
}
.sidebar .badge {
  background: rgba(255, 255, 255, 0.12);
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 13px;
}
nav { display: grid; gap: 10px; align-content: start; }
.tab-btn, button {
  border: 0;
  padding: 12px 16px;
  border-radius: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.16s ease, filter 0.16s ease, background 0.16s ease;
}
.tab-btn { background: rgba(255, 255, 255, 0.08); color: #e9f2ff; text-align: left; }
.tab-btn:hover { transform: translateY(-1px); }
.tab-btn.active { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: white; }
button { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: white; }
button:hover { filter: brightness(1.05); }
button.ghost { background: rgba(255,255,255,0.12); color: inherit; border: 1px solid rgba(255,255,255,0.2); }
button.danger { background: linear-gradient(135deg, #d9434e, #c92a2a); }

.content { padding: 28px; }
.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}
.panel-copy {
  max-width: 650px;
}
.eyebrow {
  display: inline-block;
  margin-bottom: 10px;
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand);
}
.panel-header h1 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 2.6rem);
  line-height: 1.05;
}
.panel-header p {
  margin: 0;
  color: var(--muted);
  max-width: 32rem;
}
.panel-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.hero-banner {
  display: grid;
  grid-template-columns: 1.35fr 0.9fr;
  gap: 20px;
  padding: 28px;
  background: linear-gradient(135deg, #f8faff 0%, #eef4ff 100%);
  border: 1px solid rgba(42, 109, 244, 0.18);
  border-radius: 28px;
  margin-bottom: 24px;
}
.hero-copy h2 {
  margin: 0 0 14px;
  font-size: clamp(1.6rem, 2.4vw, 2.1rem);
  line-height: 1.08;
}
.hero-copy p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.8;
  max-width: 42rem;
}
.hero-preview {
  display: grid;
  align-items: center;
}
.hero-preview-card {
  background: white;
  border: 1px solid rgba(16, 42, 67, 0.08);
  border-radius: 28px;
  padding: 24px;
  box-shadow: 0 24px 50px rgba(16, 42, 67, 0.08);
}
.hero-preview-title {
  color: var(--brand);
  font-weight: 800;
  margin-bottom: 18px;
}
.hero-preview-items {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid rgba(16, 42, 67, 0.06);
}
.hero-preview-items:first-of-type { border-top: none; padding-top: 0; }
.hero-preview-items span {
  color: var(--muted);
}
.hero-preview-items strong {
  font-size: 1.1rem;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.card {
  background: var(--panel);
  border: 1px solid rgba(16, 42, 67, 0.08);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 16px 45px rgba(20, 50, 90, 0.06);
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.kpi {
  background: linear-gradient(135deg, #f8fbff, #e7f1ff);
  border: 1px solid rgba(16, 42, 67, 0.06);
  border-radius: 22px;
  padding: 18px;
}
.kpi h4 { margin: 0 0 10px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.kpi strong { font-size: 1.8rem; line-height: 1.1; }

.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.form-grid {
  display: grid;
  gap: 14px;
}
label {
  display: grid;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
}
input, select {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  font: inherit;
  background: #fff;
}
input:focus, select:focus { outline: 2px solid rgba(42, 109, 244, 0.24); }
.scan-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}
.scanner {
  margin-top: 12px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  overflow: hidden;
}
.list {
  margin: 0;
  padding-left: 0;
  display: grid;
  gap: 10px;
  list-style: none;
}
.list li {
  background: #f8fbff;
  border: 1px solid rgba(16, 42, 67, 0.06);
  border-radius: 16px;
  padding: 14px 16px;
  color: var(--ink);
}

.alert-summaries {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
.alert-summary-card {
  display: grid;
  gap: 12px;
  padding: 22px;
  border-radius: 22px;
}
.alert-summary-card span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.alert-summary-card strong {
  font-size: 2.2rem;
}
.alert-summary-card p {
  margin: 0;
  color: var(--muted);
}
.alert-summary-card.critical { background: rgba(255, 92, 92, 0.12); border-color: rgba(255, 92, 92, 0.2); }
.alert-summary-card.warning { background: rgba(255, 180, 64, 0.12); border-color: rgba(255, 180, 64, 0.2); }
.alert-summary-card.normal { background: rgba(42, 109, 244, 0.1); border-color: rgba(42, 109, 244, 0.2); }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
.feature-card {
  background: linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%);
  border: 1px solid rgba(16, 42, 67, 0.08);
  border-radius: 24px;
  padding: 22px;
  display: grid;
  gap: 12px;
}
.feature-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: rgba(42, 109, 244, 0.12);
  font-size: 1.3rem;
}
.feature-card h4 {
  margin: 0;
  font-size: 1rem;
}
.feature-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.alert-filters {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
}
.alert-search {
  display: flex;
  align-items: center;
  gap: 12px;
}
.alert-search input {
  width: 100%;
  border-radius: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: #fff;
}
.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.alert-filter-btn {
  border: 1px solid rgba(16, 42, 67, 0.12);
  background: white;
  color: var(--ink);
  padding: 12px 18px;
  border-radius: 16px;
  font-weight: 700;
  cursor: pointer;
}
.alert-filter-btn.active {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: white;
  border-color: transparent;
}

.alert-item {
  display: grid;
  gap: 16px;
}
.alert-item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
.alert-item-title {
  font-size: 1rem;
  font-weight: 800;
}
.alert-item-subtitle {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.92rem;
}
.alert-badge {
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}
.alert-badge.critical { background: rgba(255, 92, 92, 0.12); color: #b42318; }
.alert-badge.warning { background: rgba(255, 180, 64, 0.12); color: #8a4d00; }
.alert-badge.normal { background: rgba(42, 109, 244, 0.12); color: #153d8b; }
.alert-item-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.alert-item-grid div span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 6px;
}
.alert-item-grid div strong {
  display: block;
  font-size: 1rem;
}
.alert-progress {
  height: 10px;
  border-radius: 999px;
  background: rgba(16, 42, 67, 0.08);
  overflow: hidden;
}
.alert-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2a6df4, #1454d1);
}
.alert-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}
.alert-empty {
  padding: 20px;
  border-radius: 16px;
  background: rgba(16, 42, 67, 0.05);
  color: var(--muted);
}

@media (max-width: 960px) {
  #panel-view { grid-template-columns: 1fr; }
  .sidebar { grid-template-rows: auto auto auto auto; }
  .split { grid-template-columns: 1fr; }
  .hero-banner,
  .feature-grid,
  .alert-summaries,
  .alert-item-grid {
    grid-template-columns: 1fr;
  }
}
