:root {
  --ink: #172033;
  --muted: #64748b;
  --line: #cbd5e1;
  --panel: #ffffff;
  --paper: #f4f7fb;
  --blue: #315da8;
  --blue-2: #7da0d9;
  --orange: #ef7f2d;
  --red: #dc2626;
  --green: #2f8f6f;
  --gray: #8c98a8;
  --shadow: 0 2px 7px rgba(23, 32, 51, 0.12);
  --risk-panel-height: 440px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 66px;
  padding: 10px 18px;
  background: #0f1f34;
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 260px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 2px solid #fff;
  font-weight: 700;
  letter-spacing: 0;
}

.brand-logo {
  display: grid;
  place-items: center;
  width: 150px;
  height: 42px;
  padding: 7px 12px;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 4px;
  overflow: hidden;
}

.brand-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
}

.brand-subtitle {
  margin-top: 2px;
  color: #bfd0e6;
  font-size: 12px;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.tab {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: transparent;
  color: #dbeafe;
  border-radius: 6px;
}

.tab.active {
  background: #fff;
  color: #10233c;
}

.dashboard {
  display: grid;
  grid-template-columns: 336px minmax(620px, 1fr) 336px;
  gap: 16px;
  padding: 16px;
}

.left-stack,
.center-stack,
.right-stack,
.bottom-grid {
  display: grid;
  align-content: start;
  gap: 16px;
}

.left-stack {
  grid-column: 1;
  grid-row: 1;
}

.center-stack {
  grid-column: 2;
  grid-row: 1;
  align-content: stretch;
  align-self: stretch;
  grid-template-rows: auto auto minmax(0, 1fr);
  height: 100%;
}

.right-stack {
  grid-column: 3;
  grid-row: 1;
}

.bottom-grid {
  grid-column: 1 / -1;
  grid-row: 2;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
  grid-auto-rows: var(--risk-panel-height);
}

.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid #7ea4e5;
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px 8px;
  border-bottom: 1px solid #d9e4f5;
}

.panel-title {
  font-weight: 700;
}

.panel-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.change-bell {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-left: 6px;
  border: 1px solid #f2c94c;
  border-radius: 999px;
  background: #fff8db;
  color: #b7791f;
  box-shadow: 0 1px 3px rgba(183, 121, 31, 0.22);
  vertical-align: middle;
  cursor: help;
  animation: bell-shake 1.8s ease-in-out infinite;
}

.change-bell svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
}

.changed-input-cell {
  position: relative;
  padding-right: 32px;
}

.changed-input-cell .change-bell {
  position: absolute;
  top: 6px;
  right: 8px;
  margin-left: 0;
}

@keyframes bell-shake {
  0%, 72%, 100% { transform: rotate(0deg); }
  76% { transform: rotate(-9deg); }
  80% { transform: rotate(8deg); }
  84% { transform: rotate(-6deg); }
  88% { transform: rotate(4deg); }
}

.panel-body {
  padding: 12px;
}

.slicer {
  display: flex;
  flex-direction: column;
  height: var(--risk-panel-height);
  min-height: var(--risk-panel-height);
}

.slicer .panel-body {
  flex: 1;
  min-height: 0;
}

.slicer-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid #c5d2e4;
  background: #fff;
  border-radius: 4px;
  color: #44546a;
}

.district-list {
  display: grid;
  gap: 4px;
  max-height: none;
  overflow-y: visible;
  padding: 0;
}

.district-button {
  display: flex;
  align-items: center;
  min-height: 29px;
  width: 100%;
  border: 1px solid #c8ced6;
  background: #fff;
  color: #111827;
  text-align: left;
  padding: 4px 10px;
  border-radius: 4px;
  font-weight: 600;
}

.district-button.active {
  background: #b7c8e8;
  border-color: #7c99c7;
}

.map-panel {
  min-height: 408px;
}

.lesotho-map {
  width: 100%;
  height: 318px;
  display: block;
  background: #eaf1f8;
}

.region {
  fill: #dde5ee;
  stroke: #fff;
  stroke-width: 1.8;
  transition: fill 160ms ease, filter 160ms ease;
}

.region.active {
  fill: #315da8;
  filter: drop-shadow(0 2px 3px rgba(49, 93, 168, 0.28));
}

.region.dim {
  fill: #cad7e8;
}

.region.muted {
  fill: #eef2f7;
}

.map-label {
  fill: #1f2c40;
  font-size: 9px;
  font-weight: 700;
  pointer-events: none;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.85);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.map-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}

.map-water {
  fill: #edf5fb;
}

.map-terrain-line {
  fill: none;
  stroke: #c8d8e8;
  stroke-width: 2;
  stroke-dasharray: 5 7;
  opacity: 0.75;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
}

.kpi {
  position: relative;
  background: #fff;
  border: 1px solid #d6e1ef;
  border-left: 4px solid var(--blue);
  padding: 10px 12px;
  min-height: 72px;
}

.kpi .change-bell {
  position: absolute;
  top: 6px;
  right: 6px;
  margin-left: 0;
}

