/* =====================================================================
   Charte graphique Yellow Stone
   ---------------------------------------------------------------------
   Jaune      #FFCC00  couleur d'accentuation principale (CTA, actif, alertes)
   Blanc      #FFFFFF  surfaces
   Bleu foncé #283B70  structure (barre de navigation, titres, liens, badges)
                       ⚠ la charte indique « #28b70 » (5 caractères, invalide) :
                       valeur à confirmer, à modifier ici uniquement.
   Bleu clair #AED6EB  fonds doux, focus, calendrier
   ===================================================================== */
:root {
  --ys-yellow: #FFCC00;
  --ys-yellow-dark: #E6B800;
  --ys-yellow-light: #FFF4C2;
  --ys-white: #FFFFFF;
  --ys-blue-dark: #040e2a;
  --ys-blue-darker: #040e24;
  --ys-blue-light: #AED6EB;
  --ys-blue-lighter: #E6F2F8;

  /* Rôles fonctionnels (utilisés dans les templates et le JS) */
  --primary: var(--ys-blue-dark);
  --primary-dark: var(--ys-blue-darker);
  --primary-light: var(--ys-blue-lighter);
  --accent: var(--ys-yellow);
  --accent-dark: var(--ys-yellow-dark);
  --accent-light: var(--ys-yellow-light);
  --info: var(--ys-blue-dark);
  --info-light: var(--ys-blue-lighter);

  /* Couleurs sémantiques hors charte (états) */
  --danger: #b3261e;
  --danger-light: #fbe4e2;
  --success: #1e7d4f;
  --success-light: #dff3e8;

  --muted: #5f6b80;
  --border: #d5e3ec;
  --bg: #f4f8fb;
  --surface: var(--ys-white);
  --text: #1b2438;
  --radius: 10px;
  --sidebar-width: 264px;
  --shadow: 0 1px 2px rgba(40, 59, 112, 0.06), 0 1px 3px rgba(40, 59, 112, 0.1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
/* Enveloppe du contenu : barre de tête, contenu, pied de page. Sur la page de
   connexion, le corps est une grille centrée : la boîte s'efface (`contents`)
   pour que le centrage porte comme avant sur le contenu lui-même. */
.app-body { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; }
body.auth-page .app-body { display: contents; }
body.has-sidebar { flex-direction: row; }
body.has-sidebar main.container { max-width: 1240px; padding-left: 2rem; padding-right: 2rem; }

/* Icônes de navigation : sprite masqué, tracé à la couleur du texte. */
.icon-sprite { display: none; }
.icon { width: 22px; height: 22px; flex: none; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5rem; color: var(--ys-blue-dark); }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 0.75rem; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.mono { font-variant-numeric: tabular-nums; }
.text-right { text-align: right; }

.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; }
main.container { flex: 1; padding-top: 1.75rem; padding-bottom: 3rem; }
main.narrow { max-width: 720px; }

/* ------------------------------------------------------------- topbar */
.topbar { background: var(--ys-blue-dark); border-bottom: 3px solid var(--ys-yellow); position: sticky; top: 0; z-index: 10; }
.topbar-inner { display: flex; align-items: center; gap: 1.5rem; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; color: var(--ys-white); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--ys-yellow); color: var(--ys-blue-dark); font-size: 0.85rem; letter-spacing: 0.02em; }
/* Le logo est écrit, pas affiché : « YS » en jaune sur le bleu foncé des barres. */
.brand-text { display: block; font-size: 2rem; font-weight: 800; letter-spacing: 0.06em; line-height: 1; color: var(--ys-yellow); }
.nav { display: flex; gap: 0.25rem; flex: 1; flex-wrap: wrap; }
.nav a { padding: 0.45rem 0.75rem; border-radius: 8px; color: rgba(255, 255, 255, 0.85); font-weight: 500; font-size: 0.95rem; }
.nav a:hover { background: rgba(255, 255, 255, 0.12); color: var(--ys-white); text-decoration: none; }
.nav a.active { background: var(--ys-yellow); color: var(--ys-blue-dark); font-weight: 600; }
.nav a.nav-cta { border: 1px solid var(--ys-yellow); color: var(--ys-yellow); font-weight: 600; }
.nav a.nav-cta:hover, .nav a.nav-cta.active { background: var(--ys-yellow); color: var(--ys-blue-dark); }
.user-menu { display: flex; align-items: center; gap: 0.75rem; }
.user-name { color: var(--ys-white); font-weight: 500; font-size: 0.95rem; }
.topbar .btn-ghost { color: var(--ys-white); border-color: rgba(255, 255, 255, 0.35); }
.topbar .btn-ghost:hover { background: rgba(255, 255, 255, 0.12); }
/* Sur ordinateur, le conteneur du menu s'efface : nav et compte restent dans la barre. */
.topbar-menu { display: contents; }
.topbar .nav-toggle { display: none; }
.nav-toggle-icon, .nav-toggle-icon::before, .nav-toggle-icon::after { display: block; width: 18px; height: 2px; border-radius: 1px; background: currentColor; transition: transform 0.15s, background 0.15s; }
.nav-toggle-icon { position: relative; }
.nav-toggle-icon::before, .nav-toggle-icon::after { content: ""; position: absolute; left: 0; }
.nav-toggle-icon::before { top: -6px; }
.nav-toggle-icon::after { top: 6px; }
.menu-open .nav-toggle-icon { background: transparent; }
.menu-open .nav-toggle-icon::before { transform: translateY(6px) rotate(45deg); }
.menu-open .nav-toggle-icon::after { transform: translateY(-6px) rotate(-45deg); }
@media (max-width: 720px) {
  .topbar-inner { flex-wrap: wrap; gap: 0 1rem; }
  .topbar .brand { height: 60px; }
  .topbar.js-menu .nav-toggle { display: inline-flex; width: 44px; height: 40px; padding: 0; margin-left: auto; }
  .topbar-menu { display: flex; flex-direction: column; flex-basis: 100%; gap: 0.75rem; padding: 0.25rem 0 1rem; }
  .topbar.js-menu:not(.menu-open) .topbar-menu { display: none; }
  .nav { flex-direction: column; gap: 0.15rem; }
  .nav a { padding: 0.65rem 0.75rem; }
  .user-menu { justify-content: space-between; padding-top: 0.75rem; border-top: 1px solid rgba(255, 255, 255, 0.15); }
  .nav:not(:has(a)) { display: none; }
  .nav:not(:has(a)) + .user-menu { padding-top: 0; border-top: 0; }
}

