/* ===== Thème accessible — variables clair / sombre ===== */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #eef1f6;
  --text: #14181f;
  --text-soft: #4a5568;
  --border: #cfd6e0;
  --accent: #1357c4;          /* contraste AA sur blanc */
  --accent-text: #ffffff;
  --ok: #1b7a3d;
  --ok-bg: #e3f4ea;
  --warn: #8a5a00;
  --warn-bg: #fdf0d5;
  --err: #b3261e;
  --err-bg: #fbe4e2;
  --radius: 14px;
  --tap: 48px;                 /* cible tactile mini */
  --fs: 1rem;
}
html[data-theme="dark"] {
  --bg: #0f1420;
  --surface: #1a2233;
  --surface-2: #232d42;
  --text: #f2f5fa;
  --text-soft: #b7c2d6;
  --border: #38465f;
  --accent: #5aa0ff;
  --accent-text: #06122a;
  --ok: #5cd98a;
  --ok-bg: #143524;
  --warn: #ffce6b;
  --warn-bg: #3a2f12;
  --err: #ff8d85;
  --err-bg: #3a1916;
}
html[data-fontsize="grand"]      { --fs: 1.18rem; }
html[data-fontsize="tres-grand"] { --fs: 1.36rem; }

* { box-sizing: border-box; }
html { font-size: var(--fs); }
body {
  margin: 0;
  font-family: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ===== Barre du haut ===== */
.topbar {
  display: flex; align-items: center; gap: .5rem;
  flex-wrap: wrap;
  padding: .5rem .9rem;
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 800; font-size: 1.15rem; color: var(--text); text-decoration: none; }
.mainnav { display: flex; gap: .35rem; flex-wrap: wrap; flex: 1; }
.mainnav a {
  padding: .55rem .8rem; border-radius: 10px;
  color: var(--text); text-decoration: none; font-weight: 600;
}
.mainnav a:hover { background: var(--surface-2); }
.tools { display: flex; gap: .35rem; }
.iconbtn {
  min-width: var(--tap); min-height: var(--tap);
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); border-radius: 12px; font-size: 1.1rem;
  cursor: pointer; text-decoration: none;
}
.iconbtn:hover { background: var(--border); }
.badge {
  background: var(--err); color: #fff; border-radius: 999px;
  padding: 0 .5rem; font-size: .85rem; font-weight: 700;
}

/* ===== Conteneur & cartes ===== */
.container { max-width: 880px; margin: 0 auto; padding: 1rem; }
h1 { font-size: 1.5rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.2rem; margin: 1.4rem 0 .6rem; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem; margin-bottom: .9rem;
}
.grid { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.muted { color: var(--text-soft); }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ===== Boutons ===== */
.btn {
  min-height: var(--tap); padding: .6rem 1.1rem;
  border: none; border-radius: 12px; cursor: pointer;
  font-size: 1rem; font-weight: 700; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
}
.btn:hover { filter: brightness(.97); }
.btn-primary { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.btn-ok { background: var(--ok); color: #fff; border-color: transparent; }
.btn-danger { background: var(--err); color: #fff; border-color: transparent; }
.btn-block { width: 100%; }

/* ===== Formulaires ===== */
label { font-weight: 600; display: block; margin: .6rem 0 .25rem; }
input, select, textarea {
  width: 100%; min-height: var(--tap); padding: .55rem .7rem;
  font-size: 1rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
input:focus, select:focus, textarea:focus, .btn:focus, a:focus, button:focus {
  outline: 3px solid var(--accent); outline-offset: 2px;
}
.qtyinput { max-width: 6.5rem; }
.inline-form { display: inline; }

/* ===== Statuts (jamais la couleur seule : icône + mot) ===== */
.statut { display: inline-flex; align-items: center; gap: .35rem; font-weight: 700;
  padding: .15rem .55rem; border-radius: 999px; font-size: .9rem; }
.statut.attente  { background: var(--warn-bg); color: var(--warn); }
.statut.validee  { background: var(--ok-bg);   color: var(--ok); }
.statut.refusee  { background: var(--err-bg);  color: var(--err); }
.statut.annulee  { background: var(--surface-2); color: var(--text-soft); }

/* ===== Flash ===== */
.flash-zone { max-width: 880px; margin: .6rem auto 0; padding: 0 1rem; }
.flash { padding: .7rem .9rem; border-radius: 10px; margin-bottom: .5rem; font-weight: 600;
  border: 1px solid var(--border); }
.flash.success { background: var(--ok-bg); color: var(--ok); }
.flash.error   { background: var(--err-bg); color: var(--err); }
.flash.info    { background: var(--surface-2); }

/* ===== Tableaux ===== */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--border); }
th { color: var(--text-soft); font-size: .9rem; }
.table-wrap { overflow-x: auto; }

.conflit { color: var(--err); font-weight: 700; }
.dispo-pill { font-weight: 700; }
