/* Secrétariat stylesheet — inherits the Camp v2 token system.
 * Canonical visual reference: ../Camp v2 Style Guide -standalone-.html
 *
 * Visual tokens come from /vendor/style/tokens.css (loaded before this file
 * in index.html). Reset and html/body typography come from
 * /vendor/style/base.css. No :root block needed here — all tokens are
 * provided by shared/style/tokens.css. Per user direction 2026-05-30,
 * secretariat converges to shared's design. Token value drift is dropped. */

/* secretariat-local — page-shell grid layout.
 * shared/style/base.css intentionally omits this; apps own their page shell. */
body {
  display: grid;
  grid-template-columns: var(--sb-w) minmax(0, 1fr);
  min-height: 100vh;
}

@media (max-width: 960px) {
  body {
    grid-template-columns: 1fr;
  }
}

/* Dark-mode body text: shared/style/base.css sets `color: var(--bk)` on
 * body, but `--bk` is the always-dark accent token and does NOT flip in
 * dark mode. Pairing it with `--wh` (which DOES flip to near-black)
 * produces #141414-on-#1a1a1a (~1.07:1) — invisible. Mirror campscout's
 * fix: switch body text to `--g4` in dark mode (flips to #c8c8c8, gives
 * ~10.45:1 on --wh). */
@media (prefers-color-scheme: dark) {
  body {
    color: var(--g4);
  }
}

/* ── Sidebar ───────────────────────────────────────────────── */

.sidebar {
  background: var(--bk);
  color: var(--white);
  padding: var(--sp-4);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar h1 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
  color: var(--y);
  margin-bottom: var(--sp-4);
}

.sidebar .nav-group-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--g3);
  margin: var(--sp-4) 0 var(--sp-1);
}

.sidebar .sidebar-feedback-toggle {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  margin-top: var(--sp-1);
  background: transparent;
  border: 0;
  color: var(--g2);
  font-family: inherit;
  font-size: 13.5px;
  text-align: left;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--dur-chip);
}
.sidebar .sidebar-feedback-toggle:hover {
  background: var(--bk2);
  color: var(--white);
}
.sidebar .sidebar-feedback-toggle:focus-visible {
  outline: 3px solid rgba(255, 206, 0, 0.35);
  outline-offset: 2px;
}

/* ── Main content ──────────────────────────────────────────── */

.main {
  padding: var(--sp-5);
  max-width: var(--page-shell-max);
  margin: 0 auto;
  width: 100%;
}

.main h1 {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 400;
  margin-bottom: var(--sp-2);
}

.main h2 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
  margin-bottom: var(--sp-3);
}

.muted {
  color: var(--g4);
  font-size: 12px;
}

/* ── Status pills (.stp) ───────────────────────────────────── */

.stp {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-pill);
  background: var(--g1);
  color: var(--bk);
}

.stp.ok::before,
.stp.warn::before,
.stp.bad::before,
.stp.info::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.stp.ok {
  background: var(--bg-success);
  color: var(--fg-success);
}
.stp.ok::before {
  background: var(--green);
}

.stp.warn {
  background: var(--bg-warn);
  color: var(--fg-warn);
}
.stp.warn::before {
  background: var(--amber);
}

.stp.bad {
  background: var(--bg-error);
  color: var(--fg-error);
}
.stp.bad::before {
  background: var(--red);
}

.stp.info {
  background: var(--bg-info);
  color: var(--bk);
}
.stp.info::before {
  background: var(--blue);
}

/* ── Member / household / cycle lists ───────────────────────── */

.member-list,
.household-list,
.cycle-list,
.cycle-households {
  list-style: none;
  padding: 0;
  margin: var(--sp-4) 0;
}
.member-list li,
.household-list li,
.cycle-list li,
.cycle-households li {
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--g2);
}
.member-list li:last-child,
.household-list li:last-child,
.cycle-list li:last-child,
.cycle-households li:last-child {
  border-bottom: none;
}

/* ── Cycle creation form ────────────────────────────────────── */

.cycle-form {
  background: var(--g1);
  border-radius: var(--radius-md);
  padding: var(--sp-4) var(--sp-5);
  margin-bottom: var(--sp-5);
  box-shadow: var(--shadow-sm);
}
.cycle-form h2 {
  margin: 0 0 var(--sp-3) 0;
  font-family: var(--serif);
  font-size: var(--fs-2xl);
  font-weight: 400;
}
.cycle-form form {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: var(--sp-3);
  align-items: end;
}
.cycle-form label {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  font-size: var(--fs-sm);
  color: var(--g4);
}
.cycle-form input,
.cycle-form select {
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--g3);
  border-radius: var(--radius-xs);
  font-family: var(--sans);
  font-size: var(--fs-md);
  background: var(--white);
  color: var(--bk);
}

