@import url("https://fonts.googleapis.com/css2?family=Jost:wght@300..700&display=swap");

:root {
  /* Couleurs du logo Negotiume : ardoise #183136 et or #DFAE2F */
  --paper: #f3f5f5;
  --surface: #ffffff;
  --ink: #183136;
  --petrol: #183136;
  --petrol-2: #2c4c54;
  --gold: #dfae2f;
  --gold-ink: #8a6510;
  --gold-bg: #fbf3df;
  --muted: #5b6b6f;
  --line: #dde3e4;
  --line-strong: #bccacd;
  --down: #1c7c54;
  --down-bg: #e5f3ec;
  --warn: #9a5b00;
  --warn-bg: #fdf2dc;
  --danger: #b3261e;
  --danger-bg: #fbe9e7;
  --focus: #2f7fd8;
  --radius-s: 6px;
  --radius: 10px;
  --font: "Jost", "Futura", "Avenir Next", "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f1c1f; --surface: #162729; --ink: #e6eeef; --petrol: #e6eeef; --petrol-2: #c4d4d6;
    --gold: #e4b84a; --gold-ink: #e4b84a; --gold-bg: #2c2410;
    --muted: #97a9ad; --line: #26393d; --line-strong: #375156;
    --down: #5cc99a; --down-bg: #112c22; --warn: #e9b55a; --warn-bg: #2d2412; --danger: #ff8a80; --danger-bg: #331a18;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16.5px/1.55 var(--font);
}
a { color: var(--petrol-2); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
img, svg { max-width: 100%; }
.num, td.num, .money { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ barre */
.top {
  display: flex; align-items: center; gap: 18px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand {
  font-weight: 350; font-size: 25px; letter-spacing: .01em; line-height: 1;
  color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 10px;
}
.brand img { width: 30px; height: auto; display: block; }
.top nav { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.top nav a, .top nav button.link {
  color: var(--ink); text-decoration: none; padding: 7px 11px; border-radius: var(--radius-s); font-weight: 500;
  background: none; border: 0; font: inherit; cursor: pointer;
}
.top nav a:hover, .top nav button.link:hover { background: var(--paper); }
.top nav .who { color: var(--muted); font-size: 14px; padding-right: 4px; }

main { max-width: 1120px; margin: 0 auto; padding: 32px clamp(16px, 4vw, 32px) 80px; }
main.narrow { max-width: 760px; }
main.tight { max-width: 460px; padding-top: 56px; }

/* ------------------------------------------------------------------ texte */
h1 { font-size: clamp(27px, 3.4vw, 36px); line-height: 1.15; font-weight: 500; margin: 0 0 8px; letter-spacing: -.005em; }
h2 { font-size: 20px; line-height: 1.3; font-weight: 550; margin: 0 0 14px; }
h3 { font-size: 16px; margin: 0 0 8px; }
p { margin: 0 0 12px; }
.lead { color: var(--muted); font-size: 17px; max-width: 64ch; margin-bottom: 28px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* ------------------------------------------------------------------ blocs */
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(18px, 3vw, 26px); margin-bottom: 20px;
}
.panel > h2:first-child { margin-top: 0; }
.panel.flush { padding: 0; overflow: hidden; }
.section-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.section-head h2 { margin: 0; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 820px) { .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; } }
@media (min-width: 560px) and (max-width: 820px) { .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* ------------------------------------------------------------------ formulaires */
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
label .opt { font-weight: 400; color: var(--muted); }
input, textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-s);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 15px;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--petrol); }
textarea { min-height: 96px; resize: vertical; }
.hint { color: var(--muted); font-size: 13px; margin-top: 5px; line-height: 1.45; }
.field { margin-bottom: 16px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 4px; }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 16px; border-radius: var(--radius-s); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; font-size: 15px;
  cursor: pointer; text-decoration: none; white-space: nowrap; line-height: 1.2;
}
button:hover, .btn:hover { border-color: var(--petrol-2); }
button.primary, .btn.primary { background: var(--petrol); border-color: var(--petrol); color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) button.primary, :root:not([data-theme="light"]) .btn.primary { color: #0f1c1f; } }
button.primary:hover, .btn.primary:hover { background: var(--petrol-2); border-color: var(--petrol-2); }
button.danger { color: var(--danger); }
button.ghost, .btn.ghost { border-color: transparent; background: transparent; }
button.sm, .btn.sm { padding: 6px 10px; font-size: 14px; }
button.lg, .btn.lg { padding: 13px 22px; font-size: 16px; }
button:disabled { opacity: .5; cursor: not-allowed; }

/* Choix de mode (cartes radio) */
.choice { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 640px) { .choice { grid-template-columns: 1fr; } }
.choice label {
  display: block; margin: 0; padding: 16px 16px 16px 46px; position: relative; cursor: pointer;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius); font-weight: 400; background: var(--surface);
}
.choice label strong { display: block; font-size: 16px; margin-bottom: 3px; }
.choice label span { color: var(--muted); font-size: 14px; }
.choice input { position: absolute; left: 16px; top: 19px; }
.choice label:has(input:checked) { border-color: var(--petrol); box-shadow: inset 0 0 0 1px var(--petrol); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-s); overflow: hidden; flex-wrap: wrap; }
.seg label { margin: 0; padding: 8px 14px; font-weight: 500; cursor: pointer; display: flex; gap: 8px; align-items: center; border-right: 1px solid var(--line); }
.seg label:last-child { border-right: 0; }
.seg label:has(input:checked) { background: var(--petrol); color: #fff; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }

/* Lignes de prestataires / devis */
.prow {
  display: grid; gap: 10px; align-items: start; padding: 12px 0; border-top: 1px solid var(--line);
  grid-template-columns: 1.3fr 1.3fr auto;
}
.prow.quotes { grid-template-columns: 1.2fr 1.2fr .9fr 1.2fr auto; }
.prow:first-child { border-top: 0; }
@media (max-width: 820px) { .prow, .prow.quotes { grid-template-columns: 1fr; } }
.file-pick { position: relative; }
.file-pick input[type=file] { font-size: 13px; padding: 7px; }
.file-tag { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; max-width: 100%; }
.file-tag a, .file-tag span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------------ alertes, badges */
.alert { padding: 12px 14px; border-radius: var(--radius-s); margin-bottom: 16px; border: 1px solid transparent; }
.alert.error { background: var(--danger-bg); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert.success { background: var(--down-bg); color: var(--down); border-color: color-mix(in srgb, var(--down) 25%, transparent); }
.alert.info { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--paper); color: var(--muted); border: 1px solid var(--line); }
.badge.open { background: var(--down-bg); color: var(--down); border-color: transparent; }
.badge.pending { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge.closed { background: var(--paper); color: var(--ink); }
.badge.review { background: var(--gold-bg); color: var(--gold-ink); border-color: transparent; }
.badge.draft { background: transparent; border-style: dashed; }

/* ------------------------------------------------------------------ tableaux */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 13px; color: var(--muted); font-weight: 600; white-space: nowrap; }
td.num, th.num { text-align: right; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--paper); }
td .sub { display: block; color: var(--muted); font-size: 13px; }

