:root {
  --paper: #f2f4f1;
  --surface: #ffffff;
  --ink: #1d2420;
  --muted: #5e6a63;
  --rule: #d9ded8;
  --accent: #2a3fb0;
  --accent-ink: #ffffff;
  --hot: #c8402a;
  --warm: #a86b12;
  --calm: #2f7d5b;
  --shade: #e7ebe6;
  --font-ui: "Instrument Sans", system-ui, sans-serif;
  --font-figure: "Big Shoulders Display", "Instrument Sans", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121614; --surface: #1a1f1c; --ink: #e6ebe7; --muted: #9aa59e; --rule: #2c342f;
    --accent: #8c9bff; --accent-ink: #10142e; --hot: #ff7a5c; --warm: #e5a93e; --calm: #5cc394; --shade: #232a26;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 15px/1.5 var(--font-ui); font-feature-settings: "tnum" 1;
}
a { color: var(--accent); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

/* --- en-tête --- */
.top {
  display: flex; align-items: baseline; gap: 28px; flex-wrap: wrap;
  padding: 14px 24px; border-bottom: 1px solid var(--rule); background: var(--surface);
}
.brand { font: 700 26px/1 var(--font-figure); letter-spacing: .01em; color: var(--ink); text-decoration: none; }
.nav { display: flex; gap: 4px; }
.nav a { padding: 4px 10px; border-radius: 6px; color: var(--muted); text-decoration: none; font-weight: 500; }
.nav a[aria-current="page"] { color: var(--ink); background: var(--shade); }
.freshness { margin-left: auto; color: var(--muted); font-size: 13px; }

/* --- mise en page recherche --- */
.layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 0; min-height: calc(100vh - 56px); }
.rail { border-right: 1px solid var(--rule); padding: 20px 20px 40px; background: var(--surface); }
.main { padding: 20px 28px 60px; max-width: 1080px; }

.field { margin: 0 0 16px; }
.field > label, .field > .label { display: block; font-size: 13px; font-weight: 600; margin: 0 0 5px; }
.hint { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
input[type="text"], input[type="search"], input[type="email"], select {
  width: 100%; padding: 8px 10px; font: inherit; color: var(--ink);
  background: var(--paper); border: 1px solid var(--rule); border-radius: 6px;
}
input:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.big-search { font-size: 16px; padding: 10px 12px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.checks label { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; cursor: pointer; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 16px; height: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; font: 600 14px/1.2 var(--font-ui); border-radius: 6px; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); text-decoration: none;
}
.btn.ghost { background: transparent; color: var(--accent); }
.btn.quiet { background: transparent; border-color: var(--rule); color: var(--ink); }
.btn.danger { background: transparent; border-color: var(--rule); color: var(--hot); }
.btn.full { width: 100%; }
.rail .actions { display: grid; gap: 8px; margin-top: 22px; }

/* --- liste des avis --- */
.result-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin: 4px 0 14px; }
.result-head h1 { font-size: 20px; margin: 0; font-weight: 600; }
.result-head .sort { margin-left: auto; display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.result-head .sort select { width: auto; padding: 5px 8px; }

.notices { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.notice {
  display: grid; grid-template-columns: 78px minmax(0, 1fr) auto; gap: 18px;
  padding: 14px 4px; border-bottom: 1px solid var(--rule);
}
.notice:hover { background: color-mix(in srgb, var(--surface) 60%, transparent); }

/* Le compte à rebours : l'élément central de l'écran */
.countdown { text-align: right; line-height: 1; padding-top: 2px; }
.countdown b { display: block; font: 700 40px/0.9 var(--font-figure); letter-spacing: -.01em; }
.countdown span { font-size: 12px; color: var(--muted); }
.countdown.hot b { color: var(--hot); }
.countdown.warm b { color: var(--warm); }
.countdown.calm b { color: var(--calm); }
.countdown.closed b, .countdown.none b { color: var(--muted); font-size: 22px; padding-top: 8px; }

.notice h2 { font-size: 16px; line-height: 1.35; margin: 0 0 4px; font-weight: 600; }
.notice h2 a { color: var(--ink); text-decoration: none; }
.notice h2 a:hover { color: var(--accent); text-decoration: underline; }
.buyer { color: var(--ink); font-size: 14px; }
.facts { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 4px; color: var(--muted); font-size: 13px; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 4px; background: var(--shade); color: var(--ink); font-size: 12px; font-weight: 500; }
.tag.kind-attribution { background: color-mix(in srgb, var(--calm) 18%, transparent); }
.tag.kind-rectificatif, .tag.kind-annulation { background: color-mix(in srgb, var(--warm) 20%, transparent); }
.side { text-align: right; white-space: nowrap; }
.value { font: 600 18px/1.1 var(--font-figure); letter-spacing: .01em; }
.source { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); }

.pager { display: flex; gap: 10px; align-items: center; justify-content: center; margin: 24px 0; color: var(--muted); font-size: 14px; }
.empty { padding: 48px 0; color: var(--muted); max-width: 52ch; }
.empty strong { color: var(--ink); display: block; font-size: 17px; margin-bottom: 6px; }

/* --- fiche --- */
.page { max-width: 1080px; margin: 0 auto; padding: 24px 24px 80px; }
.back { font-size: 14px; }
.sheet { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 40px; margin-top: 14px; }
.sheet h1 { font-size: 26px; line-height: 1.25; margin: 6px 0 8px; font-weight: 650; max-width: 40ch; }
.sheet .lead { font-size: 16px; margin: 0 0 22px; }
.sheet section { margin: 0 0 26px; }
.sheet h3 { font-size: 14px; margin: 0 0 8px; font-weight: 650; }
.prose { white-space: pre-line; max-width: 72ch; }
.plain-list { margin: 0; padding-left: 18px; }
.plain-list li { margin: 3px 0; }
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 18px; position: sticky; top: 16px; }
.panel .countdown { text-align: left; margin-bottom: 14px; }
.panel .countdown b { font-size: 64px; }
.panel dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 14px; }
.panel dt { color: var(--muted); }
.panel dd { margin: 0; overflow-wrap: anywhere; }
.panel .links { display: grid; gap: 8px; margin-top: 16px; }
.history { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--rule); }
.history li { padding: 8px 0; border-bottom: 1px solid var(--rule); font-size: 14px; display: flex; gap: 12px; }
.history time { color: var(--muted); white-space: nowrap; }

