/* ==========================================================================
   EmailControl — global stylesheet
   All colors/spacing come from the custom properties below (single source
   of truth). Mobile-first; breakpoints at 480 / 768 / 1024 / 1280px.
   ========================================================================== */

:root {
  /* Brand palette */
  --color-dark: #0a1628;        /* deep navy */
  --color-accent: #4f8eff;      /* electric blue */
  --color-accent-dark: #2f6fe0;
  --color-success: #10b981;     /* health 80-100 */
  --color-warning: #f59e0b;     /* health 50-79 */
  --color-danger: #ef4444;      /* health < 50 / blacklisted */
  --color-bg: #f8f9fa;
  --color-card: #ffffff;
  --color-border: #e5e7eb;
  --color-text: #111827;
  --color-text-2: #6b7280;

  /* Typography */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;

  /* Spacing scale */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;
  --sp-8: 4rem;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(10, 22, 40, 0.08), 0 4px 14px rgba(10, 22, 40, 0.06);
  --shadow-lg: 0 8px 30px rgba(10, 22, 40, 0.14);
  --container: 1200px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}
h1 { font-size: 2rem; font-weight: 800; line-height: 1.2; margin: 0 0 var(--sp-4); }
h2 { font-size: 1.5rem; font-weight: 600; line-height: 1.3; margin: 0 0 var(--sp-4); }
h3 { font-size: 1.25rem; font-weight: 600; margin: 0 0 var(--sp-3); }
@media (min-width: 768px) {
  h1 { font-size: 2.5rem; }
  h2 { font-size: 1.75rem; }
}
p { margin: 0 0 var(--sp-4); }
a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
code, pre { font-family: var(--font-mono); font-size: 0.875rem; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 var(--sp-4); }
section { padding: var(--sp-7) 0; }
.section-title { text-align: center; margin-bottom: var(--sp-6); }
.text-center { text-align: center; }
.text-muted { color: var(--color-text-2); }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }

/* ---------- Buttons (min 44px touch target) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 44px; padding: 0.65rem 1.4rem;
  border-radius: var(--radius-sm); border: 2px solid transparent;
  font-weight: 600; font-size: 1rem; font-family: inherit;
  cursor: pointer; text-decoration: none !important; transition: all 0.15s ease;
}
.btn-primary { background: var(--color-accent); color: #fff; }
.btn-primary:hover { background: var(--color-accent-dark); }
.btn-outline { background: transparent; color: var(--color-accent); border-color: var(--color-accent); }
.btn-outline:hover { background: var(--color-accent); color: #fff; }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { filter: brightness(0.9); }
.btn-light { background: #fff; color: var(--color-dark); }
.btn-sm { min-height: 40px; padding: 0.45rem 1rem; font-size: 0.9rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
/* A disabled CTA must not keep the brand fill that reads as "this works".
   Neutralise the colour and kill hover so it can never look clickable. */
