/* cf-auth-app — shared styles */
:root {
  --bg: #0b0d10;
  --surface: #141821;
  --surface-2: #1c212d;
  --border: #2a3040;
  --text: #e7ebf0;
  --text-muted: #9aa3b2;
  --text-dim: #6b7280;
  --accent: #4f8bff;
  --accent-hover: #6aa0ff;
  --accent-dim: rgba(79, 139, 255, 0.12);
  --accent-fg: #0b0d10;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #eab308;
  --radius: 10px;
  --radius-sm: 6px;
  color-scheme: light dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* Header */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.brand {
  font-family: "Syne", "Google Sans Display", "Roboto", -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  font-size: 18px;
  display: inline-flex;
  align-items: center;
}
.brand:hover { text-decoration: none; color: var(--text); }
.nav { display: flex; gap: 20px; align-items: center; }
.nav a {
  color: var(--text-muted);
  font-size: 14px;
  font-family: "Google Sans Display", "Roboto", -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 500;
}
.nav a:hover { color: var(--text); }

/* Layout */
.center-wrap {
  min-height: calc(100vh - 60px);
  display: flex; align-items: center; justify-content: center;
  padding: 40px 20px;
}
.card {
  width: 100%; max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}
.card h1 { margin: 0 0 8px; font-size: 22px; letter-spacing: -0.01em; }
.card .lead { color: var(--text-muted); font-size: 14px; margin: 0 0 24px; }

/* Forms */
.field { margin-bottom: 16px; }
.field label {
  display: block; margin-bottom: 6px;
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted);
}
.field input {
  width: 100%;
  padding: 11px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.12s;
}
.field input:focus { outline: none; border-color: var(--accent); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 11px 18px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s;
  text-decoration: none;
}
.btn:hover { background: var(--border); text-decoration: none; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-fg); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 13px; }

/* Messages */
.msg {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin: 16px 0;
  line-height: 1.5;
}
.msg.error   { background: rgba(239, 68, 68, 0.1);  border: 1px solid rgba(239, 68, 68, 0.3);  color: #fca5a5; }
.msg.success { background: rgba(34, 197, 94, 0.1);  border: 1px solid rgba(34, 197, 94, 0.3);  color: #86efac; }
.msg.warning { background: rgba(234, 179, 8, 0.1);  border: 1px solid rgba(234, 179, 8, 0.3);  color: #fde68a; }
.msg:empty { display: none; }

.form-footer {
  margin-top: 22px; padding-top: 18px;
  border-top: 1px solid var(--border);
  text-align: center; font-size: 13px; color: var(--text-muted);
}
.form-footer a { font-weight: 500; }

/* Landing page */
.hero {
  padding: 80px 28px;
  text-align: center;
  max-width: 720px;
  margin: 0 auto;
}
.hero h1 { font-size: 40px; letter-spacing: -0.02em; margin: 0 0 16px; }
.hero .sub { font-size: 17px; color: var(--text-muted); margin: 0 auto 32px; max-width: 520px; }
.hero .actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Dashboard */
.dashboard-wrap { max-width: 960px; margin: 0 auto; padding: 40px 28px; }
.dashboard-wrap h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: -0.01em; }
.dashboard-wrap .greeting { color: var(--text-muted); margin-bottom: 28px; }

.panel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.panel .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 6px; }
.panel .val { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.panel .val.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; font-weight: 400; color: var(--text-muted); }

.loading { color: var(--text-muted); font-size: 14px; text-align: center; padding: 30px; }

/* Pricing page */
.pricing-hero { text-align: center; padding: 60px 28px 20px; max-width: 780px; margin: 0 auto; }
.pricing-hero h1 { font-size: 34px; letter-spacing: -0.02em; margin: 0 0 12px; }
.pricing-hero .sub { color: var(--text-muted); margin: 0; font-size: 16px; }

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  max-width: 1040px;
  margin: 32px auto 60px;
  padding: 0 28px;
}
.plan {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  display: flex; flex-direction: column;
  position: relative;
}
.plan.is-featured {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.plan-badge {
  position: absolute;
  top: -10px; left: 50%;
  transform: translateX(-50%);
  background: var(--accent); color: var(--accent-fg);
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 10px;
}
.plan-name { font-size: 18px; font-weight: 700; margin: 0 0 4px; }
.plan-desc { color: var(--text-muted); font-size: 13px; margin: 0 0 20px; min-height: 36px; }
.plan-price { font-size: 36px; font-weight: 700; letter-spacing: -0.02em; margin: 0; line-height: 1; }
.plan-price-unit { color: var(--text-muted); font-size: 14px; font-weight: 500; margin-left: 4px; }
.plan-credits { margin: 12px 0 20px; font-size: 14px; color: var(--text-muted); }
.plan-credits strong { color: var(--text); }
.plan-features { list-style: none; padding: 0; margin: 0 0 24px; flex: 1; }
.plan-features li { font-size: 13px; color: var(--text-muted); padding: 7px 0; display: flex; gap: 8px; align-items: flex-start; }
.plan-features li::before {
  content: '✓'; color: var(--success); font-weight: 700; flex-shrink: 0;
}
.plan-cta { margin-top: auto; }

.pricing-fine {
  max-width: 780px; margin: 0 auto 60px; padding: 0 28px;
  text-align: center; color: var(--text-muted); font-size: 13px; line-height: 1.7;
}

/* Billing page */
.billing-wrap { max-width: 840px; margin: 0 auto; padding: 40px 28px; }
.billing-wrap h1 { font-size: 26px; margin: 0 0 24px; letter-spacing: -0.01em; }

.billing-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}
.billing-section h2 { margin: 0 0 14px; font-size: 16px; }
.billing-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.billing-row:last-child { border-bottom: none; }
.billing-row .k { color: var(--text-muted); }
.billing-row .v { color: var(--text); font-weight: 500; }

