﻿* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.desktop {
  position: fixed;
  top: 44px;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 50%, #81c784 100%);
  overflow: hidden;
}

.desktop::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
  pointer-events: none;
}

.windows-container {
  position: fixed;
  top: 44px;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: var(--z-window);
}

.window { pointer-events: auto; }

.window {
  position: absolute;
  pointer-events: auto;
  background: var(--white);
  border-radius: var(--radius-window);
  box-shadow: var(--shadow-window);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--duration-normal) var(--ease-ios);
  border: 0.5px solid rgba(0, 0, 0, 0.08);
}

/* Limite la hauteur des fenêtres non-maximisées pour éviter qu'elles débordent sous le dock */
/* 30px (marge haut) + 68px (dock) + 8px (dock bottom) + 30px (marge bas) */
.window:not(.maximized):not(.fullscreen):not([class*="snap-"]) {
  max-height: calc(100% - 136px);
}

.window.focused {
  box-shadow: var(--shadow-window-focused);
}

.window.minimized {
  transform: scale(0.1) translateY(100vh);
  opacity: 0;
  pointer-events: none;
  transition: transform var(--duration-slow) var(--ease-ios),
              opacity var(--duration-normal) var(--ease-ios);
}

.window.maximized {
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  border-radius: 0;
  transition: all var(--duration-normal) var(--ease-ios);
}

.window.fullscreen {
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  border-radius: 0;
  z-index: calc(var(--z-window) + 1);
}

@media (min-width: 768px) {
  .window.fullscreen,
  .window.maximized {
    /* padding dock géré par les containers d'app (100px) */
  }
}

.window.snap-left {
  top: 0 !important;
  left: 0 !important;
  width: 50% !important;
  height: 100% !important;
  border-radius: 0;
}

.window.snap-right {
  top: 0 !important;
  left: 50% !important;
  width: 50% !important;
  height: 100% !important;
  border-radius: 0;
}

.window.snap-top-left {
  top: 0 !important;
  left: 0 !important;
  width: 50% !important;
  height: 50% !important;
  border-radius: 0;
}

.window.snap-top-right {
  top: 0 !important;
  left: 50% !important;
  width: 50% !important;
  height: 50% !important;
  border-radius: 0;
}

.window.snap-bottom-left {
  top: 50% !important;
  left: 0 !important;
  width: 50% !important;
  height: 50% !important;
  border-radius: 0;
}

.window.snap-bottom-right {
  top: 50% !important;
  left: 50% !important;
  width: 50% !important;
  height: 50% !important;
  border-radius: 0;
}

.title-bar {
  height: var(--title-bar-height);
  background: linear-gradient(to bottom, #fafafa 0%, #f5f5f5 100%);
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  padding: 0 var(--space-4);
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
  position: relative;
}

.title-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 0.5px;
  background: rgba(255, 255, 255, 0.8);
}

.title-bar:active {
  cursor: grabbing;
}

.traffic-lights {
  display: flex;
  gap: 8px;
  align-items: center;
}

.traffic-light {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 0.5px solid rgba(0, 0, 0, 0.12);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-ios);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.traffic-light.close {
  background: var(--close);
}

.traffic-light.close:hover {
  background: var(--close-active);
}

.traffic-light.minimize {
  background: var(--minimize);
}

.traffic-light.minimize:hover {
  background: var(--minimize-active);
}

.traffic-light.maximize {
  background: var(--maximize);
}

.traffic-light.maximize:hover {
  background: var(--maximize-active);
}

.traffic-light svg {
  width: 8px;
  height: 8px;
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-ios);
  stroke: rgba(0, 0, 0, 0.5);
  stroke-width: 2;
  fill: none;
}

.traffic-lights:hover .traffic-light svg {
  opacity: 1;
}

.window-title {
  flex: 1;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-800);
  margin: 0 var(--space-4);
  letter-spacing: -0.01em;
}

.window-subtitle {
  font-size: 11px;
  color: var(--gray-500);
  font-weight: 400;
  margin-top: 1px;
}

