*, *::before, *::after {
            box-sizing: border-box;
        }

        html {
            -webkit-text-size-adjust: 100%;
        }

        :root {
            --primary-color: #0ea5e9;
            --secondary-color: #0284c7;
            --sidebar-bg: #0f172a;
            --sidebar-bg-soft: #1e293b;
            --accent-color: #f5a524;
            --accent-color-soft: #fde8c2;
            --dark-color: #0f172a;
            --light-color: #f1f5f9;
            --success-color: #1f9d55;
            --danger-color: #e5484d;
            --warning-color: #f5a524;
            --font-display: 'Noto Kufi Arabic', 'Noto Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
            --font-body: 'Noto Sans Arabic', 'Noto Kufi Arabic', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

        /* دڵنیابوونەوە لەوەی هەموو ئێلیمێنتەکان (تایبەتی خانەکانی فۆرم و دوگمەکان)
           هەمان فۆنتی نووسین بەکاردەهێنن، تەنانەت ئەگەر لە هەندێک براوسەر
           فۆنتی وێبی Google Fonts یان Bootstrap بە دواکەوتوویی/شکستدا بارببێت */
        html, body, input, textarea, select, button,
        .form-control, .btn, .form-label, .form-text,
        .modal, .card, .result-item, .history-record-card {
            font-family: var(--font-body);
        }

        body {
            font-family: var(--font-body);
            background-color: var(--light-color);
            color: var(--dark-color);
            min-height: 100vh;
            overflow-x: hidden;
            width: 100%;
        }

        /* ===== App shell (sidebar + main) ===== */
        .app-shell {
            display: flex;
            min-height: 100vh;
            align-items: stretch;
        }

        .app-sidebar {
            width: 76px;
            flex-shrink: 0;
            background: var(--sidebar-bg);
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 26px;
            padding: 20px 0;
            position: sticky;
            top: 0;
            height: 100vh;
        }

        .app-sidebar-logo {
            width: 40px;
            height: 40px;
            border-radius: 12px;
            background: var(--sidebar-bg-soft);
            color: var(--primary-color);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.05rem;
        }

        .app-sidebar-nav {
            display: flex;
            flex-direction: column;
            gap: 12px;
            flex: 1;
        }

        .app-sidebar-icon {
            width: 42px;
            height: 42px;
            border-radius: 12px;
            border: none;
            background: transparent;
            color: rgba(255,255,255,0.45);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.05rem;
            cursor: pointer;
            transition: background 0.2s, color 0.2s;
        }

        .app-sidebar-icon:hover:not(:disabled) {
            background: rgba(255,255,255,0.08);
            color: #fff;
        }

        .app-sidebar-icon.active {
            background: var(--primary-color);
            color: #fff;
        }

        .app-sidebar-icon:disabled {
            cursor: not-allowed;
            opacity: 0.35;
        }

        .app-sidebar-icon.add-btn {
            background: rgba(14, 165, 233, 0.14);
            color: var(--primary-color);
            margin-bottom: 6px;
        }

        .app-sidebar-icon.add-btn:hover {
            background: var(--primary-color);
            color: #fff;
        }

        .app-sidebar-icon.logout:hover {
            background: var(--danger-color);
            color: #fff;
        }

        .app-main {
            flex: 1;
            min-width: 0;
        }

        .app-main-inner {
            max-width: 1100px;
            margin: 0 auto;
            padding: 2.5rem 2rem 3.5rem;
        }

        .app-page-header {
            margin-bottom: 1.5rem;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            flex-wrap: wrap;
        }

        .app-page-header h1 {
            font-size: 1.4rem;
            font-weight: 800;
            margin: 0;
            color: var(--dark-color);
            order: 1;
        }

        .app-page-header .brand-eyebrow {
            order: 2;
        }

        /* ===== Stats row ===== */
        .stats-row {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 14px;
            margin-bottom: 1.75rem;
        }

        .stat-card {
            background: #ffffff;
            border: 1px solid #e6eaf2;
            border-radius: 16px;
            padding: 14px 16px;
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .stat-icon {
            width: 38px;
            height: 38px;
            flex-shrink: 0;
            border-radius: 11px;
            background: rgba(14, 165, 233, 0.12);
            color: var(--primary-color);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.95rem;
        }

        .stat-icon.danger {
            background: rgba(229, 72, 77, 0.12);
            color: var(--danger-color);
        }

        .stat-icon.success {
            background: rgba(31, 157, 85, 0.12);
            color: var(--success-color);
        }

        .stat-label {
            font-size: 0.72rem;
            color: #8a8f9c;
            margin-bottom: 2px;
        }

        .stat-value {
            font-size: 1.05rem;
            font-weight: 800;
            color: var(--dark-color);
        }

        .stat-value.danger { color: var(--danger-color); }
        .stat-value.success { color: var(--success-color); }

        /* ===== Login Screen ===== */
        #loginOverlay {
            position: fixed;
            inset: 0;
            z-index: 2000;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
            background:
                radial-gradient(circle at 15% 20%, rgba(14, 165, 233, 0.35), transparent 45%),
                radial-gradient(circle at 85% 80%, rgba(245, 165, 36, 0.25), transparent 45%),
                linear-gradient(160deg, #0c0f1e, #171d3a 55%, #0c0f1e);
        }

        .login-card {
            width: 100%;
            max-width: 400px;
            background: rgba(255, 255, 255, 0.98);
            border-radius: 20px;
            box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
            overflow: hidden;
            animation: cardEnter 0.5s ease;
        }

        .login-card .login-header {
            background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
            color: #fff;
            text-align: center;
            padding: 2.2rem 1.5rem 1.8rem;
        }

        .login-card .login-header .login-logo {
            width: 60px;
            height: 60px;
            margin: 0 auto 14px;
            border-radius: 50%;
            background: rgba(255,255,255,0.14);
            border: 1px solid rgba(255,255,255,0.3);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.6rem;
        }

        .login-card .login-header h3 {
            margin: 0;
            font-weight: 800;
            font-size: 1.3rem;
        }

        .login-card .login-header p {
            margin: 6px 0 0;
            font-size: 0.8rem;
            color: rgba(255,255,255,0.75);
        }

        .login-card .login-body {
            padding: 2rem 1.75rem 1.75rem;
        }

        .login-card .form-label {
            font-weight: 600;
            font-size: 0.9rem;
        }

        .login-card .btn-login {
            background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
            color: #fff;
            border: none;
            font-weight: 700;
            padding: 12px;
            border-radius: 10px;
            width: 100%;
            margin-top: 8px;
            transition: all 0.3s;
        }

        .login-card .btn-login:hover {
            filter: brightness(1.08);
            color: #fff;
        }

        .login-error {
            display: none;
            background: rgba(229, 72, 77, 0.1);
            color: var(--danger-color);
            border: 1px solid rgba(229, 72, 77, 0.25);
            border-radius: 10px;
            padding: 10px 14px;
            font-size: 0.85rem;
            margin-bottom: 14px;
            text-align: center;
        }

        .login-input-group {
            position: relative;
        }

        .login-input-group i.field-icon {
            position: absolute;
            top: 50%;
            right: 14px;
            transform: translateY(-50%);
            color: #9aa2c0;
        }

        .login-input-group input {
            padding-right: 40px;
        }

        h1, h2, h3, h4, h5, h6, .card-header, .section-title, .receipt-brand, .receipt-title h2 {
            font-family: var(--font-display);
        }
        
        .card {
            border-radius: 18px;
            box-shadow: 0 20px 45px rgba(15, 23, 42, 0.06);
            border: 1px solid #e6eaf2;
            overflow: hidden;
            animation: cardEnter 0.5s ease;
        }

        @keyframes cardEnter {
            from { opacity: 0; transform: translateY(16px); }
            to { opacity: 1; transform: translateY(0); }
        }

        @media (prefers-reduced-motion: reduce) {
            .card { animation: none; }
        }
        
        .card-header {
            position: relative;
            background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
            color: white;
            padding: 2.1rem 1.5rem 1.9rem;
            border-bottom: none;
            text-align: center;
            letter-spacing: 0.3px;
        }

        .card-header .brand-eyebrow {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            font-family: var(--font-body);
            font-size: 0.68rem;
            font-weight: 700;
            letter-spacing: 2.5px;
            text-transform: uppercase;
            color: rgba(255,255,255,0.7);
            background: rgba(255,255,255,0.12);
            padding: 5px 14px;
            border-radius: 20px;
            margin-bottom: 14px;
        }

        .card-header .header-icon-badge {
            width: 46px;
            height: 46px;
            margin: 0 auto 12px;
            border-radius: 50%;
            background: rgba(255,255,255,0.14);
            border: 1px solid rgba(255,255,255,0.25);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.2rem;
        }

        .card-header h3 {
            margin: 0;
            font-weight: 800;
            font-size: 1.35rem;
        }

        .card-body {
            padding: 1.75rem !important;
        }

        .app-page-header .brand-eyebrow {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            font-size: 0.68rem;
            font-weight: 700;
            letter-spacing: 2.5px;
            text-transform: uppercase;
            color: var(--primary-color);
            background: rgba(14, 165, 233, 0.1);
            padding: 5px 14px;
            border-radius: 20px;
        }
        
        .result-container {
            background-color: white;
            border-radius: 18px;
            padding: 25px;
            margin-top: 20px;
            box-shadow: 0 12px 30px rgba(18, 23, 43, 0.08);
            border: 1px solid #eef0f6;
            display: none;
        }
        
        .result-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 12px 15px;
            margin-bottom: 10px;
            background-color: var(--light-color);
            border-radius: 10px;
            transition: all 0.3s;
        }
        
        .result-item:hover {
            background-color: #e9ecf7;
            transform: translateX(-5px);
        }
        
        .result-label {
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        .result-value {
            font-weight: 700;
        }
        
        .total-value {
            color: var(--primary-color);
            font-size: 1.3rem;
            background-color: rgba(14, 165, 233, 0.1);
            padding: 8px 15px;
            border-radius: 10px;
        }
        
        .dollar-value {
            color: var(--success-color);
            background-color: rgba(31, 157, 85, 0.1);
            padding: 4px 8px;
            border-radius: 6px;
        }
        
        .debt-value {
            color: var(--danger-color);
            background-color: rgba(229, 72, 77, 0.1);
            padding: 4px 8px;
            border-radius: 6px;
            font-weight: 800;
        }
        
        .balance-value {
            color: var(--secondary-color);
            background-color: rgba(31, 47, 158, 0.1);
            padding: 4px 8px;
            border-radius: 6px;
        }
        
        .success-message {
            background: linear-gradient(135deg, rgba(31, 157, 85, 0.12), rgba(31, 157, 85, 0.05));
            color: #146638;
            border-radius: 15px;
            padding: 20px;
            margin-top: 20px;
            text-align: center;
            border: 1px solid rgba(31, 157, 85, 0.2);
        }
        
        .whatsapp-btn {
            background-color: #25D366;
            color: white;
            border: none;
            padding: 12px;
            border-radius: 10px;
            font-weight: 600;
            width: 100%;
            margin-top: 20px;
            transition: all 0.3s;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }
        
        .whatsapp-btn:hover {
            background-color: #128C7E;
            transform: translateY(-2px);
            box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        }
        
        .section-title {
            position: relative;
            padding-right: 44px;
            margin-bottom: 22px;
            color: var(--dark-color);
            font-weight: 700;
            font-size: 1.15rem;
        }
        
        .section-title .step {
            position: absolute;
            right: 0;
            top: -6px;
            background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
            box-shadow: 0 4px 10px rgba(14, 165, 233, 0.35);
            color: white;
            width: 32px;
            height: 32px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.9rem;
            font-family: var(--font-body);
            font-weight: 700;
        }
        
        .form-label {
            font-weight: 600;
            margin-bottom: 8px;
            display: flex;
            align-items: center;
            gap: 8px;
            color: var(--dark-color);
        }

        .form-control {
            border-radius: 10px;
            border: 1px solid #e0e3ec;
            padding: 10px 14px;
        }

        .form-control:focus {
            border-color: var(--primary-color);
            box-shadow: 0 0 0 0.2rem rgba(14, 165, 233, 0.15);
        }
        
        .optional-badge {
            background-color: #eef0f6;
            color: #6c757d;
            font-size: 0.75rem;
            padding: 2px 6px;
            border-radius: 10px;
            margin-right: 8px;
        }

        .balance-quick-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            background: #f8fafc;
            border: 1px solid #e6eaf2;
            border-radius: 14px;
            padding: 12px 14px;
            margin-bottom: 8px;
        }

        .balance-summary {
            display: flex;
            flex-wrap: wrap;
            gap: 8px 16px;
        }

        .balance-summary-item {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            font-size: 0.82rem;
            color: #64748b;
        }

        .balance-summary-item i {
            color: var(--primary-color);
            font-size: 0.8rem;
        }

        .balance-summary-item strong {
            color: var(--dark-color);
            font-weight: 800;
        }

        .balance-summary-item.debt i,
        .balance-summary-item.debt strong {
            color: var(--danger-color);
        }

        .balance-summary-item.received i,
        .balance-summary-item.received strong {
            color: var(--success-color);
        }

        .balance-edit-btn {
            flex-shrink: 0;
            width: 34px;
            height: 34px;
            border-radius: 10px;
            border: none;
            background: rgba(14, 165, 233, 0.12);
            color: var(--primary-color);
            font-size: 0.9rem;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: background 0.2s, color 0.2s;
        }

        .balance-edit-btn:hover {
            background: var(--primary-color);
            color: #fff;
        }

        .total-debt-container {
            background: linear-gradient(135deg, rgba(229, 72, 77, 0.1), rgba(229, 72, 77, 0.04));
            border-radius: 12px;
            padding: 15px;
            margin-top: 15px;
            border: 1px solid rgba(229, 72, 77, 0.2);
        }
        
        .total-debt-label {
            font-weight: 700;
            color: var(--danger-color);
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        
        .highlight-box {
            background-color: rgba(14, 165, 233, 0.05);
            border-radius: 12px;
            padding: 16px;
            margin: 12px 0;
            border: 1px solid rgba(14, 165, 233, 0.12);
        }
        
        .saved-people-list {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .saved-name-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            background: white;
            border: 1px solid #eef0f6;
            border-radius: 12px;
            padding: 8px 10px 8px 8px;
            transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
        }

        .saved-name-row:hover {
            box-shadow: 0 8px 18px rgba(18, 23, 43, 0.08);
            border-color: rgba(14, 165, 233, 0.25);
            transform: translateY(-1px);
        }

        .saved-name-main {
            background: none;
            border: none;
            display: flex;
            align-items: center;
            gap: 12px;
            cursor: pointer;
            flex: 1;
            min-width: 0;
            text-align: right;
            padding: 2px;
        }

        .saved-name-avatar {
            width: 38px;
            height: 38px;
            flex-shrink: 0;
            border-radius: 50%;
            background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
            color: white;
            display: flex;
            align-items: center;
            justify-content: center;
            font-family: var(--font-display);
            font-weight: 700;
            font-size: 0.95rem;
        }

        .saved-name-info {
            display: flex;
            flex-direction: column;
            gap: 4px;
            min-width: 0;
        }

        .saved-name-title {
            font-weight: 700;
            color: var(--dark-color);
            font-size: 0.92rem;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .saved-name-sub {
            display: inline-flex;
            width: fit-content;
            font-size: 0.72rem;
            font-weight: 700;
            color: #64748b;
            background: #f1f5f9;
            padding: 2px 10px;
            border-radius: 20px;
        }

        .saved-name-sub.has-debt {
            color: var(--danger-color);
            background: rgba(229, 72, 77, 0.12);
        }

        .saved-name-sub.has-balance {
            color: var(--success-color);
            background: rgba(31, 157, 85, 0.12);
        }

        .saved-name-actions {
            display: flex;
            gap: 2px;
            flex-shrink: 0;
        }

        .saved-name-actions .chip-icon-btn {
            background: none;
            border: none;
            cursor: pointer;
            font-size: 0.82rem;
            padding: 7px 9px;
            border-radius: 8px;
            color: #9aa0ab;
        }

        .saved-name-actions .chip-icon-btn:hover {
            background-color: rgba(0,0,0,0.06);
        }

        .saved-name-actions .chip-edit:hover {
            color: var(--primary-color);
        }

        .saved-name-actions .chip-delete:hover {
            color: var(--danger-color);
        }

        .history-modal-overlay {
            position: fixed;
            inset: 0;
            background: rgba(26, 26, 46, 0.6);
            z-index: 1050;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }

        .history-modal-box {
            background: white;
            border-radius: 18px;
            width: 92vw;
            max-width: 1100px;
            max-height: 88vh;
            display: flex;
            flex-direction: column;
            box-shadow: 0 15px 40px rgba(0,0,0,0.25);
            overflow: hidden;
        }

        .history-modal-header {
            position: relative;
            background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
            color: white;
            padding: 1.2rem 1.5rem 1.5rem;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .history-modal-header h5 {
            margin: 0;
            font-weight: 700;
            font-family: var(--font-display);
        }

        .history-modal-close {
            background: none;
            border: none;
            color: white;
            font-size: 1.5rem;
            line-height: 1;
            cursor: pointer;
            opacity: 0.85;
        }

        .history-modal-close:hover {
            opacity: 1;
        }

        .history-modal-body {
            padding: 1.2rem 1.5rem;
            overflow-y: auto;
        }

        .history-modal-footer {
            padding: 1rem 1.5rem;
            border-top: 1px solid #eee;
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
        }

        .history-record-card {
            background-color: white;
            border-radius: 12px;
            padding: 0;
            margin-bottom: 16px;
            border: 1px solid #e6e8ee;
            box-shadow: 0 3px 10px rgba(0,0,0,0.05);
            overflow: hidden;
        }

        .history-record-top {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 10px 15px;
            background: linear-gradient(135deg, rgba(67,97,238,0.08), rgba(63,55,201,0.05));
            border-bottom: 1px dashed #d7dae3;
        }

        .history-record-date {
            font-weight: 700;
            color: var(--dark-color);
            font-size: 0.9rem;
        }

        .history-record-actions button {
            background: none;
            border: none;
            font-size: 0.95rem;
            padding: 4px 7px;
            cursor: pointer;
            border-radius: 6px;
        }

        .history-record-actions button:hover {
            background-color: rgba(0,0,0,0.06);
        }

        .history-record-actions .print-btn {
            color: var(--success-color);
        }

        .history-record-actions .image-btn {
            color: var(--accent-color);
        }

        .history-record-actions .edit-btn {
            color: var(--primary-color);
        }

        .history-record-actions .delete-btn {
            color: var(--danger-color);
        }

        .history-record-body {
            padding: 12px 15px;
        }

        .history-record-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 6px 0;
            border-bottom: 1px dashed #eef0f4;
            font-size: 0.9rem;
        }

        .history-record-row:last-child {
            border-bottom: none;
        }

        .history-record-row .label {
            color: #6c757d;
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .history-record-row .value {
            font-weight: 700;
            color: var(--dark-color);
        }

        .history-record-row.total .value {
            color: var(--danger-color);
            font-size: 1rem;
        }

        .history-edit-form input {
            margin-bottom: 8px;
        }

        .history-edit-form label {
            font-size: 0.8rem;
            font-weight: 600;
            margin-bottom: 2px;
            display: block;
        }

        /* -------- فۆرمی واسڵکردنی قەرز -------- */
        .settle-debt-form {
            background: linear-gradient(135deg, rgba(31, 157, 85, 0.1), rgba(31, 157, 85, 0.04));
            border: 1px solid rgba(31, 157, 85, 0.25);
            border-radius: 12px;
            padding: 14px 16px;
            margin-bottom: 16px;
        }

        .settle-debt-form h6 {
            margin: 0 0 10px;
            font-weight: 800;
            color: var(--success-color);
            font-size: 0.9rem;
        }

        .quick-add-box {
            max-width: 460px;
        }

        .quick-add-section {
            padding: 14px 0;
            border-bottom: 1px solid #eef0f6;
        }

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

        .quick-add-section h6 {
            margin: 0 0 10px;
            font-weight: 800;
            color: var(--primary-color);
            font-size: 0.9rem;
        }

        .quick-add-section label {
            font-size: 0.8rem;
            font-weight: 600;
            margin-bottom: 2px;
            display: block;
        }

        .quick-add-msg {
            font-size: 0.78rem;
            font-weight: 700;
            margin-top: 8px;
            min-height: 1.1em;
        }

        .quick-add-msg.success {
            color: var(--success-color);
        }

        .quick-add-msg.error {
            color: var(--danger-color);
        }

        .quick-add-chip-list {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-top: 12px;
        }

        .quick-add-chip {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            background: #f1f5f9;
            color: var(--dark-color);
            font-size: 0.78rem;
            font-weight: 600;
            padding: 5px 6px 5px 12px;
            border-radius: 20px;
        }

        .quick-add-chip button {
            background: none;
            border: none;
            color: #9aa0ab;
            font-size: 0.7rem;
            width: 20px;
            height: 20px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .quick-add-chip button:hover {
            background: rgba(229, 72, 77, 0.15);
            color: var(--danger-color);
        }

        .settle-debt-form label {
            font-size: 0.8rem;
            font-weight: 600;
            margin-bottom: 2px;
            display: block;
        }

        #settleDebtBtn {
            background-color: var(--success-color);
            border-color: var(--success-color);
            color: #fff;
        }

        #settleDebtBtn:hover {
            filter: brightness(1.08);
            color: #fff;
        }

        /* -------- کارتی پارەدانەوەی قەرز لە مێژوودا -------- */
        .payment-card {
            border-color: rgba(31, 157, 85, 0.3);
        }

        .payment-top {
            background: linear-gradient(135deg, rgba(31, 157, 85, 0.12), rgba(31, 157, 85, 0.05));
        }

        .payment-amount {
            color: var(--success-color) !important;
        }

        /* -------- وەسڵی A4 چاپکراو -------- */
        #printReceiptArea {
            display: none;
        }

        @media print {
            body * {
                visibility: hidden;
            }
            #printReceiptArea, #printReceiptArea * {
                visibility: visible;
            }
            #printReceiptArea {
                display: block;
                position: absolute;
                top: 0;
                right: 0;
                width: 210mm;
                min-height: 297mm;
                padding: 15mm;
                box-sizing: border-box;
            }
        }

        /* -------- ناوچەی گرتنی وێنەی وەسڵ (بۆ ناردن) -------- */
        #imageReceiptArea {
            position: fixed;
            top: 0;
            left: -10000px;
            width: 210mm;
            background: white;
            padding: 15mm;
            box-sizing: border-box;
            z-index: -1;
        }

        .receipt-page {
            font-family: 'Noto Sans Arabic', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            color: #1a1a2e;
        }

        .receipt-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            border-bottom: 3px solid var(--primary-color);
            padding-bottom: 16px;
            margin-bottom: 24px;
        }

        .receipt-brand {
            font-size: 1.6rem;
            font-weight: 800;
            color: var(--primary-color);
            letter-spacing: 1px;
        }

        .receipt-brand small {
            display: block;
            font-size: 0.75rem;
            font-weight: 400;
            color: #6c757d;
            letter-spacing: 0;
        }

        .receipt-title {
            text-align: right;
        }

        .receipt-title h2 {
            margin: 0;
            font-size: 1.3rem;
            color: var(--dark-color);
        }

        .receipt-title span {
            color: #6c757d;
            font-size: 0.85rem;
        }

        .receipt-meta {
            display: flex;
            justify-content: space-between;
            background: rgba(67,97,238,0.06);
            border-radius: 10px;
            padding: 14px 18px;
            margin-bottom: 22px;
        }

        .receipt-meta div span {
            display: block;
        }

        .receipt-meta .meta-label {
            font-size: 0.75rem;
            color: #6c757d;
        }

        .receipt-meta .meta-value {
            font-size: 1rem;
            font-weight: 700;
            color: var(--dark-color);
        }

        .receipt-table {
            width: 100%;
            border-collapse: collapse;
            margin-bottom: 22px;
        }

        .receipt-table tr td {
            padding: 12px 14px;
            border-bottom: 1px solid #eef0f4;
            font-size: 0.95rem;
        }

        .receipt-table tr td:first-child {
            color: #6c757d;
            width: 55%;
        }

        .receipt-table tr td:last-child {
            font-weight: 700;
            color: var(--dark-color);
            text-align: right;
        }

        .receipt-table tr.total-row td {
            border-bottom: none;
            border-top: 2px solid var(--primary-color);
            font-size: 1.15rem;
            padding-top: 16px;
        }

        .receipt-table tr.total-row td:last-child {
            color: var(--danger-color);
        }

        .receipt-footer {
            text-align: center;
            margin-top: 40px;
            padding-top: 18px;
            border-top: 1px dashed #d7dae3;
            color: #6c757d;
            font-size: 0.85rem;
        }

        .receipt-footer strong {
            display: block;
            color: var(--primary-color);
            font-size: 1rem;
            margin-bottom: 4px;
        }

        .receipt-note {
            display: block;
            margin-top: 10px;
            color: var(--danger-color);
            font-weight: 600;
            font-size: 0.8rem;
        }
        
        .btn-primary {
            background-color: var(--primary-color);
            border: none;
            border-radius: 10px;
            padding: 13px;
            font-weight: 700;
            font-family: var(--font-body);
            letter-spacing: 0.2px;
            box-shadow: 0 8px 18px rgba(14, 165, 233, 0.28);
            transition: all 0.2s ease;
        }
        
        .btn-primary:hover {
            background-color: var(--secondary-color);
            transform: translateY(-1px);
            box-shadow: 0 10px 22px rgba(14, 165, 233, 0.34);
        }

        .btn-outline-primary {
            border-radius: 10px;
            font-family: var(--font-body);
        }

        .btn-outline-danger {
            border-radius: 10px;
            font-family: var(--font-body);
        }

        /* =========================================================
           ڕێکخستنی قەبارە بۆ سەرجەم ئامێرەکان (تابلێت و مۆبایل)
           ========================================================= */
        @media (max-width: 768px) {
            .app-shell {
                flex-direction: column;
            }

            .app-sidebar {
                width: 100%;
                height: auto;
                position: static;
                flex-direction: row;
                justify-content: space-between;
                padding: 12px 18px;
            }

            .app-sidebar-nav {
                flex-direction: row;
                flex: 0;
            }

            .app-main-inner {
                padding: 1.5rem 1rem 2.5rem;
            }

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

            .card-body {
                padding: 1.4rem 1.1rem !important;
            }

            .history-modal-box {
                max-height: 92vh;
            }

            .history-modal-header {
                padding: 1rem 1.1rem 1.2rem;
            }

            .history-modal-body {
                padding: 1rem 1.1rem;
            }

            .history-modal-footer {
                padding: 0.9rem 1.1rem;
            }

            .login-card {
                max-width: 100%;
            }
        }

        @media (max-width: 576px) {
            .stats-row {
                grid-template-columns: 1fr;
            }

            .app-page-header h1 {
                font-size: 1.2rem;
            }

            .section-title {
                font-size: 1.02rem;
                padding-right: 40px;
            }

            .section-title .step {
                width: 28px;
                height: 28px;
                font-size: 0.82rem;
                top: -4px;
            }

            .form-control {
                padding: 9px 12px;
                font-size: 0.92rem;
            }

            .highlight-box {
                padding: 12px;
            }

            .btn-primary, .whatsapp-btn, .btn-login {
                padding: 12px;
                font-size: 0.95rem;
            }

            .result-item {
                flex-wrap: wrap;
                gap: 6px;
                padding: 10px 12px;
            }

            .result-value {
                width: 100%;
                text-align: left;
            }

            .saved-name-title {
                font-size: 0.86rem;
            }

            .saved-name-sub {
                font-size: 0.72rem;
            }

            .history-modal-header h5 {
                font-size: 0.98rem;
            }

            .history-modal-footer {
                flex-direction: column;
            }

            .history-modal-footer button {
                width: 100%;
                justify-content: center;
            }

            .history-record-top {
                flex-wrap: wrap;
                gap: 6px;
            }

            .settle-debt-form .row > [class*="col-"] {
                margin-bottom: 10px;
            }

            .login-card .login-header {
                padding: 1.7rem 1rem 1.4rem;
            }

            .login-card .login-body {
                padding: 1.6rem 1.1rem 1.4rem;
            }
        }

        @media (max-width: 360px) {
            .app-page-header h1 {
                font-size: 1.05rem;
            }
        }

