/* ── CSS Variables — Light Theme ── */
:root {
  --bg-page: #f0ebe4;
  --bg-secondary: #e9e3da;
  --bg-tertiary: #e3dcd2;
  --bg-hover: #ddd5ca;
  --border: #d8cfc3;
  --border-subtle: #e6dfd6;
  --text-primary: #1A1D21;
  --text-secondary: #5C6370;
  --text-muted: #9CA3AF;

  --accent: #2563EB;
  --accent-light: #e8dfd3;
  --accent-border: #BFDBFE;

  --green: #16A34A;
  --green-bg: #F0FDF4;
  --amber: #D97706;
  --amber-bg: #FFFBEB;
  --red: #DC2626;
  --red-bg: #FEF2F2;
  --purple: #7C3AED;
  --purple-bg: #FAF5FF;
  --teal: #0D9488;
  --teal-bg: #F0FDFA;
  --blue: #2563EB;
  --blue-bg: #EFF6FF;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'SF Mono', 'Fira Code', monospace;

  --radius: 6px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --focus-ring: 0 0 0 3px rgba(37,99,235,0.2);
  --transition: 150ms ease;

  --topbar-height: 56px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 14px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Top Bar ── */
.topbar {
  background: var(--bg-page);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: var(--topbar-height);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 32px;
}
.topbar-brand {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.3px;
  white-space: nowrap;
}
.topbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.topbar-nav-item {
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius);
  transition: all var(--transition);
  white-space: nowrap;
}
.topbar-nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}
.topbar-nav-item.active {
  color: var(--accent);
  background: var(--accent-light);
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
}
.topbar-select:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

/* ── Mobile Menu ── */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 4px;
}
.mobile-nav {
  display: none;
  background: var(--bg-page);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px 12px;
}
.mobile-nav.open {
  display: block;
}
.mobile-nav .topbar-nav-item {
  display: block;
  padding: 10px 12px;
}

/* ── Main Content ── */
.main {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 32px;
  min-height: calc(100vh - var(--topbar-height) - 80px);
}

/* ── Footer ── */
.footer {
  background: var(--bg-secondary);
  color: var(--text-muted);
  padding: 20px 32px;
  font-size: 12px;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
}
.footer-sep { margin: 0 8px; opacity: 0.4; }
.footer-disclaimer {
  margin-top: 4px;
  font-style: italic;
  opacity: 0.7;
}

/* ── Loading ── */
.loading {
  display: flex;
  justify-content: center;
  padding: 64px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ── Hero Section ── */
.hero {
  margin-bottom: 40px;
}
.hero-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1.2;
  margin-bottom: 8px;
}
.hero-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
}
.hero-stats {
  display: flex;
  align-items: center;
  gap: 0;
  font-size: 15px;
  color: var(--text-secondary);
}
.hero-stat {
  font-weight: 600;
  color: var(--text-primary);
}
.hero-stat-divider {
  margin: 0 12px;
  color: var(--border);
}

/* ── Page Header ── */
.page-header {
  margin-bottom: 24px;
}
.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}
.page-title-count {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 16px;
  margin-left: 8px;
}
.page-desc {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ── Section ── */
.section {
  margin-bottom: 32px;
}
.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

/* ── Stat Strip ── */
.stat-strip {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 16px 0;
  margin-bottom: 32px;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}
.stat-strip-item {
  text-align: center;
  flex: 1;
}
.stat-strip-item:not(:last-child) {
  border-right: 1px solid var(--border-subtle);
}
.stat-strip-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.stat-strip-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Pipeline ── */
.pipeline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 32px;
}
.pipeline-node {
  background: var(--bg-page);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  min-width: 100px;
  flex: 1;
  max-width: 140px;
}
.pipeline-node:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}
.pipeline-node.active {
  border-color: var(--accent);
  background: var(--accent-light);
}
.pipeline-node-count {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}
.pipeline-node-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: capitalize;
  margin-top: 2px;
}
.pipeline-node.active .pipeline-node-label { color: var(--accent); }
.pipeline-node-sub {
  font-size: 11px;
  color: var(--text-muted);
}
.pipeline-arrow {
  font-size: 14px;
  color: var(--text-muted);
  padding: 0 2px;
  flex-shrink: 0;
}

