/* ──────────────────────────────────────────────────────────────────
   Hafiz AI · auth.hafiz-ai.com
   Visual language matches hafiz-ai.com (Fraunces / Inter / green
   accent on near-black). Designed to feel like a calm, premium dev
   tool — not a generic SaaS dashboard.
   ────────────────────────────────────────────────────────────────── */

:root {
  --bg:        #f7faf7;
  --bg-card:   #ffffff;
  --ink:       #0a0f0c;
  --ink-soft:  #4d5c54;
  --ink-mute:  #889a90;
  --line:      rgba(15, 157, 88, 0.14);
  --line-soft: rgba(15, 157, 88, 0.08);
  --green:     #0f9d58;
  --green-2:   #6cc28e;
  --green-3:   #064d2b;
  --red:       #d96666;
  --amber:     #d99a26;
  --code-bg:   #0c1410;
  --code-text: #d6e4dc;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--green); text-decoration: underline; text-underline-offset: 3px; }
a:hover { color: var(--green-3); }
button { font: inherit; }
code, pre { font-family: "JetBrains Mono", ui-monospace, monospace; }

/* ── Top bar ─────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 10;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ink); font-weight: 700;
  font-size: 18px;
}
.brand img { width: 28px; height: 28px; border-radius: 8px; }
.topbar nav { display: flex; align-items: center; gap: 18px; }
.topbar nav a { color: var(--ink-soft); text-decoration: none; font-size: 14px; font-weight: 500; }
.topbar nav a:hover { color: var(--ink); }
.cta {
  background: var(--green); color: #fff; border: 0;
  padding: 8px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.cta:hover { transform: translateY(-1px); box-shadow: 0 8px 22px -10px rgba(15, 157, 88, 0.5); }
.cta.busy { pointer-events: none; position: relative; }
.cta.busy::before {
  content: "";
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.cta.secondary {
  background: transparent; color: var(--green); border: 1px solid var(--line);
}
.cta.secondary:hover { background: rgba(15, 157, 88, 0.06); }
.cta:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; transform: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Auth layout (sign-in / sign-up) ─────────────────────────────── */
.auth-shell {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 56px;
  max-width: 1080px;
  margin: 56px auto;
  padding: 0 24px;
  width: 100%;
}
@media (max-width: 880px) {
  .auth-shell { grid-template-columns: 1fr; gap: 36px; margin: 32px auto; }
  .auth-side { order: -1; }
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 40px 36px;
  box-shadow: 0 24px 60px -34px rgba(10, 15, 12, 0.20);
}
.auth-card .title {
  font-family: "Fraunces", Georgia, serif;
  font-size: 36px; font-weight: 600; letter-spacing: -0.02em;
  margin: 0 0 6px;
}
.auth-card .subtitle {
  color: var(--ink-soft); margin: 0 0 28px; font-size: 15px;
}

.provider-btn {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px 16px; margin-bottom: 10px;
  background: #fff; border: 1px solid var(--line);
  border-radius: 14px; font-weight: 600; font-size: 15px;
  cursor: pointer; transition: all .12s ease; color: var(--ink);
}
.provider-btn:hover { background: rgba(15, 157, 88, 0.04); border-color: var(--green-2); }
.provider-btn.apple { background: #000; color: #fff; border-color: #000; }
.provider-btn.apple:hover { background: #1a1a1a; }

.divider {
  text-align: center; position: relative; margin: 22px 0;
  color: var(--ink-mute); font-size: 12px; text-transform: uppercase; letter-spacing: 0.18em;
}
.divider::before, .divider::after {
  content: ""; position: absolute; top: 50%;
  width: 38%; height: 1px; background: var(--line);
}
.divider::before { left: 0; }
.divider::after { right: 0; }

.email-form { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span {
  font-size: 13px; font-weight: 600; color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.field input {
  padding: 11px 14px; border-radius: 12px;
  border: 1px solid var(--line); font-size: 15px; font-family: inherit;
  background: #fff; color: var(--ink);
  transition: border .12s ease, box-shadow .12s ease;
}
.field input:focus {
  outline: none; border-color: var(--green-2);
  box-shadow: 0 0 0 4px rgba(108, 194, 142, 0.18);
}
.submit {
  background: var(--green); color: #fff; border: 0;
  padding: 13px 16px; border-radius: 14px;
  font-weight: 600; font-size: 15px; cursor: pointer;
  margin-top: 6px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.submit:hover { transform: translateY(-1px); box-shadow: 0 10px 24px -10px rgba(15, 157, 88, 0.5); }
.legal { color: var(--ink-mute); font-size: 12px; line-height: 1.5; margin: 4px 0 0; }
.alt   { text-align: center; font-size: 14px; color: var(--ink-soft); margin: 18px 0 0; }
.status {
  margin: 14px 0 0; font-size: 14px; color: var(--ink-soft); min-height: 18px;
}
.status.error { color: var(--red); }
.status.ok    { color: var(--green-3); }
.status.floating {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: #fff;
  padding: 10px 18px; border-radius: 999px;
  font-size: 13px; font-weight: 500;
  box-shadow: 0 16px 40px -16px rgba(10, 15, 12, 0.4);
  z-index: 100; min-height: auto;
}
.status.floating.error { background: var(--red); }
.status.floating.ok    { background: var(--green); }

/* ── Side panel (sign-in marketing) ──────────────────────────────── */
.auth-side {
  padding: 12px 8px 0;
}
.auth-side h2 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 28px; font-weight: 600; margin: 0 0 14px; letter-spacing: -0.02em;
}
.auth-side p { color: var(--ink-soft); line-height: 1.6; margin: 0 0 18px; }
.auth-side ul { margin: 0 0 18px; padding: 0 0 0 18px; color: var(--ink-soft); }
.auth-side ul li { margin-bottom: 8px; line-height: 1.55; }
.snippet {
  background: var(--code-bg); color: var(--code-text);
  padding: 14px 16px; border-radius: 14px;
  font-size: 13px; line-height: 1.5; overflow-x: auto;
  margin: 0; white-space: pre;
}

/* ── Footer ──────────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--line);
  padding: 18px 32px;
  text-align: center;
  color: var(--ink-mute);
  font-size: 13px;
}

/* ── Dashboard ───────────────────────────────────────────────────── */
.dashboard { background: var(--bg); }
.dash-shell {
  flex: 1;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 36px;
  max-width: 1180px;
  margin: 40px auto;
  padding: 0 24px;
  width: 100%;
}
@media (max-width: 880px) {
  .dash-shell { grid-template-columns: 1fr; gap: 18px; margin: 24px auto; }
  .dash-side { display: none; }   /* keep it simple on mobile */
}

.dash-side {
  position: sticky; top: 96px; align-self: start;
}
.dash-side h5 {
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--green-2); margin: 18px 0 8px; font-weight: 700;
}
.dash-side h5:first-child { margin-top: 0; }
.dash-side a {
  display: block; padding: 7px 12px; border-radius: 10px;
  color: var(--ink-soft); text-decoration: none; font-size: 14px;
  transition: background .12s ease, color .12s ease;
}
.dash-side a:hover { background: rgba(15, 157, 88, 0.06); color: var(--ink); }
.dash-side a.active { background: rgba(15, 157, 88, 0.12); color: var(--green-3); font-weight: 600; }

.dash-content { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.who { color: var(--ink-soft); font-size: 13px; padding-right: 8px; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 28px 30px;
  box-shadow: 0 18px 40px -28px rgba(10, 15, 12, 0.15);
  scroll-margin-top: 96px;
}
.card h2 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 24px; font-weight: 600; letter-spacing: -0.015em;
  margin: 0 0 12px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}
.card-head .actions { display: flex; gap: 8px; }
.card .muted { color: var(--ink-mute); font-size: 14px; margin: 0 0 18px; }

.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin-top: 8px;
}
@media (max-width: 720px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat {
  background: rgba(15, 157, 88, 0.06);
  border-radius: 14px; padding: 14px 16px;
}
.stat-label {
  display: block; font-size: 11px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--green-3); margin-bottom: 6px;
}
.stat-value {
  font-size: 22px; font-weight: 700;
  font-family: "Fraunces", Georgia, serif; letter-spacing: -0.01em;
}
.progress {
  margin-top: 18px; height: 8px;
  background: rgba(15, 157, 88, 0.10); border-radius: 999px; overflow: hidden;
}
.progress-bar {
  height: 100%; width: 0%;
  background: var(--green);
  transition: width .35s ease;
  border-radius: 999px;
}

/* ── API key list ───────────────────────────────────────────────── */
.key-reveal {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  background: rgba(217, 154, 38, 0.12);
  border: 1px solid rgba(217, 154, 38, 0.30);
  padding: 14px 16px; border-radius: 14px;
  margin: 10px 0 18px;
}
.key-reveal strong { width: 100%; color: #6b4d11; font-size: 13px; }
.key-reveal code {
  flex: 1; padding: 8px 12px; background: #fff;
  border-radius: 8px; border: 1px solid rgba(217, 154, 38, 0.30);
  font-size: 13px; word-break: break-all;
}
.key-list { display: flex; flex-direction: column; gap: 8px; }
.key-row {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
  padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 12px; background: #fff;
}
.key-row.revoked { opacity: .55; }
.key-row code { font-size: 13px; }
.key-row .meta { display: flex; align-items: center; gap: 14px; color: var(--ink-mute); font-size: 13px; }
.badge {
  display: inline-block; padding: 2px 8px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  border-radius: 999px; margin-left: 8px;
}
.badge.live    { background: rgba(15, 157, 88, 0.18); color: var(--green-3); }
.badge.test    { background: rgba(108, 194, 142, 0.20); color: var(--green-3); }
.badge.revoked { background: rgba(217, 102, 102, 0.16); color: #8b2c2c; }
.link-btn {
  background: none; border: 0; padding: 0;
  color: var(--red); cursor: pointer; font-size: 13px;
  text-decoration: underline; text-underline-offset: 3px;
}

/* ── Plans ──────────────────────────────────────────────────────── */
.plans {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 16px; margin: 14px 0 16px;
}
@media (max-width: 820px) { .plans { grid-template-columns: 1fr; } }
.plan {
  background: #fff; border: 1px solid var(--line);
  border-radius: 18px; padding: 22px 22px 24px;
  position: relative;
}
.plan.featured {
  border-color: var(--green);
  box-shadow: 0 18px 40px -22px rgba(15, 157, 88, 0.35);
}
.plan .tier {
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--green-3); font-weight: 700;
}
.plan h3 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 24px; font-weight: 600; margin: 6px 0 8px;
}
.plan .price {
  font-size: 30px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 10px;
}
.plan .price span { font-size: 14px; font-weight: 500; color: var(--ink-soft); }
.plan ul {
  margin: 0 0 14px; padding-left: 18px;
  color: var(--ink-soft); font-size: 14px; line-height: 1.55;
}
.plan button { width: 100%; }

/* ── Usage strip ─────────────────────────────────────────────────── */
.usage-line {
  background: rgba(15, 157, 88, 0.05);
  padding: 12px 14px; border-radius: 12px;
  color: var(--ink-soft); font-size: 14px;
}
