/* ====================================================================
   SUIVI — Design System "Luminous Ledger Dark"
   Palette : #0B0F17, #131B26, #182332, #10B981, #3B82F6, #A855F7
   Polices : Plus Jakarta Sans & JetBrains Mono
   Mobile First & Desktop Perfection
   ==================================================================== */

:root {
  --canvas-base: #0B0F17;
  --surface-card: #131B26;
  --surface-elevated: #182332;
  --surface-sunken: #0E1520;
  --border-subtle: #1F2C3F;
  --border-focus: #3B82F6;
  --border-hover: #2D415D;

  --primary: #10B981;
  --primary-hover: #34D399;
  --primary-glow: rgba(16, 185, 129, 0.2);
  --primary-subtle: rgba(16, 185, 129, 0.12);

  --google-blue: #3B82F6;
  --google-blue-subtle: rgba(59, 130, 246, 0.12);

  --accent-purple: #A855F7;
  --accent-purple-subtle: rgba(168, 85, 247, 0.12);

  --danger: #EF4444;
  --danger-subtle: rgba(239, 68, 68, 0.12);

  --warning: #F59E0B;
  --warning-subtle: rgba(245, 158, 11, 0.12);

  --text-high: #F8FAFC;
  --text-mid: #94A3B8;
  --text-muted: #64748B;

  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --shadow-modal: 0 25px 50px -12px rgba(0, 0, 0, 0.75);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  background-color: var(--canvas-base);
  color: var(--text-high);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* Polices & Tabular Figures */
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* Utilitaires Safe Area & Scroll */
.pb-safe {
  padding-bottom: var(--safe-bottom);
}
.pt-safe {
  padding-top: var(--safe-top);
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.no-scrollbar::-webkit-scrollbar {
  display: none;
}

/* Custom desktop scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--canvas-base);
}
::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ============================== Layout Général ============================== */
#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Desktop */
.sidebar {
  width: 260px;
  background-color: var(--surface-card);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 1.5rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-logo-wrap {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
}

.brand-logo-wrap img {
  width: 24px;
  height: 24px;
  border-radius: 6px;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-high);
  letter-spacing: -0.02em;
}

.brand-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  background: var(--surface-sunken);
  color: var(--primary);
  border: 1px solid var(--primary-subtle);
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.sidebar-nav {
  padding: 1.25rem 0.75rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  color: var(--text-mid);
  text-decoration: none;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.nav-link:hover {
  background: var(--surface-elevated);
  color: var(--text-high);
  border-color: var(--border-subtle);
}

.nav-link.active {
  background: var(--surface-sunken);
  color: var(--primary);
  border-color: var(--border-subtle);
  font-weight: 600;
  box-shadow: inset 0 1px 0 0 rgba(52, 211, 153, 0.2);
}

.nav-link .material-symbols-outlined {
  font-size: 1.25rem;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-snippet {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow: hidden;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  object-fit: cover;
}

.user-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-high);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.user-email {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

/* Zone principale */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: var(--canvas-base);
}

/* Topbar Desktop */
.topbar {
  height: 64px;
  border-bottom: 1px solid var(--border-subtle);
  background-color: rgba(11, 15, 23, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.topbar-title {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Topbar Mobile (Design System Stitch) */
.topbar-mobile {
  display: none;
}

/* Sync indicator pill */
.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-mid);
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background-color: var(--primary);
  position: relative;
  flex-shrink: 0;
}

.sync-dot.pulsing::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: var(--radius-full);
  background-color: var(--primary);
  opacity: 0.4;
  animation: pulse-ring 1.8s cubic-bezier(0.24, 0, 0.38, 1) infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); opacity: 0.8; }
  100% { transform: scale(2.4); opacity: 0; }
}

.content-body {
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* ============================== Grilles & Cartes ============================== */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s ease, transform 0.15s ease;
  position: relative;
  overflow: hidden;
}

.card:hover {
  border-color: var(--border-hover);
}

.card-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.card-stat {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-high);
  margin-bottom: 0.35rem;
  font-variant-numeric: tabular-nums;
}