/* ── Data Table ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table th {
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  padding: 10px 16px;
  border-bottom: 2px solid var(--border);
  background: var(--bg-secondary);
  white-space: nowrap;
}
.data-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  color: var(--text-secondary);
}
.data-table tbody tr:hover td { background: var(--bg-hover); }
.data-table .sortable { cursor: pointer; user-select: none; }
.data-table .sortable:hover { color: var(--text-primary); }
.data-table .sortable::after { content: ' \2195'; opacity: 0.4; }

/* ── Clickable Row ── */
.clickable-row { cursor: pointer; }
.clickable-row:hover td { background: var(--bg-hover); }
.clickable-row.selected td { background: var(--accent-light); }

/* ── Expandable Row ── */
.expand-row { display: none; }
.expand-row.open { display: table-row; }
.expand-row td {
  padding: 0;
  background: var(--bg-secondary);
}
.expand-content {
  padding: 16px 20px;
  border-left: 3px solid var(--accent);
  margin: 8px 16px;
  font-size: 13px;
  color: var(--text-secondary);
}
.expand-content p { margin-bottom: 6px; }
.expand-content strong { color: var(--text-primary); }

/* ── Pressure Bar (inline) ── */
.pressure-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pressure-bar-track {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-hover);
  overflow: hidden;
  min-width: 60px;
}
.pressure-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}
.pressure-bar-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 36px;
  text-align: right;
}
.fill-green { background: var(--green); }
.fill-amber { background: var(--amber); }
.fill-red { background: var(--red); }

/* ── Progress Bar ── */
.progress-bar {
  height: 6px;
  border-radius: 4px;
  background: var(--bg-hover);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}
.progress-fill.green { background: var(--green); }
.progress-fill.amber { background: var(--amber); }
.progress-fill.red { background: var(--red); }
.progress-fill.blue { background: var(--accent); }

/* ── Panel / Card ── */
.panel {
  background: var(--bg-page);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  margin-bottom: 24px;
  overflow: hidden;
}
.panel-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary);
}
.panel-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.panel-body {
  padding: 20px;
}

/* ── Badges ── */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}
.badge-act { background: var(--amber-bg); color: var(--amber); }
.badge-si, .badge-statutory_instrument { background: var(--blue-bg); color: var(--blue); }
.badge-retained_eu { background: var(--green-bg); color: var(--green); }
.badge-forthcoming { background: var(--amber-bg); color: var(--amber); }
.badge-fiscal { background: var(--purple-bg); color: var(--purple); }
.badge-guidance { background: var(--bg-tertiary); color: var(--text-muted); }
.badge-policy { background: var(--teal-bg); color: var(--teal); }

.badge-obligation { background: var(--red-bg); color: var(--red); }
.badge-prohibition { background: var(--amber-bg); color: var(--amber); }
.badge-permission { background: var(--green-bg); color: var(--green); }
.badge-reporting { background: var(--blue-bg); color: var(--blue); }
.badge-target { background: var(--teal-bg); color: var(--teal); }

.badge-current { background: var(--green-bg); color: var(--green); }
.badge-amended { background: var(--amber-bg); color: var(--amber); }
.badge-repealed { background: var(--red-bg); color: var(--red); }
.badge-enacted { background: var(--green-bg); color: var(--green); }
.badge-commenced { background: var(--blue-bg); color: var(--blue); }

.badge-low { background: var(--green-bg); color: var(--green); }
.badge-medium { background: var(--amber-bg); color: var(--amber); }
.badge-high { background: var(--red-bg); color: var(--red); }

.badge-phase {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 2px 8px;
}
.badge-climate { background: var(--green-bg); color: var(--green); }

.badge-tightening { background: var(--red-bg); color: var(--red); }
.badge-stable { background: var(--green-bg); color: var(--green); }
.badge-loosening { background: var(--blue-bg); color: var(--blue); }

