/* =========================================================
   PlastChem Dashboard — Design System
   Brand: plastchem-project.org midnight gradient
   Font: Source Sans Pro
   ========================================================= */

/* ----- Google Fonts ----- */
@import url('https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@300;400;600;700;900&display=swap');

/* ----- Design Tokens ----- */
:root {
  /* Brand colours */
  --blue-dark:        #020381;
  --blue-mid:         #1040c0;
  --blue-bright:      #2874fc;
  --purple:           #9b51e0;
  --orange:           #ff6900;
  --teal:             #7bdcb5;
  --red:              #e02424;
  --amber:            #e3a008;

  /* Semantic aliases */
  --color-primary:        var(--blue-bright);
  --color-primary-dark:   var(--blue-dark);
  --color-secondary:      var(--purple);
  --color-highlight:      var(--orange);
  --color-success:        var(--teal);
  --color-danger:         var(--red);
  --color-warning:        var(--amber);

  /* Priority list colours */
  --color-red-list:    #e02424;
  --color-orange-list: #ff6900;
  --color-watch-list:  #e3a008;
  --color-white-list:  #2874fc;
  --color-grey-list:   #9aabb8;

  /* Darker text variants of the list colours, for small text on their pale
     badge backgrounds (WCAG AA ≥ 4.5:1). Fills and charts keep the list colours. */
  --color-red-text:    #c81e1e;
  --color-orange-text: #b34700;
  --color-watch-text:  #8a5d00;
  --color-white-text:  #1a5fd6;
  --color-grey-text:   #475569;

  /* Neutrals */
  --color-text:        #1a1f36;
  --color-text-muted:  #6b7280;
  --color-text-light:  #9ca3af;
  --color-background:  #f0f4f8;
  --color-surface:     #ffffff;
  --color-border:      #e4e9f0;
  --color-hover-bg:    #eef4ff;

  /* Brand gradient (matches PlastChem hero section) */
  --gradient-brand:    linear-gradient(150deg, #020381 0%, #1040c0 45%, #2874fc 100%);
  --gradient-card:     linear-gradient(135deg, #f8faff 0%, #ffffff 100%);

  /* Layout */
  --sidebar-width:     272px;
  --sidebar-rail:      76px;   /* collapsed sidebar: icon tile only */
  --border-radius-sm:  6px;
  --border-radius:     10px;
  --border-radius-lg:  16px;

  /* Shadows — tinted with brand blue */
  --shadow-xs:  0 1px 3px rgba(2, 3, 129, 0.06);
  --shadow-sm:  0 2px 8px rgba(2, 3, 129, 0.08);
  --shadow-md:  0 4px 20px rgba(2, 3, 129, 0.10);
  --shadow-lg:  0 8px 32px rgba(2, 3, 129, 0.14);
}

/* ----- Reset ----- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.55;
  color: var(--color-text);
  background-color: var(--color-background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ----- App Shell ----- */
#app-shell {
  display: flex;
  align-items: flex-start;
  min-height: 100vh;
}

/* =========================================================
   SIDEBAR
   ========================================================= */

#sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--gradient-brand);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  transition: width 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

/* While collapsing/expanding, the blue background is this panel, which
   sidebar.js sizes every frame: it shrinks into (or grows out of) the icon
   together with the menu items, always covering the ones still in flight. */
#sidebar-panel {
  display: none;
  position: absolute;
  left: 0;
  top: 0;
  z-index: -1;             /* above #sidebar's own background, below its content */
  background-image: var(--gradient-brand);
  background-repeat: no-repeat;
  pointer-events: none;
}
html.sb-animating #sidebar-panel { display: block; }

/* Collapsed (and while animating): the rail is page-coloured, so only the
   icon tile shows. */
html.sb-animating #sidebar,
html.sb-collapsed #sidebar { background: #f1f3f6; }

/* Scrollbar inside sidebar */
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }

/* ----- Logo block ----- */
/* The logo is split into icon + wordmark (assets/brand/) so the collapse
   animation (assets/sidebar.js) can draw the menu into the icon. The icon
   keeps the same position in both states; only the rail width changes. */
#sidebar-logo {
  position: relative;
  padding: 26px 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
  flex-shrink: 0;
  transition: border-color 0.3s ease;
}

#sidebar-logo img {
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.sidebar-brand {
  margin-bottom: 8px;
}

.sidebar-brand-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none !important;
}

.sidebar-icon {
  position: relative;
  z-index: 2;              /* menu items disappear behind it */
  display: block;
  width: 44px;
  height: 52px;
  flex-shrink: 0;
}

.sidebar-icon img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* The site-icon tile (assets/icons/icon.svg) forms behind the hexagon. */
.sidebar-icon::before {
  content: "";
  position: absolute;
  left: -4px;
  top: 0;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--gradient-brand);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.28), 0 6px 18px rgba(2,3,129,0.45);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

html.sb-collapsing .sidebar-icon::before { opacity: 0.45; transform: scale(0.85); }
html.sb-collapsed  .sidebar-icon::before { opacity: 1;    transform: scale(1); }
html.sb-collapsed  .sidebar-icon img     { transform: scale(0.7); }

.sidebar-wordmark {
  width: 74px;
  height: auto;
  margin-top: -2px;        /* optical centre, as in the full logo */
}

/* Arrow next to the logo (collapses); hidden on the rail, where the icon expands. */
.sidebar-toggle {
  position: absolute;
  top: 38px;
  left: calc(var(--sidebar-width) - 16px - 28px);
  width: 28px;
  height: 28px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.28);
  background: rgba(255,255,255,0.08);
  color: #ffffff;
  cursor: pointer;
}

.sidebar-toggle:hover {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.55);
}

.sidebar-toggle:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.sidebar-toggle-arrow {
  width: 8px;
  height: 8px;
  margin-left: 3px;        /* optical centre of a left-pointing chevron */
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

/* ----- Collapsed rail: only the icon tile; clicking it expands (sidebar.js) ----- */
html.sb-collapsed #sidebar {
  width: var(--sidebar-rail);
  overflow: visible;       /* don't clip the tile's glow at the rail edge */
}
html.sb-animating #sidebar-logo,
html.sb-collapsed #sidebar-logo { border-bottom-color: transparent; }
html.sb-collapsed #sidebar-body,
html.sb-collapsed #sidebar .sidebar-suck { display: none; }
html.sb-collapsed .sidebar-toggle,
html.sb-collapsing .sidebar-toggle {
  opacity: 0;
  visibility: hidden;
}
.sidebar-toggle {
  /* fades back in once the rail has widened */
  transition: background 0.18s ease, border-color 0.18s ease,
              opacity 0.25s ease 0.2s, visibility 0s linear 0.2s;
}
html.sb-collapsed .sidebar-toggle,
html.sb-collapsing .sidebar-toggle {
  transition: opacity 0.15s ease, visibility 0s linear 0.15s;
}

