/* ==========================================================================
   PostPilot — système de design
   Thème clair · verre dépoli · mouvement sobre
   ========================================================================== */

:root {
  color-scheme: light;

  --bg: #eef0f8;
  --ink: #0c1024;
  --ink-2: #363d5c;
  --ink-3: #6a7190;
  --ink-4: #9ba1b9;
  --line: rgba(20, 26, 60, .08);
  --line-2: rgba(20, 26, 60, .14);

  --glass: rgba(255, 255, 255, .62);
  --glass-2: rgba(255, 255, 255, .78);
  --glass-3: rgba(255, 255, 255, .9);
  --glass-edge: rgba(255, 255, 255, .8);
  --fill: rgba(20, 26, 60, .045);
  --fill-2: rgba(20, 26, 60, .08);

  --brand: #5b5cf0;
  --brand-2: #8b5cf6;
  --brand-3: #ec4899;
  --brand-ink: #3b35c4;
  --brand-soft: rgba(91, 92, 240, .12);
  --grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 55%, #d946ef 100%);

  --success: #10b981;
  --success-ink: #047857;
  --warning: #f59e0b;
  --warning-ink: #b45309;
  --danger: #f43f5e;
  --danger-ink: #be123c;
  --info: #0ea5e9;
  --info-ink: #0369a1;

  --r-xs: 8px;
  --r-sm: 12px;
  --r: 18px;
  --r-lg: 24px;
  --r-xl: 30px;

  --shadow-sm: 0 1px 2px rgba(20, 26, 60, .05), 0 2px 8px -2px rgba(20, 26, 60, .06);
  --shadow: 0 1px 1px rgba(20, 26, 60, .03), 0 10px 30px -10px rgba(35, 40, 110, .14), 0 30px 60px -30px rgba(35, 40, 110, .12);
  --shadow-lg: 0 20px 70px -20px rgba(30, 30, 90, .35), 0 8px 24px -8px rgba(30, 30, 90, .15);
  --inner: inset 0 1px 0 rgba(255, 255, 255, .85);

  --blur: blur(22px) saturate(175%);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.4, .64, 1);

  --font: "Inter var", Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Inter Display", "SF Pro Display", "Segoe UI Variable Display", var(--font);

  --side-w: 256px;
  --tabbar-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

