:root {
    --primary: #2c3e50;
    --secondary: #2980b9;
    --accent: #d35400;
    --bg: #f8f9fa;
    --white: #ffffff;
    --success: #27ae60;
    --danger: #c0392b;
    --deduction: #8e44ad;
    --info: #3498db;
    --tooltip-bg: #2c3e50;
}
body {
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--primary);
    line-height: 1.5;
    padding: 20px;
}
.container { max-width: 1550px; margin: auto; }
.card {
    background: var(--white);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    margin-bottom: 25px;
    border: 1px solid #e1e8ed;
}
.header-sia {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid var(--secondary);
    margin-bottom: 20px;
    padding-bottom: 10px;
}
.config-global { background: #fdfdfd; }
.room-section {
    border-left: 10px solid var(--secondary);
    transition: all 0.3s ease;
}
.wall-row {
    display: grid;
    grid-template-columns: 1.1fr 0.4fr 0.4fr 0.5fr 0.4fr 0.4fr 0.4fr 0.4fr 0.4fr 0.55fr 100px;
    gap: 8px;
    align-items: end;
    margin-bottom: 5px;
    padding: 15px;
    background: #fcfcfc;
    border: 1px solid #edf2f7;
    border-radius: 8px 8px 0 0;
}
.sub-surface-row {
    display: grid;
    grid-template-columns: 1.1fr 0.4fr 0.4fr 0.5fr 0.4fr 0.4fr 0.4fr 0.4fr 0.55fr 40px;
    gap: 8px;
    align-items: end;
    margin-left: 40px;
    margin-bottom: 5px;
    padding: 8px 15px;
    background: #fdf2ff;
    border: 1px dashed var(--deduction);
    border-radius: 6px;
}
.sia-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}
.info-wrapper { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; position: relative; }
.info-icon {
    background: var(--info); color: white; border-radius: 50%;
    width: 16px; height: 16px; font-size: 11px;
    display: flex; align-items: center; justify-content: center;
    cursor: help; font-weight: bold;
    position: relative;
    /* QUAL-03 : accessibilité clavier */
    outline-offset: 2px;
}
.info-icon:focus-visible {
    outline: 2px solid var(--primary);
}
.info-icon:hover::after,
.info-icon:focus::after,
.info-icon:focus-visible::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%; left: 50%; transform: translateX(-50%);
    background: var(--tooltip-bg); color: white;
    padding: 8px 12px; border-radius: 6px;
    font-size: 0.75rem; width: 380px; white-space: pre-line;
    z-index: 100; box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    font-weight: normal; text-transform: none;
    line-height: 1.4;
}
.info-icon:hover::before,
.info-icon:focus::before,
.info-icon:focus-visible::before {
    content: ""; position: absolute; bottom: 110%; left: 50%; transform: translateX(-50%);
    border: 6px solid transparent; border-top-color: var(--tooltip-bg);
    z-index: 100;
}
label { font-size: 0.68em; font-weight: 700; color: #4a5568; text-transform: uppercase; white-space: nowrap; }
input, select {
    width: 100%; padding: 8px 10px;
    border: 1px solid #cbd5e0; border-radius: 6px;
    font-size: 0.85em; box-sizing: border-box;
}
.readonly-input { background: #f1f5f9; font-weight: 600; color: var(--primary); border-color: #e2e8f0; }
.u-warning { background: #fee2e2 !important; border-color: var(--danger) !important; color: var(--danger) !important; }
/* Blocage saisie négative — flash rouge + secousse + tooltip */
.neg-blocked {
    background: #fee2e2 !important;
    border-color: var(--danger) !important;
    color: var(--danger) !important;
    animation: negShake 0.35s ease-in-out;
}
@keyframes negShake {
    0%, 100% { transform: translateX(0); }
    20%      { transform: translateX(-4px); }
    40%      { transform: translateX(4px); }
    60%      { transform: translateX(-2px); }
    80%      { transform: translateX(2px); }
}
.psi-warning { background: #fff7ed !important; border-color: #c2410c !important; color: #c2410c !important; }
/* NEW-02, NEW-03, NEW-04 : alertes spécifiques (B', n50, θi) — orange amber */
.b-warning,
.n50-warning,
.ti-warning { background: #fff7ed !important; border-color: #c2410c !important; color: #c2410c !important; }
/* NEW-01 : bandeau d'alerte sur Φ Transmission si méthode détail sans ψ */
.pt-detail-warning {
    background: #fff7ed !important;
    border: 2px solid #c2410c !important;
    color: #c2410c !important;
    position: relative;
}
.pt-detail-warning::after {
    content: "⚠ Méthode détaillée active, mais aucun ψ saisi sur les parois — vérifier les ponts thermiques";
    display: block;
    font-size: 0.65em;
    font-weight: 600;
    margin-top: 4px;
    line-height: 1.3;
    color: #c2410c;
    text-transform: none;
    letter-spacing: 0;
}
.wall-loss-box {
    background: #fff5eb; border: 1px solid #fee2e2; padding: 7px;
    border-radius: 6px; text-align: center; min-height: 35px;
    display: flex; align-items: center; justify-content: center;
}
.btn { border: none; border-radius: 6px; padding: 12px 20px; cursor: pointer; font-weight: 600; transition: 0.2s; }
.btn-add { background: var(--secondary); color: white; }
.btn-report {
    background: var(--success);
    color: white;
    width: 100%;
    font-size: 1.1em;
    margin-top: 20px;
    padding: 18px 25px;
}
.btn-danger { background: var(--danger); color: white; }
.btn-deduct { background: var(--deduction); color: white; font-size: 0.7em; padding: 5px 8px; }
.btn-remove-wall { padding: 8px; line-height: 1; }
.badge-sia {
    background: #e2e8f0; padding: 4px 10px; border-radius: 4px;
    font-size: 0.75em; text-transform: uppercase; letter-spacing: 0.5px;
}
.result-box {
    background: #2d3748; color: white; padding: 15px;
    border-radius: 8px; text-align: center;
}
#final-report { display: none; margin-top: 30px; border-top: 5px solid var(--success); }
.report-table { width: 100%; border-collapse: collapse; margin-top: 10px; margin-bottom: 25px; }
.report-table th { background: #f1f5f9; padding: 10px; border: 1px solid #cbd5e0; text-align: left; font-size: 0.85em; }
.report-table td { padding: 10px; border: 1px solid #e2e8f0; font-size: 0.9em; }
.sub-row-report { background-color: #fdf2ff; font-size: 0.85em; color: var(--deduction); }
/* Icônes éléments dans le rapport */
.el-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px; height: 22px;
    margin-right: 8px;
    vertical-align: middle;
    border-radius: 4px;
    flex-shrink: 0;
}
.el-icon svg { display: block; }
.el-icon.icon-wall      { background:#fef2e8; color:#9a4a17; }
.el-icon.icon-partition { background:#f1f5f9; color:#4a5568; }
.el-icon.icon-roof      { background:#fef2e8; color:#b03a2e; }
.el-icon.icon-ceiling   { background:#eef2f7; color:#2c3e50; }
.el-icon.icon-floor     { background:#f4ecdc; color:#7d5a30; }
.el-icon.icon-floor-ext { background:#e8eef8; color:#1f4e79; }
.el-icon.icon-window    { background:#dbeafe; color:#1e40af; }
.el-icon.icon-door      { background:#fde9d7; color:#a04515; }
.el-icon.icon-unknown   { background:#f1f5f9; color:#94a3b8; }
.el-label-wrap { display: inline-flex; align-items: center; }
.technical-legend {
    margin-top: 40px; background: #eef2f7; padding: 20px;
    border-radius: 8px; font-size: 0.85em; border: 1px solid #cbd5e0;
}
.technical-legend h4 { margin-top: 0; color: var(--primary); border-bottom: 1px solid #ccc; padding-bottom: 5px; }
.legend-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
@media print {
    .no-print { display: none !important; }
    body { background: white; padding: 0; }
    .card { box-shadow: none; border: 1px solid #000; }
    .technical-legend { display: none !important; }
}
/* Modal SIA */
.btn-sia-values { background: var(--info); color: white; padding: 10px 15px; border-radius: 6px; cursor: pointer; font-weight: 600; margin-left: 10px; border: none; }
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.5); }
.modal-content { background-color: var(--white); margin: 10% auto; padding: 25px; border: 1px solid #888; width: 80%; max-width: 700px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
.close { color: #aaa; float: right; font-size: 28px; font-weight: bold; cursor: pointer; }
.close:hover { color: var(--primary); }
.sia-table { width: 100%; border-collapse: collapse; margin-top: 15px; }
.sia-table th, .sia-table td { border: 1px solid #ddd; padding: 10px; text-align: left; }
.sia-table th { background: var(--info); color: white; }
.sia-row { cursor: pointer; }
.sia-row:hover { background: #f0f8ff; }
.disclaimer { background: #fff3cd; border: 1px solid #ffeeba; padding: 12px; border-radius: 6px; margin-bottom: 20px; font-size: 0.9em; color: #856404; }

/* ── Barre Export / Import ── */
.toolbar-project {
    display: flex; align-items: center; gap: 12px;
    background: #f1f5f9; border: 1px solid #e2e8f0;
    border-radius: 10px; padding: 12px 18px; margin-bottom: 18px;
}
.toolbar-project > span { font-size: 0.85em; color: #4a5568; font-weight: 600; }
.btn-export { background: var(--secondary); color: white; padding: 10px 18px; border-radius: 6px; border: none; cursor: pointer; font-weight: 600; font-size: 0.85em; }
.btn-import { background: var(--accent); color: white; padding: 10px 18px; border-radius: 6px; border: none; cursor: pointer; font-weight: 600; font-size: 0.85em; }
.btn-print-toolbar { background: #64748b; color: white; padding: 10px 18px; border-radius: 6px; border: none; cursor: pointer; font-weight: 600; font-size: 0.85em; }
.btn-reset { background: var(--danger); color: white; padding: 10px 18px; border-radius: 6px; border: none; cursor: pointer; font-weight: 600; font-size: 0.85em; }
.btn-export:hover { background: #1f6391; }
.btn-import:hover { background: #b94600; }
.btn-print-toolbar:hover { background: #475569; }
.btn-reset:hover { background: #922b21; }
#import-file-input { display: none; }
