@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Sora:wght@500;600;700;800&display=swap');

/**
 * Thème « Atelier » — Devis Fenêtres & Portes PVC
 * Direction : anthracite + cuivre, contemporain/pro, dépendance-free.
 * Typo : Inter (UI) + Sora (titres). Couvre statiques + composants générés JS.
 */

/* ============================ TOKENS ============================ */
:root {
    /* Chrome anthracite */
    --ink-900: #181c20;
    --ink-800: #1e2429;
    --ink-700: #272f36;
    --ink-600: #36414a;

    /* Accent cuivre */
    --copper: #b9682f;
    --copper-600: #a85a28;
    --copper-700: #8f4c22;
    --copper-tint: #f6ece3;
    --copper-ring: rgba(185, 104, 47, 0.28);

    /* Surfaces chaudes */
    --paper: #f6f4f1;
    --surface: #ffffff;
    --surface-2: #faf8f5;
    --surface-3: #f1ece6;

    /* Texte */
    --text: #20262b;
    --text-soft: #5b6670;
    --text-mute: #8a949c;
    --on-ink: #eef1f3;
    --on-ink-soft: #aeb8c0;

    /* Lignes */
    --line: #e7e1d9;
    --line-2: #efeae3;

    /* Sémantique */
    --green: #2f9e6f;
    --green-tint: #e4f3ec;
    --red: #cf4334;
    --red-tint: #fbe8e6;
    --amber: #cf971f;
    --amber-tint: #f9eed2;
    --blue: #3a6ea5;

    /* Élévation */
    --sh-1: 0 1px 2px rgba(24, 28, 32, 0.04), 0 1px 3px rgba(24, 28, 32, 0.05);
    --sh-2: 0 6px 22px -6px rgba(24, 28, 32, 0.12), 0 2px 6px rgba(24, 28, 32, 0.05);
    --sh-3: 0 28px 60px -12px rgba(24, 28, 32, 0.22), 0 8px 20px -8px rgba(24, 28, 32, 0.12);

    --radius: 10px;
    --radius-sm: 8px;
    --radius-xs: 6px;

    --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-display: "Sora", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

    --maxw: 1280px;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-ui);
    background: var(--paper);
    color: var(--text);
    line-height: 1.55;
    letter-spacing: -0.006em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    padding-bottom: 96px; /* place pour la barre total collante */
}

/* Titres : tracking resserré, look contemporain */
.brand-text h1, .block-title, .header-title h2, .upload-zone h3,
.modal-header h3, .correction-modal-header h3, .annot-head h3,
.stat-value, .total-value, .summary-fig.ttc .value {
    letter-spacing: -0.02em;
}

img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--copper); outline-offset: 2px; }
/* Cases à cocher / radios aux couleurs du thème (cuivre) */
input[type="checkbox"], input[type="radio"] { accent-color: var(--copper); width: 16px; height: 16px; cursor: pointer; }