@media (max-width: 720px) {
  .cycle-form form {
    grid-template-columns: 1fr;
  }
}

/* ── Dashboard (Accueil) ───────────────────────────────────── */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--g2);
  border-radius: var(--radius-md);
  padding: var(--sp-4);
  box-shadow: var(--shadow-sm);
}
.stat-value {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  color: var(--bk);
}
.stat-label {
  margin-top: var(--sp-2);
  font-size: var(--fs-sm);
  color: var(--g4);
}
.stat-hint {
  margin-top: var(--sp-1);
  font-size: var(--fs-sm);
}
.state-list {
  list-style: none;
  padding: 0;
  margin: var(--sp-3) 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}
.state-list li {
  padding: var(--sp-1) var(--sp-3);
  background: var(--g1);
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
}

.sync-checks {
  list-style: none;
  padding: 0;
  margin: var(--sp-4) 0;
}
.sync-checks li {
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--g2);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.sync-checks li:last-child {
  border-bottom: none;
}

.audit-list {
  list-style: none;
  padding: 0;
  margin: var(--sp-4) 0;
}
.audit-list li {
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--g2);
  font-size: var(--fs-sm);
}
.audit-list li:last-child {
  border-bottom: none;
}
.audit-detail {
  font-family: var(--mono);
  font-size: var(--fs-sm);
  margin-top: var(--sp-1);
  white-space: pre-wrap;
  word-break: break-word;
}


/* Stepbar (Q2C: cycle wizard in draft/cooling_down). One row of
   pills connected by a thin line; .done is greyed, .active is the
   single yellow accent, .pending is dimmed. FN-3-6 adds an animated
   connector fill (scaleX, no layout thrash) plus crossfade classes
   for advance transitions. Style guide §17: ≤200ms motion, no
   overshoot, layout stable. */
.stepbar {
  position: relative;
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin: var(--sp-3) 0;
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--g2);
}
.stepbar-connector {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  background: var(--g2);
  z-index: 0;
  pointer-events: none;
}
.stepbar-connector-fill {
  position: absolute;
  inset: 0;
  background: var(--y);
  transform: scaleX(0);
  transform-origin: left center;
}
.stepbar .step {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--g2);
  background: var(--wh);
  color: var(--g4);
}
.stepbar .step.done {
  background: var(--g1);
  color: var(--g4);
  border-color: var(--g2);
}
.stepbar .step.active {
  background: var(--y);
  color: var(--bk);
  border-color: var(--y);
  font-weight: 600;
}
.stepbar .step.pending {
  color: var(--g3);
  background: transparent;
}
.stepbar-step-number {
  display: inline-block;
  min-width: 1.2em;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: var(--fw-semibold);
}
.stepbar-step-leaving {
  opacity: 0.55;
  transition: opacity 140ms ease-out;
}
.stepbar-step-entering {
  opacity: 0;
  animation: stepbar-enter var(--dur-normal, 200ms) 40ms ease-out forwards;
}
@keyframes stepbar-enter {
  to {
    opacity: 1;
  }
}
@keyframes stepbar-number-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.15);
  }
}
@media (prefers-reduced-motion: reduce) {
  .stepbar-step-leaving,
  .stepbar-step-entering {
    opacity: 1;
    animation: none;
    transition: none;
  }
  .stepbar-connector-fill {
    transition: none !important;
  }
}

.step-pane {
  background: var(--wh);
  border: 1px solid var(--g2);
  border-radius: 12px;
  padding: var(--sp-3);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--sp-3);
}

/* Tabbed cycle view for sent/closed cycles. */
.tabbar {
  display: flex;
  gap: 0;
  margin: var(--sp-3) 0 0;
  border-bottom: 2px solid var(--g2);
}
.tabbar .tab {
  padding: 8px 16px;
  color: var(--g4);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.tabbar .tab:hover {
  color: var(--bk);
}
.tabbar .tab.active {
  color: var(--bk);
  /* Thicker underline (3px) for better WCAG AA contrast against the
     white tab background. The 2px yellow underline borderline-failed
     against background. */
  border-bottom-width: 3px;
  border-bottom-color: var(--y);
  margin-bottom: -3px;
  font-weight: 600;
}
.tab-pane {
  padding: var(--sp-3) 0;
}

/* Filter bar for the audit-log page. */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin: var(--sp-2) 0;
}
.filter-bar input {
  padding: 6px 10px;
  border: 1px solid var(--g2);
  border-radius: 6px;
  font-size: var(--fs-sm);
}

