:root {
  --bg: #f2f2f7;
  --card: #ffffff;
  --text: #1c1c1e;
  --muted: #8a8a8e;
  --sep: rgba(60, 60, 67, 0.16);
  --accent: #2563c9;
  --accent-soft: rgba(37, 99, 201, 0.12);
  --pos: #1f9d55;
  --neg: #d7372f;
  --warn: #b26a00;
  --warn-bg: #fff4de;
  --chip: #e9e9ee;
  --seg-on: #ffffff;
  --bar: rgba(242, 242, 247, 0.86);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  --radius: 12px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

/* Mode sombre : automatique (réglage de l'appareil) sauf si « Clair » est choisi dans les Réglages… */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --card: #1c1c1e;
    --text: #f2f2f7;
    --muted: #8e8e93;
    --sep: rgba(84, 84, 88, 0.6);
    --accent: #5b9bff;
    --accent-soft: rgba(91, 155, 255, 0.18);
    --pos: #3ecf7a;
    --neg: #ff6a5f;
    --warn: #ffb340;
    --warn-bg: #2e2412;
    --chip: #2c2c2e;
    --seg-on: #636366;
    --bar: rgba(0, 0, 0, 0.8);
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

/* …ou forcé si « Sombre » est choisi */
:root[data-theme="dark"] {
  --bg: #000000;
  --card: #1c1c1e;
  --text: #f2f2f7;
  --muted: #8e8e93;
  --sep: rgba(84, 84, 88, 0.6);
  --accent: #5b9bff;
  --accent-soft: rgba(91, 155, 255, 0.18);
  --pos: #3ecf7a;
  --neg: #ff6a5f;
  --warn: #ffb340;
  --warn-bg: #2e2412;
  --chip: #2c2c2e;
  --seg-on: #636366;
  --bar: rgba(0, 0, 0, 0.8);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
}
body.sheet-open { overflow: hidden; }

a { color: var(--accent); text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }

.muted { color: var(--muted); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.grow { flex: 1; min-width: 0; }

/* ---------- Barre de navigation ---------- */

.bar {
  position: sticky; top: 0; z-index: 10;
  display: grid; grid-template-columns: minmax(80px, 1fr) auto minmax(80px, 1fr); align-items: center;
  gap: 8px;
  padding: calc(var(--safe-top) + 6px) 12px 8px;
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--sep);
}
/* Titre sur 2 lignes au maximum s'il est trop long */
.bar-title {
  margin: 0; font-size: 17px; line-height: 1.2; font-weight: 600; text-align: center; max-width: 56vw;
  overflow: hidden; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.bar-btn { min-height: 36px; display: inline-flex; align-items: center; color: var(--accent); }
.bar > :last-child { justify-self: end; }
.bar-btn.icon { width: 36px; justify-content: center; }
.bar-btn.text { font-size: 17px; }
.bar-btn.strong { font-weight: 600; }
.bar-btn.back { gap: 6px; }

.content {
  max-width: 720px; margin: 0 auto;
  padding: 16px 16px calc(var(--safe-bottom) + 110px);
}

/* ---------- Listes ---------- */

.list {
  list-style: none; margin: 0 0 20px; padding: 0;
  background: var(--card); border-radius: var(--radius); overflow: hidden;
}
.row {
  position: relative; display: flex; align-items: center; gap: 12px;
  min-height: 48px; padding: 10px 16px;
}
.row + .row::before {
  content: ""; position: absolute; top: 0; right: 0; left: 16px;
  border-top: 0.5px solid var(--sep);
}
.row[data-act], .row-link { cursor: pointer; }
.row[data-act]:active, .row-link:active { background: var(--chip); }
.chev { color: var(--muted); opacity: 0.6; flex: none; }

/* Monuments (SVG) : même encombrement qu'un emoji */
.mon-svg { display: inline-block; width: 1.15em; height: 1.15em; vertical-align: -0.2em; }
/* Drapeaux de régions (SVG) : même encombrement qu'un emoji */
.flag-svg {
  display: inline-block; width: 1.25em; height: 0.84em; vertical-align: -0.08em;
  border-radius: 2px; box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.25);
}

.title-icon { font-weight: 400; }
.icon-details { margin-bottom: 20px; }
.icon-details summary {
  list-style: none; cursor: pointer; background: var(--card); border-radius: var(--radius);
}
.icon-details summary::-webkit-details-marker { display: none; }
.icon-details[open] summary { border-radius: var(--radius) var(--radius) 0 0; }
.icon-details[open] summary .chev { transform: rotate(90deg); }
.icon-details .icon-picker { border-radius: 0 0 var(--radius) var(--radius); margin-bottom: 0; max-height: 320px; overflow-y: auto; }
.icon-current { font-size: 24px; line-height: 1; }

/* En tête du voyage : icône, nom et destination ; titre compact dans la barre une fois qu'il a défilé */
.trip-heading {
  display: flex; align-items: center; gap: 12px; margin: -2px 0 14px; padding-bottom: 14px;
  border-bottom: 0.5px solid var(--sep); text-align: left;
}
.heading-icon {
  flex: none; width: 48px; height: 48px; display: grid; place-items: center;
  border-radius: 13px; background: var(--chip); font-size: 28px; line-height: 1;
}
.heading-text { min-width: 0; }
.heading-text h2 { margin: 0; font-size: 28px; line-height: 1.15; font-weight: 700; overflow-wrap: break-word; }
.heading-text p { margin: 2px 0 0; font-size: 16px; color: var(--muted); }
.bar-title.compact { opacity: 0; transition: opacity 0.2s; }
.bar-title.compact.show { opacity: 1; }

.author-note { margin: 0 16px 12px; font-size: 13px; color: var(--muted); }
.small-muted { font-size: 12px; color: var(--muted); }

.section-title {
  display: flex; justify-content: space-between; margin: 20px 16px 6px;
  font-size: 13px; font-weight: 500; letter-spacing: 0.02em; text-transform: uppercase; color: var(--muted);
}
.section-title span:last-child { font-variant-numeric: tabular-nums; text-transform: none; }
.section-title .pos, .section-title .neg { opacity: 0.85; }

/* Résumé du voyage */
.summary {
  background: var(--card); border-radius: var(--radius); padding: 18px 16px; text-align: center; margin-bottom: 8px;
}

/* Réglages */
.group-title { margin: 22px 16px 6px; font-size: 13px; font-weight: 400; text-transform: uppercase; letter-spacing: 0.02em; color: var(--muted); }
.group-note { margin: -12px 16px 20px; font-size: 13px; color: var(--muted); }
.setting .value { margin-left: auto; color: var(--muted); text-align: right; font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
.setting .value.code { font-family: ui-monospace, Menlo, monospace; letter-spacing: 0.08em; color: var(--text); }
.setting.members { align-items: flex-start; }
.danger-text { color: var(--neg); }
.link { color: var(--accent); }
.link.small, .small { font-size: 15px; }
.link.strong { font-weight: 600; }
.version { text-align: center; color: var(--muted); font-size: 12px; }
.notice { margin-bottom: 16px; padding: 10px 14px; border-radius: 10px; background: var(--accent-soft); font-size: 14px; }
.hint { margin: 0 16px 10px; font-size: 14px; color: var(--muted); }

/* Vides / chargement */
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty-icon { font-size: 48px; margin-bottom: 8px; }
.center-screen { min-height: 80vh; display: grid; place-content: center; text-align: center; gap: 8px; padding: 24px; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--chip); border-top-color: var(--accent); animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Boutons */
.btn {
  display: inline-block; padding: 12px 20px; border-radius: 12px;
  background: var(--accent); color: #fff; font-weight: 600;
}
.btn.secondary { background: var(--accent-soft); color: var(--accent); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: 0.5; }
.fab {
  position: fixed; right: max(20px, calc(50vw - 340px)); bottom: calc(var(--safe-bottom) + 24px); z-index: 5;
  width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #fff; box-shadow: var(--shadow);
}
.fab:active { transform: scale(0.94); }
.action-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin: 0 0 12px;
  padding: 14px; border-radius: var(--radius); background: var(--card); color: var(--accent); font-weight: 500;
}
.danger-btn {
  display: block; width: 100%; margin: 8px 0 12px; padding: 14px; border-radius: var(--radius);
  background: var(--card); color: var(--neg); font-weight: 500;
}

/* ---------- Formulaires ---------- */

.group { background: var(--card); border-radius: var(--radius); margin-bottom: 20px; overflow: hidden; }
.frow {
  position: relative; display: flex; align-items: center; gap: 12px;
  min-height: 48px; padding: 6px 16px; width: 100%;
}
.frow + .frow::before, .frow + [hidden] + .frow::before {
  content: ""; position: absolute; top: 0; right: 0; left: 16px; border-top: 0.5px solid var(--sep);
}
.frow > span:first-child { flex: none; min-width: 88px; }
.frow input, .frow select, .frow textarea {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font-size: 17px; /* ≥16px : pas de zoom automatique sur iOS */
  text-align: right; padding: 6px 0;
}
.frow input[type=date] { -webkit-appearance: none; appearance: none; min-height: 36px; display: flex; justify-content: flex-end; }
.frow input::-webkit-date-and-time-value { text-align: right; }
.frow.col { flex-direction: column; align-items: stretch; gap: 2px; padding-top: 10px; }
.frow.col textarea { text-align: left; resize: vertical; }
.frow select { direction: rtl; color: var(--accent); cursor: pointer; }
.frow select option, .frow select optgroup { direction: ltr; }

.segmented {
  display: grid; grid-template-columns: 1fr 1fr; padding: 2px; margin-bottom: 16px;
  background: var(--chip); border-radius: 9px;
}
.segmented input, .chip input, .icon-grid input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; text-align: center; padding: 7px; border-radius: 7px; font-size: 15px; font-weight: 500; cursor: pointer; }
.segmented input:checked + span { background: var(--seg-on); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15); }
.segmented input[value=expense]:checked + span { color: var(--neg); }
.segmented input[value=income]:checked + span { color: var(--pos); }
.segmented input:focus-visible + span, .chip input:focus-visible + span, .icon-grid input:focus-visible + span { outline: 2px solid var(--accent); }

