.personal-settings-form {
  display: grid;
  gap: 24px;
}

.personal-settings-form fieldset {
  margin: 0;
  padding: 0 0 24px;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.personal-settings-form legend {
  color: var(--ink);
  font-size: 17px;
  font-weight: 850;
}

.personal-settings-form fieldset > p {
  margin: 5px 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.preference-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 10px;
  max-width: 680px;
}

.preference-choice {
  display: block;
}

.preference-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.preference-choice span {
  display: grid;
  place-items: center;
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--card);
  color: var(--muted);
  font-weight: 800;
}

.preference-choice input:checked + span {
  border-color: var(--purple);
  background: var(--purple-soft);
  color: var(--purple);
  box-shadow: inset 0 0 0 1px var(--purple);
}

.preference-choice input:focus-visible + span,
.preference-toggle input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--purple) 25%, transparent);
  outline-offset: 2px;
}

.preference-toggle {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  max-width: 680px;
  padding: 13px 0;
}

.preference-toggle input {
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--purple);
}

.preference-toggle strong,
.preference-toggle small {
  display: block;
}

.preference-toggle small {
  margin-top: 3px;
  color: var(--muted);
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

html[data-text-size="small"] {
  font-size: 14px;
}

html[data-text-size="standard"] {
  font-size: 16px;
}

html[data-text-size="large"] {
  font-size: 18px;
}

html[data-high-contrast="true"] {
  --muted: #4e4855;
  --line: #aaa2b2;
}

html[data-reduced-motion="true"] *,
html[data-reduced-motion="true"] *::before,
html[data-reduced-motion="true"] *::after {
  scroll-behavior: auto !important;
  animation-duration: .01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .01ms !important;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --purple: #b795ff;
  --purple-dark: #d1bdff;
  --purple-soft: #34274a;
  --ink: #f4f0f6;
  --muted: #bcb3c4;
  --line: #4a414f;
  --surface: #17131b;
  --success: #63d4ad;
  --warning: #f2b66e;
}

html[data-theme="dark"][data-high-contrast="true"] {
  --ink: #fff;
  --muted: #e0d9e5;
  --line: #83788a;
}

html[data-theme="dark"] body,
html[data-theme="dark"] .app-frame,
html[data-theme="dark"] .operations-screen {
  background: var(--surface);
  color: var(--ink);
}

html[data-theme="dark"] .app-header,
html[data-theme="dark"] .schedule-panel,
html[data-theme="dark"] .tool-panel,
html[data-theme="dark"] .metric-row article,
html[data-theme="dark"] .workspace-card,
html[data-theme="dark"] .class-order-card,
html[data-theme="dark"] .test-screen,
html[data-theme="dark"] .movement-row,
html[data-theme="dark"] .movement-editor,
html[data-theme="dark"] .review-dialog,
html[data-theme="dark"] .next-ride {
  background: #231d28;
  color: var(--ink);
}

html[data-theme="dark"] .next-ride {
  background: linear-gradient(100deg, #231d28, #291f34);
}

html[data-theme="dark"] .role-switcher,
html[data-theme="dark"] .recording-state,
html[data-theme="dark"] .schedule-safety-note,
html[data-theme="dark"] .class-order-card > header,
html[data-theme="dark"] .movement-head,
html[data-theme="dark"] .workspace-card > .workspace-heading {
  background: #1c1721;
}

html[data-theme="dark"] .role-switcher button.active,
html[data-theme="dark"] button:not(.primary-action):not(.workspace-button):not(.invite-form button),
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .preference-choice span,
html[data-theme="dark"] .class-item,
html[data-theme="dark"] .ring-item,
html[data-theme="dark"] .document-item,
html[data-theme="dark"] .checkin-item {
  background: #2a2330;
  color: var(--ink);
}

html[data-theme="dark"] .office-view-switch {
  background: #1c1721;
}

html[data-theme="dark"] .office-view-switch button.active {
  background: #3a2c4c;
  color: #d9c8ff;
}

html[data-theme="dark"] .dashboard-view-switch {
  background: #1c1721;
}

html[data-theme="dark"] .dashboard-view-switch button.active {
  background: #3a2c4c;
  color: #d9c8ff;
}

html[data-theme="dark"] .schedule-row.current,
html[data-theme="dark"] .movement-row.active,
html[data-theme="dark"] .preference-choice input:checked + span {
  background: #34274a;
}

html[data-theme="dark"] .order-rider.complete,
html[data-theme="dark"] .checkin-item.checked {
  background: #1f332e;
}

html[data-theme="dark"] .order-rider.scratched {
  background: #382528;
}

html[data-theme="dark"] .order-break {
  background: #30263e;
}

html[data-theme="dark"] .upload-drop,
html[data-theme="dark"] .notice-strip {
  background: #2d2535;
  color: var(--ink);
}

html[data-theme="dark"] .toast {
  background: #f2edf5;
  color: #211925;
}

@media (max-width: 700px) {
  .preference-options {
    grid-template-columns: 1fr;
  }

  .settings-actions {
    flex-direction: column-reverse;
  }
}
