.legacy-record-view .patient-account-card {
  --patient-account-ink: #172b46;
  --patient-account-muted: #687990;
  --patient-account-line: #d8e2ee;
  --patient-account-blue: #287de8;
  --patient-account-violet: #6a4be4;
  --patient-account-green: #13b977;
  position: relative;
  display: grid;
  gap: 15px;
  overflow: hidden;
  padding: 18px;
  border: 1px solid #cfdae8;
  border-radius: 12px;
  background:
    radial-gradient(circle at 100% 0, rgba(98, 75, 226, .11), transparent 36%),
    linear-gradient(145deg, #fbfdff 0%, #f5f8fc 58%, #f6f4ff 100%);
  box-shadow: 0 7px 22px rgba(35, 62, 96, .10);
}

.legacy-record-view .patient-account-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--patient-account-blue), var(--patient-account-violet));
  content: "";
}

.legacy-record-view .patient-account-card__topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 2px;
}

.legacy-record-view .patient-account-card__topline > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #61728a;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .11em;
}

.legacy-record-view .patient-account-card__topline > span:first-child .app-icon {
  width: 16px;
  height: 16px;
  color: var(--patient-account-violet);
}

.legacy-record-view .patient-account-card__state {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border: 1px solid #d5e1ed;
  border-radius: 999px;
  color: #65768c;
  background: rgba(255, 255, 255, .78);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.legacy-record-view .patient-account-card__state i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #91a0b2;
  box-shadow: 0 0 0 4px rgba(145, 160, 178, .13);
}

.legacy-record-view .patient-account-card__state[data-state="UP_TO_DATE"] {
  border-color: #bfe9d6;
  color: #08774b;
  background: #eafaf3;
}

.legacy-record-view .patient-account-card__state[data-state="UP_TO_DATE"] i {
  background: #11b875;
  box-shadow: 0 0 0 4px rgba(17, 184, 117, .14);
}

.legacy-record-view .patient-account-card__state[data-state="BALANCE_DUE"] {
  border-color: #f3c9cf;
  color: #aa3144;
  background: #fff0f2;
}

.legacy-record-view .patient-account-card__state[data-state="BALANCE_DUE"] i {
  background: #e0445b;
  box-shadow: 0 0 0 4px rgba(224, 68, 91, .13);
}

.legacy-record-view .patient-account-card__state[data-state="PAYMENT_PENDING"] {
  border-color: #ecdba5;
  color: #8a6310;
  background: #fff8df;
}

.legacy-record-view .patient-account-card__state[data-state="PAYMENT_PENDING"] i {
  background: #dea91f;
  box-shadow: 0 0 0 4px rgba(222, 169, 31, .14);
}

