@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;450;500;600;700&display=swap');

/* ══════════════════════════════════════════════════════════════════════
   Design tokens
   ══════════════════════════════════════════════════════════════════════ */

:root {
  --c-co2:    #3B82F6;
  --c-temp:   #EF4444;
  --c-rh:     #10B981;
  --c-mould:  #F97316;

  --bg:           #FAFBFC;
  --bg-tint:      #F4F6FA;
  --surface:      #FFFFFF;
  --surface-2:    #F8FAFC;
  --surface-tint: #F1F5F9;

  --border:       rgba(15, 23, 42, 0.07);
  --border-soft:  rgba(15, 23, 42, 0.04);
  --border-focus: rgba(59, 130, 246, 0.40);

  --text:    #0F172A;
  --muted:   #475569;
  --subtle:  #94A3B8;

  --red:    #DC2626;
  --amber:  #D97706;
  --green:  #16A34A;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.03);
  --shadow-md: 0 1px 2px rgba(15, 23, 42, 0.05), 0 4px 16px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 4px 12px rgba(15, 23, 42, 0.06), 0 16px 40px rgba(15, 23, 42, 0.08);
  --shadow-focus: 0 0 0 3px rgba(59, 130, 246, 0.16);

  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --t-fast: 0.14s cubic-bezier(0.4, 0, 0.2, 1);
  --t-base: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ══════════════════════════════════════════════════════════════════════
   Reset + base
   ══════════════════════════════════════════════════════════════════════ */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 1200px 600px at 50% -200px,
                    rgba(59, 130, 246, 0.07) 0%,
                    transparent 70%);
  background-attachment: fixed;
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  overflow-x: hidden;
}

/* Sentinel for callbacks to feature-detect new design from JS */
body::after {
  content: "ui-v2";
  display: none;
}

/* ══════════════════════════════════════════════════════════════════════
   App shell + entry animation
   ══════════════════════════════════════════════════════════════════════ */

#app-shell {
  animation: riseIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* ── Focus styles ─────────────────────────────────────── */

button, a, input, textarea, select {
  outline: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  box-shadow: var(--shadow-focus) !important;
  border-color: var(--c-co2) !important;
}

/* ══════════════════════════════════════════════════════════════════════
   Dashboard header
   ══════════════════════════════════════════════════════════════════════ */

#dashboard-header {
  background: linear-gradient(180deg, #FFFFFF 0%, #FAFCFF 100%) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-sm) !important;
  border-radius: var(--radius-lg) !important;
  position: relative;
  /* No overflow:hidden — it would clip the Period dropdown popup and the
     weather tooltip. The ::before accent line is inset so it stays
     visually within the rounded corners. */
}

#dashboard-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 14px;
  right: 14px;
  height: 1px;
  background: linear-gradient(90deg,
              transparent 0%,
              rgba(59, 130, 246, 0.30) 50%,
              transparent 100%);
  pointer-events: none;
}

#dashboard-header h1 {
  font-feature-settings: "ss01" on, "cv11" on;
}

/* ══════════════════════════════════════════════════════════════════════
   KPI cards — minimal, value-forward
   ══════════════════════════════════════════════════════════════════════ */

.kpi-card {
  position: relative;
  transition: transform var(--t-base), box-shadow var(--t-base), border-color var(--t-base);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  min-width: 0;
}

.kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: currentColor;
  opacity: 0;
  transition: opacity var(--t-base);
}

.kpi-card:hover {
  transform: translateY(-1px);
  border-color: rgba(15, 23, 42, 0.12);
  box-shadow: var(--shadow-md);
}

.kpi-card:hover::before {
  opacity: 0.55;
}

/* ══════════════════════════════════════════════════════════════════════
   Tabs — pill segmented control (Linear/Notion style)
   ══════════════════════════════════════════════════════════════════════ */

.tab-shell {
  display: flex;
  width: 100%;
  background: var(--surface-tint);
  border-radius: 11px;
  padding: 4px;
  border: 1px solid var(--border-soft);
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  box-sizing: border-box;
}
.tab-shell::-webkit-scrollbar { display: none; }

/* dcc.Tabs renders an inner wrapper (tab-container / tab-parent).
   Force it to a single horizontal row — Dash's JSX-scoped styles default to
   flex-direction:column, so we must override both display and direction. */
.tab-shell .tab-container,
.tab-shell .tab-parent {
  display: flex !important;
  flex-direction: row !important;
  flex: 1 1 auto !important;
  flex-wrap: nowrap !important;
  border: none !important;
  padding: 0 !important;
  background: transparent !important;
  width: 100% !important;
}

/* Each tab takes an equal slice of the shell. */
.tab-shell .tab {
  flex: 1 1 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  min-width: 0 !important;
  width: auto !important;
  font-family: inherit !important;
  transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast) !important;
  cursor: pointer !important;
  user-select: none !important;
}

.tab-shell .tab:hover:not(.tab--selected) {
  background: rgba(255, 255, 255, 0.55) !important;
  color: var(--text) !important;
}

/* dcc.Tabs may render an empty content panel after the tab headers —
   we render the actual content in #tab-content, so suppress it here. */
.tab-shell .tab-content {
  display: none !important;
}

/* ── Reset legacy Dash tab classes ─────────────────────── */

.tab-content,
.tab-parent {
  border: none !important;
  padding: 0 !important;
  background: transparent !important;
}

.tab-parent {
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.tab-parent::-webkit-scrollbar { display: none; }

/* ══════════════════════════════════════════════════════════════════════
   Tab content fade-in
   ══════════════════════════════════════════════════════════════════════ */

#tab-content > div {
  animation: fadeUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* ══════════════════════════════════════════════════════════════════════
   Chart cards
   ══════════════════════════════════════════════════════════════════════ */

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--t-base), box-shadow var(--t-base);
}

.chart-card:hover {
  border-color: rgba(15, 23, 42, 0.10);
  box-shadow: var(--shadow-sm);
}

/* ══════════════════════════════════════════════════════════════════════
   Section labels — softer Linear style
   ══════════════════════════════════════════════════════════════════════ */

.section-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: -0.005em;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-label::before {
  content: "";
  width: 3px;
  height: 12px;
  background: currentColor;
  border-radius: 2px;
  opacity: 0.4;
}

/* ══════════════════════════════════════════════════════════════════════
   Alert banner pulses
   ══════════════════════════════════════════════════════════════════════ */

.alert-critical {
  animation: pulseRed 2.6s ease-in-out infinite;
  border-radius: var(--radius) !important;
}

.alert-moderate {
  animation: pulseAmber 2.6s ease-in-out infinite;
  border-radius: var(--radius) !important;
}

@keyframes pulseRed {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.22); }
  50%      { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
}

