/* MaChasse — feuille de style unique, pensee mobile d'abord.
   Les ecrans de saisie sont utilises au telephone, souvent avec des gants :
   cibles tactiles a 44px minimum, une colonne par defaut. */

:root {
    --vert: #2f4f38;
    --vert-clair: #46704f;
    --vert-pale: #e8efe8;
    --sable: #f6f3ec;
    --brun: #7a5c3e;
    --ocre: #b8862f;
    --rouge: #a4342c;
    --texte: #22261f;
    --texte-doux: #5d6357;
    --bordure: #d9d5c9;
    --blanc: #fff;
    --radius: 10px;
    --ombre: 0 1px 3px rgba(0, 0, 0, .08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--texte);
    background: var(--sable);
}

a { color: var(--vert); }

h1, h2, h3 { line-height: 1.25; margin: 0 0 .6rem; }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }

/* ── En-tete et navigation ─────────────────────────────────────────────── */

.topbar {
    background: var(--vert);
    color: var(--blanc);
    padding: .7rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar a { color: var(--blanc); text-decoration: none; }
.brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: .02em;
    /* Le bloc de marque ne pousse pas les boutons hors de l'ecran sur un
       telephone etroit : c'est lui qui se comprime. */
    min-width: 0;
}
.brand-logo {
    width: 36px;
    height: 36px;
    flex: none;
    border-radius: 8px;
    display: block;
}
.brand-text { min-width: 0; }
.brand small { display: block; font-weight: 400; font-size: .72rem; opacity: .8; }

.topbar-actions { display: flex; align-items: center; gap: .5rem; }

/* Accueil et menu : memes dimensions, cible tactile de 44px minimum. */
.nav-toggle,
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0 .7rem;
    background: rgba(255, 255, 255, .15);
    border: 0;
    border-radius: var(--radius);
    color: var(--blanc);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
}
.nav-toggle:hover,
.icon-btn:hover { background: rgba(255, 255, 255, .28); }

/* La page courante : l'icone reste visible mais cesse d'inviter au clic. */
.icon-btn[aria-current="page"] { background: rgba(0, 0, 0, .22); }

.icon-btn svg {
    width: 22px;
    height: 22px;
    display: block;
    fill: currentColor;
}

.nav {
    display: none;
    background: var(--vert-clair);
    padding: .4rem 0;
}
.nav.open { display: block; }
.nav a {
    display: block;
    color: var(--blanc);
    text-decoration: none;
    padding: .75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
}
.nav a.active { background: rgba(0, 0, 0, .18); font-weight: 600; }
.nav .nav-section {
    padding: .6rem 1rem .2rem;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    opacity: .75;
}

/* ── Structure ─────────────────────────────────────────────────────────── */

.page { padding: 1rem; max-width: 1100px; margin: 0 auto; }
.page-head { margin-bottom: 1rem; }
.page-head .subtitle { color: var(--texte-doux); font-size: .9rem; }

.card {
    background: var(--blanc);
    border: 1px solid var(--bordure);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--ombre);
}
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .75rem;
}

.grid { display: grid; gap: 1rem; }
@media (min-width: 760px) {
    .grid-2 { grid-template-columns: 1fr 1fr; }
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

.muted { color: var(--texte-doux); }
.small { font-size: .85rem; }
.empty { color: var(--texte-doux); font-style: italic; padding: .5rem 0; }
.right { text-align: right; }
.stack > * + * { margin-top: .6rem; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.inline-form { display: inline; }

/* ── Chiffres cles ─────────────────────────────────────────────────────── */

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
@media (min-width: 620px) { .stats { grid-template-columns: repeat(4, 1fr); } }

.stat {
    background: var(--vert-pale);
    border-radius: var(--radius);
    padding: .6rem .7rem;
    text-align: center;
}
.stat .value { font-size: 1.5rem; font-weight: 700; color: var(--vert); line-height: 1.1; }
.stat .label { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--texte-doux); }

/* ── Formulaires ───────────────────────────────────────────────────────── */

.field { margin-bottom: .8rem; }
.field label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: .25rem; }

