:root {
  --bg: #000000;
  --surface: #111111;
  --surface-hover: #1f1f1f;
  --border: rgba(255,255,255,0.1);
  --text: #ededed;
  --text-muted: #888888;
  --primary: #3B82F6;
  --primary-grad: linear-gradient(135deg, #60A5FA 0%, #2563EB 100%);
  --primary-grad-h: linear-gradient(90deg, #60A5FA 0%, #2563EB 100%);
  --primary-hover: linear-gradient(135deg, #93C5FD 0%, #3B82F6 100%);
  --color-matin: #0EA5E9;
  --color-repas: #A855F7;
  --color-soir: #F97316;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', sans-serif; }
body { background-color: var(--bg); color: var(--text); overflow: hidden; height: 100vh; }

/* Custom Scroll Progress Bar from V2 */
.scroll-progress-container {
  position: fixed;
  top: 0;
  right: 0;
  width: 6px;
  height: 100%;
  background: rgba(255, 255, 255, 0.03);
  z-index: 9999;
  pointer-events: none;
}
.scroll-progress-fill {
  width: 100%;
  height: 0%;
  background: linear-gradient(to bottom, #60A5FA, #3B82F6, #1D4ED8);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
  border-radius: 4px;
  transition: height 0.05s ease-out;
}

/* Custom Sleek Scrollbars for Sidebar and Content Area */
.sidebar {
  scrollbar-width: thin;
  scrollbar-color: rgba(59, 130, 246, 0.4) transparent;
}
.sidebar::-webkit-scrollbar {
  width: 5px;
}
.sidebar::-webkit-scrollbar-track {
  background: transparent;
  margin: 8px 0;
}
.sidebar::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #60A5FA, #7C9BBD);
  border-radius: 99px;
  box-shadow: 0 0 6px rgba(59, 130, 246, 0.3);
}
.sidebar::-webkit-scrollbar-thumb:hover {
  background: #60A5FA;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.6);
}

.content-area {
  scrollbar-width: thin;
  scrollbar-color: rgba(59, 130, 246, 0.4) transparent;
}
.content-area::-webkit-scrollbar,
*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.content-area::-webkit-scrollbar-track,
*::-webkit-scrollbar-track {
  background: transparent;
}
.content-area::-webkit-scrollbar-thumb,
*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #60A5FA, #7C9BBD);
  border-radius: 99px;
  box-shadow: 0 0 6px rgba(59, 130, 246, 0.3);
}
.content-area::-webkit-scrollbar-thumb:hover,
*::-webkit-scrollbar-thumb:hover {
  background: #60A5FA;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.6);
}

.app-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px;
  overflow-y: auto;
  position: relative;
}

.sidebar-header { 
  margin-bottom: 32px; 
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.sidebar-header h1 { font-size: 1.2rem; font-weight: 600; }
.sidebar-header span { color: var(--text-muted); font-weight: 400; }

.admin-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(59, 130, 246, 0.3);
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);
  color: #60A5FA;
  font-size: 0.72rem;
  font-weight: 600;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.admin-link:hover {
  border-color: #3B82F6;
  color: #fff;
  background: rgba(59, 130, 246, 0.15);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.25);
}

.sidebar-section { margin-bottom: 24px; }
.sidebar-section h3 { font-size: 0.9rem; text-transform: uppercase; color: var(--text-muted); margin-bottom: 16px; letter-spacing: 0.05em; }

.input-group { margin-bottom: 16px; }
.input-group label { display: block; font-size: 0.85rem; margin-bottom: 8px; color: var(--text-muted); }
.input-group input[type="number"], .input-group input[type="text"] {
  width: 100%; padding: 10px; background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px; outline: none; transition: border-color 0.2s;
}
.input-group input[type="number"]:focus { border-color: var(--primary); }
.field-hint {
  display: block;
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 6px;
  line-height: 1.35;
}

.toggle-switch { display: flex; background: rgba(255,255,255,0.05); border-radius: 8px; padding: 4px; }
.toggle-switch input { display: none; }
.toggle-switch label {
  flex: 1; text-align: center; padding: 8px; cursor: pointer; border-radius: 6px; font-size: 0.85rem;
  transition: all 0.2s;
}
.toggle-switch input:checked + label { background: rgba(255,255,255,0.1); font-weight: 500; }

/* ===== CHILDREN SWITCHER & RESIDENT PILL ===== */
.children-switcher {
  display: flex;
  background: var(--surface);
  padding: 4px;
  border-radius: 99px;
  width: fit-content;
  border: 1px solid var(--border);
  position: relative;
}
.children-switcher .child-tab {
  padding: 8px 18px;
  border-radius: 99px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.3s;
  position: relative;
  z-index: 1;
  user-select: none;
  border: none;
  background: transparent;
  margin-bottom: 0;
}
.children-switcher .child-tab:hover {
  color: var(--text);
}
.children-switcher .child-tab.active {
  color: #ffffff;
  font-weight: 700;
}
.tab-highlight {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  background: var(--primary-grad);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
  border-radius: 99px;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), width 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  z-index: 0;
}

