/* ─── Account page (/auth/account) ───────────────────────────────────
   Builds on lightcurves-page.css for the top navbar buttons; everything
   here is scoped to body.account-page. Same palette as api-page.css.  */

body.account-page {
  --acct-ink: #1a1a1a;
  --acct-ink-2: #4a4a52;
  --acct-ink-3: #7a7a85;
  --acct-line: #e4e4ea;
  --acct-surface: #ffffff;
  --acct-tint: #f3f3f6;
  --acct-green: #0b6e4f;
  --acct-green-bg: #e0f3e9;
  --acct-red: #a8321f;
  --acct-red-bg: #fbe9e5;
  --acct-link: #2f5fa8;
  --mono: 'Source Code Pro', 'Courier New', monospace;
  --nav-h: 100px;
  background: #f9f9f9;
}

/* ─── Navbar: full width (no sidebar on this page) ───────────────── */
body.account-page #top-navbar.acct-navbar {
  left: 0;
  width: 100%;
  gap: 32px;
}

.acct-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #1a1a2e;
  text-decoration: none;
}

body.account-page .acct-nav-links {
  margin-left: 0;
}

.acct-logout {
  margin-left: auto;
  padding: 9px 14px;
  border-radius: 8px;
  background: var(--acct-tint);
  color: var(--acct-ink);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease;
}

.acct-logout:hover {
  background: #e6e6ec;
}

/* ─── Page column ────────────────────────────────────────────────── */
body.account-page main.acct {
  max-width: 820px;
  margin: var(--nav-h) auto 0;
  padding: 56px 24px 120px;
  color: var(--acct-ink);
}

.acct code {
  font-family: var(--mono);
}

/* ─── Profile header ─────────────────────────────────────────────── */
.acct-profile {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 32px;
}

.acct-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--acct-green-bg);
  color: var(--acct-green);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.acct-profile-text {
  min-width: 0;
}

.acct-profile h1 {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.acct-profile p {
  margin-top: 4px;
  font-size: 0.98rem;
  color: var(--acct-ink-3);
  overflow-wrap: anywhere;
}

.acct-dot {
  margin: 0 6px;
}

/* ─── Flash messages ─────────────────────────────────────────────── */
.acct-flashes {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.acct-flash {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.93rem;
  border: 1px solid transparent;
}

.acct-flash-success { background: var(--acct-green-bg); border-color: #b9e2cd; color: var(--acct-green); }
.acct-flash-error   { background: var(--acct-red-bg);   border-color: #f3c7bd; color: var(--acct-red); }
.acct-flash-info    { background: #eef3fb;              border-color: #cfdcf1; color: #234a85; }

/* ─── Cards ──────────────────────────────────────────────────────── */
.acct-card {
  background: var(--acct-surface);
  border: 1px solid var(--acct-line);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(20, 20, 40, 0.04);
  padding: 28px 28px 26px;
  margin-bottom: 20px;
}

.acct-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.acct-card-head h2 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 4px;
}

.acct-card-head p {
  max-width: 520px;
  font-size: 0.93rem;
  line-height: 1.55;
  color: var(--acct-ink-2);
}

.acct-link {
  flex: none;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--acct-link);
  text-decoration: none;
  white-space: nowrap;
}

.acct-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ─── Buttons ────────────────────────────────────────────────────── */
.acct-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--acct-line);
  border-radius: 9px;
  background: var(--acct-surface);
  color: var(--acct-ink);
  font: 600 0.9rem 'Inter', sans-serif;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.acct-btn:hover {
  background: var(--acct-tint);
}

.acct-btn:focus-visible {
  outline: 2px solid var(--acct-green);
  outline-offset: 2px;
}

.acct-btn-primary {
  background: var(--acct-green-bg);
  border-color: var(--acct-green-bg);
  color: var(--acct-green);
}

.acct-btn-primary:hover {
  background: #d0e9dc;
  border-color: #d0e9dc;
}

.acct-btn-danger {
  color: var(--acct-red);
  border-color: #f3c7bd;
}

.acct-btn-danger:hover {
  background: var(--acct-red-bg);
}

.acct-btn-ghost {
  height: 34px;
  padding: 0 12px;
  font-size: 0.82rem;
}

/* ─── Status pills ───────────────────────────────────────────────── */
.acct-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.acct-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.acct-pill-ok  { background: var(--acct-green-bg); color: var(--acct-green); }
.acct-pill-off { background: var(--acct-tint); color: var(--acct-ink-3); }

/* ─── Active key row ─────────────────────────────────────────────── */
.acct-key {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 16px 28px;
  padding: 16px 18px;
  border: 1px solid var(--acct-line);
  border-radius: 12px;
  background: #fbfbfc;
}

.acct-key-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.acct-key-prefix {
  font-size: 0.92rem;
  font-weight: 500;
}

.acct-key-name {
  font-size: 0.85rem;
  color: var(--acct-ink-3);
}

.acct-key-meta {
  display: flex;
  gap: 24px;
}

.acct-key-meta dt {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--acct-ink-3);
  margin-bottom: 2px;
}

.acct-key-meta dd {
  font-size: 0.9rem;
  white-space: nowrap;
}

.acct-key-actions {
  display: flex;
  gap: 8px;
}

/* ─── New key reveal ─────────────────────────────────────────────── */
.acct-newkey {
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid #b9e2cd;
  border-radius: 12px;
  background: #f2faf6;
}

.acct-newkey-title {
  font-weight: 700;
  color: var(--acct-green);
  margin-bottom: 8px;
}

.acct-newkey-label {
  margin: 14px 0 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--acct-ink-2);
}