@keyframes pulseAmber {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.22); }
  50%      { box-shadow: 0 0 0 8px rgba(217, 119, 6, 0); }
}

/* ══════════════════════════════════════════════════════════════════════
   Slider + dropdown overrides
   ══════════════════════════════════════════════════════════════════════ */

.rc-slider-rail  { background: #E2E8F0; height: 5px; }
.rc-slider-track { background: var(--c-co2); height: 5px; }
.rc-slider-handle {
  border-color: var(--c-co2);
  background: #fff;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t-fast);
}
.rc-slider-handle:hover,
.rc-slider-handle:focus {
  border-color: #2563EB;
  box-shadow: var(--shadow-focus);
}
.rc-slider-mark-text {
  font-size: 11px;
  color: var(--muted);
  font-family: inherit;
}

/* Dash dropdown */
.Select-control,
.dash-dropdown .Select-control {
  border-radius: var(--radius-sm) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-xs) !important;
  font-family: inherit !important;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.Select-control:hover {
  border-color: rgba(15, 23, 42, 0.18) !important;
  box-shadow: var(--shadow-sm) !important;
}
.is-focused:not(.is-open) > .Select-control {
  border-color: var(--c-co2) !important;
  box-shadow: var(--shadow-focus) !important;
}

/* ══════════════════════════════════════════════════════════════════════
   Logout button hover
   ══════════════════════════════════════════════════════════════════════ */

#logout-btn {
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}

#logout-btn:hover {
  background: var(--surface-tint) !important;
  color: var(--text) !important;
  border-color: rgba(15, 23, 42, 0.14) !important;
}

/* ══════════════════════════════════════════════════════════════════════
   Mobile
   ══════════════════════════════════════════════════════════════════════ */

/* Tablet portrait: header still in one row but weather chip wraps cleanly */
@media (max-width: 768px) {
  #dashboard-header {
    flex-wrap: wrap !important;
    row-gap: 10px !important;
  }
  #header-weather-chip {
    order: 5 !important;
    flex: 0 0 100% !important;
    display: flex !important;
    justify-content: flex-start !important;
  }
}

/* Phone portrait: stack everything into clean rows; weather chip prominent */
@media (max-width: 640px) {
  #app-shell {
    padding: 14px 12px !important;
  }

  #dashboard-header {
    flex-wrap: wrap !important;
    row-gap: 8px !important;
    padding: 12px 14px !important;
  }

  #dashboard-header h1 {
    font-size: 18px !important;
    min-width: 0 !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Title div: takes available space in first row */
  #dashboard-header > div:first-child {
    flex: 1 1 auto;
    min-width: 0;
  }

  /* Right-side cluster: notif/theme/period/logout — own full-width row, right-aligned */
  #dashboard-header > div:last-child {
    flex: 0 0 100% !important;
    flex-wrap: nowrap !important;
    gap: 6px !important;
    justify-content: flex-end !important;
    order: 2 !important;
  }

  /* Nav pill: own full-width row below title + controls */
  #dashboard-header .nav-links {
    order: 3 !important;
    flex: 0 0 100% !important;
    justify-content: center !important;
  }

  /* Period dropdown is 150px on desktop — too wide for mobile.
     Also force the inner Select-control (which react-select may size
     independently) to fill the constrained outer container. */
  #dashboard-header #period {
    width: 110px !important;
    min-width: 110px !important;
    max-width: 110px !important;
  }
  #dashboard-header #period .Select,
  #dashboard-header #period .Select-control {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  /* Weather chip: full-width row, prominent, never hidden */
  #header-weather-chip {
    order: 4 !important;
    flex: 0 0 100% !important;
    width: 100% !important;
    display: flex !important;
    justify-content: flex-start !important;
    margin-top: 2px;
  }
  /* The chip itself — make it stretch so the tooltip arrow direction works */
  #header-weather-chip .weather-chip-wrapper {
    width: 100%;
    display: flex;
  }
  #header-weather-chip .weather-chip-wrapper > div:first-child {
    flex: 1;
    justify-content: flex-start;
    padding: 7px 12px !important;
  }
  /* Tooltip on mobile: anchor to viewport (full width minus margins) */
  #header-weather-chip .weather-tooltip {
    left: 0 !important;
    right: 0 !important;
    min-width: 0 !important;
    width: 100% !important;
  }

  .tab-shell {
    width: 100%;
  }

  .chart-card {
    padding: 14px 14px;
  }

  /* KPI cards: allow all text to wrap so nothing gets clipped on narrow screens */
  .kpi-card-header {
    overflow: visible !important;
    align-items: flex-start !important;
  }
  .kpi-title {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    line-height: 1.3 !important;
  }
  .kpi-value {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
  }
  .kpi-unit {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
  }
  .kpi-sub {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    line-height: 1.4 !important;
  }

  /* Tab labels: allow wrapping so "Dauw & schimmel" fits in a narrow slot */
  .tab-shell .tab {
    padding: 7px 5px !important;
    font-size: 11.5px !important;
    white-space: normal !important;
    line-height: 1.25 !important;
    min-height: 36px !important;
  }

}

/* Small phones (iPhone SE etc.) — compress further */
@media (max-width: 420px) {
  #dashboard-header {
    padding: 10px 12px !important;
  }
  /* Notifications bell + theme toggle + logout shrink */
  #dashboard-header #logout-btn {
    padding: 6px 10px !important;
    font-size: 12px !important;
  }
  #dashboard-header .theme-toggle-btn {
    padding: 6px !important;
  }
  /* Period dropdown narrower still */
  #dashboard-header #period {
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
    font-size: 12px !important;
  }
  #dashboard-header #period .Select,
  #dashboard-header #period .Select-control {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
  /* Nav pill text smaller */
  #dashboard-header .nav-link {
    padding: 5px 10px !important;
    font-size: 12px !important;
  }
}

@media (max-width: 380px) {
  #metric-cards {
    grid-template-columns: 1fr !important;
  }
  #dashboard-header h1 {
    font-size: 16px !important;
  }
}

/* ══════════════════════════════════════════════════════════════════════
   Chat Widget
   ══════════════════════════════════════════════════════════════════════ */

.chat-widget {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  font-family: inherit;
  pointer-events: none;
}

/* ── Toggle button ── */
.chat-toggle-btn {
  pointer-events: auto;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 4px 16px rgba(59, 130, 246, 0.36),
    0 1px 3px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition:
    transform  0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow var(--t-fast);
  flex-shrink: 0;
  padding: 0;
  color: #fff;
}

