/* ==========================================================================
   WiFiPilot — système d'interface « affiche », noir, blanc et citron
   Aplats francs, chiffres condensés, hiérarchie par l'échelle.
   Le citron est réservé à ce qui se touche (boutons, sélection) et au chiffre décisif.
   Polices : Barlow (interface) + Barlow Condensed (chiffres et titres).
   ========================================================================== */

:root {
    /* Couleurs du monde : noir, blanc, une touche de citron */
    --lime: #C6F135;         /* l'accent : boutons, sélection, chiffre décisif */
    --lime-hi: #D7FB5C;      /* survol */
    --lime-deep: #8FBF0F;    /* tranche des boutons (relief), flancs des volumes */
    --lime-tint: #F0FAD2;
    --lime-glow: rgba(198, 241, 53, .5);
    --saffron: var(--lime);  /* ancien nom, conservé : les pages qui l'emploient passent au citron */
    --saffron-deep: var(--lime-deep);
    --ink: #0A0A0A;          /* texte, aplats noirs */
    --ink-2: #38383B;        /* texte secondaire */
    --ink-3: #67676D;        /* texte tertiaire (≥ 4.5:1 sur papier) */
    --paper: #F3F3F1;        /* fond de travail */
    --sheet: #FFFFFF;        /* surfaces de travail */
    --rule: #E5E5E2;         /* filets */
    --rule-strong: #CDCDC9;
    --green: #3D6E00;        /* argent encaissé, en ligne (texte lisible, famille citron) */
    --green-tint: #EEF8D3;
    --red: #C8361D;          /* alerte, manque, hors ligne */
    --red-tint: #F8E2DC;
    --indigo: #0A0A0A;       /* liens : noirs et soulignés */
    --indigo-tint: #EDEDEA;
    --amber-tint: #FCEFC5;

    /* Typographie */
    --font-ui: "Barlow", "Segoe UI", system-ui, sans-serif;
    --font-figure: "Barlow Condensed", "Barlow", "Arial Narrow", sans-serif;

    /* Rythme : cellule de 8 px */
    --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
    --radius: 12px;
    --radius-sm: 8px;
    --rail: 248px;
    --ease: cubic-bezier(.16, 1, .3, 1);
    --page-pad: var(--s6);   /* marge latérale du contenu, réutilisée par le fond perdu du bandeau */
}

/* ---------- Base ---------- */

html { -webkit-text-size-adjust: 100%; }

body.wp {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: 15px;
    line-height: 1.5;
    font-feature-settings: "tnum" 1, "lnum" 1;
    -webkit-font-smoothing: antialiased;
}

body.wp ::selection { background: var(--saffron); color: var(--ink); }
body.wp :focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: 4px; box-shadow: 0 0 0 6px var(--lime-glow); }
body.wp a { text-underline-offset: 3px; }
body.wp input, body.wp select, body.wp textarea, body.wp button { font-family: inherit; }
body.wp input, body.wp textarea { caret-color: var(--ink); }
body.wp table { font-variant-numeric: tabular-nums; }

body.wp * { scrollbar-width: thin; scrollbar-color: var(--rule-strong) transparent; }

/* ---------- Coque : barre latérale + contenu ---------- */

.wp-shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }

.wp-rail {
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    background: var(--ink); color: #F4F4F2;
    display: flex; flex-direction: column;
    padding: var(--s4) var(--s3);
    z-index: 30;
}

.wp-brand { display: flex; align-items: center; gap: var(--s2); padding: var(--s1) var(--s2) var(--s4); text-decoration: none; color: var(--ink); }
.wp-brand svg { width: 34px; height: 34px; flex: none; }
.wp-brand b { font-family: var(--font-figure); font-weight: 800; font-size: 26px; letter-spacing: -0.01em; text-transform: uppercase; line-height: 1; }

.wp-rail-cta {
    display: flex; align-items: center; justify-content: center; gap: var(--s2);
    background: var(--lime); color: var(--ink);
    padding: 12px var(--s4); border-radius: var(--radius-sm);
    font-weight: 700; font-size: 15px; text-decoration: none;
    margin: 0 var(--s1) var(--s4);
    transition: background-color .15s var(--ease);
}
.wp-rail-cta:hover { background: var(--lime-hi); }
.wp-rail .wp-brand { color: #fff; }

.wp-nav-group { margin-top: var(--s3); }
.wp-nav-label {
    font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    color: rgba(255, 255, 255, .5); padding: var(--s2) var(--s3) var(--s1);
}
.wp-nav-link {
    display: flex; align-items: center; gap: var(--s3);
    padding: 8px var(--s3); border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, .82); text-decoration: none; font-weight: 500; font-size: 14.5px;
    transition: background-color .15s var(--ease);
}
.wp-nav-link .wp-icon { flex: none; opacity: .85; }
.wp-nav-link:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.wp-nav-link[aria-current="page"] { background: var(--lime); color: var(--ink); font-weight: 700; }
.wp-nav-link[aria-current="page"] .wp-icon { opacity: 1; }
.wp-nav-count { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; }