html.sb-collapsed .sidebar-brand-link {
  cursor: pointer;
  border-radius: 12px;
}
html.sb-collapsed .sidebar-brand-link:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 4px;
}
html.sb-collapsed .sidebar-icon {
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
html.sb-collapsed .sidebar-icon::before {
  transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.25s ease;
}

/* Keyboard focus, and hover on devices that really hover (on touch screens
   :hover sticks after a tap): the tile lifts and wiggles, the hexagon spins a little. */
html.sb-collapsed:not(.sb-busy) .sidebar-brand-link:focus-visible .sidebar-icon {
  transform: translateY(-3px) scale(1.08);
  animation: sidebarIconWiggle 0.6s ease-in-out;
}
html.sb-collapsed:not(.sb-busy) .sidebar-brand-link:focus-visible .sidebar-icon::before {
  box-shadow: 0 0 0 1px rgba(255,255,255,0.55), 0 10px 26px rgba(2,3,129,0.55);
}
html.sb-collapsed:not(.sb-busy) .sidebar-brand-link:focus-visible .sidebar-icon img {
  transform: scale(0.74) rotate(60deg);   /* a hexagon turned 60° keeps its outline */
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@media (hover: hover) {
  html.sb-collapsed:not(.sb-busy) .sidebar-brand-link:hover .sidebar-icon {
    transform: translateY(-3px) scale(1.08);
    animation: sidebarIconWiggle 0.6s ease-in-out;
  }
  html.sb-collapsed:not(.sb-busy) .sidebar-brand-link:hover .sidebar-icon::before {
    box-shadow: 0 0 0 1px rgba(255,255,255,0.55), 0 10px 26px rgba(2,3,129,0.55);
  }
  html.sb-collapsed:not(.sb-busy) .sidebar-brand-link:hover .sidebar-icon img {
    transform: scale(0.74) rotate(60deg);
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
}

@keyframes sidebarIconWiggle {
  0%   { transform: translateY(0) scale(1) rotate(0deg); }
  30%  { transform: translateY(-3px) scale(1.08) rotate(-7deg); }
  55%  { transform: translateY(-3px) scale(1.08) rotate(5deg); }
  80%  { transform: translateY(-3px) scale(1.08) rotate(-2deg); }
  100% { transform: translateY(-3px) scale(1.08) rotate(0deg); }
}

@media (prefers-reduced-motion: reduce) {
  html.sb-collapsed .sidebar-brand-link:hover .sidebar-icon,
  html.sb-collapsed .sidebar-brand-link:focus-visible .sidebar-icon { animation: none; }
  html.sb-collapsed .sidebar-brand-link:hover .sidebar-icon img,
  html.sb-collapsed .sidebar-brand-link:focus-visible .sidebar-icon img { transform: scale(0.7); }
}

html.sb-busy #sidebar-body,
html.sb-busy .sidebar-brand-link { pointer-events: none; }
html.sb-animating #sidebar-filters { border-top-color: transparent; }

/* The menu keeps its full width while the rail animates (no re-wrapping). */
#sidebar-body {
  width: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
}

#sidebar-logo .sidebar-tagline {
  color: rgba(255,255,255,0.55);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin: 0;
}

/* ----- Nav ----- */
#sidebar-nav {
  padding: 14px 0 8px;
  flex: 1;
}

.nav-link {
  display: block;
  padding: 9px 22px 9px 20px;
  color: rgba(255,255,255,0.72) !important;
  text-decoration: none !important;
  font-size: 13.5px;
  font-weight: 400;
  letter-spacing: 0.1px;
  border-left: 3px solid transparent;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
  position: relative;
}

.nav-link:hover {
  background: rgba(255,255,255,0.10);
  color: #ffffff !important;
  border-left-color: rgba(255,255,255,0.50);
}

.nav-link.active {
  background: rgba(255,255,255,0.16);
  color: #ffffff !important;
  border-left-color: #ffffff;
  font-weight: 600;
}

/* ----- Sidebar Filters ----- */
#sidebar-filters {
  padding: 16px 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.10);
  flex-shrink: 0;
  transition: border-color 0.3s ease;
}

#sidebar-filters .filter-heading {
  color: rgba(255,255,255,0.40);
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  display: block;
  margin-bottom: 6px;
  margin-top: 14px;
}

#sidebar-filters .filter-heading:first-child { margin-top: 0; }

/* Dash dropdown inside dark sidebar */
#sidebar-filters .Select-control {
  background: rgba(255,255,255,0.09) !important;
  border: 1px solid rgba(255,255,255,0.18) !important;
  border-radius: var(--border-radius-sm) !important;
  min-height: 34px !important;
  transition: border-color 0.15s;
}

#sidebar-filters .Select-control:hover {
  border-color: rgba(255,255,255,0.35) !important;
}

#sidebar-filters .Select-value-label,
#sidebar-filters .Select-placeholder {
  color: rgba(255,255,255,0.80) !important;
  font-size: 12.5px !important;
  font-family: 'Source Sans Pro', sans-serif !important;
}

#sidebar-filters .Select-arrow {
  border-top-color: rgba(255,255,255,0.55) !important;
}

#sidebar-filters .Select-menu-outer {
  background: #1a2550 !important;
  border: 1px solid rgba(255,255,255,0.12) !important;
  border-radius: var(--border-radius-sm) !important;
  box-shadow: var(--shadow-lg) !important;
  margin-top: 2px !important;
}

#sidebar-filters .Select-option {
  background: transparent !important;
  color: rgba(255,255,255,0.80) !important;
  font-size: 12.5px !important;
  padding: 8px 12px !important;
}

#sidebar-filters .Select-option:hover,
#sidebar-filters .Select-option.is-focused {
  background: rgba(255,255,255,0.10) !important;
  color: #ffffff !important;
}

#sidebar-filters .Select-option.is-selected {
  background: rgba(40,116,252,0.30) !important;
  color: #ffffff !important;
}

/* Live match count + reset / copy-link actions */
#sidebar-filters .filter-summary {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.10);
}

#sidebar-filters .filter-match-count {
  display: block;
  color: rgba(255,255,255,0.85);
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 8px;
}

#sidebar-filters .filter-actions {
  display: flex;
  gap: 8px;
}

#sidebar-filters .filter-action-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 8px;
  background: rgba(255,255,255,0.09);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--border-radius-sm);
  color: rgba(255,255,255,0.85);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

#sidebar-filters .filter-action-btn:hover {
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.35);
}

#sidebar-filters .filter-copy-icon {
  display: inline-flex;
  color: inherit;
}

/* =========================================================
   MAIN CONTENT
   ========================================================= */

#page-content {
  flex: 1;
  min-width: 0;
  padding: 32px 36px 48px;
  background-color: #f1f3f6;
  min-height: 100vh;
}

/* Page load animation */
#page-content > * {
  animation: fadeSlideIn 0.30s ease both;
}

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

/* =========================================================
   PAGE HEADER
   ========================================================= */

.page-header {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.page-header-text { flex: 1; }

.page-header h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 3px;
  letter-spacing: -0.4px;
  line-height: 1.2;
}

.page-header p {
  color: var(--color-text-muted);
  margin: 0;
  font-size: 14px;
  font-weight: 400;
  max-width: 560px;
}

.page-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(40,116,252,0.08);
  border: 1px solid rgba(40,116,252,0.18);
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--blue-bright);
  letter-spacing: 0.2px;
  white-space: nowrap;
}

/* =========================================================
   KPI CARDS
   ========================================================= */

.kpi-row {
  display: flex;
  gap: 14px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}

.kpi-card {
  background: var(--color-surface);
  border-radius: var(--border-radius);
  padding: 18px 20px 16px;
  box-shadow: var(--shadow-sm);
  flex: 1;
  min-width: 130px;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.20s ease, transform 0.20s ease;
  border: 1px solid var(--color-border);
}

.kpi-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* Coloured left accent bar */
.kpi-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--color-primary);
  border-radius: var(--border-radius) 0 0 var(--border-radius);
}

.kpi-card.red::before    { background: var(--color-red-list); }
.kpi-card.orange::before { background: var(--color-orange-list); }
.kpi-card.watch::before  { background: var(--color-watch-list); }
.kpi-card.white::before  { background: var(--color-white-list); }
.kpi-card.grey::before   { background: var(--color-grey-list); }
.kpi-card.primary::before   { background: var(--color-primary); }
.kpi-card.secondary::before { background: var(--color-secondary); }

.kpi-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1;
  margin-bottom: 5px;
  letter-spacing: -0.5px;
}

.kpi-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

/* =========================================================
   CHART CARDS
   ========================================================= */

.chart-card {
  background: var(--color-surface);
  border-radius: var(--border-radius);
  padding: 22px 26px 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  border: 1px solid var(--color-border);
  transition: box-shadow 0.20s ease;
}

.chart-card:hover {
  box-shadow: var(--shadow-md);
}

.chart-card h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 18px;
  letter-spacing: 0.1px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Blue accent dot before chart titles */
.chart-card h3::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
  flex-shrink: 0;
}

/* =========================================================
   GRID LAYOUT
   ========================================================= */

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 0;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
}

@media (max-width: 1200px) {
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 1400px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
}

/* =========================================================
   DATA TABLES (Dash DataTable)
   ========================================================= */

.dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner th {
  background: #eef3fc !important;
  color: var(--blue-dark) !important;
  font-family: 'Source Sans Pro', sans-serif !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.7px !important;
  padding: 10px 14px !important;
  border-bottom: 2px solid var(--blue-bright) !important;
  border-right: none !important;
  white-space: nowrap;
}

.dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner td {
  font-family: 'Source Sans Pro', sans-serif !important;
  font-size: 13.5px !important;
  font-weight: 400 !important;
  color: var(--color-text) !important;
  padding: 9px 14px !important;
  border-bottom: 1px solid var(--color-border) !important;
  border-right: none !important;
  transition: background 0.12s;
}

.dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner tr:hover td {
  background: var(--color-hover-bg) !important;
}

/* Remove outer table border */
.dash-table-container .dash-spreadsheet {
  border: none !important;
}

/* Pagination controls */
/* =========================================================
   SEARCH INPUT & BUTTON
   ========================================================= */

.search-bar {
  display: flex;
  gap: 12px;
  align-items: center;
}

.search-input {
  flex: 1;
  padding: 11px 16px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--border-radius);
  font-family: 'Source Sans Pro', sans-serif;
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-surface);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.search-input:focus {
  border-color: var(--blue-bright);
  box-shadow: 0 0 0 3px rgba(40,116,252,0.12);
}

.search-button {
  padding: 11px 24px;
  background: var(--gradient-brand);
  color: #ffffff;
  border: none;
  border-radius: var(--border-radius);
  font-family: 'Source Sans Pro', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: opacity 0.18s, transform 0.18s, box-shadow 0.18s;
  box-shadow: 0 2px 8px rgba(40,116,252,0.30);
}

.search-button:hover {
  opacity: 0.92;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(40,116,252,0.38);
}

/* =========================================================
   PRIORITY LIST BADGES
   ========================================================= */

.badge-list {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-red    { background: #fde8e8; color: var(--color-red-text); }
.badge-orange { background: #fff0e6; color: var(--color-orange-text); }
.badge-watch  { background: #fef9e7; color: var(--color-watch-text); }
.badge-white  { background: #e8f0ff; color: var(--color-white-text); }
.badge-grey   { background: #f0f3f5; color: var(--color-grey-text); }

/* =========================================================
   DETAIL CARD (Chemical Search page)
   ========================================================= */

.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.detail-table td {
  padding: 6px 14px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

.detail-table td:first-child {
  font-weight: 600;
  color: var(--color-text-muted);
  width: 240px;
  white-space: nowrap;
}

.detail-table tr:last-child td { border-bottom: none; }
.detail-table tr:hover td { background: var(--color-hover-bg); }

/* =========================================================
   STYLED HTML TABLE (replaces DataTable where tags are needed)
   ========================================================= */

.styled-table-wrap {
  overflow-x: auto;
}

.styled-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  border-top: 2px solid var(--color-border);
}

.styled-table th {
  padding: 10px 14px;
  text-align: left;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
  background: #f7f9fc;
  border-bottom: 2px solid var(--color-border);
  white-space: nowrap;
}

.styled-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
  color: var(--color-text);
  font-size: 13px;
  white-space: nowrap;
}

.styled-table tbody tr:last-child td {
  border-bottom: none;
}

.styled-table tbody tr:nth-child(even) td {
  background: #fafbfc;
}

.styled-table tbody tr:hover td {
  background: rgba(40, 116, 252, 0.04);
  transition: background 0.12s ease;
}

/* Compact tag variants inside tables */
.styled-table .mea-tags-row,
.styled-table .function-tags-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  padding: 0;
  overflow: hidden;
}

.styled-table .mea-tag,
.styled-table .function-tag {
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 20px;
  white-space: nowrap;
}

/* =========================================================
   HAZARD SOURCE MATRIX
   ========================================================= */

.hazard-source-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: calc(var(--border-radius) + 2px);
  background:
    linear-gradient(180deg, rgba(40,116,252,0.04) 0%, rgba(40,116,252,0) 110px),
    var(--color-surface);
}

.hazard-source-table {
  width: 100%;
  min-width: 1320px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
}

.hazard-source-table thead th {
  border-bottom: 1px solid var(--color-border);
  border-right: 1px solid rgba(228, 233, 240, 0.7);
  background: rgba(255, 255, 255, 0.92);
}

.hazard-source-table thead tr:first-child th {
  padding: 14px 10px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--color-primary-dark);
  font-weight: 800;
}

.hazard-source-table thead tr:last-child th {
  padding: 8px 4px;
  height: 138px;
  vertical-align: bottom;
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.45px;
  color: var(--color-text-muted);
  background: rgba(247, 249, 252, 0.94);
}

.hazard-source-table th:last-child,
.hazard-source-table td:last-child {
  border-right: none;
}

.hazard-source-top-left {
  min-width: 210px;
}

.hazard-source-group,
.hazard-source-center {
  text-align: center;
}

.hazard-source-vertical {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
}

.hazard-source-table tbody td {
  padding: 11px 10px;
  border-bottom: 1px solid rgba(228, 233, 240, 0.9);
  border-right: 1px solid rgba(228, 233, 240, 0.55);
  vertical-align: middle;
  background: rgba(255, 255, 255, 0.92);
}

.hazard-source-table tbody tr:nth-child(even) td {
  background: rgba(247, 249, 252, 0.9);
}

.hazard-source-table tbody tr:hover td {
  background: rgba(40, 116, 252, 0.05);
  transition: background 0.12s ease;
}

.hazard-source-name {
  min-width: 210px;
  font-weight: 700;
  line-height: 1.35;
}

.hazard-source-link {
  min-width: 290px;
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
}

.hazard-source-link a {
  color: var(--color-primary-dark);
  text-decoration: none;
}

.hazard-source-link a:hover {
  text-decoration: underline;
}

.hazard-source-count {
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.hazard-source-marker-cell {
  width: 44px;
  min-width: 44px;
  text-align: center;
}

.hazard-source-flag {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  box-shadow: 0 0 0 3px rgba(40, 116, 252, 0.10);
}

.hazard-source-flag.empty {
  background: transparent;
  box-shadow: none;
}

@media (max-width: 900px) {
  .hazard-source-table thead tr:first-child th {
    padding-top: 12px;
  }

  .hazard-source-table thead tr:last-child th {
    height: 126px;
  }

  .hazard-source-name {
    min-width: 170px;
  }

  .hazard-source-link {
    min-width: 220px;
  }
}

/* =========================================================
   SECTION DIVIDER
   ========================================================= */

.section-divider {
  height: 1px;
  background: var(--color-border);
  margin: 24px 0;
  border: none;
}

/* =========================================================
   UTILITY
   ========================================================= */

.text-muted  { color: var(--color-text-muted); }
.text-light  { color: var(--color-text-light); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

/* =========================================================
   LIST GLOSSARY (Overview page)
   ========================================================= */

.glossary-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

@media (max-width: 1500px) {
  .glossary-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .glossary-grid { grid-template-columns: 1fr 1fr; }
}

.glossary-card {
  border-radius: var(--border-radius);
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--color-grey-list);
  background: var(--color-surface);
}

.glossary-card.red    { border-top-color: var(--color-red-list); }
.glossary-card.orange { border-top-color: var(--color-orange-list); }
.glossary-card.watch  { border-top-color: var(--color-watch-list); }
.glossary-card.white  { border-top-color: var(--color-white-list); }
.glossary-card.grey   { border-top-color: var(--color-grey-list); }

.glossary-card-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 4px;
}

.glossary-card.red .glossary-card-label    { color: var(--color-red-list); }
.glossary-card.orange .glossary-card-label { color: var(--color-orange-list); }
.glossary-card.watch .glossary-card-label  { color: var(--color-watch-list); }
.glossary-card.white .glossary-card-label  { color: var(--color-white-list); }
.glossary-card.grey .glossary-card-label   { color: #64748b; }

.glossary-card-short {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 6px;
  line-height: 1.35;
}

.glossary-card-detail {
  font-size: 12px;
  color: var(--color-text-muted);
  line-height: 1.45;
}

/* =========================================================
   INFO BANNERS (callouts / alerts)
   ========================================================= */

.info-banner {
  background: #eef4ff;
  border: 1px solid rgba(40,116,252,0.20);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--border-radius);
  padding: 12px 16px;
  font-size: 13.5px;
  color: var(--color-text);
  margin-bottom: 20px;
  line-height: 1.5;
}

.info-banner strong { color: var(--color-primary-dark); }

.info-banner.warning {
  background: #fff9e6;
  border-color: rgba(227,160,8,0.25);
  border-left-color: var(--color-warning);
}

.info-banner.warning strong { color: #92620a; }

.info-banner.danger {
  background: #fef2f2;
  border-color: rgba(224,36,36,0.20);
  border-left-color: var(--color-danger);
}

.info-banner.danger strong { color: #991b1b; }

/* =========================================================
   CHEMICAL INTERPRETATION PANEL (Search page)
   ========================================================= */

.list-interpretation {
  border-radius: var(--border-radius);
  padding: 14px 18px;
  margin-bottom: 18px;
  border: 1px solid var(--color-border);
}

.list-interpretation.red    { background: #fde8e8; border-color: rgba(224,36,36,0.22); }
.list-interpretation.orange { background: #fff0e6; border-color: rgba(255,105,0,0.22); }
.list-interpretation.watch  { background: #fef9e7; border-color: rgba(227,160,8,0.22); }
.list-interpretation.white  { background: #e8f0ff; border-color: rgba(40,116,252,0.22); }
.list-interpretation.grey   { background: #f0f3f5; border-color: rgba(100,116,139,0.22); }

.list-interpretation-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.list-interpretation-short {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--color-text);
}

.list-interpretation-detail {
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.hazard-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.hazard-pill.low      { background: #dcfce7; color: #166534; }
.hazard-pill.moderate { background: #fef9e7; color: #92620a; }
.hazard-pill.high     { background: #fff0e6; color: #9a3412; }
.hazard-pill.very-high { background: #fde8e8; color: #991b1b; }

/* =========================================================
   WATCH LIST SECTION (Compliance page)
   ========================================================= */

.section-header {
  margin: 32px 0 18px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--color-border);
}

.section-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 3px;
  letter-spacing: -0.2px;
}

.section-header p {
  color: var(--color-text-muted);
  margin: 0;
  font-size: 13.5px;
}

/* =========================================================
   UPR EVIDENCE PAGE
   ========================================================= */

.upr-methodology-grid {
  align-items: stretch;
}

.upr-method-grid {
  display: grid;
  gap: 12px;
}

.upr-method-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px 16px;
  border-radius: var(--border-radius);
  border: 1px solid var(--color-border);
  background: var(--gradient-card);
}

.upr-method-score {
  min-width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(40,116,252,0.10);
  color: var(--color-primary-dark);
  font-size: 16px;
  font-weight: 800;
}

.upr-method-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 4px;
}

.upr-method-detail {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--color-text-muted);
}

@media (max-width: 900px) {
  .upr-method-card {
    grid-template-columns: 1fr;
  }

  .upr-method-score {
    min-width: 36px;
    width: 36px;
    height: 36px;
  }
}

/* =========================================================
   SIDEBAR PROFILE INDICATOR
   ========================================================= */

.sidebar-profile {
  padding: 8px 14px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
}

.sidebar-profile-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,0.10);
  border-radius: var(--border-radius-sm);
  padding: 6px 10px;
  gap: 8px;
}

.sidebar-profile-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: rgba(255,255,255,0.75);
}

.sidebar-profile-change {
  font-size: 10.5px;
  font-weight: 600;
  color: rgba(255,255,255,0.45) !important;
  text-decoration: none !important;
  white-space: nowrap;
  transition: color 0.15s;
  flex-shrink: 0;
}

.sidebar-profile-change:hover {
  color: rgba(255,255,255,0.90) !important;
  text-decoration: underline !important;
}

/* =========================================================
   LANDING PAGE
   ========================================================= */

/* Override page-content padding and margin on landing */
.landing-shell {
  min-height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
}

/* ── Hero ── */
.landing-hero {
  background: var(--gradient-brand);
  position: relative;
  overflow: hidden;
  padding: 0;
}

/* Dot-grid texture overlay */
.landing-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.07) 1px, transparent 1px);
  background-size: 26px 26px;
  pointer-events: none;
  z-index: 0;
}

/* Animated radial glow — bottom-right */
.landing-hero::after {
  content: '';
  position: absolute;
  bottom: -20%;
  right: -5%;
  width: 55%;
  height: 180%;
  background: radial-gradient(ellipse, rgba(40,116,252,0.35) 0%, transparent 65%);
  pointer-events: none;
  z-index: 0;
  animation: landingGlow 9s ease-in-out infinite alternate;
}

@keyframes landingGlow {
  from { transform: translate(0,    0)    scale(1);    opacity: 0.8; }
  to   { transform: translate(-30px, 20px) scale(1.12); opacity: 1;   }
}

.landing-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 72px 64px 64px;
}

.landing-logo {
  width: 190px;
  height: auto;
  display: block;
  margin-bottom: 44px;
  user-select: none;
  -webkit-user-drag: none;
  /* Subtle drop-shadow on white logo */
  filter: drop-shadow(0 2px 12px rgba(0,0,0,0.25));
  animation: fadeSlideIn 0.50s ease both;
}

.landing-hero-title {
  font-size: 54px;
  font-weight: 900;
  line-height: 1.10;
  margin: 0 0 26px;
  letter-spacing: -1.8px;
  color: #ffffff;
  max-width: 680px;
  animation: fadeSlideIn 0.55s 0.05s ease both;
}

.landing-hero-desc {
  font-size: 17px;
  font-weight: 400;
  line-height: 1.65;
  color: rgba(255,255,255,0.78);
  max-width: 560px;
  margin: 0 0 48px;
  animation: fadeSlideIn 0.55s 0.10s ease both;
}

/* Stats row */
.landing-stats {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  animation: fadeSlideIn 0.55s 0.15s ease both;
}

.landing-stat {
  display: flex;
  flex-direction: column;
  padding: 0 32px 0 0;
}

.landing-stat-value {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: -0.8px;
  line-height: 1;
  color: #ffffff;
}

.landing-stat-label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: rgba(255,255,255,0.52);
  margin-top: 4px;
}

