:root {
  color-scheme: light;
  --page: #f3f5fb;
  --surface-1: #ffffff;
  --text-primary: #101828;
  --text-secondary: #475467;
  --text-muted: #98a2b3;
  --grid: #eef0f5;
  --border: #e4e7ec;

  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;

  --status-good: #16a34a;
  --status-good-bg: #eafaf0;
  --status-warning: #d97706;
  --status-warning-bg: #fef6e6;
  --status-serious: #ea580c;
  --status-serious-bg: #fef1e9;
  --status-critical: #dc2626;
  --status-critical-bg: #fdedee;
  --status-neutral: #64748b;
  --status-neutral-bg: #f1f3f7;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 6px 16px -4px rgba(16, 24, 40, 0.10), 0 2px 4px -2px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 16px 32px -8px rgba(16, 24, 40, 0.16), 0 4px 10px -4px rgba(16, 24, 40, 0.08);

  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 9px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--surface-1);
  box-shadow: var(--shadow-md);
  padding: 22px 16px;
  position: relative;
  z-index: 1;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 28px;
  padding: 0 8px;
}
.sidebar .brand .brand-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary), #7c73f0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.sidebar nav a {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar nav a:hover { background: var(--grid); text-decoration: none; color: var(--text-primary); }
.sidebar nav a.active {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.main { flex: 1; min-width: 0; padding: 28px 34px 60px; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 26px;
  flex-wrap: wrap;
  gap: 12px;
}

.topbar h1 { font-size: 22px; margin: 0; font-weight: 700; letter-spacing: -0.01em; }

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px;
  transition: box-shadow 0.15s ease;
}

.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: 2fr 1fr; }

@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 16px; }
}

.stat-tile .label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.stat-tile .value {
  font-size: 30px;
  font-weight: 800;
  margin-top: 8px;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.stat-tile .sub { font-size: 13px; color: var(--text-secondary); margin-top: 6px; }

.section-title {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 16px;
  color: var(--text-primary);
}

.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.bar-row .bar-label {
  width: 160px;
  flex-shrink: 0;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-row .bar-track {
  flex: 1;
  background: var(--grid);
  border-radius: 999px;
  height: 20px;
  position: relative;
}
.bar-row .bar-fill {
  background: linear-gradient(90deg, var(--primary), #7c73f0);
  height: 100%;
  border-radius: 999px;
  min-width: 8px;
}
.bar-row .bar-value {
  width: 36px;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--grid); }
th { color: var(--text-muted); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--page); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; background: currentColor; }
.badge.good { background: var(--status-good-bg); color: var(--status-good); }
.badge.warning { background: var(--status-warning-bg); color: var(--status-warning); }
.badge.serious { background: var(--status-serious-bg); color: var(--status-serious); }
.badge.critical { background: var(--status-critical-bg); color: var(--status-critical); }
.badge.neutral { background: var(--status-neutral-bg); color: var(--status-neutral); }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.filters select, .filters input {
  background: var(--surface-1);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: var(--shadow-sm);
}
.filters select:focus, .filters input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.btn:hover { background: var(--primary-hover); text-decoration: none; box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--surface-1); color: var(--text-primary); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.btn.secondary:hover { background: var(--grid); }
.btn.danger { background: var(--status-critical); }
.btn.outline-danger { background: var(--surface-1); color: var(--status-critical); border: 1px solid var(--status-critical); box-shadow: none; }
.btn.outline-danger:hover { background: var(--status-critical-bg); }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background:
    radial-gradient(circle at 15% 15%, rgba(79, 70, 229, 0.12), transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(124, 115, 240, 0.12), transparent 40%),
    var(--page);
}
.login-card { width: 100%; max-width: 380px; box-shadow: var(--shadow-lg); }
.login-card h1 { font-size: 22px; margin-bottom: 4px; font-weight: 800; }
.login-card p { color: var(--text-secondary); font-size: 14px; margin-top: 0; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-secondary); }
.field input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 20px;
}
.flash.success { background: var(--status-good-bg); color: var(--status-good); }
.flash.error { background: var(--status-critical-bg); color: var(--status-critical); }

.transcript {
  white-space: pre-wrap;
  line-height: 1.6;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--page);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.mt-0 { margin-top: 0; }
.empty-state { text-align: center; padding: 48px 16px; color: var(--text-muted); }
code.token {
  background: var(--grid);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}
