*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --ink: #1a2332;
    --ink-soft: #6b7688;
    --ink-faint: #9aa3b2;
    --line: #d7dbe4;
    --paper: #ffffff;
    --surface: #f7f8fb;

    --parent: #5b21b6;
    --parent-soft: #f3edfc;
    --admin: #075985;
    --admin-soft: #eaf4fa;
    --animateur: #065f46;
    --animateur-soft: #e7f5f0;
    --superadmin: #1a2332;
    --superadmin-soft: #eef0f4;

    --danger: #b3261e;
    --danger-soft: #fdecea;
    --ok: #15803d;
    --ok-soft: #e9f7ef;
}

body {
    font-family: -apple-system, 'Segoe UI', Arial, sans-serif;
    color: var(--ink);
    background: var(--surface);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, .brand {
    font-family: Georgia, 'Iowan Old Style', 'Palatino Linotype', serif;
}

a { color: inherit; }

/* ── Public header/footer ── */
.site-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.75rem;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.05rem; text-decoration: none; color: var(--ink); }
.brand img { height: 36px; width: auto; }
.brand .brand-fallback {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 8px;
    background: var(--parent); color: #fff; font-weight: 800; font-size: .9rem;
}
.header-actions { display: flex; align-items: center; gap: .7rem; font-size: .85rem; }

.site-footer {
    margin-top: auto;
    padding: 1.5rem 1.75rem;
    background: var(--paper);
    border-top: 1px solid var(--line);
    display: flex; align-items: center; justify-content: space-between;
    font-size: .78rem; color: var(--ink-soft);
}
.site-footer a { color: var(--ink-soft); text-decoration: underline; }

/* ── Buttons ── */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .85rem; font-weight: 700;
    padding: .6rem 1.2rem;
    border-radius: 6px; border: 1px solid transparent;
    cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--parent); color: #fff; }
