:root {
  --bg: #eef1f6;
  --bg-2: #e3e8f1;
  --ink: #152033;
  --muted: #5b677a;
  --card: #ffffff;
  --line: #d5dbe7;
  --accent: #c45c26;
  --accent-ink: #fff;
  --arrive: #1f4b99;
  --depart: #c45c26;
  --ok-bg: #e8f0ff;
  --ok-ink: #1f4b99;
  --ko-bg: #ffece8;
  --ko-ink: #9b2c1a;
  --shadow: 0 12px 40px rgba(21, 32, 51, 0.08);
  --radius: 22px;
  --font: "Manrope", system-ui, sans-serif;
  --display: "Sora", "Manrope", system-ui, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 0% 0%, #dfe7f5 0%, transparent 55%),
    radial-gradient(700px 360px at 100% 0%, #f3e3d6 0%, transparent 50%),
    var(--bg);
  padding-bottom: calc(72px + var(--safe-bottom));
}
a { color: var(--arrive); text-decoration: none; }
a:hover { text-decoration: underline; }

.shell { width: min(920px, calc(100% - 1.5rem)); margin: 0 auto; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: .7rem;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--display);
  font-weight: 700;
}
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: #fff;
  font-size: .95rem;
}
.brand-text { letter-spacing: -.03em; }
.nav-desktop { display: none; gap: 1rem; font-weight: 600; font-size: .95rem; }
.nav-desktop a { color: var(--muted); text-decoration: none; }
.nav-desktop a.is-active,
.nav-desktop a:hover { color: var(--ink); }

.main { padding-top: .4rem; }
.page-head { margin: 1.1rem 0 1rem; }
.page-head h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.55rem, 4.5vw, 2.1rem);
  letter-spacing: -.04em;
  line-height: 1.15;
}
.lede { margin: .45rem 0 0; color: var(--muted); font-size: 1rem; line-height: 1.45; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.2rem;
  margin-bottom: 1rem;
}
.card h2, .card h3 {
  margin: 0 0 .65rem;
  font-family: var(--display);
  letter-spacing: -.03em;
}

.grid { display: grid; gap: 1rem; }
.grid-2 { display: grid; gap: 1rem; grid-template-columns: 1fr; }

label {
  display: block;
  font-size: .86rem;
  font-weight: 700;
  color: var(--muted);
  margin: 0 0 .35rem;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: .9rem 1rem;
  font: inherit;
  background: #fff;
  margin-bottom: .85rem;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(31, 75, 153, .25);
  border-color: #8aa4d4;
}