.btn:disabled,
.btn[aria-disabled="true"] {
  background: var(--color-border, #d5dbe4);
  border-color: var(--color-border, #d5dbe4);
  color: #5b6472;
  box-shadow: none;
  pointer-events: none;
}

/* ---------- Header / Nav ---------- */
.site-header {
  background: var(--color-dark); position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}
.nav-wrap { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: var(--sp-4); }
.brand { display: flex; align-items: center; gap: var(--sp-2); color: #fff; font-size: 1.2rem; font-weight: 500; text-decoration: none !important; }
.brand strong { font-weight: 800; color: var(--color-accent); }
.brand-icon { color: var(--color-accent); font-size: 1.4rem; }
.nav-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; background: none; border: none; color: #fff; font-size: 1.3rem; cursor: pointer;
}
.site-nav {
  display: none; position: absolute; top: 64px; left: 0; right: 0;
  flex-direction: column; gap: var(--sp-3); padding: var(--sp-4);
  background: var(--color-dark); border-top: 1px solid rgba(255,255,255,0.08);
}
.site-nav.open { display: flex; }
.site-nav a { color: #e5e7eb; font-weight: 500; padding: var(--sp-2) 0; }
.site-nav a:hover { color: #fff; text-decoration: none; }
.site-nav .nav-muted { color: #9ca3af; }
@media (min-width: 1024px) {
  .nav-toggle { display: none; }
  .site-nav {
    display: flex; position: static; flex-direction: row; align-items: center;
    background: none; border: none; padding: 0; gap: var(--sp-5);
  }
}

/* ---------- Hero ---------- */
.hero { background: linear-gradient(160deg, var(--color-dark) 0%, #12233f 70%, #16305a 100%); color: #fff; padding: var(--sp-8) 0; }
.hero h1 { color: #fff; max-width: 860px; }
.hero .hero-sub { font-size: 1.15rem; color: #c3cbd9; max-width: 720px; margin-bottom: var(--sp-5); }
.hero-cta-row { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; }
.hero-note { color: #8fa0b8; font-size: 0.9rem; margin-top: var(--sp-3); }

/* ---------- Demo widget (illustrative only) ---------- */
.demo-widget {
  background: var(--color-card); color: var(--color-text);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: var(--sp-5); max-width: 560px; margin-top: var(--sp-6);
}
.demo-widget h3 { display: flex; align-items: center; gap: var(--sp-2); }
.demo-form { display: flex; flex-direction: column; gap: var(--sp-3); }
@media (min-width: 480px) { .demo-form { flex-direction: row; } .demo-form input { flex: 1; } }
.demo-result { margin-top: var(--sp-4); display: none; }
.demo-result.visible { display: block; }
.demo-score-row { display: flex; align-items: center; gap: var(--sp-4); }
.demo-checks { list-style: none; padding: 0; margin: var(--sp-3) 0 0; font-size: 0.9rem; }
.demo-checks li { padding: var(--sp-1) 0; color: var(--color-text-2); }
.demo-checks li i { width: 1.4em; }
.demo-disclaimer { font-size: 0.78rem; color: var(--color-text-2); margin: var(--sp-3) 0 0; }

/* ---------- Health score ring / value ---------- */
.score { font-weight: 800; font-size: 2rem; line-height: 1; }
.score-good { color: var(--color-success); }
.score-warn { color: var(--color-warning); }
.score-bad { color: var(--color-danger); }
.score-ring {
  --pct: 100; --ring-color: var(--color-success);
  width: 84px; height: 84px; border-radius: 50%; flex: 0 0 auto;
  background: conic-gradient(var(--ring-color) calc(var(--pct) * 1%), var(--color-border) 0);
  display: flex; align-items: center; justify-content: center;
}
.score-ring > span {
  width: 66px; height: 66px; border-radius: 50%; background: var(--color-card);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.25rem;
}

/* ---------- Cards ---------- */
.card { background: var(--color-card); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--sp-5); }
.card + .card { margin-top: var(--sp-4); }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.grid { display: grid; gap: var(--sp-4); }
@media (min-width: 768px)  { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .grid-4 { grid-template-columns: repeat(4, 1fr); } }

/* ---------- Steps (How it works) ---------- */
.steps { display: grid; gap: var(--sp-4); counter-reset: step; }
@media (min-width: 768px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step { background: var(--color-card); border: 1px solid var(--color-border); border-radius: var(--radius); padding: var(--sp-5); position: relative; }
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%; background: var(--color-accent);
  color: #fff; font-weight: 700; margin-bottom: var(--sp-3);
}

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; background: var(--color-card); border-radius: var(--radius); overflow: hidden; }
table.data th, table.data td { padding: var(--sp-3) var(--sp-4); text-align: left; border-bottom: 1px solid var(--color-border); font-size: 0.95rem; }
table.data th { background: var(--color-dark); color: #fff; font-weight: 600; white-space: nowrap; }
table.data tr:last-child td { border-bottom: none; }
table.data td .fa-check { color: var(--color-success); }
table.data td .fa-xmark { color: var(--color-danger); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 0.35em; padding: 0.2em 0.65em; border-radius: 999px; font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.badge-pass, .badge-clean { background: rgba(16, 185, 129, 0.12); color: #0a7d5a; }
.badge-fail, .badge-listed { background: rgba(239, 68, 68, 0.12); color: #b91c1c; }
.badge-missing, .badge-warn { background: rgba(245, 158, 11, 0.14); color: #92600a; }
.badge-neutral { background: rgba(107, 114, 128, 0.12); color: var(--color-text-2); }
.badge-plan { background: rgba(79, 142, 255, 0.14); color: var(--color-accent-dark); text-transform: uppercase; letter-spacing: 0.04em; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: var(--sp-4); }
.form-group label { display: block; font-weight: 600; margin-bottom: var(--sp-2); font-size: 0.95rem; }
input[type="text"], input[type="email"], input[type="password"], select, textarea {
  width: 100%; min-height: 44px; padding: 0.6rem 0.9rem;
  border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 1rem; color: var(--color-text); background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--color-accent); outline-offset: 1px; border-color: var(--color-accent); }
.form-hint { font-size: 0.85rem; color: var(--color-text-2); margin-top: var(--sp-1); }
.auth-card { max-width: 440px; margin: var(--sp-7) auto; }

/* ---------- Flash messages ---------- */
.flash { padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-sm); margin-bottom: var(--sp-4); font-size: 0.95rem; }
.flash-success { background: rgba(16, 185, 129, 0.12); color: #0a7d5a; border: 1px solid rgba(16,185,129,0.3); }
.flash-error { background: rgba(239, 68, 68, 0.1); color: #b91c1c; border: 1px solid rgba(239,68,68,0.3); }
.flash-info { background: rgba(79, 142, 255, 0.1); color: var(--color-accent-dark); border: 1px solid rgba(79,142,255,0.3); }

/* ---------- Pricing ---------- */
.pricing-cards { display: grid; gap: var(--sp-4); align-items: stretch; }
@media (min-width: 768px) { .pricing-cards { grid-template-columns: repeat(3, 1fr); } }
.price-card { display: flex; flex-direction: column; background: var(--color-card); border: 1px solid var(--color-border); border-radius: var(--radius); padding: var(--sp-5); box-shadow: var(--shadow); }
.price-card.featured { border: 2px solid var(--color-accent); position: relative; }
.price-card .plan-flag { position: absolute; top: -13px; left: 50%; transform: translateX(-50%); background: var(--color-accent); color: #fff; font-size: 0.75rem; font-weight: 700; padding: 2px 12px; border-radius: 999px; }
.price-amount { font-size: 2.4rem; font-weight: 800; margin: var(--sp-2) 0; }
.price-amount small { font-size: 1rem; font-weight: 500; color: var(--color-text-2); }
.price-features { list-style: none; padding: 0; margin: 0 0 var(--sp-5); flex: 1; }
.price-features li { padding: var(--sp-2) 0; border-bottom: 1px solid var(--color-border); font-size: 0.95rem; }
.price-features li i { color: var(--color-success); margin-right: var(--sp-2); }
.price-features li.na { color: var(--color-text-2); }
.price-features li.na i { color: var(--color-border); }

/* ---------- FAQ accordion ---------- */
.faq-list { max-width: 800px; margin: 0 auto; }
.faq-item { background: var(--color-card); border: 1px solid var(--color-border); border-radius: var(--radius); margin-bottom: var(--sp-3); overflow: hidden; }
.faq-q {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3);
  background: none; border: none; text-align: left; cursor: pointer;
  padding: var(--sp-4) var(--sp-5); font-family: inherit; font-size: 1.05rem; font-weight: 600; color: var(--color-text); min-height: 44px;
}
.faq-q i { transition: transform 0.2s; color: var(--color-accent); flex: 0 0 auto; }
.faq-item.open .faq-q i { transform: rotate(180deg); }
.faq-a { display: none; padding: 0 var(--sp-5) var(--sp-4); color: var(--color-text-2); }
.faq-item.open .faq-a { display: block; }

/* ---------- Dashboard ---------- */
.dash-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); margin: var(--sp-5) 0; }
.domain-cards { display: grid; gap: var(--sp-4); grid-template-columns: 1fr; }
@media (min-width: 768px)  { .domain-cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1280px) { .domain-cards { grid-template-columns: repeat(3, 1fr); } }
.domain-card { background: var(--color-card); border: 1px solid var(--color-border); border-radius: var(--radius); padding: var(--sp-5); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: var(--sp-3); }
.domain-card-top { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.domain-name { font-weight: 700; font-size: 1.05rem; word-break: break-all; }
.domain-badges { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.domain-meta { font-size: 0.82rem; color: var(--color-text-2); }
.chart-box { position: relative; width: 100%; min-height: 220px; }
.chart-box canvas { max-width: 100%; }

/* Sticky Add Domain button on mobile dashboards */
.sticky-add {
  position: fixed; bottom: var(--sp-4); left: var(--sp-4); right: var(--sp-4); z-index: 90;
  display: flex; box-shadow: var(--shadow-lg);
}
@media (min-width: 768px) { .sticky-add { display: none; } }
body.has-sticky-add main { padding-bottom: 90px; }

/* ---------- Alerts feed ---------- */
.alert-list { list-style: none; padding: 0; margin: 0; }
.alert-item { display: flex; gap: var(--sp-3); padding: var(--sp-3) 0; border-bottom: 1px solid var(--color-border); align-items: flex-start; }
.alert-item:last-child { border-bottom: none; }
.alert-item.unread { background: rgba(79, 142, 255, 0.05); }
.alert-icon { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.95rem; }
.alert-icon.danger { background: rgba(239,68,68,0.12); color: var(--color-danger); }
.alert-icon.success { background: rgba(16,185,129,0.12); color: var(--color-success); }
.alert-icon.warn { background: rgba(245,158,11,0.14); color: var(--color-warning); }
.alert-time { font-size: 0.8rem; color: var(--color-text-2); }

/* ---------- Record / code display ---------- */
.record-box {
  background: var(--color-dark); color: #d7e2f3; border-radius: var(--radius-sm);
  padding: var(--sp-3) var(--sp-4); font-family: var(--font-mono); font-size: 0.85rem;
  overflow-x: auto; white-space: pre-wrap; word-break: break-all; margin: var(--sp-2) 0 var(--sp-3);
}
.fix-hint { display: flex; gap: var(--sp-2); align-items: flex-start; background: rgba(245,158,11,0.1); border-left: 3px solid var(--color-warning); padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-sm); font-size: 0.9rem; }

/* ---------- Ad placeholders (AdSense readiness) ---------- */
.ad-slot { display: flex; align-items: center; justify-content: center; background: #eef1f5; border: 1px dashed var(--color-border); color: var(--color-text-2); font-size: 0.8rem; margin: var(--sp-5) auto; }
.ad-leaderboard { width: 100%; max-width: 728px; height: 90px; }
.ad-rectangle { width: 300px; height: 250px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--color-dark); color: #9ca3af; margin-top: var(--sp-8); padding: var(--sp-7) 0 var(--sp-4); }
.footer-grid { display: grid; gap: var(--sp-5); grid-template-columns: 1fr; }
@media (min-width: 768px)  { .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.footer-col h3 { color: #fff; font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: var(--sp-3); }
.footer-col a { display: block; color: #9ca3af; padding: var(--sp-1) 0; }
.footer-col a:hover { color: #fff; text-decoration: none; }
.brand-footer { margin-bottom: var(--sp-3); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.08); margin-top: var(--sp-5); padding-top: var(--sp-4); font-size: 0.85rem; }

/* ---------- Cookie banner ---------- */
.cookie-banner {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; justify-content: center;
  background: var(--color-dark); color: #d1d5db; padding: var(--sp-3) var(--sp-4);
  box-shadow: 0 -4px 20px rgba(10,22,40,0.3); font-size: 0.9rem;
}
.cookie-banner p { margin: 0; }
.cookie-banner a { color: var(--color-accent); }

/* ---------- Blog ---------- */
.blog-layout { display: grid; gap: var(--sp-5); }
@media (min-width: 1024px) { .blog-layout { grid-template-columns: minmax(0, 1fr) 320px; } }
.post-card { background: var(--color-card); border: 1px solid var(--color-border); border-radius: var(--radius); padding: var(--sp-5); margin-bottom: var(--sp-4); }
.post-card h2 { margin-bottom: var(--sp-2); }
.post-meta { font-size: 0.85rem; color: var(--color-text-2); margin-bottom: var(--sp-3); }
.post-body h2, .post-body h3 { margin-top: var(--sp-5); }
.post-body img { border-radius: var(--radius-sm); }
.post-body pre { background: var(--color-dark); color: #d7e2f3; padding: var(--sp-4); border-radius: var(--radius-sm); overflow-x: auto; }

/* ---------- Utility / page scaffolding ---------- */
.page-head { background: var(--color-dark); color: #fff; padding: var(--sp-6) 0; }
.page-head h1 { color: #fff; margin-bottom: var(--sp-2); }
.page-head p { color: #c3cbd9; margin: 0; max-width: 760px; }
.prose { max-width: 800px; }
.prose h2 { margin-top: var(--sp-6); }
.tldr { background: rgba(79,142,255,0.08); border-left: 4px solid var(--color-accent); padding: var(--sp-4) var(--sp-5); border-radius: var(--radius-sm); margin-bottom: var(--sp-5); }
.tldr strong { color: var(--color-accent-dark); }