.btn-primary:hover { opacity: .92; }
.btn-outline { background: var(--paper); color: var(--ink); border-color: var(--line); }
.btn-outline:hover { background: var(--surface); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ok { background: var(--ok); color: #fff; }
.btn-sm { padding: .4rem .8rem; font-size: .78rem; }

/* ── Home page ── */
.hero {
    max-width: 760px; margin: 0 auto; padding: 4.5rem 1.5rem 3rem; text-align: center;
}
.hero .logo-big { height: 72px; margin-bottom: 1.2rem; }
.hero h1 { font-size: 2.1rem; font-weight: 700; text-wrap: balance; }
.hero p { margin-top: 1.1rem; color: var(--ink-soft); line-height: 1.6; font-size: .95rem; }
.hero .actions { margin-top: 1.8rem; display: flex; gap: .8rem; justify-content: center; }

/* ── Forms (auth pages) ── */
.auth-wrap { max-width: 400px; margin: 3.5rem auto; padding: 0 1.5rem; }
.auth-card { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 2rem; box-shadow: 0 4px 18px rgba(26,35,50,.06); }
.auth-card h1 { font-size: 1.3rem; margin-bottom: 1.5rem; }
.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; }
.field label { font-size: .78rem; font-weight: 600; }
.field input {
    font: inherit; font-size: .88rem; padding: .6rem .75rem;
    border: 1px solid var(--line); border-radius: 5px; background: var(--paper); color: var(--ink);
}
.field input:focus { outline: 2px solid var(--parent); outline-offset: 1px; }
.form-errors {
    background: var(--danger-soft); border: 1px solid #f3c8c5; color: var(--danger);
    border-radius: 6px; padding: .7rem .9rem; font-size: .8rem; margin-bottom: 1rem;
}
.form-success {
    background: var(--ok-soft); border: 1px solid #b9e4c9; color: var(--ok);
    border-radius: 6px; padding: .7rem .9rem; font-size: .8rem; margin-bottom: 1rem;
}
.auth-card .switch-link { margin-top: 1.2rem; font-size: .82rem; text-align: center; color: var(--ink-soft); }
.auth-card .switch-link a { color: var(--parent); font-weight: 700; text-decoration: none; }
.auth-card button[type="submit"] { width: 100%; margin-top: .3rem; }

/* ── Espace (authenticated area) layout ── */
.espace {
    display: flex; flex: 1; min-height: 0;
}
.espace-sidebar {
    width: 250px; flex-shrink: 0;
    background: var(--paper); border-right: 1px solid var(--line);
    padding: 1.4rem 1rem;
    display: flex; flex-direction: column;
}
.espace-sidebar .role-tag {
    display: inline-block; align-self: flex-start;
    font-size: .64rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
    padding: .25rem .55rem; border-radius: 4px; margin-bottom: 1.3rem;
    color: #fff;
}
.espace-sidebar nav { display: flex; flex-direction: column; gap: .2rem; flex: 1; }
.espace-sidebar nav a {
    display: block; padding: .55rem .7rem; border-radius: 6px;
    font-size: .84rem; text-decoration: none; color: var(--ink-soft);
}
.espace-sidebar nav a:hover { background: var(--surface); color: var(--ink); }
.espace-sidebar nav a.active { background: var(--surface); color: var(--ink); font-weight: 700; }
.espace-sidebar .user-box { border-top: 1px solid var(--line); padding-top: 1rem; margin-top: 1rem; font-size: .78rem; color: var(--ink-soft); }
.espace-sidebar .user-box form { margin-top: .5rem; }

.espace-main { flex: 1; padding: 2.2rem 2.5rem; }
.espace-main h1 { font-size: 1.4rem; margin-bottom: .3rem; }
.espace-main .lead { color: var(--ink-soft); font-size: .85rem; margin-bottom: 1.8rem; }

.section { margin-bottom: 2.4rem; }
.section h2 { font-family: Georgia, 'Iowan Old Style', serif; font-size: 1.05rem; margin-bottom: 1rem; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
.menu-card {
    display: block; text-decoration: none; color: inherit;
    background: var(--paper); border: 1px solid var(--line); border-radius: 8px;
    padding: 1.1rem 1.2rem;
}
.menu-card:hover { border-color: var(--ink-faint); }
.menu-card .t { font-weight: 700; font-size: .92rem; margin-bottom: .3rem; }
.menu-card .d { font-size: .76rem; color: var(--ink-soft); }

.placeholder-box {
    border: 1.5px dashed var(--line); border-radius: 8px;
    padding: 3rem 2rem; text-align: center; color: var(--ink-soft); font-size: .9rem;
    background: var(--paper);
}

.toggle-box { display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 1.2rem 1.4rem; max-width: 480px; }
.status-pill { display: inline-block; font-size: .7rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: .25rem .6rem; border-radius: 999px; }
.status-pill.on { background: var(--danger-soft); color: var(--danger); }
.status-pill.off { background: var(--ok-soft); color: var(--ok); }
.status-pill.publie { background: var(--ok-soft); color: var(--ok); }
.status-pill.brouillon { background: var(--surface); color: var(--ink-soft); }

/* ── Tables de données ── */
.data-table { width: 100%; border-collapse: collapse; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; font-size: .85rem; }
.data-table th, .data-table td { padding: .65rem .9rem; text-align: left; border-bottom: 1px solid var(--line); }
.data-table th { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); background: var(--surface); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface); }
.data-table-actions { display: flex; gap: .5rem; white-space: nowrap; }
.data-table-actions form { display: inline; }

/* ── Planning vacances sportives ── */
.planning-nav {
    display: flex; align-items: center; gap: 1rem;
    margin-bottom: 1.6rem;
}
.planning-nav .semaine-label { display: flex; flex-direction: column; align-items: center; min-width: 240px; text-align: center; }
.planning-nav .semaine-numero { font-family: Georgia, 'Iowan Old Style', serif; font-size: 1.35rem; font-weight: 700; color: var(--admin); line-height: 1.2; }
.planning-nav .semaine-dates { font-size: .78rem; color: var(--ink-soft); }
.planning-nav a.btn { text-decoration: none; }

.planning-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: .8rem;
    align-items: start;
}
.planning-day { display: flex; flex-direction: column; gap: .45rem; }
.planning-day-head {
    text-align: center; font-size: .78rem; font-weight: 700;
    padding-bottom: .4rem; border-bottom: 2px solid var(--line);
    text-transform: capitalize;
}
.planning-day-head.aujourdhui { color: var(--admin); border-bottom-color: var(--admin); }
.planning-day-head .d { display: block; font-weight: 400; color: var(--ink-soft); font-size: .72rem; }

