/* Commerçants de Bruges — mock mobile PWA */
:root {
  --cdb-mint: #acdda7;
  --cdb-green: #618f69;
  --cdb-teal: #63c8ca;
  --bg: #f3f8f2;
  --surface: #fffcf9;
  --ink: #1e2a22;
  --muted: #5a6e5f;
  --line: rgba(97, 143, 105, 0.22);
  --brand: #618f69;
  --brand-soft: #4d7356;
  --accent: #63c8ca;
  --accent-ink: #1a5c5e;
  --open: #4a7d59;
  --closed: #a34a4a;
  --radius: 14px;
  --nav-h: 64px;
  --header-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  font-family: "DM Sans", system-ui, sans-serif;
}

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

html {
  height: 100%;
  height: -webkit-fill-available;
}

html,
body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: -webkit-fill-available;
  padding-top: calc(var(--header-h) + var(--safe-t));
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 8px);
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
  overscroll-behavior-y: contain;
}

.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
  height: calc(var(--header-h) + var(--safe-t));
  padding: var(--safe-t) 12px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(243, 248, 242, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  z-index: 50;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.header-account {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
  min-width: 0;
  max-width: 46%;
}

.header-prenom {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--brand);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 7.5rem;
}

.header-prenom[hidden] {
  display: none !important;
}

.brand-mark {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  overflow: hidden;
  box-shadow: 0 1px 6px rgba(97, 143, 105, 0.22);
}

.brand-mark-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  line-height: 1.08;
}

.brand-kicker {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.brand-title {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: clamp(1.12rem, 4.2vw, 1.42rem);
  color: var(--ink);
  letter-spacing: -0.04em;
}

.acteur-emoji,
.commerce-emoji {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "Twemoji Mozilla",
    sans-serif;
  font-style: normal;
  line-height: 1;
}

.big-ico.acteur-emoji,
.big-ico.commerce-emoji {
  font-size: 2.6rem;
}

.agenda-ico.acteur-emoji,
.agenda-ico.commerce-emoji {
  line-height: 1;
}

.btn-icon {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--line);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:active {
  transform: scale(0.96);
}

.view {
  display: none;
  padding: 12px 14px 24px;
  animation: fadeIn 0.2s ease;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Pas de transform ici : sur iOS, translateX + fixed fait parfois « sauter » la barre du bas */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  gap: 4px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px rgba(26, 31, 30, 0.06);
  z-index: 100;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.nav-item {
  flex: 1;
  border: none;
  background: none;
  padding: 6px 2px 8px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  max-width: 92px;
}

.nav-item .nav-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: none;
  line-height: 1.1;
}

.nav-item .ui-icon {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  color: rgba(97, 143, 105, 0.5);
}

.nav-item.active {
  color: var(--brand);
}

.nav-item.active .ui-icon {
  color: var(--cdb-teal);
  transform: scale(1.05);
}

.nav-item.nav-item--guest .nav-label {
  opacity: 0.65;
}

.nav-item.nav-item--guest .ui-icon {
  opacity: 0.55;
}

.ui-icon {
  display: block;
  shape-rendering: geometricPrecision;
}

.btn-icon .ui-icon {
  width: 24px;
  height: 24px;
  color: var(--cdb-green);
}

.star-fav-svg {
  display: block;
  color: rgba(97, 143, 105, 0.42);
}

.star-fav.on .star-fav-svg {
  color: #618f69;
  filter: drop-shadow(0 0 5px rgba(99, 200, 202, 0.35));
}

.fav-chip-inner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.fav-chip-inner .star-fav-svg {
  flex-shrink: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.pill-open {
  background: rgba(172, 221, 167, 0.42);
  color: var(--open);
}

.pill-closed {
  background: rgba(157, 59, 59, 0.12);
  color: var(--closed);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.toolbar h1 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.35rem;
  color: var(--brand);
}

.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.chip.on {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.wall-fav-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: -2px 0 8px;
  min-height: 26px;
}

.compte-actions-bottom {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 24px;
}

.chip-fav-mini {
  padding: 4px 11px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.2;
}

.chip.chip-fav {
  display: inline-flex;
  align-items: center;
  width: 100%;
  max-width: 100%;
  justify-content: center;
}

.chip.chip-fav .fav-chip-inner {
  justify-content: center;
}

.chip.chip-fav .star-fav-svg {
  color: rgba(97, 143, 105, 0.55);
}

.chip.chip-fav.on .star-fav-svg {
  color: #fff;
  filter: none;
}

.post {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  margin-bottom: 12px;
  overflow: hidden;
}

.actor-kind-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 2px 8px;
  border: 1px solid transparent;
}

.actor-kind-badge-commerce {
  background: rgba(172, 221, 167, 0.2);
  color: var(--brand);
  border-color: rgba(97, 143, 105, 0.22);
}

.actor-kind-badge-service-public {
  background: rgba(38, 93, 171, 0.12);
  color: #244b8a;
  border-color: rgba(38, 93, 171, 0.28);
}

.actor-kind-badge-association {
  background: rgba(116, 79, 174, 0.12);
  color: #5a3f8c;
  border-color: rgba(116, 79, 174, 0.28);
}

.post.actor-kind-service-public,
.agenda-card.actor-kind-service-public,
.annuaire-row.actor-kind-service-public {
  background: linear-gradient(180deg, rgba(38, 93, 171, 0.06), rgba(255, 255, 255, 0)) var(--surface);
}

.post.actor-kind-association,
.agenda-card.actor-kind-association,
.annuaire-row.actor-kind-association {
  background: linear-gradient(180deg, rgba(116, 79, 174, 0.06), rgba(255, 255, 255, 0)) var(--surface);
}

.post-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 8px;
}

