 html,
    body {
      margin: 0;
      padding: 0;
      height: 100%;
      font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        sans-serif;
      background: #f5f7fb;
      color: #222;
      overflow: hidden;
      overflow-x: hidden;
      max-width: 100vw;
      overscroll-behavior: none; /* prevent rubber-band scroll on mobile */
    }

    #app {
      position: relative;
      width: 100%;
      height: 100%;
      overflow-x: hidden;
    }

    #map {
      position: absolute;
      top: 64px;
      left: 0;
      right: 0;
      bottom: 0;
    }

    /* --- Header --- */
    .app-header {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: 64px;
      padding-top: env(safe-area-inset-top);
      background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.95) 100%);
      backdrop-filter: blur(10px);
      box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
      display: flex;
      align-items: center;
      padding: 0 24px;
      z-index: 100;
      border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    }

    .header-logo {
      display: flex;
      align-items: center;
      gap: 12px;
      text-decoration: none;
    }

    .header-logo img {
      height: 36px;
      width: auto;
    }

    .header-title {
      font-size: 18px;
      font-weight: 600;
      color: #1a1a1a;
      letter-spacing: -0.02em;
    }

    .header-subtitle {
      font-size: 13px;
      color: #666;
      font-weight: 400;
      margin-left: 12px;
      padding-left: 12px;
      border-left: 1px solid #e0e0e0;
    }

    .header-nav {
      margin-left: auto;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .header-nav-link {
      padding: 8px 16px;
      text-decoration: none;
      color: #444;
      font-size: 14px;
      font-weight: 500;
      border-radius: 8px;
      transition: background 0.15s ease, color 0.15s ease;
      white-space: nowrap;
    }

    .header-nav-link:hover {
      background: rgba(29, 183, 166, 0.1);
      color: #1db7a6;
    }

    .header-nav-link.primary {
      background: #1db7a6;
      color: white;
    }

    .header-nav-link.primary:hover {
      background: #189d8d;
      color: white;
    }

    /* --- Hamburger button (mobile only) --- */
    #nav-hamburger {
      display: none;
      flex-direction: column;
      justify-content: space-between;
      width: 36px;
      height: 36px;
      padding: 8px 6px;
      background: none;
      border: none;
      cursor: pointer;
      margin-left: auto;
      flex-shrink: 0;
    }

    #nav-hamburger span {
      display: block;
      height: 2px;
      background: #333;
      border-radius: 2px;
      transition: transform 0.2s, opacity 0.2s;
    }

    #nav-hamburger.open span:nth-child(1) {
      transform: translateY(9px) rotate(45deg);
    }

    #nav-hamburger.open span:nth-child(2) {
      opacity: 0;
    }

    #nav-hamburger.open span:nth-child(3) {
      transform: translateY(-9px) rotate(-45deg);
    }

    /* --- Mobile nav drawer --- */
    #mobile-nav-drawer {
      display: none;
      position: absolute;
      top: 64px; /* updated by JS/CSS per breakpoint */
      left: 0;
      right: 0;
      background: rgba(255, 255, 255, 0.98);
      backdrop-filter: blur(10px);
      box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
      z-index: 155;
      flex-direction: column;
      padding: 8px 0;
      transform: translateY(-8px);
      opacity: 0;
      pointer-events: none;
      transition: transform 0.2s ease, opacity 0.2s ease;
    }

    #mobile-nav-drawer.open {
      transform: translateY(0);
      opacity: 1;
      pointer-events: auto;
    }

    .mobile-nav-link {
      display: block;
      padding: 14px 20px;
      text-decoration: none;
      color: #444;
      font-size: 15px;
      font-weight: 500;
      border-bottom: 1px solid #f0f0f0;
      transition: background 0.15s;
    }

    .mobile-nav-link:last-child {
      border-bottom: none;
    }

    .mobile-nav-link:hover,
    .mobile-nav-link:active {
      background: rgba(29, 183, 166, 0.08);
      color: #1db7a6;
    }

    .mobile-nav-link.primary {
      color: #1db7a6;
      font-weight: 700;
    }

    /* --- Search box (top center) --- */
    .search-container {
      position: absolute;
      top: 84px;
      left: 50%;
      transform: translateX(-50%);
      z-index: 10;
      width: min(35vw, 80vw);
      max-width: 500px;
      pointer-events: none; /* allow map interactions if user misses box */
      transition: left 0.3s ease, transform 0.3s ease, width 0.3s ease;
    }

    /* Adjust search box when left sidebar is open - center in remaining space */
    #sidebar:not(.collapsed) ~ #info-sidebar ~ .search-container {
      left: calc(160px + (100vw - 320px) / 2); /* center in visible area */
      width: min(30vw, calc(100vw - 400px));
    }

    /* Adjust search box when right sidebar is open - center in remaining space */
    #sidebar.collapsed ~ #info-sidebar.open ~ .search-container {
      left: calc((100vw - 600px) / 2); /* center in visible area */
      width: min(30vw, calc(100vw - 680px));
    }

    /* Adjust search box when both sidebars are open - center in remaining space */
    #sidebar:not(.collapsed) ~ #info-sidebar.open ~ .search-container {
      left: calc(320px + (100vw - 920px) / 2); /* center between both sidebars */
      width: min(25vw, calc(100vw - 1000px));
    }

    .mapboxgl-ctrl-geocoder {
      width: 100% !important;
      max-width: 100% !important;
      box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
      border-radius: 16px !important;
      overflow: visible !important;
      pointer-events: auto !important;
    }

    .mapboxgl-ctrl-geocoder--input,
    .mapboxgl-ctrl-geocoder--icon,
    .mapboxgl-ctrl-geocoder--button,
    .mapboxgl-ctrl-geocoder--suggestions {
      pointer-events: auto !important;
    }

    .mapboxgl-ctrl-geocoder--suggestions {
      overflow: visible !important;
      position: absolute !important;
      background: white !important;
      width: 100% !important;
      top: 100% !important;
      left: 0 !important;
      z-index: 1000 !important;
      margin-top: 4px !important;
      border-radius: 12px !important;
      box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15) !important;
      max-height: 300px !important;
      overflow-y: auto !important;
    }

    .mapboxgl-ctrl-geocoder--suggestion {
      pointer-events: auto !important;
    }

    /* --- Basemap toggle (top-right) --- */
    .basemap-toggle {
      position: absolute;
      top: 84px;
      right: 16px;
      z-index: 10;
      background: white;
      border-radius: 999px;
      padding: 4px;
      box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
      display: flex;
      gap: 4px;
      align-items: center;
    }

    .basemap-toggle button {
      border: none;
      background: transparent;
      padding: 6px 12px;
      border-radius: 999px;
      cursor: pointer;
      font-size: 13px;
      transition: background 0.15s ease, color 0.15s ease;
    }

    .basemap-toggle button.active {
      background: #1db7a6;
      color: #fff;
    }

    /* 3D toggle — separate pill below the basemap toggle */
    .toggle-3d-wrap {
      position: absolute;
      top: 130px; /* below basemap toggle (~84px top + ~38px height + 8px gap) */
      right: 16px;
      z-index: 10;
    }

    #btn-3d {
      display: flex;
      align-items: center;
      gap: 5px;
      border: none;
      background: white;
      padding: 6px 12px;
      border-radius: 999px;
      cursor: pointer;
      font-size: 13px;
      font-weight: 600;
      box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
      color: #444;
      transition: background 0.15s ease, color 0.15s ease;
      white-space: nowrap;
    }

    #btn-3d:hover {
      background: #f0f0f0;
    }

    #btn-3d.active,
    #btn-3d[aria-pressed="true"] {
      background: #1db7a6;
      color: #fff;
    }

    #btn-3d[aria-pressed="true"] svg {
      stroke: #fff;
    }

    /* --- Sidebar --- */
    #sidebar {
      position: absolute;
      top: 64px;
      left: 0;
      bottom: 0;
      width: 320px;
      max-width: 80vw;
      background: rgba(255, 255, 255, 0.97);
      box-shadow: 8px 0 25px rgba(0, 0, 0, 0.2);
      z-index: 5;
      padding: 16px 18px 24px;
      display: flex;
      flex-direction: column;
      transform: translateX(0);
      transition: transform 0.25s ease;
    }

    #sidebar.collapsed {
      transform: translateX(-100%);
    }

    /* Drag handle — hidden on desktop, shown on mobile */
    .sidebar-handle {
      display: none;
      width: 100%;
      min-height: 44px; /* WCAG minimum touch target */
      align-items: center;
      justify-content: center;
      cursor: pointer;
      flex-shrink: 0;
    }

    /* Visual pill inside the handle */
    .sidebar-handle::after {
      content: '';
      display: block;
      width: 40px;
      height: 4px;
      background: #ccc;
      border-radius: 2px;
    }

    .sidebar-toggle {
      position: absolute;
      top: 16px;
      right: -20px;
      width: 36px;
      height: 36px;
      border-radius: 50%;
      background: #1db7a6;
      color: #fff;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
      font-size: 18px;
      transition: background 0.15s ease, transform 0.15s ease;
    }

    #sidebar.collapsed .sidebar-toggle {
      transform: rotate(180deg);
    }

    .sidebar-header {
      margin-bottom: 16px;
    }

    .sidebar-title {
      font-size: 18px;
      font-weight: 600;
      margin-bottom: 6px;
    }

    .sidebar-subtitle-wrapper {
      display: flex;
      align-items: center;
      gap: 8px;
      justify-content: space-between;
    }

    .sidebar-subtitle {
      font-size: 13px;
      color: #777;
      flex: 1;
      min-width: 0;
    }

    .score-circle-wrapper {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-bottom: 12px;
      position: relative;
    }

    .score-circle {
      width: 70px;
      height: 70px;
      border-radius: 50%;
      border: 5px solid #1db7a6;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 24px;
      font-weight: 700;
      color: #333;
      background: #f9fffd;
      box-shadow: 0 6px 14px rgba(0, 0, 0, 0.14);
      flex-shrink: 0;
    }

    .score-circle-labels {
      display: flex;
      flex-direction: column;
      gap: 2px;
      font-size: 11px;
      color: #666;
      flex: 1;
      min-width: 0;
    }

    .score-circle-labels span.strong {
      font-size: 13px;
      font-weight: 600;
      color: #333;
    }

    .score-circle-labels span {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .generate-pdf-btn {
      background: #1db7a6;
      color: white;
      border: none;
      border-radius: 4px;
      padding: 4px 8px;
      display: flex;
      align-items: center;
      gap: 3px;
      cursor: pointer;
      font-size: 10px;
      font-weight: 600;
      transition: all 0.2s ease;
      box-shadow: 0 2px 4px rgba(29, 183, 166, 0.2);
      flex-shrink: 0;
      white-space: nowrap;
    }

    .generate-pdf-btn:hover {
      background: #189d8d;
      box-shadow: 0 2px 6px rgba(29, 183, 166, 0.3);
    }

    .generate-pdf-btn svg {
      flex-shrink: 0;
    }

    .metrics-list {
      flex: 0 0 auto;
      overflow-y: auto;
      padding-right: 6px;
      margin-bottom: 8px;
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 6px;
      align-content: start;
      padding: 3px;
    }

    .history-section {
      margin-top: 6px;
      margin-bottom: 1%;
      border-top: 1px solid #e5e7eb;
      padding-top: 6px;
      flex: 1;
      min-height: 0;
      display: flex;
      flex-direction: column;
    }

    .history-section.collapsed {
      max-height: 30px;
      flex: 0 0 30px;
    }

    .history-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 4px;
      flex-shrink: 0;
    }

    .history-title {
      font-size: 11px;
      font-weight: 600;
      color: #333;
      display: flex;
      align-items: center;
      gap: 3px;
    }

    .history-title::before {
      content: "📍";
      font-size: 11px;
    }

    .history-toggle {
      background: transparent;
      border: none;
      color: #666;
      cursor: pointer;
      padding: 4px;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 4px;
      transition: all 0.2s ease;
    }

    .history-toggle:hover {
      background: #f0f2f7;
      color: #333;
    }

    .history-toggle svg {
      transition: transform 0.2s ease;
    }

    .history-section.collapsed .history-toggle svg {
      transform: rotate(180deg);
    }

    .history-list {
      max-height: 70vh;
      overflow-y: auto;
      display: flex;
      flex-direction: column;
      gap: 2px;
      padding-right: 4px;
      flex: 1;
      min-height: 0;
      transition: max-height 0.3s ease, opacity 0.2s ease;
    }

    .history-section.collapsed .history-list {
      max-height: 0;
      overflow: hidden;
      opacity: 0;
    }

    .history-item {
      background: #f9f9fb;
      border-radius: 6px;
      padding: 5px 8px;
      cursor: pointer;
      transition: all 0.15s ease;
      display: flex;
      align-items: center;
      gap: 6px;
      border: 2px solid transparent;
      position: relative;
    }

    .history-item:hover {
      background: #f0f4f8;
      border-color: #d1d5db;
    }

    .history-item.active {
      background: #e0f2f1;
      border-color: #1db7a6;
      box-shadow: 0 1px 4px rgba(29, 183, 166, 0.12);
    }

    .history-item.active::before {
      content: "";
      position: absolute;
      left: 0;
      top: 0;
      bottom: 0;
      width: 2px;
      background: #1db7a6;
      border-radius: 6px 0 0 6px;
    }

    .history-item-score {
      width: 28px;
      height: 28px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 10px;
      font-weight: 600;
      color: #fff;
      flex-shrink: 0;
      border: 2px solid rgba(255, 255, 255, 0.6);
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }

    .history-item-info {
      flex: 1;
      min-width: 0;
    }

    .history-item-address {
      font-size: 10px;
      font-weight: 500;
      color: #333;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      line-height: 1.2;
    }

    .history-item-coords {
      font-size: 8px;
      color: #999;
      margin-top: 1px;
      font-family: 'Courier New', monospace;
    }

    .history-item-delete {
      width: 24px;
      height: 24px;
      border-radius: 50%;
      background: transparent;
      color: #999;
      display: none;
      align-items: center;
      justify-content: center;
      font-size: 12px;
      cursor: pointer;
      transition: all 0.15s ease;
      flex-shrink: 0;
    }

    .history-item:hover .history-item-delete {
      display: flex;
    }

    .history-item-delete:hover {
      background: #fee2e2;
      color: #dc2626;
    }

    .history-list::-webkit-scrollbar {
      width: 6px;
    }

    .history-list::-webkit-scrollbar-track {
      background: #f0f2f7;
      border-radius: 10px;
    }

    .history-list::-webkit-scrollbar-thumb {
      background: #c5c9d4;
      border-radius: 10px;
    }

    .history-list::-webkit-scrollbar-thumb:hover {
      background: #a8adb8;
    }

    .metric-row {
      padding: 6px 4px 4px;
      background: #ffffff;
      border-radius: 6px;
      border: 1px solid #e5e7eb;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 3px;
      transition: all 0.15s ease;
    }

    .metric-row:hover {
      border-color: #1db7a6;
      box-shadow: 0 2px 6px rgba(29, 183, 166, 0.12);
      transform: translateY(-1px);
    }

    .metric-gauge {
      width: 46px;
      height: 46px;
      position: relative;
      flex-shrink: 0;
      border-radius: 50%;
      transition: background-color 0.3s ease;
    }

    .metric-gauge svg {
      transform: rotate(-90deg);
      width: 100%;
      height: 100%;
    }

    .metric-gauge-bg {
      fill: none;
      stroke: rgba(255, 255, 255, 0.4);
      stroke-width: 5;
    }

    .metric-gauge-fill {
      fill: none;
      stroke: #fff;
      stroke-width: 5;
      stroke-linecap: round;
      transition: stroke-dashoffset 0.4s ease, stroke 0.25s ease;
    }

    .metric-gauge-value {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      font-size: 12px;
      font-weight: 700;
      color: #fff;
      text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    }

    .metric-info {
      width: 100%;
      text-align: center;
    }

    .metric-header {
      display: flex;
      justify-content: center;
      align-items: center;
    }

    .metric-name {
      font-weight: 500;
      color: #374151;
      font-size: 9px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      line-height: 1.1;
      max-width: 100%;
    }

    .metric-value {
      display: none;
    }

    /* Legacy bar styles - keep for backward compatibility but hidden */
    .metric-bar-bg {
      display: none;
    }

    .metric-bar-fill {
      display: none;
    }

    .sidebar-footer {
      display: none;
    }

    /* --- Mapbox marker styles --- */
    .marker,
    .marker-loading {
      width: 42px;
      height: 42px;
      border-radius: 50%;
      background: #1db7a6;
      border: 3px solid #ffffff;
      box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.25);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
      font-weight: 600;
      color: #ffffff;
      cursor: pointer;
      transition: transform 0.15s ease;
      /* Ensure marker is precisely centered by accounting for its own dimensions */
      margin: 0;
      padding: 0;
      /* Force transform origin to be at the center of the element */
      transform-origin: center center;
    }

    .marker:hover {
      transform: scale(1.1);
    }

    .marker-loading {
      background: #ffffff;
      border-color: #1db7a6;
      box-shadow: 0 0 0 3px rgba(29, 183, 166, 0.35);
      color: transparent;
    }

    .marker-loading::after {
      content: "";
      width: 18px;
      height: 18px;
      border-radius: 50%;
      border: 2px solid #1db7a6;
      border-top-color: transparent;
      animation: spin 0.9s linear infinite;
    }

    .marker-cancel-btn {
      position: absolute;
      top: -8px;
      right: -8px;
      width: 20px;
      height: 20px;
      border-radius: 50%;
      background: #e74c3c;
      color: white;
      border: 2px solid white;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 12px;
      font-weight: bold;
      cursor: pointer;
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
      z-index: 10;
      transition: transform 0.15s ease, background 0.15s ease;
    }

    .marker-cancel-btn:hover {
      background: #c0392b;
      transform: scale(1.1);
    }

    .marker-delete-btn {
      position: absolute;
      top: -8px;
      right: -8px;
      width: 20px;
      height: 20px;
      border-radius: 50%;
      background: #e74c3c;
      color: white;
      border: 2px solid white;
      display: none;
      align-items: center;
      justify-content: center;
      font-size: 11px;
      cursor: pointer;
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
      z-index: 10;
      transition: transform 0.15s ease, background 0.15s ease;
    }

    .marker:hover .marker-delete-btn {
      display: flex;
    }

    .marker-delete-btn:hover {
      background: #c0392b;
      transform: scale(1.15);
    }

    @keyframes spin {
      to {
        transform: rotate(360deg);
      }
    }

    .mapboxgl-popup-content {
      border-radius: 16px;
      padding: 12px 14px 14px;
      box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
      font-size: 13px;
    }

    .popup-title {
      font-weight: 600;
      margin-bottom: 4px;
    }

    .popup-score {
      font-size: 22px;
      font-weight: 600;
      margin-bottom: 6px;
    }

    .popup-address {
      font-size: 11px;
      color: #777;
      margin-bottom: 8px;
    }

    .popup-button {
      width: 100%;
      padding: 8px 10px;
      border-radius: 999px;
      border: none;
      background: #1db7a6;
      color: #fff;
      font-size: 13px;
      cursor: pointer;
      font-weight: 500;
      margin-top: 4px;
      transition: background 0.15s ease, transform 0.1s ease;
    }

    .popup-button:hover {
      background: #17a091;
      transform: translateY(-1px);
    }

    /* --- Report modal --- */
    #report-modal {
      position: absolute;
      inset: 0;
      background: rgba(0, 0, 0, 0.45);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 210;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.2s ease;
    }

    #report-modal.visible {
      opacity: 1;
      pointer-events: auto;
    }

    .report-modal-content {
      background: #ffffff;
      border-radius: 18px;
      padding: 24px 26px 20px;
      width: min(540px, 90vw);
      max-height: 80vh;
      box-shadow: 0 20px 45px rgba(0, 0, 0, 0.45);
      position: relative;
      display: flex;
      flex-direction: column;
      gap: 16px;
    }

    .modal-close {
      position: absolute;
      top: 12px;
      right: 16px;
      font-size: 20px;
      cursor: pointer;
      color: #999;
    }

    .report-modal-content h2 {
      text-align: center;
      margin: 0;
      font-size: 20px;
    }

    .report-modal-content p {
      margin: 0;
      font-size: 13px;
      color: #555;
      text-align: center;
    }

    .report-form {
      display: flex;
      flex-direction: column;
      gap: 10px;
      margin-top: 8px;
    }

    .report-form input {
      padding: 10px 12px;
      border-radius: 999px;
      border: 1px solid #d7dbe5;
      font-size: 13px;
      outline: none;
      transition: border 0.15s;
    }

    .report-form input:focus {
      border-color: #1db7a6;
    }

    .report-form button {
      margin-top: 6px;
      padding: 10px 12px;
      border-radius: 999px;
      border: none;
      background: #1db7a6;
      color: #fff;
      font-size: 14px;
      font-weight: 500;
      cursor: pointer;
    }

    .report-helper {
      font-size: 11px;
      color: #777;
      text-align: center;
      margin-top: 4px;
    }

    /* --- Toast bottom-right --- */
    #report-toast {
      position: absolute;
      right: 20px;
      bottom: 20px;
      min-width: 230px;
      max-width: 260px;
      background: rgba(30, 32, 40, 0.95);
      color: #fff;
      border-radius: 16px;
      padding: 10px 14px;
      font-size: 12px;
      display: flex;
      align-items: center;
      gap: 10px;
      z-index: 25;
      opacity: 0;
      pointer-events: none;
      transform: translateY(8px);
      transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
    }

    #report-toast.visible {
      opacity: 1;
      pointer-events: auto;
      transform: translateY(0);
    }

    .toast-spinner {
      width: 14px;
      height: 14px;
      border-radius: 50%;
      border: 2px solid #fff;
      border-top-color: transparent;
      animation: spin 0.9s linear infinite;
    }

    .toast-icon-ok {
      font-size: 16px;
    }

    .toast-message {
      flex: 1;
    }

    /* --- Zoom warning toast --- */
    #zoom-warning {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      background: rgba(30, 32, 40, 0.95);
      color: #fff;
      border-radius: 16px;
      padding: 16px 24px;
      font-size: 15px;
      font-weight: 500;
      display: flex;
      align-items: center;
      gap: 12px;
      z-index: 30;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.3s ease;
      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    }

    #zoom-warning.visible {
      opacity: 1;
    }

    .zoom-warning-icon {
      font-size: 24px;
    }

    /* --- Right Info Sidebar --- */
    #info-sidebar {
      position: fixed;
      top: 64px;
      right: 0;
      bottom: 0;
      width: 600px;
      max-width: 90vw;
      background: white;
      box-shadow: -8px 0 25px rgba(0, 0, 0, 0.2);
      z-index: 15;
      transform: translateX(100%);
      transition: transform 0.3s ease;
      overflow-y: auto;
      overflow-x: hidden;
    }

    #info-sidebar.open {
      transform: translateX(0);
    }

    .info-sidebar-header {
      position: sticky;
      top: 0;
      background: white;
      border-bottom: 1px solid #e0e0e0;
      padding: 10px 15px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      z-index: 10;
    }

    .info-sidebar-header h2 {
      margin: 0;
      font-size: 24px;
      font-weight: 600;
      color: #1a1a1a;
    }

    .info-sidebar-close {
      width: 32px;
      height: 32px;
      border-radius: 50%;
      background: #f5f5f5;
      border: none;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 20px;
      color: #666;
      transition: background 0.15s ease, color 0.15s ease;
    }

    .info-sidebar-close:hover {
      background: #e0e0e0;
      color: #333;
    }

    .info-sidebar-content {
      padding: 0 20px 48px;
    }

    .info-page {
      display: none;
    }

    .info-page.active {
      display: block;
    }

    .info-page h3 {
      font-size: 20px;
      font-weight: 600;
      color: #1a1a1a;
      margin-bottom: 16px;
    }

    .info-page h4 {
      font-size: 16px;
      font-weight: 600;
      color: #1db7a6;
      margin-top: 24px;
      margin-bottom: 12px;
    }

    .info-page h5 {
      font-size: 14px;
      font-weight: 600;
      color: #1db7a6;
      margin-top: 16px;
      margin-bottom: 8px;
    }

    .info-page p {
      font-size: 15px;
      line-height: 1.7;
      color: #444;
      margin-bottom: 16px;
    }

    .info-page ul {
      margin: 16px 0;
      padding-left: 24px;
    }

    .info-page li {
      font-size: 15px;
      line-height: 1.7;
      color: #444;
      margin-bottom: 8px;
    }

    .environmental-icons {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
      gap: 20px;
      margin: 24px 0;
    }

    .environmental-icon-item {
      display: flex;
      align-items: flex-start;
      gap: 12px;
      padding: 16px;
      background: #f9f9fb;
      border-radius: 12px;
    }

    .environmental-icon-item svg,
    .environmental-icon-item img {
      width: 48px;
      height: 48px;
      flex-shrink: 0;
    }

    .environmental-icon-content h6 {
      margin: 0 0 4px 0;
      font-size: 14px;
      font-weight: 600;
      color: #333;
    }

    /* About Us — Hero */
    .about-hero {
      text-align: center;
      margin-bottom: 28px;
    }

    .about-headline {
      font-size: 22px;
      font-weight: 700;
      color: #1a1a1a;
      margin: 0 0 8px 0;
      letter-spacing: -0.3px;
    }

    .about-subtitle {
      font-size: 14px;
      color: #666;
      margin: 0;
      line-height: 1.5;
    }

    /* About Us — Metrics strip */
    .about-metrics {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 12px;
      margin-bottom: 28px;
    }

    .about-metric-card {
      background: linear-gradient(135deg, #f0fdfb, #e8f9f6);
      border: 1px solid #d1f0eb;
      border-radius: 12px;
      padding: 16px 12px;
      text-align: center;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 4px;
    }

    .about-metric-number {
      font-size: 28px;
      font-weight: 800;
      color: #1db7a6;
      line-height: 1;
    }

    .about-metric-icon {
      font-size: 26px;
      line-height: 1;
    }

    .about-metric-label {
      font-size: 13px;
      font-weight: 700;
      color: #1a1a1a;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    .about-metric-detail {
      font-size: 11px;
      color: #888;
    }

    /* About Us — Section titles */
    .about-section-title {
      font-size: 14px;
      font-weight: 700;
      color: #1db7a6;
      text-transform: uppercase;
      letter-spacing: 1px;
      margin: 24px 0 12px 0;
    }

    /* Hover tooltips — always below to avoid sidebar overflow clipping */
    .has-tooltip {
      position: relative;
      cursor: pointer;
    }

    .has-tooltip::after {
      content: attr(data-tooltip);
      position: absolute;
      left: 50%;
      top: calc(100% + 8px);
      transform: translateX(-50%);
      background: #1a1a1a;
      color: #fff;
      font-size: 12px;
      line-height: 1.5;
      font-weight: 400;
      padding: 10px 14px;
      border-radius: 8px;
      width: 240px;
      text-align: left;
      opacity: 0;
      visibility: hidden;
      transition: opacity 0.2s, visibility 0.2s;
      pointer-events: none;
      z-index: 9999;
      box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    }

    .has-tooltip::before {
      content: '';
      position: absolute;
      left: 50%;
      top: calc(100% + 2px);
      transform: translateX(-50%);
      border: 6px solid transparent;
      border-bottom-color: #1a1a1a;
      opacity: 0;
      visibility: hidden;
      transition: opacity 0.2s, visibility 0.2s;
      pointer-events: none;
      z-index: 9999;
    }

    .has-tooltip:hover::after,
    .has-tooltip:hover::before {
      opacity: 1;
      visibility: visible;
    }

    /* Category card tooltips: show ABOVE (cards sit at bottom of modal) */
    .report-category-card::after {
      top: auto;
      bottom: calc(100% + 8px);
    }

    .report-category-card::before {
      top: auto;
      bottom: calc(100% + 2px);
      border-bottom-color: transparent;
      border-top-color: #1a1a1a;
    }

    /* Pin first card tooltip to the left edge so it doesn't overflow */
    .report-category-card:first-child::after {
      left: 0;
      transform: none;
    }

    .report-category-card:first-child::before {
      left: 24px;
      transform: none;
    }

    /* Pin last card tooltip to the right edge so it doesn't overflow */
    .report-category-card:last-child::after {
      left: auto;
      right: 0;
      transform: none;
    }

    .report-category-card:last-child::before {
      left: auto;
      right: 24px;
      transform: none;
    }

    /* About Us — Audience tags */
    .about-audience {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-bottom: 24px;
    }

    .about-audience-tag {
      background: #f5f5f5;
      border: 1px solid #e0e0e0;
      border-radius: 20px;
      padding: 6px 16px;
      font-size: 13px;
      font-weight: 500;
      color: #444;
    }

    .report-structure-img {
      width: 100%;
      height: auto;
      border-radius: 12px;
      margin: 24px 0;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

    .report-structure-columns {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 32px;
      margin: 24px 0;
    }

    /* Report Page — Steps */
    .report-steps {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      margin-bottom: 28px;
      flex-wrap: wrap;
    }

    .report-step {
      display: flex;
      align-items: center;
      gap: 8px;
      background: #f8fffe;
      border: 1px solid #d1f0eb;
      border-radius: 10px;
      padding: 10px 14px;
    }

    .report-step-num {
      width: 24px;
      height: 24px;
      background: #1db7a6;
      color: #fff;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 12px;
      font-weight: 700;
      flex-shrink: 0;
    }

    .report-step-text {
      font-size: 12px;
      color: #333;
      font-weight: 500;
    }

    .report-step-arrow {
      color: #1db7a6;
      font-size: 18px;
      font-weight: 700;
    }

    /* Report Page — Image showcase */
    .report-showcase {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 12px;
      margin-bottom: 28px;
    }

    .report-showcase-item {
      position: relative;
      border-radius: 10px;
      overflow: visible;
      border: 1px solid #e0e0e0;
      cursor: pointer;
      transition: transform 0.2s, box-shadow 0.2s;
    }

    .report-showcase-item img {
      border-radius: 10px 10px 0 0;
    }

    .report-showcase-item:hover {
      transform: translateY(-2px);
      box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    }

    .report-showcase-item img {
      width: 100%;
      height: 80%;
      object-fit: cover;
      display: block;
    }

    .report-showcase-label {
      display: block;
      text-align: center;
      padding: 8px 4px;
      font-size: 12px;
      font-weight: 600;
      color: #333;
      background: #fafafa;
      border-top: 1px solid #ddd;
      box-shadow: 0 -2px 6px rgba(0,0,0,0.06);
    }

    /* Report Page — Category cards */
    .report-categories {
      display: grid;
      grid-template-columns: repeat(5, 1fr);
      gap: 8px;
      margin-bottom: 160px;
    }

    .report-category-card {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 6px;
      padding: 14px 6px;
      background: linear-gradient(135deg, #f0fdfb, #e8f9f6);
      border: 1px solid #d1f0eb;
      border-radius: 10px;
      cursor: pointer;
      transition: transform 0.2s;
    }

    .report-category-card:hover {
      transform: translateY(-2px);
    }

    .report-cat-icon {
      font-size: 22px;
    }

    .report-cat-name {
      font-size: 11px;
      font-weight: 700;
      color: #333;
      text-align: center;
    }

    .contact-form {
      margin-top: 24px;
    }

    .contact-form input,
    .contact-form textarea {
      width: 100%;
      padding: 12px 16px;
      margin-bottom: 16px;
      border: 1px solid #e0e0e0;
      border-radius: 8px;
      font-size: 14px;
      font-family: inherit;
      transition: border-color 0.15s ease;
    }

    .contact-form input:focus,
    .contact-form textarea:focus {
      outline: none;
      border-color: #1db7a6;
    }

    .contact-form textarea {
      min-height: 120px;
      resize: vertical;
    }

    .contact-form button {
      background: #1db7a6;
      color: white;
      border: none;
      padding: 12px 32px;
      border-radius: 999px;
      font-size: 15px;
      font-weight: 500;
      cursor: pointer;
      transition: background 0.15s ease;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .contact-form button:hover {
      background: #189d8d;
    }

    .team-members {
      display: grid;
      gap: 20px;
      margin-top: 20px;
    }

    .team-member {
      display: flex;
      gap: 20px;
      align-items: flex-start;
    }

    .team-member-photo {
      width: 100px;
      height: 100px;
      border-radius: 50%;
      object-fit: cover;
      flex-shrink: 0;
    }

    .team-member-info h4 {
      margin: 0 0 12px 0;
      font-size: 18px;
      color: #1a1a1a;
    }

    .team-member-info p {
      margin: 0 0 8px 0;
      font-size: 14px;
      line-height: 1.6;
    }

    .partners-image {
      width: 100%;
      max-width: 600px;
      height: auto;
      margin: 32px 0;
    }

    .login-form {
      margin-top: 24px;
    }

    .login-form label {
      display: block;
      font-size: 14px;
      font-weight: 500;
      color: #333;
      margin-bottom: 6px;
    }

    .login-form input[type="text"],
    .login-form input[type="password"],
    .login-form input[type="email"] {
      width: 100%;
      padding: 12px 16px;
      margin-bottom: 16px;
      border: 1px solid #e0e0e0;
      border-radius: 8px;
      font-size: 14px;
      font-family: inherit;
      transition: border-color 0.15s ease;
    }

    .login-form input[type="text"]:focus,
    .login-form input[type="password"]:focus,
    .login-form input[type="email"]:focus {
      outline: none;
      border-color: #1db7a6;
    }

    .login-form .remember-me {
      display: flex;
      align-items: center;
      margin-bottom: 20px;
    }

    .login-form .remember-me input[type="checkbox"] {
      margin-right: 8px;
      width: 16px;
      height: 16px;
    }

    .login-form .remember-me label {
      margin-bottom: 0;
      font-size: 14px;
      font-weight: 400;
      cursor: pointer;
    }

    .login-form button[type="submit"] {
      width: 100%;
      background: #1db7a6;
      color: white;
      border: none;
      padding: 12px 32px;
      border-radius: 999px;
      font-size: 15px;
      font-weight: 500;
      cursor: pointer;
      transition: background 0.15s ease;
    }

    .login-form button[type="submit"]:hover {
      background: #189d8d;
    }

    .login-links {
      text-align: center;
      margin-top: 16px;
      font-size: 14px;
      color: #666;
    }

    .login-links a {
      color: #1db7a6;
      text-decoration: none;
      transition: color 0.15s ease;
    }

    .login-links a:hover {
      color: #189d8d;
      text-decoration: underline;
    }

    .login-separator {
      margin: 0 8px;
      color: #ccc;
    }

    .social-login {
      margin-top: 32px;
      padding-top: 24px;
      border-top: 1px solid #e0e0e0;
    }

    .social-login-title {
      font-size: 14px;
      color: #666;
      margin-bottom: 16px;
      text-align: center;
    }

    .social-login-buttons {
      display: flex;
      flex-direction: column;
      gap: 12px;
    }

    .social-login-btn {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 12px;
      padding: 10px 16px;
      border: 1px solid #e0e0e0;
      border-radius: 8px;
      background: white;
      color: #333;
      font-size: 14px;
      font-weight: 500;
      cursor: pointer;
      transition: background 0.15s ease, border-color 0.15s ease;
      text-decoration: none;
    }

    .social-login-btn:hover {
      background: #f9f9fb;
      border-color: #d0d0d0;
    }

    .social-login-btn img {
      width: 20px;
      height: 20px;
    }

    .social-login-btn.google {
      border-color: #4285f4;
      color: #4285f4;
    }

    .social-login-btn.google:hover {
      background: #f1f5ff;
    }

    .social-login-btn.linkedin {
      border-color: #0077b5;
      color: #0077b5;
    }

    .social-login-btn.linkedin:hover {
      background: #e8f4f9;
    }

    .social-login-btn.amazon {
      border-color: #ff9900;
      color: #232f3e;
    }

    .social-login-btn.amazon:hover {
      background: #fff5e6;
    }

   @media (max-width: 768px) {

  /* Search stays below toggle */
  .search-container {
    top: 56px !important;
    width: calc(100vw - 16px) !important;
    max-width: none !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 40 !important;
  }

  /* Toggle goes to very top-right and gets smaller */
  .basemap-toggle {
    top: 8px !important;
    right: 8px !important;
    padding: 2px !important;
    gap: 2px !important;
    z-index: 50 !important;
  }

  .basemap-toggle button {
    padding: 5px 9px !important;
    font-size: 12px !important;
  }

  /* 3D button repositioned for mobile: below the compact basemap toggle */
  .toggle-3d-wrap {
    top: 50px !important;
    right: 8px !important;
  }

  #btn-3d {
    padding: 5px 10px !important;
    font-size: 12px !important;
  }

  /* Make geocoder input smaller so it looks proportional */
  .mapboxgl-ctrl-geocoder--input {
    height: 38px !important;
    font-size: 14px !important;
    padding: 8px 42px 8px 38px !important;
  }
}

@media (max-width: 420px) {
  .basemap-toggle button {
    padding: 4px 8px !important;
    font-size: 11px !important;
  }
  .search-container {
    top: 54px !important;
    width: calc(100vw - 14px) !important;
  }
  .mapboxgl-ctrl-geocoder--input {
    height: 36px !important;
    font-size: 13px !important;
  }
}

#g-search {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #ddd;
}

#g-results {
  position: absolute;
  top: 44px;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #ddd;
  border-radius: 10px;
  max-height: 260px;
  overflow: auto;
  z-index: 99999;
}

#g-results .g-item {
  padding: 10px 12px;
  cursor: pointer;
}

