/* ─────────────────────────────────────────────────────────────
 *  Notes de frais — design app mobile (custom, sans framework)
 * ─────────────────────────────────────────────────────────── */
:root {
  --primary: #1A3BA4;        /* Advans blue */
  --primary-2: #153094;      /* Advans blue (deep) */
  --primary-ink: #192454;    /* Advans ink */
  --accent: #FFAD0E;         /* Advans amber */
  --bg: #F4F6FF;             /* Advans mist */
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --ink: #192454;            /* Advans ink */
  --muted: #64748B;
  --line: #D8E0FA;           /* Advans border (soft) */
  --success: #10B981;
  --danger: #EF4444;
  --grad: linear-gradient(135deg, #1A3BA4 0%, #153094 100%);
  --grad-soft: linear-gradient(135deg, #2746B5 0%, #1A3BA4 100%);
  --shadow-sm: 0 1px 3px rgba(25,36,84,.06), 0 1px 2px rgba(25,36,84,.04);
  --shadow-md: 0 8px 24px rgba(25,36,84,.08);
  --shadow-lg: 0 16px 40px rgba(26,59,164,.18);
  --r: 18px;
  --r-sm: 12px;
  --nav-h: 68px;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* ── App shell ─────────────────────────────────────────────── */
.app { max-width: 560px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; position: relative; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top)) 18px 14px;
  background: var(--grad); color: #fff;
  box-shadow: var(--shadow-md);
}
.brand { font-weight: 800; font-size: 1.1rem; display: flex; align-items: center; gap: .5rem; }
.brand-badge {
  width: 30px; height: 30px; display: grid; place-items: center;
  background: rgba(255,255,255,.18); border-radius: 9px; font-size: .95rem;
}
.period-chip {
  border: 0; cursor: pointer; color: #fff;
  background: rgba(255,255,255,.16); backdrop-filter: blur(6px);
  padding: .45rem .8rem; border-radius: 999px; font: inherit; font-size: .8rem; font-weight: 600;
  transition: background .2s, transform .1s;
}
.period-chip:active { transform: scale(.96); }
.period-chip::after { content: " ▾"; opacity: .8; }

.screen { padding: 18px 18px calc(var(--nav-h) + 28px); }

/* ── Vues + transitions ────────────────────────────────────── */
.view { animation: viewIn .32s cubic-bezier(.22,.61,.36,1); }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.section-title { font-weight: 700; font-size: .95rem; color: var(--muted); margin: 18px 4px 10px; }

/* ── Carte total ───────────────────────────────────────────── */
.total-card {
  position: relative; overflow: hidden;
  background: var(--grad); color: #fff;
  border-radius: 22px; padding: 22px; box-shadow: var(--shadow-lg);
}
.total-glow {
  position: absolute; width: 180px; height: 180px; border-radius: 50%;
  background: rgba(255,255,255,.18); top: -70px; right: -40px; filter: blur(6px);
}
.total-label { font-size: .8rem; opacity: .85; font-weight: 600; }
.total-amount { display: block; font-size: 2.5rem; font-weight: 800; letter-spacing: -.02em; margin: 4px 0; }
.total-sub { font-size: .8rem; opacity: .85; }

/* ── Liste de frais ────────────────────────────────────────── */
.exp-list { display: flex; flex-direction: column; gap: 10px; }
.exp-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border-radius: var(--r); padding: 12px 14px;
  box-shadow: var(--shadow-sm); animation: rowIn .35s both;
}
@keyframes rowIn { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }
.exp-row .day {
  flex: 0 0 44px; height: 44px; border-radius: 13px;
  background: linear-gradient(135deg, #E2E9FF, #D2DDFF); color: var(--primary-ink);
  display: grid; place-items: center; font-weight: 800; line-height: 1;
}
.exp-row .day small { display: block; font-size: .55rem; font-weight: 600; opacity: .7; text-transform: uppercase; }
.exp-row .body { flex: 1; min-width: 0; }
.exp-row .body strong { font-size: .98rem; }
.exp-row .body .sub { color: var(--muted); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exp-row .thumb { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); }
.exp-row .amount { font-weight: 800; white-space: nowrap; }
.exp-row .del {
  border: 0; background: #FEF2F2; color: var(--danger); cursor: pointer;
  width: 30px; height: 30px; border-radius: 9px; font-size: 1rem; line-height: 1;
  transition: transform .1s;
}
.exp-row .del:active { transform: scale(.9); }
.empty { text-align: center; color: var(--muted); padding: 36px 0; }
.empty .big { font-size: 2rem; display: block; margin-bottom: 8px; }

/* ── Boutons ───────────────────────────────────────────────── */
.btn {
  font: inherit; font-weight: 700; border: 0; cursor: pointer;
  border-radius: 14px; padding: .85rem 1.1rem; display: inline-flex;
  align-items: center; justify-content: center; gap: .55rem;
  transition: transform .12s, box-shadow .2s, background .2s;
}
.btn:active { transform: scale(.97); }
.btn-block { width: 100%; margin-top: 12px; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: var(--shadow-lg); }
.btn-ghost { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }
.btn .ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.link { background: none; border: 0; color: var(--primary); font: inherit; font-weight: 600; cursor: pointer; padding: 8px; }

/* ── FAB ───────────────────────────────────────────────────── */
.fab {
  position: fixed; right: max(18px, calc(50% - 280px + 18px));
  bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom));
  width: 62px; height: 62px; border-radius: 20px; border: 0; cursor: pointer;
  background: var(--grad); box-shadow: var(--shadow-lg);
  display: grid; place-items: center; z-index: 30;
  animation: fabIn .4s cubic-bezier(.34,1.56,.64,1) .2s both;
}
.fab svg { width: 28px; height: 28px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fab:active { transform: scale(.92); }
.fab::after {
  content: ""; position: absolute; inset: 0; border-radius: 20px;
  box-shadow: 0 0 0 0 rgba(26,59,164,.45); animation: pulse 2.4s infinite;
}
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(26,59,164,.4); } 70% { box-shadow: 0 0 0 16px rgba(26,59,164,0); } 100% { box-shadow: 0 0 0 0 rgba(26,59,164,0); } }
@keyframes fabIn { from { opacity: 0; transform: scale(.4) translateY(20px); } to { opacity: 1; transform: none; } }

