/* Application mobile d'un refuge : feuille autonome (rien de commun avec le back-office). */
:root {
    --brand: #5e840c;
    --brand-dark: #4a6909;
    --brand-soft: #eef3df;
    --accent: #e0892b;
    --ink: #24291c;
    --muted: #6b7262;
    --line: #e3e6da;
    --bg: #f6f7f2;
    --card: #fff;
    --danger: #b3261e;
    --danger-soft: #fdecea;
    --safe-b: env(safe-area-inset-bottom, 0px);
    --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1, h2, p { margin: 0; }
a { color: inherit; text-decoration: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.icon { width: 22px; height: 22px; flex: none; }

/* Barre du haut et navigation du bas */
.bar {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; gap: 10px;
    padding: calc(10px + var(--safe-t)) 16px 10px;
    background: var(--card);
    border-bottom: 1px solid var(--line);
}
.bar-logo { width: 34px; height: 34px; border-radius: 10px; }
.bar h1 { font-size: 18px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main { max-width: 640px; margin: 0 auto; padding: 14px 14px calc(92px + var(--safe-b)); }
.tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    display: flex;
    padding-bottom: var(--safe-b);
    background: var(--card);
    border-top: 1px solid var(--line);
}
.tabs a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 9px 0 8px;
    font-size: 12px; font-weight: 600; color: var(--muted);
}
.tabs a.active { color: var(--brand); }

/* Boutons, cartes, champs */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 46px; padding: 0 18px;
    border: 0; border-radius: 12px;
    font: inherit; font-weight: 700; cursor: pointer;
}
.btn:disabled { opacity: .6; }
.btn-primary { background: var(--brand); color: #fff; width: 100%; }
.btn-soft { background: var(--brand-soft); color: var(--brand-dark); }
.btn-ghost { background: transparent; color: var(--danger); width: 100%; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 12px; }
.card h2 { display: flex; align-items: center; gap: 8px; font-size: 16px; margin-bottom: 12px; }
.field { display: block; margin: 0 0 12px; padding: 0; border: 0; }
.field > span, .field legend { display: block; margin-bottom: 5px; padding: 0; font-size: 14px; font-weight: 600; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
    width: 100%; min-height: 46px; padding: 10px 12px;
    border: 1px solid #cfd4c4; border-radius: 10px;
    background: #fff; color: var(--ink);
    font: inherit;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.two input { min-width: 0; }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.field-row > span { margin: 0; }
.field-row select { width: 58%; }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; margin-bottom: 12px; font-weight: 600; }
.check input { width: 22px; height: 22px; accent-color: var(--brand); }
.choice { display: flex; gap: 6px; }
.choice label { flex: 1; }
.choice input { position: absolute; opacity: 0; }
.choice span {
    display: flex; align-items: center; justify-content: center;
    min-height: 44px; padding: 0 6px;
    border: 1px solid #cfd4c4; border-radius: 10px;
    font-size: 14px; font-weight: 600; text-align: center;
}
.choice input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.choice input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.error { margin: -6px 0 12px; color: var(--danger); font-size: 14px; }
.alert { margin-bottom: 12px; padding: 10px 12px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); font-size: 14px; font-weight: 600; }
.notice { margin-bottom: 12px; padding: 10px 12px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-dark); font-size: 14px; font-weight: 600; }
.notice-off { background: #f1eee6; color: #6b5a2e; }
.empty { padding: 26px 8px; text-align: center; color: var(--muted); }

/* Connexion */
.login { max-width: 380px; margin: 0 auto; padding: calc(36px + var(--safe-t)) 18px 30px; text-align: center; }
.login-logo { width: 84px; height: 84px; border-radius: 22px; margin-bottom: 12px; }
.login h1 { font-size: 24px; margin-bottom: 2px; }
.login-form { margin: 18px 0 12px; text-align: left; }
.install { margin: 12px 0; padding: 12px; border-radius: 12px; background: #fff7ec; color: #6f4a14; font-size: 14px; text-align: left; }
.install .btn { margin-top: 10px; min-height: 40px; }

/* Liste des chiens */
.search { position: relative; margin-bottom: 10px; }
.search .icon { position: absolute; z-index: 1; left: 12px; top: 12px; color: var(--muted); }
.search input[type=search]:not([type=file]) { padding-left: 44px; }
.chips { display: flex; gap: 6px; margin: 0 -14px 12px; padding: 0 14px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-size: 14px; font-weight: 600; color: var(--muted); }
.chip small { font-weight: 500; opacity: .8; }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.dog { display: flex; align-items: center; gap: 12px; padding: 9px; margin-bottom: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.dog img, .dog-empty { width: 62px; height: 62px; flex: none; border-radius: 11px; object-fit: cover; background: var(--brand-soft); }
.dog-empty { display: grid; place-items: center; color: var(--brand); }
.dog-text { flex: 1; min-width: 0; }
.dog-text strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dog-text small { display: block; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { flex: none; padding: 3px 8px; border-radius: 999px; background: #eceee6; color: #555b4c; font-size: 12px; font-weight: 700; }
.badge-sos { background: var(--danger-soft); color: var(--danger); }
.badge-off { background: #f1eee6; color: #6b5a2e; }
.more { width: 100%; margin-top: 4px; }

/* Fiche */
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.photos:empty { display: none; }
.photo { position: relative; display: block; aspect-ratio: 1; border-radius: 11px; overflow: hidden; background: var(--brand-soft); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo input { position: absolute; opacity: 0; }
.photo span, .photo button {
    position: absolute; left: 5px; right: 5px; bottom: 5px;
    padding: 4px 0; border: 0; border-radius: 7px;
    background: rgb(0 0 0 / .6); color: #fff;
    font: inherit; font-size: 12px; font-weight: 700; text-align: center;
}
.photo.removed img { opacity: .3; }
.photo.removed span { background: var(--danger); }
.pick { width: 100%; position: relative; overflow: hidden; }
.pick input { position: absolute; inset: 0; opacity: 0; }
.save { padding: 4px 0; }
.state { margin-top: 6px; }

/* Réglages */
.intro { margin: 2px 2px 12px; font-size: 15px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 46px; font-weight: 600; border-top: 1px solid var(--line); }
.card h2 + .switch { border-top: 0; }
.switch input { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 48px; height: 28px; margin: 0; border-radius: 999px; background: #cfd4c4; cursor: pointer; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked { background: var(--brand); }
.switch input:checked::after { transform: translateX(20px); }
.switch input:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Activité */
.line { padding: 10px 0; border-top: 1px solid var(--line); }
.card h2 + .line { border-top: 0; padding-top: 0; }
.line a { font-weight: 700; color: var(--brand-dark); }
.line small { color: var(--muted); font-size: 13px; }
.line-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin-bottom: 3px; }
.line-body { font-size: 15px; overflow-wrap: anywhere; }
.line-row { display: flex; justify-content: space-between; gap: 12px; }