.post-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--line);
}

.post-meta {
  flex: 1;
  min-width: 0;
}

.post-meta .name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Safari iOS : sans couleur explicite, les <button> du mur prennent le bleu « lien » système */
.post-meta .link-acteur,
.post-meta .link-commerce {
  color: var(--ink);
  -webkit-text-fill-color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
  text-decoration: none;
}

.post-meta .time {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
}

.post-body {
  padding: 0 12px 12px;
  font-size: 0.92rem;
  line-height: 1.58;
}

.post-photos {
  display: grid;
  gap: 4px;
  margin-top: 8px;
}

.post-photos.one {
  grid-template-columns: 1fr;
}

.post-photos.two {
  grid-template-columns: 1fr 1fr;
}

.post-photos img {
  width: 100%;
  border-radius: 10px;
  display: block;
  max-height: 220px;
  object-fit: cover;
}

.post-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px 12px;
  border-top: 1px solid var(--line);
  min-height: 48px;
}

.btn-like {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  background: transparent;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 10px;
  min-width: 4.75rem;
}

.btn-like .like-count {
  min-width: 1.25em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.btn-like.liked {
  color: var(--brand-soft);
  background: rgba(97, 143, 105, 0.16);
}

.btn-like:hover:not(:disabled):not(.liked) {
  background: rgba(97, 143, 105, 0.06);
}

.btn-like:disabled {
  opacity: 0.85;
  cursor: not-allowed;
  background: transparent;
}

.star-fav {
  border: none;
  background: rgba(172, 221, 167, 0.2);
  cursor: pointer;
  padding: 6px;
  line-height: 0;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.star-fav.on {
  background: rgba(99, 200, 202, 0.18);
}

.end-list {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  padding: 16px 8px 8px;
}

#view-agenda.view {
  padding-top: 8px;
}

.agenda-day {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1rem;
  color: var(--brand);
  margin: 18px 0 8px;
}

#view-agenda .agenda-day:first-child {
  margin-top: 0;
}

.agenda-card {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  outline: none;
}

.agenda-card:focus-visible {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--cdb-teal);
}