/* Group picker (Q3C first-login). */
.group-picker {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  max-width: 480px;
}
.group-picker-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 8px 12px;
  border: 1px solid var(--g2);
  border-radius: 8px;
  cursor: pointer;
}
.group-picker-row:hover {
  background: var(--g1);
}

/* Profile cards. */
.profile-card {
  background: var(--wh);
  border: 1px solid var(--g2);
  border-radius: 12px;
  padding: var(--sp-3);
  margin-bottom: var(--sp-3);
  max-width: 600px;
}
.profile-card h2 {
  margin-top: 0;
  font-size: var(--fs-md);
}

/* SUITE-4 attention tiles on the accueil home. */
.attention-section {
  margin: var(--sp-4) 0;
}
.attention-card {
  background: var(--wh);
  border: 1px solid var(--g2);
  border-left: 4px solid var(--y);
  border-radius: 8px;
  padding: var(--sp-3);
  margin-bottom: var(--sp-3);
  box-shadow: var(--shadow-sm);
}
.attention-card.attention-error {
  border-left-color: var(--red);
}
.attention-card h3 {
  margin: 0 0 var(--sp-2);
  font-size: var(--fs-md);
}
.attention-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.attention-list li {
  padding: 4px 0;
  border-bottom: 1px solid var(--g1);
}
.attention-list li:last-child {
  border-bottom: none;
}

/* SEC-3 mail preview modal. */
.preview-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--sp-3);
}
.preview-card {
  background: var(--wh);
  border-radius: 12px;
  padding: var(--sp-4);
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-overlay, 0 10px 40px rgba(0, 0, 0, 0.2));
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.preview-body {
  background: var(--g1);
  border: 1px solid var(--g2);
  border-radius: 6px;
  padding: var(--sp-3);
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--fs-sm);
  margin: 0;
}
.preview-attachments {
  list-style: none;
  padding: 0;
  margin: 0;
}
.preview-attachments li {
  padding: 4px 0;
}

/* SEC-27 / Q5A: branch info-pack admin page (/branch-info-packs). */
.pack-year-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin: var(--sp-3) 0 var(--sp-2);
}
.pack-year-title {
  flex: 1;
  margin: 0;
  text-align: center;
  font-size: var(--fs-lg);
}
.pack-grid {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}
.pack-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: var(--wh);
  border: 1px solid var(--g2);
  border-radius: 8px;
  flex-wrap: wrap;
}
.pack-branch {
  min-width: 110px;
  font-size: var(--fs-md);
}
.pack-file {
  text-decoration: underline;
}
.pack-upload {
  margin-left: auto;
}
.pack-file-input {
  font-size: var(--fs-sm);
}
.pack-err-slot {
  min-height: 0;
}

/* SEC-40 + SEC-41: mail-batches SPA. */
.batch-cta { display: flex; gap: var(--sp-2); margin: var(--sp-3) 0; }
.batch-list { list-style: none; padding: 0; margin: 0; }
.batch-list li {
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--g2);
}
.batch-form {
  background: var(--wh);
  border: 1px solid var(--g2);
  border-radius: 12px;
  padding: var(--sp-3);
  margin: var(--sp-3) 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.batch-form label { display: flex; flex-direction: column; gap: 4px; }
.batch-form input[type=text],
.batch-form input[type=number],
.batch-form textarea,
.batch-form select {
  padding: 6px 10px;
  border: 1px solid var(--g2);
  border-radius: 6px;
  font: inherit;
}
.batch-incl-bill { flex-direction: row !important; align-items: center; }
.batch-cycle-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: var(--sp-2);
  padding: 4px 0;
}
.batch-cycle-summary { list-style: none; padding: 0; margin: 0; }
.batch-cycle-summary li { padding: 4px 0; }
.batch-attachments { list-style: none; padding: 0; margin: 0; }
.batch-attachments li { padding: 4px 0; }
.batch-upload { margin-top: var(--sp-2); display: flex; flex-direction: column; gap: var(--sp-1, 6px); }

