/* Pages du ticketing : couleurs de la charte V7.3 « Blue Trust » (framework/templates/design-system/tokens.css,
   source unique), thème clair par défaut, thème sombre selon l'appareil. Polices système : aucune ressource
   tierce, la page est servie avec une politique de sécurité stricte (default-src 'none'). */

:root {
  color-scheme: light dark;
  --bg: #f7f7f7; --fg: #08090f; --accent: #0441dc; --surface: #ffffff; --border: #d6d6d6; --muted: #565a6b;
  --accent-hover: #1d58ed; --accent-text: #0441dc; --ink-on-accent: #ffffff; --bg-alt: #e6eaf2; --accent-wash: #eaeffd;
  --ok: #17663a; --warn: #8a4b00;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151d; --fg: #f7f7f7; --surface: #1d212c; --border: #303545; --muted: #a4a8b8;
    --accent-text: #5a86f6; --bg-alt: #171a23; --accent-wash: #151d39; --ok: #6fd39a; --warn: #f0b266;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent-text); }
header.top {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: 0.9rem max(1rem, calc((100% - 56rem) / 2)); background: var(--surface); border-bottom: 1px solid var(--border);
}
header.top .marque { font-weight: 700; letter-spacing: 0.01em; text-decoration: none; color: var(--fg); }
header.top .marque span { color: var(--accent-text); }
header.top form { display: flex; align-items: center; gap: 0.75rem; margin: 0; color: var(--muted); font-size: 0.9rem; }
main { max-width: 56rem; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 1rem; }
h2 { font-size: 1.2rem; margin: 2rem 0 0.75rem; }
p.aide { color: var(--muted); margin-top: 0.25rem; }

.carte { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1.25rem; }
.carte.etroite { max-width: 28rem; margin: 3rem auto; }
.barre { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }

label { display: block; font-weight: 600; margin: 1rem 0 0.25rem; }
input, select, textarea {
  width: 100%; padding: 0.6rem 0.7rem; font: inherit; color: var(--fg); background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px;
}
textarea { min-height: 9rem; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--accent-text); outline-offset: 2px;
}
.champs { display: grid; gap: 0 1rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 36rem) { .champs { grid-template-columns: 1fr; } }

button, a.bouton {
  display: inline-block; padding: 0.6rem 1.1rem; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  color: var(--ink-on-accent); background: var(--accent); border: 1px solid var(--accent); border-radius: 8px;
}
button:hover, a.bouton:hover { background: var(--accent-hover); }
button.discret { color: var(--accent-text); background: transparent; border-color: var(--border); font-weight: 500; padding: 0.3rem 0.7rem; }
form .actions { margin-top: 1.25rem; }

table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
th, td { text-align: left; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 0.85rem; color: var(--muted); font-weight: 600; background: var(--bg-alt); }
tr:last-child td { border-bottom: 0; }
/* Le tableau défile seul sur un écran étroit, la page ne défile jamais de côté. */
.defil { overflow-x: auto; border-radius: 10px; }
td.ref { white-space: nowrap; font-weight: 600; }
td.date { white-space: nowrap; color: var(--muted); font-size: 0.9rem; }
@media (max-width: 36rem) {
  th.date, td.date { display: none; }
  th, td { padding: 0.6rem 0.5rem; }
  .etat { white-space: normal; }
}

.etat { display: inline-block; padding: 0.1rem 0.6rem; border-radius: 999px; font-size: 0.85rem; font-weight: 600; background: var(--accent-wash); color: var(--accent-text); white-space: nowrap; }
.etat.attente { background: transparent; border: 1px solid var(--warn); color: var(--warn); }
.etat.resolu { background: transparent; border: 1px solid var(--ok); color: var(--ok); }
.etat.clos { background: var(--bg-alt); color: var(--muted); }

.fil { display: grid; gap: 0.9rem; }
.message { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 0.9rem 1.1rem; }
.message.nous { border-left: 4px solid var(--accent); }
.message .qui { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.35rem; }
.message .corps { white-space: pre-wrap; overflow-wrap: anywhere; }

.avis { padding: 0.8rem 1rem; border-radius: 8px; background: var(--accent-wash); margin: 1rem 0; }
.avis.erreur { background: transparent; border: 1px solid var(--warn); color: var(--warn); }
.vide { color: var(--muted); }

/* ----- Administration ----- */
main.large { max-width: 78rem; }
.filtres { display: grid; gap: 0 1rem; grid-template-columns: repeat(3, 1fr) auto; align-items: end; margin-bottom: 0.5rem; }
.filtres .actions { margin: 0 0 0.1rem; }
@media (max-width: 48rem) { .filtres { grid-template-columns: 1fr; } }
th a { color: inherit; text-decoration: none; }
th a:hover { text-decoration: underline; }
tr.retard td:first-child { box-shadow: inset 4px 0 0 var(--warn); }
.delai { font-size: 0.9rem; }
.delai.retard, .delais li.retard { color: var(--warn); font-weight: 600; }
.delai.tenu { color: var(--ok); }
.urgent { display: inline-block; margin-left: 0.4rem; padding: 0 0.45rem; border: 1px solid var(--warn); border-radius: 999px; font-size: 0.75rem; font-weight: 600; color: var(--warn); }
.message.interne { background: var(--bg-alt); border-style: dashed; }
.grille { display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 48rem) { .grille { grid-template-columns: 1fr; } }
h2.sans-marge { margin-top: 0; }
.delais { margin: 0; padding-left: 1.2rem; }
form.en-ligne { display: flex; align-items: end; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.5rem; }
form.en-ligne > * { margin: 0; }
form.en-ligne label { margin: 0 0 0.25rem; }
form.en-ligne select { min-width: 11rem; width: auto; }
label.case { display: flex; align-items: center; gap: 0.5rem; font-weight: 500; }
label.case input { width: auto; }