.acct-copyrow {
  display: flex;
  align-items: center;
  gap: 8px;
}

.acct-copyrow code {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid #b9e2cd;
  border-radius: 8px;
  background: #fff;
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.acct-newkey-warn {
  margin-top: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--acct-red);
}

.acct-newkey-note {
  margin-top: 4px;
  font-size: 0.85rem;
  color: var(--acct-ink-2);
}

/* ─── Empty state ────────────────────────────────────────────────── */
.acct-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border: 1px dashed #d4d4dc;
  border-radius: 12px;
  color: var(--acct-ink-2);
  font-size: 0.95rem;
}

/* ─── Daily usage meter ──────────────────────────────────────────── */
.acct-usage {
  margin-top: 18px;
}

.acct-usage-text {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
  margin-bottom: 8px;
  font-size: 0.88rem;
  color: var(--acct-ink-2);
}

.acct-usage-text strong {
  color: var(--acct-ink);
}

.acct-usage-reset {
  color: var(--acct-ink-3);
}

.acct-usage-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--acct-tint);
  overflow: hidden;
}

.acct-usage-bar span {
  display: block;
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
  background: var(--acct-green);
}

.acct-usage-full {
  margin-top: 10px;
  font-size: 0.88rem;
  color: var(--acct-red);
}

.acct-usage-full a {
  color: inherit;
  font-weight: 600;
}

/* ─── Previous keys ──────────────────────────────────────────────── */
.acct-history {
  margin-top: 16px;
  font-size: 0.88rem;
}

.acct-history summary {
  cursor: pointer;
  color: var(--acct-ink-3);
  font-weight: 500;
  width: max-content;
}

.acct-history summary:hover {
  color: var(--acct-ink);
}

.acct-history ul {
  list-style: none;
  margin-top: 10px;
  border-top: 1px solid var(--acct-line);
}

.acct-history li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 20px;
  padding: 10px 0;
  border-bottom: 1px solid var(--acct-line);
  color: var(--acct-ink-3);
}

.acct-history li code {
  color: var(--acct-ink-2);
  min-width: 150px;
}

.acct-history li .acct-pill {
  margin-left: auto;
}