.kpi:nth-child(2) {
  border-left-color: var(--orange);
}

.kpi:nth-child(3) {
  border-left-color: var(--green);
}

.kpi:nth-child(4) {
  border-left-color: var(--red);
}

.kpi-label {
  color: var(--muted);
  font-size: 12px;
}

.kpi-value {
  margin-top: 6px;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.chart-panel {
  min-height: 224px;
}

.wide-chart {
  min-height: 276px;
}

.bottom-grid-chart {
  min-height: var(--risk-panel-height);
}

.bottom-grid-chart .panel-body {
  padding: 10px;
}

.bottom-grid-chart .legend {
  gap: 8px;
  font-size: 11px;
}

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

.axis-label {
  fill: #526173;
  font-size: 12px;
}

.chart-label {
  fill: #304052;
  font-size: 13px;
}

.legend {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  color: #475569;
  font-size: 12px;
}

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

.swatch {
  width: 10px;
  height: 10px;
}

.two-chart-grid {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(300px, 1fr);
  gap: 16px;
  align-self: stretch;
  align-items: stretch;
  min-height: 0;
}

.two-chart-grid > .panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.two-chart-grid > .panel > .panel-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.two-chart-grid .chart-svg {
  flex: 1;
  height: 100%;
  min-height: 0;
}

.two-chart-grid .legend {
  flex: 0 0 auto;
}

.risk-panel {
  min-height: var(--risk-panel-height);
}

.risk-list {
  display: grid;
  gap: 10px;
}

.risk-row {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid #e5edf6;
}

.hazard-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
}

.hazard-icon svg {
  display: block;
  filter: drop-shadow(0 1px 1px rgba(15, 23, 42, 0.12));
}

.risk-name {
  font-weight: 700;
  font-size: 13px;
}

.risk-bars {
  display: grid;
  gap: 5px;
  margin-top: 6px;
}

.risk-bar {
  height: 7px;
  background: #e5eaf2;
  position: relative;
}

.risk-fill {
  height: 100%;
  background: var(--red);
}

.risk-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 11px;
}

.aggregated-risk-panel {
  min-height: var(--risk-panel-height);
}

.bottom-grid > .panel {
  display: flex;
  flex-direction: column;
  height: var(--risk-panel-height);
  min-height: var(--risk-panel-height);
}

.bottom-grid > .panel > .panel-body {
  flex: 1;
  min-height: 0;
}

.aggregated-risk-panel .panel-body {
  display: flex;
  flex-direction: column;
}

.risk-summary {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid #d6e1ef;
  color: var(--muted);
  font-size: 12px;
}

.risk-summary strong {
  color: var(--ink);
  font-size: 12px;
}

.risk-summary span:last-child {
  color: #b91c1c;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.risk-heatmap {
  display: grid;
  grid-template-columns: minmax(126px, 0.95fr) repeat(5, minmax(68px, 1fr));
  grid-template-rows: 76px repeat(5, minmax(0, 1fr));
  flex: 1;
  min-height: 0;
  border: 1px solid #d6e1ef;
  overflow: hidden;
}

.risk-heatmap-cell {
  min-height: 0;
  display: grid;
  align-items: center;
  justify-items: center;
  padding: 5px 4px;
  border-right: 1px solid #d6e1ef;
  border-bottom: 1px solid #d6e1ef;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.1;
  text-align: center;
}

.risk-heatmap-cell:nth-child(6n) {
  border-right: 0;
}

.risk-heatmap-cell.header,
.risk-heatmap-cell.corner {
  background: #eef4fb;
  font-weight: 800;
}

.risk-heatmap-cell.corner.axis-corner {
  align-items: stretch;
  justify-items: stretch;
  padding: 0;
  text-align: left;
}

.axis-corner span {
  display: flex;
  align-items: center;
  padding: 6px 7px;
  min-height: 32px;
}

.axis-corner span + span {
  border-top: 1px solid #d6e1ef;
}

.risk-heatmap-cell.header.sector-header {
  min-height: 72px;
  align-content: center;
  gap: 4px;
  padding: 5px 3px;
}

.sector-header-label {
  display: block;
  width: 100%;
  font-size: 10.5px;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.sector-header svg {
  display: block;
}

.risk-heatmap-cell.row-label {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  background: #f8fafc;
  font-weight: 700;
  text-align: left;
}

.risk-heatmap-cell.row-label svg {
  flex: 0 0 auto;
  filter: drop-shadow(0 1px 1px rgba(15, 23, 42, 0.1));
}

.hazard-label-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.risk-heatmap-cell.value {
  position: relative;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.risk-cell-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
}

.risk-heatmap-cell.value.changed-risk-cell {
  padding-right: 24px;
}

.risk-heatmap-cell.value .change-bell {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  margin-left: 0;
}

.risk-heatmap-cell.value .change-bell svg {
  width: 12px;
  height: 12px;
}

.risk-heatmap-cell.value.low {
  background: #dff3e6;
  color: #166534;
}

.risk-heatmap-cell.value.medium {
  background: #fff2c6;
  color: #854d0e;
}

.risk-heatmap-cell.value.high {
  background: #ffd7b5;
  color: #9a3412;
}

.risk-heatmap-cell.value.severe {
  background: #f7b5b5;
  color: #991b1b;
}

.risk-heatmap-cell.value.empty {
  background: #f1f5f9;
  color: #94a3b8;
}

.hotspot-panel {
  min-height: 208px;
}

.hotspot-list {
  display: grid;
  gap: 9px;
}

.hotspot-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 9px;
  align-items: center;
  padding: 9px;
  border: 1px solid #d6e1ef;
  background: #f8fafc;
}

