* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4ecf7 100%);
    min-height: 100vh;
    color: #2d3748;
    padding: 24px 16px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* ===== Header ===== */
header {
    background: linear-gradient(135deg, #1a56db 0%, #3182ce 100%);
    border-radius: 16px;
    padding: 28px 32px;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    box-shadow: 0 10px 25px rgba(26, 86, 219, 0.25);
    margin-bottom: 24px;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 600;
}

.subtitle {
    opacity: 0.9;
    font-size: 0.95rem;
    margin-top: 4px;
}

/* ===== Buttons ===== */
.btn {
    border: none;
    border-radius: 10px;
    padding: 12px 22px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: #fff;
    color: #1a56db;
}

.btn-primary:hover {
    background: #e8f0fe;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: #718096;
    cursor: pointer;
    line-height: 1;
}

.btn-close:hover {
    color: #e53e3e;
}

/* ===== Statistik Cards ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: 14px;
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    border-left: 5px solid transparent;
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.stat-total { border-left-color: #f6ad55; }
.stat-korporat { border-left-color: #3182ce; }
.stat-sukan { border-left-color: #38a169; }
.stat-customers { border-left-color: #805ad5; }

.stat-icon {
    font-size: 2.2rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: #f7fafc;
}

.stat-info h3 {
    font-size: 0.85rem;
    font-weight: 500;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 2px 0;
}

.stat-label {
    font-size: 0.8rem;
    color: #a0aec0;
}

/* ===== Toolbar ===== */
.toolbar {
    background: #fff;
    border-radius: 14px;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    margin-bottom: 24px;
}

.search-box input {
    padding: 11px 18px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95rem;
    width: 320px;
    max-width: 100%;
    outline: none;
    transition: border-color 0.2s;
}

.search-box input:focus {
    border-color: #3182ce;
}

.filter-buttons {
    display: flex;
    gap: 8px;
}

.btn-filter {
    padding: 10px 20px;
    border: 2px solid #e2e8f0;
    background: #fff;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-filter:hover {
    border-color: #3182ce;
    color: #3182ce;
}

.btn-filter.active {
    background: #1a56db;
    border-color: #1a56db;
    color: #fff;
}

/* ===== Jadual ===== */
.table-section {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    overflow-x: auto;
    padding-bottom: 8px;
}

.customer-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1000px;
}

.customer-table thead {
    background: #f7fafc;
}

.customer-table th {
    text-align: left;
    padding: 15px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e2e8f0;
}

.customer-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #edf2f7;
    font-size: 0.92rem;
}

.customer-table tbody tr:hover {
    background: #f7fafc;
}

.badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 500;
}

.badge-korporat {
    background: #ebf8ff;
    color: #2b6cb0;
}

.badge-sukan {
    background: #c6f6d5;
    color: #276749;
}

.amount {
    font-weight: 600;
    color: #1a56db;
}

.action-btns {
    display: flex;
    gap: 6px;
}

.btn-icon {
    border: none;
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-view {
    background: #e9d8fd;
    color: #553c9a;
}

.btn-view:hover {
    background: #d6bcfa;
}

.btn-edit {
    background: #feebc8;
    color: #c05621;
}

.btn-edit:hover {
    background: #fbd38d;
}

.btn-delete {
    background: #fed7d7;
    color: #c53030;
}

.btn-delete:hover {
    background: #feb2b2;
}

/* ===== Empty State ===== */
.empty-state {
    display: none;
    text-align: center;
    padding: 60px 20px;
    color: #a0aec0;
}

.empty-state.show {
    display: block;
}

.empty-icon {
    font-size: 3.5rem;
    margin-bottom: 12px;
}

.empty-state h3 {
    color: #718096;
    margin-bottom: 6px;
}

/* ===== Modal ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(45, 55, 72, 0.6);
    z-index: 100;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 16px;
    overflow-y: auto;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    animation: modalIn 0.25s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 22px 28px;
    border-bottom: 1px solid #edf2f7;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal form,
.history-content {
    padding: 24px 28px;
}

/* ===== Form ===== */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: #4a5568;
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
    background: #fff;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #3182ce;
}