input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], input[type=tel], select, textarea {
    width: 100%;
    padding: .65rem .7rem;
    font: inherit;
    color: inherit;
    background: var(--blanc);
    border: 1px solid var(--bordure);
    border-radius: var(--radius);
    min-height: 44px;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--vert-clair);
    outline-offset: 1px;
    border-color: var(--vert-clair);
}

.field-row { display: grid; gap: .8rem; }
@media (min-width: 620px) { .field-row-2 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 620px) { .field-row-3 { grid-template-columns: repeat(3, 1fr); } }

/* Cases a cocher : toute la ligne est cliquable, pratique au doigt. */
.check {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .55rem .6rem;
    border: 1px solid var(--bordure);
    border-radius: var(--radius);
    background: var(--blanc);
    cursor: pointer;
    font-size: .92rem;
    min-height: 44px;
}
.check input { width: 20px; height: 20px; margin: 0; flex: none; }
.check-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; }
@media (min-width: 620px) { .check-row { grid-template-columns: repeat(4, 1fr); } }

/* ── Boutons ───────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    min-height: 44px;
    padding: .6rem 1rem;
    font: inherit;
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: var(--vert);
    color: var(--blanc);
    text-decoration: none;
    cursor: pointer;
}
.btn:hover { background: var(--vert-clair); }
.btn-block { width: 100%; }
.btn-secondary { background: var(--blanc); color: var(--vert); border-color: var(--bordure); }
.btn-secondary:hover { background: var(--vert-pale); }
.btn-danger { background: var(--rouge); }
.btn-danger:hover { background: #8d2c25; }
.btn-small { min-height: 36px; padding: .3rem .65rem; font-size: .85rem; }
.btn-link {
    background: none; border: 0; color: var(--rouge);
    padding: .3rem; font: inherit; cursor: pointer; text-decoration: underline;
    min-height: 36px;
}

/* ── Messages ──────────────────────────────────────────────────────────── */

