:root {
  --portal-surface: #ffffff;
  --portal-surface-muted: #f8fafc;
  --portal-border: #e2e8f0;
  --portal-text: #172b4d;
  --portal-muted: #64748b;
  --portal-primary: #1d7ed8;
  --portal-primary-soft: #eaf4ff;
  --portal-radius: 1rem;
  --portal-shadow: 0 12px 34px rgba(15, 23, 42, 0.08);
}

.page-body {
  padding-top: 1.5rem;
  padding-bottom: 2rem;
}

.page-header,
.portal-page-header {
  margin-bottom: 1.25rem;
}

.page-header .row,
.portal-page-header {
  gap: 1rem;
}

.page-pretitle,
.portal-kicker {
  margin-bottom: 0.35rem;
  color: var(--portal-primary);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-title,
.portal-title {
  color: var(--portal-text);
  font-size: clamp(1.45rem, 2vw, 2rem);
  font-weight: 700;
  line-height: 1.2;
}

.portal-subtitle {
  max-width: 54rem;
  margin-top: 0.45rem;
  color: var(--portal-muted);
  font-size: 0.95rem;
}

.portal-scope-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 0.85rem;
  color: #1767a8;
  background: var(--portal-primary-soft);
  border: 1px solid #cfe6fb;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}

.card,
.portal-card {
  border-color: rgba(148, 163, 184, 0.22);
  border-radius: var(--portal-radius);
  box-shadow: var(--portal-shadow);
}

.card-header {
  min-height: 4.25rem;
  padding: 1rem 1.25rem;
  background: var(--portal-surface);
  border-bottom-color: var(--portal-border);
}

.card-title {
  color: var(--portal-text);
  font-weight: 700;
}

.portal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.portal-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.portal-table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--portal-border);
  border-radius: 0.8rem;
}

.portal-table-wrap > table,
.portal-report table,
.data-table {
  width: 100%;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
  color: #334155;
  font-size: 0.875rem;
}

.portal-table-wrap th,
.portal-report table th,
.data-table th {
  padding: 0.7rem 0.8rem;
  color: var(--portal-muted);
  background: var(--portal-surface-muted) !important;
  border: 0;
  border-bottom: 1px solid var(--portal-border);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.035em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.portal-table-wrap td,
.portal-report table td,
.data-table td {
  padding: 0.7rem 0.8rem;
  background: #fff;
  border: 0;
  border-bottom: 1px solid #edf1f5;
  vertical-align: top;
}

.portal-table-wrap tbody tr:last-child td,
.portal-report table tbody tr:last-child td,
.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.portal-table-wrap tbody tr:hover td,
.portal-report table tbody tr:hover td,
.data-table tbody tr:hover td {
  background: #f6faff;
}

.portal-report .group-row td {
  color: #1767a8;
  background: var(--portal-primary-soft);
  font-weight: 700;
}

.portal-report-section + .portal-report-section {
  margin-top: 1.5rem;
}

.portal-report .card-body,
#eco-table,
#eco-detailed,
#report-output {
  min-width: 0;
  overflow-x: auto;
}

.data-table .clickable-row {
  cursor: pointer;
}

.data-table .highlighted-row td {
  background: var(--portal-primary-soft);
  box-shadow: inset 3px 0 0 var(--portal-primary);
}

.portal-section-title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.85rem;
  color: #334155;
  font-size: 0.9rem;
  font-weight: 700;
}

.portal-loading,
.portal-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 9rem;
  padding: 1.5rem;
  color: var(--portal-muted);
  text-align: center;
}

.portal-chart {
  position: relative;
  width: 100%;
  min-height: 24rem;
}

.portal-chart canvas {
  width: 100% !important;
  max-width: 100%;
  height: 24rem !important;
}

.portal-report article {
  padding: 1rem 1.1rem;
  background: var(--portal-surface-muted);
  border: 1px solid var(--portal-border);
  border-radius: 0.8rem;
}

.portal-report article + article {
  margin-top: 0.75rem;
}

.portal-category-list {
  max-height: calc(100vh - 11rem);
  overflow-y: auto;
}

.portal-category-list .category-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.72rem 1rem;
  color: #334155;
  border: 0;
  border-left: 3px solid transparent;
  text-decoration: none;
}

.portal-category-list .category-link:hover {
  color: #1767a8;
  background: #f5f9fd;
}

.portal-category-list .category-link.active,
.portal-category-list .category-link.highlighted-category {
  color: #1767a8;
  background: var(--portal-primary-soft);
  border-left-color: var(--portal-primary);
  font-weight: 600;
}

.portal-category-count {
  min-width: 2rem;
  padding: 0.2rem 0.45rem;
  color: var(--portal-muted);
  background: #eef2f7;
  border-radius: 999px;
  font-size: 0.75rem;
  text-align: center;
}

.portal-report .table-chart {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(20rem, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.portal-report .table-wrapper,
.portal-report .chart-wrapper {
  min-width: 0;
  padding: 0;
}

.portal-report .table-wrapper {
  overflow-x: auto;
}

.portal-report .chart-wrapper canvas {
  width: 100% !important;
  max-width: 100%;
  height: 24rem !important;
}

.map-viewport {
  width: 100%;
  height: min(72vh, 54rem);
  min-height: 32rem;
  background: #e8eef4;
}

@media (max-width: 991.98px) {
  .portal-report .table-chart {
    grid-template-columns: 1fr;
  }

  .portal-category-list {
    max-height: 22rem;
  }
}

@media (max-width: 767.98px) {
  .page-body {
    padding-top: 1rem;
  }

  .page-header .row,
  .portal-page-header,
  .portal-toolbar {
    align-items: stretch !important;
    flex-direction: column;
  }

  .page-header .col-auto,
  .portal-actions,
  .portal-actions .btn {
    width: 100%;
  }

  .portal-chart,
  .portal-chart canvas,
  .portal-report .chart-wrapper canvas {
    min-height: 20rem;
    height: 20rem !important;
  }

  .map-viewport {
    min-height: 26rem;
    height: 65vh;
  }
}
