.subtitle {
  color: var(--muted);
  font-size: 15px;
  margin: 0 0 32px;
  line-height: 1.5;
}

.steps-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.step-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.step-card-title {
  font-weight: 600;
  font-size: 16px;
  color: var(--white);
  margin-bottom: 6px;
}

.step-card-text {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 36px;
  max-width: 440px;
}

.auth-card h1 {
  margin-bottom: 8px;
}

.auth-card .subtitle {
  margin-bottom: 20px;
}

/* Sign in with Google button container + email/password fallback disclosure. */
#google-signin-button {
  margin-bottom: 12px;
  min-height: 40px;
}
#google-signin-note:not(:empty),
#google-signin-message:not(:empty) {
  margin-bottom: 12px;
}
/* "or" divider between the Google button and the email/password form. */
.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--color-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 14px 0;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid var(--border);
}
.auth-divider span { padding: 0 12px; }
.auth-fallback {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.auth-fallback > summary {
  cursor: pointer;
  color: var(--color-muted);
  font-size: 13px;
  list-style: revert;
  margin-bottom: 12px;
}
.auth-fallback > summary:hover {
  color: var(--white);
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.text-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--white);
  font-size: 13px;
}

.text-input::placeholder {
  color: var(--muted);
}

.primary {
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  padding: 12px 28px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  width: 100%;
  margin-top: 4px;
}

.primary:hover {
  background: var(--accent-dark);
}

.primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.ghost {
  background: transparent;
  color: var(--white);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

.ghost:hover {
  border-color: var(--accent-text);
  color: var(--accent-text);
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 18px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-title {
  font-weight: 600;
  margin-bottom: 6px;
}

.status-text {
  font-size: 13px;
  color: var(--muted);
}

.status-id {
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.file-input {
  width: 100%;
  padding: 8px 0;
  font-size: 13px;
  color: var(--text);
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-field label {
  margin: 0;
}

.results {
  display: grid;
  gap: 12px;
}

.result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.account-actions {
  margin-top: 16px;
}

/* Account tab identity block — the only thing shown by default. */
.account-identity {
  display: grid;
  gap: 8px;
  margin: 0 0 20px;
}

.account-identity-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.account-identity dt {
  flex: 0 0 88px;
  color: var(--muted);
  font-size: 13px;
}

.account-identity dd {
  margin: 0;
  font-weight: 600;
  word-break: break-all;
}

/* App-mode toggle (basic ⇄ advanced). Sits above the settings form, not in
   it, because it applies on change — the form below still needs its Save. */
.account-mode {
  margin: 0 0 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}

.account-mode-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
}

.account-mode-row input[type="checkbox"] {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--accent-text);
  cursor: pointer;
}

.account-mode-text {
  display: grid;
  gap: 4px;
}

.account-mode-title {
  font-weight: 600;
}

.account-mode-hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

/* Credentials (API base, OpenAI / Mathpix keys, DD_TOKEN) — collapsed by
   default so they don't crowd the account view. */
.account-advanced {
  margin: 4px 0 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}

.account-advanced > summary {
  cursor: pointer;
  padding: 10px 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  list-style-position: inside;
}

.account-advanced > summary:hover {
  color: var(--text);
}

.account-advanced-body {
  padding: 4px 14px 14px;
}

.hidden {
  display: none;
}

/* ================================================================
   COMING SOON PAGES (Course, Papers)
   ================================================================ */

.coming-soon-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 40vh;
}

.coming-soon-message {
  font-size: 24px;
  font-weight: 600;
  color: var(--muted);
  margin-top: 8px;
}

/* ================================================================
   THEME PICKER (Account tab)

   The swatches are the ONE place in this app where raw colour literals are
   correct: each one is a miniature of a theme the viewer is NOT currently
   in, so it cannot be drawn with var(--bg)/var(--surface) — those resolve to
   the ACTIVE theme and all three previews would come out identical. The
   values below are copied from the matching block in variables.css; if a
   theme's --bg/--surface/--border/--accent change there, change them here
   too. Nothing else in this file may follow this precedent.
   ================================================================ */

.account-theme {
  margin: 0 0 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  padding: 12px 14px;
}

.account-theme-head {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}

.account-theme-title {
  font-weight: 600;
}

.account-theme-hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.account-theme-options {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.account-theme-option {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s;
}

.account-theme-option:hover {
  border-color: var(--border-strong);
}

/* The radio itself is the accessible control — focusable, arrow-key
   navigable, announced as a radio group. It is only visually replaced by the
   swatch, never removed: `display: none` would take it out of the tab order
   and out of the a11y tree, which is how a "custom radio group" becomes
   keyboard-unreachable. */
.account-theme-option input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.account-theme-option:has(input:checked) {
  border-color: var(--accent-text);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.account-theme-option:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* A tiny picture of the app: topbar strip, card, two text lines. */
.account-theme-swatch {
  position: relative;
  display: block;
  height: 62px;
  border-radius: 7px;
  border: 1px solid;
  overflow: hidden;
  margin-bottom: 6px;
}

.account-theme-swatch-bar {
  position: absolute;
  inset: 0 0 auto 0;
  height: 13px;
}

.account-theme-swatch-card {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 21px;
  bottom: 8px;
  border-radius: 4px;
  border: 1px solid;
}

.account-theme-swatch-line {
  position: absolute;
  left: 14px;
  top: 29px;
  width: 42%;
  height: 4px;
  border-radius: 2px;
}

.account-theme-swatch-line--short {
  top: 39px;
  width: 26%;
}

.account-theme-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--white);
}

.account-theme-note {
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

/* ── The three miniatures. Literals on purpose — see the note above. ────── */

[data-theme-preview="blue"] .account-theme-swatch {
  background: #1a1a2e;
  border-color: #2a2a4a;
}
[data-theme-preview="blue"] .account-theme-swatch-bar { background: #16213e; }
[data-theme-preview="blue"] .account-theme-swatch-card {
  background: #16213e;
  border-color: #2a2a4a;
}
[data-theme-preview="blue"] .account-theme-swatch-line { background: #e3212c; }
[data-theme-preview="blue"] .account-theme-swatch-line--short { background: #8a8a99; }

[data-theme-preview="dark"] .account-theme-swatch {
  background: #202124;
  border-color: #3c4043;
}
[data-theme-preview="dark"] .account-theme-swatch-bar { background: #282a2e; }
[data-theme-preview="dark"] .account-theme-swatch-card {
  background: #2a2c30;
  border-color: #3c4043;
}
[data-theme-preview="dark"] .account-theme-swatch-line { background: #e3212c; }
[data-theme-preview="dark"] .account-theme-swatch-line--short { background: #9aa0a6; }

[data-theme-preview="light"] .account-theme-swatch {
  background: #f5f6f8;
  border-color: #d7dbe2;
}
[data-theme-preview="light"] .account-theme-swatch-bar { background: #ffffff; }
[data-theme-preview="light"] .account-theme-swatch-card {
  background: #ffffff;
  border-color: #d7dbe2;
}
[data-theme-preview="light"] .account-theme-swatch-line { background: #c8151f; }
[data-theme-preview="light"] .account-theme-swatch-line--short { background: #4f5661; }
