:root {
  --brand-bg: #0f172a; /* slate-900 */
  --brand-surface: #111827; /* gray-900 */
  --brand-accent: #38bdf8; /* sky-400 */
  --brand-accent-strong: #0ea5e9; /* sky-500 */
  --text: #e5e7eb; /* gray-200 */
  --muted: #9ca3af; /* gray-400 */
  --ring: 2px;
}

html, body {
  background: var(--brand-bg);
  color: var(--text);
  font-family: "IBM Plex Sans", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  margin: 0;
  padding: 0;
  overflow: hidden; /* Prevent scrollbars */
}

/* Loading screen */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--brand-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20000; /* Above everything including header (10001) */
  transition: opacity 0.5s ease-out;
}

.loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Password prompt overlay */
.password-prompt-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--brand-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10001; /* Above loading screen */
}

.password-prompt-box {
  background: var(--brand-surface);
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  min-width: 350px;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.password-prompt-title {
  color: var(--text);
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 20px;
  text-align: center;
}

.password-prompt-box .form-group {
  width: 100%;
  margin-bottom: 0;
}

.password-prompt-box input[type="password"] {
  width: 100%;
  padding: 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: var(--text);
  font-size: 16px;
}

.password-prompt-box input[type="password"]:focus {
  outline: none;
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.password-submit-btn {
  background: var(--brand-accent);
  color: var(--brand-bg);
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.password-submit-btn:hover {
  background: var(--brand-accent-strong);
}

.password-error {
  text-align: center;
  font-size: 14px;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(56, 189, 248, 0.2);
  border-top: 4px solid var(--brand-accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

.loading-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.loading-logo {
  height: 40px;
  width: auto;
  display: block;
}

.loading-title {
  font-size: 54px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text);
  margin-left: 20px;
  line-height: 1;
  transform: translateY(-3px); /* try -2px or -3px to move text up */
}

.loading-message {
  color: var(--text);
  font-size: 34px;
  font-weight: 500;
  text-align: center;
  margin-bottom: 10px;
}

/* Password section on loading screen */
#password-section {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#password-input-row {
  width: 100%;
}

#password-section .form-group {
  width: 100%;
  margin-bottom: 0;
}

#password-section input[type="password"] {
  width: 100%;
  padding: 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: var(--text);
  font-size: 16px;
}

#password-section input[type="password"]:focus {
  outline: none;
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.password-submit-btn {
  background: var(--brand-accent);
  color: var(--brand-bg);
  border: none;
  padding: 12px 20px;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
  height: fit-content;
}

.password-submit-btn:hover {
  background: var(--brand-accent-strong);
}

#loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.loading-subtitle {
  color: var(--muted);
  font-size: 28px;
  text-align: center;
  width: 100%;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.app-container {
  display: grid;
  grid-template-columns: 0 1fr; /* hide structural sidebar column; we overlay sidebar absolutely */
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "header header"
    "main main";
  height: 100vh;
  position: relative;
}

/* Solid white left-hand column under the header, full viewport height */
.app-container::before {
  content: "";
  position: fixed;
  top: 60px;   /* header height */
  left: 0;
  bottom: 0;
  width: 260px;  /* covers LHS buttons + legend area */
  background: #FFFFFF;
  z-index: 1500; /* above map (z=2), below panels/buttons (z~2000) */
}

/* Full-canvas map behind the UI */
#map_canvas, #map_main {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 2;
  overflow: hidden;
}

.lhs-floating {
  position: fixed;
  left: 5px;
  top: 78px;
  bottom: 0;
  width: 230px;
  background: #DCE0E7;
  border-radius: 0;
  border: none;
  box-shadow: none;
  padding: 10px;
  z-index: 1990; /* sit behind legend and other overlays */
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden; /* constrain children so inner panels can scroll */
}

/* Stack the dynamic left buttons vertically */
#lhs_ui {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 4px;  /* add a little breathing room under the header */
}

.lhs-floating .btn:not(.button-pill) { display: none; }
.lhs-floating .button-pill {
  display: flex;
  width: 100%;
  max-width: 210px;       /* align with legend/sites inner width */
  height: 36px;
  margin: 0 auto;         /* centre within LHS column */
}

/* Ensure custom Story 1 buttons are visible inside lhs-floating */
.lhs-floating .story1-toggle-btn,
.lhs-floating .story1-sub-btn {
  display: flex;
}

.sidebar .btn.active, .sidebar .btn:focus, .sidebar .btn:hover {
  color: var(--text);
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 var(--ring) rgba(56,189,248,0.25);
}

/* --- Top Trump: Profit Calculator sheet --- */
.site-info-sheet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}

.site-info-sheet-table td {
  padding: 3px 6px;
}

/* Column widths: bring figures closer to text column */
.site-info-sheet-table td:first-child {
  width: 40%;
  text-align: left;
}

.site-info-sheet-table td:nth-child(2),
.site-info-sheet-table td:nth-child(3) {
  width: 30%;
}

/* Centre align figure columns B and C */
.site-info-sheet-table td:nth-child(2),
.site-info-sheet-table td:nth-child(3) {
  text-align: center;
}

/* Input cell styling */
.site-info-input-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.site-info-input-prefix {
  font-weight: 600;
  color: #01061C; /* black prefix text */
}

.site-info-input-wrapper .form-group {
  margin-bottom: 0;
}

.site-info-input-wrapper input[type="number"] {
  background: rgba(15, 23, 42, 0.9); /* darker panel-style background */
  border: 1px solid rgba(148, 163, 184, 0.9); /* clearer border */
  border-radius: 4px;
  color: #f9fafb; /* near-white for strong contrast */
  font-family: inherit; /* match IBM Plex Sans used in the app */
  padding: 4px 6px;
  font-size: 13px;
  width: 80px;
  text-align: center; /* centre the numerics in the cell */
}

.site-info-input-wrapper input[type="number"]:focus {
  outline: none;
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.5);
}

/* Section gradient panels */
.site-info-section-1 td {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--status-color, #3272EA) 40%, white 60%) 0%,
    rgba(255, 255, 255, 0.4) 100%
  );
  color: #01061C; /* black text */
}

