/* Agent de devis — sanitaire/chauffage. Clean, precise, Swiss. Light theme. */
:root {
  --paper: #f6f5f2;
  --card: #ffffff;
  --ink: #1b2430;
  --ink-soft: #48586b;
  --ink-faint: #8492a4;
  --line: #e3e2dc;
  --line-strong: #cfd4cf;
  --accent: #0e7c66;        /* verified teal-green */
  --accent-ink: #0a5a4a;
  --accent-wash: #e7f2ee;
  --flag: #b0531d;          /* exception / to-verify */
  --flag-wash: #fbeee2;
  --shadow: 0 1px 2px rgba(27,36,48,.05), 0 8px 24px rgba(27,36,48,.06);
  --mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
  font-size: 16px;
}
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* Header */
.site-header { background: linear-gradient(180deg, #fbfbf9, var(--paper)); border-bottom: 1px solid var(--line); padding: 40px 0 26px; }
.kicker { font-size: 12.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-ink); font-weight: 600; margin-bottom: 12px; }
.site-header h1 { font-size: clamp(1.5rem, 3.4vw, 2.15rem); line-height: 1.15; margin: 0 0 12px; font-weight: 680; letter-spacing: -.01em; max-width: 20ch; }
.lede { margin: 0; max-width: 62ch; color: var(--ink-soft); font-size: 1.02rem; }
.rates { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 20px 0 0; }
.rates li { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 6px 13px; font-size: 13px; color: var(--ink-soft); box-shadow: var(--shadow); }
.rates b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* Guardrail banner */
.guardrail { background: var(--accent-wash); border-bottom: 1px solid #d3e6df; }
.guardrail .wrap { display: flex; gap: 14px; align-items: flex-start; padding-top: 16px; padding-bottom: 16px; }
.guardrail .shield { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 15px; margin-top: 1px; }
.guardrail p { margin: 0; font-size: 14.5px; color: #245043; max-width: 88ch; }
.guardrail strong { color: var(--accent-ink); }
.guardrail em { font-style: normal; font-weight: 600; }

/* Layout grid */
.grid { display: grid; grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr); gap: 22px; padding-top: 28px; padding-bottom: 40px; align-items: start; }
.panel { min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; box-shadow: var(--shadow); }
.step { font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-faint); font-weight: 600; margin-bottom: 14px; }

/* Inputs */
.lbl { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); margin: 14px 0 7px; }
.lbl:first-of-type { margin-top: 0; }
textarea, input[type=text], input[type=number] {
  width: 100%; font-family: var(--sans); font-size: 15px; color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 9px; padding: 10px 12px; background: #fcfcfb;
  resize: vertical;
}
textarea:focus, input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.examples { display: flex; flex-direction: column; gap: 8px; }
.ex-chip { text-align: left; background: #fbfbf9; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; font-family: var(--sans); transition: border-color .12s, background .12s; }
.ex-chip:hover { border-color: var(--accent); background: #fff; }
.ex-chip .ex-title { font-weight: 620; font-size: 14px; }
.ex-chip.crit .ex-title::after { content: "REFUS"; margin-left: 8px; font-size: 10px; letter-spacing: .05em; color: var(--flag); border: 1px solid #e6c3a9; border-radius: 4px; padding: 1px 5px; vertical-align: 1px; }
.ex-chip .ex-sub { font-size: 12.5px; color: var(--ink-faint); margin-top: 2px; }
.ex-chip .ex-req { font-size: 12.5px; color: var(--ink-soft); margin-top: 6px; font-style: italic; }

.controls { display: flex; align-items: flex-end; gap: 12px; margin-top: 14px; }
.hours { flex: 1; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.hours input { margin-top: 7px; }
button.primary { flex: none; background: var(--accent); color: #fff; border: 0; border-radius: 9px; padding: 11px 18px; font-size: 14.5px; font-weight: 620; cursor: pointer; font-family: var(--sans); }
button.primary:hover { background: var(--accent-ink); }
button.primary:disabled { opacity: .55; cursor: default; }

.livebox { margin-top: 16px; border: 1px dashed var(--line-strong); border-radius: 10px; padding: 0 14px; background: #fbfbf9; }
.livebox summary { cursor: pointer; padding: 11px 0; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.livebox p { font-size: 13px; color: var(--ink-soft); margin: 0 0 4px; }
.livebox input { margin-bottom: 14px; max-width: 260px; }

.status { margin-top: 12px; font-size: 13.5px; min-height: 1.2em; }
.status.err { color: var(--flag); }
.status.busy { color: var(--ink-soft); }
.status.ok { color: var(--accent-ink); }

/* Devis */
.devis-empty { color: var(--ink-faint); font-size: 14px; padding: 24px 4px; }
.devis-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.company-ph { border: 1px dashed var(--line-strong); border-radius: 8px; padding: 10px 12px; font-size: 12px; color: var(--ink-faint); background: #fbfbf9; max-width: 240px; }
.company-ph b { display: block; color: var(--ink-soft); font-size: 13px; margin-bottom: 2px; }
.devis-meta { text-align: right; font-size: 12.5px; color: var(--ink-soft); }
.devis-meta .no { font-family: var(--mono); font-weight: 600; color: var(--ink); font-size: 14px; }

.tbl-scroll { min-width: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.lines { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 520px; }
table.lines th { text-align: left; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-faint); font-weight: 600; padding: 0 10px 8px; border-bottom: 1px solid var(--line); }
table.lines td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.lines .num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
table.lines .ref { font-family: var(--mono); font-size: 12.5px; color: var(--accent-ink); white-space: nowrap; }
table.lines .supplier { font-size: 11.5px; color: var(--ink-faint); }
.conf { display: inline-block; margin-left: 6px; font-size: 10.5px; color: var(--accent-ink); background: var(--accent-wash); border-radius: 4px; padding: 1px 5px; vertical-align: 1px; font-variant-numeric: tabular-nums; }

/* Exceptions */
.exceptions { margin-top: 18px; border: 1px solid #ecd6c4; background: var(--flag-wash); border-radius: 11px; padding: 14px 16px; }
.exceptions h3 { margin: 0 0 4px; font-size: 13.5px; color: var(--flag); display: flex; align-items: center; gap: 8px; }
.exceptions h3 .warn { font-size: 15px; }
.exceptions .sub { margin: 0 0 10px; font-size: 12.5px; color: #8a5a3a; }
.exc-item { padding: 9px 0; border-top: 1px dashed #e2c3aa; }
.exc-item:first-of-type { border-top: 0; }
.exc-prod { font-weight: 620; font-size: 14px; }
.exc-prod .qty { color: var(--ink-faint); font-weight: 500; font-size: 12.5px; margin-left: 6px; }
.exc-tag { font-size: 11px; color: var(--flag); border: 1px solid #e6c3a9; border-radius: 4px; padding: 1px 6px; margin-left: 6px; white-space: nowrap; }
.exc-note { font-size: 12.5px; color: #7c5236; margin-top: 4px; }
.exc-naive { font-size: 12px; color: var(--ink-faint); margin-top: 5px; }
.exc-naive .fake { text-decoration: line-through; color: #b98a6a; font-family: var(--mono); }

/* Totals */
.totals { margin-top: 18px; margin-left: auto; max-width: 340px; }
.totals .row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 13.5px; color: var(--ink-soft); }
.totals .row .v { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--ink); }
.totals .row.sub { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 9px; font-weight: 600; color: var(--ink); }
.totals .row.ttc { border-top: 2px solid var(--ink); margin-top: 6px; padding-top: 10px; font-size: 16px; font-weight: 700; color: var(--ink); }
.totals .row.ttc .v { font-size: 17px; }

.actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.ghost { display: inline-block; background: #fff; color: var(--ink); border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px 14px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: var(--sans); text-decoration: none; }
.ghost:hover { border-color: var(--accent); color: var(--accent-ink); }
.copied { font-size: 12.5px; color: var(--accent-ink); align-self: center; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: #fbfbf9; padding: 24px 0 40px; }
.site-footer p { margin: 0 0 8px; font-size: 12px; color: var(--ink-faint); max-width: 90ch; }
.site-footer strong { color: var(--ink-soft); }

@media (max-width: 760px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .site-header { padding-top: 30px; }
  .wrap { padding: 0 18px; }
}

/* Print — a clean devis on paper (fallback if PDF lib absent) */
@media print {
  .site-header, .guardrail, .panel:first-child, .site-footer, .actions, .livebox, .examples, .controls { display: none !important; }
  body { background: #fff; }
  .grid { display: block; padding: 0; }
  .devis-panel { border: 0; box-shadow: none; padding: 0; }
  .step { display: none; }
  .exceptions { border-color: #bbb; background: #f6f6f6; }
}
