/* Admin bons plans — une feuille, sans framework. Couleurs en jetons, thème sombre auto. */
:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #f0eee9;
  --text: #1d1c1a;
  --muted: #6b6760;
  --border: #e2dfd8;
  --accent: #d9480f;
  --accent-ink: #ffffff;
  --accent-soft: #fff0e8;
  --ok: #2b8a3e;
  --ok-soft: #ebfbee;
  --warn: #b35c00;
  --warn-soft: #fff4e0;
  --danger: #c92a2a;
  --danger-soft: #fff0f0;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 2px 8px rgba(0, 0, 0, .04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151412;
    --surface: #1e1d1a;
    --surface-2: #272522;
    --text: #ecebe8;
    --muted: #a29e96;
    --border: #34322e;
    --accent: #ff7a3d;
    --accent-ink: #1a0d05;
    --accent-soft: #3a2116;
    --ok: #69db7c;
    --ok-soft: #1c3322;
    --warn: #ffb347;
    --warn-soft: #3a2c14;
    --danger: #ff8787;
    --danger-soft: #3b1d1d;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: inherit; }
h1 { font-size: 1.5rem; margin: .2rem 0 .6rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; }
h3 { font-size: 1rem; margin: 0; }
code { background: var(--surface-2); padding: .05rem .35rem; border-radius: 6px; font-size: .88em; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .7rem 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; text-decoration: none; }
.topbar nav { display: flex; gap: .25rem; flex-wrap: wrap; margin-left: auto; align-items: center; }
.topbar nav a, .topbar nav .link {
  padding: .35rem .65rem; border-radius: 8px; text-decoration: none; color: var(--muted); font-size: .92rem;
}
.topbar nav a:hover, .topbar nav .link:hover { background: var(--surface-2); color: var(--text); }
.topbar nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

main { max-width: 1080px; margin: 0 auto; padding: 1.2rem 16px 4rem; }
section { margin-bottom: 1.6rem; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.1rem; box-shadow: var(--shadow);
}
.narrow { max-width: 380px; margin: 3rem auto; }
.stack { display: flex; flex-direction: column; gap: .8rem; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .8rem; }
.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: .8rem; }
.section-head h2 { margin: 0; }
.inline { display: inline; margin: 0; }
.plain { list-style: none; padding: 0; margin: 0; display: grid; gap: .3rem; }

/* Boutons */
button, .button {
  font: inherit; cursor: pointer; border-radius: 9px; padding: .5rem .9rem;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  text-decoration: none; display: inline-flex; align-items: center; gap: .35rem; line-height: 1.2;
}
button:hover, .button:hover { background: var(--surface-2); }
button:disabled { opacity: .5; cursor: not-allowed; }
.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.primary:hover { background: var(--accent); filter: brightness(1.06); }
.secondary { background: var(--surface-2); }
.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.danger { color: var(--danger); }
.danger:hover { background: var(--danger-soft); }
.link { background: none; border: 0; }

