/* ============================================================
   SIMULATEUR PRET — Data-Forward Bold Design System
   Chiffres dominants, typographie massive, contraste élevé.
   ============================================================ */

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

/* === Django Form Elements ===
   Django renders inputs without classes — style globally. */
input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
input[type="date"],
textarea {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #0f172a;
    background-color: #ffffff;
    font-family: inherit;
    font-weight: 500;
    transition: border-color 0.12s, box-shadow 0.12s;
    appearance: none;
}
input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="date"]:focus,
textarea:focus {
    outline: none;
    border-color: #18181b;
    box-shadow: 0 0 0 3px rgba(24, 24, 27, 0.08);
}
input[type="text"]::placeholder,
input[type="number"]::placeholder,
input[type="password"]::placeholder { color: #94a3b8; font-weight: 400; }

/* === Custom Select Wrapper (injected by JS) === */
.custom-select-wrap {
    position: relative;
    display: block;
    border: 1.5px solid #e2e8f0;
    border-radius: 0.5rem;
    background-color: #ffffff;
    transition: border-color 0.12s, box-shadow 0.12s;
}
.custom-select-wrap:focus-within {
    border-color: #18181b;
    box-shadow: 0 0 0 3px rgba(24, 24, 27, 0.08);
}
.custom-select-wrap::after {
    content: '';
    position: absolute;
    right: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    pointer-events: none;
}
.custom-select-wrap select {
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    background-image: none !important;
    background-color: transparent !important;
    border-radius: 0.5rem !important;
}
.custom-select-wrap select:focus {
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}

select {
    display: block;
    width: 100%;
    padding: 0.5rem 2.25rem 0.5rem 0.75rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #0f172a;
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    transition: border-color 0.12s, box-shadow 0.12s;
    min-height: 38px;
}
select:focus {
    outline: none;
    border-color: #18181b;
    box-shadow: 0 0 0 3px rgba(24, 24, 27, 0.08);
}

input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    border: 2px solid #cbd5e1;
    border-radius: 4px;
    accent-color: #18181b;
    cursor: pointer;
    vertical-align: middle;
    flex-shrink: 0;
}

/* === Tab Component (JS toggles .active) === */
.tabs {
    display: flex;
    border-bottom: 2px solid #f1f5f9;
    margin-bottom: 1rem;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 0;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
    padding: 0.625rem 1.1rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #94a3b8;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.12s, border-color 0.12s;
    user-select: none;
}
.tab:hover { color: #1e293b; }
.tab.active {
    color: #0f172a;
    border-bottom-color: #0f172a;
}

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

/* === Badge Component === */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.badge-success  { background: #dcfce7; color: #15803d; }
.badge-primary  { background: #e0e7ff; color: #3730a3; }
.badge-warning  { background: #fef9c3; color: #854d0e; }
.badge-danger   { background: #fee2e2; color: #b91c1c; }
.badge-neutral  { background: #f1f5f9; color: #475569; }

/* === Matrix Table Cell Colors (vivid, high contrast) === */
.cell-green {
    background-color: #dcfce7;
    color: #14532d;
    font-weight: 700;
}
.cell-orange {
    background-color: #fef9c3;
    color: #713f12;
    font-weight: 700;
}
.cell-red {
    background-color: #fee2e2;
    color: #7f1d1d;
    font-weight: 700;
}

/* === Avoir toggle label === */
.avoir-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}
.avoir-type {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.avoir-type.debloquable     { background: #dcfce7; color: #14532d; }
.avoir-type.non-debloquable { background: #fee2e2; color: #7f1d1d; }

/* === Scrollable table wrapper === */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* === KPI Value display === */
.kpi-value {
    font-size: clamp(1.1rem, 2.2vw, 1.75rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.kpi-label {
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #94a3b8;
}

/* === Print Styles === */
@media print {
    header, .no-print { display: none !important; }
    button { display: none !important; }
    body { background: white; font-size: 11pt; }
    .hidden { display: block !important; }
}
