/* ===== Customers (khata style) ===== */
:root { --cu-red: #d32f2f; --cu-green: #1b7a43; }

.cu-btn { border: 1px solid var(--border, #d9dee5); background: #fff; color: var(--text, #1f2933); border-radius: 8px; padding: 10px 16px; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; text-decoration: none; display: inline-block; }
.cu-btn-green { background: var(--cu-green); border-color: var(--cu-green); color: #fff; }
.cu-btn-light { background: #f4f6f8; }
.cu-btn:disabled { opacity: .6; cursor: default; }

.cu-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1f2933; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 14px; z-index: 3000; max-width: 90vw; }
.cu-toast[hidden] { display: none; }

.cu-layout { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 18px; align-items: start; }
.cu-list-col, .cu-ledger-col { background: #fff; border: 1px solid var(--border, #d9dee5); border-radius: 12px; min-width: 0; }
.cu-list-col { padding: 14px; }
.cu-ledger-col { padding: 0; overflow: hidden; }

/* summary */
.cu-summary { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--border, #d9dee5); border-radius: 10px; overflow: hidden; margin-bottom: 12px; }
.cu-summary-cell { padding: 12px; text-align: center; display: flex; flex-direction: column; gap: 3px; }
.cu-summary-cell + .cu-summary-cell { border-left: 1px solid var(--border, #d9dee5); }
.cu-summary-cell strong { font-size: 18px; }
.cu-summary-cell span { font-size: 12px; color: var(--muted, #6b7785); }
.cu-get { color: var(--cu-red); }
.cu-give { color: var(--cu-green); }

.cu-search-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 8px; }
.cu-search-row input, .cu-search-row select, .cu-entry-search { border: 1px solid var(--border, #d9dee5); border-radius: 8px; padding: 10px 12px; font-size: 14px; font-family: inherit; min-width: 0; background: #fff; box-sizing: border-box; }
.cu-search-row .cu-btn { padding: 10px 12px; }
.cu-count { margin: 10px 2px 6px; font-size: 12px; color: var(--muted, #6b7785); }

.cu-list { max-height: calc(100vh - 330px); overflow-y: auto; }
.cu-item { display: flex; align-items: center; gap: 12px; padding: 12px 6px; border-top: 1px solid #eef1f4; cursor: pointer; }
.cu-item:hover, .cu-item.active { background: #f4f9f6; }
.cu-avatar { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; background: #e3efe8; color: var(--cu-green); font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 15px; }
.cu-item-main { flex: 1 1 auto; min-width: 0; }
.cu-item-main b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cu-item-main small { color: var(--muted, #6b7785); font-size: 12px; }
.cu-item-amt { text-align: right; flex: 0 0 auto; }
.cu-item-amt b { display: block; font-size: 15px; }
.cu-item-amt small { font-size: 11px; color: var(--muted, #6b7785); }
.cu-item-amt.get b { color: var(--cu-red); }
.cu-item-amt.give b { color: var(--cu-green); }
.cu-none { padding: 24px 8px; text-align: center; color: var(--muted, #6b7785); font-size: 14px; }

/* ledger */
.cu-empty { padding: 60px 20px; text-align: center; color: var(--muted, #6b7785); }
.cu-lhead { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid #eef1f4; }
.cu-lhead-text { flex: 1 1 auto; min-width: 0; }
.cu-lhead-text h3 { margin: 0; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cu-lhead-text p { margin: 2px 0 0; font-size: 12px; color: var(--muted, #6b7785); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cu-icon-btn { border: 0; background: transparent; width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text, #1f2933); padding: 0; }
.cu-icon-btn:hover { background: #f0f2f4; }
.cu-icon-btn svg { width: 22px; height: 22px; }
#cu-back { display: none; }

.cu-menu-wrap { position: relative; }
.cu-menu { position: absolute; right: 0; top: 42px; background: #fff; border: 1px solid var(--border, #d9dee5); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.14); min-width: 170px; z-index: 50; overflow: hidden; }
.cu-menu[hidden] { display: none; }
.cu-menu button { display: block; width: 100%; text-align: left; border: 0; background: #fff; padding: 12px 14px; font-size: 14px; cursor: pointer; font-family: inherit; }
.cu-menu button:hover { background: #f4f6f8; }
.cu-menu .cu-danger { color: var(--cu-red); }

.cu-balance-card { margin: 14px; padding: 16px; border-radius: 12px; background: #f6f8fa; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.cu-balance-card strong { font-size: 24px; }
.cu-balance-card span { font-size: 14px; font-weight: 600; }
.cu-balance-card.get strong, .cu-balance-card.get span { color: var(--cu-red); }
.cu-balance-card.give strong, .cu-balance-card.give span { color: var(--cu-green); }

.cu-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 0 14px 14px; }
.cu-action { border: 1px solid var(--border, #d9dee5); background: #fff; border-radius: 10px; padding: 10px 4px; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; font-size: 12px; font-family: inherit; color: var(--text, #1f2933); }
.cu-action:hover { background: #f4f9f6; }
.cu-action svg { width: 22px; height: 22px; color: var(--cu-green); }

.cu-gg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 14px 14px; }
.cu-gg-btn { border: 0; border-radius: 10px; padding: 14px 8px; font-size: 15px; font-weight: 700; color: #fff; cursor: pointer; font-family: inherit; }
.cu-gg-gave { background: var(--cu-red); }
.cu-gg-got { background: var(--cu-green); }

.cu-entry-search { display: block; width: calc(100% - 28px); margin: 0 14px 10px; }
.cu-entries-head { display: grid; grid-template-columns: minmax(0, 1fr) 96px 96px; padding: 8px 14px; background: #f6f8fa; font-size: 12px; font-weight: 700; color: var(--muted, #6b7785); text-transform: uppercase; }
.cu-entries-head span:nth-child(2), .cu-entries-head span:nth-child(3) { text-align: right; }
.cu-entries { max-height: calc(100vh - 560px); min-height: 160px; overflow-y: auto; }
.cu-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px 96px; padding: 10px 14px; border-bottom: 1px solid #eef1f4; cursor: pointer; align-items: start; }
.cu-row:hover { background: #fafcfb; }
.cu-row-main small { display: block; font-size: 11px; color: var(--muted, #6b7785); }
.cu-row-main b { display: block; font-size: 14px; font-weight: 600; margin: 2px 0; overflow-wrap: anywhere; }
.cu-bal-tag { display: inline-block; background: #f1f3f5; border-radius: 6px; padding: 2px 7px; font-size: 11px; color: var(--muted, #6b7785); }
.cu-row .gave, .cu-row .got { text-align: right; font-weight: 700; font-size: 14px; }
.cu-row .gave { color: var(--cu-red); }
.cu-row .got { color: var(--cu-green); }
.cu-row.alt-gave { background: #fff8f8; }

/* modals */
.cu-modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 2000; }
.cu-modal[hidden] { display: none; }
.cu-modal-card { background: #fff; border-radius: 14px; padding: 20px; width: 100%; max-width: 420px; max-height: 92vh; overflow-y: auto; box-sizing: border-box; }
.cu-modal-card h3 { margin: 0 0 12px; font-size: 18px; }
.cu-modal-card label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 5px; }
.cu-modal-card input { width: 100%; box-sizing: border-box; border: 1px solid var(--border, #d9dee5); border-radius: 8px; padding: 11px 12px; font-size: 15px; font-family: inherit; -webkit-appearance: none; appearance: none; min-width: 0; max-width: 100%; background: #fff; }
.cu-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cu-two > div { min-width: 0; }
.cu-form-message { min-height: 18px; margin: 10px 0 0; font-size: 13px; color: var(--cu-red); }
.cu-modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }
.cu-detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.cu-detail-actions .cu-btn { flex: 1 1 auto; }
.cu-d-amount { font-size: 26px; font-weight: 800; margin: 0 0 4px; }
.cu-d-amount.gave { color: var(--cu-red); }
.cu-d-amount.got { color: var(--cu-green); }
.cu-d-line { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid #eef1f4; font-size: 14px; }
.cu-d-line span:first-child { color: var(--muted, #6b7785); }
.cu-d-line span:last-child { text-align: right; overflow-wrap: anywhere; }
.cu-btn-red { background: var(--cu-red); border-color: var(--cu-red); color: #fff; }

/* Dashboard groups + bulk reminders */
.cu-group-bar { background: #fff6e5; border: 1px solid #f3d089; border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.cu-group-bar[hidden] { display: none; }
.cu-group-bar strong { display: block; font-size: 15px; color: #6b4a00; }
.cu-group-bar span { display: block; margin-top: 2px; font-size: 13px; color: #6b4a00; }
.cu-group-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.cu-group-btns .cu-btn { padding: 8px 12px; font-size: 13px; white-space: nowrap; }

.cu-select-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding: 8px 10px; background: #f4f9f6; border: 1px solid #cfe5d8; border-radius: 10px; }
.cu-select-bar[hidden] { display: none; }
.cu-select-bar label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; margin: 0; }
.cu-select-bar span { font-size: 12px; color: var(--muted, #6b7785); }
.cu-select-bar .cu-btn { padding: 8px 12px; font-size: 13px; }
.cu-select-bar input, .cu-item .cu-pick { width: 18px; height: 18px; accent-color: var(--cu-green); }
.cu-item .cu-pick { flex: 0 0 auto; }

.cu-modal-card textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--border, #d9dee5); border-radius: 8px; padding: 11px 12px; font-size: 14px; font-family: inherit; resize: vertical; }
.cu-modal-card input[type="radio"] { width: auto; -webkit-appearance: radio; appearance: auto; accent-color: var(--cu-green); }
.cu-hint { margin: 6px 0 0; font-size: 12px; color: var(--muted, #6b7785); }
.cu-channel { display: flex; gap: 18px; margin: 12px 0 8px; }
.cu-channel label { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 14px; }
.cu-bulk-card { max-width: 480px; }
.cu-bulk-list { max-height: 260px; overflow-y: auto; border: 1px solid #eef1f4; border-radius: 10px; margin-top: 8px; }
.cu-bulk-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid #eef1f4; }
.cu-bulk-row:last-child { border-bottom: 0; }
.cu-bulk-row b { display: block; font-size: 14px; }
.cu-bulk-row small { font-size: 12px; color: var(--muted, #6b7785); }
.cu-bulk-row .cu-btn { padding: 8px 12px; font-size: 13px; white-space: nowrap; }
.cu-bulk-skip { font-size: 12px; color: var(--cu-red); white-space: nowrap; }

/* print */
#cu-print { display: none; }
@media print {
    body.printing-report > *:not(#cu-print) { display: none !important; }
    body.printing-report #cu-print { display: block; padding: 10px; font-family: Arial, sans-serif; color: #000; }
    #cu-print h2 { margin: 0 0 2px; }
    #cu-print p { margin: 2px 0; font-size: 13px; }
    #cu-print table { width: 100%; min-width: 0; border-collapse: collapse; margin-top: 12px; font-size: 12px; }
    #cu-print th, #cu-print td { border: 1px solid #999; padding: 5px 6px; text-align: left; }
    #cu-print td.num, #cu-print th.num { text-align: right; }
}

/* tablet / mobile */
@media (max-width: 900px) {
    .cu-layout { grid-template-columns: minmax(0, 1fr); }
    .cu-layout .cu-ledger-col { display: none; }
    .cu-layout.show-ledger .cu-list-col { display: none; }
    .cu-layout.show-ledger .cu-ledger-col { display: block; }
    #cu-back { display: flex; }
    .cu-list { max-height: none; }
    .cu-entries { max-height: none; }
    .cu-page .topbar { gap: 10px; }
    .cu-page .topbar .cu-btn { padding: 9px 12px; font-size: 13px; white-space: nowrap; }
    .cu-entries-head, .cu-row { grid-template-columns: minmax(0, 1fr) 84px 84px; }
}


/* ===== Customers: card list, chips, 3 dots, + button ===== */

.cu-sticky {
    position: sticky;
    top: var(--mobile-header-h, 0px);
    z-index: 50;
    margin: 0 -2px;
    padding: 4px 2px 8px;
    background: #fff;
}

.cu-chips {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    overflow-x: auto;
    scrollbar-width: none;
}

.cu-chips::-webkit-scrollbar { display: none; }

.cu-chip {
    flex: none;
    padding: 8px 14px;
    border: 1px solid #d8e1db;
    border-radius: 999px;
    background: #fff;
    color: #1b2a22;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.cu-chip.on {
    background: #176b45;
    border-color: #176b45;
    color: #fff;
}

.cu-imenu-wrap { position: relative; flex: none; }

.cu-dots {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #55685d;
    cursor: pointer;
}

.cu-dots:hover { background: #eef3ef; }

.cu-imenu {
    position: absolute;
    top: 34px;
    right: 0;
    z-index: 60;
    min-width: 140px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #d8e1db;
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(16, 60, 40, 0.18);
}

.cu-imenu[hidden] { display: none; }

.cu-imenu button {
    display: block;
    width: 100%;
    padding: 11px 14px;
    border: 0;
    border-bottom: 1px solid #eef2ef;
    background: #fff;
    color: #1b2a22;
    font: inherit;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
}

.cu-imenu button:last-child { border-bottom: 0; }
.cu-imenu button:hover { background: #eef6f1; }
.cu-imenu .cu-danger { color: var(--cu-red); }

.cu-fab {
    position: fixed;
    right: 18px;
    bottom: 28px;
    z-index: 80;
    width: 58px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #176b45;
    color: #fff;
    font-size: 32px;
    line-height: 1;
    box-shadow: 0 6px 18px rgba(23, 107, 69, 0.4);
    cursor: pointer;
}

.cu-fab:hover { background: #105638; }

@media (max-width: 900px) {
    .cu-list-col {
        padding: 0;
        background: transparent;
        border: 0;
    }

    .cu-sticky { background: #f4f7f5; }

    .cu-summary { background: #fff; }

    .cu-item {
        margin-bottom: 10px;
        padding: 12px;
        background: #fff;
        border: 1px solid #e1e9e4;
        border-radius: 14px;
    }

    .cu-item:hover, .cu-item.active { background: #fff; }

    .cu-fab { bottom: calc(86px + env(safe-area-inset-bottom, 0px)); }
}

/* 3 dots menu ko kaatne se rokna */
@media (max-width: 900px) {
    .cu-list {
        overflow: visible;
    }
}

/* Aakhri card ka menu upar ki taraf khule (desktop par list scroll hoti hai) */
.cu-item:last-child .cu-imenu {
    top: auto;
    bottom: 34px;
}


/* ===== Laptop / desktop (1024px and wider) ===== */
@media (min-width: 1024px) {
    .cu-layout {
        grid-template-columns: 420px minmax(0, 1fr);
        max-width: 1300px;
    }

    .cu-ledger-col {
        min-height: 60vh;
    }

    .cu-empty {
        padding: 120px 20px;
        font-size: 15px;
    }

    .cu-item {
        padding: 14px 8px;
    }

    .cu-fab {
        width: auto;
        height: 50px;
        padding: 0 22px 0 18px;
        gap: 8px;
        border-radius: 999px;
        font-size: 28px;
        right: 32px;
        bottom: 32px;
    }

    .cu-fab::after {
        content: "Add Customer";
        font-size: 15px;
        font-weight: 600;
        font-family: inherit;
    }
}