:root {
  --navy: #1d3557;
  --navy-dark: #14263f;
  --gold: #b08d3c;
  --gold-soft: #f6efdd;
  --bg: #f4f2ed;
  --card: #fff;
  --text: #1c2733;
  --muted: #627080;
  --line: #dfdbd1;
  --ok: #1f7a4d;
  --ok-bg: #e6f4ec;
  --err: #b3261e;
  --err-bg: #fbe9e7;
  --info-bg: #e8eef6;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
a { color: var(--navy); }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; color: var(--navy-dark); line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.1rem; margin: 0; }
p { margin: 0 0 .8em; }

.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 24px; padding-bottom: 40px; min-height: 70vh; }

/* ---------- En-tête ---------- */
.topbar { background: var(--navy); color: #fff; border-bottom: 3px solid var(--gold); }
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-family: Georgia, serif; font-size: 1.25rem; }
.brand small { font-family: system-ui, sans-serif; font-size: .78rem; opacity: .75; margin-inline-start: 4px; }
.nav { display: flex; align-items: center; gap: 4px 18px; flex-wrap: wrap; font-size: .95rem; }
.nav a, .nav .linklike { color: #fff; text-decoration: none; opacity: .85; padding: 4px 0; border-bottom: 2px solid transparent; }
.nav a:hover, .nav .linklike:hover { opacity: 1; }
.nav a[aria-current] { opacity: 1; border-bottom-color: var(--gold); }
form.inline { display: inline; margin: 0; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--navy); text-decoration: underline; cursor: pointer; }
.nav .linklike { text-decoration: none; }

