/* RunLine — account self-service styles (Phase 4 W-1)

   Reuses tokens from /styles.css (--cream, --ink, --signal, --hairline,
   --pad, --maxw, --muted). All sizing/spacing follows the legal page
   pattern so account screens feel consistent with the rest of the site.
*/

.account {
  padding: clamp(40px, 6vw, 80px) var(--pad);
}

.account__inner {
  max-width: 540px;
  margin: 0 auto;
}

.account__inner h1 {
  font-size: clamp(28px, 4vw, 36px);
  margin: 12px 0 16px;
  letter-spacing: -0.01em;
}

.account__lede {
  color: var(--muted);
  font-size: 15.5px;
  margin: 0 0 32px;
  line-height: 1.55;
}

.account__lede a {
  color: var(--accent);
  text-decoration: none;
}

.account__lede a:hover {
  text-decoration: underline;
}

/* ────────── Form ────────── */

.account__form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.account__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.account__label {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.account__field input {
  font: inherit;
  font-size: 15.5px;
  padding: 12px 14px;
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  transition: border-color 120ms ease;
}

.account__field input:focus {
  outline: none;
  border-color: var(--accent);
}

.account__field input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ────────── Select (Quest-Modell etc.) ────────── */

.account__field select {
  font: inherit;
  font-size: 15.5px;
  padding: 12px 38px 12px 14px;
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%23808080' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='1 1.5 6 6.5 11 1.5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  transition: border-color 120ms ease;
}

.account__field select:focus {
  outline: none;
  border-color: var(--accent);
}

.account__field select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ────────── Password show/hide toggle ────────── */

.account__pw {
  position: relative;
  display: flex;
}

.account__pw input {
  flex: 1;
  /* Reserve room for the toggle button so long passwords don't overlap. */
  padding-right: 56px;
}

.account__pw-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 6px 10px;
  font: inherit;
  font-size: 13px;
  line-height: 0;
  border-radius: 8px;
  transition: color 120ms ease, background-color 120ms ease;
}

.account__pw-toggle:hover {
  color: var(--fg);
  background: color-mix(in oklab, var(--fg) 6%, transparent);
}

.account__pw-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  color: var(--fg);
}

.account__pw-toggle[aria-pressed="true"] {
  color: var(--accent);
}

/* ────────── ToS checkbox + form hints ────────── */

.account__checkbox {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14px;
  line-height: 1.5;
  cursor: pointer;
  color: var(--fg);
}

.account__checkbox input {
  margin-top: 3px;
  cursor: pointer;
  flex: 0 0 auto;
}

.account__checkbox a {
  color: var(--accent);
  text-decoration: none;
}

.account__checkbox a:hover {
  text-decoration: underline;
}

.account__hint {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: -2px;
  line-height: 1.4;
}

.account__optional {
  font-weight: 400;
  color: var(--muted);
}

/* Stage-switch helper (forgot.html success-state, etc.). The [hidden]
   attribute already does display:none, but keeping the rule explicit
   makes it discoverable + safe against future CSS-overrides. */
.account__stage[hidden] {
  display: none;
}

.account__form .btn {
  align-self: flex-start;
  margin-top: 8px;
}