/* ===== SIDEBAR CHILD CARDS ===== */
.sidebar-child-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
  transition: all 0.2s ease;
}
.sidebar-child-card.active {
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 0 18px rgba(59, 130, 246, 0.15);
}
.sidebar-child-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}
.sidebar-child-card-header:hover {
  background: rgba(255, 255, 255, 0.06);
}
.sidebar-child-card.active .sidebar-child-card-header {
  background: linear-gradient(90deg, rgba(96, 165, 250, 0.12) 0%, rgba(59, 130, 246, 0.08) 100%);
}
.sidebar-child-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-child-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}
.sidebar-child-card.active .sidebar-child-avatar {
  background: var(--primary-grad);
  color: #ffffff;
  font-weight: 700;
}
.sidebar-child-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}
.sidebar-child-badge {
  font-size: 0.68rem;
  padding: 3px 8px;
  border-radius: 99px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.sidebar-child-card.active .sidebar-child-badge {
  background: var(--primary-grad);
  color: #0c121e;
  border: none;
}
.sidebar-child-card:not(.active) .sidebar-child-badge {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}
.sidebar-child-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sidebar-child-body input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: white;
  padding: 6px 10px;
  font-size: 0.9rem;
}
.sidebar-child-body input:focus {
  outline: none;
  border-color: var(--primary);
}
.field-label-small {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
  display: block;
}
.custom-switcher {
  display: flex;
  background: rgba(255, 255, 255, 0.04);
  padding: 3px;
  border-radius: 99px;
  border: 1px solid var(--border);
  position: relative;
  width: 100%;
}
.custom-switcher .child-tab {
  flex: 1;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 5px 6px;
  border-radius: 99px;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  z-index: 1;
  transition: color 0.25s ease;
  user-select: none;
  white-space: nowrap;
}
.custom-switcher .child-tab:hover {
  color: var(--text);
}
.custom-switcher .child-tab.active {
  color: #ffffff;
  font-weight: 600;
}
.custom-switcher .tab-highlight {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  background: var(--primary-grad);
  border-radius: 99px;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), width 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
  pointer-events: none;
  z-index: 0;
}

