/* Réglages page: settings aside (280px) next to the competence grid, wrapping on phones. */
.settings { display: flex; gap: var(--space-8); align-items: flex-start; flex-wrap: wrap; }
.settings__aside { flex: 0 1 280px; min-width: 240px; display: flex; flex-direction: column; gap: var(--space-6); }
.settings__cards { display: flex; flex-direction: column; gap: var(--space-6); }
.settings__grid { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: var(--space-4); }
.settings__intro { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.settings__total { font-size: 14px; font-weight: 700; color: var(--ink-muted); }

.settings-card {
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.settings-card__title { color: var(--ink-muted); }
.settings-card__help { font-size: 13px; line-height: 18px; color: var(--ink-muted); }
/* The help of a switch sits right under it. */
.settings-card__help--line { margin-top: -10px; }

.settings-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: 15px;
  font-weight: 600;
}
.settings-line--stacked { flex-direction: column; align-items: stretch; gap: 6px; }
label.settings-line { cursor: pointer; }
.settings-line__check { width: 20px; height: 20px; margin: 0; accent-color: var(--brand); cursor: pointer; }
.settings-line__value { font-size: 14px; font-weight: 700; color: var(--info); text-align: right; }

/* FormField segments: joined buttons, the active one in brand / on-brand. */
.segments {
  display: flex;
  border: 2px solid var(--line-strong);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-raised);
}
.segments--vertical { flex-direction: column; }
.segments__option {
  flex: 1;
  min-height: 40px;
  padding: 0 var(--space-2);
  border: 0;
  background: var(--surface-raised);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  transition: background var(--transition);
}
.segments__option:hover { background: var(--surface-sunken); }
.segments__option + .segments__option { border-left: 2px solid var(--line-strong); }
.segments--vertical .segments__option + .segments__option { border-left: 0; border-top: 2px solid var(--line-strong); }
.segments__option[aria-pressed="true"] { background: var(--brand); color: var(--on-brand); }
.segments__option:focus-visible { outline-offset: -3px; }

.history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); font-size: 14px; line-height: 20px; }
.history__item { display: flex; flex-direction: column; }
.history__date { font-size: 13px; color: var(--ink-muted); }

/* Edit page: three short number fields, day picker. */
.field--group { border: 0; margin: 0; padding: 0; min-width: 0; }
.field--group legend { padding: 0; margin-bottom: 6px; }
.field__row { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.field__input--short { width: 96px; }
select.field__input--short { width: 112px; }
.field__inline-label { font-size: 15px; font-weight: 700; }
.day-picker { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-3); }
.day-picker__day { position: relative; cursor: pointer; }
.day-picker__day input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.day-picker__day span {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 14px;
  border: 2px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface-raised);
  font-size: 15px;
  font-weight: 700;
  transition: background var(--transition);
}
.day-picker__day input:checked + span { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.day-picker__day input:focus-visible + span { outline: 3px solid var(--info); outline-offset: 2px; }
.form__actions { display: flex; gap: var(--space-3); flex-wrap: wrap; }

/* Classe (§4.1): the open classes as radio segments (profile creation). */
.segments--radio .segments__option { position: relative; display: flex; align-items: center; justify-content: center; }
.segments--radio input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segments--radio .segments__option:has(input:checked) { background: var(--brand); color: var(--on-brand); }
.segments--radio .segments__option:has(input:focus-visible) { outline: 3px solid var(--info); outline-offset: -3px; }
.segments--radio .segments__option + .segments__option { border-left: 2px solid var(--line-strong); }

/* Numeric field (§4.2): a slider with 8 fixed positions, the class default marked. */
.field-slider { display: flex; flex-direction: column; gap: var(--space-2); }
.field-slider__value { font-size: 15px; font-weight: 700; }
.field-slider__value .num { font-size: 20px; }
.field-slider__input {
  width: 100%;
  height: 32px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}
.field-slider__input::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: var(--radius-pill);
  background: linear-gradient(to right, var(--brand) calc(var(--position) / var(--positions) * 100%), var(--surface-sunken) 0);
}
.field-slider__input::-moz-range-track { height: 8px; border-radius: var(--radius-pill); background: var(--surface-sunken); }
.field-slider__input::-moz-range-progress { height: 8px; border-radius: var(--radius-pill); background: var(--brand); }
.field-slider__input::-webkit-slider-thumb {
  appearance: none;
  width: 24px;
  height: 24px;
  margin-top: -8px;
  border-radius: 50%;
  border: 3px solid var(--surface-raised);
  background: var(--brand);
  box-shadow: var(--shadow-card);
}
.field-slider__input::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--surface-raised); background: var(--brand); }
.field-slider__input:focus-visible { outline: 3px solid var(--info); outline-offset: 2px; border-radius: var(--radius-sm); }
.field-slider__input:disabled { cursor: not-allowed; opacity: 0.55; }
/* Ticks under the 8 positions: 12px in from each end, under the thumb's centre. */
.field-slider__ticks { display: flex; justify-content: space-between; padding: 0 9px; margin-top: -6px; }
.field-slider__tick { width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); }
.field-slider__tick--default { width: 10px; height: 10px; margin: -2px -2px 0; background: var(--brand); }
.field-slider__ends { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-muted); }

/* §12.2 class change dialog (no Dialog component in the DS: the stop dialog pattern, parent sizes). */
.level-dialog {
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  color: var(--ink);
  box-shadow: var(--shadow-lift);
  padding: var(--space-8);
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
}
.level-dialog::backdrop { background: var(--overlay); }
.level-dialog__form { display: flex; flex-direction: column; gap: var(--space-4); }
.level-dialog__title { font-size: 24px; line-height: 30px; font-weight: 800; }
.level-dialog__changes { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: var(--space-1); font-size: 16px; line-height: 24px; }
.level-dialog__choices { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.level-dialog__choice {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-3) var(--space-4);
  border: 2px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.level-dialog__choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.level-dialog__choice input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--brand); }
.level-dialog__choice > span { display: flex; flex-direction: column; }
.level-dialog__choice-name { font-size: 16px; line-height: 24px; font-weight: 700; }
.level-dialog__choice-help { font-size: 14px; line-height: 20px; color: var(--ink-muted); }
.level-dialog__note { font-size: 14px; line-height: 20px; color: var(--ink-muted); }
.level-dialog__actions { display: flex; gap: var(--space-3); flex-wrap: wrap; }
@media (max-width: 640px) {
  .level-dialog { padding: var(--space-6); }
}

@media (max-width: 640px) {
  .settings__aside { flex-basis: 100%; }
}