.wp-rail-foot { margin-top: auto; padding-top: var(--s4); border-top: 1px solid rgba(255, 255, 255, .12); }
.wp-user { display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s3); }
.wp-user-mark { width: 34px; height: 34px; border-radius: 50%; background: var(--lime); color: var(--ink); display: flex; align-items: center; justify-content: center; font-family: var(--font-figure); font-weight: 800; font-size: 15px; flex: none; }
.wp-user-name { font-weight: 700; font-size: 14px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wp-user-role { font-size: 12px; color: rgba(255, 255, 255, .6); }
.wp-rail-foot form { margin: 0; }
.wp-rail-foot button.wp-nav-link { width: 100%; background: none; border: 0; cursor: pointer; text-align: left; }

/* Barre mobile */
.wp-topbar { display: none; }
.wp-scrim { display: none; }

/* ---------- Zone de contenu ---------- */

.wp-main { min-width: 0; display: flex; flex-direction: column; }

.wp-page-head {
    padding: var(--s6) var(--s6) var(--s2);
    max-width: 1320px; width: 100%; box-sizing: border-box; margin: 0 auto;
}
.wp-page-head h1, .wp-page-head h2 {
    font-family: var(--font-figure) !important; font-weight: 800 !important;
    font-size: 34px !important; line-height: 1.05 !important; letter-spacing: -0.01em;
    text-transform: uppercase; color: var(--ink) !important; margin: 0;
}
.wp-page-head span, .wp-page-head p { color: var(--ink-2); }

.wp-content { flex: 1; }
.wp-page { max-width: 1320px; margin: 0 auto; padding: var(--s4) var(--page-pad) var(--s8); box-sizing: border-box; overflow-x: clip; }

/* ---------- Composants ---------- */

.wp-panel { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); }
.wp-panel-pad { padding: var(--s5); }
.wp-panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); padding: var(--s4) var(--s5); border-bottom: 1px solid var(--rule); }
.wp-panel-head h2, .wp-panel-head h3 { font-size: 16px; font-weight: 700; margin: 0; }
.wp-panel-head a { font-size: 14px; font-weight: 600; color: var(--indigo); text-decoration: none; }
.wp-panel-head a:hover { text-decoration: underline; }

/* Signature : le bandeau « affiche » — le chiffre décisif de l'écran sur un aplat */
.wp-band {
    position: relative; overflow: hidden;
    /* Fond perdu : l'aplat court jusqu'aux bords de la zone de contenu, comme une affiche. */
    border-radius: 0;
    margin-inline: calc(-1 * var(--page-pad, var(--s6)));
    padding: var(--s7) var(--page-pad, var(--s6)) var(--s6);
    color: #fff; background: var(--ink);
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s5); align-items: end;
}
.wp-band.is-ink { background: #000; }
.wp-band:not(.is-saffron):not(.is-red) .wp-figure { color: var(--lime); }
.wp-band.is-red { background: var(--red); }
.wp-band.is-saffron { background: var(--saffron); color: var(--ink); }
.wp-band-label { font-weight: 600; font-size: 15px; opacity: .88; margin: 0 0 var(--s1); }
.wp-figure {
    font-family: var(--font-figure); font-weight: 800; font-variant-numeric: tabular-nums;
    font-size: clamp(56px, 8vw, 96px); line-height: .9; letter-spacing: -0.02em; margin: 0;
}
.wp-figure small { font-size: .32em; font-weight: 700; letter-spacing: 0; margin-left: .2em; opacity: .85; }
.wp-band-meta { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); margin-top: var(--s3); font-size: 14px; opacity: .9; }
.wp-band-meta strong { font-weight: 700; }
.wp-band-actions { display: flex; gap: var(--s2); flex-wrap: wrap; align-self: start; }