.hotspot-item.medium {
  border-color: #facc15;
  background: #fffbea;
}

.hotspot-item.high {
  border-color: #fb923c;
  background: #fff7ed;
}

.hotspot-item.severe {
  border-color: #f87171;
  background: #fef2f2;
}

.hotspot-rank {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  background: #0f1f34;
  color: #fff;
  font-weight: 800;
}

.hotspot-main {
  min-width: 0;
}

.hotspot-name {
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.hotspot-track {
  height: 7px;
  margin-top: 6px;
  background: #e5eaf2;
}

.hotspot-fill {
  height: 100%;
  background: var(--red);
}

.hotspot-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.hotspot-score {
  color: #b91c1c;
  font-size: 16px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.warning {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin-top: 8px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 12px;
}

.formula-correction {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #fed7aa;
  background: #fffaf5;
}

.formula-correction h3 {
  margin: 0 0 8px;
  color: #172033;
  font-size: 14px;
}

.formula-correction .warning {
  margin-top: 0;
}

.workbook-sheets-table {
  table-layout: fixed;
}

.workbook-sheets-table th:nth-child(1),
.workbook-sheets-table td:nth-child(1) {
  width: 18%;
}

.workbook-sheets-table th:nth-child(7),
.workbook-sheets-table td:nth-child(7) {
  width: 28%;
}

.workbook-sheets-table th:nth-child(8),
.workbook-sheets-table td:nth-child(8) {
  width: 92px;
  text-align: center;
}

.worksheet-row {
  cursor: pointer;
}

.worksheet-row:hover td {
  background: #f8fbff;
}

.compact-action {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.worksheet-modal {
  width: min(1320px, calc(100vw - 44px));
}

.worksheet-audit-grid {
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 190px);
  overflow: auto;
}

.worksheet-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 8px;
}

.worksheet-stat {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #d6e1ef;
  background: #f8fafc;
}

.worksheet-stat span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.worksheet-stat strong {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
}

.worksheet-stat-error {
  border-color: #fecaca;
  background: #fef2f2;
}

.worksheet-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #d6e1ef;
  background: #fff;
}

.worksheet-card h3 {
  margin: 0;
  color: #172033;
  font-size: 14px;
}

.worksheet-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.worksheet-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid #d6e1ef;
  background: #edf3fb;
  color: #26354a;
  font-size: 12px;
  font-weight: 800;
}

.worksheet-formula-table,
.worksheet-input-table {
  min-width: 980px;
}

.worksheet-formula-table th:nth-child(2),
.worksheet-formula-table td:nth-child(2) {
  width: 58%;
}

.compact-empty {
  min-height: 54px;
}

.cra-workspace {
  display: grid;
  gap: 12px;
}

.toolbar-subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.cra-summary-strip {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #d6e1ef;
  background: #f8fafc;
  color: var(--ink);
}

.cra-summary-strip span,
.cra-summary-strip strong {
  min-width: 0;
}

.cra-output-panel .panel-body {
  max-height: 360px;
  overflow: auto;
}

.cra-output-table {
  min-width: 760px;
}

.cra-output-table .changed-cra-value-cell {
  position: relative;
  padding-right: 34px;
}

.cra-output-table .changed-cra-value-cell .change-bell {
  position: absolute;
  top: 6px;
  right: 8px;
  margin-left: 0;
}

.cra-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 24px;
  padding: 0 7px;
  border-radius: 4px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.cra-score.low {
  background: #dff3e6;
  color: #166534;
}

.cra-score.medium {
  background: #fff2c6;
  color: #854d0e;
}

.cra-score.high {
  background: #ffd7b5;
  color: #9a3412;
}

.cra-score.severe {
  background: #f7b5b5;
  color: #991b1b;
}

.cra-score.empty {
  background: #f1f5f9;
  color: #64748b;
}

.risk-matrix-lso-panel .panel-body {
  overflow: auto;
}

.risk-matrix-lso-wrap {
  overflow-x: auto;
}

.risk-matrix-lso-table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
  table-layout: fixed;
  border: 2px solid #111827;
}

