.treasury-page {
  --treasury-ink: #172554;
  --treasury-muted: #667085;
  --treasury-line: #dfe5ef;
  --treasury-soft: #f6f8fc;
  display: grid;
  min-width: 0;
  gap: 1.25rem;
}

.treasury-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-top: -0.35rem;
}

.treasury-heading h1,
.treasury-heading p,
.treasury-panel__header h2,
.treasury-panel__header p,
.treasury-command-card h2,
.treasury-command-card p {
  margin: 0;
}

.treasury-heading h1 {
  color: var(--treasury-ink);
  font-size: clamp(1.65rem, 2.2vw, 2.25rem);
  line-height: 1.1;
}

.treasury-heading p,
.treasury-section-heading p,
.treasury-admin-setup__header p,
.treasury-panel__header p,
.treasury-command-card__header p {
  margin-top: 0.35rem;
  color: var(--treasury-muted);
}

.treasury-heading__kicker {
  display: block;
  margin-bottom: 0.3rem;
  color: #3557a8;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.treasury-heading__actions,
.treasury-command-card__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.treasury-ledger-badge,
.treasury-command-card__tag {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: #eaf0ff;
  color: #26478f;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.treasury-feedback {
  min-height: 1.3rem;
  margin: -0.35rem 0;
  color: #475467;
  font-weight: 650;
}

.treasury-feedback--error,
.treasury-page .module-state--error {
  color: #b42318;
}

.treasury-activation {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid #f0b44d;
  border-radius: 0.8rem;
  background: #fff7e6;
  color: #6f4300;
}

.treasury-activation--active {
  border-color: #86d3ac;
  background: #ecfdf3;
  color: #05603a;
}

.treasury-activation--fault {
  border-color: #f6aaa4;
  background: #fff1f0;
  color: #9c1c14;
}

.treasury-activation__hint {
  margin: 0.15rem 0 0;
  font-size: 0.84rem;
  font-weight: 650;
}

.treasury-activation__checklist {
  max-height: 22rem;
  max-width: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid rgba(111, 67, 0, 0.22);
  border-radius: 0.65rem;
  background: rgba(255, 255, 255, 0.72);
}

.treasury-activation__list {
  display: grid;
  min-width: 42rem;
  color: #5d3900;
  font-size: 0.82rem;
}

.treasury-activation__row {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr 4rem;
  gap: 0.7rem;
  padding: 0.58rem 0.7rem;
  border-bottom: 1px solid rgba(111, 67, 0, 0.14);
}

.treasury-activation__row:last-child {
  border-bottom: 0;
}

.treasury-kpis {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.35rem;
  min-width: 0;
}

.treasury-kpi-group {
  display: grid;
  min-width: 0;
  gap: 0.8rem;
}

.treasury-section-heading,
.treasury-admin-setup__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.treasury-section-heading h2,
.treasury-section-heading p,
.treasury-admin-setup__header h2,
.treasury-admin-setup__header p {
  margin: 0;
}

.treasury-section-heading h2,
.treasury-admin-setup__header h2 {
  color: var(--treasury-ink);
  font-size: 1.15rem;
}

.treasury-section-heading p,
.treasury-admin-setup__header p {
  margin-top: 0.25rem;
  color: var(--treasury-muted);
  font-size: 0.86rem;
}

.treasury-live-state,
.treasury-config-state,
.treasury-queue-badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.9rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: #e9f8ef;
  color: #087443;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.treasury-config-state {
  background: #fff2cf;
  color: #7a4d00;
}

.treasury-config-state--active {
  background: #e9f8ef;
  color: #087443;
}

.treasury-queue-badge {
  background: #fff2cf;
  color: #7a4d00;
}

.treasury-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
  min-width: 0;
}

.treasury-kpi {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 7.75rem;
  align-content: space-between;
  gap: 0.55rem;
  overflow: hidden;
  padding: 1rem 1.05rem;
  border: 1px solid var(--treasury-line);
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 8px 24px rgba(23, 37, 84, 0.055);
}

.treasury-kpi::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0.28rem;
  background: var(--treasury-tone, #3557a8);
  content: '';
}

.treasury-kpi--primary { --treasury-tone: #163a80; }
.treasury-kpi--business { --treasury-tone: #7047a6; }
.treasury-kpi--commission { --treasury-tone: #087443; }
.treasury-kpi--company { --treasury-tone: #2870b8; }
.treasury-kpi--reconciliation { --treasury-tone: #b54708; }
.treasury-kpi--transit { --treasury-tone: #856404; }
.treasury-kpi--today { --treasury-tone: #147347; }
.treasury-kpi--inflow { --treasury-tone: #007c91; }
.treasury-kpi--outflow { --treasury-tone: #a92319; }
.treasury-kpi--net { --treasury-tone: #3557a8; }

.treasury-kpi__label {
  color: #475467;
  font-size: 0.84rem;
  font-weight: 800;
  text-transform: uppercase;
}

.treasury-kpi__value {
  color: var(--treasury-ink);
  font-size: clamp(1.05rem, 1.55vw, 1.4rem);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.treasury-kpi small {
  color: var(--treasury-muted);
}

.treasury-flow-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--treasury-line);
  border-radius: 0.9rem;
  background: #fff;
}

.treasury-flow-strip article {
  display: grid;
  min-width: 0;
  gap: 0.35rem;
  padding: 0.85rem 1rem;
  border-right: 1px solid var(--treasury-line);
}

.treasury-flow-strip article:last-child {
  border-right: 0;
}

.treasury-flow-strip span,
.treasury-flow-strip small {
  color: var(--treasury-muted);
  font-size: 0.76rem;
}

.treasury-flow-strip span {
  font-weight: 800;
  text-transform: uppercase;
}

.treasury-flow-strip strong {
  color: var(--treasury-ink);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.treasury-flow-strip__reconciliation {
  background: #fffaf0;
}

.treasury-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 28rem), 1fr));
  align-items: start;
  gap: 1rem;
  min-width: 0;
  overflow: visible;
}

.treasury-actions--admin {
  margin: 0;
}

.treasury-command-card,
.treasury-panel {
  min-width: 0;
  border: 1px solid var(--treasury-line);
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 8px 24px rgba(23, 37, 84, 0.045);
}

.treasury-mandates {
  box-shadow: 0 12px 30px rgba(23, 37, 84, 0.065);
}

.treasury-mandates-table--compact {
  min-width: 62rem;
}

.treasury-number--strong {
  color: var(--treasury-ink);
  font-weight: 800;
}

.treasury-subdetails,
.treasury-advanced {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--treasury-line);
  border-radius: 1rem;
  background: #fff;
}

.treasury-subdetails {
  border-radius: 0.8rem;
  background: #f9fafc;
}

.treasury-subdetails > summary,
.treasury-advanced__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  cursor: pointer;
  color: var(--treasury-ink);
  list-style: none;
}

.treasury-subdetails > summary::-webkit-details-marker,
.treasury-advanced__summary::-webkit-details-marker {
  display: none;
}

.treasury-subdetails > summary > span,
.treasury-advanced__summary > span:first-child {
  display: grid;
  gap: 0.25rem;
}

.treasury-subdetails > summary small,
.treasury-advanced__summary small {
  color: var(--treasury-muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.treasury-subdetails > summary::after,
.treasury-advanced__summary::after {
  flex: 0 0 auto;
  color: #3557a8;
  content: '⌄';
  font-size: 1.2rem;
  font-weight: 800;
}

.treasury-subdetails[open] > summary::after,
.treasury-advanced[open] > .treasury-advanced__summary::after {
  transform: rotate(180deg);
}

.treasury-advanced__toggle {
  margin-left: auto;
  color: #3557a8;
  font-size: 0.8rem;
  font-weight: 750;
}

.treasury-subdetails__body,
.treasury-advanced__body {
  display: grid;
  min-width: 0;
  gap: 1rem;
  padding: 0 1rem 1rem;
}

.treasury-advanced__body {
  padding-top: 0.25rem;
  border-top: 1px solid var(--treasury-line);
  background: #f7f9fc;
}

.treasury-subdetails__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.treasury-subdetails__header p {
  margin: 0;
  color: var(--treasury-muted);
  font-size: 0.82rem;
}

.treasury-admin-setup {
  display: grid;
  gap: 0.85rem;
  margin-top: 0.75rem;
  padding: 1rem;
  border: 1px solid var(--treasury-line);
  border-radius: 1rem;
  background: #fff;
}

.treasury-audit-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  margin: 0;
}

.treasury-audit-facts div {
  display: grid;
  gap: 0.2rem;
  padding: 0.7rem;
  border-radius: 0.65rem;
  background: var(--treasury-soft);
}

.treasury-audit-facts dt {
  color: var(--treasury-muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.treasury-audit-facts dd {
  margin: 0;
  color: var(--treasury-ink);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.treasury-command-card {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  overflow: visible;
}

.treasury-command-card__header,
.treasury-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.treasury-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  overflow: visible;
}

.treasury-field {
  position: relative;
  z-index: 1;
  display: grid;
  min-width: 0;
  gap: 0.35rem;
  overflow: visible;
}

.treasury-field:focus-within {
  z-index: 20;
}

.treasury-field__label {
  color: #344054;
  font-size: 0.84rem;
  font-weight: 750;
}

.treasury-field small,
.treasury-command-card__note {
  color: var(--treasury-muted);
  font-size: 0.78rem;
}

.treasury-field input,
.treasury-field select,
.treasury-field textarea,
.treasury-matrix input {
  box-sizing: border-box;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.62rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.65rem;
  outline: none;
  background: #fff;
  color: #1d2939;
  font: inherit;
}

.treasury-field textarea {
  min-height: 4.25rem;
  resize: vertical;
}

.treasury-field input:focus,
.treasury-field select:focus,
.treasury-field textarea:focus,
.treasury-matrix input:focus {
  border-color: #3557a8;
  box-shadow: 0 0 0 3px rgba(53, 87, 168, 0.14);
}

.treasury-field input[readonly] {
  background: #f2f4f7;
  color: #475467;
}

.treasury-matrix-region,
.treasury-table-region {
  max-width: 100%;
  overflow: auto;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
}

.treasury-matrix-region {
  border: 1px solid var(--treasury-line);
  border-radius: 0.75rem;
}

.treasury-matrix,
.treasury-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.treasury-matrix {
  min-width: 31rem;
}

.treasury-matrix th,
.treasury-matrix td {
  padding: 0.65rem;
  border-bottom: 1px solid #e8ecf3;
  text-align: left;
}

.treasury-matrix thead th {
  background: var(--treasury-soft);
  color: #344054;
  font-size: 0.8rem;
  text-transform: uppercase;
}

.treasury-matrix tbody th {
  color: #344054;
  font-size: 0.86rem;
  white-space: nowrap;
}

.treasury-matrix tbody tr:last-child > * {
  border-bottom: 0;
}

.treasury-panel {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  overflow: visible;
}

.treasury-table-region {
  border: 1px solid var(--treasury-line);
  border-radius: 0.8rem;
  background: #fff;
}

.treasury-table {
  min-width: max-content;
  color: #344054;
  font-size: 0.86rem;
}

.treasury-table th,
.treasury-table td {
  max-width: 22rem;
  padding: 0.72rem 0.8rem;
  border-bottom: 1px solid #e8ecf3;
  text-align: left;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.treasury-table thead th {
  position: sticky;
  z-index: 2;
  top: 0;
  background: #f5f7fb;
  color: #344054;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  white-space: nowrap;
}

.treasury-table tbody tr:nth-child(even) {
  background: #fafbfe;
}

.treasury-table tbody tr:last-child td {
  border-bottom: 0;
}

.treasury-number {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.treasury-request-ref {
  color: #475467;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.76rem;
  white-space: nowrap;
}

.treasury-status {
  display: inline-flex;
  align-items: center;
  min-height: 1.75rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.treasury-status--pending { background: #8a5100; }
.treasury-status--confirmed { background: #087443; }
.treasury-status--draft { background: #667085; }

.treasury-load-more {
  justify-self: center;
}

.treasury-page button {
  min-height: 2.65rem;
  max-width: 100%;
  white-space: normal;
}

@media (max-width: 900px) {
  .treasury-heading,
  .treasury-command-card__header,
  .treasury-panel__header {
    align-items: flex-start;
    flex-direction: column;
  }

  .treasury-heading__actions,
  .treasury-command-card__actions {
    width: 100%;
    justify-content: flex-start;
  }

  .treasury-kpi-grid,
  .treasury-flow-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

@media (max-width: 640px) {
  .treasury-kpi-grid,
  .treasury-flow-strip,
  .treasury-audit-facts,
  .treasury-form-grid {
    grid-template-columns: 1fr;
  }

  .treasury-flow-strip article,
  .treasury-flow-strip article:nth-child(2) {
    border-right: 0;
    border-bottom: 1px solid var(--treasury-line);
  }

  .treasury-flow-strip article:last-child {
    border-bottom: 0;
  }

  .treasury-kpi {
    min-height: 7.5rem;
  }

  .treasury-command-card,
  .treasury-panel {
    padding: 0.8rem;
    border-radius: 0.8rem;
  }

  .treasury-heading__actions > *,
  .treasury-command-card__actions > * {
    flex: 1 1 12rem;
  }

  .treasury-section-heading,
  .treasury-admin-setup__header,
  .treasury-subdetails__header,
  .treasury-advanced__summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .treasury-advanced__toggle {
    margin-left: 0;
  }
}

@media print {
  .treasury-refresh,
  .treasury-actions,
  .treasury-confirm-button,
  .treasury-load-more {
    display: none !important;
  }

  .treasury-table-region {
    overflow: visible;
  }
}
