/* Voyage.ia — mobile-first, sans framework */

:root {
  --bg: #f2f6fb;
  --surface: #ffffff;
  --surface-2: #eef3f9;
  --border: #e3e9f2;
  --text: #0f1b2d;
  --text-muted: #64748b;

  --primary: #0ea5e9;
  --primary-2: #06b6d4;
  --primary-dark: #0369a1;
  --accent: #f97316;
  --accent-2: #fb923c;
  --pink: #ec4899;

  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;

  --shadow-sm: 0 1px 2px rgba(15, 27, 45, 0.06);
  --shadow-md: 0 6px 20px -4px rgba(15, 27, 45, 0.12), 0 2px 6px rgba(15, 27, 45, 0.06);
  --shadow-lg: 0 20px 50px -12px rgba(15, 27, 45, 0.25);
  --shadow-glow: 0 8px 24px -6px rgba(14, 165, 233, 0.45);

  --nav-h: 68px;
  --top-h: 60px;

  --font-display: 'Fredoka', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1120;
    --surface: #121c30;
    --surface-2: #182236;
    --border: #223049;
    --text: #eaf1fb;
    --text-muted: #90a1bc;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 10px 24px -6px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 24px 60px -14px rgba(0, 0, 0, 0.65);
    --shadow-glow: 0 0 0 1px rgba(14, 165, 233, 0.25), 0 8px 24px -4px rgba(14, 165, 233, 0.35);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: 16px; /* évite le zoom auto iOS au focus */
  color: inherit;
}

a { color: var(--primary-dark); }

h1, h2, h3, .card-title, .topbar-title, .btn, .nav-btn small, .section-title {
  font-family: var(--font-display);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes floatBlob {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(14px, -18px) scale(1.06); }
}