/* SEC-41 households preview on /mail-batches detail. Skip-logic rows
   are visually dimmed so comité spots them at a glance. */
.batch-households { list-style: none; padding: 0; margin: 0; }
.batch-households > li {
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--g1);
}
.batch-household-rows {
  list-style: none;
  padding: 0 0 0 var(--sp-3);
  margin: 4px 0 0;
}
/* Skipped row: line-through alone leaves color-blind users with only
   one signal. Add a leading ⊘ marker so the state has icon + colour +
   strike-through — three reinforcing cues per style-guide §10. */
.batch-household-rows .row-skipped {
  color: var(--g3);
  text-decoration: line-through;
}
.batch-household-rows .row-skipped::before {
  content: "⊘ ";
  text-decoration: none;
  display: inline-block;
  margin-right: 4px;
  font-weight: var(--fw-bold);
}

/* FN-1-2 / feels-nicer Charter Principle 2: all-or-nothing reduced-motion.
   When the user prefers reduced motion, every transition/animation in the
   app snaps in. Affirmation states degrade to static success indicators
   (the colour stays, the slide/scale doesn't). */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Modal — style-guide §Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(20, 20, 20, .5);
  display: grid; place-items: center;
  z-index: 1000;
}
.modal {
  background: var(--white, #fff);
  border-radius: var(--radius-md, 12px);
  box-shadow: var(--shadow-lg, 0 8px 30px rgba(0,0,0,.1));
  padding: var(--sp-5, 24px);
  max-width: 480px; width: 90vw;
}
.modal-title { font-size: var(--fs-xl, 17.6px); margin: 0 0 var(--sp-2, 8px); }
/* .modal-message, .modal-input, .modal-danger — now in shared/style/modal.css */
.modal-actions { display: flex; gap: var(--sp-2, 8px); justify-content: flex-end; }

/* Empty state — style-guide §Empty states */
.empty {
  display: grid; place-items: center;
  padding: var(--sp-6, 32px) var(--sp-4, 16px);
  text-align: center;
  gap: var(--sp-2, 8px);
}
.empty-icon { font-size: var(--fs-3xl, 25.6px); opacity: .6; }
.empty-title { font-size: var(--fs-xl, 17.6px); margin: 0; }
.empty-message { color: var(--g4, #6E6B62); margin: 0; max-width: 40ch; }


/* GUI-D18a: Administration mega-page — left rail of subtabs, single body. */
.admin-layout {
  display: grid; grid-template-columns: 220px 1fr;
  gap: var(--sp-5); padding: var(--sp-4);
}
@media (max-width: 960px) {
  .admin-layout { grid-template-columns: 1fr; padding: var(--sp-3); }
}
.admin-rail { display: flex; flex-direction: column; gap: var(--sp-1); }
.admin-rail-item {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-sm);
  text-decoration: none; color: var(--bk);
  border-left: 3px solid transparent;
}
.admin-rail-item:hover { background: var(--g1); }
.admin-rail-item.on {
  background: rgba(255, 206, 0, .12);
  border-left-color: var(--y);
  font-weight: 600;
}
.admin-rail-item:focus-visible {
  outline: 2px solid var(--y); outline-offset: 2px;
}
.admin-rail-ic { font-size: var(--fs-lg, 16px); }
.admin-body {
  background: var(--white); border-radius: var(--radius-md);
  padding: var(--sp-4); box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,.06));
}

