:root {
  --bg: #0f1115;
  --card: #171a21;
  --border: #2a2f3a;
  --text: #e6e8eb;
  --muted: #9aa2af;
  --pass: #2fbf71;
  --warn: #e0a72e;
  --fail: #e0524f;
  --accent: #4f8cff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

header {
  padding: 1.5rem 1rem 0;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.logo-mark {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.9rem;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
}
.nav a:hover { color: var(--text); }

.nav-cta {
  color: var(--text) !important;
  background: var(--accent);
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
}
.nav-cta:hover { color: white !important; }

.link-button {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}
.link-button:hover { color: var(--text); }
.link-button.danger:hover { color: var(--fail); }

main {
  flex: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1rem 4rem;
  width: 100%;
}

main.wide {
  max-width: 1100px;
}

/* ---- Hero (homepage) ---- */

.hero {
  text-align: center;
  padding: 4rem 0 3rem;
}

.hero h1 {
  font-size: 2.3rem;
  line-height: 1.25;
  margin: 0 0 1rem;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.hero-sub {
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.5;
  max-width: 560px;
  margin: 0 auto 2rem;
}

/* ---- Shared search-form styling (hero, result-page re-check, cta-repeat) ---- */

.check-form form,
.hero-form {
  display: flex;
  gap: 0.5rem;
  max-width: 480px;
  margin: 0 auto;
}

.check-form input[type="text"],
.hero-form input[type="text"] {
  flex: 1;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 1rem;
  min-width: 0;
}

.check-form button,
.hero-form button {
  padding: 0.85rem 1.5rem;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: white;
  font-size: 1rem;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}

.check-form.compact { margin-bottom: 1.5rem; }

.error {
  color: var(--fail);
  margin-top: 0.75rem;
  text-align: center;
}

/* ---- Section headings shared across homepage sections ---- */

.section { padding: 2.5rem 0; }

.section-heading {
  text-align: center;
  font-size: 1.6rem;
  margin: 0 0 0.5rem;
}

.section-sub {
  text-align: center;
  color: var(--muted);
  margin: 0 0 2rem;
}

/* ---- Checks grid (homepage) ---- */

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

.check-tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.4rem;
  transition: border-color 0.15s ease;
}

.check-tile:hover { border-color: var(--accent); }

.tile-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.6rem;
  height: 2.2rem;
  padding: 0 0.6rem;
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  margin-bottom: 0.9rem;
}

.check-tile h3 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
}

.check-tile p {
  margin: 0;
  color: var(--muted);
  font-size: 0.87rem;
  line-height: 1.45;
}

/* ---- How it works (homepage) ---- */

.steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.75rem;
}

.steps li {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.step-num {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
}

.steps h3 {
  margin: 0 0 0.3rem;
  font-size: 1rem;
}

.steps p {
  margin: 0;
  color: var(--muted);
  font-size: 0.87rem;
  line-height: 1.45;
}

/* ---- Why this matters (homepage) ---- */

.why-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2rem 2.25rem;
}

.why-card h2 {
  margin: 0 0 0.9rem;
  font-size: 1.3rem;
}

.why-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

/* ---- Repeat CTA (homepage) ---- */

.cta-repeat {
  text-align: center;
  padding: 3rem 0 1rem;
}

/* ---- Score / result page ---- */

.score {
  text-align: center;
  margin: 1.5rem 0 2rem;
}

.score-circle {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0 auto 1rem;
  border: 4px solid;
}

.score-pass { border-color: var(--pass); color: var(--pass); }
.score-warn { border-color: var(--warn); color: var(--warn); }
.score-fail { border-color: var(--fail); color: var(--fail); }

.score h2 { margin: 0 0 0.75rem; word-break: break-all; }

.pdf-link {
  display: inline-block;
  color: var(--accent);
  font-size: 0.85rem;
  text-decoration: none;
  border: 1px solid var(--border);
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
}
.pdf-link:hover { border-color: var(--accent); }

.results {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.result-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
}

.result-card.status-pass { border-left-color: var(--pass); }
.result-card.status-warn { border-left-color: var(--warn); }
.result-card.status-fail { border-left-color: var(--fail); }

.result-card h3 {
  margin: 0 0 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.05rem;
}

.badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  letter-spacing: 0.03em;
}