#g-results .g-item:hover {
  background: #f3f5f7;
}

/* ========= Mapbox bottom-right controls — lift above disclaimer bar ========= */
.mapboxgl-ctrl-bottom-right {
  bottom: 36px !important;  /* matches disclaimer bar height */
}

/* ========= UserWay Accessibility Widget Position ========= */
/* Target all possible position variants UserWay may inject */
.uwy.userway_p1,
.uwy.userway_p2,
.uwy.userway_p3,
.uwy.userway_p4,
.uwy.userway_p5 {
  bottom: 44px !important;  /* above disclaimer bar */
  right: 0 !important;
  left: auto !important;
  top: auto !important;
}

/* The actual button wrapper inside the uwy container */
.uwy .userway_buttons_wrapper {
  bottom: 60px !important;
  right: 12px !important;
  left: auto !important;
  top: auto !important;
  position: fixed !important;
}

/* ========= AI Chat Panel (POC) ========= */
@keyframes fab-pulse {
  0%   { box-shadow: 0 4px 20px rgba(0,0,0,0.45), 0 0 0 3px rgba(29,183,166,0.3); }
  50%  { box-shadow: 0 4px 20px rgba(0,0,0,0.45), 0 0 0 7px rgba(29,183,166,0.1); }
  100% { box-shadow: 0 4px 20px rgba(0,0,0,0.45), 0 0 0 3px rgba(29,183,166,0.3); }
}