.chat-toggle-btn:hover {
  transform: scale(1.08);
  box-shadow:
    0 6px 24px rgba(59, 130, 246, 0.46),
    0 2px 6px rgba(15, 23, 42, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.chat-toggle-btn:active {
  transform: scale(0.94);
  transition-duration: 0.08s;
}

/* ── Chat panel ── */
.chat-panel {
  width: 400px;
  height: 580px;
  background: #FFFFFF;
  border-radius: 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.88) translateY(16px);
  opacity: 0;
  pointer-events: none;
  transform-origin: bottom right;
  transition:
    transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity   0.22s ease;
}

.chat-panel.chat-open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ── Header ── */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: linear-gradient(180deg, #FFFFFF 0%, #FAFCFF 100%);
}

.chat-online-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  margin-right: 6px;
  box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.4);
  animation: onlinePulse 2.4s ease-in-out infinite;
}

@keyframes onlinePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.40); }
  50%      { box-shadow: 0 0 0 4px rgba(22, 163, 74, 0); }
}

/* ── Scrollable content area ── */
.chat-content-area {
  flex: 1;
  overflow-y: auto;
  scroll-behavior: smooth;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#chat-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.chat-content-area::-webkit-scrollbar { width: 4px; }
.chat-content-area::-webkit-scrollbar-track { background: transparent; }
.chat-content-area::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.12);
  border-radius: 2px;
}

/* ── Empty state ── */
.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex: 1;
  padding: 24px 20px;
  text-align: center;
}

.chat-empty-suggestions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 280px;
  margin-top: 8px;
}

.chat-suggestion-chip {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.4;
  transition: background var(--t-fast), border-color var(--t-fast), transform 0.08s ease;
}

.chat-suggestion-chip:hover {
  background: #EFF6FF;
  border-color: rgba(59, 130, 246, 0.30);
  transform: translateX(2px);
}

.chat-suggestion-chip:active {
  transform: translateX(2px) scale(0.99);
}

/* ── Icon-only buttons in header ── */
.chat-btn-icon-only {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: background var(--t-fast), color var(--t-fast);
}

.chat-btn-icon-only:hover {
  background: rgba(15, 23, 42, 0.06);
  color: var(--text);
}

/* ── History session row ── */
.chat-session-row {
  width: 100%;
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--t-fast), border-color var(--t-fast), transform 0.12s ease;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}

.chat-session-row:hover {
  background: #EFF6FF;
  border-color: rgba(59, 130, 246, 0.22);
  transform: translateY(-1px);
}

/* ── Typing indicator ── */
.chat-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: var(--surface-tint);
  border-radius: 16px 16px 16px 4px;
  width: fit-content;
}

.chat-typing span {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--subtle);
  animation: typingBounce 1.2s ease-in-out infinite;
}

.chat-typing span:nth-child(2) { animation-delay: 0.18s; }
.chat-typing span:nth-child(3) { animation-delay: 0.36s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0);    opacity: 0.45; }
  40%           { transform: translateY(-5px); opacity: 1;    }
}

/* ── User message ── */
.chat-msg-user {
  background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
  color: #fff;
  padding: 9px 13px;
  border-radius: 16px 16px 4px 16px;
  font-size: 13px;
  line-height: 1.5;
  max-width: 86%;
  word-wrap: break-word;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.22);
  animation: msgIn 0.18s ease-out;
}

/* ── Assistant message ── */
.chat-msg-assistant {
  background: var(--surface-tint);
  color: var(--text);
  padding: 9px 13px;
  border-radius: 16px 16px 16px 4px;
  font-size: 13px;
  line-height: 1.55;
  max-width: 86%;
  word-wrap: break-word;
  white-space: pre-wrap;
  animation: msgIn 0.18s ease-out;
}

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

.chat-msg-assistant p { margin: 2px 0; }
.chat-msg-assistant ul { margin: 4px 0 4px 2px; padding-left: 16px; }
.chat-msg-assistant li { margin-bottom: 2px; line-height: 1.5; }
.chat-msg-assistant strong { font-weight: 700; }
.chat-msg-assistant em { font-style: italic; }

/* ── Input area ── */
.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: #fff;
  flex-shrink: 0;
}

.chat-text-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface-2);
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  min-width: 0;
  resize: none;
  line-height: 1.45;
  max-height: 120px;
  overflow-y: auto;
}

.chat-text-input:focus {
  border-color: var(--c-co2);
  background: #fff;
  box-shadow: var(--shadow-focus);
}

.chat-text-input::placeholder { color: var(--subtle); }

/* ── Send button (paper plane SVG) ── */
.chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  transition: transform var(--t-fast), background var(--t-fast), box-shadow var(--t-fast), opacity var(--t-fast);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.28);
}

.chat-send-btn:hover { transform: scale(1.06); box-shadow: 0 4px 14px rgba(59, 130, 246, 0.38); }
.chat-send-btn:active { transform: scale(0.94); transition-duration: 0.08s; }

.chat-send-icon {
  display: block;
  width: 14px;
  height: 14px;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M22 2 11 13'/><path d='M22 2 15 22 11 13 2 9 22 2z'/></svg>") no-repeat center / contain;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M22 2 11 13'/><path d='M22 2 15 22 11 13 2 9 22 2z'/></svg>") no-repeat center / contain;
  transform: translateX(-1px) translateY(0px);
}

.chat-send-btn[disabled],
.chat-send-btn.disabled {
  background: var(--surface-tint);
  color: var(--subtle);
  opacity: 1;
  cursor: not-allowed;
  transform: none;
  box-shadow: var(--shadow-xs);
}

.chat-send-btn[disabled]:hover,
.chat-send-btn.disabled:hover {
  background: var(--surface-tint);
  transform: none;
  box-shadow: var(--shadow-xs);
}

/* ── Message timestamp ── */
.chat-msg-time {
  font-size: 10px;
  color: var(--subtle);
  margin-top: 3px;
  padding: 0 2px;
  letter-spacing: 0.02em;
}

/* ── Feedback buttons (👍 👎) ── */
.chat-fb-row {
  display: flex;
  gap: 2px;
  margin-top: 3px;
  margin-left: 2px;
}

.chat-fb-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 13px;
  cursor: pointer;
  line-height: 1.6;
  font-family: inherit;
  opacity: 0.35;
  transition: opacity var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}

.chat-fb-btn:hover {
  opacity: 0.75;
  background: var(--surface-tint);
  border-color: var(--border);
}

.chat-fb-active-up {
  opacity: 1;
  background: rgba(22, 163, 74, 0.09);
  border-color: rgba(22, 163, 74, 0.28);
}

.chat-fb-active-down {
  opacity: 1;
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.25);
}

/* ── Feedback cluster + inline comment (revealed once the user votes) ── */
.chat-fb-cluster {
  display: flex; flex-direction: column;
  margin-top: 3px;
  max-width: 86%;
}