.badge-enables { background: var(--green-bg); color: var(--green); }
.badge-constrains { background: var(--red-bg); color: var(--red); }
.badge-neutral { background: var(--bg-tertiary); color: var(--text-muted); }

.badge-gate-passed { background: var(--green-bg); color: var(--green); }
.badge-gate-failed { background: var(--red-bg); color: var(--red); }
.badge-gate-pending { background: var(--bg-tertiary); color: var(--text-muted); }

.badge-verified { background: var(--green-bg); color: var(--green); }
.badge-pending { background: var(--amber-bg); color: var(--amber); }
.badge-flagged { background: var(--red-bg); color: var(--red); }

.badge-horizon-12m { background: var(--amber-bg); color: var(--amber); }
.badge-horizon-24m { background: var(--blue-bg); color: var(--blue); }

/* ── Tags ── */
.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}
.tag-carbon_pricing { background: var(--amber-bg); color: var(--amber); }
.tag-emissions_limit { background: var(--red-bg); color: var(--red); }
.tag-energy_efficiency { background: var(--blue-bg); color: var(--blue); }
.tag-reporting { background: var(--purple-bg); color: var(--purple); }
.tag-adaptation { background: var(--teal-bg); color: var(--teal); }
.tag-fiscal { background: var(--purple-bg); color: var(--purple); }
.tag-procurement { background: var(--green-bg); color: var(--green); }
.tag-waste { background: var(--amber-bg); color: var(--amber); }

/* ── Toggle ── */
.toggle-group {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.toggle-btn {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  border: none;
  background: var(--bg-page);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.toggle-btn:not(:last-child) { border-right: 1px solid var(--border); }
.toggle-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.toggle-btn.active { background: var(--accent); color: #fff; }

/* ── Tabs (sub-navigation) ── */
.tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
}
.tab-btn {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font);
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Filters ── */
.filters {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.filter-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted);
}
.filter-select, .filter-input {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.filter-select:focus, .filter-input:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}
.filter-input { width: 220px; }

/* ── Attention List ── */
.attention-grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 24px;
}
.attention-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.attention-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 14px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.attention-item:last-child { border-bottom: none; }
.attention-item-title {
  font-weight: 500;
  color: var(--text-primary);
}
.attention-item-meta {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}
.view-all-link {
  display: inline-block;
  margin-top: 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}
.view-all-link:hover { text-decoration: underline; }

/* ── Trend Bars ── */
.trend-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.trend-bar-label {
  width: 60px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: right;
  flex-shrink: 0;
}
.trend-bar-wrapper {
  flex: 1;
  display: flex;
  height: 28px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-tertiary);
}
.trend-bar-seg {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  min-width: 0;
}
.trend-bar-seg.climate { background: var(--green); }
.trend-bar-seg.non-climate { background: var(--text-muted); }
.trend-bar-count {
  width: 28px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: right;
  flex-shrink: 0;
}
.trend-legend {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--text-muted);
}
.trend-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.trend-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

/* ── Entity Grid ── */
.entity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.entity-card {
  background: var(--bg-page);
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
}
.entity-card:hover {
  border-color: var(--accent-border);
  box-shadow: var(--shadow-sm);
}
.entity-card.active {
  border-color: var(--accent);
  background: var(--accent-light);
}
.entity-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.entity-card-laws {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.entity-card-pressure {
  display: flex;
  align-items: center;
  gap: 10px;
}
.entity-card-pressure .progress-bar { flex: 1; }
.entity-card-score {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  flex-shrink: 0;
}

/* ── Mini Cards ── */
.mini-card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mini-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 12px 14px;
  transition: all var(--transition);
}
.mini-card:hover { border-color: var(--border); }
.mini-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.mini-card-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* ── Provision List ── */
.provision-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.provision-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.provision-item:last-child { border-bottom: none; }
.provision-item strong {
  color: var(--text-primary);
  margin-right: 6px;
}
.provision-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

