:root {
  --red: #9f1d27;
  --ink: #202327;
  --muted: #667085;
  --line: #e4e7ec;
  --bg: #f6f7f8;
  --white: #fff;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, sans-serif;
}
header {
  background: #191b1f;
  color: #fff;
  padding: 10px 4vw 0;
  position: sticky;
  top: 0;
  z-index: 2;
}
.topbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  min-height: 44px;
}
a { color: var(--red); text-decoration: none; }
.brand { font-size: 20px; color: #fff; font-weight: 700; flex: 0 0 auto; }
.brand small { font-weight: 400; color: #ccc; }
.version {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--red);
  border-radius: 999px;
  padding: 4px 10px;
}
header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
  padding: 6px 0 10px;
  border-top: 1px solid #2a2d33;
}
header nav a {
  color: #ddd;
  padding: 8px 12px;
  border-radius: 6px;
  white-space: nowrap;
}
header nav a.active { color: #fff; background: #2a2d33; font-weight: 700; }
.account {
  display: flex;
  gap: 12px;
  align-items: center;
  flex: 0 0 auto;
  margin-left: auto;
}
.account form { margin: 0; display: block; }
.link {
  background: none;
  padding: 0;
  color: #ddd;
  width: auto;
  font-weight: 600;
}
main { max-width: 1200px; margin: 34px auto; padding: 0 22px; }
h1 { font-size: 30px; margin: 0 0 8px; }
h2 { font-size: 18px; margin: 0 0 16px; }
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: 0 2px 8px #1111;
  min-width: 0;
}
.auth { max-width: 430px; margin: 10vh auto; }
.auth h1 { color: var(--red); }
.auth-meta { color: var(--muted); margin: 0 0 18px; }
form { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-weight: 600; }
input, select, textarea {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #cfd4dc;
  border-radius: 6px;
  background: #fff;
  font: inherit;
}
textarea { min-height: 90px; }
.large { min-height: 220px; }
button, .button {
  border: 0;
  border-radius: 6px;
  background: var(--red);
  color: #fff;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-height: 40px;
  flex: 0 0 auto;
  white-space: nowrap;
}
button.secondary, .button.secondary { background: #475467; }
button.success { background: #027a48; }
button.danger { background: #b42318; }
button:active:not(:disabled) { transform: translateY(1px); filter: brightness(0.85); }
button.done, button.done:disabled {
  background: #027a48;
  opacity: 1;
  cursor: default;
}
button:disabled { opacity: .45; cursor: not-allowed; }
.button[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head p { margin: 0; color: var(--muted); }
.page-actions, .actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.page-actions form, .actions form, .user-actions form, .toolbar form {
  margin: 0;
  display: block;
  min-width: 0;
}
.toolbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.toolbar button, .toolbar .button { width: 100%; }
.toolbar.outcome { border-top-style: dashed; }
.table-wrap {
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 14px; border-bottom: 1px solid var(--line); }
th { font-size: 12px; text-transform: uppercase; color: var(--muted); }
td small, .user-row small, .log small { display: block; color: var(--muted); }
.status {
  display: inline-block;
  padding: 4px 9px;
  border-radius: 20px;
  background: #f2f4f7;
  color: #344054;
  font-size: 12px;
}
.status.big { font-size: 14px; }
.status.nouveau { background: #f2f4f7; color: #344054; }
.status.encours, .status.valide { background: #fef0c7; color: #b54708; }
.status.envoye { background: #d1e9ff; color: #175cd3; }
.status.gagne { background: #d1fadf; color: #027a48; }
.status.perdu { background: #fee4e2; color: #b42318; }
.status.attention { background: #fee4e2; color: #b42318; font-weight: 700; }
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}
.tab:hover { border-color: #c8cdd6; }
.tab.active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.tab .count {
  font-size: 12px;
  background: #f2f4f7;
  color: #344054;
  border-radius: 999px;
  min-width: 1.6em;
  padding: 2px 8px;
  text-align: center;
}
.tab.active .count {
  background: #fff;
  color: var(--red);
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.form-grid h2, .wide { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--line); border-radius: 6px; }
.check { display: inline-flex; align-items: center; gap: 8px; margin: 8px 20px 8px 0; }
.check input { width: auto; }
.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}
.detail-grid .card { margin: 0; }
.quote-builder { grid-column: 1 / -1; }
.quote-total { text-align: right; min-width: 150px; }
.quote-total span, .line-source {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.quote-total strong { display: block; color: var(--red); font-size: 22px; }
.quote-line-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.quote-line-editor > form:last-child { align-self: end; }
.quote-line-form, .catalog-form, .catalog-product {
  display: grid;
  grid-template-columns: minmax(100px, .8fr) minmax(180px, 2fr) repeat(3, minmax(100px, .8fr));
  gap: 12px;
  align-items: end;
}
.quote-line-form > label:last-of-type, .catalog-form .wide, .catalog-product .wide { grid-column: 1 / -1; }
.quote-line-form textarea, .catalog-form textarea, .catalog-product textarea { min-height: 72px; }
.line-source { grid-column: 1 / -1; color: var(--red); }
.line-total { margin: 0; font-weight: 800; white-space: nowrap; align-self: end; }
.quote-add-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-top: 18px; }
.quote-add-form { padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }
.quote-add-form h3 { margin: 0; font-size: 16px; }
.customer-reading { grid-column: 1 / -1; }
.request-summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px 24px; margin: 0; }
.request-summary-grid > div { min-width: 0; }
.request-summary-grid dt { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.request-summary-grid dd { margin: 3px 0 0; overflow-wrap: anywhere; }
.request-summary-grid .wide { grid-column: 1 / -1; }
.customer-comment { padding: 16px; border-left: 4px solid var(--red); background: #fff7f7; white-space: pre-wrap; line-height: 1.7; }
.customer-comment strong { color: #7d1720; }
.markdown-source { margin-top: 18px; }
.markdown-source summary { cursor: pointer; color: var(--muted); font-weight: 700; }
.catalog-product {
  margin: 0;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.catalog-product.inactive { opacity: .65; background: #f8fafc; }
.catalog-product > .check { margin: 0; }
.catalog-create-form { display: grid; grid-template-columns: repeat(5, minmax(120px, 1fr)); gap: 12px; align-items: end; }
.catalog-create-form .wide { grid-column: 1 / -1; }
.catalog-table-wrap { border: 0; border-radius: 0; }
.catalog-table th, .catalog-table td { padding: 10px 12px; vertical-align: top; white-space: nowrap; }
.catalog-table td:nth-child(2) { width: 100%; white-space: normal; }
.catalog-table tr.inactive { opacity: .55; }
.compact-edit summary, .line-details summary { cursor: pointer; color: var(--red); font-weight: 700; }
.catalog-edit-form { display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)); gap: 10px; margin-top: 10px; padding: 12px; min-width: min(760px, 80vw); border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }
.catalog-edit-form .wide { grid-column: 1 / -1; }
.catalog-edit-form textarea { min-height: 64px; }
.small-button { min-height: 32px; padding: 6px 9px; font-size: 12px; }
.delete-form { display: block; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.quote-line-editor { display: block; padding: 10px 0; }
.quote-line-form.compact { display: grid; grid-template-columns: 100px minmax(180px, 2fr) 70px 80px 110px 115px auto auto; gap: 8px; align-items: center; }
.quote-line-form.compact .line-source { grid-column: 1 / -1; margin-bottom: -3px; }
.quote-line-form.compact input { padding: 8px 9px; min-height: 36px; }
.quote-line-form.compact .line-total { text-align: right; font-size: 13px; }
.quote-line-form.compact button { min-height: 36px; padding: 7px 10px; font-size: 12px; }
.quote-line-form.compact .line-details { grid-column: 1 / -1; }
.quote-line-form.compact textarea { min-height: 58px; margin-top: 8px; }
.vehicle-research { grid-column: 1 / -1; }
.vehicle-research form { justify-items: start; }
.research-privacy {
  display: grid;
  gap: 4px;
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid #b2ddff;
  border-radius: 8px;
  background: #eff8ff;
  color: #1849a9;
}
.research-privacy p { margin: 0; }
.research-result {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.research-result h3 { margin: 16px 0 8px; font-size: 15px; }
.research-result li { margin-bottom: 8px; }
.research-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.research-meta .hint { width: auto; }
.research-input { overflow-wrap: anywhere; }
.research-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 2px 28px; }
.research-sources a { overflow-wrap: anywhere; }
.point-sources { display: block; margin-top: 5px; color: var(--muted); overflow-wrap: anywhere; }
.research-review { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.research-review form { display: grid; }
@media (min-width: 1100px) {
  .detail-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .catalog-create-form, .catalog-edit-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quote-line-form.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quote-line-form.compact .line-total { text-align: left; }
}
pre {
  white-space: pre-wrap;
  background: #f8fafc;
  padding: 16px;
  border-radius: 6px;
  max-height: 580px;
  overflow: auto;
}
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.recap { margin-bottom: 22px; }
.recap-card { margin: 0; color: inherit; }
.recap-card.attention-card { border-color: #fda29b; background: #fff6f5; }
a.recap-card:hover { border-color: #c8cdd6; }
.recap-card .eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.recap-card strong { display: block; font-size: 28px; line-height: 1.1; }
.recap-card small { display: block; margin-top: 6px; color: var(--muted); }
.section-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.section-head h2 { margin: 0; }
.inline-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  align-items: end;
}
.inline-form button { justify-self: start; }
.user-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px 16px;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
}
.user-row > div:first-child { flex: 1 1 220px; min-width: 0; }
.user-actions {
  flex: 1 1 280px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: end;
}
.reset {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}
.module-list .card { margin-bottom: 10px; }
.alert {
  padding: 12px 16px;
  background: #fee4e2;
  color: #912018;
  border-radius: 8px;
  margin-bottom: 18px;
}
.flash-ok {
  padding: 12px 16px;
  background: #d1fadf;
  color: #027a48;
  border-radius: 8px;
  margin-bottom: 18px;
  font-weight: 700;
}
.notice {
  padding: 12px 16px;
  background: #f2f4f7;
  color: #344054;
  border-radius: 8px;
  margin-bottom: 16px;
}
.hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  width: 100%;
}
.qty {
  display: inline-flex;
  min-width: 1.8em;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f2f4f7;
  font-weight: 700;
}
.log { max-height: 360px; overflow: auto; }
.log p { border-bottom: 1px solid var(--line); padding-bottom: 8px; }
code { color: var(--muted); }
.offer-screen-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}
.offer-screen-head p { margin: 0; color: var(--muted); }
.offer-sheet {
  max-width: 900px;
  margin: 0 auto;
  padding: 34px 38px 24px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 2px 8px #1111;
}
.offer-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 30px;
  padding-bottom: 22px;
  border-bottom: 3px solid var(--red);
}
.offer-brand { display: grid; line-height: 1.1; }
.offer-brand strong { color: var(--red); font-size: 28px; letter-spacing: .04em; }
.offer-brand span { color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-size: 11px; }
.offer-reference { display: grid; gap: 3px; text-align: right; }
.offer-reference p { margin: 0; color: var(--red); font-size: 18px; font-weight: 700; text-transform: uppercase; }
.offer-reference strong { font-size: 18px; }
.offer-reference span { color: var(--muted); font-size: 13px; }
.offer-section {
  margin-top: 26px;
  break-inside: avoid-page;
}
.offer-section h2 {
  margin-bottom: 12px;
  padding-bottom: 7px;
  color: var(--red);
  border-bottom: 1px solid var(--line);
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.offer-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 26px;
  margin: 0;
}
.offer-fields > div { min-width: 0; }
.offer-fields dt,
.offer-proposal-text > span,
.offer-amount > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.offer-fields dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.offer-field-wide { grid-column: 1 / -1; }
.offer-long-text,
.offer-proposal-text p { white-space: pre-wrap; }
.offer-lines { font-size: 13px; }
.offer-lines th, .offer-lines td { padding: 10px 8px; }
.offer-lines td:last-child, .offer-lines th:last-child { text-align: right; white-space: nowrap; }
.offer-lines small { display: block; color: var(--muted); margin-top: 3px; white-space: pre-wrap; }
.offer-lines tfoot th { color: var(--red); font-size: 14px; }
.offer-proposal {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px 30px;
  padding: 20px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.offer-proposal h2 { grid-column: 1 / -1; margin: 0; }
.offer-proposal-text p { margin: 5px 0 0; overflow-wrap: anywhere; }
.offer-amount { min-width: 150px; text-align: right; }
.offer-amount span { display: block; }
.offer-amount strong { display: block; margin-top: 5px; color: var(--red); font-size: 20px; }
.offer-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 26px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}
@media screen and (max-width: 800px) {
  header { padding: 12px 20px 0; }
  .account { margin-left: 0; }
  .account span { display: none; }
  main { margin-top: 22px; }
  .form-grid h2, .wide { grid-column: auto; }
  .user-actions, .reset { grid-template-columns: 1fr; }
  .table-wrap { font-size: 13px; }
  .offer-screen-head { display: grid; }
  .offer-sheet { padding: 24px 20px; }
  .offer-heading, .offer-footer { display: grid; }
  .offer-reference { text-align: left; }
  .offer-fields, .offer-proposal { grid-template-columns: 1fr; }
  .offer-proposal h2, .offer-field-wide { grid-column: auto; }
  .offer-amount { text-align: left; }
  .quote-line-editor { grid-template-columns: 1fr; }
  .quote-line-form, .catalog-form, .catalog-product { grid-template-columns: 1fr; }
  .quote-line-form > label:last-of-type, .catalog-form .wide, .catalog-product .wide { grid-column: auto; }
  .quote-total { text-align: left; }
}

@page { size: A4 portrait; margin: 13mm; }
@media print {
  html, body { background: #fff; color: #000; font-size: 10.5pt; }
  body > header, .no-print { display: none !important; }
  main { max-width: none; margin: 0; padding: 0; }
  .offer-sheet {
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .offer-heading { padding-bottom: 5mm; }
  .offer-section { margin-top: 5mm; }
  .offer-section h2 { margin-bottom: 3mm; }
  .offer-fields { gap: 2.5mm 7mm; }
  .offer-proposal { padding: 4mm; background: #fff; }
  .offer-footer { margin-top: 6mm; }
}