/* ===== زیادکراوی سیستەمی قەرز (v2) ===== */
.stat-icon.warning {
    background: rgba(245, 165, 36, 0.12);
    color: var(--warning-color);
}
.stat-value.warning { color: var(--warning-color); }

.overdue-text { color: var(--danger-color) !important; }
.overdue-icon { color: var(--danger-color); font-size: 0.85em; margin-right: 4px; }

.balance-summary-item.overdue i,
.balance-summary-item.overdue strong {
    color: var(--danger-color);
}

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}
.status-badge.status-paid { background: rgba(31, 157, 85, 0.12); color: var(--success-color); }
.status-badge.status-partial { background: rgba(245, 165, 36, 0.15); color: var(--warning-color); }
.status-badge.status-unpaid { background: rgba(100, 116, 139, 0.15); color: #64748b; }
.status-badge.status-overdue { background: rgba(229, 72, 77, 0.15); color: var(--danger-color); }

.history-summary-cards {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.history-summary-card {
    flex: 1;
    min-width: 180px;
    background: var(--light-color);
    border-radius: 10px;
    padding: 12px 14px;
    border: 1px solid rgba(15, 23, 42, 0.06);
}
.hsc-title {
    font-weight: 800;
    margin-bottom: 6px;
    color: var(--primary-color);
}
.hsc-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    padding: 2px 0;
}
.hsc-row.overdue-row strong,
.hsc-row.overdue-row span { color: var(--danger-color); }

.history-tabs {
    margin-bottom: 12px;
    border-bottom: 2px solid rgba(15, 23, 42, 0.08);
}
.history-tabs .nav-link {
    color: #64748b;
    font-weight: 700;
    border: none;
    background: transparent;
}
.history-tabs .nav-link.active {
    color: var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
}
.history-tab-panel { min-height: 60px; }

.history-record-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

/* ===== لاپەڕەی ڕاپۆرت ===== */
.report-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.report-card {
    background: #fff;
    border-radius: 14px;
    padding: 18px 20px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
    border: 1px solid rgba(15, 23, 42, 0.05);
}
.report-card .rc-label {
    font-size: 0.82rem;
    color: #64748b;
    margin-bottom: 6px;
}
.report-card .rc-value {
    font-size: 1.35rem;
    font-weight: 800;
}
.report-card.rc-danger .rc-value { color: var(--danger-color); }
.report-card.rc-success .rc-value { color: var(--success-color); }
.report-card.rc-warning .rc-value { color: var(--warning-color); }

.report-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.report-filters select, .report-filters input {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(15, 23, 42, 0.15);
}

.report-table-wrap {
    background: #fff;
    border-radius: 14px;
    overflow-x: auto;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
}
.report-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}
.report-table th, .report-table td {
    padding: 10px 14px;
    text-align: right;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    font-size: 0.88rem;
}
.report-table th {
    background: var(--light-color);
    font-weight: 800;
    position: sticky;
    top: 0;
}
.report-table tr.row-overdue { background: rgba(229, 72, 77, 0.04); }

.quick-add-box-wide {
    max-width: 1100px;
}

@media (min-width: 1400px) {
    .history-modal-box {
        max-width: 1250px;
    }
}

@media (max-width: 991px) {
    .history-modal-box {
        max-width: 700px;
        width: 94vw;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .history-modal-box {
        max-width: 88vw;
    }
}

@media (max-width: 768px) {
    .history-modal-overlay {
        padding: 0;
        align-items: stretch;
    }

    .history-modal-box {
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        height: 100%;
        border-radius: 0;
    }
}

@media (min-width: 1400px) {
    .app-main-inner {
        max-width: 1280px;
    }
}

@media (max-width: 900px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stats-row {
        grid-template-columns: 1fr;
    }
}
