/**
 * MXEmergency — Charte graphique unifiée (mx-app.css)
 * Pages : dashboard, affaires, inventaire, déclarations, wizards, demandes
 */

/* Tokens theme-pro (dashboard / affaires) */
:root{ --stroke: var(--bs-border-color); --brand: var(--bs-primary); --brand-2: #60a5fa; --muted: var(--bs-secondary-color); --shadow: var(--bs-box-shadow); }
.theme-pro.mx-page, body.theme-pro.mx-page{
  --bg:#0b0d10; --surf:#0f141a; --card:#121922; --muted:#8fa0b5; --text:#e7ecf2; --stroke:#1e2836;
  --brand:#66b2ff; --brand-2:#8dd0ff; --ok:#22c55e; --warn:#f59e0b; --danger:#ef4444;
  --note:#fff3bf; --noteText:#3e2f00;
  --shadow:0 1px 2px rgba(0,0,0,.18), 0 6px 24px rgba(0,0,0,.24);
  background:var(--bg); color:var(--text);
}
[data-bs-theme="light"] .theme-pro.mx-page, [data-bs-theme="light"] body.theme-pro.mx-page{
  --bg:#f6f8fb; --surf:#fff; --card:#f3f6fa; --muted:#64748b; --text:#0f172a; --stroke:#e5eef6;
  --brand:#2563eb; --brand-2:#60a5fa;
}

/* ====== Responsive gates */
.only-desktop{ display:block; }
.only-mobile{ display:none; }
@media (max-width: 768px){
  .only-desktop{ display:none !important; }
  .only-mobile{ display:block !important; }
}

/* ====== Thème & Structure */
:root{
  --bg:#0b0d10; --surf:#0f141a; --card:#121922; --muted:#8fa0b5; --text:#e7ecf2; --stroke:#1e2836;
  --brand:#66b2ff; --brand-2:#8dd0ff; --ok:#22c55e; --warn:#f59e0b; --danger:#ef4444;
  --note:#fff3bf; --noteText:#3e2f00;
  --shadow: 0 1px 2px rgba(0,0,0,.18), 0 6px 24px rgba(0,0,0,.24);
}
[data-bs-theme="light"],[data-theme="light"]{
  --bg:#f6f8fb; --surf:#ffffff; --card:#f3f6fa; --muted:#64748b; --text:#0f172a; --stroke:#e5eef6;
  --brand:#2563eb; --brand-2:#60a5fa; --ok:#16a34a; --warn:#b45309; --danger:#dc2626;
  --note:#fff3bf; --noteText:#5c3d00;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 10px 24px rgba(15,23,42,.06);
}
*{ accent-color: var(--brand); }
.theme-pro.mx-page, body.theme-pro.mx-page { background:var(--bg); color:var(--text); }

.page-header{
  display:flex; gap:14px; align-items:center; justify-content:space-between; margin-bottom:10px;
  background: linear-gradient(135deg, rgba(102,178,255,.12), transparent);
  border:1px solid var(--stroke); border-radius:14px; padding:12px 14px;
}
.page-header .title{ display:flex; align-items:center; gap:10px; }
.page-header .title .logo{
  width:34px; height:34px; display:grid; place-items:center; border-radius:10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color:white; box-shadow: var(--shadow);
}
.toolbar{ display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.toolbar .chip{
  display:inline-flex; gap:6px; align-items:center; padding:.35rem .6rem; border-radius:999px;
  border:1px solid var(--stroke); background:var(--card);
}

/* ====== Layout */
.wrap-page{ display:grid; gap:14px; grid-template-columns: 1.3fr 1fr; align-items:start; }
@media (max-width: 1180px){ .wrap-page{ grid-template-columns: 1fr; } }

.block{ background:var(--surf); border:1px solid var(--stroke); border-radius:16px; padding:12px; box-shadow: var(--shadow); }
.block h2{ font-size:1rem; margin:0 0 .5rem 0; display:flex; align-items:center; justify-content:space-between; gap:10px }
.block h2 .sub{ color:var(--muted); font-weight:500; }

/* ====== KPI */
.kpis{ display:grid; grid-template-columns: repeat(4,1fr); gap:10px; }
@media (max-width: 900px){ .kpis{ grid-template-columns: repeat(2,1fr); } }
.kpi{
  background:var(--card); border:1px solid var(--stroke); border-radius:14px; padding:10px;
  display:flex; gap:10px; align-items:center;
}
.kpi i{ width:34px; height:34px; display:grid; place-items:center; border-radius:10px; background:rgba(102,178,255,.13); color:var(--brand); }
.kpi .v{ font-size:1.1rem; font-weight:700; }

/* ====== Tableau demandes */
.table-wrap{ border:1px solid var(--stroke); border-radius:12px; overflow:hidden; }
table.data{ table-layout:fixed; width:100%; font-size:.92rem; }
table.data thead th{ position:sticky; top:0; background:var(--surf); z-index:2; }
table.data tbody tr:hover{ background: rgba(102,178,255,.08); }
table.data th, table.data td{ padding:.48rem .55rem; vertical-align:middle; border-bottom:1px solid var(--stroke); }
.col-num{ width:112px } .col-site{ width:230px } .col-crea{ width:96px } .col-obj{ width:26% }
.col-hs{ width:64px } .col-resp{ width:170px } .col-com{ width:22% } .col-inter{ width:106px } .col-n100{ width:112px } .col-act{ width:84px }
.wrap{ overflow-wrap:anywhere; white-space:normal; }
.clamp-2{ display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; max-height:3.2em; }
.clamp-1{ display:-webkit-box; -webkit-line-clamp:1; -webkit-box-orient:vertical; overflow:hidden; max-height:1.6em; }
.badge-n100.ok       { background:rgba(34,197,94,.15); color:#22c55e }
.badge-n100.soon     { background:rgba(245,158,11,.18); color:#B58100 }
.badge-n100.imminent { background:rgba(239,68,68,.18); color:#ef4444; font-weight:700 }
.badge-n100.late     { background:#111827; color:#fff }

/* ====== Planning / Notes ====== */
.planning{ display:grid; grid-template-columns: repeat(5, 1fr); gap:10px; }
@media (max-width: 1040px){ .planning{ grid-template-columns: 1fr; } }
.day{ background:var(--card); border:1px solid var(--stroke); border-radius:12px; padding:10px; min-height:140px; box-shadow: var(--shadow) }
.day h3{ font-size:.95rem; margin:.1rem 0 .5rem 0; display:flex; justify-content:space-between; align-items:center }
.smallmuted{ color:var(--muted); font-size:.88rem }

/* Items */
.item, .noteitem{
  border:1px dashed var(--stroke); border-radius:10px; padding:8px; margin-bottom:7px; background: rgba(102,178,255,.06);
}
.item .t{ font-weight:700 } .item .m{ color:var(--muted); font-size:.85rem }
.noteitem{
  border:1px solid rgba(255,234,167,.35);
  background: var(--note); color: var(--noteText);
}
.noteitem .t{ font-weight:700; }
.noteitem .meta{ font-size:.82rem; opacity:.9 }
.noteitem .badge-creator{ background: rgba(0,0,0,.12); color: inherit; }

/* Actions interventions (GPS / FMT / Réalisé) */
.actions-inline{
  display:flex; flex-wrap:wrap; gap:6px; margin-top:6px;
}
.i-btn{
  display:inline-flex; align-items:center; justify-content:center;
  min-width:34px; height:34px; padding:0 .6rem; border-radius:10px;
  border:1px solid var(--stroke); background:var(--surf); color:inherit; cursor:pointer; text-decoration:none;
  font-size:.9rem;
}
.i-btn:hover{ background:linear-gradient(180deg, rgba(255,255,255,.04), transparent); }
.i-btn.ok{ background:rgba(34,197,94,.10); border-color:rgba(34,197,94,.35) }
.i-btn[disabled]{ opacity:.5; cursor:not-allowed; }
.badge.fmt{ margin-left:auto; font-size:.82rem; border:1px solid var(--stroke); border-radius:999px; padding:.12rem .5rem; white-space:nowrap }
.fmt-ok{ background:rgba(34,197,94,.13); border-color:rgba(34,197,94,.35); color:#22c55e }
.fmt-todo{ background:rgba(239,68,68,.13); border-color:rgba(239,68,68,.35); color:#ef4444 }

/* ====== Accueil mobile : 6 cartes plein écran ====== */
@media (max-width: 768px){
  body.page-dashboard-mobile{
    overflow:hidden;
  }
  body.page-dashboard-mobile .app-wrapper{
    min-height:100dvh;
    max-height:100dvh;
    display:flex;
    flex-direction:column;
    overflow:hidden;
  }
  body.page-dashboard-mobile .app-topbar{
    flex-shrink:0;
  }
  body.page-dashboard-mobile main#main-content{
    flex:1;
    display:flex;
    flex-direction:column;
    min-height:0;
    overflow:hidden;
  }
  body.page-dashboard-mobile .app-content.container-fluid{
    flex:1;
    display:flex;
    flex-direction:column;
    min-height:0;
    overflow:hidden;
    padding:0 !important;
  }
  body.page-dashboard-mobile .site-footer{
    flex-shrink:0;
    padding-top:.5rem !important;
    padding-bottom:calc(.5rem + env(safe-area-inset-bottom, 0px)) !important;
  }
  body.page-dashboard-mobile .site-footer .small{
    font-size:.72rem;
    line-height:1.35;
  }
  .mobile-dashboard{
    flex:1;
    display:flex;
    flex-direction:column;
    min-height:0;
    padding:10px 10px 6px;
    gap:8px;
  }
  .mobile-dashboard__head{
    flex-shrink:0;
    display:flex;
    align-items:center;
    gap:10px;
    padding:4px 2px 2px;
  }
  .mobile-dashboard__head .logo{
    width:36px;height:36px;border-radius:10px;
    display:grid;place-items:center;
    background:linear-gradient(135deg,var(--brand),var(--brand-2));
    color:#fff;box-shadow:var(--shadow);
  }
  .mobile-dashboard__head h1{
    font-size:1.05rem;margin:0;font-weight:800;
  }
  .mobile-dashboard__grid{
    flex:1;
    display:grid;
    grid-template-columns:1fr 1fr;
    grid-template-rows:repeat(3, minmax(0, 1fr));
    gap:10px;
    min-height:0;
  }
  .mq-card{
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:8px;
    min-height:0;
    padding:12px 10px;
    border-radius:16px;
    color:#fff;
    text-decoration:none;
    font-weight:700;
    font-size:.92rem;
    line-height:1.2;
    text-align:center;
    border:1px solid rgba(255,255,255,.18);
    box-shadow:0 6px 18px rgba(0,0,0,.22);
    transition:transform .12s ease, box-shadow .12s ease;
  }
  .mq-card:active{ transform:scale(.98); }
  .mq-card i{ font-size:1.65rem; opacity:.95; }
  .mq-card--declaration{ background:linear-gradient(145deg,#2563eb,#1d4ed8); }
  .mq-card--sites{ background:linear-gradient(145deg,#0d9488,#0f766e); }
  .mq-card--stock{ background:linear-gradient(145deg,#7c3aed,#6d28d9); }
  .mq-card--carte{ background:linear-gradient(145deg,#16a34a,#15803d); }
  .mq-card--fmt{ background:linear-gradient(145deg,#ea580c,#c2410c); }
  .mq-card--rsd{ background:linear-gradient(145deg,#dc2626,#b91c1c); }
  .mq-card--demande{ background:linear-gradient(145deg,#0284c7,#0369a1); }

  /* Dashboard mobile — chargés d'affaires (demandes + raccourcis) */
  body.page-dashboard-mobile--scroll{
    overflow:auto;
  }
  body.page-dashboard-mobile--scroll .app-wrapper{
    min-height:100dvh;
    max-height:none;
    overflow:visible;
  }
  body.page-dashboard-mobile--scroll main#main-content,
  body.page-dashboard-mobile--scroll .app-content.container-fluid{
    overflow:visible;
    min-height:auto;
  }
  .mobile-dashboard--with-demandes{
    overflow:visible;
    padding-bottom:calc(72px + env(safe-area-inset-bottom, 0px));
  }
  .mobile-dashboard--with-demandes .mobile-dashboard__grid{
    flex:none;
    grid-template-rows:none;
    grid-auto-rows:minmax(68px, auto);
    gap:8px;
  }
  .mobile-shortcuts--top{
    flex-shrink:0;
    margin-bottom:10px;
    padding-bottom:10px;
    border-bottom:1px solid var(--stroke);
  }
  .mobile-shortcuts--top .mobile-shortcuts__title{
    margin-bottom:8px;
    font-size:.75rem;
  }
  .mobile-shortcuts--top .mq-card{
    padding:10px 6px;
    font-size:.76rem;
    border-radius:12px;
    gap:5px;
  }
  .mobile-shortcuts--top .mq-card i{ font-size:1.25rem; }
  .mobile-dem-block{
    flex-shrink:0;
    display:flex;
    flex-direction:column;
    gap:10px;
  }
  .mobile-dem-toolbar{
    flex-shrink:0;
    display:flex;
    flex-direction:column;
    gap:8px;
    padding:10px 12px;
    background:var(--card);
    border:1px solid var(--stroke);
    border-radius:14px;
  }
  .mobile-dem-search{
    display:flex;
    gap:8px;
    align-items:center;
  }
  .mobile-dem-search input{
    flex:1;
    min-width:0;
    border:1px solid var(--stroke);
    border-radius:10px;
    background:var(--card);
    color:var(--text);
    padding:8px 10px;
    font-size:.9rem;
  }
  .mobile-dem-filters{
    display:flex;
    flex-wrap:wrap;
    gap:6px;
    align-items:center;
  }
  .mobile-dem-filters .mf-chip{
    display:inline-flex;
    align-items:center;
    gap:4px;
    padding:5px 10px;
    border-radius:999px;
    border:1px solid var(--stroke);
    background:var(--card);
    font-size:.78rem;
    font-weight:600;
    color:var(--text);
    text-decoration:none;
    white-space:nowrap;
  }
  .mobile-dem-filters .mf-chip.is-active{
    background:rgba(102,178,255,.18);
    border-color:rgba(102,178,255,.45);
    color:var(--brand);
  }
  .mobile-dem-filters .mf-chip.mf-reset{ color:var(--muted); }
  .mobile-dem-section{
    flex-shrink:0;
    padding:0 2px 4px;
  }
  .mobile-dem-section h2{
    font-size:1rem;
    font-weight:800;
    margin:0;
    display:flex;
    align-items:center;
    gap:8px;
  }
  .mobile-dem-section h2 i{
    color:var(--brand);
    font-size:.95rem;
  }
  .mobile-dem-list{
    display:flex;
    flex-direction:column;
    gap:0;
    flex-shrink:0;
  }
  .mobile-dem-accordion{
    --bs-accordion-border-width:0;
    --bs-accordion-border-radius:14px;
    --bs-accordion-inner-border-radius:14px;
    --bs-accordion-btn-padding-x:12px;
    --bs-accordion-btn-padding-y:11px;
    --bs-accordion-body-padding-x:12px;
    --bs-accordion-body-padding-y:10px;
    --bs-accordion-btn-icon-width:1rem;
  }
  .mobile-dem-accordion > .accordion-item{
    background:var(--card);
    border:1px solid var(--stroke) !important;
    border-radius:14px !important;
    overflow:hidden;
    box-shadow:var(--shadow);
    margin-bottom:8px;
  }
  .mobile-dem-accordion > .accordion-item:last-child{ margin-bottom:0; }
  .mobile-dem-accordion .accordion-item.is-hs{
    border-left:4px solid var(--danger) !important;
  }
  .mobile-dem-accordion .accordion-button{
    background:var(--card);
    color:var(--text);
    box-shadow:none;
    font-weight:600;
    gap:0;
    align-items:flex-start;
    padding-right:2.5rem;
    touch-action:manipulation;
    -webkit-tap-highlight-color:transparent;
    cursor:pointer;
    position:relative;
    z-index:1;
  }
  .mobile-dem-accordion .accordion-button:not(.collapsed){
    background:rgba(102,178,255,.1);
    color:var(--text);
    box-shadow:none;
  }
  .mobile-dem-accordion .accordion-button:focus{
    box-shadow:0 0 0 2px rgba(102,178,255,.35);
    border-color:transparent;
  }
  .mobile-dem-accordion .accordion-button::after{
    position:absolute;
    right:12px;
    top:14px;
    margin-left:0;
    flex-shrink:0;
    filter:brightness(1.4);
    pointer-events:none;
  }
  .mobile-acc-head{
    flex:1;
    min-width:0;
    text-align:left;
    pointer-events:none;
    user-select:none;
  }
  .mobile-acc-head *{ pointer-events:none; }
  .mobile-acc-head__row1{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:8px;
    margin-bottom:3px;
  }
  .mobile-acc-head__ref{
    font-family:ui-monospace,monospace;
    font-size:.78rem;
    font-weight:800;
    color:var(--brand);
  }
  .mobile-acc-head__badges{
    display:flex;
    flex-wrap:wrap;
    gap:4px;
    justify-content:flex-end;
  }
  .mobile-acc-head__site{
    font-size:.9rem;
    font-weight:800;
    line-height:1.25;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }
  .mobile-acc-head__obj{
    font-size:.78rem;
    color:var(--muted);
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    margin-top:2px;
  }
  .mobile-acc-body__obj{
    font-size:.86rem;
    line-height:1.4;
    margin-bottom:10px;
    color:var(--text);
  }
  .mobile-acc-body__meta{
    display:flex;
    flex-direction:column;
    gap:6px;
    font-size:.78rem;
    color:var(--muted);
    margin-bottom:10px;
  }
  .mobile-acc-body__meta span{
    display:inline-flex;
    align-items:center;
    gap:6px;
  }
  .mobile-acc-body__com{
    font-size:.78rem;
    color:var(--muted);
    padding:8px 10px;
    background:rgba(102,178,255,.06);
    border-radius:10px;
    border:1px dashed var(--stroke);
    margin-bottom:10px;
    line-height:1.35;
  }
  .mobile-acc-body__actions{
    display:flex;
    gap:8px;
  }
  .mobile-acc-body__actions .btn{
    flex:1;
    font-weight:700;
    border-radius:10px;
  }
  .mobile-dem-card{
    display:block;
    background:var(--card);
    border:1px solid var(--stroke);
    border-radius:14px;
    padding:12px;
    color:inherit;
    text-decoration:none;
    box-shadow:var(--shadow);
    transition:transform .12s ease, border-color .12s ease;
  }
  .mobile-dem-card:active{ transform:scale(.985); }
  .mobile-dem-card.is-hs{ border-left:4px solid var(--danger); }
  .mobile-dem-card__top{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:8px;
    margin-bottom:6px;
  }
  .mobile-dem-card__ref{
    font-family:ui-monospace, monospace;
    font-size:.82rem;
    font-weight:800;
    color:var(--brand);
  }
  .mobile-dem-card__badges{
    display:flex;
    flex-wrap:wrap;
    gap:4px;
    justify-content:flex-end;
  }
  .mobile-dem-card__site{
    font-size:.95rem;
    font-weight:800;
    line-height:1.25;
    margin-bottom:4px;
  }
  .mobile-dem-card__obj{
    font-size:.85rem;
    color:var(--muted);
    display:-webkit-box;
    -webkit-line-clamp:2;
    -webkit-box-orient:vertical;
    overflow:hidden;
    line-height:1.35;
    margin-bottom:8px;
  }
  .mobile-dem-card__meta{
    display:flex;
    flex-wrap:wrap;
    gap:6px 10px;
    font-size:.75rem;
    color:var(--muted);
  }
  .mobile-dem-card__meta span{
    display:inline-flex;
    align-items:center;
    gap:4px;
  }
  .mobile-dem-card__com{
    margin-top:8px;
    padding-top:8px;
    border-top:1px dashed var(--stroke);
    font-size:.78rem;
    color:var(--muted);
    display:-webkit-box;
    -webkit-line-clamp:2;
    -webkit-box-orient:vertical;
    overflow:hidden;
  }
  .mobile-dem-empty{
    text-align:center;
    padding:28px 16px;
    color:var(--muted);
    background:var(--card);
    border:1px dashed var(--stroke);
    border-radius:14px;
    font-size:.9rem;
  }
  .mobile-dem-pagination{
    display:flex;
    align-items:center;
    justify-content:center;
    gap:10px;
    padding:6px 0 2px;
    flex-shrink:0;
  }
  .mobile-dem-pagination .pg-btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-width:40px;
    height:36px;
    padding:0 12px;
    border-radius:10px;
    border:1px solid var(--stroke);
    background:var(--card);
    color:var(--text);
    text-decoration:none;
    font-size:.85rem;
    font-weight:600;
  }
  .mobile-dem-pagination .pg-btn[disabled],
  .mobile-dem-pagination .pg-btn.disabled{
    opacity:.45;
    pointer-events:none;
  }
  .mobile-dem-pagination .pg-info{
    font-size:.82rem;
    color:var(--muted);
    font-weight:600;
  }
  .mobile-dem-fab{
    position:fixed;
    right:max(16px, env(safe-area-inset-right, 0px));
    bottom:calc(18px + env(safe-area-inset-bottom, 0px));
    z-index:1050;
    width:58px;
    height:58px;
    border-radius:18px;
    display:flex;
    align-items:center;
    justify-content:center;
    background:linear-gradient(145deg,#34d399 0%,#16a34a 45%,#15803d 100%);
    color:#fff;
    border:2px solid rgba(255,255,255,.28);
    box-shadow:
      0 10px 28px rgba(22,163,74,.45),
      0 2px 8px rgba(0,0,0,.22),
      inset 0 1px 0 rgba(255,255,255,.35);
    text-decoration:none;
    transition:transform .15s ease, box-shadow .15s ease;
  }
  .mobile-dem-fab:hover{
    color:#fff;
    box-shadow:
      0 14px 32px rgba(22,163,74,.5),
      0 4px 12px rgba(0,0,0,.25),
      inset 0 1px 0 rgba(255,255,255,.4);
  }
  .mobile-dem-fab:active{
    transform:scale(.92);
    box-shadow:0 6px 16px rgba(22,163,74,.4), inset 0 2px 6px rgba(0,0,0,.15);
  }
  .mobile-dem-fab__icon{
    display:grid;
    place-items:center;
    width:100%;
    height:100%;
    font-size:1.45rem;
    line-height:1;
    font-weight:900;
    text-shadow:0 1px 2px rgba(0,0,0,.2);
  }
  .mobile-shortcuts{
    flex-shrink:0;
  }
  .mobile-shortcuts__title{
    font-size:.82rem;
    font-weight:700;
    color:var(--muted);
    margin-bottom:8px;
    text-transform:uppercase;
    letter-spacing:.06em;
  }
}


/* ===== Wizards (FMT / FRSD / create_demande) ===== */
.mx-wizard-page .progress-wrap{
  position:sticky; top:0; z-index:100;
  background:color-mix(in srgb, var(--bs-body-bg) 94%, transparent);
  backdrop-filter:saturate(1.1) blur(6px);
  padding:.55rem .75rem; border-bottom:1px solid var(--bs-border-color);
  margin:-1rem -0.75rem 1rem; border-radius:0;
}
@media (min-width: 992px){ .mx-wizard-page .progress-wrap{ margin:-1rem -1.5rem 1rem; } }
.mx-wizard-page .wizard{ max-width:760px; margin:0 auto; }
.mx-wizard-page .qblock{
  padding:1rem; border:1px solid var(--bs-border-color); border-radius:.75rem; margin-bottom:1rem;
}
.mx-wizard-page .section-title{ display:flex; align-items:center; gap:.6rem; margin-bottom:.5rem; }
.mx-wizard-page .nav-btns, .mx-wizard-page .sticky-actions{
  display:flex; gap:.5rem; justify-content:space-between; flex-wrap:wrap;
  position:sticky; bottom:0; z-index:50;
  background:var(--bs-body-bg); padding:.75rem .25rem;
  border-top:1px solid var(--bs-border-color);
  margin:1rem -0.25rem -0.5rem;
}
.mx-wizard-page .hero{
  background:linear-gradient(135deg, rgba(13,110,253,.08), rgba(25,135,84,.07));
  border:1px solid var(--bs-border-color); border-radius:.85rem;
  padding:.95rem 1.05rem; display:flex; align-items:center; gap:.75rem;
}
.mx-wizard-page .typeahead, .mx-wizard-page .dropdown-panel{
  position:absolute; z-index:1000; background:var(--bs-body-bg);
  border:1px solid var(--bs-border-color); border-radius:.5rem;
  max-height:260px; overflow:auto; width:100%;
}



/* ===== En-tête & formulaires communs ===== */
.mx-page .page-header.mx-page-header,
.mx-page .page-header{
  display:flex; align-items:center; justify-content:space-between; gap:.75rem;
  flex-wrap:wrap; margin-bottom:1rem;
}
.mx-page .page-header.mx-page-header--card,
.mx-page.theme-pro .page-header{
  gap:14px; margin-bottom:10px;
  background:linear-gradient(135deg, rgba(102,178,255,.12), transparent);
  border:1px solid var(--stroke, var(--bs-border-color));
  border-radius:14px; padding:12px 14px;
}
.mx-page .page-header .title{ display:flex; align-items:center; gap:10px; min-width:0; }
.mx-page .page-header .logo{
  width:34px; height:34px; flex-shrink:0;
  display:grid; place-items:center; border-radius:10px;
  background:linear-gradient(135deg, var(--brand, var(--bs-primary)), var(--brand-2, #60a5fa));
  color:#fff; box-shadow:var(--shadow, 0 4px 12px rgba(0,0,0,.12));
}
.mx-page .container-narrow{ max-width:820px; }
.mx-page .hero.mx-hero{
  background:linear-gradient(135deg, #0d6efd, #3b82f6);
  color:#fff; border-radius:12px; padding:12px 14px; margin-bottom:1rem;
  box-shadow:0 6px 18px rgba(0,0,0,.12);
}
[data-bs-theme="dark"] .mx-page .hero.mx-hero{
  background:linear-gradient(135deg, #0a4abf, #2563eb);
}
.mx-page .sticky-actions{
  position:sticky; bottom:0; z-index:10;
  background:var(--bs-body-bg); border-top:1px solid var(--bs-border-color);
  padding:10px; box-shadow:0 -8px 18px rgba(0,0,0,.06);
}
.mx-page .tile{
  border:1px solid var(--bs-border-color); border-radius:.75rem;
  padding:1rem; background:var(--bs-body-bg);
}
.mx-page .card.mx-card{ border-radius:.75rem; margin-bottom:1rem; }
.mx-page .card.mx-card > .card-header{ font-weight:600; }
.mx-page .kpi-card{ border-radius:.75rem; }
.mx-page .kpi-card .display-6{ font-size:1.75rem; font-weight:700; }
@media (max-width: 576px){
  .mx-page .kpi-card .display-6{ font-size:1.35rem; }
  .mx-page .kpis.mx-kpis-bs{ grid-template-columns:repeat(2, 1fr) !important; }
}
.mx-page .kpis.mx-kpis-bs{
  display:grid; grid-template-columns:repeat(auto-fit, minmax(140px, 1fr)); gap:.75rem;
}
/* Hub inventaire SAV */
.mx-page .metric-grid{ display:grid; grid-template-columns:repeat(auto-fit, minmax(120px, 1fr)); gap:10px; }
.mx-page .metric{
  background:var(--bs-tertiary-bg); border:1px solid var(--bs-border-color);
  border-radius:12px; padding:12px; text-align:center;
}
.mx-page .metric .v{ font-size:1.25rem; font-weight:800; }
.mx-page .hub-card{ border-radius:14px; transition:transform .12s ease, box-shadow .12s ease; height:100%; }
.mx-page .hub-card:hover{ transform:translateY(-2px); box-shadow:0 8px 20px rgba(0,0,0,.1); }
.mx-mobile-page-title{ padding-bottom:.15rem; border-bottom:1px solid var(--bs-border-color); margin-bottom:.75rem; }
.mx-page .hub-card .icon-wrap{
  width:44px; height:44px; border-radius:12px;
  display:grid; place-items:center; background:rgba(13,110,253,.12); color:var(--bs-primary);
}


/* Inventaire sorties / SAV */
/* ====== Mobile-first & thème dark-friendly ====== */
  .card { margin-bottom:1rem; border-radius:.75rem; }
  .card-header { font-weight:600; }
  .sticky-actions { position:sticky; top:0; background:var(--bs-body-bg); z-index:5; padding-bottom:.25rem; }
  .is-invalid { border-color:#dc3545!important; }
  .q-note { font-size:.85rem; color:var(--bs-secondary-color); }

  /* --- Autocomplete: dark-friendly + highlight --- */
  .sg-wrap { position:relative; }
  .sg-box {
    position:absolute; top:100%; left:0; right:0; z-index:1000;
    background: var(--bs-body-bg); color: var(--bs-body-color);
    border: 1px solid var(--bs-border-color); border-top: 0;
    max-height: 280px; overflow:auto;
    box-shadow: 0 10px 24px rgba(0,0,0,.12), inset 0 1px 0 rgba(255,255,255,.02);
  }
  [data-bs-theme="dark"] .sg-box{ box-shadow: 0 16px 28px rgba(0,0,0,.6), 0 2px 8px rgba(0,0,0,.35); }
  .sg-item{ padding:.55rem .7rem; cursor:pointer; border-top:1px solid var(--bs-border-color); }
  .sg-item:first-child{ border-top:0; }
  .sg-item:hover,.sg-item.active{ background: var(--bs-tertiary-bg); color: var(--bs-body-color); }
  .sg-item.muted{ color: var(--bs-secondary-color); cursor: default; }

  mark.hl{
    background: var(--bs-warning-bg-subtle);
    color: inherit;
    padding: 0 .15em;
    border-radius: .2em;
  }
  [data-bs-theme="dark"] mark.hl{ background: rgba(255,193,7,.25); }

  /* --- Scanner --- */
  .scan-btn { display:inline-flex; align-items:center; gap:.5rem; }
  .scanner-video { width:100%; border-radius:.5rem; background:#000; }
  .scanner-toolbar { display:flex; gap:.5rem; align-items:center; flex-wrap:wrap; }
  .scanner-overlay { position:absolute; inset:0; pointer-events:none; border:2px dashed rgba(255,255,255,.6); border-radius:.5rem; margin:12px; }

  /* --- Table: wrap pour éviter le scroll horizontal --- */
  .table { table-layout: fixed; } /* forcer la casse dans les cellules */
  .table td { vertical-align:middle; word-break: break-word; overflow-wrap: anywhere; }
  thead.table-active th{ background-color: var(--bs-tertiary-bg); }

  /* Carte mobile pour chaque produit */
  @media (max-width: 576px){
    #tabLines thead { display:none; }
    #tabLines { border-collapse: separate; border-spacing: 0 .75rem; }
    #tabLines tbody tr{
      display:block;
      border:1px solid var(--bs-border-color);
      border-radius:.9rem;
      padding:.75rem .8rem;
      background: var(--bs-body-bg);
      box-shadow: 0 2px 8px rgba(0,0,0,.06);
    }
    #tabLines tbody td{ display:block; border:0; padding:.4rem 0; }

    /* En-tête de ligne produit : autoriser retours à la ligne */
    .line-head{
      display:flex; align-items:flex-start; justify-content:space-between; gap:.75rem;
      flex-wrap: wrap; /* badges passent dessous si besoin */
      min-width: 0;
    }
    .line-title{
      font-weight:600; line-height:1.25;
      white-space: normal !important;
      word-break: break-word; overflow-wrap: anywhere;
      flex: 1 1 280px; min-width: 0;
    }
    .line-badges{ display:flex; flex-wrap:wrap; gap:.35rem; flex: 1 1 auto; }
    .line-badges .badge{ font-weight:600; }

    /* Zone quantité + stepper large */
    .qty-wrap{ display:flex; gap:.5rem; align-items:center; justify-content:flex-end; }
    .qty-wrap .btn-step{ width:2.6rem; height:2.6rem; border-radius:.6rem; font-size:1.1rem; }
    .qty-wrap input[type="number"]{ flex:0 0 auto; max-width:7.2rem; font-size:1.05rem; }

    /* Libellés au-dessus des champs */
    .field-label{ font-size:.85rem; color: var(--bs-secondary-color); margin-bottom:.25rem; }

    .line-actions{ display:flex; justify-content:flex-end; }
  }

  /* Desktop stepper compact */
  @media (min-width: 577px){
    .qty-wrap{ display:inline-flex; gap:.35rem; align-items:center; }
    .qty-wrap .btn-step{ width:2rem; height:2rem; }
    .qty-wrap input[type="number"]{ max-width:6rem; }
  }

  /* État indisponible (désactivation visuelle) */
  .is-indispo{ opacity:.6; pointer-events:none; }
.inv-hero {
    background: linear-gradient(180deg, var(--bs-tertiary-bg), transparent);
    border-radius: .75rem;
    padding: 1rem 1.25rem;
  }
  .card { border-radius: .9rem; }
  .card .icon-wrap {
    width: 44px; height: 44px; display:flex; align-items:center; justify-content:center;
    border-radius: .6rem; background: var(--bs-tertiary-bg);
    font-size: 1.2rem; color: var(--bs-primary);
  }
  .metric { font-weight: 700; font-size: 1.25rem; }
  .muted { color: var(--bs-secondary-color); }

  .card.disabled {
    opacity: .6;
  }
  .card.disabled a.stretched-link {
    pointer-events: none;
  }

  @media (max-width: 576px){
    .inv-hero { padding: .75rem; }
    .metric { font-size: 1.1rem; }
  }

/* Déclaration */
.mx-page .container-narrow{ max-width: 820px; }
.mx-page .hero{
    background: linear-gradient(135deg, #0d6efd, #3b82f6);
    color: #fff; border-radius: 12px; padding: 12px 14px; margin-top:10px;
    box-shadow: 0 6px 18px rgba(0,0,0,.12);
  }
.mx-page [data-bs-theme="dark"] .hero{
    background: linear-gradient(135deg, #0a4abf, #2563eb);
    box-shadow: 0 10px 24px rgba(0,0,0,.35);
  }
.mx-page .badge-ag{
    background: var(--bs-body-secondary-bg, var(--bs-secondary-bg));
    color: var(--bs-body-color);
    border: 1px solid var(--bs-border-color);
  }
.mx-page .nav-tabs .nav-link{ color: var(--bs-body-color); }
.mx-page .nav-tabs .nav-link:focus-visible{ outline: 2px solid var(--bs-primary); outline-offset: 2px; }
.mx-page .nav-tabs .nav-link.active{
    background: var(--bs-body-bg);
    border-color: var(--bs-primary) var(--bs-border-color) var(--bs-body-bg);
    color: var(--bs-emphasis-color);
    font-weight: 600;
  }
.mx-page .nav-tabs{ border-color: var(--bs-border-color); }
.mx-page .sticky-actions{
    position: sticky; bottom: 0; z-index: 10;
    background: var(--bs-body-bg);
    border-top: 1px solid var(--bs-border-color);
    padding: 10px;
    box-shadow: 0 -8px 18px rgba(0,0,0,.06);
  }
.mx-page [data-bs-theme="dark"] .sticky-actions{ box-shadow: 0 -10px 22px rgba(0,0,0,.35); }
.mx-page .callout{
    border: 1px solid var(--bs-border-color);
    background: var(--bs-tertiary-bg);
    border-radius: 10px; padding: 10px 12px;
  }
.mx-page .chips{ display:flex; flex-wrap:wrap; gap:8px }
.mx-page .chips .btn{ border-radius: 999px; }
.mx-page .preview-grid{ display:grid; grid-template-columns:repeat(4,1fr); gap:8px }
  @media (max-width: 520px){ .preview-grid{ grid-template-columns:repeat(3,1fr) } }
.mx-page .preview-grid img{
    width:100%; aspect-ratio:1/1; object-fit:cover; border-radius:8px;
    border: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
  }
.mx-page .form-text{ color: var(--bs-secondary-color); }
  ::placeholder{ color: var(--bs-secondary-color) !important; opacity: 1; }
  @media (max-width: 576px){ .btn{ padding:.6rem .8rem; } }
.mx-page .is-invalid{ border-color: #dc3545 !important; }