/* ─── Password form ──────────────────────────────────────────────── */
.acct-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.acct-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--acct-ink-2);
}

.acct-form input {
  height: 42px;
  padding: 0 12px;
  border: 1px solid #d4d4dc;
  border-radius: 9px;
  background: #fff;
  font: 400 0.95rem 'Inter', sans-serif;
  color: var(--acct-ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.acct-form input:focus {
  outline: none;
  border-color: var(--acct-green);
  box-shadow: 0 0 0 3px rgba(11, 110, 79, 0.15);
}

.acct-form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
}

.acct-form-current {
  grid-column: 1 / -1;
}

.acct-form-current input {
  max-width: calc(50% - 8px);
}

/* ─── Standalone account pages (verify email, reset password) ────── */
body.auth-page main.acct {
  max-width: 480px;
}

.auth-card {
  padding: 32px 32px 28px;
}

.auth-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.auth-lead {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--acct-ink-2);
  margin-bottom: 24px;
}

.auth-lead strong {
  color: var(--acct-ink);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.auth-page-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-page-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--acct-ink-2);
}

.auth-page-form input {
  height: 44px;
  padding: 0 12px;
  border: 1px solid #d4d4dc;
  border-radius: 9px;
  background: #fff;
  font: 400 0.95rem 'Inter', sans-serif;
  color: var(--acct-ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-page-form input:focus {
  outline: none;
  border-color: var(--acct-green);
  box-shadow: 0 0 0 3px rgba(11, 110, 79, 0.15);
}

.auth-page-form input.auth-code-input {
  height: 60px;
  font: 600 1.9rem var(--mono);
  letter-spacing: 0.45em;
  text-align: center;
  /* letter-spacing adds space after the last digit too; balance it */
  padding-left: calc(12px + 0.45em);
}

.auth-page-form input.auth-code-input::placeholder {
  color: #d4d4dc;
}

.auth-submit {
  width: 100%;
  height: 44px;
  font-size: 0.95rem;
  text-decoration: none;
}

.auth-secondary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--acct-line);
}

.auth-secondary p {
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--acct-ink-2);
}

.auth-footnote {
  margin-top: 20px;
  font-size: 0.88rem;
  color: var(--acct-ink-3);
}

/* ─── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .acct-key {
    grid-template-columns: minmax(0, 1fr);
  }
  .acct-card-head {
    flex-direction: column;
    gap: 8px;
  }
}

@media (max-width: 640px) {
  body.account-page {
    --nav-h: 64px;
  }
  body.account-page #top-navbar.acct-navbar {
    height: var(--nav-h);
    padding: 0 16px;
    gap: 12px;
  }
  .acct-logo {
    font-size: 1.35rem;
  }
  body.account-page .acct-nav-links {
    gap: 4px;
  }
  body.account-page .acct-nav-links .top-nav-btn {
    font-size: 14px;
    padding: 6px 6px;
  }
  .acct-logout {
    padding: 7px 10px;
    font-size: 13px;
  }
  body.account-page main.acct {
    padding: 28px 16px 80px;
  }
  .acct-profile h1 {
    font-size: 1.5rem;
  }
  .acct-avatar {
    width: 52px;
    height: 52px;
    font-size: 1.15rem;
  }
  .acct-card {
    padding: 20px 18px;
  }
  .acct-form {
    grid-template-columns: minmax(0, 1fr);
  }
  .acct-form-current input {
    max-width: none;
  }
  .auth-card {
    padding: 24px 20px;
  }
  .auth-secondary {
    flex-direction: column;
    align-items: stretch;
  }
  /* iOS zooms the page when an input smaller than 16px gets focus */
  .acct-form input,
  .auth-page-form input {
    font-size: 16px;
  }
  .acct-form-actions {
    justify-content: stretch;
  }
  .acct-form-actions .acct-btn {
    width: 100%;
  }
  .acct-empty {
    flex-direction: column;
    align-items: flex-start;
  }
}
