    /* ═══════════════════════════════════════════════════════
       FTUSA DESIGN SYSTEM
       Fonts: Rubik (body), Source Serif Pro (headings), JetBrains Mono (data)
       Navy: #313D7F   Green: #93D73B   Dark Green: #6B9D2B
       Body: #666666   Headings: #313D7F   Dark: #39373A
       ═══════════════════════════════════════════════════════ */
    * { margin: 0; padding: 0; box-sizing: border-box; }
    html { scroll-behavior: smooth; }
    body { font-family: "Rubik", sans-serif; background: #ffffff; color: #666666; line-height: 1.7; font-size: 16px; -webkit-text-size-adjust: 100%; }
    .mono { font-family: "JetBrains Mono", monospace; }
    h1, h2, h3, h4 { font-family: "Source Serif Pro", serif; color: #313D7F; font-weight: 700; line-height: 1.15; }
    a { color: #1B7F96; text-decoration: none; transition: color 0.2s; }
    a:hover { color: #313D7F; }

    /* GREEN UNDERLINE ACCENT — signature FTUSA pattern */
    .section-heading { display: inline-block; margin-bottom: 40px; font-size: 30px; }
    .section-heading::after { content: ''; display: block; width: 80px; height: 4px; background: #93D73B; margin-top: 12px; border-radius: 2px; }

    /* ═══ TOP UTILITY BAR ═══ */
    /* utility-bar removed — no longer used */

    /* ═══ MAIN NAV ═══ */
    .main-nav { position: sticky; top: 38px; background: white; border-bottom: 1px solid #e8e8e8; padding: 0 40px; display: flex; align-items: center; height: 60px; z-index: 1000; transition: background .35s ease, border-color .35s ease, box-shadow .35s ease; }
    /* Transparent over the dark hero; flips to solid white once scrolled past it. */
    .main-nav.nav-clear { background: transparent; border-bottom-color: transparent; box-shadow: none; }
    .main-nav.nav-clear .nav-links a { color: #fff; }
    .main-nav.nav-clear .nav-links a:hover { color: #fff; }
    .main-nav.nav-clear .nav-links a.active { color: #fff; border-bottom-color: #93D73B; }
    .main-nav.nav-clear .nav-logo-word { color: #fff !important; }
    .main-nav.nav-clear .hamburger-btn { color: #fff; }
    /* ═══ MAP FULLSCREEN — available on ALL viewports (was mobile-only) ═══ */
    #map-expand-btn { display: inline-flex !important; align-items: center; gap: 6px; position: absolute; right: 12px; bottom: 12px; z-index: 600; background: #313D7F; color: #fff; border: none; border-radius: 24px; padding: 9px 15px; font: 600 14px 'Rubik', sans-serif; cursor: pointer; box-shadow: 0 6px 16px rgba(0,0,0,0.25); }
    #map-expand-btn:hover { background: #232b5c; }
    #map-expand-btn:active { transform: scale(0.97); }
    body.map-fullscreen #map-expand-btn { display: none !important; }
    body.map-fullscreen #map-close-btn { display: inline-flex !important; align-items: center; justify-content: center; position: fixed; top: 14px; right: 14px; z-index: 10100; width: 44px; height: 44px; border-radius: 50%; background: #fff; color: #313D7F; border: 1px solid #313D7F; font-size: 28px; line-height: 1; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,0.2); padding: 0; }
    body.map-fullscreen { overflow: hidden !important; }
    body.map-fullscreen #internal-banner, body.map-fullscreen .main-nav, body.map-fullscreen #chat-bubble { display: none !important; }
    body.map-fullscreen #map-container { position: fixed !important; inset: 0 !important; z-index: 10000 !important; height: 100vh !important; width: 100vw !important; border-radius: 0 !important; margin: 0 !important; border: none !important; }
    body.map-fullscreen #map-container > #world-map, body.map-fullscreen #world-map { height: 100vh !important; width: 100vw !important; border-radius: 0 !important; }
    /* Profile/story modals opened from map dots must sit ABOVE the fullscreen
       map (container z-index 10000); at 2000 they opened invisibly behind it,
       which read as "cannot click the dots". */
    body.map-fullscreen .modal-overlay { z-index: 10200 !important; }
    .nav-logo { height: 56px; width: auto; margin-right: 40px; }
    .nav-links { display: flex; gap: 32px; align-items: center; }
    .nav-links a { font-size: 16px; color: #39373A; font-weight: 500; padding: 24px 0; border-bottom: 3px solid transparent; transition: all 0.2s; font-family: "Rubik", sans-serif; }
    .nav-links a:hover { color: #313D7F; }
    .nav-links a.active { color: #313D7F; border-bottom-color: #93D73B; }
    .nav-right { margin-left: auto; display: flex; gap: 12px; align-items: center; }
    .hamburger-btn { display: none; background: none; border: none; cursor: pointer; padding: 8px; color: #313D7F; align-items: center; justify-content: center; }
    .signed-in-badge { display: none; font-size: 14px; color: #666; background: #f0f7e4; border: 1px solid #d4e8b4; border-radius: 16px; padding: 4px 12px; font-family: "Rubik", sans-serif; white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
    .signed-in-badge.visible { display: inline-block; }
    .btn { display: inline-block; padding: 10px 24px; border-radius: 24px; font-family: "Rubik", sans-serif; font-size: 15px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; cursor: pointer; transition: all 0.2s; text-decoration: none; border: 2px solid transparent; }
    .btn-green { background: #93D73B; color: #1a3300; border-color: #93D73B; }
    .btn-green:hover { background: #6B9D2B; border-color: #6B9D2B; color: #0F2400; }
    .btn-outline { background: white; color: #39373A; border-color: #39373A; }
    .btn-outline:hover { background: #39373A; color: white; }
    .btn-navy { background: #313D7F; color: white; border-color: #313D7F; }
    .btn-navy:hover { background: #232b5c; border-color: #232b5c; color: white; }

    /* ═══ HERO ═══ */
    .hero { background: #ffffff; padding: 60px 40px 48px; position: relative; overflow: hidden; }
    .hero-inner { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 60px; align-items: center; }
    .hero-text h1 { font-size: 44px; line-height: 1.1; margin-bottom: 16px; color: #313D7F; }
    .hero-text h1::after { content: ''; display: block; width: 80px; height: 4px; background: #93D73B; margin-top: 16px; border-radius: 2px; }
    .hero-text p { font-size: 18px; color: #666666; margin-top: 24px; margin-bottom: 30px; line-height: 1.7; }
    .hero-text .btn { margin-right: 12px; }
    /* ── Hero people carousel (right column of hero) ── */
    .hero-carousel { position: relative; width: 100%; height: 380px; border-radius: 20px; overflow: hidden; background: #1a2257; box-shadow: 0 8px 40px rgba(49,61,127,0.22); }
    .hero-carousel-slide { position: absolute; inset: 0; opacity: 0; transition: opacity 1.1s ease; }
    .hero-carousel-slide.active { opacity: 1; }
    .hero-carousel-slide img { width: 100%; height: 100%; object-fit: cover; object-position: center 15%; filter: grayscale(100%) contrast(1.15) brightness(0.68); mix-blend-mode: luminosity; }
    .hero-carousel-overlay { position: absolute; inset: 0; z-index: 1; pointer-events: none; background: linear-gradient(to top, rgba(18,24,72,0.88) 0%, rgba(18,24,72,0.1) 55%, transparent 100%); }
    .hero-carousel-caption { position: absolute; bottom: 0; left: 0; right: 0; z-index: 2; padding: 40px 18px 14px; display: flex; flex-direction: column; gap: 3px; }
    .hero-carousel-name { font: 700 15px "Source Serif Pro", serif; color: #fff; }
    .hero-carousel-from { font: 400 11px "Rubik", sans-serif; color: rgba(255,255,255,0.62); text-transform: uppercase; letter-spacing: 0.5px; }
    .hero-carousel-dots { position: absolute; bottom: 16px; right: 16px; z-index: 3; display: flex; gap: 6px; }
    .hero-carousel-dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,0.28); border: none; padding: 0; cursor: pointer; transition: background 0.3s, transform 0.3s; }
    .hero-carousel-dot.on { background: #93D73B; transform: scale(1.4); }
    .kpis-bar { background: #f5f5f5; padding: 40px 40px; }
    .kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; max-width: 900px; margin: 0 auto; }
    .kpi { text-align: center; }
    .kpi-value { font-size: 36px; font-weight: 700; color: #313D7F; font-family: "JetBrains Mono", monospace; margin-bottom: 8px; }
    .kpi-label { font-size: 15px; color: #666666; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }

    /* ═══ SECTIONS ═══ */
    .section { padding: 80px 40px; max-width: 1200px; margin: 0 auto; scroll-margin-top: 72px; }
    .section-alt { background: #f5f5f5; }
    .section-alt .section { max-width: 1200px; margin: 0 auto; }
    .section-green { background: #487410; color: white; padding: 60px 40px; }
    .section-green h2, .section-green h3 { color: white; }
    .section-green .section-heading::after { background: #93D73B; }

    /* ═══ PROGRAM DATA TABLES ═══ */
    .program-data { margin-bottom: 48px; }
    .program-tables { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
    .program-table-card { background: white; border: 1px solid #e8e8e8; border-radius: 16px; padding: 24px; box-shadow: 0 2px 8px rgba(0,0,0,0.03); }
    .program-table-card h4 { font-size: 18px; margin-bottom: 16px; font-family: "Source Serif Pro", serif; color: #313D7F; }
    .program-table { width: 100%; border-collapse: collapse; font-size: 15px; }
    .program-table thead { background: #f5f5f5; }
    .program-table th { padding: 10px 14px; text-align: right; font-size: 13px; font-weight: 600; color: #313D7F; text-transform: uppercase; letter-spacing: 0.3px; }
    .program-table th:first-child { text-align: left; }
    .program-table td { padding: 10px 14px; text-align: right; border-bottom: 1px solid #f0f0f0; color: #39373A; font-family: "JetBrains Mono", monospace; font-size: 14px; }
    .program-table td:first-child { font-family: "Rubik", sans-serif; font-weight: 500; text-align: left; font-size: 15px; }
    .program-table tr.total-row td { font-weight: 700; border-top: 2px solid #313D7F; color: #313D7F; }
    .program-table .year-header { color: #313D7F; }
    .trend-up { color: #4A7A1B; }
    .trend-down { color: #D35E28; }
    .tab-buttons { display: flex; gap: 8px; margin-bottom: 20px; }


    /* ═══ MAP UX UPGRADES ═══ */
    .map-controls { transition: all 0.3s ease; }
    .map-controls.collapsed { padding: 8px 12px; max-width: 48px; overflow: hidden; }
    .map-controls.collapsed .map-control-group { display: none; }
    .map-ctrl-toggle { background: none; border: none; font-size: 13px; color: #313D7F; cursor: pointer; padding: 2px 6px; margin-left: auto; flex-shrink: 0; font-family: "Rubik", sans-serif; font-weight: 600; }
    .map-controls.collapsed .map-ctrl-toggle { margin-left: 0; font-size: 13px; }
    .map-legend .legend-body { transition: all 0.3s; overflow: hidden; }
    .map-legend.collapsed .legend-body { max-height: 0; overflow: hidden; padding: 0; }
    .legend-section { font-size: 12px; font-weight: 700; color: #313D7F; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 3px; padding-top: 2px; display: inline-block; margin-right: 8px; font-weight: 600; }
    .legend-group { display: block; }

    /* ═══ LEAFLET INTEGRATION ═══ */
    #world-map { width: 100%; height: 100%; z-index: 1; }
    .leaflet-container { background: #eaeef2; font-family: "Rubik", sans-serif; }
    .leaflet-popup-content-wrapper { border-radius: 12px; box-shadow: 0 6px 24px rgba(49,61,127,0.18); }
    .leaflet-popup-content { margin: 16px 20px; font-family: "Rubik", sans-serif; font-size: 16px; color: #39373A; line-height: 1.5; min-width: 220px; }
    .leaflet-popup-content h4 { font-family: "Source Serif Pro", serif; color: #313D7F; font-size: 24px; margin: 0 0 6px 0; font-weight: 700; }
    .leaflet-popup-content .pop-meta { font-size: 15px; color: #767676; margin-bottom: 8px; }
    .leaflet-popup-content .pop-link { display: inline-block; margin-top: 10px; color: #313D7F; font-weight: 600; font-size: 15px; text-decoration: underline; cursor: pointer; }
    .leaflet-popup-content .pop-indicator { margin-top: 10px; padding-top: 10px; border-top: 1px solid #eee; font-size: 15px; color: #666; }
    .leaflet-popup-content .pop-indicator strong { color: #313D7F; }
    .leaflet-control-attribution { font-size: 12px !important; background: rgba(255,255,255,0.8) !important; }
    .leaflet-control-zoom { border: none !important; box-shadow: 0 2px 6px rgba(0,0,0,0.08) !important; }
    .leaflet-control-zoom a { background: white !important; color: #313D7F !important; border: 1px solid #e8e8e8 !important; }
    .leaflet-control-zoom a:hover { background: #f5f5f5 !important; }

    /* ═══ MAP ═══ */
    #map-container { background: #eaeef2; border-radius: 16px; overflow: hidden; border: 1px solid #e8e8e8; height: 680px; position: relative; box-shadow: 0 2px 12px rgba(0,0,0,0.04); }
    .map-controls { position: absolute; top: 16px; left: 16px; background: rgba(255,255,255,0.95); backdrop-filter: blur(8px); border: 1px solid rgba(232,232,232,0.8); border-radius: 12px; padding: 10px 14px; z-index: 500; display: flex; flex-direction: column; gap: 6px; max-width: 900px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
    .map-control-row { display: flex; gap: 10px; align-items: center; }
    .map-legend { position: absolute; bottom: 20px; left: 16px; background: white; border: 1px solid #e8e8e8; border-radius: 10px; padding: 12px 20px; z-index: 500; font-size: 13px; box-shadow: 0 2px 6px rgba(0,0,0,0.06); max-width: 92%; width: auto; }
    .map-legend-title { font-weight: 600; color: #313D7F; margin-bottom: 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.3px; }
    .legend-section { display: block; clear: both; font-weight: 600; color: #313D7F; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 8px; margin-bottom: 4px; }
    .legend-section:first-child { margin-top: 0; }
    .legend-row { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 4px; }
    .legend-item { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; }
    .legend-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
    .legend-line { width: 16px; height: 3px; border-radius: 2px; flex-shrink: 0; }
    .map-control-group { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
    .map-control-label { font-size: 13px; font-weight: 600; color: #666666; text-transform: uppercase; letter-spacing: 0.5px; }
    .pill { border: 1px solid #e8e8e8; background: white; color: #39373A; padding: 5px 12px; border-radius: 20px; cursor: pointer; font-size: 12px; font-weight: 600; transition: all 0.2s; font-family: "Rubik", sans-serif; white-space: nowrap; }
    .pill:hover { background: #f5f5f5; }
    #category-control-row .map-control-group { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; }
    .pill.active { background: #93D73B; color: #39373A; border-color: #93D73B; }

    /* ═══ ADMIN PANEL ═══ */
    .admin-trigger { background: none; border: 1px solid #e0e0e0; color: #666; padding: 6px 14px; border-radius: 20px; cursor: pointer; font-size: 14px; font-weight: 500; font-family: "Rubik", sans-serif; margin-left: 8px; transition: all 0.2s; display: none; }
    .admin-trigger.visible { display: inline-block; }
    .admin-trigger:hover { border-color: #313D7F; color: #313D7F; }
    /* Login overlay */
    .login-overlay { position:fixed;top:0;left:0;width:100%;height:100%;background:linear-gradient(135deg,#313D7F 0%,#1a2350 100%);z-index:100000;display:flex;align-items:center;justify-content:center;font-family:"Rubik",sans-serif; }
    .login-box { background:#fff;border-radius:16px;padding:48px 40px;max-width:380px;width:90%;text-align:center;box-shadow:0 20px 60px rgba(0,0,0,0.3); }
    .login-box img { width:60px;margin-bottom:16px; }
    .login-box h2 { font-family:"Source Serif Pro",serif;color:#313D7F;font-size:24px;margin:0 0 6px; }
    .login-box p { color:#666;font-size:14px;margin:0 0 24px; }
    .login-box input { width:100%;padding:12px 16px;border:1px solid #ddd;border-radius:8px;font-size:15px;font-family:"Rubik",sans-serif;margin-bottom:12px;box-sizing:border-box;transition:border-color 0.2s; }
    .login-box input:focus { outline:none;border-color:#313D7F; }
    .login-box button { width:100%;padding:12px;background:#313D7F;color:#fff;border:none;border-radius:8px;font-size:15px;font-weight:600;font-family:"Rubik",sans-serif;cursor:pointer;transition:background 0.2s; }
    .login-box button:hover { background:#44AEC8; }
    .login-error { color:#D35E28;font-size:13px;margin-top:8px;display:none; }
    .admin-overlay { position: fixed; inset: 0; background: rgba(49,61,127,0.45); backdrop-filter: blur(6px); z-index: 3000; display: none; padding: 40px 20px; overflow-y: auto; }
    .admin-overlay.active { display: flex; align-items: flex-start; justify-content: center; }
    .admin-panel { background: white; border-radius: 20px; width: 100%; max-width: 1100px; max-height: calc(100vh - 80px); overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 24px 80px rgba(0,0,0,0.24); }
    .admin-header { padding: 24px 32px; border-bottom: 1px solid #e8e8e8; display: flex; justify-content: space-between; align-items: center; }
    .admin-header h2 { font-family: "Source Serif Pro", serif; color: #313D7F; font-size: 24px; margin: 0; }
    .admin-header .admin-subtitle { font-size: 14px; color: #767676; margin-top: 4px; }
    .admin-close { background: none; border: none; font-size: 28px; cursor: pointer; color: #767676; padding: 0 8px; }
    .admin-close:hover { color: #313D7F; }
    .admin-tabs { display: flex; border-bottom: 1px solid #e8e8e8; padding: 0 32px; gap: 0; flex-shrink: 0; overflow-x: auto; }
    .admin-tab { padding: 14px 18px; background: none; border: none; cursor: pointer; font-family: "Rubik", sans-serif; font-size: 15px; font-weight: 500; color: #666; border-bottom: 3px solid transparent; white-space: nowrap; transition: all 0.15s; }
    .admin-tab:hover { color: #313D7F; }
    .admin-tab.active { color: #313D7F; border-bottom-color: #93D73B; font-weight: 600; }
    .admin-content { padding: 32px; overflow-y: auto; flex: 1; }
    .admin-panel-section { display: none; }
    .admin-panel-section.active { display: block; }
    .admin-panel-section h3 { font-family: "Source Serif Pro", serif; color: #313D7F; font-size: 20px; margin-bottom: 6px; }
    .admin-panel-section .admin-section-desc { font-size: 15px; color: #666; margin-bottom: 24px; }
    .admin-form-row { margin-bottom: 16px; }
    .admin-form-row label { display: block; font-size: 13px; font-weight: 700; color: #313D7F; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 6px; }
    .admin-form-row input, .admin-form-row textarea, .admin-form-row select { width: 100%; padding: 10px 14px; border: 1px solid #e0e0e0; border-radius: 8px; font-family: "Rubik", sans-serif; font-size: 15px; color: #39373A; box-sizing: border-box; }
    .admin-form-row input:focus, .admin-form-row textarea:focus, .admin-form-row select:focus { outline: none; border-color: #93D73B; }
    .admin-form-row textarea { min-height: 140px; resize: vertical; font-family: "Rubik", sans-serif; line-height: 1.5; }
    .admin-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
    .admin-btn { padding: 10px 20px; border-radius: 8px; font-family: "Rubik", sans-serif; font-size: 15px; font-weight: 600; cursor: pointer; border: none; transition: all 0.15s; }
    .admin-btn.primary { background: #313D7F; color: white; }
    .admin-btn.primary:hover { background: #232b5c; }
    .admin-btn.secondary { background: white; color: #313D7F; border: 1px solid #313D7F; }
    .admin-btn.secondary:hover { background: #f5f5f5; }
    .admin-btn.danger { background: white; color: #D35E28; border: 1px solid #D35E28; }
    .admin-btn.danger:hover { background: #fff5f0; }
    .admin-status { padding: 12px 16px; border-radius: 8px; font-size: 15px; margin-top: 16px; display: flex; align-items: center; gap: 10px; }
    .admin-status::before { content: ''; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
    .admin-status.not-connected { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
    .admin-status.not-connected::before { background: #f59e0b; }
    .admin-status.connected { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
    .admin-status.connected::before { background: #10b981; }
    .admin-note { padding: 14px 18px; background: #f7f8fa; border-left: 3px solid #313D7F; border-radius: 6px; font-size: 14px; color: #666; margin-top: 16px; line-height: 1.6; }
    .admin-note strong { color: #313D7F; }
    .admin-dropzone { border: 2px dashed #d0d0d0; border-radius: 12px; padding: 48px 32px; text-align: center; cursor: pointer; transition: all 0.2s; background: #fafbfc; }
    .admin-dropzone:hover, .admin-dropzone.dragover { border-color: #93D73B; background: #f8fdf0; }
    .admin-dropzone .dropzone-icon { font-size: 36px; color: #767676; margin-bottom: 8px; }
    .admin-dropzone p { font-size: 15px; color: #666; margin: 8px 0 0 0; }
    .admin-dropzone p.sub { font-size: 14px; color: #767676; }
    .admin-dropzone input[type="file"] { display: none; }
    .upload-preview { margin-top: 20px; }
    .upload-preview table { width: 100%; border-collapse: collapse; font-size: 14px; border: 1px solid #e8e8e8; border-radius: 8px; overflow: hidden; }
    .upload-preview th { background: #f5f5f5; padding: 8px 12px; text-align: left; font-weight: 600; color: #313D7F; font-size: 13px; text-transform: uppercase; }
    .upload-preview td { padding: 8px 12px; border-bottom: 1px solid #f0f0f0; font-family: "JetBrains Mono", monospace; font-size: 13px; color: #39373A; }
    .upload-preview .preview-info { font-size: 14px; color: #666; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }
    .stories-admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
    .stories-admin-table th { background: #f5f5f5; padding: 10px 12px; text-align: left; font-size: 12px; font-weight: 700; color: #313D7F; text-transform: uppercase; letter-spacing: 0.4px; border-bottom: 2px solid #e8e8e8; }
    .stories-admin-table td { padding: 10px 12px; border-bottom: 1px solid #f0f0f0; color: #39373A; vertical-align: top; }
    .stories-admin-table tr { cursor: pointer; transition: background 0.1s; }
    .stories-admin-table tr:hover { background: #fafbf5; }
    .stories-admin-table .td-name { font-weight: 600; color: #313D7F; max-width: 220px; }
    .stories-admin-table .td-title { max-width: 260px; color: #666; }
    .stories-admin-table .td-badge { display: inline-block; padding: 2px 8px; background: #eaf5d6; color: #4A7A1B; border-radius: 10px; font-size: 12px; font-weight: 600; }
    .admin-search-row { display: flex; gap: 12px; margin-bottom: 16px; align-items: center; }
    .admin-search-row input { flex: 1; padding: 10px 14px; border: 1px solid #e0e0e0; border-radius: 8px; font-family: "Rubik", sans-serif; font-size: 15px; }
    .admin-search-row .admin-count { font-size: 14px; color: #767676; }
    .story-edit-modal { position: fixed; inset: 0; background: rgba(49,61,127,0.5); backdrop-filter: blur(4px); z-index: 4000; display: none; padding: 40px 20px; overflow-y: auto; }
    .story-edit-modal.active { display: flex; align-items: flex-start; justify-content: center; }
    .story-edit-inner { background: white; border-radius: 16px; max-width: 760px; width: 100%; padding: 32px; box-shadow: 0 24px 80px rgba(0,0,0,0.3); }
    .story-edit-inner h3 { font-family: "Source Serif Pro", serif; color: #313D7F; margin-bottom: 20px; font-size: 22px; }
    .story-edit-actions { display: flex; gap: 12px; margin-top: 24px; padding-top: 20px; border-top: 1px solid #e8e8e8; justify-content: flex-end; }
    .export-card { background: white; border: 1px solid #e8e8e8; border-radius: 12px; padding: 24px; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
    .export-card .export-info h4 { font-family: "Source Serif Pro", serif; color: #313D7F; font-size: 16px; margin-bottom: 4px; }
    .export-card .export-info p { font-size: 14px; color: #666; margin: 0; }

    /* ═══ TABLES ═══ */
    .table-wrapper { background: white; border: 1px solid #e8e8e8; border-radius: 16px; overflow: auto; box-shadow: 0 2px 12px rgba(0,0,0,0.04); }
    table { width: 100%; border-collapse: collapse; font-size: 15px; }
    thead { background: #f5f5f5; }
    th { padding: 16px 20px; text-align: left; font-weight: 600; color: #313D7F; cursor: pointer; user-select: none; white-space: nowrap; font-size: 14px; text-transform: uppercase; letter-spacing: 0.5px; }
    th:hover { background: #eaeaea; }
    td { padding: 14px 20px; border-bottom: 1px solid #f0f0f0; color: #39373A; }
    tbody tr:hover { background: #fafbf5; }

    /* ═══ ANALYTICS ═══ */
    .metrics-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 20px; margin-bottom: 48px; }
    .metric-card { background: white; border: 1px solid #e8e8e8; padding: 28px; border-radius: 16px; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,0.03); }
    .metric-value { font-size: 32px; font-weight: 700; color: #313D7F; margin-bottom: 8px; font-family: "JetBrains Mono", monospace; }
    .metric-label { font-size: 13px; color: #666666; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
    .analytics-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-bottom: 48px; }
    .analytics-table { background: white; border: 1px solid #e8e8e8; border-radius: 16px; padding: 24px; box-shadow: 0 2px 8px rgba(0,0,0,0.03); }
    .analytics-table h4 { font-size: 16px; font-weight: 700; margin-bottom: 16px; font-family: "Source Serif Pro", serif; color: #313D7F; }
    .analytics-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #f0f0f0; font-size: 15px; }
    .analytics-row:last-child { border-bottom: none; }
    .analytics-row strong { color: #39373A; font-weight: 500; }
    .analytics-row span { color: #666666; font-family: "JetBrains Mono", monospace; font-size: 14px; }
    .analytics-collapse-header { cursor: pointer; user-select: none; display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid #e8e8e8; margin-bottom: 16px; }
    .analytics-collapse-header .collapse-arrow { transition: transform 0.3s; font-size: 14px; color: #767676; }
    .analytics-collapse-header.collapsed .collapse-arrow { transform: rotate(-90deg); }
    /* Collapsed-state preview so the section isn't a bare caret (shows key totals) */
    .analytics-collapse-header .collapsed-preview { display: none; font-family: 'Rubik', sans-serif; font-size: 12.5px; font-weight: 400; color: #767676; margin-left: auto; margin-right: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .analytics-collapse-header.collapsed .collapsed-preview { display: inline-block; }
    @media (max-width: 768px) { .analytics-collapse-header .collapsed-preview { font-size: 11.5px; max-width: 60%; } }
    .analytics-bar { height: 28px; border-radius: 4px; background: linear-gradient(90deg, #313D7F, #4A5BA0); margin-bottom: 4px; transition: width 0.8s; display: flex; align-items: center; padding: 0 10px; color: white; font-size: 13px; font-weight: 600; }
    .analytics-bar-container { margin-bottom: 20px; }
    .analytics-bar-label { display: flex; justify-content: space-between; font-size: 13px; color: #39373A; margin-bottom: 2px; }
    .analytics-bar-label span:last-child { font-family: "JetBrains Mono", monospace; color: #666; }
    /* Dashboard layout — FTUSA brand */
    .dashboard-metrics-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 32px; }
    .dashboard-metric-card { padding: 28px 28px 24px; border-radius: 14px; position: relative; overflow: hidden; }
    .dashboard-metric-card.navy { background: #313D7F; }
    .dashboard-metric-card.teal { background: #44AEC8; }
    .dashboard-metric-card.green { background: #6B9D2B; }
    .dashboard-metric-card::after { content: ''; position: absolute; top: -30px; right: -30px; width: 100px; height: 100px; border-radius: 50%; background: rgba(255,255,255,0.08); pointer-events: none; }
    .dashboard-metric-value { font-size: 36px; font-weight: 700; color: #fff; margin-bottom: 6px; font-family: "JetBrains Mono", monospace; }
    .dashboard-metric-label { font-size: 12px; color: rgba(255,255,255,0.8); font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; }
    /* Contrast review 2026-08-25: white text held AA only on the navy card.
       Measured on the actual backgrounds: teal 2.58:1 for the value, and the
       0.8-alpha white label read 2.17 to 3.84 on teal, green, coral and purple.
       The light and mid tiles now take solid dark text in their own hue, the
       treatment the gold card already used; hierarchy comes from size and
       weight, never from alpha, because alpha is what failed. All pairs are
       pinned in tools/a11y-check.mjs. */
    .dashboard-metric-card.coral { background: #E8743B; }
    .dashboard-metric-card.purple { background: #5A6BB5; }
    .dashboard-metric-card.gold { background: #EBC44E; }
    .dashboard-metric-card.teal .dashboard-metric-value,
    .dashboard-metric-card.teal .dashboard-metric-label { color: #0B3540; }
    .dashboard-metric-card.green .dashboard-metric-value,
    .dashboard-metric-card.green .dashboard-metric-label { color: #0F2400; }
    .dashboard-metric-card.coral .dashboard-metric-value,
    .dashboard-metric-card.coral .dashboard-metric-label { color: #3D1503; }
    .dashboard-metric-card.purple .dashboard-metric-label { color: #FFFFFF; }
    .dashboard-metric-card.gold .dashboard-metric-value { color: #313D7F; }
    .dashboard-metric-card.gold .dashboard-metric-label { color: #313D7F; }
    .dashboard-metric-card.gold::after { background: rgba(255,255,255,0.22); }
    /* Partner hero metric strip — solid FTUSA cards on a light band under the hero */
    .partner-metrics-band { background: #fff; border-bottom: 1px solid #eceef3; }
    .partner-metrics-band .inner { max-width: 1140px; margin: 0 auto; padding: 28px 28px 30px; }
    .partner-metrics-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; }
    .partner-metrics-row .dashboard-metric-value { font-size: clamp(20px, 2.4vw, 28px); margin-bottom: 6px; letter-spacing: -0.5px; line-height: 1.1; overflow-wrap: anywhere; }
    .partner-metrics-row .dashboard-metric-card { padding: 20px 20px 18px; }
    @media (max-width: 560px) { .partner-metrics-row { grid-template-columns: 1fr 1fr; } }
    .dashboard-charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 32px; }
    .dashboard-chart-card { background: white; border: 1px solid #e8e8e8; border-radius: 16px; padding: 24px 28px; box-shadow: 0 2px 8px rgba(0,0,0,0.03); }
    /* Scroll-reveal for charts — enabled only when JS adds .charts-animate, so the
       charts are never hidden if scripts fail or reduced-motion is on. */
    .charts-animate .dashboard-chart-card { opacity: 0; transform: translateY(22px); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.7,.2,1); }
    .charts-animate .dashboard-chart-card.chart-in { opacity: 1; transform: none; }
    .charts-animate .dashboard-chart-card svg { opacity: 0; transform: scale(.93); transform-origin: center; transition: opacity .85s ease .12s, transform .9s cubic-bezier(.2,.7,.2,1) .12s; }
    .charts-animate .dashboard-chart-card.chart-in svg { opacity: 1; transform: none; }
    .dashboard-chart-card h4 { font-size: 18px; font-weight: 700; color: #313D7F; font-family: 'Source Serif Pro', serif; margin: 0 0 16px 0; padding-bottom: 12px; border-bottom: 2px solid #93D73B; }
    .dashboard-table-details { margin-bottom: 16px; }
    .dashboard-table-details > summary { cursor: pointer; font-weight: 700; font-size: 15px; color: #313D7F; padding: 12px 0; font-family: "Source Serif Pro", serif; list-style: none; display: flex; align-items: center; gap: 8px; }
    .dashboard-table-details > summary::before { content: "▶"; font-size: 11px; color: #767676; transition: transform 0.3s; display: inline-block; } /* literal char — unicode escapes break in the JSON.stringify build */
    .dashboard-table-details[open] > summary::before { transform: rotate(90deg); }
    .dashboard-table-details > summary::-webkit-details-marker { display: none; }
    @media (max-width: 768px) {
      .dashboard-metrics-row { grid-template-columns: 1fr; }
      .dashboard-charts-row { grid-template-columns: 1fr; }
      /* The map-section KPI band is inline background:transparent for the desktop
         cinematic look; on mobile that let lower sections ghost through the cards.
         Give it a solid, opaque backdrop and its own stacking context so the
         cards always sit cleanly over the section. */
      .partner-metrics-band { background: #fff !important; position: relative; z-index: 2; isolation: isolate; }
      .partner-metrics-band .inner { padding: 16px 0 4px !important; }
      .partner-metrics-row { gap: 12px; }
    }
    .premium-breakdown { background: white; border: 1px solid #e8e8e8; border-radius: 16px; padding: 28px; margin-bottom: 48px; box-shadow: 0 2px 8px rgba(0,0,0,0.03); }
    .breakdown-item { display: flex; align-items: center; margin-bottom: 16px; }
    .breakdown-item:last-child { margin-bottom: 0; }
    .breakdown-bar { flex: 1; height: 28px; background: #f0f0f0; border-radius: 6px; overflow: hidden; margin: 0 16px; position: relative; }
    .breakdown-fill { height: 100%; display: flex; align-items: center; justify-content: flex-end; padding-right: 10px; color: white; font-size: 13px; font-weight: 600; border-radius: 6px; }
    .breakdown-label { font-size: 15px; font-weight: 500; color: #39373A; min-width: 160px; }
    .breakdown-value { min-width: 140px; text-align: right; font-family: "JetBrains Mono", monospace; font-size: 14px; color: #666666; }

    /* ═══ SYNERGY TILES ═══ */
    .synergy-card {
      background: #fff;
      border: 1px solid #e8e8e8;
      border-left: 3px solid #313D7F;
      border-radius: 14px;
      padding: 24px;
      min-height: 280px;
      overflow: hidden;
      cursor: pointer;
      transition: box-shadow 0.25s, transform 0.25s;
      display: flex;
      flex-direction: column;
      position: relative;
    }
    .synergy-card:hover {
      box-shadow: 0 8px 32px rgba(49,61,127,0.12);
      transform: translateY(-2px);
    }
    .synergy-card .synergy-title {
      font-family: 'Source Serif Pro', serif;
      font-size: 17px;
      font-weight: 700;
      color: #313D7F;
      margin-bottom: 10px;
      line-height: 1.35;
    }
    .synergy-card .synergy-body-preview {
      font-size: 14px;
      color: #555;
      line-height: 1.65;
      margin-bottom: 14px;
      flex: 1;
      overflow: hidden;
      display: -webkit-box;
      -webkit-line-clamp: 3;
      -webkit-box-orient: vertical;
    }
    .synergy-card .synergy-tags {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      margin-bottom: 10px;
    }
    .synergy-card .synergy-tag {
      font-size: 11px;
      font-weight: 600;
      color: #313D7F;
      background: rgba(49,61,127,0.08);
      padding: 3px 10px;
      border-radius: 20px;
    }
    .synergy-card .synergy-hint {
      font-size: 11px;
      color: #44AEC8;
      text-align: center;
      margin-top: auto;
      padding-top: 6px;
      font-weight: 600;
      letter-spacing: 0.3px;
      text-transform: uppercase;
      opacity: 0.7;
      transition: opacity 0.2s;
    }
    .synergy-card:hover .synergy-hint { opacity: 1; }
    /* Synergy overlay modal — immersive */
    .synergy-overlay {
      position: fixed; inset: 0;
      background: rgba(49,61,127,0.5);
      backdrop-filter: blur(8px);
      z-index: 2500;
      display: none;
      overflow-y: auto;
      padding: 40px 20px;
    }
    .synergy-overlay.active { display: flex; align-items: flex-start; justify-content: center; }
    .synergy-overlay-inner {
      background: white;
      border-radius: 20px;
      max-width: 860px;
      width: 100%;
      position: relative;
      box-shadow: 0 24px 80px rgba(0,0,0,0.28);
      overflow: hidden;
    }
    .synergy-overlay-close {
      position: absolute; top: 16px; right: 20px;
      background: rgba(255,255,255,0.9); border: none; font-size: 24px;
      cursor: pointer; color: #313D7F; padding: 4px 10px;
      border-radius: 50%; z-index: 10; line-height: 1;
    }
    .synergy-overlay-close:hover { background: white; }
    /* Hero banner */
    .synergy-hero {
      background: #313D7F;
      padding: 40px 44px 32px;
      position: relative;
      overflow: hidden;
    }
    /* FTUSA seal — sits top-right of the hero. Semi-transparent so it reads
       as a watermark seal on screen; the PDF export uses the same asset at
       full opacity in the header. */
    .synergy-hero .ftusa-seal {
      position: absolute; top: 24px; right: 28px;
      width: 84px; height: 84px;
      opacity: 0.9;
      filter: drop-shadow(0 2px 8px rgba(0,0,0,0.15));
      pointer-events: none;
    }
    .synergy-hero h3 {
      font-family: 'Source Serif Pro', serif;
      color: #fff; font-size: 26px;
      margin: 0 0 8px 0; padding-right: 110px;
      line-height: 1.3; letter-spacing: -0.01em;
    }
    .synergy-hero .synergy-subtitle {
      font-family: 'Source Serif Pro', serif;
      font-style: italic;
      font-size: 16px;
      color: rgba(255,255,255,0.78);
      margin: 0 0 16px 0;
      padding-right: 110px;
      line-height: 1.5;
    }
    .synergy-hero .synergy-key-insight {
      font-size: 15px; color: rgba(255,255,255,0.95);
      line-height: 1.6; margin: 0;
      padding: 12px 16px;
      background: rgba(255,255,255,0.1);
      border-left: 3px solid rgba(255,255,255,0.4);
      border-radius: 4px;
    }
    /* Article-format body: subheadings (## from Markdown), pull quotes (> ),
       and dense prose. Designed to feel like a two-page research article. */
    .synergy-overlay-body h4.body-section {
      font-family: 'Source Serif Pro', serif;
      color: #313D7F;
      font-size: 19px;
      font-weight: 700;
      margin: 28px 0 12px;
      padding-bottom: 6px;
      border-bottom: 2px solid #e8e8e8;
      letter-spacing: -0.005em;
    }
    .synergy-overlay-body h4.body-section:first-child { margin-top: 4px; }
    .synergy-overlay-body blockquote.pull-quote {
      font-family: 'Source Serif Pro', serif;
      font-style: italic;
      font-size: 20px;
      line-height: 1.45;
      color: #313D7F;
      margin: 24px 0;
      padding: 18px 28px;
      border-left: 4px solid #44AEC8;
      background: linear-gradient(180deg, #f7f9fc, #fff);
      border-radius: 0 8px 8px 0;
      position: relative;
    }
    .synergy-overlay-body blockquote.pull-quote::before {
      content: "“"; /* opening curly double quote — literal char; unicode escapes break in the JSON.stringify build */
      position: absolute; top: 4px; left: 10px;
      font-size: 40px; color: #44AEC8;
      opacity: 0.4; font-family: Georgia, serif;
      line-height: 1;
    }
    .synergy-overlay-body p { margin: 0 0 14px 0; }
    /* Content area */
    .synergy-overlay-content { padding: 32px 44px 40px; }
    /* Map section */
    .synergy-overlay-map {
      background: #f7f8fa; border-radius: 14px;
      padding: 20px; margin-bottom: 28px;
      text-align: center; border: 1px solid #e8e8e8;
    }
    .synergy-overlay-map .map-label {
      font-size: 11px; font-weight: 600; color: #313D7F;
      text-transform: uppercase; letter-spacing: 0.5px;
      margin-bottom: 12px;
    }
    .synergy-regions-list {
      display: flex; gap: 8px; flex-wrap: wrap;
      justify-content: center; margin-top: 12px;
    }
    .synergy-regions-list .region-chip {
      font-size: 12px; font-weight: 600; color: #313D7F;
      background: white; border: 1px solid #d0d4e8;
      padding: 4px 12px; border-radius: 20px;
    }
    /* Stats row */
    .synergy-stats-row {
      display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
      gap: 16px; margin-bottom: 28px;
    }
    .synergy-stat-card {
      background: #f7f8fa; border-radius: 12px; padding: 16px 20px;
      border-left: 3px solid #93D73B; text-align: left;
    }
    .synergy-stat-value {
      font-size: 20px; font-weight: 700; color: #313D7F;
      font-family: 'JetBrains Mono', monospace; margin-bottom: 2px;
    }
    .synergy-stat-label {
      font-size: 11px; color: #666; font-weight: 600;
      text-transform: uppercase; letter-spacing: 0.4px;
    }
    /* Narrative body */
    .synergy-overlay-body {
      font-size: 15px; color: #39373A;
      line-height: 1.85; margin-bottom: 28px;
    }
    .synergy-overlay-body strong { color: #313D7F; }
    /* Organizations section */
    .synergy-orgs-section {
      background: #f7f8fa; border-radius: 14px; padding: 20px 24px;
      margin-bottom: 28px; border: 1px solid #e8e8e8;
    }
    .synergy-orgs-section h4 {
      font-size: 14px; font-weight: 600; color: #313D7F;
      text-transform: uppercase; letter-spacing: 0.5px;
      margin: 0 0 12px 0;
      font-family: "Rubik", sans-serif;
    }
    .synergy-orgs-grid {
      display: flex; gap: 8px; flex-wrap: wrap;
    }
    .synergy-org-chip {
      font-size: 13px; color: #444; background: white;
      border: 1px solid #ddd; padding: 6px 14px;
      border-radius: 8px; font-weight: 600;
      font-family: "Rubik", sans-serif;
    }
    /* Tags footer */
    .synergy-overlay-tags {
      display: flex; gap: 8px; flex-wrap: wrap;
      padding-top: 20px; border-top: 1px solid #e8e8e8;
    }
    .synergy-overlay-tags .synergy-tag {
      font-size: 12px; font-weight: 600; color: #313D7F;
      background: rgba(49,61,127,0.08); padding: 5px 14px;
      border-radius: 20px;
    }

    /* ═══ SYNERGIES LIBRARY ═══ */
    .synergies-library-overlay {
      display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
      background: rgba(0,0,0,0.6); z-index: 9999; backdrop-filter: blur(4px);
    }
    .synergies-library-overlay.active { display: flex; align-items: flex-start; justify-content: center; }
    .synergies-library-inner {
      background: white; border-radius: 16px; max-width: 960px; width: 95%;
      max-height: 90vh; overflow: hidden; margin-top: 5vh;
      box-shadow: 0 20px 60px rgba(0,0,0,0.3); display: flex; flex-direction: column;
      min-height: 0; /* allow flex children to actually shrink */
    }
    /* library-list-view: make it a flex column so its scroll-area child can grow.
       Was missing height/flex setup → child's `flex:1` did nothing → couldn't scroll. */
    #library-list-view {
      display: flex; flex-direction: column;
      flex: 1 1 auto; min-height: 0;
      width: 100%;
    }
    .synergies-library-header {
      padding: 28px 32px 20px; border-bottom: 1px solid #eee;
      display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
    }
    .synergies-library-header h3 {
      font-family: 'Source Serif Pro', serif; color: #313D7F; font-size: 24px; margin: 0;
    }
    .library-scroll-area { overflow-y: auto; flex: 1; }
    .library-gen-item {
      padding: 16px 32px; border-bottom: 1px solid #f0f0f0; cursor: pointer;
      transition: background 0.15s;
    }
    .library-gen-item:hover { background: #f8f9ff; }
    .library-gen-item.expanded { background: #f5f7ff; }
    .library-gen-date { font-size: 15px; font-weight: 600; color: #313D7F; }
    .library-gen-meta { font-size: 12px; color: #767676; margin-top: 2px; }
    .library-gen-titles { font-size: 13px; color: #555; margin-top: 6px; line-height: 1.5; }
    /* Legacy classes kept for safety; new design uses .library-tile-grid below */
    .library-gen-cards { display: none; }
    .library-card-mini { display: none; }

    /* ── New tile-based library layout ── */
    .library-tile-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
      gap: 16px;
      padding: 20px 24px 28px;
    }
    .library-tile {
      background: #ffffff;
      border: 1px solid #e8e8e8;
      border-radius: 14px;
      padding: 18px 18px 16px;
      cursor: pointer;
      transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
      display: flex; flex-direction: column;
      position: relative;
      overflow: hidden;
    }
    .library-tile::before {
      content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
      background: linear-gradient(90deg, #313D7F, #44AEC8);
      opacity: 0.85;
    }
    .library-tile:hover {
      box-shadow: 0 8px 24px rgba(49,61,127,0.14);
      transform: translateY(-2px);
      border-color: rgba(49,61,127,0.25);
    }
    .library-tile-meta {
      display: flex; justify-content: space-between; align-items: center;
      font-size: 11px; color: #888;
      text-transform: uppercase; letter-spacing: 0.4px; font-weight: 600;
      margin-bottom: 10px;
    }
    .library-tile-lang {
      display: inline-flex; align-items: center; gap: 4px;
      background: #f0f4ff; color: #313D7F;
      padding: 3px 9px; border-radius: 10px;
      font-size: 10.5px; letter-spacing: 0.3px;
    }
    .library-tile h4 {
      font-family: 'Source Serif Pro', serif;
      font-size: 17px; color: #313D7F;
      margin: 0 0 8px; line-height: 1.3;
      font-weight: 700;
    }
    .library-tile .library-tile-insight {
      font-size: 13px; color: #1B7F96; font-style: italic;
      line-height: 1.5; margin: 0 0 10px;
      font-weight: 500;
    }
    .library-tile .library-tile-body {
      font-size: 13px; color: #555;
      line-height: 1.55; margin: 0 0 12px;
      display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical;
      overflow: hidden;
    }
    .library-tile-tags {
      display: flex; flex-wrap: wrap; gap: 5px;
      margin-top: auto; padding-top: 10px;
      border-top: 1px solid #f0f0f0;
    }
    .library-tile-tag {
      background: #f5f7fa; color: #555;
      padding: 3px 9px; border-radius: 10px;
      font-size: 11px; font-weight: 500;
    }
    .library-tile-tag.region { background: #eaf2ed; color: #2d6a4f; }
    .library-tile-cta {
      font-size: 11.5px; color: #313D7F; font-weight: 600;
      margin-top: 8px; display: flex; align-items: center; gap: 4px;
    }
    .library-tile.archived {
      opacity: 0.65; cursor: default;
      background: linear-gradient(180deg, #fafafa, #f5f5f5);
    }
    .library-tile.archived:hover { box-shadow: none; transform: none; border-color: #e8e8e8; }
    .library-tile.archived::before { background: linear-gradient(90deg, #bbb, #ddd); }
    .library-tile.archived h4 { color: #888; }

    /* Optional: a small section header above the grid that summarizes the result count */
    .library-summary {
      padding: 16px 28px 0; font-size: 13px; color: #888;
      display: flex; justify-content: space-between; align-items: center;
    }
    .library-lang-tab { padding: 6px 16px; border-radius: 20px; border: 1px solid #ddd; background: white; cursor: pointer; font-size: 13px; font-weight: 500; color: #555; transition: all 0.15s; }
    .library-lang-tab.active { background: #313D7F; color: white; border-color: #313D7F; }
    .library-no-cards-badge { display: inline-block; font-size: 10px; color: #767676; background: #f0f0f0; padding: 2px 8px; border-radius: 10px; margin-left: 8px; }
    /* Library card detail view (inside library overlay) */
    .library-card-detail { display: none; flex-direction: column; height: 100%; }
    .library-card-detail.active { display: flex; }
    .library-card-detail-header { padding: 16px 32px; border-bottom: 1px solid #eee; display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
    .library-back-btn { background: none; border: 1px solid #ddd; border-radius: 8px; padding: 6px 14px; font-size: 13px; cursor: pointer; color: #313D7F; font-weight: 600; display: flex; align-items: center; gap: 6px; transition: all 0.15s; }
    .library-back-btn:hover { background: #f0f4ff; border-color: #313D7F; }
    .library-card-nav { display: flex; gap: 6px; margin-left: auto; }
    .library-card-nav button { background: #f0f4ff; border: 1px solid #ddd; border-radius: 6px; width: 32px; height: 32px; cursor: pointer; font-size: 14px; color: #313D7F; transition: all 0.15s; }
    .library-card-nav button:hover { background: #313D7F; color: white; }
    .library-card-nav button:disabled { opacity: 0.3; cursor: default; background: #f0f0f0; color: #767676; }
    .library-detail-scroll { overflow-y: auto; flex: 1; padding: 32px; }
    .library-detail-title { font-family: 'Source Serif Pro', serif; font-size: 28px; color: #313D7F; margin: 0 0 8px; line-height: 1.3; }
    .library-detail-insight { font-size: 16px; color: #555; line-height: 1.5; margin-bottom: 24px; font-style: italic; }
    .library-detail-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 24px; }
    .library-detail-stat { background: #f5f7ff; border-radius: 10px; padding: 14px; text-align: center; }
    .library-detail-stat-val { font-size: 20px; font-weight: 700; color: #313D7F; }
    .library-detail-stat-lbl { font-size: 12px; color: #666; margin-top: 2px; }
    .library-detail-body { font-size: 15px; color: #39373A; line-height: 1.75; }
    .library-detail-body strong { color: #313D7F; }
    .library-detail-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
    .library-detail-tag { background: #f0f4ff; color: #313D7F; padding: 4px 12px; border-radius: 16px; font-size: 12px; font-weight: 500; }
    .library-detail-meta { font-size: 12px; color: #767676; margin-top: 20px; padding-top: 16px; border-top: 1px solid #eee; }
    @media (max-width: 768px) { .library-gen-cards { grid-template-columns: 1fr; } .synergies-library-inner { width: 98%; } .library-detail-title { font-size: 22px; } .library-detail-scroll { padding: 20px; } }

    /* ═══ STORIES ═══ */
    .stories-filters { display: flex; gap: 16px; margin-bottom: 32px; flex-wrap: wrap; align-items: center; }
    .filter-group { display: flex; gap: 8px; align-items: center; }
    .filter-label { font-size: 14px; font-weight: 600; color: #313D7F; text-transform: uppercase; letter-spacing: 0.3px; }
    .filter-select { padding: 8px 14px; border: 1px solid #e8e8e8; border-radius: 8px; font-size: 16px; font-family: "Rubik", sans-serif; background: white; color: #39373A; min-height: 44px; }
    .search-input { padding: 8px 14px; border: 1px solid #e8e8e8; border-radius: 8px; font-size: 15px; font-family: "Rubik", sans-serif; width: 240px; }
    .stories-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
    .story-card { background: white; border: 1px solid #e8e8e8; border-radius: 16px; overflow: hidden; cursor: pointer; transition: all 0.3s; box-shadow: 0 2px 8px rgba(0,0,0,0.03); }
    .story-card:hover { border-color: #93D73B; box-shadow: 0 8px 28px rgba(147, 215, 59, 0.15); transform: translateY(-3px); }
    .story-card-draft { position: relative; opacity: 0.85; border-style: dashed; }
    .story-card-draft:hover { border-color: #313D7F; box-shadow: 0 8px 28px rgba(49,61,127,0.1); }
    .story-image { width: 100%; height: 200px; background: #f5f5f5; overflow: hidden; }
    .story-image img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }
    .story-image.hidden { display: none; }
    .story-content { padding: 20px; }
    .story-header { margin-bottom: 10px; }
    .story-name { font-size: 15px; font-weight: 600; color: #39373A; margin-bottom: 2px; font-family: "Rubik", sans-serif; }
    .story-origin { font-size: 14px; color: #666666; }
    .story-title { font-size: 16px; font-weight: 700; color: #313D7F; margin-bottom: 8px; line-height: 1.4; font-family: "Source Serif Pro", serif; }
    .story-excerpt { font-size: 15px; color: #666666; margin-bottom: 14px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
    .story-meta { font-size: 14px; color: #39373A; margin-bottom: 12px; display: flex; gap: 14px; font-family: "Rubik", sans-serif; font-weight: 500; }
    .story-tags { display: flex; gap: 6px; flex-wrap: wrap; }
    .story-tag { display: inline-block; padding: 4px 10px; background: #f5f5f5; color: #666666; border-radius: 20px; font-size: 13px; font-weight: 500; }
    .story-tag.commodity { background: #eaf5d6; color: #4A7A1B; }
    .results-count { font-size: 15px; color: #666666; margin-left: auto; }

    /* ═══ MODAL ═══ */
    .modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(49,61,127,0.4); display: none; z-index: 2000; overflow-y: auto; padding: 60px 20px; backdrop-filter: blur(4px); }
    .modal-overlay.active { display: flex; align-items: flex-start; justify-content: center; }
    .modal { background: white; border-radius: 20px; max-width: 780px; width: 100%; max-height: 90vh; overflow-y: auto; padding: 48px; position: relative; }
    .modal-close { position: absolute; top: 20px; right: 24px; background: none; border: none; font-size: 28px; cursor: pointer; color: #666666; }
    .modal-close:hover { color: #313D7F; }
    .modal h2 { font-size: 28px; margin-bottom: 8px; padding-right: 40px; }
    .modal .story-meta-line { margin-bottom: 24px; font-size: 15px; color: #666666; }
    .modal-image { width: 100%; height: 340px; background: #f5f5f5; border-radius: 12px; overflow: hidden; margin-bottom: 20px; }
    .modal-image img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }
    .modal-image.hidden { display: none; }
    .modal-body { font-size: 16px; color: #39373A; line-height: 1.8; margin-bottom: 24px; }
    .modal-gallery { display: flex; gap: 10px; margin-bottom: 24px; }
    .modal-gallery img { width: 100px; height: 80px; object-fit: cover; object-position: center 20%; border-radius: 8px; cursor: pointer; border: 2px solid transparent; transition: border-color 0.2s; }
    .modal-gallery img:hover { border-color: #93D73B; }
    .modal-footer { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; border-top: 1px solid #e8e8e8; padding-top: 24px; }
    .modal-stat { text-align: center; }
    .modal-stat-value { font-size: 24px; font-weight: 700; color: #313D7F; font-family: "JetBrains Mono", monospace; margin-bottom: 4px; }
    .modal-stat-label { font-size: 13px; color: #666666; text-transform: uppercase; font-weight: 600; letter-spacing: 0.5px; }

    /* ═══ FOOTER ═══ */
    .site-footer { background: #f5f5f5; padding: 60px 40px 24px; }
    .footer-inner { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: auto 1fr 1fr auto; gap: 60px; align-items: start; padding-bottom: 40px; border-bottom: 1px solid #d8d8d8; margin-bottom: 24px; }
    .footer-logo { height: 72px; }
    .footer-links { display: flex; flex-direction: column; gap: 10px; }
    .footer-links a { font-size: 15px; color: #39373A; font-weight: 400; }
    .footer-links a:hover { color: #93D73B; }
    .footer-ctas { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
    .footer-bottom { max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: #767676; }
    .footer-bottom a { color: #39373A; font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-left: 24px; }

    /* ═══ RESPONSIVE ═══ */
    @media (max-width: 1024px) { .hero-inner { grid-template-columns: 1fr; } .analytics-grid { grid-template-columns: 1fr; } .stories-grid { grid-template-columns: repeat(2, 1fr); } .metrics-row { grid-template-columns: repeat(3, 1fr); } .footer-inner { grid-template-columns: 1fr 1fr; } .program-tables { grid-template-columns: 1fr; } #synergies-content { grid-template-columns: repeat(2, 1fr) !important; } }
    @media (max-width: 768px) {
      /* Top nav, hamburger, and FAB are hidden by the mobile-nav block above */
      .nav-links { display: none; }
      .hamburger-btn { display: none !important; }
      /* Section spacing — tighter on mobile, more breathing room between sections */
      .section { padding: 48px 18px; }
      .section h2 { font-size: 26px; line-height: 1.25; margin-bottom: 16px; }
      .section h3 { font-size: 20px; line-height: 1.3; }
      /* ════════════════════════════════════════════════════════════════
         FTUSA-BRANDED LANDING HERO (mobile)
         Navy → teal gradient background with white text — matches the
         FTUSA brand palette (#313D7F, #44AEC8, #93D73B). Glass-morphism
         KPI cards float over the gradient with backdrop-blur. Bold serif
         headline. Professional, not generic.
         ════════════════════════════════════════════════════════════════ */
      #overview {
        background: linear-gradient(155deg, #313D7F 0%, #3e4d9b 45%, #44AEC8 100%) !important;
        position: relative;
        overflow: hidden;
      }
      #overview::before {
        /* Large subtle FTUSA seal anchored to top-right of the section.
           Mostly off-canvas, low opacity — texture not focal point. */
        content: '';
        position: absolute;
        top: -80px;
        right: -120px;
        width: 320px;
        height: 320px;
        background: url('https://www.fairtradecertified.org/wp-content/uploads/2022/03/FTC-Full-Seal_RGB.svg') center/contain no-repeat;
        opacity: 0.08;
        pointer-events: none;
      }
      #overview::after {
        /* Decorative green accent stripe along the bottom edge — FTUSA's
           signature lime/green that you see across their brand site. */
        content: '';
        position: absolute;
        bottom: 0; left: 0; right: 0;
        height: 4px;
        background: linear-gradient(90deg, #93D73B 0%, #6B9D2B 100%);
        z-index: 1;
      }
      .hero {
        padding: 36px 22px 28px !important;
        background: transparent !important;
        position: relative;
        z-index: 1;
      }
      .hero::before { display: none !important; } /* kill the small earlier watermark */
      .hero-inner { position: relative; z-index: 1; }
      .hero-text { position: relative; }
      /* Brand kicker — small uppercase pill, glass-style */
      .hero-text::before {
        content: 'Fair Trade USA · Impact Intelligence'; /* literal middot — unicode escapes break in the JSON.stringify build */
        display: inline-block;
        font-family: 'Rubik', sans-serif;
        font-size: 10.5px;
        font-weight: 700;
        letter-spacing: 0.16em;
        text-transform: uppercase;
        color: rgba(255,255,255,0.95);
        background: rgba(255,255,255,0.14);
        -webkit-backdrop-filter: blur(8px);
        backdrop-filter: blur(8px);
        border: 1px solid rgba(255,255,255,0.18);
        padding: 7px 14px;
        border-radius: 18px;
        margin-bottom: 20px;
      }
      .hero-text h1 {
        font-family: 'Source Serif Pro', 'Source Serif 4', Georgia, serif !important;
        font-size: 36px !important;
        line-height: 1.08 !important;
        letter-spacing: -0.02em !important;
        margin-bottom: 0 !important;
        font-weight: 700 !important;
        color: #ffffff !important;
        text-shadow: 0 2px 12px rgba(20,28,60,0.18);
      }
      .hero-text h1::after {
        width: 56px !important;
        height: 3px !important;
        margin-top: 22px !important;
        background: #93D73B !important;   /* lime accent, the FTUSA signature */
        border-radius: 2px;
      }
      .hero-text p {
        font-family: 'Rubik', sans-serif !important;
        font-size: 15.5px !important;
        line-height: 1.6 !important;
        margin: 20px 0 26px !important;
        color: rgba(255,255,255,0.88) !important;
      }
      /* CTAs — primary lime button, secondary glass-outline */
      .hero .btn {
        width: 100%;
        padding: 18px 24px !important;
        font-size: 15px !important;
        justify-content: center;
        margin-top: 0 !important;
        font-weight: 700 !important;
        border-radius: 14px !important;
        letter-spacing: 0.05em;
        text-transform: uppercase;
        font-family: 'Rubik', sans-serif !important;
        display: flex;
        align-items: center;
        gap: 10px;
      }
      .hero-text > a.btn { margin-right: 0 !important; }
      .hero .btn-green {
        background: #93D73B !important;
        color: #1a2347 !important;
        border: none !important;
        box-shadow: 0 6px 20px rgba(147,215,59,0.35) !important;
      }
      .hero .btn-outline {
        background: rgba(255,255,255,0.10) !important;
        -webkit-backdrop-filter: blur(12px);
        backdrop-filter: blur(12px);
        color: #ffffff !important;
        border: 1.5px solid rgba(255,255,255,0.35) !important;
      }
      .hero-text > a.btn + a.btn { margin-top: 14px !important; }
      /* Hide the giant desktop seal column on mobile */
      .hero-inner > div:nth-child(2) { display: none !important; }

      /* ─── GLASS KPI CARDS ─── */
      .kpis-bar {
        padding: 4px 22px 28px !important;
        background: transparent !important;
        margin-top: 0 !important;
        position: relative;
        z-index: 1;
      }
      .kpis {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
      }
      .kpi {
        background: rgba(255,255,255,0.13) !important;
        -webkit-backdrop-filter: blur(14px) saturate(140%);
        backdrop-filter: blur(14px) saturate(140%);
        border: 1px solid rgba(255,255,255,0.25) !important;
        border-radius: 18px !important;
        padding: 16px 14px !important;
        text-align: left !important;
        box-shadow:
          0 4px 16px rgba(20,30,60,0.18),
          inset 0 1px 0 rgba(255,255,255,0.20) !important;
        position: relative;
        overflow: hidden;
      }
      .kpi::after {
        content: '';
        position: absolute;
        top: -16px; right: -16px;
        width: 52px; height: 52px;
        border-radius: 50%;
        background: radial-gradient(circle, rgba(147,215,59,0.28), rgba(147,215,59,0));
      }
      .kpi-value {
        font-family: 'Source Serif Pro', 'Source Serif 4', Georgia, serif !important;
        font-size: 28px !important;
        color: #ffffff !important;
        font-weight: 700 !important;
        line-height: 1.05 !important;
        letter-spacing: -0.015em !important;
      }
      .kpi-label {
        font-size: 10.5px !important;
        color: rgba(255,255,255,0.78) !important;
        margin-top: 6px !important;
        line-height: 1.35 !important;
        letter-spacing: 0.08em !important;
        font-weight: 600 !important;
        text-transform: uppercase;
        font-family: 'Rubik', sans-serif !important;
      }
      .kpis { grid-template-columns: repeat(2, 1fr); gap: 12px; }
      .stories-grid { grid-template-columns: 1fr; }
      .stories-filters { gap: 8px; }
      .search-input { width: 100%; }
      .modal { padding: 20px; border-radius: 12px; }
      .modal h2 { font-size: 22px; }
      .modal-image { height: 200px; }
      .modal-footer { grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
      .modal-stat-value { font-size: 18px; }
      .metrics-row { grid-template-columns: 1fr 1fr; }
      .utility-bar { display: none; }
      .program-tables { grid-template-columns: 1fr; }
      .program-table { font-size: 13px; }
      .program-table td, .program-table th { padding: 6px 8px; }
      .chat-panel { width: 100% !important; right: 0 !important; bottom: 0 !important; border-radius: 16px 16px 0 0 !important; max-height: 75vh !important; height: 75vh; }
      .chat-panel .chat-messages { min-height: 0 !important; max-height: none !important; flex: 1 1 0 !important; overflow-y: auto; }
      .chat-panel .chat-header button { min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; font-size: 22px; }
      .chat-panel .chat-input-row { padding: 10px 12px; gap: 6px; }
      .chat-panel .chat-input-row input { font-size: 16px; padding: 10px 14px; }
      .chat-panel .chat-input-row button { padding: 10px 14px; font-size: 14px; }
      .chat-panel #chat-report-btn { padding: 8px 10px; min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; }
      .chat-panel .chat-msg { font-size: 14px; padding: 10px 14px; max-width: 90%; }
      .chat-panel .chat-suggestions { gap: 6px; padding: 0 12px 8px; }
      .chat-panel .chat-suggest-btn { font-size: 12px; padding: 6px 10px; }
      .chat-bubble { right: 16px !important; bottom: 16px !important; width: 52px !important; height: 52px !important; }
      #synergies-content { grid-template-columns: 1fr !important; }
      .synergy-card { min-height: auto; padding: 20px; }
      .synergy-overlay { padding: 16px 8px; }
      .synergy-overlay-inner { border-radius: 14px; }
      .synergy-hero { padding: 24px 20px 20px; }
      .synergy-hero h3 { font-size: 20px; padding-right: 32px; }
      .synergy-hero .synergy-key-insight { font-size: 14px; }
      .synergy-overlay-content { padding: 20px 16px 24px; }
      .synergy-stats-row { grid-template-columns: 1fr; gap: 10px; }
      .synergy-stat-value { font-size: 18px; }
      .synergy-overlay-body { font-size: 14px; line-height: 1.7; }
      .synergy-overlay-close { top: 10px; right: 12px; font-size: 20px; padding: 2px 8px; }
      .footer-inner { grid-template-columns: 1fr; gap: 32px; }
      .footer-bottom { flex-direction: column; gap: 12px; text-align: center; }
      .breakdown-label { min-width: 80px; font-size: 13px; }
      .breakdown-value { min-width: 80px; font-size: 12px; }
      /* Dashboard metric cards */
      .dashboard-metrics-row { grid-template-columns: 1fr; }
      .dashboard-charts-row { grid-template-columns: 1fr; }
    }
    @media (max-width: 480px) {
      .kpis { grid-template-columns: 1fr; }
      .metrics-row { grid-template-columns: 1fr; }
      .modal-footer { grid-template-columns: 1fr; }
      .hero-text h1 { font-size: 24px; }
      .nav-right .btn { display: none; }
      .chat-panel { max-height: 80vh !important; height: 80vh; }
      .chat-panel .chat-input-row { padding: 8px 10px; gap: 5px; }
      .chat-panel .chat-input-row input { font-size: 16px; padding: 8px 12px; }
      .chat-panel .chat-suggest-btn { font-size: 11px; padding: 5px 8px; }
    }

    /* ═══ MOBILE FLOATING GLASS NAV BAR ═══
       Bottom-anchored, 4-item nav (Map / Stories / Analytics / Chat).
       Only renders on mobile via media query. Frosted glass via
       backdrop-filter + semi-transparent background. Hides on
       scroll-down, returns on scroll-up.
    */
    .mobile-nav { display: none; }
    @media (max-width: 768px) {
      .mobile-nav {
        position: fixed;
        left: 50%;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        transform: translateX(-50%);
        display: flex;
        align-items: center;
        justify-content: space-around;
        gap: 4px;
        width: calc(100% - 24px);
        max-width: 440px;
        padding: 8px 10px;
        background: rgba(255, 255, 255, 0.72);
        -webkit-backdrop-filter: blur(24px) saturate(180%);
        backdrop-filter: blur(24px) saturate(180%);
        border: 1px solid rgba(255, 255, 255, 0.6);
        border-radius: 28px;
        box-shadow: 0 10px 32px rgba(20, 30, 60, 0.18), 0 1px 2px rgba(0,0,0,0.04);
        z-index: 10000;
        transition: transform 0.32s cubic-bezier(0.2, 0.9, 0.3, 1), opacity 0.2s ease;
      }
      .mobile-nav.hidden {
        transform: translate(-50%, calc(100% + 30px));
        opacity: 0;
      }
      .mobile-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 8px 4px;
        background: transparent;
        border: none;
        color: #5a5d6b;
        font-family: 'Rubik', sans-serif;
        font-size: 11px;
        font-weight: 500;
        letter-spacing: 0.01em;
        cursor: pointer;
        border-radius: 18px;
        position: relative;
        transition: color 0.2s, background 0.2s, transform 0.15s;
        min-height: 52px;
        -webkit-tap-highlight-color: transparent;
      }
      .mobile-nav-item:active { transform: scale(0.92); }
      .mobile-nav-item .nav-icon {
        width: 24px; height: 24px;
        display: flex; align-items: center; justify-content: center;
      }
      .mobile-nav-item .nav-icon svg {
        width: 22px; height: 22px;
        stroke: currentColor; stroke-width: 1.9;
        fill: none; stroke-linecap: round; stroke-linejoin: round;
      }
      .mobile-nav-item.active {
        color: #313D7F;
        background: linear-gradient(180deg, rgba(49,61,127,0.10), rgba(68,174,200,0.08));
      }
      .mobile-nav-item.active .nav-icon svg {
        stroke-width: 2.2;
      }
      .mobile-nav-item.chat-trigger.active {
        color: #fff;
        background: linear-gradient(135deg, #313D7F, #44AEC8);
        box-shadow: 0 4px 12px rgba(49,61,127,0.3);
      }
      /* FTUSA brand mark — dead center between the labeled items, larger
         circular "home" button that pops above the bar (Instagram-style
         center action). Pushes Map/Stories to the left, Data/Chat to the
         right via flex order. */
      .mobile-nav-brand {
        flex: 0 0 auto;
        order: 3 !important;
        width: 56px; height: 56px;
        margin: -14px 6px 0;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #ffffff;
        border: 1px solid rgba(20,30,60,0.08);
        box-shadow: 0 6px 16px rgba(20,30,60,0.16), 0 1px 2px rgba(0,0,0,0.06);
        transition: transform 0.15s, box-shadow 0.2s;
        -webkit-tap-highlight-color: transparent;
        position: relative;
        z-index: 1;
      }
      .mobile-nav-brand img { width: 38px; height: 38px; display: block; }
      .mobile-nav-brand:active { transform: scale(0.92); }
      /* Reorder nav items so seal sits center: Map(1) Stories(2) Seal(3) Data(4) Chat(5) */
      .mobile-nav-item[data-target="#map"]     { order: 1 !important; }
      .mobile-nav-item[data-target="#stories"] { order: 2 !important; }
      .mobile-nav-item[data-target="#analytics"] { order: 4 !important; }
      .mobile-nav-item.chat-trigger              { order: 5 !important; }
      /* Backdrop dim for chat sheet */
      .chat-sheet-backdrop {
        position: fixed; inset: 0;
        background: rgba(20, 28, 50, 0.45);
        -webkit-backdrop-filter: blur(2px);
        backdrop-filter: blur(2px);
        z-index: 9998;
        opacity: 0; pointer-events: none;
        transition: opacity 0.28s ease;
      }
      .chat-sheet-backdrop.open { opacity: 1; pointer-events: auto; }
      /* Chat panel as bottom sheet on mobile */
      .chat-panel.mobile-sheet {
        position: fixed !important;
        left: 0 !important; right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        max-width: none !important;
        height: 82vh !important;
        max-height: 82vh !important;
        border-radius: 22px 22px 0 0 !important;
        transform: translateY(100%);
        transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1) !important;
        z-index: 9999 !important;
        display: flex !important;
        padding-bottom: env(safe-area-inset-bottom, 0px);
      }
      .chat-panel.mobile-sheet.open { transform: translateY(0); }
      /* Drag handle at top of sheet */
      .chat-sheet-handle {
        position: absolute;
        top: 8px; left: 50%;
        transform: translateX(-50%);
        width: 40px; height: 4px;
        background: rgba(0,0,0,0.18);
        border-radius: 2px;
        z-index: 1;
        pointer-events: none;
      }
      /* Ensure body has padding so floating nav doesn't cover content */
      body { padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
      /* Hide the top nav (and hamburger) — bottom nav takes over */
      .main-nav { display: none !important; }
      /* Hide the desktop chat FAB on mobile — chat lives in the bottom nav.
         ID selector + visibility + opacity belt-and-suspenders so even if
         display gets toggled by inline JS we still don't see it. */
      #chat-bubble,
      #chat-bubble.visible,
      #chat-bubble[style] {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
        position: absolute !important;
        left: -9999px !important;
      }
      /* Stories filter dropdowns — COMMODITY / COUNTRY / THEME were
         laying out inline and overlapping on narrow viewports. Force them
         to stack vertically with full-width labels and dropdowns. */
      .stories-filter-row,
      .stories-filter-row-dropdowns {
        flex-direction: column !important;
        gap: 12px !important;
        align-items: stretch !important;
      }
      .stories-filter-row .filter-group,
      .stories-filter-row-dropdowns .filter-group {
        flex: 1 1 100% !important;
        min-width: 0 !important;
        width: 100% !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 12px !important;
      }
      .stories-filter-row .filter-group > label,
      .stories-filter-row-dropdowns .filter-group > label {
        flex: 0 0 96px;
        font-size: 13px;
      }
      .stories-filter-row .filter-group > select,
      .stories-filter-row-dropdowns .filter-group > select {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        width: 100% !important;
      }
      .stories-filter-row-year { padding-bottom: 12px !important; }
      /* Tighten the synergy hero title so the FTUSA seal doesn't overlap text */
      .synergy-hero h3 { padding-right: 96px !important; font-size: 19px !important; line-height: 1.28 !important; }
      .synergy-hero .synergy-subtitle { padding-right: 96px !important; font-size: 14px !important; }
      .synergy-hero .ftusa-seal { width: 68px !important; height: 68px !important; top: 18px !important; right: 18px !important; }
      /* Map section: give it real estate on mobile */
      #map .map-container, #map iframe, #map > div[id*="map"] { min-height: 460px !important; }
      .leaflet-container { min-height: 420px !important; }
      /* Producer profile / story modal — fix mobile scroll trap.
         Reduce overlay padding so the modal title isn't pushed offscreen.
         Reduce modal max-height to leave room for the floating nav.
         Body lock prevents touch scroll from hijacking to the page
         underneath. */
      .modal-overlay { padding: 12px 12px 100px !important; }
      .modal { max-height: calc(100vh - 130px) !important; padding: 28px 20px !important; }
      .modal h2 { padding-right: 36px; }
      /* Story image height on mobile shouldn't dominate */
      .modal-image, .profile-hero-img { max-height: 200px !important; }
      /* Internal banner: hide the long description on mobile; keep title +
         Take a Tour + dismiss. Single-line, compact, doesn't eat the viewport. */
      #internal-banner {
        padding: 8px 36px 8px 14px !important;
        font-size: 12px !important;
        line-height: 1.3 !important;
        text-align: left !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
      }
      /* Hide the | separator and long description on mobile */
      #internal-banner > span:nth-child(2),
      #internal-banner > span:nth-child(3) { display: none !important; }
      #internal-banner .tour-start-btn {
        padding: 4px 10px !important;
        font-size: 11px !important;
        margin-left: auto !important;
        margin-right: 28px !important;
      }
      #internal-banner .tour-start-btn svg { width: 12px !important; height: 12px !important; }
    }

    /* ═══ CHAT BUBBLE & PANEL ═══ */
    .chat-bubble { position: fixed; bottom: 28px; right: 28px; width: 56px; height: 56px; border-radius: 50%; background: linear-gradient(135deg, #313D7F, #4a5ba0); color: white; border: none; cursor: pointer; box-shadow: 0 4px 20px rgba(49,61,127,0.35); z-index: 10010; display: none; align-items: center; justify-content: center; font-size: 24px; transition: transform 0.2s, box-shadow 0.2s; }
    .chat-bubble:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(49,61,127,0.45); }
    .chat-bubble.visible { display: flex; }
    .chat-panel { position: fixed; bottom: 96px; right: 28px; width: 480px; max-height: 740px; background: #ffffff; border-radius: 16px; box-shadow: 0 12px 48px rgba(0,0,0,0.18); z-index: 10009; display: none; flex-direction: column; overflow: hidden; border: 1px solid #e8e8e8; }
    .chat-panel.open { display: flex; }
    .chat-header { padding: 16px 20px; background: linear-gradient(135deg, #313D7F, #4a5ba0); color: white; display: flex; align-items: center; justify-content: space-between; }
    .chat-header h4 { margin: 0; font-family: "Rubik", sans-serif; font-size: 16px; font-weight: 600; color: #ffffff; }
    .chat-header button { background: none; border: none; color: rgba(255,255,255,0.8); cursor: pointer; font-size: 18px; padding: 0; line-height: 1; }
    .chat-header button:hover { color: white; }
    .chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; min-height: 380px; max-height: 580px; }
    .chat-msg { max-width: 85%; padding: 12px 16px; border-radius: 12px; font-size: 15px; line-height: 1.6; font-family: "Rubik", sans-serif; word-wrap: break-word; }
    .chat-msg.assistant { background: #f0f4ff; color: #1a2340; align-self: flex-start; border-bottom-left-radius: 4px; overflow-wrap: break-word; word-break: break-word; }
    .chat-msg.assistant p { margin: 0 0 8px; }
    .chat-msg.assistant p:last-child { margin-bottom: 0; }
    .chat-msg.assistant strong { color: #313D7F; }
    .chat-table-wrap { overflow-x: auto; margin: 8px 0; border-radius: 8px; border: 1px solid #dde3f0; }
    .chat-table { width: 100%; border-collapse: collapse; font-size: 14px; }
    .chat-table th { background: #313D7F; color: #fff; padding: 7px 10px; text-align: left; font-weight: 600; white-space: nowrap; }
    .chat-table td { padding: 6px 10px; border-bottom: 1px solid #e8ecf4; white-space: nowrap; }
    .chat-table tbody tr:last-child td { border-bottom: none; }
    .chat-table tbody tr:nth-child(even) { background: rgba(49,61,127,0.03); }
    .chat-table tbody tr:hover { background: rgba(49,61,127,0.07); }
    .chat-list { margin: 6px 0; padding-left: 18px; }
    .chat-list li { margin-bottom: 3px; font-size: 15px; }
    .chat-msg.user { background: #313D7F; color: #ffffff; align-self: flex-end; border-bottom-right-radius: 4px; }
    .chat-msg.system { background: #f5f5f5; color: #666; font-size: 14px; text-align: center; align-self: center; padding: 6px 12px; border-radius: 8px; }
    .chat-input-row { padding: 12px 16px; border-top: 1px solid #e8e8e8; display: flex; gap: 8px; background: #fafafa; }
    .chat-input-row input { flex: 1; border: 1px solid #ddd; border-radius: 20px; padding: 8px 16px; font-size: 15px; font-family: "Rubik", sans-serif; outline: none; transition: border-color 0.2s; }
    .chat-input-row input:focus { border-color: #313D7F; }
    .chat-input-row button { background: #313D7F; color: white; border: none; border-radius: 20px; padding: 8px 16px; font-size: 15px; font-weight: 600; cursor: pointer; font-family: "Rubik", sans-serif; transition: background 0.2s; }
    .chat-input-row button:hover { background: #4a5ba0; }
    .chat-input-row button:disabled { opacity: 0.5; cursor: not-allowed; }
    .chat-typing { display: flex; gap: 4px; padding: 8px 14px; align-self: flex-start; }
    .chat-typing span { width: 6px; height: 6px; border-radius: 50%; background: #313D7F; opacity: 0.4; animation: chatDot 1.2s infinite; }
    .chat-typing span:nth-child(2) { animation-delay: 0.2s; }
    .chat-typing span:nth-child(3) { animation-delay: 0.4s; }
    @keyframes chatDot { 0%,80%,100%{opacity:0.4;transform:scale(1)} 40%{opacity:1;transform:scale(1.2)} }

    /* WALKTHROUGH TOUR */
    /* Tour z-indexes bumped above cookie banner (10020) and prefs modal (10030)
       so tour visually dominates when active. Tour is an opt-in modal experience. */
    .tour-overlay { position:fixed;inset:0;background:rgba(0,0,0,0.55);z-index:10050;transition:opacity 0.3s; }
    .tour-highlight { position:absolute;z-index:10051;border-radius:12px;box-shadow:0 0 0 4000px rgba(0,0,0,0.55);pointer-events:none;transition:all 0.4s cubic-bezier(.4,0,.2,1); }
    .tour-tooltip { position:absolute;z-index:10052;background:#fff;border-radius:14px;padding:24px 28px 20px;max-width:380px;min-width:280px;box-shadow:0 12px 48px rgba(0,0,0,0.22);font-family:'Rubik',sans-serif;animation:tourFadeIn 0.35s ease; }
    .tour-tooltip::before { content:'';position:absolute;width:14px;height:14px;background:#fff;transform:rotate(45deg);z-index:-1; }
    .tour-tooltip.arrow-top::before { top:-6px;left:32px; }
    .tour-tooltip.arrow-bottom::before { bottom:-6px;left:32px; }
    .tour-tooltip.arrow-left::before { left:-6px;top:24px; }
    .tour-tooltip.arrow-right::before { right:-6px;top:24px; }
    .tour-step-counter { font-size: 13px;font-weight:700;color: #1B7F96;text-transform:uppercase;letter-spacing:0.8px;margin-bottom:8px; }
    .tour-title { font-size:16px;font-weight:700;color:#313D7F;margin-bottom:6px;font-family:'Source Serif Pro',serif; }
    .tour-desc { font-size: 15px;color:#555;line-height:1.6;margin-bottom:18px; }
    .tour-actions { display:flex;justify-content:space-between;align-items:center; }
    .tour-dots { display:flex;gap:5px; }
    .tour-dot { width:7px;height:7px;border-radius:50%;background:#ddd;transition:all 0.3s; }
    .tour-dot.active { background:#313D7F;width:18px;border-radius:4px; }
    .tour-btn { border:none;border-radius:8px;padding:8px 18px;font-size: 15px;font-weight:600;cursor:pointer;font-family:'Rubik',sans-serif;transition:all 0.2s; }
    .tour-btn-next { background:#313D7F;color:#fff; }
    .tour-btn-next:hover { background:#44AEC8; }
    .tour-btn-skip { background:transparent;color: #767676;font-weight:500; }
    .tour-btn-skip:hover { color:#666; }
    .tour-progress { position:fixed;top:0;left:0;height:3px;background:linear-gradient(90deg,#313D7F,#44AEC8);z-index:10001;transition:width 0.4s ease; }
    @keyframes tourFadeIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
    .tour-start-btn { display:inline-flex;align-items:center;gap:6px;background:rgba(255,255,255,0.18);color:#fff;border:1px solid rgba(255,255,255,0.3);border-radius:8px;padding:5px 14px;font-size: 14px;font-weight:600;cursor:pointer;font-family:'Rubik',sans-serif;transition:all 0.2s;margin-left:12px; }
    .tour-start-btn:hover { background:rgba(255,255,255,0.3); }
    .cat-dot { display:inline-block;width:8px;height:8px;border-radius:50%;margin-right:4px;vertical-align:middle;position:relative;top:-1px; }

    /* CASE / CORRECTION SYSTEM */
    .case-card { background:#fff;border:1px solid #e8e8e8;border-left:4px solid #44AEC8;border-radius:10px;padding:18px 20px; }
    .case-card.resolved { border-left-color:#93D73B;opacity:0.7; }
    .case-meta { font-size: 13px;color: #767676;margin-bottom:8px;display:flex;gap:16px;flex-wrap:wrap; }
    .case-meta strong { color:#313D7F; }
    .case-body { font-size: 15px;color:#39373A;line-height:1.6;margin-bottom:12px; }
    .case-context { font-size: 14px;color:#666;background:#f7f8fa;padding:10px 14px;border-radius:8px;margin-bottom:12px; }
    .case-actions { display:flex;gap:8px; }
    .case-badge { display:inline-block;padding:2px 10px;border-radius:10px;font-size: 12px;font-weight:600; }
    .case-badge.open { background:#FFF3E0;color:#B23E00; }
    .case-badge.resolved { background:#eaf5d6;color: #4A7A1B; }
    .case-filter-btn { border:none;background:transparent;font-size:12px;font-weight:600;color:#767676;padding:5px 12px;border-radius:6px;cursor:pointer;font-family:'Rubik',sans-serif; }
    .case-filter-btn.active { background:#fff;color:#313D7F;box-shadow:0 1px 3px rgba(0,0,0,0.1); }
    .case-notes-input { width:100%;border:1px solid #e0e0e0;border-radius:8px;padding:8px 10px;font-size:13px;font-family:'Rubik',sans-serif;resize:vertical;min-height:38px;margin-bottom:8px; }
    .chat-case-banner { background:linear-gradient(135deg,#f0f7ff,#e8f5e9);border:1px solid #44AEC8;border-radius:10px;padding:12px 16px;margin:8px 16px;font-size: 14px;color:#313D7F;line-height:1.5; }
    .chat-case-banner button { background:#313D7F;color:#fff;border:none;border-radius:6px;padding:6px 14px;font-size: 13px;font-weight:600;cursor:pointer;margin-top:8px;font-family:'Rubik',sans-serif; }
    .chat-case-banner button:hover { background:#44AEC8; }
    .chat-suggestions { display:flex;flex-wrap:wrap;gap:6px;padding:0 16px 8px; }
    .chat-suggest-btn { background:#f0f2f8;color:#313D7F;border:1px solid #e0e3ef;border-radius:12px;padding:6px 12px;font-size: 13px;font-family:'Rubik',sans-serif;cursor:pointer;text-align:left;line-height:1.4;transition:all 0.15s; }
    .chat-suggest-btn:hover { background:#313D7F;color:#fff;border-color:#313D7F; }
    .chat-followups { display:flex;flex-wrap:wrap;gap:6px;margin-top:8px; }
    .chat-followup-btn { background:#f7f8fa;color:#313D7F;border:1px solid #e0e3ef;border-radius:10px;padding:4px 10px;font-size: 12px;font-family:'Rubik',sans-serif;cursor:pointer;transition:all 0.15s; }
    .chat-followup-btn:hover { background:#313D7F;color:#fff; }

        /* ═══════════════════════════════════════════════════════════
           MOBILE READINESS FIXES (Session 2, May 2026)
           Merged output from 4 parallel agent batches.
           See MOBILE_AUDIT.md for the per-issue analysis.
           ═══════════════════════════════════════════════════════════ */

    /* === Batch A: Touch Targets === */
    /* Addresses MOBILE_AUDIT.md P1 #1 (banner close), P1 #2 (leaflet zoom), P2 #4 (global 44x44 floor). */

    /* ── Unconditional (pure improvement at every breakpoint) ─────────── */

    /* P1 #1: Banner close glyph was 9×19 with no padding — untappable. Give it real hit area at all sizes. */
    #internal-banner button[aria-label="Dismiss internal preview banner"] {
      min-width: 44px;
      min-height: 44px;
      padding: 10px;
      font-size: 20px;
      line-height: 1;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }


    /* ── Mobile floor: <768px ─────────────────────────────────────────── */
    @media (max-width: 768px) {
      /* P2 #4: Global 44×44 floor for interactive controls per WCAG 2.5.5 AAA / Apple HIG. */
      button,
      .btn,
      a.btn,
      [role="button"] {
        min-height: 44px;
        min-width: 44px;
      }

      /* P2 #4 exclusion: chat suggestion chips intentionally compact in dense chat panel (existing 768/480 rules keep them small). */
      .chat-panel .chat-suggest-btn {
        min-height: 0;
        min-width: 0;
      }

      /* P2 #4 exclusion: map-controls collapse toggle is a thin inline chevron; 44px would distort the controls strip. */
      .map-ctrl-toggle {
        min-height: 32px;
        min-width: 32px;
      }

      /* P2 #4 exclusion: tour button sits inside the slim banner — use compact 36px target rather than full 44px to avoid 3-line banner blowup (P3 #11). */
      #internal-banner .tour-start-btn {
        min-height: 36px;
        min-width: 36px;
        padding: 6px 14px;
      }

      /* P2 #4 (audit table): EN/ES language pills measured 39×24 — bump vertical only, keep pill row tidy. */
      .lang-btn {
        min-height: 44px;
        min-width: 44px;
        padding: 8px 12px !important; /* override inline style */
      }

      /* P1 #2: Leaflet zoom controls are 30×30 by default — bump to 44×44 on mobile. !important needed to beat Leaflet's own CSS. */
      .leaflet-control-zoom a {
        width: 44px !important;
        height: 44px !important;
        line-height: 44px !important;
        font-size: 22px !important;
      }
    }

    /* === Batch B: iOS Zoom Prevention === */
    /*
     * iOS Safari auto-zooms whenever a focused <input>/<textarea>/<select> has a
     * computed font-size below 16px, and it never zooms back out. The rules below
     * bump every text-entry control the user can actually type into up to 16px on
     * touch-class viewports (<= 768px). Buttons and checkboxes are unaffected and
     * intentionally left alone.
     *
     * Approach:
     *   - Inputs that already had explicit per-component sizes get matching
     *     selectors at the same specificity (or higher via inline-style overrides
     *     using attribute selectors).
     *   - Padding is preserved or slightly increased to keep touch-target height
     *     comfortable now that the glyphs are larger -- per the brief, prefer
     *     growing the input over shrinking text.
     *   - All rules are scoped to (max-width: 768px) so desktop visual density
     *     is untouched. The existing (max-width: 480px) chat-input rule in
     *     app.html still wins for the smallest phones; this file simply fills
     *     the 481--768px gap.
     */

    /* ──────────────────────────────────────────────────────────────
     *  TOUCH-CLASS VIEWPORTS (<=768px) — primary zoom-prevention layer
     * ────────────────────────────────────────────────────────────── */
    @media (max-width: 768px) {

      /* ---- P1 #3 — Admin login overlay (admin-login-user / admin-login-pass) ----
         Source: .login-box input { font-size: 15px; padding: 12px 16px; }
         iOS zooms on focus because 15px < 16px. Bumping to 16px is enough; we
         keep the 12px vertical padding which already yields ~46px tall targets. */
      .login-box input,
      #admin-login-user,
      #admin-login-pass {
        font-size: 16px;
      }

      /* ---- P2 #5 — Chat input (between 481px and 768px) ----
         Source: .chat-input-row input { font-size: 15px; padding: 8px 16px; }
         The existing fix only lives inside @media (max-width:480px). This rule
         extends the 16px size up through 768px. The bumped vertical padding
         (10px) matches the existing 481-768 rule already in app.html line 627
         so the input keeps its current visual height. */
      .chat-panel .chat-input-row input,
      .chat-input-row input,
      #chat-input {
        font-size: 16px;
        padding: 10px 14px;
      }

      /* ---- Bonus #1 — Public stories search (.search-input) ----
         Not flagged in the audit but it IS a text input users type into on
         the public-facing Stories grid. Source rule is 15px at line 545.
         Same iOS trap. */
      .search-input,
      #search-input {
        font-size: 16px;
        padding: 10px 14px; /* up from 8px to keep visual proportions */
      }

      /* ---- Bonus #2 — Admin story search row (.admin-search-row input) ----
         Used inside the Story Editor tab. 15px at line 212. */
      .admin-search-row input,
      #admin-story-search {
        font-size: 16px;
      }

      /* ---- Bonus #3 — All admin form inputs/textareas (Salesforce config,
         Excel upload metadata, story editor fields, etc.) ----
         Source: .admin-form-row input/textarea/select { font-size: 15px }.
         We deliberately include textarea because it's also a typing target.
         <select> is technically not zoom-triggering on iOS, but harmless to
         match here and keeps the form visually consistent. */
      .admin-form-row input,
      .admin-form-row textarea,
      .admin-form-row select {
        font-size: 16px;
      }

      /* ---- Bonus #4 — Anthropic API key field (inline-styled, 13px) ----
         #admin-api-key has font-size:13px set via inline style attribute.
         Inline styles beat normal selectors, so we use an attribute selector
         against the id which yields specificity (0,1,1,0) and add the
         declaration at the same cascade level. The original inline style
         also sets padding 10px 14px which already gives ~42px tall targets,
         so 16px text fits without needing extra padding. */
      input#admin-api-key[style] {
        font-size: 16px !important;
      }

      /* ---- Bonus #5 — Inline numeric inputs in the People Data admin tab ----
         The PEOPLE_DATA edit rows render <input type="number"> with no class
         and no explicit font-size, so they fall back to the UA default which
         on iOS Safari is ~13px for number inputs. Catch them via the data-
         attribute they all carry. */
      input[data-people-idx],
      input[data-people-field] {
        font-size: 16px;
        padding: 8px 10px; /* give the number spinner some breathing room */
      }

      /* ---- Catch-all safety net ----
         Anything we missed: any text-class input or textarea inside the admin
         panel or login overlay. Scoped so we don't accidentally bump unrelated
         widgets (e.g. the chat suggestion buttons, hidden file input, etc.). */
      #admin-panel input[type="text"],
      #admin-panel input[type="email"],
      #admin-panel input[type="url"],
      #admin-panel input[type="password"],
      #admin-panel input[type="search"],
      #admin-panel input[type="tel"],
      #admin-panel input[type="number"],
      #admin-panel textarea,
      #admin-login-overlay input[type="text"],
      #admin-login-overlay input[type="password"] {
        font-size: 16px;
      }
    }

    /* ──────────────────────────────────────────────────────────────
     *  PHONE VIEWPORTS (<=480px) — keep the existing 16px commitments
     * ──────────────────────────────────────────────────────────────
     *  Note: the existing app.html rule at line 662 already sets
     *  .chat-panel .chat-input-row input { font-size: 16px; padding: 8px 12px; }
     *  inside @media (max-width: 480px). The 768px block above does not
     *  override that (the 480 rule appears later in the source, so it wins
     *  on equal specificity). We don't need to duplicate it here, but we
     *  re-assert the safety net for the smallest screens to be defensive
     *  in case future edits reorder the cascade.                        */
    @media (max-width: 480px) {
      .login-box input,
      .chat-panel .chat-input-row input,
      .chat-input-row input,
      .search-input,
      .admin-form-row input,
      .admin-form-row textarea,
      .admin-search-row input,
      input[data-people-idx],
      input[data-people-field] {
        font-size: 16px;
      }
      input#admin-api-key[style] {
        font-size: 16px !important;
      }
    }

    /* === Batch C: Layout & Overflow === */
    /* Fixes for MOBILE_AUDIT.md items P2 #6, P2 #7, P2 #9.
       Append/include after the existing app.html <style> rules so these
       override the inline SVG attributes and base .dashboard-metric-value rule. */

    /* ─────────────────────────────────────────────────────────────────────
       P2 #6 — Dashboard metric card overflow (e.g. "1,223,671")
       Applies at all widths so the clamp() naturally scales; clamp upper
       bound (32px) is below the desktop default (36px) only at narrow
       viewports because 5vw at >=640px viewport === 32px max anyway.
       `overflow-wrap: anywhere` lets long unbroken numbers break inside
       the card instead of pushing its scrollWidth past clientWidth.
       ───────────────────────────────────────────────────────────────────── */
    .dashboard-metric-card {
      /* P2 #6 — defensive: prevent any child from forcing horizontal scroll */
      min-width: 0;
    }
    .dashboard-metric-card .dashboard-metric-value {
      /* P2 #6 — fluid font scales 20px (≤400px viewport) → 32px (≥640px). */
      font-size: clamp(20px, 5vw, 32px);
      /* P2 #6 — break inside long numbers like "1,223,671" on narrow screens. */
      overflow-wrap: anywhere;
      word-break: break-word; /* legacy Safari fallback */
      min-width: 0;
    }

    /* ─────────────────────────────────────────────────────────────────────
       <= 480px breakpoint — phones
       ───────────────────────────────────────────────────────────────────── */
    @media (max-width: 480px) {

      /* P2 #7 — Analytics chart SVG text legibility.
         The SVG <text> elements have font-size as an *attribute* (e.g.
         font-size="11"). CSS `font-size` on the element overrides the
         attribute by spec, but only reliably across browsers when marked
         !important and scoped tightly enough to beat any later rules.
         We target #container text descendants. Since each SVG is rendered
         with width="100%" inside a container that becomes ~320px wide,
         the original 10-13px attribute values get visually scaled down
         by the viewBox; bumping to 14-15px keeps year/country labels
         legible after the scale-down. */
      #top-countries-container svg text,
      #premium-dollars-container svg text {
        font-size: 14px !important;
      }
    }

    /* Premium spend visuals (Analytics). TOP-LEVEL so they apply at ALL widths
       — previously trapped inside @media(max-width:480px), so they only styled
       phones and rendered as default buttons on desktop. */

      /* ── Premium spend heatmap + dollar layer (Analytics, internal) ───── */
      .hm-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
      table.premium-heatmap {
        border-collapse: separate; border-spacing: 3px;
        width: 100%; min-width: 720px; table-layout: fixed;
      }
      .premium-heatmap th.hm-corner { width: 132px; }
      .premium-heatmap th.hm-col {
        font-size: 11px; font-weight: 600; color: #555;
        vertical-align: bottom; padding: 0 2px 7px; text-align: center;
        line-height: 1.2; white-space: normal;
      }
      .premium-heatmap th.hm-rowhead {
        text-align: right; padding-right: 10px; font-size: 13px;
        color: #313D7F; font-weight: 600; white-space: nowrap;
      }
      .premium-heatmap td.hm-cell {
        text-align: center; font-family: 'JetBrains Mono', monospace;
        font-size: 13px; font-weight: 600; padding: 11px 4px;
        border-radius: 5px; min-width: 44px;
      }
      .premium-heatmap .hm-pct { font-size: 9px; opacity: 0.7; margin-left: 1px; }
      .premium-heatmap tr.hm-row { cursor: pointer; outline: none; }
      .premium-heatmap tr.hm-row:hover td.hm-cell { box-shadow: inset 0 0 0 2px rgba(49,61,127,0.28); }
      .premium-heatmap tr.hm-row:focus-visible td.hm-cell { box-shadow: inset 0 0 0 2px #313D7F; }
      .hm-legend {
        display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
        font-size: 12px; color: #888; margin-top: 12px;
      }
      .hm-ramp { display: inline-block; width: 120px; height: 10px; border-radius: 5px; }
      .hm-hint { color: #aaa; }
      .hm-barlegend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 12px; font-size: 11px; color: #555; }
      .hm-leg-item { display: inline-flex; align-items: center; gap: 5px; }
      .hm-leg-sw { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
      .premium-drill { background: #f7f8fa; border-radius: 10px; padding: 14px 16px; }
      .premium-drill-head {
        display: flex; justify-content: space-between; align-items: center;
        margin-bottom: 8px; color: #313D7F;
        font-family: 'Source Serif Pro', serif; font-weight: 600;
      }
      .premium-drill-close {
        background: none; border: none; color: #999; font-size: 20px;
        line-height: 1; cursor: pointer; padding: 0 4px;
      }
      .premium-drill-close:hover { color: #313D7F; }
      .premium-dollars-total {
        font-family: 'JetBrains Mono', monospace; font-size: 13px;
        color: #313D7F; margin-top: 6px;
      }

      /* ── Premium spend donut pies (default Analytics matrix visual) ───── */
      .premium-pies { display: flex; flex-wrap: nowrap; gap: 10px; align-items: stretch; }
      .premium-pie {
        flex: 1 1 0; min-width: 0;
        background: none; border: 1px solid transparent; border-radius: 12px;
        padding: 10px 4px 12px; cursor: pointer; font: inherit;
        display: flex; flex-direction: column; align-items: center; gap: 2px;
        transition: background .15s, border-color .15s, transform .15s;
      }
      .premium-pie:hover { background: #f7f8fa; border-color: #e3e6ef; transform: translateY(-2px); }
      .premium-pie:focus-visible { outline: 2px solid #313D7F; outline-offset: 2px; }
      .premium-pie-svg { width: 100%; max-width: 150px; display: block; }
      .premium-pie-cap {
        font-family: 'Source Serif Pro', serif; font-weight: 600; color: #313D7F;
        font-size: 14px; text-align: center; margin-top: 4px; line-height: 1.2;
      }
      .premium-pie-sub { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: #888; }
      .premium-pie-legend { justify-content: center; margin-top: 16px; }
      .premium-pie-hint { font-size: 12px; color: #888; margin-top: 10px; line-height: 1.6; text-align: center; }
      .premium-notes-toggle > summary {
        cursor: pointer; font-size: 12px; font-weight: 600; color: #313D7F;
        list-style: none; display: inline-flex; align-items: center; gap: 5px;
        padding: 3px 0; user-select: none;
      }
      .premium-notes-toggle > summary::-webkit-details-marker { display: none; }
      .premium-notes-toggle > summary::before { content: '\25B8'; color: #999; font-size: 10px; }
      .premium-notes-toggle[open] > summary::before { content: '\25BE'; }
      .premium-notes-toggle > div { font-size: 12px; color: #888; line-height: 1.7; margin-top: 6px; }
      .premium-drill svg { width: 100%; max-width: 560px; display: block; }
      @media (max-width: 620px) {
        .premium-pies { flex-wrap: wrap; }
        .premium-pie { flex: 1 1 42%; }
      }
      @media (max-width: 560px) { .premium-pie { flex-basis: 42%; } }

    /* ─── resume phone-only (≤480px) rules ─── */
    @media (max-width: 480px) {

      /* P2 #9 — Synergy overlay action buttons (Copy / Save / Download PDF).
         The buttons live in an inline-style flex container near line 1061:
           <div style="display:flex;gap:10px;margin-top:24px;
                       padding-top:16px;border-top:1px solid #e8e8e8;">
         It's the LAST direct child <div> inside .synergy-overlay-content
         (followed only by the closing wrapper). Targeting
         `.synergy-overlay-content > div:last-child` is the cleanest hook
         without adding a class. We also defensively scope via the
         [style*="border-top"] attribute selector so we don't accidentally
         break a future last-child div. */
      .synergy-overlay-content > div:last-child[style*="display:flex"],
      .synergy-overlay-content > div[style*="border-top"] {
        flex-direction: column !important;   /* stack the 3 buttons */
        align-items: stretch !important;     /* full-width buttons */
      }
      /* Stretch each button to the full width of the column. The buttons
         themselves use inline display:flex (icon + label), so we keep that
         and just center the inner content. */
      .synergy-overlay-content > div:last-child[style*="display:flex"] > button,
      .synergy-overlay-content > div[style*="border-top"] > button {
        width: 100%;
        justify-content: center;
        /* Bump touch target — also helps with the global P2 #4 fix. */
        min-height: 44px;
      }
      /* The trailing feedback <span> ("Saved!" etc.) is align-self:center
         in inline style; let it sit centered on its own row when stacked. */
      .synergy-overlay-content > div:last-child[style*="display:flex"] > span,
      .synergy-overlay-content > div[style*="border-top"] > span {
        text-align: center;
        align-self: center !important;
      }
    }

    /* === Batch D: Admin Panel + Map + Polish === */
    /*
     * Targets: P2 #8 (admin panel mobile), P3 #11 (banner overflow),
     *          P3 #12 (admin form inputs), P3 #13 (modal gallery thumbs),
     *          P3 #14 (map height on mobile).
     *
     * Existing selectors confirmed in src/app.html:
     *   .admin-tabs              — line 162, horizontal flex bar (already has overflow-x:auto desktop)
     *   .admin-tab               — line 163 (NOT .admin-tab-btn; audit doc was wrong)
     *   .admin-panel-section     — line 167, 32px container padding via .admin-panel
     *   .admin-form-row / .admin-form-grid — lines 171, 176
     *   #people-edit-form        — container populated by renderPeopleEditForm()
     *   #sf-url / #sf-client-id / #sf-client-secret / #sf-username / #sf-proxy — Salesforce inputs
     *   #internal-banner > span:nth-of-type(2) — the "|" divider pipe (1st span = title, 2nd = pipe, 3rd = subtext)
     *   #map / #map-container    — line 122, fixed 680px height
     *   .modal-gallery img       — line 579, 100x80 unconditional
     *
     * Leaflet note: src/app.html does NOT call map.invalidateSize() anywhere.
     * That's fine for initial mobile load — Leaflet reads container size on init.
     * If the user rotates device or resizes, tiles may not reflow until pan/zoom.
     * Out of scope for this CSS-only batch.
     */

    /* ---------------------------------------------------------------- */
    /* <768px — phones & small tablets                                  */
    /* ---------------------------------------------------------------- */
    @media (max-width: 768px) {

      /* P2 #8 — Admin tabs: horizontal scroll bar instead of cramming 9 tabs */
      /* .admin-tabs already has overflow-x:auto, but padding & gap need mobile tuning */
      .admin-tabs {
        padding: 0 12px;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
      }
      .admin-tab {
        padding: 12px 14px;
        font-size: 14px;
        flex-shrink: 0;
        white-space: nowrap;
      }

      /* P2 #8 — Reduce admin panel section padding (parent .admin-panel uses 32px) */
      .admin-panel-section {
        padding: 0 16px 16px;
      }
      .admin-panel { border-radius: 12px; }
      .admin-panel-section h3 { font-size: 18px; }
      .admin-panel-section .admin-section-desc { font-size: 14px; margin-bottom: 16px; }

      /* P2 #8 — Admin form grid collapses to one column on mobile */
      .admin-form-grid {
        grid-template-columns: 1fr;
        gap: 12px;
      }

      /* P3 #12 — Admin form inputs go full-width (covers Salesforce + general admin forms) */
      .admin-form-row input,
      .admin-form-row textarea,
      .admin-form-row select {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
      }

      /* P3 #12 — Salesforce config inputs explicit fallback (they live inside .admin-form-row but lock-in for safety) */
      #sf-url,
      #sf-client-id,
      #sf-client-secret,
      #sf-username,
      #sf-proxy {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
      }

      /* P3 #12 — People Data form: renderPeopleEditForm() generates inline-style grid rows.
         Override the inline grid-template-columns (140px 1fr 1fr 1fr) on small screens. */
      #people-edit-form > div {
        grid-template-columns: 1fr !important;
        gap: 6px !important;
      }
      #people-edit-form input {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        font-size: 16px; /* prevent iOS focus zoom */
      }

      /* P3 #14 — Map height capped on mobile (was 680px on #map-container, ~600px Leaflet computed).
         Cap ONLY the map container / leaflet canvas — never the #map SECTION: a fixed
         height on the section makes it shorter than its content (heading + KPI band +
         map), so the next section renders over the band/map (mobile overlap bug). */
      #map-container { height: 380px !important; }
      .leaflet-container { height: 380px !important; }
    }

    /* ---------------------------------------------------------------- */
    /* <480px — narrow phones                                           */
    /* ---------------------------------------------------------------- */
    @media (max-width: 480px) {

      /* P3 #11 — Banner: hide pipe divider + shrink font so subtext doesn't wrap 3 lines */
      #internal-banner {
        font-size: 11px;
        padding: 6px 40px 6px 12px;
        letter-spacing: 0.2px;
      }
      /* The pipe "|" is the 2nd <span> inside #internal-banner */
      #internal-banner > span:nth-of-type(2) {
        display: none;
      }
      /* Tighten the subtext span margin since the pipe is gone */
      #internal-banner > span:nth-of-type(3) {
        margin-left: 0 !important;
        display: block;
        margin-top: 2px;
      }

      /* P3 #13 — Modal gallery thumbnails: 100x80 -> 60x48 so 3 fit on a 320px screen with gaps */
      .modal-gallery { gap: 6px; }
      .modal-gallery img {
        width: 60px;
        height: 48px;
      }

      /* P3 #14 — Even shorter map on very narrow viewports (container only, NOT the section) */
      #map-container,
      .leaflet-container { height: 340px !important; }
    }


        /* ═══════════════════════════════════════════════════════════
           MOBILE READINESS FIXES v2.1 (Session 2, May 2026, second pass)
           3 parallel agent batches addressing what verification surfaced.
           ═══════════════════════════════════════════════════════════ */

    /* === Batch E: Footer + Map Legend Targets === */
    /*
     * Follow-up to Batches A–D (see MOBILE_FIXES_MERGED.css).
     * Verification after round 1 found 16 interactive elements still below
     * the 32×32 floor on mobile. Almost all of them are text links in the
     * footer and the map-legend collapse summary — wide enough horizontally
     * (the footer column stretches them to ~820px) but only 19–26 px tall.
     *
     * Source structure confirmed in src/app.html:
     *   - Two <div class="footer-links"> columns at lines 1867 & 1874
     *     (7 anchors total: Why Fair Trade, Who We Are, FAQ, Careers,
     *      Contact Us, Donate, Report An Issue).
     *   - .footer-ctas (line 1878) holds two .btn anchors — already
     *     covered by Batch A's global `a.btn { min-height: 44px }`.
     *   - .footer-bottom (line 1883) holds three trailing anchors
     *     (Privacy Policy, Terms of Use, Admin) inside a nested <div>.
     *   - .map-legend-title (line 1317) is a <div> with inline
     *     onclick + cursor:pointer toggling .map-legend.collapsed,
     *     containing the "Legend" label and a chevron span.
     *
     * Strategy: pad-vertical only at <768. Each link already stretches
     * the full width of its flex column, so width:100% + block display
     * make the entire stretched row the hit area (not just the glyphs).
     * Keyboard users get a visible :focus-visible outline.
     *
     * Vertical-space impact (narrowest widths, single-column footer):
     *   Column 1: 5 links × +18px each   ≈ +90px
     *   Column 2: 2 links × +18px each   ≈ +36px
     *   Footer-bottom: 3 links × +20px   ≈ +60px (was inline, now stacked)
     *   Map legend title: +20px (collapsed) one-time
     *   Total worst-case: ~+186px added to the footer scroll length.
     *   This is acceptable for a section that's already below the fold
     *   and stacked single-column on phones.
     */

    @media (max-width: 768px) {

      /* ── Footer column links (.footer-links a) ─────────────────────────
         Source rule:  .footer-links a { font-size: 15px; color: #39373A; }
         Measured at 819×26 on mobile (wide because parent is column-stretch,
         short because there's no padding). Add 9px vertical padding to land
         at 44px tall (26 + 18 = 44). display:block + width:100% make the
         full row clickable so users can tap anywhere in the gap. */
      .footer-links a {
        display: block;
        width: 100%;
        padding: 9px 0;
        min-height: 44px;
        box-sizing: border-box;
        /* Override parent gap so visual spacing stays roughly the same:
           parent has gap:10px; padding now gives 18px so we trim the gap. */
      }
      .footer-links {
        gap: 2px; /* was 10px; padding above now supplies the spacing */
      }

      /* ── Footer bottom links (Privacy / Terms / Admin) ──────────────────
         Source rule:  .footer-bottom a { font-size: 14px; margin-left: 24px; }
         At <768 the parent flips to flex-direction:column (line 647), so the
         three links inside the inner <div> still render inline with
         margin-left spacing — measured at 108×19 ("Impact Stories" referenced
         in the audit was actually this row). Stack them and pad each. */
      .footer-bottom > div {
        display: flex;
        flex-direction: column;
        gap: 2px;
        width: 100%;
      }
      .footer-bottom a {
        display: block;
        width: 100%;
        padding: 11px 0;        /* 19 + 22 ≈ 44 */
        min-height: 44px;
        margin-left: 0 !important;  /* kill the 24px inline-row margin */
        box-sizing: border-box;
        text-align: center;     /* parent already center-aligns at <768 */
      }

      /* ── Map legend collapse summary (.map-legend-title) ────────────────
         Source rule (line 126):
           .map-legend-title { font-weight:600; margin-bottom:6px; font-size:13px; }
         It's a <div> with inline onclick + cursor:pointer that toggles the
         legend's collapsed state — effectively a button. Measured 485×22.
         Bump to ≥44 tall with vertical padding; display:block keeps the
         chevron's float:right alignment intact. The 6px margin-bottom is
         replaced by the new padding so the visual rhythm holds. */
      .map-legend-title {
        display: block;
        min-height: 44px;
        padding: 11px 4px;
        margin-bottom: 0;
        cursor: pointer;        /* defensive — inline style already sets it */
        box-sizing: border-box;
      }
      /* The chevron sits at the right edge — give the touch row some room
         so the title text doesn't crowd it after padding bump. */
      .map-legend-title .legend-arrow {
        line-height: 22px;
      }

      /* ── Keyboard focus rings (all four selectors above) ────────────────
         Padding alone removes the visual indication of focus on link text
         in some browsers (because the underline shifts). Provide an
         explicit :focus-visible outline so keyboard/switch users still see
         where focus is. Uses the brand navy from the existing palette. */
      .footer-links a:focus-visible,
      .footer-bottom a:focus-visible,
      .map-legend-title:focus-visible {
        outline: 2px solid #313D7F;
        outline-offset: 2px;
        border-radius: 4px;
      }
    }

    /* === Batch F: Checkbox / Radio Hit Areas === */
    /*
     * Native <input type="checkbox"> renders ~13×13 px and can't be reliably
     * resized for hit-area purposes without breaking visuals across browsers.
     * The accepted pattern is to make the wrapping <label> the tap target,
     * which (because the input is a descendant of the label) toggles the
     * checkbox when any part of the label is tapped. This file enlarges
     * every wrapping <label> to ≥44×44 on mobile and bumps the visible
     * checkbox glyph for clarity.
     *
     * Checkboxes found in src/app.html (no <input type="radio"> exist):
     *   1. #year-2023 / #year-2024 / #year-2025   (lines 1561, 1564, 1567)
     *        Public stories filter pills. Each is wrapped in a <label> with
     *        inline style "display:flex;align-items:center;gap:4px;font-size:13px;
     *        color:#39373A;cursor:pointer;". The labels sit in a flex row
     *        inside the first .filter-group of .stories-filters.
     *   2. #flag-synergies / #flag-chat            (lines 1756, 1766)
     *        Admin feature-flag toggles. Each is wrapped in a <label> with
     *        inline style "display:flex;align-items:center;gap:8px;cursor:pointer;"
     *        inside an .export-card on the admin Feature Flags panel.
     *
     * Because the wrapping labels use INLINE styles (display:flex etc.) we
     * need !important on the layout properties below to win the cascade.
     * Specificity-wise inline styles otherwise beat any external selector.
     */

    /* ────────────────────────────────────────────────────────────────
     *  MOBILE: <=768px — enforce 44×44 minimum tap target on labels.
     * ──────────────────────────────────────────────────────────────── */
    @media (max-width: 768px) {

      /* ── Year filter checkboxes (Stories section) ──────────────────
         Target the wrapping label by id of the checkbox descendant.
         The :has() selector lets us reach the parent <label> without a
         class on it. Supported in Safari 15.4+, Chrome 105+, Firefox
         121+ — covers ≥98% of mobile traffic in 2026. */
      .stories-filters label:has(> #year-2023),
      .stories-filters label:has(> #year-2024),
      .stories-filters label:has(> #year-2025) {
        /* 44×44 floor per WCAG 2.5.5 AAA / Apple HIG */
        min-height: 44px;
        min-width: 44px;
        /* Layout: keep checkbox + text on one row, vertically centered */
        display: inline-flex !important;     /* beat inline style */
        align-items: center !important;
        gap: 8px !important;                 /* up from inline 4px for clarity */
        /* Comfortable padding makes the actual hit area noticeably >44×44 */
        padding: 8px 12px;
        /* Tap-affordance: pointer cursor + remove iOS tap highlight flash */
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        /* Slightly larger touch-friendly type for the year label */
        font-size: 14px !important;          /* up from inline 13px */
        /* Prevent the labels from squishing inside the flex row */
        flex: 0 0 auto;
      }

      /* ── Bump the visible checkbox glyph itself.
         Pure visual improvement; form behavior is unaffected.
         transform:scale() avoids reflowing the row layout. */
      #year-2023,
      #year-2024,
      #year-2025 {
        width: 18px;
        height: 18px;
        transform: scale(1.15);
        transform-origin: center;
        cursor: pointer;
        /* Margin breathes the larger checkbox away from the text label */
        margin: 2px;
      }

      /* ── Parent row gap: original inline style sets gap:6px between the
         3 year labels. Bump on mobile so the now-larger tap targets don't
         touch each other (adjacent 44px boxes need separation). */
      .stories-filters .filter-group > div[style*="display:flex"] {
        gap: 4px !important;                 /* tighter base */
        flex-wrap: wrap;                     /* allow wrap if needed */
      }

      /* ── Admin feature-flag toggles (Synergies, Chat) ──────────────
         These wrapping labels also have inline display:flex. Same treatment. */
      .export-card label:has(> #flag-synergies),
      .export-card label:has(> #flag-chat) {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex !important;
        align-items: center !important;
        gap: 10px !important;
        padding: 8px 12px;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
      }

      /* The admin flag checkboxes already have inline width:18px;height:18px,
         so they're visually fine. Just ensure cursor + margin for spacing. */
      #flag-synergies,
      #flag-chat {
        cursor: pointer;
        margin: 2px;
      }
    }

    /* ────────────────────────────────────────────────────────────────
     *  PHONE: <=480px — keep year-filter labels from wrapping awkwardly.
     *  Original .stories-filters gets gap:8px on small screens (line 611);
     *  with three 44px-tall pills the row may still wrap — that's fine.
     * ──────────────────────────────────────────────────────────────── */
    @media (max-width: 480px) {
      /* Allow the year row to wrap to a 2nd line gracefully if needed */
      .stories-filters .filter-group > div[style*="display:flex"] {
        flex-wrap: wrap;
        row-gap: 6px;
      }
    }

    /* ────────────────────────────────────────────────────────────────
     *  FALLBACK for browsers without :has() support (legacy iOS <15.4).
     *  Apply min-height to ALL labels inside .stories-filters / inside
     *  .export-card that contain a direct-child checkbox. Slightly broader
     *  blast radius but safe — these contexts only ever hold checkbox labels.
     * ──────────────────────────────────────────────────────────────── */
    @media (max-width: 768px) {
      .stories-filters label,
      .export-card label {
        min-height: 44px;
        cursor: pointer;
      }
    }

    /* ═══════════════════════════════════════════════════════════
       Batch G: Overlay / Modal interaction fixes (mobile)
       Verified in forced-mobile (390px) test of impact-intelligence.org
       on worker version 6a42a61a. Issues found via live click-through.
       ═══════════════════════════════════════════════════════════ */

    /* ───────────────────────────────────────────────────────────
       Issue G1 — Chat FAB (#chat-bubble) stays visible above the
       open chat panel and overlaps the chat input's Send button.

       Repro: open chat on a phone-width viewport. #chat-bubble has
       class "chat-bubble visible" with position:fixed; right:16px;
       bottom:16px; z-index:10010 — one higher than .chat-panel.open
       (z-index 10009). The 52px bubble lands directly on top of the
       chat-input-row's Send button, blocking taps and visually
       doubling the chat-icon glyph in the lower-right corner.

       Same FAB also overlaps every other full-screen overlay on
       mobile (story modal, synergy detail, synergies library,
       admin login overlay) — observed in test screenshots:
         - story modal: bubble obscures bottom-right of content
         - synergy detail: bubble overlaps "Download PDF" CTA
         - admin login: bubble visible on top of the login card

       Fix: hide the FAB whenever ANY of those overlays is open.
       We can't rely on a single body class, so we use sibling
       selectors against the known overlay ids/classes that toggle
       to .active/.open.
       ─────────────────────────────────────────────────────────── */
    @media (max-width: 768px) {
      /* When chat panel is open, suppress the FAB entirely. */
      .chat-panel.open ~ #chat-bubble,
      .chat-panel.open ~ .chat-bubble {
        display: none !important;
      }

      /* When any other top-level overlay is active, hide the FAB so
         it doesn't sit on top of overlay content / CTAs.
         These selectors match the ids/classes seen in app.html:
           #modal-overlay.active           — story detail modal
           #synergy-overlay.active         — single synergy detail
           #synergies-library-overlay.active — synergies library list
           #admin-login-overlay (when shown, .login-overlay is visible) */
      body:has(#modal-overlay.active) #chat-bubble,
      body:has(#synergy-overlay.active) #chat-bubble,
      body:has(#synergies-library-overlay.active) #chat-bubble,
      body:has(#admin-login-overlay.login-overlay:not([style*="display: none"])) #chat-bubble,
      body:has(#admin-login-overlay.active) #chat-bubble {
        display: none !important;
      }

      /* When any of these overlays are active, lock body scroll so touch
         scrolling stays inside the overlay (was leaking through, leaving
         the modal stuck mid-content with no way to scroll up). */
      body:has(#modal-overlay.active),
      body:has(#synergy-overlay.active),
      body:has(#synergies-library-overlay.active) {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
        height: 100% !important;
      }
    }

    /* ───────────────────────────────────────────────────────────
       Issue G2 — Chat panel input row safe area on the right.

       Even with G1 hiding the FAB while the panel is open, the
       send button + 12px right padding feels cramped on a 390px
       viewport (input ~310px, Send ~64px). Add a small right pad
       to .chat-input-row so the Send button sits cleanly inside
       the rounded panel edge.
       ─────────────────────────────────────────────────────────── */
    @media (max-width: 480px) {
      .chat-panel .chat-input-row {
        padding-right: 12px;
        padding-left: 12px;
        gap: 8px;
      }
    }

    /* ───────────────────────────────────────────────────────────
       Issue G3 — Admin login overlay logo image (alt fallback)

       In testing the Fair Trade USA logo on the admin-login card
       rendered as a broken-image placeholder ("⊠ Fair Trade USA"
       alt text). Likely a transient asset 404 in the worker, but
       the broken image icon at desktop-size (height ~72px) leaves
       an awkward visual hole on the otherwise clean login card.

       CSS-only mitigation: clip the broken-image chrome and let
       the alt text stand alone in the same typographic style as
       the card header. This is defensive — once the asset URL is
       restored the rule is a no-op because the rendered image
       provides its own intrinsic box.
       ─────────────────────────────────────────────────────────── */
    @media (max-width: 768px) {
      #admin-login-overlay .login-box img[alt*="Fair Trade"] {
        max-height: 48px;
        object-fit: contain;
        /* if the image actually loads, these have no visible effect.
           If it 404s, the alt text reads cleanly without the broken
           icon glyph stretching the card. */
      }
    }

    /* ───────────────────────────────────────────────────────────
       All other flows verified working at 390px:
         - story modal: stats stack (modal-footer is single-col
           grid 1fr at <=480), image scales, close reachable
         - synergy detail: Copy/Save/Download PDF stack vertically
           (already handled by Batch C P2 #9)
         - synergies library: filter chips + list items lay out
           cleanly, close reachable
         - hamburger menu: expands inline, nav items full-width
       ─────────────────────────────────────────────────────────── */

    /* ═════════════════════════════════════════════════════════════════
       HOTFIX-1 (May 25, 2026) — bugs caught by real iPhone device test
       ═════════════════════════════════════════════════════════════════ */

    /* ── HOTFIX-1A: Map controls eating the viewport on mobile ──────────
       .map-controls and .map-legend are `position:absolute` with
       max-width up to 780px — on a 390px screen they cover the map.
       At <768 break out and stack below the map for usability.
    */
    @media (max-width: 768px) {
      /* #map-container becomes a flex column so filters can sit ABOVE the
         map and legend BELOW it (CSS-order driven, no DOM surgery). */
      #map-container {
        position: relative;
        padding-bottom: 0;
        overflow: visible;
        display: flex !important;
        flex-direction: column;
      }
      #map-container #world-map {
        order: 2;
        /* CRITICAL: flex-column parents don't pass a height down via 100%.
           Explicit height needed or the map collapses to 0 and the filter
           card visually overlaps the legend card. */
        height: 360px !important;
        min-height: 360px !important;
        width: 100% !important;
        border-radius: 14px;
        overflow: hidden;
      }
      #map-container #map-ctrl   { order: 1; margin-bottom: 12px !important; }
      #map-container #map-legend { order: 3; }
      /* Fullscreen button positioning needs to overlay the map (order 2)
         so set it absolute relative to the container. */
      #map-container #map-expand-btn,
      #map-container #map-close-btn { order: 0; position: absolute !important; }

      .map-controls,
      .map-legend {
        position: static !important;
        top: auto !important;
        bottom: auto !important;
        left: auto !important;
        right: auto !important;
        max-width: 100% !important;
        width: 100%;
        margin: 0;
        background: white;
        box-shadow: 0 1px 6px rgba(0,0,0,0.06);
        border-radius: 12px;
        backdrop-filter: none; /* unneeded once not over the map */
      }
      /* Filters: COMPACT card. Tight rows, slim labels, smaller pills.
         Each row label is fixed at 60px so all pills align on the same
         x-axis. No row separators — keep it visually quiet. */
      .map-controls {
        padding: 10px 12px !important;
        margin-bottom: 12px !important;
        border-radius: 16px !important;
        border: 1px solid #e5e8ef !important;
        box-shadow: 0 1px 4px rgba(20,30,60,0.04) !important;
        gap: 2px !important;
      }
      .map-controls .map-control-row {
        gap: 8px !important;
        align-items: center !important;
        padding: 4px 0 !important;
      }
      .map-controls .map-control-row + .map-control-row { border-top: none; padding-top: 4px; margin-top: 0; }
      .map-controls .map-control-label {
        font-size: 9.5px !important;
        font-weight: 700 !important;
        letter-spacing: 0.1em !important;
        color: #767987 !important;
        text-transform: uppercase !important;
        flex: 0 0 60px !important;
        padding-top: 0 !important;
      }
      .map-controls .map-control-group {
        flex: 1 1 auto !important;
        gap: 5px !important;
        align-items: center !important;
      }
      .map-controls .pill {
        font-size: 11.5px !important;
        padding: 5px 11px !important;
        line-height: 1.3 !important;
        border-radius: 999px !important;
      }
      .map-controls .pill.active { font-weight: 600 !important; }
      /* Default-collapsed state: both filter card and legend card start
         closed on mobile. User taps to expand. Eliminates all overlap
         concerns because the cards are small headers when collapsed. */
      .map-controls.collapsed {
        max-width: none !important;
        width: 100% !important;
        max-height: none !important;
        padding: 14px 16px !important;
        cursor: pointer !important;
        overflow: hidden !important;
        position: relative !important;
        display: block !important;
      }
      .map-controls.collapsed::before {
        content: 'Filters' !important;
        font-family: 'Rubik', sans-serif;
        font-size: 13px;
        font-weight: 600;
        color: #313D7F;
        letter-spacing: 0.02em;
        display: inline-block;
      }
      .map-controls.collapsed::after {
        content: '+';
        position: absolute;
        right: 16px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 22px;
        color: #313D7F;
        font-weight: 400;
        line-height: 1;
      }
      .map-controls.collapsed .map-control-row { display: none !important; }
      /* When expanded, change the + to a − on the header pseudo-element */
      .map-controls:not(.collapsed) {
        cursor: default !important;
        padding: 14px 16px 14px 16px !important;
        position: relative !important;
      }
      .map-controls:not(.collapsed)::before {
        content: 'Filters';
        font-family: 'Rubik', sans-serif;
        font-size: 13px;
        font-weight: 600;
        color: #313D7F;
        letter-spacing: 0.02em;
        display: block;
        margin-bottom: 10px;
        padding-right: 30px;
      }
      .map-controls:not(.collapsed)::after {
        content: '−';
        position: absolute;
        right: 16px;
        top: 12px;
        font-size: 22px;
        color: #313D7F;
        font-weight: 400;
        line-height: 1;
        cursor: pointer;
        width: 28px;
        height: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
      }
      /* Fullscreen button is moved INTO #world-map via JS on mobile init.
         When inside #world-map (position:relative), bottom:12px anchors to
         the map's bottom-right correctly. */
      #world-map { position: relative; }
      #world-map #map-expand-btn {
        position: absolute !important;
        bottom: 12px !important;
        right: 12px !important;
        top: auto !important;
        left: auto !important;
        z-index: 600 !important;
        font-size: 12px !important;
        padding: 8px 14px !important;
        border-radius: 999px !important;
        box-shadow: 0 4px 12px rgba(20,30,60,0.18) !important;
      }
      /* Hide the button when it's still in the wrong place (pre-JS) */
      #map-container > #map-expand-btn { visibility: hidden; }
      /* Legend: same card aesthetic; aggressive bottom margin + section
         padding so downstream content (donut chart, KPIs) sits in its own
         clear band — no visual collision with the legend card. */
      .map-legend {
        padding: 12px 14px !important;
        margin-top: 14px !important;
        margin-bottom: 0 !important;
        border-radius: 16px !important;
        border: 1px solid #e5e8ef !important;
        box-shadow: 0 1px 4px rgba(20,30,60,0.04) !important;
      }
      .map-legend .map-legend-title {
        font-family: 'Rubik', sans-serif !important;
        font-size: 13px !important;
        font-weight: 600 !important;
        letter-spacing: 0.02em !important;
        color: #313D7F !important;
        text-transform: none !important;
      }
      .map-legend .legend-section { font-size: 11px !important; margin-top: 8px !important; }
      .map-legend .legend-item { font-size: 12px !important; gap: 6px !important; padding: 2px 0 !important; }
      .map-legend .legend-row { gap: 6px 14px !important; flex-wrap: wrap; }
      /* Default-collapsed legend: tap to expand */
      .map-legend.collapsed {
        padding: 14px 16px !important;
        cursor: pointer !important;
        position: relative !important;
      }
      .map-legend.collapsed .legend-body {
        max-height: 0 !important;
        overflow: hidden !important;
        padding: 0 !important;
        margin: 0 !important;
      }
      .map-legend.collapsed .map-legend-title { margin: 0 !important; }
      /* Replace the legend's hard-coded ▲ arrow span with our own +/− glyph.
         Setting font-size:0 hides the original character; the ::before puts
         our icon back at proper size. */
      .map-legend .legend-arrow {
        position: absolute !important;
        right: 16px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        font-size: 0 !important;
        color: #313D7F !important;
        line-height: 1 !important;
      }
      .map-legend.collapsed .legend-arrow::before {
        content: '+';
        font-size: 22px !important;
        font-weight: 400;
      }
      .map-legend:not(.collapsed) .legend-arrow::before {
        content: '−';
        font-size: 22px !important;
        font-weight: 400;
      }
      /* Strong vertical separation between the map section and whatever
         follows. Inserts a real divider band so any downstream content
         with negative margins or overflow can't visually crash into the
         legend card. */
      #map.section { padding-bottom: 48px !important; }
      #map.section::after {
        content: '';
        display: block;
        height: 1px;
        background: #e5e8ef;
        margin: 32px -18px 0;
      }
      #map + section,
      #map + .section,
      #analytics.section {
        padding-top: 40px !important;
        margin-top: 0 !important;
      }
      /* Defensively clear any negative top margin on the first child of
         the analytics section (e.g. heading offset) on mobile. */
      #analytics > *:first-child,
      #analytics .section-heading { margin-top: 0 !important; }
      #analytics .dashboard-metrics-row,
      #analytics .dashboard-section { margin-top: 16px !important; }

      /* Wrap the filter pills so they don't overflow */
      .map-control-group {
        flex-wrap: wrap !important;
        gap: 6px;
      }

      /* When the existing collapse toggle is used, it just hides .map-control-group;
         keep that behavior but ensure the collapsed state is also full-width. */
      .map-controls.collapsed {
        max-width: 100% !important;
        width: auto;
      }
    }

    /* ── HOTFIX-1B: program-table cut off horizontally on mobile ────────
       "By Category (2025)" has 4 columns (Account, Orgs, Premium Participants,
       Direct Beneficiaries). On <400px screens that's ~1000px of content in
       a 390px viewport. Wrap parent in a horizontal scroll container.
    */
    @media (max-width: 768px) {
      /* :has() targets the .dashboard-chart-card that contains the table */
      .dashboard-chart-card:has(.program-table) {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        /* Visual cue that there's more to the right */
        background:
          linear-gradient(to right, white 30%, rgba(255,255,255,0)),
          linear-gradient(to right, rgba(0,0,0,0), rgba(0,0,0,0.06) 70%) right,
          white;
        background-repeat: no-repeat;
        background-size: 30px 100%, 30px 100%, auto;
        background-attachment: local, scroll, local;
      }
      /* Force horizontal scroll by giving the table a min-width */
      .program-table { min-width: 600px; }
      /* Tighter cell padding on mobile so more fits before scroll */
      .program-table td, .program-table th { padding: 8px 10px !important; }
    }

    /* ── HOTFIX-1C: Chat bubble incorrectly hidden when no overlay open ──
       Agent G's earlier rule was:
         body:has(#admin-login-overlay.login-overlay:not([style*="display: none"])) #chat-bubble
       The inline HTML uses `style="display:none;"` (NO space after colon),
       but the selector matches `display: none` (WITH space) — so :not() was
       ALWAYS true and the chat bubble was always hidden.

       Strategy: re-show the chat bubble when admin overlay is in its hidden
       state (style contains `display:none` no-space). Then re-hide it when
       admin overlay is actually visible (style contains `display: flex` or
       `display:flex`).
    */
    body:has(#admin-login-overlay[style*="display:none"]) #chat-bubble {
      display: flex !important;
      visibility: visible !important;
    }
    body:has(#admin-login-overlay[style*="display: flex"]) #chat-bubble,
    body:has(#admin-login-overlay[style*="display:flex"])  #chat-bubble {
      display: none !important;
    }

    /* ═════════════════════════════════════════════════════════════════
       HOTFIX-2 (May 25, 2026) — round 2 from real-device feedback
       ═════════════════════════════════════════════════════════════════ */

    /* ── HOTFIX-2A: Chat bubble specificity vs Agent G's hide rule ──────
       Agent G's selector
         body:has(#admin-login-overlay.login-overlay:not([style*="display: none"])) #chat-bubble
       has specificity (2,2,1). My v1 hotfix
         body:has(#admin-login-overlay[style*="display:none"]) #chat-bubble
       has specificity (2,1,1) — loses on the .class column.
       This v2 selector ties Agent G's specificity and is later in source,
       so wins.
    */
    body:has(#admin-login-overlay.login-overlay) #chat-bubble.chat-bubble.visible {
      display: flex !important;
      visibility: visible !important;
    }
    /* Re-hide ONLY when admin overlay is actually open */
    body:has(#admin-login-overlay.login-overlay.active) #chat-bubble.chat-bubble,
    body:has(#admin-login-overlay.login-overlay[style*="display:flex"]) #chat-bubble.chat-bubble,
    body:has(#admin-login-overlay.login-overlay[style*="display: flex"]) #chat-bubble.chat-bubble {
      display: none !important;
    }

    /* ── HOTFIX-2B: Map preview + expand modal pattern ──────────────────
       User explicitly asked for this in real-device feedback:
       "needs to be a preview and expand to full screen with an x to get out"
       The inline mobile layout (controls below) was technically working but
       the controls dominated the viewport. Fix: dedicated "Fullscreen" CTA
       that promotes the map to a viewport-filling modal.
    */

    /* Buttons hidden by default (desktop) */
    #map-expand-btn,
    #map-close-btn {
      display: none;
    }

    @media (max-width: 768px) {
      /* The Fullscreen button overlays the bottom-right of the map preview */
      #map-expand-btn {
        display: inline-flex !important;
        align-items: center;
        gap: 6px;
        position: absolute;
        right: 12px;
        bottom: 12px;
        z-index: 600;
        background: #313D7F;
        color: white;
        border: none;
        border-radius: 24px;
        padding: 10px 16px;
        font-size: 14px;
        font-weight: 600;
        font-family: 'Rubik', sans-serif;
        cursor: pointer;
        box-shadow: 0 6px 16px rgba(0,0,0,0.25);
      }
      #map-expand-btn:active { transform: scale(0.97); }

      /* When fullscreen state is on, hide the Fullscreen CTA and show the × */
      body.map-fullscreen #map-expand-btn { display: none !important; }
      body.map-fullscreen #map-close-btn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 12px;
        right: 12px;
        z-index: 10100;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        background: white;
        color: #313D7F;
        border: 1px solid #313D7F;
        font-size: 28px;
        line-height: 1;
        cursor: pointer;
        box-shadow: 0 4px 12px rgba(0,0,0,0.2);
        padding: 0;
      }

      /* Fullscreen state — map-container fills the viewport */
      body.map-fullscreen { overflow: hidden; }
      body.map-fullscreen #internal-banner,
      body.map-fullscreen .main-nav,
      body.map-fullscreen #chat-bubble {
        display: none !important;
      }
      body.map-fullscreen #map-container {
        position: fixed !important;
        inset: 0 !important;
        z-index: 10000 !important;
        height: 100vh !important;
        width: 100vw !important;
        max-width: 100vw !important;
        background: white;
        padding: 0 !important;
        margin: 0 !important;
        overflow: hidden;
      }
      body.map-fullscreen #world-map {
        height: 100vh !important;
        width: 100vw !important;
        margin: 0 !important;
      }

      /* In fullscreen, restore controls/legend to floating panels over the map */
      body.map-fullscreen .map-controls,
      body.map-fullscreen .map-legend {
        position: absolute !important;
        z-index: 600 !important;
        background: rgba(255,255,255,0.96) !important;
        backdrop-filter: blur(8px) !important;
        box-shadow: 0 4px 16px rgba(0,0,0,0.12) !important;
        width: auto !important;
        margin: 0 !important;
      }
      body.map-fullscreen .map-controls {
        top: 68px !important;
        left: 12px !important;
        right: 68px !important;
        max-height: calc(100vh - 200px);
        overflow-y: auto;
        padding: 12px !important;
        border-radius: 14px;
      }
      /* Collapsed Filters: shrink to a small floating chip, not a full-width
         empty white box. Overrides the right:68px stretch above. */
      body.map-fullscreen .map-controls.collapsed {
        right: auto !important;
        width: auto !important;
        max-width: 120px !important;
        padding: 8px 12px !important;
        max-height: none !important;
        overflow: hidden !important;
      }
      body.map-fullscreen .map-controls.collapsed .map-ctrl-toggle {
        margin: 0 !important; padding: 2px 4px !important; font-size: 13px;
      }
      body.map-fullscreen .map-legend {
        bottom: 16px !important;
        left: 12px !important;
        right: 12px !important;
        max-width: none !important;
        padding: 10px 14px !important;
        border-radius: 14px;
      }
      body.map-fullscreen .map-legend.collapsed {
        right: auto !important;
        width: auto !important;
        max-width: 120px !important;
        padding: 8px 14px !important;
      }
      body.map-fullscreen .map-legend.collapsed .map-legend-title {
        padding: 0 !important; margin: 0 !important;
      }
      /* In-map guide hint chip — small floating help/tip pill */
      .map-guide-chip {
        position: absolute;
        top: 18px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 605;
        background: rgba(49, 61, 127, 0.95);
        -webkit-backdrop-filter: blur(8px);
        backdrop-filter: blur(8px);
        color: #fff;
        padding: 10px 14px 10px 12px;
        border-radius: 24px;
        font-family: 'Rubik', sans-serif;
        font-size: 13px;
        font-weight: 500;
        display: none;
        align-items: center;
        gap: 8px;
        box-shadow: 0 6px 18px rgba(20,30,60,0.25);
        max-width: calc(100vw - 100px);
        animation: mapGuideIn 0.4s cubic-bezier(0.2,0.9,0.3,1) both;
      }
      body.map-fullscreen .map-guide-chip { display: inline-flex; }
      .map-guide-chip svg { width: 16px; height: 16px; flex-shrink: 0; }
      .map-guide-chip .map-guide-close {
        background: rgba(255,255,255,0.2);
        border: none;
        color: #fff;
        width: 22px; height: 22px;
        border-radius: 50%;
        margin-left: 4px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 14px;
        padding: 0;
      }
      @keyframes mapGuideIn {
        from { opacity: 0; transform: translate(-50%, -8px); }
        to   { opacity: 1; transform: translate(-50%, 0); }
      }
      body.map-fullscreen .map-guide-chip.dismissed { display: none !important; }
    }
    /* Base state for the map guide chip, OUTSIDE the media query. Every rule
       for this chip, including its display:none resting state, lived inside
       @media (max-width:768px), so at desktop widths the chip had no styling
       at all: an unstyled block-level div sitting in the map wrap's flow,
       measured at 1118x1153px on 2026-08-25. The chip is a mobile-fullscreen
       hint and should not exist as layout anywhere else. */
    .map-guide-chip { display: none; }

    /* ── HOTFIX-2C: Map controls width on mobile (round 1 missed !important) ──
       Round 1 set max-width: 100% !important but didn't set width itself.
       The natural content width pushed the panel to 780px (from desktop CSS).
    */
    @media (max-width: 768px) {
      body:not(.map-fullscreen) .map-controls,
      body:not(.map-fullscreen) .map-legend {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
      }
    }

    /* ═════════════════════════════════════════════════════════════════
       HOTFIX-3 (May 25, 2026) — fullscreen map polish
       ═════════════════════════════════════════════════════════════════ */

    /* ── HOTFIX-3A: Leaflet zoom controls collide with × close button.
       Both want top-right of the viewport. Move the Leaflet control to
       top-left in fullscreen so the × can keep its conventional spot. */
    @media (max-width: 768px) {
      body.map-fullscreen .leaflet-top.leaflet-left {
        /* Default Leaflet zoom container is .leaflet-top.leaflet-left — bring it
           BELOW the Filters panel so they don't stack horizontally either. */
        top: auto !important;
        bottom: 90px !important;  /* sits above the Legend pill */
        left: 12px !important;
      }
      /* If for any reason Leaflet placed controls on the right (some themes do),
         also pin those to the LEFT to keep the × clear. */
      body.map-fullscreen .leaflet-top.leaflet-right {
        top: auto !important;
        bottom: 90px !important;
        right: auto !important;
        left: 64px !important;
      }
      body.map-fullscreen .leaflet-control-zoom {
        margin: 0 !important;
      }
      body.map-fullscreen .leaflet-control-zoom a {
        width: 44px !important;
        height: 44px !important;
        line-height: 44px !important;
        font-size: 22px !important;
      }
    }

    /* ── HOTFIX-3B: Triangle arrows render as colorful play emoji on iOS.
       1. Used the SMALL triangle variants in HTML (U+25B8 ▸, U+25BE ▾) which
          don't have an emoji presentation by default
       2. Added VARIATION SELECTOR-15 (U+FE0E) to force text presentation
       3. Belt-and-suspenders: CSS font-variant-emoji: text on the toggle elements */
    .map-ctrl-toggle,
    .map-legend-title,
    .legend-arrow {
      font-variant-emoji: text;
      -webkit-font-variant-emoji: text;
      font-family: 'Rubik', sans-serif; /* Override system emoji font */
    }

    /* ── HOTFIX-3C: Tighten Filters/Legend cards in fullscreen mode.
       In v2 they were taking ~80px vertical each. Slim them down in collapsed
       state so the map gets more visible area. */
    @media (max-width: 768px) {
      body.map-fullscreen .map-controls.collapsed,
      body.map-fullscreen .map-controls:not(.expanded) {
        padding: 6px 14px !important;
        min-height: 0 !important;
      }
      body.map-fullscreen .map-controls.collapsed .map-control-row {
        padding: 0 !important;
        margin: 0 !important;
        min-height: 32px;
      }
      body.map-fullscreen .map-legend {
        padding: 8px 14px !important;
      }
      body.map-fullscreen .map-legend.collapsed .legend-body {
        display: none !important;
      }
      /* Pull the panels in a touch more so they feel less floaty */
      body.map-fullscreen .map-controls {
        top: 58px !important;
        right: 12px !important;
        left: 12px !important;
      }
      body.map-fullscreen .map-legend {
        bottom: 12px !important;
      }
    }

    /* ── HOTFIX-3D: Make Filters/Legend collapsed by default when entering
       fullscreen. CSS-only via :has() and a body class wouldn't work without
       JS state, so we just default to a compact look — the existing toggle
       still works to expand. */

    /* ═════════════════════════════════════════════════════════════════
       PRIVACY POLICY + TERMS OF USE MODAL + CHAT AI DISCLOSURE
       ═════════════════════════════════════════════════════════════════ */

    /* ── Policy modal overlay ─── */
    .policy-overlay {
      position: fixed;
      inset: 0;
      background: rgba(49, 61, 127, 0.45);
      backdrop-filter: blur(4px);
      z-index: 2500;
      display: none;
      padding: 40px 20px;
      overflow-y: auto;
      align-items: flex-start;
      justify-content: center;
    }
    .policy-overlay.active { display: flex; }

    .policy-modal {
      background: white;
      border-radius: 16px;
      max-width: 760px;
      width: 100%;
      padding: 40px 48px 48px;
      position: relative;
      max-height: calc(100vh - 80px);
      overflow-y: auto;
      box-shadow: 0 16px 48px rgba(49, 61, 127, 0.2);
      font-family: 'Rubik', sans-serif;
      color: #39373A;
      line-height: 1.65;
    }

    .policy-close {
      position: absolute;
      top: 16px;
      right: 20px;
      background: none;
      border: none;
      font-size: 32px;
      line-height: 1;
      cursor: pointer;
      color: #767676;
      padding: 6px 12px;
      border-radius: 8px;
    }
    .policy-close:hover { color: #313D7F; background: #f5f5f5; }

    .policy-content h2 {
      font-family: 'Source Serif Pro', serif;
      font-size: 26px;
      color: #313D7F;
      margin: 0 0 8px;
      padding-right: 40px;
    }
    .policy-content h3 {
      font-family: 'Rubik', sans-serif;
      font-size: 17px;
      color: #313D7F;
      margin: 28px 0 8px;
      font-weight: 600;
    }
    .policy-content p, .policy-content ul {
      font-size: 14.5px;
      margin: 0 0 12px;
      color: #39373A;
    }
    .policy-content ul {
      padding-left: 22px;
    }
    .policy-content li {
      margin-bottom: 6px;
    }
    .policy-content a {
      color: #313D7F;
      text-decoration: underline;
      text-underline-offset: 2px;
    }
    .policy-content a:hover { color: #44AEC8; }
    .policy-content strong { color: #313D7F; font-weight: 600; }
    .policy-meta {
      font-size: 12.5px !important;
      color: #767676 !important;
      border-bottom: 1px solid #e8e8e8;
      padding-bottom: 14px;
      margin-bottom: 24px !important;
    }

    /* Mobile sizing */
    @media (max-width: 768px) {
      .policy-overlay { padding: 20px 12px; }
      .policy-modal { padding: 28px 20px 32px; max-height: calc(100vh - 40px); }
      .policy-content h2 { font-size: 22px; }
      .policy-content h3 { font-size: 15.5px; }
      .policy-content p, .policy-content ul { font-size: 14px; }
      .policy-close { font-size: 28px; top: 10px; right: 12px; min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; }
    }

    /* ── Chat AI disclosure (sits above the input row) ─── */
    .chat-disclosure {
      display: flex;
      align-items: flex-start;
      gap: 6px;
      background: #f7f8fa;
      border-top: 1px solid #e8eaef;
      padding: 8px 14px;
      font-size: 11px;
      color: #5a5a5a;
      line-height: 1.4;
    }
    .chat-disclosure svg {
      color: #44AEC8;
      margin-top: 1px;
    }
    .chat-disclosure a {
      color: #313D7F;
      font-weight: 500;
      text-decoration: underline;
      text-underline-offset: 2px;
    }
    .chat-disclosure a:hover { color: #44AEC8; }

    @media (max-width: 480px) {
      .chat-disclosure { font-size: 10.5px; padding: 7px 12px; }
    }

    /* ═════════════════════════════════════════════════════════════════
       COOKIE CONSENT BANNER + PREFERENCES MODAL
       ═════════════════════════════════════════════════════════════════ */

    /* ── Bottom-anchored banner (slides up on .visible) ─── */
    .cookie-banner {
      position: fixed;
      left: 0;
      right: 0;
      bottom: 0;
      background: #313D7F;
      color: white;
      padding: 16px 24px;
      z-index: 9500; /* above most UI but below admin login overlay */
      box-shadow: 0 -4px 24px rgba(0,0,0,0.18);
      font-family: 'Rubik', sans-serif;
      transform: translateY(110%);
      transition: transform 0.4s cubic-bezier(.2,.7,.2,1);
    }
    .cookie-banner.visible { transform: translateY(0); }

    .cookie-banner-inner {
      max-width: 1200px;
      margin: 0 auto;
      display: flex;
      gap: 28px;
      align-items: center;
      flex-wrap: wrap;
    }
    .cookie-banner-text {
      flex: 1 1 380px;
      min-width: 280px;
    }
    .cookie-banner-text strong {
      display: block;
      font-size: 14px;
      margin-bottom: 4px;
    }
    .cookie-banner-text p {
      font-size: 13px;
      line-height: 1.55;
      margin: 0;
      color: rgba(255,255,255,0.92);
    }
    .cookie-banner-text a {
      color: #93D73B;
      text-decoration: underline;
      text-underline-offset: 2px;
      font-weight: 500;
    }
    .cookie-banner-text a:hover { color: white; }

    .cookie-banner-actions {
      display: flex;
      gap: 10px;
      flex-shrink: 0;
      flex-wrap: wrap;
    }

    .cookie-btn {
      padding: 10px 18px;
      border-radius: 8px;
      font-family: 'Rubik', sans-serif;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      border: 1px solid transparent;
      min-height: 44px;
    }
    .cookie-btn-primary {
      background: #93D73B;
      color: #1a2240;
      border-color: #93D73B;
    }
    .cookie-btn-primary:hover { background: #b4e664; }
    .cookie-btn-secondary {
      background: transparent;
      color: white;
      border-color: rgba(255,255,255,0.3);
    }
    .cookie-btn-secondary:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.55); }

    @media (max-width: 768px) {
      .cookie-banner { padding: 14px 16px 18px; }
      .cookie-banner-inner { gap: 14px; }
      .cookie-banner-text { flex: 1 1 100%; min-width: 0; }
      .cookie-banner-actions { width: 100%; }
      .cookie-banner-actions .cookie-btn { flex: 1 1 auto; min-width: 0; padding: 10px 12px; }
    }
    @media (max-width: 480px) {
      .cookie-banner-actions { flex-direction: column; }
      .cookie-banner-actions .cookie-btn { width: 100%; }
    }

    /* ── Preferences modal (reuses .policy-close from policy modal) ─── */
    .cookie-prefs-overlay {
      position: fixed;
      inset: 0;
      background: rgba(49,61,127,0.45);
      backdrop-filter: blur(4px);
      z-index: 9600;
      display: none;
      padding: 40px 20px;
      overflow-y: auto;
      align-items: flex-start;
      justify-content: center;
    }
    .cookie-prefs-overlay.active { display: flex; }

    .cookie-prefs-modal {
      background: white;
      border-radius: 16px;
      max-width: 620px;
      width: 100%;
      padding: 36px 40px 40px;
      position: relative;
      max-height: calc(100vh - 80px);
      overflow-y: auto;
      box-shadow: 0 16px 48px rgba(49,61,127,0.2);
      font-family: 'Rubik', sans-serif;
      color: #39373A;
      line-height: 1.55;
    }
    .cookie-prefs-modal h2 {
      font-family: 'Source Serif Pro', serif;
      font-size: 24px;
      color: #313D7F;
      margin: 0 0 6px;
      padding-right: 40px;
    }

    .cookie-category {
      padding: 16px 0;
      border-bottom: 1px solid #eef0f5;
    }
    .cookie-category:last-of-type { border-bottom: none; }
    .cookie-category-head {
      display: flex;
      align-items: flex-start;
      gap: 16px;
      justify-content: space-between;
    }
    .cookie-category-head > div { flex: 1; }
    .cookie-category h4 {
      font-size: 15px;
      color: #313D7F;
      margin: 0 0 4px;
      font-weight: 600;
    }
    .cookie-category p {
      font-size: 13px;
      color: #5a5a5a;
      margin: 0;
      line-height: 1.55;
    }

    /* Toggle switch */
    .cookie-toggle {
      position: relative;
      display: inline-block;
      width: 48px;
      height: 28px;
      flex-shrink: 0;
      cursor: pointer;
    }
    .cookie-toggle input { opacity: 0; width: 0; height: 0; }
    .cookie-toggle-slider {
      position: absolute;
      inset: 0;
      background: #c8ccd6;
      border-radius: 28px;
      transition: background 0.2s;
    }
    .cookie-toggle-slider::before {
      content: '';
      position: absolute;
      height: 22px; width: 22px;
      left: 3px; top: 3px;
      background: white;
      border-radius: 50%;
      transition: transform 0.2s;
      box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    }
    .cookie-toggle input:checked + .cookie-toggle-slider { background: #93D73B; }
    .cookie-toggle input:checked + .cookie-toggle-slider::before { transform: translateX(20px); }
    .cookie-toggle.disabled {
      background: #eef0f5;
      color: #767676;
      font-size: 11px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      border-radius: 14px;
      padding: 6px 12px;
      width: auto;
      height: auto;
      cursor: default;
      align-self: flex-start;
    }

    .cookie-prefs-footer {
      display: flex;
      gap: 10px;
      justify-content: flex-end;
      margin-top: 24px;
      padding-top: 20px;
      border-top: 1px solid #eef0f5;
    }
    .cookie-prefs-footer .cookie-btn { min-width: 140px; }
    .cookie-prefs-footer .cookie-btn-secondary { color: #313D7F; border-color: #313D7F; }
    .cookie-prefs-footer .cookie-btn-secondary:hover { background: #f0f2ff; }

    @media (max-width: 768px) {
      .cookie-prefs-overlay { padding: 20px 12px; }
      .cookie-prefs-modal { padding: 24px 18px 28px; max-height: calc(100vh - 40px); }
      .cookie-prefs-footer { flex-direction: column-reverse; }
      .cookie-prefs-footer .cookie-btn { width: 100%; }
    }

    /* ═════════════════════════════════════════════════════════════════
       COOKIE BANNER MOBILE TAP FIX (May 26, 2026)
       Banner buttons were unclickable on mobile because the chat bubble
       (z-index 10010) sits over the banner (z-index 9500), intercepting
       taps at the bottom-right where buttons are.
       ═════════════════════════════════════════════════════════════════ */

    /* Raise the banner above the chat bubble */
    .cookie-banner { z-index: 10020 !important; }
    .cookie-prefs-overlay { z-index: 10030 !important; }

    /* Hide the chat bubble while the consent banner or prefs modal is up.
       The user hasn't consented yet — don't offer chat. */
    body:has(.cookie-banner.visible) #chat-bubble,
    body:has(.cookie-prefs-overlay.active) #chat-bubble {
      display: none !important;
      visibility: hidden !important;
      pointer-events: none !important;
    }

    /* Ensure every part of the banner accepts pointer events
       (in case any ancestor has pointer-events:none) */
    .cookie-banner,
    .cookie-banner-inner,
    .cookie-banner-actions,
    .cookie-banner-actions .cookie-btn {
      pointer-events: auto !important;
    }

    /* iOS Safari sometimes ignores tap on transparent buttons inside fixed
       containers — force tap-highlight & touch-action */
    .cookie-btn {
      -webkit-tap-highlight-color: rgba(255,255,255,0.2);
      touch-action: manipulation;
      user-select: none;
      -webkit-user-select: none;
    }

    /* ═════════════════════════════════════════════════════════════════
       MAP UI/UX FIXES (May 26, 2026)
       - Filter section cut off when collapsed
       - Arrow direction (collapsed=down, open=up) + larger
       - Category filter pill colors now match legend + markers
       ═════════════════════════════════════════════════════════════════ */

    /* ── Filter button no longer clipped when collapsed ──
       Was: max-width: 48px overflow:hidden — cut off "Filters" text to "Filte".
       Now: let the collapsed pill size to its content (arrow + label). */
    .map-controls.collapsed {
      max-width: none !important;
      width: auto !important;
      padding: 8px 16px !important;
      overflow: visible !important;
    }

    /* Arrow + label both visible and legible in collapsed state */
    .map-controls.collapsed .map-ctrl-toggle {
      font-size: 14px !important;
      white-space: nowrap;
      padding: 4px 4px !important;
      display: inline-flex !important;
      align-items: center;
      gap: 4px;
    }

    /* Make the toggle arrow LARGER and a clearer affordance.
       .map-ctrl-toggle holds both the small triangle and the "Filters" label
       when collapsed; we want the triangle to read as a clear control,
       not 12px footnote text. */
    .map-ctrl-toggle {
      font-size: 18px !important;
      line-height: 1;
      color: #313D7F !important;
      font-weight: 600;
      padding: 4px 8px !important;
      min-width: 28px;
      min-height: 28px;
      border-radius: 6px;
    }
    .map-ctrl-toggle:hover { background: #f0f2ff; }

    /* Legend collapse arrow (already inline-styled to 18px now in the markup);
       add hover affordance + tap target. */
    .map-legend-title {
      padding: 4px 6px;
      border-radius: 6px;
      transition: background 0.15s;
    }
    .map-legend-title:hover { background: #f7f8fa; }
    .map-legend-title .legend-arrow {
      margin-left: 6px;
      /* Defensive — make sure no leftover rotate transform from old code */
      transform: none !important;
    }

    /* ── Category-filter pill dots: now match the marker + legend colors.
       The dots were inline-styled differently (8B5E3C/6B9D2B/7B61C2/C2703E/
       44AEC8/2980B9/8E8E93) — already updated to match in markup.
       Add a thin border so light-colored dots remain visible on white pills. */
    .cat-dot {
      display: inline-block;
      width: 10px;
      height: 10px;
      border-radius: 50%;
      margin-right: 6px;
      vertical-align: middle;
      border: 1px solid rgba(0,0,0,0.08);
      flex-shrink: 0;
    }

    /* In fullscreen mobile state, the collapsed control still needs to fit */
    @media (max-width: 768px) {
      body.map-fullscreen .map-controls.collapsed {
        max-width: 180px !important;  /* room for "▾ Filters" + padding */
        width: auto !important;
      }
      body:not(.map-fullscreen) .map-controls.collapsed {
        max-width: 100% !important;  /* full-width inline below the map */
        width: 100% !important;
      }
    }

    /* ═════════════════════════════════════════════════════════════════
       UI BATCH 2 (May 26, 2026)
       ═════════════════════════════════════════════════════════════════ */

    /* ── Stories filters: 2-row layout (year row + dropdowns row) ──
       The previous single flex container caused 5 filter-groups + the
       results count to wrap unpredictably. Now Year sits on its own row
       with the disclaimer note and results count; dropdowns + search
       share a clean second row. */
    .stories-filters {
      display: flex;
      flex-direction: column;
      gap: 18px;
      margin-bottom: 32px;
    }
    .stories-filter-row {
      display: flex;
      gap: 24px;
      flex-wrap: wrap;
      align-items: flex-start;
    }
    .stories-filter-row-year {
      justify-content: space-between;
      border-bottom: 1px solid #eef0f5;
      padding-bottom: 18px;
    }
    .stories-filter-row-year > .filter-group {
      flex: 1 1 auto;
      min-width: 280px;
    }
    .stories-filter-row-year > .results-count {
      flex: 0 0 auto;
      align-self: center;
      margin: 0;
      font-size: 14px;
      color: #5a5a5a;
      font-weight: 500;
      white-space: nowrap;
    }

    .stories-filter-row-dropdowns {
      align-items: flex-end;
    }
    .stories-filter-row-dropdowns > .filter-group {
      flex: 0 1 auto;
    }
    .stories-filter-row-dropdowns .filter-group-search {
      flex: 1 1 220px;
      min-width: 180px;
    }
    .stories-filter-row-dropdowns .filter-group-search .search-input {
      width: 100%;
    }

    @media (max-width: 768px) {
      .stories-filter-row {
        gap: 12px;
      }
      .stories-filter-row-year {
        flex-direction: column;
        align-items: stretch;
      }
      .stories-filter-row-year > .results-count {
        align-self: flex-start;
      }
      .stories-filter-row-dropdowns > .filter-group {
        flex: 1 1 calc(50% - 6px);
        min-width: 0;
      }
      .stories-filter-row-dropdowns .filter-group-search {
        flex: 1 1 100%;
      }
    }

    /* ═════════════════════════════════════════════════════════════════
       UI BATCH 3 (May 26, 2026) — overrides previous filter layout
       ═════════════════════════════════════════════════════════════════ */

    /* ── Stories filters: 3 left-aligned rows ──
       Override UI_BATCH2 which forced row 1 to space-between. New:
       - Row 1: Year checkboxes (left)
       - Row 2: Disclaimer note (own row, left)
       - Row 3: Dropdowns + search + results count (left)
    */
    .stories-filters {
      display: flex;
      flex-direction: column;
      gap: 12px;
      margin-bottom: 32px;
    }
    .stories-filter-row {
      display: flex;
      gap: 16px;
      flex-wrap: wrap;
      align-items: center;
      justify-content: flex-start !important;  /* defeat any older space-between */
      border-bottom: none !important;          /* defeat the divider from UI_BATCH2 */
      padding-bottom: 0 !important;
    }
    .stories-filter-row-year .filter-group {
      flex: 0 0 auto;
      min-width: 0;
    }
    .stories-filter-row-note {
      margin-top: 2px;
    }
    .stories-filter-row-note #stories-disclaimer {
      margin: 0;
    }
    .stories-filter-row-dropdowns {
      align-items: flex-end;
      margin-top: 10px;
      gap: 16px;
    }
    .stories-filter-row-dropdowns .filter-group {
      flex: 0 0 auto;
    }
    .stories-filter-row-dropdowns .filter-group-search {
      flex: 1 1 220px;
      min-width: 180px;
      max-width: 320px;
    }
    .stories-filter-row-dropdowns .filter-group-search .search-input {
      width: 100%;
    }
    .stories-filter-row-dropdowns .results-count {
      flex: 0 0 auto;
      margin: 0;
      font-size: 14px;
      color: #5a5a5a;
      font-weight: 500;
      white-space: nowrap;
      margin-left: auto;  /* push count to the visual right of row 3 but row itself stays left-aligned */
    }

    @media (max-width: 768px) {
      .stories-filter-row { gap: 10px; }
      .stories-filter-row-dropdowns { gap: 10px; }
      .stories-filter-row-dropdowns .filter-group {
        flex: 1 1 calc(50% - 6px);
        min-width: 0;
      }
      .stories-filter-row-dropdowns .filter-group-search {
        flex: 1 1 100%;
        max-width: none;
      }
      .stories-filter-row-dropdowns .results-count {
        margin-left: 0;
        flex: 1 1 100%;
      }
    }

    /* ── Mini-map sizing ──
       Real Leaflet maps need a fixed height to render tiles. The container
       default was set inline in renderMiniMap (90px small / 300px large).
       These rules guarantee parent positioning and ensure tiles paint. */
    .mini-map { position: relative; }
    .mini-map .leaflet-container { background: #f0f3f8 !important; }
    .mini-map .leaflet-control-attribution { display: none !important; }
    .synergy-card .mini-map { margin: 8px 0; }

    /* The synergy detail overlay container expects an SVG width:100%; switch to
       the mini-map div pattern */
    #synergy-overlay-map-svg { width: 100%; }
    #synergy-overlay-map-svg .mini-map { width: 100%; min-height: 300px; }

    /* ═════════════════════════════════════════════════════════════════
       UI BATCH 4 (May 26, 2026) — alignment hotfix
       ═════════════════════════════════════════════════════════════════ */

    /* The original .stories-filters rule (line 541) had `align-items: center`.
       When UI_BATCH2 switched to `flex-direction: column`, that center became
       HORIZONTAL — pushing each filter row toward the middle of the section
       instead of the left edge. Explicit override: */
    .stories-filters {
      align-items: flex-start !important;
      align-content: flex-start !important;
    }

    /* Belt-and-suspenders for the rows themselves */
    .stories-filter-row {
      align-self: flex-start !important;
      width: 100%;            /* take the full width of .stories-filters */
      margin-left: 0 !important;
    }

    /* The disclaimer note shouldn't have any inherited indent either */
    .stories-filter-row-note {
      margin-left: 0 !important;
      padding-left: 0 !important;
    }
    .stories-filter-row-note > #stories-disclaimer {
      margin-left: 0;
    }

    /* ─── C1: OSH cross-link (Factory category only) ─── */
    .osh-link {
      display: none;
      align-items: center;
      gap: 5px;
      margin-left: 12px;
      padding: 5px 12px;
      border: 1px solid #313D7F;
      border-radius: 16px;
      background: #f0f2ff;
      color: #313D7F;
      font-size: 12px;
      font-weight: 600;
      font-family: 'Rubik', sans-serif;
      text-decoration: none;
      white-space: nowrap;
      transition: background 0.15s, transform 0.15s;
    }
    .osh-link.visible {
      display: inline-flex;
      animation: oshLinkAppear 0.3s ease;
    }
    .osh-link:hover {
      background: #313D7F;
      color: white;
      transform: translateY(-1px);
    }
    .osh-link svg { flex-shrink: 0; }

    @keyframes oshLinkAppear {
      from { opacity: 0; transform: translateY(4px); }
      to   { opacity: 1; transform: translateY(0); }
    }

    @media (max-width: 768px) {
      .osh-link {
        margin-left: 0;
        margin-top: 8px;
        flex: 1 1 auto;
        justify-content: center;
      }
    }

    /* ─── Factory-only overlay pill (Labor Outcomes) ─── */
    .pill-factory-only.hidden-by-cat {
      display: none !important;
    }

    /* ═══ UNIVERSAL THEMES BANNER (public view) ═══
       Navy theme cards in a scroll-snap carousel on desktop; collapses to a
       vertical stack on mobile (<=768px, verified at 390px). */
    .themes-carousel-wrap { position: relative; }
    .themes-carousel {
      display: flex; gap: 20px; overflow-x: auto;
      scroll-snap-type: x mandatory; padding: 4px 4px 16px;
      scrollbar-width: thin; -webkit-overflow-scrolling: touch;
    }
    .theme-card {
      flex: 0 0 340px; scroll-snap-align: start;
      background: linear-gradient(135deg, #313D7F, #232b5c); color: #ffffff;
      border-radius: 16px; padding: 24px; cursor: pointer;
      display: flex; flex-direction: column; min-height: 240px;
      transition: transform 0.2s, box-shadow 0.2s;
      box-shadow: 0 4px 14px rgba(49,61,127,0.18);
    }
    .theme-card:hover { transform: translateY(-4px); box-shadow: 0 10px 28px rgba(49,61,127,0.35); }
    .theme-card:focus-visible { outline: 3px solid #93D73B; outline-offset: 2px; }
    .theme-card.active { outline: 3px solid #93D73B; }
    .theme-card-name { font-family: 'Source Serif Pro', serif; font-size: 21px; font-weight: 700; line-height: 1.2; color: #ffffff; }
    .theme-card-name::after { content: ''; display: block; width: 48px; height: 3px; background: #93D73B; margin-top: 8px; border-radius: 2px; }
    .theme-card-desc { font-size: 14px; line-height: 1.55; opacity: 0.92; margin: 10px 0 14px; color: #ffffff; }
    .theme-card-countries { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
    .theme-country-chip {
      background: rgba(255,255,255,0.14); border: 1px solid rgba(255,255,255,0.28);
      color: #ffffff; font-size: 11px; font-weight: 500; padding: 3px 10px; border-radius: 12px; white-space: nowrap;
    }
    .theme-card-count { margin-top: auto; font-family: 'JetBrains Mono', monospace; font-size: 12px; color: #93D73B; font-weight: 600; }
    .theme-card-cta { font-size: 13px; font-weight: 600; color: #93D73B; margin-top: 6px; }
    .themes-nav-btn {
      position: absolute; top: 42%; transform: translateY(-50%);
      width: 40px; height: 40px; border-radius: 50%;
      border: 1px solid #e0e0e0; background: #ffffff; color: #313D7F;
      font-size: 22px; line-height: 1; cursor: pointer; z-index: 5;
      box-shadow: 0 2px 10px rgba(0,0,0,0.12);
      display: flex; align-items: center; justify-content: center;
      transition: background 0.15s, color 0.15s;
    }
    .themes-nav-btn:hover { background: #313D7F; color: #ffffff; }
    #themes-prev { left: -16px; }
    #themes-next { right: -16px; }
    .theme-stories-panel {
      margin-top: 24px; background: #f7f8fa; border: 1px solid #e8e8e8;
      border-radius: 16px; padding: 24px;
    }
    .theme-stories-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
    .theme-stories-head h3 { font-size: 20px; margin: 0; }
    .theme-stories-close { background: none; border: none; font-size: 26px; color: #666666; cursor: pointer; line-height: 1; padding: 4px 8px; }
    .theme-stories-close:hover { color: #313D7F; }
    @media (max-width: 768px) {
      .themes-carousel { flex-direction: column; overflow-x: visible; scroll-snap-type: none; gap: 14px; padding: 4px 0 8px; }
      .theme-card { flex: 1 1 auto; min-height: 0; padding: 20px; }
      .themes-nav-btn { display: none; }
      .theme-stories-panel { padding: 16px; }
      .theme-stories-head h3 { font-size: 17px; }
    }


    /* ═══════════════════════════════════════════════════════
       MATURITY POLISH (grow-up pass, 2026-07) — additive only.
       Skeletons for data-driven sections, designed empty states,
       keyboard focus visibility, and print sanity. No data or
       behavior semantics change here.
       ═══════════════════════════════════════════════════════ */

    /* Loading skeletons — pure CSS on :empty containers. While the client JS
       has not yet rendered into a data-driven container, it shimmers instead
       of sitting blank; the moment content is injected, :empty stops matching
       and the skeleton vanishes. Zero JS, zero races. */
    @keyframes iih-shimmer { 0% { background-position: -600px 0; } 100% { background-position: 600px 0; } }
    #stories-grid:empty, #theme-stories-grid:empty,
    #donut-chart-container:empty, #bar-chart-container:empty,
    #world-map:empty {
      background: linear-gradient(90deg, #f2f3f7 25%, #e9ebf2 37%, #f2f3f7 63%);
      background-size: 1200px 100%;
      animation: iih-shimmer 1.4s linear infinite;
      border-radius: 12px;
    }
    #stories-grid:empty, #theme-stories-grid:empty { display: block; min-height: 240px; border-radius: 16px; }
    #donut-chart-container:empty, #bar-chart-container:empty { min-height: 200px; }
    #world-map:empty { min-height: 100%; border-radius: 0; }
    @media (prefers-reduced-motion: reduce) {
      #stories-grid:empty, #theme-stories-grid:empty,
      #donut-chart-container:empty, #bar-chart-container:empty,
      #world-map:empty { animation: none; }
    }

    /* Designed empty state — rendered by renderStoryCards() / openThemeStories()
       when a filter or theme yields zero stories (a blank grid reads as broken). */
    .iih-empty-state {
      grid-column: 1 / -1; text-align: center; padding: 48px 24px;
      border: 1px dashed #d5d9e6; border-radius: 16px;
      background: #fafbfd; color: #767676; font-size: 15px; line-height: 1.6;
    }
    .iih-empty-state strong {
      display: block; color: #313D7F; font-family: "Source Serif Pro", serif;
      font-size: 18px; font-weight: 700; margin-bottom: 6px;
    }

    /* Keyboard focus visibility — mouse clicks stay outline-free
       (:focus-visible), keyboard users get a consistent, on-brand ring. */
    a:focus-visible, button:focus-visible, [role="button"]:focus-visible,
    input:focus-visible, select:focus-visible, textarea:focus-visible,
    [tabindex]:focus-visible {
      outline: 2px solid #313D7F; outline-offset: 2px; border-radius: 4px;
    }

    /* Image rendering hygiene: story-card images already reserve a fixed
       200px box (no layout shift); decode off the main thread. */
    .story-image img { content-visibility: auto; }

    /* Print sanity — the views are screen-first, but "File > Print" should
       produce a readable impact summary, not a broken app shell: interactive
       chrome (nav, map controls, chat, cookie UI) is dropped, the map (a
       tile-based canvas that prints as gray boxes) is dropped, sections
       flow full-width, and cards avoid page-break clipping. */
    @media print {
      .main-nav, .mobile-nav, .beta-banner, .utility-bar,
      .map-controls, .map-legend, .map-guide-chip,
      #map-expand-btn, #map-close-btn, #map-container, #map,
      .chat-sheet-backdrop, #chat-widget, .chat-widget, #chat-fab, .chat-fab,
      #stories-expand-btn, .themes-nav-btn, .theme-stories-close,
      .cookie-prefs-footer, .lang-toggle, button {
        display: none !important;
      }
      body { background: #fff; color: #000; }
      .section { padding: 24px 0; max-width: 100%; }
      .story-card, .analytics-table, .dashboard-chart-card {
        break-inside: avoid; box-shadow: none; border: 1px solid #ccc;
      }
      a { color: #000; text-decoration: underline; }
    }

/* The hidden attribute must actually hide. Any explicit display rule
   (.tile is display:block, .navbtn is flex) silently overrides [hidden],
   so persona-gated tabs, tiles and admin sections stayed visible while
   reading as hidden in the DOM. Authorization was always enforced
   server-side, but the UI was showing people work that was not theirs. */
[hidden] { display: none !important; }