.legacy-record-view .patient-account-card__heading {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.legacy-record-view .patient-account-card__mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(145deg, #273f71, #5c46ce);
  box-shadow: 0 8px 17px rgba(68, 63, 169, .22);
}

.legacy-record-view .patient-account-card__mark .app-icon {
  width: 23px;
  height: 23px;
}

.legacy-record-view .patient-account-card__heading h3 {
  margin: 0;
  color: var(--patient-account-ink);
  font-size: 20px;
  font-weight: 850;
  letter-spacing: -.02em;
}

.legacy-record-view .patient-account-card__heading p {
  margin: 4px 0 0;
  color: var(--patient-account-muted);
  font-size: 12px;
  line-height: 1.45;
}

.legacy-record-view .patient-account-card__summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.legacy-record-view .patient-account-card__summary > section {
  display: grid;
  min-width: 0;
  min-height: 126px;
  align-content: start;
  padding: 14px;
  border: 1px solid var(--patient-account-line);
  border-radius: 11px;
  background: rgba(255, 255, 255, .78);
}

.legacy-record-view .patient-account-card__summary > section > span {
  color: #718197;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.3;
}

.legacy-record-view .patient-account-card__summary strong {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 5px;
  overflow-wrap: anywhere;
  margin-top: 9px;
  color: var(--patient-account-ink);
  font-size: 19px;
  font-weight: 900;
  line-height: 1.15;
}

.legacy-record-view .patient-account-card__balance strong {
  color: #16845b;
  font-size: 25px;
}

.legacy-record-view .patient-account-card__balance strong small {
  color: #4c6c62;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .05em;
}

.legacy-record-view .patient-account-card__summary p {
  margin: 8px 0 0;
  color: #75859a;
  font-size: 12px;
  line-height: 1.4;
}

.legacy-record-view .patient-account-card__pending {
  margin: -3px 0 0;
  padding: 10px 12px;
  border: 1px solid #ead9a6;
  border-radius: 9px;
  color: #795b18;
  background: #fff9e7;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.4;
}

.legacy-record-view .patient-account-card__primary {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 16px;
  border: 0;
  border-radius: 11px;
  color: #082f25;
  background: linear-gradient(105deg, #32d397, #22c887);
  box-shadow: 0 9px 19px rgba(20, 164, 111, .22);
  font-size: 13px;
  font-weight: 950;
  letter-spacing: .035em;
  transition: box-shadow .18s ease, transform .18s ease, filter .18s ease;
}

.legacy-record-view .patient-account-card__primary .app-icon {
  width: 20px;
  height: 20px;
}

.legacy-record-view .patient-account-card__primary:hover {
  filter: saturate(1.08);
  box-shadow: 0 12px 24px rgba(20, 164, 111, .28);
  transform: translateY(-2px);
}

.legacy-record-view .patient-account-card__primary:active {
  box-shadow: 0 5px 12px rgba(20, 164, 111, .20);
  transform: translateY(0);
}

.legacy-record-view .patient-account-card__primary:focus-visible {
  outline: 3px solid rgba(28, 123, 232, .28);
  outline-offset: 3px;
}

.legacy-record-view .patient-account-card__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.legacy-record-view .patient-account-card__actions button {
  display: flex;
  min-height: 45px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 11px;
  border: 1px solid #cfdae7;
  border-radius: 10px;
  color: #53657c;
  background: rgba(255, 255, 255, .82);
  font-size: 12px;
  font-weight: 850;
  transition: border-color .16s ease, color .16s ease, background .16s ease, transform .16s ease;
}

.legacy-record-view .patient-account-card__actions button .app-icon {
  width: 18px;
  height: 18px;
}

.legacy-record-view .patient-account-card__actions button:first-child {
  color: #a8394b;
}

.legacy-record-view .patient-account-card__actions button:last-child {
  color: #5147b6;
}

.legacy-record-view .patient-account-card__actions button:hover {
  border-color: #9eb9da;
  background: #fff;
  transform: translateY(-1px);
}

.legacy-record-view .patient-account-card__actions button:focus-visible {
  outline: 3px solid rgba(40, 125, 232, .22);
  outline-offset: 2px;
}

@media (max-width: 620px) {
  .legacy-record-view .patient-account-card__topline {
    align-items: flex-start;
    flex-direction: column;
  }

  .legacy-record-view .patient-account-card__summary {
    grid-template-columns: 1fr;
  }

  .legacy-record-view .patient-account-card__summary > section {
    min-height: 108px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .legacy-record-view .patient-account-card__primary,
  .legacy-record-view .patient-account-card__actions button {
    transition: none;
  }
}

/* Composición aprobada para la ficha: reemplaza la versión preliminar anterior. */
.legacy-record-view .patient-account-card { --patient-account-ink: #1d2c5c; --patient-account-line: #e2e6ef; display: block; overflow: hidden; padding: 0; border: 1px solid #dce1ee; border-radius: 19px; color: var(--patient-account-ink); background: #fff; box-shadow: 0 15px 32px rgba(42, 55, 112, .13); }
.legacy-record-view .patient-account-card::before { display: none; }
.legacy-record-view .patient-account-card__header { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px 13px; }
.legacy-record-view .patient-account-card__identity { display: grid; min-width: 0; grid-template-columns: 42px minmax(0, 1fr); align-items: center; gap: 11px; }
.legacy-record-view .patient-account-card__mark { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 12px; color: #314bc7; background: #e8ebff; box-shadow: none; }
.legacy-record-view .patient-account-card__mark .app-icon { width: 23px; height: 23px; }
.legacy-record-view .patient-account-card__identity-copy { min-width: 0; }
.legacy-record-view .patient-account-card__identity h3 { overflow-wrap: anywhere; margin: 0; color: var(--patient-account-ink); font-size: 22px; line-height: 1.2; letter-spacing: -.025em; }
.legacy-record-view .patient-account-card__identity-copy p { margin: 3px 0 0; color: #7a8498; font-size: 12px; line-height: 1.25; }
.legacy-record-view .patient-account-card__state { min-height: 29px; padding: 0 10px; border: 1px solid #d8e0ea; color: #68778d; background: #fff; font-size: 12px; font-weight: 900; }
.legacy-record-view .patient-account-card__state i { box-shadow: none; background: currentColor; }
.legacy-record-view .patient-account-card__state[data-state="UP_TO_DATE"] { border-color: #b9e5d0; color: #168653; background: #fff; }
.legacy-record-view .patient-account-card__state[data-state="BALANCE_DUE"] { border-color: #f1c4c9; color: #b13c49; background: #fff; }
.legacy-record-view .patient-account-card__state[data-state="PAYMENT_PENDING"] { border-color: #efcb9a; color: #ce6900; background: #fff; }
.legacy-record-view .patient-account-card__financial-toggle { display: flex; min-width: 0; min-height: 42px; align-items: center; justify-content: space-between; gap: 12px; width: calc(100% - 36px); margin: 10px 18px 0; padding: 7px 12px; border: 1px solid #cad7ef; border-radius: 10px; color: #2c4fb6; background: #f7f9ff; font: inherit; font-size: 12px; font-weight: 900; text-align: left; cursor: pointer; transition: border-color .16s ease, background .16s ease, color .16s ease, transform .16s ease; }
.legacy-record-view .patient-account-card__financial-toggle:hover { border-color: #9cb3e8; background: #f0f4ff; transform: translateY(-1px); }
.legacy-record-view .patient-account-card__financial-toggle:focus-visible { outline: 3px solid rgba(46, 75, 199, .22); outline-offset: 2px; }
.legacy-record-view .patient-account-card__financial-toggle .app-icon { width: 18px; height: 18px; color: #4d64c7; transition: transform .16s ease; }
.legacy-record-view .patient-account-card__financial-details[hidden] { display: none; }
.legacy-record-view .patient-account-card__financial-details { padding-top: 15px; }
.legacy-record-view .patient-account-card__financial-heading { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 10px; padding: 0 18px; }
.legacy-record-view .patient-account-card__financial-heading > strong { color: #6e7890; font-size: 12px; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; }
.legacy-record-view .patient-account-card__overview { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 17px 18px 12px; }
.legacy-record-view .patient-account-card__metric { position: relative; min-width: 0; min-height: 136px; overflow: hidden; padding: 16px; border: 0; border-radius: 15px; color: #fff; background: transparent; }
.legacy-record-view .patient-account-card__metric--received { background: #2361d5; box-shadow: 0 8px 18px rgba(35, 97, 213, .20); }
.legacy-record-view .patient-account-card__metric--due { background: #7544c5; box-shadow: 0 8px 18px rgba(117, 68, 197, .19); }
.legacy-record-view .patient-account-card__metric > span { display: block; color: inherit; font-size: 13px; font-weight: 800; }
.legacy-record-view .patient-account-card__metric strong { display: block; min-width: 0; margin-top: 8px; overflow-wrap: anywhere; color: #fff; font-size: clamp(21px, 2.2vw, 27px); font-weight: 900; line-height: 1.08; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.legacy-record-view .patient-account-card__metric strong small { color: inherit; font-size: 13px; font-weight: 900; letter-spacing: .04em; vertical-align: baseline; }
.legacy-record-view .patient-account-card__metric strong b { font: inherit; }
.legacy-record-view .patient-account-card__metric p { min-height: 34px; margin: 9px 0 0; color: rgba(255, 255, 255, .88); font-size: 12px; line-height: 1.42; }
.legacy-record-view .patient-account-card__metric-art { position: absolute; right: -11px; bottom: -15px; width: 94px; height: 94px; color: #fff; opacity: .22; pointer-events: none; }
.legacy-record-view .patient-account-card__metric-art .app-icon { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.45; }
.legacy-record-view .patient-account-card__metric-art--due { right: -22px; bottom: -22px; width: 96px; height: 96px; }
.legacy-record-view .patient-account-card__metric-art--due .app-icon { stroke-width: 2; }
.legacy-record-view .patient-account-card__activity { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0 18px; }
.legacy-record-view .patient-account-card__activity[data-pending="false"] { grid-template-columns: 1fr; }
.legacy-record-view .patient-account-card__last { min-width: 0; padding: 14px 15px; border: 1px solid #e0e4f0; border-top: 3px solid #3657cd; border-radius: 14px; background: #fbfcff; }
.legacy-record-view .patient-account-card__last > small { display: flex; align-items: center; gap: 7px; color: #3857b4; font-size: 12px; font-weight: 900; letter-spacing: .065em; }
.legacy-record-view .patient-account-card__last > small::before { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: currentColor; content: ""; }
.legacy-record-view .patient-account-card__last strong { display: block; min-width: 0; margin-top: 6px; overflow-wrap: anywhere; color: #26396f; font-size: 20px; font-weight: 900; line-height: 1.14; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.legacy-record-view .patient-account-card__last strong span { font-size: 12px; font-weight: 900; letter-spacing: .04em; vertical-align: baseline; }
.legacy-record-view .patient-account-card__last strong b { font: inherit; }
.legacy-record-view .patient-account-card__last p { margin: 5px 0 0; color: #6d7890; font-size: 13px; line-height: 1.35; }
.legacy-record-view .patient-account-card__review { display: grid; min-width: 0; align-content: center; gap: 6px; padding: 12px 15px 14px; border: 1px solid #e0e4f0; border-top: 3px solid #f07e00; border-radius: 14px; background: #fff; }
.legacy-record-view .patient-account-card__review[hidden] { display: none; }
.legacy-record-view .patient-account-card__review > div { min-width: 0; }
.legacy-record-view .patient-account-card__review small { display: block; color: #d26f00; font-size: 12px; font-weight: 900; letter-spacing: .06em; }
.legacy-record-view .patient-account-card__review strong { display: block; margin-top: 3px; overflow-wrap: anywhere; color: #263750; font-size: 14px; }
.legacy-record-view .patient-account-card__review p { margin: 3px 0 0; color: #68748a; font-size: 12px; line-height: 1.35; }
.legacy-record-view .patient-account-card__review-action { display: inline-flex; width: max-content; max-width: 100%; min-height: 35px; align-items: center; justify-content: center; gap: 7px; padding: 7px 10px; border: 0; border-radius: 9px; color: #fff; background: linear-gradient(135deg, #f07e00, #f69a09 56%, #efa817); box-shadow: 0 5px 11px rgba(242, 137, 0, .23); font: inherit; font-size: 12px; font-weight: 900; cursor: pointer; transition: box-shadow .16s ease, filter .16s ease, transform .16s ease; }
.legacy-record-view .patient-account-card__review-action .app-icon { width: 16px; height: 16px; }
.legacy-record-view .patient-account-card__review-action:hover { box-shadow: 0 7px 15px rgba(242, 137, 0, .31); filter: saturate(1.1) brightness(.96); transform: translateY(-1px); }
.legacy-record-view .patient-account-card__actions { display: grid; grid-template-areas: "primary primary" "debt history"; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 17px 18px 19px; }
.legacy-record-view .patient-account-card__actions > button { display: inline-flex; min-width: 0; min-height: 47px; align-items: center; justify-content: center; gap: 8px; padding: 10px 13px; border-radius: 10px; font: inherit; font-size: 13px; font-weight: 900; cursor: pointer; transition: color .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease, transform .16s ease; }
.legacy-record-view .patient-account-card__actions > button:hover { transform: translateY(-1px); }
.legacy-record-view .patient-account-card__actions > button:active { transform: translateY(1px); transition-duration: .06s; }
.legacy-record-view .patient-account-card__actions > button:focus-visible, .legacy-record-view .patient-account-card__review-action:focus-visible { outline: 3px solid rgba(46, 75, 199, .23); outline-offset: 2px; }
.legacy-record-view .patient-account-card__actions .app-icon { width: 18px; height: 18px; flex: 0 0 auto; }
.legacy-record-view .patient-account-card__actions > button span { min-width: 0; overflow-wrap: anywhere; }
.legacy-record-view .patient-account-card .patient-account-card__actions > .patient-account-card__primary { grid-area: primary; border: 0; color: #fff; background: linear-gradient(135deg, #0b8f58, #16aa6d 54%, #27c17f); box-shadow: 0 7px 15px rgba(18, 156, 99, .24); }
.legacy-record-view .patient-account-card .patient-account-card__actions > .patient-account-card__primary:hover { box-shadow: 0 9px 19px rgba(18, 156, 99, .32); filter: saturate(1.08) brightness(.95); }
.legacy-record-view .patient-account-card .patient-account-card__actions > .patient-account-card__debt { grid-area: debt; border: 1px solid #e6a2a9; color: #bb3f4e; background: #fff; }
.legacy-record-view .patient-account-card .patient-account-card__actions > .patient-account-card__debt:hover { border-color: #dc7d88; color: #a93041; background: #fff; }
.legacy-record-view .patient-account-card .patient-account-card__actions > .patient-account-card__history { grid-area: history; border: 1px solid #9ee1b5; color: #0d7542; background: #e5f9e9; }
.legacy-record-view .patient-account-card .patient-account-card__actions > .patient-account-card__history:hover { border-color: #68cb8d; color: #075e34; background: #d8f6e0; }
@media (max-width: 620px) { .legacy-record-view .patient-account-card__header { align-items: flex-start; flex-direction: column; } .legacy-record-view .patient-account-card__financial-heading { align-items: flex-start; flex-direction: column; } .legacy-record-view .patient-account-card__overview, .legacy-record-view .patient-account-card__activity { grid-template-columns: 1fr; } .legacy-record-view .patient-account-card__activity[data-pending="false"] { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .legacy-record-view .patient-account-card__review-action, .legacy-record-view .patient-account-card__actions > button { transition: none; } }
