/* Back-office Ambàm : sobre, lisible, contrastes WCAG AA en clair comme en sombre. */

:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --text: #1d1c1a;
  --muted: #5d5a54;
  --border: #dcd8cf;
  --accent: #0f5f4f;
  --accent-text: #ffffff;
  --soft: #e9f2ef;
  --ok: #1f6b3a;
  --ok-bg: #e3f3e8;
  --warn: #7a4a00;
  --warn-bg: #fdf0d6;
  --danger: #a1221b;
  --danger-bg: #fbe4e2;
  --radius: 10px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141412;
    --surface: #1f1e1b;
    --text: #f1efe9;
    --muted: #b5b0a5;
    --border: #3a3832;
    --accent: #5fc7ad;
    --accent-text: #0b1f1a;
    --soft: #1d302b;
    --ok: #8fdca7;
    --ok-bg: #18301f;
    --warn: #f3c66b;
    --warn-bg: #352812;
    --danger: #ff9d95;
    --danger-bg: #3a1a17;
  }
}

* { box-sizing: border-box; }

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

a { color: var(--accent); }
h1 { font-size: 1.6rem; margin: 0.5rem 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 0.75rem; }
h3 { font-size: 1rem; margin: 0.75rem 0 0.25rem; }
p { margin: 0.35rem 0; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.5rem 1rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
button.secondary { background: transparent; color: var(--accent); }
button.link { min-height: 44px; border: 0; background: none; color: var(--accent); padding: 0 0.5rem; font-weight: 500; text-decoration: underline; }
button:disabled { opacity: 0.55; cursor: progress; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
textarea { resize: vertical; }

.field { margin: 0 0 1rem; }
.field label { display: block; font-weight: 600; margin-bottom: 0.25rem; }
.hint { color: var(--muted); font-size: 0.85rem; }
fieldset { border: 0; padding: 0; margin: 0 0 1rem; }
.choice { display: flex; align-items: center; gap: 0.5rem; min-height: 44px; }
.choice input { width: auto; min-height: auto; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 0 0 1rem;
  color: inherit;
}
a.card { text-decoration: none; }
a.card:hover { border-color: var(--accent); }

.badge {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  background: var(--soft);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.soft { font-weight: 500; }

.top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; gap: 0.5rem; align-items: center; }
.who { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem; }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.tabs a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0 0.85rem;
  color: var(--text);
  text-decoration: none;
  border-bottom: 3px solid transparent;
}
.tabs a[aria-current="page"] { border-bottom-color: var(--accent); font-weight: 700; }
.count:not(:empty) {
  background: var(--danger);
  color: var(--surface);
  border-radius: 999px;
  padding: 0 0.45rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.subtabs { display: flex; gap: 0.5rem; margin: 0 0 1rem; flex-wrap: wrap; }
.subtabs a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 0.9rem;
  border: 1px solid var(--border); border-radius: 999px; color: var(--text); text-decoration: none;
}
.subtabs a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

main { max-width: 1200px; margin: 0 auto; padding: 1rem 1.25rem 3rem; }
.list { list-style: none; padding: 0; margin: 0; }
.row-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.meta { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; color: var(--muted); font-size: 0.9rem; align-items: center; }
.excerpt { color: var(--muted); }
.body { white-space: pre-wrap; overflow-wrap: anywhere; }
.voice { margin: 0.75rem 0; }
.voice audio { display: block; width: 100%; max-width: 28rem; min-height: 44px; }
.quote {
  border-inline-start: 3px solid var(--border);
  padding-inline-start: 0.75rem;
  color: var(--muted);
  /* Un avis en arabe dans une page en français (ou l'inverse) garde son propre sens. */
  unicode-bidi: plaintext;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.history { list-style: none; padding: 0; margin: 0; }
.history li { padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.history li:last-child { border-bottom: 0; }

.grid { display: grid; grid-template-columns: 3fr 2fr; gap: 1rem; align-items: start; }
@media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }

.search { display: grid; grid-template-columns: 2fr 1fr auto; gap: 0.75rem; align-items: end; }
.search .field { margin: 0; }
@media (max-width: 640px) { .search { grid-template-columns: 1fr; } }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
th, td { text-align: start; padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--border); vertical-align: top; font-size: 0.92rem; }
th { font-weight: 700; }

#flash { max-width: 1200px; margin: 0 auto; padding: 0 1.25rem; }
.flash { margin: 0.75rem 0 0; padding: 0.6rem 0.9rem; border-radius: var(--radius); font-weight: 600; }
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-error { background: var(--danger-bg); color: var(--danger); }

.auth { display: grid; place-items: center; min-height: 100vh; padding: 1rem; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { font-size: 1.3rem; }
.auth-card #flash { padding: 0; }
.auth-card form button[type="submit"] { width: 100%; }
.qr { display: block; margin: 1rem auto; background: #fff; padding: 8px; border-radius: var(--radius); }
.secret { overflow-wrap: anywhere; font-family: ui-monospace, monospace; font-size: 0.85rem; }
.lang { text-align: center; margin-top: 1rem; }
select.lang-select { width: auto; min-height: 44px; }
.extra-langs { margin: 0.5rem 0 0.75rem; }
.extra-langs > p { margin: 0 0 0.25rem; }

details { margin: 0.75rem 0 1rem; }
summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; color: var(--accent); }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; margin-top: 1rem; }
.stats .card { margin: 0; }
.stat-value { font-size: 2rem; font-weight: 700; line-height: 1.2; margin: 0.25rem 0 0.5rem; }
h2.inline { margin: 0; }

/* Mots interdits : une liste compacte, un mot par ligne. */
.terms { list-style: none; margin: 0; padding: 0; columns: 2 12rem; column-gap: 1.5rem; }
.terms li { break-inside: avoid; padding: 0.15rem 0; }
.term code { font-size: 0.95em; }

/* Photos d'un moment signalé : toutes visibles, assez grandes pour juger. */
.thumbs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.5rem 0 0.75rem; }
.thumb { width: 160px; height: 160px; object-fit: cover; border-radius: 8px; background: var(--border); }