#chat-fab{
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 52px;
  padding: 10px 18px;
  border: 2px solid rgba(255,255,255,0.9);
  border-radius: 20px;
  background: #1db7a6;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  z-index: 50;
  box-shadow: 0 4px 20px rgba(0,0,0,0.45), 0 0 0 3px rgba(29,183,166,0.3);
  transition: background 0.2s ease, box-shadow 0.2s ease, left 0.3s ease, bottom 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: fab-pulse 2.5s ease-in-out infinite;
}
#chat-fab:hover{
  background: #189d8d;
  box-shadow: 0 6px 24px rgba(0,0,0,0.5), 0 0 0 4px rgba(29,183,166,0.4);
  animation: none;
}

#chat-panel{
  position: absolute;
  top: 22%;
  right: 1%;
  bottom: 15%;
  width: 30%;
  max-width: calc(100% - 24px);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 18px;
  box-shadow: 0 18px 60px rgba(0,0,0,.18);
  z-index: 60;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(0);
  transition: transform .22s ease, opacity .22s ease,
              top .3s ease, left .3s ease, right .3s ease,
              bottom .3s ease, width .3s ease, max-width .3s ease,
              border-radius .3s ease, box-shadow .3s ease;
  opacity: 1;
}
#chat-panel.chat-closed{
  transform: translateX(calc(100% + 16px));
  opacity: 0;
  pointer-events: none;
}

