/* Financial Workbench — Corporate / Insurance Desk (reference implementation) */

.fwd-desk {
  padding-bottom: 4.5rem;
}

/* —— Command header —— */
.fwd-command {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--chk-border, #cbd5e1);
  border-radius: 0.5rem;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 55%);
  margin-bottom: 0.65rem;
}

.fwd-command--ops { gap: 0.65rem; }

.fwd-command__row--identity {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
}

.fwd-command__who { flex: 1; min-width: 0; }

.fwd-command__identity-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
  flex-shrink: 0;
}

.fwd-command__avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.45rem;
  background: #0f766e;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.fwd-command__name-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.45rem;
  align-items: center;
}

.fwd-command__name {
  font-size: 1.1rem;
  font-weight: 750;
  color: #0f172a;
  line-height: 1.2;
}

.fwd-command__badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.12rem 0.4rem;
  border-radius: 0.25rem;
  background: #e0e7ff;
  color: #3730a3;
}

.fwd-command__status {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 0.3rem;
  border: 1px solid #cbd5e1;
  background: #fff;
}

.fwd-command__status--ready_for_settlement,
.fwd-command__status--account_closed { background: #f0fdf4; border-color: #86efac; color: #047857; }
.fwd-command__status--awaiting_claim,
.fwd-command__status--claim_under_review,
.fwd-command__status--in_progress { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; }
.fwd-command__status--patient_due { background: #fff7ed; border-color: #fdba74; color: #c2410c; }

.fwd-command__pill {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}
.fwd-command__pill--settle {
  background: #f5f3ff;
  color: #6d28d9;
  border-color: #c4b5fd;
}

.fwd-command__ids {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.85rem;
  margin-top: 0.25rem;
  font-size: 0.78rem;
  color: #334155;
}
.fwd-command__ids b {
  color: #64748b;
  font-weight: 650;
  margin-right: 0.2rem;
}

/* Row 2 — compact info cards */
.fwd-command__row--cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.45rem;
}
@media (max-width: 1100px) {
  .fwd-command__row--cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .fwd-command__row--cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fwd-command__row--identity { flex-wrap: wrap; }
  .fwd-command__identity-actions { width: 100%; justify-content: flex-start; }
}

.fwd-command-card {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.4rem;
  background: #fff;
  min-width: 0;
}
.fwd-command-card__label {
  font-size: 0.62rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}
.fwd-command-card__value {
  font-size: 0.8125rem;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* More details */
.fwd-command__more {
  border-top: 1px solid #e2e8f0;
  padding-top: 0.35rem;
}
.fwd-command__more-summary {
  list-style: none;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
  color: #475569;
  user-select: none;
}
.fwd-command__more-summary::-webkit-details-marker { display: none; }
.fwd-command__more-summary::before {
  content: "▸ ";
  color: #94a3b8;
}
.fwd-command__more[open] > .fwd-command__more-summary::before { content: "▾ "; }
.fwd-command__more-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.35rem 0.75rem;
  margin-top: 0.45rem;
}
@media (max-width: 900px) {
  .fwd-command__more-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.fwd-command__more-item {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}
.fwd-command__more-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #94a3b8;
}
.fwd-command__more-value {
  font-size: 0.78rem;
  font-weight: 650;
  color: #334155;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* —— Finance strip / KPI corporate variant —— */
.fwd-finance-strip { margin-bottom: 0.65rem; }

.eu-kpi--corporate {
  border-color: #c4b5fd;
  background: linear-gradient(180deg, #f5f3ff 0%, #fff 70%);
}
.eu-kpi--corporate .eu-kpi__value { color: #6d28d9; }

/* —— Ageing strip —— */
.fwd-ageing {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0.5rem 0 0.75rem;
}
.fwd-ageing__card {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.55rem 0.7rem;
  border-radius: 0.45rem;
  border: 1px solid #e2e8f0;
  text-decoration: none;
  color: inherit;
  background: #fff;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
  outline: none;
}
.fwd-ageing__card:hover,
.fwd-ageing__card:focus-visible {
  border-color: #e2e8f0;
  outline: none;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
  transform: translateY(-2px);
}
.fwd-ageing__card:active {
  transform: translateY(0);
  box-shadow: none;
  border-color: #6d28d9;
  background: #f5f3ff;
}
.fwd-ageing__label { font-size: 0.7rem; font-weight: 650; color: #64748b; text-transform: uppercase; letter-spacing: 0.04em; }
.fwd-ageing__count { font-size: 1.15rem; font-weight: 800; }
.fwd-ageing__amt { font-size: 0.75rem; color: #475569; }
.fwd-ageing__card--success { border-color: #86efac; background: #f0fdf4; }
.fwd-ageing__card--info { border-color: #93c5fd; background: #eff6ff; }
.fwd-ageing__card--warning { border-color: #fdba74; background: #fff7ed; }
.fwd-ageing__card--danger { border-color: #fca5a5; background: #fef2f2; }
.fwd-ageing__card--success:hover,
.fwd-ageing__card--info:hover,
.fwd-ageing__card--warning:hover,
.fwd-ageing__card--danger:hover { border-color: inherit; }
.fwd-ageing__card.is-active {
  border-color: #6d28d9;
  box-shadow: 0 4px 14px rgba(109, 40, 217, 0.12);
}

@media (max-width: 900px) {
  .fwd-ageing { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* —— Panels / accordions —— */
.fwd-panels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
@media (max-width: 1100px) {
  .fwd-panels { grid-template-columns: 1fr; }
}

.fwd-panel,
.fwd-accordion {
  border: 1px solid #e2e8f0;
  border-radius: 0.45rem;
  background: #fff;
  margin-bottom: 0.5rem;
}
.fwd-panel__head,
.fwd-accordion__summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 750;
  color: #1e293b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.fwd-panel__head::-webkit-details-marker,
.fwd-accordion__summary::-webkit-details-marker { display: none; }
.fwd-panel__head::after,
.fwd-accordion__summary::after {
  content: "▸";
  margin-left: auto;
  color: #64748b;
  font-size: 0.7rem;
}
.fwd-panel[open] > .fwd-panel__head::after,
.fwd-accordion[open] > .fwd-accordion__summary::after { content: "▾"; }
.fwd-panel__count { font-weight: 650; color: #64748b; text-transform: none; letter-spacing: 0; }
.fwd-panel__body,
.fwd-accordion__body { padding: 0.35rem 0.7rem 0.65rem; border-top: 1px solid #f1f5f9; }

.fwd-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: 0.25rem;
}
.fwd-badge--info { background: #eff6ff; color: #1d4ed8; }

.fwd-mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}
.fwd-mini-table th,
.fwd-mini-table td {
  padding: 0.35rem 0.4rem;
  border-bottom: 1px solid #f1f5f9;
  text-align: left;
}
.fwd-mini-table th { color: #64748b; font-weight: 650; font-size: 0.7rem; text-transform: uppercase; }
.fwd-mini-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.fwd-mini-table tbody tr:hover { background: #f8fafc; }

.fwd-subhead {
  margin: 0.75rem 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 750;
  color: #475569;
  text-transform: uppercase;
}

/* —— Workflow rail —— */
.fwd-workflow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  list-style: none;
  margin: 0 0 0.65rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.45rem;
  background: #f8fafc;
}
.fwd-workflow--command {
  margin: 0;
  padding: 0.4rem 0.15rem 0.15rem;
  border: 0;
  background: transparent;
  gap: 0.3rem;
  flex-wrap: nowrap;
  overflow-x: auto;
}
.fwd-workflow__step {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 650;
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #64748b;
  white-space: nowrap;
  flex-shrink: 0;
}
.fwd-workflow__step--done { background: #f0fdf4; border-color: #86efac; color: #047857; }
.fwd-workflow__step.is-current,
.fwd-workflow__step--current { background: #fff7ed; border-color: #fdba74; color: #c2410c; }
.fwd-workflow__step--pending { opacity: 0.85; }
.fwd-workflow__mark { font-size: 0.75rem; }

/* —— Banners —— */
.fwd-banners { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.65rem; }
.fwd-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.7rem;
  border-radius: 0.4rem;
  border: 1px solid;
  font-size: 0.8125rem;
  font-weight: 650;
}
.fwd-banner--success { background: #f0fdf4; border-color: #86efac; color: #047857; }
.fwd-banner--info { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; }
.fwd-banner--warning { background: #fff7ed; border-color: #fdba74; color: #c2410c; }
.fwd-banner--danger { background: #fef2f2; border-color: #fca5a5; color: #b91c1c; }

/* —— Checklist / timeline / AI —— */
.fwd-checklist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.35rem; }
.fwd-checklist__item { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8125rem; color: #c2410c; }
.fwd-checklist__item.is-done { color: #047857; }

.fwd-timeline { list-style: none; margin: 0; padding: 0; }
.fwd-timeline__item {
  display: grid;
  grid-template-columns: 0.75rem 8rem 1fr 6rem 5.5rem;
  gap: 0.5rem;
  align-items: start;
  padding: 0.4rem 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.8125rem;
  position: relative;
}
.fwd-timeline__dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #64748b;
  margin-top: 0.3rem;
}
.fwd-timeline__item--settlement_received .fwd-timeline__dot,
.fwd-timeline__item--patient_paid .fwd-timeline__dot,
.fwd-timeline__item--closed .fwd-timeline__dot { background: #047857; }
.fwd-timeline__item--claim_submitted .fwd-timeline__dot { background: #6d28d9; }
.fwd-timeline__kind { font-weight: 700; color: #0f172a; }
.fwd-timeline__ref { color: #475569; }
.fwd-timeline__note { display: block; font-size: 0.7rem; color: #64748b; }
.fwd-timeline__amt { text-align: right; font-variant-numeric: tabular-nums; }
.fwd-timeline__at { text-align: right; color: #64748b; font-size: 0.75rem; }

.fwd-ai-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 0.45rem;
}
.fwd-ai-card {
  padding: 0.5rem;
  border: 1px dashed #cbd5e1;
  border-radius: 0.4rem;
  background: #f8fafc;
}
.fwd-ai-card__label { font-size: 0.7rem; font-weight: 700; color: #64748b; text-transform: uppercase; }
.fwd-ai-card__value { font-size: 0.8125rem; color: #94a3b8; margin-top: 0.2rem; }

/* —— Toolbar / sticky —— */
.fwd-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0.5rem 0;
  padding: 0.4rem 0.55rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.4rem;
  background: #f8fafc;
}
.fwd-toolbar__label { font-size: 0.7rem; font-weight: 750; text-transform: uppercase; color: #64748b; margin-right: 0.35rem; }
.fwd-toolbar__hint { font-size: 0.7rem; color: #94a3b8; }

.fwd-selection-bar {
  position: sticky;
  bottom: 0;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem 1rem;
  margin-top: 0.75rem;
  padding: 0.55rem 0.85rem;
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 0.45rem 0.45rem 0 0;
  box-shadow: 0 -2px 12px rgba(15, 23, 42, 0.2);
}
.fwd-selection-bar[hidden] { display: none !important; }
.fwd-selection-bar__count { font-size: 0.8125rem; font-weight: 650; }
.fwd-selection-bar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.fwd-selection-bar__form { display: inline; margin: 0; }
.fwd-select-box { width: 1rem; height: 1rem; accent-color: #0f766e; cursor: pointer; }

.fwd-sticky {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  padding: 0.55rem 0.85rem;
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 0.45rem 0.45rem 0 0;
  box-shadow: 0 -2px 12px rgba(15, 23, 42, 0.18);
  margin-top: 1rem;
}
.fwd-sticky--ops {
  justify-content: center;
  gap: 0.45rem;
}
.fwd-sticky__ops {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}
.fwd-sticky--ops .eu-btn--ghost {
  color: #e2e8f0;
  border-color: #475569;
}
.fwd-sticky--ops .eu-btn--ghost:hover {
  background: #334155;
  color: #fff;
}
.fwd-sticky--ops .eu-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.fwd-sticky__group { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.fwd-sticky__label {
  font-size: 0.65rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  margin-right: 0.15rem;
}
.fwd-sticky__empty { font-size: 0.75rem; color: #94a3b8; }

.fwd-settle-form { max-width: 40rem; display: flex; flex-direction: column; gap: 0.65rem; }
.fwd-coverage-settle { max-width: 36rem; display: flex; flex-direction: column; gap: 0.45rem; margin: 0.25rem 0; }
.fwd-coverage-actions { min-width: 14rem; vertical-align: top; }

/* Results ageing row accents */
#ip-billing-corporate-receivables thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
}
.fwd-row--age-90_plus { box-shadow: inset 3px 0 0 #ef4444; }
.fwd-row--age-61_90 { box-shadow: inset 3px 0 0 #f97316; }
.fwd-row--age-31_60 { box-shadow: inset 3px 0 0 #3b82f6; }
.fwd-row--age-0_30 { box-shadow: inset 3px 0 0 #22c55e; }
#ip-billing-corporate-receivables tbody tr:hover { background: #f1f5f9; }

/* Charts */
.fwd-charts {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}
@media (max-width: 900px) {
  .fwd-charts { grid-template-columns: 1fr; }
}
.fwd-chart {
  border: 1px solid #e2e8f0;
  border-radius: 0.45rem;
  background: #fff;
  padding: 0.55rem 0.7rem 0.7rem;
}
.fwd-chart__title {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #475569;
}
.fwd-chart__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.45rem;
}
.fwd-chart__head .fwd-chart__title { margin: 0; }
.fwd-chart__tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  padding: 0.15rem;
  border-radius: 0.35rem;
  background: #f1f5f9;
}
.fwd-chart__tab {
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.25rem 0.45rem;
  border-radius: 0.25rem;
  cursor: pointer;
}
.fwd-chart__tab.is-active {
  background: #fff;
  color: #6d28d9;
  box-shadow: 0 0 0 1px #e2e8f0;
}
.fwd-chart__row {
  display: grid;
  grid-template-columns: 5.5rem 1fr 5.5rem;
  gap: 0.4rem;
  align-items: center;
  text-decoration: none;
  color: inherit;
  margin-bottom: 0.35rem;
  font-size: 0.75rem;
}
.fwd-chart__track {
  height: 0.55rem;
  background: #f1f5f9;
  border-radius: 999px;
  overflow: hidden;
}
.fwd-chart__fill { display: block; height: 100%; border-radius: 999px; }
.fwd-chart__fill--success { background: #22c55e; }
.fwd-chart__fill--info { background: #3b82f6; }
.fwd-chart__fill--warning { background: #f97316; }
.fwd-chart__fill--danger { background: #ef4444; }
.fwd-chart__value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; }
.fwd-chart__cols {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  height: 7rem;
  padding-top: 0.35rem;
}
.fwd-chart__col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.fwd-chart__col--link {
  text-decoration: none;
  color: inherit;
  min-width: 0;
}
.fwd-chart__col--link:hover .fwd-chart__col-bar { background: #5b21b6; }
.fwd-chart__col-bar-wrap {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.fwd-chart__col-bar {
  width: 70%;
  max-width: 2rem;
  background: #6d28d9;
  border-radius: 0.25rem 0.25rem 0 0;
  min-height: 0.25rem;
}
.fwd-chart__col-label { font-size: 0.65rem; color: #64748b; margin-top: 0.25rem; }

/* Payer cards */
.fwd-payer-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
}
.fwd-payer-card {
  display: block;
  padding: 0.55rem 0.65rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.4rem;
  text-decoration: none;
  color: inherit;
  background: #fff;
}
.fwd-payer-card:hover { border-color: #94a3b8; }
.fwd-payer-card--danger { border-left: 3px solid #ef4444; }
.fwd-payer-card--warning { border-left: 3px solid #f97316; }
.fwd-payer-card--success { border-left: 3px solid #22c55e; }
.fwd-payer-card__top { display: flex; justify-content: space-between; gap: 0.35rem; align-items: flex-start; }
.fwd-payer-card__name { font-size: 0.8125rem; }
.fwd-payer-card__amount { font-size: 1rem; font-weight: 800; color: #6d28d9; margin: 0.2rem 0; }
.fwd-payer-card__amount-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 650;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.fwd-payer-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  font-size: 0.7rem;
  color: #64748b;
}

.fwd-badge--success { background: #f0fdf4; color: #047857; }
.fwd-badge--warning { background: #fff7ed; color: #c2410c; }
.fwd-badge--danger { background: #fef2f2; color: #b91c1c; }
.fwd-badge--info { background: #eff6ff; color: #1d4ed8; }

/* AI insights list */
.fwd-ai-list { display: flex; flex-direction: column; gap: 0.35rem; }
.fwd-ai-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.45rem 0.55rem;
  border-radius: 0.35rem;
  border: 1px solid #e2e8f0;
  font-size: 0.8125rem;
  font-weight: 650;
  text-decoration: none;
  color: inherit;
}
.fwd-ai-item__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
}
.fwd-ai-item__link {
  font-size: 0.7rem;
  font-weight: 750;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.12em;
  opacity: 0.9;
}
.fwd-ai-item__link:hover { opacity: 1; }
.fwd-ai-item--success { background: #f0fdf4; border-color: #86efac; color: #047857; }
.fwd-ai-item--info { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; }
.fwd-ai-item--warning { background: #fff7ed; border-color: #fdba74; color: #c2410c; }
.fwd-ai-item--danger { background: #fef2f2; border-color: #fca5a5; color: #b91c1c; }
.fwd-ai-item--corporate { background: #f5f3ff; border-color: #c4b5fd; color: #6d28d9; }

/* —— Corporate desk KPI interaction (no double border/outline) —— */
.ipb-corporate .eu-kpi-grid {
  gap: 0.65rem;
}
.ipb-corporate .eu-kpi,
.ipb-corporate a.eu-kpi--link {
  border: 1px solid #e2e8f0 !important;
  box-shadow: none !important;
  outline: none !important;
  text-decoration: none;
  color: inherit;
  padding: 0.7rem 0.8rem;
  border-radius: 0.5rem;
  transition: box-shadow 0.15s ease, transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.ipb-corporate .eu-kpi::before { display: none !important; }
.ipb-corporate .eu-kpi:hover,
.ipb-corporate a.eu-kpi--link:hover,
.ipb-corporate a.eu-kpi--link:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08) !important;
  border-color: #e2e8f0 !important;
  outline: none !important;
}
.ipb-corporate a.eu-kpi--link.is-active,
.ipb-corporate a.eu-kpi--link[aria-current="true"] {
  border-color: #6d28d9 !important;
  background: #f5f3ff;
  box-shadow: none !important;
  transform: none;
}
.ipb-corporate a.eu-kpi--link:active {
  transform: translateY(0);
  background: #ede9fe;
  border-color: #6d28d9 !important;
  box-shadow: none !important;
}
.ipb-corporate .eu-kpi__label { margin-bottom: 0.15rem; }
.ipb-corporate .eu-kpi__header { margin-bottom: 0.25rem; }
.ipb-corporate .eu-kpi__value { font-size: 1.05rem; }

/* Claim cockpit KPI hits — same interaction language */
.fwd-kpi-hit { cursor: pointer; }
.fwd-kpi-hit .eu-kpi {
  height: 100%;
  border: 1px solid #e2e8f0 !important;
  box-shadow: none !important;
  outline: none !important;
  transition: box-shadow 0.15s ease, transform 0.15s ease, background-color 0.15s ease;
}
.fwd-kpi-hit .eu-kpi::before { display: none !important; }
.fwd-kpi-hit:hover .eu-kpi,
.fwd-kpi-hit:focus-visible .eu-kpi {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08) !important;
  border-color: #e2e8f0 !important;
  outline: none !important;
}
.fwd-kpi-hit:active .eu-kpi {
  transform: none;
  background: #ede9fe;
  border-color: #6d28d9 !important;
}

.fwd-row-hit { cursor: pointer; }
.fwd-row-hit:hover { background: #f1f5f9; }
.fwd-row-hit:focus-visible { outline: 2px solid #6d28d9; outline-offset: -2px; }

.fwd-chart__row,
.fwd-chart__col--link,
.fwd-payer-card,
.fwd-ai-item {
  transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
  outline: none;
}
.fwd-chart__row:hover,
.fwd-chart__col--link:hover,
.fwd-payer-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
  border-color: #e2e8f0;
}
.fwd-payer-card:hover { border-color: #e2e8f0; }

/* —— CRM-style receivables grid —— */
.ipb-corporate .eu-results-table,
.ipb-corporate .eu-results-table.eu-card {
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  overflow: visible; /* allow row action menus to paint outside the card */
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.ipb-corporate .eu-table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: min(70vh, 44rem);
}
#ip-billing-corporate-receivables {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}
#ip-billing-corporate-receivables thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #f8fafc;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}
#ip-billing-corporate-receivables tbody td {
  padding: 0.85rem 0.75rem;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.8125rem;
  color: #334155;
  background: #fff;
}
#ip-billing-corporate-receivables tbody tr {
  transition: background-color 0.12s ease;
}
#ip-billing-corporate-receivables tbody tr:hover td {
  background: #f8fafc;
}
#ip-billing-corporate-receivables tbody tr:hover {
  box-shadow: none;
}
#ip-billing-corporate-receivables .eu-table__cell-primary a {
  font-weight: 700;
  color: #1d4ed8;
  text-decoration: none;
}
#ip-billing-corporate-receivables .eu-table__cell-primary a:hover {
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

/* Sticky select (left) + actions (right) */
#ip-billing-corporate-receivables th:nth-child(1),
#ip-billing-corporate-receivables td:nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 6;
  background: #fff;
  width: 2.5rem;
  min-width: 2.5rem;
  box-shadow: 1px 0 0 #e2e8f0;
}
#ip-billing-corporate-receivables thead th:nth-child(1) { background: #f8fafc; z-index: 7; }

#ip-billing-corporate-receivables th:last-child,
#ip-billing-corporate-receivables td:last-child {
  position: sticky;
  right: 0;
  z-index: 6;
  background: #fff;
  width: 3.5rem;
  min-width: 3.5rem;
  text-align: center;
  box-shadow: -2px 0 6px rgba(15, 23, 42, 0.06);
  overflow: visible;
}
#ip-billing-corporate-receivables thead th:last-child { background: #f8fafc; z-index: 7; }
#ip-billing-corporate-receivables tbody tr:hover td:nth-child(1),
#ip-billing-corporate-receivables tbody tr:hover td:last-child { background: #f8fafc; }

.fwd-patient-cell { display: flex; flex-direction: column; gap: 0.1rem; min-width: 9rem; }
.fwd-patient-cell__name {
  font-weight: 700;
  color: #0f172a;
  line-height: 1.25;
}
.fwd-patient-cell__uhid {
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  text-decoration: none;
}
.fwd-patient-cell__uhid:hover { color: #1d4ed8; text-decoration: underline; }

.fwd-payer-chip {
  display: inline-flex;
  max-width: 12rem;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid transparent;
}
.fwd-payer-chip--corporate {
  background: #f5f3ff;
  color: #6d28d9;
  border-color: #ddd6fe;
}
.fwd-payer-chip--insurance {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

/* Actions menu — native <details>, opens left into the row (never clipped by card edge) */
.fwd-action-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.fwd-action-menu > summary {
  list-style: none;
}
.fwd-action-menu > summary::-webkit-details-marker {
  display: none;
}
.fwd-action-menu__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.18rem;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 0.4rem;
  border: 1.5px solid #334155;
  background: #0f172a;
  color: #fff;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}
.fwd-action-menu__trigger:hover,
.fwd-action-menu[open] > .fwd-action-menu__trigger {
  background: #1d4ed8;
  border-color: #1d4ed8;
  transform: translateY(-1px);
}
.fwd-action-menu__dot {
  width: 0.28rem;
  height: 0.28rem;
  border-radius: 999px;
  background: currentColor;
  display: inline-block;
}
.fwd-action-menu__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 5000;
  min-width: 12.5rem;
  padding: 0.3rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  background: #fff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.22);
}
.fwd-action-menu__item {
  display: block;
  padding: 0.5rem 0.7rem;
  border-radius: 0.35rem;
  font-size: 0.8rem;
  font-weight: 650;
  color: #0f172a;
  text-decoration: none;
  white-space: nowrap;
}
.fwd-action-menu__item:hover {
  background: #eff6ff;
  color: #1d4ed8;
}

/* Unclip table chrome while a row menu is open */
.ipb-corporate .eu-results-table:has(.fwd-action-menu[open]),
.ipb-corporate .eu-results-table.eu-card:has(.fwd-action-menu[open]) {
  overflow: visible;
  z-index: 20;
  position: relative;
}
.ipb-corporate .eu-results-table:has(.fwd-action-menu[open]) .eu-table-wrap {
  overflow: visible !important;
  max-height: none;
}
#ip-billing-corporate-receivables tr:has(.fwd-action-menu[open]) {
  position: relative;
  z-index: 25;
}
#ip-billing-corporate-receivables tr:has(.fwd-action-menu[open]) td:last-child {
  z-index: 30;
  overflow: visible;
}

/* Keep sticky actions column roomy enough for the dark trigger */
.fwd-settle-hint { margin-bottom: 0.65rem; }
.fwd-write-off-form .eu-btn--danger,
.eu-btn.eu-btn--danger {
  background: #b91c1c;
  border-color: #b91c1c;
  color: #fff;
}
.eu-btn.eu-btn--danger:hover {
  background: #991b1b;
  border-color: #991b1b;
}

/* Legacy details menu (if any remain) */
.fwd-action-dots {
  position: relative;
  display: inline-block;
}
.fwd-action-dots > summary { list-style: none; }
.fwd-action-dots > summary::-webkit-details-marker { display: none; }
.fwd-action-dots__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 0.4rem;
  border: 1.5px solid #94a3b8;
  background: #0f172a;
  color: #fff;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
}
.fwd-action-dots__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 80;
  min-width: 11.5rem;
  padding: 0.25rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.45rem;
  background: #fff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
}
.fwd-action-dots__item {
  display: block;
  padding: 0.45rem 0.6rem;
  border-radius: 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #334155;
  text-decoration: none;
  white-space: nowrap;
}
.fwd-action-dots__item:hover {
  background: #f1f5f9;
  color: #0f172a;
}
.eu-results-table:has(.fwd-action-dots[open]) .eu-table-wrap,
.ipb-corporate .eu-results-table:has(.fwd-action-menu.is-open),
.ipb-corporate .eu-results-table:has(.fwd-action-menu.is-open) .eu-table-wrap {
  overflow: visible;
}

.fwd-row--age-90_plus { box-shadow: inset 3px 0 0 #ef4444; }
.fwd-row--age-61_90 { box-shadow: inset 3px 0 0 #f97316; }
.fwd-row--age-31_60 { box-shadow: inset 3px 0 0 #3b82f6; }
.fwd-row--age-0_30 { box-shadow: inset 3px 0 0 #22c55e; }

/* Document repository */
.fwd-docs-repo {
  display: grid;
  grid-template-columns: minmax(14rem, 18rem) 1fr;
  gap: 0.65rem;
  min-height: 28rem;
}
@media (max-width: 900px) {
  .fwd-docs-repo { grid-template-columns: 1fr; min-height: 0; }
}
.fwd-docs-repo__list {
  border: 1px solid #e2e8f0;
  border-radius: 0.4rem;
  background: #f8fafc;
  overflow: auto;
  max-height: 36rem;
}
.fwd-docs-repo__list-head {
  padding: 0.45rem 0.65rem;
  font-size: 0.7rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  border-bottom: 1px solid #e2e8f0;
}
.fwd-docs-repo__items {
  list-style: none;
  margin: 0;
  padding: 0.25rem;
}
.fwd-docs-repo__item {
  width: 100%;
  display: grid;
  grid-template-columns: 1.1rem 1fr auto;
  gap: 0.35rem;
  align-items: start;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.4rem 0.45rem;
  border-radius: 0.3rem;
  cursor: pointer;
  color: #334155;
  font-size: 0.78rem;
}
.fwd-docs-repo__item:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
.fwd-docs-repo__item.is-available:hover,
.fwd-docs-repo__item.is-active {
  background: #fff;
  box-shadow: inset 0 0 0 1px #c4b5fd;
}
.fwd-docs-repo__item.is-active {
  background: #f5f3ff;
  font-weight: 650;
}
.fwd-docs-repo__check { color: #64748b; line-height: 1.2; }
.fwd-docs-repo__item.is-available .fwd-docs-repo__check { color: #6d28d9; }
.fwd-docs-repo__name { line-height: 1.25; }
.fwd-docs-repo__status {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #94a3b8;
  white-space: nowrap;
}
.fwd-docs-repo__status--ready { color: #047857; }
.fwd-docs-repo__status--fallback { color: #1d4ed8; }
.fwd-docs-repo__status--missing,
.fwd-docs-repo__status--placeholder { color: #94a3b8; }
.fwd-docs-repo__viewer {
  border: 1px solid #e2e8f0;
  border-radius: 0.4rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  min-height: 28rem;
  overflow: hidden;
}
.fwd-docs-repo__viewer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  font-size: 0.8125rem;
}
.fwd-docs-repo__empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.fwd-docs-repo__frame {
  flex: 1;
  width: 100%;
  min-height: 26rem;
  border: 0;
  background: #fff;
}

/* Collapsed search summary */
.fwd-search {
  border: 1px solid #e2e8f0;
  border-radius: 0.45rem;
  background: #fff;
  margin-bottom: 0.65rem;
}
.fwd-search__summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.5rem 0.7rem;
}
.fwd-search__summary::-webkit-details-marker { display: none; }
.fwd-search__title {
  font-size: 0.7rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}
.fwd-search__chips { font-size: 0.8125rem; font-weight: 650; color: #0f172a; flex: 1; }
.fwd-search__edit { font-size: 0.75rem; }
.fwd-search__body { padding: 0 0.5rem 0.5rem; border-top: 1px solid #f1f5f9; }
.fwd-search__body .eu-search-panel { margin: 0; border: 0; box-shadow: none; }