.site-info-section-2 td {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--status-color, #3272EA) 40%, white 60%) 0%,
    rgba(255, 255, 255, 0.4) 100%
  );
  color: #01061C; /* black text */
}

.site-info-section-3 td {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--status-color, #3272EA) 40%, white 60%) 0%,
    rgba(255, 255, 255, 0.4) 100%
  );
  color: #01061C; /* black text */
}

.site-info-section-4 td {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--status-color, #3272EA) 40%, white 60%) 0%,
    rgba(255, 255, 255, 0.4) 100%
  );
  color: #01061C; /* black text */
}

/* Emphasis rows */
.site-info-row-strong td {
  font-weight: 600;
}

/* Negative numbers */
.site-info-neg {
  color: #f97373;
}

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  padding: 10px 16px;
  border: none;
  z-index: 10001;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  gap: 20px;
}

/* Mask header shadow where it overlaps the solid white LHS strip so the join is seamless */
.header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 260px; /* same width as LHS white column */
  background: #FFFFFF;
  z-index: 1; /* above header background/shadow, below logo/text */
}

.app-branding,
.story-nav-container {
  position: relative;
  z-index: 2; /* ensure content sits above the shadow mask */
}

.app-branding {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0; /* reset gap, use margin on title instead for more control */
  margin-left: 20px;
}

.header-tabs {
  position: absolute;
  left: 60%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-wrap: nowrap;      /* prevent buttons from wrapping to a second row */
  white-space: nowrap;    /* keep buttons on one line even when narrow */
  gap: 8px;
}

.lhs-view-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}

.header-tab {
  min-height: 32px;
  padding: 4px 0;
  font-size: 11pt;
  min-width: 110px;   /* same visual width */
  justify-content: center;
  background-color: #DCE0E7;
  color: #000000;
  border-radius: 999px;
  border: none;
}

.header-tab.active {
  background-color: #55688B;
  color: #FFFFFF;
}

/* Companies filter dropdown panel (under header tabs) */
.company-filter-panel {
  position: fixed;
  top: 60px;            /* just below the 60px header */
  right: 20px;          /* align under the rightmost header tab (Companies) */
  transform: none;
  z-index: 12000;       /* above header (10001) and map controls */
  background: #FFFFFF;
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  padding: 10px 12px;
  min-width: 260px;
  max-width: 320px;
}

.company-filter-header {
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #4B5563;
  margin-bottom: 6px;
}

.company-filter-separator {
  height: 1px;
  background: #E5E7EB;
  margin: 6px 0;
}

.company-filter-list {
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.company-filter-item {
  width: 100%;
  justify-content: flex-start;
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 999px;
  background-color: #F3F4F6;
  color: #111827;
  border: none;
}

.company-filter-item.active {
  background-color: #55688B;
  color: #FFFFFF;
}

.company-filter-item:hover {
  background-color: #E5E7EB;
  cursor: pointer;
}

.headline-callout-overlay {
  z-index: 9000; /* above map canvas but below header (10001) */
}

.headline-callout-card {
  min-width: 140px;
  max-width: 220px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #102347;
  background: #FFFFFFF0;
  color: #102347;
  font-size: 11px;
  font-weight: 500;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  box-sizing: border-box;
}


.app-logo {
  height: 32px;
  width: auto;
  object-fit: contain;
}

.app-title {
  color: #01061C;
  font-size: 42px;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  line-height: 1.2;
  text-align: left;
  margin-left: 30px; /* explicit spacing between logo and title - adjust this value */
}

/* On narrower screens, stack logo and title vertically within the LHS area,
   keeping the overall header height the same but shrinking the branding block. */
@media (max-width: 1380px) {
  .app-branding {
    flex-direction: column;
    align-items: center;
    gap: 2px;
  }

  .app-logo {
    height: 26px;
  }

  .app-title {
    font-size: 32px;
    letter-spacing: 0.14em;
    margin-left: 0;
    text-align: center;
  }
}

/* Story navigation panel in header */
.story-nav-container {
  flex: 1;
  display: flex;
  justify-content: center;
}

.story-nav-panel {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.story-nav-btn {
  min-width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 999px !important;
  border: none !important;
  background: #01061C !important;
  color: #FFFFFF !important;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.story-nav-counter {
  font-size: 13px;
  font-weight: 600;
  color: #01061C;
  min-width: 48px;
  text-align: center;
}

.top-tabs {
  position: absolute;
  top: 10px;
  left: 300px; /* align with floating sidebar edge */
  display: flex;
  gap: 12px;
}

.top-tabs .tab-btn { display: none; }

.main {
  grid-area: main;
  padding: 16px;
  position: relative;
  z-index: 1;
}

.content-card {
  background: transparent; /* allow map canvas to show through */
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 12px;
}

/* Main content area for image/video/chart content above the map canvas */
.overlay {
  position: fixed;
  top: 86px;    /* Nudge below header (was 70px) so Table/List panels sit lower */
  left: 260px;  /* Start just to the right of the LHS (230px width + ~10px padding) */
  right: 0;
  bottom: 0;
  pointer-events: none; /* let clicks pass through unless on card */
  z-index: 3500; /* ensure table/overlay container sits above site overlay */
}
.overlay-card {
  position: relative;
  max-width: 80vw;
  max-height: 80vh;
  overflow: auto;
  background: rgba(255,255,255,0.92);
  border-radius: 0px;
  padding: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.35);
  pointer-events: auto;
  z-index: 3600; /* Above site overlay panel and other map overlays */
}

/* Full-area overlay card for main Table view (fills map area between header and edges) */
.overlay-card.overlay-card-full {
  max-width: 90vw;
  max-height: 90vh;
  width: auto;
  height: auto;
  background: #FFFFFF;
  box-shadow: 0 4px 24px rgba(0,0,0,0.35);
  border-radius: 12px;
  padding: 12px;
  overflow: auto;
}

/* List view overlay card: same rounded corners as table panel */
.overlay-card.overlay-card-list {
  border-radius: 12px;
}

/* (Map/Table tabs now just change routes; overlay retains its standard positioning above map) */

/* List view: multi-row-per-site table */
.site-list-wrapper {
  margin-top: 12px;
  overflow-x: auto;
}
.site-list-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed; /* keep all columns on a fixed proportional grid */
  font-family: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  font-size: 12pt;
  color: #01061C;
}
.site-list-table td {
  padding: 4px 12px;
  vertical-align: top;
  border: none;
}