.risk-matrix-lso-stack {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.risk-matrix-lso-table th,
.risk-matrix-lso-table td {
  border: 1px solid #111827;
  padding: 7px 8px;
  color: #111827;
  font-size: 12px;
  line-height: 1.2;
  vertical-align: middle;
}

.risk-matrix-lso-table th {
  background: #eef4fb;
  font-weight: 900;
  text-align: center;
}

.risk-matrix-lso-table th:nth-child(1),
.risk-matrix-lso-table td:nth-child(1) {
  width: 280px;
}

.risk-matrix-lso-table th:nth-child(2),
.risk-matrix-lso-table td:nth-child(2) {
  width: 210px;
}

.consequence-definition-table {
  min-width: 1320px;
}

.consequence-definition-table th:nth-child(1),
.consequence-definition-table td:nth-child(1) {
  width: 110px;
}

.consequence-definition-table th:nth-child(2),
.consequence-definition-table td:nth-child(2) {
  width: 190px;
}

.likelihood-rating-table {
  min-width: 1260px;
}

.likelihood-rating-table .risk-lso-period-col {
  width: 90px;
}

.likelihood-rating-table .risk-lso-history-col {
  width: 430px;
}

.likelihood-rating-table .risk-lso-predictability-col {
  width: 250px;
}

.likelihood-rating-table .risk-lso-likelihood-col {
  width: 150px;
}

.likelihood-rating-table .risk-lso-score-col {
  width: 56px;
}

.likelihood-rating-table th:nth-child(1),
.likelihood-rating-table td:nth-child(1) {
  width: 90px;
}

.likelihood-rating-table th:nth-child(2),
.likelihood-rating-table td:nth-child(2) {
  width: 430px;
}

.likelihood-rating-table th:nth-child(3),
.likelihood-rating-table td:nth-child(3) {
  width: 250px;
}

.likelihood-rating-table th:nth-child(4),
.likelihood-rating-table td:nth-child(4) {
  width: 150px;
}

.risk-guidelines-table {
  min-width: 820px;
}

.risk-guidelines-table th:nth-child(1),
.risk-guidelines-table td:nth-child(1) {
  width: 120px;
}

.risk-guidelines-table th:nth-child(2),
.risk-guidelines-table td:nth-child(2) {
  width: 130px;
}

.risk-matrix-title,
.likelihood-title {
  background: #d9e2f3 !important;
  text-align: left !important;
}

.consequence-title {
  background: #d9e2f3 !important;
  font-size: 12px;
}

.consequence-type-head {
  background: #e2e8f0 !important;
}

.blank-head,
.blank-cell {
  background: #fff !important;
}

.risk-rating-head {
  background: #e2e8f0 !important;
  letter-spacing: 0;
}

.risk-consequence-head {
  width: 86px;
}

.risk-description-cell,
.risk-likelihood-cell,
.risk-likelihood-period,
.risk-likelihood-history {
  background: #d9e2f3;
  font-weight: 700;
}

.risk-likelihood-cell,
.risk-likelihood-period {
  text-align: center;
}

.risk-likelihood-history {
  font-size: 11px;
}

.consequence-type-cell {
  text-align: center;
}

.consequence-definition-cell {
  background: #fff;
  font-size: 11px;
  vertical-align: top !important;
}

.risk-matrix-lso-score {
  text-align: center;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.risk-matrix-lso-score.low {
  background: #92d050;
}

.risk-matrix-lso-score.medium {
  background: #ffff00;
}

.risk-matrix-lso-score.high {
  background: #ff9900;
}

.risk-matrix-lso-score.severe {
  background: #ff0000;
  color: #fff;
}

.risk-matrix-lso-score.not-applicable,
.risk-matrix-lso-score.empty {
  background: #ffffff;
  color: #111827;
}

.risk-guideline-rating,
.risk-guideline-level {
  text-align: center;
  font-weight: 900;
}

.risk-guideline-level.low {
  background: #92d050;
}

.risk-guideline-level.medium {
  background: #ffff00;
}

.risk-guideline-level.high {
  background: #ff9900;
}

.risk-guideline-level.severe {
  background: #ff0000;
  color: #fff;
}

.risk-guideline-text {
  background: #fff;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 31, 52, 0.42);
}

.modal-panel {
  width: min(1320px, 100%);
  max-height: min(900px, calc(100vh - 36px));
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  overflow: hidden;
  border: 1px solid #8fb4e8;
  background: #fff;
  box-shadow: 0 18px 42px rgba(15, 31, 52, 0.24);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border-bottom: 1px solid #d6e1ef;
  background: #f8fafc;
}

.modal-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: 20px;
}

.modal-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.cra-lso-table-wrap {
  overflow: auto;
  min-height: 0;
}

.cra-lso-table {
  min-width: 1780px;
  table-layout: fixed;
}

.cra-lso-table th:nth-child(1),
.cra-lso-table td:nth-child(1) {
  width: 56px;
}

.cra-lso-table th:nth-child(4),
.cra-lso-table td:nth-child(4) {
  width: 190px;
}

.cra-lso-table th:nth-child(5),
.cra-lso-table td:nth-child(5) {
  width: 330px;
}

.compact-field {
  width: 150px;
  min-height: 32px;
  padding: 0 8px;
}

.cra-text-field {
  width: 100%;
  min-height: 32px;
}

.cra-description-field {
  width: 100%;
  min-height: 56px;
  padding: 7px 8px;
  resize: vertical;
  line-height: 1.25;
}

.compact-number {
  width: 88px;
}

.workspace {
  padding: 16px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.control-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.field {
  min-height: 36px;
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 4px;
  padding: 0 10px;
}

.save-button,
.secondary-button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 4px;
  font-weight: 700;
}

.save-button {
  border: 1px solid #315da8;
  background: #315da8;
  color: #fff;
}

.secondary-button {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: var(--ink);
}

.save-button:disabled,
.secondary-button:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.risk-matrix-panel {
  margin-bottom: 16px;
}

.risk-matrix-wrap {
  overflow-x: auto;
}

.risk-matrix-grid {
  display: grid;
  min-width: 640px;
  border: 1px solid #d6e1ef;
}

.risk-matrix-cell {
  min-height: 46px;
  display: grid;
  align-items: center;
  justify-items: center;
  padding: 6px;
  border-right: 1px solid #d6e1ef;
  border-bottom: 1px solid #d6e1ef;
  text-align: center;
  font-size: 12px;
}

.risk-matrix-cell.header,
.risk-matrix-cell.corner {
  background: #eef4fb;
  color: #26354a;
  font-weight: 800;
}

.risk-matrix-cell.row-label {
  justify-items: start;
  background: #f8fafc;
  color: #26354a;
  font-weight: 800;
  text-align: left;
}

.risk-matrix-cell.input-cell.low {
  background: #dff3e6;
}

.risk-matrix-cell.input-cell.medium {
  background: #fff2c6;
}

.risk-matrix-cell.input-cell.high {
  background: #ffd7b5;
}

.risk-matrix-cell.input-cell.severe {
  background: #f7b5b5;
}

.risk-matrix-input {
  width: 58px;
  min-height: 32px;
  border: 1px solid rgba(15, 31, 52, 0.24);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  font-weight: 800;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.save-status {
  margin-bottom: 10px;
  padding: 9px 10px;
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  color: #166534;
  font-size: 13px;
  font-weight: 700;
}

.table-input {
  width: 112px;
  min-height: 32px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 0 8px;
  background: #fff;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.edited-value {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 6px;
  border-radius: 4px;
  background: #fff7ed;
  color: #9a3412;
  font-weight: 700;
}

.excel-update-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #d6e1ef;
  background: #fff;
}

.excel-update-title {
  font-size: 13px;
  font-weight: 800;
  color: #26354a;
}

.excel-update-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.excel-file-input {
  min-height: 34px;
  max-width: 280px;
}

.check-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}

