/* senGO — interface des services (Résidence, Maintenance).
   Même famille que la page d'accueil : bleu nuit, halos de couleur animés, icônes au trait, cartes arrondies. */
:root {
  --navy: #0B1F33; --navy2: #102A44; --ink: #0B1F33; --muted: #4A5B6C; --soft: #5B6B7B; --line: #D5DEE7; --line2: #E8EEF4; --bg: #F3F6F9;
  --accent: #0072BC; --accent2: #00477A; --accent-soft: #E3F0FA; --glow1: #3FA9F5; --glow2: #8B1E83; --glow3: #2E7D32;
  /* statuts des unités */
  --st-occ: #E5484D; --st-occ-t: #B42318;
  --st-free: #F5B800; --st-free-t: #7A5600;
  --st-clean: #2E9E5B; --st-clean-t: #1E7A45;
  --st-off: #8A96A3; --st-off-t: #4A5562;
}
.svc-maintenance, body.svc-maint { --accent: #2E7D32; --accent2: #184A1B; --accent-soft: #E7F5EA; --glow1: #7CC242; --glow2: #0072BC; --glow3: #E5A800; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { min-height: 100vh; background: var(--bg); color: var(--ink); font-family: 'Plus Jakarta Sans', 'IBM Plex Sans Arabic', system-ui, sans-serif; }
[dir="rtl"] body { font-family: 'IBM Plex Sans Arabic', 'Plus Jakarta Sans', system-ui, sans-serif; }
button, input, select { font: inherit; }
a { color: var(--accent); }
.hidden { display: none !important; }

@keyframes sg-drift1 { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(10%, 14%) scale(1.15); } }
@keyframes sg-drift2 { 0%, 100% { transform: translate(0, 0) scale(1.1); } 50% { transform: translate(-12%, 8%) scale(.9); } }
@keyframes sg-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes sg-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(124,194,66,.6); } 50% { box-shadow: 0 0 0 6px rgba(124,194,66,0); } }