/* Band each site block: light grey then white */
.site-list-table tr.site-list-block-odd td {
  background-color: #E5E7EB;
}
.site-list-table tr.site-list-block-even td {
  background-color: #FFFFFF;
}

/* First row of each site: status circle + site name (td stays table-cell so colspan spans) */
.site-list-table td.site-list-rowline-1 {
  padding: 24px 12px 6px;
  font-weight: 700;
}
.site-list-rowline-1-inner {
  display: flex;
  align-items: center;
}
.site-list-rowline-2 td,
.site-list-rowline-3 td,
.site-list-rowline-4 td {
  padding-top: 2px;
  padding-bottom: 2px;
}
.site-list-rowline-5 td {
  padding-top: 2px;
  padding-bottom: 12px;
}
.site-list-status-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  margin-right: 10px;
  flex-shrink: 0;
}
.site-list-status-letter {
  font-size: 14px;
  font-weight: 800;
  color: #FFFFFF;
  line-height: 1;
}
.site-list-site-name {
  font-size: 14pt;
  color: #01061C;
}
.site-list-label {
  font-weight: 600;
  color: #374151;
}
.site-list-data {
  color: #01061C;
}
.site-list-metric-label {
  font-weight: 600;
  color: #374151;
  padding-left: 4px !important;
  padding-right: 6px !important;
}
.site-list-metric-data {
  color: #01061C;
  padding-left: 4px !important;
  padding-right: 8px !important;
  text-align: center;
}
.site-list-spacer {
  width: 24px;
}
.site-list-commentary {
  font-size: 12pt;
  line-height: 1.45;
  color: #01061C;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Help panel (Ask Molior) should be above all other content panels */
.help-panel-card {
  z-index: 10000 !important; /* Above all other overlays but below loading/password screens */
}

/* Ensure the overlay wrapper containing the help panel also has high z-index */
.help-panel-overlay {
  z-index: 10000 !important;
}

.overlay:has(.help-panel-card),
.overlay .help-panel-card {
  z-index: 10000 !important;
}

/* Fallback for browsers that don't support :has() */
.overlay > .help-panel-card {
  z-index: 10000 !important;
}

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

/* Apply fade-in only when explicitly requested via JS helper */
.overlay-text-panel.overlay-fade-in {
  animation: overlayFadeIn 0.35s ease-out;
}
/* Shiny bindings alignment */
.shiny-input-container { color: var(--text); }
label { color: var(--muted); }

/* Imported look from other-project.html */
.button-pill {
  background-color: #DCE0E7;
  color: #000000;
  border-radius: 50px;
  border: none;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18);
  font-size: 10pt;
  font-family: "IBM Plex Sans", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-weight: 500;
  padding: 0 16px;
  margin: 5px;
  text-align: center;
  cursor: pointer;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  position: relative;
  z-index: 1001;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.button-pill.navy {
  background-color: #DCE0E7;
  color: #000000;
}

.button-pill:hover {
  background-color: #cfd4df;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.22);
}

.button-pill.active {
  background-color: #55688B;
  color: #FFFFFF;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.25);
}

/* Always style Map Reset as selected (white on blue) */
#btn_default {
  background-color: #55688B;
  color: #FFFFFF;
}
.button-pill:disabled { opacity: 0.55; cursor: not-allowed; animation: none; filter: grayscale(10%); }

.paired-tab-group .button-pill.paired-tab {
  border-radius: 0 !important;
  border-left-width: 1px;
  border-right-width: 1px;
}

.button-pill.paired-tab.paired-left {
  border-radius: 50px 0 0 50px !important;
}

.button-pill.paired-tab.paired-right {
  border-radius: 0 50px 50px 0 !important;
}

.button-pill.paired-tab.paired-middle {
  border-radius: 0 !important;
}

/* Button with dropdown arrow for location1 */
.button-pill-with-dropdown {
  display: flex;
  width: 100%;
  gap: 0;
  margin: 5px;
}

.button-pill-with-dropdown .button-pill {
  margin: 0;
  flex: 1;
}