/* GUI-D18c: Administration → Feedback subtab. */
.fb-toolbar { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.fb-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.fb-item {
  border: 1px solid var(--g2);
  border-radius: var(--radius-sm);
  padding: var(--sp-3);
  display: grid; grid-template-columns: 1fr auto; gap: var(--sp-2) var(--sp-3);
  align-items: start;
}
.fb-head { display: flex; align-items: center; gap: var(--sp-2); grid-column: 1; }
.fb-type { font-size: var(--fs-lg, 16px); }
.fb-title { font-size: var(--fs-lg, 16px); }
.fb-body { grid-column: 1; white-space: pre-wrap; color: var(--g4); }
.fb-meta { grid-column: 1; font-size: var(--fs-sm); color: var(--g3); }
.fb-item .btn { grid-row: 1; grid-column: 2; align-self: center; }

/* GUI-D19: audit-log pager below the rows. */
.audit-pager { display: flex; gap: var(--sp-2); margin-top: var(--sp-3); }

/* GUI-F27: Communication page — unified message list. */
.comm-toolbar { display: flex; gap: var(--sp-3); align-items: center; padding: var(--sp-3) var(--sp-4); flex-wrap: wrap; }
.filter-pills { display: flex; gap: var(--sp-1); flex-wrap: wrap; }
.filter-pill {
  padding: 4px 12px; border-radius: 999px;
  background: var(--g1); color: var(--bk); text-decoration: none;
  font-size: var(--fs-sm); border: 1px solid transparent;
}
.filter-pill:hover { background: var(--g2); }
.filter-pill.on { background: var(--bk); color: var(--white); border-color: var(--bk); }
.filter-pill:focus-visible { outline: 2px solid var(--y); outline-offset: 2px; }
.comm-list-host { padding: 0 var(--sp-4) var(--sp-4); }
.comm-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.comm-row {
  display: grid; grid-template-columns: 110px 1fr 100px 140px; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3); background: var(--white);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); align-items: center;
}
@media (max-width: 720px) {
  .comm-row { grid-template-columns: 1fr; gap: var(--sp-1); }
}
.comm-type { font-size: var(--fs-sm); color: var(--g4); font-weight: 600; }
.comm-subject { font-size: var(--fs-lg, 16px); }
.comm-status { font-size: var(--fs-sm); color: var(--g3); }
.comm-ts { font-size: var(--fs-sm); }

/* GUI-F28: Communication wizard. */
.wiz { display: flex; flex-direction: column; gap: var(--sp-4); padding: var(--sp-4); max-width: 720px; }
.wiz-stepbar { display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.wiz-step { display: flex; gap: var(--sp-2); align-items: center; padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-sm); color: var(--g3); }
.wiz-step.on { background: var(--g1); color: var(--bk); font-weight: 600; }
.wiz-step.done .wiz-step-n { background: var(--g4); color: var(--white); }
.wiz-step-n { background: var(--g2); border-radius: 999px; width: 28px; height: 28px; display: grid; place-items: center; font-weight: 600; color: var(--bk); }
.wiz-step.on .wiz-step-n { background: var(--y); color: var(--bk); }
.wiz-pane { display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-3); background: var(--white); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.wiz-mode { display: flex; gap: var(--sp-2); align-items: center; cursor: pointer; }
.wiz-mode input { width: 18px; height: 18px; }
.wiz-field { display: flex; flex-direction: column; gap: 4px; }
.wiz-field-label { font-size: var(--fs-sm); font-weight: 600; }
.wiz-input { padding: 8px 12px; border: 1px solid var(--g2); border-radius: var(--radius-sm); font-family: inherit; font-size: var(--fs-md, 14px); width: 100%; box-sizing: border-box; }
.wiz-input:focus { outline: 2px solid var(--y); outline-offset: 1px; }
.wiz-preview { padding: var(--sp-3); background: var(--g1); border-radius: var(--radius-sm); }
.wiz-preview-body { white-space: pre-wrap; font-family: inherit; margin: var(--sp-2) 0 0; }
.wiz-nav { display: flex; gap: var(--sp-3); justify-content: space-between; }
.wiz-save-status { font-size: var(--fs-sm); text-align: right; }

/* GUI-E22: Factures list view. */
.fact-toolbar {
  display: flex; gap: var(--sp-3); align-items: center; flex-wrap: wrap;
  padding: var(--sp-3) var(--sp-4);
}
.split-btn { position: relative; display: inline-flex; }
.split-btn-menu {
  position: absolute; top: 100%; right: 0; margin-top: var(--sp-1);
  background: var(--white); box-shadow: var(--shadow-md, 0 2px 8px rgba(0,0,0,.12));
  border-radius: var(--radius-sm); display: flex; flex-direction: column;
  min-width: 180px; z-index: 10; padding: var(--sp-1) 0;
}
.split-btn-menu-item {
  padding: var(--sp-2) var(--sp-3); text-decoration: none; color: var(--bk);
}
.split-btn-menu-item:hover { background: var(--g1); }
.fact-search { flex: 1; min-width: 200px; }
.fact-search input {
  width: 100%; padding: 6px 12px; border: 1px solid var(--g2);
  border-radius: var(--radius-sm); font-size: var(--fs-md, 14px);
}
.fact-list {
  list-style: none; padding: 0 var(--sp-4) var(--sp-4); margin: 0;
  display: flex; flex-direction: column; gap: var(--sp-2);
}
.fact-row-link {
  display: grid;
  grid-template-columns: 32px 1fr 80px 80px 160px 120px;
  gap: var(--sp-3); align-items: center;
  padding: var(--sp-2) var(--sp-3); background: var(--white);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-sm);
  text-decoration: none; color: var(--bk);
}
.fact-row-link:hover { background: var(--g1); }
.fact-icon { font-size: var(--fs-lg, 18px); text-align: center; }
.fact-libelle { font-weight: 600; }
.fact-year, .fact-households, .fact-total { color: var(--g4); font-size: var(--fs-sm); }
@media (max-width: 720px) {
  .fact-row-link { grid-template-columns: 32px 1fr auto; }
  .fact-year, .fact-households, .fact-total { display: none; }
}