/* Maximized state — large centered overlay */
#chat-panel.chat-maximized{
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  right: auto;
  bottom: 56px;
  width: 720px;
  max-width: calc(100% - 48px);
  border-radius: 14px;
  z-index: 200;
  box-shadow: 0 24px 80px rgba(0,0,0,.25);
}
#chat-panel.chat-maximized .chat-messages{
  padding: 16px 24px;
}
#chat-panel.chat-maximized .chat-bubble{
  font-size: 15px;
  max-width: 85%;
  line-height: 1.5;
}
#chat-panel.chat-maximized .chat-composer{
  padding: 14px 24px;
}

/* Backdrop overlay behind maximized panel */
.chat-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 190;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
.chat-backdrop.visible{
  opacity: 1;
  pointer-events: auto;
}

.chat-header{
  display:flex;
  align-items:center;
  justify-content: space-between;
  padding: 10px 10px 10px;
  border-bottom: 1px solid rgba(0,0,0,.06);
  background: rgba(255,255,255,.6);
  flex-shrink: 0;
  min-height: 48px;
  gap: 8px;
}
.chat-title{
  display:flex;
  align-items:center;
  gap:8px;
  font-weight: 600;
  font-size: 14px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.chat-title span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-title .dot{
  width:8px;
  height:8px;
  border-radius:999px;
  background:#10b981;
  box-shadow: 0 0 0 3px rgba(16,185,129,.14);
  flex-shrink: 0;
}
.chat-actions{
  display:flex;
  align-items:center;
  gap: 6px;
  flex-shrink: 0;
}
.chat-toggle{
  display:flex;
  align-items:center;
  gap:6px;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(255,255,255,.75);
}
.chat-toggle input{ transform: translateY(1px); }
.chat-icon-btn{
  border:0;
  background: rgba(0,0,0,.08);
  width: 32px;
  height: 32px;
  border-radius: 10px;
  cursor:pointer;
  font-size: 20px;
  color: #666;
  font-weight: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.chat-icon-btn:hover{
  background: rgba(0,0,0,.15);
  color: #333;
}

.chat-messages{
  padding: 12px;
  overflow:auto;
  flex: 1;
}
.chat-bubble{
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 16px;
  margin: 8px 0;
  line-height: 1.45;
  font-size: 14px;
  word-wrap: break-word;
}
.chat-bubble.user{
  white-space: pre-wrap;       /* preserve whitespace for user input */
}
/* Markdown elements inside assistant bubbles */
.chat-bubble.assistant p{ margin: 0 0 6px; }
.chat-bubble.assistant p:last-child{ margin-bottom: 0; }
.chat-bubble.assistant h2,
.chat-bubble.assistant h3{
  font-size: 14px;
  font-weight: 700;
  margin: 10px 0 4px;
  line-height: 1.3;
}
.chat-bubble.assistant h2:first-child,
.chat-bubble.assistant h3:first-child{ margin-top: 0; }
.chat-bubble.assistant ul,
.chat-bubble.assistant ol{
  margin: 4px 0 8px;
  padding-left: 20px;
}
.chat-bubble.assistant li{
  margin-bottom: 3px;
}
.chat-bubble.assistant strong{
  font-weight: 600;
}
.chat-bubble.assistant{
  background: rgba(17,24,39,.06);
  border: 1px solid rgba(0,0,0,.06);
}
.chat-bubble.user{
  margin-left: auto;
  background: #1db7a6;
  color: #fff;
}
.chat-meta{
  font-size: 11px;
  opacity: .65;
  margin-top: 4px;
}

.chat-quick{
  padding: 10px 12px;
  border-top: 1px solid rgba(0,0,0,.06);
  display:flex;
  gap:8px;
  flex-wrap: wrap;
  background: rgba(255,255,255,.55);
}
.chat-chip{
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(255,255,255,.8);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  cursor:pointer;
  transition: all 0.2s ease;
}
.chat-chip:hover{
  background: rgba(29,183,166,0.08);
  border-color: #1db7a6;
  color: #1db7a6;
}

.chat-composer{
  display:flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(0,0,0,.06);
  background: rgba(255,255,255,.85);
}
#chat-input{
  flex:1;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,.10);
  outline:none;
}
#chat-send{
  padding: 10px 12px;
  border-radius: 12px;
  border: 0;
  background: #1db7a6;
  color: #fff;
  cursor:pointer;
  font-weight: 600;
  transition: background 0.2s ease;
}
#chat-send:hover{
  background: #189d8d;
}