.landing-stat-divider {
  width: 1px;
  height: 38px;
  background: rgba(255,255,255,0.18);
  margin: 0 32px 0 0;
  flex-shrink: 0;
}

/* ── Audience selector ── */
.landing-selector {
  flex: 1;
  background: var(--color-background);
  padding: 56px 64px 48px;
  display: flex;
  justify-content: center;
}

.landing-selector-inner {
  max-width: 1000px;
  width: 100%;
}

.landing-selector-header {
  margin-bottom: 32px;
  animation: fadeSlideIn 0.45s 0.20s ease both;
}

.landing-selector-title {
  font-size: 30px;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 8px;
  letter-spacing: -0.6px;
}

.landing-selector-subtitle {
  font-size: 15px;
  color: var(--color-text-muted);
  margin: 0;
  line-height: 1.5;
}

/* 2-column card grid */
.landing-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 26px;
  animation: fadeSlideIn 0.45s 0.25s ease both;
}

@media (max-width: 860px) {
  .landing-cards-grid { grid-template-columns: 1fr; }
  .landing-hero-inner { padding: 48px 32px 40px; }
  .landing-hero-title { font-size: 38px; }
  .landing-selector   { padding: 40px 32px 36px; }
}

/* Audience card button */
.landing-audience-card {
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  padding: 26px 28px 22px;
  text-align: left;
  cursor: pointer;
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease,
    border-color 0.22s ease,
    background 0.22s ease;
  box-shadow: var(--shadow-sm);
  width: 100%;
  font-family: 'Source Sans Pro', sans-serif;
  /* Reset browser button styles */
  appearance: none;
  -webkit-appearance: none;
  outline: none;
}

.landing-audience-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.landing-audience-card:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

