.metric.warning-card {
  background: #fff8e7;
  border-color: #e6c879;
}

.phase-cards {
  display: grid;
  gap: 18px;
  margin: 16px 0;
}

.phase-card,
.phase-standalone {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(30, 51, 75, .05);
}

.phase-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 14px;
  background: var(--ink);
  color: #fff;
}

.phase-card-header h3 {
  margin: 7px 0 0;
  color: #fff;
}

.phase-kicker {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #c9d8e5;
  font-size: .78rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.phase-kicker strong {
  padding: 3px 8px;
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  letter-spacing: 0;
}

.phase-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.phase-card-header .phase-actions button {
  background: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .35);
  color: #fff;
}

.phase-card-header .phase-actions .danger {
  color: #ffd9d5;
}

.phase-summary {
  display: grid;
  grid-template-columns: 1.35fr repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
  background: #eaf2f5;
}

.phase-summary > div {
  display: grid;
  align-content: center;
  min-height: 78px;
  padding: 13px 18px;
  border-right: 1px solid var(--border);
}

.phase-summary > div:last-child { border-right: 0; }
.phase-summary span:first-child { color: var(--muted); font-size: .8rem; }
.phase-summary strong { margin-top: 5px; font-size: 1.17rem; }
.phase-summary .tag { justify-self: start; margin-top: 7px; }

.phase-children { padding: 0 20px; }

.phase-children-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0 10px;
  color: var(--ink);
}

.phase-children-title small { color: var(--muted); }

.phase-row {
  display: grid;
  grid-template-columns: minmax(280px, 1.5fr) minmax(180px, .75fr) minmax(120px, auto) auto;
  align-items: center;
  gap: 16px;
  padding: 13px 0;
  border-top: 1px solid var(--border);
}

.phase-row.direct { background: linear-gradient(90deg, #f7fafb, transparent); }
.phase-identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.phase-identity div, .phase-amount { display: grid; gap: 3px; }
.phase-identity small, .phase-amount small { color: var(--muted); }
.phase-branch { color: var(--accent); font-size: 1.2rem; font-weight: 700; }
.phase-amount { text-align: right; }
.phase-empty { margin: 0; padding: 16px 0; border-top: 1px solid var(--border); color: var(--muted); }
.phase-card footer { padding: 12px 20px 16px; background: #f8fafb; }

.phase-standalone { margin: 16px 0; padding: 0 20px; }

.allocation-panel { margin-top: 18px; }
.allocation-panel .panel-title { align-items: flex-start; }
.allocation-groups { display: grid; gap: 12px; }
.allocation-group { border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.allocation-group-title { padding: 10px 13px; background: #eaf2f5; }
.allocation-group-title div { display: grid; gap: 2px; }
.allocation-group-title small { color: var(--muted); }
.allocation-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 13px; }
.allocation-balance { min-width: 230px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: #f3f6f8; text-align: right; }
.allocation-balance strong, .allocation-balance small { display: block; }
.allocation-balance small { margin-top: 3px; color: var(--muted); }
.allocation-balance.complete { background: #eaf6f1; border-color: #8abcae; color: #176653; }
.allocation-balance.pending { background: #fff8e7; border-color: #e6c879; color: #7a5300; }
.allocation-balance.over { background: #fff0ee; border-color: #df9e97; color: #9a3028; }

.export-scope { display: grid; gap: 18px; }
.export-scope > label { max-width: 620px; }
.export-checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.export-checks .check-label { align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: #f8fafb; }
.export-checks .check-label span { display: grid; gap: 3px; }
.export-checks .check-label small { display: block; }

@media (max-width: 1050px) {
  .phase-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .phase-summary > div:nth-child(2) { border-right: 0; }
  .phase-summary > div:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .phase-row { grid-template-columns: minmax(220px, 1fr) minmax(160px, .7fr); }
  .phase-row > .tag, .phase-row > .phase-actions { justify-self: start; }
  .allocation-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .export-checks { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .phase-card-header, .phase-children-title, .allocation-panel .panel-title { align-items: stretch; flex-direction: column; }
  .phase-actions { justify-content: flex-start; }
  .phase-summary, .phase-row, .allocation-fields { grid-template-columns: 1fr; }
  .phase-summary > div { border-right: 0; border-bottom: 1px solid var(--border); }
  .phase-amount { text-align: left; }
  .allocation-balance { min-width: 0; text-align: left; }
}