.agenda-card-thumb-wrap {
  flex-shrink: 0;
  width: 100px;
  min-height: 88px;
  background: var(--bg);
}

.agenda-card-thumb {
  width: 100%;
  height: 100%;
  min-height: 88px;
  object-fit: cover;
  display: block;
}

.agenda-card-body {
  flex: 1;
  min-width: 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
}

.agenda-card-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.agenda-card-copy {
  flex: 1;
  min-width: 0;
}

.agenda-ico {
  font-size: 1.55rem;
  line-height: 1;
  flex-shrink: 0;
}

.agenda-card h3 {
  margin: 0 0 4px;
  font-size: 0.95rem;
}

.agenda-card .sub {
  font-size: 0.82rem;
  color: var(--muted);
}

.agenda-card .link-acteur,
.agenda-card .link-commerce {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--brand-soft);
  cursor: pointer;
  text-decoration: none;
}

.agenda-card .link-acteur:active,
.agenda-card .link-commerce:active {
  opacity: 0.85;
}

.agenda-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.event-hero {
  margin: -4px -16px 14px;
  border-radius: 0;
  overflow: hidden;
  max-height: 200px;
}

.event-hero img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}

.event-hero--placeholder {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, rgba(172, 221, 167, 0.35), rgba(99, 200, 202, 0.2));
}

.event-when {
  font-weight: 700;
  color: var(--brand);
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.event-organisateur {
  margin: 0 0 12px;
  font-size: 0.9rem;
  line-height: 1.45;
}

.event-detail {
  margin: 0 0 16px;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--ink);
}

.event-modal-meta {
  margin-bottom: 16px;
}

#event-body .btn-primary {
  margin-top: 0;
}

.search-bar {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 1rem;
  margin-bottom: 12px;
}

#map-annuaire {
  height: 200px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  margin-bottom: 12px;
  z-index: 1;
}

.annuaire-row {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 10px;
  cursor: pointer;
  align-items: flex-start;
}

.annuaire-row img {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: cover;
}

.annuaire-row .txt {
  flex: 1;
  min-width: 0;
}

.annuaire-row h3 {
  margin: 0 0 4px;
  font-size: 0.95rem;
}

.annuaire-row .typo {
  font-size: 0.8rem;
  color: var(--muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 31, 30, 0.45);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 110%);
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  z-index: 101;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.15);
}

.modal.show {
  transform: translate(-50%, 0);
}

.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--line);
  border-radius: 4px;
  margin: 10px auto 6px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 16px 12px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.2rem;
}

.modal-body {
  overflow-y: auto;
  padding: 16px;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.modal-close {
  border: none;
  background: var(--bg);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 1.2rem;
  cursor: pointer;
}

.fiche-hero {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.fiche-hero img.cover {
  width: 88px;
  height: 88px;
  border-radius: 16px;
  object-fit: cover;
}

.fiche-hero .big-ico {
  font-size: 2.5rem;
  line-height: 1;
}

.fiche-block {
  margin-bottom: 18px;
}

.fiche-block h4 {
  margin: 0 0 8px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.fiche-block p,
.fiche-block a {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--ink);
}

.fiche-block a {
  color: var(--brand-soft);
  word-break: break-all;
}

.horaire-exception-aujourdhui {
  margin: 0 0 12px;
  padding: 10px 12px;
  font-size: 0.88rem;
  line-height: 1.45;
  background: rgba(97, 143, 105, 0.1);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
}

.horaire-exceptions-wrap {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.horaire-exc-title {
  margin: 0 0 6px;
  font-family: Fraunces, Georgia, serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
}

.horaire-exc-hint {
  margin: 0 0 10px;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--muted);
}

.horaire-exc-list {
  margin: 0;
  padding-left: 1.15rem;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--ink);
}

.horaire-exc-date {
  font-weight: 600;
  color: var(--brand-soft);
}

.horaire-line {
  display: flex;
  justify-content: space-between;
  font-size: 0.86rem;
  padding: 4px 0;
  border-bottom: 1px dashed var(--line);
}

#map-fiche {
  height: 180px;
  border-radius: var(--radius);
  margin-top: 8px;
  border: 1px solid var(--line);
}