/* ===== CALENDAR LAYOUT WITH QUOTA SIDEBAR ===== */
.calendar-layout-wrapper {
  display: flex;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 24px;
}
.calendar-sidebar {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  width: 250px;
  align-self: flex-start;
  position: sticky;
  top: 16px;
  z-index: 10;
}
.calendar-main {
  flex: 1;
  min-width: 0;
}
.flex-progress {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  padding: 22px 20px;
  border-radius: 16px;
  border: 1px solid var(--border);
  gap: 16px;
  width: 100%;
  box-sizing: border-box;
}
.flex-progress-header {
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 12px;
}
.flex-progress-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.flex-progress-bars {
  display: flex;
  flex-direction: row;
  justify-content: space-around;
  align-items: flex-end;
  gap: 16px;
  padding: 10px 0 6px 0;
}
.flex-progress-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: flex-end;
}
.flex-progress-label-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}
.flex-progress-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}
.flex-progress-track {
  width: 32px;
  height: 250px;
  background: rgba(255, 255, 255, 0.03);
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.flex-progress-count {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Glass reflections & graduation ticks */
.glass-reflection {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 3px;
  width: 2px;
  background: linear-gradient(180deg, rgba(255,255,255,0.45) 0%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.3) 100%);
  border-radius: 2px;
  z-index: 6;
  pointer-events: none;
}
.glass-ticks {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 3px;
  width: 4px;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  z-index: 5;
  pointer-events: none;
}
.glass-ticks span {
  display: block;
  width: 3px;
  height: 1px;
  background: rgba(255, 255, 255, 0.18);
  margin-left: auto;
}

/* Bio-Fluid Fill */
.flex-progress-fill {
  width: 100% !important;
  height: 0%;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  transition: height 0.8s cubic-bezier(0.34, 1.45, 0.64, 1);
  overflow: hidden;
  border-radius: 0 0 10px 10px;
}

.flex-progress-fill.matin {
  background: linear-gradient(180deg, #38BDF8 0%, #0284C7 50%, #0369A1 100%);
}
.flex-progress-fill.repas {
  background: linear-gradient(180deg, #C084FC 0%, #9333EA 50%, #6B21A8 100%);
}
.flex-progress-fill.soir {
  background: linear-gradient(180deg, #FB923C 0%, #EA580C 50%, #9A3412 100%);
}

/* Surface Meniscus */
.fluid-surface {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 6px #ffffff, 0 -1px 3px rgba(255, 255, 255, 0.8);
  z-index: 4;
  opacity: 0;
  transition: opacity 0.3s ease;
  animation: surfaceWave 2.4s ease-in-out infinite alternate;
}
@keyframes surfaceWave {
  0% { transform: scaleY(0.8) scaleX(0.96); opacity: 0.85; }
  100% { transform: scaleY(1.3) scaleX(1.04); opacity: 1; }
}

/* Bio Bubbles */
.bio-bubble {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.45) 50%, rgba(255, 255, 255, 0.1) 100%);
  box-shadow: 0 0 3px rgba(255, 255, 255, 0.6);
  pointer-events: none;
  opacity: 0;
  z-index: 3;
}
.bio-bubble.b1 { width: 4px; height: 4px; left: 4px; animation: bioBubbleRise 2.4s infinite ease-in; }
.bio-bubble.b2 { width: 6px; height: 6px; left: 13px; animation: bioBubbleRise 3.2s infinite ease-in 0.8s; }
.bio-bubble.b3 { width: 3px; height: 3px; left: 8px; animation: bioBubbleRise 2.8s infinite ease-in 1.4s; }
.bio-bubble.b4 { width: 5px; height: 5px; left: 11px; animation: bioBubbleRise 3.6s infinite ease-in 2.1s; }

@keyframes bioBubbleRise {
  0% {
    bottom: -4px;
    opacity: 0;
    transform: translateX(0) scale(0.5);
  }
  15% {
    opacity: 0.9;
  }
  50% {
    transform: translateX(2.5px) scale(0.9);
  }
  85% {
    opacity: 0.9;
    transform: translateX(-2px) scale(1.05);
  }
  100% {
    bottom: 96%;
    opacity: 0;
    transform: translateX(0) scale(0.3);
  }
}

.flex-progress-count {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  white-space: nowrap;
}

/* ===== Quota Overflow (Smooth Beer-Style Foam & Gentle Drip) ===== */
.tube-foam {
  position: absolute;
  top: -10px;
  left: -6px;
  right: -6px;
  height: 38px;
  pointer-events: none;
  z-index: 25;
  opacity: 0;
  transform: scale(0.7) translateY(6px);
  transform-origin: bottom center;
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

.flex-progress-col.overflowing .flex-progress-track {
  overflow: visible !important;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5), 0 0 10px rgba(255, 255, 255, 0.12);
  transition: box-shadow 0.6s ease;
}

.flex-progress-col.overflowing .tube-foam {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.flex-progress-col.overflowing .flex-progress-count {
  color: #f87171 !important;
  transition: color 0.5s ease;
}

/* Creamy pillowy foam head rising smoothly like poured beer */
.foam-head {
  position: absolute;
  top: 4px;
  left: 1px;
  right: 1px;
  height: 16px;
  background: radial-gradient(ellipse at 50% 30%, #ffffff 50%, rgba(255, 255, 255, 0.95) 80%, rgba(254, 243, 199, 0.7) 100%);
  border-radius: 14px 14px 8px 8px;
  box-shadow: 0 -2px 8px rgba(255, 255, 255, 0.85), 0 2px 5px rgba(0, 0, 0, 0.25);
  animation: beerFoamSwell 3.4s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

#rowProgressMatin .foam-head {
  background: radial-gradient(ellipse at 50% 30%, #ffffff 50%, #e0f2fe 80%, rgba(186, 230, 253, 0.8) 100%);
  box-shadow: 0 -2px 8px rgba(224, 242, 254, 0.9), 0 2px 5px rgba(0, 0, 0, 0.25);
}
#rowProgressRepas .foam-head {
  background: radial-gradient(ellipse at 50% 30%, #ffffff 50%, #f3e8ff 80%, rgba(233, 213, 255, 0.8) 100%);
  box-shadow: 0 -2px 8px rgba(243, 232, 255, 0.9), 0 2px 5px rgba(0, 0, 0, 0.25);
}
#rowProgressSoir .foam-head {
  background: radial-gradient(ellipse at 50% 30%, #ffffff 50%, #ffedd5 80%, rgba(254, 215, 170, 0.8) 100%);
  box-shadow: 0 -2px 8px rgba(255, 237, 213, 0.9), 0 2px 5px rgba(0, 0, 0, 0.25);
}

@keyframes beerFoamSwell {
  0% { transform: scale(0.7, 0.5) translateY(6px); opacity: 0; }
  25% { transform: scale(0.98, 0.9) translateY(1px); opacity: 1; }
  55% { transform: scale(1.06, 1.12) translateY(-2px); }
  80% { transform: scale(1.02, 1.05) translateY(-1px); opacity: 1; }
  100% { transform: scale(1, 1) translateY(0); opacity: 0.95; }
}

/* Gentle, floating pearlescent bubbles resting atop the beer foam */
.foam-bubble {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.98) 20%, rgba(255, 255, 255, 0.75) 60%, rgba(255, 255, 255, 0.3) 100%);
  box-shadow: inset 0 0 2px rgba(255, 255, 255, 0.9), 0 1px 3px rgba(0, 0, 0, 0.15);
  pointer-events: none;
}
.foam-bubble.fb1 {
  width: 8px;
  height: 8px;
  top: -3px;
  left: 3px;
  animation: beerBubbleBob 2.4s ease-in-out infinite alternate;
}
.foam-bubble.fb2 {
  width: 10px;
  height: 10px;
  top: -6px;
  left: 11px;
  animation: beerBubbleBob 2.8s ease-in-out infinite alternate 0.3s;
}
.foam-bubble.fb3 {
  width: 7px;
  height: 7px;
  top: -2px;
  right: 3px;
  animation: beerBubbleBob 2.2s ease-in-out infinite alternate 0.6s;
}
.foam-bubble.fb4 {
  width: 9px;
  height: 9px;
  top: -5px;
  left: 7px;
  animation: beerBubbleBob 2.6s ease-in-out infinite alternate 0.15s;
}

@keyframes beerBubbleBob {
  0% { transform: translateY(0) scale(0.96); }
  50% { transform: translateY(-1.5px) scale(1.04); }
  100% { transform: translateY(0.5px) scale(0.98); }
}

/* Calm, slow drip sliding down the side like creamy beer froth */
.foam-drip {
  position: absolute;
  width: 4px;
  border-radius: 4px 4px 6px 6px;
  background: linear-gradient(180deg, #ffffff 0%, rgba(255, 255, 255, 0.9) 60%, rgba(255, 255, 255, 0) 100%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  top: 12px;
  pointer-events: none;
}
.foam-drip.drip-left {
  left: 3px;
  height: 0px;
  animation: beerSlowDripLeft 3.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.foam-drip.drip-right {
  right: 3px;
  height: 0px;
  animation: beerSlowDripRight 3.5s cubic-bezier(0.4, 0, 0.2, 1) 0.4s forwards;
}

#rowProgressMatin .foam-drip {
  background: linear-gradient(180deg, #ffffff 0%, #bae6fd 60%, rgba(56, 189, 248, 0) 100%);
}
#rowProgressRepas .foam-drip {
  background: linear-gradient(180deg, #ffffff 0%, #e9d5ff 60%, rgba(192, 132, 252, 0) 100%);
}
#rowProgressSoir .foam-drip {
  background: linear-gradient(180deg, #ffffff 0%, #fed7aa 60%, rgba(251, 146, 60, 0) 100%);
}

@keyframes beerSlowDripLeft {
  0% { height: 0px; transform: translateY(0); opacity: 0; }
  20% { height: 4px; transform: translateY(0); opacity: 0.95; }
  55% { height: 16px; transform: translateY(10px); opacity: 0.85; }
  85% { height: 22px; transform: translateY(22px); opacity: 0.5; }
  100% { height: 26px; transform: translateY(30px); opacity: 0; }
}
@keyframes beerSlowDripRight {
  0% { height: 0px; transform: translateY(0); opacity: 0; }
  25% { height: 5px; transform: translateY(0); opacity: 0.95; }
  60% { height: 18px; transform: translateY(12px); opacity: 0.85; }
  90% { height: 24px; transform: translateY(26px); opacity: 0.45; }
  100% { height: 28px; transform: translateY(34px); opacity: 0; }
}

/* Subtle gentle breathing of fluid surface during overflow */
.flex-progress-col.overflowing .fluid-surface {
  opacity: 1 !important;
  animation: beerSurfaceGentle 1.6s ease-in-out infinite alternate !important;
}
@keyframes beerSurfaceGentle {
  0% { transform: scaleY(0.9) scaleX(0.98); }
  100% { transform: scaleY(1.15) scaleX(1.02); }
}

/* Falling CO2 Droplets Cascading Down on the sides */
.co2-droplet {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
}

#rowProgressMatin .co2-droplet {
  background: radial-gradient(circle at 35% 35%, #ffffff 40%, #bae6fd 75%, rgba(56, 189, 248, 0.5) 100%);
  box-shadow: 0 0 4px rgba(56, 189, 248, 0.6);
}
#rowProgressRepas .co2-droplet {
  background: radial-gradient(circle at 35% 35%, #ffffff 40%, #e9d5ff 75%, rgba(192, 132, 252, 0.5) 100%);
  box-shadow: 0 0 4px rgba(192, 132, 252, 0.6);
}
#rowProgressSoir .co2-droplet {
  background: radial-gradient(circle at 35% 35%, #ffffff 40%, #fed7aa 75%, rgba(251, 146, 60, 0.5) 100%);
  box-shadow: 0 0 4px rgba(251, 146, 60, 0.6);
}

/* Left falling droplets */
.flex-progress-col.overflowing .co2-droplet.drop-l1 {
  width: 5px; height: 6px;
  animation: fallDropletLeft1 2.2s cubic-bezier(0.5, 0.05, 0.8, 0.5) 0.3s infinite;
}
.flex-progress-col.overflowing .co2-droplet.drop-l2 {
  width: 4px; height: 5px;
  animation: fallDropletLeft2 2.5s cubic-bezier(0.5, 0.05, 0.8, 0.5) 0.9s infinite;
}
.flex-progress-col.overflowing .co2-droplet.drop-l3 {
  width: 3px; height: 4px;
  animation: fallDropletLeft3 2.0s cubic-bezier(0.5, 0.05, 0.8, 0.5) 1.5s infinite;
}

/* Right falling droplets */
.flex-progress-col.overflowing .co2-droplet.drop-r1 {
  width: 5px; height: 6px;
  animation: fallDropletRight1 2.3s cubic-bezier(0.5, 0.05, 0.8, 0.5) 0.5s infinite;
}
.flex-progress-col.overflowing .co2-droplet.drop-r2 {
  width: 4px; height: 5px;
  animation: fallDropletRight2 2.6s cubic-bezier(0.5, 0.05, 0.8, 0.5) 1.1s infinite;
}
.flex-progress-col.overflowing .co2-droplet.drop-r3 {
  width: 3px; height: 4px;
  animation: fallDropletRight3 2.1s cubic-bezier(0.5, 0.05, 0.8, 0.5) 1.7s infinite;
}

@keyframes fallDropletLeft1 {
  0% { top: 6px; left: 1px; opacity: 0; transform: scale(0.6) translateY(0); }
  15% { top: 8px; left: -4px; opacity: 1; transform: scale(1, 1.2) translateY(0); }
  60% { top: 45px; left: -7px; opacity: 0.9; transform: scale(0.9, 1.4); }
  100% { top: 95px; left: -9px; opacity: 0; transform: scale(0.7, 1.6); }
}
@keyframes fallDropletLeft2 {
  0% { top: 8px; left: 3px; opacity: 0; transform: scale(0.5); }
  20% { top: 12px; left: -3px; opacity: 1; transform: scale(1, 1.3); }
  65% { top: 55px; left: -5px; opacity: 0.85; transform: scale(0.9, 1.5); }
  100% { top: 110px; left: -7px; opacity: 0; transform: scale(0.6, 1.7); }
}
@keyframes fallDropletLeft3 {
  0% { top: 6px; left: 0px; opacity: 0; transform: scale(0.5); }
  20% { top: 10px; left: -5px; opacity: 1; transform: scale(1, 1.2); }
  70% { top: 60px; left: -6px; opacity: 0.8; transform: scale(0.8, 1.4); }
  100% { top: 120px; left: -8px; opacity: 0; transform: scale(0.5, 1.6); }
}

@keyframes fallDropletRight1 {
  0% { top: 6px; right: 1px; opacity: 0; transform: scale(0.6) translateY(0); }
  15% { top: 8px; right: -4px; opacity: 1; transform: scale(1, 1.2) translateY(0); }
  60% { top: 48px; right: -7px; opacity: 0.9; transform: scale(0.9, 1.4); }
  100% { top: 98px; right: -9px; opacity: 0; transform: scale(0.7, 1.6); }
}
@keyframes fallDropletRight2 {
  0% { top: 8px; right: 3px; opacity: 0; transform: scale(0.5); }
  20% { top: 12px; right: -3px; opacity: 1; transform: scale(1, 1.3); }
  65% { top: 58px; right: -5px; opacity: 0.85; transform: scale(0.9, 1.5); }
  100% { top: 115px; right: -7px; opacity: 0; transform: scale(0.6, 1.7); }
}
@keyframes fallDropletRight3 {
  0% { top: 6px; right: 0px; opacity: 0; transform: scale(0.5); }
  20% { top: 10px; right: -5px; opacity: 1; transform: scale(1, 1.2); }
  70% { top: 64px; right: -6px; opacity: 0.8; transform: scale(0.8, 1.4); }
  100% { top: 125px; right: -8px; opacity: 0; transform: scale(0.5, 1.6); }
}
.calendar-main {
  flex: 1;
  min-width: 0;
}

.sidebar-footer { margin-top: auto; padding-top: 24px; border-top: 1px solid var(--border); }
.total-estimation { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.total-estimation .label { font-size: 0.9rem; color: var(--text-muted); }
.total-estimation .amount {
  font-size: 1.5rem;
  font-weight: 800;
  background: var(--primary-grad-h);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background: var(--primary-grad);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.2);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #93C5FD 0%, #3B82F6 100%);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.3);
  transform: translateY(-1px);
}
.btn-secondary { padding: 8px 16px; background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; transition: all 0.2s; }
.btn-secondary:hover { background: rgba(255,255,255,0.05); }
.btn-icon { background: rgba(255,255,255,0.05); border: 1px solid var(--border); color: white; border-radius: 8px; width: 32px; height: 32px; cursor: pointer; }

.content-area { padding: 28px 36px; overflow-y: auto; height: 100vh; position: relative; }
.content-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 14px; }
.content-header h2 { font-size: 1.45rem; font-weight: 600; }
.content-header .actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.content-header .actions .btn-secondary {
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 99px;
  white-space: nowrap;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.content-header .actions .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(59, 130, 246, 0.4);
  color: #ffffff;
}

.view-container { animation: fadeIn 0.3s ease; }

#yearView {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px 18px;
  padding-bottom: 32px;
}
@media (max-width: 1100px) {
  #yearView {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 850px) {
  #yearView {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}
@media (max-width: 500px) {
  #yearView {
    grid-template-columns: 1fr;
  }
}
.month-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  user-select: none;
  position: relative;
}
.month-card:hover {
  border-color: rgba(59, 130, 246, 0.45);
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.1);
}

.mini-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  margin: 8px 0 10px;
}
.mini-cal-dow {
  font-size: 0.65rem;
  font-weight: 600;
  text-align: center;
  color: var(--text-muted);
  padding-bottom: 2px;
}
.mini-cal-dow.weekend {
  opacity: 0.35;
}
.mini-cal-cell {
  aspect-ratio: 1;
  border-radius: 3.5px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  box-sizing: border-box;
}
.mini-cal-cell.empty {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}
.mini-cal-cell.weekend {
  background: rgba(255, 255, 255, 0.02) !important;
  border-color: transparent !important;
  opacity: 0.22;
  box-shadow: none !important;
}
.mini-cal-cell.vacances {
  background: rgba(255, 255, 255, 0.02) !important;
  border: 1px dashed rgba(255, 255, 255, 0.08) !important;
  box-shadow: none !important;
}
.mini-cal-cell.has-active-service {
  cursor: pointer;
}
.mini-cal-cell.has-active-service:hover {
  transform: scale(1.18);
  z-index: 5;
  filter: brightness(1.2);
}