.external-link-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--gray-400);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.external-link-btn:hover {
  background: var(--gray-200);
  color: var(--gray-700);
}
.external-link-btn:active {
  transform: scale(0.92);
}

.window-content {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--white);
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.22) transparent;
}

/* Padding sous le contenu des apps maximisées/snap pour qu'il ne soit pas caché par le dock */
.window.maximized .chantiers-tab-panels,
.window.fullscreen .chantiers-tab-panels,
.window[class*="snap-"] .chantiers-tab-panels,
.window.maximized .achats-scroll,
.window.fullscreen .achats-scroll,
.window[class*="snap-"] .achats-scroll,
.window.maximized .heures-scroll,
.window.fullscreen .heures-scroll,
.window[class*="snap-"] .heures-scroll,
.window.maximized .clients-body,
.window.fullscreen .clients-body,
.window[class*="snap-"] .clients-body,
.window.maximized .finance-scroll,
.window.fullscreen .finance-scroll,
.window[class*="snap-"] .finance-scroll,
.window.maximized .chiffrage-view-body,
.window.fullscreen .chiffrage-view-body,
.window[class*="snap-"] .chiffrage-view-body,
.window.maximized .plans-view-body,
.window.fullscreen .plans-view-body,
.window[class*="snap-"] .plans-view-body,
.window.maximized .calc-scroll,
.window.fullscreen .calc-scroll,
.window[class*="snap-"] .calc-scroll {
  padding-bottom: 100px;
}

.window-content::-webkit-scrollbar {
  width: 6px;
  height: 6px;
  background: transparent;
}

.window-content::-webkit-scrollbar-track {
  background: transparent;
  border: none;
}

.window-content::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 3px;
  min-height: 32px;
  border: none;
  transition: background 0.25s ease;
}

.window-content.scrolling::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.18);
}

.window-content:hover::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.28);
}

.window-content::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.40);
}

.window-content::-webkit-scrollbar-thumb:active {
  background: rgba(0, 0, 0, 0.55);
}

.resize-handle {
  position: absolute;
  z-index: 10;
}

.resize-handle.top {
  top: 0;
  left: var(--radius-window);
  right: var(--radius-window);
  height: 4px;
  cursor: n-resize;
}

.resize-handle.bottom {
  bottom: 0;
  left: var(--radius-window);
  right: var(--radius-window);
  height: 4px;
  cursor: s-resize;
}

.resize-handle.left {
  top: var(--radius-window);
  bottom: var(--radius-window);
  left: 0;
  width: 4px;
  cursor: w-resize;
}

.resize-handle.right {
  top: var(--radius-window);
  bottom: var(--radius-window);
  right: 0;
  width: 4px;
  cursor: e-resize;
}

.resize-handle.top-left {
  top: 0;
  left: 0;
  width: var(--radius-window);
  height: var(--radius-window);
  cursor: nw-resize;
}

.resize-handle.top-right {
  top: 0;
  right: 0;
  width: var(--radius-window);
  height: var(--radius-window);
  cursor: ne-resize;
}

.resize-handle.bottom-left {
  bottom: 0;
  left: 0;
  width: var(--radius-window);
  height: var(--radius-window);
  cursor: sw-resize;
}

.resize-handle.bottom-right {
  bottom: 0;
  right: 0;
  width: var(--radius-window);
  height: var(--radius-window);
  cursor: se-resize;
}

/* ── Snap divider ── */
.snap-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 12px;
  margin-left: -6px;
  z-index: 9999;
  cursor: col-resize;
  pointer-events: auto;
}

.snap-divider::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 4px;
  right: 4px;
  background: rgba(90, 158, 53, 0.15);
  border-radius: 3px;
  transition: background 0.15s ease;
}

.snap-divider:hover::before {
  background: rgba(90, 158, 53, 0.35);
}

.snap-divider.active::before {
  background: rgba(90, 158, 53, 0.55);
  left: 3px;
  right: 3px;
}