.account__err {
  margin: 0;
  padding: 10px 14px;
  font-size: 14px;
  color: #B91C1C; /* red-700, sufficient contrast on cream + ink themes */
  background: color-mix(in oklab, #B91C1C 10%, transparent);
  border: 1px solid color-mix(in oklab, #B91C1C 30%, transparent);
  border-radius: 10px;
}

.account__ok {
  margin: 0;
  padding: 10px 14px;
  font-size: 14px;
  color: #166534; /* green-800 — paired with cream/ink for AAA contrast */
  background: color-mix(in oklab, #166534 10%, transparent);
  border: 1px solid color-mix(in oklab, #166534 30%, transparent);
  border-radius: 10px;
}

.account__notice {
  margin: 0 0 4px;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.5;
  color: #1E40AF; /* blue-800 — info tone, AAA on cream + ink */
  background: color-mix(in oklab, #1E40AF 8%, transparent);
  border: 1px solid color-mix(in oklab, #1E40AF 28%, transparent);
  border-radius: 10px;
}

.account__warn {
  margin: 6px 0 0;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.5;
  color: #92400E; /* amber-800 — caution, distinguishable from red err */
  background: color-mix(in oklab, #92400E 10%, transparent);
  border: 1px solid color-mix(in oklab, #92400E 30%, transparent);
  border-radius: 10px;
}

.account__ok a {
  color: var(--accent);
  text-decoration: none;
}

.account__ok a:hover {
  text-decoration: underline;
}

/* ────────── Courses table (W-3) ────────── */

.account__courses-stage {
  /* Overrides .account__inner max-width — the courses table needs
     more horizontal real estate. */
  max-width: 980px;
}

.account__courses {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 24px;
  font-size: 14.5px;
}

.account__courses thead th {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}

.account__courses tbody td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--hairline);
  color: var(--fg);
  vertical-align: top;
}

.account__courses tbody tr:hover td {
  background: color-mix(in oklab, var(--accent) 4%, transparent);
}

.account__courses tbody td:first-child {
  font-weight: 500;
}

.account__pagination {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 8px 0 0;
}

.account__pagination .btn {
  min-width: 110px;
  justify-content: center;
}

.account__pagination .btn[disabled],
.account__pagination .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.account__pagination .account__pagination-indicator {
  flex: 1;
  text-align: center;
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

[data-account-courses][data-state="loading"] table,
[data-account-courses][data-state="loading"] .account__pagination {
  visibility: hidden;
}

[data-account-courses][data-state="loading"]::before {
  content: 'Loading…';
  display: block;
  text-align: center;
  color: var(--muted);
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 12px;
  padding: 40px 0;
}

/* ────────── Facts list (account overview) ────────── */

.account__facts {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0 0 28px;
  padding: 0;
  border-top: 1px solid var(--hairline);
}

.account__fact {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--hairline);
}

/* Honor the [hidden] HTML attribute on fact rows. Without this rule the
   author `display: flex` above beats the user-agent default
   `[hidden] { display: none }` in the cascade (author > UA), and rows
   set hidden via JS (data-me-slots, data-me-waitlist-bridge) stay
   visually rendered with empty content. Specificity 0,2,0 wins over
   the 0,1,0 of `.account__fact` alone. */
.account__fact[hidden] {
  display: none;
}

.account__fact dt {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

.account__fact dd {
  margin: 0;
  font-size: 15.5px;
  color: var(--fg);
  text-align: right;
}

/* Phase 2.5: inline action button inside a fact row (e.g. "Clear bridge"
   next to the waitlist-bridge email). Smaller than .btn--text so it
   doesn't dominate the row visually but stays poke-touch-friendly. */
.account__fact dd .account__inline-action {
  margin-left: 10px;
  font-size: 13px;
  padding: 4px 10px;
}

.account__actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Loading / error stage states. The page hides these using the
   data-state attribute (set by account.js once /me resolves).
   Keeping it CSS-driven means a flash of incorrect content is
   prevented even before JS boots. */
[data-account-stage][data-state="loading"] .account__facts,
[data-account-stage][data-state="loading"] .account__actions {
  visibility: hidden;
}

[data-account-stage][data-state="ready"] .account__loading {
  display: none;
}

/* ─────────────────────────────────────────────────────────────────────
   Phase 2.12: register-form optional-fields fieldset
   ───────────────────────────────────────────────────────────────────── */

.account__optional-group {
  border: 1px dashed var(--c-border, #d0d0d0);
  border-radius: 6px;
  padding: 14px 16px 10px;
  margin: 18px 0;
  display: grid;
  gap: 12px;
}

.account__optional-legend {
  padding: 0 8px;
  font-size: 13px;
  color: var(--c-muted, #666);
  font-style: italic;
}

.account__field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 480px) {
  .account__field-row {
    grid-template-columns: 1fr;
  }
}

/* ─────────────────────────────────────────────────────────────────────
   Phase 2.12: account-overview inline edit mode
   ───────────────────────────────────────────────────────────────────── */

.account__fact--editing dd {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.account__fact--editing input[type="text"],
.account__fact--editing input[type="password"],
.account__fact--editing select {
  padding: 4px 8px;
  font-size: 14px;
  min-width: 180px;
}

.account__checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ─────────────────────────────────────────────────────────────────────
   Phase 2.12: success banner (e.g. ?deleted=1 confirmation on login)
   ───────────────────────────────────────────────────────────────────── */

.account__success {
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
  color: #1b5e20;
  padding: 10px 14px;
  border-radius: 6px;
  margin: 0 0 16px 0;
}

/* ─────────────────────────────────────────────────────────────────────
   Phase 2.12: danger zone + delete account
   ───────────────────────────────────────────────────────────────────── */

.account__danger {
  display: flex;
  justify-content: flex-end;
  margin-top: 24px;
}

.account__delete-link {
  color: #b71c1c;
  font-weight: 400;
  font-size: 14px;
}

.account__delete-link:hover {
  color: #8e0000;
  text-decoration: underline;
}

/* .btn--danger kept — still used inside the delete-modal where a
   loud filled red button IS the appropriate CTA for the irreversible
   final action (after the user has already clicked through the
   discreet account-overview link). */
.btn--danger {
  background: #b71c1c;
  color: #fff;
  border: 1px solid #b71c1c;
  padding: 8px 18px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}

.btn--danger:hover {
  background: #8e0000;
}

/* ─────────────────────────────────────────────────────────────────────
   Phase 2.12: account-delete modal (two-step)
   ───────────────────────────────────────────────────────────────────── */

.account__modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.account__modal[hidden] {
  display: none;
}

.account__modal-panel {
  background: #fff;
  border-radius: 8px;
  padding: 28px 32px;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

.account__modal-panel h2 {
  margin: 0 0 12px 0;
  font-size: 22px;
}

.account__modal-panel p,
.account__modal-panel ul {
  margin: 0 0 14px 0;
}

.account__modal-panel ul {
  padding-left: 22px;
}

.account__modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}
