:root {
    --bni-red:      #C8102E;
    --bni-red-dark: #9e0c24;
    --ink:          #15202b;
    --ink-soft:     #4a5a68;
    --muted:        #7c8a97;
    --line:         #e3e8ed;
    --bg:           #f4f6f8;
    --card:         #ffffff;
    --radius:       12px;
    --shadow:       0 1px 2px rgba(21,32,43,.06), 0 8px 24px rgba(21,32,43,.06);
    --success:      #1a7f4b;
    --error:        #c0392b;
    --info:         #2c6fb0;
    font-synthesis: none;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--bni-red); }

/* ---------- Marque (neutre, sans logo officiel) ---------- */
.brand { display: inline-flex; align-items: baseline; gap: .5rem; text-decoration: none; }
.brand__name {
    font-weight: 800; letter-spacing: .2px; font-size: 1.2rem;
    color: var(--ink); line-height: 1;
}
.brand__sub { color: var(--muted); font-weight: 600; font-size: .9rem; }

/* ================= Pages d'authentification ================= */
.auth-body {
    min-height: 100vh;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 2rem 1rem;
    background:
        radial-gradient(1200px 500px at 50% -10%, rgba(200,16,46,.08), transparent 60%),
        var(--bg);
}
.auth-card {
    width: 100%; max-width: 600px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2.5rem 2.25rem;
    text-align: center;
}
.auth-tagline { color: var(--ink); font-size: 1.05rem; font-weight: 700; margin: 0 0 1.75rem; }
/* Desktop : titre sur une seule ligne. Mobile étroit : retour à la ligne autorisé. */
@media (min-width: 640px) {
    .auth-tagline { white-space: nowrap; }
}
.auth-h2 { font-size: 1.15rem; margin: .25rem 0 1.25rem; }
.auth-help { color: var(--ink-soft); font-size: .9rem; text-align: left; margin: 0 0 1rem; }
.auth-link {
    display: inline-block; margin-top: 1.25rem;
    font-size: .9rem; color: var(--ink-soft); text-decoration: none;
}
.auth-link:hover { color: var(--bni-red); text-decoration: underline; }
.auth-footer { margin-top: 1.5rem; }

/* ================= Formulaires ================= */
.form { text-align: left; }
.form--grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.25rem;
}
.field { display: block; margin-bottom: 1rem; }
.form--grid .field { margin-bottom: 0; }
.field--submit { grid-column: 1 / -1; }
.field__label { display: block; font-size: .85rem; font-weight: 600; color: var(--ink-soft); margin-bottom: .35rem; }
.field .opt { font-weight: 400; color: var(--muted); }
.field input, .field select, .field textarea {
    width: 100%; padding: .65rem .75rem;
    border: 1px solid var(--line); border-radius: 8px;
    font-size: 1rem; color: var(--ink); background: #fff;
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; min-height: 2.5rem; }
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--bni-red);
    box-shadow: 0 0 0 3px rgba(200,16,46,.12);
}
.field--full { grid-column: 1 / -1; }