.form-group input[readonly] {
    background: #f7fafc;
    color: #4a5568;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.total-display {
    background: linear-gradient(135deg, #ebf8ff 0%, #bee3f8 100%);
    border-radius: 10px;
    padding: 14px 16px;
    font-size: 1.3rem;
    font-weight: 700;
    color: #2b6cb0;
    text-align: center;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 0 28px 24px;
}

/* ===== Sejarah ===== */
.history-summary {
    background: #f7fafc;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 18px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.history-summary div {
    font-size: 0.9rem;
}

.history-summary strong {
    color: #1a56db;
}

.history-item {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.history-item .details {
    font-size: 0.9rem;
}

.history-item .details .date {
    color: #a0aec0;
    font-size: 0.8rem;
}

.history-item .amount {
    font-size: 1.05rem;
}

.history-note {
    width: 100%;
    font-size: 0.82rem;
    color: #718096;
    font-style: italic;
    margin-top: 6px;
}

.no-history {
    text-align: center;
    color: #a0aec0;
    padding: 30px 0;
}

/* ===== Statistik ikut Saiz ===== */
.size-section,
.payment-section,
.ansuran-section {
    background: #fff;
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    margin-bottom: 24px;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.size-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 12px;
}

.size-chip {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-radius: 12px;
    padding: 14px 10px;
    text-align: center;
    transition: transform 0.2s ease;
}

.size-chip:hover {
    transform: translateY(-2px);
}

.size-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.size-count {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a56db;
    margin-top: 4px;
}

.size-sub {
    display: block;
    font-size: 0.7rem;
    color: #718096;
    margin-top: 2px;
    line-height: 1.3;
}

/* ===== Statistik ikut Cara Bayaran ===== */
.payment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}

.payment-card {
    border-radius: 12px;
    padding: 18px;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.payment-tunai {
    background: linear-gradient(135deg, #38a169 0%, #48bb78 100%);
}

.payment-pindahan {
    background: linear-gradient(135deg, #2b6cb0 0%, #4299e1 100%);
}

.payment-ansuran {
    background: linear-gradient(135deg, #b7791f 0%, #d69e2e 100%);
}

.payment-title {
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.95;
    margin-bottom: 8px;
}

.payment-amount {
    font-size: 1.5rem;
    font-weight: 700;
}

.payment-count {
    font-size: 0.8rem;
    opacity: 0.85;
    margin-top: 4px;
}

/* ===== Ansuran Aktif ===== */
.ansuran-section { padding: 22px; }

.ansuran-card {
    background: #fffaf0;
    border: 1px solid #f6e05e;
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.ansuran-card.settle {
    background: #f0fff4;
    border-color: #9ae6b4;
}

.ansuran-card .info {
    flex: 1;
    min-width: 240px;
}

.ansuran-card .info strong {
    font-size: 1rem;
    color: #2d3748;
}

.ansuran-card .info .meta {
    font-size: 0.82rem;
    color: #718096;
    margin-top: 4px;
}

.ansuran-progress {
    width: 100%;
    margin-top: 10px;
}

.progress-bar-bg {
    background: #edf2f7;
    border-radius: 20px;
    height: 10px;
    overflow: hidden;
    margin-top: 6px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #d69e2e 0%, #ecc94b 100%);
    border-radius: 20px;
    transition: width 0.3s ease;
}

.settle .progress-bar-fill {
    background: linear-gradient(90deg, #38a169 0%, #48bb78 100%);
}

.progress-text {
    font-size: 0.8rem;
    color: #718096;
    margin-top: 4px;
    display: flex;
    justify-content: space-between;
}

.btn-ansuran {
    background: #d69e2e;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 9px 16px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.btn-ansuran:hover {
    background: #b7791f;
}

.btn-ansuran:disabled {
    background: #a0aec0;
    cursor: not-allowed;
}

.no-ansuran {
    text-align: center;
    color: #a0aec0;
    padding: 20px 0;
    font-size: 0.9rem;
}

/* ===== Badge Bayaran ===== */
.badge-tunai {
    background: #c6f6d5;
    color: #276749;
}

.badge-pindahan {
    background: #bee3f8;
    color: #2c5282;
}

.badge-ansuran {
    background: #feebc8;
    color: #975a16;
}

/* Badge Sel */
.badge-sel {
    background: #e9d8fd;
    color: #553c9a;
}

/* ===== Monitor Sel ===== */
.sel-section {
    background: #fff;
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    margin-bottom: 24px;
}

.sel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}

.sel-card {
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border: 1px solid #e1e4e8;
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.sel-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    border-color: #3182ce;
}

.sel-card.active {
    border-color: #1a56db;
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.15);
}

.sel-card-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: #2c3e50;
    padding-bottom: 8px;
    margin-bottom: 10px;
    border-bottom: 2px solid #3182ce;
}

.sel-card-empty {
    text-align: center;
    color: #a0aec0;
    font-size: 0.85rem;
    padding: 10px 0;
    font-style: italic;
}

.sel-card-stats {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sel-stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    color: #4a5568;
}

.sel-stat-row span {
    color: #718096;
}

.sel-stat-row strong {
    color: #2c3e50;
}

.sel-stat-row strong.green { color: #276749; }
.sel-stat-row strong.red { color: #c53030; }

.sel-mini-bar {
    height: 8px;
    background: #edf2f7;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 10px;
}

.sel-mini-bar > div {
    height: 100%;
    transition: width 0.3s ease;
}

.mini-green {
    background: linear-gradient(90deg, #27ae60, #2ecc71);
}

.sel-card-pct {
    font-size: 0.72rem;
    color: #718096;
    margin-top: 4px;
    text-align: right;
}

.sel-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #a0aec0;
    padding: 30px 0;
    font-size: 0.9rem;
}

/* Dropdown penapis Sel */
select.btn-filter {
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, #4a5568 50%),
                      linear-gradient(135deg, #4a5568 50%, transparent 50%);
    background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 32px;
}

/* ===== Badge LUNAS / Baki Hutang ===== */
.badge-lunas {
    background: #c6f6d5;
    color: #22543d;
    font-weight: 600;
}

.badge-belum-lunas {
    background: #fed7d7;
    color: #822727;
    font-weight: 600;
}

.baki-hutang {
    color: #c53030;
    font-weight: 700;
}

.baki-lunas {
    color: #276749;
    font-weight: 700;
}

/* ===== Status Bar LUNAS ===== */
.status-lunas-bar {
    background: linear-gradient(135deg, #c6f6d5 0%, #9ae6b4 100%);
    color: #22543d;
    font-weight: 600;
    text-align: center;
    padding: 14px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 0.95rem;
}

.status-hutang-bar {
    background: linear-gradient(135deg, #fed7d7 0%, #feb2b2 100%);
    color: #822727;
    font-weight: 600;
    text-align: center;
    padding: 14px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 0.95rem;
}

/* ===== Modal Bayar Ansuran ===== */
.pay-list {
    margin-top: 16px;
}

.pay-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #f7fafc;
    border-radius: 10px;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.pay-item .pay-date { color: #718096; font-size: 0.82rem; }
.pay-item .pay-amount { font-weight: 600; color: #2f855a; }

.pay-form {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.pay-form input {
    flex: 1;
    min-width: 140px;
    padding: 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
}

.pay-form input:focus { border-color: #3182ce; }

.pay-form button {
    background: #38a169;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 10px 20px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
}

.pay-form button:hover { background: #2f855a; }

/* ===== Radio Payment Options ===== */
.payment-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.payment-option input {
    display: none;
}

.payment-option-label {
    display: block;
    text-align: center;
    padding: 12px 8px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 500;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.2s;
}

.payment-option input:checked + .payment-option-label {
    border-color: #1a56db;
    background: #ebf8ff;
    color: #1a56db;
}

/* ===== Medan Ansuran dalam Form ===== */
.ansuran-fields { margin-bottom: 18px; }

.ansuran-box {
    background: #fffaf0;
    border: 2px dashed #d69e2e;
    border-radius: 12px;
    padding: 18px;
}

.ansuran-box h4 {
    font-size: 0.95rem;
    color: #975a16;
    margin-bottom: 14px;
}

.ansuran-calc {
    background: #fff;
    border-radius: 10px;
    padding: 14px 16px;
}

.ansuran-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 0.9rem;
    color: #4a5568;
    border-bottom: 1px dashed #edf2f7;
}

.ansuran-row:last-child { border-bottom: none; }
.ansuran-row span:last-child { font-weight: 600; color: #1a56db; }

/* ===== Export Buttons ===== */
.export-buttons {
    display: flex;
    gap: 8px;
}

.btn-export {
    padding: 10px 16px;
    border: 2px solid #e2e8f0;
    background: #fff;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-export:hover {
    border-color: #3182ce;
    color: #3182ce;
}

.btn-export-danger:hover {
    border-color: #e53e3e;
    color: #e53e3e;
}

.btn-export-excel {
    background: #e6fffa;
    color: #234e52;
    border-color: #b2f5ea;
}

.btn-export-excel:hover {
    border-color: #319795;
    color: #319795;
    background: #b2f5ea;
}

/* ===== Ticker Nama Pembeli ===== */
.buyer-ticker {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(135deg, #1a56db 0%, #3182ce 100%);
    color: #fff;
    display: flex;
    align-items: center;
    padding: 12px 0;
    box-shadow: 0 -4px 20px rgba(26, 86, 219, 0.3);
    z-index: 50;
}

.ticker-label {
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    margin-left: 16px;
    margin-right: 12px;
    flex-shrink: 0;
}

.ticker-viewport {
    overflow: hidden;
    flex: 1;
    position: relative;
    height: 24px;
}

/* Gradien tepi kanan & kiri */
.ticker-viewport::before,
.ticker-viewport::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 30px;
    z-index: 2;
    pointer-events: none;
}

.ticker-viewport::before {
    left: 0;
    background: linear-gradient(to right, #1a56db, transparent);
}

.ticker-viewport::after {
    right: 0;
    background: linear-gradient(to left, #3182ce, transparent);
}

.ticker-track {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    animation: tickerScroll 30s linear infinite;
    will-change: transform;
}

/* Pause animation on hover */
.ticker-viewport:hover .ticker-track {
    animation-play-state: paused;
}

/* Loop lancar: kandungan diduplikasi 2x dalam JS,
   animasi bergerak -50% supaya penyambungannya tak kelihatan */
@keyframes tickerScroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.ticker-item {
    font-size: 0.9rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 20px;
}

.ticker-item .dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #a3e4d7;
}

.ticker-item strong {
    color: #fff;
    font-weight: 600;
}

.ticker-separator {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
}

/* Ruang untuk ticker di bawah supaya jadual tak tertutup */
.container {
    padding-bottom: 70px;
}

/* ===== Set Box (Baju Korporat + Sukan) ===== */
.set-box {
    background: #f0f7ff;
    border: 2px solid #bee3f8;
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 18px;
}

.set-box h4 {
    font-size: 0.95rem;
    color: #2b6cb0;
    margin-bottom: 6px;
}

.set-info {
    font-size: 0.82rem;
    color: #4a5568;
    margin-bottom: 14px;
}

.set-quantity {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 14px;
}

.set-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.set-item span {
    font-size: 0.85rem;
    font-weight: 500;
    color: #4a5568;
}

.set-item input {
    width: 60px;
    padding: 6px 8px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    text-align: center;
    outline: none;
}

.set-item input:focus {
    border-color: #3182ce;
}

.set-item span:last-child {
    font-size: 0.78rem;
    color: #718096;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
    body { padding: 12px 8px; }

    header { padding: 20px; }
    header h1 { font-size: 1.4rem; }

    .form-row { grid-template-columns: 1fr; }

    .search-box input { width: 100%; }

    .toolbar { flex-direction: column; align-items: stretch; }
    .filter-buttons { justify-content: center; flex-wrap: wrap; }
    .export-buttons { justify-content: center; flex-wrap: wrap; }

    .modal form,
    .history-content { padding: 18px; }
    .form-actions { padding: 0 18px 18px; }

    .payment-options { grid-template-columns: 1fr; }
    .size-grid { grid-template-columns: repeat(4, 1fr); }
    .set-quantity { grid-template-columns: 1fr; }
}

/* ===== Resit Pembayaran ===== */
.resit-upload-area {
    border: 2px dashed #bee3f8;
    border-radius: 12px;
    background: #f0f7ff;
    transition: border-color 0.2s, background 0.2s;
}

.resit-upload-area:hover {
    border-color: #3182ce;
}

.resit-placeholder {
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.resit-icon {
    font-size: 2rem;
}

.resit-text {
    font-size: 0.92rem;
    font-weight: 500;
    color: #2b6cb0;
}

.resit-hint {
    font-size: 0.75rem;
    color: #718096;
}

.resit-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    flex-wrap: wrap;
}

.resit-preview img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #bee3f8;
    cursor: pointer;
    transition: transform 0.2s;
}

.resit-preview img:hover {
    transform: scale(1.05);
}

.resit-preview-info {
    flex: 1;
    min-width: 120px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.resit-preview-info span:first-child {
    font-size: 0.88rem;
    font-weight: 500;
    color: #2d3748;
    word-break: break-all;
}

.resit-preview-info span:last-child {
    font-size: 0.75rem;
    color: #718096;
}

.resit-remove {
    background: #fed7d7;
    color: #c53030;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.resit-remove:hover {
    background: #feb2b2;
}

/* Thumbnail resit dalam jadual */
.resit-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #bee3f8;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
    display: block;
}

.resit-thumb:hover {
    transform: scale(1.1);
    border-color: #3182ce;
}

.resit-none-cell {
    color: #cbd5e0;
    font-size: 0.9rem;
}

/* Modal lihat resit */
.resit-modal {
    max-width: 640px;
}

.resit-viewer-content {
    padding: 20px 28px;
    text-align: center;
}

.resit-viewer-content img {
    max-width: 100%;
    max-height: 60vh;
    object-fit: contain;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

/* Resit dalam sejarah */
.history-resit {
    margin-top: 10px;
    width: 100%;
}

.history-resit-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: #4a5568;
    margin-bottom: 6px;
}

.history-resit-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 10px;
    border: 2px solid #bee3f8;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}

.history-resit-thumb:hover {
    transform: scale(1.05);
    border-color: #3182ce;
}

.history-resit-file {
    font-size: 0.72rem;
    color: #a0aec0;
    margin-top: 4px;
}

/* ===== Resit PDF ===== */
.resit-pdf-icon {
    object-fit: contain !important;
    padding: 8px;
    background: #fed7d7;
    border-radius: 8px;
}

.resit-pdf-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    width: 48px;
}

.resit-pdf-label {
    font-size: 0.6rem;
    font-weight: 700;
    color: #c53030;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-resit-pdf {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    width: 80px;
}

.history-resit-pdf .resit-pdf-label {
    font-size: 0.68rem;
}

/* PDF viewer dalam modal */
#resitModalPdf {
    width: 100%;
    height: 60vh;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f7fafc;
}

/* ===== Resit Bayaran Ansuran ===== */
.pay-item-resit {
    flex-direction: column;
    align-items: stretch !important;
    gap: 8px;
}

.pay-item-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pay-resit-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.btn-resit-mini {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 5px 10px;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    color: #4a5568;
}

.btn-resit-add {
    background: #ebf8ff;
    color: #2b6cb0;
    border-color: #bee3f8;
}

.btn-resit-add:hover {
    background: #bee3f8;
    border-color: #3182ce;
}

.btn-resit-view {
    background: #f0fff4;
    color: #276749;
    border-color: #c6f6d5;
}

.btn-resit-view:hover {
    background: #c6f6d5;
}

.btn-resit-change {
    background: #feebc8;
    color: #c05621;
    border-color: #fbd38d;
}

.btn-resit-change:hover {
    background: #fbd38d;
}

.btn-resit-remove {
    background: #fed7d7;
    color: #c53030;
    border-color: #feb2b2;
}

.btn-resit-remove:hover {
    background: #feb2b2;
}

.pay-resit-hint {
    font-size: 0.76rem;
    color: #718096;
    margin-top: 8px;
    font-style: italic;
    text-align: center;
}

/* Grid resit ansuran dalam sejarah */
.history-resit-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 4px;
}

.history-resit-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.history-resit-item-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #4a5568;
}