.button-pill-dropdown {
  background-color: #DCE0E7;
  color: #000000;
  border: none;
  border-left: none;
  border-radius: 0 50px 50px 0;
  cursor: pointer;
  font-size: 10pt;
  padding: 0 12px;
  min-width: 36px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
  font-family: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  font-weight: 500;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.button-pill-dropdown:hover {
  background-color: #cfd4df;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.22);
}

.button-pill-dropdown.active {
  background-color: #55688B;
  color: #FFFFFF;
  border-color: #55688B;
}

/* CSS arrow for dropdown - right pointing */
.dropdown-arrow {
  display: inline-block;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 6px solid currentColor;
  vertical-align: middle;
}

/* Site selection panel - left-hand scrollable list */
.site-selection-panel {
  margin-top: 4px;
  background-color: #FFFFFF;
  border-radius: 8px;
  padding: 8px 10px;
  color: #01061C;
  box-shadow: none; /* flat, non-floating */
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  max-height: calc(100vh - 410px); /* account for extra controls above (legend + radar nav) */
  overflow: hidden; /* keep header/search fixed; list section handles scrolling */
}

.site-selection-header {
  background-color: #55688B;
  color: #FFFFFF;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.95;
  margin-bottom: 8px;
}

.site-selection-search {
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.site-search-input {
  width: 100%;
  padding: 6px 24px 6px 8px;
  border-radius: 4px;
  border: 1px solid #CBD2E1;
  font-size: 12px;
  box-sizing: border-box;
}

.site-search-clear {
  border: none;
  background: transparent;
  color: #6B7280;
  font-size: 12px;
  line-height: 1;
  padding: 0 4px;
  cursor: pointer;
}

.site-search-row,
.company-search-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.site-search-clear:hover {
  background: rgba(0, 0, 0, 0.6);
}

.site-selection-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.site-selection-item {
  display: block;
  color: #01061C;
  font-size: 13px;
  font-weight: 400;  /* normal weight for site names */
  padding: 6px 8px 6px 12px;
  text-decoration: none;
  transition: all 0.2s;
  font-family: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  border-left: 3px solid;
  border-radius: 4px;
  background-color: #FFFFFF; /* white slug background for readability */
  border: none;
  border-left: 3px solid;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

/* Enabled sites (in_use) - accent left border */
.site-selection-item.enabled {
  /* border-left-color set inline per site's dev status */
  cursor: pointer;
}

.site-selection-item.enabled:hover {
  background-color: rgba(1, 6, 28, 0.15);
  /* border-left-color preserved from inline style (dev status colour) */
  padding-left: 16px;
}

/* Disabled sites (not in_use) - navy left border, not clickable */
.site-selection-item.disabled {
  border-left-color: #01061C;
  cursor: not-allowed;
  opacity: 0.6;
  pointer-events: none;
}

.button-pill.paired-tab[data-pair-group]:not(.active) {
  background-color: #0C1228;
}

.paired-tab-group {
  display: inline-flex;
  gap: 0;
  margin: 5px;
  border-radius: 50px;
}

.paired-tab-group .button-pill {
  margin: 0;
}

.floating-buttons { display: flex; gap: 12px; width: 100%; justify-content: flex-start; flex-wrap: wrap; }
.floating-button { border-radius: 50px !important; border: 2px solid rgba(255, 255, 255, 0.5); padding: 0 20px; }

.floating-button.paired-tab { border-radius: 0 !important; }
.floating-button.paired-tab.paired-left { border-radius: 50px 0 0 50px !important; }
.floating-button.paired-tab.paired-right { border-radius: 0 50px 50px 0 !important; }
.floating-button.paired-tab.paired-middle { border-radius: 0 !important; }

/* Site details overlay panel (appears under top row, right of LHS buttons) */
.overlay-text-panel {
  position: fixed; /* anchor to viewport to avoid layout shifts */
  top: 95px; /* move down below top tabs */
  right: auto; /* anchor on the right to avoid LHS overlap */
  left: 275px;
  padding: 20px;
  background-color: rgba(255, 255, 255, 0.85); /* 85% opaque */
  border-radius: 10px;
  /* Card stroke is always dark navy, independent of ds status */
  border: 5px solid #01061C;
  z-index: 3000; /* above map controls (2000) and LHS (2000) and header (10001) */
  width: 30vw; /* Original width: left-hand Top Trump only */
  max-height: 88vh;         /* Original max height */
  overflow-y: hidden;       /* never show a vertical scrollbar */
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  transition: width 0.3s ease;
}

.overlay-text-panel.photo-expanded {
  width: 60vw; /* Wider when expanded: two equal halves like an open book */
}

.overlay-text-panel .developer {
  margin-top: 0;
  margin-bottom: 0px;
  font-size: 16pt;   /* larger for hierarchy */
  color: #C62828;    /* applicant/company in red */
  font-weight: 600;
  padding: 2px 6px;  /* tighter horizontal padding so it aligns closer to name */
  border-radius: 6px;
  /* Company band uses a lighter, subtle status-colour gradient */
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--status-color, #102347) 40%, white 60%) 0%,
    rgba(255, 255, 255, 0.4) 100%
  );
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.10);
}

.overlay-text-panel .site-name {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 16pt;   /* match company size */
  color: #01061C;    /* black text on status-colour gradient */
  font-weight: 600;
}

.overlay-text-panel .local-authority {
  font-size: 8pt;
  margin-top: 0;
  margin-bottom: 6px;
  color: #01061C;    /* black text on status-colour gradient */
}

.overlay-text-panel .site-name-row {
  display: flex;
  align-items: center;       /* vertically centre site + local authority */
  gap: 6px;
  padding: 4px 8px;          /* align left edge with company text */
  border-radius: 6px;
  /* Site name band uses a lighter, subtle status-colour gradient */
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--status-color, #102347) 40%, white 60%) 0%,
    rgba(255, 255, 255, 0.4) 100%
  );
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.10);
}

.overlay-text-panel .site-overlay-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

/* In full Top Trump mode, treat the main block as a 2-row grid:
   top-left = existing Top Trump, bottom-left = blank cell. */
.overlay-text-panel.full-top-trump .site-overlay-main {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 16px;
}

.overlay-text-panel.full-top-trump .site-overlay-main-cell {
  min-height: 0;
}

.overlay-text-panel.full-top-trump .site-overlay-main-blank-below {
  /* Match the visual style and gradient of the populated Top Trump area */
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--status-color, #102347) 40%, white 60%) 0%,
    rgba(255, 255, 255, 0.4) 100%
  );
  padding: 8px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* Commentary/description in the lower-left blank area */
.overlay-text-panel .site-overlay-commentary {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 8px;
  color: #01061C !important;
  font-size: 13pt;   /* in-between size */
  font-weight: 600;
  line-height: 1.4;
  text-align: left;
}

.overlay-text-panel .site-overlay-commentary p {
  margin: 0;
  line-height: 1.4;
  color: #01061C !important;
}

.overlay-text-panel .site-overlay-commentary ul {
  margin: 8px 0;
  padding-left: 20px;
  list-style-type: disc;
  color: #01061C !important;
}

.overlay-text-panel .site-overlay-commentary li {
  margin: 4px 0;
  line-height: 1.4;
  color: #01061C !important;
}

.overlay-text-panel .site-overlay-info-column {
  flex: 1; /* Default: take all available width when photo panel is hidden */
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  position: relative;
  box-sizing: border-box;
}

/* When expanded, split overlay content into two visually equal halves without causing overflow */
.overlay-text-panel.photo-expanded .site-overlay-info-column {
  flex: 1 1 0;
}

