/* GridIberia — Interactive Trilingual Region Comparator */

:root {
  --navy: #0b1730;
  --navy-2: #13254a;
  --emerald: #059669;
  --emerald-bright: #10b981;
  --cyan: #0891b2;
  --cyan-bright: #0ea5e9;
  --coral: #e8573f;
  --amber: #d97706;

  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --soft: #eef2f8;
  --soft-hover: #e2e8f0;
  --text: #0f172a;
  --text-secondary: #334155;
  --muted: #55627a;
  --border: rgba(15, 23, 42, 0.12);
  --border-strong: rgba(15, 23, 42, 0.22);
  --link: #0e7490;
  --accent-soft: rgba(5, 150, 105, 0.1);
  --info-bg: rgba(8, 145, 178, 0.08);
  --info-border: rgba(8, 145, 178, 0.3);
  --warn-bg: rgba(217, 119, 6, 0.09);
  --warn-border: rgba(217, 119, 6, 0.34);
  --chart-grid: rgba(15, 23, 42, 0.09);
  --chart-axis: #64748b;

  --series-0: #059669;
  --series-1: #0284c7;
  --series-2: #d97706;
  --series-3: #e8573f;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.1);
  --shadow-lg: 0 16px 36px rgba(15, 23, 42, 0.16);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

html[data-theme="dark"] {
  --emerald: #10b981;
  --emerald-bright: #34d399;
  --cyan: #22d3ee;
  --cyan-bright: #38bdf8;
  --coral: #fb7a63;
  --amber: #fbbf24;

  --bg: #070f1f;
  --surface: #0e1a33;
  --surface-elevated: #132242;
  --soft: #14233f;
  --soft-hover: #1d3156;
  --text: #eef2f9;
  --text-secondary: #cbd5e1;
  --muted: #9fb0c9;
  --border: rgba(148, 163, 184, 0.2);
  --border-strong: rgba(148, 163, 184, 0.34);
  --link: #22d3ee;
  --accent-soft: rgba(16, 185, 129, 0.16);
  --info-bg: rgba(34, 211, 238, 0.1);
  --info-border: rgba(34, 211, 238, 0.34);
  --warn-bg: rgba(251, 191, 36, 0.11);
  --warn-border: rgba(251, 191, 36, 0.36);
  --chart-grid: rgba(148, 163, 184, 0.16);
  --chart-axis: #94a3b8;

  --series-0: #34d399;
  --series-1: #38bdf8;
  --series-2: #fbbf24;
  --series-3: #fb7a63;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 18px 42px rgba(0, 0, 0, 0.6);
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--link);
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-thickness: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: 16px;
  top: 8px;
  z-index: 50;
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
}

.wrap {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 18px;
}

/* Top Navbar */
.topbar {
  background: var(--navy);
  color: #ffffff;
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 58px;
  flex-wrap: wrap;
  padding-top: 6px;
  padding-bottom: 6px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #ffffff;
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.logo {
  flex: none;
  display: block;
}

.logo-bg {
  fill: var(--navy-2);
}

.logo-line {
  stroke: #2dd4bf;
}

.logo-dot {
  fill: #fb7a63;
}

.mainnav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  flex: 1;
}

.mainnav a {
  color: #cfe0f5;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.mainnav a:hover,
.mainnav a[aria-current="page"] {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.lang-switcher {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.lang-btn {
  border: 0;
  background: transparent;
  color: #cfe0f5;
  font-family: var(--font);
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.lang-btn:hover {
  color: #ffffff;
}

.lang-btn.active {
  background: #2dd4bf;
  color: var(--navy);
}

.theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.theme-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.28);
  color: #ffffff;
}

/* Main Content */
.main-content {
  flex: 1;
  padding-top: 22px;
  padding-bottom: 52px;
}

/* Hero */
.hero {
  margin-bottom: 20px;
}

.hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.hero-copy {
  flex: 1;
  min-width: 280px;
}

.hero-eyebrow-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.eyebrow {
  margin: 0;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cyan);
  font-weight: 700;
}

.date-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  border: 1px solid var(--border);
}

.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(1.55rem, 3vw, 2.15rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.lede {
  margin: 0;
  max-width: 740px;
  color: var(--muted);
  font-size: 0.98rem;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 6px;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease, transform 0.1s ease;
}

.action-btn:hover:not(:disabled) {
  border-color: var(--cyan);
  color: var(--link);
}

.action-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.action-btn-primary {
  background: var(--emerald);
  border-color: var(--emerald);
  color: #ffffff;
}

.action-btn-primary:hover:not(:disabled) {
  filter: brightness(1.06);
  border-color: var(--emerald);
  color: #ffffff;
}

/* Status Panel */
.status-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.status-panel[hidden] {
  display: none;
}

.status-text {
  margin: 0;
  color: var(--muted);
}

/* Panels */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

.panel-header-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.section-label {
  margin: 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
}

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

/* Presets */
.presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
  gap: 8px;
}