.status-pass .badge { background: color-mix(in srgb, var(--pass) 20%, transparent); color: var(--pass); }
.status-warn .badge { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.status-fail .badge { background: color-mix(in srgb, var(--fail) 20%, transparent); color: var(--fail); }

.findings {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.details {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.details dt { font-weight: 600; color: var(--text); }
.details dd { margin: 0 0 0.5rem; }

details { margin-top: 0.75rem; font-size: 0.85rem; color: var(--muted); }
summary { cursor: pointer; }

.raw {
  display: block;
  margin-top: 0.5rem;
  padding: 0.75rem;
  background: var(--bg);
  border-radius: 6px;
  word-break: break-all;
  font-size: 0.8rem;
}

footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 1.5rem;
}

/* ---- Auth pages (signup/login) ---- */

.auth-section {
  display: flex;
  justify-content: center;
  padding: 3rem 0;
}

.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2.25rem;
  width: 100%;
  max-width: 380px;
}

.auth-card h1 {
  font-size: 1.5rem;
  margin: 0 0 0.4rem;
  text-align: center;
}

.auth-sub {
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
  margin: 0 0 1.5rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.auth-form label {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.6rem;
}

.auth-form input {
  padding: 0.75rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
}

.auth-form button {
  margin-top: 1.25rem;
  padding: 0.8rem;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: white;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.auth-switch {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 1.5rem 0 0;
}
.auth-switch a { color: var(--accent); }

/* ---- Dashboard ---- */

.dash-header { padding: 2.5rem 0 1.5rem; }
.dash-header h1 { margin: 0 0 0.3rem; }
.dash-sub { color: var(--muted); margin: 0; font-size: 0.92rem; }

.back-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
}
.back-link:hover { color: var(--text); }

.upgrade-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2rem 2.25rem;
}
.upgrade-card h2 { margin: 0 0 0.9rem; font-size: 1.2rem; }
.upgrade-card p { color: var(--muted); line-height: 1.6; margin: 0 0 0.75rem; }
.upgrade-note { font-style: italic; }

.add-domain-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.add-domain-card h2 { margin: 0 0 1rem; font-size: 1.1rem; }

.inline-form {
  display: flex;
  gap: 0.5rem;
}
.inline-form input {
  flex: 1;
  padding: 0.75rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
  min-width: 0;
}
.inline-form button {
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: white;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.dash-hint {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0.75rem 0 0;
}

.dash-empty {
  color: var(--muted);
  text-align: center;
  padding: 2rem 0;
}

.domains-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.domain-row {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.domain-row-main { display: flex; flex-direction: column; gap: 0.2rem; }

.domain-row-name {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}
.domain-row-name:hover { color: var(--accent); }

.domain-row-meta { color: var(--muted); font-size: 0.82rem; }

.domain-row-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* ---- Domain history page ---- */

.section-heading-left {
  font-size: 1.25rem;
  margin: 0 0 1.25rem;
}

.score-inline {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.75rem;
}
.score-inline .score-circle { margin: 0; width: 90px; height: 90px; font-size: 1.3rem; }

.history-table {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.history-row {
  display: grid;
  grid-template-columns: 200px 90px 1fr;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  align-items: center;
}
.history-row:last-child { border-bottom: none; }

.history-head {
  background: var(--card);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.history-flagged { background: color-mix(in srgb, var(--warn) 6%, transparent); }

.history-score { font-weight: 700; }
.score-text-pass { color: var(--pass); }
.score-text-warn { color: var(--warn); }
.score-text-fail { color: var(--fail); }

/* ---- Admin ---- */

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.stat-tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.stat-value { font-size: 1.6rem; font-weight: 700; }
.stat-value.stat-alert { color: var(--warn); }
.stat-label { color: var(--muted); font-size: 0.8rem; }

.user-table {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  overflow-x: auto;
}

.user-row {
  display: grid;
  grid-template-columns: 1fr 110px 80px 140px 1fr;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  align-items: center;
}
.user-row:last-child { border-bottom: none; }

.user-row-head {
  background: var(--card);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.user-email { font-weight: 600; word-break: break-all; }

.user-badges { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.badge-paid { background: color-mix(in srgb, var(--pass) 20%, transparent); color: var(--pass); }
.badge-free { background: color-mix(in srgb, var(--muted) 20%, transparent); color: var(--muted); }
.badge-admin { background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--accent); }

.user-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.user-you { color: var(--muted); font-size: 0.82rem; }

@media (max-width: 600px) {
  .hero h1 { font-size: 1.7rem; }
  .hero-sub { font-size: 1rem; }
  .check-form form, .hero-form, .inline-form { flex-direction: column; }
  .history-row { grid-template-columns: 1fr; gap: 0.25rem; }
  .score-inline { flex-direction: column; align-items: flex-start; }
  .user-row { grid-template-columns: 1fr; gap: 0.3rem; }
}