.card-subtext {
  font-size: 0.8rem;
  color: var(--text-mid);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* ============================== Composants Spécifiques Mobile Stitch ============================== */

/* Month & Sheet Navigator Bar */
.month-sheet-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.month-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.85rem;
  background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  color: var(--text-high);
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.month-pill input[type="month"] {
  background: transparent;
  border: none;
  color: var(--text-high);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.badge-cur-month {
  font-size: 0.65rem;
  text-transform: uppercase;
  background: var(--primary-subtle);
  color: var(--primary);
  border-radius: var(--radius-full);
  padding: 2px 7px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.sheet-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  color: var(--text-mid);
  text-decoration: none;
  transition: all 0.15s ease;
}

.sheet-pill:hover, .sheet-pill:active {
  color: var(--text-high);
  border-color: var(--border-hover);
}

/* Highlight Hero Card */
.card-highlight {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.card-highlight-glow {
  position: absolute;
  top: -25px;
  right: -25px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: var(--primary-subtle);
  filter: blur(35px);
  pointer-events: none;
}

.hero-stat-row {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  margin: 0.25rem 0 0.5rem 0;
}

.hero-stat-num {
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-high);
}

.hero-stat-curr {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Twin Secondary KPIs */
.twin-kpis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.kpi-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.kpi-card-stat {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-high);
  margin-top: 0.25rem;
}

/* Journal Mobile Recap Banner */
.journal-recap-banner {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  position: relative;
  overflow: hidden;
}

.journal-recap-banner::after {
  content: '';
  position: absolute;
  right: -20px;
  bottom: -20px;
  width: 100px;
  height: 100px;
  background: var(--primary-subtle);
  border-radius: 50%;
  filter: blur(30px);
  pointer-events: none;
}

.journal-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.journal-search-input {
  width: 100%;
  height: 44px;
  padding: 0 2.5rem 0 2.75rem;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-high);
  font-size: 0.9rem;
  transition: all 0.15s ease;
}

.journal-search-input:focus {
  outline: none;
  border-color: var(--border-focus);
  background: var(--surface-elevated);
}

.journal-search-icon {
  position: absolute;
  left: 0.9rem;
  color: var(--text-muted);
  pointer-events: none;
  font-size: 1.2rem;
}

.journal-clear-btn {
  position: absolute;
  right: 0.75rem;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-elevated);
  color: var(--text-muted);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.filter-chips-scroll {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 2px 0;
  -webkit-overflow-scrolling: touch;
}

.filter-chip {
  flex-shrink: 0;
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 500;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-mid);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.filter-chip:active {
  transform: scale(0.96);
}

.filter-chip.active {
  background: var(--primary);
  color: #061A12;
  font-weight: 700;
  border-color: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
}

/* Feed Groupé par Date sur Mobile */
.expense-group {
  margin-bottom: 1.25rem;
}

.expense-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.25rem 0.5rem 0.25rem;
  font-size: 0.78rem;
}

.expense-group-title {
  font-family: var(--font-mono);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-high);
}

.expense-group-total {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text-muted);
}

.expense-card-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.expense-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  gap: 0.75rem;
}

.expense-card:active {
  transform: scale(0.99);
  background: var(--surface-elevated);
}

.expense-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--border-subtle);
}

.expense-card-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.expense-card-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-high);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.expense-card-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
  flex-wrap: wrap;
}

.expense-card-amount {
  text-align: right;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.expense-card-num {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-high);
  display: block;
}

.expense-card-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Quick Amount Pills & Category Visual Grid */
.quick-amount-pills {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.quick-pill {
  padding: 0.35rem 0.75rem;
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-high);
  font-size: 0.78rem;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.quick-pill:active {
  transform: scale(0.95);
  background: var(--border-hover);
}

.category-visual-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.cat-visual-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.75rem 0.5rem;
  background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-mid);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}

.cat-visual-btn:active {
  transform: scale(0.96);
}

.cat-visual-btn.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: #061A12;
  font-weight: 700;
  box-shadow: 0 0 12px var(--primary-glow);
}

.cat-visual-btn .material-symbols-outlined {
  font-size: 1.4rem;
}