/* Mobile: bottom sheet */
@media (max-width: 900px){
  #chat-panel{
    left: 12px;
    right: 12px;
    width: auto;
    top: auto;
    height: 55vh;
    bottom: 46px; /* above disclaimer bar */
    transform: translateY(0);
  }
  #chat-panel.chat-closed{
    transform: translateY(calc(100% + 56px));
  }
  /* Pad composer so Send button clears the accessibility widget */
  .chat-composer {
    padding-right: 8px;
  }
  #chat-fab{
    right: 12px;
    bottom: 48px;
  }
  #chat-maximize{
    display: none;
  }
}
.chat-bubble.typing .dots {
  display: flex;
  gap: 6px;
  align-items: center;
}

.chat-bubble.typing .dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(0,0,0,.45);
  display: inline-block;
  animation: typingDots 1.2s infinite ease-in-out;
}

.chat-bubble.typing .dots span:nth-child(2) { animation-delay: 0.15s; }
.chat-bubble.typing .dots span:nth-child(3) { animation-delay: 0.30s; }

@keyframes typingDots {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.35; }
  40% { transform: translateY(-4px); opacity: 1; }
}
.pdf-preview-card {
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 14px;
  padding: 12px 12px;
  cursor: pointer;
  user-select: none;
}

.pdf-preview-card:hover {
  border-color: rgba(255,255,255,0.35);
}

