/* AuraLiving — thème « soft » : panneaux flottants arrondis, ombres douces, pastilles.
   Chargé après app.css ; ne redéfinit que l'habillage. */

:root {
  --page: #EDF0F5;
  --card-r: 22px;
  --soft: 0 1px 2px rgba(38, 42, 54, .04), 0 10px 30px -14px rgba(38, 42, 54, .16);
  --soft-lg: 0 24px 60px -20px rgba(38, 42, 54, .30);
  --sidebar: 264px;
}
[data-theme="dark"] {
  --page: #13161D;
  --soft: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 30px -16px rgba(0, 0, 0, .55);
}
body { background: var(--page); }

/* ------------------------------------------------------------- Mise en page */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); gap: 16px; padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 14px max(14px, env(safe-area-inset-left)); min-height: 100dvh; }
.sidebar { position: sticky; top: 14px; inset: auto; height: calc(100dvh - 28px); width: auto; background: var(--surface); color: var(--ink); border-radius: 26px; box-shadow: var(--soft); padding: 22px 14px 14px; gap: 4px; }
.main-wrap { margin-left: 0; min-width: 0; }
.brand { padding: 2px 10px 20px; }
.sidebar .h-logo, .brand .h-logo { --logo-blue: #1963a6; --logo-sign: #5a6b7d; }
[data-theme="dark"] .sidebar .h-logo { --logo-blue: #fff; --logo-sign: #c9d3de; }

.nav-label { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); padding: 14px 12px 6px; }
.nav { gap: 3px; }
.nav-item { height: 46px; padding: 0 14px; border-radius: 14px; color: var(--ink-2); font-weight: 500; transition: background .15s, color .15s, box-shadow .15s; }
.nav-item:hover { background: var(--sunken); color: var(--ink); }
.nav-item.active { background: var(--brand); color: #fff; box-shadow: 0 10px 22px -10px color-mix(in srgb, var(--brand) 80%, transparent); }
.nav-item.active .ic { color: #fff; }
.nav-kbd { display: none; }
.nav-count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; display: inline-grid; place-items: center; font: 600 11.5px var(--font); background: var(--brand-soft); color: var(--brand); }
.nav-count.red { background: #FDE7E7; color: #C02A30; } .nav-count.amber { background: #FBF0DD; color: #94600F; } .nav-count.green { background: #E2F6EE; color: #0F7F57; }
.nav-item.active .nav-count { background: rgba(255, 255, 255, .22); color: #fff; }
.nav-item span { flex: 1; }
.search-trigger { display: none; }

.sidebar-foot { border-top: 0; padding-top: 8px; gap: 10px; }
.side-card { position: relative; overflow: hidden; border-radius: 20px; background: var(--h-ink); color: #fff; padding: 16px; }
.side-card::after { content: ""; position: absolute; right: -28px; bottom: -40px; width: 120px; height: 110px; background: var(--gradient); clip-path: polygon(50% 0, 100% 42%, 100% 100%, 0 100%, 0 42%); opacity: .9; }
.side-card b { font: 600 15px var(--font-display); display: block; margin-bottom: 4px; position: relative; z-index: 1; }
.side-card p { font-size: 12.5px; color: #C5CAD6; margin: 0 0 12px; max-width: 75%; position: relative; z-index: 1; }
.side-card .btn { position: relative; z-index: 1; background: #fff; color: var(--h-ink); border: 0; min-height: 34px; font-size: 13px; }
.side-card .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: #3FD08F; }
.side-card .dot.off { background: #F0A93B; } .side-card .dot.err { background: #F0676B; }
.sidebar .me { background: var(--sunken); border-radius: 16px; padding: 8px; }
.sidebar .me-name { color: var(--ink); } .sidebar .me-role { color: var(--ink-3); }
.sidebar .icon-btn { color: var(--ink-3); } .sidebar .icon-btn:hover { background: var(--surface); color: var(--ink); }
.sync { display: none; }

/* ------------------------------------------------------------- Barre du haut */
.topbar { position: sticky; top: 14px; height: auto; min-height: 64px; padding: 4px 4px 4px 8px; background: transparent; border: 0; backdrop-filter: none; -webkit-backdrop-filter: none; z-index: 20; }
.topbar.scrolled { background: color-mix(in srgb, var(--page) 82%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-radius: 20px; }
.title-block { flex: 1; min-width: 0; }
.page-title { font: 600 26px/1.15 var(--font-display); letter-spacing: -.025em; }
.page-sub { font-size: 13px; color: var(--ink-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { gap: 10px; }
.search-field { display: flex; align-items: center; gap: 10px; width: 280px; height: 46px; padding: 0 8px 0 16px; border-radius: 999px; background: var(--surface); box-shadow: var(--soft); border: 0; color: var(--ink-3); font: 400 14px var(--font); cursor: pointer; }
.search-field span { flex: 1; text-align: left; }
.search-field kbd { background: var(--sunken); border: 0; }
.round-btn { position: relative; width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--surface); box-shadow: var(--soft); display: grid; place-items: center; color: var(--ink-2); cursor: pointer; }
.round-btn:hover { color: var(--ink); }
.round-btn .ic { width: 20px; height: 20px; }
.round-btn .badge-n { position: absolute; top: -3px; right: -3px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: #D93036; color: #fff; font: 700 11px/20px var(--font); text-align: center; box-shadow: 0 0 0 3px var(--page); }
.avatar-btn { width: 46px; height: 46px; border-radius: 50%; border: 0; padding: 0; background: linear-gradient(135deg, var(--h-sky), var(--h-mint)); color: var(--h-ink); font: 700 15px var(--font-display); cursor: pointer; box-shadow: var(--soft); }
.topbar .btn-primary { height: 46px; border-radius: 999px; padding: 0 20px; box-shadow: 0 10px 22px -10px color-mix(in srgb, var(--brand) 80%, transparent); }
.sync-pill { height: 34px; padding: 0 12px; }
.local-banner { margin: 6px 4px 0; border-radius: 16px; }
.view { padding: 14px 4px 40px; }

/* ------------------------------------------------------------- Cartes */
.card { border: 0; border-radius: var(--card-r); box-shadow: var(--soft); padding: 20px 22px; }
.card.flush { border-radius: var(--card-r); }
.card-head h3 { font: 600 17px var(--font-display); letter-spacing: -.01em; }
.card-head .sel { border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 12.5px; color: var(--ink-2); background: var(--surface); }
.kpis { gap: 16px; }
.kpi { border: 0; border-radius: var(--card-r); box-shadow: var(--soft); padding: 18px 20px; position: relative; }
.kpi-label { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.kpi-value { font-size: 28px; margin-top: 8px; }
.kpi-sub { color: var(--ink-3); margin-top: 6px; }
.kpi .kpi-ic { width: 40px; height: 40px; padding: 10px; border-radius: 14px; background: var(--sunken); color: var(--ink-2); }
.kpi.hero { background: linear-gradient(135deg, #2A7BC4 0%, #1963A6 60%, #134D82 100%); color: #fff; overflow: hidden; }
.kpi.hero::after { content: ""; position: absolute; right: -30px; bottom: -50px; width: 170px; height: 150px; background: linear-gradient(135deg, rgba(255,255,255,.22), rgba(63,232,94,.35)); clip-path: polygon(50% 0, 100% 42%, 100% 100%, 0 100%, 0 42%); }
.kpi.hero .kpi-label, .kpi.hero .kpi-sub { color: rgba(255, 255, 255, .82); }
.kpi.hero .kpi-ic { background: rgba(255, 255, 255, .18); color: #fff; }
.delta { display: inline-flex; align-items: center; gap: 3px; padding: 3px 9px; border-radius: 999px; font: 600 12px var(--font); white-space: nowrap; }
.delta.up { background: #E2F6EE; color: #0F7F57; } .delta.down { background: #FDE7E7; color: #C02A30; } .delta.flat { background: var(--sunken); color: var(--ink-2); }
.kpi.hero .delta { background: rgba(255, 255, 255, .2); color: #fff; }
.kpi-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Pastilles de statut : plus douces */
.badge { padding: 4px 11px; font-weight: 600; }
.table-wrap { border-radius: var(--card-r); }
.table th { background: transparent; border-bottom: 1px solid var(--line); text-transform: none; letter-spacing: 0; font-size: 12.5px; font-weight: 500; color: var(--ink-3); }
.table td { border-bottom: 1px solid var(--line); }
.table tbody tr:hover td { background: var(--sunken); }
.tabs { background: var(--surface); box-shadow: var(--soft); border-radius: 999px; padding: 4px; }
.tab { border-radius: 999px; padding: 6px 14px; }
.tab.on { background: var(--h-ink); color: #fff; box-shadow: none; }
[data-theme="dark"] .tab.on { background: var(--brand); color: var(--brand-ink); }
.search-inline, .select-sm { border: 0; background: var(--surface); box-shadow: var(--soft); border-radius: 999px; }
select.select-sm { padding-left: 14px; }
.btn { border-radius: 14px; }
.btn:not(.btn-primary):not(.btn-danger):not(.btn-whatsapp):not(.btn-danger-ghost) { border-color: transparent; background: var(--surface); box-shadow: var(--soft); }
.modal { border-radius: 26px; }
.toast { border-radius: 16px; }
.pcard, .state-tile { border: 0; box-shadow: var(--soft); border-radius: var(--card-r); }
.timeline.card { padding: 0; }
.notice { border-radius: 16px; }

/* ------------------------------------------------------------- Tableau de bord */
.hello { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.hello h2 { font: 600 30px/1.1 var(--font-display); letter-spacing: -.03em; }
.hello p { margin: 6px 0 0; color: var(--ink-3); }
.dash-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.col-3 { grid-column: span 3; } .col-4 { grid-column: span 4; } .col-5 { grid-column: span 5; } .col-6 { grid-column: span 6; } .col-7 { grid-column: span 7; } .col-8 { grid-column: span 8; } .col-12 { grid-column: span 12; }
.mini-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.mini { background: var(--sunken); border-radius: 16px; padding: 12px 14px; }
.mini span { display: block; font-size: 12px; color: var(--ink-3); }
.mini b { display: block; font: 600 17px var(--font-display); margin-top: 3px; font-variant-numeric: tabular-nums; }
.today-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none !important; }
.today-item:last-child { border-bottom: 0; }
.ti-avatar { width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; font: 600 13px var(--font-display); flex: none; }
.ti-avatar.in { background: #E2F6EE; color: #0F7F57; } .ti-avatar.out { background: #E7F0F9; color: #1963A6; } .ti-avatar.stay { background: var(--sunken); color: var(--ink-2); } .ti-avatar.imp { background: #FDE8E8; color: #B42D33; }
.ti-main { flex: 1; min-width: 0; } .ti-main b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .ti-main span { font-size: 12.5px; color: var(--ink-3); }
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut { width: 168px; height: 168px; flex: none; }
.donut-center { font: 600 26px var(--font-display); fill: var(--ink); } .donut-sub { font-size: 11px; fill: var(--ink-3); }
.legend-list { flex: 1; min-width: 150px; display: flex; flex-direction: column; gap: 10px; }
.legend-list div { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.legend-list i { width: 10px; height: 10px; border-radius: 4px; flex: none; }
.legend-list b { margin-left: auto; font-variant-numeric: tabular-nums; }
.bars { width: 100%; height: auto; display: block; }
.bars .gridl { stroke: var(--line); stroke-dasharray: 3 5; }
.bars .bar { fill: color-mix(in srgb, var(--h-blue) 22%, var(--surface)); }
.bars .bar.cur { fill: url(#barGrad); }
.bars .bar-g:hover .bar { fill: var(--h-blue); }
.bars text { fill: var(--ink-3); font-size: 12px; font-family: var(--font); }
.bars .bar-val { fill: var(--ink); font-weight: 600; }
.occ-row { display: grid; grid-template-columns: minmax(90px, 1.2fr) 2fr 44px; gap: 12px; align-items: center; padding: 7px 0; color: var(--ink); text-decoration: none !important; font-size: 13.5px; }
.occ-row .tr { height: 8px; border-radius: 999px; background: var(--sunken); overflow: hidden; }
.occ-row .fl { display: block; height: 100%; border-radius: 999px; background: var(--gradient); }
.occ-row .v { text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------- Centre de notifications */
.notif-panel { position: fixed; z-index: 60; top: 84px; right: 18px; width: 400px; max-height: min(640px, calc(100dvh - 110px)); display: flex; flex-direction: column; background: var(--surface); border-radius: 24px; box-shadow: var(--soft-lg); overflow: hidden; animation: pop .16s ease-out; }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 10px; }
.notif-head h3 { font: 600 18px var(--font-display); }
.notif-tabs { display: flex; gap: 6px; padding: 0 20px 10px; }
.notif-body { overflow-y: auto; padding: 0 10px 12px; }
.notif-sec { font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding: 10px 10px 6px; }
.notif { display: flex; gap: 12px; padding: 10px; border-radius: 16px; color: var(--ink); text-decoration: none !important; position: relative; }
.notif:hover { background: var(--sunken); }
.notif .ni { width: 38px; height: 38px; border-radius: 13px; display: grid; place-items: center; flex: none; }
.notif .ni .ic { width: 18px; height: 18px; }
.ni.err { background: #FDE7E7; color: #C02A30; } .ni.warn { background: #FBF0DD; color: #94600F; } .ni.info { background: #E7F0F9; color: #1963A6; } .ni.ok { background: #E2F6EE; color: #0F7F57; }
.notif b { display: block; font-weight: 600; font-size: 13.5px; }
.notif span { display: block; font-size: 12.5px; color: var(--ink-2); line-height: 1.35; }
.notif small { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }
.notif.unread::after { content: ""; position: absolute; right: 12px; top: 16px; width: 8px; height: 8px; border-radius: 50%; background: var(--h-blue); }
.notif-empty { text-align: center; padding: 30px 20px; color: var(--ink-3); }
.notif-foot { padding: 10px 16px 14px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; }

/* ------------------------------------------------------------- Tablette & téléphone */

/* Compléments */
.round-btn.only-compact { display: none; }
.dash .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.only-compact-search { display: none; }
.pill-note { padding: 5px 11px; border-radius: 999px; background: var(--sunken); color: var(--ink-3); font-size: 12px; }
.ti-side { flex: none; text-align: right; font-variant-numeric: tabular-nums; }
.kpi.warn .kpi-value { color: #C02A30; }
.kpi.warn .kpi-ic { background: #FDE7E7; color: #C02A30; }
.kpi-value small { font-size: .6em; color: var(--ink-3); font-weight: 500; }
.kpi.hero .kpi-value small { color: rgba(255,255,255,.8); }
.kpi-sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dash .sub-head { margin-top: 14px; }

@media (max-width: 1100px) {
  .only-compact-search, .round-btn.only-compact { display: grid; }
  .dash .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid .col-3 { grid-column: span 12; }
  .sync-pill { font-size: 0 !important; gap: 0 !important; padding: 0 !important; width: 38px; height: 38px; justify-content: center; border-radius: 50% !important; }
  .sync-pill .ic { font-size: 14px; }
  .shell { grid-template-columns: minmax(0, 1fr); padding: max(10px, env(safe-area-inset-top)) 10px 10px; }
  .sidebar { position: fixed; top: 12px; bottom: 12px; left: 12px; height: auto; width: 280px; transform: translateX(-115%); z-index: 40; box-shadow: var(--soft-lg); }
  body.menu-open .sidebar { transform: none; }
  .topbar { top: 8px; }
  .search-field { display: none; }
  .tabbar { left: 12px; right: 12px; bottom: max(10px, env(safe-area-inset-bottom)); border-radius: 24px; border: 0; background: color-mix(in srgb, var(--surface) 88%, transparent); box-shadow: var(--soft-lg); padding: 6px; }
  .tabbar a { border-radius: 18px; position: relative; }
  .tabbar a.active { background: var(--brand-soft); color: var(--brand); }
  .tabbar .tb-count { position: absolute; top: 2px; right: 14px; min-width: 18px; height: 18px; border-radius: 999px; background: #D93036; color: #fff; font: 700 10.5px/18px var(--font); text-align: center; padding: 0 4px; }
  .view { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
  .col-3 { grid-column: span 6; } .col-4, .col-5, .col-7, .col-8 { grid-column: span 12; } .col-6 { grid-column: span 12; }
  .notif-panel { top: 76px; right: 10px; left: 10px; width: auto; }
  #toasts { bottom: calc(96px + env(safe-area-inset-bottom)); }
}
@media (max-width: 600px) {
  .page-title { font-size: 21px; }
  .page-sub { display: none; }
  .dash .kpis .kpi.hero { grid-column: span 2; }
  .sync-pill, .avatar-btn, .hello .row-gap { display: none !important; }
  .round-btn, .avatar-btn { width: 42px; height: 42px; }
  .topbar .btn-primary { width: 42px; height: 42px; padding: 0; justify-content: center; }
  .theme-btn { display: none; }
  .col-3 { grid-column: span 12; }
  .hello h2 { font-size: 24px; }
  .kpi-value { font-size: 24px; }
}
@media print { .shell { display: block; padding: 0; } .notif-panel { display: none !important; } }