.cat-visual-label {
  font-size: 0.72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

/* ============================== Boutons ============================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  font-family: var(--font-sans);
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--primary);
  color: #061A12;
}
.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 0 16px var(--primary-glow);
}

.btn-secondary {
  background: var(--surface-elevated);
  border-color: var(--border-subtle);
  color: var(--text-high);
}
.btn-secondary:hover {
  background: var(--border-hover);
  border-color: var(--text-muted);
}

.btn-ghost {
  background: transparent;
  color: var(--text-mid);
}
.btn-ghost:hover {
  background: var(--surface-elevated);
  color: var(--text-high);
}

.btn-danger {
  background: var(--danger-subtle);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.2);
}
.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

/* ============================== Tableaux ============================== */
.table-container {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  box-shadow: var(--shadow-card);
  -webkit-overflow-scrolling: touch;
}

.table-header-bar {
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  gap: 1rem;
  flex-wrap: wrap;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  background: var(--surface-sunken);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

td {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-high);
  font-size: 0.88rem;
  vertical-align: middle;
}

tr:hover td {
  background-color: var(--surface-elevated);
}

/* ============================== Badges ============================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
}

.badge-green {
  background: var(--primary-subtle);
  color: var(--primary);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-blue {
  background: var(--google-blue-subtle);
  color: var(--google-blue);
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.badge-purple {
  background: var(--accent-purple-subtle);
  color: var(--accent-purple);
  border: 1px solid rgba(168, 85, 247, 0.25);
}

.badge-gray {
  background: var(--surface-sunken);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

/* ============================== Formulaires ============================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.15rem;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-mid);
}

.form-input, .form-select, .form-textarea {
  background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.9rem;
  color: var(--text-high);
  font-family: var(--font-sans);
  font-size: 0.95rem; /* Evite zoom iOS */
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 1px var(--border-focus);
}

.form-input.mono {
  font-family: var(--font-mono);
}

/* ============================== Modale & Bottom Sheet ============================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 20, 36, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-dialog {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  max-width: 560px;
  width: 100%;
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  animation: modal-pop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-sheet-handle {
  display: none;
}

@keyframes modal-pop {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes sheet-up {
  from { opacity: 0; transform: translateY(100%); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-header {
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 600;
}

.modal-body {
  padding: 1.5rem;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-sunken);
}

/* ============================== Media Queries Responsive ============================== */

/* Helper classes */
.desktop-only {
  display: block;
}
.mobile-only {
  display: none;
}

@media (max-width: 768px) {
  .desktop-only {
    display: none !important;
  }
  .mobile-only {
    display: block !important;
  }

  .app-layout {
    flex-direction: column;
  }
  .sidebar {
    display: none;
  }

  /* Cache le topbar desktop et montre le header mobile */
  .topbar {
    display: none;
  }
  .topbar-mobile {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: calc(60px + var(--safe-top));
    padding-top: var(--safe-top);
    padding-left: 1rem;
    padding-right: 1rem;
    background: rgba(11, 15, 23, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-subtle);
    z-index: 40;
    align-items: center;
    justify-content: space-between;
  }

  .content-body {
    padding: 1rem;
    padding-top: calc(72px + var(--safe-top));
    padding-bottom: calc(88px + var(--safe-bottom));
  }

  /* Mobile Bottom Navigation Bar */
  .mobile-bottom-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(62px + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: rgba(11, 15, 23, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-subtle);
    z-index: 50;
    justify-content: space-around;
    align-items: center;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    min-height: 46px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.68rem;
    font-weight: 500;
    transition: color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-nav-item.active {
    color: var(--primary);
    font-weight: 600;
  }

  .mobile-nav-item .material-symbols-outlined {
    font-size: 1.45rem;
  }

  .mobile-fab-add {
    position: relative;
    top: -12px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: #061A12;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 18px rgba(16, 185, 129, 0.4);
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-fab-add:active {
    transform: scale(0.92);
  }

  .mobile-fab-add .material-symbols-outlined {
    font-size: 1.65rem;
    font-weight: 700;
  }

  /* Modale / Bottom Sheet sur mobile */
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal-dialog {
    max-width: 100%;
    width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 90vh;
    animation: sheet-up 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    padding-bottom: var(--safe-bottom);
    display: flex;
    flex-direction: column;
  }

  .modal-sheet-handle {
    display: block;
    width: 40px;
    height: 4px;
    background: var(--border-hover);
    border-radius: 2px;
    margin: 8px auto 2px auto;
  }

  .modal-body {
    padding: 1rem 1.25rem;
    max-height: calc(85vh - 120px);
  }

  .modal-footer {
    padding: 0.85rem 1.25rem;
  }

  /* Form responsive adjustments */
  .form-group {
    margin-bottom: 0.9rem;
  }

  /* Grille 2 cols adaptative */
  .grid-2cols-mobile {
    grid-template-columns: 1fr !important;
  }
}
