@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=Geist:wght@300;400;500&display=swap');

:root {
  --bg:        #0a0a0f;
  --bg-card:   #111118;
  --bg-input:  #0f0f16;
  --border:    #1c1c24;
  --border-hi: #2a2a38;
  --accent:    #f97316;
  --accent-lo: #7c3a12;
  --text:      #e8e8ed;
  --text-dim:  #6b6b80;
  --text-faint:#3a3a50;
  --high:      #ef4444;
  --medium:    #f59e0b;
  --low:       #22c55e;
  --green:     #10b981;
}

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

body {
  font-family: 'Geist', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: 'Syne', sans-serif; font-weight: 700; }

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

/* ── Noise overlay ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* ── Layout ── */
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* ── Nav ── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 56px;
}
.nav-brand {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--text);
  letter-spacing: -0.02em;
}
.nav-brand span { color: var(--accent); }
.nav-badge {
  font-size: 0.7rem;
  font-family: 'Geist', monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 3px;
}

/* ── Hero ── */
.hero { margin-bottom: 60px; }
.hero-eyebrow {
  font-size: 0.75rem;
  font-family: 'Geist', monospace;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.hero-eyebrow::before {
  content: '';
  display: inline-block;
  width: 20px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}
.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin-bottom: 18px;
}
.hero h1 em {
  font-style: normal;
  color: var(--accent);
}
.hero-sub {
  font-size: 1.05rem;
  color: var(--text-dim);
  max-width: 500px;
  line-height: 1.7;
}

/* ── Stats bar ── */
.stats-bar {
  display: flex;
  gap: 1px;
  margin-bottom: 48px;
  background: var(--border);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.stat-cell {
  flex: 1;
  background: var(--bg-card);
  padding: 16px 20px;
}
.stat-label {
  font-size: 0.7rem;
  font-family: 'Geist', monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 6px;
}
.stat-value {
  font-family: 'Syne', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}
.stat-value.accent { color: var(--accent); }
.stat-sub {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 2px;
}

/* ── Section heading ── */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title {
  font-family: 'Syne', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* ── Competitor table ── */
.competitor-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 32px;
  background: var(--bg-card);
}
.competitor-table th {
  text-align: left;
  font-size: 0.7rem;
  font-family: 'Geist', monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: #0e0e16;
}
.competitor-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.competitor-table tr:last-child td { border-bottom: none; }
.competitor-table tr:hover td { background: #0e0e16; }

.comp-name {
  font-weight: 600;
  color: var(--text);
}
.comp-type {
  font-size: 0.7rem;
  font-family: 'Geist', monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 3px;
  display: inline-block;
  margin-left: 8px;
}
.comp-url {
  font-size: 0.8rem;
  color: var(--text-dim);
  word-break: break-all;
}
.last-check {
  font-size: 0.8rem;
  color: var(--text-dim);
}
.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 8px;
}
.status-dot.green  { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.amber  { background: var(--medium); box-shadow: 0 0 6px var(--medium); }
.status-dot.stale  { background: var(--text-faint); }

.no-data {
  text-align: center;
  padding: 40px;
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* ── Add competitor form ── */
.add-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 48px;
}
.add-form h3 {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 18px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr 140px auto;
  gap: 10px;
  align-items: end;
}
.form-row label {
  display: block;
  font-size: 0.72rem;
  font-family: 'Geist', monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 6px;
}
input, select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: 'Geist', sans-serif;
  font-size: 0.9rem;
  padding: 9px 12px;
  border-radius: 5px;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.12);
}
input::placeholder { color: var(--text-faint); }
select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b6b80' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}
.btn {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  padding: 10px 20px;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #0a0a0f;
}
.btn-primary:hover {
  background: #fb923c;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(249, 115, 22, 0.3);
}
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  font-size: 0.75rem;
}
.btn-ghost:hover { border-color: var(--border-hi); color: var(--text); }

/* ── Recent diffs ── */
.diff-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 48px;
}
.diff-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: border-color 0.15s;
}
.diff-item:hover { border-color: var(--border-hi); }
.diff-badge {
  font-family: 'Geist', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 3px;
  flex-shrink: 0;
  margin-top: 1px;
}
.diff-badge.high   { background: rgba(239,68,68,0.15); color: var(--high); }
.diff-badge.medium{ background: rgba(245,158,11,0.15); color: var(--medium); }
.diff-badge.low   { background: rgba(34,197,94,0.12); color: var(--low); }
.diff-body { flex: 1; }
.diff-meta {
  font-size: 0.75rem;
  color: var(--text-faint);
  margin-bottom: 4px;
  font-family: 'Geist', monospace;
}
.diff-text {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.5;
}
.diff-text strong { color: var(--text); }

/* ── Feature strip ── */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin: 60px 0 40px;
}
.feature-cell {
  background: var(--bg-card);
  padding: 24px 20px;
  text-align: center;
}
.feature-icon {
  font-size: 1.4rem;
  margin-bottom: 10px;
  display: block;
}
.feature-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 6px;
  color: var(--text);
}
.feature-desc {
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.5;
}

/* ── Footer ── */
.footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-faint);
  margin-top: 40px;
}

/* ── Error flash ── */
.flash {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 5px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: var(--high);
}

/* ── Empty state ── */
.empty-diffs {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 40px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-bottom: 48px;
}

/* ── Scrape health panel ── */
.health-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 22px;
  margin-bottom: 32px;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  gap: 16px 24px;
  align-items: center;
}
.health-score {
  display: flex;
  align-items: baseline;
  gap: 6px;
  grid-row: 1 / span 2;
  flex-wrap: wrap;
}
.health-score-value {
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
}
.health-score-suffix {
  font-size: 1rem;
  color: var(--text-faint);
  font-weight: 600;
}
.health-status {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(107,107,128,0.15);
  color: var(--text-dim);
  margin-left: 4px;
}
.health-status-healthy  { background: rgba(16,185,129,0.18); color: var(--green); }
.health-status-degraded { background: rgba(245,158,11,0.18); color: var(--medium); }
.health-status-down     { background: rgba(239,68,68,0.18);  color: var(--high); }
.health-status-idle     { background: rgba(107,107,128,0.18); color: var(--text-dim); }
.health-totals {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: center;
}
.health-totals-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text);
}
.health-totals-label {
  font-size: 0.7rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.health-failures {
  grid-column: 1 / -1;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.health-failures-empty {
  font-size: 0.78rem;
  color: var(--text-faint);
  font-style: italic;
}
.health-failure-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--text-dim);
  align-items: center;
  padding: 4px 0;
}
.health-failure-name { color: var(--text); }
.health-failure-code {
  font-family: monospace;
  color: var(--high);
  font-size: 0.72rem;
}
.health-failure-ago { color: var(--text-faint); }

/* ── Responsive ── */
@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr 1fr; }
  .stats-bar { flex-direction: column; gap: 0; }
  .features { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2rem; }
  .health-panel { grid-template-columns: 1fr; }
  .health-score { grid-row: auto; }
}