.check-field input {
  width: 15px;
  height: 15px;
}

.reports-workspace {
  display: grid;
  gap: 12px;
}

.report-upload-panel {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(260px, 1.4fr) minmax(260px, 1.1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid #d6e1ef;
  background: #fff;
}

.report-field {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: #26354a;
  font-size: 12px;
  font-weight: 800;
}

.report-field .field {
  width: 100%;
  min-width: 0;
}

.report-file-input {
  width: 100%;
  min-height: 36px;
  max-width: 100%;
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 4px;
  padding: 6px 8px;
  color: var(--ink);
}

.report-upload-button {
  align-self: end;
  min-width: 96px;
}

.reports-table {
  table-layout: fixed;
}

.reports-table th:nth-child(1),
.reports-table td:nth-child(1) {
  width: 48%;
}

.report-name-cell {
  overflow-wrap: anywhere;
}

.report-title {
  color: var(--ink);
  font-weight: 800;
}

.report-original,
.report-notes {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.report-type-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid #d6e1ef;
  border-radius: 4px;
  background: #edf3fb;
  color: #26354a;
  font-size: 12px;
  font-weight: 800;
}

.report-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.admin-workspace {
  display: grid;
  gap: 12px;
}

.admin-card {
  padding: 12px;
  border: 1px solid #d6e1ef;
  background: #fff;
}

.admin-card h3 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 16px;
}

.admin-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-card-head h3 {
  margin-bottom: 0;
}

.admin-form {
  display: grid;
  grid-template-columns: minmax(150px, 0.9fr) minmax(220px, 1.2fr) minmax(260px, 1.4fr) auto;
  gap: 10px;
  align-items: start;
}

.admin-form-simple {
  grid-template-columns: minmax(150px, 0.9fr) minmax(220px, 1.2fr) minmax(130px, 0.55fr) auto;
}

.admin-auto-apps {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid #d6e1ef;
  border-radius: 4px;
  background: #edf3fb;
  color: #26354a;
  font-size: 12px;
  font-weight: 800;
}

