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

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            color: #333;
            font-size: 16px;
            line-height: 1.5;
        }

        .container {
            max-width: 1400px;
            margin: 0 auto;
            padding: 10px;
        }

        @media (min-width: 768px) {
            .container {
                padding: 20px;
            }
        }

        .card {
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            border-radius: 15px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.1);
            padding: 20px;
            margin-bottom: 15px;
            width: 100%;
        }

        @media (min-width: 768px) {
            .card {
                border-radius: 20px;
                padding: 40px;
                margin-bottom: 20px;
                box-shadow: 0 20px 40px rgba(0,0,0,0.1);
            }
        }

        .header {
            text-align: center;
            margin-bottom: 25px;
        }

        @media (min-width: 768px) {
            .header {
                margin-bottom: 40px;
            }
        }

        .header h1 {
            color: #4a5568;
            font-size: 1.8em;
            margin-bottom: 8px;
            font-weight: 300;
        }

        @media (min-width: 768px) {
            .header h1 {
                font-size: 2.5em;
                margin-bottom: 10px;
            }
        }

        .header p {
            color: #718096;
            font-size: 1em;
        }

        @media (min-width: 768px) {
            .header p {
                font-size: 1.1em;
            }
        }

        .upload-section {
            text-align: center;
            padding: 20px;
        }

        @media (min-width: 768px) {
            .upload-section {
                padding: 40px;
            }
        }

        .upload-zone {
            border: 2px dashed #cbd5e0;
            border-radius: 12px;
            padding: 40px 15px;
            cursor: pointer;
            transition: all 0.3s ease;
            background: linear-gradient(45deg, #f7fafc 0%, #edf2f7 100%);
            touch-action: manipulation;
        }

        @media (min-width: 768px) {
            .upload-zone {
                border: 3px dashed #cbd5e0;
                border-radius: 15px;
                padding: 60px 20px;
            }
        }

        .upload-zone:hover, .upload-zone:active {
            border-color: #667eea;
            background: linear-gradient(45deg, #edf2f7 0%, #e2e8f0 100%);
            transform: translateY(-2px);
        }

        .upload-zone.dragover {
            border-color: #667eea;
            background: rgba(102, 126, 234, 0.1);
        }

        .upload-icon {
            font-size: 3em;
            color: #a0aec0;
            margin-bottom: 15px;
        }

        @media (min-width: 768px) {
            .upload-icon {
                font-size: 4em;
                margin-bottom: 20px;
            }
        }

        .upload-text {
            font-size: 1.1em;
            color: #4a5568;
            margin-bottom: 8px;
        }

        @media (min-width: 768px) {
            .upload-text {
                font-size: 1.2em;
                margin-bottom: 10px;
            }
        }

        .upload-subtext {
            color: #718096;
            font-size: 0.85em;
        }

        @media (min-width: 768px) {
            .upload-subtext {
                font-size: 0.9em;
            }
        }

        #fileInput {
            display: none;
        }

        .btn {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            padding: 12px 25px;
            border-radius: 25px;
            cursor: pointer;
            font-size: 0.95em;
            font-weight: 500;
            transition: all 0.3s ease;
            margin: 8px 4px;
            touch-action: manipulation;
            min-height: 44px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }

        @media (min-width: 768px) {
            .btn {
                padding: 12px 30px;
                font-size: 1em;
                margin: 10px 5px;
            }
        }

        .btn:hover, .btn:active {
            transform: translateY(-2px);
            box-shadow: 0 8px 16px rgba(102, 126, 234, 0.3);
        }

        .btn:disabled {
            opacity: 0.6;
            cursor: not-allowed;
            transform: none;
        }

        .btn-small {
            padding: 8px 12px;
            font-size: 0.85em;
            margin: 4px 2px;
            min-height: 36px;
        }

        @media (min-width: 768px) {
            .btn-small {
                padding: 8px 16px;
                font-size: 0.9em;
                margin: 5px;
            }
        }

        .btn-download {
            background: linear-gradient(135deg, #38b2ac 0%, #319795 100%);
            padding: 8px 16px;
            font-size: 0.9em;
            margin: 5px;
        }

        .btn-download:hover, .btn-download:active {
            box-shadow: 0 6px 12px rgba(56, 178, 172, 0.3);
        }

        .btn-success {
            background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
        }

        .btn-success:hover, .btn-success:active {
            box-shadow: 0 6px 12px rgba(56, 161, 105, 0.3);
        }

        .loading {
            display: none;
            text-align: center;
            padding: 20px;
        }

        .spinner {
            border: 3px solid #f3f3f3;
            border-top: 3px solid #667eea;
            border-radius: 50%;
            width: 30px;
            height: 30px;
            animation: spin 1s linear infinite;
            margin: 0 auto 12px;
        }

        @media (min-width: 768px) {
            .spinner {
                border: 4px solid #f3f3f3;
                border-top: 4px solid #667eea;
                width: 40px;
                height: 40px;
                margin: 0 auto 15px;
            }
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        .results-section {
            display: none;
        }

        /* Passerelle vers le tableau de bord : un relevé déposé ici y est
           aussi enregistré, on le dit et on y emmène en un clic. */
        .dash-cta {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 16px;
            flex-wrap: wrap;
            background: #E7F4EC;
            border: 1px solid #C8E6D4;
            border-radius: 14px;
            padding: 14px 18px;
            margin-bottom: 20px;
        }
        .dash-cta[hidden] { display: none; }
        .dash-cta-txt {
            margin: 0;
            flex: 1 1 260px;
            font: 400 14px/1.5 'Instrument Sans', system-ui, sans-serif;
            color: #14392B;
        }
        .dash-cta-txt strong { display: block; font-weight: 700; }

        .summary-cards {
            display: grid;
            grid-template-columns: 1fr;
            gap: 15px;
            margin-bottom: 25px;
        }

        @media (min-width: 480px) {
            .summary-cards {
                grid-template-columns: repeat(2, 1fr);
                gap: 18px;
            }
        }

        @media (min-width: 768px) {
            .summary-cards {
                grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
                gap: 20px;
                margin-bottom: 30px;
            }
        }

        @media (min-width: 1024px) {
            .summary-cards {
                grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            }
        }

        .summary-card {
            background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
            color: white;
            padding: 18px;
            border-radius: 12px;
            text-align: center;
            box-shadow: 0 6px 15px rgba(66, 153, 225, 0.3);
        }

        @media (min-width: 768px) {
            .summary-card {
                padding: 25px;
                border-radius: 15px;
                box-shadow: 0 10px 20px rgba(66, 153, 225, 0.3);
            }
        }

        .summary-card h3 {
            font-size: 0.8em;
            opacity: 0.9;
            margin-bottom: 8px;
            text-transform: uppercase;
            letter-spacing: 1px;
            line-height: 1.2;
        }

        @media (min-width: 768px) {
            .summary-card h3 {
                font-size: 0.9em;
                margin-bottom: 10px;
            }
        }

        .summary-card .amount {
            font-size: 1.8em;
            font-weight: bold;
        }

        @media (min-width: 768px) {
            .summary-card .amount {
                font-size: 2.2em;
            }
        }

        .details-table {
            background: white;
            border-radius: 12px;
            overflow: hidden;
            box-shadow: 0 4px 12px rgba(0,0,0,0.08);
            margin-bottom: 15px;
        }

        @media (min-width: 768px) {
            .details-table {
                border-radius: 15px;
                box-shadow: 0 5px 15px rgba(0,0,0,0.08);
            }
        }

        .table-controls {
            padding: 12px;
            background: #f7fafc;
            border-bottom: 1px solid #e2e8f0;
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        @media (min-width: 480px) {
            .table-controls {
                flex-direction: row;
                align-items: center;
                padding: 15px;
                gap: 10px;
            }
        }

        .table-controls label {
            font-weight: 500;
            color: #4a5568;
            font-size: 0.9em;
        }

        table {
            width: 100%;
            border-collapse: collapse;
            font-size: 0.85em;
        }

        @media (min-width: 768px) {
            table {
                font-size: 1em;
            }
        }

        th {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 12px 8px;
            font-weight: bold;
            text-align: left;
            cursor: pointer;
            transition: background 0.3s ease;
            font-size: 0.8em;
        }

        @media (min-width: 768px) {
            th {
                padding: 15px;
                font-size: 1em;
            }
        }

        th:hover, th:active {
            background: linear-gradient(135deg, #5a6fd8 0%, #6b4190 100%);
        }

        td {
            padding: 10px 8px;
            border-bottom: 1px solid #e2e8f0;
        }

        @media (min-width: 768px) {
            td {
                padding: 12px 15px;
            }
        }

        tbody tr:hover, tbody tr:active {
            background: #f7fafc;
        }

        .amount-cell {
            text-align: right;
            font-weight: 500;
        }

        .positive {
            color: #38a169;
        }

        .negative {
            color: #e53e3e;
        }

        .tabs {
            display: flex;
            margin-bottom: 15px;
            background: #edf2f7;
            border-radius: 8px;
            padding: 4px;
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
        }

        @media (min-width: 768px) {
            .tabs {
                margin-bottom: 20px;
                border-radius: 10px;
                padding: 5px;
            }
        }

        .tab {
            flex: 1;
            padding: 10px 8px;
            text-align: center;
            background: transparent;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-weight: bold;
            transition: all 0.3s ease;
            white-space: nowrap;
            min-width: 0;
            font-size: 0.9em;
            touch-action: manipulation;
        }

        @media (min-width: 768px) {
            .tab {
                padding: 12px;
                border-radius: 8px;
                font-size: 1em;
            }
        }

        .tab.active {
            background: white;
            color: #667eea;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }

        @media (min-width: 768px) {
            .tab.active {
                box-shadow: 0 2px 5px rgba(0,0,0,0.1);
            }
        }

        .tab-content {
            display: none;
        }

        .tab-content.active {
            display: block;
        }

        .cotisation-form {
            background: white;
            border-radius: 12px;
            padding: 20px;
            margin-bottom: 15px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.08);
        }

        @media (min-width: 768px) {
            .cotisation-form {
                border-radius: 15px;
                padding: 25px;
                margin-bottom: 20px;
                box-shadow: 0 5px 15px rgba(0,0,0,0.08);
            }
        }

        .year-section {
            border: 2px solid #e2e8f0;
            border-radius: 8px;
            padding: 15px;
            margin-bottom: 15px;
            background: #f7fafc;
        }

        @media (min-width: 768px) {
            .year-section {
                border-radius: 10px;
                padding: 20px;
                margin-bottom: 20px;
            }
        }

        .year-title {
            font-size: 1.2em;
            font-weight: bold;
            color: #4a5568;
            margin-bottom: 12px;
        }

        @media (min-width: 768px) {
            .year-title {
                font-size: 1.3em;
                margin-bottom: 15px;
            }
        }

        .form-row {
            display: grid;
            grid-template-columns: 1fr;
            gap: 15px;
            margin-bottom: 12px;
        }

        @media (min-width: 480px) {
            .form-row {
                grid-template-columns: 1fr 1fr;
                gap: 18px;
            }
        }

        @media (min-width: 768px) {
            .form-row {
                gap: 20px;
                margin-bottom: 15px;
            }
        }

        .form-group {
            display: flex;
            flex-direction: column;
        }

        .form-group label {
            font-weight: 500;
            color: #4a5568;
            margin-bottom: 5px;
            font-size: 0.9em;
        }

        @media (min-width: 768px) {
            .form-group label {
                font-size: 1em;
            }
        }

        .form-group input {
            padding: 10px;
            border: 2px solid #e2e8f0;
            border-radius: 8px;
            font-size: 16px;
            transition: border-color 0.3s ease;
            min-height: 44px;
        }

        @media (min-width: 768px) {
            .form-group input {
                font-size: 1em;
            }
        }

        .form-group input:focus {
            outline: none;
            border-color: #667eea;
        }

        .calculations {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 15px;
            border-radius: 8px;
            margin-top: 12px;
        }

        @media (min-width: 768px) {
            .calculations {
                padding: 20px;
                border-radius: 10px;
                margin-top: 15px;
            }
        }

        .calc-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 6px 0;
            border-bottom: 1px solid rgba(255,255,255,0.2);
            font-size: 0.9em;
        }

        @media (min-width: 768px) {
            .calc-row {
                padding: 8px 0;
                font-size: 1em;
            }
        }

        .calc-row:last-child {
            border-bottom: none;
            font-weight: bold;
            font-size: 1em;
            margin-top: 8px;
            padding-top: 12px;
            border-top: 2px solid rgba(255,255,255,0.3);
        }

        @media (min-width: 768px) {
            .calc-row:last-child {
                font-size: 1.1em;
                margin-top: 10px;
                padding-top: 15px;
            }
        }

        .error-message {
            background: #fed7d7;
            color: #c53030;
            padding: 12px;
            border-radius: 8px;
            margin: 8px 0;
            border-left: 4px solid #e53e3e;
            font-size: 0.9em;
        }

        @media (min-width: 768px) {
            .error-message {
                padding: 15px;
                border-radius: 10px;
                margin: 10px 0;
                font-size: 1em;
            }
        }

        .success-message {
            background: #c6f6d5;
            color: #2d5016;
            padding: 12px;
            border-radius: 8px;
            margin: 8px 0;
            border-left: 4px solid #48bb78;
            font-size: 0.9em;
        }

        @media (min-width: 768px) {
            .success-message {
                padding: 15px;
                border-radius: 10px;
                margin: 10px 0;
                font-size: 1em;
            }
        }

        .privacy-notice {
            background: #e6fffa;
            color: #234e52;
            padding: 12px;
            border-radius: 8px;
            margin-bottom: 15px;
            border-left: 4px solid #38b2ac;
            font-size: 0.9em;
            line-height: 1.4;
        }

        @media (min-width: 768px) {
            .privacy-notice {
                padding: 15px;
                border-radius: 10px;
                margin-bottom: 20px;
                font-size: 1em;
            }
        }

        .privacy-notice strong {
            color: #1a202c;
        }

        .chart-container {
            background: white;
            border-radius: 12px;
            padding: 15px;
            margin-bottom: 15px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.08);
            position: relative;
            width: 100%;
            height: 400px;
        }

        @media (min-width: 480px) {
            .chart-container {
                height: 450px;
            }
        }

        @media (min-width: 768px) {
            .chart-container {
                border-radius: 15px;
                padding: 30px;
                margin-bottom: 20px;
                box-shadow: 0 5px 15px rgba(0,0,0,0.08);
                height: 400px;
            }
        }

        @media (min-width: 1024px) {
            .chart-container {
                height: 500px;
            }
        }

        @media (min-width: 1200px) {
            .chart-container {
                height: 600px;
            }
        }

        .chart-header {
            display: flex;
            flex-direction: column;
            gap: 8px;
            align-items: flex-start;
            margin-bottom: 12px;
        }

        @media (min-width: 480px) {
            .chart-header {
                flex-direction: row;
                justify-content: space-between;
                align-items: center;
            }
        }

        @media (min-width: 768px) {
            .chart-header {
                margin-bottom: 15px;
                gap: 10px;
            }
        }

        .chart-container canvas {
            width: 100% !important;
            height: 100% !important;
            max-width: 100% !important;
            max-height: 100% !important;
        }

        .chart-title {
            font-size: 1em;
            font-weight: bold;
            color: #4a5568;
            margin: 0;
        }

        @media (min-width: 768px) {
            .chart-title {
                font-size: 1.2em;
            }
        }

        .chart-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 15px;
            margin-bottom: 15px;
        }

        @media (min-width: 1024px) {
            .chart-grid {
                grid-template-columns: 1fr 1fr;
                gap: 20px;
                margin-bottom: 20px;
            }
        }

        .year-selector select {
            width: 100%;
            padding: 10px;
            border: 2px solid #e2e8f0;
            border-radius: 8px;
            font-size: 16px;
            background: white;
            cursor: pointer;
            transition: border-color 0.3s ease;
            min-height: 44px;
        }

        @media (min-width: 768px) {
            .year-selector select {
                font-size: 1em;
            }
        }

        .year-selector select:focus {
            outline: none;
            border-color: #667eea;
        }

        .download-status {
            background: #e6fffa;
            color: #234e52;
            padding: 8px 12px;
            border-radius: 8px;
            margin: 8px 0;
            border-left: 4px solid #38b2ac;
            display: none;
            font-size: 0.9em;
        }

        @media (min-width: 768px) {
            .download-status {
                padding: 10px 15px;
                margin: 10px 0;
                font-size: 1em;
            }
        }

        /* Mobile-first optimizations */
        @media (max-width: 767px) {
            .container {
                padding: 8px;
            }

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

            .header h1 {
                font-size: 1.5em;
            }

            .header p {
                font-size: 0.95em;
            }

            .summary-cards {
                grid-template-columns: 1fr;
                gap: 10px;
            }

            .summary-card {
                padding: 14px;
            }

            .summary-card h3 {
                font-size: 0.7em;
                line-height: 1.1;
            }

            .summary-card .amount {
                font-size: 1.5em;
            }

            .tabs {
                padding: 3px;
                margin-bottom: 12px;
                gap: 2px;
                overflow-x: auto;
                scrollbar-width: none;
                -ms-overflow-style: none;
            }

            .tabs::-webkit-scrollbar {
                display: none;
            }

            .tab {
                flex: 0 0 auto;
                min-width: 85px;
                padding: 10px 6px;
                font-size: 0.75em;
                white-space: nowrap;
            }

            .form-row {
                gap: 12px;
            }

            .form-group input, .year-selector select {
                font-size: 16px;
                padding: 10px;
            }

            .privacy-notice {
                padding: 12px;
                font-size: 0.85em;
                line-height: 1.5;
            }

            .btn {
                width: 100%;
                max-width: 100%;
                margin: 6px 0;
                padding: 12px 16px;
                font-size: 0.9em;
            }

            .btn-small {
                width: auto;
                max-width: none;
                display: inline-flex;
                margin: 4px 2px;
                min-width: 70px;
                padding: 8px 10px;
            }

            .table-controls {
                flex-wrap: wrap;
                justify-content: center;
                gap: 6px;
            }

            .chart-container {
                padding: 10px;
                height: 400px;
                border-radius: 10px;
                margin-bottom: 12px;
                width: 100%;
            }

            .chart-title {
                font-size: 0.85em;
                text-align: center;
            }

            .upload-zone {
                padding: 25px 12px;
            }

            .upload-icon {
                font-size: 2.5em;
            }

            .upload-text {
                font-size: 0.95em;
            }

            .upload-subtext {
                font-size: 0.8em;
            }

            .loading {
                padding: 25px 15px;
            }

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

            table {
                min-width: 500px;
                font-size: 0.75em;
            }

            th, td {
                white-space: nowrap;
                padding: 8px 6px;
            }

            .year-section {
                padding: 12px;
            }

            .cotisation-form {
                padding: 15px;
            }
        }

        /* Very small screens */
        @media (max-width: 400px) {
            .container {
                padding: 5px;
            }

            .card {
                padding: 12px;
                margin-bottom: 10px;
            }

            .header h1 {
                font-size: 1.3em;
            }

            .header p {
                font-size: 0.85em;
            }

            .summary-card {
                padding: 10px;
            }

            .summary-card h3 {
                font-size: 0.65em;
            }

            .summary-card .amount {
                font-size: 1.3em;
            }

            .tab {
                min-width: 75px;
                padding: 8px 4px;
                font-size: 0.7em;
            }

            .chart-container {
                height: 380px;
                padding: 8px;
            }

            .btn-small {
                min-width: 60px;
                padding: 6px 8px;
                font-size: 0.75em;
            }
        }

        /* Footer responsive */
        footer {
            text-align: center;
            margin-top: 30px;
            padding: 15px;
            background: rgba(255,255,255,0.1);
            border-radius: 12px;
            backdrop-filter: blur(10px);
        }

        @media (min-width: 768px) {
            footer {
                margin-top: 40px;
                padding: 20px;
                border-radius: 15px;
            }
        }

        footer > div {
            color: rgba(255,255,255,0.9);
            font-size: 13px;
        }

        @media (min-width: 768px) {
            footer > div {
                font-size: 14px;
            }
        }

        footer a {
            color: rgba(255,255,255,0.9);
            text-decoration: none;
            margin: 5px;
            padding: 6px 10px;
            background: rgba(255,255,255,0.1);
            border-radius: 4px;
            transition: all 0.3s ease;
            display: inline-block;
            min-height: 32px;
            line-height: 20px;
        }

        @media (min-width: 768px) {
            footer a {
                margin: 0 10px;
                padding: 8px 12px;
                border-radius: 5px;
            }
        }

        footer a:hover, footer a:active {
            background: rgba(255,255,255,0.2);
        }

        footer span {
            color: rgba(255,255,255,0.5);
            display: none;
        }

        @media (min-width: 480px) {
            footer span {
                display: inline;
            }
        }

        /* Responsive table on mobile */
        @media (max-width: 767px) {
            .btn, .tab, input, select {
                min-height: 44px;
                touch-action: manipulation;
            }
        }

        /* Analytics and utility classes */
        .analytics-summary {
            background: linear-gradient(135deg, #38b2ac 0%, #319795 100%);
            color: white;
            padding: 20px;
            border-radius: 15px;
            margin-bottom: 20px;
        }

        .analytics-summary h3 {
            margin-bottom: 15px;
            font-size: 1.3em;
        }

        @media (max-width: 767px) {
            .analytics-summary {
                padding: 15px;
            }

            .analytics-summary h3 {
                font-size: 1.1em;
            }
        }

        .analytics-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 8px 0;
            border-bottom: 1px solid rgba(255,255,255,0.2);
        }

        @media (max-width: 767px) {
            .analytics-row {
                padding: 6px 0;
                font-size: 0.9em;
            }
        }
/* ==========================================================================
   MutuCash — Réhabillage « Sapin & Papier » (surcharge, cascade finale)
   Charge tokens.css + Google Fonts dans calculateur.html.
   Ces règles arrivent en dernier : elles priment sur le thème violet d'origine.
   ========================================================================== */
body {
  background: var(--mc-papier) !important;
  color: var(--mc-encre);
  font-family: var(--mc-font-texte), 'Segoe UI', Tahoma, sans-serif;
}
.card {
  background: var(--mc-blanc-chaud) !important;
  border: 1px solid var(--mc-brume);
  box-shadow: 0 24px 60px -30px rgba(16, 23, 17, .2) !important;
  backdrop-filter: none !important;
}
.header h1, .header h1 * {
  font-family: var(--mc-font-titre);
  color: var(--mc-sapin) !important;
  font-weight: 700 !important;
}
.header p { color: var(--mc-texte-2) !important; }

/* Zone de dépôt */
.upload-zone {
  background: var(--mc-blanc-chaud) !important;
  border-color: var(--mc-bordure-tiret) !important;
}
.upload-zone:hover, .upload-zone:active, .upload-zone.dragover {
  border-color: var(--mc-vert) !important;
  background: var(--mc-surface-survol) !important;
}
.upload-icon { color: var(--mc-vert) !important; }
.upload-text { color: var(--mc-sapin) !important; font-family: var(--mc-font-titre); }

/* Boutons */
.btn {
  background: var(--mc-sapin) !important;
  color: var(--mc-papier) !important;
  font-family: var(--mc-font-texte);
  font-weight: 600;
  border-radius: var(--mc-r-bouton) !important;
}
.btn:hover, .btn:active { background: var(--mc-sapin-fonce) !important; }
.btn:disabled { opacity: .45 !important; }

/* Onglets */
.tab { color: var(--mc-texte-2) !important; font-family: var(--mc-font-texte); }
.tab.active {
  color: var(--mc-sapin) !important;
  border-bottom-color: var(--mc-vert) !important;
}

/* Tableaux */
th { color: var(--mc-sapin) !important; font-family: var(--mc-font-titre); }
td { color: var(--mc-encre); }
.amount-cell.positive { color: var(--mc-vert) !important; }

/* Titres de contenu injecté */
#cotisationsContent h3, #analyticsContent h3, #analyticsContent h2,
.cotisation-form h3 { font-family: var(--mc-font-titre); color: var(--mc-sapin) !important; }

/* Encadrés d'info */
.privacy-notice {
  background: var(--mc-sable) !important;
  color: var(--mc-texte-2) !important;
  border-left: 3px solid var(--mc-vert) !important;
  border-radius: 12px !important;
}
.privacy-notice strong { color: var(--mc-encre) !important; }

/* Champs */
input, select, textarea { font-family: var(--mc-font-texte); }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--mc-vert); outline-offset: 1px; border-color: var(--mc-vert) !important;
}

