/* Deal Sheets page */
.ds-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}
.ds-units {
    padding: 0.75rem;
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}
.ds-units .form-input {
    width: 100%;
    margin-bottom: 0.5rem;
}
.ds-unit {
    display: block;
    width: 100%;
    text-align: left;
    border: 1px solid transparent;
    background: none;
    border-radius: 10px;
    padding: 0.55rem 0.7rem;
    cursor: pointer;
    color: inherit;
}
.ds-unit:hover {
    background: var(--ds-bg-page, #f1f5f9);
}
.ds-unit.active {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.35);
}
.ds-unit-name {
    display: block;
    font-size: 0.86rem;
}
.ds-unit-meta {
    display: block;
    font-size: 0.72rem;
    color: var(--ds-text-muted, #64748b);
    text-transform: capitalize;
}
.ds-sheet {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-width: 0;
}
.ds-head {
    padding: 1.1rem 1.25rem;
}
.ds-title {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}
.ds-title h2 {
    margin: 0 0 0.25rem;
    font-size: 1.3rem;
}
.ds-kpis {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}
.ds-kpi {
    background: var(--ds-bg-page, #f8fafc);
    border: 1px solid var(--ds-border, #e2e8f0);
    border-radius: 12px;
    padding: 0.7rem 0.85rem;
}
.ds-kpi-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ds-text-muted, #64748b);
}
.ds-kpi-value {
    font-weight: 700;
    font-size: 1.05rem;
}
.ds-kpi-sub {
    font-size: 0.72rem;
    color: var(--ds-text-muted, #64748b);
}
.ds-grid2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
.ds-table {
    font-size: 0.83rem;
    margin: 0;
}
.ds-num {
    white-space: nowrap;
    text-align: right;
}
.ds-note {
    font-size: 0.76rem;
    color: var(--ds-text-muted, #64748b);
    max-width: 360px;
}
.ds-bal {
    font-weight: 700;
    white-space: nowrap;
}
.ds-bal-pos {
    color: #16a34a;
}
.ds-bal-neg {
    color: #dc2626;
}
.ds-bal-zero {
    color: var(--ds-text-muted, #64748b);
    font-weight: 500;
}
.ds-settle {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.85rem;
}
.ds-settle-item {
    background: #fef3c7;
    color: #92400e;
    border-radius: 999px;
    padding: 0.35rem 0.8rem;
    font-size: 0.82rem;
}
.ds-settle-item.ok {
    background: #dcfce7;
    color: #166534;
}
.ds-footnote {
    font-size: 0.76rem;
    color: var(--ds-text-muted, #64748b);
    margin-top: 0.75rem;
}
.ds-chip {
    display: inline-block;
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: capitalize;
    white-space: nowrap;
}
.ds-chip.paid {
    background: #dcfce7;
    color: #166534;
}
.ds-chip.open {
    background: #e0e7ff;
    color: #3730a3;
}
.ds-chip.overdue {
    background: #fee2e2;
    color: #991b1b;
}
.ds-row-paid td {
    color: var(--ds-text-muted, #64748b);
}
.ds-tabs {
    display: flex;
    gap: 0.25rem;
    padding: 0.75rem 1rem 0;
    border-bottom: 1px solid var(--ds-border, #e2e8f0);
}
.ds-tab {
    border: none;
    background: none;
    padding: 0.6rem 0.9rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: var(--ds-text-muted, #64748b);
    font-weight: 600;
}
.ds-tab.active {
    color: var(--ds-primary, #6366f1);
    border-bottom-color: var(--ds-primary, #6366f1);
}
.ds-exp-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.5rem;
    margin-top: 0.85rem;
}
/* Partner statement modal */
.ps-chev {
    transition: transform 0.15s;
    color: var(--ds-text-muted, #64748b);
    font-size: 0.75rem;
}
.ps-detail {
    background: var(--ds-bg-page, #f8fafc);
    padding: 0.75rem 1rem !important;
}
.ps-detail-head {
    font-size: 0.8rem;
    color: var(--ds-text-muted, #64748b);
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.ps-sub {
    font-weight: 600;
    font-size: 0.82rem;
    margin: 0.6rem 0 0.3rem;
}
.ps-total td {
    font-weight: 700;
    border-top: 2px solid var(--ds-border, #e2e8f0);
}
.ps-defs {
    margin-top: 0.75rem;
    font-size: 0.8rem;
    background: #eef2ff;
    border-radius: 10px;
    padding: 0.5rem 0.85rem;
}
.ps-defs summary {
    cursor: pointer;
    font-weight: 600;
    color: #3730a3;
}
.ps-defs ul {
    margin: 0.5rem 0 0.25rem 1rem;
}
#partner-details-modal .modal,
#partner-details-modal .modal-container {
    max-width: 1150px;
    width: 96vw;
}
@media (max-width: 1100px) {
    .ds-layout {
        grid-template-columns: 1fr;
    }
    .ds-units {
        position: static;
        max-height: 260px;
    }
    .ds-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .ds-grid2 {
        grid-template-columns: 1fr;
    }
}
