
      .section-head {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 16px;
        margin-top: 22px;
        padding-bottom: 8px;
        border-bottom: 1px solid #dee2e6;
      }
      .section-head h2.sec {
        margin: 0;
        padding-bottom: 0;
        border-bottom: 0;
      }
      .loan-head-controls {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 12px;
        min-width: 0;
      }
      .loan-head-controls .f {
        display: flex;
        align-items: center;
        gap: 6px;
      }
      .loan-head-controls label {
        color: var(--tx2);
        font-size: 12px;
      }
      .loan-head-controls select {
        width: 320px;
        max-width: 55vw;
        padding: 6px 10px;
        border: 1px solid #ced4da;
        border-radius: 4px;
        background: #fff;
        color: var(--tx);
        font-size: 13px;
        font-family: inherit;
      }
      .ck {
        display: inline-block;
        width: 15px;
        height: 15px;
        line-height: 15px;
        margin-right: 4px;
        border-radius: 50%;
        background: #2e9e5b;
        color: #fff;
        font-size: 10px;
        font-weight: 700;
        text-align: center;
        vertical-align: middle;
      }
      .sched tr.next td {
        box-shadow: none;
      }
      .sched tr.next td:first-child {
        box-shadow: inset 3px 0 0 #f0b400;
      }
      .sched tbody tr {
        cursor: pointer;
      }
      .sched tbody tr:hover td {
        background: #f1f5fb;
      }
      .sched tbody tr.selected td {
        background: #dce8fa;
        color: var(--tx);
        text-decoration: none;
      }
      .sched tbody tr.selected td:first-child {
        box-shadow: inset 3px 0 0 var(--c1);
      }
      .loan {
        margin-top: var(--gap);
      }
      .loan .title {
        font-size: 15px;
        font-weight: 700;
        margin-bottom: 10px;
        display: flex;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 6px;
      }
      .loan > summary.title {
        position: relative;
        margin: 0 0 10px;
        padding-right: 22px;
        color: var(--tx);
        list-style: none;
      }
      .loan > summary.title::-webkit-details-marker {
        display: none;
      }
      .loan > summary.title::after {
        content: "";
        position: absolute;
        top: 5px;
        right: 4px;
        width: 8px;
        height: 8px;
        border-right: 2px solid var(--tx2);
        border-bottom: 2px solid var(--tx2);
        transform: rotate(45deg);
        transition: transform 0.15s;
      }
      .loan[open] > summary.title::after {
        top: 8px;
        transform: rotate(225deg);
      }
      .tag {
        font-size: 11px;
        font-weight: 600;
        padding: 2px 8px;
        border-radius: 10px;
        background: #e7f0ff;
        color: #2a5db0;
      }
      .grid2 {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0;
      }
      .loan .grid2 tr.sub td {
        text-align: left;
      }
      .grid2 > * {
        min-width: 0;
      }
      /* loan detail tables: let long values wrap instead of forcing sideways scroll */
      .loan .grid2 td {
        white-space: normal;
        overflow-wrap: anywhere;
      }
      .loan .grid2 td:first-child {
        text-align: left;
      }
      .loan .grid2 td:last-child {
        text-align: right;
      }
      .foot {
        font-size: 12px;
        color: var(--tx2);
        margin-top: 8px;
      }
      .sched {
        max-height: 360px;
        overflow: auto;
        margin-top: 8px;
        border: 1px solid #eee;
        border-radius: 6px;
      }
      .sched th {
        position: sticky;
        top: 0;
        background: #fff;
      }
      .pill {
        display: inline-block;
        font-size: 10px;
        font-weight: 700;
        padding: 1px 7px;
        border-radius: 9px;
      }
      .pill.p {
        background: #e6f4ea;
        color: #1e7e34;
      }
      .pill.u {
        background: #eef1f5;
        color: #6c757d;
      }
      .pill.n {
        background: #ffe8a3;
        color: #7a5b00;
      }
      @media (max-width: 768px){
        .grid2 {
          grid-template-columns: 1fr;
          gap: 0;
        }
        .loan .grid2 > div > table {
          margin-top: 0;
        }
        .loan .grid2 > div > table thead th {
          background: #f1f3f5;
          color: #343a40;
          border-top: 2px solid #adb5bd;
        }
        .loan .title > span {
          min-width: 0;
          overflow-wrap: anywhere;
        }
        .loan .title {
          flex-direction: column;
        }
        .loan .tag {
          align-self: flex-start;
          white-space: normal;
        }
        /* schedule: all columns kept, scrolls sideways inside its own box */
        .sched {
          overflow-x: auto;
          -webkit-overflow-scrolling: touch;
        }
        .sched table {
          min-width: 780px;
          font-size: 12px;
        }
        .sched th,
        .sched td {
          padding: 7px 9px;
          white-space: nowrap;
        }
        .sched th {
          font-size: 10px;
          letter-spacing: 0.2px;
        }}

      @media print{
        .sched {
          max-height: none;
        }}