.chat-fb-ack {
  font-size: 10.5px;
  color: var(--subtle);
  margin-left: 6px;
  font-style: italic;
  align-self: center;
}

.chat-fb-comment-row {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  margin-top: 0;
  transition:
    max-height 0.22s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.18s ease,
    margin-top 0.22s ease;
}

/* Open via server-side modifier class (history reload) or via :has() once
   the user clicks a thumb in the same cluster (modern browsers). */
.chat-fb-comment-row--open,
.chat-fb-cluster:has(.chat-fb-active-up) .chat-fb-comment-row,
.chat-fb-cluster:has(.chat-fb-active-down) .chat-fb-comment-row {
  max-height: 60px;
  opacity: 1;
  margin-top: 6px;
}

.chat-fb-comment-input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  padding: 6px 10px;
  color: var(--text);
  font-family: inherit;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.chat-fb-comment-input::placeholder { color: var(--subtle); }
.chat-fb-comment-input:focus {
  background: var(--surface);
  border-color: var(--c-co2);
  box-shadow: var(--shadow-focus);
}

body.dark .chat-fb-comment-input {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

/* ── Error bubble ── */
.chat-bubble-error {
  background: #FEF2F2;
  color: var(--red);
  padding: 9px 13px;
  border-radius: 16px 16px 16px 4px;
  font-size: 13px;
  line-height: 1.5;
  max-width: 86%;
  word-wrap: break-word;
  border: 1px solid rgba(220, 38, 38, 0.20);
  animation: msgIn 0.18s ease-out;
}

/* ══════════════════════════════════════════════════════════════════════
   Weather chip + tooltip
   ══════════════════════════════════════════════════════════════════════ */

.weather-chip-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.weather-tooltip {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 260px;
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 14px 16px;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.weather-chip-wrapper:hover .weather-tooltip {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* ── Weather section ── */
.weather-card {
  background: rgba(255, 255, 255, 0.78);
  border-radius: 10px;
  border: 1px solid rgba(59, 130, 246, 0.10);
  padding: 10px 12px;
  min-width: 72px;
  transition: box-shadow var(--t-fast), transform var(--t-fast);
}

.weather-card:hover {
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.14);
  transform: translateY(-1px);
}

/* ══════════════════════════════════════════════════════════════════════
   Feedback widget
   ══════════════════════════════════════════════════════════════════════ */

.feedback-widget {
  position: fixed;
  bottom: 28px;
  left: 28px;
  z-index: 999;
  font-family: inherit;
  pointer-events: none;
}

.feedback-toggle-btn {
  pointer-events: auto;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 16px 9px 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}

.feedback-toggle-btn:hover {
  background: #FFFFFF;
  color: var(--text);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: rgba(15, 23, 42, 0.12);
}

.feedback-toggle-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.feedback-panel {
  pointer-events: none;
  position: absolute;
  bottom: calc(100% + 12px);
  left: 0;
  width: 320px;
  background: #FFFFFF;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 18px;
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  transform-origin: bottom left;
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.feedback-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.feedback-stars {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  margin: 10px 0 12px;
}

.feedback-star {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  color: var(--subtle);
  font-size: 22px;
  line-height: 1;
  transition: color var(--t-fast), background var(--t-fast), transform 0.08s ease;
}

.feedback-star:hover {
  background: var(--surface-tint);
}

.feedback-star.active {
  color: #F59E0B;
  transform: scale(1.05);
}

.feedback-textarea {
  width: 100%;
  min-height: 60px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--text);
  background: var(--surface-2);
  resize: vertical;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  box-sizing: border-box;
  line-height: 1.5;
}

.feedback-textarea:focus {
  border-color: var(--c-co2);
  background: #fff;
  box-shadow: var(--shadow-focus);
}

.feedback-submit {
  margin-top: 10px;
  width: 100%;
  padding: 9px 14px;
  background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.24);
  transition: transform var(--t-fast), box-shadow var(--t-fast), opacity var(--t-fast);
}

.feedback-submit:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(59, 130, 246, 0.34); }
.feedback-submit:active { transform: translateY(0); }
.feedback-submit[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: var(--shadow-xs); }

.feedback-thanks {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 0 6px;
  text-align: center;
  color: var(--text);
  font-size: 13px;
}

/* ══════════════════════════════════════════════════════════════════════
   Insight card (Feature 1)
   ══════════════════════════════════════════════════════════════════════ */

.insight-card {
  position: relative;
  background:
    linear-gradient(135deg,
                    rgba(59, 130, 246, 0.04) 0%,
                    rgba(16, 185, 129, 0.04) 100%),
    #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px 14px 18px;
  margin-bottom: 14px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.insight-card::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--c-co2) 0%, var(--c-rh) 100%);
}

.insight-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.10);
  color: var(--c-co2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

/* ══════════════════════════════════════════════════════════════════════
   Notification bell
   ══════════════════════════════════════════════════════════════════════ */

.notif-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.notif-toggle-btn {
  position: relative;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px 9px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}

.notif-toggle-btn:hover {
  background: var(--surface-tint);
  border-color: rgba(15, 23, 42, 0.12);
  color: var(--text);
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px #fff;
  letter-spacing: -0.02em;
}

.notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  max-width: calc(100vw - 32px);
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 12px;
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px) scale(0.97);
  transform-origin: top right;
  transition: opacity 0.18s ease, transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.notif-panel.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* On mobile the bell sits on the left side of the full-width controls row,
   so "right: 0" relative to .notif-wrap puts the panel far off-screen to the
   left.  Switch to a fixed overlay anchored below the header instead. */
@media (max-width: 640px) {
  .notif-panel {
    position: fixed;
    top: 200px;
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
    transform-origin: top center;
  }
}

.notif-mark-all {
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  padding: 4px 7px;
  border-radius: 6px;
  transition: background var(--t-fast), color var(--t-fast);
}

.notif-mark-all:hover {
  background: var(--surface-tint);
  color: var(--text);
}

.notif-list {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.notif-list::-webkit-scrollbar { width: 4px; }
.notif-list::-webkit-scrollbar-thumb { background: rgba(15, 23, 42, 0.10); border-radius: 2px; }

.notif-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 9px;
  cursor: pointer;
  transition: background var(--t-fast);
}

.notif-row:hover {
  background: var(--surface-tint);
}

/* ══════════════════════════════════════════════════════════════════════
   Mobile chat panel
   ══════════════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
  .chat-widget { bottom: 18px; right: 14px; }
  .chat-panel  { width: calc(100vw - 28px); height: 75vh; max-height: 580px; }

  .feedback-widget { bottom: 18px; left: 14px; }
  .feedback-panel  { width: calc(100vw - 28px); max-width: 320px; }
  .feedback-toggle-btn { padding: 8px 14px 8px 11px; font-size: 12px; }
}

/* ══════════════════════════════════════════════════════════════════════
   Banners — light theme defaults; dark theme overrides below
   ══════════════════════════════════════════════════════════════════════ */