/* Per-audience hover tints */
.landing-audience-card.reg:hover   { border-color: #2874fc; background: rgba(40,116,252,0.04); }
.landing-audience-card.sci:hover   { border-color: #9b51e0; background: rgba(155,81,224,0.04); }
.landing-audience-card.press:hover { border-color: #ff6900; background: rgba(255,105,0,0.04);  }
.landing-audience-card.pub:hover   { border-color: #059669; background: rgba(5,150,105,0.04);  }

/* Card icon */
.landing-card-icon {
  font-size: 30px;
  line-height: 1;
  margin-bottom: 12px;
}

/* Card title */
.landing-card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 9px;
  letter-spacing: -0.2px;
  transition: color 0.18s;
}

.landing-audience-card.reg:hover   .landing-card-title { color: #2874fc; }
.landing-audience-card.sci:hover   .landing-card-title { color: #9b51e0; }
.landing-audience-card.press:hover .landing-card-title { color: #ff6900; }
.landing-audience-card.pub:hover   .landing-card-title { color: #059669; }

/* Card description */
.landing-card-desc {
  font-size: 13.5px;
  color: var(--color-text-muted);
  line-height: 1.58;
  margin: 0 0 14px;
}

/* Pages list */
.landing-card-pages {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
  padding: 6px 10px;
  border-radius: var(--border-radius-sm);
  display: inline-block;
}

.landing-audience-card.reg   .landing-card-pages { color: #2874fc; background: rgba(40,116,252,0.08); }
.landing-audience-card.sci   .landing-card-pages { color: #9b51e0; background: rgba(155,81,224,0.08); }
.landing-audience-card.press .landing-card-pages { color: #ff6900; background: rgba(255,105,0,0.08);  }
.landing-audience-card.pub   .landing-card-pages { color: #059669; background: rgba(5,150,105,0.08);  }

/* Skip / explore-all row */
.landing-skip-row {
  text-align: center;
  animation: fadeSlideIn 0.45s 0.30s ease both;
}

.landing-explore-all {
  background: none;
  border: 2px solid var(--color-border);
  border-radius: var(--border-radius);
  padding: 12px 32px;
  font-family: 'Source Sans Pro', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  letter-spacing: 0.2px;
  transition: border-color 0.18s, color 0.18s, box-shadow 0.18s;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
}

.landing-explore-all:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(40,116,252,0.10);
}

/* ── Executive Narrative / Science Brief ── */
.landing-narrative {
  background: var(--color-surface);
  padding: 72px 64px 64px;
  border-top: 1px solid var(--color-border);
}

.landing-narrative-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.narrative-eyebrow {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  color: var(--color-primary);
  margin-bottom: 32px;
}

/* Crisis banner — 4 key figures */
.narrative-crisis-banner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: #f0f6ff;
  border: 1px solid #d1daf5;
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  margin-bottom: 56px;
}

.crisis-stat-item {
  display: flex;
  flex-direction: column;
  padding: 32px 36px;
  border-right: 1px solid #d1daf5;
}

.crisis-stat-item:last-child {
  border-right: none;
}

.crisis-stat-value {
  font-size: 40px;
  font-weight: 900;
  color: var(--blue-dark);
  letter-spacing: -1.5px;
  line-height: 1;
  margin-bottom: 10px;
}

.crisis-stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  line-height: 1.5;
}

/* Narrative typography */
.narrative-h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.3px;
  line-height: 1.25;
  margin: 0 0 16px;
}

.narrative-h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.1px;
  line-height: 1.3;
  margin: 0 0 12px;
}

.narrative-p {
  font-size: 15px;
  line-height: 1.72;
  color: #374151;
  margin: 0 0 14px;
}

.narrative-p:last-child { margin-bottom: 0; }

.narrative-p-muted { color: var(--color-text-muted); }

/* Lead section */
.narrative-lead-section {
  margin-bottom: 52px;
  padding-bottom: 52px;
  border-bottom: 1px solid var(--color-border);
}

/* 2-column body grid */
.narrative-body-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 52px;
  margin-bottom: 56px;
  padding-bottom: 56px;
  border-bottom: 1px solid var(--color-border);
}

/* Priority groups block */
.priority-groups-block {
  background: #f8faff;
  border: 1px solid #d1daf5;
  border-radius: 14px;
  padding: 40px 44px;
  margin-bottom: 56px;
}

.priority-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.priority-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--color-surface);
  border: 1px solid #d1daf5;
  border-radius: 100px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
}

.priority-pct {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.4;
}

.priority-pct.high { background-color: var(--red); }
.priority-pct.med  { background-color: var(--orange); }
.priority-pct.low  { background-color: var(--amber); }
.priority-pct.na   { background-color: var(--color-text-muted); }

/* Four actions block */
.four-actions-block {
  margin-bottom: 56px;
}

.actions-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-top: 24px;
}

.action-card {
  position: relative;
  background: var(--color-surface);
  border: 1px solid #d1daf5;
  border-top: 3px solid transparent;
  border-radius: 12px;
  padding: 28px 24px 24px;
  overflow: hidden;
  transition: border-top-color 0.20s ease, box-shadow 0.20s ease, transform 0.20s ease;
}

.action-card:hover {
  border-top-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.action-card-num {
  position: absolute;
  top: -8px;
  right: 14px;
  font-size: 80px;
  font-weight: 900;
  color: rgba(2, 3, 129, 0.06);
  line-height: 1;
  letter-spacing: -4px;
  pointer-events: none;
  user-select: none;
}

.action-card-heading {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 10px;
  line-height: 1.35;
  position: relative;
}

.action-card-text {
  font-size: 13.5px;
  color: var(--color-text-muted);
  line-height: 1.65;
  margin: 0;
  position: relative;
}

/* Bottom line callout */
.narrative-bottom-line {
  background: var(--gradient-brand);
  border-radius: 14px;
  margin : 44px auto;
  padding: 44px 56px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.narrative-bottom-line::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
}

.narrative-bottom-line p {
  font-size: 16px;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.88);
  max-width: 780px;
  margin: 0 auto 12px;
  position: relative;
}

.narrative-bottom-line p:last-child { margin-bottom: 0; }

.narrative-bottom-line strong { color: #ffffff; }

/* Narrative responsive */
@media (max-width: 860px) {
  .landing-narrative         { padding: 48px 32px 40px; }
  .narrative-crisis-banner   { grid-template-columns: 1fr 1fr; }
  .narrative-body-grid       { grid-template-columns: 1fr; gap: 36px; }
  .actions-grid              { grid-template-columns: 1fr 1fr; }
  .narrative-bottom-line     { padding: 36px 28px; }
}

@media (max-width: 600px) {
  .narrative-crisis-banner   { grid-template-columns: 1fr; }
  .actions-grid              { grid-template-columns: 1fr; }
}

/* ── Footer ── */
.landing-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 14px 64px;
  font-size: 11.5px;
  color: var(--color-text-light);
  letter-spacing: 0.2px;
}

/* =========================================================
   SEARCH PAGE — Result Cards
   ========================================================= */

.result-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  max-height: 440px;
  overflow-y: auto;
  padding-right: 4px;
}

.result-card {
  background: var(--color-surface);
  border-radius: var(--border-radius);
  border-left: 4px solid var(--color-grey-list);
  padding: 13px 16px 11px;
  cursor: pointer;
  transition: box-shadow 0.18s ease, transform 0.16s ease, border-left-width 0.12s;
  box-shadow: var(--shadow-xs);
  user-select: none;
}

.result-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateX(3px);
}

.result-card.selected {
  box-shadow: var(--shadow-md);
  background: #f0f5ff;
  border-left-width: 5px;
  transform: translateX(2px);
}

.result-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 3px;
}

.result-card-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--color-text);
  flex: 1;
  line-height: 1.35;
}

.result-card-cas {
  font-size: 11.5px;
  color: var(--color-text-muted);
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  margin-bottom: 7px;
}

.result-card-scores {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 4px;
}

/* Mini score bars (inside result cards) */
.score-bar-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.score-bar-label {
  font-size: 10.5px;
  color: var(--color-text-muted);
  width: 50px;
  text-align: right;
  flex-shrink: 0;
}

.score-bar-track {
  flex: 1;
  height: 5px;
  background: var(--color-border);
  border-radius: 3px;
  overflow: hidden;
  max-width: 160px;
}

.score-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.score-bar-value {
  font-size: 10.5px;
  color: var(--color-text);
  font-weight: 600;
  width: 28px;
  flex-shrink: 0;
}

.result-prod-tag {
  display: inline-block;
  margin-top: 5px;
  font-size: 11px;
  padding: 2px 9px;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  color: var(--color-text-muted);
  font-weight: 600;
}

/* Results header (count + hint) */
.results-header {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--color-border);
}

.results-count {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--color-text);
}

.results-hint {
  font-size: 13px;
  color: var(--color-text-muted);
}

/* =========================================================
   SEARCH PAGE — Empty States
   ========================================================= */

.empty-state {
  text-align: center;
  padding: 52px 24px 44px;
}

.empty-state-icon {
  font-size: 42px;
  margin-bottom: 14px;
  opacity: 0.55;
  line-height: 1;
}

.empty-state-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 6px;
}

.empty-state-body {
  font-size: 13.5px;
  color: var(--color-text-muted);
  max-width: 380px;
  margin: 0 auto 20px;
  line-height: 1.6;
}