/* ── Bottom nav ────────────────────────────────────────────── */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  max-width: 560px; margin: 0 auto;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; background: rgba(255,255,255,.92); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.nav-item {
  flex: 1; border: 0; background: none; cursor: pointer; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font: inherit; font-size: .68rem; font-weight: 700; transition: color .2s;
}
.nav-item svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.nav-item.active { color: var(--primary); }
.nav-item.active svg { transform: translateY(-2px); }

/* ── Cartes / formulaires ──────────────────────────────────── */
.card { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow-sm); padding: 16px; }
.form-card { margin-top: 14px; }
.card-head { font-weight: 700; margin-bottom: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: .8rem; font-weight: 600; color: var(--muted); }
.field input, .field select {
  font: inherit; font-weight: 500; color: var(--ink);
  padding: .7rem .8rem; border: 1.5px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface-2); transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field select:focus {
  outline: 0; border-color: var(--primary); background: #fff;
  box-shadow: 0 0 0 4px rgba(26,59,164,.12);
}

/* ── Profils ───────────────────────────────────────────────── */
.profile-list { display: flex; flex-direction: column; gap: 10px; }
.profile-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border-radius: var(--r); padding: 12px 14px; box-shadow: var(--shadow-sm);
}
.profile-item .avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: 0 0 40px;
  background: var(--grad-soft); color: #fff; display: grid; place-items: center; font-weight: 800;
}
.profile-item .body { flex: 1; min-width: 0; }
.profile-item .body small { color: var(--muted); }
.profile-item .del { border: 0; background: #FEF2F2; color: var(--danger); cursor: pointer; padding: .45rem .7rem; border-radius: 10px; font: inherit; font-weight: 600; }

/* ── Export ────────────────────────────────────────────────── */
.export-hero { text-align: center; padding: 12px 8px 4px; }
.export-emoji { font-size: 2.6rem; }
.export-hero h2 { margin: 8px 0 6px; }
.recap-card { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow-sm); padding: 16px; margin: 16px 0; }
.recap-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.recap-row:last-child { border-bottom: 0; }
.recap-row span { color: var(--muted); }
.recap-row strong { font-weight: 700; }

