/* css/account.css
   Account / settings — grouped-list layout, iOS/macOS Settings
   sensibility: inset rows with hairline dividers, not bordered cards.
*/
.account-page {
  background: var(--bg-base);
  min-height: 100vh;
}
.account-topbar {
  padding: var(--space-4) var(--space-5);
  padding-top: calc(var(--space-4) + env(safe-area-inset-top, 0px)); /* iPhone home-screen status bar */
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}
.account-back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-2);
  transition: color var(--duration-fast) var(--ease);
}
.account-back:hover { color: var(--text-1); }

.account-shell {
  max-width: 560px;
  margin: 0 auto;
  padding: var(--space-7) var(--space-5) var(--space-8);
}
.account-page-title {
  font-size: var(--text-3xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-1);
  margin-bottom: var(--space-2);
}
.account-intro {
  font-size: var(--text-sm);
  color: var(--text-3);
  margin: 0 0 var(--space-6);
  max-width: 46ch;
}

/* Secondary line under a settings-row-label — replaces the inline
   "display:block; font-size: var(--text-sm); color: var(--text-3);"
   triplet that used to be repeated at every call site. */
.settings-row-desc {
  display: block;
  font-size: var(--text-sm);
  color: var(--text-3);
}
.settings-row-desc + .settings-row-desc {
  font-size: var(--text-xs);
  margin-top: 2px;
}
.settings-row-desc--muted { color: var(--text-4); }
.settings-row-desc--positive {
  color: var(--success);
  display: flex;
  align-items: center;
  gap: 4px;
}
.settings-row-desc--positive i { font-size: 0.95em; }

/* Plan status — separated from the plan name so the two carry
   different weight: name is what plan you're on, badge is whether
   it's in good standing. */
.plan-status-badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  padding: 2px 9px;
  margin-top: 2px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
}
.plan-status-badge--success { background: color-mix(in srgb, var(--success) 16%, var(--bg-elevated)); color: var(--success); }
.plan-status-badge--warning { background: color-mix(in srgb, var(--warning) 18%, var(--bg-elevated)); color: var(--warning); }
.plan-status-badge--danger  { background: var(--danger-subtle); color: var(--danger); }
.plan-status-badge--muted   { background: var(--bg-subtle); color: var(--text-3); }

/* ── Group label — small caption above each grouped list,
     like "GENERAL" / "PRIVACY" in iOS Settings ── */
.settings-group-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-4);
  margin: var(--space-6) 0 var(--space-2) var(--space-2);
}
.settings-group-label:first-of-type { margin-top: 0; }

/* ── Group — one inset rounded container, rows separated by
     hairlines rather than each row being its own card ── */
.settings-group {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-4);
  min-height: 52px;
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--border);
  text-align: left;
  background: transparent;
}
.settings-row-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}
.settings-group > .settings-row:last-child,
.settings-group > *:last-child .settings-row { border-bottom: none; }

.settings-row-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.settings-row-label {
  font-weight: 500;
  color: var(--text-1);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.settings-row-value {
  font-weight: 500;
  color: var(--text-3);
}

/* Navigable / actionable row — right-aligned chevron link */
.settings-row-cta {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  font-weight: 600;
  color: var(--accent);
  font-size: var(--text-sm);
  transition: opacity var(--duration-fast) var(--ease);
}
.settings-row-cta:hover { opacity: 0.75; }
.settings-row-cta i { font-size: 0.8em; }

/* Row rendered as a full-width button (sign out, cancel) */
.settings-row--button {
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease);
}
.settings-row--button:hover { background: var(--bg-subtle); }
.settings-row--button:disabled { opacity: 0.6; cursor: not-allowed; }
.settings-row--button > i:last-child { color: var(--text-4); font-size: 0.8em; flex-shrink: 0; }

.settings-row--danger .settings-row-label { color: var(--danger); }
.settings-row--danger i:first-child { color: var(--danger); }

/* Plan-gate explanation above a settings group — currently only used
   above the Connections group when the account's plan lacks
   connectorTools (see entitlements.js and account.html loadConnections()). */
