/* ==========================================================================
   OmSmK — système de design
   ========================================================================== */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('../vendor/fonts/inter-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('../vendor/fonts/inter-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --surface-3: #eef1f5;
  --border: #e4e8ee;
  --border-strong: #cdd4de;
  --text: #101828;
  --text-2: #475467;
  --text-3: #667085;
  --brand: #12335c;
  --brand-2: #1d4f8f;
  --brand-soft: #e9eff8;
  --accent: #e8590c;
  --accent-soft: #fff1e6;
  --focus: #84adff;
  --pos: #067647; --pos-soft: #ecfdf3; --pos-line: #abefc6;
  --neg: #b42318; --neg-soft: #fef3f2; --neg-line: #fecdca;
  --warn: #b54708; --warn-soft: #fffaeb; --warn-line: #fedf89;
  --info: #175cd3; --info-soft: #eff8ff; --info-line: #b2ddff;
  /* Données (palette validée CVD, voir README) */
  --serie-1: #2a78d6;
  --serie-2: #eb6834;
  --div-pos: #2a78d6;
  --div-neg: #e34948;
  --grid: #eceff3;
  --status-good: #0ca30c; --status-warning: #fab219; --status-serious: #ec835a; --status-critical: #d03b3b;
  /* Barre latérale */
  --side-bg: #0e2340;
  --side-bg-2: #13305a;
  --side-text: #c3cfe0;
  --side-text-strong: #ffffff;
  --side-border: rgba(255, 255, 255, .08);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 20px 40px -12px rgba(16, 24, 40, .28);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --side-w: 252px;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #0b0f15; --surface: #131922; --surface-2: #18202b; --surface-3: #1f2834;
    --border: #263040; --border-strong: #354255;
    --text: #e8edf3; --text-2: #b4bfcc; --text-3: #8b97a7;
    --brand: #3b78d8; --brand-2: #5a91e6; --brand-soft: #182a44;
    --accent: #f07a35; --accent-soft: #3a2316;
    --pos: #47cd89; --pos-soft: #0f2a1d; --pos-line: #1f5138;
    --neg: #f97066; --neg-soft: #33171a; --neg-line: #5c2428;
    --warn: #fdb022; --warn-soft: #2f2410; --warn-line: #5a4416;
    --info: #53b1fd; --info-soft: #102539; --info-line: #1d4a75;
    --serie-1: #3987e5; --serie-2: #d95926; --div-pos: #3987e5; --div-neg: #e66767; --grid: #222b37;
    --side-bg: #0a1220; --side-bg-2: #111c30;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0f15; --surface: #131922; --surface-2: #18202b; --surface-3: #1f2834;
  --border: #263040; --border-strong: #354255;
  --text: #e8edf3; --text-2: #b4bfcc; --text-3: #8b97a7;
  --brand: #3b78d8; --brand-2: #5a91e6; --brand-soft: #182a44;
  --accent: #f07a35; --accent-soft: #3a2316;
  --pos: #47cd89; --pos-soft: #0f2a1d; --pos-line: #1f5138;
  --neg: #f97066; --neg-soft: #33171a; --neg-line: #5c2428;
  --warn: #fdb022; --warn-soft: #2f2410; --warn-line: #5a4416;
  --info: #53b1fd; --info-soft: #102539; --info-line: #1d4a75;
  --serie-1: #3987e5; --serie-2: #d95926; --div-pos: #3987e5; --div-neg: #e66767; --grid: #222b37;
  --side-bg: #0a1220; --side-bg-2: #111c30;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  font-feature-settings: 'cv11', 'ss01';
}
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
h4 { font-size: 13px; }
p { margin: 0; }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-size: 12px; background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }
.ico { width: 18px; height: 18px; flex-shrink: 0; stroke-width: 1.9; vertical-align: middle; }
.ico.sm { width: 15px; height: 15px; }
.ico.lg { width: 22px; height: 22px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.hidden { display: none !important; }
.num, .tnum { font-variant-numeric: tabular-nums; }

/* ============================== Coquille =============================== */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40; height: 62px; display: flex; align-items: center; gap: 14px;
  padding: 0 24px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 9px; border: 0; background: none; cursor: pointer; padding: 4px; border-radius: 10px; color: var(--text); }