.creneau-cell {
    border-radius: 6px; border: 1px solid var(--line);
    padding: .6rem .6rem .5rem;
    text-align: center;
    background: var(--surface);
}
.creneau-cell.ouvert { background: #eaf7ee; border-color: #bfe6cc; }
.creneau-cell.ferme { background: #eef0f4; border-color: var(--line); }
.creneau-cell.cantine { padding: .35rem .5rem .3rem; }
.creneau-cell .label { font-size: .64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); margin-bottom: .3rem; }
.creneau-cell .effectif { font-size: 1.15rem; font-weight: 800; color: var(--ok); line-height: 1; }
.creneau-cell.cantine .effectif { font-size: .95rem; }
.creneau-cell .effectif small { display: block; font-size: .6rem; font-weight: 600; color: var(--ink-soft); text-transform: none; margin-top: .15rem; }
.creneau-cell form { display: flex; gap: .3rem; align-items: center; justify-content: center; margin-top: .3rem; }
.creneau-cell input[type="number"] {
    width: 3.6rem; font-size: .78rem; padding: .3rem .35rem;
    border: 1px solid var(--line); border-radius: 4px; text-align: center;
}
.creneau-cell .btn-cell {
    font-size: .65rem; font-weight: 700; padding: .3rem .4rem; border-radius: 4px; border: 1px solid transparent; cursor: pointer;
}
.creneau-cell.ferme .btn-cell { background: var(--ok); color: #fff; }
.creneau-cell.ouvert .btn-cell.enregistrer { background: var(--admin); color: #fff; }
.creneau-cell .btn-fermer { display: block; margin: .35rem auto 0; background: none; border: none; color: var(--danger); font-size: .65rem; text-decoration: underline; cursor: pointer; }

.btn-dupliquer {
    font-size: .62rem; font-weight: 700; padding: .25rem .5rem;
    display: block; width: 100%; border: 1px solid var(--line); border-radius: 4px;
    background: var(--paper); color: var(--ink-soft); cursor: pointer;
}
.btn-dupliquer:hover { background: var(--surface); color: var(--ink); }

.dup-dialog {
    position: relative;
    border: none; border-radius: 8px; padding: 1.4rem 1.5rem;
    max-width: 340px; width: 90vw;
    box-shadow: 0 10px 40px rgba(26,35,50,.25);
    font-family: -apple-system, 'Segoe UI', Arial, sans-serif;
}
.dup-dialog::backdrop { background: rgba(26,35,50,.45); }
.dup-dialog h3 { font-size: .98rem; margin-bottom: 1.1rem; padding-right: 1.5rem; font-family: Georgia, 'Iowan Old Style', serif; }
.dup-dialog .dialog-close {
    position: absolute; top: .8rem; right: .9rem;
    background: none; border: none; font-size: .85rem; color: var(--ink-soft); cursor: pointer;
}
.dup-option { display: flex; align-items: center; gap: .5rem; font-size: .8rem; margin-bottom: 1rem; flex-wrap: wrap; line-height: 1.3; }
.dup-option input[type="date"] { font: inherit; font-size: .76rem; padding: .32rem .45rem; border: 1px solid var(--line); border-radius: 5px; margin-left: auto; }
.dup-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: .5rem; }

.planning-evenements { display: flex; flex-direction: column; gap: .3rem; min-height: 1.2rem; }
.planning-evenement {
    background: var(--parent-soft); border: 1px solid #ded0f7; border-radius: 5px;
    padding: .35rem .5rem; font-size: .68rem; color: var(--parent);
}
.planning-evenement .nom { font-weight: 700; display: block; }
.planning-evenement .infos { color: #6b4fa0; }

/* ── Legal page ── */
.legal { max-width: 760px; margin: 0 auto; padding: 3rem 1.5rem 4rem; }
.legal h1 { font-size: 1.5rem; margin-bottom: .3rem; }
.legal .lead { color: var(--ink-soft); font-size: .82rem; margin-bottom: 2rem; }
.legal section { margin-bottom: 1.6rem; }
.legal h2 { font-size: 1rem; margin-bottom: .5rem; }
.legal p { font-size: .87rem; line-height: 1.65; color: #3d4758; }
.legal .todo { color: var(--danger); font-style: italic; }