/* ================= Boutons ================= */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: .4rem; cursor: pointer; border: 1px solid transparent;
    border-radius: 8px; font-size: .95rem; font-weight: 600;
    padding: .6rem 1.1rem; text-decoration: none;
    transition: background .15s, border-color .15s, color .15s;
}
.btn--primary { background: var(--bni-red); color: #fff; }
.btn--primary:hover { background: var(--bni-red-dark); }
.btn--ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--muted); }
.btn--danger { background: #fff; color: var(--error); border-color: #f0c9c4; }
.btn--danger:hover { background: var(--error); color: #fff; }
.btn--block { width: 100%; margin-top: .5rem; }
.btn--sm { padding: .45rem .8rem; font-size: .85rem; }
.btn--xs { padding: .3rem .6rem; font-size: .78rem; }

/* ================= Barre supérieure ================= */
.topbar { background: #fff; border-bottom: 1px solid var(--line); }
.topbar__inner {
    max-width: 1080px; margin: 0 auto; padding: .75rem 1.25rem;
    display: flex; align-items: center; gap: 1.5rem;
}
.nav { display: flex; gap: 1.25rem; flex: 1; }
.nav a { color: var(--ink-soft); text-decoration: none; font-weight: 600; font-size: .92rem; }
.nav a:hover { color: var(--bni-red); }
.topbar__user { display: flex; align-items: center; gap: .6rem; }
.topbar__name { font-size: .9rem; color: var(--ink-soft); }
.badge {
    background: var(--bni-red); color: #fff; font-size: .7rem; font-weight: 700;
    padding: .15rem .5rem; border-radius: 99px; text-transform: uppercase; letter-spacing: .3px;
}

/* ================= Contenu ================= */
.container { max-width: 1080px; margin: 0 auto; padding: 2rem 1.25rem 3rem; }
.page-title { font-size: 1.6rem; margin: 0 0 1.5rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem; }

.card {
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 1.5rem; margin-bottom: 1.25rem;
}
.card__title { font-size: 1.05rem; margin: 0 0 1rem; }
.card__actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }
.card--meeting { border-top: 3px solid var(--bni-red); }

.meeting-date { font-size: 1.5rem; font-weight: 700; color: var(--bni-red); margin: .25rem 0 .5rem; text-transform: capitalize; }
.meeting-info { color: var(--ink-soft); font-size: .9rem; }
.meeting-empty { color: var(--muted); }
.muted { color: var(--muted); }
.stat { font-size: 1rem; }
.stat__num { font-size: 1.6rem; font-weight: 800; color: var(--bni-red); }

/* ================= Tableau ================= */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { text-align: left; padding: .7rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); }
.table tbody tr:hover { background: #fafbfc; }
.actions { white-space: nowrap; display: flex; gap: .4rem; }
.inline { display: inline; margin: 0; }

/* ================= Statuts invités ================= */
.card--invites { border-top: 3px solid #2c6fb0; }
.status-select {
    padding: .35rem .5rem; border-radius: 6px; font-size: .85rem; font-weight: 600;
    border: 1px solid var(--line); cursor: pointer; background: #fff;
}
.status-select.status--en_attente    { background: #fff6e5; border-color: #f0d699; color: #8a5a00; }
.status-select.status--interesse     { background: #eaf2fb; border-color: #c4ddf5; color: #2c6fb0; }
.status-select.status--invite        { background: #e8f6ee; border-color: #bfe6cf; color: #1a7f4b; }
.status-select.status--pas_interesse { background: #f3f4f6; border-color: #d9dee3; color: #7c8a97; }

/* ================= Modèles de message ================= */
.section-title { margin: 2.25rem 0 .25rem; font-size: 1.25rem; }
.section-sub { margin: 0 0 1.25rem; }
.tpl-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.tpl-head .card__title { margin: 0; }
.tpl-area {
    width: 100%;
    font-family: ui-monospace, Menlo, Consolas, "Courier New", monospace;
    font-size: .82rem; line-height: 1.5;
    border: 1px solid var(--line); border-radius: 8px; padding: .75rem;
    resize: vertical; background: #fafbfc; color: var(--ink);
}
.tpl-area--subject { margin-bottom: 1.75rem; }
.tpl-head--sub { margin-top: .25rem; }

/* ================= Modale invité ================= */
.modal {
    border: none; border-radius: var(--radius); padding: 0;
    max-width: 520px; width: 92%;
    box-shadow: 0 20px 60px rgba(21,32,43,.25);
    color: var(--ink);
}
.modal::backdrop { background: rgba(21,32,43,.5); }
.modal__head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.25rem; border-bottom: 1px solid var(--line);
}
.modal__title { margin: 0; font-size: 1.15rem; }
.modal__close {
    background: none; border: none; font-size: 1.6rem; line-height: 1;
    cursor: pointer; color: var(--muted); padding: 0 .25rem;
}
.modal__close:hover { color: var(--ink); }
.modal__body { padding: 1.25rem; }
.modal__subtitle {
    font-size: .78rem; text-transform: uppercase; letter-spacing: .3px;
    color: var(--muted); margin: 1.25rem 0 .5rem; font-weight: 700;
}
.detail { display: grid; grid-template-columns: auto 1fr; gap: .35rem .9rem; margin: 0; }
.detail dt { color: var(--muted); font-weight: 600; font-size: .9rem; }
.detail dd { margin: 0; font-size: .9rem; }
.modal .note-form textarea { width: 100%; }
.journal { list-style: none; padding: 0; margin: 0; font-size: .88rem; }
.journal li {
    padding: .45rem 0; border-bottom: 1px solid var(--line);
    display: flex; flex-wrap: wrap; gap: .4rem; align-items: center;
}
.journal li:last-child { border-bottom: none; }
.journal__date { color: var(--muted); font-variant-numeric: tabular-nums; }
.journal__status { padding: .1rem .5rem; border-radius: 99px; font-size: .78rem; font-weight: 600; }
.journal__status.status--en_attente    { background: #fff6e5; color: #8a5a00; }
.journal__status.status--interesse      { background: #eaf2fb; color: #2c6fb0; }
.journal__status.status--invite         { background: #e8f6ee; color: #1a7f4b; }
.journal__status.status--pas_interesse  { background: #f3f4f6; color: #7c8a97; }
.modal__footer { margin-top: 1.5rem; }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem 1rem; margin-bottom: 1rem; }
.modal-grid .field { margin-bottom: 0; }
@media (max-width: 480px) { .modal-grid { grid-template-columns: 1fr; } }

/* ================= Commentaire invité ================= */
.guest-note { max-width: 260px; min-width: 180px; }
.note-text {
    font-size: .85rem; color: var(--ink-soft);
    background: #fafbfc; border: 1px solid var(--line); border-radius: 6px;
    padding: .4rem .55rem; margin-bottom: .35rem; white-space: pre-wrap;
}
.guest-note details summary {
    font-size: .8rem; color: var(--bni-red); cursor: pointer; font-weight: 600;
    list-style: none;
}
.guest-note details summary::-webkit-details-marker { display: none; }
.guest-note details summary::before { content: "✎ "; }
.note-form { margin-top: .5rem; }
.note-form textarea {
    width: 100%; font-family: inherit; font-size: .85rem;
    border: 1px solid var(--line); border-radius: 6px; padding: .45rem .55rem;
    resize: vertical; margin-bottom: .4rem;
}
.note-form textarea:focus { outline: none; border-color: var(--bni-red); box-shadow: 0 0 0 3px rgba(200,16,46,.12); }

/* ================= Bannière aperçu membre ================= */
.preview-banner {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    flex-wrap: wrap;
    background: #fff6e5; border: 1px solid #f0d699; color: #8a5a00;
    padding: .65rem 1rem; border-radius: 8px; margin-bottom: 1.25rem;
    font-size: .9rem; font-weight: 600;
}
.preview-banner .btn { flex-shrink: 0; }

/* ================= Messages flash ================= */
.flash {
    text-align: left; padding: .75rem 1rem; border-radius: 8px;
    font-size: .9rem; margin-bottom: 1rem; border: 1px solid transparent;
}
.flash--success { background: #e8f6ee; color: var(--success); border-color: #bfe6cf; }
.flash--error   { background: #fdecea; color: var(--error);   border-color: #f5c6c0; }
.flash--info    { background: #eaf2fb; color: var(--info);    border-color: #c4ddf5; }

/* ================= Pieds de page ================= */
.appfooter { text-align: center; padding: 1.5rem; }
.credit { font-size: .8rem; color: var(--muted); margin: 0; }
.credit a { color: var(--ink-soft); font-weight: 600; text-decoration: none; }
.credit a:hover { color: var(--bni-red); }

@media (max-width: 560px) {
    .form--grid { grid-template-columns: 1fr; }
    .topbar__inner { flex-wrap: wrap; gap: .75rem 1rem; }
    .nav { order: 3; flex-basis: 100%; }
}
