/* main.css — Base, Reset, Layout (Improved Agency v3.0) */

/* ─── RESET ────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0; padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%; height: 100dvh;
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  transition: background 0.3s ease, color 0.3s ease;
}

/* Subtle ambient background */
body::before {
  content: "";
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse at 10% 15%, rgba(var(--brand-green-rgb), 0.04) 0%, transparent 45%),
    radial-gradient(ellipse at 90% 85%, rgba(var(--brand-yellow-rgb), 0.04) 0%, transparent 45%);
  pointer-events: none;
  z-index: -1;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

a { color: inherit; text-decoration: none; }
button { font-family: 'DM Sans', sans-serif; }
input, textarea, select { font-family: 'DM Sans', sans-serif; }

/* ─── APP SHELL ────────────────────────────────────────────── */
#app {
  width: 100%; height: 100dvh;
  display: flex; flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* ─── SCREEN ─────────────────────────────────────────────────*/
.screen {
  display: none; flex-direction: column;
  flex: 1; overflow: hidden;
  position: absolute; inset: 0;
}
.screen.active { display: flex; }

/* ─── SCROLL ZONE ────────────────────────────────────────────*/
.scroll-zone {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 20px;
  position: relative;
  display: flex;
  flex-direction: column;
}
.scroll-zone > * { flex-shrink: 0; }

/* Watermark logo */
.scroll-zone::before {
  content: "";
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 260px; height: 260px;
  background: url('../assets/icons/logo_improvedgreen.png') no-repeat center;
  background-size: contain;
  opacity: 0.018;
  filter: grayscale(1);
  pointer-events: none;
  z-index: -1;
}
.scroll-zone::-webkit-scrollbar { display: none; }
.scroll-zone { scrollbar-width: none; }

/* ─── TOPBAR ──────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  flex-shrink: 0;
  position: relative; z-index: 5;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

/* ─── ICON BUTTON ─────────────────────────────────────────── */
.icon-btn {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  color: var(--text-2);
  flex-shrink: 0;
}
.icon-btn:hover  { background: var(--bg-3); border-color: var(--border-2); }
.icon-btn:active { transform: scale(0.90); border-color: var(--brand); }
.icon-btn--active {
  background: var(--brand) !important;
  border-color: var(--brand) !important;
  color: #fff !important;
}

