/* Portail des devis — charte crème / encre / orange, polices système, sans dépendance. */
:root {
  --cream: #FBFAF7;
  --ink: #15120E;
  --orange: #FF5C28;
  --orange-deep: #E04A18;
  --paper: #FFFFFF;
  --line: rgba(21, 18, 14, 0.12);
  --line-strong: rgba(21, 18, 14, 0.24);
  --muted: rgba(21, 18, 14, 0.62);
  --soft: rgba(255, 92, 40, 0.10);
  --ok: #1F7A4D;
  --ok-soft: rgba(31, 122, 77, 0.10);
  --err: #B3261E;
  --err-soft: rgba(179, 38, 30, 0.10);
  --radius: 16px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2 { font-weight: 600; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 1.6rem; line-height: 1.2; }
h2 { font-size: 1.05rem; }
p { margin: 0; }

.wrap { max-width: 880px; margin: 0 auto; padding: 0 16px; }
.top { border-bottom: 1px solid var(--line); background: var(--cream); }
.top-inner { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 18px 16px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; }
.brand::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--orange); margin-right: 8px; vertical-align: 0; }
.brand-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.86rem; color: var(--muted); }
.brand-meta a { text-decoration: none; }
.brand-meta a:hover { text-decoration: underline; }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin: 20px 0; }
.eyebrow { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--orange-deep); font-weight: 600; margin-bottom: 6px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px 18px; margin: 18px 0 0; }
.facts div { display: flex; flex-direction: column; gap: 2px; }
.facts dt { font-size: 0.78rem; color: var(--muted); }
.facts dd { margin: 0; font-weight: 500; font-variant-numeric: tabular-nums; }
.facts .amount { font-size: 1.35rem; font-weight: 700; }
.tva { margin-top: 14px; font-size: 0.78rem; color: var(--muted); }

.banner { border-radius: 12px; padding: 14px 16px; margin: 16px 0; font-size: 0.95rem; border: 1px solid transparent; }
.banner.ok { background: var(--ok-soft); border-color: rgba(31, 122, 77, 0.3); color: #16583A; }
.banner.muted { background: rgba(21, 18, 14, 0.05); border-color: var(--line); color: var(--ink); }
.banner.err { background: var(--err-soft); border-color: rgba(179, 38, 30, 0.3); color: var(--err); }

.pdf-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.pdf-frame { display: block; width: 100%; height: 70vh; min-height: 420px; border: 1px solid var(--line); border-radius: 10px; background: #F1EFEA; }
.hint { font-size: 0.8rem; color: var(--muted); margin-top: 10px; }

.decide .lead { color: var(--muted); margin: 6px 0 18px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; font-weight: 500; }
.field em { font-style: normal; font-weight: 400; color: var(--muted); }
.field input, .field textarea {
  font: inherit; color: inherit; background: var(--cream); border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px; width: 100%;
}
.field input:focus, .field textarea:focus { outline: 2px solid var(--orange); outline-offset: 1px; border-color: transparent; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 0.95rem; }
.check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--orange); flex-shrink: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border-radius: 999px; font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; border: 1px solid var(--line-strong); background: var(--paper); color: var(--ink); transition: background 0.15s, transform 0.05s;
}
.btn:hover { background: var(--cream); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--orange); border-color: var(--orange); color: #fff; align-self: flex-start; }
.btn.primary:hover { background: var(--orange-deep); border-color: var(--orange-deep); }
.btn.ghost { background: transparent; }
.btn:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

.refuse { margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--line-strong); }
.refuse summary { cursor: pointer; color: var(--muted); font-size: 0.92rem; }
.refuse summary:hover { color: var(--ink); }
.refuse .form { margin-top: 14px; }
.refuse .btn { align-self: flex-start; }

