.wrap {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 1400px;
  padding: 1rem 0.5rem;
  box-sizing: border-box;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.pageTitle {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary, #1a1a1a);
  flex-shrink: 0;
}

.pageDesc {
  font-size: 0.88rem;
  color: var(--text-secondary, #666);
  margin: 0;
  line-height: 1.4;
  flex-shrink: 0;
}

/* Mandate selector */
.mandateSelector {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.mandateLabel {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary, #555);
  white-space: nowrap;
}

.mandateSelect {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border-color, #ccc);
  border-radius: 4px;
  font-size: 0.85rem;
  color: var(--text-primary, #333);
  background: var(--bg-primary, #fff);
  min-width: 220px;
}

/* Tab bar */
.tabBar {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border-color, #e0e0e0);
  flex-shrink: 0;
}

.tab {
  padding: 0.6rem 1.2rem;
  border: none;
  background: none;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary, #666);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}

.tab:hover {
  color: var(--text-primary, #1a1a1a);
}

.tabActive {
  color: var(--accent-color, #1976d2);
  border-bottom-color: var(--accent-color, #1976d2);
}

/* Content area — bounded height so FormGeneratorTable fills available space */
.tabContent {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.tabContentScrollable {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  gap: 1rem;
}

.loadingText, .emptyText {
  padding: 2rem;
  text-align: center;
  color: var(--text-secondary, #888);
  font-size: 0.9rem;
}

.meta {
  font-size: 0.78rem;
  color: var(--text-secondary, #888);
}


/* Status cell styles */
.statusOk {
  color: #2e7d32;
  font-weight: 500;
}

.statusError {
  color: #c62828;
  font-weight: 500;
}

/* Stats controls */
.statsControls {
  display: flex;
  gap: 0.5rem;
}

.rangeBtn {
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--border-color, #ccc);
  border-radius: 4px;
  background: var(--bg-primary, #fff);
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text-primary, #333);
  transition: background 0.15s, border-color 0.15s;
}

.rangeBtn:hover {
  border-color: var(--accent-color, #1976d2);
}

.rangeBtnActive {
  background: var(--accent-color, #1976d2);
  color: #fff;
  border-color: var(--accent-color, #1976d2);
}

/* KPI grid */
.kpiGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
}

.kpiCard {
  padding: 1rem;
  border-radius: 8px;
  background: var(--bg-primary, #fff);
  border: 1px solid var(--border-color, #e0e0e0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.kpiValue {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary, #1a1a1a);
  margin: 0 0 0.2rem;
}

.kpiLabel {
  font-size: 0.78rem;
  color: var(--text-secondary, #666);
  margin: 0;
  line-height: 1.3;
}

/* Chart blocks */
.chartRow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

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

.chartBlock {
  padding: 1rem;
  border-radius: 8px;
  background: var(--bg-primary, #fff);
  border: 1px solid var(--border-color, #e0e0e0);
}

.chartTitle {
  font-size: 0.92rem;
  font-weight: 600;
  margin: 0 0 0.6rem;
  color: var(--text-primary, #1a1a1a);
}

/* ── Content View Modal ── */

.modalOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.modalContainer {
  background: var(--bg-primary, #fff);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  width: 100%;
  max-width: 900px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modalHeader {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border-color, #e0e0e0);
  flex-shrink: 0;
  position: relative;
}

.modalTitle {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary, #1a1a1a);
}

.modalMeta {
  font-size: 0.78rem;
  color: var(--text-secondary, #888);
  flex: 1;
}

.modalClose {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary, #888);
  font-size: 1rem;
  padding: 4px;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.modalClose:hover {
  color: var(--text-primary, #1a1a1a);
  background: var(--bg-hover, #f3f4f6);
}

.modalMappingBar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1.2rem;
  background: #f5f3ff;
  border-bottom: 1px solid #e9e5ff;
  flex-shrink: 0;
  font-size: 0.8rem;
}

.modalMappingLabel {
  font-weight: 600;
  color: #7c3aed;
}

.modalMappingHint {
  color: #9ca3af;
  font-style: italic;
}

.modalTabBar {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border-color, #e0e0e0);
  padding: 0 1.2rem;
  flex-shrink: 0;
}

.modalTab {
  padding: 0.5rem 1rem;
  border: none;
  background: none;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary, #666);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}

.modalTab:hover {
  color: var(--text-primary, #1a1a1a);
}

.modalTabActive {
  color: var(--accent-color, #1976d2);
  border-bottom-color: var(--accent-color, #1976d2);
}

.modalBody {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem 1.2rem;
}

.modalTextContent {
  font-size: 0.82rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-primary, #333);
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
}