.year-legend-bar {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  padding: 5px 14px;
  border-radius: 99px;
}
.year-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.year-legend-gradient-pill {
  width: 28px;
  height: 6px;
  border-radius: 99px;
  background: linear-gradient(90deg, #DCE8F4 0%, #60A5FA 30%, #AEC4DC 65%, #3B82F6 100%);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
  display: inline-block;
}

.stat-badge {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 500;
}
.stat-badge.matin { background: rgba(14,165,233,0.15); color: var(--color-matin); }
.stat-badge.repas { background: rgba(168,85,247,0.15); color: var(--color-repas); }
.stat-badge.soir { background: rgba(249,115,22,0.15); color: var(--color-soir); }

.month-toolbar { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.month-toolbar h3 { font-size: 1.25rem; min-width: 150px; text-align: center; font-weight: 700; }

.calendar-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 0; }
.day-label { text-align: center; font-size: 0.85rem; color: var(--text-muted); font-weight: 600; padding: 6px 0 10px; text-transform: uppercase; letter-spacing: 0.06em; }

.overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8);
  backdrop-filter: blur(4px); z-index: 1000; display: flex; align-items: center; justify-content: center;
}
.onboarding-modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 32px;
  max-width: 400px; text-align: center;
}
.onboarding-modal h3 { margin-bottom: 16px; font-size: 1.2rem; }
.onboarding-modal p { color: var(--text-muted); margin-bottom: 24px; line-height: 1.5; font-size: 0.95rem; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Synthèse details */
#syntheseDetails { line-height: 1.6; }
.synth-row { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
.synth-total { font-weight: bold; font-size: 1.2rem; color: var(--primary); border-top: 2px solid var(--border); padding-top: 16px; margin-top: 8px; display: flex; justify-content: space-between; }


/* V2 imported styles for flexibility */
.cell {
  aspect-ratio: 1;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px 12px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  min-height: 85px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.cell:hover:not(.empty) {
  border-color: rgba(255,255,255,0.3);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.cell.selected {
  border-color: #3B82F6;
  background: rgba(59, 130, 246, 0.16);
  box-shadow: 0 0 0 1px #3B82F6, 0 0 16px rgba(59, 130, 246, 0.3);
}
.cell.empty {
  background: transparent;
  border-color: transparent;
  cursor: default;
  box-shadow: none;
  pointer-events: none;
}
.cell-date {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 4px;
  line-height: 1;
}
.cell-data {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
  width: 100%;
  margin-top: auto;
}
.data-pill {
  height: 6px;
  border-radius: 3px;
  width: 0;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.data-pill.matin { background: var(--color-matin); }
.data-pill.repas { background: var(--color-repas); }
.data-pill.soir { background: var(--color-soir); }
.data-pill.is-free {
  background: repeating-linear-gradient(45deg, #10B981, #10B981 4px, #059669 4px, #059669 8px) !important;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}
.cell.error-quota { animation: shake 0.4s ease; box-shadow: 0 0 0 2px #ef4444 inset !important; background: rgba(239, 68, 68, 0.15) !important; z-index: 10; position: relative; }
.cell.ferie { background-color: rgba(255,255,255,0.02); border-color: rgba(255,255,255,0.05); cursor: not-allowed; opacity: 0.5; }
.cell.mercredi-blocked { background-color: #000000; border-color: #111111; cursor: not-allowed; opacity: 0.8; }

.slot-popover {
  display: none;
  flex-direction: column;
  gap: 4px;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 8px;
  border-radius: 10px;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 100;
  box-shadow: 0 12px 32px rgba(0,0,0,0.6);
}
.action-btn.active-popover .slot-popover { display: flex !important; }
.flex-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  position: relative;
}

.action-btn {
  height: 42px;
  min-width: 115px;
  padding: 0 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  user-select: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-sizing: border-box;
  text-align: center;
  width: auto !important;
  flex: 0 0 auto;
  white-space: nowrap;
}
.action-btn-inner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.action-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.3);
}
.action-btn.checked {
  border-color: #3B82F6;
  background: rgba(59, 130, 246, 0.15);
  color: #60A5FA;
}
.slot-popover .popover-item {
  background: transparent;
  border: none;
  color: var(--text);
  padding: 10px 16px;
  border-radius: 8px;
  text-align: left;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}
.slot-popover .popover-item:hover { background: rgba(255,255,255,0.08); }
.popover-item .check-icon { opacity: 0; transition: opacity 0.2s; }
.popover-item.checked .check-icon { opacity: 1; color: var(--primary); }
.gratuit-badge { font-size: 0.6rem; background: var(--color-repas); color: #fff; padding: 2px 6px; border-radius: 4px; margin-left: 8px; text-transform: uppercase; font-weight: 700; }

.toast-container { position: fixed; top: 24px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 1000; pointer-events: none; }
.toast { background: var(--surface); border: 1px solid var(--border); color: var(--text); padding: 10px 16px; border-radius: 12px; font-size: 0.9rem; font-weight: 500; box-shadow: 0 10px 25px rgba(0,0,0,0.5); text-align: center; }
.toast.error { border-color: #ef4444; color: #fff; background: #ef4444; }

/* ===== SYNTHESE STYLES ===== */
.synth-hero { margin-bottom: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 640px) { .grid-3 { grid-template-columns: 1fr; } }

.synth-tile {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 20px; text-align: center;
}
.synth-tile .tile-label { font-size: 0.78rem; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.synth-tile .tile-value { font-size: 1.6rem; font-weight: 700; color: var(--text); }
.synth-tile.total { border-color: rgba(59, 130, 246, 0.35); background: rgba(59, 130, 246, 0.06); }
.synth-tile.total .tile-value {
  background: var(--primary-grad-h);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.synth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
}

/* Disclaimer Alert */
.disclaimer-alert {
  background: rgba(14, 165, 233, 0.06);
  border: 1px solid rgba(14, 165, 233, 0.25);
  padding: 16px 20px;
  border-radius: 12px;
  margin-top: 20px;
  margin-bottom: 24px;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.5;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.disclaimer-alert svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: #0ea5e9;
  margin-top: 2px;
}

/* Download Button */
.btn-download {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px;
  border-radius: 99px; background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font-size: 0.85rem; font-weight: 500; cursor: pointer;
  transition: all 0.2s; font-family: inherit;
}
.btn-download:hover { border-color: var(--primary); background: rgba(255,255,255,0.05); }

/* SVG Cost Chart */
.cost-chart-svg { width: 100%; height: auto; }
.cost-chart-svg.has-active .chart-bar-group:not(.active) { opacity: 0.2; filter: grayscale(30%); }
.chart-bar-group { transition: opacity 0.3s, transform 0.3s, filter 0.3s; transform-origin: center bottom; cursor: pointer; }
.chart-bar-group:hover { opacity: 0.9; }
.chart-bar-group.active { transform: translateY(-4px); }
.chart-bar-group.active rect.bar-garderie { filter: drop-shadow(0 0 10px rgba(249, 115, 22, 0.85)); }
.chart-bar-group.active rect.bar-restauration { filter: drop-shadow(0 0 10px rgba(168, 85, 247, 0.85)); }
.chart-bar-group.active text.bar-cost-label { fill: var(--primary); font-weight: 800; font-size: 0.85rem; }
.chart-bar-group.active text.month-label { fill: #ffffff; font-weight: 700; }
.bar-garderie { fill: var(--color-soir); transition: all 0.3s; }
.bar-restauration { fill: var(--color-repas); transition: all 0.3s; }
.bar-cost-label { fill: var(--text-muted); font-size: 0.75rem; }
.month-label { fill: var(--text-muted); font-size: 0.8rem; }

/* Interactive Chart Detail Box */
.chart-detail-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  margin-top: 16px;
  display: none;
  animation: fadeIn 0.3s ease forwards;
}
.chart-detail-box.active {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.cdb-month { font-size: 1.05rem; font-weight: 600; color: var(--text); }
.cdb-breakdown { display: flex; gap: 28px; flex-wrap: wrap; }
.cdb-item { display: flex; flex-direction: column; }
.cdb-item-lbl { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 2px; }
.cdb-item-val { font-size: 1.15rem; font-weight: 700; color: var(--text); }
.cdb-item-val.repas { color: var(--color-repas); }
.cdb-item-val.gard { color: var(--color-soir); }

/* Synthèse Detail per Child Cards */
.synth-child-card {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px; border-radius: 14px; border: 1px solid var(--border);
  margin-top: 14px; background: rgba(255,255,255,0.02); flex-wrap: wrap; gap: 16px;
}
.synth-child-card .who { display: flex; align-items: center; gap: 14px; }
.synth-child-card .avatar {
  width: 42px; height: 42px; border-radius: 50%; background: rgba(59, 130, 246, 0.12);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem; color: var(--primary); flex-shrink: 0;
  border: 1px solid rgba(59, 130, 246, 0.35);
}
.synth-child-card .meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.synth-child-card .amounts { display: flex; gap: 24px; }
.synth-child-card .amounts .item { text-align: center; }
.synth-child-card .amounts .n { font-weight: 700; font-size: 1rem; color: var(--text); white-space: nowrap; }
.synth-child-card .amounts .l { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }

/* Modal Repeat Month */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 1000; display: flex; justify-content: center; align-items: center; opacity: 0; transition: opacity 0.3s; pointer-events: none; }
.modal-overlay.show { opacity: 1; pointer-events: auto; }
.modal-content { background: var(--surface); padding: 32px; border-radius: 16px; border: 1px solid var(--border); width: 90%; max-width: 440px; transform: translateY(20px); transition: transform 0.3s; }
.modal-overlay.show .modal-content { transform: translateY(0); }
.repeat-pill { display: inline-block; cursor: pointer; position: relative; }
.repeat-pill input { position: absolute; opacity: 0; width: 0; height: 0; }
.repeat-pill span { display: inline-flex; align-items: center; padding: 8px 16px; background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: 99px; font-size: 0.85rem; color: var(--text-muted); transition: all 0.2s; }
.repeat-pill:hover span { background: rgba(255,255,255,0.06); color: var(--text); }
.repeat-pill input:checked + span { background: rgba(59, 130, 246, 0.15); border-color: rgba(59, 130, 246, 0.4); color: var(--primary); }

/* ===== RESPONSIVE & MOBILE STYLES ===== */
.mobile-nav-bar {
  display: none;
}
.mobile-only {
  display: none;
}

/* Sticky floating action bar */
.selection-actions {
  position: sticky;
  bottom: 16px;
  max-width: 820px;
  margin: 28px auto 16px auto;
  background: rgba(17, 17, 17, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 16px;
  padding: 16px 24px;
  z-index: 50;
  box-shadow: 0 12px 32px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  transition: opacity 0.2s, transform 0.2s;
  box-sizing: border-box;
  width: 100%;
}
.selection-total-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 4px;
}
.selection-total-group {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.selection-total-group span#monthlyTotalLabel {
  font-size: 0.95rem;
  color: var(--text-muted);
}
.selection-total-group strong#monthlyTotalAmount {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}
.selection-total-group #btnMonthViewSynth {
  padding: 6px 16px;
  border-radius: 99px;
  font-size: 0.85rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
}
.selection-total-group #btnMonthViewSynth:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
}
.action-group.flex-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  width: 100%;
}

@media (max-width: 850px) {
  body {
    overflow-y: auto !important;
    height: auto !important;
    min-height: 100vh;
  }
  .app-layout {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    min-height: 100vh;
  }
  .sidebar {
    height: auto !important;
    overflow-y: visible !important;
  }
  .mobile-nav-bar {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 90;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 8px 16px;
    gap: 12px;
  }
  .mobile-tab {
    flex: 1;
    text-align: center;
    padding: 10px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
  }
  .mobile-tab.active {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--primary);
    color: var(--primary);
  }
  
  .app-layout.mobile-mode-planning .sidebar {
    display: none !important;
  }
  .app-layout.mobile-mode-planning .content-area {
    display: block !important;
    width: 100% !important;
    padding: 16px !important;
    height: auto !important;
    overflow-y: visible !important;
  }
  
  .app-layout.mobile-mode-foyer .sidebar {
    display: flex !important;
    width: 100% !important;
    height: auto !important;
    padding: 16px !important;
  }
  .app-layout.mobile-mode-foyer .content-area {
    display: none !important;
  }

  .mobile-only {
    display: block !important;
  }

  /* Responsive Calendar Layout & Progress on mobile */
  .calendar-layout-wrapper {
    flex-direction: column;
    gap: 12px;
  }
  .calendar-sidebar {
    width: 100%;
  }
  .flex-progress {
    padding: 12px 14px;
    gap: 10px;
    width: 100%;
  }
  .flex-progress-header {
    padding-bottom: 6px;
  }
  .flex-progress-bars {
    flex-direction: row;
    justify-content: space-around;
    gap: 8px;
  }
  .flex-progress-col {
    flex-direction: column;
    align-items: center;
    gap: 6px;
  }
  .flex-progress-track {
    width: 12px;
    height: 70px;
    border-radius: 6px;
    flex-direction: column;
    justify-content: flex-end;
  }
  .flex-progress-fill {
    width: 100%;
    height: 0%;
  }

  /* Responsive Calendar Grid on mobile */
  .calendar-grid {
    gap: 4px;
    margin-bottom: 175px !important; /* space for fixed actions */
  }
  .cell {
    min-height: 64px;
    padding: 4px;
  }
  .cell-date {
    font-size: 0.8rem;
    margin-bottom: 2px;
  }
  .data-pill {
    height: 4px;
  }

  /* Fixed bottom bar on mobile */
  .selection-actions {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: visible !important;
    border-radius: 16px 16px 0 0 !important;
    margin: 0 !important;
    z-index: 999 !important;
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px)) !important;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.8);
  }

  .selection-total-bar {
    gap: 6px !important;
    padding-bottom: 4px !important;
    margin-bottom: 4px !important;
  }
  .selection-total-bar > div {
    gap: 6px !important;
  }
  #monthlyTotalLabel {
    font-size: 0.82rem !important;
  }
  #monthlyTotalAmount {
    font-size: 1.05rem !important;
    margin-right: 8px !important;
  }
  #btnMonthViewSynth {
    padding: 4px 10px !important;
    font-size: 0.8rem !important;
  }
  #selectionCount {
    font-size: 0.78rem !important;
  }

  .flex-actions {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: stretch !important;
    width: 100% !important;
    gap: 6px !important;
    box-sizing: border-box !important;
  }

  .flex-actions .action-btn {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    width: auto !important;
    height: 38px !important;
    padding: 0 4px !important;
    font-size: 0.8rem !important;
    gap: 4px !important;
    white-space: nowrap !important;
  }
  .action-btn-inner {
    gap: 4px !important;
    font-size: 0.8rem !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }
  #btnDuplicateChild .action-btn-inner span {
    font-size: 0.76rem !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    max-width: 100% !important;
  }

  #btnDuplicateChild .slot-popover,
  #btnSoir .slot-popover {
    left: auto !important;
    right: 0 !important;
    max-width: calc(100vw - 24px) !important;
  }

  .content-header {
    margin-bottom: 20px;
  }

  .content-header .actions .btn-secondary {
    height: 34px;
    padding: 0 12px;
    font-size: 0.8rem;
  }
}