.foot { padding: 10px 4px 40px; font-size: 0.82rem; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.foot a { text-decoration: none; }
.foot a:hover { text-decoration: underline; }
.state h1 { margin-bottom: 8px; }

@media (max-width: 560px) {
  .card { padding: 18px 16px; margin: 14px 0; }
  h1 { font-size: 1.35rem; }
  .pdf-frame { height: 60vh; }
  .btn { width: 100%; }
  .btn.primary, .refuse .btn { align-self: stretch; }
}
@media print {
  .top, .decide, .foot .hint, .pdf-bar .btn { display: none; }
  .card { border: none; }
}

/* ---------- Rapport d'audit express (/a/<jeton>) ---------- */
.report .head .meta { color: var(--muted); font-size: 0.9rem; margin-top: 6px; word-break: break-all; }
.report .head .meta a { text-decoration: none; border-bottom: 1px solid var(--line-strong); }
.report h2 { font-size: 1.2rem; margin-bottom: 14px; }
.report .lead { color: var(--muted); margin: -6px 0 16px; font-size: 0.92rem; }
.score-row { display: flex; align-items: center; gap: 26px; margin-top: 20px; }
.gauge { flex-shrink: 0; }
.gauge-bg { stroke: rgba(21, 18, 14, 0.08); }
.gauge-val { stroke: var(--muted); transition: stroke-dasharray 0.6s ease; }
.gauge.tone-good .gauge-val { stroke: var(--ok); }
.gauge.tone-mid .gauge-val { stroke: var(--orange); }
.gauge.tone-bad .gauge-val { stroke: var(--err); }
.gauge-num { font-size: 40px; font-weight: 700; fill: var(--ink); letter-spacing: -0.03em; }
.gauge.tone-good .gauge-num { fill: var(--ok); }
.gauge.tone-mid .gauge-num { fill: var(--orange-deep); }
.gauge.tone-bad .gauge-num { fill: var(--err); }
.gauge-sub { font-size: 12px; fill: var(--muted); }
.verdict { font-size: 1.35rem; font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; }
.verdict-box .hint { margin-top: 10px; }

.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.sum { position: relative; border-radius: 12px; padding: 16px 16px 16px 18px; background: var(--cream); border: 1px solid var(--line); border-left-width: 4px; font-weight: 500; line-height: 1.35; }
.sum .num { display: block; font-size: 0.72rem; color: var(--muted); font-weight: 600; margin-bottom: 8px; letter-spacing: 0.08em; }
.sum.sev-high { border-left-color: var(--err); }
.sum.sev-medium { border-left-color: var(--orange); }
.sum.sev-low { border-left-color: var(--line-strong); }
.sum.sev-ok { border-left-color: var(--ok); }

.findings { display: flex; flex-direction: column; gap: 12px; }
.finding { border-radius: 12px; padding: 16px 18px; border: 1px solid var(--line); background: var(--paper); }
.finding h3 { margin: 0; font-size: 1rem; font-weight: 600; line-height: 1.3; padding-left: 16px; position: relative; }
.finding h3::before { content: ""; position: absolute; left: 0; top: 0.45em; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.finding.sev-high { background: var(--err-soft); border-color: rgba(179, 38, 30, 0.25); }
.finding.sev-high h3::before { background: var(--err); }
.finding.sev-medium { background: var(--soft); border-color: rgba(255, 92, 40, 0.3); }
.finding.sev-medium h3::before { background: var(--orange); }
.finding.sev-low h3::before { background: var(--line-strong); }
.finding .detail { margin: 4px 0 0 16px; font-size: 0.86rem; color: var(--muted); }
.finding .why, .finding .fix { margin: 12px 0 0 16px; font-size: 0.93rem; }
.finding .k { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; color: var(--muted); margin-bottom: 3px; }
.finding .fix .k { color: var(--ok); }
.finding .fix p { padding-left: 10px; border-left: 2px solid var(--ok); }

.good { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px 16px; }
.good li { position: relative; padding-left: 26px; font-size: 0.93rem; color: var(--ink); }
.good li::before { content: "✓"; position: absolute; left: 0; top: 0; width: 18px; height: 18px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }

.psi { display: flex; gap: 24px; align-items: flex-start; }
.bars { flex: 1; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.bar-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.92rem; font-weight: 500; margin-bottom: 5px; }
.bar-head strong { font-variant-numeric: tabular-nums; }
.bar-head .tone-good { color: var(--ok); }
.bar-head .tone-mid { color: var(--orange-deep); }
.bar-head .tone-bad { color: var(--err); }
.bar-head .tone-none { color: var(--muted); }
.bar { display: block; }
.bar-bg { fill: rgba(21, 18, 14, 0.08); }
.bar-val { fill: var(--muted); }
.bar.tone-good .bar-val { fill: var(--ok); }
.bar.tone-mid .bar-val { fill: var(--orange); }
.bar.tone-bad .bar-val { fill: var(--err); }
.bar.tone-none .bar-val { fill: transparent; }
.why-line { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }
.shot { margin: 0; flex-shrink: 0; width: 150px; text-align: center; }
.shot img { display: block; width: 150px; border-radius: 14px; border: 1px solid var(--line-strong); background: #F1EFEA; }
.shot figcaption { font-size: 0.75rem; color: var(--muted); margin-top: 6px; }

.report .facts { margin-top: 0; }

.cta { background: var(--ink); color: var(--cream); border-radius: var(--radius); padding: 30px 28px; margin: 28px 0 14px; }
.cta .eyebrow.light { color: var(--orange); }
.cta h2 { color: #fff; font-size: 1.45rem; margin-bottom: 14px; }
.cta-points { margin: 0 0 22px; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.cta-points li { position: relative; padding-left: 22px; font-size: 0.93rem; color: rgba(251, 250, 247, 0.85); line-height: 1.4; }
.cta-points li::before { content: ""; position: absolute; left: 0; top: 7px; width: 10px; height: 10px; border-radius: 3px; background: var(--orange); }
.cta-form .field { color: rgba(251, 250, 247, 0.9); }
.cta-form .field em { color: rgba(251, 250, 247, 0.55); }
.cta-form .field input, .cta-form .field textarea { background: rgba(255, 255, 255, 0.06); border-color: rgba(251, 250, 247, 0.25); color: #fff; }
.cta-form .field input::placeholder { color: rgba(251, 250, 247, 0.4); }
.cta-form .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cta .btn.primary.big { padding: 14px 26px; font-size: 1.02rem; }
.cta .hint.light { color: rgba(251, 250, 247, 0.55); margin-top: 0; }
.cta .banner.ok { background: rgba(31, 122, 77, 0.25); border-color: rgba(31, 122, 77, 0.5); color: #DDF5E7; }
.cta .banner.muted { background: rgba(251, 250, 247, 0.08); border-color: rgba(251, 250, 247, 0.2); color: var(--cream); }
.hp { position: absolute; left: -9999px; top: -9999px; width: 1px; height: 1px; overflow: hidden; }
.direct { text-align: center; font-size: 0.95rem; color: var(--muted); margin-bottom: 10px; }
.direct a { color: var(--ink); font-weight: 600; text-decoration: none; border-bottom: 1px solid var(--line-strong); }

@media (max-width: 680px) {
  .summary, .cta-points, .cta-form .grid2 { grid-template-columns: 1fr; }
  .score-row { flex-direction: column; align-items: flex-start; gap: 14px; }
  .gauge { width: 120px; height: 120px; }
  .verdict { font-size: 1.2rem; }
  .psi { flex-direction: column; }
  .shot { width: 100%; }
  .shot img { margin: 0 auto; }
  .cta { padding: 22px 18px; }
}
@media print {
  body.report { background: #fff; }
  .cta-form, .direct, .report .head .meta a { display: none; }
  .cta { background: #fff; color: var(--ink); border: 1px solid #ccc; }
  .cta h2, .cta-points li { color: var(--ink); }
  .finding, .sum { break-inside: avoid; }
}
