/* ================================================================
   FITNESS PARK ROMANIA — MOBILE v4.9 "SITE BROWSER"
   ================================================================
   Pattern: Immersive map + horizontal site carousel + rich detail.
   Inspired by Airbnb, Apple Maps (newer), Citymapper.

   Screen states (bottom sheet):
     PEEK    → 140px — handle + active site card swipeable carousel
     SUMMARY → 55vh  — rich summary (big metrics, CTA)
     DETAIL  → 95vh  — accordion full analysis

   Zero impact on desktop (> 768px).
   ================================================================ */

/* Desktop: hide all mobile-only DOM injected by src/mobile.js */
@media (min-width: 769px) {
  .fp-mobile-topbar,
  .fp-mobile-fab,
  .fp-sheet-handle,
  .fp-sheet-carousel,
  .fp-sheet-detail-btn,
  .fp-sheet-tabs,
  .fp-onboarding-hint,
  .fp-mobile-close-btn,
  .fp-mobile-search-overlay,
  .fp-addsite-overlay,
  .fp-secondary-sheet { display: none !important; }
}

@media (max-width: 768px) {

  :root {
    --peek-h: 168px;
    --summary-h: 58vh;
    --detail-h: calc(100dvh - 72px);
    --topbar-h: 56px;
    --fab-size: 52px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 10px;
    --transition-snap: .42s cubic-bezier(.22,.8,.28,1);
    --spring-bounce: .34s cubic-bezier(.34,1.56,.64,1);
    --spring-ease-out: .28s cubic-bezier(.2,.9,.3,1);
    --shadow-lift: 0 -12px 40px rgba(0,0,0,.65);
    --shadow-card: 0 4px 24px rgba(0,0,0,.5);
    --tap: 44px;
    --map-parallax: 1;
  }

  html, body { overflow: hidden; height: 100dvh; overscroll-behavior: none; }

  /* Hide desktop chrome entirely on mobile — we render our own UI */
  .app { display: block !important; grid-template-columns: none !important; height: 100dvh !important; }
  .app.panel-open { grid-template-columns: none !important; }
  .sidebar { display: none !important; } /* desktop sidebar hidden; we use fp-sheet instead */
  .right-panel { display: none !important; } /* right panel too */

  /* MAP fills screen — with parallax scale effect when sheet grows */
  .map-area {
    position: fixed !important;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100vw !important; height: 100dvh !important;
    z-index: 1;
    transform: scale(var(--map-parallax, 1));
    transform-origin: center 35%;
    transition: transform .5s cubic-bezier(.22,.8,.28,1);
    will-change: transform;
  }
  #map { height: 100dvh !important; }
  /* Reduced motion: skip parallax */
  @media (prefers-reduced-motion: reduce) {
    .map-area { transform: none !important; transition: none !important; }
  }

  /* Hide Leaflet default controls (pinch replaces zoom, attribution invasive) */
  .leaflet-control-zoom,
  .tile-selector { display: none !important; }
  .leaflet-control-attribution {
    font-size: 8px !important;
    padding: 1px 4px !important;
    background: rgba(0,0,0,.35) !important;
    color: rgba(148,163,184,.5) !important;
    margin-bottom: calc(var(--peek-h) + 2px) !important;
    pointer-events: none;
  }

  /* Hide redundant legacy overlays */
  .map-box, #pointBox, #sazBox, #legend, .legend,
  .map-overlay-tr, #mapOverlayTR { display: none !important; }

  /* ═════ TOP BAR ═════ */
  .fp-mobile-topbar {
    position: fixed;
    top: var(--safe-top);
    left: 0; right: 0;
    height: var(--topbar-h);
    z-index: 900;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(6,8,15,.85) 0%, rgba(6,8,15,.0) 100%);
  }
  .fp-mobile-topbar > * { pointer-events: auto; }
  .fp-mobile-topbar .fp-logo {
    font-weight: 900;
    font-size: 13px;
    letter-spacing: .5px;
    color: var(--white);
    text-shadow: 0 2px 8px rgba(0,0,0,.8);
    flex-shrink: 0;
  }
  .fp-mobile-topbar .fp-logo-img {
    height: 28px;
    width: auto;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,.65));
    flex-shrink: 0;
  }
  @media (max-width: 360px) {
    .fp-mobile-topbar .fp-logo-img { height: 24px; }
  }
  .fp-mobile-topbar .fp-logo em {
    color: var(--accent); font-style: normal;
  }
  .fp-search-pill {
    flex: 1;
    height: 40px;
    background: rgba(17,24,39,.95);
    backdrop-filter: blur(14px) saturate(180%);
    border: 1px solid rgba(212,160,23,.3);
    border-radius: 20px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    gap: 10px;
    color: var(--gray);
    font-size: 13px;
    cursor: pointer;
    box-shadow: var(--shadow-card);
    transition: transform .2s;
  }
  .fp-search-pill:active { transform: scale(.97); }
  .fp-search-pill svg {
    width: 16px; height: 16px; stroke: var(--gray); fill: none; stroke-width: 2;
    flex-shrink: 0;
  }
  .fp-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
    color: #000;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 15px;
    box-shadow: var(--shadow-card);
    flex-shrink: 0;
    cursor: pointer;
  }
  .fp-locale-pill {
    width: 44px; height: 40px;
    border-radius: 20px;
    background: rgba(17,24,39,.95);
    backdrop-filter: blur(14px) saturate(180%);
    border: 1px solid rgba(212,160,23,.3);
    color: var(--accent);
    font-weight: 800; font-size: 11px;
    letter-spacing: .5px;
    box-shadow: var(--shadow-card);
    flex-shrink: 0;
    cursor: pointer;
    padding: 0;
    transition: transform var(--spring-bounce), background-color .2s, border-color .2s;
  }
  .fp-locale-pill:active { transform: scale(.9); background: rgba(212,160,23,.12); border-color: rgba(212,160,23,.6); }

  /* ═════ FAB (Floating Action Button) bottom-right ═════ */
  .fp-mobile-fab {
    position: fixed;
    right: 14px;
    bottom: calc(var(--peek-h) + 16px + var(--safe-bottom));
    width: var(--fab-size); height: var(--fab-size);
    border-radius: 50%;
    background: rgba(17,24,39,.96);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(212,160,23,.35);
    box-shadow: var(--shadow-card);
    display: flex; align-items: center; justify-content: center;
    color: var(--accent);
    z-index: 950;
    transition: bottom var(--transition-snap), transform .2s;
    cursor: pointer;
  }
  .fp-mobile-fab { transition: bottom var(--transition-snap), transform var(--spring-bounce); }
  .fp-mobile-fab:active { transform: scale(.85); }
  .fp-mobile-fab svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; }
  body.fp-sheet-summary .fp-mobile-fab { bottom: calc(var(--summary-h) + 12px); }
  body.fp-sheet-detail .fp-mobile-fab { transform: scale(0) rotate(-90deg); pointer-events: none; }

  /* ═════ DEMO FAB (bottom-left, miroir du FAB outils) ═════ */
  .fp-mobile-fab-demo {
    position: fixed;
    left: 14px;
    bottom: calc(var(--peek-h) + 16px + var(--safe-bottom));
    width: var(--fab-size); height: var(--fab-size);
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(212,160,23,.22) 0%, rgba(17,24,39,.96) 100%);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(212,160,23,.6);
    box-shadow: var(--shadow-card), 0 0 12px rgba(212,160,23,.25);
    display: flex; align-items: center; justify-content: center;
    color: var(--accent);
    z-index: 950;
    transition: bottom var(--transition-snap), transform var(--spring-bounce),
                box-shadow .25s, background .25s;
    cursor: pointer;
    padding-left: 2px;  /* Décalage optique pour centrer le triangle play */
  }
  .fp-mobile-fab-demo:active { transform: scale(.85); }
  .fp-mobile-fab-demo:hover {
    box-shadow: var(--shadow-card), 0 0 20px rgba(212,160,23,.45);
  }
  .fp-mobile-fab-demo svg { width: 22px; height: 22px; }
  body.fp-sheet-summary .fp-mobile-fab-demo { bottom: calc(var(--summary-h) + 12px); }
  body.fp-sheet-detail .fp-mobile-fab-demo { transform: scale(0) rotate(-90deg); pointer-events: none; }

  /* Spring on avatar + search pill taps */
  .fp-avatar, .fp-search-pill { transition: transform var(--spring-bounce), background-color .2s; }
  .fp-avatar:active { transform: scale(.9); }
  .fp-search-pill:active { transform: scale(.97); background: rgba(17,24,39,1); }

  /* ═════ BOTTOM SHEET (the main interactive surface) ═════ */
  .fp-sheet {
    position: fixed;
    left: 0; right: 0;
    bottom: 0;
    height: var(--peek-h);
    max-height: var(--detail-h);
    background: rgba(17,24,39,.98);
    backdrop-filter: blur(22px) saturate(160%);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    border: 1px solid var(--border);
    border-bottom: none;
    box-shadow: var(--shadow-lift);
    z-index: 1001;
    transition: height var(--transition-snap);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .fp-sheet.dragging { transition: none; }

  .fp-sheet-handle {
    position: relative;
    flex-shrink: 0;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    touch-action: none;
    z-index: 2;
  }
  .fp-sheet-handle:active { cursor: grabbing; }
  .fp-sheet-handle::before {
    content: '';
    width: 44px; height: 5px;
    background: var(--gray2);
    border-radius: 3px;
    opacity: .55;
    transition: opacity .2s, background .2s;
  }
  .fp-sheet-handle:active::before { opacity: 1; background: var(--accent); }

  /* ─── CAROUSEL (peek + summary state) ─── */
  .fp-sheet-carousel {
    flex-shrink: 0;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    display: flex;
    gap: 10px;
    padding: 4px 14px 14px;
  }
  .fp-sheet-carousel::-webkit-scrollbar { display: none; }

  .fp-site-card {
    flex: 0 0 86%;
    scroll-snap-align: center;
    background: linear-gradient(180deg, rgba(30,41,59,.6) 0%, rgba(17,24,39,0) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    min-height: 112px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    cursor: pointer;
    transition: transform var(--spring-bounce), border-color .25s, box-shadow .25s;
    position: relative;
    overflow: hidden;
  }
  .fp-site-card::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(ellipse at top, rgba(212,160,23,.08) 0%, transparent 60%);
    opacity: 0;
    transition: opacity .4s;
    pointer-events: none;
  }
  .fp-site-card:active { transform: scale(.972); }
  .fp-site-card.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(212,160,23,.3), 0 6px 24px rgba(212,160,23,.18);
  }
  .fp-site-card.active::before { opacity: 1; }

  .fp-site-card .fp-site-head {
    display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  }
  .fp-site-card .fp-site-num {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: .8px;
  }
  .fp-site-card .fp-site-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--white);
    line-height: 1.2;
  }
  .fp-site-card .fp-verdict {
    font-size: 10px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 8px;
    letter-spacing: .5px;
    white-space: nowrap;
    text-transform: uppercase;
  }
  .fp-verdict.go-cond { background: rgba(16,185,129,.15); color: #34d399; border: 1px solid rgba(16,185,129,.4); box-shadow: 0 0 14px rgba(16,185,129,.22); }
  .fp-verdict.go       { background: rgba(34,197,94,.2);  color: #4ade80; border: 1px solid rgba(34,197,94,.5); box-shadow: 0 0 14px rgba(34,197,94,.28); }
  .fp-verdict.watch    { background: rgba(245,158,11,.15); color: #fbbf24; border: 1px solid rgba(245,158,11,.4); box-shadow: 0 0 14px rgba(245,158,11,.22); }
  .fp-verdict.no-go    { background: rgba(239,68,68,.15);  color: #f87171; border: 1px solid rgba(239,68,68,.4); box-shadow: 0 0 14px rgba(239,68,68,.22); }
  .fp-verdict.loading  { background: rgba(100,116,139,.15); color: var(--gray2); border: 1px solid var(--border); }

  /* Shimmer effect for loading cards (when verdict is '…') */
  .fp-site-card:has(.fp-verdict.loading) .fp-mini-metric .v {
    background: linear-gradient(90deg, #2a3142 25%, #394358 50%, #2a3142 75%);
    background-size: 200% 100%;
    color: transparent !important;
    border-radius: 4px;
    animation: fpShimmer 1.6s infinite;
  }
  @keyframes fpShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
  }
  @media (prefers-reduced-motion: reduce) {
    .fp-site-card:has(.fp-verdict.loading) .fp-mini-metric .v { animation: none; }
    .fp-detail-cta::before { animation: none; }
  }

  .fp-site-card .fp-site-meta {
    display: flex; gap: 14px;
    font-size: 11px;
    color: var(--gray);
  }
  .fp-site-card .fp-site-meta b {
    color: var(--white);
    font-weight: 700;
  }

  .fp-site-card .fp-mini-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 4px;
  }
  .fp-site-card .fp-mini-metric {
    text-align: center;
  }
  .fp-site-card .fp-mini-metric .v {
    font-size: 17px; font-weight: 800;
    color: var(--white);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
  }
  .fp-site-card .fp-mini-metric.good .v { color: #34d399; }
  .fp-site-card .fp-mini-metric.bad  .v { color: #f87171; }
  .fp-site-card .fp-mini-metric .l {
    font-size: 9px;
    color: var(--gray2);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-top: 2px;
  }

  /* ─── SUMMARY STATE: bigger hero metrics ─── */
  body.fp-sheet-summary .fp-site-card.active {
    flex: 0 0 100%;
    min-height: 180px;
  }
  .fp-sheet[data-state="summary"] .fp-sheet-carousel,
  .fp-sheet[data-state="detail"]  .fp-sheet-carousel { overflow-x: hidden; }
  .fp-sheet[data-state="summary"] .fp-site-card:not(.active),
  .fp-sheet[data-state="detail"]  .fp-site-card:not(.active) { display: none; }

  /* Detail view CTA (shown in summary state, inside active card) */
  .fp-detail-cta {
    display: none;
    margin-top: 10px;
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
    color: #000;
    font-weight: 800;
    font-size: 13.5px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: .4px;
    box-shadow: 0 4px 14px rgba(212,160,23,.35), inset 0 1px 0 rgba(255,255,255,.35);
    position: relative;
    overflow: hidden;
    transition: transform var(--spring-bounce), box-shadow .3s;
  }
  .fp-detail-cta::before {
    /* shimmer sweep */
    content: '';
    position: absolute; top: 0; bottom: 0;
    left: -60%;
    width: 40%;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.3) 50%, transparent 100%);
    transform: skewX(-20deg);
    animation: fpShimmerSweep 2.4s cubic-bezier(.3,.8,.3,1) infinite;
  }
  @keyframes fpShimmerSweep {
    0% { left: -60%; } 60% { left: 120%; } 100% { left: 120%; }
  }
  .fp-detail-cta:active { transform: scale(.96); box-shadow: 0 2px 8px rgba(212,160,23,.45); }
  .fp-detail-cta svg { width: 16px; height: 16px; fill: currentColor; position: relative; z-index: 1; }
  body.fp-sheet-summary .fp-detail-cta { display: flex; }
  body.fp-sheet-detail  .fp-detail-cta { display: none; }

  /* ─── DETAIL STATE: full analysis as accordion ─── */
  .fp-sheet-detail-scroll {
    display: none;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overflow-x: hidden;
    padding: 0 14px 30px;
  }
  body.fp-sheet-detail .fp-sheet-detail-scroll { display: block; }

  .fp-detail-header {
    position: sticky; top: 0;
    background: linear-gradient(180deg, rgba(17,24,39,.98) 60%, rgba(17,24,39,0) 100%);
    padding: 6px 0 14px;
    z-index: 3;
    display: flex; align-items: center; gap: 10px;
  }
  .fp-detail-back {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--card2);
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border);
    cursor: pointer;
    flex-shrink: 0;
  }
  .fp-detail-back:active { transform: scale(.92); }
  .fp-detail-back svg { width: 18px; height: 18px; stroke: var(--white); fill: none; stroke-width: 2.5; }
  .fp-detail-title { flex: 1; min-width: 0; }
  .fp-detail-title .t { font-size: 15px; font-weight: 700; color: var(--white); }
  .fp-detail-title .s { font-size: 11px; color: var(--gray); margin-top: 2px; }

  /* ─── Detail prev/next nav bar ─── */
  .fp-detail-nav {
    display: flex;
    align-items: stretch;
    gap: 0;
    margin: 0 0 14px;
    background: rgba(30,41,59,.4);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
  }
  .fp-detail-nav-btn {
    flex: 1; min-width: 0;
    display: flex; align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: transparent;
    border: none;
    color: var(--gray);
    font-family: var(--font);
    font-size: 12px;
    cursor: pointer;
    text-align: left;
    transition: background .2s, color .2s;
  }
  .fp-detail-nav-btn.next { justify-content: flex-end; text-align: right; }
  .fp-detail-nav-btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2.5; flex-shrink: 0; }
  .fp-detail-nav-btn .fp-nav-label {
    min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-weight: 600;
    color: var(--white);
  }
  .fp-detail-nav-btn:active { background: rgba(212,160,23,.12); color: var(--accent); }
  .fp-detail-nav-sep {
    width: 1px; background: var(--border); flex-shrink: 0;
  }

  /* Detail-swipe transition between sites */
  .fp-sheet-detail-scroll {
    transition: transform .2s cubic-bezier(.3,.7,.3,1);
  }
  .fp-sheet-detail-scroll.fp-detail-swipe-next { transform: translateX(-8px); opacity: .3; }
  .fp-sheet-detail-scroll.fp-detail-swipe-prev { transform: translateX(8px); opacity: .3; }

  /* Custom site pin: même style doré que TARGETS (demande Paul 2026-04-20).
     Override neutralisé — fp-custom-pin hérite désormais du style fp-target-pin. */
  .fp-target-pin.fp-custom-pin {
    /* No override — match TARGETS gold pin exactly */
  }
  .fp-target-pin.fp-custom-pin.active {
    /* Hérite de l'animation .active de fp-target-pin (doré) */
  }
  @keyframes fpPinPulsePurple {
    0%, 100% {
      box-shadow: 0 6px 18px rgba(139,92,246,.7),
                  0 0 0 4px rgba(139,92,246,.3);
    }
    50% {
      box-shadow: 0 8px 26px rgba(139,92,246,.9),
                  0 0 0 14px rgba(139,92,246,.05);
    }
  }

  /* Accordion sections built from original analysis */
  .fp-accordion { display: flex; flex-direction: column; gap: 10px; }
  .fp-accordion-item {
    background: rgba(30,41,59,.4);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color .25s, box-shadow .25s;
    opacity: 0;
    transform: translateY(16px);
    animation: fpFadeUp .5s cubic-bezier(.22,.9,.3,1) forwards;
  }
  /* Staggered entry */
  body.fp-sheet-detail .fp-accordion-item:nth-child(1) { animation-delay: .05s; }
  body.fp-sheet-detail .fp-accordion-item:nth-child(2) { animation-delay: .12s; }
  body.fp-sheet-detail .fp-accordion-item:nth-child(3) { animation-delay: .19s; }
  body.fp-sheet-detail .fp-accordion-item:nth-child(4) { animation-delay: .26s; }
  body.fp-sheet-detail .fp-accordion-item:nth-child(5) { animation-delay: .33s; }
  body.fp-sheet-detail .fp-accordion-item:nth-child(6) { animation-delay: .40s; }
  @keyframes fpFadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  @media (prefers-reduced-motion: reduce) {
    .fp-accordion-item { opacity: 1; transform: none; animation: none; }
  }
  .fp-accordion-item.open {
    border-color: rgba(212,160,23,.4);
    box-shadow: 0 4px 16px rgba(0,0,0,.25);
  }
  .fp-accordion-head {
    padding: 14px 16px;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    cursor: pointer;
    min-height: var(--tap);
  }
  .fp-accordion-head .icon {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: rgba(212,160,23,.12);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
  }
  .fp-accordion-head .lbl { flex: 1; font-weight: 700; font-size: 13.5px; color: var(--white); }
  .fp-accordion-head .hint { font-size: 11px; color: var(--gray2); }
  .fp-accordion-head .chev {
    width: 18px; height: 18px; stroke: var(--gray); fill: none; stroke-width: 2.5;
    transition: transform .25s;
  }
  .fp-accordion-item.open .chev { transform: rotate(180deg); color: var(--accent); }
  .fp-accordion-body {
    display: none;
    padding: 0 14px 14px;
    max-width: 100%;
    overflow: hidden;
  }
  .fp-accordion-item.open .fp-accordion-body { display: block; }
  .fp-accordion-body > * { max-width: 100%; box-sizing: border-box; word-wrap: break-word; }
  .fp-accordion-body .card {
    background: var(--card) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    padding: 12px !important;
    margin-bottom: 10px !important;
  }
  .fp-accordion-body .card:last-child { margin-bottom: 0 !important; }
  .fp-accordion-body .metric-row {
    padding: 6px 0;
    border-bottom: 1px solid rgba(71,85,115,.2);
    gap: 8px;
  }
  .fp-accordion-body .metric-row:last-child { border-bottom: none; }
  .fp-accordion-body .metric-label, .fp-accordion-body .detail-label {
    min-width: 0; overflow: hidden; text-overflow: ellipsis;
  }

  /* ═════ FAB SECONDARY SHEET (Layers + tools) ═════ */
  .fp-secondary-sheet {
    position: fixed;
    left: 0; right: 0;
    bottom: 0;
    transform: translateY(100%);
    height: 70vh;
    max-height: 520px;
    background: rgba(17,24,39,.98);
    backdrop-filter: blur(22px) saturate(160%);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    border-top: 1px solid var(--border);
    box-shadow: var(--shadow-lift);
    z-index: 1100;
    transition: transform var(--transition-snap);
    display: flex; flex-direction: column;
    overflow: hidden;
  }
  .fp-secondary-sheet.open { transform: translateY(0); }
  .fp-secondary-sheet .head {
    flex-shrink: 0;
    padding: 20px 16px 14px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border);
  }
  .fp-secondary-sheet .head .title {
    font-size: 16px; font-weight: 800; color: var(--white);
    display: flex; align-items: center; gap: 10px;
  }
  .fp-secondary-sheet .head .close-btn {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--card2);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: var(--white); cursor: pointer;
    border: 1px solid var(--border);
  }
  .fp-secondary-sheet .body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
  }

  .fp-secondary-tabs {
    display: flex;
    gap: 6px;
    /* padding-top pour décoller du header, right généreux pour fade scroll-x */
    padding: 10px 12px 12px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .fp-secondary-tabs::-webkit-scrollbar { display: none; }
  .fp-secondary-tab {
    flex: 1 1 0;
    min-width: 0;
    height: 32px;
    padding: 0 10px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 16px;
    color: var(--gray);
    font-size: 11.5px;
    font-weight: 600;
    display: flex; align-items: center; justify-content: center; gap: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
  }
  .fp-secondary-tab.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
  }
  .fp-secondary-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1099;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
  }
  .fp-secondary-backdrop.on { opacity: 1; pointer-events: auto; }

  /* Bigger toggles inside secondary sheet */
  .fp-secondary-sheet .toggle { width: 48px !important; height: 28px !important; }
  .fp-secondary-sheet .toggle::before { width: 22px !important; height: 22px !important; }
  .fp-secondary-sheet .toggle.on::before { transform: translateX(20px) !important; }
  .fp-secondary-sheet .layer-label { font-size: 14px !important; }

  /* ═════ SEARCH OVERLAY ═════ */
  .fp-mobile-search-overlay {
    position: fixed; inset: 0;
    background: rgba(6,8,15,.98);
    backdrop-filter: blur(16px);
    z-index: 9998;
    display: none;
    flex-direction: column;
    padding: calc(var(--safe-top) + 12px) 14px 14px;
  }
  .fp-mobile-search-overlay.on { display: flex; }
  .fp-mobile-search-overlay .row {
    display: flex; align-items: center; gap: 10px;
    height: var(--topbar-h);
  }
  .fp-mobile-search-overlay .back-btn {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--card2); border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
  }
  .fp-mobile-search-overlay input {
    flex: 1; height: 46px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0 16px;
    color: var(--white);
    font-size: 15px;
    font-family: var(--font);
  }
  .fp-mobile-search-overlay input:focus {
    outline: 2px solid var(--accent); border-color: var(--accent);
  }
  .fp-mobile-search-overlay .results {
    margin-top: 12px; overflow-y: auto; flex: 1;
  }
  .fp-search-clear {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--card2);
    display: flex; align-items: center; justify-content: center;
    color: var(--gray);
    font-size: 13px;
    cursor: pointer;
    flex-shrink: 0;
  }
  .fp-search-clear:active { background: var(--card3); color: var(--white); }

  /* Autocomplete result items (iOS-like list) */
  .fp-search-item {
    display: flex; align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(30,41,59,.3);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    cursor: pointer;
    transition: background .18s, transform .12s;
  }
  .fp-search-item:active {
    background: rgba(212,160,23,.12);
    transform: scale(.98);
  }
  .fp-search-item-icon {
    width: 20px; height: 20px;
    fill: var(--accent);
    flex-shrink: 0;
    margin-top: 2px;
    filter: drop-shadow(0 0 4px rgba(212,160,23,.4));
  }
  .fp-search-item-text { flex: 1; min-width: 0; }
  .fp-search-item-text .main {
    font-size: 14px;
    font-weight: 700;
    color: var(--white);
    line-height: 1.3;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .fp-search-item-text .sec {
    font-size: 12px;
    color: var(--gray);
    margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .fp-search-loading, .fp-search-empty {
    padding: 14px; text-align: center;
    font-size: 12px; color: var(--gray2);
    font-style: italic;
  }
  .fp-search-loading::after {
    content: '…';
    display: inline-block;
    animation: fpDots 1.2s steps(3, end) infinite;
  }
  @keyframes fpDots {
    0% { content: '.'; } 33% { content: '..'; } 66%, 100% { content: '…'; }
  }
  .fp-search-footer {
    padding-top: 10px;
    text-align: center;
    font-size: 9px;
    color: var(--gray2);
    letter-spacing: .5px;
  }

  /* ═════ ADD SITE: CTA button in "Mes sites" ═════ */
  .fp-addsite-cta-wrap {
    position: sticky;
    bottom: 0;
    left: 0; right: 0;
    padding: 12px 0 4px;
    background: linear-gradient(180deg, transparent 0%, rgba(17,24,39,.98) 60%);
    margin-top: 14px;
    z-index: 5;
  }
  .fp-addsite-cta {
    width: 100%;
    min-height: 54px;
    display: flex; align-items: center; justify-content: center;
    gap: 10px;
    padding: 0 18px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
    border: none;
    border-radius: 14px;
    color: #0a0d17;
    font-family: var(--font);
    font-size: 15px;
    font-weight: 800;
    letter-spacing: .3px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(212,160,23,.35), inset 0 1px 0 rgba(255,255,255,.25);
    transition: transform var(--spring-bounce), box-shadow .2s;
  }
  .fp-addsite-cta:active {
    transform: scale(.97);
    box-shadow: 0 3px 10px rgba(212,160,23,.25), inset 0 1px 0 rgba(255,255,255,.15);
  }
  .fp-addsite-cta svg {
    width: 22px; height: 22px;
    stroke: #0a0d17;
    stroke-width: 2.8;
    fill: none;
    flex-shrink: 0;
  }

  /* ═════ ADD SITE: full-screen overlay ═════ */
  .fp-addsite-overlay {
    position: fixed; inset: 0;
    z-index: 1200;
    background: rgba(6,8,15,.96);
    backdrop-filter: blur(22px) saturate(160%);
    display: flex; flex-direction: column;
    padding: calc(var(--safe-top) + 14px) 14px calc(var(--safe-bottom) + 14px);
    gap: 14px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity .25s ease-out, transform .3s cubic-bezier(.22,.8,.28,1), visibility 0s linear .25s;
  }
  .fp-addsite-overlay.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity .25s ease-out, transform .3s cubic-bezier(.22,.8,.28,1), visibility 0s linear 0s;
  }

  .fp-addsite-header {
    display: flex; align-items: center; gap: 12px;
    padding: 2px 2px 10px;
  }
  .fp-addsite-header .fp-addsite-back {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--card2);
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border);
    cursor: pointer;
    flex-shrink: 0;
    transition: transform var(--spring-bounce);
  }
  .fp-addsite-header .fp-addsite-back:active { transform: scale(.92); }
  .fp-addsite-header .fp-addsite-back svg {
    width: 20px; height: 20px;
    stroke: var(--white); fill: none; stroke-width: 2.5;
  }
  .fp-addsite-header .fp-addsite-title {
    flex: 1; min-width: 0;
  }
  .fp-addsite-header .fp-addsite-title .t {
    font-size: 18px; font-weight: 800; color: var(--white);
    line-height: 1.2;
  }
  .fp-addsite-header .fp-addsite-title .s {
    font-size: 12px; color: var(--gray); margin-top: 2px;
  }

  .fp-addsite-input-wrap {
    position: relative;
  }
  .fp-addsite-input-wrap svg.search-icon {
    position: absolute; left: 16px; top: 50%;
    transform: translateY(-50%);
    width: 18px; height: 18px;
    stroke: var(--gray); fill: none; stroke-width: 2;
    pointer-events: none;
  }
  .fp-addsite-input {
    width: 100%; height: 54px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0 44px 0 44px;
    color: var(--white);
    font-family: var(--font);
    font-size: 15px;
    font-weight: 500;
    transition: border-color .2s, box-shadow .2s;
  }
  .fp-addsite-input::placeholder { color: var(--gray2); }
  .fp-addsite-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(212,160,23,.18);
  }
  .fp-addsite-clear {
    position: absolute; right: 10px; top: 50%;
    transform: translateY(-50%);
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--card2);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; color: var(--gray);
    cursor: pointer;
    border: none;
    display: none;
  }
  .fp-addsite-input-wrap.has-value .fp-addsite-clear { display: flex; }

  .fp-addsite-results {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 14px;
  }
  .fp-addsite-results-item {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 14px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: transform var(--spring-bounce), border-color .2s, background .2s;
  }
  .fp-addsite-results-item:active {
    transform: scale(.98);
    border-color: var(--accent);
    background: rgba(212,160,23,.06);
  }
  .fp-addsite-results-item .pin {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(212,160,23,.18) 0%, rgba(212,160,23,.05) 100%);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(212,160,23,.3);
  }
  .fp-addsite-results-item .pin svg {
    width: 18px; height: 18px;
    fill: var(--accent);
  }
  .fp-addsite-results-item .text {
    flex: 1; min-width: 0;
  }
  .fp-addsite-results-item .text .main {
    font-size: 14px; font-weight: 700; color: var(--white);
    line-height: 1.3;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .fp-addsite-results-item .text .sec {
    font-size: 11px; color: var(--gray);
    margin-top: 3px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .fp-addsite-results-item .arrow {
    width: 16px; height: 16px;
    stroke: var(--gray2);
    fill: none; stroke-width: 2.5;
    flex-shrink: 0;
  }

  .fp-addsite-loading, .fp-addsite-empty, .fp-addsite-hint {
    padding: 28px 14px;
    text-align: center;
    font-size: 13px;
    color: var(--gray2);
  }
  .fp-addsite-hint .big {
    display: block; font-size: 34px; margin-bottom: 10px;
    filter: drop-shadow(0 2px 12px rgba(212,160,23,.3));
  }

  .fp-addsite-preview {
    background: linear-gradient(180deg, rgba(212,160,23,.08), rgba(212,160,23,.02));
    border: 1px solid rgba(212,160,23,.3);
    border-radius: 14px;
    padding: 16px;
    animation: fpPreviewIn .35s cubic-bezier(.34,1.56,.64,1);
  }
  @keyframes fpPreviewIn {
    from { opacity: 0; transform: translateY(10px) scale(.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
  }
  .fp-addsite-preview .label {
    font-size: 10px; letter-spacing: .6px;
    text-transform: uppercase;
    color: var(--accent); font-weight: 700;
    margin-bottom: 6px;
  }
  .fp-addsite-preview .pname {
    font-size: 16px; font-weight: 800; color: var(--white);
    line-height: 1.3;
    margin-bottom: 4px;
  }
  .fp-addsite-preview .paddr {
    font-size: 12px; color: var(--gray);
    line-height: 1.4;
    margin-bottom: 12px;
  }
  .fp-addsite-preview .coords {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 8px;
    background: rgba(30,41,59,.55);
    border-radius: 6px;
    font-size: 10px;
    color: var(--gray2);
    font-variant-numeric: tabular-nums;
    margin-bottom: 14px;
  }
  .fp-addsite-preview label.namefield {
    display: block;
    font-size: 11px; color: var(--gray2); font-weight: 600;
    letter-spacing: .4px; text-transform: uppercase;
    margin-bottom: 6px;
  }
  .fp-addsite-preview .nameinput {
    width: 100%; height: 44px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0 14px;
    color: var(--white);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 14px;
  }
  .fp-addsite-preview .nameinput:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(212,160,23,.18);
  }

  .fp-addsite-confirm {
    width: 100%;
    min-height: 52px;
    display: flex; align-items: center; justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
    border: none;
    border-radius: 12px;
    color: #0a0d17;
    font-family: var(--font);
    font-size: 15px; font-weight: 800;
    letter-spacing: .3px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(212,160,23,.35), inset 0 1px 0 rgba(255,255,255,.25);
    transition: transform var(--spring-bounce);
  }
  .fp-addsite-confirm:active { transform: scale(.97); }
  .fp-addsite-confirm:disabled {
    opacity: .5; cursor: not-allowed; transform: none;
  }
  .fp-addsite-confirm svg {
    width: 18px; height: 18px;
    stroke: #0a0d17; stroke-width: 2.8; fill: none;
  }

  .fp-addsite-footer {
    text-align: center;
    font-size: 9px;
    color: var(--gray2);
    letter-spacing: .5px;
  }

  /* ═════ ONBOARDING TOUR (spotlight) ═════ */
  .fp-tour-overlay {
    position: fixed; inset: 0;
    z-index: 99990;
    opacity: 0;
    transition: opacity .3s ease-out;
    pointer-events: none;
  }
  .fp-tour-overlay.on { opacity: 1; pointer-events: auto; }
  .fp-tour-overlay.closing { opacity: 0; }

  .fp-tour-spot {
    transition: all .5s cubic-bezier(.22,.8,.28,1);
  }

  .fp-tour-tooltip {
    position: fixed;
    left: 14px; right: 14px;
    background: rgba(17,24,39,.98);
    backdrop-filter: blur(14px) saturate(160%);
    border: 1px solid var(--accent);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    box-shadow: 0 12px 48px rgba(0,0,0,.8), 0 0 0 1px rgba(212,160,23,.2);
    transition: top .4s, bottom .4s;
    animation: fpTourPop .45s cubic-bezier(.34,1.56,.64,1);
  }
  @keyframes fpTourPop {
    from { opacity: 0; transform: scale(.92); }
    to   { opacity: 1; transform: scale(1); }
  }
  .fp-tour-progress {
    display: flex; gap: 6px; margin-bottom: 10px;
  }
  .fp-tour-dot {
    width: 24px; height: 3px; border-radius: 1.5px;
    background: var(--border);
    transition: background .3s;
  }
  .fp-tour-dot.active { background: var(--accent); }
  .fp-tour-title {
    font-size: 15px; font-weight: 800;
    color: var(--white);
    margin-bottom: 4px;
  }
  .fp-tour-body {
    font-size: 13px;
    color: var(--gray);
    line-height: 1.45;
    margin-bottom: 14px;
  }
  .fp-tour-actions {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
  }
  .fp-tour-skip {
    background: transparent;
    border: none;
    color: var(--gray2);
    font-size: 13px;
    cursor: pointer;
    padding: 8px 12px;
    font-family: var(--font);
  }
  .fp-tour-skip:active { color: var(--white); }
  .fp-tour-next {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #000;
    border: none;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 800;
    font-family: var(--font);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(212,160,23,.35);
    transition: transform var(--spring-bounce);
  }
  .fp-tour-next:active { transform: scale(.96); }

  /* ═════ ONBOARDING HINT (legacy quick-tip) ═════ */
  .fp-onboarding-hint {
    position: fixed;
    bottom: calc(var(--peek-h) + 18px);
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 16px;
    background: var(--accent);
    color: #000;
    font-size: 12px;
    font-weight: 700;
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(212,160,23,.5);
    z-index: 905;
    opacity: 0;
    pointer-events: none;
    transition: opacity .4s;
    display: flex; align-items: center; gap: 6px;
    animation: fpBounce 2.2s ease-in-out infinite;
  }
  .fp-onboarding-hint.show { opacity: 1; }
  .fp-onboarding-hint::before {
    content: '';
    width: 18px; height: 2px; background: currentColor;
    border-radius: 1px;
    margin-right: 4px;
    opacity: .5;
  }
  @keyframes fpBounce {
    0%, 100% { transform: translate(-50%, 0); }
    50% { transform: translate(-50%, -6px); }
  }

  /* ═════ PIN ENHANCEMENTS (v6.48: wrapper transparent, pin FP inside) ═════ */
  /* Avant v6.48: pin doré numéroté directement via ce CSS. Depuis v6.48: le
     wrapper .fp-target-pin ne fait que hériter l'état active (scale + pulse).
     Le vrai visuel (cercle blanc + logo FP) est dans le enfant SVG généré
     par window.fpLogoPinHTML (voir src/fp-logos.js). */
  .fp-target-pin {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: transform var(--spring-bounce);
  }
  .fp-target-pin.active {
    transform: scale(1.1);
    z-index: 1000 !important;
    animation: fpPinPulse 2.2s ease-in-out infinite;
  }
  @keyframes fpPinPulse {
    0%, 100% {
      box-shadow: 0 6px 18px rgba(212,160,23,.7),
                  0 0 0 4px rgba(212,160,23,.3);
    }
    50% {
      box-shadow: 0 8px 26px rgba(212,160,23,.85),
                  0 0 0 14px rgba(212,160,23,.05);
    }
  }
  @media (prefers-reduced-motion: reduce) {
    .fp-target-pin.active { animation: none; }
  }

  /* ═════ HELPERS ═════ */
  /* Touch action on interactive zones */
  .fp-sheet *,
  .fp-mobile-topbar *,
  .fp-mobile-fab,
  .fp-secondary-sheet * { touch-action: manipulation; }

  /* Tooltip tap-to-open (desktop .info-tip was hover-only) */
  .info-tip {
    min-width: 22px; min-height: 22px;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
  }
  .info-tip .tip-content {
    display: none;
    position: fixed !important;
    top: 50% !important; left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: min(90vw, 340px) !important;
    max-height: 70vh !important;
    overflow-y: auto;
    padding: 18px !important;
    font-size: 13px !important;
    line-height: 1.5;
    background: var(--card) !important;
    border: 1px solid var(--accent);
    box-shadow: 0 12px 48px rgba(0,0,0,.7), 0 0 0 9999px rgba(0,0,0,.6);
    border-radius: var(--radius-md);
    z-index: 99999;
  }
  .info-tip.open .tip-content { display: block !important; }
  .info-tip:hover .tip-content { display: none !important; }

  /* Sliders touch-friendly */
  input[type=range] { height: 44px !important; background: transparent; }
  input[type=range]::-webkit-slider-runnable-track {
    height: 6px !important;
    background: var(--card3);
    border-radius: 3px;
  }
  input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 28px !important; height: 28px !important;
    border-radius: 50%;
    background: var(--accent);
    border: 3px solid var(--white);
    margin-top: -11px;
    box-shadow: 0 2px 8px rgba(0,0,0,.4);
  }
  input[type=range]::-moz-range-thumb {
    width: 28px !important; height: 28px !important;
    border-radius: 50%;
    background: var(--accent);
    border: 3px solid var(--white);
  }

  /* Login page fit */
  #loginPage > div { width: 95vw !important; padding: 24px 20px !important; }

  /* Tables: avoid horizontal overflow */
  table.zone-table, table.compare-table {
    display: block; overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 11px;
  }

  /* Charts: constrain height */
  .chart-wrap { max-height: 220px !important; }
  .chart-wrap canvas { max-height: 220px !important; }
}

/* Compact phones */
@media (max-width: 375px) {
  :root { --peek-h: 152px; }
  .fp-site-card { flex: 0 0 88%; padding: 12px 14px; }
  .fp-site-card .fp-site-name { font-size: 14px; }
  .fp-site-card .fp-mini-metric .v { font-size: 16px; }
}

@media (max-width: 320px) {
  :root { --peek-h: 148px; --topbar-h: 52px; }
  .fp-site-card .fp-mini-metric .v { font-size: 14px; }
  .fp-site-card .fp-site-meta { font-size: 10px; gap: 10px; }
}

/* Landscape phones */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
  :root { --peek-h: 110px; --summary-h: 80vh; }
  .fp-site-card { min-height: 80px; padding: 10px 12px; }
  .fp-mobile-topbar { height: 48px; }
}
