/*
 * Part payment, for the member (member-part-payment.js). Every selector is .mpp*.
 *
 * Compact on purpose: the heading carries the way in, the loan is one line of figures,
 * and the two outcomes sit side by side — on a phone as well (the user's rule: two
 * across, never one).
 */

.mpp {
  margin: .75rem 0 .25rem;
  padding: .6rem .8rem .7rem;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  background: linear-gradient(180deg, var(--surface2, #f8fafc) 0%, var(--white, #fff) 100%);
  min-width: 0;
}

.mpp--closed {
  background: var(--white, #fff);
  border-style: dashed;
}

/* Title, where it stands, and the button — one row. */
.mpp__head {
  display: flex;
  align-items: center;
  gap: .3rem .6rem;
  flex-wrap: wrap;
}

.mpp__title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text, #0f1f44);
  min-width: 0;
}

.mpp__state {
  padding: .1rem .45rem;
  border-radius: 999px;
  background: #eef2f9;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted, #64748b);
  white-space: nowrap;
}

.mpp__head .mpp__open {
  margin-left: auto;
  white-space: nowrap;
}

.mpp__reason,
.mpp__hint {
  margin: .25rem 0 0;
  font-size: 12px;
  color: var(--muted, #64748b);
}

/* The loan in three figures. */
.mpp__standing {
  display: flex;
  flex-wrap: wrap;
  gap: .15rem 1rem;
  margin: .4rem 0 0;
  font-size: 12.5px;
  color: var(--text2, #334155);
}

.mpp__fact {
  display: inline-flex;
  align-items: baseline;
  gap: .3rem;
  white-space: nowrap;
}

.mpp__fact-label {
  color: var(--muted, #64748b);
}

.mpp__pending {
  display: grid;
  gap: .15rem;
  margin-top: .45rem;
  padding: .5rem .65rem;
  border-radius: 8px;
  background: #fffaeb;
  border: 1px solid #fde68a;
  font-size: 12.5px;
  color: #92400e;
}

.mpp__pending span {
  font-size: 12px;
  color: #a16207;
}

/* --- the form ---------------------------------------------------------------- */

.mpp__steps {
  display: grid;
  gap: .55rem;
  margin-top: .55rem;
}

.mpp__steps[hidden],
.mpp__step[hidden] {
  display: none;
}

.mpp__step {
  display: grid;
  gap: .35rem;
  padding-top: .55rem;
  border-top: 1px dashed var(--border, #e5e7eb);
  min-width: 0;
}

.mpp__step-title {
  margin: 0;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text, #0f1f44);
}

.mpp__input {
  font: inherit;
  font-size: 13.5px;
  height: 36px;
  padding: 0 .6rem;
  border: 1px solid #d8e1f0;
  border-radius: 8px;
  background: #fff;
  color: #0f1f44;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* The question and the amount on one line. */
.mpp__amount {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem .6rem;
  margin: 0;
}

.mpp__amount .mpp__input {
  flex: 1 1 160px;
  max-width: 220px;
}

/* Amounts worth suggesting for this loan: small pills under the field. */
.mpp__quick {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}

.mpp__chip {
  display: inline-flex;
  align-items: baseline;
  gap: .3rem;
  height: 30px;
  padding: 0 .65rem;
  border: 1px dashed #cdd9ee;
  border-radius: 999px;
  background: #fff;
  font: inherit;
  line-height: 28px;
  white-space: nowrap;
  cursor: pointer;
}

.mpp__chip strong {
  font-size: 12.5px;
  color: #14306b;
}

.mpp__chip span {
  font-size: 11px;
  color: #64748b;
}

.mpp__chip:hover {
  border-style: solid;
  border-color: #2563eb;
  background: #f4f8ff;
}

/* The two outcomes, side by side at every width. */
.mpp__choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .45rem;
}

.mpp__choices > .mpp__hint,
.mpp__choices > .mpp__message {
  grid-column: 1 / -1;
}

.mpp__choice {
  position: relative;
  display: grid;
  align-content: start;
  gap: .1rem;
  min-width: 0;
  text-align: left;
  padding: .45rem .55rem .5rem 1.75rem;
  border: 1px solid #d8e1f0;
  border-radius: 9px;
  background: #fff;
  font: inherit;
  cursor: pointer;
  color: #0f1f44;
}

/* A radio mark: choosing a card is choosing the option. */
.mpp__choice::before {
  content: '';
  position: absolute;
  left: .55rem;
  top: .62rem;
  width: 13px;
  height: 13px;
  border: 2px solid #b8c6de;
  border-radius: 50%;
  background: #fff;
  box-sizing: border-box;
}

.mpp__choice.is-on::before {
  border-color: #2563eb;
  background: radial-gradient(circle, #2563eb 0 3px, #fff 3.5px);
}

.mpp__choice:hover:not(:disabled) {
  border-color: #93c5fd;
}

.mpp__choice.is-on {
  border-color: #2563eb;
  box-shadow: 0 0 0 1px #2563eb inset;
  background: #eef4ff;
}

.mpp__choice:disabled {
  cursor: not-allowed;
  opacity: .6;
}

.mpp__choice-title {
  font-size: 12.5px;
  color: #14306b;
}

.mpp__choice-headline {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  color: #1a2d5a;
}

.mpp__choice-line {
  font-size: 11.5px;
  line-height: 1.35;
  color: #475569;
}

.mpp__choice-save {
  font-size: 11.5px;
  font-weight: 600;
  color: #067647;
}

/* A term shorter than the EMI allows: the larger instalment, said plainly. */
.mpp__choice-warn {
  font-size: 11.5px;
  font-weight: 600;
  color: #8a5a06;
}

/* Finish sooner: over how many months — across both cards, under them. */
.mpp__term {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: .45rem;
  margin: 0;
}

.mpp__term[hidden] {
  display: none;
}

.mpp__term-label {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  white-space: nowrap;
}

.mpp__term .mpp__term-select {
  flex: 1 1 auto;
  max-width: 280px;
}

/* A partial payment, as a row of the schedule after the latest instalment paid. */
#app tr.mpp-row > td {
  background: #f4fbf7;
}

.mpp-row__tag {
  display: inline-block;
  padding: .05rem .45rem;
  border-radius: 999px;
  background: #dcf3e6;
  color: #1f6f4a;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.mpp-row__meta {
  display: block;
  margin-top: .15rem;
  font-size: 11px;
  color: #1f6f4a;
  white-space: nowrap;
}

/*
 * What the partial payment was (shorter loan · UPI · ref …) sits in its Due cell and
 * wraps there, at about a date's width, so neither "#" nor "Due" is stretched by it
 * (2026-10-10: in "#" it pushed every column to the right).
 */
#app tr.mpp-row > td.mpp-row__what {
  white-space: normal;
}

#app tr.mpp-row > td.mpp-row__what .mpp-row__meta {
  margin-top: .2rem;
  min-width: 5.5rem;
  max-width: 9rem;
  white-space: normal;
  line-height: 1.35;
}

/* Spread across the empty Principal, Rate and Interest cells: the tag and what it was,
   on one line. */
#app tr.mpp-row > td.mpp-row__what--span {
  white-space: nowrap;
}

#app tr.mpp-row > td.mpp-row__what--span .mpp-row__meta {
  display: inline;
  margin: 0 0 0 .5rem;
  min-width: 0;
  max-width: none;
  white-space: nowrap;
}

/* The time a partial payment was made, under its day. */
.mpp-row__time {
  display: block;
  font-size: 11px;
  color: var(--muted, #64748b);
}

.mpp-row__paid {
  font-size: 12px;
  font-weight: 600;
  color: #067647;
}

/* On Pay EMI: one block per running loan, under the heading. */
.mpp-list {
  display: grid;
  gap: .5rem;
  margin: 0 0 .75rem;
}

.mpp-list .mpp {
  margin: 0;
}

/* --- paying ------------------------------------------------------------------ */

.mpp__payto {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1rem;
  align-items: flex-start;
  padding: .45rem .6rem;
  border: 1px solid #e5ebf6;
  border-radius: 9px;
  background: #fff;
}

.mpp__payto-lines {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: .15rem .7rem;
  margin: 0;
  font-size: 12px;
  min-width: 0;
}

.mpp__payto-lines dt {
  color: var(--muted, #64748b);
}

.mpp__payto-lines dd {
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.mpp__payto-amount {
  color: #1d4ed8;
}

.mpp__qr {
  width: 104px;
  height: 104px;
  object-fit: contain;
  border: 1px solid #e5ebf6;
  border-radius: 8px;
  background: #fff;
}

/* How and the reference side by side; the proof and the note across. */
.mpp__fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .4rem .6rem;
}

.mpp__field {
  display: grid;
  gap: .15rem;
  margin: 0;
  min-width: 0;
}

.mpp__field--wide {
  grid-column: 1 / -1;
}

.mpp__field input[type="file"] {
  font-size: 12px;
  max-width: 100%;
}

.mpp__field-label {
  font-size: 11.5px;
  font-weight: 600;
  color: #334155;
}

.mpp__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem .75rem;
}

.mpp__next {
  flex: 1 1 220px;
  margin: 0;
  font-size: 11.5px;
  line-height: 1.4;
  color: #64748b;
}

.mpp__message {
  margin: 0;
  font-size: 12px;
  color: #b42318;
}

.mpp__message:empty {
  display: none;
}

.mpp__send {
  white-space: nowrap;
}

@media (max-width: 640px) {
  .mpp {
    padding: .55rem .6rem .6rem;
  }

  .mpp__title {
    font-size: 13.5px;
  }

  .mpp__standing {
    gap: .1rem .75rem;
    font-size: 12px;
  }

  .mpp__amount .mpp__input {
    max-width: none;
  }

  /* Two across on a phone, never one. */
  .mpp__quick {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mpp__chip {
    justify-content: center;
  }

  .mpp__choice {
    padding: .4rem .45rem .45rem 1.55rem;
  }

  .mpp__choice::before {
    left: .45rem;
    top: .55rem;
  }

  .mpp__choice-headline {
    font-size: 13px;
  }

  .mpp__term .mpp__term-select {
    max-width: none;
  }

  .mpp__send {
    flex: 1 1 100%;
  }
}

/* --- Pay EMI: the button by "Complete EMI schedules", the form under it ---------
   (owner, 2026-10-06; member-part-payment.js place()). The card at the top of the
   page keeps the loan's figures. */
.mpp-sched-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem .75rem;
  margin: 0 0 .35rem;
}

.mpp-sched-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-left: auto;
}

.mpp-sched-actions:empty {
  display: none;
}

.mpp-sched-actions .mpp__open {
  white-space: nowrap;
}

/* The form, opened: a panel of its own between the heading and the schedules. */
.mpp-sched-form .mpp__steps:not([hidden]) {
  margin: .25rem 0 .9rem;
  padding: .85rem .95rem;
  border: 1px solid var(--border, #e5ebf6);
  border-radius: 12px;
  background: #fbfcfe;
}

@media (max-width: 600px) {
  .mpp-sched-head .card-title {
    flex: 1 1 auto;
  }

  .mpp-sched-form .mpp__steps:not([hidden]) {
    padding: .7rem .75rem;
  }
}