/* ------------------------------------------------------------ sidebar */
/* Parcours syndic : la navigation passe sur le côté. Colonne collante sur
   ordinateur, tiroir escamotable sous 960 px (script en bas de base.html). */
.sidebar {
  flex: none; width: var(--sidebar-width); align-self: flex-start;
  position: sticky; top: 0; height: 100vh; z-index: 40;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #2f354f 0%, #454d66 25%, #5d667f 50%, #78829a 75%, #aeb4c4 100%);
  color: rgba(255, 255, 255, 0.82);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-head { display: flex; align-items: center; padding: 0.9rem 1rem 0.6rem; }
.sidebar-logo { display: block; width: 84px; height: 84px; filter: brightness(0) invert(1); }
.sidebar-action { padding: 0.25rem 1rem 0.9rem; }
.sidebar-action .btn { gap: 0.35rem; font-size: 0.9rem; padding: 0.55rem 0.75rem; }
.sidebar-nav { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0.25rem 0.75rem 1rem; }
.sidebar-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav-section { margin: 1.15rem 0.85rem 0.35rem; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em; color: rgba(255, 255, 255, 0.55); }

/* Entrée de menu : icône, libellé, et pour « Mes demandes » un compteur. */
.nav-item { position: relative; display: flex; align-items: center; gap: 0.75rem; width: 100%; padding: 0.6rem 0.75rem; border: 0; border-radius: 9px; background: none; font: inherit; font-size: 0.95rem; font-weight: 500; color: rgba(255, 255, 255, 0.75); text-align: left; cursor: pointer; }
.nav-item:hover { background: rgba(255, 255, 255, 0.08); color: var(--ys-white); text-decoration: none; }
.nav-item:focus-visible { outline: 2px solid var(--ys-yellow); outline-offset: -2px; }
.nav-item .icon { color: rgba(255, 255, 255, 0.6); transition: color 0.15s; }
.nav-item:hover .icon { color: inherit; }
.nav-item.active { background: rgba(255, 255, 255, 0.07); color: var(--ys-yellow); font-weight: 600; }
.nav-item.active .icon { color: var(--ys-yellow); }
/* Liseré jaune plaqué contre le bord de la barre, d'où le décalage négatif
   égal au padding horizontal de `.sidebar-nav`. */
.nav-item.active::before { content: ""; position: absolute; left: -0.75rem; top: 50%; transform: translateY(-50%); width: 3px; height: 68%; border-radius: 0 3px 3px 0; background: var(--ys-yellow); }
.nav-count { margin-left: auto; display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 0.4rem; border-radius: 999px; background: rgba(255, 255, 255, 0.16); color: var(--ys-white); font-size: 0.75rem; font-weight: 700; font-variant-numeric: tabular-nums; }
/* Rouge vif : le rouge sémantique (--danger) manque de contraste sur le bleu foncé. */
.nav-count.is-alerte { background: #e5342a; }

.sidebar-foot { padding: 0.6rem 0.75rem 0.85rem; border-top: 1px solid rgba(255, 255, 255, 0.1); display: flex; flex-direction: column; gap: 2px; }
.sidebar-foot form { margin: 0; }
.sidebar-user .avatar { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--ys-yellow); color: var(--ys-blue-dark); font-size: 0.82rem; font-weight: 700; }
.sidebar-user-id { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.sidebar-user-id strong { font-weight: 600; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-org { font-size: 0.75rem; color: rgba(255, 255, 255, 0.6); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-logout { font-size: 0.88rem; color: rgba(255, 255, 255, 0.68); }

/* Barre de tête mobile : n'apparaît qu'une fois la barre latérale repliée. */
.appbar { display: none; align-items: center; gap: 0.75rem; min-height: 56px; padding: 0 0.75rem; background: var(--ys-blue-dark); border-bottom: 3px solid var(--ys-yellow); position: sticky; top: 0; z-index: 30; }
.bar-logo { display: block; height: 44px; width: auto; filter: brightness(0) invert(1); }
.appbar-toggle { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 38px; padding: 0; border: 1px solid rgba(255, 255, 255, 0.35); border-radius: 8px; background: transparent; color: var(--ys-white); cursor: pointer; }
.appbar-cta { margin-left: auto; gap: 0.25rem; }
.drawer-open .nav-toggle-icon { background: transparent; }
.drawer-open .nav-toggle-icon::before { transform: translateY(6px) rotate(45deg); }
.drawer-open .nav-toggle-icon::after { transform: translateY(-6px) rotate(-45deg); }

/* Écrans de laptop (≈ 650 px utiles) : on resserre pour tout voir sans défiler. */
@media (max-height: 820px) {
  .sidebar-head { padding: 0.5rem 1rem 0.3rem; }
  .sidebar-logo { width: 60px; height: 60px; }
  .sidebar-action { padding: 0.15rem 1rem 0.5rem; }
  .sidebar-action .btn { font-size: 0.85rem; padding: 0.45rem 0.75rem; }
  .sidebar-nav { padding-bottom: 0.5rem; }
  .nav-section { margin: 0.7rem 0.85rem 0.25rem; font-size: 0.65rem; }
  .nav-item { padding: 0.42rem 0.75rem; font-size: 0.88rem; }
  .sidebar-foot { padding: 0.4rem 0.75rem 0.5rem; }
  .sidebar-user .avatar { width: 30px; height: 30px; font-size: 0.75rem; }
  .sidebar-logout { font-size: 0.82rem; }
}
/* Ordinateur avec souris : barre repliée sur les icônes, dépliée au survol ou
   au clavier. La marge négative la fait passer par-dessus la page sans la décaler. */
@media (min-width: 961px) and (hover: hover) {
  .sidebar { width: 72px; overflow-x: hidden; transition: width 0.18s ease, margin-right 0.18s ease, box-shadow 0.18s; }
  .sidebar:hover, .sidebar:focus-within { width: var(--sidebar-width); margin-right: calc(72px - var(--sidebar-width)); box-shadow: 8px 0 30px rgba(15, 22, 45, 0.25); }
  .sidebar-head { padding-left: 0.5rem; padding-right: 0.5rem; }
  .sidebar-logo { width: 56px; height: 56px; }
  .sidebar-nav { overflow-x: hidden; }
  .nav-item, .nav-section, .sidebar-action .btn { white-space: nowrap; }
  .sidebar:not(:hover):not(:focus-within) .sidebar-action { padding-left: 0.75rem; padding-right: 0.75rem; }
  .sidebar:not(:hover):not(:focus-within) .sidebar-action .btn { padding-left: 0; padding-right: 0; }
  .sidebar:not(:hover):not(:focus-within) .sidebar-label,
  .sidebar:not(:hover):not(:focus-within) .nav-item > span:not(.nav-count):not(.avatar) { display: none; }
  .sidebar:not(:hover):not(:focus-within) .nav-section { visibility: hidden; }
  /* Repliée, la pastille se pose sur le coin de l'icône. */
  .sidebar:not(:hover):not(:focus-within) .nav-count { position: absolute; top: 2px; left: 30px; min-width: 18px; height: 18px; padding: 0 0.25rem; font-size: 0.65rem; }
}
.sidebar-scrim { display: none; }
@media (max-width: 960px) {
  body.has-sidebar { flex-direction: column; }
  body.has-sidebar main.container { padding-left: 1.25rem; padding-right: 1.25rem; }
  /* Sans JavaScript (`js-drawer` absent), la barre reste en tête de page :
     la navigation fonctionne toujours, elle ne flotte simplement plus. */
  .sidebar { width: 100%; height: auto; position: static; }
  .appbar { display: flex; }
  /* `height` explicite : enfant hors flux d'un conteneur flex, la barre ne
     s'étire pas toute seule entre `top` et `bottom`. */
  .has-sidebar.js-drawer .sidebar { position: fixed; top: 0; left: 0; height: 100vh; height: 100dvh; width: min(19rem, 86vw); transform: translateX(-100%); visibility: hidden; transition: transform 0.2s ease, visibility 0.2s; box-shadow: 0 0 40px rgba(0, 0, 0, 0.35); }
  .has-sidebar.js-drawer.drawer-open .sidebar { transform: none; visibility: visible; }
  .has-sidebar.js-drawer .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(15, 22, 45, 0.55); }
  .has-sidebar.js-drawer .sidebar-scrim[hidden] { display: none; }
  body.has-sidebar.drawer-open { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) { .has-sidebar.js-drawer .sidebar { transition: none; } }

.footer { border-top: 1px solid var(--border); padding: 1rem 0; color: var(--muted); font-size: 0.85rem; text-align: center; background: var(--ys-white); }

/* ------------------------------------------------------------ layout */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.page-header p { margin: 0; }
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 860px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 359px) { .grid-4 { grid-template-columns: minmax(0, 1fr); } }
.stack > * + * { margin-top: 1.25rem; }
.row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.row-between { justify-content: space-between; }
@media (max-width: 720px) { .row-between > :last-child { margin-left: auto; } }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.card-header h2 { margin: 0; }
@media (max-width: 720px) { .card-header { flex-wrap: wrap; } .card-header > h2 { flex: 1 1 12rem; } }
.card.highlight { border-color: var(--ys-yellow); background: var(--ys-yellow-light); }
.card.live { border-color: var(--ys-blue-dark); box-shadow: 0 0 0 3px var(--ys-blue-light); }

.stat { display: flex; flex-direction: column; gap: 0.15rem; border-top: 4px solid var(--ys-blue-light); }

/* ------------------------------------------------- bandeau KPI de tête */
/* Ouvre le tableau de bord : une figure de tête, puis les chiffres clés en
   gros. Le liseré jaune le détache du reste de la page. */
.kpi-band { display: grid; gap: 1.25rem; grid-template-columns: minmax(19rem, 1.5fr) repeat(3, minmax(0, 1fr)); }
@media (max-width: 1000px) { .kpi-band { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .kpi-band { grid-template-columns: minmax(0, 1fr); } }
.kpi-band > .card { border-top: 4px solid var(--ys-yellow); }

.kpi { display: flex; flex-direction: column; justify-content: center; gap: 0.2rem; }
.kpi-value { font-size: 2.6rem; font-weight: 700; line-height: 1.02; color: var(--ys-blue-dark); }
.kpi-label { color: var(--muted); font-size: 0.88rem; line-height: 1.3; }
.kpi-sub { color: var(--muted); font-size: 0.78rem; }
.kpi.is-alerte .kpi-value { color: var(--danger); }

.hero { display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem; }
.hero-figure { min-width: 9rem; }
.hero-value { font-size: 3.4rem; font-weight: 700; line-height: 1; color: var(--ys-blue-dark); }
.hero-value .hero-unit { font-size: 1.35rem; font-weight: 600; color: var(--muted); }
.hero-meter { flex: 1 1 12rem; }
/* Jauge : piste claire de la même teinte, remplissage porteur de la sévérité. */
.meter { height: 12px; border-radius: 999px; background: var(--ys-blue-lighter); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--ys-blue-dark); }
.meter.is-bon > span { background: var(--success); }
.meter.is-avertissement > span { background: #b87600; }
.meter.is-critique > span { background: var(--danger); }
.meter-legend { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.8rem; color: var(--muted); margin-top: 0.4rem; }
.stat-value { font-size: 1.8rem; font-weight: 700; line-height: 1.1; color: var(--ys-blue-dark); }
.stat-label { color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; }

.empty { color: var(--muted); padding: 1.5rem; text-align: center; border: 1px dashed var(--ys-blue-light); border-radius: var(--radius); background: var(--surface); }

/* ------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; background: var(--surface); }
th, td { text-align: left; padding: 0.7rem 0.75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ys-blue-dark); font-weight: 600; background: var(--ys-blue-lighter); }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg); }
.card table { margin: 0 -1.25rem; width: calc(100% + 2.5rem); }
.card table th:first-child, .card table td:first-child { padding-left: 1.25rem; }
.card table th:last-child, .card table td:last-child { padding-right: 1.25rem; }
.card.highlight table { background: transparent; }
.card.highlight th { background: rgba(255, 255, 255, 0.55); }
.card.highlight tbody tr:hover td { background: rgba(255, 255, 255, 0.45); }
@media (max-width: 720px) {
  .table-wrap th, .table-wrap td { white-space: nowrap; }
  .table-wrap td.cell-wrap { white-space: normal; min-width: 11rem; }
  .table-wrap .actions { flex-wrap: nowrap; }
}

/* ----------------------------------------------------------- badges */
.badge { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600; white-space: nowrap; background: #eef1f5; color: #3c465a; }
/* Demandes d'intervention */
.badge-created { background: var(--ys-yellow-light); color: #7a5a00; }
.badge-planned { background: var(--ys-blue-dark); color: var(--ys-white); }
.badge-delayed { background: var(--danger-light); color: var(--danger); }
.badge-finished { background: var(--success-light); color: var(--success); }
.badge-cancelled { background: #eef1f5; color: var(--muted); text-decoration: line-through; }
/* Passages de prestation */
.badge-prevu { background: var(--ys-blue-lighter); color: var(--ys-blue-dark); }
.badge-en_cours { background: var(--ys-yellow); color: var(--ys-blue-dark); }
.badge-effectue { background: var(--success-light); color: var(--success); }
.badge-manque { background: var(--danger-light); color: var(--danger); }
.badge-live { background: var(--ys-yellow); color: var(--ys-blue-dark); animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

/* ---------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; padding: 0.55rem 1rem; border-radius: 8px; border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 0.95rem; cursor: pointer; background: var(--ys-yellow); color: var(--ys-blue-dark); transition: background 0.15s, box-shadow 0.15s; }
.btn:hover { background: var(--ys-yellow-dark); text-decoration: none; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ys-blue-light); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-secondary { background: var(--ys-white); color: var(--ys-blue-dark); border-color: var(--ys-blue-light); }
.btn-secondary:hover { background: var(--ys-blue-lighter); }
.btn-ghost { background: transparent; color: var(--ys-blue-dark); }
.btn-ghost:hover { background: var(--ys-blue-lighter); }
.btn-accent, .btn-success { background: var(--ys-blue-dark); color: var(--ys-white); }
.btn-accent:hover, .btn-success:hover { background: var(--ys-blue-darker); }
.btn-danger { background: var(--danger); color: var(--ys-white); }
.btn-danger:hover { background: #8f1e18; }
.btn-outline-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-outline-danger:hover { background: var(--danger-light); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.85rem; }
.btn-lg { padding: 0.8rem 1.5rem; font-size: 1.05rem; }
.btn-block { width: 100%; }
form.inline { display: inline; }
.actions { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }

/* ------------------------------------------------------------- forms */
.form-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.field { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 1rem; }
.field label { font-weight: 600; font-size: 0.9rem; color: var(--ys-blue-dark); }
.field .help { color: var(--muted); font-size: 0.82rem; }
.field .errorlist { margin: 0; padding: 0; list-style: none; color: var(--danger); font-size: 0.85rem; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
/* Précisions d'un formulaire, repliées : on ne remplit que l'essentiel. */
.form-plus { border-top: 1px solid var(--border); margin: 0 0 1rem; padding-top: 0.75rem; }
.form-plus > summary { cursor: pointer; font-weight: 600; font-size: 0.9rem; color: var(--ys-blue-dark); }
.form-plus[open] > summary { margin-bottom: 0.75rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="time"], input[type="tel"], select, textarea {
  width: 100%; padding: 0.55rem 0.7rem; border: 1px solid #bcd3e0; border-radius: 8px; font: inherit; background: var(--ys-white); color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ys-blue-dark); box-shadow: 0 0 0 3px var(--ys-blue-light); }
textarea { resize: vertical; min-height: 90px; }
input[type="file"] { font: inherit; }
.errorlist.nonfield { list-style: none; margin: 0 0 1rem; padding: 0.75rem 1rem; background: var(--danger-light); color: var(--danger); border-radius: 8px; }
.radio-cards { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 560px) { .radio-cards { grid-template-columns: minmax(0, 1fr); } }
.radio-card { position: relative; display: block; padding: 1.25rem; border: 2px solid var(--border); border-radius: var(--radius); background: var(--surface); cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.radio-card:hover { border-color: var(--ys-blue-light); }
.radio-card input { position: absolute; opacity: 0; }
.radio-card:has(input:checked) { border-color: var(--ys-blue-dark); box-shadow: 0 0 0 3px var(--ys-blue-light); background: var(--ys-blue-lighter); }
.radio-card strong { display: block; font-size: 1.1rem; margin-bottom: 0.25rem; color: var(--ys-blue-dark); }
.radio-card .icon { font-size: 1.8rem; margin-bottom: 0.5rem; display: block; }
.formset-item { position: relative; padding: 1.25rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); margin-bottom: 1rem; }
.formset-item h3 { margin-bottom: 1rem; }
.formset-item .remove { position: absolute; top: 0.75rem; right: 0.75rem; }

/* ------------------------------------------------------------ alerts */
.messages { margin-bottom: 1.25rem; }
.alert { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 0.5rem; border: 1px solid transparent; font-size: 0.95rem; }
.alert-success { background: var(--success-light); color: var(--success); border-color: #bfe5cf; }
.alert-info, .alert-debug { background: var(--ys-blue-lighter); color: var(--ys-blue-dark); border-color: var(--ys-blue-light); }
.alert-warning { background: var(--ys-yellow-light); color: #7a5a00; border-color: var(--ys-yellow); }
.alert-error { background: var(--danger-light); color: var(--danger); border-color: #f2c2be; }

/* ------------------------------------------------------------- login */
.auth-page { display: grid; place-items: center; min-height: 100vh; padding: 2rem 1rem; background: linear-gradient(160deg, var(--ys-blue-light), var(--bg) 65%); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .card { border-top: 4px solid var(--ys-yellow); }
.auth-card .brand { justify-content: center; margin-bottom: 1.5rem; font-size: 1.15rem; color: var(--ys-blue-dark); }
@media (max-width: 400px) { .auth-card .brand { white-space: normal; } }

/* ------------------------------------------------------- definition list */
dl.details { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1.25rem; margin: 0; }
dl.details dt { color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; padding-top: 0.15rem; }
dl.details dd { margin: 0; }
@media (max-width: 560px) { dl.details { grid-template-columns: minmax(0, 1fr); gap: 0.1rem; } dl.details dd { margin-bottom: 0.6rem; } }

/* ------------------------------------------------------------ filters */
.filters { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filters a { padding: 0.35rem 0.75rem; border-radius: 999px; border: 1px solid var(--ys-blue-light); background: var(--surface); color: var(--ys-blue-dark); font-size: 0.85rem; font-weight: 500; }
.filters a:hover { text-decoration: none; background: var(--ys-blue-lighter); }
.filters a.active { background: var(--ys-blue-dark); border-color: var(--ys-blue-dark); color: var(--ys-white); }
.filters .count { opacity: 0.7; margin-left: 0.25rem; }

/* ----------------------------------------------------------- calendar */
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.calendar .weekday { text-align: center; font-size: 0.78rem; text-transform: uppercase; color: var(--ys-blue-dark); font-weight: 600; padding: 0.25rem 0; }
.calendar .day { min-height: 96px; padding: 0.4rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); display: flex; flex-direction: column; gap: 0.25rem; }
.calendar .day.other { background: var(--bg); color: #aab6c5; }
.calendar .day.today { border-color: var(--ys-yellow); box-shadow: inset 0 0 0 2px var(--ys-yellow); }
.calendar .day.today .day-number { color: var(--ys-blue-dark); }
.calendar .day-number { font-size: 0.8rem; font-weight: 600; }
.calendar .event { display: block; font-size: 0.75rem; padding: 0.2rem 0.4rem; border-radius: 6px; border-left: 3px solid var(--ys-blue-dark); background: var(--ys-blue-lighter); color: var(--ys-blue-dark); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar .event:hover { background: var(--ys-blue-dark); color: var(--ys-white); text-decoration: none; }
.calendar .event-tache { border-left-color: var(--ys-yellow-dark); background: var(--ys-yellow-light); color: #7a5a00; }
.calendar .event-tache:hover { background: var(--ys-yellow-dark); color: var(--ys-blue-dark); }
@media (max-width: 720px) { .calendar .day { min-height: 60px; } .calendar .event { font-size: 0.68rem; } }
@media (max-width: 560px) {
  .calendar { gap: 2px; }
  .calendar .day { min-height: 52px; padding: 0.15rem; }
  .calendar .event { padding: 0.1rem; border-left-width: 2px; font-size: 0.58rem; text-overflow: clip; }
  .calendar .event-label { display: none; }
}
/* Très petits écrans : l'heure ne tient plus, chaque tâche devient un simple repère (détail dans la liste du mois). */
@media (max-width: 359px) { .calendar .event { height: 6px; padding: 0; font-size: 0; } }

/* ---------------------------------------------------------- live task */
.timer { font-size: 2.4rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; color: var(--ys-blue-dark); }
.progress { height: 8px; background: var(--ys-blue-lighter); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); transition: width 1s linear; }
.photos { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.photos img { width: 120px; height: 120px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }

/* ------------------------------------------------- preuves de passage */
/* Deux vignettes côte à côte : photo d'arrivée et photo de départ. */
.proof { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 560px) { .proof { grid-template-columns: minmax(0, 1fr); } }
.proof-slot { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg); }
.proof-slot > figcaption { display: flex; justify-content: space-between; gap: 0.5rem; align-items: baseline; padding: 0.6rem 0.75rem; background: var(--surface); border-bottom: 1px solid var(--border); font-size: 0.85rem; }
.proof-slot > figcaption strong { color: var(--ys-blue-dark); }
.proof-slot img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.proof-slot .proof-empty { display: grid; place-items: center; aspect-ratio: 4 / 3; color: var(--muted); font-size: 0.9rem; text-align: center; padding: 1rem; }
.proof-thumb { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; border: 1px solid var(--border); }

/* Sections d'un formulaire long (descriptif d'une résidence). */
.form-section + .form-section { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.form-section > h3 { margin-bottom: 0.25rem; font-size: 1rem; color: var(--ys-blue-dark); }
.form-section > .section-help { color: var(--muted); font-size: 0.85rem; margin-bottom: 1rem; }
.form-grid.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 640px) { .form-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Cases à cocher en ligne (jours de la semaine, choix de résidences). */
.checkbox-inline { display: flex; flex-wrap: wrap; gap: 0.35rem 1.25rem; list-style: none; margin: 0; padding: 0; }
.checkbox-inline > div, .checkbox-inline > li { display: inline-flex; align-items: center; gap: 0.35rem; }
.checkbox-inline label { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 400; font-size: 0.92rem; color: var(--text); }

/* Mot de passe temporaire affiché une seule fois. */
.secret { display: inline-block; padding: 0.5rem 0.9rem; border-radius: 8px; background: var(--ys-blue-dark); color: var(--ys-white); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.15rem; letter-spacing: 0.08em; user-select: all; }

/* ---------------------------------------------------------- planning */
/* Grille hebdomadaire : une ligne par collaborateur (Yellow Stone) ou par
   résidence (syndic), une colonne par jour. La première colonne reste visible
   quand la grille défile horizontalement. */
main.container.wide { max-width: 1500px; }
body.has-sidebar main.container.wide { max-width: none; }

.planning-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1.25rem; margin-bottom: 1rem; }
.planning-nav { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.planning-periode { color: var(--ys-blue-dark); }
.planning-filtre { display: flex; align-items: center; gap: 0.5rem; }
.planning-filtre select { width: auto; min-width: 12rem; }

/* Les tableaux d'une carte débordent volontairement de ses marges ; le planning,
   lui, garde ses bords, sans quoi la colonne collante se décale d'autant. */
.card table.planning { margin: 0; width: 100%; }
.card table.planning th:first-child, .card table.planning td:first-child { padding-left: 0.35rem; }
.card table.planning th:last-child, .card table.planning td:last-child { padding-right: 0.35rem; }
table.planning { table-layout: fixed; font-size: 0.9rem; }
table.planning th, table.planning td { border: 1px solid var(--border); vertical-align: top; }
table.planning thead th { text-align: center; }
table.planning thead th.is-today { background: var(--ys-yellow); color: var(--ys-blue-dark); }
.planning-jour-num { font-weight: 400; font-size: 0.75rem; text-transform: none; letter-spacing: 0; }
th.planning-ressource { position: sticky; left: 0; z-index: 1; width: 11rem; background: var(--ys-blue-lighter); text-align: left; text-transform: none; font-size: 0.85rem; letter-spacing: 0; }
tbody th.planning-ressource { background: var(--surface); color: var(--ys-blue-dark); border-right: 2px solid var(--border); }
.planning-cell { position: relative; height: 6.5rem; padding: 0.3rem; }
.planning-cell.is-today { background: var(--ys-yellow-light); }
.planning-cell.is-passe { background: var(--bg); }
.planning-cell.is-passe.is-today { background: var(--ys-yellow-light); }

/* Un créneau : l'heure, ce qui est à faire, et où (ou par qui). */
.creneau { display: block; margin-bottom: 0.25rem; padding: 0.25rem 0.4rem; border-radius: 6px; border-left: 3px solid var(--ys-blue-dark); background: var(--ys-blue-lighter); color: var(--ys-blue-dark); font-size: 0.76rem; line-height: 1.25; }
.creneau:hover { text-decoration: none; filter: brightness(0.96); }
.creneau-heure { font-weight: 700; font-variant-numeric: tabular-nums; margin-right: 0.25rem; }
.creneau-titre { font-weight: 600; }
.creneau-lieu { display: block; font-size: 0.7rem; opacity: 0.75; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.creneau-marque { position: absolute; right: 0.3rem; font-weight: 700; }
.creneau-vide { color: #c3cedd; }
.creneau-prevu { border-left-color: var(--ys-blue-dark); background: var(--ys-blue-lighter); }
.creneau-en_cours { border-left-color: var(--ys-yellow-dark); background: var(--ys-yellow-light); color: #7a5a00; }
.creneau-effectue { border-left-color: var(--success); background: var(--success-light); color: var(--success); }
.creneau-manque { border-left-color: var(--danger); background: var(--danger-light); color: var(--danger); }
.creneau-created { border-left-color: var(--ys-yellow-dark); background: var(--ys-yellow-light); color: #7a5a00; }
.creneau-planned { border-left-color: var(--ys-blue-dark); background: #dde6f5; }
.creneau-delayed { border-left-color: var(--danger); background: var(--danger-light); color: var(--danger); }
.creneau-finished { border-left-color: var(--success); background: var(--success-light); color: var(--success); }
/* Le « + » ne s'affiche qu'au survol de la case : la grille reste lisible. */
.creneau-ajout { position: absolute; right: 0.25rem; bottom: 0.2rem; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; background: var(--ys-blue-lighter); color: var(--ys-blue-dark); font-weight: 700; opacity: 0; transition: opacity 0.12s; }
.planning-cell:hover .creneau-ajout, .creneau-ajout:focus-visible { opacity: 1; text-decoration: none; }
.planning-legende { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: 1rem 0 0; }
@media (max-width: 720px) {
  .planning-cell { height: auto; min-height: 4.5rem; }
  table.planning { min-width: 46rem; }
}

/* ----------------------------------------------------- notifications */
.notif { border-left: 4px solid var(--ys-blue-light); }
.notif.is-alerte { border-left-color: var(--danger); }
.notif.is-fraiche { background: var(--ys-yellow-light); border-color: var(--ys-yellow); }
.notif-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.notif-head h2 { font-size: 1.05rem; margin: 0; }

/* ------------------------------------------------- bon d'intervention */
.bon-head { display: flex; align-items: center; gap: 1rem; padding-bottom: 1rem; margin-bottom: 1.25rem; border-bottom: 3px solid var(--ys-yellow); }
.bon-head h2 { margin: 0; }
.bon-logo { display: block; width: 64px; height: 64px; }
.bon-ref { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.bon-ref strong { font-size: 1.1rem; font-variant-numeric: tabular-nums; color: var(--ys-blue-dark); }
.bon-details { margin-bottom: 0.5rem; }
.bon-section { margin-top: 1.25rem; }
.bon-section h3 { color: var(--ys-blue-dark); margin-bottom: 0.4rem; }
.bon-signatures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; margin-top: 2rem; }
.bon-cadre { height: 4.5rem; margin-top: 0.35rem; border: 1px dashed var(--border); border-radius: 8px; }
.bon-pied { margin-top: 1.5rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
/* Sur le bon, la photo est une pièce jointe : elle ne mange pas la page. */
.bon .proof-slot img { aspect-ratio: auto; max-height: 13rem; object-fit: contain; background: var(--bg); }
@media (max-width: 560px) { .bon-signatures { grid-template-columns: minmax(0, 1fr); } }

/* ------------------------------------------------- récapitulatif mensuel */
.badge-bon { background: var(--success-light); color: var(--success); }
.badge-avertissement { background: var(--ys-yellow-light); color: #7a5a00; }
.badge-critique { background: var(--danger-light); color: var(--danger); }
.only-print { display: none; }

/* Impression : seule la feuille sort, sans la navigation ni les boutons. */
@media print {
  .sidebar, .sidebar-scrim, .appbar, .topbar, .footer, .messages, .no-print { display: none !important; }
  body { background: var(--ys-white); }
  main.container { max-width: none; padding: 0; }
  .card.bon { border: 0; box-shadow: none; padding: 0; page-break-inside: avoid; }
  .proof-slot img { max-height: 8cm; object-fit: contain; }
  .only-print { display: block; }
  .card { break-inside: avoid; }
  a[href] { color: inherit; text-decoration: none; }
}

/* ------------------------------------------------- pointage en 3 étapes */
/* Arriver, faire, partir : la page suit l'ordre du travail, et chaque étape
   s'allume quand c'est son tour. */
.etapes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1.25rem; }
.etape { border-left: 4px solid var(--border); }
.etape.is-active { border-left-color: var(--ys-yellow); box-shadow: 0 0 0 3px var(--ys-yellow-light); }
.etape.is-faite { border-left-color: var(--success); }
.etape-tete { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.etape-tete h2 { margin: 0; flex: 1; }
.etape-num { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--ys-blue-lighter); color: var(--ys-blue-dark); font-weight: 700; font-size: 0.85rem; }
.etape.is-active .etape-num { background: var(--ys-yellow); }
.etape.is-faite .etape-num { background: var(--success); color: var(--ys-white); }
.etape-heure { color: var(--muted); }
.etape-preuve { max-width: 22rem; }
.etape-preuve img { max-height: 16rem; object-fit: cover; }

/* ----------------------------------------------------- liste de tâches */
/* Le cahier des charges du site, coché sur place. Les cases sont larges :
   l'écran est tenu d'une main, souvent avec des gants. */
.checklist-items { list-style: none; margin: 0.5rem 0 0; padding: 0; }
.checklist-item + .checklist-item { border-top: 1px solid var(--border); }
.checklist-item label { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 0.25rem; cursor: pointer; font-size: 1rem; }
.checklist-item input[type="checkbox"] { width: 1.5rem; height: 1.5rem; flex: none; accent-color: var(--ys-blue-dark); }
.checklist-item input[type="checkbox"]:disabled { cursor: default; }
.checklist-libelle { flex: 1; }
.checklist-item.is-faite .checklist-libelle { color: var(--muted); text-decoration: line-through; }
.checklist-submit { margin-top: 0.75rem; }
/* `display: inline-flex` des boutons l'emporterait sur l'attribut `hidden`,
   que le script pose dès qu'il prend la main sur les cases. */
.btn[hidden] { display: none; }
/* Le bouton de clôture reste cliquable : c'est le modèle qui refuse, avec un
   message qui nomme les tâches manquantes. */
.btn.is-bloque { opacity: 0.6; }
.liste-taches { list-style: none; margin: 0; padding: 0; }
.liste-taches li { padding: 0.45rem 0; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 0.5rem; }
.liste-taches li:last-child { border-bottom: 0; }
/* Accès au planning récurrent depuis un créneau (Yellow Stone seulement). */
.creneau-planning { position: absolute; top: 0.2rem; right: 0.25rem; opacity: 0; font-size: 0.8rem; color: var(--muted); }
.planning-cell:hover .creneau-planning, .creneau-planning:focus-visible { opacity: 1; text-decoration: none; }
/* Cases à cocher en colonne : les tâches d'un planning se lisent de haut en bas. */
.checkbox-colonne { display: flex; flex-direction: column; gap: 0.35rem; list-style: none; margin: 0; padding: 0; }
.checkbox-colonne label { font-weight: 400; display: inline-flex; align-items: center; gap: 0.4rem; }

/* ------------------------------------------------- la journée de l'agent */
/* Ce qu'il a à faire aujourd'hui : l'heure, le site, et les tâches qui vont
   avec — avant même d'ouvrir le pointage. */
.journee { list-style: none; margin: 0; padding: 0; counter-reset: etape; }
.journee-item + .journee-item { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.journee-tete { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.journee-heure { font-size: 1.15rem; font-weight: 700; color: var(--ys-blue-dark); }
.journee-quoi { display: flex; flex-direction: column; flex: 1 1 12rem; min-width: 0; }
.journee-taches { list-style: none; margin: 0.5rem 0 0 3.6rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.3rem 0.5rem; }
.journee-taches li { font-size: 0.82rem; padding: 0.15rem 0.55rem; border-radius: 999px; background: var(--ys-blue-lighter); color: var(--ys-blue-dark); }
@media (max-width: 560px) { .journee-taches { margin-left: 0; } }

/* ===================================================== espace Yellow Stone */
/* Tableau de bord, sites et agents : des cartes cherchables plutôt que des
   listes, parce que l'équipe travaille par site et par personne. */

.bandeau-alerte { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: 0.85rem 1.25rem; border-radius: var(--radius); background: var(--ys-yellow-light);
  border: 1px solid var(--ys-yellow); color: var(--ys-blue-dark); text-decoration: none; }
.bandeau-alerte:hover { background: var(--ys-yellow); }
.bandeau-lien { font-weight: 600; text-decoration: underline; white-space: nowrap; }

.kpi-band-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1100px) { .kpi-band-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 620px) { .kpi-band-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi-band-5 .kpi-value { font-size: 2rem; }

.grid-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 860px) { .grid-2-1 { grid-template-columns: minmax(0, 1fr); } }

/* Une entrée de liste cliquable : heure ou pastille à gauche, le reste à droite. */
.ligne-passage { display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.6rem 0;
  border-bottom: 1px solid var(--border); color: inherit; text-decoration: none; }
.ligne-passage:last-child { border-bottom: 0; }
a.ligne-passage:hover { background: var(--bg); }
.ligne-passage .mono { flex: none; color: var(--muted); font-size: 0.85rem; padding-top: 0.15rem; }

.pastille { flex: none; width: 9px; height: 9px; border-radius: 50%; margin-top: 0.45rem; background: var(--muted); }
.pastille-en_cours { background: var(--success); }
.pastille-prevu { background: var(--ys-yellow); }
.pastille-repos { background: #c8cedb; }
.pastille-alerte, .pastille-manque { background: var(--danger); }
.etat-manque { color: var(--danger); font-weight: 600; }

.etat { font-size: 0.82rem; color: var(--muted); }
.etat-en_cours { color: var(--success); font-weight: 600; }
.etat-prevu { color: #7a5a00; }

.photos-observation { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.observation + .observation { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.observation-tete { display: flex; justify-content: space-between; gap: 1rem; }
.observation blockquote { margin: 0.25rem 0 0; padding-left: 0.75rem; border-left: 3px solid var(--ys-yellow); color: var(--muted); }
.sous-titre { margin: 1.25rem 0 0.5rem; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
.badge-jour { background: var(--surface); border: 1px solid var(--border); }

/* Recherche et étiquettes dérivées (cabinet, ville) : aucune saisie à faire. */
.recherche { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; }
.recherche input { flex: 1; }
.etiquettes { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.25rem; }
.etiquette { display: inline-block; padding: 0.2rem 0.7rem; border-radius: 999px; font-size: 0.8rem;
  background: var(--surface); border: 1px solid var(--border); color: var(--ys-blue-dark); text-decoration: none; }
a.etiquette:hover, .etiquette.is-active { background: var(--ys-yellow); border-color: var(--ys-yellow); text-decoration: none; }
.etiquette-raz { color: var(--muted); }
.etiquettes-carte { margin: 0.75rem 0 0; }

.cartes { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); }
.cartes > .empty { grid-column: 1 / -1; }
.carte-site, .carte-agent { display: flex; flex-direction: column; }
.carte-site .card-header, .carte-agent .card-header { margin-bottom: 0.75rem; }
.carte-site h2 { font-size: 1rem; }
.details-compact { font-size: 0.88rem; gap: 0.3rem 0.9rem; }
.details-compact dt { font-size: 0.78rem; }
.details-compact dd { overflow-wrap: anywhere; }
.carte-actions { margin-top: auto; padding-top: 0.9rem; }
.carte-agent-tete { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.9rem; }
.carte-agent-tete .avatar { flex: none; display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: 50%; background: var(--ys-yellow); color: var(--ys-blue-dark); font-weight: 700; }

/* Carte entièrement cliquable : le lien du titre s'étend sur toute la carte,
   les boutons et étiquettes restent cliquables au-dessus. */
.carte-cliquable { position: relative; transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s; }
.carte-cliquable:hover, .carte-cliquable:focus-within { border-color: var(--ys-blue-light); box-shadow: 0 6px 18px rgba(40, 59, 112, 0.14); transform: translateY(-2px); }
.carte-lien { color: inherit; }
.carte-lien:hover { text-decoration: none; }
.carte-lien::after { content: ''; position: absolute; inset: 0; border-radius: var(--radius); }
.carte-cliquable .carte-actions, .carte-cliquable a.etiquette { position: relative; z-index: 1; }

/* Moyens d'accès d'un site : cases sur une ligne, le code à côté du digicode. */
.acces-choix { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1.5rem; margin-bottom: 1rem; }
.acces-choix label { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 400; cursor: pointer; }
.acces-digicode { display: inline-flex; align-items: center; gap: 0.5rem; }
.acces-digicode input[type="text"] { width: 8rem; }
.photo-facade { display: block; width: 100%; max-height: 280px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--border); }
.carte-photo { display: block; width: calc(100% + 2.5rem); height: 140px; object-fit: cover; margin: -1.25rem -1.25rem 1rem; border-radius: var(--radius) var(--radius) 0 0; }
.photo-acces { max-width: 220px; max-height: 160px; border-radius: 8px; border: 1px solid var(--border); object-fit: cover; }
.liens-fiche { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.liens-fiche a { display: flex; align-items: center; gap: 0.6rem; }
.liens-fiche .avatar { flex: none; display: grid; place-items: center; width: 32px; height: 32px; font-size: 0.8rem;
  border-radius: 50%; background: var(--ys-yellow); color: var(--ys-blue-dark); font-weight: 700; }

.filtres { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.filtres input[type="search"] { flex: 1 1 14rem; }
.filtres select { width: auto; min-width: 10rem; }

.mot-de-passe { font-size: 1.5rem; font-weight: 700; letter-spacing: 0.08em; margin: 0.5rem 0 1rem; }

/* Colonne « Site » du planning piloté par Yellow Stone. */
.planning-site { width: 10rem; font-size: 0.85rem; color: var(--ys-blue-dark); vertical-align: middle; }
td.planning-site { background: var(--surface); border-right: 2px solid var(--border); }
th.planning-ressource .avatar-sm { display: inline-grid; place-items: center; width: 22px; height: 22px;
  border-radius: 50%; background: var(--ys-yellow); color: var(--ys-blue-dark); font-size: 0.7rem;
  font-weight: 700; margin-right: 0.35rem; vertical-align: middle; }
@media (max-width: 960px) { table.planning-pilote { min-width: 56rem; } }

/* Bâtiments d'un site : saisie par lignes, résumé sous l'adresse. */
.table-batiments { width: 100%; margin-bottom: 0.75rem; }
.table-batiments td { padding: 0.25rem 0.5rem 0.25rem 0; vertical-align: top; }
.table-batiments th { text-align: left; font-weight: 600; font-size: 0.85rem; }
.liste-batiments { margin-top: 0.25rem; }

/* Formulaire de planning : un jour coché, une heure facultative à côté. */
.jours-heures { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 0.4rem 1rem; }
.jour-heure { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.jour-heure label { display: inline-flex; align-items: center; gap: 0.35rem; margin: 0; font-weight: 500; }
.jour-heure input[type=time] { width: 7.5rem; }
.jour-heure input[type=time]:disabled { opacity: 0.35; }

/* Planning : glisser-déposer d'un passage prévu. */
.creneau[draggable=true] { cursor: grab; }
.creneau.is-deplace { opacity: 0.4; }
.planning-cell.is-cible { outline: 2px dashed var(--ys-yellow); outline-offset: -3px; background: rgba(255, 204, 0, 0.08); }