.snap-dragging {
  border-radius: 0 !important;
  transition: none !important;
}

@keyframes window-open {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes window-close {
  from {
    transform: scale(1);
    opacity: 1;
  }
  to {
    transform: scale(0.95);
    opacity: 0;
  }
}

.window.opening {
  animation: window-open var(--duration-normal) var(--ease-spring);
}

.window.closing {
  animation: window-close var(--duration-normal) var(--ease-ios);
}

/* ==========================================================================
   SPRINGBOARD MOBILE (iPhone-style)
   ========================================================================== */
.springboard {
  display: none;
}

/* Cacher le bouton + du dock sur desktop */
.dock-item-add { display: none; }

/* ── Mobile Responsive: Springboard + Dock iPhone ── */
@media (max-width: 767px) {
  /* --- Status bar compact --- */
  .status-bar {
    height: 44px;
    padding: 0 12px;
    z-index: 9999;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
  }
  .status-bar .sync-badge { display: none; }
  .status-bar .status-search { display: none; }
  .status-bar .status-bar-account-name { display: none; }
  .status-bar-left { gap: 8px; }
  .status-bar .status-dropdown { min-width: 240px; right: -12px; }
  
  /* --- Cacher le desktop (widgets + ancien dock), montrer le springboard --- */
  .desktop {
    display: block;
    top: 43px;
    padding-bottom: 0;
  }
  .desktop > .widgets-container {
    display: none;
  }
  .windows-container {
    display: none;
    top: 43px;
    z-index: var(--z-mobile-windows);
  }
  .windows-container.active {
    display: block;
  }
  
  /* --- Dock iPhone (float au-dessus du springboard) --- */
  .dock {
    display: flex;
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0));
    transform: none;
    border-radius: 22px;
    height: 68px;
    padding: 6px 12px;
    justify-content: space-evenly;
    background: rgba(255,255,255,0.75);
    backdrop-filter: blur(50px) saturate(180%);
    -webkit-backdrop-filter: blur(50px) saturate(180%);
    border: 0.5px solid rgba(255,255,255,0.6);
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    gap: 4px;
    z-index: var(--z-mobile-dock);
  }
  /* Cacher le dock quand une fenêtre est ouverte */
  .windows-container.active ~ .dock { display: none; }
  /* Pas de padding dock quand il est caché */
  .windows-container.active .window .chantiers-tab-panels,
  .windows-container.active .window .achats-scroll,
  .windows-container.active .window .heures-scroll,
  .windows-container.active .window .clients-body,
  .windows-container.active .window .finance-scroll,
  .windows-container.active .window .chiffrage-view-body,
  .windows-container.active .window .plans-view-body,
  .windows-container.active .window .calc-scroll { padding-bottom: 0; }
  /* Fenêtre pleine largeur sur mobile */
  .windows-container.active .window {
    left: 0 !important;
    width: 100vw !important;
    border-radius: 0;
  }
  .dock-item {
    width: 48px;
    height: 48px;
    flex-direction: column;
    gap: 1px;
    touch-action: manipulation;
  }
  .dock-item-icon {
    width: 48px;
    height: 48px;
    font-size: 22px;
    border-radius: 12px;
  }
  .dock-item-tooltip { display: none; }
  .dock-item-indicator { display: none; }
  .dock-item:hover { transform: none; }
  .dock-item:active { transform: scale(0.88); }
  .dock-item:hover + .dock-item,
  .dock-item:has(+ .dock-item:hover) { transform: none; }
  .dock-item:hover + .dock-item + .dock-item,
  .dock-item:has(+ .dock-item + .dock-item:hover) { transform: none; }
  .dock-separator { display: none; }
  .dock-folder { display: none; }
  /* Only 3 main apps + button in dock on mobile */
  .dock-item[data-app="agenda"],
  .dock-item[data-app="calculateur"],
  .dock-item[data-app="chiffrage"],
  .dock-item[data-app="achats"],
  .dock-item[data-app="fichiers"],
  .dock-item[data-app="docs"],
  .dock-item[data-app="finances"],
  .dock-item[data-app="assistant"],
  .dock-item[data-app="admin"],
  .dock-item[data-app="plans"] { display: none; }
  
  /* ── Bouton + du dock (mobile uniquement) ── */
  .dock-item-add { display: flex; border-radius: 14px; }
  .dock-item-add .dock-add-icon {
    background: rgba(0,0,0,0.15);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 0.5px solid rgba(255,255,255,0.25);
    color: #fff;
  }
  .dock-item-add .dock-add-icon i { width: 28px; height: 28px; }
  .dock-item-add:active .dock-add-icon { transform: scale(0.88); }
  
  
  /* --- Windows full-screen sans boutons --- */
  .window { border-radius: 0; }
  .window .title-bar { cursor: default; }
  .window .traffic-light.minimize,
  .window .traffic-light.maximize { display: none; }
  .window .traffic-light.close {
    width: 14px;
    height: 14px;
    border: none;
  }
  .window .traffic-light.close svg { display: none; }
  .window .resize-handle { display: none; }
  /* Padding sous le contenu des apps maximisées */
  .window.maximized .chantiers-tab-panels,
  .window.fullscreen .chantiers-tab-panels,
  .window[class*="snap-"] .chantiers-tab-panels,
  .window.maximized .achats-scroll,
  .window.fullscreen .achats-scroll,
  .window[class*="snap-"] .achats-scroll,
  .window.maximized .heures-scroll,
  .window.fullscreen .heures-scroll,
  .window[class*="snap-"] .heures-scroll,
  .window.maximized .clients-body,
  .window.fullscreen .clients-body,
  .window[class*="snap-"] .clients-body,
  .window.maximized .finance-scroll,
  .window.fullscreen .finance-scroll,
  .window[class*="snap-"] .finance-scroll,
  .window.maximized .chiffrage-view-body,
  .window.fullscreen .chiffrage-view-body,
  .window[class*="snap-"] .chiffrage-view-body,
  .window.maximized .plans-view-body,
  .window.fullscreen .plans-view-body,
  .window[class*="snap-"] .plans-view-body,
  .window.maximized .calc-scroll,
  .window.fullscreen .calc-scroll,
  .window[class*="snap-"] .calc-scroll { padding-bottom: 100px; }
  
  /* --- Ajustements scroll --- */
  .widget-content { max-height: none; }

  /* ==========================================================================
     SPRINGBOARD, ACTION SHEET & FOLDER (migrés depuis mobile.css obsolète)
     ========================================================================== */
  .sb-widget {
    opacity: 0;
    animation: widgetFadeSlideUp 0.45s var(--ease-spring) forwards;
  }

  .sb-widget:nth-child(1) { animation-delay: 0.05s; }
  .sb-widget:nth-child(2) { animation-delay: 0.12s; }
  .sb-widget:nth-child(3) { animation-delay: 0.19s; }
  .sb-widget:nth-child(4) { animation-delay: 0.26s; }
  .sb-widget:nth-child(5) { animation-delay: 0.33s; }

  .sb-icon {
    opacity: 0;
    animation: widgetFadeSlideUp 0.35s var(--ease-spring) forwards;
  }

  .sb-icon:nth-child(1) { animation-delay: 0.05s; }
  .sb-icon:nth-child(2) { animation-delay: 0.10s; }
  .sb-icon:nth-child(3) { animation-delay: 0.15s; }
  .sb-icon:nth-child(4) { animation-delay: 0.20s; }
  .sb-icon:nth-child(5) { animation-delay: 0.25s; }
  .sb-icon:nth-child(6) { animation-delay: 0.30s; }
  .sb-icon:nth-child(7) { animation-delay: 0.35s; }
  .sb-icon:nth-child(8) { animation-delay: 0.40s; }

  /* --- Springboard --- */
  .springboard {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 43px;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 50%, #81c784 100%);
    z-index: var(--z-mobile-springboard);
  }

  .sb-track {
    flex: 1;
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }
  .sb-track::-webkit-scrollbar { display: none; }

  .sb-page {
    flex: 0 0 100%;
    scroll-snap-align: start;
    padding: clamp(12px, 4vw, 24px) clamp(12px, 4vw, 24px) 100px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(8px, 2.5vw, 16px);
    align-content: start;
  }

  .sb-page-label {
    grid-column: 1 / -1;
    font-size: clamp(22px, 6vw, 34px);
    font-weight: 800;
    color: rgba(0,0,0,0.8);
    margin-bottom: clamp(2px, 1vw, 8px);
    letter-spacing: -0.3px;
  }

  /* --- Page dots --- */
  .sb-dots {
    position: fixed;
    bottom: 88px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 7px;
    z-index: calc(var(--z-mobile-springboard) + 1);
    pointer-events: none;
  }
  .sb-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(0,0,0,0.3);
    transition: all 0.2s;
  }
  .sb-dot.active {
    background: rgba(0,0,0,0.7);
    width: 20px;
    border-radius: 4px;
  }

  /* --- iOS Widgets --- */
  .sb-widget {
    border-radius: clamp(14px, 3.5vw, 22px);
    padding: clamp(12px, 3vw, 20px);
    margin-bottom: 0;
    position: relative;
    background: rgba(246, 246, 246, 0.55);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    box-shadow: var(--shadow-window);
    border: 0.5px solid var(--glass-border);
  }
  .sb-widget-medium {
    grid-column: 1 / -1;
  }
  .sb-widget-half {
    min-height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
  .sb-widget-half .chantiers-single,
  .sb-widget-half .factures-single {
    min-height: 0;
    padding: 0;
    gap: 4px;
  }
  .sb-widget-half .chantiers-single-count {
    font-size: 34px;
  }
  .sb-widget-half .chantiers-single-label,
  .sb-widget-half .factures-single-label {
    font-size: 10px;
  }
  .sb-widget-half .factures-single-value {
    font-size: 22px;
  }
  .sb-widget-small {
    min-height: 150px;
  }
  .sb-widget-header {
    font-size: clamp(9px, 2.2vw, 13px);
    font-weight: 700;
    color: var(--gray-600);
    margin-bottom: clamp(5px, 1.5vw, 10px);
    letter-spacing: 0.3px;
    text-transform: uppercase;
    position: relative;
  }

  /* --- Page 2: App icons grid --- */
  .sb-icons {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(4, 1fr);
    gap: clamp(10px, 3vw, 20px) clamp(4px, 1.5vw, 12px);
    padding-top: 8px;
    width: 100%;
  }
  .sb-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(4px, 1.2vw, 8px);
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
    color: var(--gray-800);
  }
  .sb-icon:active { transform: scale(0.9); }
  .sb-icon-img {
    width: clamp(44px, 13vw, 64px);
    height: clamp(44px, 13vw, 64px);
    border-radius: clamp(10px, 3vw, 16px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: clamp(20px, 6vw, 30px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  }
  .sb-icon-label {
    font-size: clamp(8px, 2.2vw, 12px);
    font-weight: 500;
    text-align: center;
    line-height: 1.2;
    max-width: clamp(48px, 14vw, 72px);
  }

  /* --- iOS Action Sheet --- */
  .action-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: var(--z-mobile-action-sheet);
    display: none;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
  }
  .action-sheet-overlay.open {
    display: flex;
    opacity: 1;
  }
  .action-sheet {
    width: 100%;
    max-width: 400px;
    background: rgba(240,240,242,0.94);
    backdrop-filter: blur(50px) saturate(180%);
    -webkit-backdrop-filter: blur(50px) saturate(180%);
    border-radius: 14px 14px 0 0;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom,0));
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32,0.72,0,1);
  }
  .action-sheet-overlay.open .action-sheet {
    transform: translateY(0);
  }
  .action-sheet-title {
    font-size: 13px;
    font-weight: 600;
    color: #8e8e93;
    text-align: center;
    padding: 12px 16px 8px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    border-bottom: 0.5px solid rgba(60,60,67,0.08);
    margin-bottom: 4px;
  }
  .action-sheet-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.12s ease;
  }
  .action-sheet-item:active { background: rgba(60,60,67,0.06); }
  .action-sheet-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
  }
  .action-sheet-item-icon i { width: 18px; height: 18px; }
  .action-sheet-item-text {
    display: flex;
    flex-direction: column;
    text-align: left;
  }
  .action-sheet-item-label {
    font-size: 17px;
    font-weight: 400;
    color: #000;
    line-height: 1.3;
  }
  .action-sheet-item-desc {
    font-size: 12px;
    color: #8e8e93;
    line-height: 1.2;
  }
  .action-sheet-cancel {
    margin: 8px 8px 0;
    padding: 14px;
    background: rgba(255,255,255,0.95);
    border-radius: 14px;
    text-align: center;
    font-size: 17px;
    font-weight: 600;
    color: #007aff;
    cursor: pointer;
    transition: background 0.12s ease;
  }

  /* --- Springboard iOS Folder --- */
  .sb-icon-folder { position: relative; }
  .sb-icon-folder-thumb {
    width: 58px;
    height: 58px;
    border-radius: 14px;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border: 0.5px solid rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
  }
  .sb-folder-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 2px;
    width: 42px;
    height: 42px;
  }
  .sb-folder-mini {
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
  }

  /* --- Springboard Folder Overlay --- */
  .sb-folder-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    z-index: var(--z-mobile-folder);
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
  }
  .sb-folder-overlay.open {
    display: flex;
    opacity: 1;
  }
  .sb-folder-popup {
    width: 300px;
    max-height: 80vh;
    overflow-y: auto;
    background: rgba(255,255,255,0.88);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border-radius: 20px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.2);
    padding: 16px 14px 10px;
    transform: scale(0.92);
    transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
  }
  .sb-folder-overlay.open .sb-folder-popup {
    transform: scale(1);
  }
  .sb-folder-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 0.5px solid rgba(60,60,67,0.08);
  }
  .sb-folder-popup-title {
    font-size: 16px;
    font-weight: 600;
    color: #000;
  }
  .sb-folder-popup-close {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: rgba(60,60,67,0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    transition: background 0.12s ease;
  }
  .sb-folder-popup-close:active { background: rgba(60,60,67,0.2); }
  .sb-folder-popup-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
  }

  /* --- Windows fullscreen on mobile --- */
  .windows-container .window {
    position: fixed !important;
    top: 38px !important;
    left: 0 !important;
    width: 100% !important;
    height: calc(100% - 38px) !important;
    border-radius: 0 !important;
    z-index: 8000 !important;
  }
  .windows-container .window .window-titlebar {
    display: none !important;
  }
  .windows-container .window .window-content {
    top: 0 !important;
    height: 100% !important;
  }
  .windows-container .window .window-resize-handle {
    display: none !important;
  }
  .windows-container .window.minimized {
    transform: translateY(100vh) !important;
  }

  /* ─── iOS Detail Tabs (fiche chantier) ─── */
  .ios-detail-tabs {
    display: flex;
    gap: 4px;
    padding: 0 14px 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    position: sticky;
    top: 0;
    background: var(--gray-50);
    z-index: 10;
  }
  .ios-detail-tabs::-webkit-scrollbar { height: 0; }
  .ios-detail-tab {
    flex-shrink: 0;
    padding: 7px 14px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font-sans);
    color: var(--gray-500);
    background: transparent;
    cursor: pointer;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
  }
  .ios-detail-tab:active {
    background: rgba(0,0,0,0.05);
  }
  .ios-detail-tab.active {
    background: var(--green);
    color: white;
    font-weight: 600;
  }
  .ios-detail-panel {
    padding: 0 0 12px;
  }
}
