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

:root {
  --primary: #000000;
  --primary-light: #333333;
  --accent: #7C3AED;
  --accent-light: #EDE9FE;
  --bg: #FFFFFF;
  --bg-secondary: #F9FAFB;
  --bg-tertiary: #F3F4F6;
  --card: #FFFFFF;
  --card-border: #E5E7EB;
  --text: #111827;
  --text-muted: #6B7280;
  --text-light: #9CA3AF;
  --danger: #EF4444;
  --success: #10B981;
  --warning: #F59E0B;
  --yellow: #F59E0B;
  --blue: #3B82F6;
  --purple: #7C3AED;
  --dark: #111827;
  --darker: #000000;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-secondary);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--card-border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.logo { font-size: 20px; font-weight: 800; color: var(--primary); letter-spacing: -0.5px; }
.header-right { display: flex; align-items: center; gap: 8px; }

.auto-refresh {
  font-size: 12px;
  color: var(--success);
  padding: 4px 10px;
  background: var(--bg-tertiary);
  border-radius: 12px;
  font-weight: 500;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  transition: all 0.15s;
}
.nav-link:hover { color: var(--primary); background: var(--bg-tertiary); }

/* Stats bar */
.stats-bar {
  display: flex;
  gap: 16px;
  padding: 16px 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--card-border);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

/* Cards */
.card {
  background: var(--card);
  border-radius: 16px;
  padding: 20px;
  border: 1px solid var(--card-border);
}

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

/* Grid */
.grid { padding: 24px; display: grid; gap: 20px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  border-bottom: 1px solid var(--card-border);
}

td {
  padding: 10px 12px;
  font-size: 14px;
  border-bottom: 1px solid var(--bg-tertiary);
}

tr:hover { background: var(--bg-secondary); }

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.badge-success { background: #ECFDF5; color: #059669; }
.badge-danger { background: #FEF2F2; color: #DC2626; }
.badge-warning { background: #FEF3C7; color: #D97706; }
.badge-info { background: #EFF6FF; color: #2563EB; }

/* Feed */
.feed {
  max-height: 400px;
  overflow-y: auto;
}

.feed-item {
  padding: 10px 12px;
  border-bottom: 1px solid var(--bg-tertiary);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.feed-item:hover { background: var(--bg-secondary); }

.feed-time {
  font-size: 11px;
  color: var(--text-light);
  font-variant-numeric: tabular-nums;
}

.feed-method {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

/* Pill selectors */
.pill-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
}

.pill-bar .pill {
  padding: 6px 14px;
  border: 1px solid var(--card-border);
  border-radius: 20px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
}

.pill-bar .pill:hover { border-color: var(--primary); color: var(--text); }

.pill-bar .pill.active {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
  font-weight: 600;
}

/* Chart placeholder */
.chart-area {
  height: 200px;
  background: var(--bg-secondary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 13px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--card-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

.header-nav { display: flex; gap: 8px; align-items: center; }
.header-nav a { color: #6B7280; text-decoration: none; font-size: 13px; font-weight: 500; padding: 6px 12px; border-radius: 8px; transition: all 0.15s; }
.header-nav a:hover { color: #111827; background: #F3F4F6; }
.header-nav a.active { color: #111827; font-weight: 700; background: #F3F4F6; }

/* Analytics page specific styles */
main { padding: 24px; max-width: 1400px; margin: 0 auto; }

.section {
  background: var(--card);
  border-radius: 16px;
  border: 1px solid var(--card-border);
  padding: 20px;
  margin-bottom: 20px;
}

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

.section-header h2 { font-size: 16px; font-weight: 700; color: var(--text); }
.section-note { font-size: 12px; color: var(--text-muted); }

/* Interval filter pills */
.interval-filter { display: flex; align-items: center; gap: 6px; }
.filter-label { font-size: 12px; color: var(--text-muted); font-weight: 600; }

.filter-pill {
  padding: 5px 14px;
  border: 1px solid var(--card-border);
  border-radius: 20px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.filter-pill:hover { border-color: var(--primary); color: var(--text); }
.filter-pill.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  font-weight: 600;
}

/* Tables */
.table-wrap { overflow-x: auto; }
.table-wrap table { width: 100%; border-collapse: collapse; }
.table-wrap th {
  text-align: left; padding: 10px 12px; font-size: 11px;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;
  font-weight: 600; border-bottom: 1px solid var(--card-border);
  background: var(--bg-secondary);
}
.table-wrap th.num { text-align: right; }
.table-wrap td { padding: 10px 12px; font-size: 13px; border-bottom: 1px solid var(--bg-tertiary); }
.table-wrap td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap td.empty { text-align: center; color: var(--text-muted); padding: 24px; }
.table-wrap tr:hover { background: var(--bg-secondary); }

/* Model name with icon */
.model-name { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.model-icon { font-size: 16px; }

/* Latency bar */
.latency-bar {
  display: inline-block; height: 6px; border-radius: 3px;
  background: var(--blue); margin-right: 8px; vertical-align: middle;
}

/* Verdict badges */
.verdict {
  display: inline-block; padding: 3px 10px; border-radius: 12px;
  font-size: 11px; font-weight: 600;
}
.verdict-great { background: #ECFDF5; color: #059669; }
.verdict-good { background: #EFF6FF; color: #2563EB; }
.verdict-ok { background: #FEF3C7; color: #D97706; }
.verdict-expensive { background: #FEF2F2; color: #DC2626; }

/* Cost bar chart */
.cost-bar-chart { margin-top: 16px; }
.cost-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.cost-row-label { width: 120px; font-size: 13px; font-weight: 600; flex-shrink: 0; }
.cost-bar-track { flex: 1; height: 28px; background: var(--bg-tertiary); border-radius: 8px; position: relative; overflow: visible; }
.cost-bar-fill {
  height: 100%; border-radius: 8px; display: flex; align-items: center;
  padding: 0 10px; font-size: 12px; font-weight: 600; color: white;
  transition: width 0.4s ease; min-width: 60px;
}
.cost-bar-fill.cheapest { background: #10B981; }
.cost-bar-fill.moderate { background: #3B82F6; }
.cost-bar-fill.expensive { background: #F59E0B; }
.cost-bar-fill.very-expensive { background: #EF4444; }

.manual-line {
  position: absolute; top: -4px; bottom: -4px; width: 2px;
  background: var(--danger); z-index: 2;
}
.manual-label {
  position: absolute; top: -20px; left: 4px; font-size: 10px;
  color: var(--danger); font-weight: 600; white-space: nowrap;
}

/* Feed controls */
.feed-controls { display: flex; gap: 8px; align-items: center; }
.feed-controls select {
  padding: 6px 12px; background: var(--bg-secondary); color: var(--text);
  border: 1px solid var(--card-border); border-radius: 10px; font-size: 13px;
}
.feed-controls select:focus { outline: none; border-color: var(--primary); }

.btn-refresh {
  padding: 6px 14px; background: var(--bg-secondary); color: var(--text);
  border: 1px solid var(--card-border); border-radius: 10px; cursor: pointer;
  font-size: 13px; font-weight: 500; transition: all 0.15s;
}
.btn-refresh:hover { border-color: var(--primary); background: var(--bg-tertiary); }

/* Scans feed */
.scans-feed { max-height: 500px; overflow-y: auto; }
.scans-feed .empty { text-align: center; padding: 24px; color: var(--text-muted); font-size: 13px; }

.scan-row {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px;
  border-bottom: 1px solid var(--bg-tertiary); font-size: 13px;
  transition: background 0.1s;
}
.scan-row:hover { background: var(--bg-secondary); }
.scan-row.violation { border-left: 3px solid var(--danger); }
.scan-row.clean { border-left: 3px solid transparent; }

.scan-time { color: var(--text-light); font-size: 12px; font-variant-numeric: tabular-nums; width: 70px; flex-shrink: 0; }
.scan-method {
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px;
  white-space: nowrap; flex-shrink: 0;
}
.scan-method.m-bedrock { background: #F3E8FF; color: #7C3AED; }
.scan-method.m-rekognition { background: #EFF6FF; color: #2563EB; }

.scan-interval { font-size: 11px; color: var(--text-muted); width: 30px; flex-shrink: 0; }
.scan-latency { font-size: 12px; color: var(--text-muted); width: 50px; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.scan-items { flex: 1; color: var(--text-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.scan-violation-tag {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  background: #FEF2F2; color: #DC2626; font-size: 11px; font-weight: 600;
  flex-shrink: 0;
}
.scan-clean-tag {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  background: #ECFDF5; color: #059669; font-size: 11px; font-weight: 600;
  flex-shrink: 0;
}
