/* ═══════════════════════════════════════════════════════════
   POS App — Custom Styles (supplements Tailwind)
   ═══════════════════════════════════════════════════════════ */

/* ── Google Font ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap');

/* ── Base ────────────────────────────────────────────────── */
* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'DM Sans', sans-serif;
    background: #F5F5F7;
    color: #1D1D1F;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #C7C7CC; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #8E8E93; }

/* ── Layout ──────────────────────────────────────────────── */
.app-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.sidebar {
    width: 260px;
    background: #FFFFFF;
    border-right: 1px solid #E5E5EA;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 40;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid #E5E5EA;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    overflow-y: auto;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 10px;
    color: #6E6E73;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-bottom: 2px;
}

.sidebar-nav a:hover {
    background: #F5F5F7;
    color: #1D1D1F;
}

.sidebar-nav a.active {
    background: #0071E3;
    color: #FFFFFF;
}

.sidebar-nav a .nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid #E5E5EA;
}

.main-content {
    flex: 1;
    min-width: 0; /* Critical: prevents flex item from stretching page body on mobile */
    margin-left: 260px;
    padding: 32px;
    min-height: 100vh;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-content.expanded {
    margin-left: 0;
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

/* ── Mobile bottom bar ───────────────────────────────────── */
.bottom-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #FFFFFF;
    border-top: 1px solid #E5E5EA;
    z-index: 50;
    padding: 4px 0;
    padding-bottom: env(safe-area-inset-bottom, 4px);
}

.bottom-bar nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.bottom-bar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 12px;
    color: #8E8E93;
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
    border-radius: 8px;
    transition: color 0.2s;
}

.bottom-bar a .bar-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.bottom-bar a.active { color: #0071E3; }
.bottom-bar a:hover { color: #0071E3; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
    background: #FFFFFF;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.stat-card {
    background: #FFFFFF;
    border-radius: 16px;
    padding: 20px 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
    color: #1D1D1F;
}

.stat-label {
    font-size: 13px;
    color: #8E8E93;
    font-weight: 500;
    margin-top: 2px;
}

/* ── Status badges ───────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.badge-in-stock { background: #E8F8ED; color: #1B7A3D; }
.badge-in-stock .badge-dot { background: #34C759; }

.badge-low-stock { background: #FFF8E6; color: #9A6700; }
.badge-low-stock .badge-dot { background: #FF9F0A; }

.badge-out-of-stock { background: #FEE9E7; color: #C5221F; }
.badge-out-of-stock .badge-dot { background: #FF3B30; }

/* ── Toast notifications ─────────────────────────────────── */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-radius: 12px;
    background: #FFFFFF;
    color: #1D1D1F;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    font-size: 14px;
    font-weight: 500;
    min-width: 300px;
    max-width: 420px;
    transform: translateX(120%);
    animation: toast-slide-in 0.35s cubic-bezier(0.21, 1.02, 0.73, 1) forwards;
    border-left: 4px solid transparent;
}

.toast.toast-out {
    animation: toast-slide-out 0.3s ease-in forwards;
}