/* ── Suite app launcher wrapper (topbar context — position anchor) ──────────
 * The .sb-applauncher / .sb-app-menu / .sb-app-tile primitives ship in
 * shared/style/sidebar.css. The wrapper just anchors the popover to
 * the topbar instead of the document body. Mirrors matos/css/style.css. */
.topbar-launcher-wrap { position: relative; display: inline-flex; align-items: center; }

/* ── Suite group switcher (topbar context) ────────────────────────────────
 * Single-Abteilung renders as plain text; multi-Abteilung renders a
 * native <select>. Mirrors matos's .topbar-group-switcher pattern but
 * adapted to secretariat's light topbar surface. */
.topbar-group-switcher-mount { display: inline-flex; align-items: center; }
.topbar-group-switcher { color: var(--bk); font-size: var(--fs-sm); line-height: 1.15; }
.topbar-group-switcher .g-switcher {
  appearance: none;
  background: var(--wh);
  border: 1px solid var(--g2);
  border-radius: var(--radius-sm);
  color: var(--bk);
  font-size: var(--fs-sm);
  padding: 0.22rem 0.5rem;
  cursor: pointer;
  max-width: 180px;
  transition: background var(--dur-normal), border-color var(--dur-normal);
}
.topbar-group-switcher .g-switcher:hover { background: var(--g1); border-color: var(--g3); }
.topbar-group-switcher:empty,
.topbar-group-switcher-mount:empty { display: none; }
@media (max-width: 480px) {
  .topbar-group-switcher .g-switcher { max-width: 120px; font-size: var(--fs-xs); }
}

/* ── Dark-mode foreground overrides ─────────────────────────────────────
 * `--bk` is a non-theme-aware accent token (#141414 always). Explicit
 * `color: var(--bk)` declarations on rules whose background flips in
 * dark mode (--wh, --g1, --g2, --bg-*, or inherited body bg) become
 * dark-on-dark and read at <2:1 contrast. The body-level
 * `color: var(--g4)` override (line ~31) only fixes inherited text —
 * these per-element overrides need their own dark-mode sibling rules.
 * Strategy A from the 2026-06-01 contrast audit. */
@media (prefers-color-scheme: dark) {
  /* Generic status pill — neutral variant on --g1 surface. The .ok / .warn /
     .bad pairs already use --fg-success / --fg-warn / --fg-error which all
     flip; only the default and .info variants reference --bk explicitly. */
  .stp {
    color: var(--g4);
  }
  /* .info uses --bg-info (#2a2400 in dark), mirror the .warn fg-token
     pattern so info-on-info reads ≥4.5:1. */
  .stp.info {
    color: var(--fg-warn);
  }
  /* Tabbar hover / active state — inherits flipping bg */
  .tabbar .tab:hover,
  .tabbar .tab.active {
    color: var(--g4);
  }
  /* Administration left-rail items — inherit flipping bg */
  .admin-rail-item {
    color: var(--g4);
  }
  /* Communication filter pills — --g1 surface, flips. The .on variant
     keeps --bk surface (non-flipping dark) so its --white text is fine. */
  .filter-pill {
    color: var(--g4);
  }
  /* Wizard stepbar — .on row uses --g1, .wiz-step-n uses --g2 (both flip).
     The .on .wiz-step-n keeps yellow surface so its --bk text stays. */
  .wiz-step.on,
  .wiz-step-n {
    color: var(--g4);
  }
  /* Topbar group switcher (light topbar surface flips with body) +
     the inner <select> (--wh background, flips). */
  .topbar-group-switcher,
  .topbar-group-switcher .g-switcher {
    color: var(--g4);
  }
}
