:root {
    color-scheme: light;
    --forest: #173f35;
    --forest-2: #24594a;
    --mint: #dff2e8;
    --cream: #f7f4ec;
    --paper: #ffffff;
    --fox: #e97a3d;
    --fox-dark: #bc5428;
    --ink: #17211e;
    --muted: #66746f;
    --line: #dce5e1;
    --danger: #b83838;
    --shadow: 0 18px 50px rgba(23, 63, 53, .12);
    font-family: Inter, ui-rounded, "SF Pro Rounded", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--cream); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--cream); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px 20px;
    background:
        radial-gradient(circle at 20% 10%, rgba(233, 122, 61, .25), transparent 32%),
        radial-gradient(circle at 90% 85%, rgba(36, 89, 74, .22), transparent 36%),
        var(--cream);
}
.login-card { width: min(430px, 100%); padding: 34px; border: 1px solid rgba(255,255,255,.8); border-radius: 30px; background: rgba(255,255,255,.88); box-shadow: var(--shadow); backdrop-filter: blur(14px); }
.brand-mark { width: 72px; height: 72px; overflow: hidden; border-radius: 23px; background: var(--forest); box-shadow: 0 8px 22px rgba(23,63,53,.16); }
.brand-mark img { width: 100%; height: 100%; display: block; object-fit: cover; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(2rem, 8vw, 2.8rem); letter-spacing: -.045em; }
h2 { margin-bottom: 0; font-size: 1.35rem; letter-spacing: -.025em; }
h3 { margin: 24px 0 12px; font-size: 1rem; }
.eyebrow { margin-bottom: 4px; color: var(--fox-dark); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.muted { color: var(--muted); line-height: 1.5; }
.stack { display: grid; gap: 16px; margin-top: 26px; }
label { display: grid; gap: 7px; color: #34433e; font-size: .9rem; font-weight: 700; }
input, select { width: 100%; min-height: 48px; padding: 0 14px; color: var(--ink); border: 1px solid var(--line); border-radius: 14px; background: white; outline: none; }
input:focus, select:focus { border-color: var(--forest-2); box-shadow: 0 0 0 3px rgba(36,89,74,.12); }
.error { min-height: 1.3em; margin: 0; color: var(--danger); }

.primary, .small-button, .action-grid button, .ghost, .audio-button, .icon-button { border: 0; border-radius: 14px; font-weight: 800; }
.primary { min-height: 46px; padding: 0 18px; color: white; background: var(--forest); }
.primary:hover { background: var(--forest-2); }
.wide { width: 100%; }
.compact { min-height: 40px; padding: 0 14px; }
.ghost { min-height: 40px; padding: 0 14px; color: var(--forest); background: var(--mint); }
.icon-button { width: 42px; height: 42px; padding: 0; color: var(--forest); background: var(--mint); font-size: 1.3rem; }

.topbar { position: sticky; top: 0; z-index: 1000; min-height: 74px; padding: calc(10px + env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) 10px max(18px, env(safe-area-inset-left)); display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid rgba(220,229,225,.85); background: rgba(247,244,236,.88); backdrop-filter: blur(18px); }
.brand-inline { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 42px; height: 42px; display: block; object-fit: cover; border-radius: 14px; }
.brand-inline strong, .brand-inline small { display: block; }
.brand-inline small { color: var(--muted); font-size: .72rem; }
.top-actions { display: flex; align-items: center; gap: 8px; }

.dashboard { width: min(1080px, 100%); margin: auto; padding: 24px 18px calc(40px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(310px, .65fr); gap: 18px; }
.child-heading, .status-grid { grid-column: 1 / -1; }
.child-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 12px; }
.child-heading > div:first-child { flex: 1 1 220px; min-width: 0; }
.child-heading select { min-width: 0; max-width: 100%; padding-left: 0; border: 0; background: transparent; font-size: 1.8rem; font-weight: 900; letter-spacing: -.04em; }
.child-actions { display: flex; align-items: center; gap: 8px; }
.pairing-empty { grid-column: 1 / -1; }
.pairing-empty .muted { margin-top: 12px; }
.pairing-result { padding: 18px; border-radius: 18px; background: var(--mint); text-align: center; }
.pairing-code { display: block; margin: 12px 0; color: var(--forest); font-size: clamp(2rem, 9vw, 3.1rem); font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: .12em; }
#pairing-generate:disabled, #pairing-done:disabled { opacity: .6; cursor: wait; }
.status-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.status-card { min-width: 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.8); }
.status-card span, .status-card strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-card span { margin-bottom: 4px; color: var(--muted); font-size: .78rem; }
.status-card strong { font-size: 1rem; }

.position-status-card .status-card-heading { display: flex; align-items: center; gap: 7px; margin-bottom: 4px; }
.position-status-card .status-card-heading > span { margin-bottom: 0; min-width: 0; }
.status-refresh-button { width: 26px; height: 26px; flex: 0 0 26px; border: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--mint); color: var(--forest); font-size: 1rem; font-weight: 900; line-height: 1; cursor: pointer; }
.status-refresh-button:hover { filter: brightness(.98); }
.status-refresh-button:disabled { opacity: .5; cursor: wait; }

