@charset "UTF-8";
/* 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: var(--font-body);
  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: var(--font-body);
  font-weight: 700;
  letter-spacing: -0.02em;
}

a { color: inherit; text-decoration: none; }
button { font-family: var(--font-body); }
input, textarea, select { font-family: var(--font-body); }

/* ─── 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 { display: inline-block; vertical-align: middle; flex-shrink: 0; }
.icon-box { vertical-align: middle; }
.icon-label { vertical-align: middle; }
.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; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.kpi-sub   { font-size: 10px; font-weight: 700; opacity: 0.5; }

/* ─── 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); }

/* ─── SABI COMMAND (FLOATING AI) ────────────────────────── */
#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: var(--font-body);
  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: var(--font-body);
  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(18, 20, 26, 0.92);
  color: white;
  border: 1px solid rgba(255,255,255,0.10);
}
.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; } }

/* ─── ANIMATIONS ─────────────────────────────────────────────*/
@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: var(--font-body);
  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(249, 249, 254, 0.93), rgba(249, 249, 254, 0.97)), url('../assets/images/tribal-bg.jpg') no-repeat center / cover;
  }
  [data-theme="dark"] .bottom-nav {
    background: linear-gradient(rgba(10, 10, 10, 0.93), rgba(10, 10, 10, 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; }
}

/* ─── MESSAGERIE INTÉGRÉE (webmail) ───────────────────────── */
.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;
  line-height: 1.45;
}
.mail-setup-banner {
  background: color-mix(in srgb, var(--brand) 12%, var(--surface));
  color: var(--text);
  text-align: left;
}
.mail-quota-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  margin-bottom: 14px;
  overflow: hidden;
}
.mail-quota-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 65%, #fff));
  border-radius: 3px;
  transition: width .3s;
}
.mail-shell #mail-search {
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-2, var(--surface));
  font-size: 14px;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.mail-shell #mail-search:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent);
  outline: none;
}
.mail-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 6px 0;
  background: var(--bg, var(--surface));
}
.mail-toolbar .btn-sm { border-radius: 999px; }
.mail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
}
.mail-item {
  display: flex;
  gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  background: transparent;
  transition: background .12s;
  position: relative;
  align-items: flex-start;
}
.mail-item:last-child { border-bottom: 0; }
.mail-item:hover { background: color-mix(in srgb, var(--brand) 4%, var(--surface)); }
.mail-item:active { background: var(--bg-2); }
.mail-item.unread { background: color-mix(in srgb, var(--brand) 7%, var(--surface)); }
.mail-item.unread::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
}
.mail-item.unread .mail-from,
.mail-item.unread .mail-subject { font-weight: 800; }
.mail-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 55%, #000));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
  font-size: 16px;
  box-shadow: 0 2px 6px color-mix(in srgb, var(--brand) 30%, transparent);
}
.mail-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mail-from {
  font-size: 13.5px;
  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;
  white-space: nowrap;
  padding-top: 2px;
}
.mail-empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}
.mail-compose-form {
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
}
.mail-compose-form .form-input { border-radius: 10px; }
.mail-compose-form textarea.form-input { line-height: 1.55; }
.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;
  line-height: 1.6;
}
.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; }
.mail-shell .page-body { overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* ─── Modales mail (signature, provision, admin boîtes) ───── */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(10, 9, 8, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
  animation: fadeIn 0.18s ease;
}
.modal {
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: 20px;
  padding: 26px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow-lg, 0 20px 50px rgba(0, 0, 0, 0.25));
  animation: modalIn 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.modal.lg { max-width: 680px; }
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-title {
  font-size: 19px;
  font-weight: 800;
  margin-bottom: 16px;
  letter-spacing: -0.3px;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}