/* ─── BOTTOM NAV ──────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-height, calc(72px + env(safe-area-inset-bottom, 0px)));
  min-height: 72px;
  background: var(--nav-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--border);
  display: none;
  align-items: stretch;
  justify-content: space-around;
  padding: 6px 4px env(safe-area-inset-bottom, 6px);
  z-index: 1000;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.06);
}
.bottom-nav.visible { display: flex; }

.nav-item {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  padding: 6px 4px;
  border-radius: 16px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  flex: 1;
  position: relative;
  min-width: 0;
  min-height: 52px;
  color: var(--text-3);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.nav-item.active { color: var(--brand); background: rgba(var(--brand-green-rgb), 0.08); }
.nav-item:active { transform: scale(0.92); opacity: 0.7; }

.nav-icon {
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.nav-item.active .nav-icon { transform: translateY(-2px) scale(1.1); }

.nav-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-align: center;
  transition: all 0.2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.1;
}
.nav-item.active .nav-label { color: var(--brand); }
.nav-dot { display: none; }

/* ─── FAB ─────────────────────────────────────────────────── */
.fab {
  position: fixed;
  bottom: 88px;
  right: 20px;
  width: 54px; height: 54px;
  border-radius: 18px;
  background: var(--gradient-gold);
  border: none;
  color: var(--text-on-gold);
  box-shadow: var(--shadow-gold), var(--shadow-sm);
  cursor: pointer;
  display: none;
  align-items: center; justify-content: center;
  z-index: 99;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.fab.visible { display: flex; }
.fab:active { transform: scale(0.90); }
.fab:hover  { transform: scale(1.06); box-shadow: var(--shadow-gold), var(--shadow); }
.fab svg {
  width: 24px; height: 24px;
  stroke: currentColor;
  stroke-width: 2.5;
  fill: none;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.fab.menu-open svg { transform: rotate(45deg); }

/* FAB Context Menu */
.fab-menu {
  position: fixed;
  bottom: 154px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 98;
  pointer-events: none;
  opacity: 0;
  transform: translateY(16px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.fab-menu.visible {
  pointer-events: auto;
  opacity: 1;
  transform: translateY(0);
}
.fab-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 16px;
  cursor: pointer;
  box-shadow: var(--shadow);
  white-space: nowrap;
  transition: all 0.2s;
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
}
.fab-menu-item:hover  { transform: translateX(-4px); border-color: var(--brand); }
.fab-menu-item:active { transform: scale(0.95); }
.fab-menu-item .fab-item-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.fab-overlay {
  position: fixed; inset: 0;
  z-index: 97;
  display: none;
}
.fab-overlay.visible { display: block; }

/* ─── CARDS ────────────────────────────────────────────────── */
.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}
.card-interactive { cursor: pointer; }
.card-interactive:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
  border-color: var(--border-2);
}
.card-interactive:active { transform: scale(0.98); opacity: 0.9; }

/* KPI / Glass Card */
.kpi-card {
  background: var(--glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kpi-label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.7; }
.kpi-value { font-size: 22px; font-weight: 900; letter-spacing: -0.02em; }
.kpi-sub   { font-size: 10px; font-weight: 700; opacity: 0.5; }

/* ─── LOADER COMITARI ─────────────────────────────────────── */
.page-loader{padding:48px 24px;text-align:center;color:var(--text-3);font-size:13px;font-weight:600}
.page-loader .splash-dots,.page-loader .splash-track{margin-left:auto;margin-right:auto}
.page-loader .splash-dots{margin-bottom:14px}
.page-loader .splash-track{width:100px;background:var(--bg-3)}
.page-loader .splash-track span{background:linear-gradient(90deg,transparent,var(--brand),#C9A227,transparent)}
.splash-dots{display:flex;gap:8px;justify-content:center}
.splash-dots i{display:block;width:9px;height:9px;border-radius:50%;background:var(--brand,#003893);animation:comitariDot 1.1s ease-in-out infinite;font-style:normal}
.splash-dots i:nth-child(2){animation-delay:.14s}
.splash-dots i:nth-child(3){animation-delay:.28s}
.splash-track{width:128px;height:3px;background:var(--bg-3);border-radius:99px;overflow:hidden}
.splash-track span{display:block;height:100%;width:36%;background:linear-gradient(90deg,transparent,var(--brand),#C9A227,transparent);animation:comitariSlide 1.5s ease-in-out infinite}
@keyframes comitariDot{0%,80%,100%{transform:translateY(0);opacity:.35}40%{transform:translateY(-8px);opacity:1}}
@keyframes comitariSlide{0%{transform:translateX(-120%)}100%{transform:translateX(320%)}}

/* ─── SKELETON ────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(110deg, var(--bg-3) 30%, var(--bg-4) 50%, var(--bg-3) 70%);
  background-size: 200% 100%;
  animation: shine 1.5s linear infinite;
  border-radius: 16px;
}
@keyframes shine {
  to { background-position: -200% 0; }
}

/* ─── ENTRANCE ANIMATIONS ──────────────────────────────────── */
.animate-stagger-list > * {
  opacity: 0;
  animation: slideInPremium 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes slideInPremium {
  from { transform: translateY(12px) scale(0.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* Generative delay classes */
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }

/* ─── MODALS & SHEETS ────────────────────────────────────── */
.sheet {
  transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
}
.sheet-open { transform: translateY(0) !important; }

/* ─── SEARCH BAR ──────────────────────────────────────────── */
.search-bar-container { width: 100%; transition: all 0.3s; }
.search-bar-container:focus-within { transform: translateY(-1px); }

/* Accueil Comitari */
.home-hero {
  padding: 20px 22px;
  margin-bottom: 16px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--brand) 0%, color-mix(in srgb, var(--brand) 70%, #001A3F) 100%);
  color: #fff;
  border: none;
  box-shadow: var(--shadow-brand, 0 8px 28px rgba(0, 56, 147, 0.22));
}
.home-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
@media (min-width: 768px) {
  .home-kpi-grid { grid-template-columns: repeat(4, 1fr); gap: 12px; }
}
.home-kpi {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 88px;
}
.home-insight {
  padding: 16px; margin-bottom: 16px; border-radius: 18px;
  border: 1px solid var(--border); border-left: 4px solid var(--brand); background: var(--bg-2);
}
.home-insight__head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.home-insight__body { font-size: 13px; line-height: 1.55; color: var(--text-2); font-weight: 500; }
.home-quick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
@media (min-width: 600px) {
  .home-quick-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
}
@media (min-width: 1024px) {
  .home-quick-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
}
.quick-action {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 14px 14px;
  min-height: 72px;
  text-align: left;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.quick-action:hover {
  border-color: color-mix(in srgb, var(--brand) 35%, var(--border));
  box-shadow: 0 4px 16px rgba(0, 56, 147, 0.08);
}
.quick-action:active { transform: scale(0.98); }
.quick-action__icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--bg-3);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 0;
}
.quick-action__icon .icon { display: block; }
.quick-action__body { flex: 1; min-width: 0; }
.quick-action__label {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.quick-action__sub {
  font-size: 10px;
  color: var(--text-3);
  margin-top: 3px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ─── SABI COMMAND (FLOATING AI) ────────────────────────── */
#sabi-command-bubble[hidden],
#sabi-command-panel[hidden] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
#sabi-command-bubble {
  position: fixed; bottom: 84px; right: 16px;
  width: 48px; height: 48px; border-radius: 16px;
  background: var(--brand);
  color: white; font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 132, 95, 0.4);
  cursor: pointer; z-index: 900;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  user-select: none; touch-action: none;
}
#sabi-command-bubble:active { transform: scale(0.9); }
#sabi-command-bubble.open { transform: rotate(45deg); background: var(--danger); }

@media (min-width: 900px) {
  #sabi-command-bubble { width: 56px; height: 56px; bottom: 32px; right: 32px; border-radius: 20px; font-size: 26px; }
}

#sabi-command-panel {
  position: fixed; bottom: 142px; right: 16px;
  width: 340px; max-width: calc(100vw - 32px);
  max-height: 450px; background: var(--bg-2);
  border-radius: 24px; border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); z-index: 999;
  display: none; flex-direction: column; overflow: hidden;
}
#sabi-command-panel.open { display: flex; animation: slideInUp 0.3s cubic-bezier(0.4, 0, 0.2, 1); }

.sabi-chat-header { padding: 16px; background: var(--bg-3); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.sabi-chat-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.sabi-chat-input-zone { padding: 12px; border-top: 1px solid var(--border); background: var(--bg-2); }

.msg { padding: 10px 14px; border-radius: 16px; font-size: 13px; max-width: 85%; line-height: 1.4; }
.msg-ai { background: var(--bg-3); color: var(--text); align-self: flex-start; border-bottom-left-radius: 4px; font-weight: 500; }
.msg-user { background: var(--brand); color: white; align-self: flex-end; border-bottom-right-radius: 4px; font-weight: 600; }

@keyframes slideInUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ─── BADGES ─────────────────────────────────────────────────*/
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.4px;
}
.badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.s-attente { background: rgba(217, 119, 6, 0.12); color: #B45309; }
.s-encours { background: rgba(var(--brand-green-rgb), 0.10); color: var(--brand); }
.s-prete   { background: rgba(37, 99, 235, 0.10); color: #2563EB; }
.s-livre   { background: rgba(22, 163, 74, 0.10); color: #16A34A; }
.s-annule  { background: rgba(220, 38, 38, 0.10); color: #DC2626; }
.s-devis   { background: rgba(139, 92, 246, 0.12); color: #7C3AED; }

/* ─── FORM ELEMENTS ──────────────────────────────────────────*/
.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
  display: block; font-size: 11px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.6px;
}
.form-input {
  width: 100%;
  background: var(--bg-3);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 14px; color: var(--text);
  font-family: 'DM Sans', sans-serif;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  appearance: none;
  -webkit-appearance: none;
}
.form-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(var(--brand-green-rgb), 0.10);
  background: var(--bg-2);
}
.form-input::placeholder { color: var(--text-4); }
select.form-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239A948C' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
textarea.form-input { resize: vertical; min-height: 80px; }

.form-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--nav-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  z-index: 90;
}

/* ─── BUTTONS ────────────────────────────────────────────────*/
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 14px; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
  border: none; font-family: 'DM Sans', sans-serif;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: scale(0.95); }

.btn-brand {
  background: var(--gradient-brand);
  color: white;
  box-shadow: var(--shadow-brand);
}
.btn-brand:hover:not(:disabled) { box-shadow: var(--shadow-brand), var(--shadow-sm); }

.btn-gold {
  background: var(--gradient-gold);
  color: var(--text-on-gold);
  box-shadow: var(--shadow-gold);
}
.btn-gold:hover:not(:disabled) { box-shadow: var(--shadow-gold), var(--shadow-sm); }

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-success {
  background: var(--success);
  color: white;
}
.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-2);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-3); border-color: var(--border-2); }

.btn-outline {
  background: var(--bg-2);
  border: 1.5px solid var(--border-2);
  color: var(--text);
}
.btn-outline:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }

.btn-sm { padding: 8px 14px; font-size: 12px; border-radius: 10px; }
.btn-lg { padding: 16px 28px; font-size: 16px; border-radius: 16px; }
.btn-full { width: 100%; }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: 12px; flex-shrink: 0; }

/* ─── LOADING / SPINNER ──────────────────────────────────────*/
.btn-spinner {
  width: 16px; height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--bg-3) 25%, var(--bg-4) 50%, var(--bg-3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 12px;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── TOAST ──────────────────────────────────────────────────*/
.toast {
  position: fixed;
  bottom: calc(var(--nav-height, 90px) + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  max-width: min(420px, calc(100vw - 32px));
  padding: 14px 18px;
  border-radius: 16px;
  font-size: 13px; font-weight: 600;
  display: flex; align-items: flex-start; gap: 10px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 9000;
  white-space: normal;
  line-height: 1.4;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.toast-visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.toast-success {
  background: rgba(22, 163, 74, 0.92);
  color: white;
  border: 1px solid rgba(22, 163, 74, 0.4);
}
.toast-error {
  background: rgba(220, 38, 38, 0.92);
  color: white;
  border: 1px solid rgba(220, 38, 38, 0.4);
}
.toast-info {
  background: rgba(15, 13, 10, 0.88);
  color: white;
  border: 1px solid rgba(255,255,255,0.12);
}
.toast-warning {
  background: rgba(217, 119, 6, 0.92);
  color: white;
  border: 1px solid rgba(217, 119, 6, 0.4);
}

/* ─── BOTTOM SHEET ───────────────────────────────────────────*/
.sheet-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1200;
  display: flex; align-items: flex-end;
  opacity: 0; visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  overscroll-behavior: contain;
}
.sheet-overlay.open {
  opacity: 1; visibility: visible;
}
.sheet {
  background: var(--sheet-bg);
  border-radius: 28px 28px 0 0;
  width: 100%; max-width: 600px;
  margin: 0 auto;
  max-height: min(94dvh, calc(100dvh - env(safe-area-inset-top, 0px) - 8px));
  min-height: 0;
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  overflow: hidden;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.2);
}
.sheet-overlay.open .sheet {
  transform: translateY(0);
}
.sheet-handle {
  width: 40px; height: 4px;
  background: var(--border-2);
  border-radius: 2px;
  margin: 12px auto 4px;
  flex-shrink: 0;
  touch-action: none;
}
.sheet-body {
  overflow-x: hidden;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: 4px 0 calc(16px + env(safe-area-inset-bottom, 0px));
}
.sheet-body::-webkit-scrollbar { display: none; }

body.sheet-open {
  overflow: hidden;
  touch-action: none;
}

/* Overlays / modales ad hoc (hors openSheet) — même empilement que .sheet-overlay */
.modal-overlay,
.app-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  overscroll-behavior: contain;
}
.modal-overlay > .modal-panel,
.app-overlay > .modal-panel {
  width: 100%;
  max-width: 600px;
  max-height: min(96dvh, calc(100dvh - env(safe-area-inset-top, 0px) - 4px));
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 24px 24px 0 0;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}

/* Desktop Modal Override */
@media (min-width: 768px) {
  .sheet-overlay {
    align-items: center;
    justify-content: center;
    padding: 20px;
  }
  .sheet {
    border-radius: 24px;
    max-height: 85vh;
    transform: translateY(30px) scale(0.95);
    opacity: 0;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  }
  .sheet-overlay.open .sheet {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  .sheet-handle { display: none; }
  .sheet-body { padding: 24px; }
}

/* ─── SUCCESS POPUP ──────────────────────────────────────────*/
.success-popup-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  opacity: 0; visibility: hidden;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 20px;
}
.success-popup-overlay.active {
  opacity: 1; visibility: visible;
}
.success-popup-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 36px 28px;
  width: 100%; max-width: 340px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  transform: scale(0.82) translateY(20px);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.success-popup-overlay.active .success-popup-card {
  transform: scale(1) translateY(0);
}
.checkmark-svg {
  width: 80px; height: 80px;
  display: block; margin: 0 auto 20px;
}
.checkmark-circle {
  stroke: var(--brand);
  stroke-width: 2.5;
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  fill: none;
  animation: stroke-circle 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}
.checkmark-check {
  stroke: var(--brand);
  stroke-width: 2.5;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  stroke-linecap: round;
  fill: none;
  animation: stroke-check 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.55s forwards;
}
@keyframes stroke-circle { 100% { stroke-dashoffset: 0; } }
@keyframes stroke-check  { 100% { stroke-dashoffset: 0; } }

/* ─── ACHIEVEMENT POPUP (trophées guide) ─────────────────────*/
.achievement-popup-overlay {
  position: fixed; inset: 0;
  background: rgba(10, 37, 64, 0.55);
  backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  z-index: 10050;
  opacity: 0; visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s;
  padding: 20px;
}
.achievement-popup-overlay.active { opacity: 1; visibility: visible; }
.achievement-popup-card {
  position: relative;
  background: linear-gradient(165deg, var(--bg-2) 0%, color-mix(in srgb, var(--brand) 6%, var(--bg-2)) 100%);
  border: 1px solid color-mix(in srgb, var(--brand) 25%, var(--border));
  border-radius: 28px;
  padding: 32px 24px 24px;
  width: 100%; max-width: 360px;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18);
  transform: scale(0.75) translateY(24px);
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}
.achievement-popup-overlay.active .achievement-popup-card {
  transform: scale(1) translateY(0);
}
.achievement-trophy-ring {
  width: 88px; height: 88px; margin: 0 auto 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, #FDE68A, #F59E0B);
  box-shadow: 0 8px 28px rgba(245, 158, 11, 0.45);
  animation: trophy-bounce 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s both;
}
.tier-silver .achievement-trophy-ring {
  background: linear-gradient(145deg, #E2E8F0, #94A3B8);
  box-shadow: 0 8px 28px rgba(148, 163, 184, 0.5);
}
.tier-gold .achievement-trophy-ring {
  background: linear-gradient(145deg, #FDE047, #EAB308);
  box-shadow: 0 8px 32px rgba(234, 179, 8, 0.55);
}
.tier-legend .achievement-trophy-ring {
  background: linear-gradient(145deg, #C4B5FD, #7C3AED);
  box-shadow: 0 8px 36px rgba(124, 58, 237, 0.55);
}
.achievement-trophy-icon { font-size: 42px; line-height: 1; }
.achievement-eyebrow {
  font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--brand); margin-bottom: 6px;
}
.achievement-title {
  font-size: 22px; font-weight: 900; color: var(--text);
  margin: 0 0 8px; line-height: 1.2;
}
.achievement-message {
  font-size: 14px; color: var(--text-2); line-height: 1.55;
  margin: 0 0 16px;
}
.achievement-meta {
  display: flex; gap: 8px; justify-content: center; align-items: center;
  margin-bottom: 18px; flex-wrap: wrap;
}
.achievement-tier, .achievement-points {
  font-size: 11px; font-weight: 800; padding: 5px 10px; border-radius: 999px;
}
.badge-tier-bronze { background: #FEF3C7; color: #92400E; }
.badge-tier-silver { background: #F1F5F9; color: #475569; }
.badge-tier-gold { background: #FEF9C3; color: #854D0E; }
.badge-tier-legend { background: #EDE9FE; color: #5B21B6; }
.achievement-points { background: var(--bg-3); color: var(--text-2); }
@keyframes trophy-bounce {
  0% { transform: scale(0) rotate(-20deg); opacity: 0; }
  60% { transform: scale(1.12) rotate(6deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* ─── GUIDE PARCOURS ─────────────────────────────────────────*/
.guide-hero {
  background: linear-gradient(135deg, var(--navy, #0A2540) 0%, color-mix(in srgb, var(--brand) 40%, #0A2540) 100%);
  color: #fff; border-radius: 20px; padding: 24px 20px;
  margin-bottom: 16px; position: relative; overflow: hidden;
}
.guide-hero::after {
  content: ''; position: absolute; right: -30px; top: -30px;
  width: 140px; height: 140px; border-radius: 50%;
  background: rgba(255,255,255,0.06);
}
.guide-progress-ring {
  width: 72px; height: 72px; flex-shrink: 0;
}
.guide-trophy-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  margin-bottom: 16px;
}
@media (min-width: 520px) { .guide-trophy-grid { grid-template-columns: repeat(6, 1fr); } }
.guide-trophy {
  aspect-ratio: 1; border-radius: 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: 8px 4px; text-align: center;
  background: var(--bg-2); border: 1px solid var(--border);
  transition: transform 0.2s, box-shadow 0.2s;
}
.guide-trophy.unlocked {
  border-color: color-mix(in srgb, #F59E0B 40%, var(--border));
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.15);
}
.guide-trophy.locked { opacity: 0.45; filter: grayscale(0.8); }
.guide-trophy-icon { font-size: 22px; line-height: 1; }
.guide-trophy-label { font-size: 8px; font-weight: 800; color: var(--text-3); line-height: 1.2; }
.guide-chapter {
  border-radius: 18px; border: 1px solid var(--border);
  background: var(--bg-2); margin-bottom: 12px; overflow: hidden;
  transition: box-shadow 0.2s;
}
.guide-chapter.open { box-shadow: var(--shadow-md); }
.guide-chapter-head {
  display: flex; align-items: center; gap: 14px; padding: 16px;
  cursor: pointer; user-select: none;
}
.guide-chapter-icon {
  width: 44px; height: 44px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.guide-chapter-body { padding: 0 16px 16px; display: none; }
.guide-chapter.open .guide-chapter-body { display: block; animation: fadeUp 0.35s ease; }
.guide-step {
  display: flex; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.guide-step:last-child { border-bottom: none; }
.guide-step-num {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  background: color-mix(in srgb, var(--brand) 12%, var(--bg-3));
  color: var(--brand); font-size: 12px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
}
.guide-tip {
  margin-top: 12px; padding: 12px 14px; border-radius: 12px;
  background: color-mix(in srgb, var(--brand) 8%, var(--bg-3));
  font-size: 13px; color: var(--text-2); line-height: 1.5;
}
.guide-hero__glow {
  position: absolute; inset: -40% -20% auto auto;
  width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle, rgba(253, 230, 138, 0.25) 0%, transparent 70%);
  pointer-events: none;
}
.guide-next-step {
  display: flex; align-items: center; gap: 14px;
  width: 100%; margin-bottom: 16px; padding: 16px;
  border-radius: 18px; border: 1px solid color-mix(in srgb, var(--brand) 30%, var(--border));
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 8%, var(--bg-2)) 0%, var(--bg-2) 100%);
  cursor: pointer; font-family: inherit; text-align: left;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.guide-next-step:hover { box-shadow: var(--shadow-md); }
.guide-next-step:active { transform: scale(0.98); }
.guide-next-step--complete {
  border-color: color-mix(in srgb, #F59E0B 35%, var(--border));
  background: linear-gradient(135deg, #FFFBEB 0%, var(--bg-2) 100%);
  cursor: default;
}
.guide-next-step__icon { font-size: 28px; line-height: 1; flex-shrink: 0; }
.guide-next-step__eyebrow {
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--brand); margin-bottom: 2px;
}
.guide-next-step__title { font-size: 15px; font-weight: 900; color: var(--text); }
.guide-next-step__hint { font-size: 12px; color: var(--text-3); margin-top: 2px; line-height: 1.4; }
.guide-next-step__arrow { font-size: 20px; font-weight: 900; color: var(--brand); flex-shrink: 0; }
.guide-trophy-panel { position: relative; overflow: hidden; }
.guide-trophy.unlocked .guide-trophy-icon { animation: trophy-bounce 0.5s ease both; }
.guide-trophy.unlocked:hover { transform: translateY(-2px) scale(1.03); }
.guide-trophy-label { font-size: 9px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guide-path-complete {
  text-align: center; padding: 14px; font-weight: 800; color: var(--brand);
  background: color-mix(in srgb, #F59E0B 10%, var(--bg-3));
  border-radius: 12px; margin-top: 8px;
}
.guide-chapter-badge {
  font-size: 20px; width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--bg-3);
}
.guide-chapter-badge.done {
  background: color-mix(in srgb, #F59E0B 15%, var(--bg-3));
  box-shadow: 0 0 0 2px color-mix(in srgb, #F59E0B 25%, transparent);
}
.guide-chapter-cta { margin-top: 14px; }
.guide-md-scroll { max-height: 320px; overflow: auto; line-height: 1.6; }
.guide-promo {
  display: flex; align-items: center; gap: 14px;
  padding: 16px; margin-bottom: 16px; border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--brand) 25%, var(--border));
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 10%, var(--bg-2)) 0%, var(--bg-2) 100%);
  cursor: pointer; width: 100%; font-family: inherit; text-align: left;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.guide-promo:hover { box-shadow: var(--shadow-md); }
.guide-promo:active { transform: scale(0.98); }
.guide-promo__ring { width: 52px; height: 52px; flex-shrink: 0; }
.guide-promo__title { font-size: 15px; font-weight: 900; color: var(--text); }
.guide-promo__sub { font-size: 12px; color: var(--text-3); margin-top: 2px; line-height: 1.4; }
.achievement-confetti {
  position: absolute; inset: 0; pointer-events: none; overflow: hidden;
  border-radius: inherit;
}
.achievement-confetti::before,
.achievement-confetti::after {
  content: '🎉 ✨ 🏆 ⭐';
  position: absolute; left: 50%; top: 0;
  font-size: 14px; letter-spacing: 8px;
  transform: translateX(-50%);
  animation: confetti-fall 1.2s ease-out forwards;
  opacity: 0;
}
.achievement-confetti::after {
  animation-delay: 0.15s;
  content: '✨ 🎊 ⭐ 🎉';
  font-size: 12px;
}
@keyframes confetti-fall {
  0% { opacity: 0; transform: translate(-50%, -20px) scale(0.6); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, 80px) scale(1.1); }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(32px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.88); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.6; transform: scale(0.85); }
}
@keyframes stagger-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes countUp { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }

.animate-fadeUp   { animation: fadeUp  0.4s cubic-bezier(0.16, 1, 0.3, 1) both; }
.animate-fadeIn   { animation: fadeIn  0.3s ease-out both; }
.animate-slideUp  { animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both; }
.animate-scaleIn  { animation: scaleIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both; }

.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.10s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.20s; }
.stagger-5 { animation-delay: 0.25s; }

/* View Transitions API */
::view-transition-old(root),
::view-transition-new(root) { animation-duration: 0.28s; }

/* ─── SEARCH BAR ──────────────────────────────────────────── */
.search-bar {
  margin: 12px 16px 0;
  position: relative; flex-shrink: 0;
}
.search-bar .search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-3); pointer-events: none;
}
.search-bar input {
  width: 100%;
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 11px 14px 11px 42px;
  font-size: 14px; color: var(--text);
  font-family: 'DM Sans', sans-serif;
  outline: none; transition: all 0.2s;
}
.search-bar input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(var(--brand-green-rgb), 0.10);
}

/* ─── DESKTOP SIDEBAR ─────────────────────────────────────── */
@media (min-width: 900px) {
  body:has(.bottom-nav.visible) #app {
    width: calc(100vw - 240px) !important;
    margin-left: 240px !important;
  }
  .bottom-nav {
    flex-direction: column;
    width: 240px; height: 100dvh;
    left: 0; top: 0;
    border-right: 1px solid var(--border);
    border-top: none;
    padding: 16px 0 20px;
    justify-content: flex-start;
    gap: 2px;
    overflow-y: auto;
    background: linear-gradient(rgba(242, 239, 233, 0.93), rgba(242, 239, 233, 0.97)), url('../assets/images/tribal-bg.jpg') no-repeat center / cover;
  }
  [data-theme="dark"] .bottom-nav {
    background: linear-gradient(rgba(17, 17, 17, 0.93), rgba(17, 17, 17, 0.97)), url('../assets/images/tribal-bg.jpg') no-repeat center / cover;
  }
  .nav-item {
    flex: none; flex-direction: row;
    margin: 2px 12px; padding: 12px 16px;
    gap: 14px;
    border-radius: 14px;
    justify-content: flex-start;
  }
  .nav-label { font-size: 14px; font-weight: 600; }
  .nav-dot { display: none; }
  .nav-item.active { background: rgba(var(--brand-green-rgb), 0.09); }

  .fab {
    bottom: 30px;
    right: calc(50vw - 120px + 30px);
  }
  .fab-menu {
    bottom: 96px;
    right: calc(50vw - 120px + 30px);
  }
  .toast { bottom: 30px; }
}

/* ─── EMPTY STATE ─────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 24px; text-align: center; gap: 12px;
}
.empty-state-icon {
  width: 72px; height: 72px;
  border-radius: 24px;
  background: var(--bg-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  margin-bottom: 4px;
}
.empty-state-title {
  font-size: 16px; font-weight: 700; color: var(--text);
}
.empty-state-sub {
  font-size: 13px; color: var(--text-3); line-height: 1.5;
  max-width: 260px;
}

/* ─── NAVIGATION GROUPS ───────────────────────────────────── */
.nav-group {
  width: 100%;
  margin-bottom: 4px;
}
.nav-group-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 14px;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}
.nav-group-header:hover {
  background: var(--bg-3);
  color: var(--text);
}
.nav-group-header .chevron {
  margin-left: auto;
  transition: transform 0.3s ease;
  opacity: 0.5;
}
.nav-group.open .nav-group-header {
  color: var(--brand);
}
.nav-group-header.active {
  color: var(--brand);
  font-weight: 700;
}
.nav-group-header.active .nav-icon {
  color: var(--brand);
}
.nav-group.open .chevron {
  transform: rotate(180deg);
  opacity: 1;
}

.nav-group-items {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding-left: 20px;
}
.nav-group.open .nav-group-items {
  max-height: 500px;
  margin-top: 4px;
  margin-bottom: 8px;
}

.nav-group-items .nav-item {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0.7;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 12px;
  margin-bottom: 2px;
}
.nav-group-items .nav-item .nav-icon {
  opacity: 0.6;
  width: 18px;
  height: 18px;
}
.nav-group-items .nav-item.active .nav-icon {
  opacity: 1;
  color: var(--brand);
}
.nav-group-items .nav-item.active {
  opacity: 1;
  color: var(--brand);
  background: transparent;
}
.nav-group-items .nav-item:hover {
  opacity: 1;
  background: rgba(var(--text-rgb), 0.03);
}

/* Bouton « Plus » : visible sur mobile uniquement */
.nav-more-btn { display: none; }

@media (max-width: 899px) {
  .nav-more-btn.nav-item { display: flex !important; }
  /* Les groupes s'effacent : leurs items deviennent enfants directs de la barre */
  .nav-group, .nav-group-items { display: contents; }
  .nav-group-header { display: none; }
  .divider { display: none; }
  .section-header { display: none; }
  #sidebar-brand { display: none; }

  /* Barre fixe : seuls les 5 onglets primaires sont visibles */
  .bottom-nav.visible {
    justify-content: space-around;
    overflow: visible;
    padding: 0 2px;
  }
  .bottom-nav .nav-item { display: none; }
  .bottom-nav .nav-item.nav-primary { display: flex; flex: 1; min-width: 0; }

  /* Uniformise les items issus des groupes pour qu'ils ressemblent aux onglets de base */
  .nav-group-items .nav-item {
    opacity: 1; padding: 8px 6px; flex-direction: column; gap: 3px;
    font-size: inherit; font-weight: inherit; margin: 0; border-radius: 16px;
  }
  .nav-group-items .nav-item .nav-icon { opacity: 1; width: auto; height: auto; }
}

/* ─── DIVIDER ─────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 8px 16px;
  display: none; /* Hide on mobile */
}
.section-header {
  font-size: 10px; font-weight: 800; color: var(--text-4);
  text-transform: uppercase; letter-spacing: 1.2px;
  padding: 0 16px;
  margin: 20px 12px 6px;
  display: none;
}

@media (min-width: 900px) {
  .divider { display: block; }
  .section-header { display: block; }
}

/* Notification — signet déplaçable + panneau coulissant */
.notif-edge-tab {
  position: fixed;
  right: 0;
  top: 42vh;
  z-index: 850;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 36px;
  padding: 12px 6px 10px 8px;
  border: none;
  border-radius: 14px 0 0 14px;
  background: rgba(0, 56, 147, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  cursor: grab;
  touch-action: none;
  box-shadow: -3px 0 16px rgba(0, 26, 63, 0.2);
  transition: width 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.notif-edge-tab--dragging {
  cursor: grabbing;
  box-shadow: -6px 0 24px rgba(0, 26, 63, 0.28);
  background: rgba(0, 56, 147, 0.95);
}
.notif-edge-tab.hidden { display: none; }
.notif-edge-tab:hover,
.notif-edge-tab:focus-visible {
  width: 44px;
  background: rgba(0, 56, 147, 0.92);
  outline: none;
}
.notif-edge-tab__grip {
  width: 14px;
  height: 3px;
  border-radius: 99px;
  background: rgba(255,255,255,0.45);
  margin-bottom: 2px;
}
.notif-edge-tab__icon { display: flex; align-items: center; justify-content: center; line-height: 0; }
.notif-edge-tab__icon svg { stroke: currentColor; }
.notif-edge-tab__label {
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  opacity: 0.88;
}
.notif-edge-tab .notif-badge {
  position: absolute;
  top: 6px;
  left: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
  border: 2px solid rgba(255,255,255,0.9);
}
.notif-edge-tab .notif-badge.hidden { display: none; }

.notif-panel-overlay {
  position: fixed;
  inset: 0;
  z-index: 860;
  background: rgba(0, 17, 53, 0);
  pointer-events: none;
  transition: background 0.28s ease;
}
.notif-panel-overlay--open {
  background: rgba(0, 17, 53, 0.38);
  pointer-events: auto;
}
.notif-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 870;
  width: min(400px, 100vw);
  height: 100dvh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  transform: translateX(105%);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
.notif-panel--open { transform: translateX(0); }
body.notif-panel-open { overflow: hidden; }
.notif-panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 18px 12px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 8%, var(--surface)) 0%, var(--surface) 100%);
}
.notif-panel__eyebrow { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.6px; color: var(--brand); }
.notif-panel__title { font-size: 20px; font-weight: 900; color: var(--text); margin-top: 2px; }
.notif-panel__sub { font-size: 12px; color: var(--text-3); margin-top: 4px; font-weight: 600; }
.notif-panel__close { min-width: 36px; padding: 6px 10px !important; }
.notif-panel__actions {
  display: flex;
  gap: 8px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
}
.notif-panel__list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px 24px;
  -webkit-overflow-scrolling: touch;
}
.notif-panel-loading, .notif-panel-empty {
  padding: 32px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}
.notif-panel-empty__icon { font-size: 40px; margin-bottom: 12px; }
.notif-panel-empty__title { font-size: 15px; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.notif-panel-empty__sub { font-size: 12px; line-height: 1.5; }
.notif-panel-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  width: 100%;
  padding: 12px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.notif-panel-item:hover { border-color: color-mix(in srgb, var(--brand) 30%, var(--border)); }
.notif-panel-item:active { transform: scale(0.99); }
.notif-panel-item--unread {
  background: color-mix(in srgb, var(--brand) 5%, var(--surface));
  border-color: color-mix(in srgb, var(--brand) 22%, var(--border));
}
.notif-panel-item__icon {
  width: 38px; height: 38px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; flex-shrink: 0;
}
.notif-panel-item__body { flex: 1; min-width: 0; }
.notif-panel-item__meta {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 10px; font-weight: 800; text-transform: uppercase; color: var(--text-4);
}
.notif-panel-item__title {
  display: block; font-size: 13px; font-weight: 800; color: var(--text);
  margin-top: 4px; line-height: 1.35;
}
.notif-panel-item__text {
  display: block; font-size: 11px; color: var(--text-3);
  margin-top: 4px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.notif-panel-item__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand); flex-shrink: 0; margin-top: 6px;
}
@media (max-width: 899px) {
  .notif-panel { width: 100vw; border-left: none; }
}

/* Icônes SVG (Lucide-style) */
.icon { display: inline-block; vertical-align: middle; flex-shrink: 0; }
.icon-box { line-height: 0; }
.icon-label { display: inline-flex; align-items: center; gap: 8px; }
.btn .icon, .btn .icon-box, .btn .icon-label { pointer-events: none; }
.btn-icon-wrap { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
.empty-state .icon-box { margin-bottom: 4px; }
.context-menu-item .icon { display: block; }

/* ─── PORTAIL CLIENT PUBLIC ─────────────────────────────────── */
body.is-portal #app {
  width: 100% !important;
  margin-left: 0 !important;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
body.is-portal .bottom-nav,
body.is-portal #notif-edge-tab,
body.is-portal #notif-panel,
body.is-portal #notif-panel-overlay,
body.is-portal #subscription-banner,
body.is-portal #sabi-command-bubble,
body.is-portal #sabi-command-panel {
  display: none !important;
}

/* ─── MESSAGERIE INTÉGRÉE ─────────────────────────────────── */
.mail-demo-banner { background: #fef3c7; color: #92400e; font-size: 12px; font-weight: 600; text-align: center; padding: 8px 12px; border-radius: 10px; margin-bottom: 12px; }
.mail-quota-bar { height: 6px; background: var(--border); border-radius: 3px; margin-bottom: 14px; overflow: hidden; }
.mail-quota-fill { height: 100%; background: var(--brand); border-radius: 3px; transition: width .3s; }
.mail-toolbar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.mail-list { list-style: none; margin: 0; padding: 0; }
.mail-item { display: flex; gap: 12px; padding: 14px 12px; border-bottom: 1px solid var(--border); cursor: pointer; background: var(--surface); }
.mail-item:active { background: var(--bg-2); }
.mail-item.unread { background: color-mix(in srgb, var(--brand) 8%, var(--surface)); }
.mail-item.unread .mail-subject { font-weight: 800; }
.mail-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; flex-shrink: 0; font-size: 15px; }
.mail-body { flex: 1; min-width: 0; }
.mail-from { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-subject { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-snippet { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-date { font-size: 11px; color: var(--text-3); flex-shrink: 0; }
.mail-empty { padding: 40px; text-align: center; color: var(--text-3); }
.mail-read-html { font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
.mail-read-text { white-space: pre-wrap; font-family: inherit; font-size: 14px; }
.nav-badge { position: absolute; top: 2px; right: 8px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 800; min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
#nav-mail { position: relative; }

/* ─── BOUTIQUE & WALLET COMM ──────────────────────────────── */
.shop-loading, .shop-empty { padding: 40px; text-align: center; color: var(--text-3); }
.shop-balance-card {
  padding: 20px; border-radius: var(--radius-lg, 16px); margin-bottom: 16px;
  background: linear-gradient(135deg, var(--brand) 0%, color-mix(in srgb, var(--brand) 70%, #000) 100%);
  color: #fff; text-align: center;
}
.shop-balance-label { font-size: 11px; font-weight: 800; text-transform: uppercase; opacity: .85; letter-spacing: .5px; }
.shop-balance-amount { font-size: 28px; font-weight: 900; margin: 6px 0; }
.shop-balance-hint { font-size: 11px; opacity: .8; line-height: 1.4; }
.shop-pool-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.shop-pool-tile {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 8px; text-align: center;
}
.shop-pool-val { font-size: 20px; font-weight: 900; color: var(--brand); }
.shop-pool-lbl { font-size: 10px; color: var(--text-3); margin-top: 4px; font-weight: 700; text-transform: uppercase; }
.shop-section { margin-bottom: 24px; }
.shop-section-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.shop-section-icon { font-size: 24px; line-height: 1; }
.shop-section-title { font-size: 15px; font-weight: 900; }
.shop-section-hint { font-size: 12px; color: var(--text-3); line-height: 1.4; margin-top: 2px; }
.shop-grid { display: grid; gap: 10px; }
@media (min-width: 600px) { .shop-grid { grid-template-columns: 1fr 1fr; } }
.shop-card {
  display: flex; flex-direction: column; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px; min-height: 140px; transition: border-color .15s, box-shadow .15s;
}
.shop-card:active { border-color: var(--brand); box-shadow: 0 4px 16px rgba(0,0,0,.06); }
.shop-card-title { font-size: 14px; font-weight: 800; margin: 0 0 6px; }
.shop-card-desc { font-size: 12px; color: var(--text-3); line-height: 1.45; margin: 0; }
.shop-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.shop-card-price { font-size: 15px; font-weight: 900; color: var(--brand); }