.toast-success { border-left-color: #34C759; }
.toast-error { border-left-color: #FF3B30; }
.toast-info { border-left-color: #0071E3; }
.toast-warning { border-left-color: #FF9F0A; }

.toast-icon { font-size: 18px; flex-shrink: 0; }

@keyframes toast-slide-in {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toast-slide-out {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(120%); opacity: 0; }
}

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    padding: 16px;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: #FFFFFF;
    border-radius: 20px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.25s cubic-bezier(0.21, 1.02, 0.73, 1);
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 24px 24px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: #1D1D1F;
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #F5F5F7;
    color: #8E8E93;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.modal-close:hover { background: #E5E5EA; }

.modal-body { padding: 20px 24px; }
.modal-footer {
    padding: 0 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #6E6E73;
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #E5E5EA;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    color: #1D1D1F;
    background: #FFFFFF;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.form-input:focus {
    border-color: #0071E3;
    box-shadow: 0 0 0 3px rgba(0,113,227,0.12);
}

.form-input::placeholder { color: #C7C7CC; }

.form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #E5E5EA;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    color: #1D1D1F;
    background: #FFFFFF;
    transition: border-color 0.2s;
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238E8E93' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.form-select:focus {
    border-color: #0071E3;
    box-shadow: 0 0 0 3px rgba(0,113,227,0.12);
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-primary {
    background: #0071E3;
    color: #FFFFFF;
}
.btn-primary:hover { background: #0077ED; box-shadow: 0 2px 8px rgba(0,113,227,0.3); }
.btn-primary:active { background: #006ADB; transform: scale(0.98); }

.btn-secondary {
    background: #F5F5F7;
    color: #1D1D1F;
}
.btn-secondary:hover { background: #E8E8ED; }

.btn-danger {
    background: #FF3B30;
    color: #FFFFFF;
}
.btn-danger:hover { background: #E0352B; }

.btn-success {
    background: #34C759;
    color: #FFFFFF;
}
.btn-success:hover { background: #2DB84E; }

.btn-ghost {
    background: transparent;
    color: #0071E3;
    padding: 8px 12px;
}
.btn-ghost:hover { background: rgba(0,113,227,0.08); }

.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: 8px; }
.btn-icon {
    width: 36px; height: 36px; padding: 0;
    border-radius: 10px; font-size: 16px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Tables ──────────────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table thead th {
    padding: 10px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: #8E8E93;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #E5E5EA;
    white-space: nowrap;
}

.data-table tbody td {
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid #F2F2F7;
    color: #1D1D1F;
    white-space: nowrap;
}

.data-table tbody tr {
    transition: background 0.15s ease;
}

.data-table tbody tr:hover {
    background: #FAFAFA;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ── Loading spinner ─────────────────────────────────────── */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #E5E5EA;
    border-top-color: #0071E3;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.spinner-lg { width: 40px; height: 40px; border-width: 4px; }

.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 0;
    gap: 12px;
    color: #8E8E93;
    font-size: 14px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Login page ──────────────────────────────────────────── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 24px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.login-logo {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #0071E3, #5856D6);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #FFFFFF;
    margin: 0 auto 20px;
}

/* ── POS cart ────────────────────────────────────────────── */
.cart-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #F2F2F7;
}

.cart-item:last-child { border-bottom: none; }

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 4px;
}

.cart-item-qty button {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1.5px solid #E5E5EA;
    background: #FFFFFF;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    color: #1D1D1F;
}

.cart-item-qty button:hover {
    border-color: #0071E3;
    color: #0071E3;
}

.cart-item-qty span {
    min-width: 24px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
}

/* ── Product grid (POS) ──────────────────────────────────── */
.product-grid-item {
    background: #FFFFFF;
    border: 1.5px solid #E5E5EA;
    border-radius: 14px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.product-grid-item:hover {
    border-color: #0071E3;
    box-shadow: 0 2px 12px rgba(0,113,227,0.12);
    transform: translateY(-2px);
}

.product-grid-item.out-of-stock {
    opacity: 0.5;
    cursor: not-allowed;
}



.product-grid-item .product-name {
    font-size: 13px;
    font-weight: 600;
    color: #1D1D1F;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-grid-item .product-price {
    font-size: 15px;
    font-weight: 700;
    color: #0071E3;
}

.product-grid-item .product-stock {
    font-size: 11px;
    color: #8E8E93;
    margin-top: 4px;
}

/* ── Receipt modal ───────────────────────────────────────── */
.receipt {
    border: 2px dashed #E5E5EA;
    border-radius: 12px;
    padding: 24px;
    font-size: 13px;
}

.receipt-header {
    text-align: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px dashed #E5E5EA;
}

.receipt-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
}

.receipt-divider {
    border-top: 1px dashed #E5E5EA;
    margin: 8px 0;
}

.receipt-total {
    font-size: 18px;
    font-weight: 700;
    color: #1D1D1F;
}

/* ── Confirm dialog ──────────────────────────────────────── */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.confirm-box {
    background: #FFFFFF;
    border-radius: 16px;
    padding: 28px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.confirm-box h3 {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 700;
    color: #1D1D1F;
}

.confirm-box p {
    color: #6E6E73;
    font-size: 14px;
    margin: 0 0 20px;
}

.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #8E8E93;
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 15px;
    margin: 0;
}

/* ── Category chips ──────────────────────────────────────── */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1.5px solid #E5E5EA;
    background: #FFFFFF;
    color: #6E6E73;
    transition: all 0.2s;
    white-space: nowrap;
}

.chip:hover { border-color: #0071E3; color: #0071E3; }

.chip.active {
    background: #0071E3;
    border-color: #0071E3;
    color: #FFFFFF;
}

/* ── Page header ─────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: -32px -32px 24px;
    padding: 24px 32px 16px;
    background: rgba(245, 245, 247, 0.9);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 30;
    flex-wrap: wrap;
    gap: 12px;
    border-bottom: 1px solid rgba(229, 229, 234, 0.5);
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #1D1D1F;
    margin: 0;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }

    .main-content {
        margin-left: 0;
        padding: 20px 16px;
        padding-bottom: 100px;
    }

    .main-content.expanded { margin-left: 0; }

    .page-header {
        margin: -20px -16px 20px;
        padding: 20px 16px 16px;
    }
    
    .card {
        padding: 16px;
    }
    
    .table-responsive {
        margin-left: -16px;
        margin-right: -16px;
        padding-left: 16px;
        padding-right: 16px;
    }

    .bottom-bar { display: block; }

    .page-header h1 { font-size: 22px; }

    .stat-card { padding: 16px; }
    .stat-value { font-size: 22px; }

    .modal { border-radius: 16px; }
    .login-card { padding: 32px 24px; }

    .card { padding: 16px; border-radius: 12px; }

    .data-table { font-size: 13px; }
    .data-table thead th { padding: 8px 10px; }
    .data-table tbody td { padding: 10px; }
}

@media (max-width: 480px) {
    .page-header { flex-direction: column; align-items: flex-start; }
}

/* ── Print ───────────────────────────────────────────────── */
@media print {
    body { background: #FFFFFF; }
    .sidebar, .bottom-bar, .toast-container, .no-print { display: none !important; }
    .main-content { margin-left: 0; padding: 0; }
    .receipt { border: none; }
}

/* ── Dark Mode ───────────────────────────────────────────── */
body.dark-theme {
    background: #000000;
    color: #F5F5F7;
}

/* Backgrounds and Borders */
body.dark-theme .card,
body.dark-theme .stat-card,
body.dark-theme .modal,
body.dark-theme .sidebar,
body.dark-theme .bottom-bar,
body.dark-theme .login-card,
body.dark-theme .product-grid-item,
body.dark-theme .confirm-box {
    background: #1C1C1E;
    color: #F5F5F7;
    border-color: #38383A;
}

body.dark-theme .login-card {
    background: rgba(28, 28, 30, 0.45);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .page-header {
    background: rgba(0, 0, 0, 0.9);
}

body.dark-theme .sidebar-header,
body.dark-theme .sidebar-footer,
body.dark-theme .modal-header,
body.dark-theme .modal-footer,
body.dark-theme .data-table thead th,
body.dark-theme .data-table tbody td,
body.dark-theme .cart-item,
body.dark-theme .receipt-header,
body.dark-theme .receipt-divider,
body.dark-theme .receipt-row {
    border-color: #38383A;
}

/* Text Colors */
body.dark-theme h1,
body.dark-theme h2,
body.dark-theme h3,
body.dark-theme h4,
body.dark-theme h5,
body.dark-theme h6,
body.dark-theme .stat-value,
body.dark-theme .modal-header h2,
body.dark-theme .data-table tbody td,
body.dark-theme .receipt-total,
body.dark-theme .confirm-box h3,
body.dark-theme .product-grid-item .product-name {
    color: #F5F5F7;
}

body.dark-theme .stat-label,
body.dark-theme .data-table thead th,
body.dark-theme .sidebar-nav a,
body.dark-theme .confirm-box p,
body.dark-theme .product-grid-item .product-stock {
    color: #A1A1A6;
}

/* Tailwind utility overrides (using !important to override inline tailwind classes if needed) */
body.dark-theme .text-apple-text { color: #F5F5F7 !important; }
body.dark-theme .text-apple-muted { color: #A1A1A6 !important; }

/* Stat Icons in dark mode (override inline styles) */
body.dark-theme .stat-icon[style*="color: #0071E3"] { background: rgba(0, 113, 227, 0.2) !important; color: #66b0ff !important; }
body.dark-theme .stat-icon[style*="color: #FF9F0A"] { background: rgba(255, 159, 10, 0.2) !important; color: #ffb84d !important; }
body.dark-theme .stat-icon[style*="color: #34C759"] { background: rgba(52, 199, 89, 0.2) !important; color: #6bdf8a !important; }
body.dark-theme .stat-icon[style*="color: #5856D6"] { background: rgba(88, 86, 214, 0.2) !important; color: #8a88e5 !important; }
body.dark-theme .empty-icon i,
body.dark-theme .empty-icon svg { color: #48484A !important; }

/* Interactive Elements */
body.dark-theme .chip {
    background: #1C1C1E;
    border-color: #38383A;
    color: #A1A1A6;
}
body.dark-theme .chip:hover {
    border-color: #0071E3;
    color: #0071E3;
}
body.dark-theme .chip.active {
    background: #0071E3;
    border-color: #0071E3;
    color: #FFFFFF;
}

body.dark-theme .bottom-bar a {
    color: #A1A1A6;
}
body.dark-theme .bottom-bar a.active,
body.dark-theme .bottom-bar a:hover {
    color: #0071E3;
}

body.dark-theme .sidebar-nav a:hover {
    background: #2C2C2E;
    color: #F5F5F7;
}
body.dark-theme .sidebar-nav a.active {
    color: #FFFFFF;
}

body.dark-theme .btn-secondary {
    background: #2C2C2E;
    color: #F5F5F7;
}
body.dark-theme .btn-secondary:hover {
    background: #3A3A3C;
}

body.dark-theme .form-input,
body.dark-theme .form-select {
    background: #1C1C1E;
    color: #F5F5F7;
    border-color: #38383A;
}

body.dark-theme .data-table tbody tr:hover {
    background: #2C2C2E;
}

body.dark-theme .modal-close {
    background: #2C2C2E;
    color: #F5F5F7;
}
body.dark-theme .modal-close:hover {
    background: #3A3A3C;
}

/* ═══════════════════════════════════════════════════════════
   Credit / Debtors Page
   ═══════════════════════════════════════════════════════════ */

/* ── Tab navigation ─────────────────────────────────────── */
.credit-tabs {
    display: flex;
    gap: 4px;
    background: #F2F2F7;
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 24px;
}

.credit-tab {
    flex: 1;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    border: none;
    background: transparent;
    color: #6E6E73;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.credit-tab:hover {
    color: #1D1D1F;
}

.credit-tab.active {
    background: #FFFFFF;
    color: #1D1D1F;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
}

/* ── Credit status badges ───────────────────────────────── */
.badge-pending { background: #FFF3E0; color: #E65100; }
.badge-pending .badge-dot { background: #FF9F0A; }

.badge-partial { background: #E3F2FD; color: #1565C0; }
.badge-partial .badge-dot { background: #2196F3; }

.badge-overdue { background: #FEE9E7; color: #C5221F; }
.badge-overdue .badge-dot { background: #FF3B30; }

.badge-paid { background: #E8F8ED; color: #1B7A3D; }
.badge-paid .badge-dot { background: #34C759; }

/* ── Credit nav badge ───────────────────────────────────── */
.credit-nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    background: #FF3B30;
    color: #FFFFFF;
    font-size: 11px;
    font-weight: 700;
    padding: 0 6px;
    margin-left: auto;
    line-height: 1;
}

/* ── Notification items ─────────────────────────────────── */
.notification-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border-radius: 12px;
    background: #FFFFFF;
    border: 1.5px solid #E5E5EA;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.notification-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transform: translateY(-1px);
}

.notification-item.urgency-overdue {
    border-color: #FF3B30;
    background: #FFF5F5;
}

.notification-item.urgency-today {
    border-color: #FF9F0A;
    background: #FFFBF0;
}

.notification-item.urgency-upcoming {
    border-color: #E5E5EA;
}

.notification-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-icon.icon-overdue {
    background: rgba(255, 59, 48, 0.12);
    color: #FF3B30;
}

.notification-icon.icon-today {
    background: rgba(255, 159, 10, 0.12);
    color: #FF9F0A;
}

.notification-icon.icon-upcoming {
    background: rgba(0, 113, 227, 0.12);
    color: #0071E3;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-size: 14px;
    font-weight: 600;
    color: #1D1D1F;
    margin-bottom: 2px;
}

.notification-subtitle {
    font-size: 12px;
    color: #8E8E93;
}

.notification-amount {
    font-size: 16px;
    font-weight: 700;
    color: #1D1D1F;
    text-align: right;
    white-space: nowrap;
}

.notification-due {
    font-size: 11px;
    font-weight: 600;
    text-align: right;
    margin-top: 2px;
}

.notification-due.due-overdue { color: #FF3B30; }
.notification-due.due-today { color: #FF9F0A; }
.notification-due.due-upcoming { color: #0071E3; }

/* ── Credit sale card ───────────────────────────────────── */
.credit-card {
    background: #FFFFFF;
    border-radius: 14px;
    padding: 20px;
    border: 1.5px solid #E5E5EA;
    transition: all 0.2s ease;
    cursor: pointer;
}

.credit-card:hover {
    border-color: #0071E3;
    box-shadow: 0 4px 12px rgba(0,113,227,0.08);
    transform: translateY(-1px);
}

.credit-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.credit-card-customer {
    font-size: 15px;
    font-weight: 600;
    color: #1D1D1F;
}

.credit-card-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.credit-card-label {
    font-size: 11px;
    color: #8E8E93;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.credit-card-value {
    font-size: 14px;
    font-weight: 600;
    color: #1D1D1F;
}

.credit-card-progress {
    height: 6px;
    background: #F2F2F7;
    border-radius: 3px;
    overflow: hidden;
}

.credit-card-progress-bar {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, #34C759, #30D158);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Customer card ──────────────────────────────────────── */
.customer-card {
    background: #FFFFFF;
    border-radius: 14px;
    padding: 20px;
    border: 1.5px solid #E5E5EA;
    transition: all 0.2s ease;
    cursor: pointer;
}

.customer-card:hover {
    border-color: #0071E3;
    box-shadow: 0 4px 12px rgba(0,113,227,0.08);
    transform: translateY(-1px);
}

.customer-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #0071E3, #5856D6);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    flex-shrink: 0;
}

/* ── Repayment timeline ─────────────────────────────────── */
.timeline {
    position: relative;
    padding-left: 28px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: #E5E5EA;
    border-radius: 1px;
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -24px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #0071E3;
    border: 2px solid #FFFFFF;
    box-shadow: 0 0 0 2px #E5E5EA;
}

.timeline-item:first-child .timeline-dot {
    background: #34C759;
}

.timeline-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.timeline-amount {
    font-size: 15px;
    font-weight: 700;
    color: #34C759;
}

.timeline-date {
    font-size: 12px;
    color: #8E8E93;
    margin-top: 2px;
}

.timeline-method {
    font-size: 12px;
    color: #8E8E93;
}

/* ── Filter chips for credit ────────────────────────────── */
.filter-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

/* ── Credit detail panel ────────────────────────────────── */
.detail-section {
    padding: 20px 0;
    border-bottom: 1px solid #F2F2F7;
}

.detail-section:last-child {
    border-bottom: none;
}

.detail-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #8E8E93;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

/* ── Dark Mode — Credit ─────────────────────────────────── */
body.dark-theme .credit-tabs {
    background: #2C2C2E;
}

body.dark-theme .credit-tab {
    color: #A1A1A6;
}

body.dark-theme .credit-tab:hover {
    color: #F5F5F7;
}

body.dark-theme .credit-tab.active {
    background: #1C1C1E;
    color: #F5F5F7;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

body.dark-theme .credit-card,
body.dark-theme .customer-card,
body.dark-theme .notification-item {
    background: #1C1C1E;
    border-color: #38383A;
}

body.dark-theme .credit-card:hover,
body.dark-theme .customer-card:hover {
    border-color: #0071E3;
}

body.dark-theme .credit-card-customer,
body.dark-theme .credit-card-value,
body.dark-theme .notification-title,
body.dark-theme .notification-amount {
    color: #F5F5F7;
}

body.dark-theme .notification-item.urgency-overdue {
    background: rgba(255, 59, 48, 0.08);
    border-color: rgba(255, 59, 48, 0.3);
}

body.dark-theme .notification-item.urgency-today {
    background: rgba(255, 159, 10, 0.08);
    border-color: rgba(255, 159, 10, 0.3);
}

body.dark-theme .credit-card-progress {
    background: #2C2C2E;
}

body.dark-theme .timeline::before {
    background: #38383A;
}

body.dark-theme .timeline-dot {
    border-color: #1C1C1E;
    box-shadow: 0 0 0 2px #38383A;
}

body.dark-theme .detail-section {
    border-color: #38383A;
}