.alert {
    padding: .75rem .9rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    border: 1px solid;
    font-size: .93rem;
}
.alert-success { background: #eaf3ea; border-color: #b9d6bb; color: #2a5c30; }
.alert-danger  { background: #fbeceb; border-color: #e8bab6; color: #8d2c25; }
.alert-warning { background: #fdf4e3; border-color: #e8d2a0; color: #7a5a17; }
.alert-info    { background: #eaf0f5; border-color: #bcd0e0; color: #2d4d66; }

/* ── Tableaux ──────────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--bordure); vertical-align: top; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--texte-doux); }
tbody tr:last-child td { border-bottom: 0; }

/* ── Etiquettes ────────────────────────────────────────────────────────── */

.tag {
    display: inline-block;
    padding: .1rem .5rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    background: var(--vert-pale);
    color: var(--vert);
    white-space: nowrap;
}
.tag-guest { background: #f1e9db; color: var(--brun); }
.tag-muted { background: #ececec; color: var(--texte-doux); }
.tag-warning { background: #fdf0d8; color: #7a5a17; }
.tag-danger { background: #f8ddda; color: #8d2c25; }

/* ── Calendrier ────────────────────────────────────────────────────────── */

.cal-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .75rem; }
.cal-head h1 { margin: 0; text-transform: capitalize; }

.cal { width: 100%; border-collapse: collapse; table-layout: fixed; background: var(--blanc); }
.cal th {
    padding: .4rem 0;
    text-align: center;
    font-size: .68rem;
    background: var(--vert-pale);
    color: var(--vert);
}
.cal td {
    border: 1px solid var(--bordure);
    padding: 0;
    height: 74px;
    vertical-align: top;
}
.cal td.blank { background: #f1efe9; }

.cal-day { display: block; padding: .25rem; height: 100%; text-decoration: none; color: inherit; }
.cal-day .num { font-size: .8rem; font-weight: 600; }
.cal-day.today .num {
    background: var(--vert);
    color: var(--blanc);
    border-radius: 999px;
    padding: 0 .35rem;
}
.cal-day.weekend { background: #fbf8f1; }
.cal-day.closed { background: repeating-linear-gradient(45deg, #f4f2ec, #f4f2ec 4px, #ebe8e0 4px, #ebe8e0 8px); color: var(--texte-doux); }
.cal-day.has-people { box-shadow: inset 0 -3px 0 var(--vert-clair); }

.cal-counts { font-size: .66rem; line-height: 1.35; margin-top: .15rem; }
.cal-counts span { display: block; white-space: nowrap; }
.cal-counts .c-hunters { color: var(--vert); font-weight: 700; }
.cal-counts .c-meals { color: var(--brun); }
.cal-counts .c-harvest { color: var(--ocre); font-weight: 600; }

.legend { display: flex; flex-wrap: wrap; gap: .75rem; font-size: .78rem; color: var(--texte-doux); margin-top: .6rem; }

/* ── Quotas ────────────────────────────────────────────────────────────── */

.quota { margin-bottom: .8rem; }
.quota-head { display: flex; justify-content: space-between; font-size: .9rem; margin-bottom: .2rem; }
.quota-bar { height: 8px; background: var(--vert-pale); border-radius: 999px; overflow: hidden; }
.quota-bar span { display: block; height: 100%; background: var(--vert-clair); }
.quota.warning .quota-bar span { background: var(--ocre); }
.quota.danger .quota-bar span { background: var(--rouge); }

/* ── Couchage ──────────────────────────────────────────────────────────── */

.beds { display: grid; gap: .6rem; }
@media (min-width: 620px) { .beds { grid-template-columns: repeat(2, 1fr); } }

.bed {
    border: 1px solid var(--bordure);
    border-radius: var(--radius);
    padding: .6rem;
    background: var(--blanc);
}
.bed.full { background: var(--vert-pale); }
.bed .bed-label { font-weight: 600; font-size: .9rem; }
.bed .occupant { font-size: .85rem; color: var(--texte-doux); }

/* ── Listes de personnes ───────────────────────────────────────────────── */

.person {
    display: flex;
    gap: .5rem;
    align-items: flex-start;
    justify-content: space-between;
    padding: .6rem 0;
    border-bottom: 1px solid var(--bordure);
}
.person:last-child { border-bottom: 0; }
.person .name { font-weight: 600; }
.person .meta { font-size: .8rem; color: var(--texte-doux); }

details.box {
    border: 1px solid var(--bordure);
    border-radius: var(--radius);
    background: var(--blanc);
    padding: .5rem .75rem;
    margin-bottom: .75rem;
}
details.box > summary { cursor: pointer; font-weight: 600; padding: .35rem 0; }
details.box[open] > summary { margin-bottom: .5rem; }

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

/* ── Ajout a l'ecran d'accueil ─────────────────────────────────────────── */

.install-help {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, .5);
}
.install-help[hidden] { display: none; }

.install-help-box {
    width: 100%;
    max-width: 420px;
    background: var(--blanc);
    border-radius: 14px;
    padding: 1.2rem;
    /* Marge basse : la fleche pointe vers le bouton Partager de Safari, qui
       se trouve juste sous le cadre. */
    margin-bottom: env(safe-area-inset-bottom, 0);
    box-shadow: 0 -4px 30px rgba(0, 0, 0, .3);
}
.install-help-box h2 { margin-top: 0; color: var(--vert); }
.install-help-box ol { margin: 0 0 .8rem; padding-left: 1.2rem; }
.install-help-box li { margin-bottom: .5rem; }

.install-share {
    display: inline-block;
    padding: 0 .35rem;
    border: 1px solid var(--bordure);
    border-radius: 6px;
    font-weight: 700;
    color: var(--vert);
}

/* ── Ecran de connexion ────────────────────────────────────────────────── */

.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    background: linear-gradient(160deg, var(--vert) 0%, #1e3324 100%);
}
.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--blanc);
    border-radius: 14px;
    padding: 1.6rem 1.3rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}
.auth-card h1 { text-align: center; color: var(--vert); margin-bottom: .2rem; }
.auth-card .tagline { text-align: center; color: var(--texte-doux); font-size: .85rem; margin-bottom: 1.2rem; }
.auth-footer { text-align: center; margin-top: 1rem; font-size: .8rem; color: var(--texte-doux); }