.icon-picker { background: var(--card); border-radius: var(--radius); padding: 4px 10px 10px; margin-bottom: 20px; }
.icon-group { margin: 10px 4px 4px; font-size: 12px; font-weight: 500; color: var(--muted); }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 4px; }
.icon-grid span {
  display: grid; place-items: center; aspect-ratio: 1; border-radius: 10px; font-size: 24px; cursor: pointer;
  border: 2px solid transparent;
}
.icon-grid input:checked + span { border-color: var(--accent); background: var(--accent-soft); }

.segmented.three { grid-template-columns: 1fr 1fr 1fr; }
.theme-choice { margin-bottom: 20px; }
.theme-note { margin-top: -12px !important; }
.segmented.nav-seg a { display: block; text-align: center; padding: 7px; border-radius: 7px; font-size: 15px; font-weight: 500; color: var(--text); }
.segmented.nav-seg a.on { background: var(--seg-on); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15); }


input.switch {
  flex: none !important; -webkit-appearance: none; appearance: none; position: relative;
  width: 51px; height: 31px; padding: 0 !important; border-radius: 16px; background: var(--chip) !important;
  transition: background 0.2s; cursor: pointer;
}
input.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25); transition: transform 0.2s;
}
input.switch:checked { background: var(--pos) !important; }
input.switch:checked::after { transform: translateX(20px); }
.frow:has(.switch) { justify-content: space-between; }