.empty-state-hints {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.empty-hint-chip {
  display: inline-block;
  font-size: 11.5px;
  padding: 4px 13px;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  color: var(--color-text-muted);
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.empty-hint-chip:hover,
.empty-hint-chip:focus-visible {
  background: rgba(40, 116, 252, 0.07);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* =========================================================
   SEARCH PAGE — Chemical Profile Dashboard
   ========================================================= */

.chem-detail-dashboard {
  margin-top: 20px;
  animation: fadeSlideIn 0.28s ease both;
}

/* Hero / identity block */
.chem-hero {
  background: var(--color-surface);
  border-radius: var(--border-radius);
  border-left: 5px solid var(--color-primary);
  padding: 22px 26px 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  border: 1px solid var(--color-border);
  border-left-width: 5px;
}

.chem-hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 5px;
}

.chem-hero-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
  margin: 0;
  flex: 1;
  line-height: 1.3;
  letter-spacing: -0.2px;
}

.badge-lg {
  font-size: 12.5px !important;
  padding: 5px 14px !important;
  flex-shrink: 0;
}

/* Structure first, beside the list panel and identifiers */
.chem-hero-grid {
  display: grid;
  grid-template-columns: minmax(240px, 380px) minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  margin-top: 18px;
}

.chem-hero-structure {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.chem-hero-structure.empty {
  justify-content: center;
  min-height: 160px;
  padding: 16px;
  border: 1px dashed var(--color-border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--color-text-muted);
  font-style: italic;
}

.chem-hero-info {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.chem-hero > .list-interpretation {
  margin: 14px 0 0;
}

.chem-hero-identifiers td.detail-value {
  word-break: break-word;
}

@media (max-width: 900px) {
  .chem-hero-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Score meters grid */
.scores-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin: 4px 0 14px;
}

@media (max-width: 1100px) {
  .scores-grid { grid-template-columns: repeat(3, 1fr); }
}

.score-meter-card {
  background: var(--color-background);
  border-radius: var(--border-radius);
  padding: 18px 12px 14px;
  text-align: center;
  border: 1px solid var(--color-border);
}

.score-meter-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 12px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}

.score-meter-value.na { color: #9ca3af; }

.score-meter-bar-track {
  height: 6px;
  background: var(--color-border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 10px;
}

.score-meter-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.score-meter-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

.scores-coverage-note {
  font-size: 11.5px;
  color: var(--color-text-muted);
  font-style: italic;
  padding-top: 10px;
  border-top: 1px solid var(--color-border);
}

/* Stat cards (production, UPR) */
.stat-card {
  display: flex;
  flex-direction: column;
}

.stat-card-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.2;
  margin: 8px 0 4px;
  letter-spacing: -0.3px;
}

.stat-card-value.na {
  font-size: 18px;
  color: var(--color-text-muted);
  font-weight: 400;
  font-style: italic;
}

.stat-card-note {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: auto;
  padding-top: 6px;
}

/* UPR trio */
.upr-trio {
  display: flex;
  gap: 28px;
  margin: 8px 0 4px;
  flex-wrap: wrap;
}

.upr-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-secondary);
  line-height: 1.2;
  letter-spacing: -0.3px;
}

.upr-label {
  font-size: 10.5px;
  color: var(--color-text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-top: 3px;
}

/* Function tags */
.function-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0;
}

.function-tag {
  display: inline-block;
  padding: 5px 13px;
  background: rgba(40, 116, 252, 0.07);
  color: var(--color-primary);
  border: 1px solid rgba(40, 116, 252, 0.18);
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
}

/* Regulatory section */
.reg-sub-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.mea-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.mea-tag {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(123, 220, 181, 0.12);
  color: #0f7a56;
  border: 1px solid rgba(123, 220, 181, 0.38);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.mea-tag-prec {
  background: rgba(155, 81, 224, 0.07);
  color: var(--color-secondary);
  border-color: rgba(155, 81, 224, 0.22);
}

.no-mea-badge {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(224, 36, 36, 0.07);
  color: var(--color-red-list);
  border: 1px solid rgba(224, 36, 36, 0.18);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

/* Source database tags */
.source-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 4px 0;
}

.source-tag {
  display: inline-block;
  padding: 4px 12px;
  background: var(--color-background);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.no-data-note {
  font-size: 13px;
  color: var(--color-text-muted);
  font-style: italic;
}

/* ----- Identity row: molecule + identifiers side by side ----- */
.identity-row > .chart-card,
.identity-row > .molecule-card {
  /* Cards inside the identity row stretch to the same height */
  height: 100%;
  box-sizing: border-box;
  margin-bottom: 0;
}

/* ----- Molecule structure viewer ----- */
.molecule-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.molecule-viewer {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px 0 8px;
}

.molecule-img {
  max-width: 420px;
  width: 100%;
  height: auto;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-xs);
}

.molecule-label {
  font-size: 11.5px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 6px;
  padding-bottom: 4px;
}

/* === Production page — integrated table filters =========================== */

.integrated-filter-table {
  table-layout: fixed;
}

.integrated-filter-table th,
.integrated-filter-table td {
  white-space: normal;
}

.table-filter-headrow th {
  padding: 8px 10px;
  background: #fbfcfe;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

.table-filter-input.search-input {
  width: 100%;
  min-width: 120px;
  padding: 6px 10px;
  font-size: 12.5px;
  height: 34px;
  box-sizing: border-box;
}

.table-filter-dropdown {
  min-width: 150px;
}

.table-filter-dropdown .Select-control,
.table-filter-dropdown .VirtualizedSelect {
  font-size: 12.5px;
  min-height: 34px;
}

.table-filter-dropdown .Select-placeholder,
.table-filter-dropdown .Select-value-label,
.table-filter-dropdown .Select-input input {
  font-size: 12.5px;
}

/* Table pagination controls */
.table-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 14px 0 4px;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-primary);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.page-btn:hover:not(:disabled) {
  background: rgba(40, 116, 252, 0.07);
  border-color: var(--color-primary);
}

.page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.page-info {
  font-size: 13px;
  color: var(--color-text-muted);
  font-weight: 600;
  min-width: 180px;
  text-align: center;
}

/* === Search page — chemical browser table ================================= */

.chem-table-card {
  margin-top: 20px;
}

.chem-table-row {
  cursor: pointer;
}

.chem-table td {
  vertical-align: top;
}

.styled-table.chem-table tbody tr.chem-table-row:hover td {
  background: rgba(40, 116, 252, 0.09);
}

/* Row of the chemical whose profile is open (table shown below a profile) */
.styled-table.chem-table tbody tr.chem-table-current td {
  background: rgba(40, 116, 252, 0.10);
  font-weight: 600;
}
.styled-table.chem-table tbody tr.chem-table-current td:first-child {
  box-shadow: inset 4px 0 0 var(--color-primary);
}

.chem-table-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.chem-table-tags .hazard-pill.chem-table-score,
.chem-table-tags .source-tag,
.chem-table .no-mea-badge {
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  border-radius: 20px;
  white-space: nowrap;
}

.chem-table-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.chem-table-text.mono {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  font-size: 12px;
}

.chem-table-empty {
  color: var(--color-grey-list);
}

.chem-table-no-match {
  padding: 24px !important;
  text-align: center;
  color: var(--color-text-muted) !important;
  font-style: italic;
  white-space: normal;
}

/* The header (with filters) and the body are separate tables with identical
   fixed column widths, so they read as one table. */
.chem-table-head {
  margin-bottom: 0;
}

.chem-table-body,
.chem-table-body > div {
  margin: 0;
  padding: 0;
}

.chem-table.chem-table-rows {
  border-top: none;
  table-layout: fixed;
}

.chem-table-body p {
  margin: 0;
}

/* =========================================================
   SHARED CHART-CARD EXTRAS (toggle, note, header, export)
   ========================================================= */

.chart-note {
  color: var(--color-text-muted);
  font-size: 12.5px;
  line-height: 1.5;
  margin: -4px 0 10px;
}

.chart-toggle {
  display: flex;
  gap: 16px;
  font-size: 12.5px;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.chart-toggle label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.chart-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.export-button {
  padding: 6px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-primary);
  border-radius: var(--border-radius-sm);
  color: var(--color-primary);
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.export-button:hover {
  background: var(--color-primary);
  color: #ffffff;
}

/* =========================================================
   SECTORS & USES PAGE
   ========================================================= */

.sector-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.sector-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 14px 14px 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-xs);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.sector-tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary);
}