/* ── Timeline ── */
.timeline-container {
  position: relative;
  padding-left: 40px;
}
.timeline-container::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline-year {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 24px 0 10px -40px;
  padding-left: 40px;
}
.timeline-year:first-child { margin-top: 0; }
.timeline-event {
  position: relative;
  background: var(--bg-page);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  transition: all var(--transition);
}
.timeline-event:hover {
  box-shadow: var(--shadow-sm);
}
.timeline-event::before {
  content: '';
  position: absolute;
  left: -33px;
  top: 18px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--bg-page);
}
.timeline-event.enacted::before { background: var(--green); }
.timeline-event.amended::before { background: var(--amber); }
.timeline-event.repealed::before { background: var(--red); }
.timeline-event.commenced::before { background: var(--accent); }
.timeline-event-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.timeline-event-date {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.timeline-event-phases {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

/* ── Buttons ── */
.btn {
  display: inline-block;
  padding: 7px 14px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.btn:hover { opacity: 0.85; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-review { background: var(--blue-bg); color: var(--accent); }
.btn-approve { background: var(--green); color: #fff; }
.btn-reject { background: var(--red); color: #fff; }
.btn-secondary { background: var(--bg-tertiary); color: var(--text-primary); }

/* ── Review Form ── */
.review-form { max-width: 600px; }
.review-form-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-page);
  resize: vertical;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.review-form-textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}
.review-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* ── Gate Dots ── */
.gate-dots {
  display: flex;
  gap: 4px;
  align-items: center;
}
.gate-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
}
.gate-dot.passed { background: var(--green); border-color: var(--green); }
.gate-dot.failed { background: var(--red); border-color: var(--red); }
.gate-dot.pending { background: var(--bg-tertiary); border-color: var(--border); }

/* ── Stat Grid ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--border-subtle);
}
.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 4px;
}

/* ── Inline Verification Detail ── */
.verification-detail {
  display: none;
  padding: 16px 20px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
}
.verification-detail.open { display: block; }

/* ── Grid Helpers ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

/* ── Tooltips ── */
[data-tooltip] {
  position: relative;
  cursor: help;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: var(--bg-page);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  padding: 6px 10px;
  border-radius: var(--radius);
  white-space: normal;
  width: max-content;
  max-width: 280px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 150ms ease;
  z-index: 200;
  text-transform: none;
  letter-spacing: normal;
}
[data-tooltip]:hover::after {
  opacity: 1;
}

/* ── Info Icon ── */
.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  font-style: normal;
  cursor: help;
  margin-left: 4px;
  vertical-align: middle;
  position: relative;
}

/* ── Section Description ── */
.section-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.5;
}

/* ── Gate Legend ── */
.gate-legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 20px;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}
.gate-legend-item {
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.gate-legend-label {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

/* ── Utility ── */
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-small { font-size: 12px; }
.text-accent { color: var(--accent); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ── Content fade-in ── */
.content-fade {
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .topbar { padding: 0 16px; }
  .topbar-nav { display: none; }
  .topbar-controls { display: none; }
  .mobile-menu-btn { display: block; }
  .main { padding: 20px 16px; }
  .pipeline { flex-wrap: wrap; gap: 8px; }
  .pipeline-arrow { display: none; }
  .pipeline-node { min-width: 80px; padding: 10px 12px; }
  .attention-grid { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .stat-strip { flex-wrap: wrap; }
  .stat-strip-item { min-width: 100px; }
  .entity-grid { grid-template-columns: 1fr; }
  .filters { flex-direction: column; }
  .filter-input { width: 100%; }
  .data-table { font-size: 13px; }
  .data-table th, .data-table td { padding: 8px 10px; }
  .tab-btn { padding: 8px 14px; font-size: 13px; }
  [data-tooltip]::after { max-width: 200px; font-size: 11px; }
  .gate-legend { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .hero-title { font-size: 24px; }
  .hero-stats { flex-wrap: wrap; }
  .pipeline-node { min-width: 70px; }
}

/* ── Scrollbar styling ── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