.view-assistant-page.view {
  padding-top: 4px;
  padding-bottom: 4px;
}

/*
  Hauteur par défaut : uniquement CSS (fiable à l’arrivée sur l’onglet).
  --assistant-panel-h n’est posé par JS que quand le clavier réduit le visualViewport.
*/
#view-assistant.view-assistant-page.active {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  height: var(
    --assistant-panel-h,
    calc(100dvh - var(--header-h) - var(--nav-h) - var(--safe-t) - var(--safe-b) - 8px)
  );
  max-height: var(
    --assistant-panel-h,
    calc(100dvh - var(--header-h) - var(--nav-h) - var(--safe-t) - var(--safe-b) - 8px)
  );
  min-height: 220px;
  overflow: hidden;
}

.assistant-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.assistant-chat {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-anchor: none;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 10px;
  padding: 4px 2px 12px;
  margin: 0;
  background: transparent;
  border-radius: 0;
  scroll-padding-bottom: 12px;
}

/* Evite la compression verticale des bulles (source de superpositions sur petits écrans). */
.assistant-chat > * {
  flex-shrink: 0;
}

/* Pousse les bulles vers le bas quand peu de messages ; ne gêne pas le scroll jusqu’en bas (contrairement à justify-content: flex-end). */
.assistant-chat-spacer {
  flex: 1 1 auto;
  min-height: 0;
}

/* Ancre réelle du bas du fil (scrollIntoView fiable sur Android / PWA). */
.assistant-chat-end {
  width: 100%;
  height: 1px;
  flex-shrink: 0;
  overflow: hidden;
  pointer-events: none;
}

.assistant-compose {
  flex-shrink: 0;
  margin: 0 -14px 0;
  padding: 10px 14px max(2px, var(--safe-b));
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 24px rgba(26, 31, 30, 0.05);
}

.assistant-compose--locked {
  opacity: 0.92;
  pointer-events: none;
}

.bubble {
  max-width: 90%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.45;
  flex-shrink: 0;
  overflow-wrap: anywhere;
}

.bubble.user {
  align-self: flex-end;
  background: var(--brand);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.bubble.bot {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}

.bubble.bot .assistant-md {
  display: block;
  font-size: 0.95rem;
  line-height: 1.45;
  word-break: break-word;
}

.bubble.bot .assistant-md p {
  margin: 0.35em 0;
}

.bubble.bot .assistant-md p:first-child {
  margin-top: 0;
}

.bubble.bot .assistant-md p:last-child {
  margin-bottom: 0;
}

.bubble.bot .assistant-md strong {
  font-weight: 700;
}

.bubble.bot .assistant-md ul,
.bubble.bot .assistant-md ol {
  margin: 0.35em 0;
  padding-left: 1.25em;
}

.bubble.bot .assistant-md a {
  color: var(--accent);
  text-decoration: underline;
}

/* Attente de réponse : petits points animés (masqués dès que le texte arrive) */
.bubble.bot.assistant-stream {
  min-height: 2.5rem;
}

.assistant-typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 0;
}

.assistant-stream-inner:not(:empty) ~ .assistant-typing {
  display: none;
}

.assistant-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  opacity: 0.45;
  animation: assistant-typing-pulse 1.05s ease-in-out infinite;
}

.assistant-typing-dot:nth-child(2) {
  animation-delay: 0.18s;
}

.assistant-typing-dot:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes assistant-typing-pulse {
  0%,
  70%,
  100% {
    opacity: 0.35;
    transform: translateY(0) scale(1);
  }
  35% {
    opacity: 1;
    transform: translateY(-4px) scale(1.05);
  }
}

