/* EVM — Écrivains de Mauritanie */
:root {
  --sand: #f8f3ea;
  --paper: #ffffff;
  --ink: #1c2230;
  --ink-2: #4a5263;
  --muted: #7a8090;
  --line: #e6ddcd;
  --red: #c8284a;
  --blue: #0a6aad;
  --green: #3f9a2a;
  --orange: #e36d16;
  --yellow: #e9b308;
  --ok-bg: #e5f4df; --ok-fg: #24661a;
  --warn-bg: #fdf1d3; --warn-fg: #8a5a00;
  --bad-bg: #fbe1e6; --bad-fg: #a3122f;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(28,34,48,.06), 0 6px 20px rgba(28,34,48,.06);
  --serif: "Fraunces", Georgia, serif;
  --sans: "Source Sans 3", "Segoe UI", Arial, sans-serif;
  --arabic: "Amiri", "Traditional Arabic", serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--sand); color: var(--ink); font: 17px/1.55 var(--sans); }
body.modal-lock { overflow: hidden; }
a { color: var(--blue); }
h1, h2, h3 { font-family: var(--serif); line-height: 1.15; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h2 { font-size: 1.35rem; }
p { margin: 0 0 1em; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 820px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
code { background: #efe7d8; padding: .1em .35em; border-radius: 4px; font-size: .9em; }
[lang="ar"] { font-family: var(--arabic); }

/* En-tête */
.site-header { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand-logo { height: 44px; width: auto; }
.brand strong { display: block; font-family: var(--serif); font-size: 1.15rem; }
.brand small { display: block; color: var(--muted); font-size: .8rem; }
.site-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.site-nav a, .linklike { color: var(--ink-2); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 600; font-size: .95rem; background: none; border: 0; cursor: pointer; font-family: inherit; }
.site-nav a:hover, .site-nav a.active, .linklike:hover { background: var(--sand); color: var(--ink); }
.inline { display: inline; margin: 0; }

/* Héros */
.hero { background: linear-gradient(135deg, #1c2230 0%, #23314d 100%); color: #fff; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 6px;
  background: linear-gradient(90deg, var(--red) 0 20%, var(--blue) 20% 40%, var(--green) 40% 60%, var(--orange) 60% 80%, var(--yellow) 80%); }
.hero-inner { display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; padding-top: 56px; padding-bottom: 56px; align-items: center; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .78rem; color: var(--yellow); font-weight: 700; margin-bottom: .6em; }
.lead { font-size: 1.12rem; color: inherit; opacity: .88; max-width: 60ch; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0; }
.stats div { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); border-radius: var(--radius); padding: 16px; }
.stats dt { font-size: .82rem; opacity: .75; }
.stats dd { margin: 0; font-family: var(--serif); font-size: 2rem; font-weight: 700; }

/* Filtres */
.filters { display: grid; grid-template-columns: 2fr repeat(5, 1fr) auto; gap: 10px; align-items: end; background: var(--paper);
  padding: 16px; border-radius: var(--radius); box-shadow: var(--shadow); margin: -28px 0 18px; position: relative; z-index: 2; }
.filters-admin { grid-template-columns: 2fr repeat(3, 1fr) auto; margin: 0 0 14px; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.f-actions { display: flex; gap: 8px; }
input, select, textarea { font: inherit; font-size: 1rem; color: var(--ink); background: #fff; border: 1px solid #d6cdbb; border-radius: 10px; padding: 10px 12px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(10,106,173,.18); border-color: var(--blue); }
textarea { resize: vertical; min-height: 90px; }
.result-count { color: var(--muted); font-size: .92rem; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 10px; border: 1px solid #d6cdbb;
  background: #fff; color: var(--ink); font: 600 .95rem var(--sans); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--ink-2); }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: #08588f; border-color: #08588f; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #a71f3c; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 10px; font-size: .85rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* Cartes */
.grid { list-style: none; padding: 0; margin: 0 0 24px; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.card { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid transparent; transition: transform .15s, border-color .15s; }
.card:hover { transform: translateY(-2px); border-color: var(--line); }
.card-non_verifie { background: #fffdfb; }
.card-link { display: block; padding: 18px; color: inherit; text-decoration: none; height: 100%; }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.card-name { font-size: 1.15rem; margin-bottom: .2em; }
.card-ar { font-size: 1.1rem; margin: 0 0 .4em; color: var(--ink-2); text-align: left; }
.card-meta { font-size: .9rem; color: var(--ink-2); margin-bottom: .3em; }
.card-genres { font-size: .85rem; color: var(--muted); margin-bottom: .5em; }
.card-work { font-size: .88rem; font-style: italic; border-top: 1px dashed var(--line); padding-top: 8px; margin: 0; }

.avatar { width: 46px; height: 46px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font: 700 1rem var(--serif); flex: none; }
.avatar-lg { width: 84px; height: 84px; font-size: 1.8rem; }
.av0 { background: var(--red); } .av1 { background: var(--blue); } .av2 { background: var(--green); } .av3 { background: var(--orange); } .av4 { background: #b58a00; }

/* Badges */
.badge { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .04em; padding: 4px 9px; border-radius: 999px; line-height: 1.2; }
.badge-verifie { background: var(--ok-bg); color: var(--ok-fg); }
.badge-partiel { background: var(--warn-bg); color: var(--warn-fg); }
.badge-non_verifie { background: var(--bad-fg); color: #fff; text-transform: uppercase; }
.chip { display: inline-block; font-size: .78rem; padding: 3px 9px; border-radius: 999px; background: var(--sand); color: var(--ink-2); border: 1px solid var(--line); }

/* Fiche */
.profile { padding-top: 28px; padding-bottom: 40px; }
.crumbs { font-size: .9rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.profile-head { display: flex; gap: 20px; align-items: center; margin: 18px 0 24px; }
.profile-head h1 { margin-bottom: .1em; }
.profile-ar { font-size: 1.5rem; margin: 0 0 .3em; color: var(--ink-2); text-align: left; }
.facts { display: flex; flex-wrap: wrap; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 0 0 28px; }
.facts div { flex: 1 1 200px; padding: 14px 16px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0 -1px -1px 0; }
.facts dt { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 600; }
.block { background: var(--paper); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px; box-shadow: var(--shadow); }
.block ul, .block ol { margin: 0; padding-left: 1.2em; }
.block li { margin: 4px 0; }
.works li { font-style: italic; }
.sources { word-break: break-word; }
.legend div { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.legend dd { margin: 0; }
.updated { font-size: .85rem; }

/* Avertissements */
.notice { padding: 14px 16px; border-radius: 12px; margin: 12px 0 18px; border-left: 5px solid; }
.notice-danger { background: var(--bad-bg); color: var(--bad-fg); border-color: var(--bad-fg); }
.notice-warn { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--yellow); }
.empty { background: var(--paper); border-radius: var(--radius); padding: 40px; text-align: center; color: var(--ink-2); margin: 24px 0; }

/* Pagination */
.pagination { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin: 10px 0 40px; }
.pagination a, .pagination span { min-width: 40px; padding: 8px 12px; border-radius: 10px; text-align: center; text-decoration: none; background: var(--paper); color: var(--ink); border: 1px solid var(--line); }
.pagination .current { background: var(--ink); color: #fff; border-color: var(--ink); }
.pagination .dots { background: none; border: 0; }

/* Pied */
.site-footer { border-top: 1px solid var(--line); background: var(--paper); padding: 28px 0; margin-top: 40px; text-align: center; font-size: .9rem; color: var(--ink-2); }
.footer-logo { height: 40px; margin-bottom: 8px; }

/* Modales */
.modal { position: fixed; inset: 0; background: rgba(20,24,34,.55); display: none; align-items: center; justify-content: center; padding: 16px; z-index: 100; }
.modal.is-open { display: flex; }
.modal-box { background: #fff; border-radius: 16px; padding: 24px; width: 100%; max-width: 460px; box-shadow: 0 20px 60px rgba(0,0,0,.3); border-top: 6px solid var(--blue); animation: pop .18s ease-out; }
.modal-success { border-top-color: var(--green); }
.modal-error { border-top-color: var(--red); }
.modal-info { border-top-color: var(--orange); }
.modal-box ul { padding-left: 1.2em; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }

/* Administration */
.admin-header { border-bottom: 4px solid var(--blue); }
.admin-main { padding-top: 28px; padding-bottom: 20px; }
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.dash-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 12px; }
.kpi { background: var(--paper); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); border-top: 4px solid var(--ink-2); }
.kpi span { display: block; font-size: .8rem; color: var(--muted); }
.kpi strong { font-family: var(--serif); font-size: 1.8rem; }
.kpi-ok { border-top-color: var(--green); } .kpi-warn { border-top-color: var(--yellow); } .kpi-bad { border-top-color: var(--red); }
.progress { position: relative; height: 26px; background: #eadfcb; border-radius: 999px; overflow: hidden; margin-bottom: 22px; }
.progress div { height: 100%; background: var(--green); }
.progress span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; }
.table-wrap { overflow-x: auto; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: #fbf8f2; padding: 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 12px; border-bottom: 1px solid #f0e9dc; vertical-align: top; }
.table tr:hover td { background: #fffaf0; }
.table .btn { margin-left: 4px; }

.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .92rem; margin-bottom: 14px; }
.form .check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
.form .check input { width: auto; }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form fieldset { border: 0; background: var(--paper); border-radius: var(--radius); padding: 20px 22px 8px; margin: 0 0 16px; box-shadow: var(--shadow); }
.form legend { font-family: var(--serif); font-weight: 700; font-size: 1.15rem; padding: 0; float: left; width: 100%; margin-bottom: 14px; }
.form legend + * { clear: both; }
.help { font-weight: 400; color: var(--muted); font-size: .82rem; }
.error { font-weight: 600; color: var(--bad-fg); font-size: .85rem; }
.has-error input, .has-error textarea, .has-error select { border-color: var(--red); background: #fff8f9; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin: 8px 0 24px; }
.pw { display: flex; gap: 6px; }
.pw input { flex: 1; }
.pw-toggle { border: 1px solid #d6cdbb; background: #fbf8f2; border-radius: 10px; padding: 0 12px; cursor: pointer; font: 600 .82rem var(--sans); color: var(--ink-2); }
.two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.card-form { background: var(--paper); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-bottom: 16px; }
.auth-box { max-width: 420px; margin: 30px auto; background: var(--paper); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.auth-logo { display: block; height: 70px; margin: 0 auto 12px; }
.auth-box h1 { font-size: 1.5rem; text-align: center; }
.checklist { list-style: none; padding: 0; margin: 0 0 8px; }
.checklist li { padding: 6px 0 6px 30px; position: relative; }
.checklist li::before { position: absolute; left: 0; top: 6px; width: 20px; height: 20px; border-radius: 50%; color: #fff; font-size: .75rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.checklist .ok::before { content: "✓"; background: var(--green); }
.checklist .ko::before { content: "✕"; background: var(--red); }
.inline-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
textarea.code { font-family: Consolas, monospace; font-size: .85rem; }

/* Responsive */
@media (max-width: 980px) {
  .hero-inner { grid-template-columns: 1fr; padding-top: 36px; padding-bottom: 44px; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .f-search, .filters .f-actions { grid-column: 1 / -1; }
  .filters-admin { grid-template-columns: 1fr 1fr; }
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .two-cols { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .form .row { grid-template-columns: 1fr; }
  .profile-head { flex-direction: column; align-items: flex-start; }
  .legend div { grid-template-columns: 1fr; gap: 4px; }
  .brand small { display: none; }
  .site-nav { width: 100%; }
}
