        /* ===== ОРИГИНАЛЬНЫЕ СТИЛИ (без изменений) ===== */
        .btn-status-all { background: #6b7280; color: white; border: none; padding: 10px 20px; border-radius: 40px; font-weight: 600; font-size: 0.8rem; cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; gap: 8px; }
        .btn-status-active { background: #10b981; color: white; border: none; padding: 10px 20px; border-radius: 40px; font-weight: 600; font-size: 0.8rem; cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; gap: 8px; }
        .btn-status-suspended { background: #f59e0b; color: white; border: none; padding: 10px 20px; border-radius: 40px; font-weight: 600; font-size: 0.8rem; cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; gap: 8px; }
        .btn-status-expired { background: #ef4444; color: white; border: none; padding: 10px 20px; border-radius: 40px; font-weight: 600; font-size: 0.8rem; cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; gap: 8px; }
        .btn-status-all:hover, .btn-status-active:hover, .btn-status-suspended:hover, .btn-status-expired:hover { transform: translateY(-2px); filter: brightness(1.05); }
        * { margin: 0; padding: 0; box-sizing: border-box; }
        body { font-family: 'Inter', sans-serif; background: #f0f2f8; color: #1e293b; margin: 0; padding: 0; min-height: 100vh; }
        .container { width: 100%; margin: 0 auto; padding: 0 20px; }
        .main-menu { background: #1b4a6e; border-radius: 60px; padding: 8px 24px; margin-bottom: 32px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 20px; border: 1px solid #eef2f8; box-shadow: 0 2px 8px rgba(0,0,0,0.03); position: relative;}
        .logo-area { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
        .logo-text h2 { font-size: 1rem; color: white; margin: 0; line-height: 1.2; }
        .logo-text p { font-size: 0.65rem; color: rgba(255,255,255,0.7); margin: 0; }
        .logo-icon {
    width: 90px;
    height: 90px;
    background: rgba(255,255,255,0.2);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    font-weight: 700;
    color: #ffb347;
}
        .menu-items { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
        .menu-item { background: transparent; border: none; padding: 10px 18px; border-radius: 40px; font-weight: 600; font-size: 0.8rem; cursor: pointer; color: rgba(255,255,255,0.7) !important; display: flex; align-items: center; gap: 6px; transition: all 0.2s; position: relative; }
        .menu-item:not(:last-child)::after { content: '│'; position: absolute; right: -12px; top: 50%; transform: translateY(-50%); color: rgba(255,255,255,0.2); font-size: 0.8rem; }
        .menu-item:hover { background: rgba(255,255,255,0.15) !important; color: white !important; }
        .menu-item.active { background: #ffb347; color: #1e293b !important; }
        .menu-item.active::after { display: none; }
        .stats-cards { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 20px; margin-top: 10px; }
        .stat-card { background: white; border-radius: 16px; padding: 16px 14px; text-align: center; border: 1px solid #eef2f8; box-shadow: 0 2px 8px rgba(0,0,0,0.04); transition: all 0.2s; }
        .stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
        .stat-card .stat-icon { font-size: 1.4rem; margin-bottom: 6px; display: block; color: #1b4a6e; }
        .stat-card .stat-number { font-size: 1.5rem; font-weight: 700; color: #1b4a6e; line-height: 1.2; }
        .stat-card .stat-label { font-size: 0.65rem; color: #5b6e8c; font-weight: 500; margin-top: 4px; }
        .stat-card.card-total { border-top: 3px solid #1b4a6e; }
        .stat-card.card-pending { border-top: 3px solid #f59e0b; }
        .stat-card.card-amount { border-top: 3px solid #10b981; }
        .stat-card.card-paid { border-top: 3px solid #3b82f6; }
        .stat-card.card-unpaid { border-top: 3px solid #ef4444; }
        .stat-card.card-all { border-top: 3px solid #8b5cf6; }
        .stat-divider { border-top: 1px dashed #cbd5e1; margin: 6px auto; width: 40px; }
        .stat-count { font-size: 1rem; color: #5b6e8c; font-weight: 600; }
        
        .user-menu-wrapper {
            position: relative;
            z-index: 9999;
            flex-shrink: 0;
        }
        .user-menu-btn { background: rgba(255,255,255,0.15); border: none; padding: 8px 16px 8px 12px; border-radius: 40px; color: white; cursor: pointer; display: flex; align-items: center; gap: 10px; font-size: 0.8rem; font-weight: 500; transition: all 0.2s; font-family: 'Inter', sans-serif; }
        .user-menu-btn:hover { background: rgba(255,255,255,0.25); }
        .user-menu-btn i { font-size: 1rem; }
        .user-menu-btn .user-name { max-width: none; overflow: visible; white-space: nowrap; }
        .user-menu-btn .user-arrow { font-size: 0.6rem; margin-left: 4px; transition: transform 0.2s; }
        .user-menu-btn.open .user-arrow { transform: rotate(180deg); }
        .user-dropdown {
            display: none;
            position: absolute;
            right: 0;
            top: calc(100% + 8px);
            background: white;
            border-radius: 16px;
            min-width: 140px;
            box-shadow: 0 8px 30px rgba(0,0,0,0.15);
            border: 1px solid #eef2f8;
            padding: 8px 0;
            z-index: 1000;
        }
        .user-dropdown.open { display: block; }
        .user-dropdown .dropdown-item { padding: 10px 16px; cursor: pointer; font-size: 0.8rem; color: #1e293b; display: flex; align-items: center; gap: 10px; transition: all 0.15s; border: none; background: none; width: 100%; text-align: left; font-family: 'Inter', sans-serif; }
        .user-dropdown .dropdown-item:hover { background: #f1f5f9; }
        .user-dropdown .dropdown-item i { width: 18px; color: #94a3b8; font-size: 0.8rem; }
        .user-dropdown .dropdown-divider { height: 1px; background: #f0f4f9; margin: 4px 0; }
        .user-dropdown .dropdown-item.logout-item { color: #dc2626; border-top: 1px solid #f0f4f9; margin-top: 4px; padding-top: 12px; }
        .user-dropdown .dropdown-item.logout-item i { color: #dc2626; }
        .user-dropdown .dropdown-item .year-badge { background: #e0e7ff; padding: 2px 10px; border-radius: 20px; font-size: 0.7rem; color: #3730a3; margin-left: auto; }
        
        .stats-header {
            background: #1b4a6e;
            border-radius: 28px;
            padding: 12px 28px;
            margin-bottom: 0;
            display: flex;
            justify-content: flex-end;
            align-items: center;
            flex-wrap: wrap;
            gap: 15px;
            min-height: 20px;
            position: relative;
        }
        .filter-panel { background: white; border-radius: 20px; padding: 20px 24px; margin-bottom: 25px; border: 1px solid #eef2f8; border-top: 3px solid #ffb347 !important; }
        .contract-table th { background: #1b4a6e !important; color: white !important; }
        .modal-header { background: #1b4a6e !important; border-radius: 32px 32px 0 0 !important; padding: 20px 28px !important; margin: -28px -30px 0 -30px !important; }
        .modal-header h2 { color: white !important; margin: 0; }
        .close-modal { color: white !important; font-size: 28px; background: none; border: none; cursor: pointer; }
        .btn-search { background: #1b4a6e !important; color: white !important; }
        .btn-add { background: #ffb347 !important; color: #1e293b !important; }
        input:focus, select:focus, textarea:focus { border-color: #ffb347 !important; box-shadow: 0 0 0 2px rgba(255, 179, 71, 0.2) !important; outline: none !important; }
        ::-webkit-scrollbar { width: 8px; height: 8px; }
        ::-webkit-scrollbar-track { background: #e2e8f0; border-radius: 10px; }
        ::-webkit-scrollbar-thumb { background: #1b4a6e; border-radius: 10px; }
        ::-webkit-scrollbar-thumb:hover { background: #ffb347; }
        button { transition: all 0.2s ease !important; }
        button:hover { transform: translateY(-1px); filter: brightness(1.05); }
        .filter-row { display: flex; flex-wrap: wrap; gap: 15px; margin-bottom: 15px; }
        .filter-group { flex: 1; min-width: 180px; }
        .filter-group label { display: block; font-size: 0.7rem; font-weight: 600; color: #5b6e8c; margin-bottom: 6px; }
        .filter-group label i { margin-right: 4px; }
        .filter-group input, .filter-group select { width: 100%; padding: 10px 12px; border: 1px solid #dce3ec; border-radius: 12px; font-size: 0.85rem; font-family: inherit; }
        .filter-buttons { display: flex; gap: 12px; flex-wrap: wrap; justify-content: flex-end; margin-top: 5px; }
        .filter-buttons button { padding: 10px 20px; border-radius: 40px; font-weight: 600; font-size: 0.8rem; cursor: pointer; border: none; }
        .btn-search { background: #1b4a6e; color: white; }
        .btn-clear { background: #e2e8f0; color: #334155; }
        .btn-deleted { background: #fef3c7; color: #b45309; }
        .btn-export-filter { background: #10b981; color: white; }
        .btn-add { background: #ffb347; color: #1e293b; border: none; padding: 10px 20px; border-radius: 40px; font-weight: 600; font-size: 0.8rem; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
        .btn-add:hover { background: #ff9f1a; }
        .table-wrapper { overflow-x: auto; border-radius: 20px; background: white; border: 1px solid #eef2f8; }
        .contract-table { width: 100%; border-collapse: collapse; font-size: 0.75rem; min-width: 1300px; }
        .contract-table th { background: #f8fafd; padding: 14px 12px; font-weight: 600; border-bottom: 1px solid #e2e8f0; text-align: center; cursor: pointer; }
        .contract-table th:hover { background: #eef2ff; }
        .contract-table td { padding: 12px 10px; border-bottom: 1px solid #f0f4f9; text-align: center; cursor: pointer; }
        .contract-table tr:hover td { background-color: #e6f0fa; }
        .status-badge { display: inline-block; padding: 4px 10px; border-radius: 40px; font-size: 0.7rem; font-weight: 600; }
        .status-active { background: #dcfce7; color: #15803d; }
        .status-expired { background: #fee2e2; color: #b91c1c; }
        .status-pending { background: #fef3c7; color: #b45309; }
        .status-suspended { background: #e0e7ff; color: #3730a3; }
        .modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; justify-content: center; align-items: center; }
        .modal-content { background: white; border-radius: 32px; width: 95%; max-width: 1400px; max-height: 90vh; overflow-y: auto; padding: 28px 30px; margin: auto; }
        .modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; padding-bottom: 16px; border-bottom: 2px solid #eef2f8; }
        .modal-header h2 { font-size: 1.3rem; color: #1f3a4b; }
        .close-modal { background: none; border: none; font-size: 28px; cursor: pointer; color: #94a3b8; }
        .form-group { margin-bottom: 20px; }
        .form-group label { display: block; font-size: 0.75rem; font-weight: 600; color: #5b6e8c; margin-bottom: 6px; }
        .form-group input, .form-group select, .settings-input { width: 100%; padding: 10px 12px; border: 1px solid #dce3ec; border-radius: 12px; font-size: 0.9rem; font-family: inherit; }
        .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
        .total-card { background: #f1f5f9; border-radius: 16px; padding: 20px; margin: 25px 0; text-align: center; border: 1px solid #e2e8f0; }
        .total-label { font-size: 0.75rem; color: #5b6e8c; text-transform: uppercase; letter-spacing: 1px; }
        .total-amount { font-size: 1.8rem; font-weight: 700; color: #1b4a6e; margin-top: 8px; }
        .form-hint { font-size: 0.65rem; color: #94a3b8; margin-top: 5px; display: block; }
        .required { color: #dc2626; margin-left: 4px; }
        .btn-primary { background: #1b4a6e; color: white; border: none; padding: 12px 24px; border-radius: 40px; font-weight: 600; cursor: pointer; }
        .btn-secondary { background: #e2e8f0; color: #334155; border: none; padding: 10px 20px; border-radius: 40px; font-weight: 600; cursor: pointer; }
        .btn-danger { background: #dc2626; color: white; border: none; padding: 12px 24px; border-radius: 40px; font-weight: 600; cursor: pointer; }
        .btn-warning { background: #f59e0b; color: white; border: none; padding: 12px 24px; border-radius: 40px; font-weight: 600; cursor: pointer; }
        .btn-sm { padding: 5px 10px; border-radius: 20px; font-size: 0.7rem; font-weight: 600; cursor: pointer; border: none; margin: 2px; }
        .btn-edit { background: #fef3c7; color: #b45309; }
        .btn-delete { background: #fee2e2; color: #dc2626; }
        .modal-buttons { display: flex; gap: 15px; justify-content: flex-end; margin-top: 25px; }
        .detail-container { display: none; background: white; border-radius: 24px; padding: 6px 28px; border: 1px solid #eef2f8; margin-top: 0; }
        .detail-container.active { display: block; }
        .tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; background: #f8fafd; padding: 6px 12px; border-radius: 60px; border: 1px solid #eef2f8; }
        .tab-btn { background: transparent; border: none; padding: 10px 24px; border-radius: 40px; font-weight: 600; font-size: 0.85rem; cursor: pointer; color: #5b6e8c; position: relative; transition: all 0.2s; }
        .tab-btn:not(:first-child)::before { content: ''; position: absolute; left: -4px; top: 50%; transform: translateY(-50%); height: 20px; width: 1px; background: #cbd5e1; }
        .tab-btn:hover:not(.active) { background: #f1f5f9; }
        .tab-btn.active { background: #ffb347 !important; color: #1e293b !important; }
        .tab-btn.active::before { background: transparent; }
        .tab-content { display: none; background: white; border-radius: 20px; padding: 10px 20px; border: 1px solid #eef2f8; }
        .tab-content.active { display: block; }
        .detail-row { display: flex; padding: 12px 0; border-bottom: 1px solid #f0f4f9; }
        .detail-label { width: 35%; font-weight: 600; color: #5b6e8c; }
        .detail-value { width: 65%; color: #1e293b; font-weight: 500; }
        .flex-buttons { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-start; flex-wrap: wrap; }
        .stats-mini-card { background: #f8fafd; padding: 15px; border-radius: 16px; text-align: center; border-top: 3px solid #ffb347 !important; }
        .stat-mini-label { font-size: 0.7rem; color: #5b6e8c; }
        .stat-mini-value { font-size: 1.3rem; font-weight: 700; color: #1b4a6e; }
        .payment-form { background: #f8fafd; padding: 15px; border-radius: 16px; margin-bottom: 20px; }
        .comment-item { background: #f8fafd; padding: 12px; border-radius: 16px; margin-bottom: 10px; border-left: 4px solid #ffb347; }
        .comment-date { font-size: 0.65rem; color: #94a3b8; margin-bottom: 5px; }
        .comment-text { font-size: 0.85rem; }
        .invoices-table-wrapper { overflow-x: auto; margin-top: 20px; border-radius: 20px; border: 1px solid #eef2f8; background: white; }
        .invoices-table { width: 100%; border-collapse: collapse; font-size: 0.7rem; min-width: 1300px; }
        .invoices-table th { background: #1b4a6e !important; color: white !important; padding: 14px 10px; font-weight: 600; border-bottom: 1px solid #e2e8f0; text-align: center; }
        .invoices-table td { padding: 12px 10px; border-bottom: 1px solid #f0f4f9; text-align: center; vertical-align: middle; cursor: pointer; }
        .invoices-table tr:hover td { background-color: #fafcff; }
        .create-btn { background: #1b4a6e !important; color: white !important; border: none; padding: 12px 24px; border-radius: 40px; font-weight: 600; cursor: pointer; }
        .create-btn:hover { background: #0f3a57 !important; }
        .status-published { background: #d1fae5; color: #065f46; padding: 4px 10px; border-radius: 40px; display: inline-block; font-size: 0.7rem; font-weight: 600; }
        .status-rejected { background: #fee2e2; color: #b91c1c; padding: 4px 10px; border-radius: 40px; display: inline-block; font-size: 0.7rem; font-weight: 600; }
        .status-pending-faktura { background: #fef3c7; color: #b45309; padding: 4px 10px; border-radius: 40px; display: inline-block; font-size: 0.7rem; font-weight: 600; }
        .branch-badge { display: inline-block; padding: 4px 8px; border-radius: 12px; font-size: 0.65rem; background: #e0e7ff; color: #3730a3; }
        .faktura-id-badge { display: inline-block; padding: 4px 8px; border-radius: 12px; font-size: 0.65rem; font-family: monospace; background: #f1f5f9; }
        .faktura-id-linked { background: #dcfce7; color: #15803d; }
        .faktura-id-missing { background: #fef3c7; color: #b45309; }
        .invoice-actions-cell { display: flex; gap: 5px; justify-content: center; flex-wrap: wrap; }
        .btn-table { padding: 6px 10px; border-radius: 20px; font-size: 0.65rem; font-weight: 600; cursor: pointer; border: none; transition: all 0.2s; }
        .btn-edit-table { background: #fef3c7; color: #b45309; }
        .btn-delete-table { background: #fee2e2; color: #dc2626; }
        .btn-send-table { background: #dbeafe; color: #1d4ed8; }
        .btn-id-table { background: #fef3c7; color: #b45309; }
        .btn-id-linked-table { background: #dbeafe; color: #1d4ed8; }
        .btn-table:hover { opacity: 0.8; transform: scale(1.02); }
        .faktura-status-select { padding: 6px 10px; border-radius: 20px; border: 1px solid #dce3ec; background: white; font-size: 0.7rem; font-weight: 600; cursor: pointer; font-family: inherit; }
        .pagination-controls { display: flex; justify-content: center; gap: 10px; margin-top: 20px; align-items: center; }
        .invoice-horizontal-modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); z-index: 2000; justify-content: center; align-items: center; }
        .invoice-horizontal-content { background: white; border-radius: 24px; width: 95%; max-width: 1600px; height: 90vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25); }
        .invoice-horizontal-header { padding: 20px 28px; background: #1b4a6e; color: white; display: flex; justify-content: space-between; align-items: center; border-radius: 24px 24px 0 0; }
        .invoice-horizontal-body { flex: 1; overflow-y: auto; padding: 24px 28px; display: flex; flex-direction: column; gap: 24px; }
        .invoice-two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
        .invoice-info-card { background: white; border: 1px solid #e2e8f0; border-radius: 20px; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); margin-bottom: 20px; }
        .invoice-info-card h3 { background: #f8fafc; margin: -20px -20px 20px -20px; padding: 15px 20px; border-bottom: 2px solid #ffb347; border-radius: 20px 20px 0 0; color: #1b4a6e; font-size: 1rem; }
        .invoice-detail-row { display: flex; padding: 10px 0; border-bottom: 1px solid #f0f4f9; }
        .invoice-detail-label { width: 35%; font-weight: 600; color: #5b6e8c; font-size: 0.8rem; }
        .invoice-detail-value { width: 65%; color: #1e293b; font-weight: 500; font-size: 0.85rem; }
        .invoice-items-table-wrapper { overflow-x: auto; border-radius: 16px; border: 1px solid #e2e8f0; background: white; }
        .invoice-items-table { width: 100%; border-collapse: collapse; font-size: 0.75rem; }
        .invoice-items-table th { background: #f1f5f9; padding: 12px 10px; text-align: center; font-weight: 600; }
        .invoice-items-table td { padding: 10px; text-align: center; border-bottom: 1px solid #e9edf2; }
        .invoice-items-table input { width: 100%; padding: 6px 8px; border: 1px solid #dce3ec; border-radius: 8px; font-size: 0.7rem; text-align: center; }
        .invoice-footer-buttons { display: flex; gap: 16px; justify-content: flex-end; margin-top: 20px; padding-top: 20px; border-top: 1px solid #e2e8f0; }
        .btn-send-faktura { background: #10b981; color: white; border: none; padding: 12px 28px; border-radius: 40px; font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 8px; }
        .btn-send-faktura:hover { background: #059669; transform: translateY(-2px); }
        .invoice-footer-buttons .btn-secondary { background: #e2e8f0; color: #334155; border: none; padding: 12px 28px; border-radius: 40px; font-weight: 600; cursor: pointer; }
        .invoice-footer-buttons .btn-secondary:hover { background: #cbd5e1; transform: translateY(-2px); }
        .invoice-footer-buttons .btn-danger { background: #dc2626; color: white; border: none; padding: 12px 28px; border-radius: 40px; font-weight: 700; cursor: pointer; }
        .invoice-footer-buttons .btn-danger:hover { background: #b91c1c; transform: translateY(-2px); }
        .id-modal-content { max-width: 500px; }
        .info-card { background: #f8fafc; padding: 15px; border-radius: 16px; margin-bottom: 20px; }
        .info-row { display: flex; justify-content: space-between; margin-bottom: 8px; }
        .info-label { color: #5b6e8c; }
        .info-value { font-weight: 600; color: #1e293b; }
        .invoice-form-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin-bottom: 20px; }
        .full-width-textarea { grid-column: span 4; }
        .modal-buttons-row { display: flex; gap: 15px; justify-content: flex-end; margin-top: 25px; }
        .btn-ecp { background: #f59e0b; color: white; border: none; padding: 12px 24px; border-radius: 40px; font-weight: 600; cursor: pointer; margin-right: auto; }
        .btn-ecp:hover { background: #d97706; }
        .readonly-field { background: #f1f5f9; color: #334155; }
        .act-container { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
        .act-part { background: white; border: 1px solid #e2e8f0; border-radius: 20px; overflow: hidden; margin-bottom: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
        .act-part h3 { background: #f8fafd; padding: 14px 20px; margin: 0; font-size: 0.95rem; font-weight: 600; color: #1b4a6e; border-bottom: 2px solid #ffb347; }
        .act-table { width: 100%; border-collapse: collapse; font-size: 0.75rem; background: white; }
        .act-table th { background: #1b4a6e; color: white; padding: 10px 8px; font-weight: 600; text-align: center; border: 1px solid #2d5a7c; }
        .act-table td { padding: 8px 6px; text-align: center; border: 1px solid #e2e8f0; }
        .act-table tr:hover td { background: #f8fafc; }
        .act-total { background: #f1f5f9 !important; font-weight: 700; }
        .act-total td { background: #f1f5f9; }
        .print-btn button { background: #1b4a6e !important; color: white !important; border: none; padding: 10px 24px; border-radius: 40px; font-weight: 600; cursor: pointer; transition: all 0.2s; margin-top: 20px; }
        .print-btn button:hover { background: #0f3a57 !important; transform: translateY(-2px); }
        hr { margin: 20px 0; border-color: #e2e8f0; }
        .admin-user-list { margin-top: 20px; }
        .admin-user-item { background: #f8fafd; padding: 15px; border-radius: 16px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
        .admin-role-badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 0.7rem; font-weight: 600; }
        .role-admin { background: #dcfce7; color: #15803d; }
        .role-user { background: #e0e7ff; color: #3730a3; }
        .admin-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-bottom: 25px; }
        .admin-stat-card { background: #f8fafc; padding: 15px; border-radius: 16px; text-align: center; }
        .btn-reset { background: #ef4444; color: white; border: none; padding: 8px 16px; border-radius: 40px; font-weight: 600; cursor: pointer; margin-left: 10px; }
        .btn-reset:hover { background: #dc2626; }
        .print-header { text-align: center; margin-bottom: 25px; padding-bottom: 15px; border-bottom: 2px solid #1b4a6e; }
        .print-header h2 { color: #1b4a6e; font-size: 1.5rem; margin-bottom: 8px; }
        .print-header p { color: #5b6e8c; font-size: 0.85rem; }
        .signatures { display: flex; justify-content: space-between; margin-top: 30px; padding-top: 20px; border-top: 1px solid #e2e8f0; }
        .signature-line { width: 45%; }
        .signature-line p { margin: 5px 0; color: #1e293b; }
        .signature-line p:first-child { font-weight: 600; color: #1b4a6e; }
        .print-footer { margin-top: 30px; text-align: center; font-size: 0.7rem; color: #94a3b8; border-top: 1px solid #e2e8f0; padding-top: 15px; }
        @media (max-width: 1024px) {
    .new-contract-page .top-fields {
        grid-template-columns: auto auto auto;
    }
}
        @media (max-width: 768px) { .invoice-two-columns { grid-template-columns: 1fr !important; gap: 20px !important; } .signatures { flex-direction: column; gap: 20px; } .signature-line { width: 100%; } .act-container { grid-template-columns: 1fr !important; } .form-row { grid-template-columns: 1fr; } .invoice-form-row { grid-template-columns: 1fr 1fr; } .full-width-textarea { grid-column: span 2; } .main-menu { border-radius: 20px; padding: 12px 16px; } .menu-item { padding: 6px 12px; font-size: 0.7rem; } .menu-item:not(:last-child)::after { display: none; } .filter-row { flex-direction: column; } .filter-group { min-width: 100%; } .filter-buttons { justify-content: center; } .detail-container { padding: 16px; } .stats-cards { grid-template-columns: repeat(2, 1fr); } }
        @media (max-width: 480px) { .invoice-form-row { grid-template-columns: 1fr; } .full-width-textarea { grid-column: span 1; } .tabs { overflow-x: auto; flex-wrap: nowrap; padding: 4px 8px; } .tab-btn { padding: 8px 14px; font-size: 0.7rem; white-space: nowrap; } .stats-cards { grid-template-columns: 1fr 1fr; gap: 8px; } .stat-card .stat-number { font-size: 1.2rem; } .stat-card { padding: 12px 10px; } }
        .admin-layout { display: flex; gap: 24px; background: white; border-radius: 24px; padding: 0; overflow: hidden; border: 1px solid #eef2f8; }
        .admin-sidebar { width: 240px; background: #f8fafc; padding: 20px 0; flex-shrink: 0; border-right: 1px solid #eef2f8; display: flex; flex-direction: column; gap: 4px; }
        .admin-sidebar-btn { background: transparent; border: none; padding: 12px 24px; text-align: left; font-weight: 500; font-size: 0.85rem; color: #5b6e8c; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 12px; border-left: 3px solid transparent; width: 100%; }
        .admin-sidebar-btn i { width: 20px; text-align: center; font-size: 1rem; color: #94a3b8; }
        .admin-sidebar-btn:hover { background: #f1f5f9; color: #1e293b; }
        .admin-sidebar-btn:hover i { color: #1b4a6e; }
        .admin-sidebar-btn.active { background: #f1f5f9; color: #1b4a6e; font-weight: 600; border-left-color: #ffb347; }
        .admin-sidebar-btn.active i { color: #ffb347; }
        .admin-content-area { flex: 1; padding: 24px 28px; min-height: 500px; background: white; }
        .admin-content-area h3 { color: #1b4a6e; margin-bottom: 20px; font-size: 1.1rem; }
        .admin-stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-bottom: 25px; }
        .admin-section { display: none; }
        .admin-section.active { display: block; }
        @media (max-width: 768px) { .admin-layout { flex-direction: column; } .admin-sidebar { width: 100%; border-right: none; border-bottom: 1px solid #eef2f8; flex-direction: row; flex-wrap: wrap; padding: 10px; gap: 4px; } .admin-sidebar-btn { padding: 8px 14px; border-left: none; border-bottom: 3px solid transparent; width: auto; flex: 1 0 auto; justify-content: center; font-size: 0.75rem; } .admin-sidebar-btn.active { border-left: none; border-bottom-color: #ffb347; } .admin-content-area { padding: 16px; } .admin-stats-grid { grid-template-columns: 1fr 1fr; } }
        @media (max-width: 480px) { .admin-stats-grid { grid-template-columns: 1fr; } }
        .filter-panel.hidden { display: none !important; }
        #autoSaveIndicator { display: none !important; }

        .detail-right-panel { background: #f8fafd; border-radius: 16px; padding: 20px; margin-top: 20px; border: 1px solid #eef2f8; }
        .detail-right-panel h4 { color: #1b4a6e; margin-bottom: 15px; font-size: 0.9rem; }
        .detail-right-panel .detail-row { padding: 8px 0; }
        .detail-right-panel .detail-label { width: 40%; }
        .detail-right-panel .detail-value { width: 60%; }
        .contract-detail-layout { display: flex; flex-direction: column; gap: 20px; }
        .contract-detail-main { flex: 1; }
        .contract-detail-side { flex: 1; }
        @media (min-width: 992px) { .contract-detail-layout { flex-direction: row; } .contract-detail-main { flex: 2; } .contract-detail-side { flex: 1.2; } }
        
        .detail-action-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 0; padding-top: 0; }
        .detail-action-buttons .btn-sm { padding: 8px 16px; font-size: 0.7rem; border-radius: 30px; }
        .detail-action-buttons .btn-edit { background: #fef3c7; color: #b45309; border: none; }
        .detail-action-buttons .btn-suspend { background: #e0e7ff; color: #3730a3; border: none; }
        .detail-action-buttons .btn-delete { background: #fee2e2; color: #dc2626; border: none; }
        .detail-action-buttons .btn-pdf { background: #dbeafe; color: #1d4ed8; border: none; }
        .detail-action-buttons .btn-word { background: #fce7f3; color: #be185d; border: none; }
        .detail-action-buttons .btn-sm:hover { opacity: 0.85; transform: translateY(-1px); }
        
        .input-stir { letter-spacing: 1px; font-family: monospace; }
        .input-mfo { letter-spacing: 1px; font-family: monospace; }
        .btn-disabled { opacity: 0.5; pointer-events: none; cursor: not-allowed; }
        
        #contractModal .modal-content { max-width: 900px; }
        #contractModal .modal-header { border-radius: 32px 32px 0 0 !important; margin: -28px -30px 24px -30px !important; padding: 20px 28px !important; }
        #invoiceModal .modal-header { border-radius: 32px 32px 0 0 !important; margin: -28px -30px 24px -30px !important; padding: 20px 28px !important; }

        .stat-icon .fa-money-bill-wave,
        .stat-icon .fa-check-circle,
        .stat-icon .fa-exclamation-circle {
            margin: 0 2px;
        }
        .stat-icon .fa-money-bill-wave + .fa-check-circle,
        .stat-icon .fa-money-bill-wave + .fa-exclamation-circle {
            margin-left: 4px;
        }

        .invoice-stats-cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 20px; margin-top: 10px; }
        .invoice-stat-card { background: white; border-radius: 16px; padding: 16px 14px; text-align: center; border: 1px solid #eef2f8; box-shadow: 0 2px 8px rgba(0,0,0,0.04); transition: all 0.2s; }
        .invoice-stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
        .invoice-stat-card .stat-icon { font-size: 1.4rem; margin-bottom: 6px; display: block; color: #1b4a6e; }
        .invoice-stat-card .stat-number { font-size: 1.5rem; font-weight: 700; color: #1b4a6e; line-height: 1.2; }
        .invoice-stat-card .stat-label { font-size: 0.65rem; color: #5b6e8c; font-weight: 500; margin-top: 4px; }
        .invoice-stat-card.card-sent { border-top: 3px solid #3b82f6; }
        .invoice-stat-card.card-signed { border-top: 3px solid #10b981; }
        .invoice-stat-card.card-waiting { border-top: 3px solid #f59e0b; }
        .invoice-stat-card.card-rejected { border-top: 3px solid #ef4444; }

        .btn-sync-faktura { background: #8b5cf6; color: white; border: none; padding: 10px 24px; border-radius: 40px; font-weight: 600; font-size: 0.8rem; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: all 0.2s; }
        .btn-sync-faktura:hover { background: #7c3aed; transform: translateY(-2px); }

        .faktura-status-sent { background: #dbeafe; color: #1d4ed8; padding: 4px 10px; border-radius: 40px; display: inline-block; font-size: 0.7rem; font-weight: 600; }
        .faktura-status-signed-supplier { background: #d1fae5; color: #065f46; padding: 4px 10px; border-radius: 40px; display: inline-block; font-size: 0.7rem; font-weight: 600; }
        .faktura-status-signed-buyer { background: #dcfce7; color: #15803d; padding: 4px 10px; border-radius: 40px; display: inline-block; font-size: 0.7rem; font-weight: 600; }
        .faktura-status-rejected { background: #fee2e2; color: #b91c1c; padding: 4px 10px; border-radius: 40px; display: inline-block; font-size: 0.7rem; font-weight: 600; }
        .faktura-status-draft { background: #f1f5f9; color: #5b6e8c; padding: 4px 10px; border-radius: 40px; display: inline-block; font-size: 0.7rem; font-weight: 600; }

        /* ===== НОВЫЕ СТИЛИ ДЛЯ КАРТОЧЕК ДОГОВОРОВ ===== */
        .contract-cards-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
            gap: 16px;
            padding: 4px 0;
        }
        .contract-card {
            background: white;
            border-radius: 16px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.06);
            border: 1px solid #eef2f8;
            overflow: hidden;
            cursor: pointer;
            transition: all 0.2s ease;
            position: relative;
        }
        .contract-card:hover {
            transform: translateY(-4px);
            box-shadow: 0 8px 25px rgba(0,0,0,0.1);
        }
        .contract-card .card-indicator {
            height: 4px;
            width: 100%;
            border-radius: 4px 4px 0 0;
            flex-shrink: 0;
        }
        .contract-card .card-indicator.blue { background: #3b82f6; }
        .contract-card .card-indicator.red { background: #ef4444; }
        .contract-card .card-indicator.purple { background: #8b5cf6; }
        .contract-card .card-indicator.yellow { background: #f59e0b; }
        .contract-card .card-indicator.gray { background: #94a3b8; }

        .contract-card .card-body {
            padding: 14px 16px 16px 16px;
            display: flex;
            flex-direction: column;
            gap: 6px;
        }
        .contract-card .card-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 3px 0;
            border-bottom: 1px solid #f1f5f9;
        }
        .contract-card .card-row:last-child {
            border-bottom: none;
        }
        .contract-card .card-label {
            font-size: 0.65rem;
            font-weight: 600;
            color: #5b6e8c;
            text-transform: uppercase;
            letter-spacing: 0.3px;
            min-width: 80px;
            flex-shrink: 0;
        }
        .contract-card .card-value {
            font-size: 0.8rem;
            font-weight: 500;
            color: #1e293b;
            text-align: right;
            word-break: break-word;
        }
        .contract-card .card-value strong {
            font-weight: 700;
            color: #1b4a6e;
        }
        .contract-card .card-operator {
            font-size: 0.7rem;
            font-weight: 500;
            color: #1e293b;
            text-align: right;
            line-height: 1.3;
        }
        .contract-card .card-operator .fio-surname { font-weight: 600; }
        .contract-card .card-operator .fio-name { font-weight: 400; }
        .contract-card .card-operator .fio-patronymic { font-weight: 400; }

        .contract-card .card-date-block {
            display: flex;
            flex-direction: column;
            align-items: flex-end;
            font-size: 0.7rem;
            line-height: 1.4;
        }
        .contract-card .card-date-block .date-start { color: #1b4a6e; font-weight: 500; }
        .contract-card .card-date-block .date-end { color: #5b6e8c; }
        .contract-card .card-date-block .date-label { font-size: 0.55rem; color: #94a3b8; font-weight: 400; }

        .contract-card .card-status-badge {
            display: inline-block;
            padding: 3px 10px;
            border-radius: 30px;
            font-size: 0.6rem;
            font-weight: 600;
            white-space: nowrap;
        }
        .contract-card .card-status-badge.status-active { background: #dcfce7; color: #15803d; }
        .contract-card .card-status-badge.status-expired { background: #fee2e2; color: #b91c1c; }
        .contract-card .card-status-badge.status-pending { background: #fef3c7; color: #b45309; }
        .contract-card .card-status-badge.status-suspended { background: #e0e7ff; color: #3730a3; }

        .contract-card .card-number {
            font-weight: 700;
            font-size: 0.85rem;
            color: #1b4a6e;
        }
        .contract-card .card-customer {
            font-weight: 500;
            font-size: 0.8rem;
            color: #1e293b;
        }
        .contract-card .card-stir {
            font-size: 0.7rem;
            color: #5b6e8c;
            font-family: monospace;
        }
        .contract-card .card-branch {
            font-size: 0.65rem;
            background: #e0e7ff;
            padding: 2px 8px;
            border-radius: 12px;
            color: #3730a3;
            display: inline-block;
        }
        .contract-card .card-amount {
            font-weight: 700;
            font-size: 0.9rem;
            color: #1b4a6e;
        }
        .contract-card .card-debt {
            font-size: 0.7rem;
            font-weight: 500;
        }

        /* ===== СТИЛИ ДЛЯ НОВОЙ СТРАНИЦЫ СОЗДАНИЯ ДОГОВОРА ===== */
        .new-contract-page {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: #f0f2f8;
            z-index: 99999;
            overflow-y: auto;
            padding: 24px;
        }
        .new-contract-page.active {
            display: block;
        }
        .new-contract-page .top-bar {
            background: white;
            border-radius: 20px;
            padding: 16px 28px;
            margin-bottom: 24px;
            display: flex;
            justify-content: center;
            align-items: center;
            border: 1px solid #eef2f8;
            box-shadow: 0 2px 8px rgba(0,0,0,0.04);
        }
        .new-contract-page .top-bar-title {
            font-size: 1.2rem;
            font-weight: 700;
            color: #1b4a6e;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .new-contract-page .top-bar-title i {
            color: #ffb347;
        }
        .new-contract-page .main-card {
            background: white;
            border-radius: 24px;
            padding: 32px 36px;
            border: 1px solid #eef2f8;
            box-shadow: 0 4px 16px rgba(0,0,0,0.04);
            max-width: 1400px;
            margin: 0 auto;
        }
        /* ===== ИЗМЕНЕНО: 5 полей в ряд (добавлен НОМЕР ДОГОВОРА) ===== */
        .new-contract-page .top-fields {
            display: grid;
            grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr;
            gap: 16px;
            margin-bottom: 16px;
        }
        .new-contract-page .field-group {
            display: flex;
            flex-direction: column;
            gap: 6px;
        }
        .new-contract-page .field-group label {
            font-size: 0.65rem;
            font-weight: 600;
            color: #5b6e8c;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            display: flex;
            align-items: center;
            gap: 6px;
        }
        .new-contract-page .field-group label i {
            font-size: 0.7rem;
            color: #94a3b8;
        }
        .new-contract-page .field-group select,
        .new-contract-page .field-group input {
            padding: 10px 14px;
            border: 1px solid #dce3ec;
            border-radius: 12px;
            font-size: 0.85rem;
            font-family: 'Inter', sans-serif;
            background: white;
            width: 100%;
            transition: all 0.2s;
        }
        .new-contract-page .field-group select:focus,
        .new-contract-page .field-group input:focus {
            border-color: #ffb347;
            box-shadow: 0 0 0 3px rgba(255, 179, 71, 0.15);
            outline: none;
        }
        .new-contract-page .divider-line {
            border: none;
            border-top: 2px dashed #dce3ec;
            margin: 16px 0;
        }
        .new-contract-page .total-block {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 14px 20px;
            background: #f8fafc;
            border-radius: 16px;
            border: 2px solid #ffb347;
            margin-bottom: 28px;
        }
        .new-contract-page .total-label {
            font-size: 0.9rem;
            font-weight: 700;
            color: #1b4a6e;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .new-contract-page .total-label i {
            color: #f59e0b;
            font-size: 1.2rem;
        }
        .new-contract-page .total-amount {
            font-size: 1.4rem;
            font-weight: 700;
            color: #1b4a6e;
        }
        .new-contract-page .two-columns {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 40px;
            margin-top: 8px;
        }
        .new-contract-page .column-title {
            font-size: 0.85rem;
            font-weight: 700;
            color: #1b4a6e;
            margin-bottom: 16px;
            padding-bottom: 10px;
            border-bottom: 2px solid #f0f4f9;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .new-contract-page .column-title i {
            font-size: 1rem;
        }
        .new-contract-page .form-row {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 16px;
            margin-bottom: 14px;
        }
        .new-contract-page .form-row-three {
            display: grid;
            grid-template-columns: 1fr 1fr 1fr;
            gap: 16px;
            margin-bottom: 14px;
        }
        .new-contract-page .form-group {
            display: flex;
            flex-direction: column;
            gap: 4px;
        }
        .new-contract-page .form-group label {
            font-size: 0.7rem;
            font-weight: 600;
            color: #5b6e8c;
            display: flex;
            align-items: center;
            gap: 6px;
        }
        .new-contract-page .form-group label i {
            font-size: 0.7rem;
            color: #94a3b8;
        }
        .new-contract-page .form-group input,
        .new-contract-page .form-group select {
            padding: 10px 14px;
            border: 1px solid #dce3ec;
            border-radius: 12px;
            font-size: 0.85rem;
            font-family: 'Inter', sans-serif;
            background: white;
            width: 100%;
            transition: all 0.2s;
        }
        .new-contract-page .form-group input:focus,
        .new-contract-page .form-group select:focus {
            border-color: #ffb347;
            box-shadow: 0 0 0 3px rgba(255, 179, 71, 0.15);
            outline: none;
        }
        .new-contract-page .form-group input:disabled {
            background: #f1f5f9;
            color: #5b6e8c;
        }
        .new-contract-page .input-stir {
            letter-spacing: 1px;
            font-family: monospace;
        }
        .new-contract-page .input-mfo {
            letter-spacing: 1px;
            font-family: monospace;
        }
        .new-contract-page .required {
            color: #dc2626;
            margin-left: 2px;
        }
        .new-contract-page .bottom-buttons {
            display: flex;
            justify-content: flex-end;
            gap: 16px;
            margin-top: 28px;
            padding-top: 18px;
            border-top: 2px solid #f0f4f9;
        }
        .new-contract-page .btn-cancel {
            background: #e2e8f0;
            color: #334155;
            border: none;
            padding: 12px 32px;
            border-radius: 40px;
            font-weight: 600;
            font-size: 0.85rem;
            cursor: pointer;
            transition: all 0.2s;
        }
        .new-contract-page .btn-cancel:hover {
            background: #cbd5e1;
            transform: translateY(-2px);
        }
        .new-contract-page .btn-save {
            background: #10b981;
            color: white;
            border: none;
            padding: 12px 32px;
            border-radius: 40px;
            font-weight: 600;
            font-size: 0.85rem;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 10px;
            transition: all 0.2s;
        }
        .new-contract-page .btn-save:hover {
            background: #059669;
            transform: translateY(-2px);
            box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
        }
        @media (max-width: 1024px) {
            .new-contract-page .top-fields {
                grid-template-columns: 1fr 1fr 1fr;
            }
            .new-contract-page .two-columns {
                grid-template-columns: 1fr;
            }
        }
        @media (max-width: 768px) {
    .new-contract-page .top-fields {
        grid-template-columns: auto auto;
    }
            .new-contract-page .form-row {
                grid-template-columns: 1fr;
            }
            .new-contract-page .form-row-three {
                grid-template-columns: 1fr;
            }
            .new-contract-page .main-card {
                padding: 20px;
            }
            .new-contract-page .total-block {
                flex-direction: column;
                gap: 8px;
                text-align: center;
            }
            .new-contract-page .bottom-buttons {
                flex-direction: column-reverse;
            }
            .new-contract-page .bottom-buttons button {
                width: 100%;
                justify-content: center;
            }
        }
        @media (max-width: 480px) {
    .new-contract-page .top-fields {
        grid-template-columns: auto;
    }
        }

        .sticky-header {
    background: #f0f2f8 !important;
    padding-top: 4px !important;
    padding-bottom: 4px !important;
}
        .sticky-header .stats-cards {
            margin-bottom: 4px;
            margin-top: 4px;
        }
        .sticky-header .stats-header {
            margin-bottom: 0;
        }
        .sticky-header .stat-card {
            padding: 12px 12px;
        }
        .sticky-header .stat-card .stat-number {
            font-size: 1.3rem;
        }
        @media (max-width: 768px) {
            .sticky-header {
                position: sticky;
                top: 0;
                padding-top: 2px;
                padding-bottom: 2px;
            }
            .sticky-header .stats-cards {
                gap: 6px;
            }
            .sticky-header .stat-card {
                padding: 8px 6px;
            }
            .sticky-header .stat-card .stat-number {
                font-size: 1rem;
            }
            .sticky-header .stat-card .stat-label {
                font-size: 0.55rem;
            }
        }

        .main-menu {
            position: sticky !important;
            top: 0 !important;
            z-index: 1000 !important;
            background: #1b4a6e !important;
            border-radius: 60px !important;
            padding: 8px 24px !important;
            margin-bottom: 16px !important;
            display: flex !important;
            flex-wrap: wrap !important;
            justify-content: space-between !important;
            align-items: center !important;
            gap: 20px !important;
            border: 1px solid #eef2f8 !important;
            box-shadow: 0 2px 8px rgba(0,0,0,0.03) !important;
        }
        .sticky-header .stats-cards {
            margin-bottom: 4px !important;
            margin-top: 4px !important;
        }
        .sticky-header .stats-header {
            margin-bottom: 0 !important;
        }
        .sticky-header .stat-card {
            padding: 12px 12px !important;
        }
        .sticky-header .stat-card .stat-number {
            font-size: 1.3rem !important;
        }
        @media (max-width: 768px) {
            .main-menu {
                position: sticky !important;
                top: 0 !important;
                border-radius: 20px !important;
                padding: 12px 16px !important;
                margin-bottom: 10px !important;
            }
            .sticky-header {
                top: 70px !important;
                padding-top: 2px !important;
                padding-bottom: 2px !important;
            }
            .sticky-header .stats-cards {
                gap: 6px !important;
            }
            .sticky-header .stat-card {
                padding: 8px 6px !important;
            }
            .sticky-header .stat-card .stat-number {
                font-size: 1rem !important;
            }
            .sticky-header .stat-card .stat-label {
                font-size: 0.55rem !important;
            }
        }

        /* ===== НОВЫЕ СТИЛИ ДЛЯ ПРАВ ДОСТУПА ===== */
        .permission-group {
            background: #f8fafc;
            border-radius: 12px;
            padding: 15px;
            margin-bottom: 12px;
            border: 1px solid #eef2f8;
        }
        .permission-group h4 {
            color: #1b4a6e;
            margin-bottom: 10px;
            font-size: 0.85rem;
        }
        .permission-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
            gap: 8px;
        }
        .permission-item {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 0.75rem;
            color: #1e293b;
        }
        .permission-item input[type="checkbox"] {
            width: 16px;
            height: 16px;
            accent-color: #1b4a6e;
            cursor: pointer;
        }
        .permission-item label {
            cursor: pointer;
            font-weight: 400;
        }
        .permission-item.disabled {
            opacity: 0.5;
        }
        .permission-item.disabled input {
            pointer-events: none;
        }
        .permission-badge {
            display: inline-block;
            padding: 2px 8px;
            border-radius: 12px;
            font-size: 0.6rem;
            font-weight: 600;
            margin: 1px;
        }
        .permission-badge.green { background: #dcfce7; color: #15803d; }
        .permission-badge.red { background: #fee2e2; color: #dc2626; }
        .permission-badge.gray { background: #f1f5f9; color: #5b6e8c; }

        .permissions-popup {
            position: relative;
            display: inline-block;
            cursor: pointer;
        }
        .permissions-popup .permissions-tooltip {
            visibility: hidden;
            width: 300px;
            background: white;
            color: #1e293b;
            text-align: left;
            border-radius: 12px;
            padding: 12px 16px;
            border: 1px solid #eef2f8;
            box-shadow: 0 8px 30px rgba(0,0,0,0.15);
            position: absolute;
            z-index: 1000;
            bottom: 125%;
            left: 50%;
            transform: translateX(-50%);
            opacity: 0;
            transition: opacity 0.3s;
            font-size: 0.7rem;
            line-height: 1.6;
        }
        .permissions-popup:hover .permissions-tooltip {
            visibility: visible;
            opacity: 1;
        }
        .permissions-tooltip .perm-item {
            display: inline-block;
            padding: 2px 8px;
            border-radius: 12px;
            margin: 2px;
            font-size: 0.6rem;
            background: #f1f5f9;
            color: #1e293b;
        }
        .permissions-tooltip .perm-item.granted {
            background: #dcfce7;
            color: #15803d;
        }
        .permissions-tooltip .perm-item.denied {
            background: #fee2e2;
            color: #dc2626;
            opacity: 0.5;
        }

        /* ===== ДОБАВЛЕН СТИЛЬ ДЛЯ МОДАЛЬНОГО ОКНА КАРТОЧКИ ===== */
        .contract-modal-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.6);
            z-index: 10000;
            justify-content: center;
            align-items: center;
            padding: 20px;
            box-sizing: border-box;
            overflow-y: auto;
        }
        .contract-modal-overlay.active {
            display: flex;
        }
        .contract-modal-box {
            background: white;
            border-radius: 24px;
            width: 100%;
            max-width: 1400px;
            max-height: 90vh;
            overflow-y: auto;
            padding: 30px 32px;
            box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
            position: relative;
        }
        .contract-modal-box .close-modal-btn {
            position: sticky;
            top: 0;
            float: right;
            background: none;
            border: none;
            font-size: 28px;
            cursor: pointer;
            color: #94a3b8;
            z-index: 10;
            padding: 0 0 0 20px;
            line-height: 1;
        }
        .contract-modal-box .close-modal-btn:hover {
            color: #1e293b;
        }
        .contract-modal-box .modal-two-columns {
            display: flex;
            gap: 30px;
            flex-wrap: wrap;
            margin-top: 10px;
        }
        .contract-modal-box .modal-left {
            flex: 35;
            min-width: 300px;
        }
        .contract-modal-box .modal-right {
            flex: 65;
            min-width: 280px;
        }
        /* Стили для содержимого внутри модального окна — такие же как в оригинале */
        .contract-modal-box .contract-info-block {
            background: #f8fafd;
            border-radius: 16px;
            padding: 20px;
            border: 1px solid #eef2f8;
        }
        .contract-modal-box .contract-side-block {
            background: #f8fafd;
            border-radius: 16px;
            padding: 20px;
            border: 1px solid #eef2f8;
        }
        /* Адаптация */
        @media (max-width: 768px) {
            .contract-modal-box .modal-two-columns {
                flex-direction: column;
            }
            .contract-modal-box .modal-left,
            .contract-modal-box .modal-right {
                flex: 1 1 100%;
                min-width: 0;
            }
            .contract-modal-box {
                padding: 20px 16px;
            }
        }
                                /* ===== НОВЫЕ СТИЛИ ДЛЯ ПОЛЕЙ ПОСТАВЩИКА ===== */
        /* ===== КАЖДОЕ ПОЛЕ ПОДСТРАИВАЕТСЯ ПОД СОДЕРЖИМОЕ ===== */
        .new-contract-page .supplier-field-group {
            display: flex;
            flex-direction: column;
            gap: 4px;
            min-width: 0;
            flex: 1 1 auto;
        }
        .new-contract-page .supplier-field-group label {
            font-size: 0.65rem;
            font-weight: 600;
            color: #5b6e8c;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .new-contract-page .supplier-field-group input {
            padding: 10px 14px;
            border: 1px solid #dce3ec;
            border-radius: 12px;
            font-size: 0.85rem;
            font-family: 'Inter', sans-serif;
            background: #f1f5f9;
            width: auto;
            min-width: 60px;
            max-width: 100%;
            box-sizing: border-box;
            transition: all 0.2s;
            height: auto;
            min-height: 44px;
            max-height: none;
            line-height: 1.4;
            word-wrap: break-word;
            word-break: break-word;
            overflow-wrap: break-word;
            white-space: normal;
            display: inline-block;
            flex: 0 1 auto;
        }
        .new-contract-page .supplier-field-group input:focus {
            border-color: #ffb347;
            box-shadow: 0 0 0 3px rgba(255, 179, 71, 0.15);
            outline: none;
        }
                /* ===== ДЛЯ DISABLED ПОЛЕЙ (НЕ МЕНЯЕМ) ===== */
        .new-contract-page .supplier-field-group input[disabled] {
            background: #f1f5f9;
            color: #1e293b;
            cursor: default;
            opacity: 1;
            -webkit-text-fill-color: #1e293b;
        }

        /* ===== НОВЫЕ ПРАВИЛА ДЛЯ ПОЛЕЙ, ЧТОБЫ ОНИ ПОДСТРАИВАЛИСЬ ПОД ТЕКСТ ===== */

/* 1. САМИ ПОЛЯ ВВОДА */
.new-contract-page .supplier-field-group input {
    width: auto;
    min-width: 80px;
    max-width: 100%;
    box-sizing: border-box;
    padding: 10px 14px;
    border: 1px solid #dce3ec;
    border-radius: 12px;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    background: #f1f5f9;
    height: auto;
    min-height: 44px;
    line-height: 1.4;
    transition: all 0.2s;
    white-space: normal;
    word-wrap: break-word;
}

/* 2. КОНТЕЙНЕР ДЛЯ ПОЛЯ */
.new-contract-page .supplier-field-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1 1 auto;
}

/* 3. ПОДПИСИ К ПОЛЯМ */
.new-contract-page .supplier-field-group label {
    font-size: 0.65rem;
    font-weight: 600;
    color: #5b6e8c;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* ===== СЕТКА ДЛЯ ПОЛЕЙ ===== */
.new-contract-page .supplier-grid {
    display: grid;
    gap: 16px;
    margin-bottom: 14px;
    width: 100%;
}

/* ===== 3 КОЛОНКИ ===== */
.new-contract-page .supplier-grid-3 {
    grid-template-columns: auto auto auto;
}

/* ===== 4 КОЛОНКИ ===== */
.new-contract-page .supplier-grid-4 {
    grid-template-columns: auto auto auto auto;
}

/* ===== ИНДИВИДУАЛЬНЫЕ РАЗМЕРЫ ДЛЯ КАЖДОГО ПОЛЯ ===== */

/* 1. Поле "Наименование организации" */
.new-contract-page .supplier-field-group input#newSupplierName {
    min-width: 200px;
    max-width: 600px;
}

/* 2. Поле "Директор" */
.new-contract-page .supplier-field-group input#newSupplierDirector {
    min-width: 200px;
    max-width: 600px;
}

/* 3. Поле "На основание" */
.new-contract-page .supplier-field-group input#newSupplierBasis {
    min-width: 60px;
    max-width: 80px;
}

/* 4. Поле "ИНН" */
.new-contract-page .supplier-field-group input#newSupplierInn {
    min-width: 70px;
    max-width: 105px;
}

/* 5. Поле "Юридический адрес" */
.new-contract-page .supplier-field-group input#newSupplierAddress {
    min-width: 250px;
    max-width: 800px;
}

/* 6. Поле "Телефон" */
.new-contract-page .supplier-field-group input#newSupplierPhone {
    min-width: 100px;
    max-width: 130px;
}

/* 7. Поле "Банковский счёт" */
.new-contract-page .supplier-field-group input#newSupplierBankAccount {
    min-width: 200px;
    max-width: 500px;
}

/* 8. Поле "Рег. номер НДС" */
.new-contract-page .supplier-field-group input#newSupplierVatNumber {
    min-width: 130px;
    max-width: 130px;
}

/* 9. Поле "ОКЭД" */
.new-contract-page .supplier-field-group input#newSupplierOked {
    min-width: 100px;
    max-width: 100px;
}

/* 10. Поле "МФО банка" */
.new-contract-page .supplier-field-group input#newSupplierMfo {
    min-width: 100px;
    max-width: 100px;
}

/* ===== АДАПТАЦИЯ ДЛЯ МАЛЕНЬКИХ ЭКРАНОВ ===== */
@media (max-width: 768px) {
    .new-contract-page .supplier-grid-3 {
        grid-template-columns: minmax(60px, auto) minmax(60px, auto);
    }
    .new-contract-page .supplier-grid-4 {
        grid-template-columns: minmax(60px, auto) minmax(60px, auto);
    }
    
    /* ===== АДАПТИВНЫЙ ЛОГОТИП ===== */
    .logo-icon {
        width: 40px !important;
        height: 40px !important;
        font-size: 1.5rem !important;
        border-radius: 10px !important;
    }
    .logo-icon img {
        width: 40px !important;
        height: 40px !important;
        border-radius: 10px !important;
    }
    .logo-text h2 {
        font-size: 0.8rem !important;
    }
    .logo-text p {
        font-size: 0.5rem !important;
    }
    .logo-area {
        gap: 6px !important;
    }
    .main-menu {
        padding: 6px 12px !important;
        gap: 10px !important;
    }
}

@media (max-width: 480px) {
    .new-contract-page .supplier-grid-3 {
        grid-template-columns: minmax(60px, auto);
    }
    .new-contract-page .supplier-grid-4 {
        grid-template-columns: minmax(60px, auto);
    }
    
    /* ===== АДАПТИВНЫЙ ЛОГОТИП (ТЕЛЕФОНЫ) ===== */
    .logo-icon {
        width: 32px !important;
        height: 32px !important;
        font-size: 1.2rem !important;
        border-radius: 8px !important;
    }
    .logo-icon img {
        width: 32px !important;
        height: 32px !important;
        border-radius: 8px !important;
    }
    .logo-text h2 {
        font-size: 0.7rem !important;
    }
    .logo-text p {
        font-size: 0.45rem !important;
    }
    .logo-area {
        gap: 4px !important;
    }
    .main-menu {
        padding: 4px 8px !important;
        gap: 6px !important;
    }
}

        /* ===== СКРЫВАЕМ КОНТЕНТ ДО ЗАГРУЗКИ ===== */
        #mainPage {
            opacity: 0;
            transition: opacity 0.1s ease;
        }
        #mainPage.visible {
            opacity: 1;
        }


/* ===== ЛИЧНЫЙ ПРОФИЛЬ ===== */
.profile-modal-overlay{position:fixed;inset:0;z-index:10000;background:rgba(15,23,42,.55);backdrop-filter:blur(5px);display:flex;align-items:center;justify-content:center;padding:20px;overflow:auto}
.profile-modal{width:min(620px,100%);max-height:calc(100vh - 40px);overflow:auto;background:#fff;border:1px solid #e7edf5;border-radius:28px;box-shadow:0 24px 80px rgba(15,23,42,.28);padding:28px;color:#1e293b;position:relative}
.profile-modal-close{position:absolute;right:18px;top:16px;width:38px;height:38px;border:0;border-radius:50%;background:#f1f5f9;color:#475569;font-size:25px;line-height:1;cursor:pointer}
.profile-modal-close:hover{background:#e2e8f0}
.profile-modal-header{display:flex;align-items:center;gap:18px;padding:4px 45px 24px 4px}
.profile-modal-header h2{margin:0 0 5px;font-size:1.25rem;color:#1b4a6e}
.profile-role{font-size:.82rem;color:#64748b;font-weight:600}
.profile-avatar-large{width:82px;height:82px;flex:none;border-radius:50%;overflow:hidden;background:linear-gradient(145deg,#eaf0f7,#dce5ef);display:flex;align-items:center;justify-content:center;color:#64748b;font-size:38px;border:4px solid #fff;box-shadow:0 6px 18px rgba(27,74,110,.12)}
.profile-avatar-large img{width:100%;height:100%;object-fit:cover;display:block}
.profile-section{border-top:1px solid #edf1f6;padding:20px 0 2px;margin-top:4px}
.profile-section-title{display:flex;align-items:center;gap:9px;color:#1b4a6e;font-weight:800;font-size:.92rem;margin-bottom:14px}
.profile-section-title i{color:#ffb347;width:18px;text-align:center}
.profile-avatar-actions{display:flex;gap:10px;flex-wrap:wrap}
.profile-action-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:42px;padding:10px 14px;border-radius:12px;border:1px solid #dce3ec;background:#f8fafc;color:#334155;font:600 .78rem Inter,sans-serif;cursor:pointer;transition:.2s}
.profile-upload-btn{background:#eef2ff;color:#3730a3;border-color:#dbe2ff}
.profile-delete-btn{background:#fff1f2;color:#dc2626;border-color:#fecdd3}
.profile-action-btn:disabled{opacity:.45;cursor:not-allowed;transform:none!important;filter:none!important}
.profile-hint{font-size:.72rem;color:#94a3b8;margin-top:9px}
.profile-field{margin-bottom:12px}
.profile-field label{display:block;font-size:.72rem;font-weight:700;color:#64748b;margin:0 0 6px}
.profile-field input{width:100%;padding:11px 13px;border:1px solid #dce3ec;border-radius:12px;background:#fff;color:#1e293b;font:500 .84rem Inter,sans-serif}
.profile-fields-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.profile-save-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:42px;padding:10px 17px;border:0;border-radius:12px;background:#1b4a6e;color:#fff;font:700 .8rem Inter,sans-serif;cursor:pointer;margin-top:2px}
.profile-save-btn:hover{background:#153b59}
.profile-save-btn:disabled{opacity:.6;cursor:wait;transform:none!important;filter:none!important}
.profile-save-btn.is-loading{cursor:wait}
@media(max-width:600px){
 .profile-modal-overlay{padding:10px;align-items:flex-start}
 .profile-modal{max-height:calc(100vh - 20px);border-radius:20px;padding:20px 16px}
 .profile-modal-header{gap:12px;padding-right:42px}
 .profile-avatar-large{width:68px;height:68px;font-size:30px}
 .profile-modal-header h2{font-size:1rem}
 .profile-fields-grid{grid-template-columns:1fr}
 .profile-avatar-actions{flex-direction:column}
 .profile-action-btn,.profile-save-btn{width:100%}
}

/* ===== PROFILE / USER MENU PREMIUM OVERRIDES ===== */
.user-menu-wrapper{position:relative}
.user-menu-btn{display:flex!important;align-items:center;gap:10px!important;min-height:46px!important;padding:5px 12px 5px 7px!important;border:1px solid rgba(255,255,255,.22)!important;border-radius:16px!important;background:rgba(255,255,255,.10)!important;box-shadow:0 8px 24px rgba(15,23,42,.12)!important;backdrop-filter:blur(10px)!important;transition:transform .2s,background .2s,box-shadow .2s!important}
.user-menu-btn:hover,.user-menu-btn.open{transform:translateY(-1px);background:rgba(255,255,255,.17)!important;box-shadow:0 10px 28px rgba(15,23,42,.18)!important}
#userAvatarWrap{width:36px!important;height:36px!important;border:2px solid rgba(255,255,255,.7)!important;box-shadow:0 3px 12px rgba(0,0,0,.14)}
#userAvatarWrap i{font-size:29px!important;color:#fff}
#userAvatarWrap img{width:100%;height:100%;object-fit:cover}
.user-name{font-weight:800!important;letter-spacing:.1px}
.user-dropdown{min-width:280px!important;padding:9px!important;border-radius:20px!important;border:1px solid #e8edf4!important;box-shadow:0 20px 55px rgba(15,23,42,.20)!important;background:rgba(255,255,255,.98)!important}
.user-dropdown.open{animation:profileDropIn .16s ease-out}
.user-dropdown .dropdown-item{border-radius:13px!important;margin:3px 0!important;min-height:44px!important;font-weight:700!important}
.user-dropdown .dropdown-item:hover{background:#f4f7fb!important;transform:translateX(2px)}
.user-dropdown .logout-item{color:#dc2626!important}
.user-dropdown .dropdown-divider{margin:8px 4px!important}
@keyframes profileDropIn{from{opacity:0;transform:translateY(-5px) scale(.985)}to{opacity:1;transform:none}}
.profile-modal-overlay{padding:14px!important;background:rgba(15,23,42,.62)!important;backdrop-filter:blur(9px)!important}
.profile-modal{width:min(680px,100%)!important;border-radius:30px!important;padding:30px!important;background:linear-gradient(180deg,#fff 0%,#fbfdff 100%)!important;box-shadow:0 30px 100px rgba(15,23,42,.32)!important}
.profile-modal-header{padding:3px 48px 24px 3px!important}
.profile-avatar-large{width:96px!important;height:96px!important;border-radius:28px!important;border:1px solid #e5ebf3!important;box-shadow:0 12px 30px rgba(27,74,110,.16)!important;background:linear-gradient(145deg,#edf4fb,#dfe9f4)!important}
.profile-modal-header h2{font-size:1.45rem!important;font-weight:850!important}
.profile-role{display:inline-flex!important;padding:5px 9px!important;border-radius:999px!important;background:#f1f5f9!important}
.profile-section{padding:22px 0 5px!important}
.profile-field input{min-height:46px!important;border-radius:14px!important;background:#f8fafc!important}
.profile-field input:focus{outline:none!important;background:#fff!important;border-color:#8aa9c2!important;box-shadow:0 0 0 4px rgba(27,74,110,.08)!important}
.profile-action-btn{min-height:44px!important;border-radius:13px!important;font-weight:800!important;box-shadow:0 4px 12px rgba(15,23,42,.05)!important}
.profile-action-btn:hover:not(:disabled){transform:translateY(-1px)!important;box-shadow:0 7px 18px rgba(15,23,42,.10)!important}
.profile-upload-btn{background:#eef6ff!important;color:#1b4a6e!important}
.profile-delete-btn{background:#fff5f5!important}
.profile-modal-close{width:42px!important;height:42px!important;right:15px!important;top:14px!important;background:#f4f7fb!important}
@media(max-width:600px){
 .user-name{max-width:130px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
 .user-dropdown{position:fixed!important;top:70px!important;right:10px!important;left:10px!important;min-width:0!important;width:auto!important}
 .profile-modal-overlay{align-items:flex-end!important;padding:0!important}
 .profile-modal{width:100%!important;max-height:92vh!important;border-radius:28px 28px 0 0!important;padding:22px 18px calc(22px + env(safe-area-inset-bottom))!important}
 .profile-modal-header{gap:14px!important;padding-right:44px!important}
 .profile-avatar-large{width:76px!important;height:76px!important;border-radius:22px!important}
 .profile-modal-header h2{font-size:1.18rem!important}
 .profile-avatar-actions{display:grid!important;grid-template-columns:1fr 1fr!important}
 .profile-action-btn{width:100%!important}
}
