/* ==========================================================================
   Lafiya — gestion hospitalière — feuille de style (design Cigaba)
   ========================================================================== */

@view-transition { navigation: auto; }

:root {
  --bg: #FBF5EA;
  --card: #FFFFFF;
  --text: #16201A;
  --muted: #6E7268;
  --line: #E9E0D0;
  --line-strong: #D9CDB5;
  --hover: #F3ECDC;
  --input: #F3ECDC;
  --primary: #0B7838;
  --primary-d: #075C2C;
  --primary-soft: #E2F3E8;
  --accent: #E05000;  --accent-d: #B23F00; --accent-soft: #FDEEE1;
  --green: #1DA55E;   --green-soft: #E3F5E8;
  --red: #E41E3F;     --red-soft: #FDE8EC;
  --amber: #C98A00;   --amber-soft: #FFF3D1;
  --violet: #7B61FF;  --violet-soft: #ECE8FF;
  --teal: #00A5A5;    --teal-soft: #DDF4F4;
  --shadow: 0 1px 2px rgba(0,0,0,.12), 0 0 0 1px rgba(0,0,0,.02);
  --shadow-lg: 0 12px 28px rgba(0,0,0,.18), 0 2px 4px rgba(0,0,0,.1);
  --radius: 16px;
  --top-h: 56px;
  --side-w: 288px;
  --ease: cubic-bezier(.2,.8,.2,1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

:root[data-theme="dark"] {
  --bg: #12160F;
  --card: #1D2317;
  --text: #ECE9E0;
  --muted: #A8AC9A;
  --line: #333A2C;
  --line-strong: #454D3C;
  --hover: #29301F;
  --input: #29301F;
  --primary: #35C073;
  --primary-d: #52D98C;
  --primary-soft: #163420;
  --accent: #FF8A3D; --accent-d: #FFA35C; --accent-soft: #3A2415;
  --green: #3ECB7A;   --green-soft: #1B3A27;
  --red: #FF5A75;     --red-soft: #45222B;
  --amber: #F7B928;   --amber-soft: #43381A;
  --violet: #9B87FF;  --violet-soft: #2D2850;
  --teal: #2CC7C7;    --teal-soft: #17393A;
  --shadow: 0 1px 2px rgba(0,0,0,.5);
  --shadow-lg: 0 12px 28px rgba(0,0,0,.6);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.4;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
  transition: background .25s, color .25s;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
h1 { font-size: 26px; letter-spacing: -.3px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
p { margin: 0 0 8px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: 8px 0; }
button { font: inherit; color: inherit; cursor: pointer; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; justify-content: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.bold { font-weight: 600; }
[hidden] { display: none !important; }
.only-mobile { display: none !important; }
.inline { display: inline; }
.i { flex: none; vertical-align: middle; }
::selection { background: var(--primary-soft); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- Barre de progression de navigation ---------- */
.topbar-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 1000;
  background: linear-gradient(90deg, #0B7838, #E05000, #0B7838); background-size: 200% 100%;
  transition: width .4s var(--ease), opacity .3s; opacity: 0; }
.topbar-progress.run { opacity: 1; animation: slide 1s linear infinite; }
@keyframes slide { to { background-position: -200% 0; } }

/* ---------- Barre du haut ---------- */
.topbar { position: fixed; top: 0; left: 0; right: 0; height: var(--top-h); z-index: 100;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  padding: 0 16px; background: var(--card); box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.tb-left, .tb-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tb-right { justify-content: flex-end; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-size: 20px; letter-spacing: -.3px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand b { color: var(--primary); }
.brand-logo { width: 40px; height: 40px; object-fit: contain; flex: none; transition: transform .4s var(--ease); filter: drop-shadow(0 2px 6px rgba(11,120,56,.25)); }
.brand:hover .brand-logo { transform: rotate(-6deg) scale(1.06); }
.brand-slogan { display: block; font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.brand.big { font-size: 30px; color: var(--text); gap: 16px; } .brand.big b { color: var(--primary); }
.brand.big .brand-logo { width: 72px; height: 72px; }
.search { position: relative; display: flex; align-items: center; margin-left: 4px; }
.search .i { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.search input { width: 240px; height: 40px; border: 0; border-radius: 20px; background: var(--input); color: var(--text);
  padding: 0 14px 0 38px; font: inherit; transition: width .3s var(--ease), box-shadow .2s; }
.search input:focus { width: 300px; outline: none; box-shadow: 0 0 0 2px var(--primary); background: var(--card); }
.tb-tabs { display: flex; gap: 4px; height: 100%; align-items: stretch; }
.tab { position: relative; display: grid; place-items: center; width: 100px; color: var(--muted); border-radius: 8px; margin: 4px 0; transition: background .2s, color .2s; }
.tab:hover { background: var(--hover); text-decoration: none; }
.tab.active { color: var(--primary); background: transparent; }
.tab.active::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -4px; height: 3px; border-radius: 3px 3px 0 0; background: var(--primary); animation: grow-x .35s var(--ease); }
@keyframes grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--text); transition: background .2s, transform .15s; position: relative; }
.icon-btn:hover { background: var(--hover); }
.icon-btn:active { transform: scale(.9); }
.icon-btn.round { width: 40px; height: 40px; background: var(--input); }
.icon-btn.round:hover { background: var(--hover); filter: brightness(.96); }
.icon-btn.danger { color: var(--red); }
.icon-btn.danger:hover { background: var(--red-soft); }
.icon-btn.ok { color: var(--green); }
.icon-btn.ok:hover { background: var(--green-soft); }
.badge-dot { position: absolute; top: -2px; right: -2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff;
  font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--card); animation: pulse 2s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(228,30,63,.5)} 70%{box-shadow:0 0 0 8px rgba(228,30,63,0)} 100%{box-shadow:0 0 0 0 rgba(228,30,63,0)} }
.avatar-btn { border: 0; background: none; padding: 0; border-radius: 50%; transition: transform .15s; }
.avatar-btn:active { transform: scale(.92); }

/* ---------- Menus déroulants ---------- */
.dd-wrap { position: relative; }
.dropdown { position: absolute; right: 0; top: calc(100% + 8px); width: 340px; max-width: calc(100vw - 24px); background: var(--card);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 8px; z-index: 200; transform-origin: top right; animation: pop .22s var(--ease); }
.dropdown.me { width: 320px; }
@keyframes pop { from { opacity: 0; transform: scale(.92) translateY(-6px); } to { opacity: 1; transform: none; } }
.dd-title { font-size: 20px; font-weight: 700; padding: 8px 10px; }
.dd-empty { padding: 20px; text-align: center; color: var(--muted); }
.dd-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 8px; text-align: left; color: var(--text); font-weight: 500; }
.dd-item:hover { background: var(--hover); text-decoration: none; }
.dd-item small { display: block; color: var(--primary); font-weight: 400; font-size: 12px; }
.dd-ico { width: 36px; height: 36px; border-radius: 50%; background: var(--input); display: grid; place-items: center; flex: none; }
.dd-profile { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 8px; color: var(--text); }
.dd-profile:hover { background: var(--hover); text-decoration: none; }
.dd-profile small { display: block; color: var(--muted); font-weight: 400; }
.dropdown form { margin: 0; }

/* ---------- Avatars ---------- */
.avatar { display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 700; object-fit: cover; flex: none; letter-spacing: .3px; }
.avatar.xs { width: 28px; height: 28px; font-size: 11px; }
.avatar.sm { width: 40px; height: 40px; font-size: 14px; }
.avatar.md { width: 44px; height: 44px; font-size: 16px; }
.avatar.lg { width: 72px; height: 72px; font-size: 26px; }
.avatar.xl { width: 128px; height: 128px; font-size: 44px; border: 4px solid var(--card); box-shadow: var(--shadow); }
.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person b { display: block; color: var(--text); }
.person small { color: var(--muted); }

/* ---------- Menu latéral ---------- */
.sidebar { position: fixed; top: var(--top-h); left: 0; bottom: 0; width: var(--side-w); padding: 12px 8px 24px; overflow-y: auto; background: var(--bg); z-index: 90; transition: transform .35s var(--ease); }
.sb-school { display: flex; align-items: center; gap: 12px; padding: 10px; margin-bottom: 4px; border-radius: 12px; background: var(--card); box-shadow: var(--shadow); }
.sb-school small { display: block; color: var(--muted); }
.sb-school b { display: block; line-height: 1.2; }
.sb-group { padding: 16px 10px 6px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }
.sb-link { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 8px; color: var(--text); font-weight: 500; position: relative; transition: background .15s, transform .15s; }
.sb-link:hover { background: var(--hover); text-decoration: none; transform: translateX(2px); }
.sb-ico { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--card); color: var(--primary); box-shadow: var(--shadow); transition: background .2s, color .2s, transform .25s var(--ease); }
.sb-link:hover .sb-ico { transform: scale(1.08) rotate(-4deg); }
.sb-link.active { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.sb-link.active .sb-ico { background: var(--primary); color: #fff; }
.sb-foot { padding: 20px 10px; color: var(--muted); font-size: 12px; }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity .3s; z-index: 80; }
.scrim.show { opacity: 1; pointer-events: auto; }

/* ---------- Contenu ---------- */
.main { margin-left: var(--side-w); padding: calc(var(--top-h) + 24px) 28px 56px; min-height: 100vh; }
.main > * { max-width: 1120px; margin-left: auto; margin-right: auto; }
.main > .reveal, .main > .card { animation: fadeUp .5s var(--ease) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.reveal { animation: fadeUp .55s var(--ease) both; animation-delay: calc(var(--i, 0) * 55ms); }
body.leaving .main { opacity: .55; transform: scale(.996); transition: opacity .2s, transform .2s; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Cartes ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; transition: box-shadow .25s, transform .25s var(--ease), background .25s; }
.card.flush { padding: 0; overflow: hidden; }
.card.hover:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-h h2, .card-h h3 { font-size: 17px; }
.card-b { padding: 20px; }
.card > h2, .card > h3 { margin-bottom: 12px; }
.pop { animation: pop-in .5s var(--ease) both; }
@keyframes pop-in { from { opacity: 0; transform: scale(.94) translateY(12px); } to { opacity: 1; transform: none; } }

.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.grid > .card { margin-bottom: 0; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.split > div > .card:last-child { margin-bottom: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.gap-s { gap: 6px; }

/* ---------- Statistiques ---------- */
.stat { display: flex; align-items: center; gap: 14px; padding: 18px; }
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-ico { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; flex: none; transition: transform .35s var(--ease); }
.stat:hover .stat-ico { transform: scale(1.1) rotate(-6deg); }
.stat-ico.blue { background: var(--primary-soft); color: var(--primary); }
.stat-ico.green { background: var(--green-soft); color: var(--green); }
.stat-ico.red { background: var(--red-soft); color: var(--red); }
.stat-ico.amber { background: var(--amber-soft); color: var(--amber); }
.stat-ico.violet { background: var(--violet-soft); color: var(--violet); }
.stat-ico.teal { background: var(--teal-soft); color: var(--teal); }
.stat-label { color: var(--muted); font-size: 13px; font-weight: 500; }
.stat-value { font-size: 26px; font-weight: 800; letter-spacing: -.5px; line-height: 1.15; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- Boutons ---------- */
.btn { position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border: 0; border-radius: 10px;
  font-weight: 600; font-size: 15px; background: var(--input); color: var(--text); transition: background .2s, transform .15s, box-shadow .2s; white-space: nowrap; }
.btn:hover { background: var(--hover); filter: brightness(.97); text-decoration: none; }
.btn:active { transform: scale(.96); }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-d); filter: none; box-shadow: 0 4px 14px rgba(11,120,56,.35); }
.btn.green { background: var(--green); color: #fff; }
.btn.accent { background: var(--accent); color: #fff; }
.btn.accent:hover { background: var(--accent-d); filter: none; box-shadow: 0 4px 14px rgba(224,80,0,.35); }
.btn.danger { background: var(--red-soft); color: var(--red); }
.btn.danger:hover { background: var(--red); color: #fff; }
.btn.ghost { background: transparent; color: var(--primary); }
.btn.ghost:hover { background: var(--primary-soft); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 14px; }
.btn.lg { height: 48px; font-size: 17px; border-radius: 14px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .6; pointer-events: none; }
.ripple { position: absolute; border-radius: 50%; background: rgba(255,255,255,.45); transform: scale(0); animation: ripple .6s linear; pointer-events: none; }
.btn:not(.primary):not(.green) .ripple { background: rgba(120,120,120,.25); }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--input); color: var(--muted); white-space: nowrap; }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.blue { background: var(--primary-soft); color: var(--primary); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }

/* ---------- Formulaires ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field label { font-weight: 600; font-size: 14px; }
.field label i { color: var(--red); font-style: normal; }
input, select, textarea { font: inherit; color: var(--text); }
.field input, .field select, .field textarea, .toolbar input, .toolbar select, .cell-input {
  width: 100%; min-height: 42px; padding: 9px 12px; border: 1.5px solid var(--line-strong); border-radius: 10px; background: var(--card); transition: border-color .2s, box-shadow .2s; }
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .toolbar input:focus, .toolbar select:focus, .cell-input:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.field input[type=file] { padding: 8px; }
.login-card .field input { border-color: var(--line-strong); }
.login-card .field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.help { color: var(--muted); font-size: 12px; }
.combo { position: relative; }
.combo input { padding-right: 34px; }
.combo-arrow { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--muted); font-size: 11px; }
.combo-arrow::before { content: '▾'; }
.combo-menu { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px); max-height: min(240px, 50vh); overflow-y: auto; -webkit-overflow-scrolling: touch; background: var(--card);
  border: 1.5px solid var(--line-strong); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.14); padding: 6px; margin: 0; list-style: none; }
.combo-menu li { padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.combo-menu li:hover, .combo-menu li.active { background: var(--primary-soft); color: var(--primary); }
:root[dir="rtl"] .combo-arrow { right: auto; left: 12px; }
:root[dir="rtl"] .combo input { padding-right: 12px; padding-left: 34px; }
/* Cibles tactiles plus grandes sur mobile et tablette (écran tactile, quelle que soit la largeur) */
@media (hover: none), (pointer: coarse) {
  .combo-menu { max-height: min(280px, 55vh); padding: 4px; }
  .combo-menu li { min-height: 44px; display: flex; align-items: center; padding: 10px 12px; font-size: 15px; }
  .combo-arrow { right: 10px; font-size: 13px; }
}
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; }
.span2 { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 8px; flex-wrap: wrap; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.toolbar > * { flex: 0 1 auto; }
.toolbar input, .toolbar select { width: auto; min-width: 150px; }
.toolbar .grow { flex: 1 1 200px; }
.pw { position: relative; }
.pw input { padding-right: 44px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: 0; background: none; border-radius: 50%; color: var(--muted); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; min-height: 0; accent-color: var(--primary); }
.photo-pick { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }

/* ---------- Alertes ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-weight: 500; }
.alert.error { background: var(--red-soft); color: var(--red); }
.alert.success { background: var(--green-soft); color: var(--green); }
.alert.info { background: var(--primary-soft); color: var(--primary); }
.alert.warn { background: var(--amber-soft); color: var(--amber); }
.shake { animation: shake .45s; }
@keyframes shake { 20%,60% { transform: translateX(-6px); } 40%,80% { transform: translateX(6px); } }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: var(--hover); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.actions, .table th.actions { text-align: right; white-space: nowrap; }
.table td.actions form, .table td.actions a { display: inline-flex; }
.table tr.total td { font-weight: 800; background: var(--input); }
.table tbody tr { animation: fadeUp .45s var(--ease) both; animation-delay: calc(var(--r, 0) * 25ms); }

/* ---------- Pagination ---------- */
.pager { display: flex; gap: 6px; justify-content: center; padding: 16px; }
.page-link { min-width: 36px; height: 36px; display: grid; place-items: center; padding: 0 10px; border-radius: 8px; background: var(--input); color: var(--text); font-weight: 600; transition: background .15s, transform .15s; }
.page-link:hover { background: var(--hover); text-decoration: none; transform: translateY(-1px); }
.page-link.active { background: var(--primary); color: #fff; }
.page-link.disabled { opacity: .4; pointer-events: none; }

/* ---------- Onglets / puces ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip { padding: 8px 16px; border-radius: 99px; background: var(--card); color: var(--text); font-weight: 600; box-shadow: var(--shadow); transition: background .2s, color .2s, transform .15s; }
.chip:hover { background: var(--hover); text-decoration: none; transform: translateY(-1px); }
.chip.active { background: var(--primary); color: #fff; }

/* ---------- Listes ---------- */
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); transition: background .15s; }
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--hover); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item small { color: var(--muted); display: block; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; margin: 0; }
.kv dt { color: var(--muted); font-weight: 500; }
.kv dd { margin: 0; font-weight: 500; word-break: break-word; }

/* ---------- Profil ---------- */
.cover { height: 150px; border-radius: var(--radius) var(--radius) 0 0; background: linear-gradient(120deg, var(--primary-d), var(--primary) 55%, var(--accent)); position: relative; overflow: hidden; }
.cover::before, .cover::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255,255,255,.12); animation: float 9s ease-in-out infinite; }
.cover::before { width: 220px; height: 220px; right: -40px; top: -80px; }
.cover::after { width: 140px; height: 140px; left: 20%; bottom: -70px; animation-delay: -4s; }
.profile-head { display: flex; gap: 20px; align-items: flex-end; padding: 0 24px 20px; margin-top: -48px; position: relative; flex-wrap: wrap; }
.profile-head h1 { font-size: 28px; }
.profile-head .grow { flex: 1; min-width: 200px; padding-bottom: 6px; }

/* ---------- Annonces (fil) ---------- */
.post { padding: 0; }
.post-h { display: flex; gap: 12px; align-items: center; padding: 16px 20px 8px; }
.post-h small { color: var(--muted); display: block; }
.post-b { padding: 4px 20px 18px; white-space: pre-line; }
.post-b h3 { margin-bottom: 6px; }

/* ---------- Barres, anneaux, progression ---------- */
.progress { height: 8px; border-radius: 99px; background: var(--input); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--primary-d), var(--primary)); width: 0; transition: width 1.1s var(--ease); }
.progress.green > i { background: linear-gradient(90deg, #1DA55E, #6BD27E); }
.progress.red > i { background: linear-gradient(90deg, #E41E3F, #FF7B93); }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding-top: 24px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; min-width: 0; }
.bar > i { display: block; width: 100%; max-width: 44px; border-radius: 8px 8px 0 0; background: linear-gradient(180deg, var(--primary), var(--primary-d)); transform-origin: bottom; animation: grow .9s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms); position: relative; min-height: 3px; }
.bar > i::before { content: attr(data-v); position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.bar > span { font-size: 11px; color: var(--muted); text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.ring { position: relative; width: 120px; height: 120px; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; stroke-linecap: round; }
.ring .bg { stroke: var(--input); }
.ring .fg { stroke: var(--primary); stroke-dasharray: 314; stroke-dashoffset: 314; transition: stroke-dashoffset 1.4s var(--ease); }
.ring.good .fg { stroke: var(--green); } .ring.bad .fg { stroke: var(--red); } .ring.mid .fg { stroke: var(--amber); }
.ring .val { position: absolute; inset: 0; display: grid; place-items: center; font-size: 24px; font-weight: 800; }
.ring .val small { font-size: 11px; color: var(--muted); display: block; text-align: center; font-weight: 500; margin-top: -4px; }

/* ---------- Bulletin / reçu (impression) ---------- */
.paper { background: #fff; color: #111; border-radius: 6px; box-shadow: var(--shadow); padding: 28px 32px; margin: 0 auto 20px; max-width: 900px; }
:root[data-theme="dark"] .paper { box-shadow: 0 0 0 1px #555; }
.paper h1, .paper h2, .paper h3 { color: #111; }
.paper-head { display: flex; justify-content: space-between; gap: 16px; border-bottom: 3px double #0B7838; padding-bottom: 12px; margin-bottom: 14px; align-items: center; }
.paper-head .l { font-size: 13px; line-height: 1.5; }
.paper-head .c { text-align: center; }
.paper-head .c h1 { font-size: 22px; text-transform: uppercase; letter-spacing: 1px; }
.paper table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.paper th, .paper td { border: 1px solid #b9bec7; padding: 6px 8px; }
.paper th { background: #eaf2ff; text-align: center; color: #0b3d91; }
.paper td.c { text-align: center; }
.paper .sum { background: #f4f6fa; font-weight: 700; }
.paper .sign { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-top: 24px; text-align: center; font-size: 13px; min-height: 90px; }
.paper .meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 20px; margin-bottom: 12px; font-size: 14px; }
.paper .box { border: 1px solid #b9bec7; border-radius: 6px; padding: 10px 12px; margin-top: 12px; font-size: 14px; }
.paper .logo { width: 64px; height: 64px; object-fit: contain; }
.receipt { max-width: 560px; }
.receipt-duo { display: flex; flex-direction: column; }
.receipt-copy { padding-bottom: 4px; }
.receipt-copy-label { text-align: center; font-size: 11px; color: #777; text-transform: uppercase; letter-spacing: .5px; margin-top: 8px; }
.receipt-cut { text-align: center; margin: 18px 0; border-top: 1px dashed #b9bec7; position: relative; }
.receipt-cut span { position: relative; top: -9px; background: #fff; padding: 0 10px; color: #999; font-size: 11px; letter-spacing: .3px; }

/* ---------- Reçu compact pour imprimante Bluetooth thermique (58/80 mm) ---------- */
.receipt-thermal { font-family: 'Courier New', ui-monospace, monospace; font-size: 12.5px; line-height: 1.5; padding: 14px; }
.receipt-thermal.w80 { max-width: 320px; page: thermal80; }
.receipt-thermal.w58 { max-width: 230px; font-size: 11.5px; page: thermal58; }
.receipt-thermal .rt-c { text-align: center; }
.receipt-thermal .rt-sep { border-top: 1px dashed #777; margin: 8px 0; }
.receipt-thermal .rt-row { display: flex; justify-content: space-between; gap: 10px; padding: 1px 0; }
.receipt-thermal .rt-row span { color: #555; }
.receipt-thermal .rt-row b { text-align: right; }
.receipt-thermal .rt-total { font-size: 14px; }
.receipt-thermal .rt-note { font-size: 11px; color: #333; }
@page thermal80 { size: 80mm auto; margin: 3mm; }
@page thermal58 { size: 58mm auto; margin: 2mm; }

/* ---------- États vides ---------- */
.empty { text-align: center; padding: 48px 24px; }
.empty-ico { width: 84px; height: 84px; margin: 0 auto 14px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; animation: float 4s ease-in-out infinite; }
.empty p { color: var(--muted); max-width: 420px; margin: 8px auto 16px; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* ---------- Toasts & modales ---------- */
.toasts { position: fixed; left: 20px; bottom: 20px; z-index: 500; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 12px; min-width: 260px; max-width: 420px; padding: 14px 16px; border-radius: 12px; background: #242526; color: #fff; box-shadow: var(--shadow-lg);
  pointer-events: auto; animation: toast-in .45s var(--ease) both; border-left: 5px solid var(--primary); }
.toast.success { border-color: #45BD62; } .toast.error { border-color: #FF5A75; } .toast.warn { border-color: #F7B928; }
.toast.out { animation: toast-out .3s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(-40px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(-30px); } }
.modal-root { position: fixed; inset: 0; z-index: 600; display: grid; place-items: center; padding: 16px; background: rgba(0,0,0,.55); animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--card); border-radius: 16px; padding: 24px; width: 100%; max-width: 420px; box-shadow: var(--shadow-lg); animation: pop-in .3s var(--ease); }
.modal h3 { margin-bottom: 8px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ---------- Navigation mobile ---------- */
.bottom-nav { display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 100; background: var(--card); border-top: 1px solid var(--line);
  border-radius: 18px 18px 0 0; box-shadow: 0 -4px 16px rgba(0,0,0,.08); padding-bottom: env(safe-area-inset-bottom); }
.bn-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 2px 6px; border: 0; background: none; color: var(--muted); font-size: 11px; font-weight: 600; position: relative; }
.bn-item:hover { text-decoration: none; }
.bn-item.active { color: var(--primary); }
.bn-item.active svg { background: var(--primary-soft); border-radius: 10px; padding: 3px; box-sizing: content-box; margin-top: -3px; }
.bn-item.active::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); animation: grow-x .35s var(--ease); }
.bn-item:active svg { transform: scale(.82); }
.bn-item svg { transition: transform .15s; }

/* ---------- Connexion ---------- */
body.bare { background: var(--card); }
.bare-main { min-height: 100vh; }
.login-wrap { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.login-art { position: relative; overflow: hidden; background: linear-gradient(160deg, #FFF9EE 0%, #FBEEDF 48%, #E7F5EB 100%); color: var(--text); display: flex; align-items: center; padding: 48px; }
.blob { position: absolute; border-radius: 50%; filter: blur(2px); opacity: .25; background: var(--primary); animation: float 10s ease-in-out infinite; }
.blob.b1 { width: 360px; height: 360px; left: -140px; top: -120px; background: var(--primary); opacity: .1; }
.blob.b2 { width: 240px; height: 240px; right: -40px; bottom: -60px; animation-delay: -3s; background: var(--accent); opacity: .12; }
.art-inner { position: relative; max-width: 480px; animation: fadeUp .8s var(--ease) both; }
.art-inner h2 { font-size: 34px; margin: 28px 0 12px; letter-spacing: -.5px; color: var(--text); }
.art-inner p { font-size: 17px; opacity: .8; }
.art-list { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 12px; }
.art-list li { display: flex; gap: 10px; align-items: center; font-weight: 500; animation: fadeUp .7s var(--ease) both; }
.art-list li .i { color: var(--primary); }
.art-list li:nth-child(1){animation-delay:.3s}.art-list li:nth-child(2){animation-delay:.4s}.art-list li:nth-child(3){animation-delay:.5s}.art-list li:nth-child(4){animation-delay:.6s}
.login-panel { display: grid; place-items: center; padding: 32px 20px; background: var(--bg); }
.login-card { width: 100%; max-width: 420px; padding: 32px 28px; }
.login-card h1 { margin: 12px 0 4px; text-align: center; }
.login-card .muted { text-align: center; margin-bottom: 20px; }
.login-card .brand.center { display: flex; margin: 0 auto; width: fit-content; }

/* ---------- Installation PWA : écran de démarrage ---------- */
.splash { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; background: linear-gradient(160deg, #0A6A32, #0B7838 55%, #0E8E45); color: #fff; transition: opacity .5s, visibility .5s; }
.splash.hide { opacity: 0; visibility: hidden; }
.splash .logo { width: 112px; height: 112px; display: grid; place-items: center; animation: splash-pop 1s var(--ease) both; margin: 0 auto 16px; }
.splash .logo img { width: 100%; height: 100%; object-fit: contain; }
.splash b { display: block; text-align: center; font-size: 26px; letter-spacing: -.3px; animation: fadeUp .8s .2s var(--ease) both; }
.splash small { display: block; text-align: center; font-size: 14px; opacity: .85; margin-top: 2px; animation: fadeUp .8s .3s var(--ease) both; }
@keyframes splash-pop { from { transform: scale(.4) rotate(-20deg); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Impression ---------- */
@media print {
  .topbar, .sidebar, .bottom-nav, .toasts, .scrim, .page-head, .no-print, .topbar-progress { display: none !important; }
  body { background: #fff; }
  .main { margin: 0; padding: 0; }
  .paper { box-shadow: none; border-radius: 0; margin: 0; padding: 0; max-width: none; page-break-after: always; }
  .paper:last-child { page-break-after: auto; }
  .paper.receipt-thermal { padding: 2mm; }
  .card { box-shadow: none; }
  * { animation: none !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .tab { width: 72px; }
  .search input { width: 200px; }
}
@media (max-width: 1099px) {
  .only-mobile { display: inline-grid !important; }
  .sidebar { transform: translateX(-102%); width: min(320px, 86vw); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .brand-text { display: none; }
  .topbar { grid-template-columns: auto 1fr auto; }
  .tb-tabs { justify-content: center; }
}
@media (max-width: 899px) {
  .tb-tabs, .search { display: none; }
  .topbar { grid-template-columns: 1fr auto; padding: 0 10px; }
  .brand-text { display: inline; font-size: 18px; }
  .bottom-nav { display: flex; }
  .main { padding: calc(var(--top-h) + 16px) 14px calc(80px + env(safe-area-inset-bottom)); }
  .toasts { left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }
  .split { grid-template-columns: 1fr; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  h1 { font-size: 22px; }
}
@media (max-width: 719px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-panel { background: linear-gradient(160deg, #FFF9EE 0%, #F2F8F1 100%); min-height: 100vh; }
  .login-card .only-mobile { display: flex !important; }
  .brand-text { display: inline; }
}
@media (max-width: 639px) {
  .g2, .g3 { grid-template-columns: 1fr; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-value { font-size: 22px; }
  .form-grid { grid-template-columns: 1fr; }
  .combo input { font-size: 16px; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dt { margin-top: 8px; font-size: 12px; text-transform: uppercase; }
  .page-head { align-items: flex-start; }
  .card { padding: 16px; }
  .card-h, .toolbar { padding: 12px 16px; }
  .toolbar input, .toolbar select { width: 100%; }
  .toolbar > * { flex: 1 1 100%; }
  .profile-head { padding: 0 16px 16px; }
  .paper { padding: 16px; }
  .table.stack thead { display: none; }
  .table.stack, .table.stack tbody, .table.stack tr, .table.stack td { display: block; width: 100%; }
  .table.stack tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .table.stack td { padding: 4px 0; border: 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table.stack td::before { content: attr(data-label); color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; text-align: left; flex: none; padding-top: 2px; }
  .table.stack td.main-cell { display: block; text-align: left; padding-bottom: 8px; }
  .table.stack td.main-cell::before { display: none; }
  .table.stack td.actions { justify-content: flex-end; padding-top: 8px; }
  .table.stack td.actions::before { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

.stat-value{white-space:nowrap}
@media(max-width:600px){.grid.g4{grid-template-columns:1fr 1fr!important;gap:10px}}
@media(prefers-reduced-motion:reduce){@view-transition{navigation:none}}

/* ---------- Robustesse responsive (mobile / tablette) ---------- */
html, body { max-width: 100%; overflow-x: clip; }
.main, .main > *, .card, .grid > *, .stat > div { min-width: 0; }
.stat > div:last-child { flex: 1; min-width: 0; }
.stat-value { white-space: normal; overflow-wrap: anywhere; font-size: clamp(17px, 2.1vw + 11px, 26px); }
.stat-label, .stat-sub { overflow-wrap: anywhere; }
img, svg, video, canvas { max-width: 100%; }
img { height: auto; }
input, select, textarea { max-width: 100%; }
pre, code { overflow-x: auto; max-width: 100%; }
.card h1, .card h2, .card h3, .page-head h1, .page-head p, td, th { overflow-wrap: anywhere; }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 639px) {
  .stat { padding: 12px; gap: 10px; }
  .stat-ico { width: 40px; height: 40px; border-radius: 50%; }
  .stat-ico svg { width: 20px; height: 20px; }
  .stat-label { font-size: 12px; }
  .card { padding-left: 14px; padding-right: 14px; }
  .btn { white-space: normal; }
}
@media (max-width: 380px) { .grid.g4 { grid-template-columns: 1fr !important; } }

/* ---------- Messages parents ---------- */
.msg-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.btn.wa { background: #25d366; border-color: #25d366; color: #fff; }
.btn.wa:hover { background: #1fb457; }
@media (max-width: 719px) { .msg-actions { justify-content: flex-start; } }

.wz { position: fixed; inset: 0; background: rgba(10,20,40,.55); display: grid; place-items: center; z-index: 200; padding: 16px; }
.wz[hidden] { display: none; }
.wz-box { background: var(--card, #fff); border-radius: 16px; padding: 20px; width: min(480px, 100%); max-height: 92vh; overflow: auto; box-shadow: 0 20px 50px rgba(0,0,0,.35); }
.wz-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.wz-msg { white-space: pre-wrap; font: inherit; background: var(--input, #f1f4f9); border-radius: 12px; padding: 12px; margin: 12px 0; max-height: 34vh; overflow: auto; }
.wz-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.wz-actions .btn.wa { flex: 1; justify-content: center; }

/* ---------- Statistiques & graphiques ---------- */
.hbars { display: grid; gap: 10px; }
.hb { display: grid; grid-template-columns: minmax(80px, 150px) 1fr 62px; align-items: center; gap: 10px; font-size: 14px; }
.hb-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-t { height: 14px; background: var(--input); border-radius: 8px; overflow: hidden; display: block; }
.hb-t i { display: block; height: 100%; border-radius: 8px; background: var(--primary); transition: width .6s var(--ease); }
.hb-t i.green { background: var(--green); } .hb-t i.red { background: var(--red); } .hb-t i.amber { background: var(--amber); } .hb-t i.violet { background: var(--violet); }
.hb-v { text-align: right; }
.hist { display: flex; align-items: flex-end; gap: 8px; height: 190px; padding-top: 6px; }
.hi { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; font-size: 12px; }
.hi i { display: block; width: 100%; max-width: 46px; border-radius: 8px 8px 0 0; background: var(--primary); }
.hi i.green { background: var(--green); } .hi i.red { background: var(--red); } .hi i.amber { background: var(--amber); }
.hi span { color: var(--muted); font-size: 11px; white-space: nowrap; }
.lchart { width: 100%; height: auto; display: block; }
.lc-grid { stroke: var(--line); stroke-width: 1; }
.lc-ref { stroke: var(--red); stroke-width: 1.5; stroke-dasharray: 5 4; }
.lc-t { fill: var(--muted); font-size: 11px; }
.lc-v { font-size: 11px; font-weight: 700; }
.lc-leg { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 6px; }
.lc-leg i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.lc-leg i.ref { background: none; border-top: 2px dashed var(--red); border-radius: 0; height: 0; width: 16px; vertical-align: 3px; }
@media (max-width: 520px) { .hb { grid-template-columns: 90px 1fr 54px; font-size: 13px; } }

/* v2.6 — comptes par téléphone */
.stat-mini { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat-mini b { font-size: 22px; margin-right: 6px; }

/* Onglets de la console plateforme */
.pf-tabs { min-width: 0; max-width: 100%; display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin: 0 0 14px; scrollbar-width: thin; }
.pf-tabs a { flex: 0 0 auto; padding: 8px 14px; border-radius: 999px; color: var(--muted); font-weight: 600; white-space: nowrap; background: var(--hover); }
.pf-tabs a:hover { text-decoration: none; color: var(--text); }
.pf-tabs a.active { color: #fff; background: var(--primary); }

/* ---- Console super-administrateur ---- */
.console-pill { display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: #fff; background: linear-gradient(135deg, #E05000, #0B2A1C); vertical-align: middle; }
body.app .console-pill { line-height: 1.4; }
.console-login .login-art { background: linear-gradient(160deg, #0B2A1C 0%, #0B7838 70%, #E05000 130%); color: #fff; }
.console-login .login-art .art-inner h2, .console-login .login-art .art-inner p, .console-login .login-art .brand.big b { color: #fff; }
.console-login .login-art .brand-slogan { color: rgba(255,255,255,.75); }
.console-login .login-art .art-list li .i { color: #fff; }
.console-login .login-art .blob { background: #fff; opacity: .1; }
.hbars .hb-l { min-width: 0; }
@media (max-width: 640px) { .console-pill { display: none; } }

/* ---- Sélecteur de langue (pages publiques : connexion, inscription) ---- */
.lang-switch { display: flex; justify-content: flex-end; gap: 4px; margin-bottom: 10px; }
.lang-switch a { padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--muted); background: var(--card); box-shadow: var(--shadow); text-decoration: none; letter-spacing: .4px; }
.lang-switch a:hover { color: var(--primary); text-decoration: none; }
.lang-switch a.active { color: #fff; background: var(--primary); }
:root[dir="rtl"] .lang-switch { justify-content: flex-start; }

/* ---- Sélecteur de langue dans le menu « Mon compte » (une fois connecté) ---- */
.dd-item.dd-lang { cursor: default; }
.dd-item.dd-lang:hover { background: none; }
.dd-lang-opts { display: flex; gap: 4px; margin-left: auto; }
.dd-lang-opts a { padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; color: var(--muted); background: var(--input); text-decoration: none; letter-spacing: .3px; }
.dd-lang-opts a:hover { color: var(--primary); text-decoration: none; }
.dd-lang-opts a.active { color: #fff; background: var(--primary); }
:root[dir="rtl"] .dd-lang-opts { margin-left: 0; margin-right: auto; }

/* ---- Assistant d'aide intégré (bulle flottante + panneau de discussion) ---- */
.assist-float { position: fixed; right: 20px; bottom: 20px; z-index: 150; width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--primary); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 18px rgba(0,0,0,.25); transition: transform .2s, box-shadow .2s; }
.assist-float:hover { transform: scale(1.08); box-shadow: 0 8px 22px rgba(0,0,0,.3); }
.assist-float:active { transform: scale(.94); }
body.app .assist-float { bottom: calc(88px + env(safe-area-inset-bottom)); }
@media (min-width: 720px) { body.app .assist-float { bottom: 24px; } }
.assist-panel { position: fixed; right: 20px; bottom: 84px; z-index: 151; width: min(360px, calc(100vw - 32px)); height: min(480px, calc(100vh - 220px));
  background: var(--card); border-radius: 16px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line);
  animation: pop-in .25s var(--ease); }
body.app .assist-panel { bottom: calc(152px + env(safe-area-inset-bottom)); }
@media (min-width: 720px) { body.app .assist-panel { bottom: 84px; } }
.assist-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; background: var(--primary); color: #fff; font-weight: 700; font-size: 14px; }
.assist-head .icon-btn { color: #fff; }
.assist-body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.assist-msg { max-width: 85%; padding: 9px 12px; border-radius: 12px; font-size: 13.5px; line-height: 1.45; white-space: pre-wrap; }
.assist-msg.bot { align-self: flex-start; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-bottom-left-radius: 2px; }
.assist-msg.me { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 2px; }
.assist-msg.typing { color: var(--muted); font-weight: 700; letter-spacing: 2px; }
.assist-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.assist-form input { flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font-size: 14px; background: var(--card); color: var(--text); }
.assist-form .btn { padding: 0 14px; }
@media print { .assist-float, .assist-panel { display: none !important; } }
@media (max-width: 420px) { .assist-panel { right: 16px; width: calc(100vw - 32px); } .assist-float { right: 16px; } }

/* ---- RTL (arabe) : miroir du chrome principal (barre latérale, barre du haut, navigation) ----
   Volontairement limité à la navigation partagée et aux composants génériques ; les écrans
   métier (tableaux de données, bulletins imprimés .bs-*…) gardent leur mise en page actuelle. */
:root[dir="rtl"] { direction: rtl; }
:root[dir="rtl"] .sidebar { left: auto; right: 0; }
:root[dir="rtl"] .main { margin-left: 0; margin-right: var(--side-w); }
:root[dir="rtl"] .sb-link:hover { transform: translateX(-2px); }
:root[dir="rtl"] .sb-link.active { border-left: 0; }
:root[dir="rtl"] .search { margin-left: 0; margin-right: 4px; }
:root[dir="rtl"] .search .i { left: auto; right: 12px; }
:root[dir="rtl"] .search input { padding: 0 38px 0 14px; }
:root[dir="rtl"] .dropdown { right: auto; left: 0; }
:root[dir="rtl"] .badge-dot { right: auto; left: -2px; }
:root[dir="rtl"] .dd-item { text-align: right; }
:root[dir="rtl"] .pw input { padding-right: 0; padding-left: 44px; }
:root[dir="rtl"] .pw-toggle { right: auto; left: 4px; }
:root[dir="rtl"] .toasts { left: auto; right: 20px; }
:root[dir="rtl"] .toast { border-left: 0; border-right: 5px solid var(--primary); }
:root[dir="rtl"] .table th, :root[dir="rtl"] .table td { text-align: right; }
:root[dir="rtl"] .table td.actions, :root[dir="rtl"] .table th.actions { text-align: left; }
:root[dir="rtl"] .assist-float { right: auto; left: 20px; }
:root[dir="rtl"] .assist-panel { right: auto; left: 20px; }
@media (max-width: 1099px) {
  :root[dir="rtl"] .sidebar { transform: translateX(102%); }
  :root[dir="rtl"] .main { margin-right: 0; }
}

/* ==========================================================================
   Lafiya — composants propres à la gestion hospitalière, dans le style Cigaba
   (mêmes variables, rayons, ombres et animations que la base ci-dessus)
   ========================================================================== */

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.req, .field label i { color: var(--red); font-style: normal; }
.bad { color: var(--red); font-weight: 700; }
.good { color: var(--green); font-weight: 600; }
.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.strike td { text-decoration: line-through; opacity: .6; }
.w-sm { width: 90px !important; min-width: 0 !important; }
.rowlink { cursor: pointer; }

/* ---------- En-têtes, actions, sections ---------- */
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.section-title { margin: 26px 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 700; }
.section-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.quick { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.quick .btn { height: 42px; }
.chip-link { padding: 7px 14px; border-radius: 99px; background: var(--card); color: var(--text); font-weight: 600; font-size: 13px; box-shadow: var(--shadow); transition: background .2s, transform .15s; }
.chip-link:hover { background: var(--hover); text-decoration: none; transform: translateY(-1px); }
.btn.success { background: var(--green); color: #fff; }
.btn.success:hover { filter: brightness(.95); }
.btn.small { height: 32px; padding: 0 12px; font-size: 14px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.row-actions { white-space: nowrap; }
.row-actions > * { margin: 2px; }
form.inline { display: inline; }
.inline-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline-form input, .inline-form select { width: auto; min-height: 36px; padding: 6px 10px; border: 1.5px solid var(--line-strong); border-radius: 10px; background: var(--card); }

/* ---------- Cartes ---------- */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; font-size: 17px; }
.card.narrow { max-width: 680px; }
.card h3 { margin: 16px 0 8px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card.table-wrap { padding: 0; overflow-x: auto; }
.card.table-wrap > h2 { padding: 16px 20px 6px; margin: 0; font-size: 17px; }
.card.table-wrap > .empty, .card.table-wrap > .alert, .card.table-wrap > form, .card.table-wrap > details, .card.table-wrap > p, .card.table-wrap > .hbars { margin: 12px 20px; }
.grid-dash { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.grid-dash > .card { margin: 0; }
.grid-2col { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; margin-bottom: 16px; }
.grid-2col > .card, .grid-2col > section { margin-bottom: 0; }

/* ---------- Indicateurs (même rendu que les cartes statistiques Cigaba) ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 16px; }
.kpi { display: flex; align-items: center; gap: 14px; padding: 18px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text);
  transition: box-shadow .25s, transform .25s var(--ease); animation: fadeUp .5s var(--ease) both; min-width: 0; }
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); text-decoration: none; }
.kpi > div { min-width: 0; flex: 1; }
.kpi small { display: block; color: var(--muted); font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.kpi strong { display: block; font-size: clamp(17px, 2.1vw + 11px, 26px); font-weight: 800; letter-spacing: -.5px; line-height: 1.15; overflow-wrap: anywhere; }
.kpi-ic { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--primary-soft); color: var(--primary); transition: transform .35s var(--ease); }
.kpi:hover .kpi-ic { transform: scale(1.1) rotate(-6deg); }
.kpis > :nth-child(6n+2) .kpi-ic { background: var(--green-soft); color: var(--green); }
.kpis > :nth-child(6n+3) .kpi-ic { background: var(--amber-soft); color: var(--amber); }
.kpis > :nth-child(6n+4) .kpi-ic { background: var(--violet-soft); color: var(--violet); }
.kpis > :nth-child(6n+5) .kpi-ic { background: var(--teal-soft); color: var(--teal); }
.kpis > :nth-child(6n+6) .kpi-ic { background: var(--red-soft); color: var(--red); }
.kpis > :nth-child(1) { animation-delay: 0ms; } .kpis > :nth-child(2) { animation-delay: 55ms; } .kpis > :nth-child(3) { animation-delay: 110ms; }
.kpis > :nth-child(4) { animation-delay: 165ms; } .kpis > :nth-child(5) { animation-delay: 220ms; } .kpis > :nth-child(6) { animation-delay: 275ms; }

/* ---------- Onglets (pastilles, comme la console Cigaba) ---------- */
.tabs { min-width: 0; max-width: 100%; display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin: 0 0 16px; scrollbar-width: thin; }
.tabs a { flex: 0 0 auto; padding: 8px 16px; border-radius: 999px; color: var(--text); font-weight: 600; white-space: nowrap; background: var(--card); box-shadow: var(--shadow); transition: background .2s, color .2s, transform .15s; }
.tabs a:hover { text-decoration: none; background: var(--hover); transform: translateY(-1px); }
.tabs a.active { color: #fff; background: var(--primary); }

/* ---------- Filtres ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; padding: 12px 14px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.filters input, .filters select { min-height: 40px; padding: 8px 12px; border: 1.5px solid var(--line-strong); border-radius: 10px; background: var(--card); color: var(--text); width: auto; }
.filters input:focus, .filters select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.filters input[type="search"] { flex: 1 1 220px; max-width: 460px; }
.filters label { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); font-weight: 500; }
.filters .check { color: var(--text); }

/* ---------- Grilles de formulaire ---------- */
.grid2, .grid3, .grid4 { display: grid; column-gap: 16px; }
.grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.full { grid-column: 1 / -1; }
.span3 { grid-column: span 3; }
.grid3 .span2, .grid4 .span2 { grid-column: span 2; }
.form-actions { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 14px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset:disabled input, fieldset:disabled textarea { background: var(--input); }
.field textarea, .field input, .field select { font-size: 15px; }
details > summary { list-style: none; cursor: pointer; display: inline-flex; margin: 6px 0; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary { margin-bottom: 12px; }
.inline-const { margin-top: 6px; border-top: 1px dashed var(--line-strong); padding-top: 10px; }
.inline-const summary { color: var(--primary); font-weight: 600; }
.grid-note { display: grid; grid-template-columns: 220px 1fr auto; gap: 12px; align-items: end; margin-bottom: 14px; }
.grid-note .field { margin: 0; }

/* ---------- Recherche avec suggestions (même rendu que les listes Cigaba) ---------- */
.picker { position: relative; }
.picker-list { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px); max-height: min(280px, 50vh); overflow-y: auto; background: var(--card);
  border: 1.5px solid var(--line-strong); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.14); padding: 6px; display: none; }
.picker-list.open { display: block; animation: pop .18s var(--ease); }
.picker-list button { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none; border-radius: 8px; color: var(--text); font-size: 14px; }
.picker-list button:hover, .picker-list button.hl { background: var(--primary-soft); color: var(--primary); }
.picker-list button small { display: block; color: var(--muted); font-size: 12px; }
.picker.ok input[type="search"] { border-color: var(--green); background: var(--green-soft); }
@media (hover: none), (pointer: coarse) { .picker-list button { min-height: 44px; } }

/* ---------- Ordonnances, entrées de stock, examens ---------- */
.ord-lines { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.ord-row { display: grid; grid-template-columns: 2fr 2fr 1fr 80px 40px; gap: 8px; align-items: start; }
.entry-row, .entry-head { display: grid; grid-template-columns: 2.4fr 90px 1fr 150px 1fr 40px; gap: 8px; align-items: center; }
.entry-head { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; margin: 12px 0 6px; }
.ord-row input, .ord-row select, .entry-row input, .entry-row select { width: 100%; min-height: 42px; padding: 9px 12px; border: 1.5px solid var(--line-strong); border-radius: 10px; background: var(--card); color: var(--text); }
.ord-row input:focus, .entry-row input:focus, .entry-row select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.ord-view { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; background: var(--bg); }
.ord-view .card-head { margin-bottom: 6px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px 16px; max-height: 340px; overflow-y: auto; padding: 4px 2px; margin-bottom: 10px; }
.checks h4 { grid-column: 1 / -1; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 10px 0 2px; }
.checks .check { margin: 4px 0; }
.filter-checks { margin-bottom: 8px; width: 100%; max-width: 360px; min-height: 40px; padding: 8px 12px; border: 1.5px solid var(--line-strong); border-radius: 10px; background: var(--card); color: var(--text); }

/* ---------- Listes ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); transition: background .15s; }
.list li:hover { background: var(--hover); border-radius: 8px; }
.list li:last-child { border-bottom: 0; }
.list li small { display: block; color: var(--muted); font-size: 13px; }
.list.compact li { padding: 7px 4px; }
.dl { display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; margin: 0; }
.dl dt { color: var(--muted); font-weight: 500; }
.dl dd { margin: 0; font-weight: 500; word-break: break-word; }
.dl.small { grid-template-columns: 110px 1fr; font-size: 14px; }

/* ---------- Constantes vitales ---------- */
.vitals { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.vital { display: inline-flex; flex-direction: column; padding: 6px 12px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); font-weight: 800; font-size: 15px; }
.vital small { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.vital.bad { background: var(--red-soft); border-color: transparent; color: var(--red); }

/* ---------- File d'attente ---------- */
.queue { display: flex; flex-direction: column; gap: 12px; }
.q-item { display: flex; gap: 14px; align-items: center; background: var(--card); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
  transition: box-shadow .25s, transform .25s var(--ease); animation: fadeUp .5s var(--ease) both; }
.q-item:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.q-item.urgent { box-shadow: inset 4px 0 0 var(--red), var(--shadow); }
.q-num { width: 46px; height: 46px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 800; font-size: 18px; flex: none; }
.q-item.urgent .q-num { background: var(--red-soft); color: var(--red); }
.q-body { flex: 1; min-width: 0; }
.q-title { margin-bottom: 4px; }
.q-meta { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.q-motif { font-size: 14px; margin-top: 4px; }
.q-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- Consultation, hospitalisation, facture : principal + colonne ---------- */
.consult { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
.consult-side { position: sticky; top: calc(var(--top-h) + 16px); }
.consult-side .card { padding: 18px; }
.consult-side h3 { margin-top: 0; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 16px 14px; animation: fadeUp .45s var(--ease) both; }
.timeline li::before { content: ""; position: absolute; left: -25px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--primary); border: 3px solid var(--card); box-shadow: 0 0 0 2px var(--primary-soft); }
.timeline p { margin: 4px 0 0; white-space: pre-line; }
.totals .dl dd { text-align: right; font-variant-numeric: tabular-nums; }
.big-reste { margin-top: 14px; padding: 16px; border-radius: 14px; text-align: center; }
.big-reste small { display: block; font-weight: 600; }
.big-reste strong { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.big-reste.due { background: var(--red-soft); color: var(--red); }
.big-reste.ok { background: var(--green-soft); color: var(--green); }

/* ---------- Plan des lits ---------- */
.beds { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.room { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); animation: fadeUp .5s var(--ease) both; }
.room header { margin-bottom: 10px; }
.room header small { display: block; color: var(--muted); }
.room-beds { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(130px, 100%), 1fr)); gap: 8px; }
.bed { border-radius: 12px; padding: 10px; font-size: 14px; display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--line); transition: transform .2s var(--ease); }
.bed:hover { transform: translateY(-2px); }
.bed small { display: block; color: var(--muted); }
.bed .btn { white-space: normal; text-align: center; height: auto; min-height: 32px; padding: 4px 10px; }
.bed form { display: block; }
.bed-top { display: flex; justify-content: space-between; align-items: center; gap: 4px; }
.bed.libre { background: var(--green-soft); border-color: transparent; }
.bed.occupe { background: var(--red-soft); border-color: transparent; }
.bed.maintenance { background: var(--input); }
.bed-chip { display: inline-flex; align-items: center; gap: 4px; margin: 2px; padding: 3px 4px 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--input); }
.bed-chip.occupe { background: var(--red-soft); color: var(--red); padding-right: 10px; }
.bed-chip .x { border: 0; background: transparent; color: var(--muted); font-size: 16px; line-height: 1; padding: 0 4px; }

/* ---------- Agenda ---------- */
.week { display: flex; gap: 6px; align-items: center; margin-bottom: 14px; overflow-x: auto; padding: 2px; }
.day { flex: 1; min-width: 58px; background: var(--card); border-radius: 14px; padding: 8px 4px; text-align: center; color: var(--text); position: relative; box-shadow: var(--shadow); transition: transform .15s, background .2s; }
.day:hover { text-decoration: none; transform: translateY(-2px); }
.day small { display: block; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.day strong { font-size: 18px; }
.day span { position: absolute; top: 4px; right: 6px; background: var(--accent); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 800; padding: 0 6px; }
.day.today { box-shadow: 0 0 0 2px var(--accent); }
.day.active { background: var(--primary); color: #fff; }
.day.active small { color: rgba(255,255,255,.8); }

/* ---------- Support, notifications, comptes ---------- */
.ticket { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 10px; background: var(--bg); }
.reply { margin-top: 10px; padding: 12px; border-radius: 10px; background: var(--primary-soft); }
.reply p { margin: 6px 0 0; white-space: pre-line; }
.notif-urgent { box-shadow: inset 4px 0 0 var(--red), var(--shadow); }
.notif-important { box-shadow: inset 4px 0 0 var(--amber), var(--shadow); }
.guide li { margin-bottom: 6px; }
.qr { width: 196px; height: 196px; padding: 8px; background: #fff; border-radius: 12px; margin: 10px 0; display: grid; place-items: center; }
.secret { word-spacing: 4px; }
.credentials { display: block; }
.credentials code.big, code.big { font-size: 20px; padding: 4px 10px; letter-spacing: .06em; background: var(--card); border-radius: 8px; }
.logo-preview { max-height: 70px; max-width: 200px; object-fit: contain; border-radius: 8px; border: 1px solid var(--line); padding: 4px; background: #fff; }
.lockbox .cd { font-variant-numeric: tabular-nums; }
.alert > span, .alert > div { flex: 1; min-width: 0; }
.alert a { color: inherit; font-weight: 700; text-decoration: underline; }
.alert .i { margin-top: 1px; }
.alert.block { display: block; }

/* ---------- Pagination ---------- */
.pager { flex-wrap: wrap; align-items: center; }
.pager .muted { margin-left: 8px; font-size: 13px; align-self: center; }

/* ---------- Pages publiques (inscription, 2FA, choix de clinique) ---------- */
.choice-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.choice-list .btn { justify-content: space-between; height: auto; min-height: 56px; padding: 10px 16px; text-align: left; }
.choice-list .btn small { color: var(--muted); font-weight: 500; }
.login-card.wide { max-width: 680px; }
.success-box { text-align: center; }
.checklist { list-style: none; padding: 0; margin: 0 0 16px; }

/* ---------- Mode support (bandeau) ---------- */
.support-alert { position: sticky; top: calc(var(--top-h) + 8px); z-index: 50; }

/* ---------- Barres horizontales de rapport (structure Cigaba .hb) ---------- */
.hb-v { white-space: nowrap; }

/* ---------- Écrans étroits ---------- */
@media (max-width: 1100px) {
  .consult { grid-template-columns: minmax(0, 1fr); }
  .consult-side { position: static; }
  .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 899px) {
  .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span3 { grid-column: 1 / -1; }
}
@media (max-width: 639px) {
  .grid2, .grid3, .grid4 { grid-template-columns: minmax(0, 1fr); }
  .grid3 .span2, .grid4 .span2, .span3 { grid-column: auto; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px; gap: 10px; }
  .kpi-ic { width: 40px; height: 40px; }
  .kpi-ic svg { width: 20px; height: 20px; }
  .kpi small { font-size: 12px; }
  .grid-dash, .grid-2col { grid-template-columns: minmax(0, 1fr); }
  .quick .btn { flex: 1 1 calc(50% - 10px); }
  .q-item { flex-wrap: wrap; }
  .q-actions { width: 100%; justify-content: flex-start; }
  .ord-row { grid-template-columns: 1fr 1fr; }
  .ord-row .picker { grid-column: 1 / -1; }
  .entry-head { display: none; }
  .entry-row { grid-template-columns: 1fr 1fr; }
  .entry-row select { grid-column: 1 / -1; }
  .grid-note { grid-template-columns: 1fr; }
  .filters input, .filters select { flex: 1 1 140px; }
  .filters input[type="search"] { max-width: none; flex-basis: 100%; }
  .dl { grid-template-columns: 1fr; gap: 2px 0; }
  .dl dt { margin-top: 8px; font-size: 12px; text-transform: uppercase; }
  .table.stack td textarea, .table.stack td input:not([type="checkbox"]), .table.stack td select { max-width: 62%; }
  .table.stack td.row-actions { justify-content: flex-start; flex-wrap: wrap; white-space: normal; }
  .table.stack td.row-actions::before { display: none; }
  .table.stack td:not([data-label])::before { display: none; }
}
@media (max-width: 380px) { .kpis { grid-template-columns: 1fr; } }

/* ---------- RTL (arabe) pour les composants Lafiya ---------- */
:root[dir="rtl"] .num, :root[dir="rtl"] th.num { text-align: left; }
:root[dir="rtl"] .timeline { padding: 0 18px 0 0; border-left: 0; border-right: 2px solid var(--line); }
:root[dir="rtl"] .timeline li { padding: 0 14px 16px 0; }
:root[dir="rtl"] .timeline li::before { left: auto; right: -25px; }
:root[dir="rtl"] .q-item.urgent { box-shadow: inset -4px 0 0 var(--red), var(--shadow); }
:root[dir="rtl"] .notif-urgent { box-shadow: inset -4px 0 0 var(--red), var(--shadow); }
:root[dir="rtl"] .notif-important { box-shadow: inset -4px 0 0 var(--amber), var(--shadow); }
:root[dir="rtl"] .picker-list button, :root[dir="rtl"] .choice-list .btn { text-align: right; }
:root[dir="rtl"] .day span { right: auto; left: 6px; }
:root[dir="rtl"] .pager .muted { margin-left: 0; margin-right: 8px; }
:root[dir="rtl"] .totals .dl dd { text-align: left; }
:root[dir="rtl"] .bed-chip { padding: 3px 10px 3px 4px; }

@media print {
  .filters, .tabs, .quick, .form-actions, .assist-float, .assist-panel, .support-alert { display: none !important; }
  .kpi, .q-item, .room { box-shadow: none; border: 1px solid #ccc; }
}

.login-col { width: 100%; max-width: 420px; }
.login-col:has(.wide) { max-width: 680px; }
.login-col .lang-switch { display: flex; }
.login-col .login-card { max-width: none; }
.hb { grid-template-columns: minmax(80px, 150px) 1fr auto; }
.hb-v { min-width: 62px; font-weight: 600; }
.bars .bar > i { cursor: default; }
.alert:not(:has(> .i)) { display: block; }
.kpi strong { font-size: clamp(17px, 1vw + 10px, 23px); }
.kpi-ic { width: 46px; height: 46px; }
.kpi-sub { display: block; font-style: normal; font-size: 12px; color: var(--muted); margin-top: 2px; }
.card .empty, .grid-dash .empty { padding: 22px 12px; }
.card .empty .empty-ico, .grid-dash .empty .empty-ico { width: 56px; height: 56px; margin-bottom: 8px; }
.card .empty .empty-ico svg { width: 26px; height: 26px; }
.card .empty p { margin: 4px auto 0; }

/* ---------- Ma salle (appels vers l'écran) ---------- */
.salle-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 8px 12px; margin: 0 0 12px; }
.salle-bar label { font-weight: 600; }
.salle-bar select { width: auto; min-width: 150px; height: 36px; }
.salle-bar .i { color: var(--primary); }
.q-num { font-variant-numeric: tabular-nums; }

/* ---------- Écran d'appel de la salle d'attente (télévision) ---------- */
.ecran-body { margin: 0; min-height: 100vh; background: radial-gradient(1200px 700px at 15% 0%, #0f8a45 0%, transparent 60%), linear-gradient(160deg, #0B2A1C 0%, #0B4D2A 60%, #0B2A1C 100%); color: #fff; display: flex; flex-direction: column; overflow: hidden; font-family: var(--font, system-ui, sans-serif); }
.ecran-top { display: flex; justify-content: space-between; align-items: center; padding: 2.2vh 3vw; gap: 20px; }
.ecran-brand { display: flex; align-items: center; gap: 16px; min-width: 0; }
.ecran-brand img { width: clamp(44px, 5vw, 72px); height: auto; border-radius: 14px; background: #fff; padding: 4px; }
.ecran-brand strong { display: block; font-size: clamp(20px, 2.4vw, 38px); line-height: 1.1; }
.ecran-brand span { color: rgba(255,255,255,.7); font-size: clamp(13px, 1.2vw, 20px); }
.ecran-clock { text-align: end; }
.ecran-clock b { display: block; font-size: clamp(28px, 3.6vw, 60px); font-variant-numeric: tabular-nums; line-height: 1; }
.ecran-clock span { color: rgba(255,255,255,.7); font-size: clamp(12px, 1.1vw, 18px); text-transform: capitalize; }
.ecran-main { flex: 1; display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 2.5vw; padding: 0 3vw 2vh; min-height: 0; }
.ecran-now { background: #fff; color: #10231a; border-radius: 32px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 3vh 2vw; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.ec-lbl { font-size: clamp(20px, 2.6vw, 44px); text-transform: uppercase; letter-spacing: .18em; color: #6b7a72; font-weight: 700; }
.ec-ticket { font-size: clamp(110px, 19vw, 340px); font-weight: 900; line-height: .95; color: var(--primary, #0B7838); font-variant-numeric: tabular-nums; letter-spacing: -.02em; word-break: break-all; }
.ec-arrow { font-size: clamp(30px, 4vw, 70px); color: var(--accent, #E05000); line-height: 1; margin: 1vh 0; }
.ec-salle { font-size: clamp(34px, 5.4vw, 96px); font-weight: 800; color: #fff; background: var(--accent, #E05000); border-radius: 22px; padding: .1em .6em; max-width: 100%; overflow-wrap: anywhere; }
.ecran-now.flash { animation: ecFlash 1.1s ease 3; }
@keyframes ecFlash { 0%, 100% { transform: scale(1); box-shadow: 0 30px 80px rgba(0,0,0,.35); } 40% { transform: scale(1.025); box-shadow: 0 0 0 14px rgba(224,80,0,.55), 0 30px 80px rgba(0,0,0,.35); } }
.ecran-hist { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); border-radius: 28px; padding: 2.4vh 1.8vw; min-height: 0; overflow: hidden; }
.ecran-hist h2 { margin: 0 0 1.6vh; font-size: clamp(18px, 1.9vw, 32px); color: rgba(255,255,255,.85); font-weight: 700; }
.ecran-hist ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.2vh; }
.ecran-hist li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1vw; background: rgba(255,255,255,.1); border-radius: 18px; padding: 1.3vh 1.2vw; animation: pop .4s var(--ease, ease) both; }
.ecran-hist li b { font-size: clamp(26px, 3.2vw, 56px); font-variant-numeric: tabular-nums; min-width: 2.4em; }
.ecran-hist li span { font-size: clamp(18px, 2vw, 34px); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ecran-hist li small { color: rgba(255,255,255,.65); font-size: clamp(13px, 1.2vw, 20px); }
.ecran-hist li.ec-empty { display: block; background: none; color: rgba(255,255,255,.6); font-size: clamp(16px, 1.5vw, 24px); }
.ecran-foot { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 1.6vh 3vw; background: rgba(0,0,0,.25); font-size: clamp(14px, 1.4vw, 24px); color: rgba(255,255,255,.85); }
.ec-net { background: var(--red, #d93025); color: #fff; border-radius: 10px; padding: 4px 12px; font-weight: 700; }
.ec-net[hidden] { display: none; }
.ecran-start { position: fixed; inset: 0; background: rgba(6,24,15,.82); backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 50; padding: 16px; }
.ecran-start[hidden] { display: none; }
.ecran-start .ec-card { background: #fff; color: #10231a; border-radius: 28px; padding: 36px 32px; text-align: center; max-width: 520px; width: 100%; box-shadow: 0 30px 80px rgba(0,0,0,.4); }
.ecran-start .ec-card img { border-radius: 16px; }
.ecran-start .ec-card h1 { margin: 12px 0 4px; font-size: 28px; }
.ecran-start .ec-card p { color: #6b7a72; margin: 0 0 22px; }
.ecran-start .ec-card small { display: block; margin-top: 14px; color: #6b7a72; }
.ecran-off { margin: auto; text-align: center; padding: 24px; max-width: 640px; }
.ecran-off img { border-radius: 20px; background: #fff; padding: 6px; }
@media (max-width: 760px) {
  .ecran-body { overflow: auto; }
  .ecran-main { grid-template-columns: 1fr; }
  .ecran-foot { flex-direction: column; text-align: center; }
}