.settings-plan-note {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-2);
  border-radius: var(--radius-md);
  background: var(--accent-subtle);
  border: 1px solid var(--accent);
  color: var(--text-1);
  font-size: var(--text-xs);
  line-height: 1.5;
}
.settings-plan-note i { flex-shrink: 0; font-size: 1rem; color: var(--accent); margin-top: 1px; }
.settings-plan-note a { color: var(--accent); font-weight: 600; margin-left: 4px; }

/* A settings row this plan can't act on yet (Connect, while locked) —
   same dimmed treatment used elsewhere for plan-gated options. */
.settings-row.is-locked { opacity: 0.7; }
.settings-row-cta.is-locked { color: var(--text-3); }
.settings-row-cta.is-locked i { font-size: 0.85em; }

/* Usage row — icon, label + count on one line, thin bar beneath */
.settings-row--usage {
  align-items: flex-start;
  gap: var(--space-3);
}
.settings-row--usage > i:first-child {
  font-size: 1rem;
  color: var(--accent);
  margin-top: 2px;
  flex-shrink: 0;
}
.settings-row-usage-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.settings-row-usage-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}
.settings-row-usage-count {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.settings-row-usage-count span {
  font-weight: 500;
  color: var(--text-4);
}
.usage-bar {
  height: 3px;
  border-radius: var(--radius-full);
  background: var(--border);
  overflow: hidden;
}
.usage-bar-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: var(--radius-full);
  transition: width var(--duration-slow) var(--ease);
}
.usage-bar-fill.is-near-limit { background: var(--warning); }
.usage-bar-fill.is-at-limit { background: var(--danger); }

.settings-footnote {
  font-size: var(--text-xs);
  color: var(--text-4);
  margin: var(--space-3) 0 0 var(--space-2);
}

@media (max-width: 480px) {
  .account-shell { padding-left: var(--space-4); padding-right: var(--space-4); }
}

/* ── Delete account modal ──────────────────────────────────────────
   The base .modal-overlay/.modal-box/.modal-header/.modal-body/
   .modal-close-btn classes come from app.css. They used to be redefined
   here for the standalone account page; now that Account lives inside
   app.html those copies would override every other modal in the app, so
   only this modal's own sizing/spacing is kept. */
.delete-account-box { width: min(480px, 92vw); }
.delete-account-box .modal-header { padding: var(--space-4); }
.delete-account-box .modal-body { padding: var(--space-4); gap: var(--space-3); }

.delete-warning-lead {
  color: var(--danger);
  font-weight: 600;
  font-size: var(--text-sm);
  margin: 0;
}
.delete-explains-label { color: var(--text-2); font-size: var(--text-sm); margin: 0; }
.delete-item-list {
  margin: 0;
  padding-left: var(--space-5);
  color: var(--text-2);
  font-size: var(--text-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.delete-step-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-2);
}
.delete-btn-secondary {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease);
}
.delete-btn-secondary:hover { background: var(--bg-subtle); }
.delete-btn-danger {
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--duration-fast) var(--ease);
}
.delete-btn-danger:hover:not(:disabled) { opacity: 0.88; }
.delete-btn-danger:disabled { opacity: 0.5; cursor: not-allowed; }

/* The email people must type against — selectable/copyable on purpose
   (user-select: text, not "all": no fake-input trick, just a normal
   selectable text block) while the actual confirmation field below it
   blocks paste, so retyping is a small deliberate action rather than
   the modal effectively confirming itself. */
.delete-email-display {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-1);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  user-select: text;
  word-break: break-all;
}
.delete-input-label { font-size: var(--text-xs); color: var(--text-3); }
.delete-email-input {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-1);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  width: 100%;
  box-sizing: border-box;
}
.delete-email-input:focus { outline: none; border-color: var(--danger); }
.delete-mismatch-note { color: var(--danger); font-size: var(--text-xs); margin: 0; }

/* ── Scroll container for the Account / Scheduler / Inbox / Insights views
   inside app.html. Keeps the page-coloured backdrop the standalone pages
   had (.account-page), so the elevated .settings-group cards still stand
   out from it. ── */
.settings-view-scroll {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-base);
}
