*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f8fafc;
  color: #1e293b;
  font-size: 14px;
  line-height: 1.5;
}

/* ── Layout ── */
.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: 220px;
  background: #fff;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 10;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  border-bottom: 1px solid #f1f5f9;
}

.logo-icon {
  width: 32px; height: 32px;
  background: #4f46e5;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.logo-text { font-weight: 700; font-size: 17px; color: #1e293b; }

.sidebar-nav { flex: 1; padding: 12px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: #64748b;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background .15s, color .15s;
}

.nav-item:hover { background: #f8fafc; color: #1e293b; }
.nav-item.active { background: #eef2ff; color: #4f46e5; }
.nav-item svg { flex-shrink: 0; }

.badge {
  margin-left: auto;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid #f1f5f9;
}

.user-info { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }

.user-avatar {
  width: 28px; height: 28px;
  background: #eef2ff;
  color: #4f46e5;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  flex-shrink: 0;
}

.user-email { font-size: 11px; color: #64748b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-btn { font-size: 11px; color: #94a3b8; text-decoration: none; }
.logout-btn:hover { color: #ef4444; }

/* ── Main Content ── */
.main { margin-left: 220px; flex: 1; overflow-y: auto; }
.page { padding: 32px; max-width: 1100px; }

/* ── Page Header ── */
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 22px; font-weight: 700; color: #0f172a; }
.page-header p { color: #64748b; font-size: 13px; margin-top: 2px; }

/* ── Stat Cards ── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
}
.stat-card .label { font-size: 11px; color: #64748b; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.stat-card .value { font-size: 30px; font-weight: 700; }
.stat-card .value.green  { color: #16a34a; }
.stat-card .value.red    { color: #dc2626; }
.stat-card .value.amber  { color: #d97706; }
.stat-card .value.indigo { color: #4f46e5; }
.stat-card .value.gray   { color: #0f172a; }

/* ── Cards ── */
.card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
}

.card-header h2 { font-size: 14px; font-weight: 600; color: #0f172a; }
.card-header a { font-size: 12px; color: #4f46e5; text-decoration: none; }
.card-header a:hover { text-decoration: underline; }
.card-body { padding: 20px; }

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; }
th { padding: 10px 16px; text-align: left; font-size: 11px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid #f1f5f9; }
td { padding: 14px 16px; border-bottom: 1px solid #f8fafc; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafa; }

/* ── Forms ── */
.form-row { display: grid; gap: 12px; margin-bottom: 16px; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row.cols-4 { grid-template-columns: 1fr 1fr 1fr auto; }

.form-group label { display: block; font-size: 12px; font-weight: 600; color: #374151; margin-bottom: 6px; }

input[type="text"], input[type="email"], input[type="password"], input[type="url"], select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 13px;
  color: #1e293b;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all .15s;
  white-space: nowrap;
}

.btn-primary   { background: #4f46e5; color: #fff; }
.btn-primary:hover { background: #4338ca; }
.btn-success   { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger    { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-secondary { background: #fff; color: #374151; border: 1px solid #d1d5db; }
.btn-secondary:hover { background: #f9fafb; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Alerts ── */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ── Alert rows ── */
.alert-row { cursor: pointer; }
.alert-row.selected td { background: #eef2ff !important; border-left: 3px solid #4f46e5; }

/* ── Detail Panel ── */
.detail-panel {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  width: 280px;
  flex-shrink: 0;
  position: sticky;
  top: 32px;
  align-self: flex-start;
}

.detail-row { margin-bottom: 14px; }
.detail-row .dlabel { font-size: 11px; color: #94a3b8; margin-bottom: 2px; }
.detail-row .dvalue { font-size: 12px; color: #1e293b; word-break: break-all; }
.detail-row .dvalue.mono { font-family: monospace; }

/* ── Token box ── */
.token-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 20px;
}
.token-box h3 { font-size: 13px; color: #92400e; margin-bottom: 8px; }
.token-value {
  display: flex;
  gap: 8px;
  align-items: center;
}
.token-value code {
  flex: 1;
  background: #fff;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  word-break: break-all;
  font-family: monospace;
}

/* ── Empty state ── */
.empty { padding: 48px; text-align: center; color: #94a3b8; }
.empty svg { margin: 0 auto 12px; display: block; }
.empty p { font-size: 13px; }

/* ── Two-column layout for alerts ── */
.split-layout { display: flex; gap: 20px; align-items: flex-start; }
.split-layout .list { flex: 1; }

/* ── Status pill ── */
.status-pill {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 20px;
}
.status-pill.new          { background: #fef3c7; color: #92400e; }
.status-pill.acknowledged { background: #eff6ff; color: #1e40af; }
.status-pill.resolved     { background: #f0fdf4; color: #166534; }

/* ── Login page ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
}
.login-box {
  width: 100%;
  max-width: 380px;
}
.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 28px;
}
.login-logo .logo-icon { width: 40px; height: 40px; border-radius: 12px; }
.login-logo span { font-size: 24px; font-weight: 700; color: #0f172a; }
.login-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.login-card h1 { font-size: 18px; text-align: center; margin-bottom: 4px; }
.login-card p  { text-align: center; color: #64748b; font-size: 13px; margin-bottom: 24px; }
.login-footer { text-align: center; font-size: 12px; color: #94a3b8; margin-top: 20px; }

/* ── Misc ── */
code { font-family: monospace; font-size: 12px; background: #f1f5f9; padding: 2px 6px; border-radius: 4px; }
.text-muted { color: #94a3b8; font-size: 12px; }
.text-right { text-align: right; }
.flex { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.mt-16 { margin-top: 16px; }
.filter-tabs { display: flex; gap: 4px; background: #f1f5f9; border-radius: 10px; padding: 4px; }
.filter-tab {
  padding: 6px 16px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
  text-decoration: none;
  transition: all .15s;
}
.filter-tab.active { background: #fff; color: #0f172a; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.filter-tab:hover:not(.active) { color: #374151; }
