:root {
  --bg: #071927;
  --bg-soft: #0b2434;
  --panel: rgba(15, 43, 59, .92);
  --panel-2: #12364a;
  --paper: #f4f1e8;
  --paper-2: #fffdf7;
  --ink: #10212c;
  --text: #f5f7f8;
  --muted: #9fb2be;
  --muted-dark: #65727a;
  --accent: #e6b85c;
  --accent-2: #55c4b4;
  --danger: #e87575;
  --success: #5bc78f;
  --border: rgba(255,255,255,.1);
  --shadow: 0 18px 50px rgba(0,0,0,.24);
  --radius: 22px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, ui-rounded, "SF Pro Rounded", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(85,196,180,.45); outline-offset: 2px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 5px; color: var(--accent-2); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.row { display: flex; align-items: center; }
.wrap { flex-wrap: wrap; }
.gap { gap: 10px; }
.spacer { flex: 1; }

.login-screen { min-height: 100svh; display: grid; place-items: center; padding: calc(28px + var(--safe-top)) 18px calc(28px + var(--safe-bottom)); position: relative; overflow: hidden; }
.login-art { position: absolute; inset: 0; opacity: .95; pointer-events: none; }
.sun { position: absolute; width: 190px; height: 190px; border-radius: 50%; right: -35px; top: 6%; background: radial-gradient(circle at 35% 35%, #ffe5a8, var(--accent)); box-shadow: 0 0 120px rgba(230,184,92,.24); }
.mountain { position: absolute; width: 80vw; height: 38vh; bottom: -12vh; transform: rotate(7deg); background: linear-gradient(135deg, transparent 49%, #0f3948 50%); }
.mountain-a { left: -18vw; }
.mountain-b { right: -26vw; transform: rotate(-12deg) scale(.8); opacity: .8; }
.login-card { width: min(100%, 440px); position: relative; z-index: 2; padding: 30px 24px; border: 1px solid var(--border); border-radius: 30px; background: rgba(7,25,39,.82); backdrop-filter: blur(20px); box-shadow: var(--shadow); }
.app-mark { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 18px; margin-bottom: 20px; background: linear-gradient(145deg, var(--accent), #c78931); color: #33240d; font-size: 1.75rem; font-weight: 900; box-shadow: 0 12px 32px rgba(230,184,92,.2); }
.login-card h1 { margin: 0 0 8px; font-size: clamp(2rem, 9vw, 3.2rem); line-height: .95; letter-spacing: -.05em; }
.login-card form { margin-top: 24px; }
.security-note { margin: 18px 0 0; color: var(--muted); font-size: .77rem; line-height: 1.5; }
.form-message { min-height: 1.3em; margin: 12px 0 0; color: var(--danger); font-size: .88rem; }

.app-shell { min-height: 100svh; background: linear-gradient(180deg, #071927 0, #0b2434 42%, #e9e5da 42%, #e9e5da 100%); }
.topbar { position: sticky; top: 0; z-index: 20; min-height: calc(80px + var(--safe-top)); padding: calc(14px + var(--safe-top)) 18px 12px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; background: rgba(7,25,39,.9); backdrop-filter: blur(18px); border-bottom: 1px solid var(--border); }
.topbar h1 { margin: 0; font-size: 1.25rem; letter-spacing: -.025em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60vw; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.icon-button { width: 42px; height: 42px; border: 1px solid var(--border); border-radius: 14px; background: rgba(255,255,255,.07); color: var(--text); font-size: 1.35rem; cursor: pointer; }
.sync-pill { height: 42px; padding: 0 12px; display: flex; align-items: center; gap: 7px; border: 1px solid var(--border); border-radius: 14px; background: rgba(255,255,255,.07); color: var(--text); font-size: .76rem; font-weight: 700; cursor: pointer; }
.sync-pill span:first-child { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 4px rgba(159,178,190,.1); }
.sync-pill.online span:first-child { background: var(--success); }
.sync-pill.dirty span:first-child { background: var(--accent); }
.sync-pill.error span:first-child { background: var(--danger); }
.main-content { min-height: calc(100svh - 150px); padding: 18px 16px calc(112px + var(--safe-bottom)); color: var(--ink); }

.bottom-nav { position: fixed; z-index: 30; left: 10px; right: 10px; bottom: calc(8px + var(--safe-bottom)); height: 68px; padding: 6px; display: grid; grid-template-columns: repeat(5, 1fr); border: 1px solid rgba(255,255,255,.14); border-radius: 22px; background: rgba(7,25,39,.94); backdrop-filter: blur(18px); box-shadow: 0 16px 42px rgba(0,0,0,.28); }
.nav-item { border: 0; border-radius: 16px; background: transparent; color: var(--muted); display: grid; place-items: center; align-content: center; gap: 2px; cursor: pointer; }
.nav-item span { font-size: 1.15rem; line-height: 1; }
.nav-item small { font-size: .65rem; font-weight: 700; }
.nav-item.active { background: rgba(85,196,180,.14); color: var(--accent-2); }
.fab { position: fixed; right: 20px; bottom: calc(91px + var(--safe-bottom)); z-index: 28; width: 58px; height: 58px; border: 0; border-radius: 20px; background: linear-gradient(145deg, var(--accent), #cd9438); color: #30230e; font-size: 2rem; line-height: 1; box-shadow: 0 14px 34px rgba(0,0,0,.3); cursor: pointer; }

.hero-card { border-radius: 28px; padding: 24px; min-height: 205px; background: radial-gradient(circle at 90% 10%, rgba(230,184,92,.36), transparent 36%), linear-gradient(145deg, #123a4b, #0a2737); color: var(--text); box-shadow: var(--shadow); overflow: hidden; position: relative; }
.hero-card::after { content: "旅"; position: absolute; right: 18px; bottom: -22px; color: rgba(255,255,255,.055); font-size: 9rem; font-weight: 900; }
.hero-card h2 { max-width: 75%; margin: 6px 0 12px; font-size: 2rem; line-height: 1.02; letter-spacing: -.04em; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 24px; }
.hero-stat { padding: 10px; border-radius: 15px; background: rgba(255,255,255,.08); }
.hero-stat strong { display: block; font-size: 1.05rem; }
.hero-stat span { color: var(--muted); font-size: .68rem; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 24px 2px 12px; }
.section-head h2 { margin: 0; font-size: 1.25rem; letter-spacing: -.03em; }
.section-head p { margin: 0; color: var(--muted-dark); font-size: .78rem; }
.text-button { border: 0; padding: 7px 0; background: transparent; color: #166f70; font-weight: 800; cursor: pointer; }
.card { background: var(--paper-2); border: 1px solid rgba(16,33,44,.08); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(25,44,53,.08); }
.card + .card { margin-top: 10px; }
.card-pad { padding: 16px; }
.mini-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat-card { padding: 15px; }
.stat-card strong { display: block; font-size: 1.5rem; letter-spacing: -.04em; }
.stat-card span { color: var(--muted-dark); font-size: .75rem; }
.progress { height: 8px; border-radius: 999px; background: #d9ddd9; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2ba39b, #e0ad4f); }

.city-strip, .date-strip, .subnav { display: flex; gap: 9px; overflow-x: auto; scrollbar-width: none; padding: 2px 1px 8px; scroll-snap-type: x proximity; }
.city-strip::-webkit-scrollbar, .date-strip::-webkit-scrollbar, .subnav::-webkit-scrollbar { display: none; }
.city-chip, .date-chip, .subnav button { flex: 0 0 auto; border: 1px solid rgba(16,33,44,.1); background: rgba(255,255,255,.7); color: var(--ink); border-radius: 17px; padding: 10px 13px; cursor: pointer; scroll-snap-align: start; }
.city-chip strong, .date-chip strong { display: block; font-size: .84rem; }
.city-chip small, .date-chip small { color: var(--muted-dark); }
.city-chip.active, .date-chip.active, .subnav button.active { background: var(--bg-soft); color: var(--text); border-color: var(--bg-soft); }
.city-chip.active small, .date-chip.active small { color: var(--muted); }
.date-chip { min-width: 66px; text-align: center; }

.day-head { padding: 20px; margin-top: 8px; background: var(--paper-2); border-radius: 24px; border: 1px solid rgba(16,33,44,.08); }
.day-head h2 { margin: 2px 0 8px; font-size: 1.55rem; line-height: 1.1; letter-spacing: -.04em; }
.day-head .meta { color: var(--muted-dark); font-size: .82rem; }
.day-note { margin-top: 14px; padding: 12px; border-radius: 14px; background: #f1eee4; white-space: pre-wrap; font-size: .86rem; }
.activity-list { position: relative; margin-top: 14px; }
.activity-list::before { content: ""; position: absolute; left: 28px; top: 18px; bottom: 18px; width: 2px; background: #d9ddd9; }
.activity { position: relative; display: grid; grid-template-columns: 55px 1fr; gap: 9px; padding: 8px 0; }
.activity-time { position: relative; z-index: 1; align-self: start; padding: 8px 4px; border-radius: 12px; background: var(--paper); border: 1px solid #d7d9d2; text-align: center; font-size: .7rem; font-weight: 900; color: #31505d; }
.activity-card { padding: 14px; border-radius: 18px; background: var(--paper-2); border: 1px solid rgba(16,33,44,.08); box-shadow: 0 7px 20px rgba(20,38,47,.06); }
.activity-card h3 { margin: 0; font-size: 1rem; line-height: 1.2; }
.activity-card p { margin: 8px 0 0; color: #53636b; font-size: .82rem; line-height: 1.46; }
.activity-card.done { opacity: .62; }
.activity-card.done h3 { text-decoration: line-through; }
.activity-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.tiny-button { min-height: 31px; border: 1px solid rgba(16,33,44,.1); border-radius: 10px; background: #f1f3ef; color: #26434f; padding: 5px 9px; font-size: .7rem; font-weight: 750; cursor: pointer; }
.tiny-button.accent { background: rgba(85,196,180,.14); color: #136e68; }
.badges { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 7px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 7px; border-radius: 999px; background: #e9eeeb; color: #4e5e65; font-size: .64rem; font-weight: 800; }
.badge.plan-b { background: #dfe9f5; color: #3d5f84; }
.badge.transport { background: #e7e2f4; color: #634f85; }
.badge.repas { background: #f4ead7; color: #8a6328; }
.badge.priere { background: #dbeee7; color: #2f6958; }
.badge.alert { background: #f6dfdf; color: #9a4a4a; }

.list-card { padding: 15px; display: flex; gap: 12px; align-items: flex-start; }
.list-card .icon { width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 13px; background: #e7eeeb; font-size: 1.2rem; }
.list-card h3 { margin: 1px 0 4px; font-size: .96rem; }
.list-card p { margin: 0; color: var(--muted-dark); font-size: .79rem; line-height: 1.4; }
.list-card .right { margin-left: auto; text-align: right; }
.status-select { min-height: 34px; max-width: 120px; border: 1px solid #d5dad5; border-radius: 11px; background: #f4f5f2; padding: 5px 7px; font-size: .72rem; }

.check-group { padding: 16px; }
.check-group h3 { margin: 0 0 10px; }
.check-item { display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; align-items: start; padding: 10px 0; border-top: 1px solid #e8e8e2; }
.check-item:first-of-type { border-top: 0; }
.check-item input { width: 20px; height: 20px; accent-color: #258b83; }
.check-item.done span { color: #8a9497; text-decoration: line-through; }
.check-item small { color: var(--muted-dark); }

.expense-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 13px 15px; border-top: 1px solid #ecebe4; }
.expense-row:first-child { border-top: 0; }
.expense-row h3 { margin: 0; font-size: .9rem; }
.expense-row p { margin: 3px 0 0; color: var(--muted-dark); font-size: .72rem; }
.expense-row strong { white-space: nowrap; }

.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.photo-tile { aspect-ratio: 1; border: 0; border-radius: 13px; overflow: hidden; padding: 0; background: #d9ddd9; cursor: pointer; }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-empty { grid-column: 1 / -1; padding: 22px; border-radius: 16px; border: 1px dashed #b8c1c0; color: var(--muted-dark); text-align: center; }

.guide-card { overflow: hidden; }
.guide-card summary { list-style: none; padding: 16px; cursor: pointer; font-weight: 850; }
.guide-card summary::-webkit-details-marker { display: none; }
.guide-card summary::after { content: "+"; float: right; }
.guide-card[open] summary::after { content: "−"; }
.guide-body { padding: 0 16px 16px; color: #485b65; white-space: pre-wrap; font-size: .81rem; line-height: 1.48; }
.phrase-card { padding: 16px; }
.phrase-card strong { font-size: 1.25rem; }
.phrase-card p { margin: 5px 0 0; color: var(--muted-dark); }

.journal-card { padding: 17px; }
.journal-card h3 { margin: 0; }
.journal-card .journal-text { white-space: pre-wrap; margin: 10px 0; color: #43545d; line-height: 1.5; }
.mood { font-size: 1.35rem; }

.insight { display: grid; grid-template-columns: 38px 1fr; gap: 11px; padding: 14px; border-radius: 17px; background: #fff8e7; border: 1px solid #ead6a8; }
.insight + .insight { margin-top: 8px; }
.insight h3 { margin: 0 0 3px; font-size: .9rem; }
.insight p { margin: 0; color: #665b43; font-size: .76rem; line-height: 1.4; }

.empty-state { padding: 30px 18px; text-align: center; border: 1px dashed #b8c1c0; border-radius: 22px; color: var(--muted-dark); }
.empty-state strong { display: block; margin-bottom: 6px; color: var(--ink); }

.button { min-height: 44px; border-radius: 14px; border: 1px solid transparent; padding: 10px 15px; font-weight: 800; cursor: pointer; }
.button.primary { background: var(--accent-2); color: #082a2a; }
.button.ghost { background: rgba(255,255,255,.06); border-color: var(--border); color: inherit; }
.card .button.ghost, .modal .button.ghost { background: #eef1ed; border-color: #d9ddd9; color: var(--ink); }
.button.danger { color: #a83d3d; }
.button.wide { width: 100%; }

.field { display: grid; gap: 7px; margin: 0 0 14px; }
.field > span { font-size: .76rem; font-weight: 800; color: inherit; }
.field input, .field textarea, .field select, .search-field input, .photo-caption-panel textarea { width: 100%; min-height: 46px; border: 1px solid rgba(16,33,44,.16); border-radius: 14px; background: #fff; color: var(--ink); padding: 11px 12px; }
.login-card .field input { background: rgba(255,255,255,.09); border-color: var(--border); color: var(--text); }
.field textarea { resize: vertical; min-height: 105px; }
.checkbox-field { display: flex; align-items: center; gap: 10px; min-height: 44px; margin-bottom: 12px; }
.checkbox-field input { width: 21px; height: 21px; accent-color: var(--accent-2); }

.modal { width: min(94vw, 580px); max-height: 90svh; padding: 0; border: 1px solid rgba(16,33,44,.1); border-radius: 25px; background: var(--paper-2); color: var(--ink); box-shadow: var(--shadow); }
.modal::backdrop, .photo-modal::backdrop { background: rgba(1,11,17,.72); backdrop-filter: blur(5px); }
.modal form { display: flex; flex-direction: column; max-height: 90svh; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 18px 12px; border-bottom: 1px solid #e5e6df; }
.modal-head h2 { margin: 0; letter-spacing: -.03em; }
.modal-head .icon-button { color: var(--ink); background: #edf0ec; }
.modal-body { padding: 16px 18px; overflow: auto; }
.modal-actions { display: flex; align-items: center; gap: 9px; padding: 13px 18px calc(13px + var(--safe-bottom)); border-top: 1px solid #e5e6df; }
.search-field { display: flex; align-items: center; gap: 8px; border: 1px solid #d9ddd9; border-radius: 15px; background: #fff; padding: 0 12px; }
.search-field input { border: 0; padding-left: 0; }
.search-results { margin-top: 12px; }
.search-result { width: 100%; text-align: left; display: block; border: 0; border-top: 1px solid #e5e6df; background: transparent; padding: 12px 2px; color: var(--ink); cursor: pointer; }
.search-result:first-child { border-top: 0; }
.search-result strong { display: block; }
.search-result small { color: var(--muted-dark); }

.photo-modal { width: min(96vw, 760px); max-width: 760px; padding: 0; border: 0; border-radius: 24px; background: #06131c; color: var(--text); overflow: hidden; }
.photo-modal img { width: 100%; max-height: 68svh; object-fit: contain; display: block; background: #000; }
.photo-close { position: absolute; right: 10px; top: 10px; z-index: 2; width: 42px; height: 42px; border: 0; border-radius: 50%; background: rgba(0,0,0,.56); color: #fff; font-size: 1.5rem; }
.photo-caption-panel { padding: 14px; }
.photo-caption-panel textarea { min-height: 54px; margin: 7px 0 10px; }

.toast { position: fixed; z-index: 100; left: 50%; bottom: calc(92px + var(--safe-bottom)); transform: translate(-50%, 25px); max-width: calc(100vw - 32px); padding: 11px 16px; border-radius: 14px; background: #06131c; color: #fff; opacity: 0; pointer-events: none; transition: .22s ease; box-shadow: var(--shadow); font-size: .82rem; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.original-text { white-space: pre-wrap; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .68rem; line-height: 1.4; }
.danger-zone { border-color: rgba(232,117,117,.35); background: #fff6f6; }

@media (min-width: 760px) {
  .app-shell { background: linear-gradient(90deg, #071927 0 230px, #e9e5da 230px); }
  .topbar { left: 230px; margin-left: 230px; }
  .bottom-nav { top: calc(18px + var(--safe-top)); left: 14px; bottom: auto; right: auto; width: 200px; height: auto; grid-template-columns: 1fr; gap: 5px; padding: 10px; }
  .nav-item { min-height: 52px; grid-template-columns: 30px 1fr; justify-items: start; padding: 0 12px; }
  .nav-item small { font-size: .82rem; }
  .main-content { margin-left: 230px; max-width: 960px; padding: 25px 28px 70px; }
  .fab { right: 32px; bottom: 30px; }
  .hero-card { min-height: 250px; padding: 30px; }
  .hero-card h2 { font-size: 2.7rem; }
  .mini-grid { grid-template-columns: repeat(4, 1fr); }
  .photo-grid { grid-template-columns: repeat(5, 1fr); }
}

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

/* Option d'affichage pour les longues journées sur petit écran. */
body.compact .main-content { padding-left: 11px; padding-right: 11px; }
body.compact .day-head { padding: 15px; }
body.compact .activity { grid-template-columns: 48px 1fr; gap: 6px; padding: 5px 0; }
body.compact .activity-list::before { left: 24px; }
body.compact .activity-card { padding: 11px; }
body.compact .activity-card p { margin-top: 6px; line-height: 1.35; }
body.compact .activity-actions { margin-top: 8px; }
body.compact .tiny-button { min-height: 29px; padding: 4px 7px; }
