/* BTP Manager IA — espace entreprise */
.btpm-root {
    --btpm-accent: #e8590c;
    --accent: var(--btpm-accent);
    --accent-soft: color-mix(in srgb, var(--accent) 10%, #fff);
    --accent-line: color-mix(in srgb, var(--accent) 30%, #fff);
    --ink: #1b1f24;
    --ink2: #4b5563;
    --muted: #6b7280;
    --line: #e5e7eb;
    --line2: #d1d5db;
    --bg: #f5f6f8;
    --card: #fff;
    --side: #16191d;
    --ok: #15803d;
    --warn: #b45309;
    --err: #b91c1c;
    --info: #1d4ed8;
    --ia: #6d28d9;
    --r: 14px;
    --tabbar: 0px;
    --sidew: 250px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.45;
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    text-align: left;
}
.btpm-root *, .btpm-root *::before, .btpm-root *::after { box-sizing: border-box; }
.btpm-root h1, .btpm-root h2, .btpm-root h3, .btpm-root h4 { font-weight: 700; font-family: inherit; color: var(--ink); margin: 0; letter-spacing: -.01em; line-height: 1.25; text-transform: none; }
.btpm-root p { margin: 0 0 .6em; }
.btpm-root a { color: var(--accent); text-decoration: none; }
.btpm-root a:hover { text-decoration: underline; }
.btpm-root button { font: inherit; cursor: pointer; }
.btpm-root input, .btpm-root select, .btpm-root textarea {
    font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line2); border-radius: 10px;
    padding: 9px 11px; width: 100%; min-height: 42px; margin: 0; box-shadow: none; outline: none; transition: border-color .15s, box-shadow .15s;
}
.btpm-root input, .btpm-root select, .btpm-root textarea { font-weight: 400; }
.btpm-root textarea { resize: vertical; min-height: 42px; line-height: 1.4; }
.btpm-root textarea.auto { resize: none; overflow: hidden; }
.btpm-root input:focus, .btpm-root select:focus, .btpm-root textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.btpm-root input[type=checkbox], .btpm-root input[type=radio] { width: 18px; height: 18px; min-height: 0; padding: 0; accent-color: var(--accent); flex: none; }
.btpm-root input[type=color] { padding: 4px; height: 42px; cursor: pointer; }
.btpm-root select { appearance: auto; }
.btpm-root code { font-size: .85em; background: #f1f3f5; padding: 1px 5px; border-radius: 4px; }
.btpm-root [hidden] { display: none !important; }
.btpm-root .ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.btpm-muted { color: var(--muted); }
.btpm-root small { font-size: 12.5px; }
.pad { padding: 14px 4px; margin: 0; }

body.btpm-fullscreen { margin: 0; background: #f5f6f8; }
body.btpm-noscroll { overflow: hidden; }

/* ------------------------------ Boutons ------------------------------ */
.btpm-root .btpm-btn { font-weight: 600; font-size: 14.5px; }
.btpm-root .btpm-btn.sm { font-size: 13.5px; }
.btpm-root .btpm-btn.lg { font-size: 16px; }
.btpm-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--accent); background: var(--accent);
    color: #fff !important; font-weight: 600; font-size: 14.5px; padding: 0 16px; min-height: 42px; border-radius: 11px; white-space: nowrap;
    text-decoration: none !important; transition: filter .15s, transform .05s, background .15s; line-height: 1.1;
}
.btpm-btn:hover { filter: brightness(.95); }
.btpm-btn:active { transform: translateY(1px); }
.btpm-btn:disabled { opacity: .6; cursor: default; }
.btpm-btn.ghost { background: #fff; color: var(--ink) !important; border-color: var(--line2); }
.btpm-btn.ghost:hover { background: #f9fafb; filter: none; }
.btpm-btn.danger, .btpm-btn.ghost.danger { color: var(--err) !important; }
.btpm-btn.sm { min-height: 36px; padding: 0 12px; font-size: 13.5px; border-radius: 9px; }
.btpm-btn.sm .ico { width: 17px; height: 17px; }
.btpm-btn.lg { min-height: 52px; padding: 0 22px; font-size: 16px; border-radius: 13px; }
.btpm-btn.white { background: #fff; color: var(--ink) !important; border-color: #fff; }
.btpm-btn.wide { width: 100%; }
.btpm-btn.ia { background: linear-gradient(135deg, var(--ia), #9333ea); border-color: transparent; box-shadow: 0 6px 18px -6px rgba(109, 40, 217, .55); }
.btpm-btn.ia-outline { color: var(--ia) !important; border-color: color-mix(in srgb, var(--ia) 35%, #fff); background: #faf5ff; }
.btpm-btn.pulse { box-shadow: 0 0 0 3px var(--accent-soft); animation: btpm-pulse 1.6s infinite; }
.btpm-btn.stale { opacity: .85; }
@keyframes btpm-pulse { 50% { box-shadow: 0 0 0 6px var(--accent-soft); } }
.btpm-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 11px; border: 1px solid var(--line2); background: #fff; color: var(--ink2); padding: 0; }
.btpm-icon-btn:hover { background: #f3f4f6; color: var(--ink); }
.btpm-icon-btn.danger:hover { color: var(--err); background: #fef2f2; }
.btpm-icon-btn.sm { width: 32px; height: 32px; border-radius: 8px; border-color: transparent; background: transparent; }
.btpm-icon-btn.sm .ico { width: 17px; height: 17px; }
.btpm-link { background: none; border: 0; color: var(--accent); font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; padding: 8px 2px; }
.btpm-link .ico { width: 16px; height: 16px; }

.btpm-spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: btpm-spin .8s linear infinite; }
.btpm-spinner.sm { width: 17px; height: 17px; border-width: 2px; border-color: rgba(255, 255, 255, .45); border-top-color: currentColor; }
.btpm-btn.ghost .btpm-spinner.sm { border-color: var(--line); border-top-color: var(--accent); }
@keyframes btpm-spin { to { transform: rotate(360deg); } }
.btpm-boot, .btpm-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; min-height: 50vh; color: var(--muted); }

/* ------------------------------ Connexion ------------------------------ */
.btpm-login { min-height: 80vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: radial-gradient(circle at 20% 0%, var(--accent-soft), transparent 50%), #f5f6f8; }
.btpm-fullscreen .btpm-login { min-height: 100vh; }
.btpm-login-card { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 32px 28px; width: 100%; max-width: 420px; box-shadow: 0 20px 50px -25px rgba(0, 0, 0, .25); }
.btpm-login-card h1 { font-size: 24px; margin-bottom: 4px; }
.btpm-login-logo { margin-bottom: 14px; }
.btpm-login-card form p { margin: 0 0 14px; }
.btpm-login-card label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.btpm-login-card .login-remember label { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.btpm-login-card input[type=submit] { width: 100%; background: var(--accent); color: #fff; border: 0; font-weight: 700; min-height: 48px; cursor: pointer; }
.btpm-login-links { font-size: 14px; text-align: center; margin-top: 8px; }

/* ------------------------------ Structure ------------------------------ */
.btpm-shell { background: var(--bg); min-height: 100vh; }
.btpm-side {
    position: fixed; inset: 0 auto 0 0; width: var(--sidew); background: var(--side); color: #cbd2d9; display: flex; flex-direction: column; padding: 18px 14px; z-index: 30;
}
.btpm-brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 20px; color: #fff !important; text-decoration: none !important; }
.btpm-brand span { display: flex; flex-direction: column; min-width: 0; }
.btpm-brand strong { font-size: 16px; }
.btpm-brand small { color: #8b95a1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.btpm-nav { display: flex; flex-direction: column; gap: 3px; }
.btpm-nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: #cbd2d9 !important; font-weight: 500; text-decoration: none !important; }
.btpm-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff !important; }
.btpm-nav a.active { background: rgba(255, 255, 255, .1); color: #fff !important; box-shadow: inset 3px 0 0 var(--accent); }
.btpm-side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.btpm-quota { padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, .05); font-size: 13px; }
.btpm-quota span { display: block; margin-bottom: 6px; }
.btpm-meter { height: 6px; background: rgba(255, 255, 255, .12); border-radius: 99px; overflow: hidden; margin-bottom: 5px; }
.btpm-meter i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.btpm-logout { display: flex; align-items: center; gap: 10px; padding: 10px 12px; color: #8b95a1 !important; font-size: 14px; border-radius: 10px; }
.btpm-logout:hover { color: #fff !important; background: rgba(255, 255, 255, .06); text-decoration: none !important; }
.btpm-main { margin-left: var(--sidew); padding: 28px 32px 40px; min-height: 100vh; }
.btpm-view { max-width: 1180px; margin: 0 auto; }
.btpm-view.in { animation: btpm-in .22s ease-out; }
@keyframes btpm-in { from { opacity: 0; transform: translateY(6px); } }
.btpm-tabbar { display: none; }

/* Intégré dans une page du thème (mode plein écran désactivé) : navigation en haut */
body:not(.btpm-fullscreen) .btpm-shell { min-height: 0; border-radius: 16px; }
body:not(.btpm-fullscreen) .btpm-side { display: none; }
body:not(.btpm-fullscreen) .btpm-main { margin-left: 0; padding: 18px 16px 30px; min-height: 0; }
body:not(.btpm-fullscreen) .btpm-tabbar { display: flex; gap: 4px; padding: 8px; background: var(--side); border-radius: 16px 16px 0 0; }
body:not(.btpm-fullscreen) .btpm-tabbar a { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px; border-radius: 10px; color: #cbd2d9 !important; font-weight: 600; font-size: 14px; text-decoration: none !important; }
body:not(.btpm-fullscreen) .btpm-tabbar a.active { background: rgba(255, 255, 255, .12); color: #fff !important; }
body:not(.btpm-fullscreen) .btpm-shell { display: flex; flex-direction: column; }
body:not(.btpm-fullscreen) .btpm-tabbar { order: -1; }

/* ------------------------------ En-têtes de page ------------------------------ */
.btpm-page-head { margin-bottom: 22px; }
.btpm-back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted) !important; font-size: 14px; margin-bottom: 10px; }
.btpm-back .ico { width: 18px; height: 18px; }
.btpm-page-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.btpm-page-title h1 { font-size: 27px; font-weight: 750; }
.btpm-page-title p { color: var(--muted); margin: 4px 0 0; }
.btpm-page-title p::first-letter { text-transform: uppercase; }
.btpm-page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btpm-status-select { width: auto !important; min-width: 150px; font-weight: 600; }

/* ------------------------------ Cartes ------------------------------ */
.btpm-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 22px; margin-bottom: 18px; box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
.btpm-card h2 { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
.btpm-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.btpm-card-head h2 { margin: 0; display: flex; align-items: center; gap: 10px; }
.btpm-card-head a { font-size: 14px; font-weight: 600; }
.btpm-card-soft { background: #fafafa; border-style: dashed; }
.btpm-num { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 14px; font-weight: 700; }
.btpm-grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.btpm-grid2 > .btpm-card { margin-bottom: 0; }
.btpm-grid2 { margin-bottom: 18px; }

.btpm-hero {
    display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 24px 26px; border-radius: 18px; margin-bottom: 18px; color: #fff;
    background: linear-gradient(120deg, var(--side), color-mix(in srgb, var(--accent) 55%, var(--side)));
}
.btpm-hero h2 { color: #fff; font-size: 21px; margin-bottom: 6px; }
.btpm-hero p { margin: 0; color: rgba(255, 255, 255, .82); max-width: 600px; }

.btpm-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.btpm-kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; display: flex; flex-direction: column; gap: 3px; color: var(--ink) !important; text-decoration: none !important; min-width: 0; }
a.btpm-kpi:hover { border-color: var(--accent-line); }
.btpm-kpi span { color: var(--muted); font-size: 13.5px; }
.btpm-kpi strong { font-size: 25px; font-weight: 750; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btpm-kpi small { color: var(--muted); }

.btpm-alert { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-radius: 12px; margin-bottom: 14px; font-size: 14.5px; border: 1px solid; color: var(--ink) !important; text-decoration: none !important; }
.btpm-alert > .ico:first-child { margin-top: 1px; }
.btpm-alert div { flex: 1; }
.btpm-alert.warn { background: #fffbeb; border-color: #fde68a; }
.btpm-alert.warn > .ico { color: var(--warn); }
.btpm-alert.info { background: #eff6ff; border-color: #bfdbfe; }
.btpm-alert.info > .ico { color: var(--info); }
.btpm-alert.err { background: #fef2f2; border-color: #fecaca; }
.btpm-alert.err > .ico { color: var(--err); }

/* Listes */
.btpm-rows { display: flex; flex-direction: column; }
.btpm-row { display: flex; align-items: center; gap: 12px; padding: 11px 6px; border-bottom: 1px solid var(--line); color: var(--ink) !important; text-decoration: none !important; border-radius: 8px; }
.btpm-row:last-child { border-bottom: 0; }
.btpm-row:hover { background: #f9fafb; }
.btpm-row-ico { width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; flex: none; }
.btpm-row-main, .btpm-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.btpm-row-main strong, .btpm-item-main strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btpm-row-main small, .btpm-item-main small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btpm-row-side, .btpm-item-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.btpm-row-side small, .btpm-item-side small { color: var(--muted); }
.btpm-cards { display: flex; flex-direction: column; gap: 8px; }
.btpm-item { display: flex; align-items: center; gap: 13px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; color: var(--ink) !important; text-decoration: none !important; transition: border-color .15s, box-shadow .15s; }
.btpm-item:hover { border-color: var(--accent-line); box-shadow: 0 4px 14px -8px rgba(0, 0, 0, .15); }
.btpm-item-side span { display: flex; align-items: center; gap: 6px; }
.btpm-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; }
.btpm-empty { text-align: center; padding: 50px 20px; background: #fff; border: 1px dashed var(--line2); border-radius: var(--r); }
.btpm-empty > .ico { width: 44px; height: 44px; color: var(--accent); margin-bottom: 8px; }
.btpm-empty h3 { font-size: 19px; margin-bottom: 6px; }
.btpm-empty p { color: var(--muted); max-width: 420px; margin: 0 auto 16px; }

.btpm-badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: #f3f4f6; color: var(--ink2); white-space: nowrap; }
.p-nouveau { background: #f3f4f6; color: #374151; }
.p-en_etude { background: #eef2ff; color: #4338ca; }
.p-devis_envoye, .d-envoye { background: #eff6ff; color: #1d4ed8; }
.p-accepte, .d-accepte { background: #ecfdf5; color: #047857; }
.p-en_cours { background: #fff7ed; color: #c2410c; }
.p-termine { background: #f0fdf4; color: #15803d; }
.p-perdu, .d-refuse { background: #fef2f2; color: #b91c1c; }
.d-brouillon { background: #f3f4f6; color: #4b5563; }
.btpm-chip { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: #f3f4f6; color: var(--ink2); }
.btpm-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.btpm-chips::-webkit-scrollbar { display: none; }
.btpm-chips button { border: 1px solid var(--line2); background: #fff; border-radius: 99px; padding: 6px 13px; font-size: 13.5px; white-space: nowrap; color: var(--ink2); }
.btpm-chips button b { color: var(--muted); font-weight: 600; margin-left: 2px; }
.btpm-chips button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.btpm-chips button.on b { color: #cbd2d9; }
.btpm-search { position: relative; margin-bottom: 12px; }
.btpm-search .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; height: 18px; }
.btpm-search input { padding-left: 38px; background: #fff; }

/* ------------------------------ Formulaires ------------------------------ */
.btpm-form { display: flex; flex-direction: column; gap: 14px; }
.btpm-form label, .btpm-form-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; font-weight: 600; color: var(--ink2); }
.btpm-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.btpm-form-grid.g3 { grid-template-columns: 1fr 1fr 1.4fr; }
.btpm-form-grid .span2 { grid-column: span 2; }
.btpm-form-title { font-size: 15px; margin-top: 4px; }
.btpm-root label.btpm-check { flex-direction: row; align-items: center; gap: 9px; font-weight: 500; color: var(--ink); }
.btpm-sub { border: 1px solid var(--line); background: #fafafa; border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.btpm-sub h4 { font-size: 15px; }
.btpm-seg { display: inline-flex; background: #f3f4f6; border-radius: 11px; padding: 3px; gap: 3px; align-self: flex-start; }
.btpm-seg label { margin: 0; cursor: pointer; }
.btpm-seg input { position: absolute; opacity: 0; pointer-events: none; }
.btpm-seg span { display: block; padding: 7px 14px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--ink2); }
.btpm-seg input:checked + span { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.btpm-contact { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.btpm-contact a, .btpm-contact span { display: inline-flex; gap: 8px; align-items: center; color: var(--ink) !important; }
.btpm-contact .ico { color: var(--muted); width: 18px; height: 18px; }
.btpm-note { margin: 12px 0 0; padding: 10px 12px; background: #fafafa; border-radius: 10px; white-space: pre-line; }

/* ------------------------------ Étapes projet ------------------------------ */
.btpm-steps { list-style: none; display: flex; gap: 8px; margin: 0 0 18px; padding: 0; }
.btpm-steps li { flex: 1; }
.btpm-steps a { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 12px; background: #fff; border: 1px solid var(--line); color: var(--muted) !important; font-weight: 600; text-decoration: none !important; font-size: 14.5px; }
.btpm-steps i { width: 26px; height: 26px; border-radius: 50%; background: #f3f4f6; display: flex; align-items: center; justify-content: center; font-style: normal; font-size: 13px; flex: none; }
.btpm-steps i .ico { width: 15px; height: 15px; stroke-width: 2.6; }
.btpm-steps li.done a { color: var(--ok) !important; }
.btpm-steps li.done i { background: #dcfce7; }
.btpm-steps li.current a { color: var(--ink) !important; border-color: var(--accent-line); background: var(--accent-soft); }
.btpm-steps li.current i { background: var(--accent); color: #fff; }

/* Dépôt de fichiers */
.btpm-drop { border: 2px dashed var(--line2); border-radius: 16px; padding: 26px 16px; text-align: center; background: #fcfcfd; transition: all .15s; display: flex; flex-direction: column; align-items: center; gap: 8px; position: relative; }
.btpm-drop.over { border-color: var(--accent); background: var(--accent-soft); }
.btpm-drop p { margin: 0; }
.btpm-drop-ico { width: 52px; height: 52px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.btpm-drop-ico .ico { width: 26px; height: 26px; }
.btpm-drop-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.btpm-drop-btns label { cursor: pointer; }
.btpm-progress { position: absolute; left: 16px; right: 16px; bottom: 10px; height: 5px; background: var(--line); border-radius: 99px; overflow: hidden; }
.btpm-progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.show-touch { display: none !important; }
@media (hover: none) and (pointer: coarse) { .show-touch { display: inline-flex !important; } .hide-touch { display: none; } }

.btpm-docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 16px; }
.btpm-doc { position: relative; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.btpm-doc-thumb { height: 108px; background: #f3f4f6; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.btpm-doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.btpm-doc-thumb .ico.big { width: 44px; height: 44px; stroke-width: 1.3; }
.ico.big.pdf { color: #dc2626; }
.ico.big.image { color: #2563eb; }
.ico.big.text { color: #0f766e; }
.btpm-doc-info { padding: 8px 10px; display: flex; flex-direction: column; min-width: 0; }
.btpm-doc-info span { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btpm-doc-info small { color: var(--muted); font-size: 12px; }
.btpm-doc-check { position: absolute; top: 7px; left: 7px; z-index: 2; cursor: pointer; }
.btpm-doc-check input { position: absolute; opacity: 0; }
.btpm-doc-check i { width: 24px; height: 24px; border-radius: 7px; background: rgba(255, 255, 255, .95); border: 1.5px solid var(--line2); display: flex; align-items: center; justify-content: center; color: transparent; }
.btpm-doc-check i .ico { width: 15px; height: 15px; stroke-width: 3; }
.btpm-doc-check input:checked + i { background: var(--accent); border-color: var(--accent); color: #fff; }
.btpm-doc:has(.btpm-doc-check input:not(:checked)) { opacity: .55; }
.btpm-doc-del { position: absolute; top: 7px; right: 7px; width: 26px; height: 26px; border-radius: 7px; border: 0; background: rgba(17, 24, 39, .6); color: #fff; display: flex; align-items: center; justify-content: center; padding: 0; }
.btpm-doc-del .ico { width: 15px; height: 15px; }
.btpm-doc-del:hover { background: var(--err); }

.btpm-consigne { display: flex; flex-direction: column; gap: 7px; margin-top: 18px; }
.btpm-consigne strong { font-size: 15px; }
.btpm-analyse-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 16px; }
.btpm-analyse-bar small { flex: 1; min-width: 200px; }
.btpm-inline { display: flex !important; flex-direction: row !important; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; flex-basis: 100%; }
.btpm-inline select { width: auto; flex: 1; max-width: 420px; }

.btpm-ai-run { display: flex; gap: 16px; align-items: center; margin-top: 18px; padding: 18px; border-radius: 14px; background: linear-gradient(135deg, #faf5ff, #fff7ed); border: 1px solid #e9d5ff; }
.btpm-ai-run > div:last-child { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.btpm-ai-run strong { font-size: 16px; }
.btpm-ai-orb { width: 54px; height: 54px; border-radius: 50%; background: linear-gradient(135deg, var(--ia), #db2777); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; animation: btpm-glow 2s ease-in-out infinite; }
.btpm-ai-orb .ico { width: 26px; height: 26px; animation: btpm-spin 6s linear infinite; }
@keyframes btpm-glow { 50% { box-shadow: 0 0 0 10px rgba(147, 51, 234, .12); } }
.btpm-ai-bar { height: 5px; background: rgba(109, 40, 217, .12); border-radius: 99px; overflow: hidden; margin: 6px 0 2px; }
.btpm-ai-bar i { display: block; height: 100%; width: 35%; background: linear-gradient(90deg, var(--ia), #db2777); border-radius: 99px; animation: btpm-slide 1.6s ease-in-out infinite; }
@keyframes btpm-slide { from { transform: translateX(-100%); } to { transform: translateX(300%); } }

/* ------------------------------ Fiche projet ------------------------------ */
.btpm-fiche { margin-bottom: 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.btpm-fiche-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.btpm-fiche-meta select { width: auto; min-height: 36px; padding: 5px 9px; font-size: 13.5px; }
.btpm-details { margin: 16px 0 0; border: 1px solid var(--line); border-radius: 12px; }
.btpm-details summary { padding: 11px 14px; cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 8px; list-style: none; }
.btpm-details summary::-webkit-details-marker { display: none; }
.btpm-details summary .ico { color: var(--muted); }
.btpm-doclist { list-style: none; margin: 0; padding: 0 14px 10px; }
.btpm-doclist li { padding: 9px 0; border-top: 1px solid var(--line); }
.btpm-doclist p { margin: 3px 0 0; color: var(--ink2); font-size: 14px; }
.btpm-listblock { margin-top: 14px; border-radius: 12px; padding: 12px 14px; border: 1px solid; }
.btpm-listblock.warn { background: #fffbeb; border-color: #fde68a; }
.btpm-listblock.info { background: #eff6ff; border-color: #bfdbfe; }
.btpm-listblock-head { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; font-size: 14.5px; }
.btpm-listblock.warn .ico { color: var(--warn); }
.btpm-listblock.info .ico { color: var(--info); }
.btpm-listblock textarea { background: rgba(255, 255, 255, .7); font-size: 14px; }
.btpm-lots-title { font-size: 17px; margin: 24px 0 12px; }
.btpm-lot { border: 1px solid var(--line); border-radius: 14px; margin-bottom: 14px; overflow: hidden; }
.btpm-lot-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #f8f9fa; border-bottom: 1px solid var(--line); }
.btpm-lot-num { width: 30px; height: 30px; border-radius: 9px; background: var(--ink); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; font-size: 14px; }
.btpm-root .btpm-lot-name { font-weight: 700; font-size: 15.5px; border-color: transparent; background: transparent; }
.btpm-root .btpm-lot-name:hover { border-color: var(--line2); background: #fff; }
.btpm-lot-total { white-space: nowrap; font-size: 15px; }
.btpm-mini-actions { display: flex; flex: none; }
.btpm-root .btpm-lot-desc { margin: 10px 12px 0; width: calc(100% - 24px); font-size: 14px; color: var(--ink2); }
.btpm-works { display: flex; flex-direction: column; }
.btpm-work { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; padding: 12px; border-bottom: 1px solid var(--line); align-items: start; }
.btpm-work.verify { background: #fffbeb; }
.btpm-work-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.btpm-root .btpm-work-des { font-weight: 600; }
.btpm-root .btpm-work-det { font-size: 13.5px; color: var(--ink2); }
.btpm-src { color: var(--muted); font-size: 12px; }
.btpm-work-nums { display: grid; grid-template-columns: 76px 88px 96px 82px 100px; gap: 8px; }
.btpm-work-nums label { display: flex; flex-direction: column; gap: 3px; margin: 0; }
.btpm-work-nums label span, .btpm-work-total span { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.btpm-root .btpm-work-nums input, .btpm-root .btpm-work-nums select { padding: 8px 8px; text-align: right; font-size: 14.5px; }
.btpm-root .btpm-work-nums select { text-align: left; }
.btpm-work-total { display: flex; flex-direction: column; gap: 3px; align-items: flex-end; }
.btpm-work-total strong { font-size: 15px; padding-top: 10px; white-space: nowrap; }
.btpm-work-actions { display: flex; flex-direction: column; align-items: center; gap: 4px; padding-top: 18px; }
.btpm-root label.btpm-verify { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; color: var(--muted); font-weight: 600; cursor: pointer; white-space: nowrap; }
.btpm-lot > .btpm-link { margin: 4px 12px 6px; }

/* Barre d'actions collante */
.btpm-sticky {
    position: sticky; bottom: calc(var(--tabbar) + 12px); z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px;
    background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px 10px 18px; margin: 12px 0 18px; box-shadow: 0 10px 30px -12px rgba(0, 0, 0, .25);
}
#etape-2 .btpm-sticky { margin-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; border-top: 0; }
.btpm-sticky-total { display: flex; flex-direction: column; min-width: 0; }
.btpm-sticky-total small { color: var(--muted); }
.btpm-sticky-total strong { font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btpm-sticky-btns { display: flex; gap: 8px; }
.show-sm { display: none; }

/* Modales */
.btpm-modal-wrap { position: fixed; inset: 0; z-index: 100000; background: rgba(15, 18, 22, .5); display: flex; align-items: center; justify-content: center; padding: 20px; animation: btpm-fade .15s; }
@keyframes btpm-fade { from { opacity: 0; } }
.btpm-modal { background: #fff; border-radius: 18px; width: 100%; max-width: 560px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .45); animation: btpm-pop .18s ease-out; }
.btpm-modal.wide { max-width: 760px; }
@keyframes btpm-pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }
.btpm-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 12px 22px; border-bottom: 1px solid var(--line); }
.btpm-modal-head h3 { font-size: 18px; }
.btpm-modal-head .btpm-icon-btn { border: 0; }
.btpm-modal-body { padding: 18px 22px; overflow-y: auto; }
.btpm-modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--line); }
.btpm-examples { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btpm-chip-btn { border: 1px solid var(--line2); background: #fafafa; border-radius: 99px; padding: 6px 12px; font-size: 13px; text-align: left; color: var(--ink2); }
.btpm-chip-btn:hover { border-color: var(--ia); color: var(--ia); }

/* Notifications */
.btpm-toasts { position: fixed; top: 16px; right: 16px; z-index: 100001; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.btpm-toast { display: flex; align-items: center; gap: 10px; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .4); font-size: 14.5px; max-width: 420px; animation: btpm-pop .2s; transition: opacity .4s, transform .4s; }
.btpm-toast.ok .ico { color: #4ade80; }
.btpm-toast.err { background: #7f1d1d; }
.btpm-toast.out { opacity: 0; transform: translateY(-8px); }

/* Menu */
.btpm-menu { position: relative; }
.btpm-menu-list { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .25); padding: 6px; min-width: 180px; z-index: 40; }
.btpm-menu-list button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 10px 12px; border-radius: 8px; text-align: left; color: var(--ink); }
.btpm-menu-list button:hover { background: #f3f4f6; }
.btpm-menu-list button.danger { color: var(--err); }

/* ------------------------------ Devis ------------------------------ */
.btpm-grid-devis { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; }
.btpm-grid-devis > .btpm-card { margin-bottom: 18px; }
.btpm-devis-client p { margin: 2px 0 12px; }
.btpm-lines-card { padding-bottom: 14px; }
.btpm-lines-head, .btpm-line.ligne { display: grid; grid-template-columns: minmax(0, 1fr) 78px 86px 104px 80px 112px 132px; gap: 8px; align-items: start; }
.btpm-lines-head.micro, .btpm-line.ligne.micro { grid-template-columns: minmax(0, 1fr) 78px 86px 104px 112px 132px; }
.btpm-lines-head { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 0 8px 8px; border-bottom: 1px solid var(--line); }
.btpm-lines-head span:nth-child(n+2) { text-align: right; }
.btpm-line { padding: 10px 8px; border-bottom: 1px solid var(--line); }
.btpm-line .c-des { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.btpm-root .btpm-line .c-des input, .btpm-root .btpm-line .c-des textarea[data-l="designation"] { font-weight: 600; }
.btpm-root .btpm-line .c-des textarea { font-size: 13.5px; color: var(--ink2); }
.btpm-line label { margin: 0; }
.btpm-line label span, .btpm-line .c-tot span { display: none; }
.btpm-root .btpm-line .c-q input, .btpm-root .btpm-line .c-p input { text-align: right; padding: 8px; }
.btpm-root .btpm-line select { padding: 8px 6px; }
.btpm-line .c-tot { text-align: right; padding-top: 10px; font-weight: 700; white-space: nowrap; }
.btpm-line-tools { display: flex; justify-content: flex-end; }
.btpm-line.lot, .btpm-line.titre, .btpm-line.texte { display: flex; align-items: center; gap: 8px; }
.btpm-line.lot { background: #f3f4f6; border-radius: 10px; margin-top: 10px; border-bottom: 0; }
.btpm-root .btpm-line.lot input, .btpm-root .btpm-line.lot textarea { font-weight: 750; font-size: 15.5px; background: transparent; border-color: transparent; }
.btpm-root .btpm-line.lot input:hover, .btpm-root .btpm-line.lot textarea:hover { background: #fff; border-color: var(--line2); }
.btpm-line.lot strong { white-space: nowrap; }
.btpm-root .btpm-line.titre input, .btpm-root .btpm-line.titre textarea { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.btpm-line.texte textarea { font-style: italic; color: var(--ink2); }
.btpm-line.lot > input, .btpm-line.titre > input, .btpm-line.lot > textarea, .btpm-line.titre > textarea, .btpm-line.texte > textarea { flex: 1; }
.btpm-lines-empty { padding: 28px; text-align: center; color: var(--muted); }
.btpm-add-lines { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 14px; }
.btpm-totals { display: flex; flex-direction: column; gap: 2px; }
.btpm-tot-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 14.5px; }
.btpm-tot-row small { color: var(--muted); }
.btpm-tot-row b { white-space: nowrap; }
.btpm-tot-row.strong { border-top: 1px solid var(--line); font-size: 16px; }
.btpm-tot-row.muted { color: var(--muted); font-size: 13.5px; }
.btpm-tot-row.ttc { background: var(--accent); color: #fff; border-radius: 11px; padding: 12px 14px; margin: 6px 0; font-size: 18px; }
.btpm-tot-row.input label { display: flex; align-items: center; gap: 8px; font-size: 14.5px; }
.btpm-root .btpm-tot-row.input input { width: 72px; text-align: right; padding: 6px 8px; min-height: 36px; }

/* Profil */
.btpm-imgbox { display: flex; flex-direction: column; gap: 6px; }
.btpm-imgprev { height: 120px; border: 1px dashed var(--line2); border-radius: 12px; display: flex; align-items: center; justify-content: center; background: repeating-conic-gradient(#f3f4f6 0% 25%, #fff 0% 50%) 50% / 16px 16px; }
.btpm-imgprev img { max-height: 100px; max-width: 90%; object-fit: contain; }
.btpm-row-btns { display: flex; gap: 8px; }
.btpm-row-btns label { cursor: pointer; }

/* ------------------------------ Tablette ------------------------------ */
@media (max-width: 1180px) {
    .btpm-work { grid-template-columns: 1fr auto; }
    .btpm-work-nums { grid-column: 1 / -1; grid-row: 2; grid-template-columns: repeat(4, 1fr) 1.2fr; }
    .btpm-work-actions { grid-column: 2; grid-row: 1; flex-direction: row; padding-top: 0; }
    .btpm-kpis { grid-template-columns: repeat(2, 1fr); }
}

/* ------------------------------ Mobile & tablette portrait ------------------------------ */
@media (max-width: 960px) {
    .btpm-root { --tabbar: 64px; }
    .btpm-side { display: none; }
    .btpm-main, body:not(.btpm-fullscreen) .btpm-main { margin-left: 0; padding: 18px 16px calc(var(--tabbar) + 24px + env(safe-area-inset-bottom)); }
    .btpm-tabbar {
        display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: rgba(255, 255, 255, .96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid var(--line); height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    }
    .btpm-tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted) !important; font-size: 11px; font-weight: 600; text-decoration: none !important; }
    .btpm-tabbar a .ico { width: 23px; height: 23px; }
    .btpm-tabbar a.active { color: var(--accent) !important; }
    .btpm-grid2, .btpm-grid-devis { grid-template-columns: minmax(0, 1fr); }
    .btpm-grid2 > .btpm-card { margin-bottom: 0; }
    .btpm-hero { flex-direction: column; align-items: flex-start; padding: 20px; }
    .btpm-lines-head { display: none; }
    .btpm-line.ligne, .btpm-line.ligne.micro { grid-template-columns: repeat(4, 1fr); padding: 12px 4px; }
    .btpm-line.ligne.micro { grid-template-columns: repeat(3, 1fr); }
    .btpm-line .c-des { grid-column: 1 / -1; }
    .btpm-line label span, .btpm-line .c-tot span { display: block; font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; margin-bottom: 3px; }
    .btpm-line .c-tot { grid-column: 1 / 3; text-align: left; padding-top: 4px; font-size: 16px; }
    .btpm-line.ligne.micro .c-tot { grid-column: 1 / 2; }
    .btpm-line.ligne .btpm-line-tools { grid-column: 3 / -1; align-self: end; }
}

@media (max-width: 640px) {
    .btpm-root { font-size: 15.5px; }
    .btpm-root input, .btpm-root select, .btpm-root textarea { font-size: 16px; }
    .btpm-page-title h1 { font-size: 23px; }
    .btpm-page-title { flex-direction: column; align-items: stretch; }
    .btpm-page-actions .btpm-status-select { flex: 1; }
    .btpm-card { padding: 16px 14px; border-radius: 13px; }
    .btpm-kpis { gap: 10px; }
    .btpm-kpi { padding: 13px 14px; }
    .btpm-kpi strong { font-size: 20px; }
    .btpm-form-grid, .btpm-form-grid.g3 { grid-template-columns: 1fr; }
    .btpm-form-grid .span2 { grid-column: auto; }
    .btpm-steps span { display: none; }
    .btpm-steps li.current span { display: inline; }
    .btpm-steps a { justify-content: center; padding: 9px; }
    .btpm-docs { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .btpm-doc-thumb { height: 96px; }
    .btpm-analyse-bar .btpm-btn { width: 100%; }
    .btpm-work { grid-template-columns: 1fr; padding: 12px 10px; }
    .btpm-work-nums { grid-template-columns: 1fr 1fr; grid-row: auto; }
    .btpm-work-total { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; }
    .btpm-work-total strong { padding-top: 0; }
    .btpm-work-actions { grid-row: auto; grid-column: auto; flex-direction: row; justify-content: space-between; }
    .btpm-root label.btpm-verify { flex-direction: row; gap: 6px; font-size: 13px; }
    .btpm-lot-head { flex-wrap: wrap; }
    .btpm-lot-head .btpm-lot-name { flex: 1 1 60%; }
    .btpm-lot-head .btpm-lot-name { flex: 1 1 calc(100% - 40px); }
    .btpm-mini-actions { order: 4; }
    .btpm-lot-total { order: 5; margin-left: auto; }
    .btpm-sticky { padding: 8px 8px 8px 14px; border-radius: 14px; }
    .btpm-sticky-total strong { font-size: 16px; }
    .btpm-sticky .btpm-btn { padding: 0 12px; }
    .btpm-sticky-btns { flex: 1; justify-content: flex-end; min-width: 0; }
    #etape-2 .btpm-sticky { flex-wrap: wrap; padding: 10px; }
    #etape-2 .btpm-sticky-total { flex-direction: row; align-items: baseline; gap: 8px; width: 100%; padding: 0 4px; }
    #etape-2 .btpm-sticky-btns { width: 100%; }
    #etape-2 .btpm-sticky-btns .btpm-btn:last-child { flex: 1; }
    .btpm-page-actions .btpm-status-select { min-width: 0; }
    .btpm-page-actions { flex-wrap: nowrap; }
    .hide-sm { display: none; }
    .show-sm { display: inline; }
    .btpm-modal-wrap { align-items: flex-end; padding: 0; }
    .btpm-modal { max-width: none; border-radius: 20px 20px 0 0; max-height: 92vh; }
    .btpm-modal-body { padding: 16px; }
    .btpm-modal-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
    .btpm-modal-foot .btpm-btn { flex: 1; }
    .btpm-toasts { left: 12px; right: 12px; top: 12px; }
    .btpm-toast { max-width: none; }
    .btpm-item { padding: 12px; gap: 11px; }
    .btpm-item-side small { display: none; }
    .btpm-row-side small { display: none; }
    .btpm-add-lines .btpm-btn { flex: 1; }
    .btpm-line.ligne, .btpm-line.ligne.micro { grid-template-columns: 1fr 1fr; }
    .btpm-line.ligne .c-tot { grid-column: 1 / -1; }
    .btpm-line.ligne .btpm-line-tools { grid-column: 1 / -1; }
    .btpm-line.lot, .btpm-line.titre, .btpm-line.texte { flex-wrap: wrap; }
    .btpm-line.lot > input, .btpm-line.titre > input, .btpm-line.lot > textarea, .btpm-line.titre > textarea, .btpm-line.texte > textarea { flex-basis: 100%; }
    .btpm-line.lot strong { flex: 1; padding-left: 12px; }
    .btpm-line.titre .btpm-line-tools, .btpm-line.texte .btpm-line-tools { margin-left: auto; }
}

@media print {
    .btpm-side, .btpm-tabbar, .btpm-sticky { display: none !important; }
    .btpm-main { margin: 0 !important; }
}

/* Ajustement global des prix (− / % / +) */
.btpm-adjust { margin: 2px 0 8px; padding: 12px 12px 14px; border: 1px dashed var(--line2); border-radius: 12px; background: #fafafa; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.btpm-adjust-head { display: flex; flex-direction: column; align-items: center; gap: 1px; text-align: center; }
.btpm-adjust-head span { font-weight: 600; font-size: 14px; }
.btpm-adjust-head small { color: var(--muted); }
.btpm-adjust.up .btpm-adjust-head small { color: var(--ok); font-weight: 600; }
.btpm-adjust.down .btpm-adjust-head small { color: var(--err); font-weight: 600; }
.btpm-adjust-ctl { display: flex; align-items: center; gap: 12px; }
.btpm-root .btpm-adj-btn {
    width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line2); background: #fff; color: var(--ink);
    font-size: 26px; font-weight: 500; line-height: 1; display: flex; align-items: center; justify-content: center; padding: 0 0 2px;
    user-select: none; -webkit-user-select: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; transition: background .1s, transform .05s;
}
.btpm-root .btpm-adj-btn:hover { background: #f3f4f6; }
.btpm-root .btpm-adj-btn:active { transform: scale(.94); background: var(--accent-soft); border-color: var(--accent); }
.btpm-adj-val { position: relative; display: block; margin: 0; }
.btpm-root .btpm-adj-val input { width: 104px; height: 48px; text-align: center; font-size: 20px; font-weight: 700; padding: 0 26px 0 10px; font-variant-numeric: tabular-nums; }
.btpm-adj-val span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; pointer-events: none; }
.btpm-adjust.up .btpm-adj-val input { color: var(--ok); }
.btpm-adjust.down .btpm-adj-val input { color: var(--err); }
.btpm-root label.btpm-btn { flex-direction: row; gap: 8px; }
.btpm-version { color: #5b6470; font-size: 11.5px; padding: 0 12px; }
.btpm-stale { position: fixed; top: 0; left: 0; right: 0; z-index: 100002; background: #b91c1c; color: #fff; padding: 10px 16px; font-size: 14px; text-align: center; }

/* Boutons d'insertion rapide dans les lignes chiffrées du devis : + (ligne), L (lot), S (sous-titre), C (commentaire) */
/* L et S flottent au-dessus du champ sans prendre de place : le champ texte reste aligné avec Qté, Unité, PU… */
.btpm-line.ligne { padding-top: 26px; }
.btpm-line.ligne .c-des { position: relative; gap: 0; }
.btpm-des-top { position: absolute; top: -23px; left: 26px; height: 20px; display: flex; align-items: center; }
.btpm-des-row { display: flex; align-items: center; gap: 4px; }
.btpm-des-field { flex: 1; min-width: 0; display: flex; align-items: stretch; }
.btpm-des-field input, .btpm-des-field textarea { flex: 1; min-width: 0; }
.btpm-qa { display: flex; gap: 4px; align-items: center; flex: none; }

/* Petits boutons colorés */
.btpm-root .btpm-qa button, .btpm-root .btpm-qa-c {
    height: 19px; min-width: 21px; min-height: 0; padding: 0 5px; border-radius: 6px; border: 1px solid; font-size: 11px; font-weight: 800;
    line-height: 1; display: inline-flex; align-items: center; justify-content: center; gap: 3px; flex: none; transition: background .12s, transform .05s;
}
.btpm-root .btpm-qa button:active, .btpm-root .btpm-qa-c:active { transform: scale(.94); }
.btpm-root .btpm-qa button[data-ins="lot"] { color: #1d4ed8; border-color: #bfdbfe; background: #eff6ff; }
.btpm-root .btpm-qa button[data-ins="lot"]:hover { background: #dbeafe; border-color: #93c5fd; }
.btpm-root .btpm-qa button[data-ins="titre"] { color: #7c3aed; border-color: #ddd6fe; background: #f5f3ff; }
.btpm-root .btpm-qa button[data-ins="titre"]:hover { background: #ede9fe; border-color: #c4b5fd; }
.btpm-root .btpm-qa-c { color: #c2410c; border-color: #fed7aa; background: #fff7ed; }
.btpm-root .btpm-qa-c:hover { background: #ffedd5; border-color: #fdba74; }
.btpm-root .btpm-qa-c .btpm-dot { display: none; width: 3px; height: 3px; border-radius: 50%; background: currentColor; }
.btpm-root .btpm-qa-c.has .btpm-dot { display: block; }
.btpm-root .btpm-qa-c.open { color: #fff; background: #ea580c; border-color: #ea580c; }
.btpm-root .btpm-qa-plus {
    width: 22px; height: 22px; min-height: 0; padding: 0; border: 0; border-radius: 6px; background: transparent;
    color: #65a30d; font-size: 21px; font-weight: 700; line-height: 1; display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.btpm-root .btpm-qa-plus:hover { background: #ecfccb; }

/* Numéro (1 / 1.1 / 1.1.1) collé devant le libellé */
.btpm-numtag {
    display: inline-flex; align-items: center; justify-content: center; min-width: 30px; padding: 0 8px; flex: none;
    font-size: 12px; font-weight: 700; color: var(--ink2); background: #f3f4f6; border: 1px solid var(--line2); border-right: 0;
    border-radius: 10px 0 0 10px; font-variant-numeric: tabular-nums;
}
.btpm-des-field .btpm-numtag + input, .btpm-des-field .btpm-numtag + textarea { border-top-left-radius: 0 !important; border-bottom-left-radius: 0 !important; }
.btpm-line.lot > .btpm-numtag, .btpm-line.titre > .btpm-numtag { align-self: stretch; border-radius: 10px; border-right: 1px solid var(--line2); min-height: 38px; }
.btpm-line.lot > .btpm-numtag { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Ligne de commentaire : C au début, champ fin collé sous le libellé (1 px) */
.btpm-det-row { display: flex; align-items: flex-start; gap: 5px; padding: 1px 0 0 26px; min-height: 21px; }
.btpm-det-row .btpm-qa-c { margin-top: 3px; }
.btpm-root textarea.btpm-det {
    flex: 1; min-width: 0; min-height: 28px; padding: 5px 10px; font-size: 12.5px; line-height: 1.45; color: var(--ink2); font-style: italic;
    background: #fafafa; border: 0; border-left: 2px solid #fdba74; border-radius: 0 0 8px 8px;
}
.btpm-root textarea.btpm-det:focus { background: #fff; box-shadow: 0 0 0 1px var(--line2); border-left-color: #ea580c; }
@media (hover: none) and (pointer: coarse) {
    .btpm-root .btpm-qa button, .btpm-root .btpm-qa-c { height: 26px; min-width: 30px; font-size: 13px; }
    .btpm-root .btpm-qa-plus { width: 30px; height: 30px; font-size: 24px; }
    .btpm-line.ligne { padding-top: 34px; }
    .btpm-des-top { left: 34px; top: -31px; height: 28px; }
    .btpm-det-row { padding-left: 34px; }
}
@media (max-width: 640px) {
    .btpm-line.lot > input, .btpm-line.titre > input, .btpm-line.lot > textarea, .btpm-line.titre > textarea, .btpm-line.texte > textarea { flex: 1 1 100%; min-width: 0; }
    .btpm-line.lot strong { flex: 1; padding-left: 12px; }
}

/* Libellés qui s'agrandissent (textarea automatique) : même aspect qu'un champ d'une ligne */
.btpm-root textarea[data-oneline] { min-height: 42px; line-height: 1.35; padding-top: 10px; padding-bottom: 9px; overflow: hidden; resize: none; }
.btpm-root .btpm-line.titre textarea { text-decoration: underline; text-underline-offset: 3px; }
.btpm-root .btpm-lot-name { font-weight: 700; font-size: 15.5px; }
/* Bouton S inactif (pas de lot au-dessus) */
.btpm-root .btpm-qa button:disabled { color: #9ca3af !important; background: #f3f4f6 !important; border-color: #e5e7eb !important; cursor: not-allowed; transform: none; }

/* S inactif : simplement pâle, sans curseur « interdit » */
.btpm-root .btpm-qa button.is-off { color: #b8bec6 !important; background: #f6f7f8 !important; border-color: #e8eaed !important; cursor: default; transform: none !important; }

/* Bulles d'aide discrètes (au survol) : fond clair, texte de la couleur du bouton */
.btpm-root [data-tip] { position: relative; }
.btpm-root [data-tip]::after {
    content: attr(data-tip); position: absolute; left: -2px; bottom: calc(100% + 6px); transform: translateY(3px);
    background: #fff; color: #4b5563; border: 1px solid #e5e7eb; font-size: 11px; font-weight: 600; font-style: normal; line-height: 1.3; letter-spacing: 0;
    padding: 4px 8px; border-radius: 7px; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .15s, transform .15s; z-index: 60;
    box-shadow: 0 4px 14px -6px rgba(17, 24, 39, .22); text-transform: none;
}
.btpm-root [data-tip]:hover::after { opacity: 1; transform: translateY(0); transition-delay: .25s; }
.btpm-root button[data-ins="lot"][data-tip]::after { color: #1d4ed8; border-color: #bfdbfe; background: #f8fbff; }
.btpm-root button[data-ins="titre"][data-tip]::after { color: #6d28d9; border-color: #ddd6fe; background: #fbfaff; }
.btpm-root .btpm-qa-c[data-tip]::after { color: #c2410c; border-color: #fed7aa; background: #fffaf5; }
.btpm-root .btpm-qa-plus[data-tip]::after { color: #4d7c0f; border-color: #d9f99d; background: #fbfef5; }
.btpm-root .is-off[data-tip]::after { color: #6b7280 !important; border-color: #e5e7eb !important; background: #fafafa !important; font-weight: 500; }
.btpm-add-lines [data-tip]::after { bottom: calc(100% + 6px); }
.btpm-root .btpm-add-lines .is-off { opacity: .45; cursor: default; }
@media (hover: none) { .btpm-root [data-tip]::after { display: none; } }

/* C : plus petit, juste sous le numéro */
.btpm-det-row { padding-top: 2px; min-height: 17px; gap: 4px; }
.btpm-det-row .btpm-qa-c { margin-top: 0; }
.btpm-root .btpm-qa-c { height: 14px; min-width: 15px; padding: 0 3px; font-size: 9px; border-radius: 4px; gap: 2px; }
@media (hover: none) and (pointer: coarse) {
    .btpm-root .btpm-qa-c { height: 20px; min-width: 22px; font-size: 11px; }
}

/* ---- Questions au client (avant le chiffrage) ---- */
.btpm-qa-card > .btpm-muted { margin: 4px 0 14px; }
.btpm-qa-table { border: 1px solid var(--line2); border-radius: 12px; overflow: hidden; background: #fff; }
.btpm-qa-row { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); border-top: 1px solid var(--line); }
.btpm-qa-row:first-child { border-top: 0; }
.btpm-qa-q { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-right: 1px solid var(--line); background: #fafbfc; }
.btpm-qa-q strong { display: block; font-weight: 600; font-size: 14.5px; line-height: 1.4; }
.btpm-qa-q small { display: block; margin-top: 3px; color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.btpm-qa-n { flex: none; width: 24px; height: 24px; border-radius: 50%; background: #e0e7ff; color: var(--info); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; margin-top: 1px; }
.btpm-qa-n .ico { width: 14px; height: 14px; }
.btpm-qa-row.done .btpm-qa-n { background: #dcfce7; color: var(--ok); }
.btpm-qa-row.done .btpm-qa-q { background: #f6fef9; }
.btpm-qa-a { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.btpm-qa-a textarea { min-height: 38px; padding: 7px 10px; font-size: 14px; }
.btpm-qa-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.btpm-root .btpm-qa-opt { border: 1px solid var(--line2); background: #fff; color: var(--ink2); border-radius: 8px; padding: 7px 14px; font-size: 14px; font-weight: 600; min-height: 36px; line-height: 1.2; transition: background .12s, border-color .12s, color .12s; }
.btpm-root .btpm-qa-opt:hover { border-color: var(--ink2); color: var(--ink); }
.btpm-root .btpm-qa-opt.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.btpm-root .btpm-qa-opt.yes.on { background: var(--ok); border-color: var(--ok); }
.btpm-root .btpm-qa-opt.no.on { background: var(--err); border-color: var(--err); }
.btpm-root .btpm-qa-opt.nsp { font-weight: 500; color: var(--muted); border-style: dashed; }
.btpm-root .btpm-qa-opt.nsp.on { background: #6b7280; border-color: #6b7280; border-style: solid; color: #fff; }
.btpm-root .btpm-qa-opt.sm { padding: 4px 10px; min-height: 28px; font-size: 12.5px; }
.btpm-qa-prec { display: block; margin-top: 14px; font-weight: 600; font-size: 14px; }
.btpm-qa-prec textarea { margin-top: 6px; font-weight: 400; }
.btpm-qa-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.btpm-qa-foot .btpm-btn { margin-left: auto; }
.btpm-qa-progress { font-size: 13px; color: var(--muted); font-weight: 600; }
.btpm-qa-foot .btpm-link { color: var(--muted); font-weight: 500; }
.btpm-qa-box { margin-top: 14px; border: 1px solid #c7d2fe; background: #f5f7ff; border-radius: 12px; padding: 0 14px; }
.btpm-qa-box[open] { padding-bottom: 14px; }
.btpm-qa-box > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 12px 0; font-size: 14.5px; flex-wrap: wrap; }
.btpm-qa-box > summary::-webkit-details-marker { display: none; }
.btpm-qa-box > summary .ico { color: var(--info); }
.btpm-qa-box > summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
.btpm-qa-box[open] > summary::after { transform: rotate(-135deg); }
.btpm-chip.warn { background: #fef3c7; color: var(--warn); }
@media (max-width: 640px) {
    .btpm-qa-row { grid-template-columns: minmax(0, 1fr); }
    .btpm-qa-q { border-right: 0; padding-bottom: 6px; }
    .btpm-qa-a { padding: 4px 12px 12px 46px; }
    .btpm-qa-row .btpm-qa-a { background: #fafbfc; }
    .btpm-qa-row.done .btpm-qa-a { background: #f6fef9; }
    .btpm-qa-foot { flex-direction: column-reverse; align-items: stretch; }
    .btpm-qa-foot .btpm-btn { margin-left: 0; width: 100%; justify-content: center; white-space: normal; text-align: center; padding-left: 14px; padding-right: 14px; font-size: 15px; }
    .btpm-qa-foot .btpm-qa-progress, .btpm-qa-foot .btpm-link { align-self: center; }
}

/* ---- Frise de progression de l'IA ---- */
.btpm-prog { margin-top: 18px; padding: 20px 22px 16px; border-radius: 16px; background: linear-gradient(160deg, #faf5ff 0%, #fff 45%, #fff7ed 100%); border: 1px solid #ede9fe; box-shadow: 0 10px 30px -18px rgba(109, 40, 217, .35); }
.btpm-prog-wrap .btpm-prog { margin-top: 14px; }
.btpm-prog-head { display: flex; align-items: center; gap: 14px; }
.btpm-prog-head .btpm-ai-orb { width: 46px; height: 46px; }
.btpm-prog-head .btpm-ai-orb .ico { width: 22px; height: 22px; }
.btpm-prog-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.btpm-prog-titles strong { font-size: 16.5px; }
.btpm-prog-titles small { color: #9ca3af; font-size: 13px; }
.btpm-prog-pct { font-size: 22px; font-weight: 700; color: var(--ia); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.btpm-prog-bar { position: relative; height: 8px; margin: 14px 0 18px; border-radius: 99px; background: rgba(109, 40, 217, .1); overflow: hidden; }
.btpm-prog-bar i { position: relative; display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--ia), #c026d3 60%, var(--accent)); transition: width .45s ease-out; overflow: hidden; }
.btpm-prog-bar i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent); transform: translateX(-100%); animation: btpm-shine 1.8s ease-in-out infinite; }
@keyframes btpm-shine { to { transform: translateX(100%); } }
.btpm-prog-steps { list-style: none; margin: 0; padding: 0; }
.btpm-prog-steps > li { position: relative; display: flex; gap: 12px; padding: 0 0 12px; }
.btpm-prog-steps > li:last-child { padding-bottom: 2px; }
.btpm-prog-steps > li::before { content: ""; position: absolute; left: 10px; top: 24px; bottom: 2px; width: 2px; border-radius: 2px; background: #ece8f5; }
.btpm-prog-steps > li:last-child::before { display: none; }
.btpm-prog-steps > li.done::before { background: linear-gradient(#86efac, #bbf7d0); }
.btpm-prog-dot { flex: none; position: relative; z-index: 1; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #ddd6fe; background: #fff; display: inline-flex; align-items: center; justify-content: center; transition: all .3s; }
.btpm-prog-dot .ico { width: 12px; height: 12px; stroke-width: 3; display: none; }
.btpm-prog-steps > li.done .btpm-prog-dot { background: #22c55e; border-color: #22c55e; color: #fff; }
.btpm-prog-steps > li.done .btpm-prog-dot .ico { display: block; animation: btpm-pop .35s ease; }
@keyframes btpm-pop { from { transform: scale(.3); opacity: 0; } }
.btpm-prog-steps > li.now .btpm-prog-dot { border-color: var(--ia); box-shadow: 0 0 0 4px rgba(109, 40, 217, .12); }
.btpm-prog-steps > li.now .btpm-prog-dot::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ia); animation: btpm-beat 1.2s ease-in-out infinite; }
@keyframes btpm-beat { 50% { transform: scale(.55); opacity: .5; } }
.btpm-prog-steps > li > div { min-width: 0; flex: 1; padding-top: 1px; }
.btpm-prog-steps strong { display: block; font-size: 14.5px; font-weight: 600; line-height: 1.35; color: #c4c9d1; transition: color .3s; }
.btpm-prog-steps > li.now strong { color: var(--ink); }
.btpm-prog-steps > li.done strong { color: #4b5563; font-weight: 500; }
.btpm-prog-steps ul { list-style: none; margin: 3px 0 0; padding: 0; }
.btpm-prog-steps ul li { font-size: 12.5px; line-height: 1.5; color: #a1a1aa; max-height: 0; opacity: 0; overflow: hidden; transform: translateY(-3px); transition: max-height .35s ease, opacity .45s ease, transform .45s ease; overflow-wrap: anywhere; }
.btpm-prog-steps ul li.in { max-height: 60px; opacity: 1; transform: none; }
.btpm-prog-steps ul li.in::before { content: "✓ "; color: #b5dcc2; }
.btpm-prog-steps ul li.cur { color: #8b5cf6; }
.btpm-prog-steps ul li.cur::before { content: "› "; color: #a78bfa; }
.btpm-prog-steps > li.done ul li:not(:first-child) { max-height: 0; opacity: 0; }
.btpm-prog-steps > li.done ul li:first-child { color: #b8bcc4; }
.btpm-prog-foot { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-top: 12px; padding-top: 12px; border-top: 1px dashed #ece8f5; }
.btpm-prog-foot small { color: #a1a1aa; font-size: 12.5px; }
.btpm-prog-foot [data-prog-time] { flex: none; font-variant-numeric: tabular-nums; }
.btpm-prog-tip { text-align: right; font-style: italic; }
.btpm-prog-tip.in { animation: btpm-fade .6s ease; }
@keyframes btpm-fade { from { opacity: 0; transform: translateY(3px); } }
.btpm-prog-retry { color: #d97706; }
.btpm-prog.finished { border-color: #bbf7d0; background: linear-gradient(160deg, #f0fdf4, #fff 60%); }
.btpm-prog.finished .btpm-ai-orb { background: linear-gradient(135deg, #16a34a, #22c55e); animation: none; }
.btpm-prog.finished .btpm-ai-orb .ico { animation: none; }
.btpm-prog.finished .btpm-prog-pct { color: var(--ok); }
@media (max-width: 640px) {
    .btpm-prog { padding: 16px 14px 12px; }
    .btpm-prog-pct { font-size: 18px; }
    .btpm-prog-foot { flex-direction: column; align-items: flex-start; gap: 4px; }
    .btpm-prog-tip { text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
    .btpm-prog-bar i::after, .btpm-prog-steps > li.now .btpm-prog-dot::after { animation: none; }
}

/* Questions « document » et listes repliables */
.btpm-root .btpm-qa-opt.add { display: inline-flex; align-items: center; gap: 6px; border-color: #bfdbfe; color: var(--info); background: #eff6ff; }
.btpm-root .btpm-qa-opt.add .ico { width: 16px; height: 16px; }
.btpm-root .btpm-qa-opt.add.on { background: #eff6ff; color: var(--info); border-color: var(--info); }
.btpm-qa-files { display: flex; flex-wrap: wrap; gap: 6px; }
.btpm-chip.ok { background: #dcfce7; color: var(--ok); display: inline-flex; align-items: center; gap: 4px; }
.btpm-chip.ok .ico { width: 12px; height: 12px; }
details.btpm-listblock { padding: 0 14px; }
details.btpm-listblock[open] { padding-bottom: 12px; }
details.btpm-listblock > summary { list-style: none; cursor: pointer; margin: 0; padding: 11px 0; }
details.btpm-listblock > summary::-webkit-details-marker { display: none; }
details.btpm-listblock > summary .btpm-chip { background: rgba(255, 255, 255, .8); }
details.btpm-listblock > summary::after { content: ""; margin-left: auto; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
details.btpm-listblock[open] > summary::after { transform: rotate(-135deg); }

/* ---- En-tête de la fiche projet : travaux à gauche, client à droite ---- */
.btpm-fiche-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px 22px; align-items: start; }
.btpm-fiche-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.btpm-fiche-col > label, .btpm-f-site { display: flex; flex-direction: column; gap: 5px; }
.btpm-root .btpm-f-type textarea { font-size: 19px; font-weight: 700; color: #1e3a8a; letter-spacing: -.01em; line-height: 1.3; padding: 10px 13px; background: linear-gradient(135deg, #f5f8ff, #fff); border-color: #c7d2fe; }
.btpm-root .btpm-f-type textarea:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99, 102, 241, .15); }
.btpm-f-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-weight: 600; font-size: 13.5px; color: var(--ink2); margin-bottom: 5px; }
.btpm-seg { display: inline-flex; padding: 2px; border-radius: 99px; background: #f1f2f4; border: 1px solid var(--line); }
.btpm-root .btpm-seg button { border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; padding: 3px 11px; border-radius: 99px; line-height: 1.4; min-height: 0; }
.btpm-root .btpm-seg button.on { background: #fff; color: #1e3a8a; box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.btpm-root .btpm-f-client { line-height: 1.5; }
.btpm-f-site { margin-top: 12px; }
.btpm-f-site small { font-weight: 400; }
.btpm-fiche-col .btpm-link.sm { font-size: 13px; padding: 8px 0 0; align-self: flex-start; }
.btpm-fiche-col .btpm-link.sm .ico { width: 15px; height: 15px; }
@media (max-width: 760px) {
    .btpm-fiche-top { grid-template-columns: minmax(0, 1fr); gap: 12px; }
}

/* ---- Éditeur de devis sur téléphone : plus large, plus compact ---- */
@media (max-width: 640px) {
    /* Le cadre des lignes va jusqu'aux bords de l'écran */
    .btpm-grid-devis { margin-left: -10px; margin-right: -10px; }
    .btpm-grid-devis > .btpm-card { border-radius: 12px; }
    .btpm-lines-card { padding-left: 6px; padding-right: 8px; }
    .btpm-lines-card .btpm-card-head { padding-left: 6px; }
    .btpm-line { padding-left: 0; padding-right: 0; }

    /* Ligne chiffrée : + collé au bord gauche, libellé plus large */
    .btpm-line.ligne, .btpm-line.ligne.micro { padding: 20px 0 12px; column-gap: 8px; }
    .btpm-des-row { gap: 1px; }
    .btpm-root .btpm-qa-plus { width: 17px; height: 26px; font-size: 19px; border-radius: 4px; }
    .btpm-des-top { top: -17px; left: 18px; height: 15px; }
    .btpm-root .btpm-qa { gap: 3px; }
    .btpm-root .btpm-qa button { height: 15px; min-width: 17px; padding: 0 3px; font-size: 9px; border-radius: 4px; }
    .btpm-numtag { min-width: 24px; padding: 0 5px; font-size: 10.5px; }
    .btpm-root .btpm-line .c-des textarea[data-l="designation"] { font-size: 14.5px; min-height: 38px; padding: 8px 9px 7px; }

    /* Commentaire : C minuscule, texte plus petit et plus serré */
    .btpm-det-row { padding: 1px 0 0 18px; gap: 3px; min-height: 15px; }
    .btpm-root .btpm-qa-c { height: 13px; min-width: 14px; padding: 0 2px; font-size: 8.5px; border-radius: 3px; }
    .btpm-root textarea.btpm-det { font-size: 12px; line-height: 1.35; min-height: 24px; padding: 3px 8px; }

    /* Lot : une seule ligne basse — numéro minuscule dans l'angle, nom, montant, outils */
    .btpm-line.lot { position: relative; flex-wrap: nowrap; gap: 4px; padding: 7px 4px 6px 8px; margin-top: 12px; }
    .btpm-line.lot > .btpm-numtag {
        position: absolute; top: 0; left: 0; min-height: 0; min-width: 0; height: 15px; padding: 0 5px; font-size: 9.5px;
        border-radius: 10px 0 7px 0; align-self: auto; line-height: 15px;
    }
    .btpm-root .btpm-line.lot > textarea { flex: 1 1 auto; min-width: 0; font-size: 14.5px; min-height: 34px; padding: 8px 6px 6px; }
    .btpm-line.lot strong { flex: none; padding-left: 0; font-size: 14px; }
    .btpm-line.lot .btpm-line-tools, .btpm-line.titre .btpm-line-tools, .btpm-line.texte .btpm-line-tools { flex: none; margin-left: 0; }
    .btpm-line.lot .btpm-icon-btn.sm, .btpm-line.titre .btpm-icon-btn.sm, .btpm-line.texte .btpm-icon-btn.sm { width: 24px; height: 24px; min-height: 0; }
    .btpm-line.lot .btpm-icon-btn.sm .ico, .btpm-line.titre .btpm-icon-btn.sm .ico, .btpm-line.texte .btpm-icon-btn.sm .ico { width: 14px; height: 14px; }

    /* Sous-titre et texte libre : même principe */
    .btpm-line.titre, .btpm-line.texte { position: relative; flex-wrap: nowrap; gap: 4px; padding: 8px 0 6px; }
    .btpm-line.titre > .btpm-numtag {
        position: absolute; top: 2px; left: 0; min-height: 0; min-width: 0; height: 14px; padding: 0 4px; font-size: 9px;
        border-radius: 6px 0 6px 0; line-height: 14px; align-self: auto; border-right: 1px solid var(--line2);
    }
    .btpm-root .btpm-line.titre > textarea, .btpm-root .btpm-line.texte > textarea { flex: 1 1 auto; min-width: 0; font-size: 14px; min-height: 34px; padding: 8px 6px 6px 10px; }
}
@media (max-width: 640px) {
    /* Total HT et outils de la ligne sur la même rangée */
    .btpm-line.ligne .c-tot { grid-column: 1 / 2; align-self: center; padding-top: 2px; }
    .btpm-line.ligne .btpm-line-tools { grid-column: 2 / 3; align-self: center; }
    .btpm-line.ligne .btpm-icon-btn.sm { width: 28px; height: 28px; }
}

/* ---- Téléphone : fiche projet et devis bord à bord (1 px de marge) ---- */
@media (max-width: 640px) {
    .btpm-root .btpm-fiche, .btpm-grid-devis { margin-left: -15px; margin-right: -15px; }
    .btpm-root .btpm-fiche { padding: 12px 1px 14px; border-radius: 10px 10px 0 0; }
    .btpm-root .btpm-fiche > .btpm-card-head, .btpm-root .btpm-fiche > .btpm-muted { padding-left: 9px; padding-right: 9px; }
    .btpm-root .btpm-fiche .btpm-form label, .btpm-root .btpm-fiche .btpm-f-label, .btpm-root .btpm-fiche .btpm-qa-prec { text-indent: 8px; }
    .btpm-root .btpm-fiche .btpm-form label > *, .btpm-root .btpm-fiche .btpm-qa-prec > * { text-indent: 0; }
    .btpm-root .btpm-fiche .btpm-lots-title { padding-left: 9px; }
    .btpm-root .btpm-fiche .btpm-listblock, .btpm-root .btpm-fiche .btpm-qa-box, .btpm-root .btpm-fiche .btpm-details { border-radius: 10px; }
    .btpm-root .btpm-fiche > .btpm-btn.wide { width: calc(100% - 2px); margin-left: 1px; }

    /* Lots et lignes de la fiche */
    .btpm-lot { margin-bottom: 8px; border-radius: 10px; }
    .btpm-lot-head { padding: 6px 6px 6px 8px; gap: 6px; }
    .btpm-root .btpm-lot-desc { margin: 6px 1px 0; width: calc(100% - 2px); }
    .btpm-work { padding: 8px 1px; gap: 6px; }
    .btpm-work-nums { gap: 6px 1px; column-gap: 4px; }
    .btpm-work-nums label span, .btpm-work-total span { padding-left: 7px; }
    .btpm-work-total { padding: 0 7px; }
    .btpm-work-actions { padding: 0 7px; }
    .btpm-src { padding-left: 7px; }
    .btpm-lot > .btpm-link { margin: 2px 8px 4px; }

    /* Devis : même principe */
    .btpm-grid-devis > .btpm-card { border-radius: 10px; }
    .btpm-root .btpm-lines-card { padding-left: 1px; padding-right: 1px; }
    .btpm-root .btpm-lines-card > .btpm-card-head { padding-left: 9px; padding-right: 9px; }
    .btpm-line.ligne label span { padding-left: 7px; }
    .btpm-line.ligne .c-tot { padding-left: 7px; }
    .btpm-line.ligne, .btpm-line.ligne.micro { column-gap: 4px; }
}
@media (max-width: 640px) {
    #etape-2 > .btpm-sticky { margin-left: -15px; margin-right: -15px; }
}
@media (max-width: 640px) {
    .btpm-root .btpm-lines-card { margin-left: -15px; margin-right: -15px; border-radius: 10px; }
}

/* ---- Téléphone : 2 px de marge, + et C alignés à gauche, textes plus petits ---- */
@media (max-width: 640px) {
    .btpm-root .btpm-fiche, .btpm-grid-devis, .btpm-root .btpm-lines-card, #etape-2 > .btpm-sticky { margin-left: -14px; margin-right: -14px; }
    .btpm-root .btpm-fiche { padding-left: 2px; padding-right: 2px; }
    .btpm-root .btpm-lines-card { padding-left: 2px; padding-right: 2px; }
    .btpm-root .btpm-fiche > .btpm-btn.wide { width: calc(100% - 4px); margin-left: 2px; }
    .btpm-root .btpm-lot-desc { margin: 6px 2px 0; width: calc(100% - 4px); }
    .btpm-work { padding: 8px 2px; }

    /* + plus à gauche et collé au champ */
    .btpm-des-row { gap: 0; }
    .btpm-root .btpm-qa-plus { width: 14px; margin-left: -1px; font-size: 18px; }
    .btpm-des-top { left: 13px; }

    /* C au même niveau que le + : le commentaire gagne en largeur */
    .btpm-det-row { padding-left: 0; gap: 2px; }
    .btpm-root .btpm-qa-c { margin-left: -1px; }

    /* Textes : désignation −1 pt, commentaire −2 pt */
    .btpm-root .btpm-line .c-des textarea[data-l="designation"] { font-size: 13.5px; }
    .btpm-root textarea.btpm-det { font-size: 10px; line-height: 1.4; }
}
@media (max-width: 640px) {
    .btpm-det-row { gap: 1px; }
    .btpm-root .btpm-qa-c { min-width: 13px; width: 13px; padding: 0; gap: 0; }
    .btpm-root .btpm-qa-c .btpm-dot { display: none !important; }
}
@media (max-width: 640px) {
    .btpm-root .btpm-line .c-des textarea.btpm-det { font-size: 11.5px; line-height: 1.4; }
}

/* ---- Téléphone : Qté, Unité, PU HT, TVA et Total sur UNE seule ligne ---- */
@media (max-width: 640px) {
    /* Devis */
    .btpm-line.ligne { position: relative; grid-template-columns: 44px 62px minmax(0, 1fr) 54px minmax(0, 1fr); column-gap: 3px; row-gap: 4px; align-items: end; }
    .btpm-line.ligne.micro { grid-template-columns: 44px 62px minmax(0, 1fr) minmax(0, 1fr); }
    .btpm-line.ligne .c-des { grid-column: 1 / -1; }
    .btpm-line.ligne .c-q, .btpm-line.ligne .c-u, .btpm-line.ligne .c-p, .btpm-line.ligne .c-t, .btpm-line.ligne .c-tot { grid-column: auto; grid-row: 2; }
    .btpm-line.ligne label span, .btpm-line.ligne .c-tot span { font-size: 9px; letter-spacing: .02em; margin-bottom: 1px; padding-left: 3px; line-height: 1.2; }
    .btpm-root .btpm-line.ligne .c-q input, .btpm-root .btpm-line.ligne .c-p input, .btpm-root .btpm-line.ligne select {
        height: 32px; min-height: 32px; font-size: 13px; padding: 4px 5px; border-radius: 7px;
    }
    .btpm-root .btpm-line.ligne select { -webkit-appearance: none; appearance: none; background-image: none; padding-right: 3px; text-overflow: clip; }
    .btpm-line.ligne .c-tot { grid-column: auto; text-align: right; padding: 0 2px 7px 0; font-size: 13px; align-self: end; }
    .btpm-line.ligne .c-tot strong { font-size: 13px; }
    .btpm-line.ligne .c-tot span { padding-left: 0; }
    /* Outils (monter, descendre, dupliquer, supprimer) : en haut à droite, dans la bande des boutons L et S */
    .btpm-line.ligne .btpm-line-tools { position: absolute; top: 1px; right: 2px; grid-column: auto; grid-row: auto; gap: 1px; }
    .btpm-root .btpm-line.ligne .btpm-icon-btn.sm { width: 22px; height: 18px; min-height: 0; border-radius: 5px; }
    .btpm-root .btpm-line.ligne .btpm-icon-btn.sm .ico { width: 13px; height: 13px; }

    /* Fiche projet : même principe */
    .btpm-work-nums { grid-template-columns: 44px 62px minmax(0, 1fr) 54px minmax(0, 1fr); column-gap: 3px; row-gap: 0; align-items: end; }
    .btpm-work-nums label span, .btpm-work-total span { font-size: 9px; letter-spacing: .02em; padding-left: 3px; line-height: 1.2; }
    .btpm-root .btpm-work-nums input, .btpm-root .btpm-work-nums select { height: 32px; min-height: 32px; font-size: 13px; padding: 4px 5px; border-radius: 7px; }
    .btpm-root .btpm-work-nums select { -webkit-appearance: none; appearance: none; background-image: none; padding-right: 3px; }
    .btpm-work-total { grid-column: auto; flex-direction: column; align-items: flex-end; justify-content: flex-end; gap: 1px; padding: 0 2px 7px 0; }
    .btpm-work-total span { padding-left: 0; }
    .btpm-work-total strong { font-size: 13px; padding-top: 0; }
    .btpm-work-actions { padding: 0 4px; }
}
@media (max-width: 640px) {
    .btpm-line.ligne .c-tot { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; align-self: stretch; padding-bottom: 8px; }
    .btpm-line.ligne .c-tot span { margin-bottom: 0; }
    .btpm-work-total { align-self: stretch; justify-content: space-between; padding-bottom: 8px; }
}

/* Commentaire : fond plus foncé pour bien le rattacher à sa ligne */
.btpm-root .btpm-line .c-des textarea.btpm-det { background: #eceef2; }
.btpm-root .btpm-line .c-des textarea.btpm-det:focus { background: #fff; }
@media (max-width: 640px) {
    /* Qté commence au même niveau que le libellé et le commentaire */
    .btpm-line.ligne { grid-template-columns: 57px 62px minmax(0, 1fr) 54px minmax(0, 1fr); }
    .btpm-line.ligne.micro { grid-template-columns: 57px 62px minmax(0, 1fr) minmax(0, 1fr); }
    .btpm-line.ligne .c-q { padding-left: 13px; }
}

/* ---- Tablette : même organisation que le téléphone, en plus grand ---- */
@media (min-width: 641px) and (max-width: 960px) {
    .btpm-line.ligne, .btpm-line.ligne.micro { position: relative; padding: 26px 0 12px; column-gap: 6px; row-gap: 6px; align-items: end;
        grid-template-columns: 94px 96px minmax(0, 1fr) 80px minmax(0, 1fr); }
    .btpm-line.ligne.micro { grid-template-columns: 94px 96px minmax(0, 1fr) minmax(0, 1fr); }
    .btpm-line.ligne .c-des { grid-column: 1 / -1; }
    .btpm-line.ligne .c-q, .btpm-line.ligne .c-u, .btpm-line.ligne .c-p, .btpm-line.ligne .c-t, .btpm-line.ligne .c-tot { grid-column: auto; grid-row: 2; }

    /* + un peu plus à gauche ; libellé, commentaire et Qté démarrent au même niveau (24 px) */
    .btpm-des-row { gap: 2px; }
    .btpm-root .btpm-qa-plus { width: 22px; margin-left: -2px; }
    .btpm-des-top { left: 22px; }
    .btpm-det-row { padding-left: 0; gap: 2px; }
    .btpm-root .btpm-qa-c { width: 20px; min-width: 20px; margin-left: 0; }
    .btpm-line.ligne .c-q { padding-left: 22px; }

    /* Chiffres : champs plus compacts, total tout à droite */
    .btpm-line.ligne label span, .btpm-line.ligne .c-tot span { display: block; font-size: 10.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 2px; padding-left: 3px; }
    .btpm-root .btpm-line.ligne .c-q input, .btpm-root .btpm-line.ligne .c-p input, .btpm-root .btpm-line.ligne select { height: 38px; min-height: 38px; font-size: 14.5px; padding: 6px 8px; }
    .btpm-root .btpm-line.ligne select { padding-right: 4px; }
    .btpm-line.ligne .c-tot { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; align-self: stretch; text-align: right; padding: 0 2px 9px 0; }
    .btpm-line.ligne .c-tot span { padding-left: 0; margin-bottom: 0; }
    .btpm-line.ligne .c-tot strong { font-size: 15.5px; }

    /* Outils de la ligne en haut à droite, sur la bande des boutons L et S */
    .btpm-line.ligne .btpm-line-tools { position: absolute; top: 2px; right: 0; grid-column: auto; grid-row: auto; gap: 2px; }
    .btpm-root .btpm-line.ligne .btpm-icon-btn.sm { width: 26px; height: 22px; min-height: 0; border-radius: 6px; }
    .btpm-root .btpm-line.ligne .btpm-icon-btn.sm .ico { width: 15px; height: 15px; }
}
@media (min-width: 641px) and (max-width: 960px) and (hover: none) and (pointer: coarse) {
    .btpm-line.ligne, .btpm-line.ligne.micro { padding-top: 32px; }
    .btpm-des-top { top: -29px; }
}

/* Lots : fond bleu-vert clair (plus bleu que vert) */
.btpm-line.lot { background: #dcedf4; }
.btpm-lot-head { background: #dcedf4; border-bottom-color: #c5e0ec; }
.btpm-root .btpm-line.lot textarea:hover, .btpm-root .btpm-line.lot textarea:focus { background: #fff; }

/* Ligne chiffrée : un seul bouton, le X rouge, aligné sur le libellé */
.btpm-root .btpm-line-x {
    flex: none; align-self: center; width: 26px; height: 26px; min-height: 0; margin-left: 4px; padding: 0; border: 0; border-radius: 7px;
    background: transparent; color: #dc2626; display: inline-flex; align-items: center; justify-content: center; transition: background .12s;
}
.btpm-root .btpm-line-x .ico { width: 17px; height: 17px; stroke-width: 2.6; }
.btpm-root .btpm-line-x:hover { background: #fee2e2; }
.btpm-root .btpm-line-x:active { transform: scale(.92); }
@media (max-width: 640px) {
    .btpm-root .btpm-line-x { width: 22px; height: 26px; margin-left: 1px; }
    .btpm-root .btpm-line-x .ico { width: 15px; height: 15px; }
}
@media (min-width: 961px) {
    .btpm-lines-head, .btpm-line.ligne { grid-template-columns: minmax(0, 1fr) 78px 86px 104px 80px 118px; }
    .btpm-lines-head.micro, .btpm-line.ligne.micro { grid-template-columns: minmax(0, 1fr) 78px 86px 104px 118px; }
}

/* Poubelle à l'intérieur du champ du libellé, à droite, centrée sur la ligne */
.btpm-des-field { position: relative; }
.btpm-root .btpm-des-field textarea[data-l="designation"] { padding-right: 36px; }
.btpm-root .btpm-des-field .btpm-line-x {
    position: absolute; right: 5px; top: 50%; transform: translateY(-50%); margin: 0; width: 28px; height: 28px;
    color: #9ca3af; border-radius: 7px; background: transparent;
}
.btpm-root .btpm-des-field .btpm-line-x .ico { width: 16px; height: 16px; stroke-width: 2; }
.btpm-root .btpm-des-field .btpm-line-x:hover { color: #dc2626; background: #fee2e2; }
.btpm-root .btpm-des-field .btpm-line-x:active { transform: translateY(-50%) scale(.92); }
@media (max-width: 640px) {
    .btpm-root .btpm-des-field textarea[data-l="designation"] { padding-right: 30px; }
    .btpm-root .btpm-des-field .btpm-line-x { right: 3px; width: 24px; height: 26px; }
    .btpm-root .btpm-des-field .btpm-line-x .ico { width: 15px; height: 15px; }
}

/* Le texte du libellé ne passe jamais sous la poubelle */
.btpm-root .btpm-line .c-des .btpm-des-field textarea[data-l="designation"] { padding-right: 38px; }
@media (max-width: 640px) {
    .btpm-root .btpm-line .c-des .btpm-des-field textarea[data-l="designation"] { padding-right: 32px; }
}

/* Séparation entre deux lignes du devis : trait plus marqué au centre, qui s'affine et disparaît sur les côtés */
.btpm-line.ligne, .btpm-line.titre, .btpm-line.texte { position: relative; border-bottom: 0; }
.btpm-line.ligne::after, .btpm-line.titre::after, .btpm-line.texte::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 4px; pointer-events: none;
    background: radial-gradient(ellipse at center, rgba(71, 85, 105, .55) 0%, rgba(71, 85, 105, .38) 40%, rgba(71, 85, 105, .12) 62%, rgba(71, 85, 105, 0) 72%);
}
.btpm-line.ligne { padding-bottom: 14px; margin-bottom: 4px; }
@media (max-width: 640px) {
    .btpm-line.ligne, .btpm-line.ligne.micro { padding-bottom: 12px; margin-bottom: 4px; }
}
.btpm-line.ligne::after, .btpm-line.titre::after, .btpm-line.texte::after {
    height: 5px; bottom: -3px;
    background: radial-gradient(ellipse at center, rgba(71, 85, 105, .7) 0%, rgba(71, 85, 105, .45) 38%, rgba(71, 85, 105, .14) 60%, rgba(71, 85, 105, 0) 72%);
}
/* Trait de séparation : plus fin, plus noir, plein plus loin vers les bords avant de s'effacer */
.btpm-line.ligne::after, .btpm-line.titre::after, .btpm-line.texte::after {
    height: 3px; bottom: -2px;
    background: radial-gradient(ellipse 100% 100% at center, rgba(17, 24, 39, .85) 0%, rgba(17, 24, 39, .75) 55%, rgba(17, 24, 39, .3) 80%, rgba(17, 24, 39, 0) 100%);
}
.btpm-line.ligne::after, .btpm-line.titre::after, .btpm-line.texte::after {
    height: 3px; bottom: -2px;
    background: linear-gradient(90deg, rgba(17, 24, 39, 0) 0%, rgba(17, 24, 39, .8) 14%, rgba(17, 24, 39, .8) 86%, rgba(17, 24, 39, 0) 100%);
    clip-path: polygon(0 50%, 14% 0, 86% 0, 100% 50%, 86% 100%, 14% 100%);
}
/* Trait de séparation : bleu-vert foncé, 30 % plus fin */
.btpm-line.ligne::after, .btpm-line.titre::after, .btpm-line.texte::after {
    height: 2.1px; bottom: -1px;
    background: linear-gradient(90deg, rgba(15, 76, 92, 0) 0%, rgba(15, 76, 92, .9) 14%, rgba(15, 76, 92, .9) 86%, rgba(15, 76, 92, 0) 100%);
}
/* Trait de séparation : épaisseur identique partout (bordure alignée sur les pixels de l'écran), couleur qui s'efface aux extrémités */
.btpm-line.ligne::after, .btpm-line.titre::after, .btpm-line.texte::after {
    height: 0; bottom: 0; clip-path: none; background: none;
    border-top: 1.5px solid transparent;
    border-image: linear-gradient(90deg, rgba(15, 76, 92, 0) 0%, rgba(15, 76, 92, .9) 14%, rgba(15, 76, 92, .9) 86%, rgba(15, 76, 92, 0) 100%) 1;
}
.btpm-line.ligne::after, .btpm-line.titre::after, .btpm-line.texte::after {
    border-top-width: 1.5px;
    border-image: linear-gradient(90deg, rgba(15, 76, 92, 0) 0%, rgb(15, 76, 92) 14%, rgb(15, 76, 92) 86%, rgba(15, 76, 92, 0) 100%) 1;
}

/* Téléphone : chiffres plus compacts, le Total garde toujours sa place à droite */
@media (max-width: 640px) {
    .btpm-line.ligne { grid-template-columns: 47px 46px minmax(0, 1fr) 40px max-content; column-gap: 3px; }
    .btpm-line.ligne.micro { grid-template-columns: 47px 46px minmax(0, 1fr) max-content; }
    .btpm-root .btpm-line.ligne .c-q input, .btpm-root .btpm-line.ligne .c-p input, .btpm-root .btpm-line.ligne select {
        height: 28px; min-height: 28px; font-size: 12px; padding: 3px 4px; border-radius: 6px;
    }
    .btpm-root .btpm-line.ligne .c-p input { min-width: 44px; }
    .btpm-line.ligne label span, .btpm-line.ligne .c-tot span { font-size: 8.5px; }
    .btpm-line.ligne .c-tot { padding: 0 1px 6px 3px; min-width: 0; }
    .btpm-line.ligne .c-tot strong { font-size: 12.5px; white-space: nowrap; }
}

/* ---- Commentaire structuré : icône, outils (volet suivant, ●, ○) et niveaux ---- */
.btpm-root .btpm-qa-c { color: #c2410c; }
.btpm-root .btpm-qa-c .ico { width: 13px; height: 13px; stroke-width: 2; }
.btpm-root .btpm-qa-c.open .ico { color: #fff; }
.btpm-det-row { align-items: flex-start; }
.btpm-det-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.btpm-det-wrap[hidden] { display: none; }
.btpm-det-tools { display: flex; gap: 3px; align-items: center; margin: 0 0 1px; }
.btpm-root .btpm-dt {
    height: 18px; min-width: 20px; min-height: 0; padding: 0 5px; border-radius: 5px; border: 1px solid #cbd5e1; background: #fff;
    color: #334155; font-size: 11px; font-weight: 700; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
}
.btpm-root .btpm-dt.lt { color: #0e7490; border-color: #a5d8e6; background: #ecfeff; }
.btpm-root .btpm-dt:hover { border-color: #64748b; }
.btpm-root .btpm-dt.is-off { color: #c0c6ce; border-color: #e5e7eb; background: #f8f9fa; }
.btpm-det-blk { display: flex; align-items: flex-start; gap: 4px; min-width: 0; }
.btpm-det-blk textarea { flex: 1; min-width: 0; }
.btpm-det-mark { flex: none; width: 14px; text-align: center; padding-top: 5px; font-size: 12px; font-weight: 700; color: #334155; line-height: 1.2; }
/* Niveau 1 (volets a, b…) : texte le plus marqué */
.btpm-root .btpm-line .c-des .btpm-det-blk.lv1 textarea.btpm-det { background: #e7ebf1; font-weight: 500; color: #1f2937; }
/* Niveau 2 (●) : décalé, fond bleuté, texte plus léger */
.btpm-det-blk.lv2 { margin-left: 18px; }
.btpm-det-blk.lv2 .btpm-det-mark { font-size: 9px; padding-top: 7px; color: #475569; }
.btpm-root .btpm-line .c-des .btpm-det-blk.lv2 textarea.btpm-det { background: #eaf2f7; font-weight: 400; color: #374151; border-left-color: #7dd3fc; }
/* Niveau 3 (○) : encore décalé, fond plus clair, texte le plus fin */
.btpm-det-blk.lv3 { margin-left: 36px; }
.btpm-det-blk.lv3 .btpm-det-mark { font-size: 10px; padding-top: 6px; color: #64748b; font-weight: 400; }
.btpm-root .btpm-line .c-des .btpm-det-blk.lv3 textarea.btpm-det { background: #f3f6f9; font-weight: 300; color: #4b5563; border-left-color: #cbd5e1; }
.btpm-det-blk.cur .btpm-det-mark { color: #0e7490; }
.btpm-root .btpm-line .c-des .btpm-det-blk textarea.btpm-det:focus { background: #fff; }
@media (max-width: 640px) {
    .btpm-root .btpm-qa-c .ico { width: 10px; height: 10px; }
    .btpm-root .btpm-dt { height: 16px; min-width: 18px; font-size: 10px; padding: 0 4px; }
    .btpm-det-blk.lv2 { margin-left: 12px; }
    .btpm-det-blk.lv3 { margin-left: 24px; }
    .btpm-det-mark { width: 11px; font-size: 11px; padding-top: 4px; }
    .btpm-root .btpm-line .c-des .btpm-det-blk.lv2 textarea.btpm-det { font-size: 11px; }
    .btpm-root .btpm-line .c-des .btpm-det-blk.lv3 textarea.btpm-det { font-size: 10.5px; }
}
.btpm-det-blk.lv2 .btpm-det-mark { font-size: 11px; padding-top: 5px; }
.btpm-det-blk.lv3 .btpm-det-mark { font-size: 11px; padding-top: 5px; }
.btpm-root .btpm-dt.lt { padding: 0 5px; font-size: 10.5px; letter-spacing: .02em; }

/* Volets a, b, c… : fond gris plus clair ; petit X rouge pour fermer chaque volet ou puce */
.btpm-det-box { position: relative; flex: 1; min-width: 0; display: flex; }
.btpm-det-box textarea { flex: 1; min-width: 0; }
.btpm-root .btpm-line .c-des .btpm-det-blk.lv1.m textarea.btpm-det { background: #f1f3f6; }
.btpm-root .btpm-line .c-des .btpm-det-blk .btpm-det-box:has(.btpm-det-x) textarea.btpm-det { padding-right: 22px; }
.btpm-root .btpm-det-x {
    position: absolute; top: 3px; right: 3px; width: 16px; height: 16px; min-height: 0; padding: 0; border: 0; border-radius: 4px;
    background: transparent; color: #dc2626; display: inline-flex; align-items: center; justify-content: center; opacity: .75;
}
.btpm-root .btpm-det-x .ico { width: 11px; height: 11px; stroke-width: 2.6; }
.btpm-root .btpm-det-x:hover { opacity: 1; background: #fee2e2; }
@media (max-width: 640px) {
    .btpm-root .btpm-det-x { width: 15px; height: 15px; top: 2px; right: 2px; }
    .btpm-root .btpm-det-x .ico { width: 10px; height: 10px; }
}
.btpm-det-blk.lv2 .btpm-det-mark { color: #0284c7; }
.btpm-det-blk.lv3 .btpm-det-mark { color: #38bdf8; }

/* Fiche conforme au CCTP : numéros d'articles et titres d'articles parents */
.btpm-lot-num.ref { width: auto; min-width: 30px; padding: 0 7px; font-size: 12.5px; }
.btpm-work-st { padding: 9px 12px 4px; font-size: 13.5px; font-weight: 700; color: #0f4c5c; text-decoration: underline; text-underline-offset: 3px; background: #f7fafc; border-bottom: 1px solid var(--line); }
.btpm-work-st b { text-decoration: none; display: inline-block; margin-right: 4px; }
.btpm-doc-txt { display: inline-block; margin-top: 2px; font-size: 10.5px; font-weight: 600; color: var(--ok); background: #dcfce7; border-radius: 99px; padding: 0 6px; width: max-content; }
.btpm-prog-parts { color: #0e7490; }

/* ---- Question « éléments » : un tableau (fenêtre 1, 2, 3… × largeur, hauteur, matériau) ---- */
.btpm-qa-row.wide { grid-template-columns: minmax(0, 1fr); }
.btpm-qa-row.wide .btpm-qa-q { border-right: 0; border-bottom: 1px dashed var(--line); }
.btpm-qa-row.wide .btpm-qa-a { padding: 10px 14px 12px; }
.btpm-qa-els { display: flex; flex-direction: column; gap: 6px; }
.btpm-qa-el { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 10px; align-items: center; padding: 7px 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.btpm-qa-el-name { position: relative; }
.btpm-root .btpm-qa-el-name input { font-weight: 600; font-size: 13.5px; min-height: 34px; padding: 5px 24px 5px 8px; border-color: transparent; background: #f5f7fa; }
.btpm-root .btpm-qa-el-name input:focus { border-color: var(--line2); background: #fff; }
.btpm-qa-el-name .btpm-det-x { top: 9px; right: 4px; }
.btpm-qa-el-fields { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: flex-end; }
.btpm-qa-elc { display: flex; flex-direction: column; gap: 2px; margin: 0; }
.btpm-qa-elc > small { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.btpm-qa-elc > span { display: inline-flex; align-items: center; gap: 4px; }
.btpm-root .btpm-qa-elc input { min-height: 32px; height: 32px; padding: 4px 8px; font-size: 14px; }
.btpm-root .btpm-qa-elc.nombre input { width: 76px; text-align: right; }
.btpm-root .btpm-qa-elc.texte input { width: 180px; }
.btpm-qa-elc em { font-style: normal; font-size: 12.5px; color: var(--muted); }
.btpm-root .btpm-qa-elc .btpm-qa-opt.sm { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.btpm-root .btpm-qa-elother { width: 96px; }
.btpm-qa-row.wide [data-eladd] { align-self: flex-start; font-size: 13px; padding: 4px 0; }
.btpm-qa-row.wide [data-elnote] { font-size: 13.5px; min-height: 36px; }
@media (max-width: 640px) {
    .btpm-qa-el { grid-template-columns: minmax(0, 1fr); gap: 6px; }
    .btpm-qa-el-fields { gap: 6px 10px; }
    .btpm-root .btpm-qa-elc.nombre input { width: 64px; }
    .btpm-qa-row.wide .btpm-qa-a { padding: 8px 8px 10px; }
}

/* Client trouvé par l'IA dans les documents */
.btpm-root .btpm-f-src { display: flex; align-items: center; gap: 5px; margin: 4px 0 2px; font-size: 11.5px; color: #1a7f4b; line-height: 1.3; }
.btpm-root .btpm-f-src svg { width: 13px; height: 13px; flex: none; }

/* Estimation de la durée d'analyse */
.btpm-root .btpm-estim { flex-basis: 100%; display: flex; align-items: flex-start; gap: 7px; margin: 2px 0 0; font-size: 12.5px; line-height: 1.45; color: #6b7280; }
.btpm-root .btpm-estim .ico { width: 15px; height: 15px; flex: none; margin-top: 2px; }
.btpm-root .btpm-estim.heavy { color: #8a4b08; background: #fff7eb; border: 1px solid #f7d9a8; border-radius: 10px; padding: 9px 12px; }

/* Élément « Ne pas chiffrer » */
.btpm-root .btpm-qa-skip { display: inline-flex; align-items: center; margin-top: 6px; padding: 3px 10px; min-height: 26px; border-radius: 999px; border: 1px dashed #c3cad4; background: #fff; color: #5b6573; font-size: 11.5px; font-weight: 600; cursor: pointer; }
.btpm-root .btpm-qa-skip:hover { border-color: #8d97a5; color: #2f3742; }
.btpm-root .btpm-qa-skip.on { border-style: solid; border-color: #9aa3ae; background: #e9ecf0; color: #3b434e; }
.btpm-root .btpm-qa-el.off { background: #f1f3f5; border-color: #e1e5ea; }
.btpm-root .btpm-qa-el.off .btpm-qa-el-name input { background: #e6e9ed; color: #8a939e; text-decoration: line-through; }
.btpm-root .btpm-qa-el.off .btpm-qa-el-fields { opacity: .38; filter: grayscale(1); pointer-events: none; }

/* Réponses détaillées (ex. « Plans DP : extension 19,84 m², terrasse 21,66 m² ») */
.btpm-root .btpm-qa-opt.long { flex-basis: 100%; text-align: left; display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; padding: 8px 12px; }
.btpm-root .btpm-qa-opt.long b { font-weight: 700; }
.btpm-root .btpm-qa-opt.long span { font-weight: 500; }

/* Question « Ne pas chiffrer » */
.btpm-root .btpm-qa-q .btpm-qa-skip { margin-top: 7px; }
.btpm-root .btpm-qa-skip .ico { width: 13px; height: 13px; margin-right: 4px; }
.btpm-root .btpm-qa-skip.on { border-style: solid; border-color: var(--accent); background: #fff; color: var(--accent); }
.btpm-root .btpm-qa-skip.on:hover { background: var(--accent); color: #fff; }
.btpm-root .btpm-qa-row.off { background: #f1f3f5; }
.btpm-root .btpm-qa-row.off .btpm-qa-q strong { color: #8a939e; text-decoration: line-through; text-decoration-color: #b5bcc5; }
.btpm-root .btpm-qa-row.off .btpm-qa-q small { color: #9aa2ad; }
.btpm-root .btpm-qa-row.off .btpm-qa-n { background: #dfe3e8; color: #6b7480; }
.btpm-root .btpm-qa-row.off .btpm-qa-a { opacity: .35; filter: grayscale(1); pointer-events: none; user-select: none; }
.btpm-root .btpm-qa-offnote { display: block; margin-top: 3px; font-weight: 600; color: #5b6573 !important; }

/* Titres des groupes de questions */
.btpm-root .btpm-qa-theme { display: flex; align-items: baseline; gap: 10px; padding: 14px 16px 8px; background: #eef3f8; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.btpm-root .btpm-qa-table > .btpm-qa-theme:first-child { border-top: 0; }
.btpm-root .btpm-qa-theme span { font-size: 12.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #2f5475; }
.btpm-root .btpm-qa-theme small { font-size: 11.5px; color: #7a8794; }
@media (max-width: 640px) { .btpm-root .btpm-qa-theme { padding: 12px 12px 7px; } }
