/* ==========================================================================
   Payment History — compact mobile-first (matches charges page)
   ========================================================================== */

.pay-hist-page {
  --ph-navy: #0F172A;
  --ph-gold: #C8A968;
  --ph-bg: #F7F9FC;
  --ph-white: #FFFFFF;
  --ph-border: #E6ECF2;
  --ph-text: #0F172A;
  --ph-muted: #64748B;
  --ph-light: #94A3B8;
  --ph-page-pad: 16px;
  --ph-radius: 16px;
  --ph-radius-sm: 12px;
  --ph-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
  --ph-transition: 250ms ease;

  position: relative;
  min-height: 100%;
  padding: 0 var(--ph-page-pad) var(--ph-page-pad);
  padding-bottom: calc(var(--ph-page-pad) + 8px);
  --pd-pad: var(--ph-page-pad);
  --pd-bg: var(--ph-bg);
  --pd-primary: var(--ph-navy);
  --pd-gold: var(--ph-gold);
  --pd-muted: var(--ph-muted);
  --pd-border: var(--ph-border);
  --pd-card: var(--ph-white);
  --pd-fs-2xs: 10px;
  --pd-fs-xs: 11px;
  --pd-fs-lg: 15px;
  --pd-fs-xl: 17px;
  --pd-r-sm: 12px;
  --pd-r-md: 16px;
  --pd-shadow: var(--ph-shadow);
  --pd-transition: var(--ph-transition);
  --pd-touch: 40px;
  background: var(--ph-bg);
  font-family: Vazirmatn, inherit;
  color: var(--ph-text);
  max-width: 720px;
  margin: 0 auto;
  box-sizing: border-box;
}

/* ---------- Layout integration ---------- */
.layout--pay-hist {
  min-height: 100vh;
  min-height: 100dvh;
}

.layout--pay-hist .main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

.layout--pay-hist .topbar {
  display: none !important;
}

.layout--pay-hist .pay-hist-page > .pd-header,
.layout--pay-tx .pay-hist-page > .pd-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 100vw;
  z-index: 90;
  margin: 0;
  padding: calc(10px + env(safe-area-inset-top, 0)) var(--ph-page-pad) 8px;
  background: var(--ph-bg, #f7f9fc);
  border-bottom: 1px solid var(--ph-border, #e6ecf2);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  box-sizing: border-box;
}

@media (min-width: 721px) {
  .vp-desktop .layout--pay-hist .pay-hist-page > .pd-header,
  .vp-desktop .layout--pay-tx .pay-hist-page > .pd-header {
    width: auto;
    inset-inline-start: 272px;
    inset-inline-end: 0;
  }
}

.pay-hist-page__body {
  padding-top: calc(58px + env(safe-area-inset-top, 0));
}

.pay-hist-page .pd-header__start {
  flex: 1;
  min-width: 0;
}

.pay-hist-page .pd-header__title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.pay-hist-page .pd-header__date {
  flex-shrink: 0;
  max-width: 46%;
  font-size: 9px;
  padding: 5px 7px;
  line-height: 1.35;
}

.layout--pay-tx .topbar {
  display: none !important;
}

.content.pay-hist-content-host {
  background: var(--ph-bg, #F7F9FC);
  padding: 0 !important;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.vp-mobile .layout--pay-hist .content.pay-hist-content-host {
  padding-bottom: calc(80px + env(safe-area-inset-bottom, 0)) !important;
}

/* ---------- Page header ---------- */
.pay-hist-top {
  margin-bottom: 14px;
}

.pay-hist-top__back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 0 10px;
  padding: 0;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--ph-gold);
  text-decoration: none;
  cursor: pointer;
}

.pay-hist-top__back:hover {
  text-decoration: underline;
}

.pay-hist-top__title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--ph-navy);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.pay-hist-top__hint {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--ph-muted);
  line-height: 1.45;
}

/* ---------- Unit strip ---------- */
.pay-hist-unit-bar {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 10px 12px;
  margin-bottom: 10px;
  border-radius: var(--ph-radius-sm);
  background: var(--ph-white);
  border: 1px solid rgba(210, 220, 235, 0.55);
  box-shadow: var(--ph-shadow);
}

.pay-hist-unit-bar .charge-unit-compact {
  font-size: 12px;
  gap: 4px 6px;
}