/* ── Bottom sheet ──────────────────────────────────────────── */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 40; animation: fade .25s; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  max-width: 560px; margin: 0 auto;
  background: var(--surface); border-radius: 26px 26px 0 0;
  padding: 12px 20px calc(24px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 40px rgba(15,23,42,.18);
  animation: sheetUp .34s cubic-bezier(.22,.61,.36,1);
  max-height: 92dvh; overflow-y: auto;
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
.sheet-handle { width: 44px; height: 5px; border-radius: 999px; background: var(--line); margin: 4px auto 14px; }
.sheet-title { font-weight: 800; font-size: 1.15rem; margin-bottom: 16px; }
.sheet-actions { display: flex; gap: 12px; margin-top: 6px; }
.sheet-actions .btn { flex: 1; }

/* photo-first */
.photo-step { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.photo-tile {
  width: 100%; cursor: pointer; border: 2px dashed var(--primary);
  background: linear-gradient(135deg, #F4F6FF, #E2E9FF);
  border-radius: var(--r); padding: 30px 16px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--primary-ink); transition: transform .12s, box-shadow .2s;
}
.photo-tile:active { transform: scale(.99); }
.photo-tile svg { width: 44px; height: 44px; fill: none; stroke: var(--primary); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.photo-tile small { color: var(--muted); font-weight: 500; }
.photo-preview { position: relative; }
.photo-preview img { width: 100%; max-height: 200px; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--line); }
.photo-preview .badge {
  position: absolute; top: 8px; left: 8px; background: rgba(16,185,129,.95); color: #fff;
  font-size: .7rem; font-weight: 700; padding: .25rem .6rem; border-radius: 999px;
}
.photo-preview .retake {
  position: absolute; top: 8px; right: 8px; background: rgba(15,23,42,.7); color: #fff; border: 0;
  font: inherit; font-size: .72rem; font-weight: 600; padding: .3rem .6rem; border-radius: 999px; cursor: pointer;
}
.photo-preview .add-photo {
  width: 100%; border: 1.5px dashed var(--line); background: var(--surface-2); color: var(--primary);
  border-radius: var(--r-sm); padding: .8rem; font: inherit; font-weight: 600; cursor: pointer;
}

/* ── Assistant guidé (wizard) ──────────────────────────────── */
.wiz-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.wiz-head .sheet-title { margin: 0; flex: 1; }
.wiz-back {
  flex: 0 0 36px; width: 36px; height: 36px; border: 0; border-radius: 11px;
  background: var(--surface-2); color: var(--primary); cursor: pointer;
  display: grid; place-items: center; transition: transform .1s, background .2s;
}
.wiz-back:active { transform: scale(.9); }
.wiz-back svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.wiz-dots { display: flex; gap: 6px; }
.wiz-dots .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); transition: background .25s, transform .25s; }
.wiz-dots .dot.on { background: var(--primary); transform: scale(1.18); }
.wiz-step { animation: viewIn .28s cubic-bezier(.22,.61,.36,1); }
.wiz-hint { margin: 0 0 14px; color: var(--muted); font-weight: 600; font-size: .92rem; }