.preset-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--soft);
  color: var(--text);
  font-family: var(--font);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease, box-shadow 0.14s ease;
}

.preset-btn:hover {
  border-color: var(--cyan);
  background: var(--surface);
}

.preset-btn.active {
  border-color: var(--emerald);
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--emerald);
}

.preset-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.preset-regions {
  font-size: 12px;
  color: var(--muted);
}

/* Region Selector Slots */
.add-region-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px dashed var(--border-strong);
  background: transparent;
  color: var(--link);
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.add-region-btn:hover {
  background: var(--soft);
  border-color: var(--cyan);
}

.add-region-btn[hidden] {
  display: none;
}

.slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(225px, 1fr));
  gap: 10px;
}

.region-slot {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.slot-trigger {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-elevated);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.slot-trigger:hover,
.slot-trigger[aria-expanded="true"] {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px var(--info-bg);
}

.slot-trigger-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.series-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
}

.slot-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slot-badge {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  flex-shrink: 0;
}

.slot-chevron {
  flex-shrink: 0;
  color: var(--muted);
}

.slot-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--soft);
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.slot-remove:hover {
  background: rgba(232, 87, 63, 0.12);
  border-color: var(--coral);
  color: var(--coral);
}

/* Searchable Dropdown Popover */
.slot-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  min-width: 260px;
  z-index: 40;
  background: var(--surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.slot-popover[hidden] {
  display: none;
}

.popover-search-wrap {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  background: var(--soft);
}

.popover-search {
  width: 100%;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
}

.popover-search:focus {
  border-color: var(--cyan);
}

.popover-list {
  max-height: 290px;
  overflow-y: auto;
  padding: 6px 0;
}

.popover-group-label {
  padding: 6px 12px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.popover-option {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 7px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  text-align: left;
}

.popover-option:hover,
.popover-option.focused {
  background: var(--soft);
}

.popover-option.is-current {
  background: var(--accent-soft);
  font-weight: 700;
}

.popover-option-meta {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}

.popover-empty {
  padding: 14px 12px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

/* Unit Honesty Banner & Market Context */
.unit-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--warn-border);
  background: var(--warn-bg);
  color: var(--text);
  margin-bottom: 14px;
  font-size: 13.5px;
}

.unit-banner[hidden] {
  display: none;
}

.unit-banner-icon {
  color: var(--amber);
  flex-shrink: 0;
  margin-top: 2px;
}

.unit-banner-text {
  margin: 0;
}

.market-context-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--info-border);
  background: var(--info-bg);
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--text-secondary);
}

.market-context-bar[hidden] {
  display: none;
}

.market-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

/* KPI Table */
.block {
  margin: 22px 0;
}

.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.block h2 {
  margin: 0;
  font-size: 1.18rem;
  letter-spacing: -0.015em;
}

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  -webkit-overflow-scrolling: touch;
}

.kpi-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 600px;
}

.kpi-table th,
.kpi-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.kpi-table thead th {
  background: var(--soft);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  border-bottom: 1px solid var(--border-strong);
}

.kpi-table thead th:first-child {
  width: 210px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.kpi-table tbody th[scope="row"] {
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface);
  white-space: nowrap;
}

.kpi-table tbody tr:last-child th,
.kpi-table tbody tr:last-child td {
  border-bottom: 0;
}

.kpi-table tbody tr:hover td,
.kpi-table tbody tr:hover th {
  background: var(--soft);
}

.region-col-head {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.region-col-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14.5px;
}