/* ---------- marque ---------- */
.brand { display: inline-flex; align-items: baseline; text-decoration: none; direction: ltr; }
.brand .sig { font-family: 'Mrs Saint Delafield', cursive; font-size: 44px; line-height: 1; color: #fff; margin-right: 2px; }
.brand .go { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 25px; font-weight: 800; }
.brand .g { color: #C27BD6; } .brand .o { color: #3FA9F5; }

/* ---------- langues ---------- */
.langs { display: flex; gap: 6px; }
.langs button { min-width: 44px; height: 36px; padding: 0 10px; border-radius: 18px; border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.06); color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; }
.langs button[aria-pressed="true"] { background: #fff; border-color: #fff; color: var(--accent); font-weight: 800; }
.light .langs button { border-color: var(--line); color: var(--ink); background: #fff; }

/* ---------- mise en page ---------- */
.app { min-height: 100vh; display: flex; }
.side { position: sticky; top: 0; height: 100vh; width: 264px; flex: none; background: radial-gradient(400px 300px at 0% 0%, color-mix(in srgb, var(--accent) 35%, transparent), transparent 70%), var(--navy); padding: 20px 14px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.side-top { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 0 8px 14px; }
.svc-chip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px; border-radius: 14px; background: rgba(255,255,255,.08); color: #fff; font-size: 13px; font-weight: 700; letter-spacing: .3px; }
[dir="rtl"] .svc-chip { padding: 5px 5px 5px 12px; }
.svc-ico { width: 28px; height: 28px; border-radius: 9px; background: var(--accent); display: flex; align-items: center; justify-content: center; }
.svc-ico svg { width: 17px; height: 17px; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.tab { min-height: 44px; padding: 0 10px; border-radius: 12px; border: none; background: transparent; color: #C9D6E3; font-size: 14.5px; font-weight: 600; display: flex; align-items: center; gap: 12px; cursor: pointer; text-align: start; width: 100%; transition: background .2s ease, color .2s ease; }
.tab .ti { width: 32px; height: 32px; flex: none; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,.06); transition: background .2s ease; }
.tab .ti svg { width: 18px; height: 18px; }
.tab .tl { flex: 1; }
.tab:hover { background: rgba(255,255,255,.06); color: #fff; }
.tab[aria-current="page"] { background: rgba(255,255,255,.1); color: #fff; }
.tab[aria-current="page"] .ti { background: var(--accent); color: #fff; box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 50%, transparent); }
.tab .soon { font-size: 10px; font-weight: 700; padding: 3px 7px; border-radius: 8px; background: rgba(255,255,255,.1); color: #AFC0D1; }
.spacer { flex: 1; min-height: 16px; }
.me { display: flex; align-items: center; gap: 10px; padding: 12px 8px; border-top: 1px solid rgba(255,255,255,.1); }
.me .av { width: 38px; height: 38px; flex: none; border-radius: 50%; background: linear-gradient(135deg, var(--glow1), var(--accent)); color: #fff; font-size: 13px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.me .mi { display: flex; flex-direction: column; min-width: 0; }
.me strong { color: #fff; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me span { color: #AFC0D1; font-size: 12px; }
.links { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 6px 4px; }
.links a, .links button { min-height: 38px; padding: 0 12px; border-radius: 10px; border: none; background: rgba(255,255,255,.08); color: #fff; font-size: 12.5px; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; cursor: pointer; }
.links a:hover, .links button:hover { background: rgba(255,255,255,.14); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
/* en-tête vivant */
.phero { position: relative; overflow: hidden; isolation: isolate; margin: 14px 14px 0; border-radius: 26px; padding: 18px clamp(18px, 3vw, 32px) 74px; background: linear-gradient(140deg, var(--accent), var(--accent2)); color: #fff; }
.phero .aurora { position: absolute; inset: 0; z-index: -1; overflow: hidden; }
.phero .aurora span { position: absolute; width: 520px; height: 520px; border-radius: 50%; filter: blur(70px); opacity: .45; }
.phero .aurora .b1 { background: var(--glow1); top: -300px; left: -120px; animation: sg-drift1 20s ease-in-out infinite; }
.phero .aurora .b2 { background: var(--glow2); top: -260px; right: -160px; opacity: .35; animation: sg-drift2 26s ease-in-out infinite; }
.phero .aurora .b3 { background: var(--glow3); bottom: -360px; left: 40%; opacity: .25; animation: sg-drift1 30s ease-in-out infinite reverse; }
.phero-top { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.live { display: inline-flex; align-items: center; gap: 10px; padding: 6px 14px; border-radius: 20px; background: rgba(255,255,255,.12); font-size: 13px; color: #EAF2FA; backdrop-filter: blur(6px); }
.live .dot { width: 8px; height: 8px; border-radius: 50%; background: #7CC242; animation: sg-pulse 2.4s ease-in-out infinite; }
.phero-title { display: flex; align-items: center; gap: 16px; margin-top: 26px; }
.fresh .phero-title { animation: sg-up .5s ease both; }
.phero-ico { width: 60px; height: 60px; flex: none; border-radius: 19px; background: rgba(255,255,255,.16); box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; }
.phero-ico svg { width: 30px; height: 30px; }
.kicker { font-size: 13px; color: rgba(255,255,255,.75); font-weight: 600; }
.phero h1 { margin: 2px 0 0; font-size: clamp(24px, 3.2vw, 34px); font-weight: 800; letter-spacing: -.01em; }
.phero-sub { margin: 4px 0 0; color: rgba(255,255,255,.8); font-size: 14px; }
.pbody { position: relative; margin: -50px 14px 0; padding: 0 clamp(4px, 2vw, 18px) 40px; display: flex; flex-direction: column; gap: 18px; }
.fresh .pbody > * { animation: sg-up .5s ease both; }
.pbody > *:nth-child(2) { animation-delay: .06s; } .pbody > *:nth-child(3) { animation-delay: .12s; } .pbody > *:nth-child(4) { animation-delay: .18s; } .pbody > *:nth-child(n+5) { animation-delay: .24s; }

@media (max-width: 860px) {
  .app { flex-direction: column; }
  .side { position: static; height: auto; width: auto; padding: 12px; }
  .side-top { flex-direction: row; align-items: center; justify-content: space-between; padding: 0 4px 8px; }
  .nav { flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 4px; scrollbar-width: none; }
  .tab { width: auto; flex: none; padding: 0 12px 0 6px; }
  .tab .soon, .spacer, .me { display: none; }
  .links { padding: 6px 0 0; }
  .phero { margin: 10px 10px 0; border-radius: 22px; }
  .pbody { margin: -50px 10px 0; padding: 0 0 32px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi.main-kpi { grid-column: 1 / -1; }
  .kpi { padding: 16px; }
  .kpi .v { font-size: 28px; }
  .rooms { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
}

/* ---------- composants ---------- */
.panel { background: #fff; border-radius: 22px; padding: 22px; box-shadow: 0 6px 24px rgba(11,31,51,.07); display: flex; flex-direction: column; gap: 14px; }
.panel h2 { margin: 0; font-size: 18px; font-weight: 800; }
.panel-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.kpi { position: relative; background: #fff; border-radius: 20px; padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 6px 24px rgba(11,31,51,.07); overflow: hidden; }
.kpi .l { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.kpi .v { font-size: 32px; font-weight: 800; letter-spacing: -.02em; }
.kpi .v small { font-size: 15px; font-weight: 600; color: var(--soft); }
.kpi .n { font-size: 12px; color: var(--soft); }
.kpi.main-kpi { background: linear-gradient(140deg, var(--navy), var(--navy2)); color: #fff; }
.kpi.main-kpi .l, .kpi.main-kpi .n { color: #AFC0D1; }
.ring { position: absolute; top: 14px; inset-inline-end: 14px; width: 54px; height: 54px; border-radius: 50%; background: conic-gradient(var(--glow1) calc(var(--p) * 1%), rgba(255,255,255,.12) 0); display: flex; align-items: center; justify-content: center; }
.ring::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--navy); }
.ring b { position: relative; font-size: 12px; }

/* pastilles de statut */
.sdot { width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--d); box-shadow: 0 0 0 3px color-mix(in srgb, var(--d) 22%, transparent); }
.s-occ { --d: var(--st-occ); --dt: var(--st-occ-t); }
.s-free { --d: var(--st-free); --dt: var(--st-free-t); }
.s-clean { --d: var(--st-clean); --dt: var(--st-clean-t); }
.s-off { --d: var(--st-off); --dt: var(--st-off-t); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 40px; padding: 0 14px; border-radius: 20px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); font-size: 13.5px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: border-color .2s ease, background .2s ease; }
.chip:hover { border-color: #AFC0D1; }
.chip[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip .cnt { font-weight: 800; opacity: .7; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 16px; background: #fff; box-shadow: 0 6px 24px rgba(11,31,51,.07); }
.seg button { min-width: 56px; min-height: 42px; padding: 0 14px; border-radius: 12px; border: none; background: transparent; font-weight: 800; font-size: 14px; color: var(--muted); cursor: pointer; transition: background .2s ease, color .2s ease; }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 40%, transparent); }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }

/* barre empilée */
.stack { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: var(--line2); }
.stack i { display: block; height: 100%; background: var(--d); transition: width .5s ease; }
.brow { display: grid; grid-template-columns: minmax(150px, 220px) 1fr auto; gap: 14px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line2); }
.brow:first-of-type { border-top: none; }
.brow strong { font-size: 14px; }
.brow .rate { font-size: 13px; font-weight: 700; color: var(--muted); min-width: 64px; text-align: end; }
@media (max-width: 600px) { .brow { grid-template-columns: 1fr auto; } .brow .stack { grid-column: 1 / -1; } }

/* étages et unités */
.floor { background: #fff; border-radius: 22px; padding: 18px; box-shadow: 0 6px 24px rgba(11,31,51,.07); display: flex; flex-direction: column; gap: 14px; }
.floor-head { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.floor-head h3 { margin: 0; font-size: 15px; font-weight: 800; }
.floor-head .cnt { font-size: 13px; color: var(--soft); }
.floor-head .stack { flex: 1 1 160px; max-width: 260px; height: 8px; margin-inline-start: auto; }
.rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.rt { position: relative; min-height: 84px; padding: 12px 12px 10px; border-radius: 16px; border: 1px solid var(--line2); background: linear-gradient(180deg, #fff, #FAFCFE); display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: start; cursor: pointer; color: var(--ink); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.rt:hover, .rt:focus-visible { transform: translateY(-3px); box-shadow: 0 12px 24px rgba(11,31,51,.1); border-color: color-mix(in srgb, var(--d) 45%, var(--line2)); outline: none; }
.rt .sdot { position: absolute; top: 12px; inset-inline-end: 12px; }
.rt b { font-size: 15.5px; font-weight: 800; letter-spacing: -.01em; direction: ltr; }
.rt .ty { font-size: 11.5px; color: var(--soft); }
.rt .sl { margin-top: auto; font-size: 11.5px; font-weight: 700; color: var(--dt); }
.rt.s-occ { background: linear-gradient(180deg, #fff, color-mix(in srgb, var(--st-occ) 5%, #fff)); }
.rt.s-off { background: repeating-linear-gradient(135deg, #fff 0 8px, #F5F7F9 8px 16px); }
.rt.dim { opacity: .28; transform: none !important; box-shadow: none !important; }

/* fenêtre d'une unité */
.sheet { width: min(440px, calc(100% - 24px)); border: none; border-radius: 26px; padding: 0; color: var(--ink); box-shadow: 0 30px 80px rgba(0,0,0,.3); }
.sheet::backdrop { background: rgba(11,31,51,.5); backdrop-filter: blur(3px); }
.sheet-head { position: relative; overflow: hidden; padding: 22px 22px 20px; background: linear-gradient(140deg, var(--accent), var(--accent2)); color: #fff; }
.sheet-head .x { position: absolute; top: 14px; inset-inline-end: 14px; width: 40px; height: 40px; border-radius: 20px; border: none; background: rgba(255,255,255,.16); color: #fff; font-size: 20px; cursor: pointer; }
.sheet-head .k { font-size: 13px; color: rgba(255,255,255,.8); }
.sheet-head h3 { margin: 4px 0 0; font-size: 30px; font-weight: 800; direction: ltr; text-align: start; }
.sheet-body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 14px; }
.cur { display: inline-flex; align-items: center; gap: 10px; align-self: flex-start; padding: 8px 14px; border-radius: 14px; background: color-mix(in srgb, var(--d) 12%, #fff); color: var(--dt); font-weight: 800; }
.stgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stbtn { min-height: 52px; padding: 0 14px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); font-weight: 700; display: flex; align-items: center; gap: 10px; cursor: pointer; text-align: start; }
.stbtn:hover:not(:disabled) { border-color: var(--d); background: color-mix(in srgb, var(--d) 7%, #fff); }
.stbtn[aria-pressed="true"] { border-color: var(--d); background: color-mix(in srgb, var(--d) 12%, #fff); color: var(--dt); }
.stbtn:disabled { opacity: .4; cursor: not-allowed; }
.sheet .msg { margin: 0; font-size: 13px; color: var(--soft); }
.sheet .msg.err { color: #B42318; font-weight: 600; }

.note { margin: 0; font-size: 13px; line-height: 1.55; color: var(--soft); }
.btn { min-height: 44px; padding: 0 18px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); font-weight: 600; font-size: 14px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn.primary { border: none; background: var(--navy); color: #fff; font-weight: 700; }

/* état « en préparation » */
.empty { position: relative; overflow: hidden; background: #fff; border-radius: 24px; padding: clamp(24px, 4vw, 40px); box-shadow: 0 6px 24px rgba(11,31,51,.07); display: flex; flex-direction: column; gap: 16px; max-width: 820px; }
.empty::after { content: ""; position: absolute; width: 260px; height: 260px; border-radius: 50%; top: -120px; inset-inline-end: -100px; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%); }
.empty .tag { align-self: flex-start; padding: 6px 12px; border-radius: 12px; background: var(--accent-soft); color: var(--accent2); font-size: 13px; font-weight: 800; }
.empty h2 { margin: 0; font-size: 22px; }
.empty p { margin: 0; color: var(--muted); line-height: 1.6; }
.empty ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.empty li { display: flex; gap: 10px; align-items: flex-start; line-height: 1.5; }
.empty li::before { content: ""; width: 8px; height: 8px; margin-top: 8px; flex: none; border-radius: 50%; background: var(--accent); }

/* refus d'accès */
.denied { max-width: 520px; margin: 12vh auto; background: #fff; border-radius: 24px; padding: 32px; display: flex; flex-direction: column; gap: 14px; text-align: center; box-shadow: 0 10px 30px rgba(11,31,51,.1); }
.denied h1 { margin: 0; font-size: 22px; }
.denied p { margin: 0; color: var(--muted); line-height: 1.6; }

/* onglet Utilisateurs */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: #3D4F61; }
.field select { height: 44px; min-width: 190px; border-radius: 12px; border: 1.5px solid var(--line); padding: 0 12px; background: #fff; }
.urow { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; padding: 14px 0; border-top: 1px solid var(--line2); }
.urow:first-of-type { border-top: none; }
.who2 { flex: 1 1 240px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--muted); }
.who2 strong { font-size: 15px; color: var(--ink); }
.acts { display: flex; gap: 8px; }
.count { display: inline-block; min-width: 24px; padding: 2px 8px; border-radius: 12px; background: var(--accent); color: #fff; font-size: 13px; text-align: center; vertical-align: middle; }

@media (prefers-reduced-motion: reduce) {
  .phero .aurora span, .live .dot, .phero-title, .pbody > * { animation: none !important; }
  .rt, .tab, .stack i { transition: none !important; }
}