.overlay-text-panel .site-overlay-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.overlay-text-panel .site-overlay-body {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.overlay-text-panel .site-overlay-photo-inline-frame {
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 26vh;          /* allow image to shrink on very short viewports */
  border-radius: 10px;
  margin: 4px 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Background frame uses a lighter, subtle status-colour gradient */
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--status-color, #102347) 40%, white 60%) 0%,
    rgba(255, 255, 255, 0.4) 100%
  );
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.10);
}

.overlay-text-panel .site-overlay-photo-inline-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.overlay-text-panel .site-overlay-stats {
  margin-top: 0px;
}

.overlay-text-panel .site-overlay-stats-3col {
  display: flex;
  gap: 8px;  /* reduced gap to prevent overhang */
  width: 100%;
  margin: 8px 0 4px 0;
  align-items: stretch;
}

.overlay-text-panel .site-overlay-stats-3col .stats-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;  /* include padding/border in width calculation */
}

.overlay-text-panel .site-overlay-stats-3col .stats-col-labels {
  flex: 0 0 calc(50% - 4px);  /* stats (labels + values) take 50% minus half gap */
}

.overlay-text-panel .site-overlay-stats-3col .stats-col-values {
  display: none;  /* values are now inside stats-row, not separate column */
}

.overlay-text-panel .site-overlay-stats-3col .stats-col-status {
  flex: 0 0 calc(50% - 4px);  /* DS circle panel takes the other 50% minus half gap */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;  /* move padding from inline style to CSS */
  border-radius: 6px;
  /* Status panel behind the circle uses the same lighter, subtle status-colour gradient */
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--status-color, #102347) 40%, white 60%) 0%,
    rgba(255, 255, 255, 0.4) 100%
  );
  box-shadow: 0 2px 6px rgba(0,0,0,0.10);
}

.overlay-text-panel .site-overlay-stats-3col .stats-label {
  font-size: 10pt;
  font-weight: 600;
  color: #01061C;      /* black text on status-colour stat rows */
  margin: 1px 0;
}

.overlay-text-panel .site-overlay-stats-3col .stats-value {
  font-size: 10pt;
  font-weight: 600;
  color: #01061C;      /* black text on status-colour stat rows */
  margin: 1px 0;
}

.overlay-text-panel .site-overlay-stats-3col .status-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
  background: transparent;
  box-shadow: none;
}

.overlay-text-panel .site-overlay-stats-3col .stats-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 2px 6px;      /* tighter vertical and horizontal spacing */
  margin-bottom: 2px;    /* pack rows closer together */
  border-radius: 6px;
  /* Stat rows use a lighter, subtle status-colour gradient */
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--status-color, #102347) 40%, white 60%) 0%,
    rgba(255, 255, 255, 0.4) 100%
  );
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.10);
}

.overlay-text-panel .site-overlay-stats-3col .status-badge-circle {
  width: 48px;  /* much larger circle */
  height: 48px;
  border-radius: 50%;
  border: 3px solid #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
}

.overlay-text-panel .site-overlay-stats-3col .status-badge-letter {
  font-size: 20pt;  /* much larger letter */
  font-weight: 800;
  color: #FFFFFF; /* white letter inside coloured circle */
}

.overlay-text-panel .site-overlay-stats-3col .status-badge-name {
  font-size: 10pt;  /* same size as stats font */
  font-weight: 600;
  color: #01061C; /* keep black */
  text-align: center;
}

.overlay-text-panel .site-overlay-description {
  flex: 2;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 12px;      /* a little more separation from stats/status */
  padding: 8px 10px;
  border-radius: 6px;
  /* Match the modified DS colour treatment: subtle gradient fading to light */
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--status-color, #102347) 40%, white 60%) 0%,
    rgba(255, 255, 255, 0.4) 100%
  );
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.10);
}

/* Ensure description text in the Top Trump panel is black, matching DS text */
.overlay-text-panel .site-overlay-description,
.overlay-text-panel .site-overlay-description p,
.overlay-text-panel .site-overlay-description ul,
.overlay-text-panel .site-overlay-description li {
  color: #01061C;
  font-size: 10pt;    /* match stats font size */
  font-weight: 600;   /* match stats weight */
}

/* Style bullet lists in description */
.overlay-text-panel .site-overlay-description ul {
  margin: 8px 0;
  padding-left: 20px;
  list-style-type: disc;
}

.overlay-text-panel .site-overlay-description li {
  margin: 4px 0;
  line-height: 1.4;
}

.overlay-text-panel .site-overlay-description p {
  margin: 8px 0;
  line-height: 1.4;
}

.overlay-text-panel .site-overlay-description p:first-child {
  margin-top: 0;
}

.overlay-text-panel .description-v2 {
  margin: 0;
  font-size: 11pt;
  font-weight: normal;
  color: #01061C;  /* ensure black text */
  display: block;
}

.overlay-text-panel .description-v2,
.overlay-text-panel .description-v2 p,
.overlay-text-panel .description-v2 ul,
.overlay-text-panel .description-v2 li {
  font-size: 11pt;
  font-weight: normal;
  margin: 0;
}

.overlay-text-panel .description-v2 ul {
  margin: 8px 0;
  padding-left: 20px;
}

.overlay-text-panel .description-v2 li {
  margin: 4px 0;
}

.overlay-text-panel button.popup-close:hover {
  background: #f0f0f0;
  color: red;
}

.overlay-text-panel .site-overlay-content {
  display: flex;
  gap: 24px;
  align-items: stretch;
  flex: 1;
  min-height: 0;
  width: 100%;
  box-sizing: border-box;
}

/* In full Top Trump mode, make the two columns (left + right) share full height so
   the bottom of the left blank panel aligns with the bottom of the right panel. */
.overlay-text-panel.full-top-trump .site-overlay-content {
  align-items: stretch;
}

.overlay-text-panel .site-overlay-photo-panel {
  display: none;           /* hidden until expanded */
  flex: 1 1 0;             /* When visible, share space evenly with left column */
  min-width: 0;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
  /* Match the Top Trump gradient so visible areas behind media retain the same look */
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--status-color, #102347) 40%, white 60%) 0%,
    rgba(255, 255, 255, 0.4) 100%
  );
  flex-direction: column; /* stack tabs above content */
}

.overlay-text-panel.photo-expanded .site-overlay-photo-panel {
  display: flex;
}