/* ------------------------------------------------------------------ chiffres */
.figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 20px; }
.figures > div { padding: 16px 18px; border-left: 1px solid var(--line); min-width: 0; }
.figures > div:first-child { border-left: 0; }
@media (max-width: 820px) { .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); } .figures > div:nth-child(3) { border-left: 0; } .figures > div:nth-child(n+3) { border-top: 1px solid var(--line); } }
.figures .k { color: var(--muted); font-size: 13.5px; }
.figures .v { font-size: clamp(21px, 2.4vw, 27px); font-weight: 550; font-variant-numeric: tabular-nums; line-height: 1.25; overflow-wrap: anywhere; }
.figures .s { color: var(--muted); font-size: 13px; }
.v.down { color: var(--down); }
.countdown.urgent { color: var(--danger); }

/* Résultat */
.result { border: 1.5px solid var(--down); border-radius: var(--radius); background: var(--surface); padding: 20px 22px; margin-bottom: 20px; }
.result dl { display: grid; grid-template-columns: 1fr auto; gap: 8px 20px; margin: 0; max-width: 520px; }
.result dt { color: var(--muted); }
.result dd { margin: 0; text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.result dd.total { font-size: 19px; border-top: 1px solid var(--line); padding-top: 8px; }
.result dt.total { border-top: 1px solid var(--line); padding-top: 8px; font-weight: 600; color: var(--ink); }

/* ------------------------------------------------------------------ graphique escalier */
.chart svg { width: 100%; height: 240px; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 14px; margin-top: 10px; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

/* ------------------------------------------------------------------ vue prestataire */
.rank-block { text-align: center; padding: 26px 18px; }
.rank-block .rank { font-size: clamp(68px, 12vw, 104px); font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums; }
.rank-block .rank sup { font-size: .32em; vertical-align: super; }
.rank-block.leader .rank { color: var(--down); }
.rank-block.leader::after { content: ""; display: block; width: 14px; height: 14px; margin: 12px auto 0; background: var(--gold); transform: rotate(45deg); }
.rank-block .caption { color: var(--muted); margin-top: 10px; }
.flash { animation: flash 1.4s ease; }
@keyframes flash { 0% { background: var(--warn-bg); } 100% { background: var(--surface); } }
.bid-form { display: flex; gap: 10px; }
.bid-form input { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .bid-form { flex-direction: column; } }

/* ------------------------------------------------------------------ accueil */
.hero { display: grid; grid-template-columns: 1.05fr 1fr; gap: clamp(24px, 5vw, 64px); align-items: center; padding: clamp(28px, 6vw, 72px) 0 40px; }
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; } }
.hero h1 { font-size: clamp(38px, 5.6vw, 64px); font-weight: 400; line-height: 1.04; letter-spacing: -.015em; margin-bottom: 20px; }
.hero p { font-size: 18px; color: var(--muted); max-width: 52ch; }
.stair { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 18px 12px; }
.stair svg { width: 100%; height: auto; display: block; }
.stair .cap { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--muted); padding: 4px 4px 0; flex-wrap: wrap; }
.stair .cap strong { color: var(--down); font-size: 17px; }
@media (prefers-reduced-motion: no-preference) {
  .stair .step-line { stroke-dasharray: 1400; stroke-dashoffset: 1400; animation: draw 2.4s .3s cubic-bezier(.5, 0, .2, 1) forwards; }
  .stair .end-dot { opacity: 0; animation: appear .4s 2.6s forwards; }
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes appear { to { opacity: 1; } }
.how { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--line); margin: 24px 0 48px; }
.how > div { padding: 22px 22px 0 0; }
.how b { display: block; font-size: 16px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
@media (max-width: 820px) { .how { grid-template-columns: 1fr; } }
.two-ways { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 48px; }
@media (max-width: 820px) { .two-ways { grid-template-columns: 1fr; } }
.price-box { display: flex; gap: 24px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: #183136; color: #fff; border-radius: 14px; padding: 28px clamp(20px, 4vw, 36px); border-left: 6px solid var(--gold); }
.price-box p { color: rgba(255,255,255,.82); margin: 0; }
.price-box .btn { background: var(--gold); color: #183136; border-color: var(--gold); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .price-box { background: #163f46; } }
footer.foot { border-top: 1px solid var(--line); padding: 22px clamp(16px, 4vw, 40px); color: var(--muted); font-size: 14px; display: flex; gap: 16px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ onglets admin */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 10px 14px; color: var(--muted); }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--gold); }
.tabs .count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 6px; border-radius: 999px; background: var(--gold); color: #183136; font-size: 12.5px; font-weight: 600; }
code.key { display: block; padding: 10px 12px; background: var(--paper); border: 1px dashed var(--line-strong); border-radius: var(--radius-s); font-size: 13px; overflow-wrap: anywhere; }
pre.mail { white-space: pre-wrap; background: var(--paper); padding: 12px; border-radius: var(--radius-s); font: 13px/1.5 var(--font); max-height: 320px; overflow: auto; }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty h2 { color: var(--ink); }

/* ------------------------------------------------------------------ contrôle de comparabilité */
.checklist { display: grid; gap: 10px; margin: 6px 0 4px; }
.checklist label { display: flex; gap: 12px; align-items: flex-start; font-weight: 400; margin: 0; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-s); cursor: pointer; }
.checklist label:has(input:checked) { border-color: var(--down); background: var(--down-bg); }
.checklist input { margin-top: 4px; }
.warn-list { margin: 0; padding-left: 20px; }
.warn-list li { margin-bottom: 4px; }
.review-box { border: 1.5px solid var(--gold); background: var(--surface); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 20px; }
.review-box h2 { display: flex; align-items: center; gap: 10px; }
.diamond { display: inline-block; width: 11px; height: 11px; background: var(--gold); transform: rotate(45deg); flex: none; }
.adj { display: grid; grid-template-columns: 1.4fr .9fr .9fr 1.6fr; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
@media (max-width: 820px) { .adj { grid-template-columns: 1fr; } }
.adj .sub { display: block; color: var(--muted); font-size: 13px; }

/* Parcours « pas encore de devis » vers Submisso */
.no-quotes { border-left: 3px solid var(--gold); background: var(--gold-bg); }
.no-quotes .btn { white-space: nowrap; }

/* Fenêtre de confirmation */
.modal-backdrop { position: fixed; inset: 0; background: rgba(24, 49, 54, .45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 100; }
.modal { background: var(--surface); border-radius: var(--radius); max-width: 520px; width: 100%; padding: 26px 28px; box-shadow: 0 18px 50px rgba(0,0,0,.25); border-top: 4px solid var(--gold); }
.modal h2 { margin: 0 0 12px; }
.modal p { margin: 0 0 10px; }

/* Menu « Mon compte » */
.account-menu { position: relative; margin-left: 6px; }
.account-btn { background: none; border: 0; padding: 2px; color: var(--petrol); cursor: pointer; border-radius: 50%; display: flex; }
.account-btn:hover, .account-btn[aria-expanded="true"] { color: var(--petrol-2); box-shadow: 0 0 0 3px var(--gold-bg); }
.account-dropdown { position: absolute; right: 0; top: calc(100% + 8px); min-width: 270px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 12px 32px rgba(24, 49, 54, .18); padding: 6px; z-index: 60; }
.account-who { padding: 10px 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.account-who strong { display: block; }
.account-who span { color: var(--muted); font-size: 13px; }
.top nav .account-dropdown a, .top nav .account-dropdown button.link { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 11px 12px; border-radius: var(--radius-s); color: var(--ink); text-decoration: none; font-size: 15px; justify-content: flex-start; font-weight: 400; background: none; border: 0; }
.top nav .account-dropdown a:hover, .top nav .account-dropdown button.link:hover { background: var(--paper); }
.account-dropdown svg { color: var(--petrol); flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.anchor { scroll-margin-top: 90px; }
.anchor.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 3px var(--gold); } 100% { box-shadow: 0 0 0 3px transparent; } }
.contact-lines div { display: flex; gap: 16px; padding: 8px 0; border-top: 1px solid var(--line); }
.contact-lines div:first-child { border-top: 0; }
.contact-lines .k { width: 110px; color: var(--muted); flex: none; }
.legal h2 { font-size: 18px; margin-top: 26px; }
.legal p, .legal li { line-height: 1.6; }

/* Pied de page (textes juridiques) */
.site-foot { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; padding: 18px clamp(16px, 4vw, 40px) 26px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.site-foot a { color: var(--muted); text-decoration: none; }
.site-foot a:hover { color: var(--ink); text-decoration: underline; }
.legal-nav { margin-bottom: 4px; }