/* --- alertes --- */
.flash { background: color-mix(in srgb, var(--calm) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--calm) 40%, transparent); padding: 10px 14px; border-radius: 8px; margin: 0 0 18px; }
.error { background: color-mix(in srgb, var(--hot) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--hot) 40%, transparent); padding: 10px 14px; border-radius: 8px; margin: 0 0 18px; }
.page-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 24px; }
.page-head .btn { margin-left: auto; }
.alerts { display: grid; gap: 12px; }
.alert {
  display: grid; grid-template-columns: 90px minmax(0, 1fr) auto; gap: 18px; align-items: start;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 16px 18px;
}
.alert.paused { opacity: .62; }
.alert .count b { display: block; font: 700 38px/0.9 var(--font-figure); color: var(--accent); }
.alert .count span { font-size: 12px; color: var(--muted); }
.alert h2 { margin: 0 0 4px; font-size: 17px; }
.criteria { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.alert .ops { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.alert .ops form { margin: 0; }

.form-card { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 22px; max-width: 760px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.form-grid .wide { grid-column: 1 / -1; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .rail { border-right: 0; border-bottom: 1px solid var(--rule); padding: 16px; }
  .main { padding: 16px; }
  .notice { grid-template-columns: 56px minmax(0, 1fr); gap: 12px; }
  .notice .side { grid-column: 2; text-align: left; }
  .countdown b { font-size: 32px; }
  .sheet { grid-template-columns: 1fr; }
  .panel { position: static; }
  .page { padding: 16px; }
  .top { padding: 12px 16px; gap: 16px; }
  .freshness { margin-left: 0; width: 100%; }
  .alert { grid-template-columns: 64px minmax(0, 1fr); }
  .alert .ops { grid-column: 1 / -1; justify-content: flex-start; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.more { margin: 0 0 4px; }
.more > summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--accent); margin: 0 0 14px; }
@media (min-width: 861px) { .more > summary { display: none; } }

.scope { padding: 12px; margin: 0 0 18px; border-radius: 8px; background: color-mix(in srgb, var(--accent) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent); }
.scope-toggle { display: flex; gap: 8px; align-items: center; font-weight: 600; font-size: 14px; cursor: pointer; }
.scope .hint { margin-top: 6px; }
.tag.alert-tag { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--ink); }

/* --- tri intéressé / pas intéressé --- */
.decision-form { display: flex; gap: 6px; justify-content: flex-end; margin-top: 10px; }
.decision-btn {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px; border-radius: 999px;
  border: 1px solid var(--rule); background: var(--surface); color: var(--muted);
  font: 500 12px/1.2 var(--font-ui); cursor: pointer; white-space: nowrap;
}
.decision-btn svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.decision-btn:hover { color: var(--ink); border-color: var(--muted); }
.decision-btn.yes[aria-pressed="true"] { background: var(--calm); border-color: var(--calm); color: #fff; }
.decision-btn.no[aria-pressed="true"] { background: var(--shade); color: var(--hot); border-color: var(--hot); }
.interest-tag { display: none; background: color-mix(in srgb, var(--calm) 22%, transparent); color: var(--ink); font-weight: 600; }
.notice.is-interesse .interest-tag { display: inline-block; }
.notice.is-interesse { box-shadow: inset 3px 0 0 var(--calm); }
.notice.is-pas_interesse { opacity: .55; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sheet-head .decision-form { margin-top: 0; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 10;
  display: flex; gap: 14px; align-items: center; padding: 10px 14px; border-radius: 10px;
  background: var(--ink); color: var(--paper); font-size: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.18);
}
.toast[hidden] { display: none; }
.toast button { background: none; border: 0; color: var(--accent); filter: brightness(1.6); font: 600 14px var(--font-ui); cursor: pointer; padding: 0; }
@media (max-width: 860px) { .decision-form { justify-content: flex-start; } }
.notice[hidden] { display: none; }

/* --- connexion --- */
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 340px; background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 28px 24px; }
.login-card .brand { display: block; margin: 0 0 22px; font-size: 32px; }