/* Blank areas used when full Top Trump mode is enabled */
.overlay-text-panel .site-overlay-photo-blank {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  border-radius: 20px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--status-color, #102347) 40%, white 60%) 0%,
    rgba(255, 255, 255, 0.4) 100%
  );
}

.overlay-text-panel .site-extra-tabs {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 16px; /* symmetric vertical padding for better centering */
  /* Solid navy header bar for Profit Calculator */
  background: #01061C;
  box-shadow: none;
  border-radius: 10px 10px 0 0;
}

.overlay-text-panel .site-extra-tab {
  flex: 0;
  text-align: center;
  font-size: 11pt;
  font-weight: 600;
  color: #FFFFFF;
  padding: 0;
  line-height: 1.2;
  transform: translateY(-1px); /* tiny visual nudge to centre text in the bar */
  border-radius: 0;
  background: transparent;
  border: none;
}

.overlay-text-panel .site-extra-tab.active {
  background: transparent;
  color: #FFFFFF;
  border: none;
}

.overlay-text-panel .site-extra-content {
  flex: 1;
  padding: 14px 16px;
  background: #FFFFFF;  /* clean white content panel */
  border-radius: 0 10px 10px 10px;  /* join to tabs at top */
  border: 1px solid rgba(15, 23, 42, 0.15);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08); /* very slight uplift */
  font-size: 10.5pt;
  color: #01061C;
}

.overlay-text-panel .site-extra-content h4 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 11pt;
  font-weight: 700;
}

.overlay-text-panel .site-overlay-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding-top: 8px;
}

.overlay-text-panel .site-overlay-footer-right {
  margin-left: auto;
  display: flex;
  align-items: center;
}

.overlay-text-panel .site-overlay-photo-toggle {
  /* Match the close button style: small, circular, dark grey */
  width: 20px;
  height: 20px;
  border: none;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  font-size: 12px;
  font-weight: 600;
  border-radius: 50%;
  cursor: pointer;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

.overlay-text-panel .site-overlay-photo-toggle:hover {
  background-color: #1A1F3D;              /* same hover behaviour as .button-pill */
  box-shadow: 0 0 15px rgba(1, 6, 28, 0.8), 0 0 30px rgba(1, 6, 28, 0.6);
}

/* Pricing Tool Styles */
.pricing-tool-container {
  display: flex;
  gap: 12px;            /* tighter gap between sidebar and content */
  width: 100%;
  min-height: 55vh;     /* grow with viewport height */
}

.pricing-tool-sidebar {
  /* Fixed, narrow sidebar so chart/table get maximum width */
  flex: 0 0 160px;        /* slightly narrower fixed basis */
  min-width: 150px;
  max-width: 180px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 8px;
  align-self: stretch;    /* use full vertical space of container */
}

/* Checkbox styling for pricing tool */
.checkbox-group {
  margin-top: -7px;
  margin-bottom: 12px;
  text-align: left;
  background-color: rgba(255, 255, 255, 0.9);
  padding: 10px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.checkbox-group h3 {
  font-size: 11pt;
  font-weight: bold;
  color: #01061C;
  margin-bottom: 8px;
  padding: 4px 8px;
  background-color: rgba(70, 198, 145, 0.1);
  border-radius: 5px;
  border-left: 3px solid #46C691;
}

.checkbox-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin: 6px 0;
  padding: 4px 6px;
  border-radius: 5px;
  transition: background-color 0.2s ease;
}

.checkbox-item:hover {
  background-color: rgba(70, 198, 145, 0.05);
}

.checkbox-item input[type="checkbox"],
.checkbox-item input[type="radio"] {
  margin-right: 10px;
  transform: scale(1.1);
  accent-color: #01061C;
  cursor: pointer;
}

.checkbox-item label {
  font-size: 9.5pt;
  line-height: 1.2;
  color: #01061C;
  cursor: pointer;
  font-weight: 500;
  text-align: left;
  margin-left: 0;
  padding-left: 0;
}

.price-type-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.price-type-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

.price-type-dot.price-type-asking {
  background-color: #46C691;
}

.price-type-dot.price-type-achieved {
  background-color: #3272EA;
}

.price-type-dot.price-type-resale {
  background-color: #F29900;
}

.checkbox-item input[type="checkbox"]:checked + label,
.checkbox-item input[type="radio"]:checked + label {
  color: #01061C;
  font-weight: bold;
}

.checkbox-item input[type="checkbox"]:checked,
.checkbox-item input[type="radio"]:checked {
  animation: checkboxPulse 0.3s ease-in-out;
}

@keyframes checkboxPulse {
  0% { transform: scale(1.1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1.1); }
}

.pricing-tool-content {
  flex: 1;
  min-width: 0;
  padding: 16px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 8px;
}

.pricing-tool-chart-placeholder,
.pricing-tool-table-placeholder {
  display: none; /* Hide placeholder when content is rendered */
}

.pricing-tool-wrapper {
  width: 100%;
  margin-top: 16px;
}

/* Hide mapdeck legends (not using them anymore) */
.mapdeck-legend,
.deckgl-legend {
  display: none !important;
}

/* Custom legend panel - now sits directly under Map Reset button */
#map-legend {
  margin-top: 0px;
  padding-top: 0;
}

.radar-controls {
  margin-top: 6px;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  max-width: 210px;
}

.radar-toggle-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.radar-toggle-btn.is-active {
  background-color: #102347;
  color: #FFFFFF;
}

.radar-toggle-check {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  flex-shrink: 0;
}

.radar-toggle-check.is-checked::after {
  content: "";
  width: 7px;
  height: 7px;
  background: currentColor;
  border-radius: 1px;
}

.radar-toggle-label {
  line-height: 1;
  margin-left: 4px;
}

.radar-nav-inline {
  display: flex;
  align-items: center;
  width: 100%;
  justify-content: space-between;
  gap: 6px;
}