a { color: var(--mc-vert); }
.download-status { background: var(--mc-vert) !important; color: #fff !important; }

/* ==========================================================================
   Correctifs responsive du parcours résultats.
   ========================================================================== */

/* Sous 480 px, .table-controls passe en colonne : les deux boutons de tri sont
   alors étirés sur toute la largeur et occupent deux écrans de haut pour rien.
   On les remet côte à côte, le libellé gardant sa propre ligne. */
@media (max-width: 479px) {
  .table-controls {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .table-controls label { flex: 1 0 100%; }

  .table-controls .btn-small {
    flex: 1 1 0;
    min-width: 0;
    margin: 0;
  }
}

/* Quatre séries + une légende de 15 px écrasaient la zone de tracé sur
   téléphone (la légende est compactée côté Chart.js, cf. legendeResponsive) :
   on redonne un peu de hauteur au cadre. */
@media (max-width: 767px) {
  .chart-container { height: 440px; }
}

@media (max-width: 400px) {
  .chart-container { height: 420px; }
}

/* L'en-tête du tableau était resté sur le dégradé violet d'origine alors que
   la surcharge « Sapin & Papier » en passe le texte en vert sapin : texte
   sombre sur fond violet, illisible. On aligne le fond sur le thème. */
#detailsTable th {
  background: var(--mc-sapin) !important;
  color: var(--mc-papier) !important;
}

#detailsTable th:hover, #detailsTable th:active {
  background: var(--mc-sapin-fonce) !important;
}