.banner {
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 8px;
  border: 1px solid transparent;
}

.banner-info {
  background: #EFF6FF;
  border-color: #3B82F6;
  border-left: 4px solid #3B82F6;
  color: #1D4ED8;
}
.banner-critical {
  background: #FEF2F2;
  border-color: #DC2626;
  border-left: 4px solid #DC2626;
  color: #DC2626;
}
.banner-amber {
  background: #FFFBEB;
  border-color: #D97706;
  border-left: 4px solid #D97706;
  color: #D97706;
}
.banner-green {
  background: #F0FDF4;
  border-color: #16A34A;
  border-left: 4px solid #16A34A;
  color: #166534;
}

body.dark .banner-info {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.45);
  border-left-color: #3B82F6;
  color: #93C5FD;
}
body.dark .banner-critical {
  background: rgba(220, 38, 38, 0.15);
  border-color: rgba(220, 38, 38, 0.45);
  border-left-color: #DC2626;
  color: #FCA5A5;
}
body.dark .banner-amber {
  background: rgba(217, 119, 6, 0.15);
  border-color: rgba(217, 119, 6, 0.45);
  border-left-color: #D97706;
  color: #FCD34D;
}
body.dark .banner-green {
  background: rgba(22, 163, 74, 0.15);
  border-color: rgba(22, 163, 74, 0.45);
  border-left-color: #16A34A;
  color: #86EFAC;
}

/* ── Finding rows (Diagnose tab) ─────────────────────────────────────── */

.finding-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 9px 12px;
  border-radius: 8px;
  margin-bottom: 6px;
}
.finding-row--red    { background: #FEF2F2; }
.finding-row--amber  { background: #FFFBEB; }
.finding-row--green  { background: #F0FDF4; }

body.dark .finding-row--red   { background: rgba(220, 38, 38, 0.15); }
body.dark .finding-row--amber { background: rgba(217, 119, 6, 0.15); }
body.dark .finding-row--green { background: rgba(22, 163, 74, 0.15); }

/* ── Recommendation rows ──────────────────────────────────────────── */

.recommendation-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 14px;
  background: rgba(59, 130, 246, 0.04);
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: 8px;
  margin-bottom: 6px;
}
body.dark .recommendation-row {
  background: rgba(59, 130, 246, 0.10);
  border-color: rgba(59, 130, 246, 0.25);
}

/* ── KPI badges ──────────────────────────────────────────────────── */

.kpi-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  background: var(--surface-2);
}
.kpi-badge--red    { background: #FEF2F2; }
.kpi-badge--amber  { background: #FFFBEB; }
.kpi-badge--green  { background: #F0FDF4; }

body.dark .kpi-badge--red   { background: rgba(220, 38, 38, 0.18); }
body.dark .kpi-badge--amber { background: rgba(217, 119, 6, 0.18); }
body.dark .kpi-badge--green { background: rgba(22, 163, 74, 0.18); }

/* ── KPI progress bar track ─────────────────────────────────────── */

.kpi-progress-track {
  margin-top: 10px;
  height: 3px;
  background: rgba(15, 23, 42, 0.06);
  border-radius: 2px;
  overflow: hidden;
}
body.dark .kpi-progress-track {
  background: rgba(255, 255, 255, 0.08);
}

/* ══════════════════════════════════════════════════════════════════════
   Theme toggle button
   ══════════════════════════════════════════════════════════════════════ */

.theme-toggle-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px 9px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform var(--t-fast);
  flex-shrink: 0;
}

.theme-toggle-btn:hover {
  background: var(--surface-tint);
  border-color: rgba(15, 23, 42, 0.14);
  color: var(--text);
  transform: scale(1.08);
}

.theme-toggle-btn:active { transform: scale(0.94); }

#theme-icon-sun  { display: none; }
#theme-icon-moon { display: inline; }

/* ══════════════════════════════════════════════════════════════════════
   Dark theme — CSS variable overrides
   ══════════════════════════════════════════════════════════════════════ */

body.dark {
  --bg:           #0D1117;
  --bg-tint:      #161B22;
  --surface:      #1C2130;
  --surface-2:    #1A1F2E;
  --surface-tint: #242A38;

  --border:       rgba(255, 255, 255, 0.08);
  --border-soft:  rgba(255, 255, 255, 0.05);
  --border-focus: rgba(59, 130, 246, 0.45);

  --text:    #E2E8F0;
  --muted:   #94A3B8;
  --subtle:  #4A5568;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.30);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.40), 0 16px 40px rgba(0, 0, 0, 0.45);
}

body.dark {
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 1200px 600px at 50% -200px,
                    rgba(59, 130, 246, 0.08) 0%,
                    transparent 70%);
}

/* Dark: icon swap */
body.dark #theme-icon-moon { display: none; }
body.dark #theme-icon-sun  { display: inline; }

/* Dark: header */
body.dark #dashboard-header {
  background: linear-gradient(180deg, #1C2130 0%, #1A1F2E 100%) !important;
}
body.dark #dashboard-header::before {
  background: linear-gradient(90deg,
              transparent 0%,
              rgba(59, 130, 246, 0.18) 50%,
              transparent 100%);
}

/* Dark: card hover border */
body.dark .kpi-card:hover { border-color: rgba(255, 255, 255, 0.12); }

/* Dark: insight card */
body.dark .insight-card {
  background: linear-gradient(135deg, rgba(59,130,246,0.07) 0%, rgba(16,185,129,0.07) 100%), #1C2130;
}

/* Dark: weather section */
body.dark .weather-section-outer {
  background: linear-gradient(135deg, rgba(59,130,246,0.10) 0%, rgba(30,58,138,0.18) 100%) !important;
  border-color: rgba(59, 130, 246, 0.16) !important;
}
body.dark .weather-card {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(59, 130, 246, 0.12);
}
body.dark .weather-tooltip {
  background: #1C2130;
}

/* Dark: MA slider card */
body.dark .rc-slider-rail  { background: #2A3244; }
body.dark .rc-slider-handle {
  background: #1C2130;
  border-color: var(--c-co2);
}

/* Dark: Dash dropdown */
body.dark .Select-control,
body.dark .dash-dropdown .Select-control {
  background: #1C2130 !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
body.dark .Select-menu-outer {
  background: #1C2130 !important;
  border-color: var(--border) !important;
  box-shadow: var(--shadow-lg) !important;
}
body.dark .Select-option {
  background: #1C2130 !important;
  color: var(--text) !important;
}
body.dark .Select-option:hover,
body.dark .Select-option.is-focused {
  background: #242A38 !important;
}
body.dark .Select-option.is-selected {
  background: rgba(59, 130, 246, 0.20) !important;
  color: var(--text) !important;
}
body.dark .Select-value-label,
body.dark .Select-placeholder { color: var(--text) !important; }
body.dark .Select-arrow-zone  { color: var(--muted) !important; }
body.dark .Select-input input  { color: var(--text) !important; background: transparent !important; }

/* Dark: tabs */
body.dark .tab-shell .tab {
  color: var(--muted) !important;
}
body.dark .tab-shell .tab--selected {
  background: var(--surface-tint) !important;
  color: var(--text) !important;
}
body.dark .tab-shell .tab:hover:not(.tab--selected) {
  background: rgba(255, 255, 255, 0.06) !important;
  color: var(--text) !important;
}

/* Dark: logout btn */
body.dark #logout-btn:hover {
  background: var(--surface-tint) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

/* Dark: chart card hover */
body.dark .chart-card:hover { border-color: rgba(255, 255, 255, 0.10); }

/* Dark: alert banners */
body.dark .alert-critical {
  background: rgba(220, 38, 38, 0.15) !important;
  border-color: rgba(220, 38, 38, 0.35) !important;
  color: #FCA5A5 !important;
}
body.dark .alert-moderate {
  background: rgba(217, 119, 6, 0.12) !important;
  border-color: rgba(217, 119, 6, 0.35) !important;
  color: #FCD34D !important;
}

/* Dark: notification panel */
body.dark .notif-panel { background: #1C2130; }
body.dark .notif-badge { box-shadow: 0 0 0 2px #1C2130; }

/* Dark: chat panel */
body.dark .chat-panel {
  background: #1C2130;
  border-color: var(--border);
}
body.dark .chat-header {
  background: linear-gradient(180deg, #1C2130 0%, #1A1F2E 100%);
  border-bottom-color: var(--border);
}
body.dark .chat-input-area {
  background: #1A1F2E;
  border-top-color: var(--border);
}
body.dark .chat-text-input {
  background: #242A38;
  color: var(--text);
  border-color: var(--border);
}
body.dark .chat-text-input:focus {
  background: #2A3244;
  border-color: var(--c-co2);
}
body.dark .chat-msg-assistant {
  background: #242A38;
  color: var(--text);
}
body.dark .chat-bubble-error {
  background: rgba(220, 38, 38, 0.12);
  border-color: rgba(220, 38, 38, 0.28);
  color: #FCA5A5;
}
body.dark .chat-suggestion-chip {
  background: #242A38;
  color: var(--text);
}
body.dark .chat-suggestion-chip:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.30);
}
body.dark .chat-session-row {
  background: #242A38;
  color: var(--text);
}
body.dark .chat-session-row:hover {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.22);
}
body.dark .chat-btn-icon-only:hover {
  background: rgba(255, 255, 255, 0.08);
}
body.dark .chat-content-area::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.10);
}

/* Dark: feedback widget */
body.dark .feedback-toggle-btn {
  background: #1C2130;
  border-color: var(--border);
}
body.dark .feedback-toggle-btn:hover {
  background: #242A38;
  border-color: rgba(255, 255, 255, 0.12);
}
body.dark .feedback-panel {
  background: #1C2130;
  border-color: var(--border);
}
body.dark .feedback-textarea {
  background: #242A38;
  color: var(--text);
  border-color: var(--border);
}
body.dark .feedback-textarea:focus {
  background: #2A3244;
}
body.dark .feedback-star:hover { background: #242A38; }

/* Dark: Plotly chart overrides */
body.dark .js-plotly-plot .xtick text,
body.dark .js-plotly-plot .ytick text,
body.dark .js-plotly-plot .g-xtitle text,
body.dark .js-plotly-plot .g-ytitle text,
body.dark .js-plotly-plot .legendtext,
body.dark .js-plotly-plot .annotation text {
  fill: #94A3B8 !important;
}
body.dark .js-plotly-plot .gridlayer path,
body.dark .js-plotly-plot .gridlayer line {
  stroke: rgba(255, 255, 255, 0.07) !important;
}
body.dark .js-plotly-plot .zerolinelayer path { stroke: rgba(255,255,255,0.10) !important; }
body.dark .js-plotly-plot .barlayer .point path { stroke: transparent !important; }

/* Dark: scrollbars */
body.dark ::-webkit-scrollbar-track { background: transparent; }
body.dark ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.10); border-radius: 4px; }
body.dark * { scrollbar-color: rgba(255,255,255,0.10) transparent; }

