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

body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: #0f172a;
  background: #f8fafc;
}

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

header {
  background: white;
  border-bottom: 1px solid #e5e7eb;
  padding: 2rem 0;
}

header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: #64748b;
  font-size: 1.125rem;
  margin-bottom: 1rem;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.badge {
  background: #f1f5f9;
  color: #475569;
  padding: 0.375rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.btn-github {
  background: #0f172a;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  text-decoration: none;
  font-weight: 500;
  transition: background 0.2s;
}

.btn-github:hover { background: #1e293b; }

.kpi-strip {
  background: white;
  border-bottom: 1px solid #e5e7eb;
  padding: 1.5rem 0;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
}

.kpi {
  text-align: center;
}

.kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.25rem;
}

.kpi-label {
  font-size: 0.875rem;
  color: #64748b;
}

.kpi .savings { color: #059669; }

main { padding: 2rem 0; }

.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.tab {
  background: none;
  border: none;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  color: #64748b;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.tab.active {
  color: #059669;
  border-bottom-color: #059669;
  font-weight: 500;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.card {
  background: white;
  border-radius: 0.75rem;
  border: 1px solid #e5e7eb;
  padding: 2rem;
}

.card h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.help-text {
  color: #64748b;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.prompt-examples {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.example-btn {
  background: #f1f5f9;
  border: 1px solid #e5e7eb;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
}

.example-btn:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

#prompt-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  font-family: inherit;
  font-size: 1rem;
  margin-bottom: 1rem;
  resize: vertical;
}

.api-key-section {
  margin-bottom: 1rem;
  padding: 1rem;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 0.5rem;
}

.api-key-section summary {
  cursor: pointer;
  font-weight: 500;
  color: #92400e;
  margin-bottom: 0.5rem;
}

.api-key-section input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #fbbf24;
  border-radius: 0.375rem;
  font-family: 'Courier New', monospace;
  margin-bottom: 0.5rem;
}

.provider-toggles {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.provider-toggles label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
}

.btn-primary {
  background: #059669;
  color: white;
  padding: 0.75rem 2rem;
  border: none;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover { background: #047857; }

.result {
  margin-top: 2rem;
  padding: 1.5rem;
  background: #f8fafc;
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
}

.result.hidden { display: none; }

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.result-metric {
  padding: 1rem;
  background: white;
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
}

.result-metric-value {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.result-metric-label {
  font-size: 0.875rem;
  color: #64748b;
}

.chart-row {
  display: flex;
  gap: 1rem;
  margin: 1rem 0;
}

.chart-row > div {
  min-width: 0;
  flex: 1;
}

.audit-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

#audit-search {
  flex: 1;
  min-width: 200px;
  padding: 0.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
}

.filter-pills {
  display: flex;
  gap: 0.5rem;
}

.pill {
  background: white;
  border: 1px solid #e5e7eb;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
}

.pill.active {
  background: #059669;
  color: white;
  border-color: #059669;
}

.audit-row {
  padding: 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.audit-row-header {
  cursor: pointer;
  transition: background 0.2s;
  margin: -0.5rem;
  padding: 0.5rem;
  border-radius: 0.5rem;
}

.audit-row-header:hover {
  background: #f8fafc;
}

.chevron {
  display: inline-block;
  width: 1rem;
  font-size: 0.75rem;
  color: #64748b;
  transition: transform 0.2s;
  margin-right: 0.5rem;
}

footer {
  background: white;
  border-top: 1px solid #e5e7eb;
  padding: 2rem 0;
  margin-top: 4rem;
  text-align: center;
  color: #64748b;
}

footer a {
  color: #059669;
  text-decoration: none;
}

footer a:hover { text-decoration: underline; }

@media (max-width: 768px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
  .chart-row { flex-direction: column; }
  .tabs { overflow-x: auto; }
  .provider-toggles { flex-direction: column; gap: 0.5rem; }
}
