.sidebar {
  padding-top: 18px;
}

.nav-list {
  gap: 12px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.nav-group {
  min-width: 0;
}

.nav-parent {
  width: 100%;
  height: 42px;
  padding: 0 10px;
  border: 0;
  border-left: 3px solid transparent;
  background: transparent;
  color: #98A3D2;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 9px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
}

.nav-parent > svg {
  width: 17px;
  height: 17px;
}

.nav-parent span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-parent:hover,
.nav-parent.is-current {
  color: #FFFFFF;
  background: rgba(255, 255, 255, .045);
}

.nav-parent.is-current {
  border-left-color: var(--lime);
}

.nav-parent.is-current > svg:first-child {
  color: var(--lime);
}

.nav-chevron {
  width: 14px !important;
  height: 14px !important;
  transition: transform .16s ease-out;
}

.nav-group:not(.is-open) .nav-chevron {
  transform: rotate(-90deg);
}

.nav-children {
  display: grid;
  gap: 2px;
  max-height: 220px;
  opacity: 1;
  overflow: hidden;
  transition: max-height .18s ease-out, opacity .18s ease-out;
}

.nav-group:not(.is-open) .nav-children {
  max-height: 0;
  opacity: 0;
}

.nav-item.nav-child {
  height: 36px;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  padding-left: 27px;
  font-size: 11px;
  border-radius: 0 3px 3px 0;
}

.nav-item.nav-child svg {
  width: 14px;
  height: 14px;
}

.analysis-context-strip {
  min-height: 44px;
  margin-bottom: 14px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: var(--muted);
  font-size: 10px;
}

.analysis-context-strip span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.analysis-context-strip svg {
  width: 15px;
  height: 15px;
  color: var(--blue);
}

.analysis-context-strip strong {
  color: var(--navy);
  font-size: 10px;
  white-space: nowrap;
}

.analysis-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
  border: 1px solid var(--line);
  background: #FFFFFF;
}

.analysis-kpi-strip article {
  min-width: 0;
  min-height: 104px;
  padding: 17px 19px;
  border-right: 1px solid var(--line);
}

.analysis-kpi-strip article:last-child {
  border-right: 0;
}

.analysis-kpi-strip span,
.analysis-kpi-strip strong,
.analysis-kpi-strip small {
  display: block;
}

.analysis-kpi-strip span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.analysis-kpi-strip strong {
  margin: 7px 0 4px;
  color: var(--navy);
  font-family: Poppins, sans-serif;
  font-size: 20px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analysis-kpi-strip small {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.35;
}

.analysis-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.analysis-main-panel {
  min-width: 0;
}

.analysis-side {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.panel-header.compact {
  min-height: 58px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.grain-label {
  max-width: 220px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  background: #F8F9FC;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.35;
  text-align: right;
}

.analysis-table-wrap {
  max-height: 670px;
}

.analysis-table {
  min-width: 1060px;
}

.analysis-table th:not(:first-child),
.analysis-table td:not(:first-child) {
  text-align: right;
}

.analysis-table th:nth-child(2),
.analysis-table td:nth-child(2),
.business-table th:nth-child(3),
.business-table td:nth-child(3),
.copa-table th:nth-child(2),
.copa-table td:nth-child(2),
.copa-table th:nth-child(3),
.copa-table td:nth-child(3) {
  text-align: left;
}

.financial-table .pnl-label {
  min-width: 220px;
}

.pnl-label span {
  display: inline-block;
}

.pnl-label.level-1 span {
  padding-left: 18px;
}

.analysis-row.subtotal td {
  border-top: 1px solid var(--line-strong);
  background: #F8F9FC;
  color: var(--navy);
  font-weight: 600;
}

.analysis-row.total td {
  border-top: 2px solid var(--navy);
  background: #EEF0FF;
  color: var(--navy);
  font-weight: 700;
}

.account-range {
  display: inline-block;
  padding: 3px 6px;
  background: var(--pale);
  color: var(--muted-blue);
  font-size: 9px;
  font-weight: 600;
}

.unit-name {
  color: var(--navy);
}

.analysis-table tfoot td {
  padding: 12px;
  border-top: 2px solid var(--navy);
  background: #EEF0FF;
  color: var(--navy);
  font-weight: 700;
  white-space: nowrap;
  text-align: right;
}

.analysis-table tfoot td:first-child {
  text-align: left;
}

.variance-positive {
  color: var(--green) !important;
  font-weight: 600;
}

.variance-negative {
  color: var(--red) !important;
  font-weight: 600;
}

.variance-neutral {
  color: var(--muted) !important;
}

.control-list,
.validation-list {
  min-width: 0;
}

.control-item {
  min-height: 72px;
  padding: 12px 13px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 7px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.control-item:last-child,
.validation-item:last-child {
  border-bottom: 0;
}

.control-status {
  width: 5px;
  height: 36px;
  background: var(--muted);
}

.control-status.OK {
  background: var(--green);
}

.control-status.WARNING {
  background: var(--amber);
}

.control-status.INFO {
  background: var(--blue);
}

.control-item strong,
.validation-item strong {
  display: block;
  color: var(--navy);
  font-size: 10px;
  line-height: 1.35;
}

.control-item p,
.validation-item p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
}

.control-item b {
  padding-left: 7px;
  font-size: 9px;
  white-space: nowrap;
}

.validation-item {
  min-height: 82px;
  padding: 12px 13px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.transaction-code {
  min-height: 25px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  background: #F8F9FC;
  color: var(--navy);
  font-size: 9px;
  font-weight: 700;
  text-align: center;
}

.validation-item small {
  display: block;
  margin-top: 5px;
  color: var(--muted-blue);
  font-size: 8px;
  font-weight: 600;
  text-transform: uppercase;
}

.analysis-rule-strip {
  min-height: 48px;
  margin-bottom: 18px;
  padding: 10px 14px;
  border: 1px solid #BBC4FF;
  background: #F1F3FF;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 11px;
}

.analysis-rule-strip svg {
  width: 18px;
  height: 18px;
  color: var(--blue);
  flex: none;
}

.analysis-rule-strip p {
  margin: 0;
  font-size: 10px;
  line-height: 1.45;
}

@media (max-width: 1550px) {
  .analysis-workspace {
    grid-template-columns: 1fr;
  }

  .analysis-side {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .analysis-kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analysis-kpi-strip article:nth-child(2) {
    border-right: 0;
  }

  .analysis-kpi-strip article:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .analysis-side {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .analysis-context-strip {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .analysis-context-strip strong {
    white-space: normal;
  }

  .analysis-kpi-strip {
    grid-template-columns: 1fr;
  }

  .analysis-kpi-strip article {
    min-height: 90px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .analysis-kpi-strip article:last-child {
    border-bottom: 0;
  }

  .grain-label {
    display: none;
  }

  .validation-item {
    grid-template-columns: 74px minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav-chevron,
  .nav-children {
    transition: none;
  }
}