.pay-hist-unit-bar .charge-unit-compact__floor {
  font-size: 11px;
}

/* ---------- Summary stats ---------- */
.pay-hist-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.pay-hist-stats__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 58px;
  padding: 8px 10px;
  border-radius: var(--ph-radius-sm);
  background: var(--ph-white);
  border: 1px solid rgba(210, 220, 235, 0.55);
  box-shadow: var(--ph-shadow);
  text-align: center;
}

.pay-hist-stats__label {
  font-size: 10px;
  font-weight: 500;
  color: var(--ph-muted);
  line-height: 1.2;
}

.pay-hist-stats__value {
  font-size: 15px;
  font-weight: 800;
  color: var(--ph-navy);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.pay-hist-stats__item--total .pay-hist-stats__value {
  font-size: 13px;
}

/* ---------- Payment list ---------- */
.pay-hist-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pay-hist-page .empty {
  padding: 28px 12px;
  font-size: 13px;
  border-radius: var(--ph-radius-sm);
  background: var(--ph-white);
  border: 1px dashed var(--ph-border);
}

/* ---------- Payment card ---------- */
.pay-hist-card {
  background: var(--ph-white);
  border: 1px solid var(--ph-border);
  border-radius: var(--ph-radius);
  box-shadow: var(--ph-shadow);
  overflow: hidden;
  transition: box-shadow var(--ph-transition);
}

.pay-hist-card.is-open {
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

.pay-hist-card__toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border: none;
  background: transparent;
  text-align: start;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.pay-hist-card__toggle-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pay-hist-card__amount {
  font-size: 15px;
  font-weight: 800;
  color: var(--ph-navy);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.pay-hist-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.pay-hist-card__method {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: #FFF7E8;
  color: #B8943F;
  font-size: 10px;
  font-weight: 600;
}

.pay-hist-card__date {
  font-size: 11px;
  color: var(--ph-muted);
  white-space: nowrap;
}

.pay-hist-card__chevron {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--ph-bg);
  color: var(--ph-muted);
  transition: transform var(--ph-transition), background var(--ph-transition);
}

.pay-hist-card.is-open .pay-hist-card__chevron {
  transform: rotate(180deg);
  background: rgba(200, 169, 104, 0.12);
  color: var(--ph-gold);
}

.pay-hist-card__body {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.35s ease, opacity var(--ph-transition);
  border-top: 1px solid transparent;
}

.pay-hist-card__body.is-visible {
  max-height: 1200px;
  opacity: 1;
  border-top-color: var(--ph-border);
}

.pay-hist-card__body-inner {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pay-hist-card__rows {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.pay-hist-card__row {
  display: grid;
  grid-template-columns: minmax(72px, 34%) 1fr;
  gap: 6px 8px;
  align-items: start;
  font-size: 11px;
  line-height: 1.4;
}

.pay-hist-card__row dt {
  margin: 0;
  color: var(--ph-muted);
  font-weight: 500;
}

.pay-hist-card__row dd {
  margin: 0;
  color: var(--ph-text);
  word-break: break-word;
}

/* ---------- Receipt ---------- */
.pay-hist-card__receipt {
  padding-top: 2px;
}

.pay-hist-card__receipt-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--ph-muted);
  margin-bottom: 6px;
}

.pay-hist-card__receipt-img-wrap {
  display: block;
  margin-bottom: 6px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--ph-border);
  background: var(--ph-bg);
}

.pay-hist-card__receipt-img-wrap img {
  display: block;
  width: 100%;
  max-height: 140px;
  object-fit: contain;
}

.pay-hist-card__receipt--empty {
  font-size: 11px;
  color: var(--ph-light);
  font-style: italic;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--ph-bg);
  text-align: center;
}

.pay-hist-card__receipt .btn.sm {
  min-height: 32px;
  padding: 0 12px;
  font-size: 11px;
  border-radius: 10px;
}

/* ---------- Footer actions ---------- */
.pay-hist-card__foot {
  display: flex;
  justify-content: flex-end;
  padding-top: 2px;
}

.pay-hist-card__foot .btn.sm.danger {
  min-height: 34px;
  padding: 0 14px;
  font-size: 11px;
  border-radius: 10px;
  font-family: Vazirmatn, inherit;
}

