:root {
    --color-success: #10B981;
    --color-primary: #2563EB;
    --color-neutral: #94A3B8;
    --color-danger: #EF4444;
    --color-warning: #F59E0B;
    --color-bg: #EFF6FF;
    --color-card-bg: #FFFFFF;

    --bg-color: var(--color-bg);
    --card-bg: var(--color-card-bg);
    --primary-color: var(--color-primary);
    --primary-hover: #1D4ED8;
    --text-main: #111827;
    --text-muted: #6B7280;
    --danger-color: var(--color-danger);
    --danger-hover: #DC2626;
    --success-color: var(--color-success);
    --warning-bg: #FEF3C7;
    --warning-text: #92400E;
    
    --border-color: #E5E7EB;
    --input-border: #D1D5DB;
    
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    
    --border-radius-lg: 16px;
    --border-radius-md: 10px;
    --border-radius-sm: 6px;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, #DBEAFE 0%, #BFDBFE 100%);
    background-attachment: fixed;
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    padding-bottom: 40px; /* Mobile bottom padding */
    min-height: 100vh;
}

/* Typography Utilities */
h1, h2, h3, h4, h5, h6 {
    color: #1E293B;
    font-weight: 600;
}
.fw-bold { font-weight: 700; }
.text-danger { color: var(--danger-color); }
.text-success { color: var(--success-color); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.875rem; }

/* Large Numbers for Money */
.debt-amount, #total-debt-amount, #detail-point-debt {
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    font-weight: 700;
}

/* Layout Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}
.d-flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.align-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.mr-3 { margin-right: 16px; }
.m-0 { margin: 0 !important; }
.prognoz-date-range { flex-shrink: 0; }
.kassa-daftar-col { flex: 1 1 260px; min-width: 240px; padding: 16px; display: flex; flex-direction: column; }
/* Jadval ichidagi bo'sh "spacer" qatori qolgan bo'sh joyni egallaydi —
   shu tufayli jami (tfoot) qatorlari ikkala ustunda ham doim pastda tekis turadi */
.kassa-table { height: 100%; }
.kassa-table .kassa-spacer-row { height: 100%; }
.kassa-table tfoot tr:first-child td { border-top: 2px solid rgba(0,0,0,0.15); }
@media (max-width: 640px) {
    .kassa-toolbar { justify-content: center !important; }
}
@media (max-width: 768px) {
    .prognoz-chart-header { flex-direction: column; align-items: stretch !important; }
    .prognoz-chart-header .prognoz-date-range { justify-content: flex-end; }
}

/* Navigation */
.top-nav {
    background-color: var(--card-bg);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-brand {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #2563EB 0%, #7C3AED 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: var(--primary-color); /* fallback, agar gradient qo'llab-quvvatlanmasa */
}
#user-name-display {
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #2563EB 0%, #7C3AED 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: var(--primary-color); /* fallback, agar gradient qo'llab-quvvatlanmasa */
}
.nav-actions {
    display: flex;
    align-items: center;
}

/* Cards */
.card, .widget-card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
}
.widget-header, .list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