.logo-mark {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 800; font-size: 12.5px; letter-spacing: .02em;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.15); flex-shrink: 0;
}
.logo-text { font-weight: 750; font-size: 16.5px; letter-spacing: -.01em; }
.chantier-switch {
  display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; max-width: 260px; min-width: 0;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; font-weight: 600;
}
.chantier-switch:hover { border-color: var(--border-strong); }
.chantier-switch .ico { color: var(--text-3); flex-shrink: 0; }
.chantier-switch .cs-nom { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.espaces { display: flex; gap: 2px; margin: 0 auto; }
.esp { position: relative; border: 0; background: none; height: 38px; padding: 0 14px; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; gap: 7px; }
.esp:hover { background: var(--surface-3); color: var(--text); }
.esp.on { color: var(--brand-2); background: var(--brand-soft); }
.pastille { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; line-height: 1; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.avatar-btn { border: 0; background: none; padding: 2px; border-radius: 50%; cursor: pointer; }
.avatar-btn:hover .avatar { box-shadow: 0 0 0 3px var(--brand-soft); }
.sync-pill {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 11px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 12.5px; font-weight: 550; cursor: pointer;
}
.sync-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.sync-pill.ok .dot { background: var(--status-good); }
.sync-pill.encours .dot { background: var(--info); animation: pulse 1s infinite; }
.sync-pill.erreur { border-color: var(--neg-line); color: var(--neg); }
.sync-pill.erreur .dot { background: var(--status-critical); }
.sync-pill.horsligne .dot { background: var(--status-warning); }
@keyframes pulse { 50% { opacity: .35; } }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #2b4c7e; color: #fff; font-weight: 650; font-size: 12px; flex-shrink: 0; }

/* Onglets de l'espace */
.subnav { position: sticky; top: 62px; z-index: 35; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.subnav-in { max-width: 1240px; margin: 0 auto; padding: 0 24px; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.subnav-in::-webkit-scrollbar { display: none; }
.subnav button { flex-shrink: 0; border: 0; background: none; height: 44px; padding: 0 12px; display: inline-flex; align-items: center; gap: 7px; font-weight: 550; font-size: 13.5px; color: var(--text-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subnav button:hover { color: var(--text); }
.subnav button.on { color: var(--text); border-bottom-color: var(--accent); }

.content { padding: 28px 24px 64px; max-width: 1240px; width: 100%; margin: 0 auto; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .ph-txt { min-width: 0; }
.page-head .eyebrow { font-size: 12px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 4px; }
.page-head h1 { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.page-head .sub { color: var(--text-3); margin-top: 6px; display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.page-head .sub span { display: inline-flex; align-items: center; gap: 5px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.bottom-nav { display: none; }

@media (max-width: 1100px) { .esp { padding: 0 10px; } .sync-pill .lbl { display: none; } }
@media (max-width: 960px) {
  .espaces, .top-actions .creer-btn, #themeBtn { display: none; }
  .topbar { padding: 0 12px; gap: 8px; }
  .logo-text { display: none; }
  .chantier-switch { flex: 1; max-width: none; }
  .subnav { top: 62px; }
  .subnav-in { padding: 0 8px; }
  .content { padding: 18px 14px 104px; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    background: var(--surface); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav button { position: relative; border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; color: var(--text-3); font-size: 10.5px; font-weight: 550; cursor: pointer; }
  .bottom-nav button.active { color: var(--brand-2); }
  .bottom-nav .bn-creer { width: 52px; height: 52px; border-radius: 16px; margin: -18px auto 0; background: var(--accent); color: #fff; justify-content: center; box-shadow: 0 6px 18px rgba(232, 89, 12, .35); }
  .bottom-nav .bn-creer .ico { width: 24px; height: 24px; }
  .bn-dot { position: absolute; top: 2px; left: calc(50% + 8px); width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
  .page-head h1 { font-size: 21px; }
}
/* Téléphone : boutons d'en-tête sur une seule ligne qui défile (l'action principale en premier),
   indicateurs resserrés pour garder la saisie visible sans faire défiler */
@media (max-width: 760px) {
  .page-head { margin-bottom: 16px; gap: 12px; }
  .page-actions { flex-wrap: nowrap; overflow-x: auto; width: calc(100% + 28px); margin: 0 -14px; padding: 2px 14px 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .page-actions::-webkit-scrollbar { display: none; }
  .page-actions > * { flex-shrink: 0; }
  .page-actions > .btn.primary, .page-actions > .btn.accent { order: -1; }
  .kpis { gap: 10px; }
  .kpis .kpi { padding: 12px 14px; }
  .kpis .kpi-lbl { font-size: 12.5px; }
  .kpis .kpi-ico { width: 28px; height: 28px; }
  .kpis .kpi-val { font-size: 22px; margin-top: 6px; }
  .kpis .kpi-val small { font-size: 13px; }
  .kpis .kpi-sub { font-size: 12px; margin-top: 4px; }
}

/* =============================== Tuiles ================================ */
.tuiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.tuile {
  position: relative; display: flex; flex-direction: column; gap: 4px; padding: 20px; border-radius: var(--radius-lg); cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-xs); transition: box-shadow .15s, transform .15s, border-color .15s; min-height: 176px;
}
.tuile:hover { box-shadow: var(--shadow-md, 0 8px 24px rgba(16,24,40,.08)); transform: translateY(-2px); border-color: var(--border-strong); }
.tuile:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.tuile.alerte { border-color: var(--warn-line); box-shadow: inset 3px 0 0 var(--accent), var(--shadow-xs); }
.t-haut { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.t-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-2); flex-shrink: 0; }
.tuile.alerte .t-ico { background: var(--accent-soft); color: var(--accent); }
.t-fleche { margin-left: auto; color: var(--text-3); opacity: 0; transition: opacity .15s, transform .15s; }
.tuile:hover .t-fleche { opacity: 1; transform: translateX(2px); }
.t-titre { font-size: 13px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.t-val { font-size: 24px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.t-sous { font-size: 13px; color: var(--text-2); }
.t-action { margin-top: auto; align-self: flex-start; position: relative; top: 8px; }
.resume { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.resume > div { background: var(--surface); padding: 18px 20px; display: grid; gap: 6px; align-content: start; }
.resume span { font-size: 12.5px; color: var(--text-3); font-weight: 550; }
.resume b { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.resume small { font-size: 12.5px; color: var(--text-3); }
.section-titre { font-size: 13px; font-weight: 650; color: var(--text-2); margin: 6px 0 10px; text-transform: uppercase; letter-spacing: .05em; }
.calme { display: flex; align-items: center; gap: 10px; color: var(--text-3); padding: 16px 18px; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); }
.calme .ico { color: var(--pos); }
.liens-discrets { gap: 4px; }
@media (max-width: 760px) {
  .resume > div { padding: 12px; gap: 4px; }
  .resume b { font-size: 19px; }
  .resume span { font-size: 11.5px; }
  .resume small { display: none; }
  .tuiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tuile { padding: 14px; min-height: 0; }
  .t-ico { width: 34px; height: 34px; border-radius: 10px; }
  .t-val { font-size: 19px; }
  .t-sous { font-size: 12px; }
  .t-action { top: 4px; margin-top: 8px; }
}

/* ======================= Menu, création, recherche ===================== */
.menu-espaces { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
.menu-esp-t { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin-bottom: 6px; }
.menu-lien { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; color: var(--text); font: inherit; text-align: left; }
.menu-lien:hover { background: var(--surface-3); }
.menu-lien:disabled { opacity: .45; cursor: default; }
.menu-lien .ico { color: var(--text-3); }
.pop-user { padding-bottom: 6px; }
.pop-user .menu-lien { padding: 9px 14px; border-radius: 0; }
.creer-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.creer-item { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; text-align: left; color: var(--text); font: inherit; }
.creer-item:hover { border-color: var(--border-strong); background: var(--surface-2); }
.creer-item b { display: block; font-size: 14px; }
.creer-item small { display: block; color: var(--text-3); font-size: 12px; }
.rc-liste { margin-top: 10px; display: grid; gap: 2px; max-height: 52vh; overflow-y: auto; }
.rc-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 0; background: none; border-radius: 9px; cursor: pointer; text-align: left; color: var(--text); font: inherit; }
.rc-item .ico { color: var(--text-3); flex-shrink: 0; }
.rc-item b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-item small { display: block; color: var(--text-3); font-size: 12px; }
.rc-item:hover, .rc-item.on { background: var(--surface-3); }

/* ============================== Composants ============================= */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-head .hint { color: var(--text-3); font-size: 12.5px; font-weight: 400; }
.card-body { padding: 18px 20px; }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .g-main, .g-3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) { .g-2 { grid-template-columns: minmax(0, 1fr); } }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.xs { font-size: 11.5px; }
.strong { font-weight: 600; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.sep { height: 1px; background: var(--border); margin: 16px 0; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-xs);
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.danger { color: var(--neg); border-color: var(--neg-line); }
.btn.danger:hover { background: var(--neg-soft); }
.btn.danger-fill { background: #d92d20; border-color: #d92d20; color: #fff; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn.lg { height: 44px; padding: 0 18px; font-size: 15px; }
.btn.block { width: 100%; }
.btn.icon { width: 36px; padding: 0; }
.btn.icon.sm { width: 30px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: 8px 0 0 8px; margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 8px 8px 0; }

/* Contrôle segmenté */
.seg { display: inline-flex; padding: 3px; background: var(--surface-3); border-radius: 9px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 7px; font-weight: 550; font-size: 13px; color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg .n { font-size: 11px; background: var(--surface-3); border-radius: 999px; padding: 0 6px; color: var(--text-2); }
.seg button.on .n { background: var(--brand-soft); color: var(--brand-2); }

/* Formulaires */
.field { margin-bottom: 14px; }
.label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); transition: border-color .12s, box-shadow .12s;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; min-height: 84px; line-height: 1.5; }
.input:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-2) 22%, transparent); }
.input::placeholder { color: var(--text-3); }
.input-icon { position: relative; }
.input-icon .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.input-icon .input { padding-left: 36px; }
.input.cell { height: 32px; padding: 0 8px; box-shadow: none; border-color: transparent; background: transparent; text-align: right; width: 92px; }
.input.cell:hover { border-color: var(--border-strong); background: var(--surface); }
.input.cell:focus { background: var(--surface); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
@media (max-width: 560px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.form-section { font-size: 11.5px; font-weight: 650; color: var(--text-3); text-transform: uppercase; letter-spacing: .07em; margin: 6px 0 10px; }
.checkbox { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.checkbox input { appearance: none; width: 20px; height: 20px; margin: 1px 0 0; border: 1.5px solid var(--border-strong); border-radius: 6px; background: var(--surface); flex-shrink: 0; cursor: pointer; display: grid; place-items: center; transition: background .12s, border-color .12s; }
.checkbox input:checked { background: var(--pos); border-color: var(--pos); }
.checkbox input:checked::after { content: ''; width: 10px; height: 6px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.checkbox.lg input { width: 26px; height: 26px; border-radius: 7px; }
.checkbox.lg input:checked::after { width: 12px; height: 7px; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap; border: 1px solid transparent; }
.badge .ico { width: 13px; height: 13px; }
.badge.pos { background: var(--pos-soft); color: var(--pos); border-color: var(--pos-line); }
.badge.neg { background: var(--neg-soft); color: var(--neg); border-color: var(--neg-line); }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.badge.info { background: var(--info-soft); color: var(--info); border-color: var(--info-line); }
.badge.brand { background: var(--brand-soft); color: var(--brand-2); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { padding: 16px 18px; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-lbl { font-size: 13px; color: var(--text-2); font-weight: 550; }
.kpi-ico { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-2); }
.kpi-val { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin-top: 8px; line-height: 1.1; }
.kpi-val small { font-size: 15px; font-weight: 600; color: var(--text-3); margin-left: 2px; }
.kpi-sub { margin-top: 6px; font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; font-size: 12px; padding: 1px 6px; border-radius: 6px; }
.delta.pos { background: var(--pos-soft); color: var(--pos); }
.delta.neg { background: var(--neg-soft); color: var(--neg); }
.delta.neutre { background: var(--surface-3); color: var(--text-2); }
.mini-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mini-stats > div { padding: 14px 18px; border-right: 1px solid var(--border); }
.mini-stats > div:last-child { border-right: 0; }
@media (max-width: 760px) { .mini-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .mini-stats > div:nth-child(2) { border-right: 0; } .mini-stats > div:nth-child(-n+2) { border-bottom: 1px solid var(--border); } }
.mini-stats .ms-lbl { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.mini-stats .ms-val { font-size: 18px; font-weight: 650; margin-top: 2px; }

/* Barres de progression */
.progress { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--brand-2); border-radius: 999px; }
.progress.pos > i { background: var(--status-good); }
.progress.lg { height: 8px; }

/* Tableaux */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--text-3); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover td { background: var(--surface-2); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tr.group td { background: var(--surface-2); font-weight: 650; color: var(--text); font-size: 12.5px; padding-top: 9px; padding-bottom: 9px; }
.table tr.total td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border-strong); border-bottom: 0; }
.table tr:last-child td { border-bottom: 0; }
.table .actions { white-space: nowrap; text-align: right; width: 1%; }
.table .sub { font-size: 12px; color: var(--text-3); }
.row-link { cursor: pointer; }

/* Matrice zones x tâches */
.matrix th.rot { writing-mode: vertical-rl; transform: rotate(180deg); text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 550; padding: 10px 6px; height: 150px; vertical-align: bottom; }
.matrix td.cell { text-align: center; cursor: pointer; padding: 6px; }
.matrix td.cell .c { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; background: var(--surface-3); color: transparent; }
.matrix td.cell.on .c { background: var(--pos); color: #fff; }
.matrix td.cell:hover .c { box-shadow: 0 0 0 2px var(--focus); }
.matrix td.na { background: repeating-linear-gradient(45deg, transparent, transparent 4px, var(--surface-3) 4px, var(--surface-3) 5px); }
.matrix td.zone { position: sticky; left: 0; background: var(--surface); font-weight: 600; white-space: nowrap; z-index: 1; }

/* État vide */
.empty { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty .e-ico { width: 52px; height: 52px; border-radius: 14px; display: inline-grid; place-items: center; background: var(--brand-soft); color: var(--brand-2); margin-bottom: 14px; }
.empty h3 { color: var(--text); margin-bottom: 6px; }
.empty p { max-width: 460px; margin: 0 auto 16px; }

/* Alertes */
.alert { display: flex; gap: 12px; padding: 12px 14px; border-radius: 10px; border: 1px solid; font-size: 13.5px; align-items: flex-start; }
.alert .ico { margin-top: 1px; }
.alert.info { background: var(--info-soft); border-color: var(--info-line); color: var(--text); }
.alert.info .ico { color: var(--info); }
.alert.warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--text); }
.alert.warn .ico { color: var(--warn); }
.alert.neg { background: var(--neg-soft); border-color: var(--neg-line); color: var(--text); }
.alert.neg .ico { color: var(--neg); }
.attention-list { list-style: none; margin: 0; padding: 0; }
.attention-list li { display: flex; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.attention-list li:last-child { border-bottom: 0; }
.sev { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; }
.sev.critical { background: var(--neg-soft); color: var(--status-critical); }
.sev.serious { background: var(--warn-soft); color: var(--status-serious); }
.sev.warning { background: var(--warn-soft); color: var(--warn); }
.sev.good { background: var(--pos-soft); color: var(--status-good); }

/* Liste de phases */
.phase { display: grid; grid-template-columns: minmax(0, 1fr) 76px; gap: 6px 14px; padding: 12px 20px; border-bottom: 1px solid var(--border); align-items: center; }
.phase:last-child { border-bottom: 0; }
.phase .p-nom { font-weight: 600; }
.phase .p-meta { font-size: 12px; color: var(--text-3); grid-column: 1 / 2; }
.phase .p-val { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; grid-row: 1 / 3; grid-column: 2; }
.phase .p-val small { display: block; font-size: 11.5px; font-weight: 500; color: var(--text-3); }
.phase .progress { grid-column: 1 / 2; }

/* Fil d'activité */
.feed { list-style: none; margin: 0; padding: 4px 0; }
.feed li { display: flex; gap: 12px; padding: 10px 20px; }
.feed .f-ico { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); flex-shrink: 0; }
.feed .f-ico.pos { background: var(--pos-soft); color: var(--pos); }
.feed .f-ico.warn { background: var(--warn-soft); color: var(--warn); }
.feed .f-ico.info { background: var(--info-soft); color: var(--info); }
.feed .f-txt { min-width: 0; }
.feed .f-txt b { font-weight: 600; }
.feed .f-date { font-size: 12px; color: var(--text-3); }

/* Liste de définitions */
.dl { display: grid; grid-template-columns: auto 1fr; gap: 9px 16px; font-size: 13.5px; }
.dl dt { color: var(--text-3); }
.dl dd { margin: 0; font-weight: 550; text-align: right; }

/* Terrain */
.zone-bar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.zone-pick { text-align: left; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; display: flex; align-items: center; gap: 12px; min-width: 0; box-shadow: var(--shadow-xs); }
.zone-pick:hover { border-color: var(--brand-2); }
.zone-pick .zp-txt { flex: 1; min-width: 0; }
.zone-pick .zp-lbl { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); font-weight: 600; }
.zone-pick .zp-nom { display: block; font-weight: 650; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ring { --p: 0; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: conic-gradient(var(--status-good) calc(var(--p) * 1%), var(--surface-3) 0); }
.ring span { width: 36px; height: 36px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 11.5px; font-weight: 700; }
.tasks { display: grid; gap: 0; }
.task { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(160px, 38%) auto; gap: 12px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.task:last-child { border-bottom: 0; }
.task.done { background: color-mix(in srgb, var(--pos-soft) 55%, transparent); }
.task .t-nom { font-weight: 550; }
.task.done .t-nom { color: var(--text-2); }
.task .t-meta { font-size: 12px; color: var(--text-3); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 2px; }
.task .input { height: 34px; }
@media (max-width: 720px) { .task { grid-template-columns: auto minmax(0, 1fr) auto; } .task .t-obs { grid-column: 2 / 4; } }
.zone-list { display: grid; gap: 6px; max-height: 60vh; overflow-y: auto; margin-top: 12px; }
.zone-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; text-align: left; width: 100%; }
.zone-item:hover { border-color: var(--brand-2); }
.zone-item.active { border-color: var(--brand-2); background: var(--brand-soft); }
.zone-item .zi-nom { flex: 1; font-weight: 600; }
.zone-item .progress { width: 80px; }

/* Journal (chronologie) */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; margin-bottom: 14px; }
.tl-item::before { content: ''; position: absolute; left: -20px; top: 18px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand-2); }
.tl-item.intemp::before { border-color: var(--status-warning); background: var(--warn-soft); }
.tl-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; }
.tl-date { font-weight: 650; }
.tl-body { margin-top: 8px; white-space: pre-wrap; color: var(--text-2); }

/* Réserves */
.res-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.res-item:last-child { border-bottom: 0; }
.res-item .r-desc { font-weight: 550; }
.r-meta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 4px; font-size: 12.5px; color: var(--text-3); }
.r-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.res-num { font-size: 11.5px; font-weight: 700; color: var(--text-3); background: var(--surface-3); border-radius: 6px; padding: 3px 7px; font-variant-numeric: tabular-nums; }

/* Check-lists */
.cl-sec { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.cl-sec:last-child { border-bottom: 0; }
.cl-sec-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.cl-sec-head h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); }
.cl-sec-head .progress { width: 120px; }
.cl-item { padding: 8px 0; }
.cl-item .cl-meta { font-size: 12px; color: var(--text-3); margin: 2px 0 0 30px; }
.cl-item.done span.txt { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--border-strong); }

/* Portefeuille */
.projets { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 16px; }
.projet { padding: 18px; display: flex; flex-direction: column; gap: 14px; cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.projet:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.projet.actif { border-color: var(--brand-2); box-shadow: 0 0 0 1px var(--brand-2); }
.projet-head { display: flex; gap: 12px; align-items: flex-start; }
.projet-ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-2); flex-shrink: 0; }
.projet h3 { font-size: 15.5px; }
.projet .p-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.projet .p-kpis div { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; }
.projet .p-kpis .l { font-size: 11px; color: var(--text-3); }
.projet .p-kpis .v { font-weight: 650; font-variant-numeric: tabular-nums; }

/* Paramètres */
.settings-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; }
@media (max-width: 860px) { .settings-grid { grid-template-columns: minmax(0, 1fr); } }
.set-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 80px; align-self: start; }
.set-nav button { border: 0; background: none; text-align: left; padding: 8px 12px; border-radius: 8px; cursor: pointer; color: var(--text-2); font-weight: 550; display: flex; gap: 10px; align-items: center; }
.set-nav button:hover { background: var(--surface-3); }
.set-nav button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
@media (max-width: 860px) { .set-nav { position: static; flex-direction: row; overflow-x: auto; } .set-nav button { white-space: nowrap; } }
.set-row { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.set-row:last-child { border-bottom: 0; }
.set-row .s-txt { max-width: 560px; }
.set-row .s-txt b { display: block; font-weight: 600; }
.set-row .s-txt span { color: var(--text-3); font-size: 13px; }

/* Graphiques */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--font); }
.chart .ax { fill: var(--text-3); font-size: 11px; }
.chart .lbl { fill: var(--text-2); font-size: 11.5px; font-weight: 600; }
.chart .grid-l { stroke: var(--grid); stroke-width: 1; }
.chart .base-l { stroke: var(--border-strong); stroke-width: 1; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 16px; height: 3px; border-radius: 2px; display: inline-block; }
.legend i.dash { background: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 7px) !important; height: 2px; }
.legend i.sq { width: 10px; height: 10px; border-radius: 3px; }
.viz-tip {
  position: fixed; z-index: 300; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); border-radius: 10px; padding: 9px 12px; font-size: 12.5px; min-width: 150px; opacity: 0; transition: opacity .1s;
}
.viz-tip.show { opacity: 1; }
.viz-tip .t-h { font-weight: 650; margin-bottom: 5px; }
.viz-tip .t-r { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.viz-tip .t-r span { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.viz-tip .t-r b { font-variant-numeric: tabular-nums; }
.viz-tip i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }

/* Modales */
.modal-back { position: fixed; inset: 0; background: rgba(10, 18, 32, .55); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .15s ease-out; }
.modal { background: var(--surface); width: 100%; max-width: 560px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; border-radius: 16px; box-shadow: var(--shadow-lg); animation: up .18s ease-out; }
.modal.wide { max-width: 920px; }
.modal.narrow { max-width: 420px; }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 22px 0; }
.modal-head .m-ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-2); flex-shrink: 0; }
.modal-head .m-ico.danger { background: var(--neg-soft); color: var(--neg); }
.modal-head .m-titre { flex: 1; min-width: 0; padding-top: 2px; }
.modal-head .m-titre p { color: var(--text-3); font-size: 13px; margin-top: 3px; }
.modal-body { padding: 18px 22px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 16px 16px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(10px) scale(.98); opacity: 0; } }
@media (max-width: 640px) {
  .modal-back { align-items: flex-end; padding: 0; }
  .modal { border-radius: 18px 18px 0 0; max-height: 92vh; }
  .modal-foot { border-radius: 0; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
}

/* Menu déroulant */
.popover { position: fixed; z-index: 150; width: 320px; max-height: 70vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); color: var(--text); overflow: hidden; }
.popover .pop-search { padding: 10px; border-bottom: 1px solid var(--border); }
.popover .pop-list { overflow-y: auto; padding: 6px; }
.popover .pop-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; }
.popover .pop-item:hover { background: var(--surface-3); }
.popover .pop-item.on { background: var(--brand-soft); }
.popover .pop-item .pi-txt { flex: 1; min-width: 0; }
.popover .pop-item .pi-nom { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.popover .pop-item .pi-sub { display: block; font-size: 12px; color: var(--text-3); }
.popover .pop-foot { border-top: 1px solid var(--border); padding: 6px; }

/* Notifications */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 400; display: grid; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 420px; padding: 12px 14px; border-radius: 10px; background: #101828; color: #fff; box-shadow: var(--shadow-lg); font-size: 13.5px; font-weight: 500; animation: up .18s ease-out; }
.toast .ico { color: #98a2b3; }
.toast.succes .ico { color: #47cd89; }
.toast.erreur .ico { color: #f97066; }
.toast.alerte .ico { color: #fdb022; }
@media (max-width: 1023px) { .toasts { left: 14px; right: 14px; bottom: 84px; } .toast { max-width: none; } }

/* Écran d'accueil */
.welcome { min-height: calc(100vh - 160px); display: grid; place-items: center; }
.welcome-card { max-width: 760px; width: 100%; padding: 36px; }
.welcome-card h1 { font-size: 28px; letter-spacing: -.02em; }
.welcome-card .lead { color: var(--text-2); font-size: 15px; margin-top: 10px; max-width: 580px; }
.welcome-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 26px; }
@media (max-width: 760px) { .welcome-actions { grid-template-columns: 1fr; } }
.w-action { text-align: left; padding: 18px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; display: flex; flex-direction: column; gap: 8px; transition: border-color .12s, box-shadow .12s; }
.w-action:hover { border-color: var(--brand-2); box-shadow: var(--shadow-sm); }
.w-action .w-ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-2); }
.w-action b { font-weight: 650; }
.w-action span { font-size: 13px; color: var(--text-3); }
.features { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 24px; margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--border); }
.features div { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--text-2); }
.features .ico { color: var(--pos); margin-top: 1px; }
@media (max-width: 560px) { .features { grid-template-columns: 1fr; } }