.pdf-preview-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.pdf-preview-sub {
  opacity: 0.85;
  font-size: 13px;
  margin-bottom: 10px;
}

.pdf-preview-open {
  font-weight: 600;
  font-size: 13px;
  opacity: 0.95;
}

/* ========= Mapbox Controls Repositioning ========= */
/* Move zoom controls to top-right, horizontally next to map/satellite toggle */
.mapboxgl-ctrl-top-right {
  display: flex;
  flex-direction: row !important;
  gap: 16px;
  top: 80px;
  right: 16px;
  padding: 8px;
}

.mapboxgl-ctrl-group {
  margin: 4px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  border-radius: 4px;
}

/* Make zoom controls horizontal */
.mapboxgl-ctrl-zoom-in,
.mapboxgl-ctrl-zoom-out {
  width: 36px;
  height: 36px;
}
/* ========= RESPONSIVE DESIGN ========= */

/* Large screens (1400px+) - Default styles work well */

/* Medium-Large screens (1200px - 1400px) */
@media (max-width: 1400px) {
  .app-header {
    padding: 0 16px;
  }

  .header-subtitle {
    display: none; /* Hide subtitle on medium screens */
  }

  #sidebar {
    width: 300px; /* Reduce from 340px */
  }
}

/* Medium screens (900px - 1200px) - Tablets, small laptops */
@media (max-width: 1200px) {
  .app-header {
    height: 56px;
    padding: 0 12px;
  }

  #map {
    top: 56px;
  }

  .header-logo img {
    width: 32px;
    height: 32px;
  }

  .header-title {
    font-size: 13px;
  }

  .header-nav {
    gap: 8px;
  }

  .header-nav-link {
    font-size: 12px;
    padding: 6px 10px;
  }

  /* Sidebar adjustments */
  #sidebar {
    width: 280px;
    padding: 16px 12px;
  }

  .sidebar-title {
    font-size: 16px;
  }

  .score-circle {
    width: 60px;
    height: 60px;
    font-size: 20px;
  }

  /* Metrics - keep 3 columns but smaller */
  .metrics-list {
    gap: 5px;
  }

  .metric-gauge {
    width: 40px;
    height: 40px;
  }

  .metric-name {
    font-size: 10px;
  }

  /* Chat panel */
  #chat-panel {
    width: 35%;
    min-width: 280px;
  }
}