/* ---------- Login ---------- */
.login-body {
  position: relative;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 20px;
  background: linear-gradient(120deg, #0ea5e9, #06b6d4 35%, #f97316 75%, #fb923c);
  background-size: 300% 300%;
  animation: gradientShift 14s ease infinite;
}
.login-body::before,
.login-body::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  pointer-events: none;
  animation: floatBlob 9s ease-in-out infinite;
}
.login-body::before {
  width: 300px; height: 300px;
  background: rgba(255, 255, 255, 0.55);
  top: -100px; left: -90px;
}
.login-body::after {
  width: 240px; height: 240px;
  background: rgba(253, 230, 138, 0.55);
  bottom: -80px; right: -70px;
  animation-delay: 1.5s;
}
.login-card {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-lg);
  padding: 40px 30px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: popIn 0.5s cubic-bezier(.2, .9, .3, 1.2) both;
}
@media (prefers-color-scheme: dark) {
  .login-card {
    background: rgba(18, 28, 48, 0.85);
    border-color: rgba(255, 255, 255, 0.08);
  }
}
.login-emoji {
  font-size: 46px;
  width: 88px; height: 88px;
  margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
  border-radius: 26px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: var(--shadow-glow);
}
.login-card h1 {
  margin: 20px 0 2px;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.login-sub { color: var(--text-muted); margin: 4px 0 26px; font-size: 14.5px; }
.login-error {
  background: #fee2e2; color: #991b1b; border-radius: var(--radius-sm);
  padding: 11px 14px; font-size: 14px; margin-bottom: 18px; text-align: left;
}
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 14px 18px; font-weight: 700;
  text-decoration: none; color: var(--text); box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-google:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-google:active { transform: translateY(0) scale(0.98); }
.login-note { color: var(--text-muted); font-size: 12.5px; margin-top: 22px; }

/* ---------- App shell ---------- */
#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky; top: 0; z-index: 10;
  height: var(--top-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-title {
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; white-space: nowrap; font-size: 16px;
}
.topbar-emoji {
  font-size: 17px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: var(--shadow-glow);
}
.leg-switch {
  flex: 1;
  min-width: 0;
}
.leg-switch-track {
  position: relative;
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  min-width: 0;
}
.leg-switch-indicator {
  position: absolute;
  top: 3px; left: 3px;
  height: calc(100% - 6px);
  width: calc((100% - 6px) / var(--leg-count, 2));
  border-radius: 999px;
  transform: translateX(calc(var(--leg-index, 0) * 100%));
  transition: transform 0.35s cubic-bezier(.25, 1, .3, 1.2), background 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.leg-chip {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  border: none; background: transparent;
  color: var(--text-muted);
  border-radius: 999px; padding: 7px 10px;
  font-size: 12.5px; font-weight: 700; white-space: nowrap;
  min-width: 0;
  transition: color 0.3s ease, transform 0.15s ease;
}
.leg-chip-icon { font-size: 14px; flex-shrink: 0; }
.leg-chip span:last-child { overflow: hidden; text-overflow: ellipsis; }
.leg-chip.active { color: #fff; }
.leg-chip:active { transform: scale(0.95); }
.bell-btn {
  position: relative;
  border: none; background: none; cursor: pointer;
  font-size: 18px; width: 34px; height: 34px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; color: var(--text-muted);
  transition: background 0.15s ease;
}
.bell-btn:hover { background: var(--surface-2); }
.bell-badge {
  position: absolute; top: 2px; right: 2px;
  min-width: 16px; height: 16px; padding: 0 3px;
  border-radius: 999px; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
}

.notif-panel {
  position: fixed; inset: 0; z-index: 60;
  background: var(--bg);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(.25, 1, .3, 1);
  display: flex; flex-direction: column;
  pointer-events: none;
}
.notif-panel.open { transform: translateX(0); pointer-events: auto; }
.notif-panel-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; padding-top: max(12px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.notif-panel-header h2 { flex: 1; font-size: 17px; margin: 0; font-family: var(--font-display); }
.notif-list { flex: 1; overflow-y: auto; padding: 12px 14px 30px; }

.notif-row { position: relative; margin-bottom: 10px; border-radius: var(--radius); overflow: hidden; }
.notif-row-bg {
  position: absolute; inset: 0; display: flex; align-items: center;
  font-weight: 700; color: #fff; font-size: 13px;
}
.notif-row-bg.left { background: var(--success); justify-content: flex-start; padding-left: 18px; }
.notif-row-bg.right { background: var(--danger); justify-content: flex-end; padding-right: 18px; }
.notif-row-fg {
  position: relative;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px;
  display: flex; gap: 10px; align-items: flex-start;
  touch-action: pan-y; cursor: pointer; user-select: none;
  transition: opacity 0.2s ease;
}
.notif-row.unread .notif-row-fg { border-left: 3px solid var(--primary); }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 6px; flex-shrink: 0; }
.notif-row.read .notif-dot { visibility: hidden; }
.notif-body { flex: 1; min-width: 0; }
.notif-message { font-size: 13.5px; line-height: 1.4; }
.notif-row.read .notif-message { color: var(--text-muted); }
.notif-time { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }

.creator-tag { display: block; font-size: 11.5px; color: var(--text-muted); margin-top: 6px; }

.activity-more { margin-top: 2px; }
.activity-more summary {
  list-style: none; cursor: pointer; font-size: 13.5px; font-weight: 700;
  color: var(--primary-dark); display: flex; align-items: center; gap: 6px;
  padding: 12px 4px; margin: 0 -4px; border-radius: 8px;
  min-height: 44px; box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
.activity-more summary:active { background: var(--surface-2); }
.activity-more summary::-webkit-details-marker { display: none; }
.activity-more summary::after { content: '›'; margin-left: auto; transform: rotate(90deg); font-size: 18px; transition: transform 0.2s ease; }
.activity-more[open] summary::after { transform: rotate(-90deg); }
.activity-more-body { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; animation: fadeInUp 0.2s ease both; }
.activity-more-body p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text); }
.activity-more-body p b { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 2px; }

.qa-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.qa-item {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px;
  animation: fadeInUp 0.25s ease both;
}
.qa-question { font-size: 12.5px; font-weight: 700; color: var(--primary-dark); }
.qa-question::before { content: '❓ '; }
.qa-answer-wrap { margin-top: 4px; }
.qa-answer { font-size: 13px; line-height: 1.5; white-space: pre-wrap; }
.qa-meta { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.qa-meta .creator-tag { margin: 0; flex: 1; }
.qa-edit-textarea { width: 100%; min-height: 70px; }
.qa-form { display: flex; gap: 8px; align-items: flex-end; }
.qa-form textarea { flex: 1; min-height: 42px; }
.qa-inline { margin-top: 10px; border-top: 1px dashed var(--border); padding-top: 10px; }
.qa-inline .form-row { gap: 6px; }
.qa-inline input[type=text] { flex: 1; }
.qa-inline-answer:empty { display: none; }
.qa-inline-answer { margin-top: 8px; }

/* ---------- Accueil (dashboard) ---------- */
.weekly-card {
  background: linear-gradient(135deg, #fce7f3, #ede9fe);
  border: 1px solid #f5d0e8;
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px;
  font-size: 14px; font-weight: 600; color: #831843; line-height: 1.45;
  animation: fadeInUp 0.3s ease both;
}
@media (prefers-color-scheme: dark) {
  .weekly-card { background: linear-gradient(135deg, #4a1942, #2e1a5e); border-color: #5b2a52; color: #fbcfe8; }
}

.surprise-btn {
  background: linear-gradient(135deg, var(--accent), var(--pink) 70%, var(--primary));
  background-size: 200% 200%;
  animation: gradientShift 6s ease infinite;
  margin-bottom: 16px;
}
#surpriseResult .suggestion-form { margin-top: 4px; }
.countdown-card { position: relative; overflow: hidden; }
.countdown-card::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 90% -10%, rgba(255,255,255,0.35), transparent 55%);
  pointer-events: none;
}
.countdown-clock { display: flex; align-items: center; gap: 8px; margin-top: 14px; position: relative; }
.cd-unit {
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(4px);
  border-radius: 14px; padding: 10px 4px;
  min-width: 64px; text-align: center; flex: 1;
}
.cd-value {
  display: block; font-family: var(--font-display); font-weight: 700;
  font-size: 28px; line-height: 1; color: #fff;
  font-variant-numeric: tabular-nums;
}
.cd-suffix {
  display: block; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: 0.06em; color: #fff; opacity: 0.85; margin-top: 4px; font-weight: 600;
}
.cd-sep { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: rgba(255,255,255,0.6); }
.countdown-total { font-size: 11.5px; color: #fff; opacity: 0.75; margin-top: 8px; }
.countdown-edit-btn {
  position: absolute; top: 14px; right: 14px; z-index: 1;
  background: rgba(255,255,255,0.2); color: #fff;
}
.countdown-edit-btn:hover { background: rgba(255,255,255,0.32); }
.countdown-edit {
  position: relative; margin-top: 14px; padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.25);
}
.countdown-edit .field { color: #fff; }
.countdown-edit input {
  background: rgba(255,255,255,0.16); border: 1px solid rgba(255,255,255,0.35); color: #fff;
}
.countdown-edit input::-webkit-calendar-picker-indicator { filter: invert(1); }
.countdown-edit .form-actions { margin-top: 10px; }
.countdown-edit .btn.secondary { background: rgba(255,255,255,0.16); color: #fff; }
.dash-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.dash-row {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 13px; cursor: pointer;
  animation: fadeInUp 0.3s ease both;
  transition: background 0.15s ease, transform 0.15s ease;
}
.dash-row:hover { background: var(--surface-2); }
.dash-row:active { transform: scale(0.98); }
.dash-row-icon { font-size: 18px; flex-shrink: 0; }
.dash-row-body { flex: 1; min-width: 0; }
.dash-row-label { display: block; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-row-meta { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.dash-row-chevron { font-size: 20px; color: var(--text-muted); flex-shrink: 0; }

.dash-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dash-stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; text-align: left; cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}
.dash-stat:hover { background: var(--surface-2); }
.dash-stat:active { transform: scale(0.97); }
.dash-stat-label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.dash-stat-value { font-size: 20px; font-weight: 700; font-family: var(--font-display); margin-top: 4px; }
.dash-stat-bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: 8px; }
.dash-stat-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-2)); transition: width 0.4s ease; }

.activity-links { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.chip-link {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 700; text-decoration: none;
  color: var(--text); background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 11px;
  transition: background 0.15s ease, transform 0.15s ease;
}
.chip-link:hover { background: var(--border); }
.chip-link:active { transform: scale(0.95); }

.vote-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.vote-btn {
  border: 1px solid var(--border); background: var(--surface-2);
  border-radius: 999px; padding: 5px 11px; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; gap: 5px; cursor: pointer; color: var(--text);
  transition: transform 0.15s ease, background 0.15s ease;
}
.vote-btn.voted { background: #fce7f3; border-color: #fbcfe8; }
.vote-btn:active { transform: scale(0.93); }
.vote-names { font-size: 11.5px; color: var(--text-muted); }
.comment-toggle {
  margin-left: auto; border: none; background: none; color: var(--text-muted);
  font-size: 13px; font-weight: 600; cursor: pointer; padding: 5px 6px;
}
.comments-box { margin-top: 10px; border-top: 1px dashed var(--border); padding-top: 10px; }
.comment-item { padding: 8px 0; border-bottom: 1px solid var(--border); }
.comment-item:last-child { border-bottom: none; }
.comment-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.comment-time { color: var(--text-muted); font-weight: 400; }
.comment-head .icon-btn { margin-left: auto; width: 24px; height: 24px; font-size: 11px; }
.comment-text { font-size: 13.5px; margin-top: 2px; line-height: 1.4; }
.comment-form { display: flex; gap: 8px; margin-top: 10px; align-items: flex-end; }
.comment-form textarea { flex: 1; min-height: 40px; }
.comment-form .btn { padding: 10px 14px; }

@keyframes flashHighlight {
  0%, 100% { box-shadow: var(--shadow-sm); }
  25%, 75% { box-shadow: 0 0 0 3px var(--primary); }
}
.flash-highlight { animation: flashHighlight 1.8s ease; }

.logout-link {
  text-decoration: none; font-size: 16px; color: var(--text-muted);
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; flex-shrink: 0; transition: background 0.15s ease, color 0.15s ease;
}
.logout-link:hover { background: var(--surface-2); color: var(--danger); }

.view {
  flex: 1;
  padding: 16px 14px calc(var(--nav-h) + 24px);
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  height: var(--nav-h);
  display: flex; overflow-x: auto;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -6px 20px rgba(15, 27, 45, 0.05);
}
.nav-btn {
  flex: 1 0 auto; min-width: 68px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; background: none; border: none; color: var(--text-muted);
  padding: 8px 4px 6px; cursor: pointer; position: relative;
  transition: color 0.15s ease, transform 0.15s ease;
}
.nav-btn span { font-size: 20px; transition: transform 0.2s cubic-bezier(.3,1.4,.5,1); }
.nav-btn small { font-size: 10.5px; font-weight: 600; }
.nav-btn.active { color: var(--primary); }
.nav-btn.active span { transform: translateY(-2px) scale(1.08); }
.nav-btn.active::before {
  content: '';
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 22px; height: 3px; border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
}
.nav-btn:active { transform: scale(0.94); }

/* ---------- Sections communes ---------- */
.section-title {
  font-size: 14.5px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin: 20px 0 10px;
}
.section-title:first-child { margin-top: 0; }

.chip-row { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 999px; padding: 7px 13px; font-size: 13px; font-weight: 600;
  white-space: nowrap; cursor: pointer; color: var(--text-muted);
  transition: all 0.15s ease;
}
.chip.active { background: var(--text); color: var(--surface); border-color: var(--text); box-shadow: var(--shadow-sm); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 11px;
  box-shadow: var(--shadow-sm);
  animation: fadeInUp 0.35s ease both;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card-title { font-weight: 600; font-size: 15.5px; letter-spacing: -0.005em; }
.card-sub { color: var(--text-muted); font-size: 13px; margin-top: 3px; }
.card-body { font-size: 14px; margin-top: 7px; color: var(--text); line-height: 1.5; }
.card-notes { font-size: 13px; color: var(--text-muted); margin-top: 5px; white-space: pre-wrap; line-height: 1.5; }
.card-actions { display: flex; gap: 6px; flex-shrink: 0; }
.icon-btn {
  background: var(--surface-2); border: none; border-radius: 10px;
  width: 34px; height: 34px; font-size: 14px; cursor: pointer; color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { background: var(--border); }
.icon-btn:active { transform: scale(0.9); }
.icon-btn.danger:hover { background: #fee2e2; color: var(--danger); }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 700;
  border-radius: 999px; padding: 4px 10px; margin-right: 5px; margin-top: 5px;
}
.badge-idee { background: #e0e7ff; color: #3730a3; }
.badge-a_reserver { background: #fef3c7; color: #92400e; }
.badge-prevu { background: #fef3c7; color: #92400e; }
.badge-reserve { background: #dcfce7; color: #166534; }
.badge-fait { background: #dbeafe; color: #1e40af; }
.badge-kid { background: #fce7f3; color: #9d174d; }
.badge-type { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
@media (prefers-color-scheme: dark) {
  .badge-idee { background: #312e81; color: #c7d2fe; }
  .badge-a_reserver, .badge-prevu { background: #451a03; color: #fde68a; }
  .badge-reserve { background: #14532d; color: #bbf7d0; }
  .badge-fait { background: #1e3a5f; color: #bfdbfe; }
  .badge-kid { background: #500724; color: #fbcfe8; }
}

.empty-state {
  text-align: center; color: var(--text-muted); font-size: 14px;
  padding: 44px 16px; animation: fadeInUp 0.35s ease both;
}

/* ---------- Formulaires ---------- */
details.add-form {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 16px; overflow: hidden;
  box-shadow: var(--shadow-sm);
}
details.add-form summary {
  padding: 14px 16px; font-weight: 600; cursor: pointer;
  list-style: none; display: flex; align-items: center; gap: 8px;
  color: var(--primary-dark); font-size: 15px;
  transition: background 0.15s ease;
}
details.add-form summary::-webkit-details-marker { display: none; }
details.add-form summary::after {
  content: '›'; margin-left: auto; font-size: 20px; color: var(--text-muted);
  transform: rotate(90deg); transition: transform 0.2s ease;
}
details[open].add-form summary::after { transform: rotate(-90deg); }
details.add-form summary:hover { background: var(--surface-2); }
.form-grid {
  padding: 6px 16px 16px; display: flex; flex-direction: column; gap: 11px;
  animation: fadeInUp 0.25s ease both;
}
.form-row { display: flex; gap: 8px; }
.form-row > * { flex: 1; min-width: 0; }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--text-muted); font-weight: 600; }
input, select, textarea {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 12px; width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}
textarea { resize: vertical; min-height: 56px; line-height: 1.5; }

/* Champs de contenu riche (résumé/détails générés par Gemini) : plus de place, moins de scroll interne. */
textarea[name="description"],
textarea[name="details"],
textarea[name="family_fit"],
textarea[name="practical_info"],
textarea[name="notes"] {
  min-height: 130px;
}
.btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; border: none; border-radius: 999px;
  padding: 12px 18px; font-weight: 600; font-size: 15px; cursor: pointer;
  box-shadow: var(--shadow-glow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn.secondary { background: var(--surface-2); color: var(--text); box-shadow: none; border: 1px solid var(--border); }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.55; transform: none; cursor: default; }
.form-actions { display: flex; gap: 8px; }

/* ---------- Checklist ---------- */
.check-row {
  display: flex; align-items: center; gap: 11px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 13px; margin-bottom: 8px;
  animation: fadeInUp 0.3s ease both;
  transition: background 0.2s ease;
}
.check-row input[type=checkbox] {
  width: 21px; height: 21px; flex-shrink: 0; accent-color: var(--primary); cursor: pointer;
}
.check-row.done { background: color-mix(in srgb, var(--success) 8%, var(--surface)); }
.check-row.done .check-label { text-decoration: line-through; color: var(--text-muted); }
.check-label { flex: 1; font-size: 14px; }
.check-meta { font-size: 11.5px; color: var(--text-muted); }

/* ---------- Budget ---------- */
.budget-total {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 55%, var(--accent) 130%);
  color: #fff; border-radius: var(--radius-lg); padding: 22px;
  margin-bottom: 16px; box-shadow: var(--shadow-md);
  animation: fadeInUp 0.3s ease both;
}
.budget-total .label {
  font-size: 12px; opacity: 0.85; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.budget-total .amount {
  font-size: 38px; font-weight: 700; font-family: var(--font-display);
  letter-spacing: -0.01em; line-height: 1.15; margin-top: 2px;
}

.budget-bar {
  display: flex; height: 9px; border-radius: 999px; overflow: hidden;
  margin-top: 18px; background: rgba(0, 0, 0, 0.12);
}
.budget-bar .seg { height: 100%; transition: width 0.4s ease; }
.budget-bar .seg + .seg { border-left: 2px solid rgba(0, 0, 0, 0.18); }
.budget-bar .seg-active { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.95); }

.budget-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 12px; }
.budget-legend-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; opacity: 0.85;
}
.budget-legend-item b { font-weight: 800; }
.budget-legend-item.active {
  opacity: 1; background: rgba(255, 255, 255, 0.16);
  padding: 4px 10px 4px 8px; border-radius: 999px;
}
.budget-legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.budget-split {
  display: flex; gap: 16px; margin-top: 16px; padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 12.5px; flex-wrap: wrap; opacity: 0.95;
}

/* ---------- Assistant / chat ---------- */
.chat-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.chat-bubble {
  max-width: 85%; padding: 11px 14px; border-radius: 18px; font-size: 14px;
  white-space: pre-wrap; line-height: 1.5;
  animation: fadeInUp 0.25s ease both;
}
.chat-bubble.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; border-bottom-right-radius: 4px; box-shadow: var(--shadow-sm);
}
.chat-bubble.assistant {
  align-self: flex-start; background: var(--surface); border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.chat-input-row {
  position: sticky; bottom: calc(var(--nav-h) + 10px);
  display: flex; gap: 8px; background: var(--bg); padding-top: 6px;
}
.chat-input-row textarea {
  flex: 1; min-height: 46px; border-radius: var(--radius-sm);
}

.suggestion-card { border: 1px dashed var(--primary); background: color-mix(in srgb, var(--primary) 5%, var(--surface)); }
.suggestion-actions { margin-top: 10px; }

/* ---------- Documents ---------- */
.doc-row {
  display: flex; align-items: center; gap: 11px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 13px; margin-bottom: 8px;
  animation: fadeInUp 0.3s ease both;
}
.doc-icon {
  font-size: 19px; flex-shrink: 0;
  width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  border-radius: 12px; background: var(--surface-2);
}
.doc-info { flex: 1; min-width: 0; }
.doc-title { font-weight: 600; font-size: 14px; }
.doc-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 14px); transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 999px;
  font-size: 13.5px; font-weight: 500; z-index: 50; max-width: 90vw; text-align: center;
  box-shadow: var(--shadow-lg);
  animation: popIn 0.25s cubic-bezier(.3,1.4,.5,1) both;
}
.toast.error { background: var(--danger); color: #fff; }
.toast.celebrate {
  background: linear-gradient(135deg, var(--accent), var(--pink));
  color: #fff; font-weight: 700;
  box-shadow: 0 10px 30px -6px rgba(249, 115, 22, 0.55);
}

/* ---------- Confettis ---------- */
.confetti-container { position: fixed; inset: 0; pointer-events: none; z-index: 90; overflow: hidden; }
.confetti-piece {
  position: absolute; top: -12px; width: 8px; height: 14px; border-radius: 2px; opacity: 0.95;
  animation-name: confettiFall; animation-timing-function: cubic-bezier(.3,.6,.7,1); animation-fill-mode: forwards;
}
@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(105vh) rotate(var(--rot, 360deg)); opacity: 0.25; }
}

/* ---------- États de chargement (skeleton) ---------- */
@keyframes shimmer {
  0% { background-position: -200px 0; }
  100% { background-position: 200px 0; }
}
.skeleton-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 11px;
}
.skeleton-line {
  height: 12px; border-radius: 6px; margin: 8px 0;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
  background-size: 400px 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
.skeleton-line.w40 { width: 40%; }
.skeleton-line.w60 { width: 60%; height: 16px; }
.skeleton-line.w80 { width: 80%; }

/* ---------- Accessibilité clavier ---------- */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}
.leg-chip:focus-visible, .chip:focus-visible, .nav-btn:focus-visible { outline-offset: -2px; }

@media (min-width: 600px) {
  .view { padding-left: 22px; padding-right: 22px; }
}

/* ---------- Localisation (widget "📍 Localiser sur la carte") ---------- */
.locate-widget { margin: 2px 0 6px; }
.locate-hint { font-size: 11px; color: var(--text-muted); margin-top: 5px; line-height: 1.4; }
.locate-status { font-size: 12.5px; margin-top: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.locate-ok { color: var(--success); font-weight: 600; }
.locate-empty { color: var(--text-muted); }
.locate-clear {
  border: none; background: none; color: var(--danger); font-size: 12px;
  cursor: pointer; padding: 2px 4px; text-decoration: underline;
}
.locate-results { margin-top: 6px; display: flex; flex-direction: column; gap: 6px; }
.locate-candidate {
  text-align: left; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); border-radius: 10px; padding: 8px 10px; font-size: 12.5px;
  cursor: pointer; line-height: 1.35;
}
.locate-candidate:active { background: var(--border); }

/* ---------- Carte (Leaflet) ---------- */
.map-view {
  height: min(60vh, 520px); border-radius: 16px; overflow: hidden;
  border: 1px solid var(--border); margin: 4px 0 10px; box-shadow: var(--shadow-sm);
  background: var(--surface-2);
}
.map-pin-icon { background: none; border: none; }
.map-pin {
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(15, 27, 45, 0.35);
}
.map-legend {
  display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 14px;
  font-size: 12.5px; color: var(--text-muted);
}
.map-legend-item { display: inline-flex; align-items: center; gap: 4px; }
.map-popup { min-width: 180px; }
.map-popup-title { font-weight: 700; font-size: 14px; margin-bottom: 2px; color: var(--text); }
.map-popup-sub { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.map-popup-distance { font-size: 12px; color: var(--text-muted); margin: 6px 0; }
.map-popup-route { min-height: 16px; margin: 2px 0 6px; }
.map-popup-route-loading { font-size: 12px; color: var(--text-muted); font-style: italic; }
.map-popup-route-ok { font-size: 12.5px; color: var(--primary-dark); font-weight: 600; }
.map-popup .btn { margin-top: 8px; font-size: 13px; padding: 8px 10px; }

/* Popups Leaflet habillés dans le style de l'appli (y compris en thème sombre). */
.leaflet-popup-content-wrapper {
  background: var(--surface); color: var(--text);
  border-radius: 14px; box-shadow: var(--shadow-sm);
}
.leaflet-popup-content { margin: 12px 14px; }
.leaflet-popup-tip { background: var(--surface); }
.leaflet-container { font-family: 'Inter', sans-serif; }