/* Formulaires */
label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .92rem; }
label .muted { font-weight: 400; }
input[type=text], input[type=password], input[type=search], input[type=date], input:not([type]), textarea, select {
  font: inherit; font-weight: 400; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 9px; padding: .55rem .7rem; width: 100%;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; font-size: .92rem; margin-bottom: .4rem; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { flex-direction: row; font-weight: 400; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { padding: .3rem .7rem; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); font-size: .88rem; }
.chip input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chip input:focus-visible + span { outline: 2px solid var(--accent); }
.check { flex-direction: row; align-items: flex-start; gap: .6rem; font-weight: 400; }
.check input { margin-top: .25rem; accent-color: var(--accent); }
.form-grid { display: grid; gap: 1rem; }
.actions { display: flex; gap: .6rem; position: sticky; bottom: 0; padding: .8rem 0; background: linear-gradient(transparent, var(--bg) 30%); }
.search-bar input[type=search] { min-width: 220px; flex: 1; }
.search-bar select { width: auto; }

/* Messages */
.alert { padding: .7rem .9rem; border-radius: 10px; border: 1px solid; margin: 0 0 1rem; }
.alert ul { margin: 0; padding-left: 1.1rem; }
.alert.error { background: var(--danger-soft); border-color: var(--danger); }
.alert.warn { background: var(--warn-soft); border-color: var(--warn); }
.alert.ok { background: var(--ok-soft); border-color: var(--ok); }
.empty { text-align: left; }
.empty p { margin: .3rem 0 .8rem; }

/* Tuiles d'état */
.status-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .7rem; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem .9rem; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.tile.warn { border-color: var(--warn); background: var(--warn-soft); }
.tile-label { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.tile-value { font-size: 1.35rem; font-weight: 700; margin: .1rem 0; font-variant-numeric: tabular-nums; }
.tile-sub { font-size: .82rem; color: var(--muted); }

/* Cartes de recherche */
.search-card { text-decoration: none; display: flex; flex-direction: column; gap: .4rem; transition: border-color .15s; }
.search-card:hover { border-color: var(--accent); }
.search-card.paused { opacity: .6; }
.search-card-head { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.search-card p { margin: 0; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .9rem; }
.counts { display: flex; gap: .8rem; font-size: .9rem; flex-wrap: wrap; }
.badge { font-size: .75rem; padding: .1rem .5rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; text-decoration: none; font-weight: 500; }
.filters { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin: 0 0 1rem; }

/* Onglets */
.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; overflow-x: auto; }
.tabs a { padding: .55rem .8rem; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a span { font-size: .78rem; background: var(--surface-2); border-radius: 999px; padding: .05rem .45rem; margin-left: .2rem; }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

/* Listes de deals */
.deal-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .55rem; }
.deal { display: grid; grid-template-columns: 64px 1fr auto; gap: .8rem; align-items: start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .7rem; box-shadow: var(--shadow); }
.deal.expired { opacity: .5; }
.deal-body { min-width: 0; } /* une grille laisse sinon un long mot pousser la page */
.deal img, .deal .ph { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; background: var(--surface-2); display: grid; place-items: center; }
.compact .deal { grid-template-columns: 44px 1fr; padding: .5rem .6rem; }
.compact .deal img, .compact .deal .ph { width: 44px; height: 44px; }
.deal-title { font-weight: 600; text-decoration: none; display: block; overflow-wrap: anywhere; }
.deal-title:hover { color: var(--accent); }
.deal-meta { display: flex; flex-wrap: wrap; gap: .2rem .7rem; font-size: .85rem; margin-top: .2rem; align-items: center; }
.price { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.real { font-weight: 600; color: var(--ok); }
.deg { color: var(--warn); font-weight: 600; }
.score { font-weight: 700; background: var(--accent-soft); color: var(--accent); padding: 0 .45rem; border-radius: 6px; }
.reason { margin: .35rem 0 0; font-size: .88rem; color: var(--muted); font-style: italic; }
.votes { display: flex; flex-direction: column; gap: .3rem; }
.vote { padding: .3rem .5rem; font-size: 1rem; background: var(--bg); }
.vote.on { background: var(--accent-soft); border-color: var(--accent); }
.preview-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .3rem; font-size: .88rem; }
.preview-list li { padding: .35rem .5rem; background: var(--bg); border-radius: 8px; overflow-wrap: anywhere; }
.preview-list a { text-decoration: none; }

@media (max-width: 720px) {
  .status-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row3 { grid-template-columns: 1fr 1fr; }
  .deal { grid-template-columns: 48px 1fr; }
  .deal img, .deal .ph { width: 48px; height: 48px; }
  .votes { grid-column: 2; flex-direction: row; }
  .topbar nav { margin-left: 0; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  h1 { font-size: 1.3rem; }
}