.panel { padding: 20px; border: 1px solid var(--line); border-radius: 24px; background: var(--paper); box-shadow: 0 8px 30px rgba(23,63,53,.06); }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.map-panel { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.map-panel .panel-heading { padding: 20px 20px 0; }
.map-links { display: flex; gap: 6px; }
.small-button { display: inline-flex; min-height: 34px; padding: 0 10px; align-items: center; justify-content: center; color: var(--forest); background: var(--mint); font-size: .75rem; text-decoration: none; cursor: pointer; }
.small-button:disabled { opacity: .55; cursor: wait; }
#map { flex: 1; min-height: 430px; background: #e9efeb; }
.map-help { margin: 0; padding: 10px 18px; color: var(--muted); background: #f8faf8; font-size: .78rem; }
.leaflet-control-attribution { font-size: 9px; }

.pill { padding: 6px 10px; border-radius: 999px; color: var(--muted); background: #eef2f0; font-size: .76rem; font-weight: 800; }
.pill.live { color: #8f2525; background: #ffe3e3; }
.audio-button { width: 100%; min-height: 58px; display: flex; align-items: center; justify-content: center; gap: 10px; color: white; background: var(--forest); }
.audio-button.live { background: var(--danger); }
.audio-dot { width: 12px; height: 12px; border-radius: 50%; background: #9ae2c2; box-shadow: 0 0 0 5px rgba(154,226,194,.15); }
.audio-button.live .audio-dot { background: white; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 9px rgba(255,255,255,.08); } }
.inline-message { min-height: 1.2em; margin: 9px 0 0; color: var(--muted); font-size: .8rem; }
.audio-level { margin-top: 18px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: #f8faf8; }
.audio-level-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.audio-level-heading label { font-size: .85rem; }
.audio-level-heading output { flex-shrink: 0; min-width: 44px; color: var(--forest); font-weight: 850; text-align: right; font-variant-numeric: tabular-nums; }
.audio-level input[type="range"] { display: block; min-height: 44px; margin: 5px 0 0; background: transparent; }
.audio-level input[type="range"]:focus-visible { outline: 2px solid var(--forest); outline-offset: 3px; }
.audio-level input:disabled { opacity: .45; cursor: not-allowed; }
.audio-level-scale { display: flex; justify-content: space-between; color: var(--muted); font-size: .72rem; }
.audio-level .inline-message { line-height: 1.45; }
.audio-level button { margin-top: 12px; }
.audio-level button:disabled { opacity: .45; cursor: default; }
.divider { height: 1px; margin: 20px 0; background: var(--line); }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.action-grid button { min-height: 45px; padding: 8px; color: var(--forest); background: var(--mint); }
.message-row { margin-top: 10px; display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.commands-note { color: var(--muted); font-size: .78rem; line-height: 1.5; }
.commands-panel { grid-column: 1 / -1; }
.commands-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 8px; }
.command-item { padding: 12px; border: 1px solid var(--line); border-radius: 12px; overflow-wrap: anywhere; }
.command-item strong, .command-item span, .command-item small { display: block; }
.command-item span { margin: 5px 0; font-weight: 700; }
.command-item small { color: var(--muted); font-size: .75rem; }
.command-item.response-yes { background: #e5f6e9; border-color: #b5d9bf; }
.command-item.response-no { background: #fff0ed; border-color: #e6aaa0; }
.command-item.response-no span { color: #982c25; }

.zones-panel { grid-column: 1 / -1; }
.protection-panel { grid-column: 1 / -1; }
.health-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; }
.health-item { display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 10px 12px; border-radius: 14px; color: #24503f; background: #edf8f2; font-size: .84rem; font-weight: 750; }
.health-item::before { content: "✓"; width: 22px; height: 22px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: white; background: #2f7d5d; font-size: .75rem; }
.health-item.missing { color: #8f2525; background: #fff0f0; }
.health-item.missing::before { content: "!"; background: var(--danger); }
.danger-zone { margin-top: 18px; padding-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); }
.danger-zone strong, .danger-zone small { display: block; }
.danger-zone small { margin-top: 4px; color: var(--muted); }
.danger-button { min-height: 44px; padding: 0 16px; border: 0; border-radius: 14px; color: white; background: var(--danger); font-weight: 800; }
.danger-button:disabled { opacity: .55; cursor: wait; }
.warning { padding: 12px 14px; color: #7c2d22; border: 1px solid #f2c8c2; border-radius: 14px; background: #fff2ef; line-height: 1.45; }
.zones-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.zone-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: #fbfcfb; }
.zone-card strong, .zone-card small { display: block; }
.zone-card small { margin-top: 3px; color: var(--muted); }
.zone-card button { border: 0; color: var(--danger); background: transparent; font-weight: 800; }
.empty { padding: 18px; color: var(--muted); border: 1px dashed var(--line); border-radius: 16px; text-align: center; }
.timeline { display: grid; gap: 2px; }
.timeline-item { position: relative; padding: 11px 12px 11px 38px; border-radius: 12px; }
.timeline-item::before { content: ""; position: absolute; left: 15px; top: 17px; width: 9px; height: 9px; border-radius: 50%; background: var(--fox); }
.timeline-item strong, .timeline-item small { display: block; }
.timeline-item small { color: var(--muted); }

dialog { width: min(520px, calc(100% - 24px)); padding: 0; border: 0; border-radius: 24px; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(11,28,23,.52); backdrop-filter: blur(3px); }
.dialog-card { padding: 22px; display: grid; gap: 14px; }
.dialog-card .panel-heading { margin: 0; }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
input[type="range"] { min-height: 34px; padding: 0; accent-color: var(--fox); box-shadow: none; }
.check { display: flex; align-items: center; gap: 9px; }
.check input { width: 20px; min-height: 20px; }
.toast { position: fixed; z-index: 2000; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); max-width: min(430px, calc(100% - 32px)); padding: 12px 16px; color: white; border-radius: 14px; background: var(--forest); box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 760px) {
    .topbar { min-height: 68px; }
    .brand-inline small { display: none; }
    .ghost { max-width: 152px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .75rem; }
    .dashboard { grid-template-columns: 1fr; padding: 18px 12px calc(32px + env(safe-area-inset-bottom)); }
    .child-heading, .status-grid, .zones-panel, .protection-panel { grid-column: 1; }
    .status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
    .status-card { padding: 12px 10px; }
    .status-card span { font-size: .66rem; }
    .status-card strong { font-size: .84rem; }
    .panel { border-radius: 20px; }
    #map { min-height: 350px; }
    .map-panel .panel-heading { align-items: flex-start; }
    .map-links { flex-direction: column; }
    .two-columns { grid-template-columns: 1fr; }
    .danger-zone { align-items: stretch; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

/* Lot 1: navigation, compact activity, history and push diagnostics. */
.dashboard-content { display: contents; }
.main-menu { width: min(1080px, calc(100% - 24px)); margin: 12px auto 0; padding: 8px; display: flex; flex-wrap: wrap; gap: 6px; border: 1px solid var(--line); border-radius: 18px; background: white; }
.main-menu a { display: flex; gap: 8px; align-items: center; padding: 12px 16px; border-radius: 12px; color: var(--forest); text-decoration: none; font-weight: 750; }
.main-menu a[aria-current="page"] { background: var(--forest); color: white; }
.logout-button span { font-size: 1.3rem; vertical-align: -.06em; }
.history-panel, .notifications-panel { grid-column: 1 / -1; min-width: 0; }
.commands-heading { flex-wrap: wrap; }
.commands-toggle { margin-top: 14px; }
.history-link { gap: 6px; min-height: 40px; }
.history-link span { font-size: 1.2rem; }
.command-message { margin: 6px 0; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.command-item { overflow-wrap: anywhere; }
.history-filter { max-width: 340px; margin: 18px 0; }
.history-list { display: grid; gap: 10px; margin: 16px 0; }
.history-list .command-item { display: grid; gap: 6px; }
.history-list .command-item small { color: var(--muted); }
.push-status { margin: 18px 0 8px; color: var(--forest); font-weight: 750; }
.notification-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.notification-guide { max-width: 680px; color: var(--muted); line-height: 1.6; }
.notification-guide h3 { color: var(--ink); }
.audio-banner { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; padding: 10px 16px; background: #ffe3e3; color: #8f2525; font-weight: 700; }
button:disabled { cursor: default; opacity: .55; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--fox); outline-offset: 3px; }
@media (max-width: 760px) {
    .topbar { flex-wrap: wrap; padding-right: 12px; padding-left: 12px; }
    .top-actions { flex-wrap: wrap; }
    .ghost { max-width: none; white-space: normal; overflow: visible; text-overflow: clip; }
    .top-actions .ghost { padding: 0 10px; font-size: .78rem; }
    .main-menu { flex-direction: column; }
    .history-panel, .notifications-panel { grid-column: 1; }
    .page-heading { flex-wrap: wrap; }
    .notification-actions { flex-direction: column; align-items: stretch; }
    .commands-heading h2 { font-size: 1.15rem; }
}

.power-icon { vertical-align: -.22em; margin-right: 2px; }

/* Fixed navigation, independent of document scroll and of the iOS viewport. */
:root { --topbar-height: 74px; }
html { scroll-padding-top: calc(var(--topbar-height) + 14px); }
.app-shell { padding-top: var(--topbar-height); }
.topbar { position: fixed; inset: 0 0 auto; z-index: 1200; }
.brand-inline { color: inherit; text-decoration: none; }
.top-actions { flex-shrink: 0; }
.inbox-button { position: relative; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.unread-badge { position: absolute; top: -5px; right: -5px; min-width: 20px; height: 20px; padding: 0 4px; border: 2px solid var(--cream); border-radius: 20px; background: #bc3030; color: white; font-size: 10px; line-height: 16px; font-weight: 800; }
.main-menu { position: fixed; z-index: 1220; top: calc(var(--topbar-height) + 8px); right: max(12px, env(safe-area-inset-right)); margin: 0; width: min(350px, calc(100% - 24px)); max-height: calc(100vh - var(--topbar-height) - 24px); max-height: calc(100dvh - var(--topbar-height) - 24px); overflow-y: auto; flex-direction: column; box-shadow: var(--shadow); }
.menu-backdrop { position: fixed; z-index: 1100; inset: var(--topbar-height) 0 0; width: 100%; border: 0; background: rgba(23, 63, 53, .18); }
.menu-unread { min-width: 24px; padding: 3px 7px; margin-left: auto; text-align: center; background: #bc3030; color: white; border-radius: 20px; font-size: .75rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.messages-panel { grid-column: 1 / -1; min-width: 0; }
.chat-description { margin-bottom: 8px; color: var(--muted); font-size: .85rem; line-height: 1.5; }
.chat-scroll { height: min(55vh, 560px); min-height: 220px; overflow-y: auto; overscroll-behavior: contain; padding: 12px; border: 1px solid var(--line); border-radius: 18px; background: #f7f9f7; }
.chat-list { display: flex; flex-direction: column; gap: 12px; }
.chat-list:empty::after { content: "Les messages de cette conversation apparaîtront ici."; color: var(--muted); padding: 24px 4px; text-align: center; }
.chat-bubble { align-self: flex-start; width: fit-content; max-width: min(84%, 640px); padding: 12px 15px; border: 1px solid var(--line); border-radius: 18px 18px 18px 4px; background: white; overflow-wrap: anywhere; }
.chat-bubble.outgoing { align-self: flex-end; background: var(--mint); border-color: #bdd9cb; border-radius: 18px 18px 4px 18px; }
.chat-bubble strong { display: block; margin-bottom: 5px; font-size: .82rem; color: var(--forest); }
.chat-bubble p { margin-bottom: 7px; white-space: pre-wrap; line-height: 1.5; }
.chat-bubble small { display: block; color: var(--muted); font-size: .7rem; }
.chat-origin { margin-bottom: 5px; color: var(--fox-dark); font-size: .7rem; font-weight: 700; }
.chat-compose { display: flex; gap: 10px; margin-top: 14px; align-items: end; }
.chat-compose textarea { flex: 1; width: 0; min-height: 56px; max-height: 180px; resize: vertical; border: 1px solid var(--line); border-radius: 14px; padding: 12px; font: inherit; font-size: 16px; }
.chat-compose textarea:focus { outline: 2px solid var(--forest-2); }
#chat-new { margin-top: 10px; }
#chat-older { margin-bottom: 14px; }
.command-replies { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
.command-replies p { white-space: pre-wrap; font-size: .85rem; margin: 6px 0; }
.command-chat-link { margin-top: 10px; }
@media (max-width: 760px) {
    .topbar { flex-wrap: nowrap; gap: 8px; }
    .top-actions { gap: 6px; flex-wrap: nowrap; }
    .brand-inline { gap: 7px; }
    .brand-logo { width: 36px; height: 36px; border-radius: 12px; }
    .brand-inline strong { font-size: .9rem; }
    .top-actions .ghost { padding: 0 8px; font-size: .72rem; }
    .top-actions .icon-button { width: 36px; height: 40px; }
    .messages-panel { padding: 14px; }
    .chat-scroll { height: 48vh; padding: 9px; }
    .chat-compose { gap: 7px; }
    .chat-compose .primary { padding: 0 12px; font-size: .84rem; }
    .chat-bubble { max-width: 90%; }
}
@media (max-width: 355px) { .topbar .brand-inline strong { display: none; } }
/* Keep the composer in view while the conversation itself scrolls. */
.messages-open .dashboard { display: flex; flex-direction: column; gap: 10px; }
.messages-open .child-heading { margin: 0; }
.messages-open .child-heading .eyebrow, .messages-open .child-actions { display: none; }
.messages-open #child-select { font-size: 1.1rem; padding-top: 5px; padding-bottom: 5px; }
.messages-open .messages-panel { display: flex; flex-direction: column; min-height: 350px; height: var(--chat-panel-height, 65vh); }
.messages-open .messages-panel .panel-heading { margin-bottom: 4px; }
.messages-open #messages-title { font-size: 1.15rem; }
.messages-open .chat-description { margin: 4px 0; }
.messages-open .chat-scroll { flex: 1; height: auto; min-height: 90px; }
.messages-open .inline-message:empty { display: none; }
.messages-open .chat-compose { flex-shrink: 0; margin-top: 8px; }
.messages-open .chat-compose textarea { resize: none; }
.messages-open #chat-send-state { margin-bottom: 0; }

/* FoxKid 0.3.0 — coffre, paramètres et récupération du compte. */
.login-link { min-height: 40px; padding: 0; border: 0; color: var(--forest); background: transparent; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.compact-stack { margin-top: 16px; }
.settings-panel { grid-column: 1 / -1; min-width: 0; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 14px; margin-top: 18px; }
.settings-card { padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: #fbfcfb; }
.settings-card h3 { margin-top: 0; }
.command-item.vault-correct { background: #e5f6e9; border-color: #b5d9bf; }
.command-item.vault-correct span { color: #24503f; }
.command-item.vault-incorrect { background: #fff0ed; border-color: #e6aaa0; }
.command-item.vault-incorrect span { color: #982c25; }
@media (max-width: 760px) {
    .settings-panel { grid-column: 1; }
}

/* FoxKid 0.3.1 — Événements et couleurs du Coffre. */
.command-chat-link-top { margin: 0 0 9px; justify-self: start; }
.command-item.vault-code-change { background: #eaf3ff; border-color: #9ebfe8; }
.command-item.vault-code-change span { color: #24558a; }
.chat-bubble.vault-correct { background: #e5f6e9; border-color: #b5d9bf; }
.chat-bubble.vault-correct strong, .chat-bubble.vault-correct .chat-origin { color: #24503f; }
.chat-bubble.vault-incorrect { background: #fff0ed; border-color: #e6aaa0; }
.chat-bubble.vault-incorrect strong, .chat-bubble.vault-incorrect .chat-origin { color: #982c25; }

/* FoxKid 0.4.0 — mises à jour à distance et compteur Événements. */
.events-icon { font-size: 1.25rem; line-height: 1; font-weight: 900; }
.updates-panel { grid-column: 1 / -1; min-width: 0; }
.update-status-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 10px; margin: 16px 0; }
.update-card { padding: 15px; border: 1px solid var(--line); border-radius: 16px; background: #fbfcfb; }
.update-card span, .update-card strong, .update-card small { display: block; }
.update-card span { margin-bottom: 5px; color: var(--muted); font-size: .76rem; }
.update-card strong { color: var(--forest); font-size: 1rem; }
.update-card small { margin-top: 5px; color: var(--muted); font-size: .7rem; }
.update-actions-card, .update-mode-card { margin-top: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: #fbfcfb; }
.update-actions-card h3 { margin-top: 0; }
.update-mode-card { display: grid; gap: 8px; }
.update-mode-card legend { padding: 0 7px; color: var(--forest); font-size: 1rem; font-weight: 850; }
.update-mode-option { grid-template-columns: auto 1fr; align-items: center; gap: 11px; min-height: 58px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: white; cursor: pointer; }
.update-mode-option:has(input:checked) { border-color: #86b7a1; background: var(--mint); }
.update-mode-option input { width: 20px; min-height: 20px; margin: 0; accent-color: var(--forest); }
.update-mode-option strong, .update-mode-option small { display: block; }
.update-mode-option small { margin-top: 3px; color: var(--muted); font-weight: 500; line-height: 1.35; }
.update-last-result { margin-top: 14px; }
.command-item.update-started { background: #fff4df; border-color: #e8bd6b; }
.command-item.update-started span { color: #8a5a00; }
.command-item.update-success { background: #f2eafa; border-color: #c9afe8; }
.command-item.update-success span { color: #5b3388; }
.command-item.update-failed { background: #fff0ed; border-color: #e6aaa0; }
.command-item.update-failed span { color: #982c25; }
@media (max-width: 760px) {
    .updates-panel { grid-column: 1; }
}
@media (max-width: 430px) {
    .topbar .brand-inline small { display: none; }
}
@media (max-width: 370px) {
    .logout-button { width: 40px; padding: 0; font-size: 0 !important; }
    .logout-button .power-icon { margin-right: 0; }
}

.command-item.sharing-started { background: #e5f6e9; border-color: #b5d9bf; }
.command-item.sharing-started span { color: #24503f; }
.command-item.sharing-stopped { background: #fff0ed; border-color: #e6aaa0; }
.command-item.sharing-stopped span { color: #982c25; }
.command-item.password-change { background: #fff4e5; border-color: #e6b26b; }
.command-item.password-change span { color: #8a4d0f; }

/* FoxKid 0.4.6 : création et alertes des zones. */
#zones-panel { scroll-margin-top: 95px; }
#zone-picker-map { height: 245px; border: 1px solid var(--line); border-radius: 14px; background: #e9efeb; overflow: hidden; }
.command-item.zone-enter { background: #e5f6e9; border-color: #b5d9bf; }
.command-item.zone-enter span { color: #24503f; }
.command-item.zone-exit { background: #fff0ed; border-color: #e6aaa0; }
.command-item.zone-exit span { color: #982c25; }
#zone-dialog .dialog-card { width: min(530px, 94vw); max-height: min(90vh, 850px); overflow-y: auto; }

/* FoxKid 0.4.6a — standalone Zones and iOS PWA refresh. */
.zones-summary-panel, #zones-page { grid-column: 1 / -1; min-width: 0; }
.zones-summary-panel .panel-heading { flex-wrap: wrap; }
#zones-page h3 { margin: 22px 0 12px; }
#zone-map { height: min(52vh, 450px); min-height: 290px; border: 1px solid var(--line); border-radius: 16px; background: #e9efeb; overflow: hidden; }
#zones-history-link { margin-top: 14px; }
#top-refresh-button[aria-busy="true"] { opacity: .5; cursor: wait; }
@media (max-width: 760px) {
  .zones-summary-panel, #zones-page { grid-column: 1; }
  .top-actions { gap: 4px; }
  .top-actions #top-refresh-button { width: 36px; height: 40px; flex: 0 0 36px; }
}

@media (max-width: 760px) {
  .top-actions .logout-button { width: 36px; height: 40px; min-width: 36px; padding: 0; display: inline-flex; justify-content: center; align-items: center; }
  .top-actions .logout-button .power-icon { margin: 0; }
  .top-actions .logout-button .logout-text { display: none; }
}

/* Zone cache: compteurs indicatifs, sans comparateur automatique */
.zone-cache-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 14px 0 8px; }
.zone-cache-summary > div { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: #fbfcfb; }
.zone-cache-summary strong, .zone-cache-summary span { display: block; }
.zone-cache-summary span { margin-top: 7px; font-size: 1.1rem; font-weight: 700; }

/* FoxKid 0.4.9 — edition des cercles existants. */
.zone-card-actions { display:flex; flex-wrap: wrap; align-items:center; gap:6px; }
.zone-card .zone-edit-button { color:var(--fox); border:1px solid var(--line); border-radius:10px; padding:8px 10px; background:#fff; cursor:pointer; }
.zone-card .zone-delete-button { padding:8px 10px; cursor:pointer; }
.zone-form-actions { display:flex; justify-content:flex-end; align-items:center; flex-wrap:wrap; gap:10px; }
.zone-form-actions button { flex:1 1 145px; }
@media (max-width:600px) { .zone-card { align-items:flex-start; } .zone-card-actions { flex-direction:column; align-items:stretch; } }

/* FoxKid 0.4.9a — recherche d'adresse dans le formulaire de zone. */
.zone-address-search { display: grid; gap: 7px; margin: 12px 0; }
.zone-address-search > label { font-weight: 650; }
.zone-address-row { display: flex; align-items: stretch; gap: 8px; }
.zone-address-row input { min-width: 0; flex: 1 1 auto; }
.zone-address-row button { flex: 0 0 auto; padding: 8px 12px; }
.zone-address-results { display: grid; gap: 6px; max-height: 190px; overflow-y: auto; }
.zone-address-results[hidden] { display: none; }
.zone-address-choice { display: block; width: 100%; text-align: left; white-space: normal; overflow-wrap: anywhere; padding: 10px; border-radius: 9px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.zone-address-choice:hover, .zone-address-choice:focus-visible { border-color: var(--fox); background: #eff8f1; }
#zone-address-status { margin: 0; }
@media (max-width: 440px) { .zone-address-row { flex-wrap: wrap; } .zone-address-row button { width: 100%; } }

/* FoxKid 0.5.1 : carte et diagnostic GPS des Déplacements (sans confusion avec Zones). */
.journey-page { grid-column: 1 / -1; min-width: 0; }
.journey-page .panel-heading { flex-wrap: wrap; }
.journey-stats { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; margin: 16px 0 10px; }
.journey-stats article { min-width:0; padding:14px; background:#fbfcfb; border:1px solid var(--line); border-radius:14px; }
.journey-stats span { display:block; color:var(--muted); font-size:.81rem; line-height:1.3; }
.journey-stats strong { display:block; font-size:clamp(.88rem, 2.5vw, 1.18rem); margin-top:7px; overflow-wrap:anywhere; font-variant-numeric:tabular-nums; }
.journey-controls { display:flex; flex-wrap:wrap; gap:12px; align-items:end; justify-content:space-between; margin:18px 0 12px; }
.journey-controls .journey-date-picker-row { display:flex;align-items:center;gap:12px;flex:1 1 270px;flex-wrap:wrap; }
.journey-selected-date {font-size:.95rem;font-weight:650;color:var(--ink);text-transform:capitalize;}
.journey-controls .pill { margin-bottom:12px; }
#journey-map { height:min(55vh,480px); min-height:290px; border:1px solid var(--line); border-radius:16px; overflow:hidden; background:#e9efeb; }
.journey-legend { display:flex; gap:12px; align-items:center; justify-content:center; font-size:.86rem; color:var(--muted); margin:11px 0; }
.journey-legend span { display:inline-flex; gap:6px; align-items:center; }
.journey-legend i { display:inline-block; width:16px; height:5px; border-radius:3px; }
.journey-legend .journey-blue { background:#2573ec; }
.journey-legend .journey-green { background:#27ab64; }
@media(max-width:760px) { .journey-page {grid-column:1;} .journey-stats {grid-template-columns:1fr 1fr;} .journey-stats article:first-child {grid-column:1 / -1;} }

/* FoxKid 0.5.2 — individual trips and deliberately sparse waypoints. */
.journey-trip-list {display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,290px),1fr));gap:10px;margin:12px 0;}
.journey-trip-choice {display:block;text-align:left;white-space:normal;width:100%;border:1px solid var(--line);border-radius:14px;background:#fff;color:inherit;padding:13px;cursor:pointer;}
.journey-trip-choice:hover,.journey-trip-choice:focus-visible {border-color:#2573ec;}
.journey-trip-choice[aria-pressed="true"] {border:2px solid #2573ec;background:#eef5ff;padding:12px;}
.journey-trip-choice strong,.journey-trip-choice small {display:block;}
.journey-trip-choice small {margin-top:6px;color:var(--muted);line-height:1.4;}
.journey-selected-details {border:1px solid var(--line);padding:12px;border-radius:14px;background:#fbfcfb;margin:12px 0;line-height:1.55;}
.journey-selected-details strong {display:block;margin-bottom:6px;}
.journey-detail-grid {display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:8px;margin-top:10px;}
.journey-detail-grid > div {border:1px solid var(--line);border-radius:10px;padding:9px;background:#fff;}
.journey-detail-grid span {display:block;color:var(--muted);font-size:.82rem;}
.journey-detail-grid b {display:block;margin-top:3px;overflow-wrap:anywhere;}
.journey-legend {flex-wrap:wrap;}
.journey-note {margin:8px 0;color:var(--muted);font-size:.85rem;}

/* FoxKid 0.5.2b: journeys day -> trip cards -> focused detail */
.journey-page [hidden],.journey-page div[hidden] {display:none!important;}
.journey-day-summary {display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin:12px 0 20px;}
.journey-day-summary article {background:#f4f8f6;border:1px solid var(--line);border-radius:13px;padding:13px;min-width:0;}
.journey-day-summary span {display:block;font-size:.8rem;color:var(--muted);}
.journey-day-summary strong {display:block;font-size:1.3rem;margin-top:8px;overflow-wrap:anywhere;font-variant-numeric:tabular-nums;}
.journey-trip-list {display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,325px),1fr));gap:16px;margin:14px 0 20px;align-items:start;}
.journey-summary-card {border:1px solid var(--line);border-radius:18px;background:#fff;padding:13px;min-width:0;box-shadow:0 3px 8px rgba(18,62,43,.06);}
.journey-card-heading {display:flex;gap:9px;align-items:start;justify-content:space-between;}
.journey-card-heading strong {font-size:1.08rem;}
.journey-card-heading p,.journey-card-route {color:var(--muted);font-size:.9rem;margin:5px 0 10px;}
.journey-event-pill {font-size:.78rem;padding:5px 8px;background:#e9f5ee;border-radius:999px;white-space:nowrap;}
.journey-thumb {height:190px;border-radius:12px;border:1px solid var(--line);background:#dceadd;overflow:hidden;position:relative;pointer-events:auto;}
.journey-thumb > span {position:absolute;top:45%;left:8%;right:8%;text-align:center;font-size:.82rem;color:#385c46;}
.journey-thumb .leaflet-control-attribution {font-size:9px!important;}
.journey-thumb .leaflet-control-zoom {pointer-events:auto!important;}
.journey-thumb .leaflet-control-zoom a {pointer-events:auto!important;}
.journey-card-stats {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;text-align:center;margin-top:12px;}
.journey-card-stats span {font-size:.75rem;color:var(--muted);min-width:0;}
.journey-card-stats b {display:block;font-size:.96rem;color:var(--ink);margin-bottom:4px;overflow-wrap:anywhere;}
.journey-card-foot {border-top:1px solid var(--line);padding-top:10px;margin-top:10px;display:flex;align-items:center;justify-content:space-between;gap:9px;flex-wrap:wrap;}
.journey-card-foot small {color:var(--muted);font-size:.78rem;}
.journey-open-detail {background:#def2e7;color:#153b2d;border:0;border-radius:10px;padding:10px 12px;font-weight:700;cursor:pointer;}
.journey-open-detail:hover,.journey-open-detail:focus-visible {background:#bde6cf;}
.journey-detail-nav {display:flex;align-items:center;justify-content:center;gap:10px;margin:14px 0;}
.journey-detail-nav button {min-height:40px;}
.journey-detail-nav button:disabled {opacity:.35;cursor:not-allowed;}
.journey-detail-nav .journey-back {flex:0 1 200px;}
.journey-event-list {list-style:none;padding:0;margin:8px 0 18px;display:grid;gap:8px;}
.journey-event-list li {background:#f8faf8;border:1px solid var(--line);border-radius:10px;padding:10px;font-size:.88rem;}
.journey-diagnostic {border-top:1px solid var(--line);padding-top:15px;margin-top:20px;}
.journey-diagnostic summary {cursor:pointer;font-weight:650;}
@media(max-width:800px){.journey-day-summary {grid-template-columns:repeat(2,minmax(0,1fr));}.journey-trip-list {grid-template-columns:1fr;}.journey-detail-nav {gap:5px;}.journey-back {font-size:.85rem;}}

/* 0.5.2c: alternating directional chevrons fully enclosed by the route stroke. */
.leaflet-overlay-pane path.journey-chevron-phase-a,
.leaflet-overlay-pane path.journey-chevron-phase-b {pointer-events:none!important;stroke-linecap:round;stroke-linejoin:round;}
.leaflet-overlay-pane path.journey-chevron-phase-a {animation:foxkidChevronA 1.5s linear infinite;}
.leaflet-overlay-pane path.journey-chevron-phase-b {animation:foxkidChevronB 1.5s linear infinite;}
@keyframes foxkidChevronA {0%,48%{opacity:.95;} 51%,98%{opacity:.06;} 100%{opacity:.95;}}
@keyframes foxkidChevronB {0%,48%{opacity:.06;} 51%,98%{opacity:.95;} 100%{opacity:.06;}}
@media(prefers-reduced-motion:reduce){
 .leaflet-overlay-pane path.journey-chevron-phase-a {animation:none;opacity:.92;}
 .leaflet-overlay-pane path.journey-chevron-phase-b {animation:none;opacity:.06;}
}

/* 0.5.3: inferred crossings are visually distinct from confirmed zone events. */
.journey-possible-crossings li {background:var(--surface,#fbfaf3);border-style:dashed;color:var(--text,#26443b);}

/* FoxKid 0.5.3a — accessible parent calendar, independent from native date picker */
.journey-calendar[hidden] {display:none!important;}
.journey-calendar {max-width:410px;padding:14px;margin:0 0 18px;border:1px solid var(--line);border-radius:16px;background:#fff;box-shadow:0 5px 14px rgba(20,50,40,.06);}
.journey-calendar-heading {display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:12px;text-transform:capitalize;}
.journey-calendar-heading button {min-width:38px;min-height:38px;padding:6px;}
.journey-calendar-weekdays,.journey-calendar-days {display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:5px;text-align:center;}
.journey-calendar-weekdays {color:var(--muted);font-size:.73rem;margin-bottom:6px;}
.journey-calendar-day {position:relative;aspect-ratio:1/1;border:1px solid transparent;border-radius:9px;background:#f7f9f7;color:var(--ink);cursor:pointer;padding:4px 2px 11px;font:inherit;font-weight:550;min-width:0;}
.journey-calendar-day.has-trip {background:#eaf3ff;border-color:#d3e5ff;color:#124b8c;}
.journey-calendar-day.has-trip::after {content:'';position:absolute;bottom:4px;left:50%;transform:translateX(-50%);width:5px;height:5px;border-radius:50%;background:#2573ec;}
.journey-calendar-day.is-selected {outline:2px solid #236ed4;outline-offset:-2px;font-weight:800;}
.journey-calendar-day:focus-visible {outline:3px solid #236ed4;outline-offset:1px;}
.journey-calendar #journey-calendar-message {font-size:.76rem;line-height:1.45;margin:12px 0 0;}
@media(max-width:480px){.journey-calendar {max-width:100%;padding:9px;}.journey-calendar-days {gap:3px;}.journey-calendar-day {font-size:.9rem;}}

/* 0.5.3b: only confirmed-by-analysis estimated trips are highlighted blue. */
.journey-calendar-day.is-checking::after {content:'';position:absolute;bottom:4px;left:50%;transform:translateX(-50%);width:4px;height:4px;border-radius:50%;background:#a2aaa5;}
@media(max-width:480px){.journey-date-picker-row {gap:8px;}.journey-selected-date {font-size:.85rem;}}

/* FoxKid 0.5.4 — icônes de zones */
.zone-card-title { font-size:1.02rem; }
.zone-icon-picker { margin:0; padding:12px; border:1px solid var(--line); border-radius:14px; }
.zone-icon-picker legend { padding:0 6px; font-weight:800; }
.zone-icon-grid { display:grid; grid-template-columns:repeat(5,minmax(72px,1fr)); gap:8px; margin:4px 0 8px; }
.zone-icon-grid label { cursor:pointer; margin:0; }
.zone-icon-grid input { position:absolute; opacity:0; pointer-events:none; }
.zone-icon-grid span { min-height:64px; display:flex; flex-direction:column; justify-content:center; align-items:center; gap:3px; padding:8px 5px; border:1px solid var(--line); border-radius:12px; background:#fff; font-size:1.5rem; text-align:center; }
.zone-icon-grid small { font-size:.68rem; line-height:1.1; color:var(--muted); }
.zone-icon-grid input:checked + span { border:2px solid var(--fox); background:#edf7f2; box-shadow:0 0 0 2px rgba(36,89,74,.08); }
.zone-icon-grid input:focus-visible + span { outline:3px solid rgba(36,89,74,.3); outline-offset:2px; }
.zone-map-icon-wrap,.journey-zone-icon-wrap { background:transparent!important; border:0!important; }
.zone-map-icon { width:32px; height:32px; display:flex; align-items:center; justify-content:center; border-radius:50%; background:#fff; border:2px solid #24594a; box-shadow:0 2px 8px rgba(0,0,0,.22); font-size:18px; }
.journey-zone-icon { width:28px; height:28px; display:flex; align-items:center; justify-content:center; border-radius:50%; background:#7846ae; border:2px solid #fff; box-shadow:0 2px 7px rgba(0,0,0,.25); font-size:15px; }
@media (max-width:640px){ .zone-icon-grid { grid-template-columns:repeat(3,minmax(72px,1fr)); } }

.zone-popup-edit-button { margin-top:8px; border:1px solid var(--line); border-radius:9px; padding:7px 10px; background:#fff; color:var(--fox); font-weight:800; cursor:pointer; }
.zone-popup-edit-button:hover,.zone-popup-edit-button:focus-visible { border-color:var(--fox); background:#eff8f1; }
.zone-radius-warning { display:block; margin-top:-4px; color:#8a5a16; }
.zone-radius-warning[hidden] { display:none; }

.zone-passage-options{border:1px solid var(--border,#d7e0dc);border-radius:12px;padding:.75rem .85rem;margin:.35rem 0 .65rem}.zone-passage-options legend{font-weight:700;padding:0 .25rem}.zone-passage-options .check{margin:.4rem 0}.zone-passage-options small{display:block;margin-top:.35rem}

/* FoxKid 0.5.6a — iOS/PWA stability. The page itself does not pinch-zoom;
   Leaflet maps keep their own gestures. */
html, body, #app-view { touch-action: pan-x pan-y; }
.leaflet-container { touch-action: none; }

/* Avoid nested horizontal scrolling / Safari repaint jumps in the zone editor. */
#zone-dialog { overflow: hidden; }
#zone-dialog .dialog-card {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  max-height: min(90vh, 850px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.zone-icon-grid { min-width: 0; }
.zone-icon-grid label, .zone-icon-grid span { min-width: 0; box-sizing: border-box; }
.zone-icon-grid input:checked + span {
  border-width: 1px;
  box-shadow: inset 0 0 0 1px var(--fox), 0 0 0 2px rgba(36,89,74,.08);
}
@media (max-width:640px) {
  #zone-dialog { width: calc(100% - 12px); }
  #zone-dialog .dialog-card { max-height: 88vh; padding: 16px; }
}


/* FoxKid 0.5.6b — séparation App FoxKid / Espace web */
.update-product-section { margin-top: 18px; padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.62); }
.update-product-section + .update-product-section { margin-top: 18px; }
.update-section-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.update-section-heading h3 { margin: 0; color: var(--forest); font-size: 1.18rem; }
.update-section-heading .eyebrow { margin-bottom: 3px; }
.web-update-section { background: #f8fbfa; }
.web-version-grid .update-card strong { overflow-wrap:anywhere; }
.settings-version-row { display:flex; align-items:center; justify-content:space-between; gap:12px; margin:10px 0; padding:10px 12px; border:1px solid var(--line); border-radius:12px; background:white; }
.settings-version-row span { color:var(--muted); font-size:.82rem; }
.settings-version-row strong { color:var(--forest); }
.button-link { display:block; text-align:center; text-decoration:none; }
@media (max-width:600px) { .update-product-section { padding:14px; } .update-section-heading { align-items:center; } }


/* FoxKid 0.5.7 — sélecteur d'icônes stable sur iOS.
   Le dialog est lui-même la zone scrollable : pas de double calque de défilement
   ni de radio transparent qui force Safari à recomposer le formulaire. */
#zone-dialog {
  width: min(560px, calc(100% - 12px));
  max-height: min(92dvh, 850px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  box-sizing: border-box;
}
#zone-dialog .dialog-card {
  width: 100%;
  max-width: 100%;
  max-height: none;
  overflow: visible;
  box-sizing: border-box;
}
.zone-icon-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.zone-icon-choice {
  min-width: 0;
  min-height: 64px;
  margin: 0;
  padding: 8px 5px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: inherit;
  font: inherit;
  cursor: pointer;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
.zone-icon-choice > span { min-height: 0; padding: 0; border: 0; background: transparent; box-shadow: none; font-size: 1.5rem; }
.zone-icon-choice small { font-size: .68rem; line-height: 1.1; color: var(--muted); }
.zone-icon-choice.is-selected,
.zone-icon-choice[aria-pressed="true"] {
  border-color: var(--fox);
  background: #edf7f2;
  box-shadow: inset 0 0 0 1px var(--fox), 0 0 0 2px rgba(36,89,74,.08);
}
.zone-icon-choice:focus-visible { outline: 3px solid rgba(36,89,74,.3); outline-offset: 2px; }
@media (max-width: 640px) {
  #zone-dialog { width: calc(100% - 10px); max-height: 92dvh; }
  #zone-dialog .dialog-card { padding: 16px; }
  .zone-icon-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* FoxKid 0.5.7 — trajet en direct. */
.journey-live-panel { margin: 14px 0 22px; padding: 16px; border: 1px solid #cfe0d8; border-radius: 18px; background: linear-gradient(180deg,#f8fcfa,#f3f8f5); }
.journey-live-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:12px; }
.journey-live-heading h3 { margin:0; color:var(--forest); }
.journey-live-heading .eyebrow { margin-bottom:3px; }
.journey-live-badge { flex:0 0 auto; padding:6px 9px; border-radius:999px; font-size:.78rem; font-weight:800; white-space:nowrap; }
.journey-live-badge.is-live { color:#16633e; background:#ddf4e7; }
.journey-live-badge.is-waiting { color:#755317; background:#fff0c9; }
.journey-live-badge.is-stale { color:#7a3030; background:#fde4e4; }
.journey-live-status-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; margin-bottom:12px; }
.journey-live-status-grid article { min-width:0; padding:11px; border:1px solid var(--line); border-radius:12px; background:#fff; }
.journey-live-status-grid span,.journey-live-status-grid small { display:block; color:var(--muted); }
.journey-live-status-grid span { font-size:.76rem; }
.journey-live-status-grid strong { display:block; margin-top:5px; overflow-wrap:anywhere; font-size:.98rem; font-variant-numeric:tabular-nums; }
.journey-live-status-grid small { margin-top:5px; font-size:.72rem; line-height:1.35; }
.journey-live-map-wrap { position:relative; }
#journey-live-map { height:min(46vh,390px); min-height:270px; border:1px solid var(--line); border-radius:14px; overflow:hidden; background:#e9efeb; }
.journey-live-follow { position:absolute; z-index:500; top:10px; left:50px; min-height:34px; padding:6px 10px; border:1px solid rgba(36,89,74,.35); border-radius:9px; background:rgba(255,255,255,.94); color:var(--forest); font-weight:800; box-shadow:0 1px 5px rgba(0,0,0,.14); cursor:pointer; }
.journey-live-follow[aria-pressed="true"] { background:#e5f6ec; border-color:#5e9b7e; }
#journey-live-feedback { margin:10px 0 0; font-size:.8rem; line-height:1.45; }
@media (max-width: 850px) { .journey-live-status-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width: 520px) {
  .journey-live-panel { padding:12px; }
  .journey-live-heading { align-items:center; }
  .journey-live-status-grid { grid-template-columns:1fr 1fr; gap:6px; }
  .journey-live-status-grid article { padding:9px; }
  #journey-live-map { min-height:245px; }
  .journey-live-follow { left:48px; right:10px; width:auto; }
}

/* 0.5.8 — Indicateurs de zone compacts, libellés au survol et au toucher. */
.zone-card { display:grid; grid-template-columns:minmax(0,1fr) auto; }
.zone-card > div:first-child { min-width: 0; }
.zone-status-indicators { grid-column:1/-1; display:flex; flex-wrap:wrap; align-items:center; gap:2px; margin-top:8px; }
.zone-card .zone-status-icon { display:inline-flex; align-items:center; justify-content:center; padding:4px; width:32px; height:34px; background:transparent; border:0; cursor:pointer; border-radius:6px; }
.zone-status-icon svg { width:26px; height:24px; flex-shrink:0; }
.zone-card .zone-status-icon.is-on { color:#137642; }
.zone-card .zone-status-icon.is-off { color:#b92d36; }
.zone-status-icon:focus-visible { outline:2px solid var(--ink); outline-offset:2px; }
.journey-live-legend { display:flex; flex-wrap:wrap; align-items:center; gap:8px; color:var(--muted); font-size:.85rem; }
.journey-live-line { display:inline-block; width:25px; height:0; }
.journey-live-line.blue { border-top:4px solid #2573ec; }
.journey-live-line.red { border-top:3px dashed #c13d3d; }
@media (pointer:coarse) { .zone-card .zone-status-icon { height:44px; } }

/* PWA : checklist privée et notes enregistrables. */
.pwa-panel { min-width:0; }
.pwa-tabs { display:flex; border-bottom:1px solid var(--line,#d8e0eb); margin:18px 0; }
.pwa-tabs [role=tab] { background:#e8f1ff; color:#174b89; border:0; border-bottom:3px solid #2765b0; border-radius:8px 8px 0 0; padding:12px 18px; }
.pwa-checklist-toolbar,.pwa-test-actions { display:flex; flex-wrap:wrap; align-items:center; gap:10px; margin:12px 0; }
.pwa-test { min-width:0; margin:22px 0; padding:18px; border:1px solid #cbd5e1; border-radius:12px; }
.pwa-test legend { max-width:100%; padding:0 6px; font-weight:700; overflow-wrap:anywhere; }
.pwa-test p { line-height:1.6; overflow-wrap:anywhere; }
.pwa-test-choices { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; margin:16px 0; }
.pwa-test-choices label { display:flex; align-items:center; gap:9px; min-height:48px; padding:9px; margin:0; border:1px solid #cbd5e1; border-radius:8px; cursor:pointer; font-weight:400; }
.pwa-test-choices label:has(input:checked) { border-color:#2868ae; background:#eaf3ff; color:#163d69; }
.pwa-test-choices input { flex:0 0 auto; width:18px; height:18px; margin:0; accent-color:#2765b0; }
.pwa-test textarea,#pwa-checklist-output { box-sizing:border-box; width:100%; resize:vertical; font:inherit; font-size:16px; padding:10px; min-height:86px; border:1px solid #a9b8cc; border-radius:8px; }
.pwa-test-actions [data-feedback] { flex:1 1 180px; font-size:.9rem; }
.pwa-test-conflict { background:#fff5d8; color:#4d3900; padding:12px; border-radius:8px; }
.pwa-test-conflict p { white-space:pre-wrap; }
.pwa-test-conflict button { margin:4px; }
@media(max-width:540px) { .pwa-test {padding:12px;} .pwa-test-choices {grid-template-columns:1fr;} }

/* 0.5.10 : aucune action ne peut chevaucher la description d'une zone. */
.zone-card { grid-template-columns:minmax(0,1fr); gap:8px; }
.zone-card > div:first-child { grid-column:1; width:100%; overflow-wrap:anywhere; }
.zone-card .zone-card-actions { grid-column:1; display:flex; flex-direction:row; flex-wrap:nowrap; justify-content:flex-end; align-items:center; gap:6px; }
.zone-card .zone-card-actions button,.zone-popup-actions button { display:inline-flex; align-items:center; justify-content:center; flex:0 0 44px; width:44px; height:44px; padding:6px; border:1px solid var(--line); border-radius:10px; background:#fff; font-size:20px; }
.zone-card .zone-delete-button,.zone-popup-delete-button { color:#b92d36; }
.zone-popup-actions { display:flex; gap:6px; margin-top:8px; }
.zone-popup-actions .zone-popup-edit-button { margin:0; }
.zone-card .zone-status-indicators { margin:0; }
#journey-live-panel[hidden] { display:none!important; }

.pwa-share-panel {margin:14px 0;padding:12px;border:1px solid var(--line);border-radius:10px;}
.pwa-share-panel summary {cursor:pointer;font-weight:700;}
#pwa-share-url {box-sizing:border-box;width:100%;font-size:16px;margin:8px 0;}

.journey-endpoint-icon {background:transparent;border:0;}
.journey-endpoint-icon svg {display:block;filter:drop-shadow(0 1px 2px #0006);}

.zone-passage-options .is-disabled {opacity:.55;cursor:not-allowed;}
.zone-passage-options label.is-disabled input {cursor:not-allowed;}