.sector-tile.selected {
  border: 2px solid var(--color-primary);
  background: var(--color-hover-bg);
  padding: 13px 13px 11px;
}

.sector-tile.muted {
  background: #f7f9fb;
  border-style: dashed;
}

.sector-tile-name {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--color-primary-dark);
}

.sector-tile-value {
  font-size: 26px;
  font-weight: 900;
  line-height: 1.1;
  color: var(--color-text);
  margin-top: 4px;
}

.sector-tile-unit {
  font-size: 11.5px;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.sector-tile-bar {
  width: 100%;
  height: 6px;
  background: #eef1f5;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}

.sector-tile-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-red-list), var(--color-orange-list));
}

.sector-tile-stat {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text);
}

.sector-tile-stat.danger {
  font-weight: 400;
  color: var(--color-red-list);
}

.sector-table tbody tr.chem-table-row:hover td {
  background: rgba(40, 116, 252, 0.09);
}

.sector-table td {
  vertical-align: top;
}

.sector-table-name {
  display: block;
  font-weight: 600;
  color: var(--color-text);
}

.sector-table-cas {
  display: block;
  font-size: 11.5px;
  color: var(--color-text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* =========================================================
   CHEMICAL PROFILE (/chemical/<cas>) & COMPARE (/compare)
   ========================================================= */

.badge-mea { background: #e6e7f5; color: var(--color-primary-dark); }

.chem-hero h1.chem-hero-name { font-size: 24px; }

.profile-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.profile-actions-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.profile-back,
.profile-compare-status a {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
}

.profile-back:hover,
.profile-compare-status a:hover { text-decoration: underline; }

.sector-chip-row,
.jurisdiction-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 12px;
}

.sector-chip {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid #c9d8f5;
  background: var(--color-hover-bg);
  color: var(--color-primary-dark);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.sector-chip:hover {
  background: #dce8ff;
  border-color: var(--color-primary);
  color: var(--color-primary-dark);
}

.sector-chip:focus-visible,
.chem-table-row:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.fc-evidence {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 4px 0 12px;
}

.fc-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  background: #fff0e6;
  color: #b34a00;
}

.fc-badge.fc-migration { background: #fde8e8; color: #b91c1c; }
.fc-badge.fc-both      { background: #fde8e8; color: #b91c1c; }

.reg-status-pill {
  padding: 10px 14px;
  border-radius: var(--border-radius-sm);
  font-size: 13px;
  margin-bottom: 12px;
  border-left: 4px solid var(--color-grey-list);
  background: #f6f8fb;
}

.reg-status-pill.mea      { border-left-color: var(--color-primary-dark); }
.reg-status-pill.regional { border-left-color: var(--color-primary); }
.reg-status-pill.none     { border-left-color: var(--color-danger); background: #fdf2f2; }

.jurisdiction-pill {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: help;
}

.jurisdiction-pill.on  { background: var(--color-primary); color: #fff; }
.jurisdiction-pill.off { background: #f0f3f5; color: #64748b; }

.reg-block { margin-top: 10px; }

.upr-flag .upr-value { font-size: 18px; }
.upr-flag.no .upr-value { color: var(--color-text-light); font-weight: 600; }

.upr-note {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.info-banner.warning.compact {
  font-size: 12.5px;
  padding: 8px 12px;
  margin: 0 0 12px;
}

.similarity-table,
.compare-table {
  width: 100%;
  font-size: 13px;
}

.similarity-table .score-bar-row { min-width: 130px; gap: 6px; }
.similarity-table .score-bar-track { flex: 1; }

.similarity-table tbody tr.chem-table-row,
.result-card[data-href] { cursor: pointer; }

.similarity-table tbody tr.chem-table-row:hover td {
  background: rgba(40, 116, 252, 0.09);
}

.compare-table th[scope="row"] {
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-muted);
  white-space: nowrap;
  width: 190px;
  background: #f8fafc;
}

.compare-table thead th { vertical-align: bottom; min-width: 200px; }
.compare-table td { vertical-align: top; }

.compare-name {
  display: block;
  font-weight: 700;
  color: var(--color-primary-dark);
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13.5px;
}

.compare-name:hover { text-decoration: underline; }

.compare-remove {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-danger);
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
}

.compare-table { table-layout: fixed; }
.compare-table th,
.compare-table td,
.compare-table .fc-badge,
.compare-table .compare-name { white-space: normal; overflow-wrap: anywhere; }
.compare-table thead th { min-width: 0; }
.compare-table thead th:first-child,
.compare-table th[scope="row"] { width: 190px; white-space: normal; }

/* =========================================================
   REGULATION PAGE
   ========================================================= */

.kpi-note {
  font-size: 11.5px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.chart-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 20px;
}

.chart-toolbar .filter-heading { margin: 0; color: var(--color-text-muted); }
.inline-dropdown { min-width: 280px; flex: 0 1 420px; }

.table-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 6px 0 10px;
}

.table-control { flex: 1 1 180px; min-width: 160px; }
.table-control.wide { flex: 2 1 300px; }
.table-control .filter-heading { display: block; margin-bottom: 4px; color: var(--color-text-muted); }
.table-control .table-filter-input { width: 100%; }

/* =========================================================
   PRIORITISE PAGE
   ========================================================= */

.coverage-note {
  font-size: 13px;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-warning);
  border-radius: var(--border-radius-sm);
  padding: 9px 14px;
  margin-bottom: 18px;
}

.coverage-note a { color: var(--color-primary); font-weight: 600; }

.shortlist-card { border-top: 3px solid #ffd23f; }

.shortlist-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.copy-link-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-primary);
  cursor: pointer;
}

.export-button.subtle { border-color: var(--color-border); color: var(--color-text-muted); }

.shortlist-star,
.shortlist-remove {
  border: none;
  background: transparent;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: #9aabb8;
  padding: 2px 4px;
  border-radius: 4px;
}

.shortlist-star.on { color: #e3a008; }
.shortlist-remove { font-size: 14px; }
.shortlist-star:hover,
.shortlist-remove:hover { background: var(--color-hover-bg); color: var(--color-primary-dark); }
.shortlist-star:focus-visible,
.shortlist-remove:focus-visible { outline: 2px solid var(--color-primary); }

.zone-check label { font-size: 13px; display: flex; align-items: center; gap: 4px; margin-top: 8px; }

/* =========================================================
   HAZARDS & METHODS PAGES
   ========================================================= */

.chart-toggle-group { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }

.methods-toc {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 0;
  margin-bottom: 8px;
  background: var(--color-background);
}

.methods-toc a {
  font-size: 12.5px;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 20px;
  border: 1px solid #c9d8f5;
  background: var(--color-surface);
  color: var(--color-primary-dark);
  text-decoration: none;
}

.methods-toc a:hover { background: var(--color-hover-bg); border-color: var(--color-primary); }

.methods-section { scroll-margin-top: 64px; }
.methods-section h4 {
  font-size: 13px;
  font-weight: 700;
  margin: 14px 0 8px;
  color: var(--color-text);
}

.methods-steps { margin: 0 0 8px 18px; padding: 0; line-height: 1.6; font-size: 14px; }
.methods-table { width: 100%; font-size: 13px; }
.methods-table td { vertical-align: top; }

.coverage-table td:nth-child(3) { min-width: 200px; }
.coverage-bar {
  height: 6px;
  background: #eef2f7;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 3px;
}
.coverage-bar > div { height: 100%; background: var(--color-primary); }

.citation-box {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: #f6f8fb;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  padding: 12px 14px;
  margin-bottom: 10px;
  font-size: 13.5px;
}
.citation-box p { margin: 0; flex: 1; }

.methods-table td,
.methods-table th { white-space: normal; }

/* =========================================================
   KEY FINDINGS (/overview)
   ========================================================= */

.findings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  column-gap: 16px;
  row-gap: 0;               /* cards add their own bottom margin (subgrid rows) */
  margin-bottom: 10px;
}

/* Each card spans 5 shared rows (value, statement, chart, detail, actions) via
   subgrid, so charts and links line up across the cards of a row however long
   each statement is. */
.finding-card {
  background: var(--color-surface);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  border-top: 4px solid var(--color-grey-list);
  padding: 18px 20px 14px;
  margin-bottom: 16px;
  display: grid;
  grid-row: span 5;
  grid-template-rows: subgrid;
  row-gap: 0;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.finding-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.finding-card.red     { border-top-color: var(--color-red-list); }
.finding-card.orange  { border-top-color: var(--color-orange-list); }
.finding-card.primary { border-top-color: var(--color-primary); }

.finding-value {
  font-size: 34px;
  font-weight: 900;
  letter-spacing: -0.5px;
  line-height: 1.1;
  color: var(--color-text);
  margin-bottom: 8px;
}

.finding-card.red .finding-value { color: var(--color-red-list); }
.finding-card.orange .finding-value { color: #c75200; }
.finding-card.primary .finding-value { color: var(--color-primary-dark); }

.finding-statement {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--color-text);
  margin: 0 0 8px;
}

.finding-detail {
  font-size: 12.5px;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin: 0 0 12px;
  flex: 1;
}

/* Evidence chart inside a finding card (between statement and detail) */
.finding-chart {
  margin: 2px -4px 10px;
  min-height: 150px;
  display: flex;
  align-items: center;      /* shorter charts sit centred in the shared chart row */
}

.finding-chart > div { width: 100%; }
.finding-card .finding-detail { align-self: start; }
.finding-card .finding-actions { align-self: end; }

.finding-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--color-border);
  padding-top: 10px;
}

.finding-link {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
}

.finding-link:hover { text-decoration: underline; }

.finding-copy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--color-text-muted);
  cursor: pointer;
}