.tile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile {
  border: 1.5px solid var(--line); background: var(--surface-2); cursor: pointer;
  border-radius: var(--r-sm); padding: 14px 6px 11px; font: inherit; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  transition: transform .12s, border-color .2s, box-shadow .2s, background .2s;
}
.tile:active { transform: scale(.95); }
.tile.pre { border-color: var(--primary); background: #E2E9FF; }
.tile-ic {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(135deg, #E2E9FF, #D2DDFF); color: var(--primary);
}
.tile-ic svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tile-ic.sm { width: 42px; height: 42px; border-radius: 12px; flex: 0 0 42px; }
.tile-ic.sm svg { width: 23px; height: 23px; }
.tile-label { font-size: .78rem; font-weight: 700; text-align: center; line-height: 1.15; }

.wiz-recap {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--surface-2); border: 1.5px solid var(--line); border-radius: var(--r-sm);
}
.wiz-recap strong { display: block; font-size: 1rem; }
.wiz-recap small { color: var(--muted); font-size: .8rem; }

.amount-field span { font-size: .8rem; font-weight: 600; color: var(--muted); }
.amount-input { display: flex; align-items: center; gap: 10px; }
.amount-input input {
  flex: 1; min-width: 0; font: inherit; font-size: 1.8rem; font-weight: 800; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2);
  padding: .5rem .7rem; transition: border-color .2s, box-shadow .2s;
}
.amount-input input:focus { outline: 0; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px rgba(26,59,164,.12); }
.amount-input em { font-style: normal; font-size: 1.3rem; font-weight: 800; color: var(--muted); }

/* ── Toast ─────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: calc(var(--nav-h) + 80px); left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: .7rem 1.1rem; border-radius: 999px;
  font-size: .85rem; font-weight: 600; opacity: 0; pointer-events: none; z-index: 60; transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); }

/* ─────────────────────────────────────────────────────────────
 *  Page de connexion (login.html)
 * ─────────────────────────────────────────────────────────── */
.auth {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center;
  padding: 24px; position: relative; overflow: hidden; background: var(--grad);
}
.auth .blob { position: absolute; border-radius: 50%; filter: blur(40px); opacity: .5; }
.auth .blob.b1 { width: 320px; height: 320px; background: #FFAD0E; top: -80px; left: -60px; animation: float1 9s ease-in-out infinite; }
.auth .blob.b2 { width: 280px; height: 280px; background: #6983D6; bottom: -60px; right: -40px; animation: float2 11s ease-in-out infinite; }
@keyframes float1 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(30px,40px); } }
@keyframes float2 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(-30px,-30px); } }
.auth-card {
  position: relative; z-index: 1; width: 100%; max-width: 380px;
  background: rgba(255,255,255,.97); border-radius: 26px; padding: 34px 26px;
  box-shadow: 0 24px 60px rgba(15,23,42,.35); text-align: center;
  animation: cardUp .5s cubic-bezier(.22,.61,.36,1);
}
@keyframes cardUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.auth-logo { width: 72px; height: 72px; border-radius: 20px; margin: 0 auto 14px; display: block; box-shadow: var(--shadow-lg); }
.auth-card h1 { margin: 0 0 4px; font-size: 1.5rem; font-weight: 800; }
.auth-card .sub { color: var(--muted); margin: 0 0 22px; font-size: .9rem; }
.auth-card .stack { text-align: left; }
.auth-card .field input { background: var(--surface-2); }
.auth-error { color: var(--danger); font-size: .82rem; font-weight: 600; min-height: 1.1em; margin-top: -2px; }
.auth-card .btn-primary { margin-top: 6px; }
.auth-tabs { display: flex; gap: 4px; background: var(--surface-2); border: 1.5px solid var(--line);
  border-radius: var(--r-sm); padding: 4px; margin-bottom: 18px; }
.auth-tab { flex: 1; border: 0; background: none; font: inherit; font-weight: 700; font-size: .85rem;
  color: var(--muted); padding: .55rem; border-radius: 9px; cursor: pointer; transition: all .2s; }
.auth-tab.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }
.auth-hint { color: var(--muted); font-size: .75rem; line-height: 1.5; margin: -2px 0 2px; }

/* Barre de compte (vue Profils) */
.account-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow-sm);
  padding: 12px 14px; margin-bottom: 4px; }
.account-id { display: flex; flex-direction: column; min-width: 0; }
.account-id .muted { font-size: .72rem; }
.account-id strong { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-sm { padding: .5rem .8rem; font-size: .82rem; flex-shrink: 0; }

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