/* ---------- Responsive ---------- */
@media (max-width: 380px) {
  .pay-hist-stats__item--total .pay-hist-stats__value {
    font-size: 12px;
  }

  .pay-hist-card__row {
    grid-template-columns: 1fr;
    gap: 1px;
  }
}

.layout--pay-tx .main {
  background: #f7f9fc;
}

.pay-tx-page .pay-hist-card__method.badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
}

.pay-tx-card--rejected {
  border-color: rgba(220, 38, 38, 0.14);
}

/* ---------- Manager payments list (all units) ---------- */
.payments-mgr-page {
  --pm-navy: #0F172A;
  --pm-gold: #C8A968;
  --pm-gold-light: rgba(200, 169, 104, 0.14);
  --pm-gold-soft: #FFF7E8;
  --pm-bg: #F7F9FC;
  --pm-white: #FFFFFF;
  --pm-border: #E6ECF2;
  --pm-muted: #64748B;
  --pm-light: #94A3B8;
  --pm-success: #16A34A;
  --pm-danger: #DC2626;
  --pm-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  --pm-shadow-hover: 0 12px 32px rgba(15, 23, 42, 0.09);
  --pm-radius: 16px;
  --pm-radius-sm: 12px;
  --pm-transition: 220ms ease;
  max-width: 720px;
}

.payments-mgr-head {
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid transparent;
  border-image: linear-gradient(90deg, var(--pm-gold) 0%, transparent 72%) 1;
}

.payments-mgr-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: var(--pm-navy);
  letter-spacing: -0.03em;
  line-height: 1.25;
}

/* Summary stats */
.payments-mgr-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.payments-mgr-stat {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 76px;
  padding: 12px 14px 12px 12px;
  border-radius: var(--pm-radius);
  background: linear-gradient(145deg, var(--pm-white) 0%, #FAFBFE 100%);
  border: 1px solid rgba(210, 220, 235, 0.7);
  box-shadow: var(--pm-shadow);
  overflow: hidden;
}

.payments-mgr-stat::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: var(--pm-gold);
  opacity: 0.55;
}

.payments-mgr-stat--total::before {
  background: linear-gradient(180deg, #22C55E 0%, #16A34A 100%);
  opacity: 0.85;
}

.payments-mgr-stat__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--pm-gold-light);
  color: #A68B4B;
  margin-bottom: 2px;
}

.payments-mgr-stat--total .payments-mgr-stat__icon {
  background: rgba(22, 163, 74, 0.1);
  color: var(--pm-success);
}

.payments-mgr-stat__label {
  font-size: 11px;
  font-weight: 500;
  color: var(--pm-muted);
  line-height: 1.3;
}