.assistant-input-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.assistant-input-row input {
  flex: 1;
  min-height: 46px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  font-size: 1rem;
  background: var(--bg);
  touch-action: manipulation;
}

.assistant-input-row button {
  padding: 0 16px;
  min-height: 46px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  flex-shrink: 0;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-size: 1rem;
  font-family: inherit;
  color: var(--ink);
  background-color: var(--surface);
  box-sizing: border-box;
}

.form-group select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath fill='%235a6e5f' d='M7 9L0 0h14z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 11px auto;
}

.form-group input[type='date'] {
  appearance: none;
  -webkit-appearance: none;
}

.form-group input[type='date']::-webkit-calendar-picker-indicator {
  opacity: 0.75;
  cursor: pointer;
}

.btn-primary {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 8px;
}

.btn-ghost {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
}

.hint-box {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 0.85rem;
  line-height: 1.5;
  margin-top: 12px;
}

.fav-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}

.fav-list-item button {
  border: none;
  background: none;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
}

.install-prompt {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--nav-h) + var(--safe-b) + 6px);
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 12px;
  z-index: 102;
  pointer-events: none;
}

.install-prompt:not([hidden]) {
  pointer-events: auto;
  animation: install-prompt-in 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes install-prompt-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.install-prompt-inner {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px 12px;
  box-shadow: 0 10px 36px rgba(26, 31, 30, 0.12);
}

.install-prompt-title {
  margin: 0 0 6px;
  font-family: Fraunces, Georgia, serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
}

.install-prompt-text {
  margin: 0 0 14px;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--muted);
}

.install-prompt-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.install-prompt-actions .btn-primary {
  width: 100%;
  justify-content: center;
}

.install-prompt-actions .btn-ghost {
  width: 100%;
  justify-content: center;
}

.install-prompt-never {
  border: none;
  background: none;
  padding: 4px 0 0;
  font-size: 0.75rem;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-b) + 20px);
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
  z-index: 200;
  opacity: 0;
  transition: transform 0.25s, opacity 0.25s;
  max-width: 90%;
  text-align: center;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.leaflet-container {
  font-family: inherit;
}

@media (min-width: 481px) {
  body {
    box-shadow: 0 0 0 1px var(--line);
  }
}

/* Écran large type bureau : QR (pas l’app). Exclut le paysage téléphone : large mais peu haut. */
.desktop-qr-gate {
  display: none;
}

@media (min-width: 601px) and (min-height: 500px) {
  body {
    padding: 0;
    max-width: none;
    box-shadow: none;
  }

  #app-mobile {
    display: none !important;
  }

  .desktop-qr-gate {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    background: linear-gradient(165deg, var(--bg) 0%, #e4efe2 42%, var(--surface) 100%);
    padding: 32px 20px;
    overflow: auto;
  }

  .desktop-qr-inner {
    max-width: 440px;
    text-align: center;
  }

  .desktop-qr-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 28px;
    text-align: left;
  }

  .desktop-qr-kicker {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
  }

  .desktop-qr-title {
    display: block;
    font-family: Fraunces, Georgia, serif;
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.15;
  }

  .desktop-qr-h1 {
    margin: 0 0 12px;
    font-family: Fraunces, Georgia, serif;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--ink);
  }

  .desktop-qr-lead {
    margin: 0 0 24px;
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--muted);
  }

  .desktop-qr-figure {
    margin: 0 auto 20px;
    padding: 16px;
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    box-shadow: 0 12px 40px rgba(26, 31, 30, 0.08);
    display: inline-block;
  }

  .desktop-qr-img {
    display: block;
    width: min(280px, 70vw);
    height: auto;
    aspect-ratio: 1;
  }

  .desktop-qr-url {
    display: inline-block;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--brand);
    word-break: break-all;
    text-decoration: none;
    border-bottom: 1px solid rgba(97, 143, 105, 0.35);
  }

  .desktop-qr-url:hover {
    color: var(--brand-soft);
    border-bottom-color: var(--brand-soft);
  }
}