/* ---------- Blocs ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 22px; }
.narrow { max-width: 460px; margin-left: auto; margin-right: auto; margin-top: 24px; }
.narrow-left { max-width: 460px; }
.form-card { max-width: 760px; }
.center { text-align: center; }
.lead { font-size: 1.02rem; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.page-title { margin: 6px 0 18px; }
.callout { background: var(--gold-soft); border: 1px solid #e6d8ae; border-radius: var(--radius); padding: 18px; }
.empty { text-align: center; padding: 34px 22px; }

.flash { border-radius: 8px; padding: 11px 14px; margin-bottom: 16px; border: 1px solid transparent; }
.flash-ok { background: var(--ok-bg); color: #14532d; border-color: #b9dfc8; }
.flash-error { background: var(--err-bg); color: #7f1d1d; border-color: #f2c1bb; }
.flash-info { background: var(--info-bg); color: var(--navy-dark); border-color: #c9d6e8; }

/* ---------- Formulaires ---------- */
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
label .muted { font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=date], input[type=search], select {
  width: 100%; padding: 10px 11px; font: inherit; color: inherit; background: #fff;
  border: 1px solid #c4c0b5; border-radius: 7px; min-height: 44px;
}
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
input:disabled { background: #f1efea; color: var(--muted); }
fieldset { border: 0; padding: 0; margin: 0 0 8px; }
legend { font-family: Georgia, serif; font-size: 1.05rem; color: var(--navy-dark); padding: 0; margin-bottom: 10px; border-bottom: 1px solid var(--line); width: 100%; padding-bottom: 4px; }
.stack > label { margin-top: 12px; }
.stack > .btn { margin-top: 16px; }
.field { margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.gap-lg { gap: 0 22px; align-items: start; }
.hint { font-size: .82rem; color: var(--muted); margin: 4px 0 0; }
.field-error { color: var(--err); font-size: .88rem; margin: 4px 0 0; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 9px 18px;
  background: var(--navy); color: #fff; border: 1px solid var(--navy); border-radius: 7px;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--navy-dark); }
.btn-accent { background: var(--gold); border-color: var(--gold); }
.btn-accent:hover { background: #987830; }
.btn-ghost { background: #fff; color: var(--navy); border-color: #c4c0b5; }
.btn-ghost:hover { background: #f1efea; }
.btn-danger { color: var(--err); }
.btn-sm { min-height: 34px; padding: 4px 12px; font-size: .88rem; font-weight: 500; }

/* ---------- Recherche ---------- */
.search h1 { margin-bottom: 14px; }
.search-form { display: flex; gap: 0 14px; flex-wrap: wrap; align-items: flex-end; }
.search-form .field { flex: 1 1 160px; }
.search-form .grow { flex: 2 1 240px; }
.search-form .field-btn { flex: 0 0 auto; }
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.list-head p { margin: 0; }

/* ---------- Présences ---------- */
.listings { display: grid; gap: 12px; margin-bottom: 22px; }
.listing {
  display: grid; grid-template-columns: 230px 1fr auto; gap: 8px 22px; align-items: start;
  background: var(--card); border: 1px solid var(--line); border-inline-start: 4px solid var(--navy);
  border-radius: var(--radius); padding: 16px 18px;
}
.listing.is-current { border-inline-start-color: var(--gold); }
.listing.is-past { opacity: .7; }
.listing-when strong { display: block; font-family: Georgia, serif; font-size: 1.2rem; color: var(--navy-dark); line-height: 1.2; }
.listing-when span { display: block; color: var(--muted); font-size: .9rem; }
.listing-when time { display: block; margin-top: 6px; font-weight: 600; }
.badge { display: inline-block; margin-top: 6px; background: var(--gold-soft); color: #6f5516; border: 1px solid #e6d8ae; border-radius: 99px; padding: 1px 10px; font-size: .78rem; font-style: normal; font-weight: 600; }
.tag { display: inline-block; background: var(--info-bg); color: var(--navy); border-radius: 4px; padding: 0 6px; font: 600 .72rem/1.6 system-ui, sans-serif; vertical-align: middle; }
.listing-who p { margin: 4px 0 0; }
.contacts { display: flex; flex-wrap: wrap; gap: 4px 16px; font-weight: 500; }
.contacts a { overflow-wrap: anywhere; }
.comment { color: #3c4856; font-style: italic; }
.listing-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.listing-actions form { margin: 0; }
details.past { margin-bottom: 22px; }
details.past summary { cursor: pointer; color: var(--muted); margin-bottom: 12px; }

/* ---------- Administration ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stats div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; color: var(--muted); font-size: .9rem; }
.stats strong { display: block; font: 700 1.5rem Georgia, serif; color: var(--navy-dark); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: start; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: .82rem; }
td form { margin: 0; }

/* ---------- Langues ---------- */
.topbar-end { display: flex; align-items: center; gap: 6px 22px; flex-wrap: wrap; }
.langs { display: flex; gap: 2px; font-size: .82rem; }
.langs a { color: #fff; opacity: .7; text-decoration: none; padding: 3px 8px; border-radius: 5px; }
.langs a:hover { opacity: 1; }
.langs a[aria-current] { opacity: 1; background: rgba(255, 255, 255, .16); font-weight: 600; }
fieldset.checks { margin-bottom: 12px; }
.stack > fieldset.checks { margin-top: 12px; }
.checks legend.label { font: 600 .9rem system-ui, sans-serif; color: var(--text); border: 0; margin-bottom: 6px; padding: 0; }
.checks-list { display: flex; flex-wrap: wrap; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 7px; margin: 0; padding: 7px 12px; font-weight: 500; cursor: pointer;
  background: #fff; border: 1px solid #c4c0b5; border-radius: 99px; }
.check:has(input:checked) { background: var(--info-bg); border-color: var(--navy); }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--navy); }

/* ---------- Hébreu (droite à gauche) ---------- */
[dir=rtl] input[type=email], [dir=rtl] input[type=tel], [dir=rtl] input[type=password] { direction: ltr; text-align: right; }
[dir=rtl] .comment { font-style: normal; }
[dir=rtl] .contacts { justify-content: flex-start; }

.foot { color: var(--muted); font-size: .8rem; text-align: center; padding-top: 0; padding-bottom: 28px; }

@media (max-width: 720px) {
  h1 { font-size: 1.35rem; }
  .card { padding: 16px; }
  .grid2 { grid-template-columns: 1fr; }
  .listing { grid-template-columns: 1fr; }
  .listing-actions { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .search-form .field-btn, .search-form .field-btn .btn { width: 100%; flex-basis: 100%; }
  .list-head .btn { width: 100%; }
  .brand small { display: none; }
}