.admin-app-checks {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.admin-app-checks.compact {
  gap: 4px;
}

.admin-users-table th:nth-child(1),
.admin-users-table td:nth-child(1) {
  width: 24%;
}

.admin-users-table th:nth-child(4),
.admin-users-table td:nth-child(4) {
  width: 30%;
}

.admin-users-table td:last-child {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.frozen-row td {
  background: #f8fafc;
  color: #64748b;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 800;
}

.status-pill.active {
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.status-pill.frozen {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.danger-button {
  border-color: #fecaca;
  color: #991b1b;
}

.invite-link-box {
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  color: #166534;
  font-size: 13px;
}

.invite-link-box a,
.admin-inline-link {
  color: #1d4ed8;
  overflow-wrap: anywhere;
}

.workbook-toolbar {
  margin-top: 8px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid #d6e1ef;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid #e5edf6;
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.data-table th {
  background: #edf3fb;
  color: #26354a;
  font-weight: 700;
}

.data-table tr:hover td {
  background: #f8fbff;
}

.formula-cell {
  max-width: 720px;
  overflow-wrap: anywhere;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 99px;
  background: #e2e8f0;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}

.badge.error {
  background: #fee2e2;
  color: #991b1b;
}

.empty-state {
  padding: 40px;
  color: var(--muted);
  text-align: center;
}

.loader {
  padding: 60px;
  color: var(--muted);
}

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(380px, 1.05fr) minmax(360px, 0.95fr);
  background:
    linear-gradient(120deg, rgba(15, 31, 52, 0.95), rgba(49, 93, 168, 0.82)),
    repeating-linear-gradient(135deg, rgba(255,255,255,0.08) 0 1px, transparent 1px 22px);
}

.auth-hero {
  display: grid;
  align-content: center;
  gap: 18px;
  padding: 58px;
  color: #fff;
}

.auth-hero h1,
.home-intro h1 {
  margin: 0;
  font-size: 42px;
  line-height: 1.05;
}

.auth-hero p,
.home-intro p,
.app-card p {
  margin: 0;
  color: #dbeafe;
  font-size: 15px;
  line-height: 1.5;
}

.auth-app-preview {
  display: grid;
  gap: 6px;
  max-width: 360px;
  margin-top: 20px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
}

.auth-logo-tile {
  display: grid;
  place-items: center;
  width: min(420px, 100%);
  min-height: 124px;
  padding: 16px 22px;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.36);
  box-shadow: 0 10px 30px rgba(15, 31, 52, 0.18);
}

.auth-logo-tile img {
  display: block;
  max-width: 100%;
  max-height: 94px;
  object-fit: contain;
}

.preview-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 22px;
  padding: 0 8px;
  background: #dcfce7;
  color: #166534;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
}

.auth-card {
  display: grid;
  align-content: center;
  padding: 38px;
  background: #f8fbff;
}

.auth-card form {
  width: min(100%, 420px);
  margin: 0 auto;
  padding: 28px;
  background: #fff;
  border: 1px solid #d6e1ef;
  box-shadow: var(--shadow);
}

.auth-card h2 {
  margin: 20px 0 18px;
  font-size: 24px;
}

.auth-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  overflow: hidden;
}

.auth-switch button {
  min-height: 38px;
  border: 0;
  background: #fff;
  color: #334155;
  font-weight: 700;
}

.auth-switch button.active {
  background: #0f1f34;
  color: #fff;
}

.auth-label {
  display: block;
  margin: 12px 0 6px;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

.auth-input {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
}

.password-wrap {
  position: relative;
}

.password-wrap .auth-input {
  padding-right: 70px;
}

.show-password {
  position: absolute;
  top: 5px;
  right: 5px;
  min-width: 56px;
  min-height: 32px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}

.auth-submit,
.open-app {
  width: 100%;
  min-height: 42px;
  margin-top: 18px;
  border: 0;
  border-radius: 4px;
  background: #315da8;
  color: #fff;
  font-weight: 700;
}

.auth-submit:disabled,
.open-app:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}

.auth-error {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
  font-size: 13px;
}

.auth-notice {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  color: #166534;
  font-size: 13px;
}

.auth-hint {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.auth-hint.top {
  margin: 0 0 12px;
  line-height: 1.45;
}

.auth-text-button {
  min-height: 30px;
  margin-top: 10px;
  border: 0;
  background: transparent;
  color: #315da8;
  font-size: 13px;
  font-weight: 800;
  text-align: left;
}

.auth-text-button.align-right {
  display: block;
  margin-left: auto;
  text-align: right;
}

.user-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  color: #dbeafe;
  font-weight: 700;
}

.home-page {
  padding: 26px 18px;
}

.home-intro {
  max-width: 980px;
  margin: 0 auto 18px;
}

.home-intro h1 {
  color: var(--ink);
  font-size: 34px;
}

.home-intro p {
  color: var(--muted);
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 16px;
  max-width: 980px;
  margin: 0 auto;
}

.app-card {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 238px;
  padding: 18px;
  border: 1px solid #d6e1ef;
  background: #fff;
  box-shadow: var(--shadow);
}

.app-card.ready {
  border-top: 4px solid #315da8;
}

.app-card.planned {
  border-top: 4px solid #94a3b8;
}

.app-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.app-index {
  color: #94a3b8;
  font-size: 24px;
  font-weight: 700;
}

.app-card h2 {
  margin: 0;
  font-size: 21px;
}

.app-card p {
  color: var(--muted);
}

.ofc-page {
  padding: 16px;
}

.ofc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 16px;
  background: #fff;
  border: 1px solid #d6e1ef;
  box-shadow: var(--shadow);
}

.ofc-header h1 {
  margin: 0;
  font-size: 24px;
}

.ofc-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.ofc-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ofc-tabs button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: var(--ink);
  border-radius: 4px;
  font-weight: 700;
}

