/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    color: #1e293b;
    line-height: 1.6;
    font-size: 14px;
}

a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== LAYOUT ===== */
.app-header {
    background: linear-gradient(135deg, #1e3a5f, #2563eb);
    color: #fff;
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.app-header h1 { font-size: 20px; font-weight: 600; }
.app-header nav a {
    color: #fff;
    margin-left: 20px;
    font-size: 14px;
    padding: 6px 14px;
    border-radius: 4px;
    transition: background 0.2s;
}
.app-header nav a:hover, .app-header nav a.active {
    background: rgba(255,255,255,0.2);
    text-decoration: none;
}

.container {
    max-width: 1100px;
    margin: 24px auto;
    padding: 0 20px;
}

/* ===== CARDS ===== */
.card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    padding: 24px;
    margin-bottom: 20px;
}
.card h2 {
    font-size: 18px;
    color: #1e3a5f;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 10px;
    margin-bottom: 16px;
}
.card h3 {
    font-size: 15px;
    color: #334155;
    margin: 14px 0 8px;
}

/* ===== FORMS ===== */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.form-grid.col-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-grid.col-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.form-group { margin-bottom: 12px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    color: #475569;
    margin-bottom: 4px;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.form-group textarea { resize: vertical; min-height: 80px; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-success { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-outline {
    background: transparent;
    border: 2px solid #2563eb;
    color: #2563eb;
}
.btn-outline:hover { background: #2563eb; color: #fff; }
.btn-print { background: #6366f1; color: #fff; }
.btn-print:hover { background: #4f46e5; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

.btn-group { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

/* ===== TABLES ===== */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
}
table th, table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    font-size: 13px;
}
table th {
    background: #f1f5f9;
    font-weight: 700;
    color: #334155;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
table tr:hover { background: #f8fafc; }
table .text-right { text-align: right; }
table .text-center { text-align: center; }
table tfoot td {
    font-weight: 700;
    background: #f1f5f9;
    border-top: 2px solid #cbd5e1;
}

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}
.badge-faible { background: #d1fae5; color: #065f46; }
.badge-moyen { background: #fef3c7; color: #92400e; }
.badge-eleve { background: #fee2e2; color: #991b1b; }
.badge-critique { background: #991b1b; color: #fff; }
.badge-essentiel { background: #dbeafe; color: #1e40af; }
.badge-pro { background: #d1fae5; color: #065f46; }
.badge-premium { background: #fef3c7; color: #92400e; }

/* ===== RISK TABLE ===== */
.risk-eleve, .risk-critique { color: #dc2626; font-weight: 700; }
.risk-moyen { color: #d97706; font-weight: 600; }
.risk-faible { color: #16a34a; }

/* ===== PACK CARDS ===== */
.packs-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin: 16px 0; }
.pack-card {
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s;
    position: relative;
}
.pack-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.pack-card.recommended {
    border-color: #16a34a;
    box-shadow: 0 4px 12px rgba(22,163,74,0.15);
}
.pack-card.recommended::before {
    content: 'RECOMMANDÉ';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: #16a34a;
    color: #fff;
    padding: 2px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}
.pack-card h3 { margin: 0 0 6px; font-size: 18px; }
.pack-card .price { font-size: 28px; font-weight: 800; color: #1e3a5f; margin: 10px 0; }
.pack-card .price small { font-size: 13px; font-weight: 400; color: #64748b; }
.pack-card .monthly { font-size: 14px; color: #64748b; margin-bottom: 12px; }
.pack-card ul { list-style: none; text-align: left; font-size: 13px; }
.pack-card ul li { padding: 4px 0; border-bottom: 1px solid #f1f5f9; }
.pack-card ul li::before { content: '✓ '; color: #16a34a; font-weight: 700; }

/* ===== SECTION DIVIDERS ===== */
.section-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    background: #2563eb;
    color: #fff;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 700;
    margin-right: 8px;
}

/* ===== ALERT BOXES ===== */
.alert {
    padding: 14px 18px;
    border-radius: 8px;
    margin: 12px 0;
    font-size: 13px;
}
.alert-info { background: #dbeafe; color: #1e40af; border-left: 4px solid #2563eb; }
.alert-warning { background: #fef3c7; color: #92400e; border-left: 4px solid #f59e0b; }
.alert-danger { background: #fee2e2; color: #991b1b; border-left: 4px solid #dc2626; }
.alert-success { background: #d1fae5; color: #065f46; border-left: 4px solid #16a34a; }

/* ===== LIST STYLES ===== */
.check-list { list-style: none; padding: 0; }
.check-list li { padding: 5px 0; font-size: 13px; }
.check-list li::before { content: '✓ '; color: #16a34a; font-weight: 700; }

/* ===== DASHBOARD ===== */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.stat-card .stat-value { font-size: 32px; font-weight: 800; color: #1e3a5f; }
.stat-card .stat-label { font-size: 13px; color: #64748b; margin-top: 4px; }

.recent-list { list-style: none; padding: 0; }
.recent-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
}
.recent-list li:last-child { border: none; }

/* ===== COEFFICIENT SLIDER ===== */
.coeff-display {
    font-size: 32px;
    font-weight: 800;
    color: #2563eb;
    text-align: center;
}
input[type="range"] {
    width: 100%;
    margin: 10px 0;
    accent-color: #2563eb;
}
.coeff-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #64748b;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #94a3b8;
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }

/* ===== PRINT STYLES ===== */
@media print {
    body { background: #fff; font-size: 12px; }
    .app-header, .btn, .btn-group, .no-print { display: none !important; }
    .container { max-width: 100%; margin: 0; padding: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; page-break-inside: avoid; padding: 16px; margin-bottom: 12px; }
    table { font-size: 11px; }
    table th, table td { padding: 6px 8px; }
    .packs-grid { grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
    .pack-card { padding: 12px; border: 1px solid #ccc; }
    .pack-card .price { font-size: 20px; }
    .stats-grid { display: none; }
    h1, h2, h3 { page-break-after: avoid; }
    .page-break { page-break-before: always; }

    .print-header {
        display: block !important;
        width: 210mm;
        background: #ffffff;
        color: #4472C4;
        padding: 15px;
        position: relative;
        text-align: right;
        border-bottom: 3pt solid #4472C4;
        margin-bottom: 20px;
    }
    .print-header img {
        width: 67mm;
        position: absolute;
        top: 17px;
        left: 19px;
    }
    .print-header .company-name {
        font-size: 28pt;
        font-weight: bold;
        margin-bottom: 5px;
        font-family: "Century Gothic", Arial, sans-serif;
        border-bottom: 2pt solid #4472C4;
        width: 129mm;
        color: #000000;
        display: inline-block;
        text-align: right;
    }
    .print-header .company-tagline {
        font-size: 11pt;
        margin-bottom: 3px;
        max-width: 124mm;
        font-family: "Segoe UI", Arial, sans-serif;
        display: inline-block;
        text-align: right;
    }
    .print-footer {
        display: block !important;
        text-align: center;
        margin-top: 30px;
        padding-top: 10px;
        border-top: 1px solid #ccc;
        font-size: 10px;
        color: #999;
    }
}

.print-title .doc-title {
    font-size: 24px;
    color: #1e3a5f;
    margin-top: 10px;
    font-weight: bold;
    text-align: center;
}
.print-title .doc-info {
    font-size: 10pt;
    text-align: center;
    color: #666;
}

.print-header, .print-footer { display: none; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .form-grid, .form-grid.col-3, .form-grid.col-4 { grid-template-columns: 1fr; }
    .packs-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .app-header { flex-direction: column; gap: 10px; }
}

/* ===== EQUIPMENT ROW ===== */
.equip-row {
    display: grid;
    grid-template-columns: 2fr 1fr 80px 80px 1.5fr auto;
    gap: 8px;
    align-items: end;
    margin-bottom: 8px;
}
.equip-row .form-group { margin-bottom: 0; }
.equip-row .btn-remove {
    background: #fee2e2;
    color: #dc2626;
    border: none;
    width: 32px; height: 32px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.equip-row .btn-remove:hover { background: #fecaca; }

/* ===== TABS ===== */
.tabs { display: flex; border-bottom: 2px solid #e2e8f0; margin-bottom: 16px; }
.tab-btn {
    padding: 10px 20px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    font-family: inherit;
}
.tab-btn:hover { color: #1e3a5f; }
.tab-btn.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}
.tab-content { display: none; }
.tab-content.active { display: block; }