.region-col-meta {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.val-primary {
  font-family: var(--mono);
  font-size: 14.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.val-unit {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  margin-left: 3px;
}

.val-sub {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  font-family: var(--font);
  margin-top: 2px;
}

.val-leader {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font-family: var(--font);
  font-size: 10.5px;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--emerald);
  vertical-align: middle;
}

.delta-pos {
  color: var(--emerald);
}

.delta-neg {
  color: var(--coral);
}

.delta-zero {
  color: var(--muted);
}

.sat-cell {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 110px;
}

.sat-bar-track {
  width: 100%;
  max-width: 136px;
  height: 7px;
  border-radius: 999px;
  background: var(--soft);
  overflow: hidden;
}

.sat-bar-fill {
  height: 100%;
  border-radius: 999px;
}

.sat-low {
  background: var(--emerald);
}

.sat-mid {
  background: var(--amber);
}

.sat-high {
  background: var(--coral);
}

.op-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.op-pill {
  display: inline-block;
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.cell-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cell-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid var(--border-strong);
  background: var(--surface-elevated);
  color: var(--text);
  transition: border-color 0.14s ease, color 0.14s ease, background 0.14s ease;
}

.cell-link:hover {
  border-color: var(--cyan);
  color: var(--link);
  text-decoration: none;
}

.cell-link-primary {
  background: var(--emerald);
  border-color: var(--emerald);
  color: #ffffff;
}

.cell-link-primary:hover {
  filter: brightness(1.06);
  border-color: var(--emerald);
  color: #ffffff;
}

/* Dynamic Multi-Region Alert Capture Card */
.compare-alert-card {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: center;
  gap: 16px 24px;
  margin: 22px 0;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--emerald);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.compare-alert-main {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.compare-alert-header {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.compare-alert-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--emerald);
  flex-shrink: 0;
  margin-top: 1px;
}

.compare-alert-copy {
  min-width: 0;
}

.compare-alert-heading {
  margin: 0 0 3px;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--text);
}

.compare-alert-sub {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

.compare-alert-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.compare-alert-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--soft);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.compare-alert-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.compare-alert-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.compare-alert-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.compare-alert-input::placeholder {
  color: var(--muted);
}

.compare-alert-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--info-bg);
}

.compare-alert-submit {
  flex: 0 0 auto;
  white-space: nowrap;
}

.compare-alert-status {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.45;
  min-height: 0;
}

.compare-alert-status:empty {
  margin: 0;
  padding: 0;
  min-height: 0;
}

.compare-alert-status.is-sending {
  color: var(--muted);
}

.compare-alert-status.is-success {
  color: var(--emerald);
  font-weight: 600;
}

.compare-alert-status.is-error {
  color: var(--coral);
  font-weight: 500;
}

.compare-alert-status a {
  color: var(--link);
  font-weight: 600;
  text-decoration: underline;
}

.compare-alert-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 11.5px;
  color: var(--muted);
}

.compare-alert-rss {
  font-weight: 600;
  color: var(--link);
  text-decoration: none;
  white-space: nowrap;
}

.compare-alert-rss:hover {
  text-decoration: underline;
}

/* Charts */
.charts-section {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 22px;
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.chart-head h2 {
  margin: 0 0 3px;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}

.chart-sub {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.bars-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}

.bar-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: var(--bg);
}

.bar-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.bar-panel-head h3 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
}

.inline-legend {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

.segmented {
  display: inline-flex;
  background: var(--soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
}

.seg-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}

.seg-btn:hover {
  color: var(--text);
}

.seg-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.trend-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-bottom: 10px;
}

.trend-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.trend-legend-line {
  width: 16px;
  height: 3px;
  border-radius: 99px;
  display: inline-block;
}

.trend-legend-delta {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
}

.svg-host {
  width: 100%;
  overflow-x: auto;
}

.chart-svg {
  width: 100%;
  min-width: 480px;
  height: auto;
  display: block;
}

#trend-chart-host .chart-svg {
  min-width: 640px;
}

.svg-label {
  fill: var(--text);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
}

.svg-muted {
  fill: var(--chart-axis);
  font-family: var(--mono);
  font-size: 11px;
}

.svg-value {
  fill: var(--text-secondary);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
}

.svg-grid {
  stroke: var(--chart-grid);
  stroke-width: 1;
}

.svg-point {
  cursor: pointer;
  transition: r 0.12s ease;
}

.chart-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
}

/* Footer */
.sitefoot {
  background: var(--navy);
  color: #cfe0f5;
  padding: 26px 0;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.foot-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.foot-brand-col {
  max-width: 560px;
}

.foot-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #ffffff;
  font-weight: 700;
  margin: 0 0 6px;
}

.foot-note {
  margin: 0;
  font-size: 12.5px;
  color: #9fb0c9;
}

.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  font-size: 13px;
  align-items: center;
}

.foot-links a {
  color: #7dd3fc;
  text-decoration: none;
}

.foot-links a:hover {
  text-decoration: underline;
}

@media (max-width: 760px) {
  .mainnav {
    order: 3;
    flex-basis: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }

  .mainnav a {
    white-space: nowrap;
  }

  .kpi-table th,
  .kpi-table td {
    padding: 8px 10px;
  }

  .bars-grid {
    grid-template-columns: 1fr;
  }

  .compare-alert-card {
    grid-template-columns: 1fr;
    padding: 15px 14px;
    gap: 14px;
  }
}

@media (max-width: 520px) {
  .compare-alert-row {
    flex-direction: column;
  }

  .compare-alert-submit {
    width: 100%;
  }
}