/* ══════════════════════════════════════════════════════════════════════
   Page navigation pills (Dashboard ↔ Scenarios)
   ══════════════════════════════════════════════════════════════════════ */

.nav-links {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface-tint);
  border-radius: 10px;
  border: 1px solid var(--border-soft);
}

.nav-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 7px;
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
  white-space: nowrap;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.55);
  color: var(--text);
}

.nav-link--active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

body.dark .nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

/* ══════════════════════════════════════════════════════════════════════
   Scenarios page
   ══════════════════════════════════════════════════════════════════════ */

#sc-two-col {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 16px;
  align-items: start;
}

@media (max-width: 880px) {
  #sc-two-col {
    grid-template-columns: 1fr;
  }
}

.scenario-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--shadow-xs);
}

.scenario-text-input {
  flex: 1;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.scenario-text-input:focus {
  background: var(--surface);
  border-color: var(--c-co2);
  box-shadow: var(--shadow-focus);
}

.btn {
  font-family: inherit;
  font-weight: 600;
  font-size: 13px;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}

.btn-primary {
  background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.28);
}
.btn-primary:hover  { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(59, 130, 246, 0.38); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--surface-tint);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--surface);
  border-color: rgba(15, 23, 42, 0.14);
}
body.dark .btn-secondary:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

/* ── ML prediction card ─────────────────────────────────────── */

.ml-card {
  background: linear-gradient(135deg, rgba(59,130,246,0.05) 0%, rgba(16,185,129,0.05) 100%), var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}
.ml-card--empty {
  background: var(--surface-2);
}
body.dark .ml-card {
  background: linear-gradient(135deg, rgba(59,130,246,0.10) 0%, rgba(16,185,129,0.08) 100%), var(--surface-tint);
}

/* ── Recommendation cards ───────────────────────────────────── */