/* Small-Medium screens (700px - 900px) - Large phones, small tablets */
@media (max-width: 900px) {
  .app-header {
    height: 52px;
    padding: 0 10px;
    flex-wrap: wrap;
  }

  #map {
    top: 52px;
  }

  .header-subtitle {
    display: none;
  }

  .header-nav {
    gap: 6px;
  }

  .header-nav-link {
    font-size: 11px;
    padding: 5px 8px;
  }

  /* Hide some nav items on smaller screens */
  .header-nav-link:nth-child(n+4) {
    display: none;
  }

  /* Sidebar - narrower */
  #sidebar {
    width: 260px;
    padding: 14px 10px;
  }

  .sidebar-title {
    font-size: 15px;
  }

  .sidebar-subtitle {
    font-size: 11px;
  }

  .score-circle {
    width: 55px;
    height: 55px;
    font-size: 18px;
    border: 4px solid #1db7a6;
  }

  .score-circle-labels {
    font-size: 10px;
  }

  .score-circle-labels span.strong {
    font-size: 12px;
  }

  /* Metrics - switch to 2 columns */
  .metrics-list {
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
  }

  .metric-row {
    padding: 5px 3px 3px;
  }

  .metric-gauge {
    width: 38px;
    height: 38px;
  }

  .metric-gauge svg {
    width: 38px;
    height: 38px;
  }

  .metric-gauge-value {
    font-size: 10px;
  }

  .metric-name {
    font-size: 8px;
  }

  /* History section - even more compact */
  .history-section {
    max-height: 100px;
  }

  .history-list {
    max-height: 80px;
  }

  .history-item {
    padding: 4px 6px;
  }

  .history-item-score {
    width: 24px;
    height: 24px;
    font-size: 9px;
  }

  .history-item-address {
    font-size: 9px;
  }

  .history-item-coords {
    font-size: 7px;
  }

  /* Search container */
  .search-container {
    width: 280px;
  }

  /* Map controls */
  .mapboxgl-ctrl-top-right {
    top: 68px;
    right: 10px;
    gap: 10px;
  }

  /* Chat panel - already has mobile styles */
  #chat-fab {
    left: auto;
    right: 12px;
    bottom: 48px;
    transform: none;
  }
}

/* Small screens (500px - 700px) - Phones landscape */
@media (max-width: 700px) {
  .app-header {
    height: 48px;
    padding: 0 10px;
  }

  #map {
    top: 48px;
  }

  .header-subtitle {
    display: none;
  }

  .header-logo img {
    width: 30px;
    height: 30px;
  }

  .header-title {
    font-size: 12px;
  }

  /* Hide desktop nav, show hamburger */
  .header-nav {
    display: none;
  }

  #nav-hamburger {
    display: flex;
  }

  #mobile-nav-drawer {
    display: flex;
    top: 48px;
  }

  /* Logo — keep it readable on mobile */
  .header-logo img {
    width: auto;
    height: 32px;
  }

  .header-title {
    font-size: 14px;
  }

  /* "What We Measure" — 2 columns to cut height in half */
  .environmental-icons {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 12px 0;
  }

  .environmental-icon-item {
    padding: 10px;
  }

  .environmental-icon-item > div:first-child {
    width: 36px !important;
    height: 36px !important;
    font-size: 18px !important;
    flex-shrink: 0;
  }

  /* Sidebar — bottom sheet on mobile */
  #sidebar {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 36px; /* above disclaimer bar */
    width: 100%;
    max-width: 100%;
    box-sizing: border-box; /* prevent padding from causing overflow */
    max-height: 62vh;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.2);
    padding: 0 16px 72px; /* extra bottom padding clears UserWay widget */
    transform: translateY(calc(100% - 52px)); /* collapsed: peek 52px handle strip */
    transition: transform 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain; /* prevent scroll from bubbling to page */
    z-index: 150;
  }

  #sidebar.collapsed {
    transform: translateY(calc(100% - 52px)); /* peek strip visible */
  }

  #sidebar:not(.collapsed) {
    transform: translateY(0);
  }

  /* Show drag handle (full-width touch target), hide arrow toggle */
  .sidebar-handle {
    display: flex;
    touch-action: pan-y; /* allow vertical swipe through the handle */
  }

  .sidebar-toggle {
    display: none !important;
  }

  /* Metrics — horizontal scroll row inside the bottom sheet */
  .metrics-list {
    display: flex !important;
    flex-direction: row !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scrollbar-width: none !important; /* Firefox */
    gap: 8px !important;
    padding-bottom: 4px;
  }

  .metrics-list::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
  }

  .metric-row {
    flex: 0 0 auto !important;
    width: 64px !important;
    align-items: center;
  }

  /* History — no max-height cap; sheet itself scrolls */
  .history-section {
    max-height: none !important;
  }

  .history-list {
    max-height: none !important;
  }

  /* Score section — horizontal layout to save vertical space */
  .score-circle-wrapper {
    flex-direction: row;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
  }

  .score-circle {
    width: 56px;
    height: 56px;
    font-size: 18px;
    flex-shrink: 0;
  }

  .sidebar-title {
    font-size: 14px;
  }

  .sidebar-subtitle {
    font-size: 10px;
  }

  .score-circle {
    width: 52px;
    height: 52px;
    font-size: 17px;
    border: 3px solid #1db7a6;
  }

  .score-circle-wrapper {
    gap: 10px;
    margin-bottom: 12px;
  }

  .score-circle-labels {
    font-size: 10px;
  }

  .score-circle-labels span.strong {
    font-size: 12px;
  }

  .generate-pdf-btn {
    padding: 4px 7px;
    font-size: 10px;
    gap: 3px;
  }

  .generate-pdf-btn svg {
    width: 11px;
    height: 11px;
  }

  /* Metrics - 3 columns */
  .metrics-list {
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
  }

  .metric-gauge {
    width: 36px;
    height: 36px;
  }

  .metric-gauge svg {
    width: 36px;
    height: 36px;
  }

  .metric-gauge-value {
    font-size: 9px;
  }

  .metric-name {
    font-size: 8px;
    text-align: center;
  }

  /* History */
  .history-section {
    max-height: 90px;
  }

  .history-section.collapsed {
    max-height: 26px;
  }

  .history-list {
    max-height: 66px;
  }

  .history-title {
    font-size: 10px;
  }

  .history-toggle {
    width: 22px;
    height: 22px;
  }

  .history-toggle svg {
    width: 12px;
    height: 12px;
  }

  .history-item {
    padding: 4px 6px;
    gap: 6px;
  }

  .history-item-score {
    width: 24px;
    height: 24px;
    font-size: 9px;
  }

  .history-item-address {
    font-size: 10px;
  }

  .history-item-coords {
    font-size: 7px;
  }

  /* Search — sidebar is now a bottom sheet so it doesn't block the left side */
  .search-container {
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: calc(100vw - 32px) !important;
    max-width: 480px !important;
    top: 58px !important;
    z-index: 8 !important;
  }

  .search-input {
    font-size: 13px;
    padding: 10px 14px;
  }

  /* Map controls */
  .mapboxgl-ctrl-top-right {
    top: 58px;
    right: 8px;
    gap: 8px;
    padding: 4px;
  }

  .mapboxgl-ctrl-zoom-in,
  .mapboxgl-ctrl-zoom-out {
    width: 32px;
    height: 32px;
  }

  /* Hide popups on smaller screens */
  .mapboxgl-popup {
    display: none !important;
  }
}