.shell { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ============================ TOPBAR ============================ */
.topbar {
    background: linear-gradient(180deg, var(--ink-800), var(--ink-900));
    color: var(--on-ink);
    border-bottom: 3px solid var(--copper);
    position: sticky;
    top: 0;
    z-index: 40;
}
.topbar-inner {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark {
    width: 40px; height: 40px; flex: none;
    display: grid; place-items: center;
    background: var(--copper);
    color: #fff;
    border-radius: 10px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-text h1 {
    font-family: var(--font-display);
    font-size: 1.32rem;
    font-weight: 600;
    letter-spacing: .2px;
    line-height: 1.1;
}
.brand-text .tagline {
    font-size: .76rem;
    color: var(--on-ink-soft);
    letter-spacing: .3px;
}
.topbar-meta {
    margin-left: auto;
    display: flex; align-items: center; gap: 10px;
    font-size: .78rem; color: var(--on-ink-soft);
}
.engine-pill {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 6px 12px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 999px;
    color: var(--on-ink);
    font-weight: 600; font-size: .76rem;
}
.engine-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--copper); box-shadow: 0 0 0 3px var(--copper-ring); }

/* ============================ STEPS ============================ */
.steps {
    display: flex;
    gap: 0;
    margin: 26px 0 6px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--sh-1);
    overflow: hidden;
}
.step {
    flex: 1;
    display: flex; align-items: center; gap: 12px;
    padding: 16px 20px;
    color: var(--text-mute);
    position: relative;
    transition: background .2s, color .2s;
}
.step + .step { border-left: 1px solid var(--line-2); }
.step-num {
    width: 30px; height: 30px; flex: none;
    display: grid; place-items: center;
    border-radius: 50%;
    background: var(--surface-3);
    color: var(--text-mute);
    font-weight: 700; font-size: .9rem;
    border: 1px solid var(--line);
}
.step-label { font-weight: 600; font-size: .92rem; line-height: 1.15; }
.step-label small { display: block; font-weight: 500; font-size: .74rem; color: var(--text-mute); }
.step.is-active { color: var(--text); background: var(--copper-tint); }
.step.is-active .step-num { background: var(--copper); color: #fff; border-color: var(--copper); box-shadow: 0 0 0 4px var(--copper-ring); }
.step.is-done { color: var(--text-soft); }
.step.is-done .step-num { background: var(--green); color: #fff; border-color: var(--green); }

/* ============================ BLOCS / TITRES ============================ */
.block { margin-top: 26px; }
.block-title {
    font-family: var(--font-display);
    font-size: 1.14rem; font-weight: 600;
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 14px;
}
.block-title .bar { width: 4px; height: 20px; border-radius: 4px; background: var(--copper); }

/* ============================ EN-TÊTE DEVIS ============================ */
.devis-header {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--sh-1);
    padding: 22px 24px;
}
.devis-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 26px;
}
.devis-col h3 {
    font-size: .8rem; text-transform: uppercase; letter-spacing: .8px;
    color: var(--copper-700); font-weight: 700; margin-bottom: 12px;
}
.field { margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.field label {
    display: block; font-size: .78rem; font-weight: 600;
    color: var(--text-soft); margin-bottom: 5px;
}
.field input, .field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-xs);
    background: var(--surface-2);
    color: var(--text);
    font: inherit; font-size: .92rem;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.field input:focus, .field textarea:focus {
    outline: none; background: #fff;
    border-color: var(--copper);
    box-shadow: 0 0 0 3px var(--copper-ring);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.souhaits-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.field select {
    width: 100%; padding: 10px 12px; border: 1px solid var(--line);
    border-radius: var(--radius-xs); background: var(--surface-2); color: var(--text);
    font: inherit; font-size: .92rem;
}
.field select:focus { outline: none; background: #fff; border-color: var(--copper); box-shadow: 0 0 0 3px var(--copper-ring); }

/* ============================ UPLOAD ============================ */
.upload-card { margin-top: 6px; }
.upload-tip {
    margin-bottom: 14px; padding: 12px 16px;
    background: var(--copper-tint); border: 1px solid #e7d2bf;
    border-radius: var(--radius-sm); color: var(--text);
    font-size: .88rem; line-height: 1.5;
}
.upload-tip strong { color: var(--copper-700); }
.upload-precise { margin-top: 12px; display: flex; justify-content: center; }
.upload-zone {
    background: var(--surface);
    border: 2px dashed var(--line);
    border-radius: var(--radius);
    padding: 46px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s, transform .1s;
    position: relative;
}
.upload-zone:hover { border-color: var(--copper); background: var(--surface-2); }
.upload-zone.dragover { border-color: var(--copper); background: var(--copper-tint); transform: translateY(-1px); }
.upload-icon-wrapper {
    width: 64px; height: 64px; margin: 0 auto 16px;
    display: grid; place-items: center;
    background: var(--copper-tint);
    color: var(--copper-700);
    border-radius: 18px;
}
.upload-icon { width: 30px; height: 30px; }
.upload-zone h3 { font-family: var(--font-display); font-size: 1.22rem; font-weight: 600; margin-bottom: 8px; }
.upload-subtitle { color: var(--text); font-weight: 600; margin-bottom: 4px; }
.file-info { color: var(--text-soft); font-size: .9rem; }
.file-info-small { color: var(--text-mute); font-size: .8rem; margin-top: 4px; }

/* Progress */
.progress-section { margin-top: 18px; }
.progress-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: .86rem; }
.progress-label { font-weight: 600; }
.progress-count { color: var(--text-soft); font-variant-numeric: tabular-nums; }
.progress-bar { height: 12px; background: var(--surface-3); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.progress-fill {
    height: 100%; width: 0;
    background: linear-gradient(90deg, var(--copper), var(--copper-600));
    border-radius: 999px;
    display: flex; align-items: center; justify-content: flex-end;
    transition: width .3s ease;
    position: relative; overflow: hidden;
}
.progress-fill.indeterminate {
    animation: sweep 1.15s ease-in-out infinite;
}
@keyframes sweep {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(250%); }
}
.progress-percentage { color: #fff; font-size: .66rem; font-weight: 700; padding-right: 8px; }
.progress-text { margin-top: 8px; color: var(--text-soft); font-size: .86rem; }

/* ============================ FILTRES ============================ */
.filters-section {
    margin-top: 22px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--sh-1);
    padding: 20px 22px;
}
.filters-header {
    display: flex; align-items: center; gap: 10px;
    font-family: var(--font-display); font-weight: 600; font-size: 1.05rem;
    margin-bottom: 16px;
}
.filters-header svg { width: 20px; height: 20px; color: var(--copper-700); }
.filters-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.filter-group { position: relative; }
.filter-label { display: block; font-size: .76rem; font-weight: 600; color: var(--text-soft); margin-bottom: 6px; }
.filter-input, .filter-select {
    width: 100%; padding: 9px 12px;
    border: 1px solid var(--line); border-radius: var(--radius-xs);
    background: var(--surface-2); color: var(--text); font: inherit; font-size: .9rem;
}
.filter-input:focus, .filter-select:focus { outline: none; border-color: var(--copper); box-shadow: 0 0 0 3px var(--copper-ring); background: #fff; }
.search-box .search-input { padding-left: 36px; }
.search-icon { position: absolute; left: 11px; bottom: 10px; width: 17px; height: 17px; color: var(--text-mute); pointer-events: none; }
.filters-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.btn-reset {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 16px; border: 1px solid var(--line); border-radius: var(--radius-xs);
    background: var(--surface); color: var(--text-soft); font-weight: 600; font-size: .86rem;
}
.btn-reset:hover { border-color: var(--copper); color: var(--copper-700); }
.btn-reset svg { width: 16px; height: 16px; }
.results-count { display: inline-flex; align-items: center; gap: 8px; color: var(--text-soft); font-size: .86rem; font-weight: 600; }
.results-count svg { width: 16px; height: 16px; color: var(--copper-700); }

/* ============================ STATS DASHBOARD ============================ */
.stats-dashboard {
    margin-top: 22px;
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 4px solid var(--copper);
    border-radius: var(--radius-sm);
    box-shadow: var(--sh-1);
    padding: 18px 20px;
}
.stat-card.green { border-left-color: var(--green); }
.stat-card.blue { border-left-color: var(--blue); }
.stat-card.orange { border-left-color: var(--copper); }
.stat-card.purple { border-left-color: #6b5bd1; }
.stat-card .stat-icon { width: 30px; height: 30px; color: var(--text-mute); margin-bottom: 10px; }
.stat-card .stat-icon svg { width: 100%; height: 100%; }
.stat-label { font-size: .78rem; color: var(--text-soft); font-weight: 600; }
.stat-value { font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; margin: 4px 0; font-variant-numeric: tabular-nums; }
.stat-change { font-size: .74rem; color: var(--text-mute); display: flex; align-items: center; gap: 5px; }
.stat-change svg { width: 13px; height: 13px; }

/* ============================ SECTION ITEMS ============================ */
.items-grid-section { margin-top: 26px; }
.section-header {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    margin-bottom: 16px; flex-wrap: wrap;
}
.header-title { display: flex; align-items: center; gap: 12px; }
.header-title h2 { font-family: var(--font-display); font-size: 1.3rem; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.title-icon { width: 22px; height: 22px; color: var(--copper-700); }
.item-count-badge {
    min-width: 28px; height: 28px; padding: 0 9px;
    display: inline-grid; place-items: center;
    background: var(--copper); color: #fff; border-radius: 999px; font-weight: 700; font-size: .82rem;
}
.header-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.items-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 20px; }

/* ============================ CARTE ITEM ============================ */
.item-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--sh-1);
    overflow: hidden;
    display: flex; flex-direction: column;
    transition: box-shadow .2s, transform .1s, border-color .2s;
}
.item-card:hover { box-shadow: var(--sh-2); border-color: #ddd4c8; }
.item-card.corrected { border-color: var(--green); }
.item-card.has-error { border-color: var(--red); }
.card-error-notice {
    background: var(--red-tint);
    border: 1px solid var(--red);
    color: #8a241b;
    border-radius: var(--radius-xs);
    padding: 9px 12px;
    font-size: .82rem;
    font-weight: 600;
}

.card-header {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    padding: 12px 16px;
    background: var(--ink-800);
    color: var(--on-ink);
}
.card-header-item { display: flex; flex-direction: column; }
.card-header-label { font-size: .62rem; text-transform: uppercase; letter-spacing: .6px; color: var(--on-ink-soft); }
.card-header-value { font-weight: 700; font-size: .92rem; font-variant-numeric: tabular-nums; }
.card-header-item:nth-child(3) { margin-left: 4px; }
.api-badge { margin-left: auto; padding: 5px 10px; border-radius: 999px; color: #fff !important; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.corrected-badge { margin-left: 8px; padding: 4px 9px; background: var(--green); color: #fff; border-radius: 999px; font-size: .68rem; font-weight: 700; }

.card-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.card-visual { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card-photo { border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); background: var(--surface-3); aspect-ratio: 4 / 3; cursor: zoom-in; position: relative; }
.card-photo::after {
    content: '⤢'; position: absolute; top: 6px; right: 6px;
    width: 24px; height: 24px; display: grid; place-items: center;
    background: rgba(24,28,32,.62); color: #fff; border-radius: 6px; font-size: .8rem;
    opacity: 0; transition: opacity .15s;
}
.card-photo:hover::after { opacity: 1; }

/* Lightbox image plein écran */
.image-lightbox {
    position: fixed; inset: 0; z-index: 80;
    background: rgba(15, 18, 21, .92);
    display: flex; align-items: center; justify-content: center;
    padding: 28px; cursor: zoom-out;
    animation: slideInUp .2s ease-out;
}
.image-lightbox img { max-width: 95vw; max-height: 90vh; object-fit: contain; border-radius: 8px; box-shadow: var(--sh-3); }
.lightbox-close { position: fixed; top: 18px; right: 22px; width: 42px; height: 42px; border: none; border-radius: 50%; background: rgba(255,255,255,.14); color: #fff; font-size: 1.4rem; cursor: pointer; }
.lightbox-close:hover { background: rgba(255,255,255,.24); }

/* ===== Annotateur — entourer la fenêtre avant l'analyse ===== */
.annot-modal {
    position: fixed; inset: 0; z-index: 75;
    background: rgba(15, 18, 21, .9);
    display: flex; align-items: center; justify-content: center;
    padding: 16px; animation: slideInUp .2s ease-out;
}
.annot-content {
    background: var(--surface); border-radius: var(--radius);
    box-shadow: var(--sh-3); width: 100%; max-width: 940px;
    max-height: 94vh; overflow: auto; display: flex; flex-direction: column;
}
.annot-head { padding: 16px 20px 4px; }
.annot-head h3 { font-family: var(--font-display); font-size: 1.16rem; }
.annot-head p { color: var(--text-soft); font-size: .86rem; margin-top: 4px; }
.annot-stage { padding: 14px 20px; display: flex; justify-content: center; }
.annot-canvas {
    max-width: 100%; height: auto; border-radius: var(--radius-sm);
    border: 1px solid var(--line); background: var(--surface-3);
    touch-action: none; cursor: crosshair;
}
.annot-actions {
    display: flex; gap: 10px; justify-content: flex-end;
    padding: 12px 20px 18px; flex-wrap: wrap; border-top: 1px solid var(--line);
}
.annot-ref { margin-top: 12px; padding: 12px 14px; background: var(--copper-tint); border-radius: var(--radius-xs); }
.annot-ref label { display: block; font-size: .82rem; font-weight: 600; color: var(--text); }
.annot-ref-select {
    display: block; margin-top: 6px; width: 100%; max-width: 360px;
    padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-xs);
    background: #fff; font: inherit; font-size: .9rem; color: var(--text);
}
.annot-ref-tip { display: block; margin-top: 8px; font-size: .78rem; color: var(--copper-700); font-weight: 500; }
.card-photo img { width: 100%; height: 100%; object-fit: cover; }
.card-schematic { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); padding: 8px; display: flex; flex-direction: column; }
.schematic-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.schematic-label { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-mute); }
.schematic-buttons { display: flex; gap: 5px; }
.btn-toggle-svg, .btn-view-code {
    padding: 3px 8px; font-size: .68rem; font-weight: 600;
    border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--text-soft);
}
.btn-toggle-svg.active { background: var(--copper); color: #fff; border-color: var(--copper); }
.schematic-display, .schematic-ia { flex: 1; display: grid; place-items: center; }
.schematic-display svg, .schematic-ia svg { max-width: 100%; height: auto; }

.card-content { display: flex; flex-direction: column; gap: 12px; }
.card-title { font-family: var(--font-display); font-weight: 600; font-size: 1.02rem; }
.card-specs { display: flex; flex-direction: column; border: 1px solid var(--line-2); border-radius: var(--radius-sm); overflow: hidden; }
.spec-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 12px; font-size: .82rem; }
.spec-row:nth-child(odd) { background: var(--surface-2); }
.spec-label { color: var(--text-soft); }
.spec-value { font-weight: 600; text-align: right; }