/* Keyboard access: [data-href] rows/cards are focusable (chem_table.js) */
[data-href]:focus-visible,
.sector-tile:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Source database references (Key Findings + Methods #databases) */
.source-refs-heading { margin: 8px 0 10px; font-size: 16px; }
.source-refs .source-ref-citation { white-space: normal; line-height: 1.45; min-width: 320px; }
.source-refs td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Profile "similar chemicals" tables scroll inside their card on narrow screens */
.similarity-table-wrap { overflow-x: auto; }

/* Phone drawer backdrop (shown only by the phone rules below) */
#sidebar-backdrop { display: none; }

/* =========================================================
   PHONES (≤ 768px)
   The sidebar is collapsed by default (assets/sidebar.js): a slim frosted top
   bar holding only the icon tile. Tapping the tile opens the menu as a drawer
   over the page; it is drawn back into the icon on backdrop tap, Escape or
   navigation. Content gets the full width, one column, and wide charts/tables
   scroll sideways inside their card.
   ========================================================= */
@media (max-width: 768px) {
  /* ----- Sidebar: top bar (collapsed) / drawer (open) ----- */
  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
    transition: none;
  }
  #sidebar-logo { padding: 8px 16px 14px; }
  .sidebar-icon { width: 34px; height: 40px; }
  .sidebar-icon::before { left: -3px; width: 40px; height: 40px; border-radius: 10px; }
  .sidebar-wordmark { width: 60px; }
  .sidebar-toggle {                      /* 36px touch target */
    top: 10px;
    left: calc(var(--sidebar-width) - 16px - 36px);
    width: 36px;
    height: 36px;
  }

  html.sb-collapsed #sidebar {
    width: 100%;
    height: 56px;
    background: rgba(241, 243, 246, 0.9);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-border);
    box-shadow: none;
  }
  html.sb-collapsed #sidebar-logo { padding: 8px 16px; }
  html.sb-collapsed .sidebar-brand { margin-bottom: 0; }

  /* While animating, the page shows through around the shrinking blue panel. */
  html.sb-animating #sidebar { background: transparent; box-shadow: none; }

  #sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(2, 3, 129, 0.38);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
  }
  html:not(.sb-collapsed) #sidebar-backdrop {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease;
  }
  html.sb-collapsing #sidebar-backdrop { opacity: 0; }
  html:not(.sb-collapsed) body { overflow: hidden; }   /* page doesn't scroll under the drawer */

  /* ----- Page frame ----- */
  #page-content { padding: 72px 14px 36px; }   /* clears the 56px top bar */

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 18px;
    padding-bottom: 14px;
  }
  .page-header h1 { font-size: 22px; }
  .page-header p { font-size: 13.5px; }

  .grid-2,
  .grid-3 { grid-template-columns: minmax(0, 1fr); gap: 14px; }

  .chart-card { padding: 16px 14px 14px; margin-bottom: 14px; }
  .chart-card h3 { font-size: 13px; margin-bottom: 12px; }

  /* KPIs two per row */
  .kpi-row { gap: 10px; margin-bottom: 18px; }
  .kpi-card { flex: 1 1 calc(50% - 5px); min-width: 0; padding: 14px 14px 12px; }
  .kpi-value { font-size: 24px; }
  .kpi-label { font-size: 10.5px; letter-spacing: 0.5px; }

  /* Key Findings: one card per row */
  .findings-grid { grid-template-columns: minmax(0, 1fr); }
  .finding-card { padding: 16px 16px 12px; }
  .finding-value { font-size: 30px; }

  /* Sectors: two tiles per row */
  .sector-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

  /* Controls wrap instead of overflowing */
  .chart-toggle { flex-wrap: wrap; gap: 6px 14px; }
  .chart-toggle-group { gap: 8px; }
  .table-pagination { flex-wrap: wrap; gap: 8px; }
  .page-btn { padding: 6px 12px; }
  .inline-dropdown { min-width: 0; flex: 1 1 100%; max-width: 100%; }
  .search-input { min-width: 0; }

  /* Tables: tighter cells; wide ones scroll inside .styled-table-wrap */
  .styled-table th,
  .styled-table td { padding: 8px 10px; }
  .source-refs .source-ref-citation { min-width: 220px; }

  /* Heatmaps keep a readable size and swipe sideways inside their card */
  #hazard-coverage, #hazard-cooccurrence, #reg-list-heat, #reg-gap-heat,
  #sectors-endpoint-heat, #sectors-jurisdiction-heat, #sectors-overlap-heat {
    min-width: 600px;
  }
  .chart-card:has(#hazard-coverage, #hazard-cooccurrence, #reg-list-heat, #reg-gap-heat,
                  #sectors-endpoint-heat, #sectors-jurisdiction-heat, #sectors-overlap-heat) {
    overflow-x: auto;
  }
  .chart-card:has(#hazard-coverage, #hazard-cooccurrence, #reg-list-heat, #reg-gap-heat,
                  #sectors-endpoint-heat, #sectors-jurisdiction-heat, #sectors-overlap-heat) h3::after {
    content: "Swipe \2192";
    margin-left: auto;
    padding-left: 8px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: var(--color-text-muted);
    text-transform: none;
    white-space: nowrap;
  }

  /* No Plotly toolbar on touch screens (zoom/pan buttons are fiddly there) */
  .modebar-container { display: none !important; }

  /* ----- Chemical profile ----- */
  .chem-hero { padding: 16px 14px; }
  .chem-hero-name { font-size: 18px; }
  .scores-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .score-meter-card { padding: 12px 6px 10px; }
  .score-meter-value { font-size: 22px; margin-bottom: 8px; }

  /* Key/value tables stack: label above value; long identifiers break anywhere */
  .detail-table,
  .detail-table tbody,
  .detail-table tr,
  .detail-table td { display: block; width: auto; }
  .detail-table tr { padding: 8px 0; border-bottom: 1px solid var(--color-border); }
  .detail-table tr:last-child { border-bottom: none; }
  .detail-table td { padding: 0; border: none; }
  .detail-table td:first-child {
    width: auto;
    margin-bottom: 2px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: normal;
  }
  .detail-table td:last-child { overflow-wrap: anywhere; }
  .detail-table tr:hover td { background: none; }

  /* ----- Compare: attribute column stays put while chemicals swipe ----- */
  .compare-table th[scope="row"] {
    width: auto;
    min-width: 126px;               /* fits "BIOACCUMULATION" on one line */
    max-width: 132px;
    white-space: normal;
    position: sticky;
    left: 0;
    z-index: 1;
  }
  .compare-table {                      /* wider than the screen; swipes in its card */
    table-layout: auto;
    width: max-content;
    min-width: 100%;
  }
  .compare-table thead th,
  .compare-table td { min-width: 150px; max-width: 190px; }
  .compare-table thead th:first-child { min-width: 0; width: 1px; }   /* empty corner cell */
  .compare-table th[scope="row"] { padding: 8px; font-size: 11px; }

  /* ----- Methods: sticky contents bar sits under the top bar ----- */
  .methods-toc { top: 56px; }
  .methods-section { scroll-margin-top: 120px; }
}