.ofc-tabs button.active {
  background: #0f1f34;
  color: #fff;
}

.ofc-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(280px, 1fr));
  gap: 16px;
}

.ofc-grid.revenue {
  grid-template-columns: repeat(2, minmax(340px, 1fr));
}

.ofc-excel-section {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(720px, 1fr) minmax(230px, 280px);
  gap: 22px;
  align-items: start;
}

.ofc-excel-main {
  display: grid;
  grid-template-columns: minmax(160px, 180px) minmax(260px, 0.95fr) minmax(390px, 1.35fr);
  gap: 10px 24px;
  align-items: start;
  min-height: 390px;
  padding: 12px;
  background: #d9e9f8;
  border: 1px solid #c6d9ec;
}

.ofc-explore-title {
  color: #0f172a;
  font-size: 12px;
  font-style: italic;
  font-weight: 800;
}

.ofc-programme-slicer {
  display: grid;
  gap: 4px;
}

.ofc-slicer-heading {
  display: grid;
  grid-template-columns: 88px 26px 1fr;
  align-items: center;
  gap: 2px;
  padding: 2px 4px;
  border: 1px solid #1f2937;
  border-bottom: 0;
  background: #f8fafc;
  font-size: 10px;
  font-weight: 700;
}

.ofc-slicer-heading span:nth-child(2) {
  display: flex;
  justify-content: center;
  gap: 2px;
  color: #475569;
}

.ofc-slicer-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.ofc-slicer-button {
  display: grid;
  place-items: center;
  width: 14px;
  height: 14px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #475569;
  cursor: pointer;
}

.ofc-slicer-button:hover,
.ofc-slicer-button:focus-visible {
  background: #dbeafe;
  color: #0f172a;
  outline: 1px solid #93c5fd;
}

.ofc-slicer-heading span:last-child {
  text-align: right;
}

.ofc-programme-list {
  border: 1px solid #1f2937;
  border-top: 0;
  background: #fff;
}

.ofc-programme-row {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 4px;
  align-items: center;
  width: 100%;
  min-height: 18px;
  padding: 1px 2px;
  border: 0;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
  color: #111827;
  font-size: 10px;
  text-align: left;
  cursor: pointer;
}

.ofc-programme-row:last-child {
  border-bottom: 0;
}

.ofc-programme-code {
  display: block;
  padding: 1px 6px;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  background: #f8fafc;
  line-height: 13px;
}

.ofc-programme-row.active .ofc-programme-code {
  background: #64b9d9;
  border-color: #338cb0;
  color: #fff;
  font-weight: 700;
}

.ofc-programme-progress {
  position: relative;
  display: block;
  height: 14px;
  overflow: hidden;
  border: 1px solid #111827;
  background: #f8fafc;
}

.ofc-programme-fill {
  position: absolute;
  inset: 1px auto 1px 1px;
  background: #7bd26f;
}

.ofc-programme-percent {
  position: absolute;
  inset: 0 3px 0 auto;
  display: grid;
  align-items: center;
  color: #111827;
  font-size: 9px;
  font-weight: 700;
}

.ofc-impact-metrics {
  display: grid;
  gap: 10px;
  padding-top: 9px;
}

.ofc-impact-metric {
  display: grid;
  grid-template-columns: minmax(74px, 0.45fr) minmax(150px, 1fr);
  align-items: center;
  min-height: 20px;
  padding: 3px 9px;
  background: #fff;
  color: #111827;
  font-size: 11px;
}

.ofc-impact-value {
  display: flex;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  color: #111827;
  font-variant-numeric: tabular-nums;
}

.ofc-impact-prefix {
  min-width: 10px;
}

.ofc-impact-bridge {
  color: #ec4899;
}

.ofc-impact-label {
  overflow-wrap: anywhere;
  text-align: left;
}

.ofc-excel-charts {
  display: grid;
  gap: 10px;
}

.ofc-gauge-card,
.ofc-esv-card {
  background: #fff;
  border: 1px solid #c7c7c7;
  box-shadow: inset 0 0 0 2px #f2f2f2;
}

.ofc-gauge-card {
  display: grid;
  justify-items: center;
  min-height: 188px;
  padding: 8px 12px 18px;
}

.ofc-gauge-visual {
  position: relative;
  width: 230px;
  height: 105px;
  margin-top: 2px;
}