.status-pill {
  display: inline-block; padding: 3px 10px;
  border-radius: 12px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.status-pill.active    { background: rgba(34,197,94,0.15); color: #86efac; }
.status-pill.past_due  { background: rgba(234,179,8,0.15); color: #fde68a; }
.status-pill.canceled  { background: rgba(239,68,68,0.15); color: #fca5a5; }
.status-pill.none, .status-pill.incomplete { background: var(--surface-2); color: var(--text-muted); }

.credits-bar {
  height: 8px; border-radius: 4px; background: var(--surface-2);
  overflow: hidden; margin: 12px 0 8px;
}
.credits-bar-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.3s; }
.credits-bar-fill.low { background: var(--warning); }
.credits-bar-fill.empty { background: var(--danger); }

.credit-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  background: var(--accent-dim); border: 1px solid var(--accent);
  border-radius: 12px;
  font-size: 12px; font-weight: 600;
  color: var(--accent);
  font-family: ui-monospace, Menlo, Consolas, monospace;
}

/* Success / cancel pages */
.outcome-wrap { text-align: center; max-width: 460px; margin: 0 auto; padding: 80px 28px; }
.outcome-icon { font-size: 48px; margin-bottom: 16px; }
.outcome-wrap h1 { margin: 0 0 10px; font-size: 24px; }
.outcome-wrap p { color: var(--text-muted); margin: 0 0 28px; }

/* WB_LIGHT_MODE_INSTALLED */
/* ---- System-driven light mode --------------------------------------- */
/* Activates automatically when the user's OS / browser is in light mode. */

@media (prefers-color-scheme: light) {
  :root {
    --bg:           #ffffff;
    --surface:      #f6f8fa;
    --surface-2:    #eceff3;
    --border:       #d6dbe2;
    --text:         #0b0d10;
    --text-muted:   #5a6472;
    --text-dim:     #8a93a0;
    --accent:       #2563eb;
    --accent-hover: #1d4ed8;
    --accent-dim:   rgba(37, 99, 235, 0.10);
    --accent-fg:    #ffffff;
    --danger:       #dc2626;
    --success:      #16a34a;
    --warning:      #ca8a04;
  }

  /* The few text colors that aren't variables — re-tune for white bg. */
  .msg.error          { color: #b91c1c; }
  .msg.success        { color: #166534; }
  .msg.warning        { color: #854d0e; }

  .status-pill.active    { color: #166534; background: rgba(22,163,74,0.12); }
  .status-pill.past_due  { color: #854d0e; background: rgba(202,138,4,0.14); }
  .status-pill.canceled  { color: #b91c1c; background: rgba(220,38,38,0.12); }

  /* Slightly stronger shadow under headers in light mode for depth. */
  .site-header {
    box-shadow: 0 1px 0 var(--border);
  }
}

/* WB_GOOGLE_COLORS_INSTALLED */
/* ------------------------------------------------------------------ */
/* Google brand colors + Roboto font                                  */
/* ------------------------------------------------------------------ */

/* Inject Google Fonts (Roboto + Google Sans-style fallback + Syne for the brand wordmark). */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&family=Google+Sans+Display:wght@400;500;700&family=Syne:wght@500;600;700;800&display=swap');

:root {
  /* Override accent + status colors with Google's palette */
  --accent:        #4285F4;        /* Google Blue */
  --accent-hover:  #1a73e8;        /* Google Blue darker */
  --accent-dim:    rgba(66, 133, 244, 0.12);
  --accent-fg:     #ffffff;        /* white text on blue button */
  --danger:        #EA4335;        /* Google Red */
  --success:       #34A853;        /* Google Green */
  --warning:       #FBBC04;        /* Google Yellow */
  /* Promote Google Sans / Roboto */
  font-family: "Google Sans Display", "Roboto", -apple-system,
               BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

body, .brand, .nav a, .btn, .field input,
.card h1, .hero h1, .hero .sub,
.dashboard-wrap h1, .pricing-hero h1, .pricing-hero .sub,
.plan-name, .plan-price, .plan-features li,
.billing-wrap h1, .billing-section h2,
.outcome-wrap h1, .outcome-wrap p {
  font-family: "Google Sans Display", "Roboto", -apple-system,
               BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

/* Light-mode tuning so Google blue still pops on white. */
@media (prefers-color-scheme: light) {
  :root {
    --accent:       #1a73e8;        /* Google Blue button color (darker for white bg) */
    --accent-hover: #1558b3;
    --accent-dim:   rgba(26, 115, 232, 0.10);
    --accent-fg:    #ffffff;
    --danger:       #d93025;        /* Google Red darker for light bg */
    --success:      #1e8e3e;        /* Google Green darker for light bg */
    --warning:      #f29900;        /* Google Yellow-orange darker for light bg */
  }
  /* Re-tune the message text colors to match darker palette */
  .msg.error          { color: #b3261e; }
  .msg.success        { color: #156c2c; }
  .msg.warning        { color: #b06000; }
  .status-pill.active    { color: #156c2c; background: rgba(30, 142, 62, 0.12); }
  .status-pill.past_due  { color: #b06000; background: rgba(242, 153, 0, 0.14); }
  .status-pill.canceled  { color: #b3261e; background: rgba(217, 48, 37, 0.12); }
}

/* Brand wordmark — distinctive Syne display font for the GridRank name */
.brand {
  font-family: "Syne", "Google Sans Display", "Roboto", -apple-system, sans-serif;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.015em;
}

/* Google's 4-color accent stripe under every page's header — only appears on hover
   (matches the auth page behavior; not a permanent visual element). */
.site-header,
#wb-site-header {
  position: relative;
}
.site-header::after,
#wb-site-header::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    #4285F4 0% 25%,
    #EA4335 25% 50%,
    #FBBC04 50% 75%,
    #34A853 75% 100%
  );
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  z-index: 5;
}
.site-header:hover::after,
#wb-site-header:hover::after { opacity: 1; }

/* Hide Pricing + Billing TEXT links in every logged-in page header — they're
   accessible via the profile icon. Exception: the profile icon itself is also
   <a href="/billing.html" id="wb-profile">, so we exclude it via :not(#wb-profile). */
#wb-site-header > nav > a.wb-desk[href="/pricing.html"],
#wb-site-header > nav > a.wb-desk[href="/billing.html"],
.site-header .nav > a[href="/pricing.html"],
.site-header .nav > a[href="/billing.html"]:not(#wb-profile) { display: none !important; }

/* The inline-styled brand link in tool.html uses its own font-family.
   Force Syne on the in-tool brand wordmark too so all pages stay aligned. */
#wb-site-header > a[href="/"] {
  font-family: "Syne", "Google Sans Display", "Roboto", -apple-system, sans-serif !important;
  font-weight: 700 !important;
  font-size: 18px !important;
}

/* tool.html inline-styled nav links default to 13px — force 14px to match
   .site-header .nav a used on ai-tracker, url-audit, billing. */
#wb-site-header > nav {
  font-size: 14px !important;
  gap: 20px !important;
}
#wb-site-header > nav > a.wb-desk {
  font-size: 14px !important;
  font-family: "Google Sans Display", "Roboto", -apple-system, BlinkMacSystemFont, sans-serif !important;
  font-weight: 500 !important;
}
#wb-logout {
  font-size: 13px !important;
  font-family: "Google Sans Display", "Roboto", -apple-system, BlinkMacSystemFont, sans-serif !important;
}

/* ============================================================== */
/* WB_DARK_MODE — full app dark theme + light/dark toggle button   */
/* Light is the default (no [data-theme] or [data-theme="light"])  */
/* Dark applies when [data-theme="dark"] is set on <html>          */
/* ============================================================== */

/* Explicit light theme — re-asserts the Google-blue palette so it wins over
   any OS prefers-color-scheme override in the earlier blocks. */
:root[data-theme="light"] {
  --bg:           #ffffff;
  --surface:      #f6f8fa;
  --surface-2:    #eceff3;
  --border:       #d6dbe2;
  --text:         #0b0d10;
  --text-muted:   #5a6472;
  --text-dim:     #8a93a0;
  --accent:       #1a73e8;
  --accent-hover: #1558b3;
  --accent-dim:   rgba(26, 115, 232, 0.10);
  --accent-fg:    #ffffff;
  --danger:       #d93025;
  --success:      #1e8e3e;
  --warning:      #f29900;
  color-scheme:   light;
}

/* Full dark theme — every page surface goes dark, not just card-bgs. */
:root[data-theme="dark"] {
  --bg:           #0b0d10;
  --surface:      #161b22;
  --surface-2:    #1c2230;
  --border:       #2a3040;
  --text:         #e7ebf0;
  --text-muted:   #9aa3b2;
  --text-dim:     #6b7280;
  --accent:       #4f8bff;
  --accent-hover: #6aa0ff;
  --accent-dim:   rgba(79, 139, 255, 0.12);
  --accent-fg:    #0b0d10;
  --danger:       #ef4444;
  --success:      #22c55e;
  --warning:      #eab308;
  color-scheme:   dark;
}
:root[data-theme="dark"] body { background: var(--bg); color: var(--text); }
:root[data-theme="dark"] .site-header { background: var(--surface); border-bottom-color: var(--border); }
:root[data-theme="dark"] .site-header .nav a { color: var(--text-muted); }
:root[data-theme="dark"] .site-header .nav a:hover,
:root[data-theme="dark"] .site-header .nav a.active { color: var(--text); }
:root[data-theme="dark"] .site-header .brand { color: var(--text); }
:root[data-theme="dark"] .card,
:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .plan,
:root[data-theme="dark"] .billing-section,
:root[data-theme="dark"] .pricing-fine { background: var(--surface); border-color: var(--border); color: var(--text); }
:root[data-theme="dark"] .field input,
:root[data-theme="dark"] .field select,
:root[data-theme="dark"] input[type="text"],
:root[data-theme="dark"] input[type="email"],
:root[data-theme="dark"] input[type="password"],
:root[data-theme="dark"] input[type="url"],
:root[data-theme="dark"] input[type="number"] { background: var(--bg); border-color: var(--border); color: var(--text); }
:root[data-theme="dark"] .field label { color: var(--text-muted); }
:root[data-theme="dark"] .billing-row { border-bottom-color: var(--border); }
:root[data-theme="dark"] .billing-row .k { color: var(--text-muted); }
:root[data-theme="dark"] .credit-chip,
:root[data-theme="dark"] .credits-chip,
:root[data-theme="dark"] #wb-credits-chip { background: var(--accent-dim); color: var(--accent); border-color: rgba(79,139,255,0.30); }
:root[data-theme="dark"] .btn:not(.btn-primary) { background: var(--surface-2); color: var(--text); border-color: var(--border); }
:root[data-theme="dark"] .btn:not(.btn-primary):hover { background: var(--border); }
:root[data-theme="dark"] .form-footer { border-top-color: var(--border); color: var(--text-muted); }
:root[data-theme="dark"] .msg.error   { color: #fca5a5; }
:root[data-theme="dark"] .msg.success { color: #86efac; }
:root[data-theme="dark"] .msg.warning { color: #fde68a; }
:root[data-theme="dark"] .loading { color: var(--text-muted); }
/* Footer (hardcoded inline styles in 19 pages) — recolor for dark mode. */
:root[data-theme="dark"] footer[style*="background:#fff"],
:root[data-theme="dark"] footer[style*="background:white"] {
  background: var(--bg) !important;
  color: var(--text-muted) !important;
  border-top-color: var(--border) !important;
}
:root[data-theme="dark"] footer a { color: var(--text-muted) !important; }
:root[data-theme="dark"] footer a:hover { color: var(--text) !important; }

/* iOS-style toggle switch — lives in the billing-page Display section
   ("Account → Display → Dark mode"). Click flips light/dark via WBTheme. */
.wb-theme-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  vertical-align: middle;
}
.wb-theme-switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #d6dbe2;                /* off track: visible against any bg */
  transition: background 0.18s ease;
}
:root[data-theme="dark"] .wb-theme-switch-track { background: rgba(255, 255, 255, 0.20); }
.wb-theme-switch.is-on .wb-theme-switch-track { background: var(--accent); }
:root[data-theme="dark"] .wb-theme-switch.is-on .wb-theme-switch-track { background: var(--accent); }
.wb-theme-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: transform 0.18s ease;
}
.wb-theme-switch.is-on .wb-theme-switch-thumb { transform: translateX(20px); }
.wb-theme-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

