/* ============================================================
   INVENTRA v2 — Styles
   Protection Civile 79 — Antonin LIÈRE
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body { font-family: 'Inter', system-ui, sans-serif; background: #f0f4f8; color: #111827; min-height: 100vh; font-size: 14px; line-height: 1.5; }

/* ── Screens ── */
.screen { display: none; flex-direction: column; min-height: 100vh; }
.screen.active { display: flex; }
.page { display: none; }
.page.active { display: block; }

/* ══════════════════════════════════════════════════════════
   LOGIN — split panel
   ══════════════════════════════════════════════════════════ */
.login-page { display: flex; min-height: 100vh; }

.login-left {
  flex: 1.2; background: #004589;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 48px; position: relative; overflow: hidden;
}
.login-left::before {
  content: ''; position: absolute; top: -120px; right: -120px;
  width: 400px; height: 400px; border-radius: 50%;
  background: rgba(240,136,1,0.12);
}
.login-left::after {
  content: ''; position: absolute; bottom: -80px; left: -80px;
  width: 300px; height: 300px; border-radius: 50%;
  background: rgba(255,255,255,0.05);
}
.ll-logo { display: flex; align-items: center; gap: 12px; }
.ll-mark { width: 40px; height: 40px; background: #F08801; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 18px; color: white; letter-spacing: -1px; flex-shrink: 0; }
.ll-name { font-size: 22px; font-weight: 700; color: white; letter-spacing: 2px; }
.ll-sub  { font-size: 11px; color: rgba(255,255,255,0.5); letter-spacing: 1px; text-transform: uppercase; margin-top: 2px; }

.ll-hero { position: relative; z-index: 1; }
.ll-hero h1 { font-size: 36px; font-weight: 700; color: white; line-height: 1.2; margin-bottom: 16px; }
.ll-hero h1 span { color: #F08801; }
.ll-hero p { font-size: 15px; color: rgba(255,255,255,0.65); line-height: 1.7; max-width: 380px; }

.ll-modules { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; position: relative; z-index: 1; }
.ll-chip { background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12); border-radius: 10px; padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.ll-dot  { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.ll-chip span { font-size: 13px; color: rgba(255,255,255,0.8); font-weight: 500; }

.login-right {
  width: 460px; flex-shrink: 0; background: white;
  display: flex; flex-direction: column; justify-content: center;
  padding: 0 48px 56px; position: relative;
}
.lr-bar { height: 4px; background: #F08801; margin-bottom: 56px; }

.lr-header { margin-bottom: 36px; }
.lr-header h2 { font-size: 26px; font-weight: 700; color: #0f1923; margin-bottom: 8px; }
.lr-header p  { font-size: 14px; color: #6b7280; }

.lr .form-group { margin-bottom: 20px; }
.lr .form-group label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 7px; }
.lr .form-group input {
  width: 100%; height: 46px; border: 1.5px solid #e5e7eb; border-radius: 10px;
  padding: 0 14px; font-size: 14px; color: #111827; outline: none;
  transition: border-color .15s; background: #f9fafb; font-family: inherit;
}
.lr .form-group input:focus { border-color: #004589; background: white; }
.lr .form-group input::placeholder { color: #9ca3af; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-eye { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: #9ca3af; padding: 0; display: flex; align-items: center; }
.pw-eye svg { width: 18px; height: 18px; }

.btn-login {
  width: 100%; height: 48px; background: #004589; color: white; border: none;
  border-radius: 10px; font-size: 15px; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s; font-family: inherit; letter-spacing: .3px;
}
.btn-login:hover { background: #003a73; }
.btn-login svg { width: 18px; height: 18px; }

.lr-divider { display: flex; align-items: center; gap: 12px; margin: 28px 0; }
.lr-divider-line { flex: 1; height: 1px; background: #f3f4f6; }
.lr-divider span { font-size: 12px; color: #9ca3af; }

.lr-secure { display: flex; align-items: center; gap: 8px; padding: 12px 14px; background: #f0f7ff; border-radius: 8px; border: 1px solid #dbeafe; }
.lr-secure svg { width: 16px; height: 16px; flex-shrink: 0; }
.lr-secure span { font-size: 12px; color: #3b82f6; }

.lr-footer { margin-top: 32px; text-align: center; font-size: 12px; color: #9ca3af; }
.lr-footer strong { color: #004589; }

.login-err { color: #c0392b; font-size: 12px; margin-top: 10px; display: none; }
.login-msg { font-size: 13px; padding: 12px; border-radius: 8px; margin-top: 10px; display: none; }
.login-msg.loading { background: #f0f4fa; color: #004589; display: block; }

/* ══════════════════════════════════════════════════════════
   TOPBAR (portail + modules)
   ══════════════════════════════════════════════════════════ */
.topbar {
  background: #004589; height: 56px;
  display: flex; align-items: center; padding: 0 32px; gap: 16px;
  position: sticky; top: 0; z-index: 100; flex-shrink: 0;
}
.topbar-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; cursor: pointer; }
.tb-mark { width: 32px; height: 32px; background: #F08801; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; color: white; flex-shrink: 0; }
.tb-name { font-size: 16px; font-weight: 700; color: white; letter-spacing: 2px; }
.topbar-sep { width: 1px; height: 24px; background: rgba(255,255,255,0.15); }
.topbar-org { font-size: 12px; color: rgba(255,255,255,0.55); letter-spacing: .5px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.tb-notif { width: 34px; height: 34px; border-radius: 8px; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12); display: flex; align-items: center; justify-content: center; cursor: pointer; color: rgba(255,255,255,0.8); position: relative; }
.tb-notif-dot { width: 8px; height: 8px; background: #F08801; border-radius: 50%; position: absolute; top: 6px; right: 6px; border: 2px solid #004589; }
.tb-notif svg { width: 16px; height: 16px; }

.tb-user { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.tb-avatar { width: 32px; height: 32px; border-radius: 50%; background: #F08801; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: white; flex-shrink: 0; }
.tb-username { font-size: 13px; color: rgba(255,255,255,0.85); font-weight: 500; }
.tb-chevron { color: rgba(255,255,255,0.5); }

.tb-gear { background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15); color: rgba(255,255,255,0.8); width: 34px; height: 34px; border-radius: 8px; cursor: pointer; font-size: 17px; display: none; align-items: center; justify-content: center; font-family: inherit; }
.tb-gear.visible { display: flex; }
.tb-gear:hover { background: rgba(255,255,255,0.2); }

.tb-back { background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15); color: rgba(255,255,255,0.8); padding: 5px 12px; border-radius: 8px; font-size: 12px; cursor: pointer; font-family: inherit; display: flex; align-items: center; gap: 6px; }
.tb-back:hover { background: rgba(255,255,255,0.2); }

.topbar-bar { height: 3px; background: #F08801; flex-shrink: 0; }

/* ══════════════════════════════════════════════════════════
   PORTAIL
   ══════════════════════════════════════════════════════════ */
.portal-body { flex: 1; max-width: 1200px; margin: 0 auto; padding: 40px 32px; width: 100%; }

.portal-welcome { margin-bottom: 36px; }
.portal-welcome h1 { font-size: 26px; font-weight: 700; color: #0f1923; margin-bottom: 6px; }
.portal-welcome h1 span { color: #004589; }
.portal-welcome p { font-size: 14px; color: #6b7280; }

/* Bannière */
.portal-banner {
  background: #004589; border-radius: 14px; padding: 20px 24px;
  display: flex; align-items: center; gap: 16px; margin-bottom: 36px;
  position: relative; overflow: hidden;
}
.portal-banner::after { content: ''; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: rgba(240,136,1,0.15); }
.pb-icon { width: 44px; height: 44px; background: rgba(255,255,255,0.12); border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pb-icon svg { width: 22px; height: 22px; color: white; }
.pb-text h3 { font-size: 15px; font-weight: 600; color: white; margin-bottom: 3px; }
.pb-text p  { font-size: 13px; color: rgba(255,255,255,0.65); }
.pb-close { margin-left: auto; position: relative; z-index: 1; background: none; border: none; color: rgba(255,255,255,0.6); font-size: 20px; cursor: pointer; line-height: 1; }

.portal-section-title { font-size: 13px; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: .8px; margin-bottom: 16px; }

/* Cards modules */
.portal-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 40px; }

.portal-card {
  background: white; border-radius: 14px; border: 1.5px solid #e5e7eb;
  padding: 24px 20px; cursor: pointer;
  transition: border-color .15s, transform .15s;
  position: relative; overflow: hidden; text-decoration: none;
}
.portal-card:hover:not(.portal-locked) { border-color: #004589; transform: translateY(-2px); }
.portal-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; }
.portal-card.c-blue::before   { background: #004589; }
.portal-card.c-green::before  { background: #10b981; }
.portal-card.c-orange::before { background: #F08801; }
.portal-card.c-red::before    { background: #ef4444; }
.portal-card.portal-locked { opacity: .55; cursor: default; }
.portal-card.portal-locked:hover { transform: none; border-color: #e5e7eb; }

.pc-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.pc-icon svg { width: 22px; height: 22px; }
.pc-icon.i-blue   { background: #eff6ff; color: #004589; }
.pc-icon.i-green  { background: #ecfdf5; color: #10b981; }
.pc-icon.i-orange { background: #fff7ed; color: #F08801; }
.pc-icon.i-red    { background: #fef2f2; color: #ef4444; }
.pc-icon.i-gray   { background: #f3f4f6; color: #9ca3af; }

.pc-name { font-size: 15px; font-weight: 700; color: #111827; margin-bottom: 4px; }
.pc-desc { font-size: 12px; color: #9ca3af; margin-bottom: 16px; line-height: 1.5; }
.pc-locked-label { font-size: 11px; color: #9ca3af; margin-bottom: 16px; }

.pc-arrow { position: absolute; bottom: 20px; right: 20px; width: 28px; height: 28px; background: #f9fafb; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.pc-arrow svg { width: 14px; height: 14px; color: #9ca3af; }

/* Liens rapides */
.portal-links { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 40px; }
.quick-link { display: flex; flex-direction: column; align-items: center; gap: 7px; background: white; border: 1.5px solid #eee; border-radius: 14px; padding: 14px 20px; text-decoration: none; min-width: 90px; transition: box-shadow .15s, border-color .15s; }
.quick-link:hover { box-shadow: 0 4px 16px rgba(0,69,137,.12); border-color: #004589; }
.ql-icon { width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.quick-link span { font-size: 12px; font-weight: 600; color: #333; }

/* Bottom grid */
.portal-bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.quick-card { background: white; border-radius: 14px; border: 1.5px solid #e5e7eb; padding: 20px; }
.quick-card h3 { font-size: 14px; font-weight: 600; color: #111827; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.quick-card h3 svg { width: 16px; height: 16px; color: #004589; }
.qc-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f9fafb; font-size: 13px; color: #374151; }
.qc-item:last-child { border-bottom: none; }
.qc-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.qc-dot.red { background: #ef4444; }
.qc-dot.orange { background: #F08801; }
.qc-badge { margin-left: auto; font-size: 11px; padding: 2px 7px; border-radius: 20px; font-weight: 600; white-space: nowrap; }
.qc-badge.red    { background: #fef2f2; color: #ef4444; }
.qc-badge.orange { background: #fff7ed; color: #d97706; }
.qc-badge.blue   { background: #eff6ff; color: #004589; }

/* ══════════════════════════════════════════════════════════
   MODULES (nav interne, cards, forms, tables…)
   ══════════════════════════════════════════════════════════ */
.module-body { flex: 1; padding: 20px; }

/* Nav */
.nav { display: flex; border-bottom: 1px solid #eee; margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav-btn { padding: 9px 14px; font-size: 13px; cursor: pointer; border: none; background: transparent; color: #666; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-family: inherit; font-weight: 500; }
.nav-btn.active { color: #F08801; border-bottom-color: #F08801; font-weight: 600; }
.nav-btn:hover  { color: #F08801; }

/* Cards */
.card { background: white; border: 1px solid #e5e5e5; border-radius: 12px; padding: 15px; margin-bottom: 12px; }
.card-hdr { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; flex-wrap: wrap; gap: 8px; }
.card-title { font-size: 14px; font-weight: 600; }

/* Badges */
.badge { padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.b-ok  { background: #e8f5e9; color: #2e7d32; }
.b-low { background: #fff8e1; color: #e65100; }
.b-out { background: #fde8e8; color: #c0392b; }

/* Metrics */
.grid4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin-bottom: 14px; }
.metric { background: #f0f4fa; border-radius: 10px; padding: 12px; }
.metric-val { font-size: 20px; font-weight: 700; }
.metric-lbl { font-size: 11px; color: #666; margin-top: 2px; }

/* Buttons */
.btn { padding: 6px 12px; border: 1px solid #ddd; background: white; border-radius: 8px; font-size: 12px; cursor: pointer; font-weight: 500; color: #1a1a1a; font-family: inherit; }
.btn:hover { background: #f5f5f5; }
.btn-primary { background: #F08801; border-color: #F08801; color: white; }
.btn-primary:hover { background: #d97700; }
.btn-danger  { background: #fde8e8; border-color: #c0392b; color: #c0392b; }
.btn-danger:hover  { background: #fbd0cc; }
.btn-blue    { background: #004589; border-color: #004589; color: white; }
.btn-blue:hover    { background: #003570; }

/* Forms */
.form-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.form-row label { font-size: 12px; color: #555; font-weight: 500; }
.form-row input, .form-row select, .form-row textarea { padding: 8px 10px; border: 1px solid #ddd; border-radius: 8px; font-size: 13px; font-family: inherit; }
.form-row textarea { resize: vertical; min-height: 60px; }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { outline: none; border-color: #004589; box-shadow: 0 0 0 3px rgba(0,69,137,0.08); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Movement toggle */
.type-toggle { display: flex; gap: 8px; margin-bottom: 16px; }
.type-btn { flex: 1; padding: 10px; border: 1px solid #ddd; border-radius: 8px; font-size: 13px; cursor: pointer; background: #f8f8f8; color: #666; text-align: center; font-weight: 500; font-family: inherit; }
.type-btn.active-in  { background: #e8f5e9; border-color: #2e7d32; color: #2e7d32; font-weight: 600; }
.type-btn.active-out { background: #fde8e8; border-color: #c0392b; color: #c0392b; font-weight: 600; }

/* Tables */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; color: #666; font-weight: 600; padding: 5px 7px; border-bottom: 1px solid #eee; font-size: 12px; white-space: nowrap; }
.tbl td { padding: 7px 7px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: #fafafa; }
.qty-inp { width: 55px; padding: 3px 6px; border: 1px solid #ddd; border-radius: 6px; font-size: 13px; text-align: center; font-family: inherit; }

/* Accordion stock */
.cat-toggle { display: flex; align-items: center; cursor: pointer; user-select: none; padding: 9px 12px; border-radius: 8px; background: #f0f4fa; margin-bottom: 3px; }
.cat-toggle:hover { background: #e0eaf7; }
.cat-left  { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cat-name  { font-size: 13px; font-weight: 600; color: #004589; }
.cat-count { font-size: 11px; color: #888; background: white; border-radius: 20px; padding: 1px 8px; border: .5px solid #ddd; }
.cat-arrow { font-size: 10px; color: #004589; transition: transform .2s; flex-shrink: 0; }
.cat-arrow.open { transform: rotate(90deg); }
.cat-body { overflow: hidden; transition: max-height .3s ease; }
.cat-body.collapsed { max-height: 0; }
.cat-body.expanded  { max-height: 3000px; }

/* Drag handle */
.drag-handle { cursor: grab; color: #ccc; font-size: 16px; padding: 0 6px; user-select: none; flex-shrink: 0; }
.drag-handle:hover { color: #004589; }
.tbl tr.dragging td { opacity: .4; background: #e8f0fa; }
.tbl tr.drag-over td { border-top: 2px solid #F08801; }

/* Alerts */
.alert-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f0f0f0; }
.alert-item:last-child { border-bottom: none; }
.alert-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-out { background: #c0392b; }
.dot-low { background: #e67e22; }

/* Bars */
.bar-wrap  { margin-bottom: 10px; }
.bar-label { display: flex; justify-content: space-between; font-size: 12px; color: #666; margin-bottom: 3px; }
.bar-track { height: 7px; background: #f0f0f0; border-radius: 4px; overflow: hidden; margin-bottom: 2px; }
.bar-fill  { height: 100%; border-radius: 4px; }
.bar-in    { background: #2e7d32; }
.bar-out-b { background: #F08801; }

/* Movement badges */
.mv-badge { display: inline-flex; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; }
.mv-plus  { background: #e8f5e9; color: #2e7d32; }
.mv-minus { background: #fff3e0; color: #F08801; }

/* Filter row */
.filter-row { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.filter-row input, .filter-row select { padding: 6px 10px; border: 1px solid #ddd; border-radius: 7px; font-size: 12px; font-family: inherit; }

/* Users */
.code-item { display: flex; align-items: center; gap: 8px; background: #f8f8f8; border-radius: 9px; padding: 10px 13px; margin-bottom: 7px; flex-wrap: wrap; }
.code-email { font-size: 13px; font-weight: 500; flex: 1; min-width: 140px; }
.code-name  { font-size: 12px; color: #888; }

/* Role badges */
.role-superadmin            { background:#fde8e8;color:#c0392b; }
.role-tenues_gestionnaire   { background:#e6f0ff;color:#004589; }
.role-tenues_consultant     { background:#f0f4fa;color:#004589; }
.role-pharmacie_gestionnaire{ background:#e8f5e9;color:#2e7d32; }
.role-pharmacie_consultant  { background:#f1f8f1;color:#2e7d32; }
.role-vehicules_gestionnaire{ background:#fff3e0;color:#e65100; }
.role-vehicules_consultant  { background:#fff8f0;color:#e65100; }

/* Settings panel */
.settings-overlay-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 2000; display: flex; align-items: flex-start; justify-content: flex-end; }
.settings-panel { background: white; width: 100%; max-width: 460px; height: 100%; overflow-y: auto; box-shadow: -4px 0 24px rgba(0,0,0,.18); display: flex; flex-direction: column; }
.settings-hdr  { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid #eee; background: #004589; }
.settings-hdr h3 { font-size: 14px; font-weight: 600; color: white; }
.settings-close { background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.3); color: white; width: 28px; height: 28px; border-radius: 6px; cursor: pointer; font-size: 16px; line-height: 1; font-family: inherit; }
.settings-close:hover { background: rgba(255,255,255,.28); }
.settings-body { padding: 18px; flex: 1; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 3000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box { background: white; border-radius: 12px; padding: 22px; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; }
.modal-box h3 { font-size: 15px; font-weight: 600; color: #004589; margin-bottom: 16px; }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* Toast */
.toast { position: fixed; bottom: 20px; right: 20px; background: #222; color: white; padding: 10px 16px; border-radius: 9px; font-size: 13px; opacity: 0; transition: opacity .3s; pointer-events: none; z-index: 9999; max-width: 300px; }
.toast.show  { opacity: 1; }
.toast.error { background: #c0392b; }

/* Misc */
.empty    { font-size: 13px; color: #999; padding: 10px 0; }
.info-box { background: #e6f0ff; border-radius: 9px; padding: 11px 14px; font-size: 13px; color: #004589; margin-bottom: 14px; }
.warn-box { background: #fff3e0; border-radius: 9px; padding: 11px 14px; font-size: 13px; color: #e65100; margin-bottom: 14px; }
.sort-hint { font-size: 11px; color: #999; font-style: italic; padding: 4px 8px 0; }

/* ── Responsive ── */
@media(max-width:900px) {
  .login-left { display: none; }
  .login-right { width: 100%; }
  .portal-grid { grid-template-columns: 1fr 1fr; }
  .portal-bottom { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; }
  .topbar-org { display: none; }
  .portal-body { padding: 24px 16px; }
  .module-body { padding: 14px; }
}
@media(max-width:600px) {
  .portal-grid { grid-template-columns: 1fr; }
  .grid4 { grid-template-columns: 1fr 1fr; gap: 8px; }
  .form-grid { grid-template-columns: 1fr; }
  .nav-btn { padding: 8px 11px; font-size: 12px; }
  .portal-welcome h1 { font-size: 20px; }
}

/* ── Header modules (hdr/body/footer — compatibilité V1 pendant transition) ── */
.hdr { background: #004589; padding: 12px 18px; display: flex; align-items: center; gap: 12px; }
.hdr-logo { flex-shrink: 0; }
.hdr-logo img { height: 48px; object-fit: contain; }
.hdr-title h1 { color: white; font-size: 14px; font-weight: 600; line-height: 1.2; }
.hdr-title p  { color: rgba(255,255,255,0.7); font-size: 11px; }
.hdr-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.role-pill { background: rgba(255,255,255,0.18); color: white; font-size: 11px; padding: 3px 10px; border-radius: 20px; white-space: nowrap; }
.btn-out  { background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.3); color: white; padding: 5px 12px; border-radius: 7px; font-size: 12px; cursor: pointer; font-family: inherit; }
.btn-out:hover { background: rgba(255,255,255,0.22); }
.btn-back { background: transparent; border: none; color: rgba(255,255,255,0.85); font-size: 12px; cursor: pointer; font-family: inherit; padding: 5px 8px; }
.btn-back:hover { color: white; }
.gear-btn { background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.3); color: white; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 17px; display: none; align-items: center; justify-content: center; flex-shrink: 0; font-family: inherit; }
.gear-btn.visible { display: flex; }
.gear-btn:hover { background: rgba(255,255,255,0.28); }
.body { background: white; border: 1px solid #e5e5e5; padding: 20px 18px; min-height: 200px; flex: 1; }
.footer { background: linear-gradient(135deg,#004589 60%,#F08801 100%); padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.footer-logo img { height: 48px; object-fit: contain; }
.footer-credits p { color: rgba(255,255,255,0.5); font-size: 12px; line-height: 1.6; }
.footer-credits strong { color: rgba(255,255,255,0.6); font-weight: 500; }
.app { width: 100%; display: flex; flex-direction: column; min-height: 100vh; }

/* ── Stat chips portail ── */
.stat-chip { font-size: 11px; padding: 3px 8px; border-radius: 20px; font-weight: 600; }
.stat-ok   { background: #ecfdf5; color: #059669; }
.stat-warn { background: #fef3c7; color: #d97706; }
.stat-err  { background: #fef2f2; color: #ef4444; }
.stat-info { background: #eff6ff; color: #004589; }

/* ── Alertes groupées portail ── */
.pa-group { margin-bottom: 14px; }
.pa-group:last-child { margin-bottom: 0; }
.pa-group-label { font-size: 11px; font-weight: 700; color: #9ca3af; text-transform: uppercase; letter-spacing: .8px; margin-bottom: 6px; }
.pa-plus { font-size: 11px; color: #004589; cursor: pointer; padding: 4px 0 0 18px; font-weight: 500; }
.pa-plus:hover { text-decoration: underline; }

/* ── Activité récente portail ── */
.act-avatar { width: 28px; height: 28px; border-radius: 50%; background: #f0f4fa; display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }