body.tfam-mgmt-page {
  background:
    radial-gradient(circle at top left, rgba(49, 95, 89, .10), transparent 28%),
    linear-gradient(180deg, #f7faf7 0%, #eef3ee 100%) !important;
  color: #1f2926 !important;
}

body.tfam-mgmt-page .container {
  max-width: 1440px !important;
}

body.tfam-mgmt-page header {
  background: #4d584f !important;
  color: #f7f2e7 !important;
  border-radius: 16px !important;
  box-shadow: 0 18px 46px rgba(31, 41, 38, .14) !important;
}

body.tfam-mgmt-page .badge,
body.tfam-mgmt-page .back-link,
body.tfam-mgmt-page .upload-btn {
  border: 1px solid rgba(255, 255, 255, .20) !important;
  background: rgba(255, 255, 255, .14) !important;
}

body.tfam-mgmt-page .kpi-row {
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  align-items: stretch !important;
}

body.tfam-mgmt-page .kpi-card,
body.tfam-mgmt-page .panel,
body.tfam-mgmt-page .summary-card,
body.tfam-mgmt-page .owner-card,
body.tfam-mgmt-page .risk-card,
body.tfam-mgmt-page .project-card,
body.tfam-mgmt-page .item-card {
  background: #ffffff !important;
  border: 1px solid #dbe1d8 !important;
  border-radius: 10px !important;
  box-shadow: 0 10px 28px rgba(31, 41, 38, .05) !important;
}

body.tfam-mgmt-page .kpi-card {
  border-left: 4px solid #4d584f !important;
}

body.tfam-mgmt-page .kpi-card:nth-child(2) {
  border-left-color: #3f7f5f !important;
}

body.tfam-mgmt-page .kpi-card:nth-child(3) {
  border-left-color: #b77a2f !important;
}

body.tfam-mgmt-page .kpi-card:nth-child(4) {
  border-left-color: #6e8c82 !important;
}

body.tfam-mgmt-page .kpi-label,
body.tfam-mgmt-page .muted,
body.tfam-mgmt-page .kpi-sub {
  color: #65716b !important;
}

body.tfam-mgmt-page .kpi-value,
body.tfam-mgmt-page .summary-card h3,
body.tfam-mgmt-page .risk-card h3,
body.tfam-mgmt-page .owner-card h3,
body.tfam-mgmt-page .project-card h3 {
  color: #1f2926 !important;
}

body.tfam-mgmt-page .panel h2 {
  color: #315f59 !important;
}

body.tfam-mgmt-page .tabs {
  background: #e1e7df !important;
  border: 1px solid #dbe1d8 !important;
  border-radius: 12px !important;
  padding: 4px !important;
  gap: 4px !important;
  overflow-x: auto !important;
}

body.tfam-mgmt-page .tab-btn {
  background: transparent !important;
  color: #4f5c50 !important;
  border: 0 !important;
  border-radius: 10px !important;
  font-weight: 700 !important;
  box-shadow: none !important;
}

body.tfam-mgmt-page .tab-btn.active {
  background: #315f59 !important;
  color: #ffffff !important;
  box-shadow: none !important;
}

.tfam-mgmt-summary {
  background: #ffffff;
  border: 1px solid #dbe1d8;
  border-radius: 12px;
  padding: 16px;
  margin: 0 0 18px;
  box-shadow: 0 10px 28px rgba(31, 41, 38, .05);
}

.tfam-mgmt-summary-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
}

.tfam-mgmt-summary-head h2 {
  margin: 0 0 4px !important;
  color: #1f2926 !important;
  font-size: 18px !important;
  border: 0 !important;
  padding: 0 !important;
}

.tfam-mgmt-summary-head p {
  margin: 0;
  color: #65716b;
  font-size: 12px;
  line-height: 1.6;
}

.tfam-mgmt-rate {
  text-align: right;
  min-width: 120px;
}

.tfam-mgmt-rate span {
  display: block;
  color: #65716b;
  font-size: 11px;
}

.tfam-mgmt-rate strong {
  color: #315f59;
  font-size: 28px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.tfam-mgmt-rail-wrap {
  margin: 8px 0 12px;
}

.tfam-mgmt-rail {
  position: relative;
  height: 16px;
  background: #e1e7df;
  border-radius: 999px;
  overflow: visible;
}

.tfam-mgmt-rail::after {
  content: "";
  position: absolute;
  top: -5px;
  right: 0;
  bottom: -5px;
  border-right: 1px solid rgba(49, 95, 89, .62);
}

.tfam-mgmt-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  border-radius: 999px;
}

.tfam-mgmt-fill.sign {
  background: rgba(183, 122, 47, .68);
}