/* ============================================================
   INTERACTIVE ONBOARDING TOUR & SPOTLIGHT
   ============================================================ */
.tour-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 10000;
  pointer-events: auto;
  overflow: hidden;
  background: transparent;
}

.tour-spotlight {
  position: absolute;
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.78), inset 0 0 0 2px var(--primary);
  transition: all 0.35s cubic-bezier(0.25, 1, 0.5, 1);
  pointer-events: none;
  z-index: 10001;
  animation: tourPulse 2.5s infinite ease-in-out;
}

@keyframes tourPulse {
  0%, 100% {
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.78), inset 0 0 0 2px rgba(59, 130, 246, 0.5), 0 0 20px rgba(59, 130, 246, 0.25);
  }
  50% {
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.82), inset 0 0 0 2px rgba(96, 165, 250, 0.9), 0 0 32px rgba(59, 130, 246, 0.45);
  }
}

.tour-tooltip {
  position: absolute;
  background: #151515;
  border: 1px solid rgba(59, 130, 246, 0.35);
  padding: 22px 24px;
  border-radius: 16px;
  width: 360px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  color: var(--text);
  z-index: 10002;
  pointer-events: auto;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.85), 0 0 1px rgba(255, 255, 255, 0.2);
  transition: all 0.35s cubic-bezier(0.25, 1, 0.5, 1);
  backdrop-filter: blur(12px);
}