.radar-nav-btn {
  min-width: 42px;
  height: 24px !important;
  min-height: 24px !important; /* override global .button-pill min-height: 36px */
  justify-content: center;
  padding: 0 8px !important;
  margin: 0 !important;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

.radar-nav-count {
  min-width: 58px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: #01061C;
  background: #FFFFFF;
  border-radius: 999px;
  padding: 4px 8px;
}

.story1-controls {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.story1-toggle-btn {
  width: 100%;
  text-align: center;
}

.story1-toggle-btn.is-active {
  background-color: #102347;
  color: #FFFFFF;
}

.story1-sub-buttons {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}

.story1-sub-btn {
  width: 100%;
  max-width: 210px;
  justify-content: center;
}

.legend-panel {
  background-color: #FFFFFF;
  border-radius: 10px;
  border: none;
  padding: 4px 8px;
  box-shadow: none;
  font-family: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  width: auto;
  max-width: 210px;  /* align visually with sites panel (230px - 2*10px padding) */
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 1px;
  font-size: 12px;
  line-height: 1.4;
  transition: opacity 0.2s ease;
}

.legend-row.legend-clickable {
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background-color 0.2s ease, opacity 0.2s ease;
}

.legend-row.legend-clickable:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.legend-row.legend-active {
  opacity: 1;
}

.legend-row.legend-inactive {
  opacity: 0.4;
}

.legend-row.legend-clickable:hover {
  opacity: 0.8;
}

.legend-row.legend-clickable.legend-active:hover {
  opacity: 1;
}

.legend-circle {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border: 2px solid #FFFFFF;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.legend-letter {
  font-size: 13px;
  font-weight: 800;
  color: #FFFFFF;
  line-height: 1;
}

.legend-name {
  color: #01061C;
  font-weight: 500;
  flex: 1;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
}

/* Story 1 overlay panel - align similarly to Top Trump */
#story1-panel.story1-panel {
  position: fixed;
  top: 95px;              /* just below header, similar to Top Trump */
  left: 275px;            /* align with left edge of Top Trump overlay */
  width: calc(100% - 300px);
  padding: 16px;
  z-index: 3100;          /* above map controls (2000) and consistent with overlays */
}

.story1-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(100vh - 160px); /* scale down to stay within viewport */
  object-fit: contain;
  border-radius: 6px;
}

/* Ensure mapdeck/deck.gl tooltips render above header/LHS overlays */
.mapboxgl-popup { z-index: 6000; pointer-events: auto; }
.deckgl-tooltip, .mapdeck-tooltip { z-index: 6000; pointer-events: auto; }

/* Style mapdeck tooltips */
.mapdecktooltip {
  background: white !important;
  color: black !important;
  padding: 12px 16px !important;
  border: 3px solid #01061C !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
  font-family: "IBM Plex Sans", system-ui, -apple-system, sans-serif !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  z-index: 6000 !important;
  pointer-events: none !important;
  max-width: 250px !important;
  word-wrap: break-word !important;
}

/* Also target the specific ID */
#mapdecktooltipmap_main {
  background: white !important;
  color: black !important;
  padding: 12px 16px !important;
  border: 3px solid #01061C !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
  font-family: "IBM Plex Sans", system-ui, -apple-system, sans-serif !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  z-index: 6000 !important;
  pointer-events: none !important;
  max-width: 250px !important;
  word-wrap: break-word !important;
}