.payments-mgr-stat__value {
  font-size: 17px;
  font-weight: 800;
  color: var(--pm-navy);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.payments-mgr-stat--total .payments-mgr-stat__value {
  font-size: 14px;
}

/* List */
.payments-mgr-list {
  gap: 12px;
}

.payments-mgr-list .empty {
  padding: 32px 16px;
  font-size: 13px;
  border-radius: var(--pm-radius);
  background: var(--pm-white);
  border: 1px dashed var(--pm-border);
  text-align: center;
  color: var(--pm-muted);
}

/* Payment card */
.payments-mgr-card {
  position: relative;
  border-radius: var(--pm-radius);
  border: 1px solid rgba(210, 220, 235, 0.65);
  box-shadow: var(--pm-shadow);
  overflow: hidden;
  transition: box-shadow var(--pm-transition), transform var(--pm-transition);
}

.payments-mgr-card:hover {
  box-shadow: var(--pm-shadow-hover);
}

.payments-mgr-card.is-open {
  box-shadow: var(--pm-shadow-hover);
  border-color: rgba(200, 169, 104, 0.35);
}

.payments-mgr-card__toggle {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 14px 14px 14px 12px;
  border: none;
  background: linear-gradient(180deg, var(--pm-white) 0%, #FAFCFF 100%);
  text-align: start;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.payments-mgr-card__accent {
  position: absolute;
  inset-inline-start: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, var(--pm-gold) 0%, #E8D5A8 100%);
}

.payments-mgr-card__icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  margin-top: 1px;
  border-radius: 11px;
  background: var(--pm-gold-light);
  color: #A68B4B;
}

.payments-mgr-card__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.payments-mgr-card__amount {
  font-size: 17px;
  font-weight: 800;
  color: var(--pm-navy);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.payments-mgr-card__unit {
  font-size: 12px;
  font-weight: 600;
  color: var(--pm-muted);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.payments-mgr-card__chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.payments-mgr-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
}

.payments-mgr-chip--method {
  background: var(--pm-gold-soft);
  color: #9A7B3A;
}

.payments-mgr-chip--date {
  background: rgba(15, 23, 42, 0.05);
  color: var(--pm-muted);
}

.payments-mgr-chip__ico {
  flex-shrink: 0;
  opacity: 0.75;
}

.payments-mgr-card__chevron {
  flex-shrink: 0;
  margin-top: 6px;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--pm-bg);
  color: var(--pm-muted);
  transition: transform var(--pm-transition), background var(--pm-transition), color var(--pm-transition);
}

.payments-mgr-card.is-open .payments-mgr-card__chevron {
  transform: rotate(180deg);
  background: var(--pm-gold-light);
  color: #A68B4B;
}

/* Expanded body */
.payments-mgr-card__inner {
  padding: 0 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.payments-mgr-detail {
  margin: 0;
  padding: 10px 12px;
  display: grid;
  gap: 0;
  border-radius: var(--pm-radius-sm);
  background: var(--pm-bg);
  border: 1px solid rgba(230, 236, 242, 0.9);
}

.payments-mgr-detail__row {
  display: grid;
  grid-template-columns: minmax(76px, 38%) 1fr;
  gap: 6px 10px;
  align-items: start;
  padding: 7px 0;
  font-size: 11px;
  line-height: 1.45;
  border-bottom: 1px solid rgba(230, 236, 242, 0.85);
}

.payments-mgr-detail__row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.payments-mgr-detail__row:first-child {
  padding-top: 0;
}

.payments-mgr-detail__row dt {
  margin: 0;
  color: var(--pm-muted);
  font-weight: 500;
}

.payments-mgr-detail__row dd {
  margin: 0;
  color: var(--pm-navy);
  font-weight: 600;
  word-break: break-word;
}

/* Receipt */
.payments-mgr-receipt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--pm-radius-sm);
  background: var(--pm-white);
  border: 1px solid var(--pm-border);
}

.payments-mgr-receipt--empty {
  justify-content: center;
  background: var(--pm-bg);
  border-style: dashed;
  color: var(--pm-light);
  font-size: 11px;
  font-style: normal;
}

.payments-mgr-receipt__icon {
  flex-shrink: 0;
  color: var(--pm-muted);
  opacity: 0.7;
}

.payments-mgr-receipt--empty .payments-mgr-receipt__icon {
  opacity: 0.45;
}

.payments-mgr-receipt__btn {
  flex: 1;
  min-height: 34px;
  border-radius: 10px;
  font-size: 11px;
}

/* Footer */
.payments-mgr-card__foot {
  display: flex;
  justify-content: flex-end;
  padding-top: 2px;
}

.payments-mgr-card__del {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(220, 38, 38, 0.2);
  border-radius: 10px;
  background: rgba(220, 38, 38, 0.06);
  color: var(--pm-danger);
  font-family: Vazirmatn, inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--pm-transition), border-color var(--pm-transition);
}

.payments-mgr-card__del:hover {
  background: rgba(220, 38, 38, 0.1);
  border-color: rgba(220, 38, 38, 0.35);
}

.payments-mgr-card__del:active {
  transform: scale(0.98);
}

.content.payments-mgr-content {
  background: var(--pm-bg, #F7F9FC);
}

.vp-mobile .content.payments-mgr-content {
  padding-inline: 12px !important;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0)) !important;
}

@media (max-width: 380px) {
  .payments-mgr-stat--total .payments-mgr-stat__value {
    font-size: 12px;
  }

  .payments-mgr-detail__row {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .payments-mgr-card__amount {
    font-size: 16px;
  }
}

@media (min-width: 721px) {
  .payments-mgr-page {
    margin: 0 auto;
  }

  .payments-mgr-head h2 {
    font-size: 22px;
  }

  .payments-mgr-list {
    gap: 14px;
  }
}