.ofc-gauge-arc {
  position: absolute;
  left: 20px;
  top: 0;
  width: 190px;
  height: 95px;
  overflow: hidden;
  border-radius: 190px 190px 0 0;
  background: conic-gradient(from 270deg at 50% 100%, #d8f6d7 0deg 58deg, #75dd87 58deg 122deg, #2f8d29 122deg 180deg, transparent 180deg 360deg);
}

.ofc-gauge-arc::after {
  position: absolute;
  left: 34px;
  top: 34px;
  width: 122px;
  height: 61px;
  border-radius: 122px 122px 0 0;
  background: #fff;
  content: "";
}

.ofc-gauge-needle {
  position: absolute;
  left: 50%;
  bottom: 9px;
  width: 80px;
  height: 3px;
  border-radius: 2px;
  background: #111827;
  transform: rotate(var(--needle-angle));
  transform-origin: 0 50%;
}

.ofc-gauge-hub {
  position: absolute;
  left: calc(50% - 4px);
  bottom: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #111827;
}

.ofc-gauge-title {
  margin-top: 5px;
  color: #111827;
  font-size: 13px;
  line-height: 1.35;
  text-align: center;
}

.ofc-esv-card {
  min-height: 180px;
  padding: 8px 10px 5px;
}

.ofc-mini-chart-title {
  color: #64748b;
  font-size: 11px;
  text-align: center;
}

.ofc-esv-svg {
  display: block;
  width: 100%;
  min-height: 150px;
}

.ofc-esv-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 10px;
  font-size: 8px;
}

.ofc-programme-key {
  background: #fff;
  color: #111827;
}

.ofc-key-title {
  margin-bottom: 2px;
  font-size: 11px;
  font-style: italic;
  font-weight: 800;
}

.ofc-key-table {
  border: 1px solid #111827;
}

.ofc-key-row {
  display: grid;
  grid-template-columns: 46px 1fr;
  width: 100%;
  min-height: 17px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid #111827;
  background: #fff;
  color: #111827;
  font-size: 10px;
  text-align: left;
  cursor: pointer;
}

.ofc-key-row:last-child {
  border-bottom: 0;
}

.ofc-key-row span {
  padding: 2px 5px;
}

.ofc-key-row span:first-child {
  border-right: 1px solid #111827;
  font-weight: 700;
}

.ofc-key-row.active {
  background: #d9edf8;
}

.ofc-kpis {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 10px;
}

.ofc-chart-panel {
  min-height: 300px;
}

.ofc-chart-panel.wide {
  grid-column: 1 / -1;
}

.ofc-bars {
  display: grid;
  gap: 9px;
  max-height: 238px;
  overflow-y: auto;
  padding-right: 4px;
}

.ofc-bar-row {
  display: grid;
  grid-template-columns: minmax(100px, 0.95fr) minmax(110px, 1.4fr) 82px;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.ofc-bar-label {
  color: #334155;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ofc-bar-track {
  display: block;
  height: 10px;
  background: #e5edf6;
}

.ofc-bar-track span {
  display: block;
  height: 100%;
  background: #1c6b86;
}

.ofc-bar-value {
  color: var(--muted);
  text-align: right;
}

.donut-wrap {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 236px;
}

.donut-svg {
  width: 190px;
  height: 190px;
  transform: rotate(-90deg);
}

.donut-center {
  position: absolute;
  top: 76px;
  display: grid;
  justify-items: center;
  color: var(--ink);
}

.donut-center strong {
  font-size: 20px;
}

.donut-center span {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 1240px) {
  .ofc-excel-section {
    grid-template-columns: 1fr;
  }

  .ofc-excel-main {
    grid-template-columns: minmax(160px, 190px) minmax(260px, 1fr);
  }

  .ofc-excel-charts {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(320px, 1fr));
  }

  .ofc-programme-key {
    max-width: 420px;
  }

  .dashboard {
    grid-template-columns: 300px 1fr;
  }

  .left-stack,
  .center-stack,
  .right-stack {
    grid-column: auto;
    grid-row: auto;
  }

  .right-stack {
    grid-column: 1 / -1;
    grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr);
  }

  .bottom-grid {
    grid-column: 1 / -1;
    grid-row: auto;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .risk-panel {
    min-height: auto;
  }
}

@media (max-width: 860px) {
  .auth-page {
    grid-template-columns: 1fr;
  }

  .auth-hero,
  .auth-card {
    padding: 28px 18px;
  }

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

  .ofc-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .ofc-grid,
  .ofc-grid.revenue,
  .ofc-kpis {
    grid-template-columns: 1fr;
  }

  .ofc-excel-main,
  .ofc-excel-charts {
    grid-template-columns: 1fr;
  }

  .ofc-impact-metric {
    grid-template-columns: minmax(68px, 0.35fr) minmax(160px, 1fr);
  }

  .ofc-programme-key {
    max-width: none;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .tabs {
    justify-content: flex-start;
  }

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

  .right-stack {
    grid-template-columns: 1fr;
  }

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

  .report-upload-panel {
    grid-template-columns: 1fr;
  }

  .report-upload-button {
    width: 100%;
  }

  .admin-form {
    grid-template-columns: 1fr;
  }

  .reports-table {
    min-width: 720px;
  }

  .two-chart-grid,
  .kpi-row {
    grid-template-columns: 1fr;
  }
}