/* ---------- Voyages ---------- */

.trips .row { padding: 0; }
.row-link {
  flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0;
  min-height: 64px; padding: 12px 16px; color: inherit;
}
.trip-icon {
  flex: none; width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 11px; background: var(--chip); font-size: 22px; line-height: 1;
}
.trip-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.trip-name { font-size: 18px; font-weight: 600; line-height: 1.25; overflow-wrap: break-word; }
.trip-sub { font-size: 14px; color: var(--muted); overflow-wrap: break-word; }
.trip-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.badge {
  padding: 2px 8px; border-radius: 10px; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
  background: var(--accent-soft); color: var(--accent);
}
.badge.current { background: var(--pos); color: #fff; }


/* Étiquettes : référence copiable, « à payer » */
.step-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0; }
.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 8px;
  background: var(--chip); color: var(--text); font-size: 13px; font-weight: 500;
}
.tag.code { font-family: ui-monospace, Menlo, monospace; letter-spacing: 0.04em; color: var(--accent); background: var(--accent-soft); }
.tag.due { background: var(--warn-bg); color: var(--warn); }
.tag:active { filter: brightness(0.9); }

/* Formulaires : catégorie d'un lieu, dates et heures */
.kind-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 16px; }
.kind-grid input { position: absolute; opacity: 0; pointer-events: none; }
.kind-grid span {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px;
  border-radius: 10px; border: 1.5px solid transparent; background: var(--card);
  font-size: 12px; font-weight: 500; text-align: center; cursor: pointer;
}
.kind-grid i { font-style: normal; font-size: 22px; line-height: 1.2; }
.kind-grid input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.kind-grid input:focus-visible + span { outline: 2px solid var(--accent); }
.date-time { flex: 1; min-width: 0; display: flex; justify-content: flex-end; gap: 8px; }
.date-time input { flex: 0 1 auto !important; min-width: 0; }
.date-time input[type=time] { flex: 0 0 auto !important; width: 5.2em; }
.frow input[type=time] { -webkit-appearance: none; appearance: none; min-height: 36px; }
.frow input[name=price] { font-variant-numeric: tabular-nums; }
.frow select[name=currency] { flex: 0 0 auto; max-width: 7.5em; direction: ltr; text-align: right; }
@media (max-width: 380px) {
  .kind-grid { grid-template-columns: repeat(4, 1fr); }
  .frow > span:first-child { min-width: 76px; }
}