.card-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.card-total { display: flex; flex-direction: column; }
.total-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .6px; color: var(--text-mute); }
.total-value { font-family: var(--font-display); font-size: 1.34rem; font-weight: 700; color: var(--copper-700); font-variant-numeric: tabular-nums; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================ BOUTONS ============================ */
.btn {
    display: inline-flex; align-items: center; gap: 8px; justify-content: center;
    padding: 10px 16px;
    border: 1px solid transparent; border-radius: var(--radius-xs);
    font-weight: 600; font-size: .88rem; line-height: 1;
    transition: background .15s, border-color .15s, color .15s, transform .08s;
    background: var(--surface-3); color: var(--text);
}
.btn:active { transform: translateY(1px); }
.btn-icon { width: 16px; height: 16px; }
.btn-primary { background: var(--copper); color: #fff; }
.btn-primary:hover { background: var(--copper-600); }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { filter: brightness(.95); }
.btn-outline { background: var(--surface); color: var(--text-soft); border-color: var(--line); }
.btn-outline:hover { border-color: var(--red); color: var(--red); }
.btn-secondary { background: var(--surface-3); color: var(--text-soft); }
.btn-secondary:hover { background: var(--line); }
.btn-correct { background: var(--ink-700); color: #fff; }
.btn-correct:hover { background: var(--ink-600); }
.btn-export-excel { background: #1d6f42; color: #fff; }
.btn-export-excel:hover { filter: brightness(1.06); }

/* ============================ BARRE TOTAL COLLANTE ============================ */
.summary-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
    background: var(--ink-900); color: var(--on-ink);
    border-top: 3px solid var(--copper);
    box-shadow: 0 -10px 30px rgba(24,28,32,.22);
}
.summary-bar-inner {
    max-width: var(--maxw); margin: 0 auto; padding: 12px 24px;
    display: flex; align-items: center; gap: 28px; flex-wrap: wrap;
}
.summary-figures { display: flex; gap: 28px; flex-wrap: wrap; }
.summary-fig { display: flex; flex-direction: column; }
.summary-fig .label { font-size: .68rem; text-transform: uppercase; letter-spacing: .6px; color: var(--on-ink-soft); }
.summary-fig .value { font-weight: 700; font-size: 1.04rem; font-variant-numeric: tabular-nums; }
.summary-fig.ttc .value { font-family: var(--font-display); font-size: 1.45rem; color: #fff; }
.summary-fig.ttc .label { color: var(--copper); }
.summary-actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }

/* ============================ MODALES ============================ */
.modal {
    position: fixed; inset: 0; z-index: 60;
    background: rgba(24, 28, 32, .55);
    backdrop-filter: blur(2px);
    display: none; align-items: center; justify-content: center;
    padding: 20px;
}
.modal[style*="flex"] { display: flex !important; }
.modal-content {
    background: var(--surface); border-radius: var(--radius);
    box-shadow: var(--sh-3); width: min(640px, 100%);
    max-height: 90vh; overflow: auto;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-header h3 { font-family: var(--font-display); font-size: 1.16rem; font-weight: 600; }
.modal-close { width: 34px; height: 34px; border: none; background: var(--surface-3); border-radius: 8px; font-size: 1.2rem; color: var(--text-soft); }
.modal-close:hover { background: var(--line); }
.modal-body { padding: 22px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { display: flex; flex-direction: column; }
.form-group label { font-size: .78rem; font-weight: 600; color: var(--text-soft); margin-bottom: 5px; }
.form-group input, .form-group select {
    padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-xs);
    background: var(--surface-2); font: inherit; font-size: .92rem; color: var(--text);
}
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--copper); box-shadow: 0 0 0 3px var(--copper-ring); background: #fff; }
.checkbox-group { flex-direction: row; align-items: center; }
.checkbox-group label { display: flex; align-items: center; gap: 8px; margin: 0; cursor: pointer; }
.checkbox-group input { width: 18px; height: 18px; accent-color: var(--copper); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ============================ MODALE CORRECTION ============================ */
.correction-modal {
    position: fixed; inset: 0; z-index: 65;
    background: rgba(24,28,32,.55); backdrop-filter: blur(2px);
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.correction-modal-content { background: var(--surface); border-radius: var(--radius); box-shadow: var(--sh-3); width: min(720px, 100%); max-height: 92vh; overflow: auto; }
.correction-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; background: var(--ink-800); color: var(--on-ink); }
.correction-modal-header h3 { font-family: var(--font-display); font-size: 1.16rem; }
.correction-modal-header .modal-close { background: rgba(255,255,255,.1); color: #fff; }
.correction-modal-body { padding: 22px; display: flex; flex-direction: column; gap: 18px; }
.correction-preview { border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); max-height: 220px; }
.correction-preview img { width: 100%; height: 100%; object-fit: contain; background: var(--surface-3); }
.correction-current h4, .correction-form h4 { font-size: .82rem; text-transform: uppercase; letter-spacing: .6px; color: var(--copper-700); margin-bottom: 10px; }
.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.result-item { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-xs); padding: 8px 11px; display: flex; flex-direction: column; gap: 2px; }
.result-item.confidence-high { border-left: 3px solid var(--green); }
.result-item.confidence-medium { border-left: 3px solid var(--amber); }
.result-item.confidence-low { border-left: 3px solid var(--red); }
.result-label { font-size: .7rem; color: var(--text-mute); }
.result-value { font-weight: 700; font-size: .92rem; }
.correction-hint { font-size: .84rem; color: var(--text-soft); background: var(--copper-tint); border-radius: var(--radius-xs); padding: 9px 12px; margin-bottom: 12px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.form-field { display: flex; flex-direction: column; }
.form-field label { font-size: .78rem; font-weight: 600; color: var(--text-soft); margin-bottom: 5px; display: flex; align-items: center; gap: 6px; }
.form-field input, .form-field select, .form-field textarea {
    padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-xs);
    background: var(--surface-2); font: inherit; font-size: .92rem; color: var(--text);
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { outline: none; border-color: var(--copper); box-shadow: 0 0 0 3px var(--copper-ring); background: #fff; }
.field-hint { font-size: .72rem; color: var(--text-mute); margin-top: 4px; }
.agent-stats { border-top: 1px solid var(--line); padding-top: 14px; }
.agent-stats h4 { font-size: .9rem; margin-bottom: 10px; }
.stats-empty { font-size: .86rem; color: var(--text-soft); background: var(--green-tint); border-radius: var(--radius-xs); padding: 10px 12px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.agent-stats .stat-card { border-left: 4px solid var(--copper); text-align: center; padding: 12px; }
.agent-stats .stat-card.stat-positive { border-left-color: var(--green); }
.agent-stats .stat-value { font-size: 1.3rem; }
.correction-modal-footer { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 22px; border-top: 1px solid var(--line); }

/* ============================ MODALE CODE SVG ============================ */
.svg-code-modal { position: fixed; inset: 0; z-index: 70; background: rgba(24,28,32,.6); display: flex; align-items: center; justify-content: center; padding: 20px; }
.svg-code-modal-content { background: var(--surface); border-radius: var(--radius); width: min(720px, 100%); max-height: 88vh; overflow: auto; box-shadow: var(--sh-3); }
.svg-code-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.svg-code-modal-close { width: 32px; height: 32px; border: none; background: var(--surface-3); border-radius: 8px; }
.svg-code-modal-body { padding: 18px 20px; }
.svg-code-actions { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.btn-copy-svg { padding: 8px 14px; border: none; border-radius: var(--radius-xs); background: var(--copper); color: #fff; font-weight: 600; }
.svg-code-length { font-size: .8rem; color: var(--text-mute); }
.svg-code-display { background: var(--ink-900); color: #e2e2e2; border-radius: var(--radius-xs); padding: 14px; overflow: auto; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .78rem; }

/* ============================ TOASTS ============================ */
.toast-container { position: fixed; top: 18px; right: 18px; z-index: 90; display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.toast {
    display: flex; align-items: flex-start; gap: 11px;
    background: var(--surface); border: 1px solid var(--line);
    border-left: 4px solid var(--copper);
    border-radius: var(--radius-sm); box-shadow: var(--sh-2);
    padding: 13px 14px; animation: slideInRight .35s ease-out;
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.warning { border-left-color: var(--amber); }
.toast.info { border-left-color: var(--blue); }
.toast-icon { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.toast-icon svg { width: 100%; height: 100%; }
.toast-content { flex: 1; }
.toast-message { font-size: .88rem; color: var(--text); }
.toast-close { width: 24px; height: 24px; border: none; background: transparent; color: var(--text-mute); padding: 0; }
.toast-close svg { width: 18px; height: 18px; }

/* ============================ FOOTER ============================ */
.app-footer { text-align: center; color: var(--text-mute); font-size: .82rem; padding: 30px 0 10px; }

/* ============================ ANIMATIONS ============================ */
@keyframes slideInRight { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideInUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

/* ============================ RESPONSIVE ============================ */
@media (max-width: 860px) {
    .devis-grid { grid-template-columns: 1fr; gap: 18px; }
    .steps { flex-direction: column; }
    .step + .step { border-left: none; border-top: 1px solid var(--line-2); }
    .card-visual { grid-template-columns: 1fr; }
    .form-grid, .form-row, .field-row, .stats-grid { grid-template-columns: 1fr; }
    .summary-bar-inner { gap: 14px; }
    .summary-fig.ttc .value { font-size: 1.2rem; }
}
@media (max-width: 560px) {
    .shell { padding: 0 14px; }
    .items-grid { grid-template-columns: 1fr; }
    .topbar-meta .meta-text { display: none; }
    .summary-actions { width: 100%; }
    .summary-actions .btn { flex: 1; }
}
