:root {
  --bg1: #eef6ff;
  --bg2: #fdf4ff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: rgba(15, 23, 42, .08);
  --glass: rgba(255, 255, 255, .62);
  --glass-strong: rgba(255, 255, 255, .85);
  --primary: #4f46e5;
  --primary-2: #06b6d4;
  --good: #10b981;
  --warn: #f59e0b;
  --bad: #f43f5e;
  --radius: 22px;
  --shadow: 0 10px 40px -12px rgba(30, 41, 99, .18), 0 2px 6px rgba(30, 41, 99, .05);
  --shadow-lg: 0 30px 80px -20px rgba(30, 41, 99, .35);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: linear-gradient(135deg, var(--bg1) 0%, #f5f3ff 50%, var(--bg2) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--primary); }

/* ---------- Décor flottant ---------- */
.sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; animation: float 18s ease-in-out infinite; }
.blob.b1 { width: 420px; height: 420px; background: #a5b4fc; top: -120px; left: -80px; }
.blob.b2 { width: 360px; height: 360px; background: #67e8f9; bottom: -100px; right: -60px; animation-delay: -6s; }
.blob.b3 { width: 280px; height: 280px; background: #f9a8d4; top: 40%; left: 55%; animation-delay: -12s; opacity: .35; }
.cloud { position: absolute; background: #fff; border-radius: 100px; opacity: .7; filter: blur(1px); animation: drift linear infinite; }
.cloud::before, .cloud::after { content: ''; position: absolute; background: #fff; border-radius: 50%; }
.cloud.c1 { width: 120px; height: 34px; top: 16%; animation-duration: 70s; }
.cloud.c1::before { width: 56px; height: 56px; top: -28px; left: 18px; }
.cloud.c1::after { width: 40px; height: 40px; top: -18px; left: 62px; }
.cloud.c2 { width: 90px; height: 26px; top: 62%; animation-duration: 95s; animation-delay: -40s; opacity: .5; }
.cloud.c2::before { width: 40px; height: 40px; top: -20px; left: 14px; }
.cloud.c2::after { width: 30px; height: 30px; top: -14px; left: 46px; }
.plane-fly { position: absolute; top: 24%; left: -80px; width: 46px; opacity: .25; animation: fly 38s linear infinite; }
@keyframes float { 0%,100% { transform: translate(0,0) scale(1); } 33% { transform: translate(40px,-30px) scale(1.06); } 66% { transform: translate(-30px,25px) scale(.96); } }
@keyframes drift { from { transform: translateX(-160px); } to { transform: translateX(110vw); } }
@keyframes fly { 0% { transform: translate(0,0) rotate(8deg); } 50% { transform: translate(55vw,-60px) rotate(4deg); } 100% { transform: translate(115vw,20px) rotate(8deg); } }

.wrap { position: relative; z-index: 1; max-width: 1180px; margin: 0 auto; padding: 24px 20px 120px; }

/* ---------- Header ---------- */
header.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 14px 18px; border-radius: 999px; background: var(--glass); backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px); border: 1px solid rgba(255,255,255,.7); box-shadow: var(--shadow);
  position: sticky; top: 14px; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: -.02em; }
.brand .logo {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 8px 20px -6px rgba(79,70,229,.6);
}
.brand span em { font-style: normal; background: linear-gradient(90deg, var(--primary), var(--primary-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px;
  background: rgba(255,255,255,.7); border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--muted);
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 4px rgba(16,185,129,.18); }
.pill.running .dot { background: var(--warn); box-shadow: 0 0 0 4px rgba(245,158,11,.2); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer;
  padding: 10px 16px; border-radius: 999px; font-weight: 700; font-size: 14px; transition: transform .15s, box-shadow .15s, background .15s;
  background: rgba(255,255,255,.8); border: 1px solid var(--line); white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:disabled { opacity: .55; cursor: wait; transform: none; }
.btn.primary { color: #fff; border: 0; background: linear-gradient(135deg, var(--primary), #6366f1 50%, var(--primary-2)); box-shadow: 0 10px 24px -10px rgba(79,70,229,.7); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.icon { width: 36px; height: 36px; padding: 0; border-radius: 12px; }
.btn.danger:hover { color: var(--bad); }

/* ---------- Hero / stats ---------- */
.hero { margin: 44px 4px 26px; display: flex; justify-content: space-between; align-items: end; gap: 24px; flex-wrap: wrap; }
.hero h1 { font-size: clamp(30px, 4.5vw, 46px); margin: 0 0 6px; letter-spacing: -.035em; line-height: 1.05; }
.hero p { margin: 0; color: var(--muted); font-size: 16px; }
.stats { display: flex; gap: 12px; flex-wrap: wrap; }
.stat {
  min-width: 128px; padding: 14px 18px; border-radius: 18px; background: var(--glass); backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.75); box-shadow: var(--shadow); animation: bob 6s ease-in-out infinite;
}
.stat:nth-child(2) { animation-delay: -2s; } .stat:nth-child(3) { animation-delay: -4s; }
.stat b { display: block; font-size: 26px; letter-spacing: -.03em; }
.stat small { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

.notice { margin: 0 4px 18px; padding: 12px 16px; border-radius: 14px; background: rgba(245,158,11,.12); color: #92400e; font-size: 14px; font-weight: 600; border: 1px solid rgba(245,158,11,.25); }

/* ---------- Cartes ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 20px; }
.card {
  position: relative; padding: 20px; border-radius: var(--radius); background: var(--glass); backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px); border: 1px solid rgba(255,255,255,.75); box-shadow: var(--shadow);
  transition: transform .25s, box-shadow .25s; animation: appear .45s ease both;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.card.paused, .card.expired { opacity: .65; }
@keyframes appear { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.card-head { display: flex; justify-content: space-between; align-items: start; gap: 10px; }
.airline { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: #1e3a8a; background: rgba(30,58,138,.08); padding: 4px 10px; border-radius: 999px; }
.badge { font-size: 11px; font-weight: 800; padding: 4px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: .05em; }
.badge.active { background: rgba(16,185,129,.12); color: #047857; }
.badge.pending { background: rgba(99,102,241,.12); color: #4338ca; }
.badge.paused { background: rgba(100,116,139,.15); color: #475569; }
.badge.error { background: rgba(244,63,94,.12); color: #be123c; }
.badge.expired { background: rgba(15,23,42,.08); color: #334155; }
.badge.hit { background: linear-gradient(135deg, #10b981, #06b6d4); color: #fff; }

.route { display: flex; align-items: center; gap: 12px; margin: 16px 0 4px; }
.route .code { font-size: 30px; font-weight: 800; letter-spacing: -.03em; }
.route .line { flex: 1; height: 2px; background: repeating-linear-gradient(90deg, #c7d2fe 0 6px, transparent 6px 12px); position: relative; }
.route .line svg { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 22px; color: var(--primary); background: transparent; }
.cities { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; font-weight: 600; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0; }
.chip { font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 10px; background: rgba(255,255,255,.75); border: 1px solid var(--line); color: #334155; }
.chip.down { color: #047857; background: rgba(16,185,129,.08); border-color: rgba(16,185,129,.2); }
.chip.up { color: #be123c; background: rgba(244,63,94,.07); border-color: rgba(244,63,94,.2); }

.price-row { display: flex; justify-content: space-between; align-items: end; gap: 10px; padding: 14px; border-radius: 16px; background: rgba(255,255,255,.65); border: 1px solid var(--line); }
.price { font-size: 32px; font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.price.good { color: var(--good); } .price.high { color: var(--bad); }
.price small { display: block; font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; margin-bottom: 6px; }
.spark { width: 130px; height: 44px; }
.minmax { font-size: 12px; color: var(--muted); margin-top: 6px; font-weight: 600; }
.error-msg { margin-top: 10px; font-size: 12.5px; color: #be123c; background: rgba(244,63,94,.07); padding: 8px 10px; border-radius: 10px; }
.card-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
.card-foot .when { font-size: 12px; color: var(--muted); font-weight: 600; }
.card-foot .actions { display: flex; gap: 4px; }

.empty { text-align: center; padding: 70px 20px; border-radius: var(--radius); background: var(--glass); border: 1px dashed rgba(79,70,229,.3); }
.empty .big { font-size: 54px; animation: bob 4s ease-in-out infinite; display: inline-block; }
.empty h3 { margin: 10px 0 6px; font-size: 22px; } .empty p { color: var(--muted); margin: 0 0 20px; }

/* ---------- Bouton flottant ---------- */
.fab {
  position: fixed; right: 26px; bottom: 26px; z-index: 30; padding: 16px 22px; font-size: 15px;
  box-shadow: 0 18px 40px -12px rgba(79,70,229,.8); animation: bob 5s ease-in-out infinite;
}

/* ---------- Modale ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(15,23,42,.35); backdrop-filter: blur(6px); display: none; align-items: center; justify-content: center; padding: 16px; }
.overlay.open { display: flex; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 620px; max-height: 92vh; overflow: auto; border-radius: 26px; background: var(--glass-strong);
  backdrop-filter: blur(24px); border: 1px solid rgba(255,255,255,.9); box-shadow: var(--shadow-lg); padding: 26px;
  animation: pop .28s cubic-bezier(.2,1.4,.4,1);
}
@keyframes pop { from { transform: translateY(20px) scale(.96); opacity: 0; } }
.modal h2 { margin: 0 0 4px; letter-spacing: -.03em; }
.modal .sub { margin: 0 0 20px; color: var(--muted); font-size: 14px; }
.modal-head { display: flex; justify-content: space-between; align-items: start; }
.section-title { font-size: 12px; font-weight: 800; color: var(--primary); text-transform: uppercase; letter-spacing: .08em; margin: 22px 0 10px; display: flex; align-items: center; gap: 8px; }
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row.three { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 560px) { .row, .row.three { grid-template-columns: 1fr; } }
label.f { display: block; font-size: 13px; font-weight: 700; color: #334155; }
label.f > span { display: block; margin-bottom: 6px; }
.input {
  width: 100%; padding: 12px 14px; border-radius: 14px; border: 1px solid rgba(15,23,42,.12); background: rgba(255,255,255,.9);
  outline: none; transition: border-color .15s, box-shadow .15s; font-size: 15px;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(79,70,229,.14); }
.input-wrap { position: relative; }
.input-wrap .suffix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; }
.hint { font-size: 12px; color: var(--muted); font-weight: 500; margin-top: 6px; }
.swap { align-self: end; }

.ac { position: relative; }
.ac-list { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 6px); background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg); max-height: 240px; overflow: auto; display: none; border: 1px solid var(--line); }
.ac-list.open { display: block; }
.ac-item { padding: 10px 14px; cursor: pointer; display: flex; gap: 10px; align-items: center; font-size: 14px; }
.ac-item b { font-size: 12px; background: rgba(79,70,229,.1); color: var(--primary); padding: 3px 7px; border-radius: 7px; min-width: 44px; text-align: center; }
.ac-item small { color: var(--muted); margin-left: auto; }
.ac-item:hover, .ac-item.sel { background: rgba(79,70,229,.07); }

.flights { display: grid; gap: 8px; margin-top: 12px; }
.flight-opt { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 1.5px solid rgba(15,23,42,.1); background: rgba(255,255,255,.85); cursor: pointer; transition: border-color .15s, background .15s; }
.flight-opt:hover { border-color: rgba(79,70,229,.4); }
.flight-opt.sel { border-color: var(--primary); background: rgba(79,70,229,.06); }
.flight-opt input { accent-color: var(--primary); }
.flight-opt .t { font-weight: 800; font-size: 15px; }
.flight-opt .n { font-size: 12px; color: var(--muted); font-weight: 600; }
.flight-opt .p { margin-left: auto; font-weight: 800; font-size: 16px; }
.flight-opt .p.so { color: var(--muted); font-size: 13px; }
.seg { display: inline-flex; padding: 4px; border-radius: 999px; background: rgba(15,23,42,.06); }
.seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 13px; cursor: pointer; color: var(--muted); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(15,23,42,.1); }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 26px; }
.form-error { color: #be123c; font-size: 13px; font-weight: 600; margin-top: 12px; min-height: 18px; }

/* ---------- Journal ---------- */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100%); z-index: 60; background: var(--glass-strong); backdrop-filter: blur(24px); box-shadow: var(--shadow-lg); transform: translateX(105%); transition: transform .3s ease; display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { margin: 0; }
.drawer-body { overflow: auto; padding: 12px 22px 30px; }
.log { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.log time { display: block; font-size: 11px; color: var(--muted); font-weight: 700; margin-bottom: 2px; }
.log.error { color: #be123c; } .log.alert { color: #047857; font-weight: 600; }
.settings-box { padding: 16px; border-radius: 16px; background: rgba(255,255,255,.7); border: 1px solid var(--line); margin: 14px 0 6px; font-size: 13.5px; }
.settings-box p { margin: 4px 0; color: #334155; }
.settings-box .row2 { display: flex; gap: 8px; margin-top: 10px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; }
.toast { padding: 12px 18px; border-radius: 14px; background: #0f172a; color: #fff; font-weight: 600; font-size: 14px; box-shadow: var(--shadow-lg); animation: pop .3s ease; }
.toast.err { background: #be123c; } .toast.ok { background: #047857; }

.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Login ---------- */
.login-wrap { position: relative; z-index: 1; min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 400px; padding: 34px 30px; border-radius: 28px; background: var(--glass); backdrop-filter: blur(24px); border: 1px solid rgba(255,255,255,.8); box-shadow: var(--shadow-lg); text-align: center; animation: pop .4s ease; }
.login-card .brand { justify-content: center; font-size: 26px; margin-bottom: 6px; }
.login-card .brand .logo { width: 48px; height: 48px; border-radius: 15px; }
.login-card p { color: var(--muted); margin: 0 0 24px; }
.login-card form { display: grid; gap: 12px; }

@media (max-width: 640px) {
  header.top { border-radius: 22px; top: 8px; }
  .top-actions .pill { display: none; }
  .fab { right: 16px; bottom: 16px; }
  .hero { margin-top: 28px; }
  .stats { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat { min-width: 0; padding: 12px; }
  .stat b { font-size: 21px; }
  .stat small { font-size: 10px; }
  .grid { grid-template-columns: 1fr; }
}

/* ---------- Canaux de notification ---------- */
.channels { display: flex; gap: 8px; flex-wrap: wrap; }
.ch { cursor: pointer; }
.ch input { position: absolute; opacity: 0; pointer-events: none; }
.ch span { display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px; border-radius: 999px; border: 1.5px solid rgba(15,23,42,.12); background: rgba(255,255,255,.85); font-weight: 700; font-size: 14px; transition: all .15s; }
.ch span em { font-style: normal; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: #047857; background: rgba(16,185,129,.12); padding: 2px 6px; border-radius: 6px; }
.ch input:checked + span { border-color: var(--primary); background: rgba(79,70,229,.08); color: var(--primary); box-shadow: 0 0 0 4px rgba(79,70,229,.1); }
.ch input:focus-visible + span { outline: 2px solid var(--primary); }
[data-for].hidden { display: none; }