/* Responsive media styling for images and videos (fit nicely inside overlay card) */
.responsive-media {
  max-width: 100%;
  max-height: 60vh;  /* Prevent tall images from forcing scroll */
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Ensure video elements are properly sized and fit within their container */
.responsive-media[type="video"],
.overlay-card video.responsive-media {
  background: transparent; /* Match image/light background */
  max-height: 60vh; /* Limit video height to prevent overflow */
  width: 100%;
  height: auto;
}

/* Force hide video controls */
.overlay-card video.responsive-media::-webkit-media-controls {
  display: none !important;
}

.overlay-card video.responsive-media::-webkit-media-controls-panel {
  display: none !important;
}

.overlay-card video.responsive-media::-webkit-media-controls-play-button {
  display: none !important;
}

.overlay-card video.responsive-media::-webkit-media-controls-timeline {
  display: none !important;
}

.overlay-card video.responsive-media::-webkit-media-controls-current-time-display {
  display: none !important;
}

.overlay-card video.responsive-media::-webkit-media-controls-time-remaining-display {
  display: none !important;
}

.overlay-card video.responsive-media::-webkit-media-controls-mute-button {
  display: none !important;
}

.overlay-card video.responsive-media::-webkit-media-controls-volume-slider {
  display: none !important;
}

.overlay-card video.responsive-media::-webkit-media-controls-fullscreen-button {
  display: none !important;
}

/* Main content area styling */
.main-content-title {
  margin: 0 0 16px 0;
  font-size: 18px;
  font-weight: 600;
  color: #01061C;
  text-align: center;
}

.main-content-wrapper {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.main-content-description {
  flex: 0 0 200px; /* Fixed width for description */
  font-size: 16px;
  line-height: 1.6;
  color: #01061C;
  padding: 12px;
  background: rgba(255, 255, 255, 0.8);
}

.main-content-media {
  flex: 1; /* Takes remaining space */
  min-width: 0; /* Allows flex item to shrink */
}

/* Table styling */
.main-content-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.main-content-table th {
  background: #DCE0E7; /* Light grey header */
  color: #01061C;
  padding: 12px 8px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Sortable table header styles */
.sortable-header {
  position: relative;
  transition: background-color 0.2s ease;
}

.sortable-header:hover {
  background-color: #CDD4E0 !important;
}

.sortable-header-content {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.sortable-header-content .header-text {
  flex: 1;
  min-width: 0;
}

/* For center-aligned headers, center the content */
.sortable-header[style*="text-align: center"] .sortable-header-content {
  justify-content: center;
  position: relative;
}

.sortable-header[style*="text-align: center"] .sort-indicator {
  position: absolute;
  right: 8px;
}

.sort-indicator {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  opacity: 0.4;
  transition: opacity 0.2s ease;
  line-height: 1;
  font-size: 10px;
}

.sortable-header:hover .sort-indicator {
  opacity: 0.7;
}

.sortable-header[data-sort="asc"] .sort-indicator,
.sortable-header[data-sort="desc"] .sort-indicator {
  opacity: 1;
}

.sort-arrow {
  display: block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  transition: opacity 0.2s ease;
  margin: 0 auto;
}

.sort-arrow-up {
  opacity: 0;
  border-bottom: 5px solid white;
  border-top: none;
  margin-bottom: 2px;
}

.sort-arrow-down {
  opacity: 0;
  border-top: 5px solid white;
  border-bottom: none;
  margin-top: 2px;
}

.sortable-header[data-sort="asc"] .sort-arrow-up {
  opacity: 1;
}

.sortable-header[data-sort="asc"] .sort-arrow-down {
  opacity: 0;
}

.sortable-header[data-sort="desc"] .sort-arrow-up {
  opacity: 0;
}

.sortable-header[data-sort="desc"] .sort-arrow-down {
  opacity: 1;
}

.sortable-header[data-sort="none"] .sort-arrow-up,
.sortable-header[data-sort="none"] .sort-arrow-down {
  opacity: 0;
}

.main-content-table td {
  padding: 12px 8px;
  font-size: 13px;
  font-weight: 400;
  color: #01061C;
}

.main-content-table td:first-child {
  text-align: left;
}

.main-content-table td:not(:first-child) {
  text-align: center;
}

/* Site name column styling with dev status dot in the main table */
.table-site-name-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.table-status-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 700;
}

.table-site-name-text {
  white-space: nowrap;
}

/* Restore natural column behaviour for the pricing tool table */
.pricing-tool-table-wrapper .main-content-table {
  table-layout: auto;
}

.pricing-tool-table-wrapper .main-content-table td:first-child,
.pricing-tool-table-wrapper .main-content-table td:not(:first-child) {
  width: auto;
}

.main-content-table tbody tr:nth-child(odd) {
  background: #FCFCFC;
}

.main-content-table tbody tr:nth-child(even) {
  background: #F1F1F3;
}

.main-content-table tr:hover {
  background: #e0f2fe; /* Light blue on hover */
  transition: background-color 0.2s ease;
}

/* Table row animation */
.main-content-table tr {
  animation: slideInRow 0.6s ease-out forwards;
  opacity: 0;
  transform: translateX(-20px);
}

@keyframes slideInRow {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.pricing-tool-table-wrapper .main-content-table {
  font-size: 13px;
}

.pricing-tool-table-wrapper .main-content-table th {
  font-size: 11px;
}

.pricing-tool-table-wrapper .main-content-table td {
  font-size: 12px;
}

/* Pricing table sortable header styles */
.pricing-table-sortable {
  position: relative;
}

.pricing-table-sortable:hover {
  background-color: #1a1f3d !important;
}

.pricing-table-sortable .sortable-header-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
}

.pricing-table-sortable[style*="text-align: left"] .sortable-header-content {
  justify-content: flex-start;
}

.pricing-table-sortable .sort-indicator {
  margin-left: 4px;
}

.price-type-square {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  display: inline-block;
}

/* Close button for overlay content */
.overlay-close-btn {
  width: 20px;
  height: 20px;
  border: none;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  font-size: 12px;
  font-weight: 600;
  border-radius: 50%;
  cursor: pointer;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

/* List and Table overlay: close button top-right */
.overlay-card > .overlay-close-btn {
  position: absolute;
  top: 8px;
  right: 8px;
}

.overlay-close-btn:hover {
  background: rgba(0, 0, 0, 0.9);
}

.overlay-close-btn:active {
  background: rgba(0, 0, 0, 1);
}

/* Container for expand/collapse + close buttons in the top-right corner */
.overlay-top-buttons {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  align-items: center;
  z-index: 1100;
}

/* Photo carousel layout: center media, no stretch or crop */
.site-overlay-photo-carousel {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.site-photo-media {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: none;
}

.site-photo-media.is-active {
  display: block;
}

.site-photo-carousel-nav {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
}

.site-photo-carousel-btn {
  /* Large standalone arrows, no outline circles */
  width: auto;
  height: auto;
  border: none;
  background: transparent;
  color: #01061C; /* dark arrow */
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0 4px;
}

.site-photo-carousel-btn:hover {
  background: transparent;
  color: #000000;
}

/* Map controls in bottom right */
.map-controls-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  /* Sit above the map but below content/Top Trump panels */
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
}

.map-controls-row {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.map-control-btn {
  width: 40px;
  height: 40px;
  border: 2px solid #01061C;
  background-color: rgba(255, 255, 255, 0.9);
  color: #01061C;
  font-size: 18px;
  font-weight: bold;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.map-control-btn:hover {
  background-color: #01061C;
  color: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.map-control-btn:active {
  transform: scale(0.95);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* North button with integrated arrow */
.map-control-btn-north {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px;
}

.north-arrow-label {
  color: inherit;
  font-size: 10px;
  font-weight: bold;
  line-height: 1;
  margin: 0;
}

.north-arrow-arrow {
  color: #ff0000;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  margin: 0;
  display: block;
  transition: transform 0.3s ease;
  transform-origin: center;
  text-shadow: 0 0 2px rgba(255, 0, 0, 0.8);
  filter: drop-shadow(0 0 1px rgba(255, 0, 0, 0.5));
}

/* Table export icon button styling */
.main-content-title-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  margin-bottom: 24px; /* Increased spacing between title/button and content below for regular tables */
}

/* But keep original spacing for pricing tables */
.pricing-tool-wrapper .main-content-title-wrapper,
.overlay-card .main-content-title-wrapper {
  margin-bottom: 16px; /* Original spacing for pricing tables */
}

.main-content-title-wrapper .main-content-title {
  margin: 0; /* Remove default margin to help alignment */
}

.table-export-icon-btn {
  background: #01061C;
  color: white;
  border: none;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4; /* Match title line-height better */
  transition: opacity 0.2s;
  display: inline-flex;
  align-items: center;
  vertical-align: baseline; /* Align with text baseline */
  margin-top: 2px; /* Fine-tune vertical position */
}

.table-export-icon-btn:hover {
  opacity: 0.7;
}

.table-export-icon-btn:active {
  opacity: 0.5;
}