:root { --ink: #1f2a33; --muted: #5d6b76; --line: #d8dee3; --bg: #f5f7f8; --card: #fff; --accent: #b4441f; --ok: #2f6b3a; --warn: #8a5a00; --error: #a3261b; }
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--accent); }
.top { display: flex; align-items: center; gap: 12px; padding: 10px 20px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; }
.brand { font-weight: 700; font-size: 16px; color: var(--ink); text-decoration: none; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 10px; background: #fbe9e2; color: var(--accent); font-weight: 600; }
.spacer { flex: 1; }
.who { color: var(--muted); }
main { max-width: 1280px; margin: 0 auto; padding: 16px 20px 40px; }
h1 { font-size: 22px; margin: 6px 0 10px; } h1 small { font-size: 14px; color: var(--muted); font-weight: 400; }
h2 { font-size: 16px; margin: 18px 0 8px; } h3 { font-size: 14px; margin: 16px 0 6px; }
button { font: inherit; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; }
button.secondary { background: var(--card); color: var(--accent); }
button:disabled { opacity: .5; cursor: not-allowed; }
input, select { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; min-width: 0; }
label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--muted); }
.auth { max-width: 380px; margin: 40px auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 20px 24px; }
.auth form { display: flex; flex-direction: column; gap: 12px; }
.notice { max-width: 1280px; margin: 10px auto 0; padding: 8px 14px; border-radius: 6px; background: #e9eef2; }
.notice.ok { background: #e3f1e5; color: var(--ok); } .notice.warn { background: #fdf1dc; color: var(--warn); } .notice.error { background: #fbe4e1; color: var(--error); }
form.inline { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
form.inline label { flex: 1 1 180px; }
table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #fafbfc; }
td.n, th.n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); font-style: italic; }
.crumbs { margin: 0; color: var(--muted); }
.plan-line { margin-bottom: 8px; }
.state { padding: 8px 12px; border-radius: 6px; border-left: 4px solid var(--muted); background: var(--card); }
.state.ok { border-color: var(--ok); } .state.warn { border-color: var(--warn); background: #fffaf0; } .state.info { border-color: #5b7fa3; }
.columns { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 20px; align-items: start; }
.history { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 4px 12px 12px; }
.history-list { list-style: none; margin: 0; padding: 0; }
.history-list li { padding: 6px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; }
.history-list li span { font-size: 12px; color: var(--muted); }
.history-list li.current a { font-weight: 700; color: var(--ink); }
.detail { min-width: 0; overflow-x: auto; }
.meta { color: var(--muted); font-size: 12px; }
.totals { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 10px 0; }
.totals div { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; }
.totals span { font-size: 12px; color: var(--muted); } .totals b { font-size: 16px; }
.warnings { background: #fffaf0; border: 1px solid #f0dcb4; border-radius: 8px; padding: 2px 14px; }
.warnings ul, .changes { margin: 6px 0 10px; padding-left: 18px; }
.diff { background: #f2f6fa; border: 1px solid #cfdbe6; border-radius: 8px; padding: 2px 14px 10px; margin: 10px 0; }
.frozen { padding: 8px 12px; border-radius: 6px; background: #eef0f8; border-left: 4px solid #4a5a9a; margin-top: 8px; }
.freeze { margin: 8px 0; }
.foot { max-width: 1280px; margin: 0 auto; padding: 12px 20px 24px; color: var(--muted); font-size: 12px; }
@media (max-width: 900px) { .columns { grid-template-columns: 1fr; } }
.fiche { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 2px 14px 12px; margin-bottom: 14px; }
.fiche-form label.check { flex: 0 0 auto; flex-direction: row; align-items: center; gap: 6px; color: var(--ink); }
.fiche-read { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 8px 0; }
.fiche-read dt { color: var(--muted); }
.modulations { margin-top: 8px; }
.modulations p { margin: 6px 0; }
.envelope { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 2px 14px 12px; margin-bottom: 14px; }
.postes { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.poste { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; min-width: 0; }
.poste.todo { border-left: 3px solid #b7791f; }
.poste-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.poste-head span, .poste-source { color: var(--muted); font-size: .9em; }
.poste-source { overflow-wrap: anywhere; }
.poste .missing { color: #b7791f; font-weight: 600; }
.poste details.edit form { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.poste details.edit label { display: flex; flex-direction: column; gap: 2px; }
.poste details.edit select, .poste details.edit input { width: 100%; max-width: 100%; min-width: 0; }
.poste fieldset { border: 1px solid var(--line); border-radius: 4px; margin: 0; padding: 4px 8px 6px; min-width: 0; }
.poste .actions { display: flex; gap: 10px; align-items: center; }
button.link { background: none; border: none; color: inherit; text-decoration: underline; padding: 0; cursor: pointer; }
tr.total td { border-top: 2px solid var(--line); }
.exports { margin: 4px 0 10px; }
.variants { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 2px 14px 12px; margin-bottom: 14px; }
.scroll { overflow-x: auto; }
table.compare td small { color: var(--muted); }
.variant-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 8px; margin: 10px 0; }
.variant { border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px 8px; min-width: 0; }
.variant h3 { margin: 6px 0; }
.variant .changes li { overflow-wrap: anywhere; }
.variant details.edit form, .variant .var-meta { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.variant select, .variant input { width: 100%; max-width: 100%; min-width: 0; }
.variant .var-editor { border: none; padding: 0; }
.report-bar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin: 4px 0 12px; }
.report { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 6px 20px 20px; }
.report-kicker { color: var(--accent); font-weight: 700; text-transform: uppercase; font-size: 12px; letter-spacing: .04em; margin: 10px 0 0; }
.report-notice { font-weight: 600; border-left: 4px solid var(--accent); padding: 6px 10px; background: #fbe9e2; }
.report table { font-size: 12px; margin-bottom: 4px; }
.report td { overflow-wrap: anywhere; }
.report .ident th { width: 220px; font-size: 12px; }
.report ul { margin: 4px 0 10px; padding-left: 18px; }
@page { size: A4 landscape; margin: 14mm 10mm 14mm;
  @top-left { content: "Thermique CTL — pré-étude non réglementaire"; font: 700 9px system-ui, sans-serif; color: #b4441f; }
  @bottom-right { content: "Page " counter(page) " / " counter(pages); font: 9px system-ui, sans-serif; color: #5d6b76; } }
@media print {
  body { background: #fff; font-size: 10px; }
  .top, .foot, .notice, .no-print { display: none !important; }
  main { max-width: none; padding: 0; }
  .report { border: none; padding: 0; }
  .report table { font-size: 9px; }
  thead { display: table-header-group; }
  tr { break-inside: avoid; }
  h2 { break-after: avoid; }
}