/* Extra small screens (max 500px) - Phones portrait */
@media (max-width: 500px) {
  /* Disclaimer bar — prevent text overflow on narrow screens */
  #disclaimer-bar {
    font-size: 10px;
    gap: 8px;
    overflow: hidden;
    white-space: nowrap;
  }

  #disclaimer-bar span {
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }

  /* Header - more compact */
  .app-header {
    height: 50px;
    padding: 0 8px;
    justify-content: space-between;
  }

  #map {
    top: 50px;
  }

  .header-logo {
    gap: 8px;
    flex-shrink: 0;
  }

  .header-logo img {
    height: 30px;
    width: auto;
  }

  .header-title {
    font-size: 13px;
  }

  .header-subtitle {
    display: none;
  }

  .header-nav {
    gap: 4px;
    flex-shrink: 0;
  }

  /* Show only 2 nav items */
  .header-nav-link:nth-child(n+3) {
    display: none;
  }

  .header-nav-link {
    font-size: 10px;
    padding: 5px 8px;
  }

  /* Sidebar — inherits bottom sheet from 700px breakpoint, minor tweaks */
  #sidebar {
    max-height: 55vh;
  }

  .score-circle-wrapper {
    gap: 12px;
    margin-bottom: 10px;
  }

  /* Search — sidebar is a bottom sheet so always center search */
  .search-container {
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: calc(100vw - 24px) !important;
    max-width: 420px !important;
    top: 58px !important;
    z-index: 8 !important;
  }

  .search-input {
    font-size: 13px;
    padding: 10px 14px;
  }

  /* Mapbox controls - smaller, positioned to avoid overlaps */
  .mapboxgl-ctrl-top-right {
    top: 60px;
    right: 8px;
  }

  .mapboxgl-ctrl-zoom-in,
  .mapboxgl-ctrl-zoom-out {
    width: 30px !important;
    height: 30px !important;
    font-size: 16px !important;
  }

  /* Hide marker popups on small screens - show only in sidebar */
  .mapboxgl-popup {
    display: none !important;
  }

  /* Info sidebar - full width on mobile */
  #info-sidebar {
    width: 100%;
    max-width: none;
  }

  /* Chat FAB - move to left so it doesn't clash with accessibility widget (bottom-right) */
  #chat-fab {
    left: 12px;
    right: auto;
    bottom: 46px;
    transform: translateX(0);
    font-size: 12px;
    padding: 8px 12px;
    gap: 6px;
    border-radius: 14px;
  }

  #chat-fab svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
  }

  #chat-panel {
    width: 100%;
    max-width: 100%;
  }

  /* Info sidebar - tighter inner padding on mobile, bottom pad clears disclaimer bar */
  .info-sidebar-content {
    padding: 0 12px 48px;
  }

  .team-member {
    flex-direction: column;
    gap: 12px;
  }

  .team-member-photo {
    width: 72px;
    height: 72px;
  }

  .partners-image {
    max-width: 100%;
  }

  #mobile-nav-drawer {
    top: 50px;
  }
}

/* Landscape orientation adjustments for phones */
@media (max-height: 500px) and (orientation: landscape) {
  .app-header {
    height: 40px;
  }

  #map {
    top: 40px;
  }

  #sidebar {
    padding: 8px 6px;
  }

  .score-circle {
    width: 40px;
    height: 40px;
    font-size: 13px;
  }

  .score-circle-wrapper {
    margin-bottom: 8px;
  }

  .metrics-list {
    gap: 2px;
  }

  .history-section {
    max-height: 60px;
  }

  .history-list {
    max-height: 40px;
  }

  /* Chat panel — shorter in landscape so map remains visible */
  #chat-panel {
    height: 45vh;
  }

  /* Modals — shorter in landscape */
  .report-modal,
  #info-sidebar {
    max-height: 80vh;
  }
}

/* ========= Disclaimer Bar ========= */
#disclaimer-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 36px;
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(15, 20, 30, 0.92);
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 200;
  backdrop-filter: blur(4px);
  letter-spacing: 0.01em;
}

#disclaimer-bar a {
  color: #1db7a6;
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}

#disclaimer-bar a:hover {
  text-decoration: underline;
}

/* ========= Chat Panel Disclaimer ========= */
.chat-disclaimer {
  padding: 7px 14px;
  font-size: 10.5px;
  color: #999;
  text-align: center;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  background: rgba(255, 255, 255, 0.6);
  flex-shrink: 0;
}

/* ========= Terms of Service Modal ========= */
#tos-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 25, 0.75);
  backdrop-filter: blur(6px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

#tos-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.tos-modal {
  background: #fff;
  border-radius: 16px;
  padding: 36px 40px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tos-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.tos-logo img {
  height: 28px;
}

.tos-logo span {
  font-size: 13px;
  color: #777;
  font-weight: 500;
}

.tos-modal h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: #1a1a1a;
}

.tos-modal p {
  margin: 0;
  font-size: 14px;
  color: #555;
  line-height: 1.6;
}

.tos-modal p a {
  color: #1db7a6;
  font-weight: 600;
  text-decoration: none;
}

.tos-modal p a:hover {
  text-decoration: underline;
}

.tos-note {
  background: #f5f7fb;
  border-left: 3px solid #1db7a6;
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
  font-size: 13px !important;
  color: #666 !important;
}

.tos-check-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: #333;
  line-height: 1.4;
}

.tos-check-label input[type="checkbox"] {
  width: 17px;
  height: 17px;
  margin-top: 1px;
  flex-shrink: 0;
  accent-color: #1db7a6;
  cursor: pointer;
}

#tos-accept-btn {
  padding: 13px 20px;
  background: #1db7a6;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, opacity 0.2s ease;
  margin-top: 4px;
}

#tos-accept-btn:disabled {
  background: #b0b0b0;
  cursor: not-allowed;
  opacity: 0.7;
}

#tos-accept-btn:not(:disabled):hover {
  background: #189d8d;
}

@media (max-width: 500px) {
  .tos-modal {
    padding: 24px 20px;
  }

  .tos-modal h2 {
    font-size: 18px;
  }
}