/* QR */
#qrVideo { width: 100%; border-radius: 12px; background: #000; aspect-ratio: 1; object-fit: cover; }
.qr-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.qr-label { border: 1px solid var(--border); border-radius: 10px; padding: 12px; text-align: center; break-inside: avoid; background: #fff; color: #101828; }
.qr-label .qr-box { display: flex; justify-content: center; margin: 8px 0; }
.qr-label .qr-box img, .qr-label .qr-box canvas { width: 120px !important; height: 120px !important; }
.qr-label .z { font-weight: 700; font-size: 15px; }
.qr-label .c { font-size: 11px; color: #667085; }
.qr-label .brand { font-size: 10px; font-weight: 700; color: #e8590c; letter-spacing: .06em; }

@media print {
  body * { visibility: hidden; }
  #printArea, #printArea * { visibility: visible; }
  #printArea { display: block !important; position: absolute; left: 0; top: 0; width: 100%; }
  .qr-sheet { grid-template-columns: repeat(4, 1fr); }
  .qr-label { border: 1px dashed #98a2b3; }
}

/* ------------------------------ Pointage ------------------------------- */
.pt-list { border-top: 1px solid var(--border); }
.pt-row { display: grid; grid-template-columns: minmax(170px, 1.3fr) 150px 84px minmax(180px, 2fr) 84px 76px 40px; gap: 12px; align-items: center; padding: 10px 20px; border-bottom: 1px solid var(--border); }
.pt-row > .num { text-align: right; }
.pt-head { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); background: var(--surface-2); padding-top: 8px; padding-bottom: 8px; }
.pt-total { font-weight: 650; background: var(--surface-2); }
.pt-vide { background: repeating-linear-gradient(135deg, transparent, transparent 8px, var(--surface-2) 8px, var(--surface-2) 9px); }
.pt-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pt-who .sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-statut, .pt-phase { height: 36px; width: 100%; }
.pt-statut.st-present { border-color: var(--pos-line); background: var(--pos-soft); color: var(--pos); font-weight: 600; }
.pt-statut.st-intemperie { border-color: var(--info-line); background: var(--info-soft); color: var(--info); font-weight: 600; }
.pt-statut.st-maladie, .pt-statut.st-absent { border-color: var(--warn-line); background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.pt-statut.st-conge, .pt-statut.st-formation { background: var(--brand-soft); color: var(--brand-2); font-weight: 600; }
.input.cell.pt-num { width: 76px; border-color: var(--border-strong); background: var(--surface); }
.pt-multi { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; justify-content: flex-start; }
.pt-act { text-align: right; }
.pt-lbl-m { display: none; }
.pt-row .checkbox { margin: 0; }
.pt-grille td.pt-cel { cursor: pointer; }
.pt-grille td.pt-cel:hover { background: var(--surface-2); }
.pt-grille .pt-auj { background: var(--brand-soft); }
.pt-equipe { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.pt-equipe .res-item { align-items: center; padding: 10px 14px; }
.pt-equipe .res-item:last-child { border-bottom: 0; }
.pt-inactif { opacity: .6; }
@media (max-width: 900px) {
  .pt-head { display: none; }
  .pt-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "who st" "ph ph" "h it" "pan act"; gap: 8px 12px; padding: 12px 16px; }
  .pt-row > :nth-child(1) { grid-area: who; } .pt-row > :nth-child(2) { grid-area: st; } .pt-row > :nth-child(3) { grid-area: h; }
  .pt-row > :nth-child(4) { grid-area: ph; } .pt-row > :nth-child(5) { grid-area: it; } .pt-row > :nth-child(6) { grid-area: pan; } .pt-row > :nth-child(7) { grid-area: act; }
  .pt-row > .num { text-align: left; display: flex; align-items: center; gap: 8px; }
  .pt-row > .num:empty, .pt-row > .pt-ph:empty, .pt-row > div:empty { display: none; }
  .pt-lbl-m { display: inline; font-size: 12px; color: var(--text-3); }
  .pt-total { grid-template-areas: "who h"; }
  .pt-total > :nth-child(n+2):not(:nth-child(3)) { display: none; }
}
.pt-who > div { min-width: 0; }
.pt-outils { flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 900px) { .pt-outils { justify-content: flex-start; } .pt-outils select { flex: 1 1 100%; max-width: none !important; } }

/* ---------------------------- Actions ----------------------------------- */
.act-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.act-item:last-child { border-bottom: 0; }
.act-item .act-lib { font-weight: 550; overflow-wrap: anywhere; }
.act-item.fait .act-lib { text-decoration: line-through; color: var(--text-3); }
.act-item .r-meta { margin-top: 4px; }
.act-rapide { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; border-bottom: 1px solid var(--border); }
.act-rapide .grow { flex: 1 1 220px; min-width: 0; }
.act-rapide .input { height: 38px; }
@media (max-width: 760px) { .act-rapide > .input { max-width: none !important; flex: 1 1 100%; } .act-rapide > .btn { flex: 1 1 auto; justify-content: center; } }

/* ---------------------------- Annuaire ---------------------------------- */
.contacts { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.contact { display: flex; gap: 12px; align-items: flex-start; padding: 14px 20px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); }
.contact-liens { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.contact-liens .btn { max-width: 100%; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
@media (max-width: 760px) { .contacts { grid-template-columns: minmax(0, 1fr); } .contact { border-right: 0; } }

/* ------------------------- Réunions et CR ------------------------------- */
.reu-item { cursor: pointer; align-items: center; }
.reu-item:hover { background: var(--surface-2); }
.reu-point { padding: 14px 20px; border-bottom: 1px solid var(--border); display: grid; gap: 8px; }
.reu-point textarea { resize: vertical; min-height: 70px; }
.reu-infos { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .reu-infos { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ----------------------------- Sécurité --------------------------------- */
.choix-k { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px 16px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 14px; }
.visite-grille { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 14px; }
.visite-ligne { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.visite-ligne:last-child { border-bottom: 0; }
.seg-sm label { padding: 4px 10px; border-radius: 7px; font-size: 12px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.seg-sm input { position: absolute; opacity: 0; pointer-events: none; }
.seg-sm label.on { background: var(--surface); box-shadow: var(--shadow-sm); color: var(--text); }
.seg-sm label.on.c { color: var(--pos); }
.seg-sm label.on.nc { color: var(--neg); background: var(--neg-soft); }
.seg-scroll { max-width: 100%; }

/* ------------------------------ Photos ---------------------------------- */
.ph-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-top: 10px; }
.ph-grille.petit { grid-template-columns: repeat(auto-fill, minmax(78px, 92px)); }
.ph { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--surface-3); border: 1px solid var(--border); padding: 0; cursor: pointer; display: block; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph:hover { box-shadow: 0 0 0 2px var(--focus); }
.ph-absente::after { content: 'photo non disponible hors-ligne'; position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-size: 10.5px; color: var(--text-3); padding: 6px; }
.ph-leg { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 8px 6px; font-size: 11.5px; color: #fff; text-align: left; background: linear-gradient(transparent, rgba(0, 0, 0, .65)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-x { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(16, 24, 40, .7); color: #fff; display: grid; place-items: center; cursor: pointer; }
.ph-plein { position: relative; background: #0b0f15; border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; display: grid; place-items: center; min-height: 240px; }
.ph-plein img { max-width: 100%; max-height: 62vh; display: block; }
.ph-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255, 255, 255, .9); }
.ph-nav.g { left: 10px; } .ph-nav.d { right: 10px; }

/* --------------------------- Ma journée --------------------------------- */
.agenda { list-style: none; margin: 0; padding: 0 0 6px; }
.ag-jour { font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); padding: 12px 20px 4px; }
.ag-jour::first-letter { text-transform: uppercase; }
.ag-item { display: flex; gap: 12px; align-items: center; width: 100%; padding: 8px 20px; border: 0; background: none; text-align: left; cursor: pointer; color: inherit; font: inherit; }
.ag-item:hover { background: var(--surface-2); }
.ag-item .sub { display: block; }
.ag-item .f-ico { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--info-soft); color: var(--info); flex-shrink: 0; }
.ag-item .f-ico.warn { background: var(--warn-soft); color: var(--warn); }
tr.clic { cursor: pointer; }
tr.clic:hover td { background: var(--surface-2); }
@media (max-width: 760px) {
  .creer-grille { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .creer-item { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; }
  .creer-item small { display: none; }
  .creer-item b { font-size: 13px; }
}

/* ----------------------------- Signatures ------------------------------- */
.sig-liste { display: grid; gap: 16px; }
.sig-item { display: grid; gap: 8px; }
.sig-zone { border: 1.5px dashed var(--border-strong); border-radius: 12px; background: #fff; overflow: hidden; }
.sig-pad { display: block; width: 100%; height: 150px; touch-action: none; cursor: crosshair; background: linear-gradient(transparent calc(100% - 38px), #e4e7ec calc(100% - 38px), #e4e7ec calc(100% - 37px), transparent calc(100% - 37px)); }
.sig-pied { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 4px 12px; border-top: 1px solid #eef0f3; background: #fafbfc; }
.sig-pied .xs { color: #667085; }
.sig-pied .btn { color: #344054; }

/* --------------------------- Plan de charge ----------------------------- */
.table.charge td, .table.charge th { padding-left: 8px; padding-right: 8px; }
.charge-sel { height: 32px; min-width: 112px; font-size: 12.5px; padding: 0 6px; }
.charge-sel.chantier { background: var(--brand-soft); border-color: transparent; color: var(--brand-2); font-weight: 600; }
.charge-sel.absence { background: var(--surface-3); border-color: transparent; color: var(--text-2); font-style: italic; }
.charge-sel.vide { color: var(--text-3); }
.charge-jauge { display: inline-flex; align-items: baseline; gap: 1px; min-width: 52px; justify-content: center; padding: 3px 8px; border-radius: 8px; font-weight: 700; background: var(--surface-3); }
.charge-jauge small { font-weight: 500; color: var(--text-3); }
.charge-jauge.ok { background: var(--pos-soft); color: var(--pos); }
.charge-jauge.manque { background: var(--neg-soft); color: var(--neg); }
.charge-jauge.exces { background: var(--warn-soft); color: var(--warn); }
tr.charge-ch td { background: var(--surface-2); }

/* ---------------------------- Préparation ------------------------------- */
.prep-item { display: flex; gap: 16px; align-items: center; justify-content: space-between; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.prep-item:last-child { border-bottom: 0; }
.prep-item.fait .strong { color: var(--text-2); }
.prep-item.so { opacity: .6; }
.prep-txt { min-width: 0; flex: 1; }
.prep-txt .r-meta { margin-top: 4px; }
.prep-champs { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.prep-champs .input { height: 34px; width: auto; }
.prep-st.st-fait { background: var(--pos-soft); color: var(--pos); border-color: var(--pos-line); font-weight: 600; }
.prep-st.st-encours { background: var(--info-soft); color: var(--info); border-color: var(--info-line); font-weight: 600; }
@media (max-width: 760px) { .prep-item { flex-direction: column; align-items: stretch; gap: 8px; } .prep-champs .input { flex: 1; } }

/* RAF projet (OTP) */
.resume.r4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 760px) { .resume.r4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.resume > .row-link { cursor: pointer; }
.resume > .row-link:hover { background: var(--surface-2); }
.table tr.sous-total td { background: var(--surface-2); }
.table td.warn, .dl dd.warn { color: var(--warn); }

/* Mes pages : choix des pages affichées */
.choix-pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px 22px; }
.cp-esp { display: grid; gap: 4px; align-content: start; }
.cp-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.cp-item:hover { background: var(--surface-2); }
.cp-item input { width: 18px; height: 18px; accent-color: var(--brand-2); flex: none; }
.cp-item .t-ico { width: 30px; height: 30px; flex: none; }
.cp-item b { display: block; font-size: 14px; font-weight: 600; }
.cp-item small { display: block; font-size: 12.5px; color: var(--text-3); }
.cp-item:has(input:not(:checked)) { opacity: .55; }

/* Détail repliable */
details.plus > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); color: var(--text-2); font-weight: 600; font-size: 14px; }
details.plus > summary::-webkit-details-marker { display: none; }
details.plus > summary:hover { background: var(--surface); color: var(--text); }
details.plus > summary .ico { transition: transform .15s; }
details.plus[open] > summary { margin-bottom: 16px; }
details.plus[open] > summary .ico { transform: rotate(180deg); }