.rec-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.rec-card--info     { border-left-color: #3B82F6; }
.rec-card--warning  { border-left-color: #D97706; }
.rec-card--critical { border-left-color: #DC2626; }

.rec-sev-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
body.dark .rec-sev-pill { background: rgba(255, 255, 255, 0.06); }

.rec-fb-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 13px;
  cursor: pointer;
  line-height: 1.6;
  font-family: inherit;
  opacity: 0.45;
  transition: opacity var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.rec-fb-btn:hover {
  opacity: 1;
  background: var(--surface-tint);
  border-color: var(--border);
}

/* ── Saved scenarios table ───────────────────────────────────── */

.sc-saved-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.sc-saved-table th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.sc-saved-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.sc-saved-table tr:last-child td { border-bottom: none; }

.sc-row-delete {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 2px 7px;
  color: var(--subtle);
  cursor: pointer;
  font-size: 13px;
  transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.sc-row-delete:hover {
  color: #DC2626;
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.30);
}

/* Mobile: stack the saved-scenarios table cells */
@media (max-width: 640px) {
  .sc-saved-table {
    display: block;
    overflow-x: auto;
  }
  .sc-saved-table thead, .sc-saved-table tbody, .sc-saved-table tr {
    display: table;
    width: 100%;
  }
}

/* ── Baseline card (live sensor reading) ────────────────────────── */

.baseline-card {
  background:
    radial-gradient(120% 100% at 0% 0%, rgba(59,130,246,0.10), transparent 60%),
    radial-gradient(120% 100% at 100% 100%, rgba(16,185,129,0.08), transparent 60%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-xs);
}

body.dark .baseline-card {
  background:
    radial-gradient(120% 100% at 0% 0%, rgba(59,130,246,0.18), transparent 60%),
    radial-gradient(120% 100% at 100% 100%, rgba(16,185,129,0.14), transparent 60%),
    var(--surface);
}

/* ── Risk summary banner ────────────────────────────────────────── */

.risk-banner {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid;
  animation: fadeSlide 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.risk-banner--green {
  background: linear-gradient(135deg, rgba(22,163,74,0.08), rgba(22,163,74,0.03));
  border-color: rgba(22, 163, 74, 0.22);
}
.risk-banner--amber {
  background: linear-gradient(135deg, rgba(217,119,6,0.10), rgba(217,119,6,0.03));
  border-color: rgba(217, 119, 6, 0.22);
}
.risk-banner--red {
  background: linear-gradient(135deg, rgba(220,38,38,0.10), rgba(220,38,38,0.03));
  border-color: rgba(220, 38, 38, 0.22);
}

body.dark .risk-banner--green { background: linear-gradient(135deg, rgba(22,163,74,0.14), rgba(22,163,74,0.05)); }
body.dark .risk-banner--amber { background: linear-gradient(135deg, rgba(217,119,6,0.18), rgba(217,119,6,0.05)); }
body.dark .risk-banner--red   { background: linear-gradient(135deg, rgba(220,38,38,0.20), rgba(220,38,38,0.06)); }

.risk-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 99px;
  background: var(--surface);
  border: 1px solid;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  align-self: flex-start;
  margin-top: 2px;
}
.risk-pill--green { color: #16A34A; border-color: rgba(22,163,74,0.45); }
.risk-pill--amber { color: #D97706; border-color: rgba(217,119,6,0.45); }
.risk-pill--red   { color: #DC2626; border-color: rgba(220,38,38,0.45); }

body.dark .risk-pill { background: rgba(255,255,255,0.04); }

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(-3px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── AI recommendations empty state ─────────────────────────────── */

.recs-empty {
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(59,130,246,0.06), transparent 70%),
    var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 20px 18px;
  text-align: center;
}

body.dark .recs-empty {
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(59,130,246,0.10), transparent 70%),
    var(--surface-tint);
}

/* ── Saved scenarios empty state + count badge ──────────────────── */

.sc-saved-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 28px 16px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.sc-chart-hint {
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
  padding: 14px 0 4px;
  font-style: italic;
}

.sc-count-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 99px;
  background: var(--surface-tint);
  color: var(--muted);
  border: 1px solid var(--border-soft);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  position: relative;
  top: -2px;
}

/* ── Tertiary button (subtle, for Reset) ────────────────────────── */

.btn-tertiary {
  background: transparent;
  color: var(--muted);
  border: 1px dashed var(--border);
}
.btn-tertiary:hover {
  color: var(--text);
  border-color: rgba(15, 23, 42, 0.18);
  background: var(--surface-tint);
}
body.dark .btn-tertiary:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

/* Dark: login page */
body.dark .login-card {
  background: var(--surface) !important;
  border-color: var(--border) !important;
}
body.dark .login-card h1,
body.dark .login-card p,
body.dark .login-card label {
  color: var(--text) !important;
}
body.dark .login-card input {
  background: var(--surface-2) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
body.dark .login-card input::placeholder { color: var(--subtle) !important; }

/* ══════════════════════════════════════════════════════════════════════
   Scenarios v2 — auto-generated cards + heatmap
   ══════════════════════════════════════════════════════════════════════ */

/* Hero intro */
.sc-hero {
  margin: 4px 0 18px;
  padding: 4px 2px;
}
.sc-hero-title {
  font-size: clamp(22px, 3.4vw, 30px);
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
  color: var(--text);
}
.sc-hero-body {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
  line-height: 1.55;
  max-width: 720px;
}

/* Live baseline banner */
.sc-bl-banner {
  background:
    radial-gradient(120% 100% at 0% 0%, rgba(59,130,246,0.12), transparent 60%),
    radial-gradient(120% 100% at 100% 100%, rgba(16,185,129,0.10), transparent 60%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 18px;
  box-shadow: var(--shadow-xs);
}
.sc-bl-banner--empty {
  background: var(--surface-2);
  border-style: dashed;
  color: var(--muted);
  font-size: 13px;
  padding: 14px 18px;
}
body.dark .sc-bl-banner {
  background:
    radial-gradient(120% 100% at 0% 0%, rgba(59,130,246,0.20), transparent 60%),
    radial-gradient(120% 100% at 100% 100%, rgba(16,185,129,0.16), transparent 60%),
    var(--surface);
}
.sc-bl-meta {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.sc-bl-eyebrow {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em;
  color: var(--c-rh); text-transform: uppercase;
}
.sc-bl-ts {
  font-size: 11.5px; color: var(--subtle);
}
.sc-bl-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
.sc-bl-label {
  font-size: 10.5px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600;
}
.sc-bl-value {
  font-size: 20px; font-weight: 700; color: var(--text);
  margin-top: 3px; letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

/* Best recommendation banner (hero) */
.sc-best-banner {
  background:
    linear-gradient(135deg, rgba(59,130,246,0.08) 0%, rgba(16,185,129,0.06) 100%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 22px;
  margin: 16px 0 22px;
  box-shadow: var(--shadow-sm);
  animation: fadeSlide 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
body.dark .sc-best-banner {
  background:
    linear-gradient(135deg, rgba(59,130,246,0.15) 0%, rgba(16,185,129,0.10) 100%),
    var(--surface);
}
.sc-best-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 6px;
}
.sc-best-icon { font-size: 20px; }
.sc-best-eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  color: var(--muted); text-transform: uppercase;
}
.sc-best-sev {
  margin-left: auto;
  font-size: 10px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px;
  border: 1px solid; background: var(--surface);
  letter-spacing: 0.04em;
}
body.dark .sc-best-sev { background: rgba(255,255,255,0.04); }
.sc-best-title {
  font-size: 20px; font-weight: 700; margin: 0 0 4px;
  color: var(--text); letter-spacing: -0.015em;
}
.sc-best-body {
  font-size: 14px; color: var(--muted); margin: 0;
  line-height: 1.6;
}

/* Scenario card grid */
.sc-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.sc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--shadow-xs);
  display: flex; flex-direction: column; gap: 12px;
  transition: transform var(--t-fast), box-shadow var(--t-fast), border-color var(--t-fast);
}
.sc-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(15, 23, 42, 0.12);
}
body.dark .sc-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
}
.sc-card--current {
  background:
    linear-gradient(135deg, rgba(59,130,246,0.06) 0%, transparent 60%),
    var(--surface);
  border-color: rgba(59,130,246,0.32);
}
body.dark .sc-card--current {
  background:
    linear-gradient(135deg, rgba(59,130,246,0.14) 0%, transparent 60%),
    var(--surface);
}

.sc-card-head {
  display: flex; align-items: center; gap: 10px;
}
.sc-card-head-left {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0;
}
.sc-card-icon { font-size: 20px; line-height: 1; flex-shrink: 0; }
.sc-card-title {
  font-size: 14.5px; font-weight: 700; color: var(--text);
  letter-spacing: -0.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sc-card-pill {
  font-size: 10px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px;
  border: 1px solid; background: var(--surface);
  text-transform: uppercase; letter-spacing: 0.05em;
  white-space: nowrap;
}
body.dark .sc-card-pill { background: rgba(255,255,255,0.05); }

.sc-card-blurb {
  font-size: 12.5px; color: var(--muted); line-height: 1.5; margin: -4px 0 0;
}

/* Health score block */
.sc-score-block { display: flex; flex-direction: column; gap: 6px; }
.sc-score-head {
  display: flex; justify-content: space-between; align-items: baseline;
}
.sc-score-label {
  font-size: 10.5px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.sc-score-value {
  font-size: 14.5px; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.sc-score-track {
  width: 100%; height: 8px;
  background: var(--surface-tint);
  border-radius: 999px; overflow: hidden;
}
body.dark .sc-score-track { background: rgba(255,255,255,0.06); }

/* Metric chips */
.sc-chip-row {
  display: flex; flex-direction: column; gap: 6px;
}
.sc-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 12.5px;
}
body.dark .sc-chip { background: rgba(255,255,255,0.04); }
.sc-chip-label {
  color: var(--muted); flex: 1;
}
.sc-chip-value {
  font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* Delta line */
.sc-delta {
  font-size: 12.5px; color: var(--text);
  padding: 6px 0 0;
  border-top: 1px dashed var(--border-soft);
  line-height: 1.5;
}
.sc-delta--neutral { color: var(--subtle); }

/* Comparison heatmap */
.sc-section { margin-bottom: 24px; }
.sc-section-hint {
  font-size: 12.5px; color: var(--muted);
  margin: 0 0 10px; line-height: 1.5;
}

.sc-heat-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 4px;
  overflow-x: auto;
  box-shadow: var(--shadow-xs);
}
.sc-heat-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 4px;
  font-variant-numeric: tabular-nums;
  min-width: 600px;
}
.sc-heat-table th {
  font-weight: 600;
  font-size: 11px;
  color: var(--muted);
  padding: 8px 4px;
  text-transform: none;
  letter-spacing: normal;
  border: none;
  text-align: center;
  vertical-align: bottom;
}
.sc-heat-header-inner {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.sc-heat-icon { font-size: 16px; line-height: 1; }
.sc-heat-name {
  font-size: 10.5px; color: var(--muted); font-weight: 600;
  text-align: center; line-height: 1.3;
  max-width: 100px;
}
.sc-heat-rowlabel {
  font-size: 12px; font-weight: 600;
  color: var(--text);
  padding: 8px 10px;
  white-space: nowrap;
  background: var(--surface-2);
  border-radius: 8px;
}
body.dark .sc-heat-rowlabel { background: rgba(255,255,255,0.04); }
.sc-heat-cell {
  padding: 0;
}
.sc-heat-cell-inner {
  border-radius: 8px;
  padding: 12px 6px;
  text-align: center;
  transition: transform var(--t-fast);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.005em;
}
.sc-heat-cell-inner:hover {
  transform: scale(1.04);
}
body.dark .sc-heat-cell-inner { color: #fff; }

/* Extra recommendations */
.sc-rec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}
.sc-rec {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 10px;
  padding: 12px 14px;
}
.sc-rec--info     { border-left-color: #3B82F6; }
.sc-rec--warning  { border-left-color: #D97706; }
.sc-rec--critical { border-left-color: #DC2626; }

.sc-rec-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
}
.sc-rec-title {
  font-size: 13.5px; font-weight: 700; color: var(--text);
  flex: 1; letter-spacing: -0.005em;
}
.sc-rec-sev {
  font-size: 9.5px; font-weight: 700;
  padding: 2px 7px; border-radius: 999px;
  border: 1px solid; background: var(--surface);
  letter-spacing: 0.04em;
  white-space: nowrap;
}
body.dark .sc-rec-sev { background: rgba(255,255,255,0.06); }
.sc-rec-body {
  font-size: 12.5px; color: var(--muted); line-height: 1.5; margin: 0;
}

.sc-rec-actions {
  display: flex; align-items: center; gap: 4px; margin-top: 10px;
}
.sc-fb-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 13px;
  cursor: pointer;
  line-height: 1.6;
  font-family: inherit;
  opacity: 0.45;
  transition: opacity var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.sc-fb-btn:hover {
  opacity: 1;
  background: var(--surface-tint);
  border-color: var(--border);
}
.sc-fb-ack {
  font-size: 11px; color: var(--subtle); margin-left: 6px;
  font-style: italic;
}

.sc-rec-error {
  font-size: 12.5px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 10px 14px;
}

/* Mobile: stack cleanly */
@media (max-width: 720px) {
  .sc-card-grid { grid-template-columns: 1fr; }
  .sc-bl-stats { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .sc-bl-value { font-size: 17px; }
  .sc-rec-grid { grid-template-columns: 1fr; }
  .sc-best-banner { padding: 16px 18px; }
  .sc-best-title { font-size: 18px; }
}