/* Couleurs de catégories et de comptes */
.c-indigo { --c: #6366f1; }
.c-violet { --c: #8b5cf6; }
.c-sky { --c: #0ea5e9; }
.c-teal { --c: #14b8a6; }
.c-emerald { --c: #10b981; }
.c-amber { --c: #f59e0b; }
.c-orange { --c: #f97316; }
.c-rose { --c: #f43f5e; }
.c-slate { --c: #64748b; }

/* ---------------------------------------------------------------- Base */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 90px;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
  overflow-x: hidden;
}

h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); letter-spacing: -.02em; line-height: 1.2; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }
::selection { background: rgba(99, 102, 241, .22); }

:focus-visible { outline: 3px solid rgba(91, 92, 240, .45); outline-offset: 2px; border-radius: 10px; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.i {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.85; stroke-linecap: round; stroke-linejoin: round;
}
.i-sm { width: 16px; height: 16px; }
.i-lg { width: 24px; height: 24px; }

.tnum, .amount, .num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum", "cv11"; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--ink-3); }
.faint { color: var(--ink-4); }
.small { font-size: 13px; }
.xsmall { font-size: 12px; }
.strong { font-weight: 650; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pos { color: var(--success-ink); }
.neg { color: var(--ink); }
.danger-text { color: var(--danger-ink); }
.warning-text { color: var(--warning-ink); }

.stack { display: flex; flex-direction: column; gap: var(--gap, 12px); }
.inline { display: flex; align-items: center; gap: var(--gap, 8px); flex-wrap: wrap; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; } .mt-4 { margin-top: 32px; }

/* ---------------------------------------------------------------- Aurore (fond) */

.aurora {
  position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
  background:
    radial-gradient(1200px 800px at -10% -20%, rgba(129, 120, 255, .30), transparent 60%),
    radial-gradient(900px 700px at 110% 0%, rgba(56, 189, 248, .22), transparent 60%),
    radial-gradient(900px 700px at 90% 110%, rgba(244, 114, 182, .18), transparent 60%),
    radial-gradient(800px 600px at -10% 100%, rgba(52, 211, 153, .14), transparent 60%),
    linear-gradient(180deg, #f4f5fc, #eceef8);
}
.aurora i {
  position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55;
  animation: drift 26s var(--ease) infinite alternate;
}
.aurora i:nth-child(1) { width: 42vmax; height: 42vmax; left: -8vmax; top: -12vmax; background: #a5b4fc; }
.aurora i:nth-child(2) { width: 34vmax; height: 34vmax; right: -10vmax; top: 18vh; background: #bae6fd; animation-duration: 32s; animation-delay: -8s; }
.aurora i:nth-child(3) { width: 30vmax; height: 30vmax; left: 35vw; bottom: -14vmax; background: #fbcfe8; animation-duration: 38s; animation-delay: -14s; }
.aurora::after {
  content: ""; position: absolute; inset: 0; opacity: .35; mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
}
@keyframes drift {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(6vw, 4vh, 0) scale(1.12); }
}

/* ---------------------------------------------------------------- Verre */

.glass, .card, .side-panel, .tabbar-inner, .topbar.is-stuck .topbar-inner, .menu-pop, .toast, .palette-panel {
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}

.card {
  position: relative;
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow), var(--inner);
  padding: 20px;
  min-width: 0;
}
.card-flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { font-size: 16px; font-weight: 650; }
.card-head .sub { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.card-link { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: var(--brand-ink); white-space: nowrap; border-radius: 8px; }
.card-link .i { width: 16px; height: 16px; transition: transform .25s var(--ease); }
.card-link:hover .i { transform: translateX(2px); }
.card-foot { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }

/* ---------------------------------------------------------------- Coquille */

.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100dvh; }

.sidebar { position: sticky; top: 0; height: 100dvh; padding: 14px 0 14px 14px; z-index: 30; }
.side-panel {
  height: 100%; display: flex; flex-direction: column; gap: 6px;
  background: rgba(255, 255, 255, .55);
  border: 1px solid var(--glass-edge);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow), var(--inner);
  padding: 18px 14px;
  overflow-y: auto;
  scrollbar-width: none;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; font-weight: 750; font-size: 17px; letter-spacing: -.02em; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: #fff; flex: none;
  background: var(--grad);
  box-shadow: 0 8px 20px -6px rgba(99, 102, 241, .6), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.brand-mark .i { width: 20px; height: 20px; stroke-width: 2.4; }
.brand small { display: block; font-size: 11px; font-weight: 550; color: var(--ink-4); letter-spacing: 0; }

.side-cta { margin: 0 0 14px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-4); padding: 12px 12px 6px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 13px; font-weight: 550; color: var(--ink-2);
  transition: background .2s var(--ease), color .2s var(--ease);
}
.nav a:hover { background: rgba(255, 255, 255, .7); color: var(--ink); }
.nav a .i { color: var(--ink-3); transition: color .2s; }
.nav a.is-active { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.nav a.is-active .i { color: var(--brand); }
.nav a.is-active::before {
  content: ""; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad);
}
.nav .badge { margin-left: auto; }

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.side-user {
  display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 16px;
  background: rgba(255, 255, 255, .6); border: 1px solid var(--line);
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-size: 13px; font-weight: 700; color: #fff; background: var(--grad);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3);
}
.side-user .who { min-width: 0; flex: 1; }
.side-user .who strong { display: block; font-size: 14px; font-weight: 650; }
.side-user .who span { display: block; font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar { position: sticky; top: 0; z-index: 25; padding: 14px clamp(16px, 3vw, 36px) 0; }
.topbar-inner {
  display: flex; align-items: center; gap: 10px; max-width: 1280px; margin: 0 auto;
  padding: 8px; border-radius: 20px; border: 1px solid transparent;
  transition: background .3s var(--ease), border-color .3s, box-shadow .3s;
}
.topbar.is-stuck .topbar-inner { background: rgba(255, 255, 255, .7); border-color: var(--glass-edge); box-shadow: var(--shadow-sm); }
.topbar-brand { display: none; }
.search-trigger {
  flex: 1; max-width: 460px; display: flex; align-items: center; gap: 10px;
  height: 44px; padding: 0 8px 0 14px; border-radius: 14px;
  background: rgba(255, 255, 255, .6); border: 1px solid var(--glass-edge); color: var(--ink-3);
  box-shadow: var(--shadow-sm); transition: background .2s, box-shadow .2s;
}
.search-trigger:hover { background: rgba(255, 255, 255, .85); box-shadow: var(--shadow); }
.search-trigger span { flex: 1; text-align: left; font-size: 14px; }
kbd {
  font-family: inherit; font-size: 11px; font-weight: 600; color: var(--ink-3);
  padding: 3px 7px; border-radius: 7px; background: rgba(255, 255, 255, .9); border: 1px solid var(--line-2); box-shadow: 0 1px 0 var(--line-2);
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.page { width: 100%; max-width: 1280px; margin: 0 auto; padding: 18px clamp(16px, 3vw, 36px) 64px; view-transition-name: page; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 6px 0 22px; }
.page-head h1 { font-size: clamp(26px, 3.2vw, 34px); font-weight: 750; letter-spacing: -.035em; }
.page-head p { color: var(--ink-3); margin-top: 4px; }
.page-head .eyebrow { display: block; margin-bottom: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink-3); margin-bottom: 8px; }
.back-link:hover { color: var(--ink); }

.eyebrow { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); }

/* Barre d'onglets (mobile) */
.tabbar { display: none; }

/* Progression de navigation */
#nav-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 100; opacity: 0;
  background: var(--grad); box-shadow: 0 0 12px rgba(139, 92, 246, .6); border-radius: 0 3px 3px 0;
  transition: width .4s var(--ease), opacity .3s;
}
#nav-progress.is-loading { opacity: 1; width: 70%; transition: width 6s cubic-bezier(.1, .7, .1, 1), opacity .2s; }
#nav-progress.is-done { opacity: 0; width: 100%; transition: width .2s, opacity .4s .15s; }

/* ---------------------------------------------------------------- Grilles */

.grid { display: grid; gap: 18px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; } .span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(var(--min, 240px), 1fr)); }

/* ---------------------------------------------------------------- Boutons */

.btn {
  --h: 44px;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h); padding: 0 18px; border-radius: 14px;
  font-weight: 600; font-size: 14px; white-space: nowrap; user-select: none;
  background: rgba(255, 255, 255, .8); color: var(--ink); border: 1px solid var(--line-2);
  box-shadow: var(--shadow-sm);
  transition: transform .18s var(--ease), box-shadow .25s var(--ease), background .2s, color .2s, opacity .2s;
}
.btn:hover { background: #fff; box-shadow: var(--shadow); }
.btn:active { transform: scale(.97); }
.btn .i { width: 18px; height: 18px; }
.btn-primary {
  color: #fff; border-color: transparent;
  background: var(--grad);
  box-shadow: 0 10px 24px -10px rgba(99, 102, 241, .75), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.btn-primary:hover { background: var(--grad); box-shadow: 0 14px 30px -10px rgba(99, 102, 241, .85), inset 0 1px 0 rgba(255, 255, 255, .3); filter: saturate(1.1); }
.btn-dark { color: #fff; background: #12152b; border-color: transparent; box-shadow: 0 10px 24px -12px rgba(18, 21, 43, .7); }
.btn-dark:hover { background: #1c2040; }
.btn-soft { background: var(--brand-soft); color: var(--brand-ink); border-color: transparent; box-shadow: none; }
.btn-soft:hover { background: rgba(91, 92, 240, .18); box-shadow: none; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn-ghost:hover { background: var(--fill); box-shadow: none; }
.btn-danger { color: var(--danger-ink); background: rgba(244, 63, 94, .08); border-color: transparent; box-shadow: none; }
.btn-danger:hover { background: rgba(244, 63, 94, .14); box-shadow: none; }
.btn-success { color: #fff; background: linear-gradient(135deg, #10b981, #14b8a6); border-color: transparent; box-shadow: 0 10px 22px -10px rgba(16, 185, 129, .7); }
.btn-success:hover { background: linear-gradient(135deg, #10b981, #14b8a6); filter: saturate(1.15); }
.btn-sm { --h: 34px; padding: 0 12px; border-radius: 11px; font-size: 13px; }
.btn-sm .i { width: 16px; height: 16px; }
.btn-lg { --h: 54px; padding: 0 24px; border-radius: 17px; font-size: 16px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-busy { opacity: .6; pointer-events: none; }
.btn.is-busy::after {
  content: ""; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn-icon {
  position: relative; width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 13px; color: var(--ink-2);
  transition: background .2s, color .2s, transform .15s;
}
.btn-icon:hover { background: rgba(255, 255, 255, .8); color: var(--ink); }
.btn-icon:active { transform: scale(.94); }
.btn-icon.glass { background: rgba(255, 255, 255, .6); border: 1px solid var(--glass-edge); box-shadow: var(--shadow-sm); }
.btn-icon .dot {
  position: absolute; top: 7px; right: 7px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  font-size: 10px; font-weight: 700; line-height: 17px; text-align: center; color: #fff;
  background: linear-gradient(135deg, #f43f5e, #ec4899); box-shadow: 0 0 0 2px #fff;
}

/* ---------------------------------------------------------------- Pastilles, badges, puces */

.bubble {
  --c: #6366f1; --s: 42px;
  width: var(--s); height: var(--s); flex: none; display: grid; place-items: center; border-radius: 13px;
  color: var(--c);
  background: linear-gradient(145deg, color-mix(in srgb, var(--c) 18%, #fff), color-mix(in srgb, var(--c) 9%, #fff));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 14%, transparent), inset 0 1px 0 rgba(255, 255, 255, .8);
}
.bubble .i { width: 20px; height: 20px; }
.bubble-sm { --s: 34px; border-radius: 11px; }
.bubble-sm .i { width: 17px; height: 17px; }
.bubble-lg { --s: 52px; border-radius: 16px; }
.bubble-lg .i { width: 24px; height: 24px; }
.bubble-solid { color: #fff; background: linear-gradient(145deg, var(--c), color-mix(in srgb, var(--c) 70%, #000)); box-shadow: 0 8px 18px -8px var(--c); }

.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 99px;
  font-size: 11.5px; font-weight: 650; white-space: nowrap;
  background: var(--fill-2); color: var(--ink-2);
}
.badge .i { width: 13px; height: 13px; stroke-width: 2.2; }
.badge-brand { background: var(--brand-soft); color: var(--brand-ink); }
.badge-success { background: rgba(16, 185, 129, .13); color: var(--success-ink); }
.badge-warning { background: rgba(245, 158, 11, .16); color: var(--warning-ink); }
.badge-danger { background: rgba(244, 63, 94, .12); color: var(--danger-ink); }
.badge-info { background: rgba(14, 165, 233, .13); color: var(--info-ink); }
.badge-count { background: linear-gradient(135deg, #f43f5e, #ec4899); color: #fff; min-width: 20px; justify-content: center; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 99px;
  font-size: 13.5px; font-weight: 600; white-space: nowrap; color: var(--ink-2);
  background: rgba(255, 255, 255, .65); border: 1px solid var(--glass-edge); box-shadow: var(--shadow-sm);
  transition: background .2s, color .2s, box-shadow .2s, transform .15s;
}
.chip:hover { background: #fff; }
.chip:active { transform: scale(.97); }
.chip.is-active { color: #fff; background: #12152b; border-color: transparent; box-shadow: 0 8px 18px -10px rgba(18, 21, 43, .8); }
.chip .i { width: 16px; height: 16px; }
.chip-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 6px; margin: -2px -2px 0; scroll-snap-type: x proximity; }
.chip-row::-webkit-scrollbar { display: none; }
.chip-row > * { scroll-snap-align: start; }

/* ---------------------------------------------------------------- Listes */

.list { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-width: 0;
  padding: 11px 10px; margin: 0 -10px; width: calc(100% + 20px); border-radius: 15px; text-align: left;
  transition: background .2s var(--ease);
}
a.row:hover, button.row:hover, .row.is-clickable:hover { background: rgba(255, 255, 255, .75); }
a.row:active, button.row:active { background: rgba(255, 255, 255, .95); }
.row + .row { position: relative; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.row-title { font-weight: 600; font-size: 14.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 12.5px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; white-space: nowrap; }
.row-sub > span { overflow: hidden; text-overflow: ellipsis; }
.row-end { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; text-align: right; }
.row-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.amount { font-weight: 650; font-size: 15px; letter-spacing: -.01em; white-space: nowrap; }
.amount.pos { color: var(--success-ink); }
.amount.muted { color: var(--ink-3); }
.sep { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .5; flex: none; }

.day-group { margin-top: 18px; }
.day-group:first-child { margin-top: 0; }
.day-head {
  position: sticky; top: 76px; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 12px; margin: 0 -8px 4px; border-radius: 12px;
  font-size: 12.5px; font-weight: 650; color: var(--ink-3);
  background: rgba(244, 245, 252, .82); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.day-head .tnum { font-weight: 600; }

/* ---------------------------------------------------------------- Barres et anneaux */

.bar { position: relative; height: 8px; border-radius: 99px; background: var(--fill-2); overflow: hidden; }
.bar > i {
  display: block; height: 100%; width: var(--p, 0%); border-radius: inherit;
  background: var(--c, var(--brand));
  background: linear-gradient(90deg, color-mix(in srgb, var(--c, #6366f1) 75%, #fff), var(--c, #6366f1));
  animation: grow 1.1s var(--ease) both;
}
.bar-thin { height: 5px; }
.bar-lg { height: 12px; }
.bar.is-over > i { background: linear-gradient(90deg, #fb7185, #e11d48); }
.bar .mark { position: absolute; top: -3px; bottom: -3px; width: 2px; border-radius: 2px; background: var(--ink-2); left: var(--m); }
@keyframes grow { from { width: 0; } }

.ring { --size: 64px; --stroke: 7; position: relative; width: var(--size); height: var(--size); flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: var(--stroke); stroke-linecap: round; }
.ring .track { stroke: var(--fill-2); }
.ring .value { stroke: var(--c, var(--brand)); stroke-dasharray: var(--p) 100; animation: ring 1.4s var(--ease) both; }
.ring .ring-label { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
@keyframes ring { from { stroke-dasharray: 0 100; } }

/* ---------------------------------------------------------------- Formulaires */

.form-grid { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.form-grid > .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.field .hint { font-size: 12.5px; color: var(--ink-3); }
.field-error { font-size: 12.5px; font-weight: 550; color: var(--danger-ink); display: flex; align-items: center; gap: 5px; animation: fadeUp .25s var(--ease); }

.input, .select, .textarea {
  width: 100%; height: 48px; padding: 0 14px; border-radius: 14px;
  background: rgba(255, 255, 255, .78); border: 1px solid var(--line-2); color: var(--ink);
  font-size: 15px; outline: none; appearance: none; -webkit-appearance: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.textarea { height: auto; min-height: 84px; padding: 12px 14px; resize: vertical; line-height: 1.45; }
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }
.input:hover, .select:hover, .textarea:hover { border-color: rgba(20, 26, 60, .22); }
.input:focus, .select:focus, .textarea:focus { background: #fff; border-color: rgba(91, 92, 240, .55); box-shadow: 0 0 0 4px rgba(91, 92, 240, .14); }
.select {
  padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236a7190' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
input[type="date"].input { padding-right: 10px; }
.is-invalid .input, .is-invalid .select, .input.is-invalid { border-color: rgba(244, 63, 94, .6); box-shadow: 0 0 0 4px rgba(244, 63, 94, .1); }

.input-wrap { position: relative; }
.input-wrap .input { padding-right: 52px; }
.input-wrap .suffix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-weight: 600; color: var(--ink-3); pointer-events: none; }
.input-wrap .btn-icon { position: absolute; right: 3px; top: 3px; }

/* Grand montant */
.amount-field { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px 0 4px; }
.amount-field .amount-line { display: flex; align-items: baseline; justify-content: center; gap: 8px; max-width: 100%; }
.amount-input {
  width: 100%; max-width: 100%; min-width: 2ch; border: 0; outline: none; background: transparent; text-align: center;
  font-family: var(--font-display); font-size: clamp(40px, 11vw, 56px); font-weight: 750; letter-spacing: -.04em; line-height: 1.1;
  font-variant-numeric: tabular-nums; color: var(--ink); caret-color: var(--brand); padding: 0;
}
.amount-input::placeholder { color: rgba(20, 26, 60, .18); }
.amount-currency { font-size: 22px; font-weight: 650; color: var(--ink-4); }
.amount-field.is-invalid .amount-input { color: var(--danger-ink); }
.amount-field .field-error { justify-content: center; }

/* Contrôle segmenté */
.seg {
  position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 4px; border-radius: 15px;
  background: var(--fill-2);
}
.seg label {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 10px; border-radius: 11px;
  font-size: 13.5px; font-weight: 600; color: var(--ink-3); cursor: pointer; text-align: center; line-height: 1.2;
  transition: color .2s, background .25s var(--ease), box-shadow .25s var(--ease);
}
.seg label:hover { color: var(--ink); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(20, 26, 60, .08), 0 4px 12px -4px rgba(20, 26, 60, .12); }
.seg label:has(input:focus-visible) { outline: 3px solid rgba(91, 92, 240, .45); }
.seg-lg label { min-height: 44px; font-size: 14.5px; }
.seg .i { width: 16px; height: 16px; }
.seg label.t-expense:has(input:checked) { color: var(--ink); }
.seg label.t-income:has(input:checked) { color: var(--success-ink); }
.seg label.t-transfer:has(input:checked) { color: var(--brand-ink); }

/* Choix en tuiles (catégories, types de compte, icônes) */
.tiles { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(var(--tile, 84px), 1fr)); }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px 9px; border-radius: 15px;
  font-size: 12px; font-weight: 600; color: var(--ink-2); text-align: center; line-height: 1.2; cursor: pointer;
  background: rgba(255, 255, 255, .55); border: 1px solid var(--line);
  transition: background .2s, border-color .2s, box-shadow .2s, transform .15s var(--spring);
}
.tile:hover { background: #fff; }
.tile:active { transform: scale(.96); }
.tile input { position: absolute; opacity: 0; pointer-events: none; }
.tile .bubble { --s: 36px; border-radius: 11px; }
.tile .bubble .i { width: 18px; height: 18px; }
.tile > span:last-child { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.tile:has(input:checked) { background: #fff; border-color: rgba(91, 92, 240, .55); box-shadow: 0 0 0 3px rgba(91, 92, 240, .14), var(--shadow-sm); color: var(--ink); }
.tile:has(input:focus-visible) { outline: 3px solid rgba(91, 92, 240, .45); }
.tiles-scroll { display: grid; grid-auto-flow: column; grid-template-rows: repeat(2, auto); grid-auto-columns: 84px; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 4px; margin: 0 -2px; }
.tiles-scroll::-webkit-scrollbar { display: none; }
.tiles-compact { --tile: 44px; }
.tiles-compact .tile { padding: 8px; }

.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { position: relative; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; background: var(--c); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .6); transition: transform .2s var(--spring); }
.swatch input { position: absolute; opacity: 0; }
.swatch:has(input:checked) { transform: scale(1.1); box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--c); }
.swatch:has(input:focus-visible) { outline: 3px solid rgba(91, 92, 240, .45); outline-offset: 4px; }

.emoji-row { display: flex; gap: 6px; flex-wrap: wrap; }
.emoji { position: relative; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; font-size: 21px; cursor: pointer; background: rgba(255, 255, 255, .6); border: 1px solid var(--line); transition: transform .2s var(--spring); }
.emoji input { position: absolute; opacity: 0; }
.emoji:has(input:checked) { background: #fff; border-color: rgba(91, 92, 240, .55); box-shadow: 0 0 0 3px rgba(91, 92, 240, .14); transform: scale(1.06); }

/* Interrupteur */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border-radius: 15px; background: rgba(255, 255, 255, .55); border: 1px solid var(--line); cursor: pointer; }
.switch-row .text { min-width: 0; }
.switch-row strong { display: block; font-size: 14px; font-weight: 600; }
.switch-row span.hint { display: block; font-size: 12.5px; color: var(--ink-3); margin-top: 1px; }
.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: rgba(20, 26, 60, .16); transition: background .25s var(--ease); }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(20, 26, 60, .25); transition: transform .3s var(--spring); }
.switch input:checked + span { background: var(--success); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 3px solid rgba(91, 92, 240, .45); outline-offset: 2px; }

.range { width: 100%; accent-color: var(--brand); height: 28px; }
.quick-dates { display: flex; gap: 6px; }
.quick-dates .chip { height: 32px; padding: 0 12px; font-size: 13px; box-shadow: none; }

details.more > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--brand-ink); padding: 4px 0; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary .i { width: 16px; height: 16px; transition: transform .25s var(--ease); }
details.more[open] > summary .i { transform: rotate(180deg); }
details.more[open] > .more-body { animation: fadeUp .3s var(--ease); }
.more-body { display: flex; flex-direction: column; gap: 14px; margin-top: 10px; }

/* ---------------------------------------------------------------- Panneaux (dialog) */

dialog { color: inherit; }
.sheet {
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 16px;
  border: 0; background: transparent; overflow: hidden;
}
.sheet[open] { display: flex; align-items: center; justify-content: center; }
.sheet::backdrop { background: rgba(18, 20, 45, .3); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); animation: fadeIn .3s var(--ease); }
.sheet.is-closing::backdrop { animation: fadeOut .22s var(--ease) forwards; }

.sheet-panel {
  position: relative; display: flex; flex-direction: column; width: min(540px, 100%); max-height: min(88dvh, 860px);
  background: rgba(250, 250, 255, .88); -webkit-backdrop-filter: blur(34px) saturate(180%); backdrop-filter: blur(34px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .9); border-radius: var(--r-xl); box-shadow: var(--shadow-lg), var(--inner);
  animation: popIn .42s var(--spring) both;
}
.sheet-wide .sheet-panel { width: min(640px, 100%); }
.sheet.is-closing .sheet-panel { animation: popOut .2s var(--ease) forwards; }
.sheet-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 20px 10px 24px; }
.sheet-head > div { flex: 1; min-width: 0; }
.sheet-head h2 { font-size: 19px; font-weight: 700; letter-spacing: -.025em; }
.sheet-sub { font-size: 13.5px; color: var(--ink-3); margin-top: 2px; }
.sheet-sub:empty { display: none; }
.sheet-head .btn-icon { margin: -6px -6px 0 0; background: var(--fill); }
.sheet-grip { display: none; }
.sheet-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 8px 24px 20px; display: flex; flex-direction: column; gap: 16px; }
.sheet-foot { display: flex; gap: 10px; align-items: center; padding: 14px 20px calc(16px + var(--safe-b)); border-top: 1px solid var(--line); background: rgba(255, 255, 255, .5); border-radius: 0 0 var(--r-xl) var(--r-xl); }
.sheet-foot .btn-primary, .sheet-foot .btn-dark, .sheet-foot .btn-success { flex: 1; }
.sheet-info { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--brand-soft); color: var(--brand-ink); font-size: 13.5px; font-weight: 550; }
.sheet-info:empty { display: none; }
.sheet-summary { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 18px; background: rgba(255, 255, 255, .7); border: 1px solid var(--line); }

@keyframes popIn { from { opacity: 0; transform: translateY(14px) scale(.965); } }
@keyframes popOut { to { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes slideUp { from { transform: translateY(100%); } }
@keyframes slideDown { to { transform: translateY(100%); } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } }

/* Verdict du conseiller */
.verdict {
  --vc: var(--ink-3);
  position: relative; display: flex; gap: 12px; padding: 14px; border-radius: 18px; overflow: hidden;
  background: color-mix(in srgb, var(--vc) 9%, rgba(255, 255, 255, .8));
  border: 1px solid color-mix(in srgb, var(--vc) 22%, transparent);
  transition: background .35s var(--ease), border-color .35s var(--ease);
}
.verdict::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--vc); transition: background .35s; }
.verdict .v-icon { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; flex: none; color: #fff; background: var(--vc); box-shadow: 0 6px 14px -6px var(--vc); transition: background .35s; }
.verdict .v-icon .i { width: 18px; height: 18px; stroke-width: 2.3; }
.verdict .v-body { flex: 1; min-width: 0; }
.verdict .v-title { font-weight: 700; font-size: 14.5px; color: color-mix(in srgb, var(--vc) 70%, #000); }
.verdict .v-msg { font-size: 13.5px; color: var(--ink-2); margin-top: 2px; }
.verdict .v-stats { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 12.5px; color: var(--ink-3); }
.verdict .v-stats strong { color: var(--ink); font-weight: 650; }
.verdict .v-reasons { margin: 8px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--ink-2); }
.verdict .v-reasons li { display: flex; gap: 6px; }
.verdict .v-reasons li::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--vc); margin-top: 7px; flex: none; }
.verdict.is-loading .v-body { opacity: .55; }
.v-success { --vc: #10b981; }
.v-warning { --vc: #f59e0b; }
.v-danger { --vc: #f43f5e; }
.v-info { --vc: #8a90aa; }

.suggest { display: flex; flex-direction: column; gap: 8px; }
.suggest-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, .7); border: 1px dashed rgba(91, 92, 240, .35); text-align: left; transition: background .2s, border-color .2s; }
.suggest-item:hover { background: #fff; border-style: solid; }
.suggest-item.is-picked { background: #fff; border: 1px solid rgba(16, 185, 129, .55); box-shadow: 0 0 0 3px rgba(16, 185, 129, .12); }

/* ---------------------------------------------------------------- Menus déroulants */

details.menu { position: relative; }
details.menu > summary { list-style: none; }
details.menu > summary::-webkit-details-marker { display: none; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 220px; padding: 6px;
  background: rgba(255, 255, 255, .92); border: 1px solid var(--glass-edge); border-radius: 17px; box-shadow: var(--shadow-lg);
  animation: menuIn .22s var(--ease); transform-origin: top right;
}
details.menu.up .menu-pop { top: auto; bottom: calc(100% + 6px); transform-origin: bottom right; }
.menu-pop form { margin: 0; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 11px;
  font-size: 14px; font-weight: 550; color: var(--ink-2); text-align: left; white-space: nowrap;
}
.menu-item:hover { background: var(--fill); color: var(--ink); }
.menu-item .i { width: 18px; height: 18px; color: var(--ink-3); }
.menu-item.danger, .menu-item.danger .i { color: var(--danger-ink); }
.menu-sep { height: 1px; background: var(--line); margin: 5px 6px; }
.menu-head { padding: 10px 12px 8px; }
.menu-head strong { display: block; font-size: 14px; }
.menu-head span { font-size: 12.5px; color: var(--ink-3); }
@keyframes menuIn { from { opacity: 0; transform: scale(.95) translateY(-4px); } }

/* Notifications */
.notif-pop { width: min(380px, calc(100vw - 32px)); max-height: min(70vh, 520px); overflow-y: auto; padding: 8px; }
.notif { display: flex; gap: 10px; padding: 10px; border-radius: 13px; }
.notif:hover { background: var(--fill); }
.notif .n-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: none; background: var(--ink-4); }
.notif.is-unread .n-dot { background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.notif.n-danger.is-unread .n-dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(244, 63, 94, .15); }
.notif.n-warning.is-unread .n-dot { background: var(--warning); box-shadow: 0 0 0 3px rgba(245, 158, 11, .15); }
.notif strong { display: block; font-size: 13.5px; font-weight: 650; }
.notif p { font-size: 13px; color: var(--ink-2); }
.notif time { font-size: 11.5px; color: var(--ink-4); }

/* ---------------------------------------------------------------- Palette de commandes */

.palette { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 12vh 16px 16px; border: 0; background: transparent; }
.palette[open] { display: flex; justify-content: center; align-items: flex-start; }
.palette::backdrop { background: rgba(18, 20, 45, .28); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: fadeIn .2s; }
.palette-panel {
  width: min(600px, 100%); background: rgba(252, 252, 255, .9); border: 1px solid #fff; border-radius: 22px; box-shadow: var(--shadow-lg); overflow: hidden;
  animation: popIn .3s var(--spring);
}
.palette-search { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.palette-search .i { color: var(--ink-3); }
.palette-search input { flex: 1; border: 0; outline: none; background: transparent; font-size: 17px; }
.palette-list { max-height: 50vh; overflow-y: auto; padding: 8px; }
.palette-group { font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-4); padding: 10px 12px 4px; }
.palette-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border-radius: 13px; text-align: left; font-weight: 550; }
.palette-item .bubble { --s: 32px; border-radius: 10px; }
.palette-item .bubble .i { width: 16px; height: 16px; }
.palette-item span.grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item small { color: var(--ink-4); font-size: 12px; }
.palette-item.is-active { background: #12152b; color: #fff; }
.palette-item.is-active small { color: rgba(255, 255, 255, .6); }
.palette-empty { padding: 28px; text-align: center; color: var(--ink-3); }
.palette-foot { display: flex; gap: 14px; padding: 10px 18px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-3); }

/* ---------------------------------------------------------------- Toasts */

#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(460px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 10px 10px 14px; border-radius: 18px;
  color: #fff; background: rgba(18, 21, 43, .9); box-shadow: 0 18px 40px -14px rgba(18, 21, 43, .55); border: 1px solid rgba(255, 255, 255, .08);
  animation: toastIn .45s var(--spring) both;
}
.toast.is-leaving { animation: toastOut .25s var(--ease) forwards; }
.toast .t-icon { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; flex: none; background: rgba(16, 185, 129, .95); }
.toast.t-danger .t-icon { background: rgba(244, 63, 94, .95); }
.toast.t-warning .t-icon { background: rgba(245, 158, 11, .95); }
.toast.t-info .t-icon { background: rgba(99, 102, 241, .95); }
.toast .t-icon .i { width: 16px; height: 16px; stroke-width: 2.6; }
.toast .t-text { flex: 1; min-width: 0; font-size: 14px; font-weight: 550; line-height: 1.35; }
.toast .t-undo { height: 34px; padding: 0 12px; border-radius: 11px; font-size: 13.5px; font-weight: 650; color: #c7c8ff; background: rgba(255, 255, 255, .08); white-space: nowrap; }
.toast .t-undo:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.toast .t-close { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; color: rgba(255, 255, 255, .6); }
.toast .t-close:hover { color: #fff; background: rgba(255, 255, 255, .08); }
@keyframes toastIn { from { opacity: 0; transform: translateY(18px) scale(.95); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px) scale(.97); } }

/* ---------------------------------------------------------------- Vides, notes, alertes */

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 34px 20px; }
.empty .bubble { --s: 60px; border-radius: 20px; margin-bottom: 4px; }
.empty .bubble .i { width: 26px; height: 26px; }
.empty h3 { font-size: 17px; font-weight: 700; }
.empty p { color: var(--ink-3); max-width: 38ch; font-size: 14px; }
.empty .btn { margin-top: 6px; }
.empty-sm { padding: 18px 12px; }

.callout { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 18px; font-size: 14px; background: rgba(255, 255, 255, .6); border: 1px solid var(--line); }
.callout .i { margin-top: 1px; }
.callout-warning { background: rgba(254, 243, 199, .6); border-color: rgba(245, 158, 11, .3); color: #7c4a03; }
.callout-danger { background: rgba(255, 228, 230, .65); border-color: rgba(244, 63, 94, .3); color: #8a1234; }
.callout-info { background: rgba(224, 231, 255, .6); border-color: rgba(99, 102, 241, .25); color: #312e81; }
.callout-success { background: rgba(209, 250, 229, .6); border-color: rgba(16, 185, 129, .3); color: #065f46; }

/* ---------------------------------------------------------------- Onglets */

.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 16px; background: rgba(255, 255, 255, .5); border: 1px solid var(--glass-edge); box-shadow: var(--shadow-sm); overflow-x: auto; scrollbar-width: none; margin-bottom: 20px; width: fit-content; max-width: 100%; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 12px; font-weight: 600; font-size: 14px; color: var(--ink-3); white-space: nowrap; transition: color .2s, background .25s var(--ease), box-shadow .25s; }
.tab:hover { color: var(--ink); }
.tab.is-active { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.tab .badge { height: 20px; }

/* ---------------------------------------------------------------- Statistiques */

.stat { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stat .label { font-size: 12.5px; font-weight: 600; color: var(--ink-3); justify-content: flex-start; }
.stat .value { font-family: var(--font-display); font-size: clamp(20px, 2.2vw, 26px); font-weight: 720; letter-spacing: -.03em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .foot { font-size: 12.5px; color: var(--ink-3); display: flex; align-items: center; gap: 4px; }
.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stat-card { padding: 16px 18px; }
.stat-card .bubble { margin-bottom: 8px; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 650; }
.delta .i { width: 14px; height: 14px; stroke-width: 2.4; }
.delta.up { color: var(--danger-ink); }
.delta.down { color: var(--success-ink); }

/* ---------------------------------------------------------------- Héros (accueil) */

.hero {
  --h1: #6366f1; --h2: #8b5cf6; --h3: #d946ef;
  position: relative; overflow: hidden; isolation: isolate; color: #fff; padding: 26px 26px 22px; border-radius: var(--r-xl);
  background: linear-gradient(135deg, var(--h1) 0%, var(--h2) 52%, var(--h3) 120%);
  box-shadow: 0 30px 60px -28px color-mix(in srgb, var(--h2) 80%, transparent), 0 10px 24px -12px rgba(30, 30, 90, .25), inset 0 1px 0 rgba(255, 255, 255, .3);
}
.hero::before {
  content: ""; position: absolute; inset: -40% -10% auto auto; width: 70%; aspect-ratio: 1; border-radius: 50%; z-index: -1;
  background: radial-gradient(circle, rgba(255, 255, 255, .35), transparent 62%);
  animation: glow 9s ease-in-out infinite alternate;
}
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .5;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .16) 45%, transparent 60%);
  background-size: 250% 100%; animation: sheen 7s ease-in-out infinite;
}
.hero.is-caution { --h1: #f59e0b; --h2: #f97316; --h3: #ec4899; }
.hero.is-deficit { --h1: #f43f5e; --h2: #e11d48; --h3: #9333ea; }
@keyframes glow { to { transform: translate(-12%, 18%) scale(1.15); } }
@keyframes sheen { 0%, 100% { background-position: 120% 0; } 50% { background-position: -20% 0; } }

.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hero .eyebrow { color: rgba(255, 255, 255, .82); }
.hero-pill { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 99px; font-size: 12.5px; font-weight: 650; background: rgba(255, 255, 255, .2); border: 1px solid rgba(255, 255, 255, .3); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.hero-pill .i { width: 14px; height: 14px; stroke-width: 2.4; }
.hero-amount { margin-top: 10px; font-family: var(--font-display); font-size: clamp(40px, 6.4vw, 66px); font-weight: 780; letter-spacing: -.045em; line-height: 1.02; font-variant-numeric: tabular-nums; text-shadow: 0 2px 20px rgba(40, 20, 120, .2); white-space: nowrap; }
.hero-sub { margin-top: 8px; font-size: 15px; color: rgba(255, 255, 255, .88); max-width: 52ch; }
.hero-sub strong { color: #fff; font-weight: 700; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; }
.hero-btn { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px; border-radius: 14px; font-weight: 650; font-size: 14px; color: #fff; background: rgba(255, 255, 255, .18); border: 1px solid rgba(255, 255, 255, .28); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); transition: background .2s, transform .15s; }
.hero-btn:hover { background: rgba(255, 255, 255, .28); }
.hero-btn:active { transform: scale(.97); }
.hero-btn.is-main { color: var(--ink); background: #fff; border-color: #fff; box-shadow: 0 10px 24px -12px rgba(20, 20, 60, .5); }
.hero-btn.is-main:hover { background: #fff; }
.hero-btn .i { width: 18px; height: 18px; }
.hero-meta { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 20px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .22); }
.hero-meta div { min-width: 0; }
.hero-meta span { display: block; font-size: 12px; color: rgba(255, 255, 255, .75); font-weight: 550; }
.hero-meta strong { display: block; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hero-ring { position: absolute; right: 24px; top: 58px; }
.hero-ring .ring { --size: 92px; --stroke: 8; --c: #fff; }
.hero-ring .ring .track { stroke: rgba(255, 255, 255, .22); }
.hero-ring .ring .ring-label { flex-direction: column; line-height: 1.05; text-align: center; font-size: 20px; font-weight: 780; }
.hero-ring .ring .ring-label small { display: block; font-size: 10.5px; font-weight: 600; opacity: .8; }

/* Explication du disponible */
.waterfall { display: flex; flex-direction: column; gap: 2px; }
.wf-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 0; }
.wf-row + .wf-row { border-top: 1px dashed var(--line-2); }
.wf-sign { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: 15px; background: var(--fill); color: var(--ink-3); }
.wf-row.is-total { border-top: 1px solid var(--line-2); margin-top: 4px; padding-top: 12px; }
.wf-row.is-total .wf-sign { background: var(--grad); color: #fff; }
.wf-row.is-total .amount { font-size: 18px; font-weight: 750; }
.wf-label { font-size: 14px; font-weight: 550; color: var(--ink-2); min-width: 0; }
.wf-label small { display: block; font-size: 12px; color: var(--ink-4); font-weight: 500; }
.wf-row.is-zero { opacity: .55; }

/* Échéancier */
.tl-date { width: 46px; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; height: 48px; border-radius: 14px; background: rgba(255, 255, 255, .75); border: 1px solid var(--line); line-height: 1; }
.tl-date b { font-size: 17px; font-weight: 750; letter-spacing: -.02em; }
.tl-date small { font-size: 10.5px; text-transform: uppercase; font-weight: 650; color: var(--ink-3); margin-top: 3px; letter-spacing: .04em; }
.tl-date.is-today { background: var(--grad); color: #fff; border-color: transparent; }
.tl-date.is-today small { color: rgba(255, 255, 255, .85); }
.tl-date.is-late { background: rgba(244, 63, 94, .1); border-color: rgba(244, 63, 94, .25); color: var(--danger-ink); }
.tl-date.is-late small { color: var(--danger-ink); }

/* Comptes */
.acct-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(190px, 1fr); gap: 12px; overflow-x: auto; scrollbar-width: none; padding: 4px; margin: -4px; scroll-snap-type: x mandatory; }
.acct-strip::-webkit-scrollbar { display: none; }
.acct {
  --c: #6366f1;
  position: relative; display: flex; flex-direction: column; gap: 14px; min-height: 128px; padding: 16px; border-radius: 22px; overflow: hidden; isolation: isolate; scroll-snap-align: start;
  background: rgba(255, 255, 255, .62); border: 1px solid var(--glass-edge); box-shadow: var(--shadow), var(--inner);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.acct::before { content: ""; position: absolute; width: 160px; height: 160px; right: -60px; top: -70px; border-radius: 50%; z-index: -1; background: radial-gradient(circle, color-mix(in srgb, var(--c) 35%, transparent), transparent 70%); }
a.acct:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg), var(--inner); }
.acct-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.acct-name { font-weight: 650; font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-type { font-size: 12px; color: var(--ink-3); }
.acct-balance { margin-top: auto; font-family: var(--font-display); font-size: 22px; font-weight: 740; letter-spacing: -.03em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.acct-balance.is-negative { color: var(--danger-ink); }
.acct-add { align-items: center; justify-content: center; gap: 8px; color: var(--ink-3); font-weight: 600; background: rgba(255, 255, 255, .35); border: 1.5px dashed rgba(20, 26, 60, .18); box-shadow: none; }
.acct-add:hover { color: var(--brand-ink); border-color: rgba(91, 92, 240, .45); background: rgba(255, 255, 255, .6); }
.acct-add::before { display: none; }

/* Graphique en barres */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 132px; padding-top: 8px; }
.bars .b { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.bars .b-col { position: relative; flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.bars .b-col i {
  display: block; width: min(100%, 30px); height: var(--h); min-height: 4px; border-radius: 9px 9px 5px 5px;
  background: linear-gradient(180deg, #a5b4fc, #6366f1); transform-origin: bottom; animation: rise .9s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms);
}
.bars .b.is-today .b-col i { background: var(--grad); box-shadow: 0 8px 18px -8px rgba(139, 92, 246, .8); }
.bars .b.is-zero .b-col i { background: var(--fill-2); }
.bars .b small { font-size: 11.5px; font-weight: 600; color: var(--ink-4); text-transform: capitalize; }
.bars .b.is-today small { color: var(--ink); }
.bars .b-col[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; bottom: calc(var(--h) + 8px); left: 50%; transform: translateX(-50%); z-index: 2;
  padding: 4px 8px; border-radius: 8px; font-size: 11.5px; font-weight: 650; white-space: nowrap; color: #fff; background: #12152b;
}
.bars-dense { gap: 3px; }
.bars-dense .b-col i { border-radius: 5px 5px 3px 3px; }
@keyframes rise { from { transform: scaleY(0); } }

/* Donut */
.donut-wrap { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 22px; align-items: center; }
.donut { position: relative; width: 180px; height: 180px; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut circle { fill: none; stroke-width: 12; }
.donut .seg-arc { stroke: var(--c); stroke-linecap: butt; animation: ring 1.3s var(--ease) both; transition: stroke-width .2s; }
.donut .seg-arc:hover { stroke-width: 15; }
.donut .center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.donut .center strong { display: block; font-family: var(--font-display); font-size: 19px; font-weight: 750; letter-spacing: -.03em; }
.donut .center span { font-size: 12px; color: var(--ink-3); }

.legend { display: flex; flex-direction: column; gap: 10px; }
.legend-item { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 13.5px; }
.legend-item i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.legend-item > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); font-weight: 550; }

.stack-bar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; gap: 3px; background: transparent; }
.stack-bar i { display: block; height: 100%; background: var(--c); border-radius: 4px; animation: grow 1.1s var(--ease) both; width: var(--p); }

/* Objectifs */
.goal { display: flex; flex-direction: column; gap: 14px; }
.goal-top { display: flex; align-items: center; gap: 14px; }
.goal-emoji { width: 50px; height: 50px; border-radius: 16px; display: grid; place-items: center; font-size: 26px; flex: none; background: rgba(255, 255, 255, .8); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.goal .ring { --size: 58px; --stroke: 6; }

/* Guide de démarrage */
.onboard { background: linear-gradient(135deg, rgba(255, 255, 255, .78), rgba(238, 240, 255, .7)); }
.onboard-steps { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.step { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 18px; text-align: left; background: rgba(255, 255, 255, .7); border: 1px solid var(--line); transition: transform .25s var(--ease), box-shadow .25s; }
button.step:hover, a.step:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.step-check { width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-items: center; border: 2px solid var(--line-2); color: transparent; }
.step.is-done .step-check { background: var(--success); border-color: var(--success); color: #fff; }
.step.is-done strong { text-decoration: line-through; color: var(--ink-3); }
.step-check .i { width: 14px; height: 14px; stroke-width: 3; }
.step strong { display: block; font-size: 14px; font-weight: 650; }
.step-text span { display: block; font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }

/* Sections des réglages */
.settings-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.settings-nav { position: sticky; top: 92px; display: flex; flex-direction: column; gap: 2px; }
.settings-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; font-weight: 550; font-size: 14px; color: var(--ink-3); }
.settings-nav a:hover { color: var(--ink); background: rgba(255, 255, 255, .6); }
.settings-nav a .i { width: 18px; height: 18px; }
.section-title { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.section-title h2 { font-size: 18px; font-weight: 700; }
.section-title p { font-size: 13.5px; color: var(--ink-3); margin-top: 2px; }

.mode-cards { display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mode-card { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 18px; cursor: pointer; background: rgba(255, 255, 255, .6); border: 1px solid var(--line); transition: border-color .2s, box-shadow .2s, background .2s; }
.mode-card input { position: absolute; opacity: 0; }
.mode-card strong { font-size: 14.5px; }
.mode-card > span:last-child { font-size: 12.5px; color: var(--ink-3); line-height: 1.4; }
.mode-card:has(input:checked) { background: #fff; border-color: rgba(91, 92, 240, .55); box-shadow: 0 0 0 3px rgba(91, 92, 240, .14), var(--shadow-sm); }
.mode-card .level { display: flex; gap: 3px; }
.mode-card .level i { width: 16px; height: 5px; border-radius: 3px; background: var(--fill-2); }
.mode-card .level i.on { background: var(--grad); }

.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; padding: 10px 12px; border-radius: 12px; background: rgba(18, 21, 43, .9); color: #e0e7ff; overflow-x: auto; white-space: pre; }

/* ---------------------------------------------------------------- Écrans d'accès */

.auth { min-height: 100dvh; display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: min(440px, 100%); padding: 32px; border-radius: 32px; }
.auth-wide { width: min(620px, 100%); }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.auth-brand .brand-mark { width: 44px; height: 44px; border-radius: 14px; }
.auth-brand strong { font-size: 20px; font-weight: 760; letter-spacing: -.03em; }
.auth h1 { font-size: 26px; font-weight: 760; letter-spacing: -.035em; }
.auth .lead { color: var(--ink-3); margin: 6px 0 22px; }
.auth-foot { text-align: center; margin-top: 18px; font-size: 12.5px; color: var(--ink-4); }

.steps-bar { display: flex; gap: 6px; margin-bottom: 22px; }
.steps-bar i { flex: 1; height: 5px; border-radius: 99px; background: var(--fill-2); transition: background .4s var(--ease); }
.steps-bar i.on { background: var(--grad); }
.wizard-step { display: flex; flex-direction: column; gap: 14px; animation: fadeUp .35s var(--ease); }
.req { display: flex; align-items: center; gap: 10px; font-size: 13.5px; padding: 6px 0; }
.req .i { width: 18px; height: 18px; }
.req.ok .i { color: var(--success); }
.req.ko .i { color: var(--danger); }

/* Page d'erreur */
.error-code { font-family: var(--font-display); font-size: 84px; font-weight: 800; letter-spacing: -.06em; line-height: 1; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------------------------------------------------------------- Apparition */

.reveal > * { animation: fadeUp .5s var(--ease) both; }
.reveal > *:nth-child(2) { animation-delay: .04s; }
.reveal > *:nth-child(3) { animation-delay: .08s; }
.reveal > *:nth-child(4) { animation-delay: .12s; }
.reveal > *:nth-child(5) { animation-delay: .16s; }
.reveal > *:nth-child(6) { animation-delay: .2s; }
.reveal > *:nth-child(n+7) { animation-delay: .24s; }

::view-transition-old(page) { animation: vtOut .18s var(--ease) both; }
::view-transition-new(page) { animation: vtIn .32s var(--ease) both; }
@keyframes vtOut { to { opacity: 0; transform: translateY(-4px); } }
@keyframes vtIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------------------------------------------------------------- Tablette */

@media (max-width: 1180px) {
  :root { --side-w: 84px; }
  .sidebar { padding: 12px 0 12px 12px; }
  .side-panel { padding: 16px 10px; align-items: center; }
  .brand { padding: 2px 0 14px; }
  .brand > span:not(.brand-mark), .nav-label, .nav a span, .side-user .who, .side-cta span, .nav .badge { display: none; }
  .nav a { justify-content: center; padding: 12px; }
  .nav a.is-active::before { left: -10px; }
  .side-cta { width: 48px; height: 48px; padding: 0; border-radius: 15px; }
  .side-user { padding: 6px; background: transparent; border: 0; }
  .side-user form { display: none; }
  .span-3, .span-4, .span-5 { grid-column: span 6; }
  .span-7, .span-8 { grid-column: span 12; }
  .mode-cards { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .span-3, .span-4, .span-5, .span-6 { grid-column: span 12; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  .settings-nav a { white-space: nowrap; background: rgba(255, 255, 255, .5); }
}

/* ---------------------------------------------------------------- Mobile */

@media (max-width: 767px) {
  body { font-size: 15px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }

  .topbar { padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 0; }
  .topbar-inner { padding: 6px; }
  .topbar-brand { display: flex; align-items: center; gap: 8px; font-weight: 750; letter-spacing: -.02em; }
  .topbar-brand .brand-mark { width: 32px; height: 32px; border-radius: 10px; }
  .topbar-brand .brand-mark .i { width: 17px; height: 17px; }
  .search-trigger { display: none; }
  .search-icon { display: grid !important; }

  .page { padding: 10px 16px calc(var(--tabbar-h) + 40px + var(--safe-b)); }
  .page-head { margin: 4px 0 16px; align-items: flex-start; }
  .page-head h1 { font-size: 27px; }
  .page-head .page-actions .btn:not(.keep) { display: none; }

  .card { padding: 16px; border-radius: 22px; }
  .grid { gap: 14px; }
  .form-grid { grid-template-columns: 1fr; }

  .tabbar {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 0 12px calc(10px + var(--safe-b));
    pointer-events: none;
  }
  .tabbar-inner {
    pointer-events: auto; position: relative; display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; height: var(--tabbar-h);
    padding: 0 6px; border-radius: 24px; background: rgba(255, 255, 255, .78); border: 1px solid rgba(255, 255, 255, .9);
    box-shadow: 0 16px 40px -14px rgba(30, 30, 90, .3), var(--inner);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; font-size: 10.5px; font-weight: 600; color: var(--ink-4); transition: color .2s; }
  .tabbar a .i { width: 23px; height: 23px; transition: transform .3s var(--spring); }
  .tabbar a.is-active { color: var(--ink); }
  .tabbar a.is-active .i { color: var(--brand); transform: translateY(-1px); }
  .fab {
    position: relative; /* sinon la pastille du compteur se pose sur la barre, pas sur le bouton */
    justify-self: center; width: 56px; height: 56px; margin-top: -26px; border-radius: 19px; display: grid; place-items: center; color: #fff;
    background: var(--grad); box-shadow: 0 14px 28px -10px rgba(99, 102, 241, .8), 0 0 0 5px rgba(255, 255, 255, .85), inset 0 1px 0 rgba(255, 255, 255, .3);
    transition: transform .25s var(--spring);
  }
  .fab:active { transform: scale(.92) rotate(90deg); }
  .fab .i { width: 26px; height: 26px; stroke-width: 2.4; }

  #toasts { bottom: calc(var(--tabbar-h) + 22px + var(--safe-b)); }

  .sheet { padding: 0; }
  .sheet[open] { align-items: flex-end; }
  .sheet-panel, .sheet-wide .sheet-panel {
    width: 100%; max-height: 94dvh; border-radius: 28px 28px 0 0; border-bottom: 0;
    animation: slideUp .45s cubic-bezier(.2, .9, .25, 1) both;
    touch-action: pan-y;
  }
  .sheet.is-closing .sheet-panel { animation: slideDown .26s var(--ease) forwards; }
  .sheet-head { padding: 22px 18px 8px 20px; }
  .sheet-grip { display: block; position: absolute; top: 8px; left: 50%; width: 40px; height: 5px; margin-left: -20px; border-radius: 99px; background: rgba(20, 26, 60, .18); }
  .sheet-body { padding: 6px 20px 18px; }
  .sheet-foot { border-radius: 0; padding: 12px 16px calc(12px + var(--safe-b)); }

  .palette { padding: 12px; }
  .palette-list { max-height: 60vh; }
  .palette-foot { display: none; }

  .hero { padding: 22px 20px 18px; border-radius: 26px; }
  .hero-ring { display: none; }
  .hero-actions { display: grid; grid-template-columns: repeat(3, 1fr); }
  .hero-btn { justify-content: center; padding: 0 8px; font-size: 13px; }
  .hero-meta { gap: 16px; }

  .donut-wrap { grid-template-columns: 1fr; justify-items: center; }
  .legend { width: 100%; }
  .day-head { top: 70px; }
  .tabs { width: 100%; }
  .tab { flex: 1; justify-content: center; padding: 0 12px; }
  .hide-mobile { display: none !important; }
  .row-actions .btn-sm .btn-label { display: none; }
  .menu-pop { position: fixed; left: 12px; right: 12px; top: auto !important; bottom: calc(var(--tabbar-h) + 24px + var(--safe-b)); min-width: 0; animation: fadeUp .25s var(--ease); }
  .notif-pop { width: auto; }
}

@media (min-width: 768px) {
  .show-mobile { display: none !important; }
  .search-icon { display: none !important; }
}

/* Écrans très étroits */
@media (max-width: 360px) {
  .hero-amount { font-size: 36px; }
  .tabbar a { font-size: 9.5px; }
}

/* ---------------------------------------------------------------- Accessibilité */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .aurora i { display: none; }
}

@media (prefers-reduced-transparency: reduce) {
  .card, .side-panel, .tabbar-inner, .sheet-panel, .menu-pop, .palette-panel { background: #fbfbfe; -webkit-backdrop-filter: none; backdrop-filter: none; }
}

@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .card, .side-panel, .tabbar-inner, .sheet-panel, .menu-pop, .palette-panel { background: rgba(252, 252, 255, .96); }
}

@media print {
  .aurora, .sidebar, .topbar, .tabbar, #toasts { display: none !important; }
  .shell { display: block; }
  .card { box-shadow: none; border: 1px solid #ddd; background: #fff; }
}

/* ---------------------------------------------------------------- Compléments */

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.amount-input[data-autosize] { width: auto; min-width: 1.2ch; }
.search-icon { display: none; }
.hero.is-night { --h1: #1e1b4b; --h2: #4338ca; --h3: #7c3aed; }
.acct .stretched { position: absolute; inset: 0; z-index: 0; border-radius: inherit; }
.acct .acct-edit { position: relative; z-index: 1; width: 34px; height: 34px; border-radius: 11px; background: rgba(255, 255, 255, .6); }
.acct .acct-edit:hover { background: #fff; }
.field.is-invalid, .amount-field.is-invalid { animation: shake .4s var(--ease); }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.error-wrap { display: grid; place-items: center; min-height: 60dvh; }
.error-wrap .auth-card { width: min(460px, 100%); }
.goal .row-title { white-space: normal; }
.sheet-summary .row-title { display: block; white-space: normal; }
.row .row-title .badge { vertical-align: 1px; margin-left: 4px; }
button.acct { font: inherit; text-align: center; }
.code.grow { margin: 0; }
.hero-pill { white-space: nowrap; flex: none; }
.hero-top .eyebrow { min-width: 0; }
@media (max-width: 767px) { .hero .eyebrow { font-size: 11px; letter-spacing: .07em; } }
@media (max-width: 767px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stats > .stat-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .stat-card { padding: 14px; }
  .stat .value { font-size: 19px; }
  .stat-card .bubble { display: none; }
  .row-actions .btn-sm { padding: 0 10px; }
}

/* Rappels automatiques (cron-job.org) */
.cron-steps { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.cron-steps li { display: flex; gap: 12px; align-items: flex-start; }
.cron-steps li > div { flex: 1; min-width: 0; }
.cron-steps strong { font-size: 14px; font-weight: 650; }
.cron-steps p { font-size: 13.5px; color: var(--ink-3); margin-top: 2px; }
.cron-steps a { color: var(--brand-ink); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.cron-n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 12.5px; font-weight: 700; color: #fff; background: var(--grad); box-shadow: 0 6px 14px -6px rgba(99, 102, 241, .7); }
.copy-field { display: flex; align-items: center; gap: 6px; margin-top: 8px; padding: 4px 4px 4px 12px; border-radius: 12px; background: rgba(18, 21, 43, .92); color: #e0e7ff; }
.copy-field code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; scrollbar-width: none; font: 12.5px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.copy-field .tag { font: 600 11px/1 var(--font); color: #a5b4fc; text-transform: uppercase; letter-spacing: .06em; flex: none; }
.copy-field .btn-icon { width: 34px; height: 34px; color: #c7d2fe; border-radius: 9px; }
.copy-field .btn-icon:hover { color: #fff; background: rgba(255, 255, 255, .1); }
/* Guide de démarrage : 4 colonnes, puis 2×2, puis 1 */
.onboard-steps { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1180px) { .onboard-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .onboard-steps { grid-template-columns: minmax(0, 1fr); } }
.onboard .card-head { align-items: flex-start; }
.onboard .card-head > .inline { flex-wrap: nowrap; min-width: 0; }
.onboard .card-head form { flex: none; }

/* ==========================================================================
   Fluidité sur téléphone et tablette
   Le verre dépoli (backdrop-filter), les halos animés et le grain plein écran
   sollicitent fortement le processeur graphique d'un téléphone : défilement
   saccadé, panneaux lents à s'ouvrir. Sur écran tactile ou étroit, on garde
   le même dessin avec des surfaces opaques, sans flou ni animation continue.
   ========================================================================== */
@media (max-width: 1024px), (hover: none) {
  .aurora {
    background:
      radial-gradient(700px 520px at 0% 0%, rgba(129, 120, 255, .22), transparent 65%),
      radial-gradient(600px 480px at 100% 12%, rgba(56, 189, 248, .16), transparent 65%),
      linear-gradient(180deg, #f3f4fb, #eceef8);
  }
  .aurora i, .aurora::after { display: none; }

  .card, .side-panel, .menu-pop, .toast, .palette-panel, .day-head, .hero-pill, .hero-btn,
  .tabbar-inner, .topbar.is-stuck .topbar-inner, .sheet-panel, .search-trigger {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .card, .acct { background: rgba(255, 255, 255, .92); box-shadow: 0 1px 2px rgba(20, 26, 60, .05), 0 8px 20px -12px rgba(35, 40, 110, .2); }
  .acct-add { background: rgba(255, 255, 255, .5); box-shadow: none; }
  .sheet-panel { background: #f9f9fe; }
  .menu-pop, .palette-panel { background: #fff; }
  .tabbar-inner { background: rgba(255, 255, 255, .97); }
  .topbar.is-stuck .topbar-inner { background: rgba(255, 255, 255, .96); }
  .day-head { background: rgba(244, 245, 252, .97); }
  .hero-pill, .hero-btn { background: rgba(255, 255, 255, .2); }
  .hero-btn.is-main { background: #fff; }
  .toast { background: #15182f; }
  .sheet::backdrop, .palette::backdrop { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(18, 20, 45, .45); }
  .hero::before, .hero::after { animation: none; }
  .reveal > * { animation-duration: .28s; animation-delay: 0s !important; }
  .day-group { content-visibility: auto; contain-intrinsic-size: auto 260px; }
}

/* Notifications : actions groupées */
.toast .t-actions { display: flex; align-items: center; gap: 4px; flex: none; }

/* Barre de synchronisation (hors ligne, envois en attente) */
.sync-bar { width: 100%; max-width: 1280px; margin: 10px auto 0; padding-inline: clamp(16px, 3vw, 36px); }
.sync-inner {
  display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 8px 6px 14px; border-radius: 16px;
  font-size: 13.5px; font-weight: 550; color: #7c4a03; background: #fff7e6; border: 1px solid rgba(245, 158, 11, .35);
}
.sync-bar.is-offline .sync-inner { color: var(--ink-2); background: #eef0f8; border-color: var(--line-2); }
.sync-bar.is-syncing .sync-inner { color: #312e81; background: #eef2ff; border-color: rgba(99, 102, 241, .3); }
.sync-bar.is-error .sync-inner { color: #8a1234; background: #fff1f2; border-color: rgba(244, 63, 94, .3); }
.sync-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: currentColor; }
.sync-bar.is-syncing .sync-dot { animation: syncPulse 1s ease-in-out infinite; }
.sync-inner .btn-icon { width: 36px; height: 36px; }
.sync-bar.is-open [data-sync-toggle] .i { transform: rotate(180deg); }
.sync-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sync-list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: #fff; border: 1px solid var(--line); font-size: 13.5px; }
.sync-list li small { display: block; font-size: 12px; color: var(--ink-3); }
.sync-list li.is-failed small { color: var(--danger-ink); }
.hero-note { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12.5px; font-weight: 550; color: rgba(255, 255, 255, .88); }
@keyframes syncPulse { 50% { opacity: .3; } }
@media (max-width: 767px) {
  .sync-bar { margin-top: 8px; padding-inline: 16px; }
  .sync-inner { font-size: 13px; }
}
/* ==========================================================================
   PostPilot — calendrier, réseaux, textes de publication
   ========================================================================== */

/* Calendrier */
.cal-card { padding: 14px; }
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-head { margin-bottom: 6px; }
.cal-head span { font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-4); text-align: center; }
.cal-day {
  display: flex; flex-direction: column; gap: 4px; min-height: 92px; padding: 8px; border-radius: 14px;
  background: rgba(255, 255, 255, .5); border: 1px solid var(--line); color: inherit;
}
.cal-day.is-out { opacity: .45; }
.cal-day.is-today { border-color: rgba(91, 92, 240, .55); box-shadow: 0 0 0 3px rgba(91, 92, 240, .12); }
a.cal-day:hover { background: #fff; box-shadow: var(--shadow); transform: translateY(-1px); transition: transform .2s var(--ease); }
.cal-num { font-size: 12.5px; font-weight: 700; color: var(--ink-3); }
.cal-day.is-today .cal-num { color: var(--brand-ink); }
.cal-title { font-size: 12px; line-height: 1.3; font-weight: 550; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cal-dots { display: flex; gap: 3px; margin-top: auto; flex-wrap: wrap; }
.cal-dots i, .cal-key { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--ink-4)); display: inline-block; flex: none; }
.cal-dots i.is-done, .cal-key.is-done { background: var(--success); }
.cal-dots i.is-failed, .cal-key.is-failed { background: var(--danger); }
@media (max-width: 767px) {
  .cal-day { min-height: 68px; padding: 6px; }
  .cal-title { display: none; }
  .cal-card { padding: 10px; }
  .cal-head, .cal-grid { gap: 4px; }
}

/* Réseau : une carte réglable */
.net-card { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 18px; background: rgba(255, 255, 255, .6); border: 1px solid var(--line); }
.net-head { display: flex; align-items: center; gap: 12px; }
.net-head .grow strong { display: block; font-size: 14.5px; font-weight: 650; }
.net-controls { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.net-controls .field { min-width: 120px; }
.net-controls .switch-row { min-width: 220px; }
.net-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 8px; border-top: 1px dashed var(--line-2); }

/* Texte d'une publication */
.post-text {
  white-space: pre-wrap; font-size: 15px; line-height: 1.6; color: var(--ink);
  padding: 14px 16px; border-radius: 16px; background: rgba(255, 255, 255, .7); border: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.post-text.small { font-size: 13.5px; }

/* Visuels */
.media-slot { display: flex; flex-direction: column; gap: 6px; }
.media-slot img { width: 100%; height: auto; border-radius: 14px; border: 1px solid var(--line); background: #fff; }
.media-empty { display: flex; align-items: center; gap: 10px; padding: 18px; border-radius: 14px; border: 1.5px dashed var(--line-2); color: var(--ink-4); }

/* Liste à puces sobre */
.clean-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.clean-list li { display: flex; gap: 10px; align-items: flex-start; color: var(--ink-2); }
.clean-list li .i { color: var(--brand); margin-top: 2px; flex: none; }

/* Champ à copier */
.copy-field { display: flex; align-items: center; gap: 6px; padding: 4px 4px 4px 12px; border-radius: 12px; background: rgba(18, 21, 43, .92); color: #e0e7ff; }
.copy-field code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; scrollbar-width: none; font: 12.5px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.copy-field .tag { font: 600 11px/1 var(--font); color: #a5b4fc; text-transform: uppercase; letter-spacing: .06em; flex: none; }
.copy-field .btn-icon { width: 34px; height: 34px; color: #c7d2fe; border-radius: 9px; }
.copy-field .btn-icon:hover { color: #fff; background: rgba(255, 255, 255, .1); }

.btn-icon-only { padding: 0; width: 40px; }
.fab .dot {
  position: absolute; top: -3px; right: -3px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; color: var(--brand-ink);
  background: #fff; box-shadow: 0 2px 6px rgba(20, 24, 55, .18);
}

/* Sur téléphone, une ligne de publication ne garde que l'essentiel : le
   bouton d'action suffit, la double flèche prenait la place du titre. */
@media (max-width: 600px) {
  .row-actions.has-action .open-day { display: none; }
  .row-end .badge { font-size: 10.5px; padding: 2px 7px; }
}
