:root {
    --bg: #f4f5f7;
    --card: #ffffff;
    --ink: #1f2733;
    --muted: #6b7785;
    --line: #dfe3e8;
    --primary: #2f6f4f;
    --primary-d: #245c41;
    --pos: #1d7a3a;
    --neg: #b5341f;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.45;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--primary);
    color: #fff;
    padding: .7rem 1.1rem;
    flex-wrap: wrap;
}
.brand { color: #fff; font-weight: 700; text-decoration: none; font-size: 1.1rem; }
.topbar nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.topbar nav a {
    color: #eef5f0; text-decoration: none; padding: .35rem .7rem; border-radius: 6px; font-size: .92rem;
}
.topbar nav a:hover { background: rgba(255,255,255,.15); }
.topbar nav a.logout { opacity: .85; }

.container { max-width: 940px; margin: 1.2rem auto; padding: 0 1rem; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 1.1rem 1.2rem;
    margin-bottom: 1.1rem;
    box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.card h1 { margin: .1rem 0 .6rem; font-size: 1.3rem; }
.card h2 { margin: .1rem 0 .6rem; font-size: 1.1rem; }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.big { font-size: 1.05rem; }
.hint { color: var(--muted); font-size: .88rem; }

label { display: block; margin: .6rem 0; font-size: .92rem; color: var(--muted); }
label.short { max-width: 220px; }
label.check { display: flex; align-items: center; gap: .5rem; color: var(--ink); }
label.check input { width: auto; }

input[type=text], input[type=password], input[type=date], textarea {
    width: 100%;
    margin-top: .25rem;
    padding: .5rem .6rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
    color: var(--ink);
    background: #fff;
}
textarea { resize: vertical; }

.btn {
    display: inline-block;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    padding: .5rem .9rem;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    font: inherit;
}
.btn:hover { background: #f0f2f4; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-d); }
.btn.danger { background: #fff; border-color: #e53e3e; color: #e53e3e; }
.btn.danger:hover { background: #e53e3e; color: #fff; }

.actions-bar { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }
.inline { display: flex; gap: .8rem; align-items: flex-end; flex-wrap: wrap; }

.alert { padding: .55rem .8rem; border-radius: 8px; margin: .5rem 0; }
.alert.ok { background: #e6f4ea; color: var(--pos); }
.alert.error { background: #fbeae7; color: var(--neg); }

.badge { font-size: .78rem; padding: .12rem .55rem; border-radius: 999px; }
.badge.brouillon { background: #fff3d6; color: #8a6d1a; }
.badge.envoye { background: #e6f4ea; color: var(--pos); }

.table-wrap { overflow-x: auto; }
.grid-table { width: 100%; border-collapse: collapse; margin-top: .5rem; }
.grid-table th, .grid-table td { border: 1px solid var(--line); padding: .45rem .5rem; text-align: left; font-size: .9rem; }
.grid-table thead th { background: #f7f8f9; }
.grid-table tfoot th { background: #f7f8f9; }
.grid-table .actions a { margin-right: .5rem; }

.horaires th, .horaires td { text-align: center; }
.horaires .rowlabel { background: #f7f8f9; font-weight: 600; }
.horaires .cell { min-width: 78px; }
.horaires .hin { text-align: center; padding: .3rem; margin: .1rem 0; }
.horaires .totaux td, .horaires .totaux th { background: #f7f8f9; font-weight: 600; }

.pos { color: var(--pos); }
.neg { color: var(--neg); }

.login-card { max-width: 360px; margin: 3rem auto; }

.footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 1.5rem; }

/* ---- Page d'aide ---- */
.guide h2 { margin-top: .2rem; border-bottom: 2px solid var(--primary); padding-bottom: .3rem; }
.guide h3 { margin: 1.1rem 0 .3rem; color: var(--primary-d); }
.guide p, .guide li { font-size: .96rem; }
.steps { list-style: none; padding: 0; margin: .5rem 0; }
.steps > li { position: relative; padding: .1rem 0 .9rem 2.4rem; }
.steps > li::before { counter-increment: step; content: counter(step); position: absolute; left: 0; top: 0;
    width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .9rem; }
.steps { counter-reset: step; }
.callout { background: #eef5f0; border-left: 4px solid var(--primary); border-radius: 6px;
    padding: .7rem .9rem; margin: .8rem 0; font-size: .92rem; }
.callout.warn { background: #fdf4e7; border-left-color: #c9852b; }
.tag { display: inline-block; background: #eef1f4; border: 1px solid var(--line); border-radius: 5px;
    padding: .05rem .4rem; font-size: .85rem; font-weight: 600; }
.toc { columns: 2; font-size: .92rem; }
@media (max-width: 560px){ .toc { columns: 1; } }
