﻿:root {
            --bg: #f4f4f5;
            --surface: #ffffff;
            --border: #e4e4e7;
            --border-strong: #d4d4d8;
            --text: #18181b;
            --text-muted: #71717a;
            --accent: #18181b;
            --accent-hover: #3f3f46;
            --focus: #2563eb;
            --radius: 4px;
            --radius-sm: 3px;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
            background: var(--bg);
            color: var(--text);
            min-height: 100vh;
            padding: 24px;
            -webkit-font-smoothing: antialiased;
        }
        
        .container {
            max-width: 1200px;
            margin: 0 auto;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            padding: 28px;
        }
        
        h1 {
            color: var(--text);
            margin-bottom: 0;
            font-size: 22px;
            font-weight: 600;
            letter-spacing: -0.02em;
        }
        
        .tabs {
            display: flex;
            gap: 10px;
            margin-bottom: 30px;
            border-bottom: 2px solid #e0e0e0;
        }
        
        .tab {
            padding: 12px 24px;
            background: none;
            border: none;
            cursor: pointer;
            font-size: 16px;
            font-weight: 600;
            color: #666;
            border-bottom: 3px solid transparent;
            transition: all 0.3s;
        }
        
        .tab.active {
            color: var(--text);
            border-bottom-color: var(--text);
        }
        
        .tab:hover {
            color: var(--text);
        }
        
        .tab-content {
            display: none;
        }
        
        .tab-content.active {
            display: block;
        }
        
        .form-section {
            margin-bottom: 30px;
        }
        
        .form-section h2 {
            color: #333;
            margin-bottom: 20px;
            font-size: 20px;
            border-left: 4px solid #667eea;
            padding-left: 15px;
        }
        
        .form-group {
            margin-bottom: 20px;
        }
        
        label {
            display: block;
            margin-bottom: 8px;
            color: #555;
            font-weight: 500;
        }
        
        input[type="text"],
        input[type="number"],
        input[type="date"],
        input[type="email"],
        input[type="password"],
        textarea,
        select {
            width: 100%;
            padding: 10px 12px;
            border: 1px solid var(--border-strong);
            border-radius: var(--radius-sm);
            font-size: 14px;
            font-family: inherit;
            background: var(--surface);
            color: var(--text);
            transition: border-color 0.15s, box-shadow 0.15s;
        }
        
        input:focus,
        textarea:focus,
        select:focus {
            outline: none;
            border-color: var(--focus);
            box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
        }
        
        textarea {
            resize: vertical;
            min-height: 80px;
        }
        
        .form-row {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 20px;
        }
        
        @media (max-width: 768px) {
            .form-row {
                grid-template-columns: 1fr;
            }
        }
        
        .checkbox-group {
            display: flex;
            gap: 15px;
            align-items: center;
        }
        
        .checkbox-group input[type="checkbox"] {
            width: auto;
        }
        
        .radio-group {
            display: flex;
            gap: 20px;
            align-items: center;
        }
        
        .radio-group label {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 0;
            cursor: pointer;
        }
        
        .radio-group input[type="radio"] {
            width: auto;
        }
        
        .agent-selector {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
            gap: 15px;
            margin-top: 10px;
        }
        
        .agent-checkbox {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 10px;
            border: 2px solid #e0e0e0;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.3s;
        }
        
        .agent-checkbox:hover {
            border-color: #667eea;
            background: #f8f9ff;
        }
        
        .agent-checkbox input[type="checkbox"] {
            width: auto;
        }
        
        .agent-checkbox.selected {
            border-color: #667eea;
            background: #f0f4ff;
        }
        
        .price-distribution {
            margin-top: 15px;
        }

        .commission-price-summary {
            padding: 12px 14px;
            border-radius: 8px;
            background: #f8f9fa;
            border: 2px solid #e0e0e0;
            font-size: 14px;
            line-height: 1.5;
        }

        .commission-price-summary.is-pending {
            border-color: #ffc107;
            background: #fffbf0;
        }

        .commission-price-summary.is-balanced {
            border-color: #28a745;
            background: #f0fff4;
        }

        .commission-price-summary.is-overflow {
            border-color: #dc3545;
            background: #fff5f5;
        }

        .commission-price-summary-status {
            margin: 6px 0 0;
            font-weight: 600;
        }

        .commission-price-wait {
            margin: 12px 0 0;
            padding: 12px;
            border-radius: 8px;
            background: #f0f4ff;
            border: 1px dashed #667eea;
            color: #555;
            font-size: 14px;
        }
        
        .price-item {
            margin-bottom: 15px;
            padding: 15px;
            border: 2px solid #e0e0e0;
            border-radius: 8px;
            background: #f8f9fa;
        }
        
        .price-item label {
            display: block;
            margin-bottom: 10px;
            font-weight: 600;
            color: #333;
        }

        .price-item-fields {
            display: grid;
            grid-template-columns: 1fr 1fr 1fr auto;
            gap: 10px;
            margin-top: 6px;
            align-items: end;
        }

        .price-item-paid {
            display: flex;
            align-items: center;
            gap: 8px;
            padding-bottom: 2px;
        }

        .commission-split-equally-btn {
            margin-bottom: 12px;
            padding: 8px 14px;
            border: 2px solid #667eea;
            border-radius: 8px;
            background: #f0f4ff;
            color: #667eea;
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
        }

        .commission-split-equally-btn:hover {
            background: #667eea;
            color: #fff;
        }

        .commission-price-summary-share {
            margin: 4px 0 0;
            font-size: 13px;
            color: #555;
        }

        @media (max-width: 768px) {
            .price-item-fields {
                grid-template-columns: 1fr 1fr;
            }

            .price-item-paid {
                grid-column: 1 / -1;
            }
        }
        
        .price-item .percent-display {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 8px;
            font-size: 14px;
        }
        
        .price-item .percent-display span {
            font-weight: 600;
            color: #667eea;
        }
        
        .master-slider-container {
            padding: 20px;
            border: 2px solid #667eea;
            border-radius: 8px;
            background: white;
            margin-bottom: 20px;
        }
        
        .master-slider-container label {
            display: block;
            margin-bottom: 15px;
            font-weight: 600;
            color: #333;
            font-size: 16px;
        }
        
        .slider-container {
            display: flex;
            align-items: center;
            gap: 15px;
        }
        
        .slider-container input[type="range"] {
            flex: 1;
            height: 10px;
            border-radius: 5px;
            background: linear-gradient(to right, #e0e0e0 0%, #667eea 100%);
            outline: none;
            -webkit-appearance: none;
            appearance: none;
        }
        
        .slider-container input[type="range"]::-webkit-slider-thumb {
            -webkit-appearance: none;
            appearance: none;
            width: 24px;
            height: 24px;
            border-radius: 50%;
            background: #667eea;
            cursor: pointer;
            transition: all 0.3s;
            box-shadow: 0 2px 6px rgba(102, 126, 234, 0.4);
        }
        
        .slider-container input[type="range"]::-webkit-slider-thumb:hover {
            background: #764ba2;
            transform: scale(1.15);
            box-shadow: 0 3px 8px rgba(102, 126, 234, 0.6);
        }
        
        .slider-container input[type="range"]::-moz-range-thumb {
            width: 24px;
            height: 24px;
            border-radius: 50%;
            background: #667eea;
            cursor: pointer;
            border: none;
            transition: all 0.3s;
            box-shadow: 0 2px 6px rgba(102, 126, 234, 0.4);
        }
        
        .slider-container input[type="range"]::-moz-range-thumb:hover {
            background: #764ba2;
            transform: scale(1.15);
            box-shadow: 0 3px 8px rgba(102, 126, 234, 0.6);
        }
        
        .slider-value {
            min-width: 60px;
            text-align: center;
            font-weight: 600;
            color: #667eea;
            font-size: 18px;
        }
        
        .total-percentage {
            margin-top: 15px;
            padding: 10px;
            background: white;
            border-radius: 8px;
            text-align: center;
            font-weight: 600;
        }
        
        .total-percentage.valid {
            color: #28a745;
            border: 2px solid #28a745;
        }
        
        .total-percentage.invalid {
            color: #dc3545;
            border: 2px solid #dc3545;
        }
        
        .yes-no-buttons {
            display: flex;
            gap: 10px;
        }
        
        .yes-no-btn {
            flex: 1;
            padding: 12px;
            border: 2px solid #e0e0e0;
            border-radius: 8px;
            background: white;
            color: #333;
            cursor: pointer;
            font-weight: 600;
            transition: all 0.3s;
        }
        
        .yes-no-btn.yes.active {
            background: #28a745;
            color: white;
            border-color: #28a745;
        }
        
        .yes-no-btn.no.active {
            background: #dc3545;
            color: white;
            border-color: #dc3545;
        }
        
        .yes-no-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        }
        
        button {
            padding: 10px 18px;
            background: var(--accent);
            color: #fff;
            border: 1px solid var(--accent);
            border-radius: var(--radius-sm);
            font-size: 14px;
            font-weight: 500;
            font-family: inherit;
            cursor: pointer;
            transition: background 0.15s, border-color 0.15s;
        }
        
        button:hover {
            background: var(--accent-hover);
            border-color: var(--accent-hover);
        }
        
        button.secondary {
            background: var(--surface);
            color: var(--text);
            border-color: var(--border-strong);
        }

        button.secondary:hover {
            background: var(--bg);
            border-color: var(--border-strong);
        }
        
        button.danger {
            background: #dc3545;
        }
        
        .button-group {
            display: flex;
            gap: 10px;
            margin-top: 30px;
        }
        
        .agent-list {
            margin-top: 20px;
        }

        .user-list {
            margin-top: 20px;
            display: grid;
            gap: 16px;
        }

        @media (min-width: 900px) {
            .user-list {
                grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
            }
        }

        .user-card {
            border: 2px solid #e0e0e0;
            border-radius: 12px;
            padding: 20px;
            background: #f8f9fa;
        }

        .user-card h3 {
            color: #333;
            margin-bottom: 10px;
        }

        .user-card p {
            margin-bottom: 8px;
            color: #555;
            font-size: 14px;
        }

        .user-assignment-list {
            margin-top: 10px;
            padding-left: 18px;
            color: #555;
            font-size: 14px;
        }

        .user-assignment-list li {
            margin-bottom: 4px;
        }

        .user-login-events {
            margin-top: 14px;
            padding-top: 14px;
            border-top: 1px solid #dbe4ee;
        }

        .user-login-events-title {
            margin: 0 0 10px;
            color: #334155;
            font-weight: 600;
            font-size: 14px;
        }

        .user-login-empty {
            margin: 0;
            color: #64748b;
            font-size: 13px;
        }

        .user-login-event-list {
            list-style: none;
            padding: 0;
            margin: 0;
            display: grid;
            gap: 8px;
        }

        .user-login-event-item {
            padding: 10px 12px;
            border-radius: 10px;
            border: 1px solid #e2e8f0;
            background: #fff;
        }

        .user-login-event-meta {
            margin: 0;
            color: #334155;
            font-size: 13px;
            font-weight: 500;
        }

        .user-login-event-details {
            margin: 4px 0 0;
            color: #64748b;
            font-size: 12px;
            line-height: 1.45;
            word-break: break-word;
        }

        .user-login-more {
            margin-top: 10px;
        }

        .user-login-more summary {
            cursor: pointer;
            color: #7c3aed;
            font-size: 13px;
            font-weight: 600;
            list-style: none;
        }

        .user-login-more summary::-webkit-details-marker {
            display: none;
        }

        .user-login-more summary::before {
            content: "â–¸ ";
        }

        .user-login-more[open] summary::before {
            content: "â–¾ ";
        }

        .user-login-event-list.extra {
            margin-top: 10px;
        }

        .visually-hidden {
            position: absolute;
            width: 1px;
            height: 1px;
            padding: 0;
            margin: -1px;
            overflow: hidden;
            clip: rect(0, 0, 0, 0);
            white-space: nowrap;
            border: 0;
        }

        
        .agent-list-section {
            margin-bottom: 32px;
        }
        
        .agent-list-section:last-child {
            margin-bottom: 0;
        }
        
        .agent-list-section h3 {
            font-size: 1.1rem;
            color: #475569;
            margin-bottom: 12px;
            padding-bottom: 8px;
            border-bottom: 2px solid #e2e8f0;
        }
        
        .agent-list-section .agent-grid {
            display: flex;
            flex-direction: row;
            flex-wrap: nowrap;
            gap: 12px;
            overflow-x: auto;
            padding-bottom: 10px;
            scroll-snap-type: x proximity;
            -webkit-overflow-scrolling: touch;
        }

        .agent-list-section .agent-grid::-webkit-scrollbar {
            height: 8px;
        }

        .agent-list-section .agent-grid::-webkit-scrollbar-thumb {
            background: #cbd5e1;
            border-radius: 4px;
        }
        
        .agent-card {
            flex: 0 0 auto;
            min-width: 280px;
            max-width: 340px;
            border: 2px solid #e0e0e0;
            border-radius: 8px;
            padding: 14px 16px;
            background: #f8f9fa;
            scroll-snap-align: start;
        }

        .agent-card.inactive-team-member {
            opacity: 0.6;
            filter: grayscale(0.9);
            background: #f1f5f9;
            border-color: #cbd5e1;
        }
        
        .agent-card h3 {
            color: #333;
            margin-bottom: 15px;
        }
        
        .agent-card p {
            margin-bottom: 8px;
            color: #666;
            font-size: 14px;
        }
        
        .agent-card .badge {
            display: inline-block;
            padding: 4px 12px;
            border-radius: 12px;
            font-size: 12px;
            font-weight: 600;
            margin-top: 10px;
        }
        
        .badge.manager {
            background: #667eea;
            color: white;
        }
        
        .badge.builder {
            background: #28a745;
            color: white;
        }
        
        .badge.client {
            background: #ffc107;
            color: #333;
        }

        .badge.apprentice {
            background: #14b8a6;
            color: white;
        }

        .badge.engagement-active {
            background: #dcfce7;
            color: #166534;
        }

        .badge.engagement-attention {
            background: #fef9c3;
            color: #854d0e;
        }

        .badge.engagement-warn {
            background: #ffedd5;
            color: #c2410c;
        }

        .badge.engagement-sanction {
            background: #fee2e2;
            color: #b91c1c;
        }

        .engagement-hint {
            font-size: 14px;
            color: #64748b;
            margin: -8px 0 16px;
            line-height: 1.45;
        }

        .agent-card .engagement-line {
            margin-top: 10px;
            font-size: 14px;
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            align-items: center;
        }

        .badge.inactive-team {
            background: #334155;
            color: #fff;
            margin-left: 8px;
        }

        .agent-team-status-readonly {
            margin: 6px 0 0;
            padding: 10px 12px;
            border-radius: 8px;
            background: #ecfdf5;
            color: #166534;
            font-weight: 600;
            font-size: 14px;
        }

        .agent-team-status-readonly.is-inactive {
            background: #f1f5f9;
            color: #64748b;
        }

        #agentTeamStatusFields .field-label {
            display: block;
            font-weight: 600;
            color: #334155;
            margin-bottom: 4px;
        }

        .badge.pending-ign {
            background: #f97316;
            color: #fff;
            margin-left: 8px;
        }
        
        .commission-list {
            margin-top: 16px;
        }

        .commission-table-empty {
            text-align: center;
            color: #64748b;
            padding: 48px 24px;
            font-size: 15px;
        }

        .commission-table-wrap {
            overflow-x: auto;
            border: 1px solid #e2e8f0;
            border-radius: 10px;
            background: #fff;
        }

        .commission-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 13px;
            min-width: 960px;
        }

        .commission-table thead th {
            position: sticky;
            top: 0;
            z-index: 1;
            text-align: left;
            padding: 10px 12px;
            background: #f8fafc;
            color: #475569;
            font-size: 11px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            border-bottom: 2px solid #e2e8f0;
            white-space: nowrap;
        }

        .commission-table tbody td {
            padding: 10px 12px;
            border-bottom: 1px solid #eef2f7;
            color: #1e293b;
            vertical-align: middle;
        }

        .commission-table tbody tr:last-child td {
            border-bottom: none;
        }

        .commission-table tbody tr:hover {
            background: #f8fafc;
        }

        .commission-row.is-finished {
            background: #f0fdf4;
        }

        .commission-row.is-in-progress {
            background: #fff;
        }

        .commission-col-world,
        .commission-col-client,
        .commission-col-builders {
            max-width: 160px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .commission-col-builders {
            max-width: 200px;
        }

        .commission-col-price {
            font-weight: 600;
            white-space: nowrap;
        }

        .commission-col-date {
            white-space: nowrap;
            color: #475569;
        }

        .commission-col-state {
            white-space: nowrap;
        }

        .commission-col-edit {
            white-space: nowrap;
            width: 1%;
        }

        .commission-col-delete {
            white-space: nowrap;
            width: 1%;
            text-align: center;
        }

        .commission-row-badge {
            display: inline-block;
            padding: 3px 8px;
            border-radius: 999px;
            font-size: 11px;
            font-weight: 600;
        }

        .commission-row-badge.finished {
            background: #dcfce7;
            color: #166534;
        }

        .commission-row-badge.in-progress {
            background: #fef3c7;
            color: #92400e;
        }

        .commission-row-edit {
            padding: 6px 12px;
            border: 1px solid #cbd5e1;
            border-radius: 6px;
            background: #fff;
            color: #334155;
            font-size: 12px;
            font-weight: 600;
            cursor: pointer;
        }

        .commission-row-edit:hover {
            background: #667eea;
            border-color: #667eea;
            color: #fff;
        }

        .commission-form-actions {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            align-items: center;
        }

        .commission-form-delete {
            margin-left: auto;
        }

        .commission-row-muted {
            color: #94a3b8;
        }
        
        .commission-card {
            border: 1px solid #e2e8f0;
            border-radius: 12px;
            padding: 0;
            background: #fff;
            box-shadow: 0 1px 3px rgba(0,0,0,0.08);
            overflow: hidden;
            transition: box-shadow 0.2s, transform 0.2s;
        }
        
        .commission-card:hover {
            box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
        }
        
        .commission-card-header {
            padding: 18px 20px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: #fff;
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 10px;
        }
        
        .commission-card-header h3 {
            margin: 0;
            font-size: 1.15rem;
            font-weight: 600;
            letter-spacing: 0.02em;
        }
        
        .commission-card-price {
            font-size: 1.25rem;
            font-weight: 700;
            background: rgba(255,255,255,0.25);
            padding: 6px 12px;
            border-radius: 8px;
        }
        
        .commission-card-body {
            padding: 18px 20px;
        }
        
        .commission-card .info-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px 20px;
            font-size: 13px;
        }
        
        .commission-card .info-row {
            display: flex;
            flex-direction: column;
            gap: 2px;
            margin-bottom: 0;
        }
        
        .commission-card .info-label {
            font-weight: 600;
            color: #64748b;
            font-size: 11px;
            text-transform: uppercase;
            letter-spacing: 0.04em;
        }
        
        .commission-card .info-value {
            color: #1e293b;
            font-size: 14px;
        }
        
        .commission-card-status {
            display: inline-block;
            margin-top: 12px;
            padding: 4px 10px;
            border-radius: 20px;
            font-size: 12px;
            font-weight: 600;
        }
        
        .commission-card-status.ok {
            background: #dcfce7;
            color: #166534;
        }
        
        .commission-card-status.ko {
            background: #fee2e2;
            color: #991b1b;
        }
        
        .commission-card.finished {
            border-left: 4px solid #10b981;
        }
        .commission-card.in-progress {
            border-left: 4px solid #f59e0b;
        }
        .commission-card-badge {
            display: inline-block;
            padding: 4px 10px;
            border-radius: 20px;
            font-size: 12px;
            font-weight: 600;
            margin-left: 8px;
        }
        .commission-card-badge.finished {
            background: #dcfce7;
            color: #166534;
        }
        .commission-card-badge.in-progress {
            background: #fef3c7;
            color: #92400e;
        }
        
        .commission-card-actions {
            margin-top: 18px;
            padding-top: 16px;
            border-top: 1px solid #e2e8f0;
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
        }
        
        .commission-card-actions button {
            flex: 1;
            min-width: 100px;
            padding: 10px 14px;
            font-size: 13px;
            border-radius: 8px;
            font-weight: 500;
            transition: opacity 0.2s;
        }
        
        .commission-card-actions button:hover {
            opacity: 0.9;
        }
        
        .commission-card-actions button:first-of-type {
            background: #e0e7ff;
            color: #3730a3;
            border: none;
        }
        
        .commission-card-actions button:nth-of-type(2) {
            background: #667eea;
            color: #fff;
            border: none;
        }
        
        .commission-card-actions button.danger {
            background: #fef2f2;
            color: #b91c1c;
            border: 1px solid #fecaca;
        }
        
        .hidden {
            display: none;
        }
        
        .alert {
            padding: 15px;
            border-radius: 8px;
            margin-bottom: 20px;
        }
        
        .alert.success {
            background: #d4edda;
            color: #155724;
            border: 1px solid #c3e6cb;
        }
        
        .alert.error {
            background: #f8d7da;
            color: #721c24;
            border: 1px solid #f5c6cb;
        }
        
        .payment-method-item {
            border: 2px solid #e0e0e0;
            border-radius: 8px;
            padding: 15px;
            margin-bottom: 15px;
            background: #f8f9fa;
        }
        
        .payment-method-item .form-row {
            margin-bottom: 10px;
        }
        
        .payment-method-item .remove-payment {
            margin-top: 10px;
            padding: 8px 16px;
            font-size: 14px;
        }
        
        .analyst-kpi-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 20px;
            margin-bottom: 32px;
        }
        .analyst-kpi-card {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: #fff;
            padding: 20px;
            border-radius: 12px;
            box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
        }
        .analyst-kpi-card.outflow { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
        .analyst-kpi-card.team { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
        .analyst-kpi-card.lusciana { background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%); }
        .analyst-kpi-card h4 { font-size: 12px; opacity: 0.9; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.05em; }
        .analyst-kpi-card .value { font-size: 28px; font-weight: 700; }
        .analyst-section { margin-bottom: 32px; }
        .analyst-section h3 { margin-bottom: 16px; color: #333; font-size: 1.1rem; }
        .analyst-chart-wrap { position: relative; height: 280px; max-width: 100%; }
        .analyst-table { width: 100%; border-collapse: collapse; font-size: 14px; }
        .analyst-table th, .analyst-table td { padding: 12px; text-align: left; border-bottom: 1px solid #e2e8f0; }
        .analyst-table th { background: #f8fafc; color: #475569; font-weight: 600; }
        .analyst-table tr:hover { background: #f8fafc; }
        .transaction-amount.positive { color: #059669; font-weight: 600; }
        .transaction-amount.negative { color: #dc2626; font-weight: 600; }
        .transaction-type-badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
        .transaction-type-badge.commission { background: #dbeafe; color: #1e40af; }
        .transaction-type-badge.expense { background: #fee2e2; color: #991b1b; }
        .transaction-type-badge.builder { background: #dcfce7; color: #166534; }
        .transaction-type-badge.manager { background: #e0e7ff; color: #3730a3; }
        body.is-authenticated #appContainer {
            display: block;
        }
        .password-field-wrap {
            position: relative;
            display: flex;
            align-items: center;
            width: 100%;
        }

        .password-field-wrap input {
            width: 100%;
            padding-right: 40px;
            box-sizing: border-box;
        }

        .password-toggle-btn {
            position: absolute;
            right: 4px;
            top: 50%;
            transform: translateY(-50%);
            border: none;
            background: transparent;
            cursor: pointer;
            padding: 6px;
            line-height: 0;
            border-radius: var(--radius-sm);
            color: var(--text-muted);
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .password-toggle-btn:hover {
            background: var(--bg);
            color: var(--text);
        }

        .password-toggle-btn:focus-visible {
            outline: 2px solid var(--focus);
            outline-offset: 1px;
        }

        /* ——— Login & header auth ——— */
        .header-auth {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            flex-wrap: wrap;
            gap: 20px;
            margin-bottom: 24px;
            padding-bottom: 20px;
            border-bottom: 1px solid var(--border);
        }

        .app-brand-mark {
            font-size: 11px;
            font-weight: 600;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: var(--text-muted);
            margin-bottom: 6px;
        }

        .header-subtitle {
            margin-top: 8px;
            color: var(--text-muted);
            font-size: 14px;
            line-height: 1.5;
            max-width: 420px;
        }

        .auth-panel {
            display: flex;
            flex-direction: column;
            gap: 0;
            min-width: 280px;
        }

        .language-switcher {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 20px;
        }

        .language-switcher label {
            font-size: 13px;
            font-weight: 500;
            color: var(--text-muted);
            margin: 0;
        }

        .language-switcher select {
            min-width: 140px;
            padding: 8px 10px;
            font-size: 13px;
        }

        .login-form {
            display: flex;
            flex-direction: column;
            gap: 16px;
            width: 100%;
        }

        .login-form.hidden {
            display: none !important;
        }

        .login-field label {
            display: block;
            margin-bottom: 6px;
            font-size: 13px;
            font-weight: 500;
            color: var(--text);
        }

        .login-form .password-field-wrap {
            max-width: none;
            width: 100%;
        }

        .login-form .password-field-wrap input {
            width: 100%;
            max-width: none;
            padding-right: 40px;
        }

        .login-submit {
            width: 100%;
            padding: 11px 16px;
            margin-top: 4px;
            font-weight: 600;
        }

        .auth-status {
            margin: 0;
            font-size: 13px;
            color: var(--text-muted);
            text-align: left;
            line-height: 1.4;
        }

        .session-bar {
            display: flex;
            align-items: center;
            gap: 12px;
            flex-wrap: wrap;
        }

        .session-bar.hidden {
            display: none !important;
        }

        .session-user {
            font-size: 14px;
            color: var(--text);
            font-weight: 500;
        }

        .session-logout {
            padding: 8px 14px;
            font-size: 13px;
        }

        /* Mode visiteur : écran de connexion centré */
        body.is-guest {
            padding: 0;
            min-height: 100vh;
        }

        body.is-guest #appContainer {
            max-width: none;
            margin: 0;
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            border: none;
            border-radius: 0;
            background: var(--bg);
            padding: 32px 20px;
        }

        body.is-guest .header-auth {
            width: 100%;
            max-width: 400px;
            flex-direction: column;
            align-items: stretch;
            margin: 0;
            padding: 32px;
            border: 1px solid var(--border);
            border-radius: var(--radius);
            background: var(--surface);
            border-bottom: 1px solid var(--border);
        }

        body.is-guest .app-brand {
            margin-bottom: 4px;
        }

        body.is-guest .auth-panel {
            min-width: 0;
            width: 100%;
        }

        body.is-guest .language-switcher {
            justify-content: space-between;
            margin-bottom: 24px;
        }

        body.is-guest .tabs,
        body.is-guest .tab-content {
            display: none !important;
        }

        body.is-authenticated .header-auth {
            align-items: center;
        }

        body.is-authenticated .auth-panel {
            align-items: flex-end;
            text-align: right;
        }

        body.is-authenticated .language-switcher {
            justify-content: flex-end;
            margin-bottom: 12px;
        }

        body.is-authenticated .session-bar {
            justify-content: flex-end;
        }

        .tabs a.tab {
            text-decoration: none;
            display: inline-block;
        }

        @media (max-width: 640px) {
            body {
                padding: 10px;
            }

            .container {
                padding: 16px;
                border-radius: var(--radius);
            }

            h1 {
                font-size: 20px;
            }

            .form-section {
                margin-bottom: 20px;
            }

            .form-section h2 {
                font-size: 18px;
                margin-bottom: 16px;
            }

            body.is-guest .header-auth {
                padding: 24px 20px;
            }

            body.is-authenticated .header-auth {
                flex-direction: column;
                align-items: stretch;
            }

            body.is-authenticated .auth-panel {
                align-items: stretch;
                text-align: left;
            }

            .session-bar {
                flex-direction: column;
                align-items: stretch;
            }

            .session-logout {
                width: 100%;
            }

            .tabs {
                gap: 8px;
                margin-bottom: 20px;
                overflow-x: auto;
                overflow-y: hidden;
                flex-wrap: nowrap;
                padding-bottom: 8px;
                scrollbar-width: thin;
                -webkit-overflow-scrolling: touch;
            }

            .tabs a.tab,
            .tab {
                flex: 0 0 auto;
                white-space: nowrap;
                padding: 10px 14px;
                font-size: 14px;
            }

            .checkbox-group,
            .radio-group,
            .button-group,
            .slider-container {
                flex-direction: column;
                align-items: stretch;
            }

            .button-group {
                margin-top: 20px;
            }

            .button-group button,
            button,
            .payment-method-item .remove-payment,
            .commission-card-actions button {
                width: 100%;
            }

            .agent-selector,
            .agent-list-section .agent-grid,
            .commission-list,
            .user-list,
            .analyst-kpi-grid {
                grid-template-columns: 1fr;
            }

            .commission-card .info-grid,
            .payment-method-item .form-row {
                flex-direction: column;
            }

            .commission-card-header,
            .commission-card-body {
                padding: 14px;
            }

            .commission-card-header h3,
            .commission-card-price {
                width: 100%;
            }

            .commission-card-actions {
                flex-direction: column;
            }

            .analyst-chart-wrap {
                height: 220px;
            }

            .analyst-table {
                display: block;
                overflow-x: auto;
                white-space: nowrap;
                -webkit-overflow-scrolling: touch;
            }

            .analyst-table th,
            .analyst-table td {
                padding: 10px 8px;
                font-size: 13px;
            }
        }

        /* Formulaire commission compact */
        .commission-form-compact .form-section {
            margin-bottom: 18px;
        }

        .commission-form-compact .form-section h2 {
            margin-bottom: 12px;
            font-size: 16px;
            padding-left: 10px;
        }

        .commission-form-compact .form-group {
            margin-bottom: 12px;
        }

        .commission-form-compact .form-row-4 {
            grid-template-columns: repeat(4, 1fr);
            gap: 12px;
        }

        .commission-form-compact .form-row-5 {
            grid-template-columns: repeat(5, 1fr);
            gap: 12px;
        }

        @media (max-width: 1100px) {
            .commission-form-compact .form-row-5 {
                grid-template-columns: repeat(3, 1fr);
            }
        }

        @media (max-width: 900px) {
            .commission-form-compact .form-row-4 {
                grid-template-columns: repeat(2, 1fr);
            }

            .commission-form-compact .form-row-5 {
                grid-template-columns: repeat(2, 1fr);
            }
        }

        @media (max-width: 600px) {
            .commission-form-compact .form-row-4 {
                grid-template-columns: 1fr;
            }

            .commission-form-compact .form-row-5 {
                grid-template-columns: 1fr;
            }
        }

        .commission-form-compact .compact-label {
            display: block;
            margin-bottom: 6px;
            font-size: 13px;
            font-weight: 500;
            color: #555;
        }

        .commission-form-compact textarea {
            min-height: 56px;
        }

        .commission-flags-row {
            display: flex;
            flex-wrap: wrap;
            gap: 12px 24px;
            margin-bottom: 12px;
            align-items: center;
        }

        .commission-inline-check {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            margin: 0;
            font-size: 14px;
            font-weight: 500;
            color: #555;
            cursor: pointer;
        }

        .commission-inline-check input[type="checkbox"] {
            width: auto;
            margin: 0;
            cursor: pointer;
        }

        .client-select-row {
            display: flex;
            gap: 8px;
            align-items: stretch;
        }

        .client-select-row select {
            flex: 1;
        }

        .client-select-row .compact-btn {
            padding: 10px 12px;
            white-space: nowrap;
            flex-shrink: 0;
        }

        .radio-group-inline {
            display: flex;
            gap: 16px;
            align-items: center;
        }

        .radio-group-inline label {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            margin: 0;
            font-weight: 500;
            cursor: pointer;
        }

        .radio-group-inline input[type="radio"] {
            width: auto;
            margin: 0;
        }

        .commission-total-input {
            max-width: 180px;
        }

        .commission-new-client {
            margin-top: 8px;
            padding: 12px;
            background: var(--surface-muted, #f8f9fc);
            border-radius: var(--radius-sm);
        }

        .button-group.compact {
            gap: 8px;
        }

        .button-group.compact button {
            padding: 8px 14px;
        }

        .who-took-wrap {
            margin-top: 8px;
        }

        /* Tickets Discord : voir discord-tickets.css */