.actions { display: flex; flex-wrap: wrap; gap: .7rem; }
.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: .9rem 1.2rem;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
}
.btn:hover { filter: brightness(1.05); text-decoration: none; }
.btn.accent { background: var(--accent); color: var(--accent-ink); }
.btn.soft { background: #e8edf5; color: var(--ink); }
.btn.arrive { background: var(--arrive); }
.btn.depart { background: var(--depart); }
.btn.big { width: 100%; min-height: 58px; font-size: 1.08rem; }
.btn.block { width: 100%; }

.toast {
  border-radius: 14px;
  padding: .9rem 1rem;
  margin-bottom: 1rem;
  font-weight: 650;
}
.toast-ok { background: var(--ok-bg); color: var(--ok-ink); }
.toast-ko { background: var(--ko-bg); color: var(--ko-ink); }

.foyer-card {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
}
.foyer-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 44px rgba(21, 32, 51, 0.12);
  text-decoration: none;
}
.foyer-card .kicker {
  font-size: .78rem;
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .35rem;
}
.foyer-card .title {
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -.03em;
  margin-bottom: .25rem;
}
.foyer-card .meta { color: var(--muted); font-size: .95rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .85rem; }
.chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: .28rem .65rem;
  font-size: .78rem;
  font-weight: 700;
  background: #e8edf5;
  color: var(--ink);
}
.chip.famille { background: #f7e7dc; color: #8a3d16; }
.chip.compte { background: #dde7f8; color: #1f4b99; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: .75rem;
  padding: .85rem 0;
  border-bottom: 1px solid var(--line);
}
.timeline li:last-child { border-bottom: 0; }
.timeline .when {
  font-size: .82rem;
  font-weight: 750;
  color: var(--muted);
  line-height: 1.35;
}
.timeline .what { font-weight: 750; }
.timeline .sub { color: var(--muted); font-size: .92rem; margin-top: .15rem; }
.badge {
  display: inline-block;
  border-radius: 999px;
  padding: .18rem .55rem;
  font-size: .75rem;
  font-weight: 800;
  vertical-align: middle;
}
.badge.arrivee { background: #dde7f8; color: var(--arrive); }
.badge.depart { background: #f7e7dc; color: #8a3d16; }

.scan-hero { text-align: center; padding: 1.35rem 1.1rem; }
.scan-hero .who {
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -.03em;
  margin: .2rem 0 .35rem;
}
.muted { color: var(--muted); }
.code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: .82rem;
  word-break: break-all;
  background: #f3f5f9;
  padding: .7rem .8rem;
  border-radius: 12px;
}

.qr-box {
  display: grid;
  place-items: center;
  padding: 1rem;
  background: #f7f8fb;
  border-radius: 18px;
  margin: .8rem 0;
}
.qr-box img { width: min(240px, 70vw); height: auto; border-radius: 8px; }

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: .25rem;
  padding: .45rem .6rem calc(.45rem + var(--safe-bottom));
  background: rgba(255,255,255,.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.tabbar a {
  text-decoration: none;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .15rem;
  font-size: .72rem;
  font-weight: 750;
  padding: .35rem .2rem;
  border-radius: 12px;
}
.tabbar a.is-active { color: var(--ink); background: #eef2f8; }
.tab-ico { font-size: 1.05rem; line-height: 1; }

.site-foot {
  color: var(--muted);
  font-size: .82rem;
  padding: 1.2rem 0 1.5rem;
}
.nav-app .site-foot { padding-bottom: .5rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .75rem .35rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .6rem;
  margin-bottom: 1rem;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: .85rem .7rem;
  text-align: center;
}
.stat strong {
  display: block;
  font-family: var(--display);
  font-size: 1.35rem;
  letter-spacing: -.03em;
}
.stat span { color: var(--muted); font-size: .78rem; font-weight: 700; }

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 .35rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: .72rem;
  font-weight: 800;
}

.plan-list { display: grid; gap: .75rem; margin-top: .7rem; }
.plan-block {
  border-radius: 16px;
  padding: .95rem 1rem;
  border: 1px solid var(--line);
  background: #f7f8fb;
}
.plan-block.status-ok {
  background: #e7f7ec;
  border-color: #9fd0ad;
}
.plan-block.status-alert {
  background: #fff1e4;
  border-color: #f0b27a;
}
.plan-block.status-pending {
  background: #f2f4f8;
  border-color: #d5dbe7;
}
.plan-top {
  display: flex;
  justify-content: space-between;
  gap: .6rem;
  align-items: center;
  margin-bottom: .35rem;
}
.plan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .75rem;
}
.chip.status-ok { background: #cfeedd; color: #176b38; }
.chip.status-alert { background: #ffe0c2; color: #9a4b10; }
.chip.status-pending { background: #e4e8f0; color: #4b5568; }

.msg-list { list-style: none; margin: 0; padding: 0; }
.msg-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
  margin-bottom: .75rem;
  background: #fff;
}
.msg-item.kind-alert { border-left: 5px solid #e0893a; }
.msg-item.is-unread { background: #fff8f0; }
.msg-item.is-read { opacity: .88; }
.msg-head {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: baseline;
}

@media (min-width: 760px) {
  body { padding-bottom: 0; }
  .tabbar { display: none; }
  .nav-desktop { display: flex; }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .shell { width: min(980px, calc(100% - 2rem)); }
}