.tfam-mgmt-fill.paid {
  background: #3f7f5f;
}

.tfam-mgmt-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  color: #65716b;
  font-size: 11px;
}

.tfam-mgmt-axis strong {
  color: #1f2926;
}

.tfam-mgmt-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: #65716b;
  font-size: 11px;
}

.tfam-mgmt-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.tfam-mgmt-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
}

.tfam-mgmt-dot.budget {
  background: #e1e7df;
  border: 1px solid #cfd8ce;
}

.tfam-mgmt-dot.sign {
  background: #b77a2f;
}

.tfam-mgmt-dot.paid {
  background: #3f7f5f;
}

.project-visual-grid {
  grid-template-columns: minmax(900px, 1.72fr) minmax(280px, .42fr) !important;
}

.overview-grid {
  grid-template-columns: minmax(300px, .68fr) minmax(760px, 1.7fr) minmax(280px, .58fr) !important;
}

.overview-project-matrix-panel {
  min-width: 0;
}

.project-account-matrix,
.tfam-project-matrix {
  overflow: auto;
  max-height: 520px;
  border: 1px solid #dbe1d8;
  border-radius: 10px;
  background: #ffffff;
}

.project-account-matrix.compact,
.tfam-project-matrix.compact {
  max-height: 390px;
}

.matrix-summary,
.tfam-matrix-summary {
  position: sticky;
  left: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid #dbe1d8;
  background: #f7faf7;
  color: #65716b;
  font-size: 12px;
  line-height: 1.5;
}

.matrix-summary strong,
.tfam-matrix-summary strong {
  color: #1f2926;
}

.project-account-matrix .matrix-grid,
.tfam-matrix-grid {
  display: grid;
  grid-template-columns: minmax(240px, 1.2fr) repeat(var(--matrix-cols), minmax(112px, 1fr));
  min-width: 100%;
}

.project-account-matrix.compact .matrix-grid,
.tfam-project-matrix.compact .tfam-matrix-grid {
  grid-template-columns: minmax(190px, 1.1fr) repeat(var(--matrix-cols), minmax(96px, 1fr));
  min-width: 100%;
}

.project-account-matrix .matrix-cell,
.tfam-matrix-cell {
  padding: 10px 11px;
  border-bottom: 1px solid #dbe1d8;
  border-right: 1px solid #dbe1d8;
  min-height: 48px;
  font-size: 12px;
  line-height: 1.35;
  color: #1f2926;
}

.project-account-matrix .matrix-cell.head,
.tfam-matrix-cell.head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #eef3ee;
  color: #4f5c50;
  font-weight: 800;
  white-space: normal;
  word-break: keep-all;
}

.project-account-matrix .matrix-cell.project,
.tfam-matrix-cell.project {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #ffffff;
  font-weight: 800;
  white-space: normal;
}

.project-account-matrix .matrix-cell.project.head,
.tfam-matrix-cell.project.head {
  z-index: 3;
  background: #eef3ee;
}

.project-account-matrix .matrix-cell.amount,
.tfam-matrix-cell.amount {
  background: rgba(49, 95, 89, var(--shade));
  color: #1f2926;
  font-weight: 800;
  text-align: right;
}

.project-account-matrix .matrix-cell.amount.empty,
.tfam-matrix-cell.amount.empty {
  background: #f7faf7;
  color: #c0c9bd;
}

.project-account-matrix .matrix-cell span,
.tfam-matrix-cell span {
  display: block;
  color: #65716b;
  font-size: 11px;
  font-weight: 600;
  margin-top: 3px;
}

.tfam-mgmt-alerts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.tfam-mgmt-alert {
  background: #f7faf7;
  border: 1px solid #dbe1d8;
  border-radius: 10px;
  padding: 12px;
  min-width: 0;
}

.tfam-mgmt-alert h3 {
  margin: 0 0 8px;
  color: #1f2926;
  font-size: 13px;
}

.tfam-mgmt-alert ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 7px;
}

.tfam-mgmt-alert li {
  color: #4f5c50;
  font-size: 12px;
  line-height: 1.45;
}

.tfam-mgmt-alert em {
  display: block;
  color: #65716b;
  font-size: 11px;
  font-style: normal;
  margin-top: 2px;
}

@media (max-width: 1180px) {
  .overview-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 1100px) {
  body.tfam-mgmt-page .kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .project-visual-grid {
    grid-template-columns: 1fr !important;
  }

  .tfam-mgmt-alerts {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  body.tfam-mgmt-page .kpi-row {
    grid-template-columns: 1fr !important;
  }

  .tfam-mgmt-summary-head {
    display: block;
  }

  .tfam-mgmt-rate {
    margin-top: 10px;
    text-align: left;
  }
}
