:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eef0f4;
  --border: #dfe3ea;
  --text: #16191f;
  --muted: #6b7280;
  --accent: #ff6e14;
  --accent-text: #ffffff;
  --ok: #157f4b;
  --warn: #a35c00;
  --err: #c02626;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 12px rgba(16, 24, 40, 0.05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116;
    --surface: #171b22;
    --surface-2: #1e232c;
    --border: #2a313c;
    --text: #e7eaf0;
    --muted: #98a2b3;
    --ok: #4ade80;
    --warn: #fbbf24;
    --err: #f87171;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--err); min-height: 1.2em; }

/* ------------------------------- connexion ------------------------------- */

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.gate-card {
  width: min(380px, 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

/* -------------------------------- entête --------------------------------- */

header {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 20px clamp(16px, 4vw, 40px);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; gap: 14px; align-items: center; }
.logo { font-size: 30px; }
h1 { font-size: 20px; margin: 0; }
header p { margin: 2px 0 0; font-size: 13px; }
.actions { display: flex; gap: 8px; }

button {
  font: inherit;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 9px 16px;
  cursor: pointer;
}
button:hover { filter: brightness(0.97); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
button.ghost { background: transparent; }
button:disabled { opacity: 0.55; cursor: progress; }

/* -------------------------------- statut --------------------------------- */

.banner {
  margin: 20px clamp(16px, 4vw, 40px) 0;
  padding: 16px 20px;
  border: 1px solid var(--err);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: var(--surface);
}
.banner p, .banner ol { margin: 8px 0 0; font-size: 14px; color: var(--muted); }
.banner ol { padding-left: 20px; }
.banner li { margin-top: 6px; }
.banner b { color: var(--text); }

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  padding: 20px clamp(16px, 4vw, 40px) 0;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat .label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.stat .value { font-size: 22px; font-weight: 650; margin-top: 4px; }
.stat .value.ok { color: var(--ok); }
.stat .value.warn { color: var(--warn); }
.stat .value.err { color: var(--err); font-size: 15px; font-weight: 550; line-height: 1.35; }

/* -------------------------------- onglets -------------------------------- */

.tabs {
  display: flex;
  gap: 4px;
  padding: 20px clamp(16px, 4vw, 40px) 0;
  flex-wrap: wrap;
}
.tabs button {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 10px 14px;
  color: var(--muted);
}
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

main { padding: 20px clamp(16px, 4vw, 40px) 60px; }
.tab { display: none; }
.tab.active { display: block; }

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
a { color: var(--accent); }

/* ------------------------------- annonces -------------------------------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.ad {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}
.ad img { width: 100%; height: 170px; object-fit: cover; background: var(--surface-2); }
.ad .no-img { height: 170px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); font-size: 32px; }
.ad-body { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.ad h3 { margin: 0; font-size: 15px; line-height: 1.35; }
.ad h3 a { color: inherit; text-decoration: none; }
.ad h3 a:hover { text-decoration: underline; }
.ad .price { font-size: 19px; font-weight: 700; color: var(--accent); }
.ad .meta { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px; }
.ad .foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.ad .fav { background: none; border: none; font-size: 18px; padding: 2px 6px; }
.badge {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
}
.badge.reject { border-color: var(--err); color: var(--err); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
}
.chip button { border: none; background: none; padding: 0 2px; color: var(--muted); font-size: 16px; line-height: 1; }

/* -------------------------------- réglages ------------------------------- */

fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 20px;
  margin: 0 0 20px;
}
legend { font-weight: 650; padding: 0 8px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
label.block { margin-top: 16px; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 14px; margin-bottom: 8px; }
label.check input { width: auto; }
input, select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  width: 100%;
}
textarea { resize: vertical; font-size: 13px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.zone-picker { display: flex; gap: 8px; margin: 8px 0 12px; }
.zone-picker select, .zone-picker input { flex: 1; }
.zone-picker button { white-space: nowrap; }
.form-actions { display: flex; align-items: center; gap: 14px; }

/* --------------------------------- journal ------------------------------- */

h2 { font-size: 16px; margin: 24px 0 10px; }
pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.6;
  max-height: 60vh;
}
.table { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); font-size: 13px; white-space: nowrap; }
th { color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: none; }
td.ok { color: var(--ok); }
td.err { color: var(--err); white-space: normal; }
.empty { color: var(--muted); padding: 40px; text-align: center; border: 1px dashed var(--border); border-radius: var(--radius); }