/* ---------- Page d'un voyage : carte et panneau ---------- */

body.map-mode { overflow: hidden; overscroll-behavior: none; }
.trip-page { position: fixed; inset: 0; }
.map { position: absolute; inset: 0; background: #e8e6e1; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.map-offline { display: grid; place-items: center; height: 100%; color: var(--muted); }
.leaflet-container { font: inherit; }
/* Fond de carte en mode sombre : couleurs inversées, teintes conservées */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(0.9) contrast(0.9); }
}
:root[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(0.9) contrast(0.9); }
.leaflet-control-attribution { font-size: 10px; }

.map-top {
  position: absolute; z-index: 600; top: calc(var(--safe-top) + 10px); left: 12px; right: 12px;
  display: flex; align-items: center; gap: 8px; pointer-events: none;
}
.map-top > * { pointer-events: auto; }
.map-btn {
  flex: none; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px;
  background: rgba(60, 60, 67, 0.72); color: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.map-btn.off { opacity: 0.5; }
.map-title {
  flex: 0 1 auto; min-width: 0; display: flex; align-items: center; gap: 6px; height: 46px; padding: 0 14px;
  margin-right: auto; border-radius: 14px; background: rgba(60, 60, 67, 0.72); color: #fff;
  font-weight: 600; font-size: 15px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.map-title-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 420px) { .map-title { visibility: hidden; flex: 1; } }

/* Marqueurs : icône de la catégorie dans une pastille de sa couleur */
.pin {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: #fff; border: 3px solid var(--c); font-size: 17px; line-height: 1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); transition: transform 0.15s;
}
.pin.selected { transform: scale(1.3); background: var(--c); box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.85), 0 3px 10px rgba(0, 0, 0, 0.35); }
.pin.dim { opacity: 0.35; }
.leaflet-tooltip.pin-label {
  display: none; padding: 3px 8px; border: 0; border-radius: 7px; background: rgba(44, 44, 46, 0.85);
  color: #fff; font-size: 13px; font-weight: 500; box-shadow: none;
}
.leaflet-tooltip.pin-label::before { display: none; }
.show-labels .leaflet-tooltip.pin-label, .leaflet-tooltip.pin-label.on { display: block; }
.day-pin {
  display: inline-grid; place-items: center; min-width: 44px; height: 26px; padding: 0 8px; border-radius: 13px;
  background: #fff; color: var(--accent); border: 2px solid var(--accent); font-size: 13px; font-weight: 800;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25); font-variant-numeric: tabular-nums; cursor: pointer;
}
.day-pin.on { background: var(--accent); color: #fff; }
.day-pin { white-space: nowrap; }
.leaflet-marker-icon.day-icon { pointer-events: none !important; }
.day-icon .day-pin { pointer-events: auto; }
.day-pin.floating { position: relative; left: 50%; transform: translateX(-50%); }
.day-pin.static { flex: none; box-shadow: none; cursor: inherit; }
.route-line { stroke: var(--accent); }

.pick-banner {
  position: absolute; z-index: 700; left: 12px; right: 12px; top: calc(var(--safe-top) + 66px);
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 14px;
  background: var(--card); box-shadow: var(--shadow); font-size: 15px; font-weight: 500;
}
.pick-banner span { flex: 1; }
body.picking .map-fab, body.picking .panel { display: none; }
body.picking .map { cursor: crosshair; }

/* Panneau des lieux : en bas de la carte (téléphone), à gauche (grand écran) */
.panel {
  position: absolute; z-index: 650; left: 0; right: 0; bottom: 0; height: 46%;
  display: flex; flex-direction: column; background: var(--card);
  border-radius: 18px 18px 0 0; box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  transition: height 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.panel[data-size="min"] { height: 118px; }
.panel[data-size="full"] { height: calc(100% - var(--safe-top) - 72px); }
.panel-grip { flex: none; display: grid; place-items: center; height: 22px; cursor: grab; touch-action: none; }
.panel-grip span { width: 40px; height: 5px; border-radius: 3px; background: var(--sep); }
@media (min-width: 900px) {
  .panel, .panel[data-size] {
    top: calc(var(--safe-top) + 70px); bottom: 16px; left: 16px; right: auto; width: 400px; height: auto !important;
    border-radius: 18px;
  }
  .panel-grip { display: none; }
  .map-title { margin-left: 404px; }
}
.tabs {
  flex: none; display: flex; align-items: center; gap: 4px; padding: 0 10px; overflow-x: auto;
  border-bottom: 0.5px solid var(--sep); scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; display: flex; align-items: center; padding: 10px 10px 9px; border-bottom: 3px solid transparent;
  font-size: 15px; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.tab.on { color: var(--accent); border-bottom-color: var(--accent); }
.panel-body {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: 8px 16px calc(var(--safe-bottom) + 90px);
}
.map-fab { z-index: 660; }
.panel-empty { margin: 16px 0; color: var(--muted); font-size: 15px; }
.panel-title { margin: 18px 0 4px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
.panel-back { display: inline-flex; align-items: center; gap: 6px; padding: 6px 0; color: var(--accent); font-size: 16px; }
.panel-back svg { width: 9px; height: 15px; }

.trip-summary { padding: 6px 0 4px; font-size: 15px; }
.trip-summary .muted { margin-top: 2px; font-size: 14px; }
.trip-status-inline { font-weight: 600; color: var(--accent); }
.trip-status-inline.current { color: var(--pos); }
.trip-memo { margin: 8px 0 0; font-size: 14px; color: var(--muted); white-space: pre-line; }

/* Listes du panneau : lieux, jours, vols */
.place-list, .day-list { list-style: none; margin: 0; padding: 0; }
.place-row, .day-row, .flight-row {
  position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; cursor: pointer;
}
.flight-row { cursor: default; }
.place-row + .place-row, .day-row + .day-row, .flight-row + .flight-row { border-top: 0.5px solid var(--sep); }
.place-row:active, .day-row:active { background: var(--chip); }
.day-row { align-items: center; }
.thumb { flex: none; width: 64px; height: 64px; border-radius: 12px; object-fit: cover; background: var(--chip); }
.thumb-icon { display: grid; place-items: center; font-size: 28px; background: color-mix(in srgb, var(--c) 18%, var(--card)); }
.flight-icon { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--chip); font-size: 20px; }
.place-text { flex: 1; min-width: 0; }
.place-name { font-size: 17px; font-weight: 600; line-height: 1.25; overflow-wrap: break-word; }
.place-meta { margin-top: 2px; font-size: 14px; color: var(--muted); overflow-wrap: break-word; }
.place-meta sup { font-size: 10px; color: var(--warn); }
.place-desc { margin-top: 3px; font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.place-text .tag { margin-top: 6px; }
.day-head { display: flex; align-items: center; gap: 10px; margin: 4px 0 6px; }
.day-head h2 { margin: 0; font-size: 20px; }

.search-box {
  display: flex; align-items: center; gap: 8px; margin: 6px 0; padding: 0 12px; border-radius: 12px;
  background: var(--chip); color: var(--muted);
}
.search-box input { flex: 1; min-width: 0; padding: 10px 0; border: 0; outline: 0; background: transparent; font-size: 17px; color: var(--text); }

/* Fiche d'un lieu */
.detail-top { display: flex; align-items: center; justify-content: space-between; }
.detail-head { display: flex; gap: 14px; margin: 6px 0 10px; }
.detail-head h2 { margin: 0; font-size: 22px; line-height: 1.2; overflow-wrap: break-word; }
.detail-photo { flex: none; width: 112px; height: 112px; border-radius: 16px; object-fit: cover; background: var(--chip); }
.detail-photo.thumb-icon { font-size: 48px; }
.cat-chip {
  display: inline-block; margin-top: 4px; padding: 2px 9px; border-radius: 8px; font-size: 13px; font-weight: 600;
  color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent);
}
.detail-when { margin-top: 6px; font-size: 14px; font-weight: 600; color: var(--accent); }
.detail-desc { margin: 0 0 10px; font-size: 16px; line-height: 1.45; white-space: pre-line; }
.info-list { list-style: none; margin: 12px 0; padding: 0; }
.info-list li { display: flex; gap: 12px; padding: 9px 0; font-size: 15px; border-top: 0.5px solid var(--sep); }
.info-list li > span { flex: none; width: 22px; text-align: center; }
.info-list li > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.info-list .pre { white-space: pre-line; }
.info-list .ig { font-weight: 700; color: #d6249f; }
.info-list .g { font-weight: 800; color: #4285f4; }
.panel-body .action-btn { background: var(--chip); }

/* Fiche d'un lieu (formulaire) */
.cat-grid { grid-template-columns: repeat(4, 1fr); }
@media (min-width: 560px) { .cat-grid { grid-template-columns: repeat(6, 1fr); } }
.import-box { margin-bottom: 8px; }
.import-box input { text-align: left !important; }
.sheet-note {
  margin: 0 0 14px; padding: 10px 14px; border-radius: var(--radius);
  background: var(--accent-soft); color: var(--text); font-size: 14px;
}
.photo-box { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; }
.photo-preview {
  flex: none; width: 96px; height: 96px; border-radius: 14px; overflow: hidden; background: var(--card);
  display: grid; place-items: center; color: var(--muted); font-size: 12px; text-align: center;
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-actions { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.tool-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 8px;
  border-radius: 10px; background: var(--card); color: var(--accent); font-size: 15px; font-weight: 500; cursor: pointer;
}
.tool-btn.busy { opacity: 0.5; pointer-events: none; }
.position-text { color: var(--muted); font-size: 15px; text-align: right; }
details.booking > summary { cursor: pointer; list-style: revert; }
.flight-head { min-height: 40px; font-weight: 600; }
.flights .group { margin-bottom: 12px; }
.choice { cursor: pointer; }
.choice input { flex: none !important; width: 20px; accent-color: var(--accent); }
.trip-icon.small { width: 30px; height: 30px; font-size: 17px; border-radius: 8px; }
.break { word-break: break-all; font-weight: 500; }

/* ---------- Feuille modale ---------- */

.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0);
  display: flex; align-items: flex-end; justify-content: center; transition: background 0.25s;
}
.sheet-backdrop.open { background: rgba(0, 0, 0, 0.35); }
.sheet {
  width: 100%; max-width: 640px; max-height: calc(100% - var(--safe-top) - 12px);
  display: flex; flex-direction: column;
  background: var(--bg); border-radius: 14px 14px 0 0; box-shadow: var(--shadow);
  transform: translateY(100%); transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet-backdrop.open .sheet { transform: none; }
@media (min-width: 700px) {
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: 14px; max-height: 90vh; }
}
.sheet-bar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  padding: 14px 16px; border-bottom: 0.5px solid var(--sep);
}
.sheet-bar h2 { margin: 0; font-size: 17px; font-weight: 600; text-align: center; }
.sheet-bar .link:first-child { justify-self: start; }
.sheet-bar .link:last-child { justify-self: end; }
.sheet-bar button:disabled { opacity: 0.4; }
.sheet-body {
  overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
  padding: 16px 16px calc(var(--safe-bottom) + 16px);
}
.sheet { overflow: hidden; }
.sheet-body { flex: 1 1 auto; min-height: 0; }

.sheet-error {
  margin: 0 0 14px; padding: 12px 14px; border-radius: var(--radius);
  background: var(--warn-bg); color: var(--neg); font-size: 15px; font-weight: 500;
}

/* ---------- Connexion ---------- */

.auth {
  max-width: 420px; margin: 0 auto; padding: calc(var(--safe-top) + 48px) 16px 48px;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
}
.auth h1 { margin: 8px 0 0; font-size: 28px; }
.auth-logo { width: 84px; height: 84px; border-radius: 20px; box-shadow: var(--shadow); }
.auth-form { width: 100%; margin: 16px 0 8px; text-align: left; }
.auth-form .group { margin-bottom: 12px; }
.auth-form .frow > span:first-child { min-width: 110px; }
.auth .group-title { margin-left: 16px; }

/* ---------- Toast ---------- */

/* En haut de l'écran : reste visible quand le clavier de l'iPhone est ouvert */
#toast {
  position: fixed; left: 50%; top: calc(var(--safe-top) + 60px); z-index: 100;
  transform: translate(-50%, -20px); opacity: 0; pointer-events: none;
  max-width: min(92vw, 480px); padding: 12px 18px; border-radius: 12px;
  background: rgba(30, 30, 32, 0.94); color: #fff; font-size: 15px; text-align: center;
  transition: opacity 0.2s, transform 0.2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  .sheet, .sheet-backdrop, #toast { transition: none; }
}

