/* laws-cache — Dark theme */
:root {
  --bg-base: #0a0b0f;
  --bg-raised: #12141a;
  --bg-surface: #1a1d26;
  --bg-hover: #222633;
  --border: #2a2e3a;
  --border-light: #363b4a;
  --text-primary: #e4e6f0;
  --text-secondary: #8b90a8;
  --text-muted: #5a5f75;
  --accent: #00d97e;
  --accent-dim: #00b368;
  --accent-bg: rgba(0, 217, 126, 0.08);
  --yellow: #ffca4d;
  --yellow-bg: rgba(255, 202, 77, 0.1);
  --red: #ff5470;
  --red-bg: rgba(255, 84, 112, 0.08);
  --blue: #6c8aff;
  --blue-bg: rgba(108, 138, 255, 0.08);
  --radius: 8px;
  --radius-lg: 12px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

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

body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  font-size: 14px;
}

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

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  padding: 0 24px;
  height: 52px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.5px;
}
.logo:hover { text-decoration: none; opacity: 0.85; }

.nav-links {
  display: flex;
  gap: 4px;
  margin-left: 32px;
}

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

/* Main container */
#app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

/* Footer */
.footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
}
.footer .sep { margin: 0 8px; }
.footer a { color: var(--text-secondary); }

/* Hero */
.hero {
  text-align: center;
  padding: 48px 0 36px;
}
.hero h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--accent) 0%, #4dffb0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero p {
  color: var(--text-secondary);
  font-size: 15px;
  max-width: 560px;
  margin: 0 auto;
}

/* Scanner form */
.scanner-form {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 32px;
}

.input-toggle {
  display: flex;
  gap: 2px;
  background: var(--bg-base);
  border-radius: 6px;
  padding: 3px;
  margin-bottom: 16px;
  width: fit-content;
}

.toggle-btn {
  padding: 6px 16px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}
.toggle-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.code-input {
  width: 100%;
  min-height: 200px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  color: var(--text-primary);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
}
.code-input:focus { border-color: var(--accent-dim); }
.code-input::placeholder { color: var(--text-muted); }

.github-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
}
.github-input:focus { border-color: var(--accent-dim); }
.github-input::placeholder { color: var(--text-muted); }

.form-row {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.form-group select,
.form-group input[type="number"] {
  padding: 8px 12px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}

.scan-btn {
  padding: 10px 28px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  margin-left: auto;
}
.scan-btn:hover { background: var(--accent-dim); }
.scan-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Stats strip */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  text-align: center;
}

.stat-value {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
}

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

/* Recent scans */
.section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-weight: 600;
}

.recent-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.recent-item {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  gap: 16px;
}
.recent-item:hover { background: var(--bg-hover); border-color: var(--border-light); }

.recent-source {
  flex: 1;
  font-size: 13px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-sites {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
}

.recent-savings {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

.recent-date {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Report page */
.report-hero {
  text-align: center;
  padding: 40px 0 32px;
}

.savings-number {
  font-family: var(--mono);
  font-size: 48px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -1px;
}

.savings-label {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.savings-percent {
  display: inline-block;
  background: var(--accent-bg);
  color: var(--accent);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--mono);
  margin-top: 8px;
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}

.summary-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.summary-card .value {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
}

.summary-card .label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Call site table */
.callsite-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
}

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

.callsite-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}

.callsite-table tr { cursor: pointer; transition: background 0.1s; }
.callsite-table tbody tr:hover { background: var(--bg-hover); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-static { background: var(--accent-bg); color: var(--accent); }
.badge-template { background: var(--yellow-bg); color: var(--yellow); }
.badge-dynamic { background: var(--red-bg); color: var(--red); }

.provider-badge {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--blue);
}

.model-name {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-secondary);
}

.cost-cell {
  font-family: var(--mono);
  font-size: 13px;
}

.savings-cell {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

/* Expanded row detail */
.callsite-detail {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 8px 12px 16px;
  padding: 16px;
}

.detail-section {
  margin-bottom: 16px;
}

.detail-section:last-child { margin-bottom: 0; }

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

.code-block {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 16px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  position: relative;
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 10px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}
.copy-btn:hover { background: var(--bg-surface); color: var(--text-primary); }

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.share-btn:hover { background: var(--bg-hover); border-color: var(--border-light); }

/* Pricing page */
.pricing-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.search-input {
  padding: 8px 14px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  width: 260px;
}
.search-input:focus { border-color: var(--accent-dim); }
.search-input::placeholder { color: var(--text-muted); }

.pricing-table {
  width: 100%;
  border-collapse: collapse;
}

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

.pricing-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.pricing-table tbody tr:hover { background: var(--bg-hover); }

.pricing-table .model-id {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-secondary);
}

.pricing-table .price {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
}

/* Loading */
.loading {
  text-align: center;
  padding: 48px;
  color: var(--text-muted);
}

.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 10px 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13px;
  z-index: 200;
  transition: all 0.3s;
}
.toast.hidden { opacity: 0; transform: translateY(10px); pointer-events: none; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 14px;
}

/* Report actions */
.report-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 32px;
}

/* Responsive */
@media (max-width: 768px) {
  .hero h1 { font-size: 22px; }
  .savings-number { font-size: 36px; }
  .form-row { flex-direction: column; }
  .scan-btn { margin-left: 0; width: 100%; }
  .callsite-table { font-size: 12px; }
  .callsite-table th:nth-child(n+4),
  .callsite-table td:nth-child(n+4) { display: none; }
  .search-input { width: 100%; }
}