/* Sur téléphone, le tableau imposait un min-width de 500 px : la colonne
   « Total » restait hors champ, derrière un défilement horizontal invisible.
   On laisse les en-têtes passer à la ligne pour que les quatre colonnes
   tiennent dans la largeur de l'écran. */
@media (max-width: 767px) {
  #detailsTable {
    min-width: 0;
    table-layout: fixed;
  }

  #detailsTable th {
    white-space: normal;
    font-size: 0.66em;
    line-height: 1.2;
    padding: 8px 4px;
  }

  #detailsTable td {
    padding: 8px 4px;
    font-size: 0.78em;
  }

  #detailsTable th:first-child,
  #detailsTable td:first-child { width: 28%; }
}

/* ==========================================================================
   Thème SOMBRE — surfaces héritées du calculateur (fonds posés en dur avant
   le réhabillage Sapin & Papier). Le reste bascule via les jetons.
   ========================================================================== */
[data-theme="dark"] .details-table,
[data-theme="dark"] .cotisation-form,
[data-theme="dark"] .chart-container,
[data-theme="dark"] .year-selector select,
[data-theme="dark"] .tab.active { background: var(--mc-blanc-chaud) !important; }
[data-theme="dark"] .table-controls,
[data-theme="dark"] .year-section,
[data-theme="dark"] .tabs { background: var(--mc-sable) !important; }
[data-theme="dark"] tbody tr:hover,
[data-theme="dark"] tbody tr:active { background: var(--mc-sable) !important; }
[data-theme="dark"] .dash-cta { background: var(--mc-vert-pastel) !important; border-color: var(--mc-bordure-verte) !important; }
[data-theme="dark"] .error-message { background: var(--mc-terracotta-pastel) !important; color: var(--mc-terracotta-texte) !important; }
[data-theme="dark"] .success-message { background: var(--mc-vert-pastel) !important; color: var(--mc-vert-texte) !important; }
[data-theme="dark"] .privacy-notice { color: var(--mc-texte-2) !important; }
[data-theme="dark"] .download-status { color: #101915 !important; }
[data-theme="dark"] td,
[data-theme="dark"] th { border-color: var(--mc-brume) !important; }
[data-theme="dark"] .form-group label,
[data-theme="dark"] .table-controls label { color: var(--mc-texte-2); }
[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group select,
[data-theme="dark"] .year-selector select {
  background: var(--mc-blanc-chaud);
  color: var(--mc-encre);
  border-color: var(--mc-bordure-champ) !important;
}