/* Barres de la semaine, dans le bandeau */
.wp-week { display: flex; align-items: flex-end; gap: 6px; height: 96px; min-width: 260px; }
.wp-week-day { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.wp-week-bar { width: 100%; max-width: 30px; background: rgba(255, 255, 255, .38); border-radius: 3px 3px 1px 1px; min-height: 3px; }
.wp-week-day.is-today .wp-week-bar { background: var(--lime); }
.wp-week-day span { font-size: 11px; margin-top: 6px; opacity: .85; white-space: nowrap; }
.wp-week-day.is-today span { font-weight: 700; opacity: 1; }

/* Rangée de chiffres secondaires (pas de grille de cartes) */
/* Les filets naissent de l'écart de 1 px : la rangée reste juste quand elle passe sur deux lignes. */
.wp-stats { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.wp-stat { padding: var(--s4) var(--s5); background: var(--sheet); min-width: 0; text-decoration: none; color: inherit; }
a.wp-stat:hover { background: #F7FBEA; }
.wp-band + .wp-stats { margin-top: 0; margin-inline: calc(-1 * var(--page-pad)); border-radius: 0; border-width: 0 0 1px; }
/* À fond perdu, chaque cellule s'aligne sur la marge de la page (même quand la rangée passe à la ligne) */
.wp-band + .wp-stats .wp-stat { padding-inline: var(--page-pad); }
.wp-stat dt { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.wp-stat dd { margin: 2px 0 0; font-family: var(--font-figure); font-weight: 700; font-size: 30px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.wp-stat dd small { font-family: var(--font-ui); font-size: 13px; font-weight: 500; color: var(--ink-3); margin-left: 4px; }
.wp-stat.is-alert dd { color: var(--red); }

/* Boutons */
.wp-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
    min-height: 40px; padding: 0 var(--s4); border-radius: var(--radius-sm); border: 1px solid transparent;
    font-weight: 700; font-size: 14.5px; text-decoration: none; cursor: pointer; white-space: nowrap;
    background: var(--lime); color: var(--ink);
    transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
.wp-btn:hover { background: var(--lime-hi); }
.wp-btn:disabled, .wp-btn[aria-disabled="true"] { background: var(--rule-strong); color: var(--ink-3); cursor: not-allowed; }
.wp-btn.is-ink { background: var(--lime); color: var(--ink); }  /* boutons d action : tous citron */
.wp-btn.is-ink:hover { background: var(--lime-hi); }
.wp-btn.is-quiet { background: var(--sheet); color: var(--ink); border-color: var(--rule-strong); }
.wp-btn.is-quiet:hover { border-color: var(--ink); }
/* Sur aplat : on assombrit l'aplat sous le texte blanc (contraste ≥ 4,5:1 sur vert comme sur rouge) */
.wp-btn.is-on-color { background: rgba(255, 255, 255, .08); color: inherit; border-color: rgba(255, 255, 255, .45); }
.wp-btn.is-on-color:hover { background: rgba(255, 255, 255, .16); }
.wp-band.is-red .wp-btn.is-on-color { background: rgba(0, 0, 0, .2); }
.wp-band.is-saffron .wp-btn.is-on-color { background: rgba(20, 19, 15, .08); border-color: rgba(20, 19, 15, .4); }
.wp-btn.is-lg { min-height: 56px; font-size: 17px; padding: 0 var(--s5); border-radius: 10px; }

/* Pastilles d'état */
.wp-badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.wp-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.wp-badge.is-ok { background: var(--green-tint); color: var(--green); }
.wp-badge.is-down { background: var(--red-tint); color: #A32B16; }
.wp-badge.is-warn { background: var(--amber-tint); color: #7A5600; }
.wp-badge.is-off { background: #ECEBE6; color: var(--ink-3); }

/* Listes de travail */
.wp-rows { list-style: none; margin: 0; padding: 0; }
.wp-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3) var(--s5); border-top: 1px solid var(--rule); text-decoration: none; color: inherit; }
.wp-rows > :first-child .wp-row, .wp-rows > .wp-row:first-child { border-top: 0; }
a.wp-row:hover { background: #F7FBEA; }
.wp-row-main { min-width: 0; }
.wp-row-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wp-row-sub { font-size: 13px; color: var(--ink-3); }
.wp-row-figure { font-family: var(--font-figure); font-weight: 700; font-size: 20px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.wp-empty { padding: var(--s6) var(--s5); text-align: center; color: var(--ink-3); }
.wp-empty strong { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }

/* Grilles de travail */
.wp-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); gap: var(--s5); }
.wp-stack > * + * { margin-top: var(--s5); }

/* Barre de durée proportionnelle (forfaits) */
.wp-duration { height: 6px; background: #ECEBE6; border-radius: 3px; overflow: hidden; }
.wp-duration span { display: block; height: 100%; background: var(--ink); border-radius: 3px; }

/* Éléments épuisés, expirés : passent en gris */
.is-spent { filter: grayscale(1); opacity: .55; }

/* Messages */
.wp-flash { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--radius-sm); font-weight: 500; margin-bottom: var(--s4); }
.wp-flash.is-ok { background: var(--green-tint); color: #2C5000; }
.wp-flash.is-error { background: var(--red-tint); color: #8E2414; }

/* ==========================================================================
   Harmonisation des écrans existants (styles inline)
   Les anciennes pages gardent leur structure ; leurs couleurs et surfaces
   sont ramenées dans le monde de l'affiche.
   ========================================================================== */

main > div[style*="min-height:100vh"],
main > div[style*="min-height: 100vh"] { background: transparent !important; padding: var(--s4) var(--s6) var(--s8) !important; }

/* Pages autrefois autonomes (ventes, dépenses, caisse, rapports) : style confiné à .wp-legacy */
body.wp .wp-legacy { background: transparent !important; padding: var(--s4) var(--s6) var(--s8) !important; font-family: var(--font-ui) !important; color: var(--ink) !important; }
body.wp .wp-legacy * { box-shadow: none !important; text-shadow: none !important; }
body.wp .wp-legacy .container { max-width: 1320px !important; }
body.wp .wp-legacy .header { background: none !important; color: var(--ink) !important; padding: 0 0 var(--s2) !important; border-radius: 0 !important; margin-bottom: var(--s5) !important; }
body.wp .wp-legacy .header h1, body.wp .wp-legacy .header h2 { font-family: var(--font-figure) !important; font-weight: 800 !important; font-size: 34px !important; line-height: 1.05 !important; text-transform: uppercase; letter-spacing: -0.01em; margin: 0 0 6px !important; color: var(--ink) !important; }
body.wp .wp-legacy .header p { color: var(--ink-2) !important; }
body.wp .wp-legacy .btn, body.wp .wp-legacy .small-btn {
    display: inline-flex !important; align-items: center; gap: 8px; vertical-align: top;
    border-radius: var(--radius-sm) !important; font-weight: 700 !important; text-transform: none !important; letter-spacing: 0 !important;
    background: var(--sheet) !important; color: var(--ink) !important; border: 1px solid var(--rule-strong) !important;
    transition: border-color .15s var(--ease), background-color .15s var(--ease);
}
body.wp .wp-legacy .btn:hover, body.wp .wp-legacy .small-btn:hover { border-color: var(--ink) !important; }
body.wp .wp-legacy .btn.blue, body.wp .wp-legacy .btn.green, body.wp .wp-legacy .btn-primary { background: var(--lime) !important; color: var(--ink) !important; border-color: var(--lime) !important; }
body.wp .wp-legacy .btn.red { background: var(--red) !important; color: #fff !important; border-color: var(--red) !important; }
body.wp .wp-legacy th { background: #F4F4F2 !important; color: var(--ink-2) !important; }
body.wp .wp-legacy .receipt, body.wp .wp-legacy .action {
    background: var(--sheet) !important; color: var(--ink) !important; border: 1px solid var(--rule-strong) !important;
    border-radius: var(--radius-sm) !important; text-transform: none !important; font-weight: 700 !important;
}
body.wp .wp-legacy .receipt:hover, body.wp .wp-legacy .action:hover { border-color: var(--ink) !important; }
body.wp .wp-legacy button.action[style*="#dc2626"] { background: var(--sheet) !important; color: var(--red) !important; border-color: #E9B8AD !important; }
body.wp .wp-legacy .value, body.wp .wp-legacy .stat-card .value { color: var(--ink) !important; font-family: var(--font-figure); font-weight: 700; }
body.wp .wp-legacy .stat-card strong { color: var(--ink) !important; font-family: var(--font-figure); font-weight: 700; font-size: 30px !important; font-variant-numeric: tabular-nums; }
body.wp .wp-legacy .value.negative { color: var(--red) !important; }
body.wp .wp-legacy .value.positive { color: var(--green) !important; }
body.wp .wp-legacy [class*="card"], body.wp .wp-legacy [class*="box"], body.wp .wp-legacy .summary, body.wp .wp-legacy .stat {
    border: 1px solid var(--rule); border-radius: var(--radius) !important;
}

@media (max-width: 1023px) {
    main > div[style*="min-height:100vh"], main > div[style*="min-height: 100vh"], body.wp .wp-legacy { padding: var(--s4) var(--s4) var(--s7) !important; }
}

main div[style*="background:white"], main div[style*="background: white"],
main div[style*="background:#fff;"], main div[style*="background: #fff;"] {
    border: 1px solid var(--rule) !important; border-radius: var(--radius) !important; box-shadow: none !important;
}

main table thead tr, main table thead { background: #F4F4F2 !important; }
main table th { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2) !important; }
main table td { border-color: var(--rule) !important; }
main tbody tr { transition: background-color .12s var(--ease); }
main tbody tr:hover { background: #F7FBEA; }

main input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="hidden"]),
main select, main textarea {
    border: 1px solid var(--rule-strong) !important; border-radius: var(--radius-sm) !important;
    background: var(--sheet); color: var(--ink); min-height: 40px; box-sizing: border-box;
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
main input:focus, main select:focus, main textarea:focus { border-color: var(--ink) !important; box-shadow: 0 0 0 3px var(--lime-glow) !important; outline: none; }

main a[style*="background:#"], main a[style*="background: #"],
main button[style*="background:#"], main button[style*="background: #"] {
    border-radius: var(--radius-sm) !important; font-weight: 700 !important; box-shadow: none !important;
    transition: filter .15s var(--ease);
}
main a[style*="background:#"]:hover, main a[style*="background: #"]:hover,
main button[style*="background:#"]:hover, main button[style*="background: #"]:hover { filter: brightness(.9); }

main h1[style], main h2[style], main h3[style] { color: var(--ink) !important; letter-spacing: -0.01em; }

/* ---------- Mobile et tablette ---------- */

@media (max-width: 1023px) {
    .wp-shell { grid-template-columns: minmax(0, 1fr); align-content: start; }
    .wp-main { min-height: calc(100vh - 56px); }
    .wp-rail {
        position: fixed; inset: 0 auto 0 0; width: min(86vw, 300px); height: 100vh;
        transform: translateX(-102%); transition: transform .22s var(--ease);
        box-shadow: 0 0 0 100vmax transparent;
    }
    .wp-shell.is-open .wp-rail { transform: none; box-shadow: 8px 0 32px rgba(20, 19, 15, .25); }
    .wp-shell.is-open .wp-scrim { display: block; position: fixed; inset: 0; background: rgba(20, 19, 15, .45); z-index: 25; }
    .wp-topbar {
        display: flex; align-items: center; gap: var(--s3); position: sticky; top: 0; z-index: 20;
        background: var(--ink); color: #fff; padding: 10px var(--s4); min-height: 56px; box-sizing: border-box;
    }
    .wp-topbar button, .wp-topbar a.wp-topbar-icon { background: none; border: 0; color: #fff; padding: 8px; border-radius: var(--radius-sm); display: inline-flex; position: relative; cursor: pointer; }
    .wp-topbar .wp-brand { padding: 0; color: #fff; }
    .wp-topbar .wp-brand b { font-size: 22px; }
    .wp-topbar-spacer { flex: 1; }
    .wp-topbar .wp-nav-count { position: absolute; top: 2px; right: 0; }
    .wp-page-head { padding: var(--s5) var(--s4) 0; }
    .wp-page-head h1, .wp-page-head h2 { font-size: 28px !important; }
    :root { --page-pad: var(--s4); }
    .wp-page { padding: var(--s4) var(--page-pad) var(--s7); }
    .wp-band { grid-template-columns: minmax(0, 1fr); padding: var(--s6) var(--page-pad) var(--s5); }
    .wp-week { min-width: 0; }
}

/* ---------- Mouvement et impression ---------- */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

@media print {
    .wp-rail, .wp-topbar, .wp-scrim { display: none !important; }
    .wp-shell { display: block; }
    body.wp { background: #fff; }
}

/* ==========================================================================
   Kit des pages intérieures : listes, formulaires, fiches
   ========================================================================== */

/* Bandeau compact : le chiffre clé d'un module */
.wp-band.is-compact { padding-top: var(--s5); padding-bottom: var(--s5); align-items: center; }
.wp-band.is-compact .wp-figure { font-size: clamp(44px, 5vw, 64px); }
.wp-band-figures { display: flex; flex-wrap: wrap; gap: var(--s4) var(--s7); align-items: flex-end; }
.wp-mini { font-family: var(--font-figure); font-weight: 700; font-size: 32px; line-height: 1; font-variant-numeric: tabular-nums; margin: 0; }
.wp-mini-label { font-size: 13px; opacity: .85; margin: 4px 0 0; }
.wp-band + .wp-panel, .wp-band + form, .wp-band + .wp-cols { margin-top: var(--s5); }

/* Barre d'outils au-dessus d'une liste */
.wp-toolbar { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; padding: var(--s3) var(--s5); border-bottom: 1px solid var(--rule); }
.wp-toolbar h2 { font-size: 16px; font-weight: 700; margin: 0 auto 0 0; }
.wp-count { font-weight: 500; color: var(--ink-3); margin-left: 6px; }
.wp-search { position: relative; }
.wp-search input { padding-left: 34px !important; min-width: 220px; }
.wp-search .wp-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }

/* Onglets de filtre en pilules */
.fleet-chip { display: inline-flex; align-items: center; gap: 4px; padding: 7px 13px; border-radius: 999px; font-size: 13px; font-weight: 700; text-decoration: none; background: var(--sheet); color: var(--ink-2); border: 1px solid var(--rule-strong); white-space: nowrap; }
.fleet-chip:hover { border-color: var(--ink); }
.fleet-chip[aria-current] { background: var(--ink); color: var(--lime); border-color: var(--ink); }
.fleet-chip .wp-count { margin-left: 2px; font-weight: 600; }
.fleet-chip[aria-current] .wp-count { color: rgba(198, 241, 53, .75); }

/* Tableau */
/* relative : les libellés .sr-only des en-têtes restent dans le tableau (sinon la page déborde sur téléphone) */
.wp-table-wrap { overflow-x: auto; position: relative; }
.wp-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.wp-table th { text-align: left; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3) !important; background: #F7F7F5 !important; padding: 10px var(--s4); border-bottom: 1px solid var(--rule); white-space: nowrap; }
.wp-table td { padding: 12px var(--s4); border-bottom: 1px solid var(--rule); vertical-align: middle; }
.wp-table tbody tr:last-child td { border-bottom: 0; }
.wp-table th:first-child, .wp-table td:first-child { padding-left: var(--s5); }
.wp-table th:last-child, .wp-table td:last-child { padding-right: var(--s5); }
.wp-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wp-table .strong { font-weight: 700; }
.wp-table .mono { font-family: Consolas, "Courier New", monospace; font-size: 13.5px; letter-spacing: .02em; white-space: nowrap; }
.wp-table .muted { color: var(--ink-3); font-size: 13px; }
.wp-table a.wp-cell-link { color: var(--ink); font-weight: 700; text-decoration: none; }
.wp-table a.wp-cell-link:hover { text-decoration: underline; }

/* Actions de ligne en icônes */
.wp-actions { display: flex; gap: 4px; justify-content: flex-end; }
.wp-actions form { margin: 0; }
.wp-icon-btn { width: 34px; height: 34px; border-radius: var(--radius-sm); border: 1px solid transparent; background: transparent; color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none; transition: background-color .15s var(--ease), color .15s var(--ease); }
.wp-icon-btn:hover { background: #EFEEE8; color: var(--ink); }
.wp-icon-btn.is-danger:hover { background: var(--red-tint); color: var(--red); }

/* Pagination Laravel */
.wp-pager { padding: var(--s3) var(--s5); border-top: 1px solid var(--rule); }

/* État vide qui guide */
.wp-empty-state { padding: var(--s7) var(--s5); text-align: center; }
.wp-empty-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--saffron); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; margin-bottom: var(--s3); }
.wp-empty-state h3 { font-size: 18px; font-weight: 700; margin: 0 0 6px; }
.wp-empty-state p { color: var(--ink-3); max-width: 46ch; margin: 0 auto var(--s4); }

/* Formulaires en sections */
.wp-form { max-width: 1040px; }
.wp-form-section { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: var(--s5) var(--s6); padding: var(--s6) 0; border-top: 1px solid var(--rule); }
.wp-form-section:first-of-type { border-top: 0; padding-top: var(--s2); }
.wp-form-section > header h2 { font-size: 17px; font-weight: 700; margin: 0 0 4px; }
.wp-form-section > header p { color: var(--ink-3); font-size: 14px; margin: 0; }
.wp-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); padding: var(--s5); }
.wp-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.wp-field.is-wide { grid-column: 1 / -1; }
.wp-field > label, .wp-field > .wp-label { font-weight: 600; font-size: 14px; color: var(--ink-2); }
.wp-help { font-size: 13px; color: var(--ink-3); margin: 0; }
.wp-field-error { font-size: 13px; color: var(--red); font-weight: 600; margin: 0; }
.wp-input, .wp-select, .wp-textarea {
    width: 100%; box-sizing: border-box; min-height: 42px; padding: 0 12px;
    border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); background: var(--sheet);
    font: inherit; font-size: 15px; color: var(--ink);
}
.wp-textarea { padding: 10px 12px; min-height: 96px; resize: vertical; }
.wp-input:focus, .wp-select:focus, .wp-textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--lime-glow); }
.wp-input[aria-invalid="true"], .wp-select[aria-invalid="true"], .wp-textarea[aria-invalid="true"] { border-color: var(--red); }
.wp-affix { display: flex; align-items: stretch; }
.wp-affix .wp-input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.wp-affix > span { display: inline-flex; align-items: center; padding: 0 12px; border: 1px solid var(--rule-strong); border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: #F6F6F2; color: var(--ink-2); font-weight: 600; font-size: 14px; white-space: nowrap; }

/* Choix segmentés (radios en pilules) */
.wp-segmented { display: flex; flex-wrap: wrap; gap: 6px; }
.wp-segmented label { cursor: pointer; }
.wp-segmented input { position: absolute; opacity: 0; pointer-events: none; }
.wp-segmented span { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--rule-strong); background: var(--sheet); font-weight: 600; font-size: 14px; color: var(--ink-2); }
.wp-segmented input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--saffron); }
.wp-segmented input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 6px var(--lime-glow); }
.wp-switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.wp-switch input { width: 20px; height: 20px; accent-color: var(--ink); }
.wp-chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* Cases à cocher natives aux couleurs du monde (le plugin de formulaires Tailwind les repeint en bleu) */
body.wp input[type="checkbox"] { -webkit-appearance: auto; appearance: auto; accent-color: var(--ink); background-image: none; border-radius: 4px; }

/* Barre d'enregistrement collée en bas */
.wp-form-actions { position: sticky; bottom: 0; z-index: 5; display: flex; gap: var(--s2); justify-content: flex-end; align-items: center; padding: var(--s4) 0; margin-top: var(--s2); background: var(--paper); border-top: 1px solid var(--rule); }

/* Fiche de détail */
.wp-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); gap: 0; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; margin: 0; }
.wp-facts > div { background: var(--sheet); padding: var(--s4) var(--s5); min-width: 0; box-shadow: 1px 0 0 var(--rule), 0 1px 0 var(--rule); }
.wp-facts dt { font-size: 12.5px; font-weight: 600; color: var(--ink-3); margin-bottom: 4px; }
.wp-facts dd { margin: 0; font-weight: 600; font-size: 15.5px; overflow-wrap: anywhere; }
.wp-facts dd.is-figure { font-family: var(--font-figure); font-weight: 700; font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.wp-head-actions { display: flex; flex-wrap: wrap; gap: var(--s2); }
.wp-back { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-weight: 600; font-size: 14px; text-decoration: none; margin-bottom: var(--s2); }
.wp-back:hover { color: var(--ink); }
.mono { font-family: Consolas, "Courier New", monospace; letter-spacing: .02em; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.wp-head-row { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--s4); flex-wrap: wrap; }

/* ---------- Accès : lien d'évitement, page courante, cibles tactiles ---------- */

.wp-skip { position: absolute; left: var(--s3); top: -80px; z-index: 100; padding: 12px var(--s4); background: var(--ink); color: var(--lime); font-weight: 700; border-radius: var(--radius-sm); text-decoration: none; }
.wp-skip:focus { top: var(--s3); }
#contenu:focus { outline: none; }
.wp-rail-cta[aria-current="page"] { outline: 2px solid var(--lime); outline-offset: 3px; }

/* Doigt sur écran tactile : 44 px minimum pour tout ce qui se touche */
@media (pointer: coarse) {
    .wp-btn { min-height: 44px; }
    .wp-icon-btn { width: 44px; height: 44px; }
    .fleet-chip { min-height: 44px; padding-block: 0; }
    .wp-nav-link { min-height: 44px; }
    .wp-topbar button, .wp-topbar a.wp-topbar-icon { min-width: 44px; min-height: 44px; align-items: center; justify-content: center; }
    .wp-panel-head a, .wp-pager a { display: inline-flex; align-items: center; min-height: 44px; }
    .wp-segmented span { min-height: 44px; }
}

/* Panne nommée, collée sous le bandeau, à fond perdu comme lui */
.wp-outage { display: flex; align-items: center; gap: var(--s3); margin-inline: calc(-1 * var(--page-pad)); padding: var(--s3) var(--page-pad); background: var(--red); color: #fff; text-decoration: none; font-size: 15px; }
.wp-outage strong { font-weight: 700; }
.wp-outage-since { opacity: .9; }
.wp-outage-go { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-weight: 700; white-space: nowrap; }
.wp-outage:hover .wp-outage-go { text-decoration: underline; }
.wp-stack > .wp-band + .wp-outage { margin-top: 0; }
.wp-outage + .wp-stats { margin-top: 0; margin-inline: calc(-1 * var(--page-pad)); border-radius: 0; border-width: 0 0 1px; }
.wp-outage + .wp-stats .wp-stat { padding-inline: var(--page-pad); }

/* ---------- Pièces partagées : carte de site, carte de chaleur, barres de part ---------- */

.wp-card { display: block; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); padding: var(--s5); color: inherit; text-decoration: none; }
a.wp-card:hover { border-color: var(--ink); }
.wp-card.is-down { border-color: #E3B3A7; }
.wp-card-head { display: flex; justify-content: space-between; gap: var(--s2); align-items: flex-start; }
.wp-card-title { font-weight: 700; font-size: 16px; }
.wp-card-sub { color: var(--ink-3); font-size: 13px; }
.wp-kv { display: flex; justify-content: space-between; gap: var(--s3); font-size: 13.5px; padding: 5px 0; color: var(--ink-3); }
.wp-kv b { color: var(--ink); font-variant-numeric: tabular-nums; text-align: right; }
.wp-kv b.is-alert { color: var(--red); }
.wp-error-line { margin: var(--s2) 0 0; padding: var(--s2) var(--s3); background: var(--red-tint); color: #8E2414; border-radius: var(--radius-sm); font-size: 13px; overflow-wrap: anywhere; }

.wp-share { margin-bottom: var(--s4); }
.wp-share-head { display: flex; justify-content: space-between; gap: var(--s3); font-size: 14px; }
.wp-share-head span { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.wp-share-track { height: 10px; background: #ECEBE6; border-radius: 3px; margin-top: 6px; overflow: hidden; }
.wp-share-track span { display: block; height: 100%; background: var(--lime-deep); border-radius: 3px; transform-origin: 0 50%; }
.wp-share-track.is-ink span { background: var(--ink); }
.wp-rank { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: var(--lime); font-family: var(--font-figure); font-weight: 800; font-size: 13px; margin-right: 8px; }

.wp-heat { display: grid; grid-template-columns: 40px repeat(24, minmax(20px, 1fr)); gap: 3px; min-width: 680px; font-size: 11px; }
.wp-heat > span { height: 24px; border-radius: 4px; }
.wp-heat .wp-heat-h { height: auto; text-align: center; color: var(--ink-3); }
.wp-heat .wp-heat-d { height: auto; align-self: center; color: var(--ink-2); font-weight: 700; }

.wp-tips { list-style: none; margin: 0; padding: 0; }
.wp-tips li { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s5); border-top: 1px solid var(--rule); }
.wp-tips li:first-child { border-top: 0; }
.wp-tips .wp-tip-icon { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--saffron); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; }
.wp-tips li.is-alert .wp-tip-icon { background: var(--red-tint); color: var(--red); }

@media (max-width: 1023px) {
    .wp-form-section { grid-template-columns: minmax(0, 1fr); gap: var(--s3); padding: var(--s5) 0; }
    .wp-fields { grid-template-columns: minmax(0, 1fr); padding: var(--s4); }
    .wp-search { flex: 1; }
    .wp-search input { min-width: 0; width: 100%; }
}

/* ===== Application installable : proposition d'installation (public/js/wifipilot-application.js) ===== */
.wp-installer {
    position: fixed; z-index: 80; left: var(--s3); right: var(--s3);
    bottom: calc(var(--s3) + env(safe-area-inset-bottom));
    max-width: 520px; margin: 0 auto;
    display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: var(--s3) var(--s4); align-items: center;
    background: var(--ink); color: #fff; border-radius: var(--radius); padding: var(--s4);
    box-shadow: 0 18px 40px rgba(0, 0, 0, .35);
    animation: wp-installer-in .32s cubic-bezier(.2, .8, .2, 1) both;
}
.wp-installer img { border-radius: 10px; }
.wp-installer p { margin: 0; font-size: 15px; line-height: 1.4; color: rgba(255, 255, 255, .86); }
.wp-installer p b { color: #fff; }
.wp-installer-actions { grid-column: 1 / -1; display: flex; gap: var(--s3); justify-content: flex-end; align-items: center; }
.wp-installer-actions .wp-btn { min-height: 44px; }
.wp-installer-plus-tard {
    background: none; border: 0; color: rgba(255, 255, 255, .7); font: inherit; font-size: 15px;
    min-height: 44px; padding: 0 var(--s3); cursor: pointer;
}
.wp-installer-plus-tard:hover { color: #fff; }
@keyframes wp-installer-in { from { opacity: 0; transform: translateY(16px); } }
@media (prefers-reduced-motion: reduce) { .wp-installer { animation: none; } }
/* Application installée : la barre du haut respecte l'encoche du téléphone. */
.wp-installee body { padding-top: env(safe-area-inset-top); }

/* ===== Barre d'onglets du bas (téléphone) : navigation d'application ===== */
.wp-tabbar { display: none; }
@media (max-width: 767px) {
    .wp-tabbar {
        position: fixed; z-index: 22; left: 0; right: 0; bottom: 0;
        display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
        background: var(--ink); border-top: 1px solid #222;
        padding-bottom: env(safe-area-inset-bottom);
    }
    .wp-tabbar a, .wp-tabbar button {
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
        min-height: 62px; padding: 6px 2px; background: none; border: 0; cursor: pointer;
        color: rgba(255, 255, 255, .62); text-decoration: none; font: inherit; font-size: 12px; font-weight: 600;
        -webkit-tap-highlight-color: transparent; position: relative;
    }
    .wp-tabbar [aria-current="page"] { color: var(--lime); }
    .wp-tabbar [aria-current="page"]::before {
        content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--lime);
    }
    .wp-tabbar a:active, .wp-tabbar button:active { background: rgba(255, 255, 255, .06); }
    /* Le contenu et la proposition d'installation passent au-dessus de la barre. */
    .wp-main { padding-bottom: calc(62px + env(safe-area-inset-bottom)); }
    .wp-installer { bottom: calc(74px + env(safe-area-inset-bottom)); }
}
@media print { .wp-tabbar { display: none !important; } }
