/* Loan calculation page styles, payment plan visuals and loan-only responsive rules live here. */
.loan-money-input-wrap {
  position: relative;
  min-width: 0;
}

.loan-money-prefix {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  font-weight: 800;
  z-index: 2;
  pointer-events: none;
}

.loan-money-input {
  padding-left: 40px;
}

.loan-summary-shell {
  display: grid;
  gap: 1rem;
  min-width: 0;
  max-width: 100%;
}

.loan-summary-hero {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 1rem;
  padding: 1.2rem;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.95) 0%, rgba(248,250,252,0.98) 100%);
}

.loan-summary-hero-value {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  line-height: 1.1;
  font-weight: 800;
  margin: 0.25rem 0 0.5rem;
}

.loan-rate-box {
  min-width: 220px;
  padding: 1rem 1.1rem;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.04);
}

.loan-rate-box strong {
  display: block;
  font-size: 1.35rem;
  margin-top: 0.15rem;
}

.loan-chart-card,
.loan-schedule-card {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 20px;
  padding: 1.1rem;
  background: rgba(255,255,255,0.92);
}

.loan-stack-chart {
  display: flex;
  width: 100%;
  height: 16px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.06);
  margin-top: 0.5rem;
}

.loan-stack-segment.principal { background: #2563eb; }
.loan-stack-segment.interest { background: #7c3aed; }
.loan-stack-segment.tax { background: #f59e0b; }

.loan-chart-legend {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
  font-size: 0.95rem;
}

.loan-chart-legend div {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.loan-table th,
.loan-table td {
  white-space: nowrap;
  font-size: 0.95rem;
}

.loan-details-toggle {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 18px;
  background: #fff;
  padding: 0.85rem 1rem;
}

.loan-details-toggle > summary {
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}

.loan-details-toggle > summary::-webkit-details-marker {
  display: none;
}

.loan-details-toggle > summary::after {
  content: "+";
  float: right;
  font-size: 1.1rem;
}

.loan-details-toggle[open] > summary::after {
  content: "−";
}

.loan-schedule-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
}

.loan-schedule-item + .loan-schedule-item {
  margin-top: 12px;
}

.loan-schedule-item summary {
  list-style: none;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  font-weight: 700;
  cursor: pointer;
}

.loan-schedule-item summary::after {
  content: "+";
  width: 20px;
  height: 20px;
  min-width: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #64748b;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  transition: all .22s ease;
  justify-self: end;
}

.loan-schedule-item[open] summary::after {
  content: "−";
  color: #4338ca;
  border-color: #c7d2fe;
  background: #eef2ff;
}

.loan-schedule-item summary::-webkit-details-marker {
  display: none;
}

.loan-schedule-item summary span {
  color: #0f172a;
  white-space: nowrap;
}

.loan-schedule-item summary strong {
  color: #4338ca;
  justify-self: start;
  white-space: nowrap;
}

.loan-schedule-item-body {
  padding: 0 18px 18px;
  display: grid;
  gap: 0;
  border-top: 1px solid #eef2f7;
}

.loan-schedule-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
}

.loan-schedule-stat span {
  color: #64748b;
  font-size: .94rem;
}

.loan-schedule-stat strong {
  color: #0f172a;
  font-size: 1rem;
}

.loan-schedule-table-wrap,
.loan-summary-shell .loan-schedule-table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.loan-summary-shell .loan-details-toggle,
.loan-summary-shell .loan-schedule-card,
.loan-summary-shell .loan-schedule-table-wrap {
  min-width: 0;
  max-width: 100%;
}

.loan-summary-shell .loan-table {
  table-layout: auto;
}

.loan-summary-shell .loan-schedule-table-wrap .loan-table {
  width: max-content;
  min-width: 760px;
  margin-bottom: 0;
}

.loan-schedule-table-wrap::-webkit-scrollbar,
.loan-summary-shell .loan-schedule-table-wrap::-webkit-scrollbar {
  height: 6px;
}

.loan-schedule-table-wrap::-webkit-scrollbar-track,
.loan-summary-shell .loan-schedule-table-wrap::-webkit-scrollbar-track {
  background: transparent;
}

.loan-schedule-table-wrap::-webkit-scrollbar-thumb,
.loan-summary-shell .loan-schedule-table-wrap::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

.loan-schedule-table-wrap::-webkit-scrollbar-thumb:hover,
.loan-summary-shell .loan-schedule-table-wrap::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

@media (max-width: 991.98px) {
  .loan-summary-hero {
    flex-direction: column;
  }

  .loan-rate-box {
    min-width: 100%;
  }

  .loan-chart-legend {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767.98px) {
  .loan-schedule-table-wrap {
    display: none;
  }

  .loan-schedule-mobile-list {
    display: grid;
    gap: 0;
  }

  .loan-schedule-mobile-empty {
    padding: 14px 0;
  }

  .loan-schedule-mobile-card {
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 14px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .04);
  }

  .loan-schedule-mobile-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eef2f7;
  }

  .loan-schedule-mobile-head strong:last-child,
  .loan-schedule-mobile-head span {
    color: var(--primary-dark);
    font-weight: 800;
  }

  .loan-schedule-mobile-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .loan-schedule-mobile-grid div {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .loan-schedule-mobile-grid div.full {
    grid-column: 1 / -1;
  }

  .loan-schedule-mobile-grid small {
    color: var(--muted);
    font-size: .78rem;
  }

  .loan-schedule-mobile-grid strong {
    font-size: .98rem;
    letter-spacing: -.02em;
  }
}

@media (min-width: 768px) {
  .loan-schedule-mobile-list {
    display: none;
  }
}

@media (max-width: 575.98px) {
  .loan-schedule-mobile-grid {
    grid-template-columns: 1fr;
  }
}

.loan-chart-legend{
  grid-template-columns:1fr;
}

.loan-chart-legend > div{
  display:grid;
  grid-template-columns:18px 110px minmax(0,1fr);
  align-items:start;
  gap:10px;
  min-width:0;
}

.loan-chart-legend strong{
  display:block;
  min-width:0;
  max-width:100%;
  overflow-wrap:anywhere;
  line-height:1.25;
}

.loan-chart-legend .legend-dot{
  align-self:start;
  margin-top:.38em;
}

@media (max-width:480px){
  .loan-chart-legend > div{
    grid-template-columns:18px 90px minmax(0,1fr);
    gap:8px;
  }
}

@media (max-width: 767.98px) {
  .loan-schedule-item summary {
    grid-template-columns: minmax(0, 1fr) 20px;
    align-items: center;
  }

  .loan-schedule-item summary span {
    min-width: 0;
    white-space: normal;
  }

  .loan-schedule-item-body {
    padding: 0 16px 16px;
  }

  .loan-schedule-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding-top: 14px;
  }

  .loan-schedule-value-card {
    padding: 12px 14px;
    border-radius: 18px;
    min-width: 0;
  }

  .loan-schedule-value-card--full {
    grid-column: 1 / -1;
  }

  .loan-schedule-value-card small {
    margin-bottom: 5px;
    line-height: 1.3;
  }

  .loan-schedule-value-card strong {
    display: block;
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    line-height: 1.24;
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .loan-schedule-card-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

.loan-rate-box strong
{
   min-width:0;
   max-width:100%;
   overflow-wrap:anywhere;
}