/* Login Container */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 16px;
}
.login-card {
    background: var(--card-bg);
    width: 100%;
    max-width: 400px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 32px 24px;
}
.login-header {
    text-align: center;
    margin-bottom: 24px;
}
.login-header h1 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}
.login-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: #374151;
}
input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
select.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius-md);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s ease;
    background-color: #F9FAFB;
}
input:focus,
select.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.form-row {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
@media (min-width: 768px) {
    .form-row {
        flex-direction: row;
        align-items: flex-end;
    }
    .form-group.flex-fill {
        flex: 1;
        margin-bottom: 0;
    }
    .form-group-btn {
        margin-bottom: 0;
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    min-height: 44px;
    font-family: inherit;
    text-align: center;
    white-space: nowrap;
}
.btn-primary { background: #2563EB; color: white; }
.btn-primary:hover { background: #1D4ED8; }
.btn-primary-outline { background: white; color: #2563EB; border: 1.5px solid #2563EB; }
.btn-primary-outline:hover:not(:disabled) { background: #EFF6FF; }
.btn-danger-outline { background: white; color: #EF4444; border: 1.5px solid #EF4444; }
.btn-danger-outline:hover:not(:disabled) { background: #FEF2F2; color: #DC2626; }
.btn-success-outline { background: white; color: #10B981; border: 1.5px solid #10B981; }
.btn-success-outline:hover:not(:disabled) { background: #ECFDF5; }
.btn-warning-outline { background: white; color: #F59E0B; border: 1.5px solid #F59E0B; }
.btn-warning-outline:hover:not(:disabled) { background: #FFFBEB; }
.btn-outline { background: white; color: #475569; border: 1.5px solid #E2E8F0; }
.btn-outline:hover:not(:disabled) { background: #F8FAFC; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; min-height: 32px; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-block { width: 100%; }

/* Alerts and Messages */
.alert, .error-message {
    padding: 12px 16px;
    border-radius: var(--border-radius-md);
    margin-bottom: 16px;
    font-size: 0.95rem;
}
.alert-danger, .error-message {
    background-color: #FEF2F2;
    color: #991B1B;
    border: 1px solid #F87171;
}
.alert-warning {
    background-color: var(--warning-bg);
    color: var(--warning-text);
    border: 1px solid #FCD34D;
}

/* Dealer / Point Cards (Grid) */
.dealers-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}
@media (min-width: 768px) {
    .dealers-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}
.dealer-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--color-success);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.dealer-card.has-debt {
    border-left-color: var(--color-danger);
}
.dealer-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.dealer-info h3 {
    margin-bottom: 4px;
    font-size: 1.1rem;
}
.dealer-finances {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px dashed var(--border-color);
    margin-top: 12px;
}
.assistant-box {
    background: #F8FAFC;
    border: 1px dashed #CBD5E1;
    padding: 10px 12px;
    border-radius: 8px;
    max-width: 100%;
    box-sizing: border-box;
}
.debt-label {
    font-size: 0.9rem;
    color: var(--text-muted);
}
.debt-amount {
    font-weight: 700;
    font-size: 1.1rem;
}

/* Card States */
.dealer-card.frozen {
    background-color: #F3F4F6;
    border-color: #D1D5DB;
    border-left-color: var(--color-neutral);
    opacity: 0.85;
}
.dealer-card.deleted-card {
    background-color: #F9FAFB;
    border-color: #E5E7EB;
    opacity: 0.7;
    filter: grayscale(80%);
}

/* Progress Bar Widget */
.progress-bar-container {
    width: 100%;
    height: 10px;
    background-color: #E5E7EB;
    border-radius: 20px;
    overflow: hidden;
    margin-top: 12px;
}
.progress-bar {
    height: 100%;
    border-radius: 20px;
    transition: width 0.5s ease;
    width: 0%;
}
.progress-bar.bg-green { background: linear-gradient(90deg, #10B981, #34D399); }
.progress-bar.bg-yellow { background: linear-gradient(90deg, #F59E0B, #FBBF24); }
.progress-bar.bg-red { background: linear-gradient(90deg, #EF4444, #F87171); }

/* Modals */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(17, 24, 39, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
    animation: fadeIn 0.3s ease;
}
.modal-content {
    background-color: var(--card-bg);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: slideUp 0.3s ease;
}
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}
.modal-body {
    padding: 24px;
}
.modal-footer {
    padding: 16px 24px;
    background-color: #F9FAFB;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}
.credentials-box {
    background-color: #F3F4F6;
    padding: 16px;
    border-radius: var(--border-radius-md);
    margin-top: 16px;
    border: 1px dashed var(--input-border);
}
.credentials-box p {
    margin-bottom: 8px;
}
.credentials-box p:last-child {
    margin-bottom: 0;
}
.selectable-text {
    user-select: all;
    background-color: #E5E7EB;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 1.1rem;
}

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

/* Empty, Loading, Error States */
.loading-state, .empty-state, .error-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 1rem;
    grid-column: 1 / -1; /* For grid layouts */
}
.error-state {
    color: var(--danger-color);
}

/* Search Box */
.search-box {
    width: 100%;
    max-width: 300px;
}
.search-box input {
    margin: 0;
}
@media (max-width: 767px) {
    .search-box {
        margin-top: 12px;
        max-width: 100%;
    }
}

/* Table styling and responsiveness */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    border-radius: var(--border-radius-md);
}
.table {
    min-width: 600px;
    width: 100%;
    border-collapse: collapse;
}
.table th, .table td {
    border-bottom: 1px solid var(--border-color);
    padding: 12px;
}
.table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background-color: #F9FAFB;
}
.table tr:last-child td {
    border-bottom: none;
}

/* Deleted details accordion */
.deleted-points-details summary {
    cursor: pointer;
    padding: 8px 0;
    user-select: none;
    color: var(--text-main);
    outline: none;
}
.deleted-points-details summary:hover {
    color: var(--primary-color);
}

/* Mobile Responsiveness for Tables and Point Details */
@media (max-width: 640px) {
    .table { min-width: 0; }
    .table thead { display: none; }
    .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
    .table tr { 
        margin-bottom: 16px; 
        border: 1px solid #e5e7eb; 
        border-radius: 14px; 
        padding: 12px; 
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    }
    .table td { 
        display: flex; 
        justify-content: space-between; 
        align-items: center; 
        padding: 8px 4px; 
        border: none; 
        text-align: right;
    }
    .table td::before { 
        content: attr(data-label); 
        font-weight: 600; 
        color: #64748b; 
        text-align: left;
        margin-right: 12px;
    }
    .table td.action-required { 
        justify-content: flex-end; 
        gap: 8px; 
    }
    
    #view-point-details .d-flex.justify-between {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    #view-point-details .d-flex.justify-between > button {
        width: 100%;
    }
    #detail-point-name {
        font-size: 1.3rem;
        margin-bottom: 4px;
    }
    .debt-display {
        text-align: left;
    }
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-block;
}
.badge-success { background: var(--color-success); color: white; }
.badge-danger { background: var(--color-danger); color: white; }

/* Loader Overlay */
#global-loader {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(3px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
.loader-box {
    background: white;
    padding: 28px 36px;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.loader-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #E2E8F0;
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader-text {
    font-weight: 600;
    color: #334155;
    margin: 0;
}

/* Dealers List View */
.dealers-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.dealer-list-item {
    background-color: var(--card-bg);
    padding: 8px 12px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    cursor: pointer;
}
.dealer-list-item:hover {
    background-color: #f8fafc;
}
.dealer-list-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}
.dealer-list-name {
    font-weight: 600;
    font-size: 0.95rem;
}
.dealer-list-location {
    color: var(--text-muted);
    font-size: 0.9rem;
}
.dealer-list-right {
    display: flex;
    align-items: center;
    gap: 24px;
}
.dealer-list-debt {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.95rem;
}
.dealer-list-date {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Custom Grid layout for Savdo nuqtalari */
.savdo-grid-card {
    background: #fff;
    border-radius: 12px;
    border-left: 5px solid #10B981;
    padding: 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}
.savdo-grid-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.savdo-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.savdo-card-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
}
.savdo-card-date {
    font-size: 0.75rem;
    color: #64748b;
}
.savdo-card-location {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-top: 4px;
}
.savdo-card-footer {
    margin-top: 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    border-top: 1px dashed #e2e8f0;
    padding-top: 12px;
}
.savdo-card-debt-label {
    font-size: 0.85rem;
    color: #94a3b8;
}
.savdo-card-debt-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
}

/* ============================================
   SAVDO NUQTALARI — iOS-Style Premium Toolbar
   ============================================ */

.savdo-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 20px;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 18px;
    box-shadow: 0 4px 24px rgba(37, 99, 235, 0.08), 0 1px 4px rgba(0,0,0,0.04);
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.savdo-toolbar-left {
    display: flex;
    align-items: center;
}
.savdo-toolbar-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

/* Savdo nuqtalari / Taminotchilar almashtirgichi — ikkala ro'yxat hech qachon
   bir vaqtda ko'rinmaydi, shuning uchun aralashib ketmaydi */
.kind-switch {
    display: inline-flex;
    background: #f1f5f9;
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
}
.kind-switch-btn {
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 9px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.kind-switch-btn:hover { color: #0f172a; }
.kind-switch-btn.active {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.kind-switch-btn[data-kind="taminotchi"].active { color: #6d28d9; }
.kind-switch-btn[data-kind="nuqta"].active { color: #1d4ed8; }

.savdo-toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Search */
.savdo-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.savdo-search-icon {
    position: absolute;
    left: 12px;
    width: 16px;
    height: 16px;
    color: #94a3b8;
    pointer-events: none;
}
.savdo-search-input {
    width: 200px;
    padding: 9px 14px 9px 38px !important;  /* icon uchun left padding */
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 50px !important;
    font-size: 0.88rem;
    background: #f8fafc !important;
    color: #0f172a;
    transition: all 0.2s ease;
    outline: none;
    font-family: inherit;
    box-shadow: none !important;
}
.savdo-search-input:focus {
    border-color: #2563eb !important;
    background: #fff !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12) !important;
    width: 240px;
}
.savdo-search-input::placeholder {
    color: #94a3b8;
}

/* iOS Segmented Control */
.savdo-segment-ctrl {
    display: flex;
    background: #f1f5f9;
    border-radius: 50px;
    padding: 3px;
    gap: 2px;
    border: 1px solid #e2e8f0;
}
.savdo-segment-ctrl input[type="radio"] {
    display: none;
}
.savdo-segment-label {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.82rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    white-space: nowrap;
}
.savdo-segment-ctrl input[type="radio"]:checked + .savdo-segment-label {
    background: #fff;
    color: #2563eb;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15), 0 1px 2px rgba(0,0,0,0.06);
    font-weight: 600;
}
.savdo-segment-label:hover {
    color: #1e293b;
}

/* Sort */
.savdo-sort-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 50px;
    padding: 7px 14px;
    color: #64748b;
    transition: border-color 0.2s;
}
.savdo-sort-wrap:focus-within {
    border-color: #2563eb;
}
.savdo-sort-select {
    border: none;
    background: transparent;
    font-size: 0.85rem;
    font-weight: 500;
    color: #334155;
    outline: none;
    cursor: pointer;
    font-family: inherit;
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
}

@media (max-width: 767px) {
    .savdo-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px 14px;
    }
    .savdo-toolbar-right {
        flex-direction: column;
        align-items: stretch;
    }
    .savdo-search-input {
        width: 100%;
    }
    .savdo-search-input:focus {
        width: 100%;
    }
}

/* ---------------------------------
   MODERN UI — Fullscreen Modal
------------------------------------ */
.modern-modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(8, 15, 30, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 1050;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding: 0;
    transition: opacity 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    opacity: 0;
    pointer-events: none;
}
.modern-modal.show {
    opacity: 1;
    pointer-events: auto;
}

.modern-modal-content {
    background: #0d1526;
    width: 100%;
    max-width: 100%;
    height: 96vh;
    border-radius: 20px 20px 0 0;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -8px 48px rgba(0,0,0,0.5);
    border-top: 1px solid rgba(255,255,255,0.08);
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.modern-modal.show .modern-modal-content {
    transform: translateY(0);
}

@media (min-width: 768px) {
    .modern-modal {
        align-items: center;
        padding: 12px;
    }
    .modern-modal-content {
        height: 96vh;
        max-width: 1400px;
        border-radius: 20px;
        border: 1px solid rgba(255,255,255,0.08);
        transform: translateY(40px) scale(0.98);
    }
    .modern-modal.show .modern-modal-content {
        transform: translateY(0) scale(1);
    }
}

.modern-modal-header {
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    color: #f8fafc;
}

.modern-btn-icon {
    background: rgba(255,255,255,0.1);
    border: none;
    color: #f1f5f9;
    font-size: 1.25rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}
.modern-btn-icon:hover {
    background: rgba(255,255,255,0.2);
}

.modern-date-picker {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.05);
    padding: 8px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
}
.modern-date-picker input {
    background: transparent;
    border: none;
    color: #f1f5f9;
    outline: none;
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
}
.modern-date-picker input::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

.modern-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    -webkit-overflow-scrolling: touch;
}

.modern-table-container {
    width: 100%;
}
.modern-table {
    width: 100%;
    border-collapse: collapse;
    color: #e2e8f0;
}
.modern-table th {
    padding: 14px 16px;
    font-weight: 500;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    position: sticky;
    top: 0;
    background: #0f172a;
    z-index: 2;
    text-align: left;
}
.modern-table td {
    padding: 14px 16px;
    font-size: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.02);
}
.modern-table tbody tr:hover {
    background: rgba(255,255,255,0.02);
}
.modern-table tfoot th, .modern-table tfoot td {
    position: sticky;
    bottom: 0;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 1.1rem;
}

/* Common text colors for positive/negative */
.text-green-500 { color: #22c55e !important; }
.text-red-500 { color: #ef4444 !important; }
.text-slate-400 { color: #94a3b8 !important; }

/* Filter Dropdown */
.modern-filter {
    position: relative;
    display: inline-block;
}
.modern-filter-btn {
    background: rgba(30, 41, 59, 0.7);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
    color: #f1f5f9;
    padding: 8px 16px;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    user-select: none;
}
.modern-filter-btn:hover {
    background: rgba(30, 41, 59, 0.9);
}
.modern-filter-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 8px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 8px;
    min-width: 220px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    display: none;
    flex-direction: column;
    gap: 4px;
}
.modern-filter-dropdown.show {
    display: flex;
}
.modern-filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    color: #cbd5e1;
    transition: background 0.2s;
    font-size: 0.9rem;
}
.modern-filter-item:hover {
    background: rgba(255,255,255,0.05);
}
.modern-filter-item input[type="checkbox"] {
    accent-color: #38bdf8;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Sorting */
.sortable-th {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 25px !important;
}
.sortable-th:hover {
    background: rgba(255,255,255,0.03);
}
.sort-icon {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    opacity: 0.3;
    transition: opacity 0.2s;
}
.sort-icon.active {
    opacity: 1;
}
.sort-icon svg {
    width: 16px;
    height: 16px;
    fill: #22c55e;
}
.sort-icon.asc .svg-down { opacity: 0.3; }
.sort-icon.desc .svg-up { opacity: 0.3; }

/* Balans Taqsimoti: qator saqlangandan keyin qisqa yaltillash animatsiyasi */
@keyframes breakdownRowSaved {
    0% { background-color: rgba(16, 185, 129, 0.28); }
    100% { background-color: transparent; }
}
.breakdown-row-saved {
    animation: breakdownRowSaved 1s ease-out;
}
.breakdown-row:hover {
    background-color: rgba(255, 255, 255, 0.05);
}
