:root {
  --accent: #e0673a;
  --accent-soft: #fbe6dc;
  --teal: #1f6b6b;
  --bg: #f6f7fb;
  --panel: #ffffff;
  --text: #22262e;
  --muted: #6b7280;
  --line: #e5e7eb;
  --green: #2e9d5b;
  --green-soft: #d9f0e2;
  --red: #d64545;
  --red-soft: #fbdede;
  --yellow: #f4c94a;
  --blue: #4aa3e8;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* Couleur de l'app pour les cases à cocher et curseurs ; dates alignées comme les autres champs (iOS les centre en bleu). */
:root { accent-color: var(--teal); }
input[type=date] { color: var(--text); text-align: left; }
input[type=date]::-webkit-date-and-time-value { text-align: left; }
.history { padding-left: 0; list-style: none; }
/*
 * Mise en page : c'est la page entière qui défile (et non une zone intérieure), pour que Safari sur
 * iPhone replie sa barre d'adresse. Les marges env(safe-area-inset-*) évitent l'encoche, la Dynamic Island
 * et la barre d'accueil (iPhone, iPad, et app installée sur l'écran d'accueil).
 */
:root { --topbar-h: 52px; --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px); }
/* Fond orange derrière la page : la zone de la barre d'état (app installée sur iPhone) prend la couleur de l'app. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--accent); }
html, body { margin: 0; }
body { font-family: Inter, system-ui, sans-serif; font-size: 14px; color: var(--text); background: var(--bg);
  min-height: 100vh; min-height: 100dvh; -webkit-tap-highlight-color: rgba(0,0,0,.05);
  display: grid; grid-template-columns: calc(250px + var(--safe-l)) minmax(0, 1fr); grid-template-rows: auto 1fr; grid-template-areas: "top top" "nav main"; }
body.nav-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
.ms { font-family: 'Material Symbols Outlined'; font-size: 20px; line-height: 1; vertical-align: middle; }

.topbar { grid-area: top; background: var(--accent); color: #fff; display: flex; align-items: center; gap: 12px;
  position: sticky; top: 0; z-index: 16; min-height: calc(var(--topbar-h) + var(--safe-t));
  padding: var(--safe-t) calc(16px + var(--safe-r)) 0 calc(16px + var(--safe-l)); }
.brand { font-weight: 700; font-size: 16px; display: flex; gap: 8px; align-items: center; }
.topbar-spacer { flex: 1; }
.icon-btn { background: none; border: 0; color: inherit; cursor: pointer; padding: 6px; border-radius: 8px; }
@media (hover: hover) { .icon-btn:hover { background: rgba(0,0,0,.08); } }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #9b59b6; display: grid; place-items: center; font-weight: 600; }

.sidebar { grid-area: nav; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column;
  padding: 10px 8px calc(10px + var(--safe-b)) calc(8px + var(--safe-l)); overflow: hidden;
  position: sticky; top: calc(var(--topbar-h) + var(--safe-t)); align-self: start;
  height: calc(100vh - var(--topbar-h) - var(--safe-t)); height: calc(100dvh - var(--topbar-h) - var(--safe-t)); overscroll-behavior: contain; }
.sidebar a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--text); text-decoration: none; white-space: nowrap; }
.sidebar a:hover { background: var(--bg); }
.sidebar a.active { background: #e3ebf6; font-weight: 600; }
.sidebar-spacer { flex: 1; }
.sidebar { overflow-y: auto; }
.nav-group { display: flex; align-items: center; gap: 10px; padding: 12px 12px 4px; font-weight: 600; white-space: nowrap; }
.sidebar a.sub { padding: 6px 12px 6px 42px; font-size: 13px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tabs::-webkit-scrollbar { display: none; }
.filters-box { margin-bottom: 12px; }
.filters-box > summary { cursor: pointer; padding: 12px 16px; font-weight: 600; display: flex; gap: 8px; align-items: center; list-style: none; }
.filters-box > summary::-webkit-details-marker { display: none; }
.filters-box[open] > summary { border-bottom: 1px solid var(--line); }
.tabs a { flex: 0 0 auto; white-space: nowrap; padding: 10px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; display: flex; gap: 6px; align-items: center; }
.tabs a.active { color: var(--text); border-color: var(--accent); font-weight: 600; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.filters label { min-width: 110px; }
.slider-row { display: flex; align-items: center; gap: 10px; }
.history li { padding: 4px 0; }

.view { grid-area: main; min-width: 0; padding: 16px calc(16px + var(--safe-r)) calc(24px + var(--safe-b)) 16px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }
h1 { font-size: 20px; margin: 0 0 14px; }
h2 { font-size: 16px; margin: 0; }
h3 { font-size: 14px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.btn { border: 1px solid var(--line); background: var(--panel); color: var(--text); text-decoration: none; border-radius: 999px; padding: 7px 14px; cursor: pointer; font: inherit; display: inline-flex; gap: 6px; align-items: center; justify-content: center; -webkit-appearance: none; appearance: none; }
.btn:disabled { opacity: .45; cursor: default; }
/* Boutons d'envoi de fichier : le vrai champ reste présent (Safari iOS n'ouvre pas un champ masqué) mais invisible. */
label.file-btn { flex-direction: row; font-size: 14px; color: var(--text); position: relative; overflow: hidden; }
.sr-file { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; font-size: 0; }
@media (hover: hover) { .btn:hover { border-color: var(--accent); } }
.btn.primary { background: var(--teal); color: #fff; border-color: var(--teal); }
.btn.outline { color: var(--accent); border-color: var(--accent); }
input, select, textarea { font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
/* Les champs prennent toute la largeur de leur colonne (iOS donne sinon une largeur fixe aux dates). */
label > input:not([type=checkbox]):not([type=radio]):not([type=range]), label > select, label > textarea { width: 100%; min-width: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #f9fafc; border-radius: var(--radius) var(--radius) 0 0; }
.panel-body { padding: 14px 16px; }

/* Tableau de bord */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { overflow: hidden; }
.kpi-head { color: #fff; text-align: center; padding: 12px; font-weight: 600; }
.kpi-row { display: flex; }
.kpi-row div { flex: 1; text-align: center; padding: 10px 4px; border-right: 1px solid var(--line); }
.kpi-row div:last-child { border-right: 0; }
.kpi-row b { display: block; font-size: 18px; }
.kpi-foot { text-align: center; font-size: 11px; color: var(--muted); padding-bottom: 8px; }
.two-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; }
.list-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); gap: 8px; }
.list-row:last-child { border-bottom: 0; }
.panel.list-row { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

/* Cartes biens */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.card-head { padding: 8px 10px; display: flex; justify-content: space-between; gap: 6px; }
.card-head .addr { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-img { height: 130px; position: relative; display: grid; place-items: center; color: #fff; font-size: 40px; }
.badge { position: absolute; font-size: 11px; padding: 2px 8px; border-radius: 4px; color: #fff; font-weight: 600; }
.badge.status { top: 8px; right: 8px; background: var(--green); }
.badge.drop { top: 8px; left: 8px; background: var(--accent); }
.badge.excl { bottom: 8px; left: 8px; background: var(--teal); }
.card-body { padding: 8px 10px; display: flex; justify-content: space-between; align-items: center; }
.chips { display: flex; gap: 4px; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; font-size: 12px; }
.price { text-align: right; }
.price b { display: block; }
.card-foot { padding: 8px 10px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; margin-top: auto; }

/* Kanban prospection */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 10px; overflow-x: auto; align-items: start; }
.col { background: #eceef3; border-radius: var(--radius); min-height: 300px; padding: 8px; }
.col-head { font-weight: 600; padding: 4px 6px 10px; display: flex; justify-content: space-between; }
.col.drag-over { outline: 2px dashed var(--accent); }
.pcard { background: #fff; border-radius: 8px; padding: 10px; margin-bottom: 8px; box-shadow: var(--shadow); cursor: grab; }
.pcard .t { font-weight: 600; }

/* Estimation */
.est-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
.gauge { position: relative; height: 10px; border-radius: 5px; background: linear-gradient(90deg, #2e9d5b, #f4c94a, #d64545); margin: 22px 0 6px; }
.gauge .mark { position: absolute; top: -6px; width: 2px; height: 22px; background: var(--text); }
.gauge-labels { display: flex; justify-content: space-between; font-size: 11px; text-align: center; }
.impacts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.impact-box { border-radius: 8px; padding: 10px 12px; min-height: 90px; }
.impact-box.pos { background: var(--green-soft); }
.impact-box.neg { background: var(--red-soft); }
.impact-box .r { display: flex; justify-content: space-between; font-size: 13px; padding: 2px 0; }
.dots span { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #ccc; margin-right: 3px; }
.dots span.on { background: var(--accent); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); font-size: 13px; }
th { color: var(--muted); font-weight: 500; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: grid; place-items: center; z-index: 30; padding: var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l); }
.modal[hidden] { display: none; }
.modal-card { background: #fff; border-radius: 12px; width: min(720px, calc(100vw - 32px)); max-height: 90vh; max-height: calc(100dvh - 32px - var(--safe-t) - var(--safe-b)); overflow: auto; overscroll-behavior: contain; padding: 16px 20px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }

/* ---------- Connexion, synchro, carte ---------- */
.login { position: fixed; inset: 0; background: var(--bg); display: grid; place-items: center; z-index: 40; }
.login[hidden] { display: none; }
.login-card { background: #fff; padding: 28px; border-radius: 14px; box-shadow: var(--shadow); width: min(340px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 14px; }
.sync-status { font-size: 12px; opacity: .85; }
.sync-status[data-s="error"], .sync-status[data-s="offline"] { background: rgba(0,0,0,.2); padding: 2px 8px; border-radius: 999px; }
.map-wrap { margin: 10px 0; }
.map { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); z-index: 0; }
.map-legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 6px; flex-wrap: wrap; }
.map-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 7px 12px; cursor: pointer; font: inherit; display: flex; gap: 4px; align-items: center; }
.seg button.on { background: var(--teal); color: #fff; }
.warn { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; margin: 2px 4px 2px 0; }
.warn.red { background: var(--red-soft); color: var(--red); }
.warn.orange { background: #fdebd3; color: #b26a00; }
.late { color: var(--red); font-weight: 600; }
.ai-btn { font-size: 12px; padding: 3px 10px; margin-left: 6px; }
.share-box { background: #f9fafc; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }

/* ---------- Éditeur d'étude ---------- */
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.thumbs figure { margin: 0; position: relative; }
.thumbs img { width: 110px; height: 80px; object-fit: cover; border-radius: 6px; display: block; }
.thumbs button { position: absolute; top: 2px; right: 2px; background: rgba(0,0,0,.6); color: #fff; border: 0; border-radius: 50%; width: 22px; height: 22px; cursor: pointer; }
.thumbs figure:first-child img { outline: 3px solid var(--accent); }
.profile-photo { width: 90px; height: 90px; border-radius: 50%; object-fit: cover; background: #eee; }

/* ---------- Rapport d'avis de valeur (A4) ---------- */
.report { --r-primary: #E0673A; --r-secondary: #1F2A44; display: flex; flex-direction: column; align-items: center; gap: 20px; color: #222; }
.r-page { width: 210mm; min-height: 297mm; background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.15); position: relative; display: flex; flex-direction: column; overflow: hidden; }
.r-header { display: flex; justify-content: space-between; align-items: center; padding: 10mm 14mm 4mm; border-bottom: 3px solid var(--r-primary); color: var(--r-secondary); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: .08em; }
.r-header img { height: 26px; }
.r-content { padding: 8mm 14mm; flex: 1; font-size: 12.5px; line-height: 1.55; }
.r-content h2 { color: var(--r-primary); font-size: 20px; margin: 4mm 0 4mm; }
.r-content h3 { color: var(--r-secondary); font-size: 14px; margin: 5mm 0 2mm; }
.r-footer { display: flex; justify-content: space-between; padding: 4mm 14mm 8mm; font-size: 10px; color: #888; border-top: 1px solid #eee; }
.r-muted { color: #888; }
.r-cover { background: var(--r-secondary); color: #fff; }
.r-cover-top { padding: 14mm 14mm 0; }
.r-logo { height: 46px; background: #fff; padding: 6px 10px; border-radius: 6px; }
.r-logo-text { font-size: 28px; font-weight: 800; color: var(--r-primary); letter-spacing: .05em; }
.r-cover-title { padding: 14mm; }
.r-kicker { display: inline-block; background: var(--r-primary); padding: 4px 12px; border-radius: 4px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; font-size: 12px; }
.r-cover-title h1 { font-size: 32px; margin: 6mm 0 2mm; line-height: 1.15; }
.r-cover-title p { margin: 1mm 0; opacity: .9; font-size: 15px; }
.r-date { opacity: .7 !important; font-size: 13px !important; }
.r-cover-photo { flex: 1; min-height: 100mm; background: #445 center/cover no-repeat; display: grid; place-items: center; color: #ccd; border-top: 6px solid var(--r-primary); border-bottom: 6px solid var(--r-primary); }
.r-cover-agent { display: flex; gap: 6mm; align-items: center; padding: 10mm 14mm; font-size: 13px; line-height: 1.5; }
.r-cover-agent img, .r-avatar { width: 26mm; height: 26mm; border-radius: 50%; object-fit: cover; border: 3px solid var(--r-primary); }
.r-avatar { display: grid; place-items: center; background: var(--r-primary); font-size: 36px; font-weight: 700; }
.r-agent { display: flex; gap: 8mm; align-items: center; margin-bottom: 4mm; }
.r-agent img { width: 40mm; height: 40mm; border-radius: 50%; object-fit: cover; border: 4px solid var(--r-primary); }
.r-agent h3 { font-size: 18px; margin: 0; }
.r-steps li { margin-bottom: 2mm; }
.r-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3mm; margin-bottom: 4mm; }
.r-photos img { width: 100%; height: 38mm; object-fit: cover; border-radius: 4px; }
.r-table { width: 100%; border-collapse: collapse; }
.r-table th, .r-table td { padding: 2mm 3mm; border-bottom: 1px solid #eee; font-size: 12px; }
.r-table th { color: #666; font-weight: 500; width: 45%; }
.r-grid th { width: auto; background: #f6f6f8; }
.r-two { display: grid; grid-template-columns: 1fr 1fr; gap: 5mm; margin-top: 4mm; }
.r-box { border-radius: 6px; padding: 3mm 5mm; }
.r-box h3 { margin-top: 1mm; }
.r-box ul { margin: 0; padding-left: 5mm; }
.r-pos { background: #e3f3e9; }
.r-neg { background: #fbe4e4; }
.r-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(38mm, 1fr)); gap: 4mm; margin: 4mm 0; }
.r-kpis div { border: 1px solid #eee; border-radius: 6px; padding: 4mm; text-align: center; }
.r-kpis b { display: block; font-size: 17px; color: var(--r-secondary); }
.r-kpis span { font-size: 11px; color: #777; }
.r-kpis .r-accent { background: var(--r-primary); border-color: var(--r-primary); }
.r-kpis .r-accent b, .r-kpis .r-accent span { color: #fff; }
.r-value { text-align: center; background: #f6f6f8; border-radius: 8px; padding: 6mm; display: flex; flex-direction: column; gap: 1mm; }
.r-value b { font-size: 26px; color: var(--r-primary); }
.r-value span { color: #666; }
.r-gauge { height: 8px; border-radius: 4px; background: linear-gradient(90deg, #2e9d5b, #f4c94a, #d64545); position: relative; margin: 8mm 0 2mm; }
.r-gauge div { position: absolute; top: -6px; width: 4px; height: 20px; background: var(--r-secondary); border-radius: 2px; }
.r-gauge-l { display: flex; justify-content: space-between; font-size: 11px; color: #777; }
.r-sign { margin: 12mm 0; text-align: right; }
.r-legal { font-size: 10px; color: #888; margin-top: 20mm; border-top: 1px solid #eee; padding-top: 3mm; }
.r-proof { display: flex; flex-wrap: wrap; gap: 2mm; margin-top: 2mm; }
.r-proof span { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.35); border-radius: 20px; padding: 1px 9px; font-size: 11.5px; font-weight: 600; }
.r-dots { display: inline-block; min-width: 60mm; border-bottom: 1px dotted #aaa; height: 1em; }
.r-status span { margin-right: 6mm; color: #888; }
.r-status span.on { color: var(--r-primary); font-weight: 700; }
.r-list { padding-left: 5mm; }
.r-list li { margin-bottom: 1.5mm; }
.r-quote { font-style: italic; color: #444; border-left: 3px solid var(--r-primary); padding-left: 4mm; margin: 2mm 0; }
.r-rates { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4mm; margin: 4mm 0; }
.r-rate { border: 1px solid #eee; border-radius: 6px; padding: 3mm 4mm; display: flex; flex-direction: column; gap: 1mm; text-align: center; }
.r-rate b { font-size: 20px; color: var(--r-secondary); }
.r-rate span { font-weight: 600; color: #555; }
.r-rate small { color: #888; font-size: 10.5px; }
.r-rate.ok { background: #e3f3e9; border-color: #bfe3cc; }
.r-rate.ko { background: #fbe4e4; border-color: #f2c4c4; }
.r-rate.ko b { color: #c23b3b; }
.r-strats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4mm; margin: 4mm 0; }
.r-strat { border: 1px solid #e5e5ea; border-radius: 8px; padding: 4mm; display: flex; flex-direction: column; gap: 1.5mm; }
.r-strat > b { font-size: 17px; color: var(--r-secondary); }
.r-strat > span { color: #777; font-size: 11.5px; }
.r-strat small { color: #666; font-size: 11px; }
.r-strat ul { margin: 1mm 0 0; padding-left: 4mm; font-size: 11.5px; }
.r-strat-price { font-size: 19px; font-weight: 700; color: var(--r-primary); margin: 1mm 0; }
.r-strat.rec { border: 2px solid var(--r-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--r-primary) 15%, transparent); }
.r-strat.rec > small:first-child { color: var(--r-primary); font-weight: 700; }

/* ---------- Mode Présenter (plein écran) ---------- */
.present { position: fixed; inset: 0; z-index: 100; background: #1b1d24; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l); }
.present-stage { flex: 1; min-height: 0; display: grid; place-items: center; width: 100%; overflow: hidden; gap: 0; touch-action: pan-y; }
.present-stage .r-page { box-shadow: 0 6px 30px rgba(0,0,0,.5); }
.present-bar { display: flex; align-items: center; gap: 12px; padding: 8px 12px 12px; color: #fff; }
.present-bar .icon-btn { color: #fff; background: rgba(255,255,255,.12); width: 44px; height: 44px; }
.present-count { min-width: 60px; text-align: center; font-variant-numeric: tabular-nums; }
/* iPad / iPhone : Safari affiche sa propre croix en haut à gauche en plein écran. */
@media (pointer: coarse) { .present { padding-top: calc(var(--safe-t) + 52px); } }

/* ---------- Point de performance (saisie) ---------- */
.perf-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 12px; align-items: start; }
.perf-side { position: sticky; top: calc(var(--topbar-h) + var(--safe-t) + 12px); display: flex; flex-direction: column; gap: 12px; }
.perf-sec { margin-bottom: 12px; }
.perf-sec > summary { cursor: pointer; padding: 12px 16px; font-weight: 600; font-size: 15px; list-style: none; display: flex; gap: 8px; align-items: center; }
.perf-sec > summary::-webkit-details-marker { display: none; }
.perf-sec > summary::after { content: 'expand_more'; font-family: 'Material Symbols Outlined'; margin-left: auto; transition: transform .2s; }
.perf-sec[open] > summary::after { transform: rotate(180deg); }
.perf-sec > .panel-body { border-top: 1px solid var(--line); }
.perf-rows { display: flex; flex-direction: column; gap: 10px; }
.perf-row { border: 1px solid var(--line); border-radius: 8px; padding: 36px 10px 10px; position: relative; }
.perf-row .del { position: absolute; top: 6px; right: 6px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.checks label { flex-direction: row; align-items: center; gap: 6px; color: inherit; font-size: 13px; }
.sum-line { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; font-size: 13px; border-bottom: 1px dashed var(--line); }
.sum-line b.ko { color: var(--red); }
.sum-line b.ok { color: #2e9d5b; }
.issues { margin: 0; padding-left: 18px; }
.issues li { margin-bottom: 6px; }
.issues b { color: var(--muted, #666); font-weight: 600; }
.hint { font-size: 12px; color: var(--muted, #777); }
@media (max-width: 1000px) { .perf-layout { grid-template-columns: minmax(0, 1fr); } .perf-side { position: static; } }

@media print {
  /* Marges de 10 mm et contenu à 90 % : tient sur une page A4 dans Chrome comme dans Safari (iPhone, iPad, Mac),
     qui impose ses propres marges et en-têtes. */
  @page { size: A4; margin: 10mm; }
  .r-hint { display: none !important; }
  body { display: block; background: #fff; }
  .topbar, .sidebar, .no-print, .modal, .present { display: none !important; }
  .view { padding: 0; overflow: visible; }
  html, body { height: auto !important; min-height: 0 !important; background: #fff !important; }
  .report { gap: 0; zoom: 1 !important; }
  .r-page { box-shadow: none; page-break-after: always; break-after: page; break-inside: avoid; min-height: 297mm; height: 297mm; zoom: .9; margin: 0 auto; overflow: hidden; }
  .r-page:last-child { page-break-after: avoid; break-after: avoid; height: 280mm; min-height: 280mm; }
  .public-main, .view { padding: 0 !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (max-width: 800px), (pointer: coarse) and (max-height: 500px) {
  body, body.nav-collapsed { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "main"; }
  /* En tiroir, le menu sort de la grille : sinon WebKit (Safari iOS) l'aligne en haut de sa zone de grille et ignore « top ». */
  .sidebar { grid-area: auto; align-self: auto; position: fixed; top: var(--drawer-top, calc(var(--topbar-h) + var(--safe-t))); bottom: 0; left: 0; height: auto;
    width: calc(260px + var(--safe-l)); z-index: 15; transform: translateX(-105%); transition: transform .2s; box-shadow: 4px 0 20px rgba(0,0,0,.15); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(0,0,0,.25); z-index: 14; }
  .view { padding: 12px calc(12px + var(--safe-r)) calc(24px + var(--safe-b)) calc(12px + var(--safe-l)); }
  .est-grid, .impacts { grid-template-columns: 1fr; }
  .brand { font-size: 17px; }
  .filters { display: grid; grid-template-columns: 1fr 1fr; }
  .filters label { min-width: 0; }
  .filters input:not([type=checkbox]), .filters select { width: 100%; }
  .filters label:first-child { grid-column: 1 / -1; }
  .toolbar > h1 { flex-basis: 100%; }
  .kpis.compact { grid-template-columns: 1fr 1fr; }
  .kanban { grid-auto-columns: 82%; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; padding-bottom: 6px; }
  .col { scroll-snap-align: start; }
  h1 { font-size: 19px; }
}
/* Tableaux larges : défilement horizontal sur téléphone et iPad en portrait. */
@media (max-width: 1100px) {
  .panel > table, .share-box > table, .panel-body > table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
}
/* Estimation : sur iPad portrait, les trois indicateurs passent sous le prix, sur une ligne ; sur iPhone, en colonne. */
@media (max-width: 1100px) {
  .est-grid { grid-template-columns: 1fr; }
  .est-grid > div:last-child { grid-template-columns: repeat(3, 1fr); }
  .est-grid > div:last-child > .list-row { flex-direction: column; align-items: flex-start; justify-content: center; gap: 6px; }
}
@media (max-width: 600px) {
  /* Formulaires : deux colonnes égales (sinon un champ « sur deux colonnes » crée une colonne minuscule). */
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid > [style*="span 3"] { grid-column: 1 / -1 !important; }
  .est-grid > div:last-child { grid-template-columns: 1fr; }
  .est-grid > div:last-child > .list-row { flex-direction: row; align-items: center; justify-content: space-between; }
}
/* Écrans tactiles (iPhone, iPad) : champs en 16 px (sinon Safari zoome à chaque saisie), zones de toucher ≥ 44 px. */
@media (pointer: coarse) {
  input, select, textarea { font-size: 16px; }
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]), select { min-height: 44px; }
  input[type=checkbox] { width: 22px; height: 22px; }
  input[type=date] { -webkit-appearance: none; appearance: none; background: #fff; }
  .icon-btn { min-width: 44px; min-height: 44px; display: inline-grid; place-items: center; }
  .btn { min-height: 44px; }
  .sidebar a { padding-top: 11px; padding-bottom: 11px; }
  .sidebar a.sub { padding-top: 10px; padding-bottom: 10px; }
  .seg button { min-height: 42px; }
  .chip { padding: 4px 10px; }
  .thumbs button { width: 32px; height: 32px; font-size: 18px; }
}