.tour-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.tour-badge-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tour-step-badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  background: rgba(59, 130, 246, 0.12);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.tour-dots {
  display: flex;
  gap: 5px;
}

.tour-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transition: all 0.25s ease;
}

.tour-dot.active {
  background: var(--primary);
  width: 18px;
  border-radius: 10px;
}

.tour-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 6px;
  transition: color 0.2s ease, background 0.2s ease;
}

.tour-close-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.tour-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 8px 0;
  color: #fff;
  line-height: 1.35;
}

.tour-text {
  color: rgba(237, 237, 237, 0.85);
  font-size: 0.92rem;
  line-height: 1.55;
  margin: 0 0 20px 0;
}

.tour-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.tour-skip-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 6px 4px;
}

.tour-skip-btn:hover {
  color: var(--text);
}

.tour-nav-buttons {
  display: flex;
  gap: 8px;
}

.tour-prev-btn, .tour-next-btn {
  padding: 8px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
}

.tour-prev-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* ============================================================
   VIDEO DEMO INTEGRATION & MODAL
   ============================================================ */
.btn-demo-video {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-demo-video:hover {
  background: rgba(59, 130, 246, 0.22);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.sidebar-video-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, rgba(96, 165, 250, 0.05) 100%);
  border: 1px solid rgba(59, 130, 246, 0.22);
  cursor: pointer;
  transition: all 0.2s ease;
}

.sidebar-video-banner:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.22) 0%, rgba(96, 165, 250, 0.12) 100%);
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}

.svb-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--primary-grad);
  color: #111;
  flex-shrink: 0;
}

.svb-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.svb-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
}

.svb-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.modal-video-content {
  max-width: 860px;
  width: 92%;
  padding: 24px;
  border-radius: 18px;
  background: rgba(17, 17, 17, 0.95);
  border: 1px solid rgba(59, 130, 246, 0.25);
  backdrop-filter: blur(16px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.9);
}

.modal-video-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.modal-video-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(59, 130, 246, 0.12);
  padding: 3px 8px;
  border-radius: 6px;
}

.modal-video-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 4px 0 0 0;
  color: #fff;
}

.video-player-wrapper {
  position: relative;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  aspect-ratio: 16 / 9;
}

.video-player-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}

.modal-video-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
  flex-wrap: wrap;
  gap: 14px;
}

.modal-video-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0;
  max-width: 480px;
  line-height: 1.45;
}

.modal-video-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
