/* ============================================================
   SAG / TIUF workflow — dark-mode corrections

   Two distinct problems, both correctness rather than taste.

   1. CHOICE CONTROLS WERE INVISIBLE.
      theme-dark-overrides.css dresses .form-control and .form-select for
      dark mode but never touches .form-check-input — so every checkbox and
      radio in the app kept Bootstrap's light-mode border (a pale grey ring
      meant for a white page) against #0f1115. On a form whose entire job is
      choosing, a choice control you cannot see is a broken form, not a dim
      one. The rules below are therefore GLOBAL within dark mode, not scoped
      to SAG: the same control is equally invisible everywhere else.

   2. THE ICS TREE SAT FLAT ON THE PAGE BACKGROUND.
      326 entries over four levels need visible structure. The tree gets a
      raised surface and its art. 18.2 blocks a slightly lighter one, so the
      nesting reads without extra borders.

   Purely ADDITIVE and scoped to [data-bs-theme="dark"]; light mode is never
   touched. Colours come from theme-tokens.css so they track the rest of the
   palette rather than drifting from it. Loaded in base.html AFTER
   theme-dark-overrides.css and survey-dark.css.
   ============================================================ */

/* --- 1. Checkboxes and radios ------------------------------------ */

[data-bs-theme="dark"] .form-check-input {
  /* A ring bright enough to find at a glance. --input-border (#363b44) is
     the right colour for a text field's edge and far too quiet for a control
     the eye has to locate among hundreds. */
  background-color: var(--input-bg, #22262d);
  border-color: #6c757d;
}

[data-bs-theme="dark"] .form-check-input:hover:not(:disabled) {
  border-color: var(--fg-muted, #adb5bd);
}

[data-bs-theme="dark"] .form-check-input:checked {
  /* Bootstrap's own primary, restated so a checked box stays obvious against
     the raised surface below rather than blending into it. */
  background-color: #0d6efd;
  border-color: #0d6efd;
}

[data-bs-theme="dark"] .form-check-input:focus {
  border-color: #6ea8fe;
  box-shadow: 0 0 0 .2rem rgba(110, 168, 254, .3);
}

[data-bs-theme="dark"] .form-check-input:disabled,
[data-bs-theme="dark"] .form-check-input[disabled] {
  /* Disabled must read as "not available", not as "absent" — a locked field
     the requester cannot see at all looks like a rendering bug. */
  background-color: #2a2f37;
  border-color: #4a5260;
  opacity: .65;
}

[data-bs-theme="dark"] .form-check-input:disabled ~ .form-check-label,
[data-bs-theme="dark"] .form-check-label > .form-check-input:disabled {
  opacity: .75;
}

/* --- 2. The ICS perimeter tree ----------------------------------- */

[data-bs-theme="dark"] .ics-tree {
  background-color: var(--bg-surface-2, #22262d);
  border-color: var(--border-default, #363b44) !important;
}

[data-bs-theme="dark"] .ics-block > summary {
  /* One step lighter than the tree so the eight art. 18.2 blocks separate
     without drawing eight boxes. */
  background-color: var(--bg-muted, #2a2f37);
  color: var(--fg-default, #e6e8eb);
  border-radius: .25rem;
}

[data-bs-theme="dark"] .ics-block > summary:hover {
  background-color: #333944;
}

[data-bs-theme="dark"] .ics-block[open] > summary {
  border-bottom-color: var(--border-default, #363b44);
}

[data-bs-theme="dark"] .ics-cite {
  /* The regulatory citation is the traceability, not decoration: it has to
     stay legible while clearly secondary to the label. */
  color: var(--fg-muted, #adb5bd);
}

[data-bs-theme="dark"] .ics-tree .form-check-label {
  color: var(--fg-default, #e6e8eb);
}

/* --- 3. The workflow cards --------------------------------------- */

[data-bs-theme="dark"] .wf-locked-note,
[data-bs-theme="dark"] .form-text {
  color: var(--fg-muted, #adb5bd);
}
