/* ============================================================
   SplitIt — Liquid Glass design system (adapté du handoff Claude Design)
   theme = tokens + matériau "glass" ; ui = composants ; layout = shell.
   Glass = couche fonctionnelle (chrome flottant) ; .card = contenu solide.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter+Tight:ital,wght@0,400;0,500;0,600;0,700;0,800&display=swap');

:root {
  /* --- Brand --- */
  --primary: #2E7D68;
  --primary-600: #2A7160;
  --primary-700: #225C4E;
  --primary-100: #E2F0EB;
  --secondary: #FF7043;

  /* --- Surfaces (light) --- */
  --bg: #F7F8FA;
  --bg-2: #EEF1F4;
  --surface: #FFFFFF;
  --surface-2: #F4F6F8;
  --text: #111827;
  --text-2: #4B5563;
  --text-3: #6B7280;
  --line: #E5E7EB;
  --line-2: #D5DAE1;

  /* --- Solde semantics (RÉSERVÉ, jamais décoratif) --- */
  --pos: #16A34A;
  --pos-bg: #E7F6EC;
  --neg: #C2410C;       /* tu dois — PAS rouge */
  --neg-bg: #FBEBE2;
  --settled: #6B7280;
  --settled-bg: #EEF0F2;
  --error: #DC2626;     /* erreurs/échecs uniquement */
  --error-bg: #FCEBEB;
  --info: #2563EB;

  /* --- Glass (light) --- */
  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-bg-strong: rgba(255, 255, 255, 0.90);
  --glass-tint: rgba(46, 125, 104, 0.07);
  --glass-tint-strong: rgba(46, 125, 104, 0.12);
  --glass-edge: rgba(255, 255, 255, 0.85);
  --glass-edge-in: rgba(255, 255, 255, 0.55);
  --glass-blur: 20px;
  --glass-shadow: 0 10px 26px -12px rgba(17, 24, 39, 0.16), 0 2px 6px -3px rgba(17, 24, 39, 0.08);
  --glass-hi: rgba(255, 255, 255, 0.72);
  --glass-hairline: rgba(255, 255, 255, 0.14);
  --glass-sheen: rgba(255, 255, 255, 0.50);
  --glass-noise: 0.5;

  /* --- Elevation (3 niveaux) --- */
  --e0: none;
  --e1: 0 1px 2px rgba(17, 24, 39, 0.06), 0 1px 3px rgba(17, 24, 39, 0.05);
  --e2: 0 8px 24px -10px rgba(17, 24, 39, 0.18), 0 2px 6px -2px rgba(17, 24, 39, 0.08);

  /* --- Rayons concentriques --- */
  --r-container: 22px;
  --r-card: 16px;
  --r-control: 12px;
  --r-pill: 999px;

  /* --- Espacement (grille 8pt) --- */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;

  /* --- Type (échelle 5 pas FIXE) --- */
  --f-title: 28px; --fw-title: 700;
  --f-section: 18px; --fw-section: 600;
  --f-item: 16px; --fw-item: 600;
  --f-body: 14px; --fw-body: 400;
  --f-meta: 12px; --fw-meta: 500;

  --ring: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary);
  --font: 'Inter Tight', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

[data-theme="dark"] {
  --bg: #181A20;
  --bg-2: #131419;
  --surface: #20232B;
  --surface-2: #282C35;
  --text: #F1F3F6;
  --text-2: #B7BDC8;
  --text-3: #8C93A0;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.10);
  --primary-100: #233A34;
  --pos-bg: #1A2E22;
  --neg-bg: #33231A;
  --settled-bg: #272B33;
  --error-bg: #34201F;
  /* Lighten semantic foregrounds so money-status text meets WCAG AA on dark surfaces. */
  --pos: #4ADE80;
  --neg: #FB923C;
  --settled: #9CA3AF;
  --info: #60A5FA;
  --glass-bg: rgba(32, 35, 43, 0.58);
  --glass-bg-strong: rgba(32, 35, 43, 0.82);
  --glass-tint: rgba(46, 125, 104, 0.09);
  --glass-tint-strong: rgba(46, 125, 104, 0.15);
  --glass-edge: rgba(255, 255, 255, 0.09);
  --glass-edge-in: rgba(255, 255, 255, 0.045);
  --glass-shadow: 0 12px 30px -14px rgba(0, 0, 0, 0.40), 0 2px 6px -3px rgba(0, 0, 0, 0.30);
  --glass-hi: rgba(255, 255, 255, 0.14);
  --glass-hairline: rgba(255, 255, 255, 0.08);
  --glass-sheen: rgba(255, 255, 255, 0.07);
  --glass-noise: 0.35;
  --e1: 0 1px 2px rgba(0, 0, 0, 0.30);
  --e2: 0 8px 24px -14px rgba(0, 0, 0, 0.45);
}

/* ============================================================
   GLASS — un seul matériau, flotte au-dessus du contenu
   ============================================================ */
.glass {
  position: relative;
  isolation: isolate;
  background:
    linear-gradient(152deg, var(--glass-sheen) 0%, transparent 46%),
    linear-gradient(180deg, var(--glass-tint), transparent 72%),
    var(--glass-bg);
  -webkit-backdrop-filter: blur(26px) saturate(160%) brightness(1.04);
  backdrop-filter: blur(26px) saturate(160%) brightness(1.04);
  border-radius: var(--r-container);
  box-shadow:
    var(--glass-shadow),
    inset 0 1px 0.5px var(--glass-hi),
    inset 0 0 0 1px var(--glass-hairline),
    inset 0 -10px 24px -18px rgba(0, 0, 0, 0.30);
}
.glass::after {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  border-radius: inherit; pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  opacity: var(--glass-noise);
  mix-blend-mode: overlay;
}
.glass::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, var(--glass-hi) 0%, rgba(255, 255, 255, 0.15) 26%, transparent 48%, transparent 82%, var(--glass-hairline));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none;
}
.glass--strong {
  background:
    linear-gradient(152deg, var(--glass-sheen) 0%, transparent 46%),
    linear-gradient(180deg, var(--glass-tint-strong), var(--glass-tint) 60%),
    var(--glass-bg-strong);
}
.glass--strong::after { opacity: calc(var(--glass-noise) * 0.6); }
.glass--hoverable { transition: box-shadow .25s, transform .25s; }
@media (hover: hover) and (pointer: fine) {
  .glass.glass--hoverable:hover {
    box-shadow:
      var(--glass-shadow),
      inset 0 1px 0.5px rgba(255, 255, 255, 0.85),
      inset 0 0 0 1px var(--glass-hairline),
      inset 0 -10px 24px -18px rgba(0, 0, 0, 0.30);
  }
}

/* Transparence réduite — verre -> surface solide opaque */
[data-rt="1"] .glass {
  background: var(--surface) !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  border: 1px solid var(--line);
  box-shadow: var(--e2);
}
[data-rt="1"] .glass--strong { background: var(--surface) !important; }
[data-rt="1"] .glass::before { display: none; }

/* ============================================================
   BASE
   ============================================================ */
.app-root {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: var(--f-body);
  font-weight: var(--fw-body);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.f-title { font-size: var(--f-title); font-weight: var(--fw-title); letter-spacing: -0.02em; line-height: 1.15; }
.f-section { font-size: var(--f-section); font-weight: var(--fw-section); letter-spacing: -0.01em; }
.f-item { font-size: var(--f-item); font-weight: var(--fw-item); }
.f-body { font-size: var(--f-body); font-weight: var(--fw-body); }
.f-meta { font-size: var(--f-meta); font-weight: var(--fw-meta); color: var(--text-3); }

/* FocusOnNavigate adds tabindex="-1" to the route's h1 and focuses it for screen
   readers. Such targets aren't keyboard-reachable (tab order excludes -1), so the
   default focus box is pure noise here — drop it. Interactive controls keep theirs. */
[tabindex="-1"]:focus { outline: none; }

/* skeleton shimmer */
@keyframes sk-shimmer { 0% { background-position: -200% 0 } 100% { background-position: 200% 0 } }
.sk {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--bg-2) 37%, var(--surface-2) 63%);
  background-size: 200% 100%;
  animation: sk-shimmer 1.4s ease-in-out infinite;
  border-radius: 8px;
}
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }

/* ============================================================
   COMPOSANTS — surfaces SOLIDES (contenu lisible)
   ============================================================ */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--e1); }
.card--flat { box-shadow: var(--e0); }
.card--pad { padding: var(--s4); }

/* Avatar (initiales) */
.si-avatar {
  flex: 0 0 auto; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; letter-spacing: 0.02em;
  width: 40px; height: 40px; font-size: 15px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.si-avatar--sm { width: 32px; height: 32px; font-size: 13px; }
.si-avatar--lg { width: 56px; height: 56px; font-size: 20px; }
.si-avatar--xl { width: 72px; height: 72px; font-size: 26px; }

/* Chips */
.si-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 10px; border-radius: var(--r-pill);
  font-size: var(--f-meta); font-weight: 600;
  background: var(--surface-2); color: var(--text-2);
  border: 1px solid var(--line);
}
.si-chip--currency { background: var(--secondary); color: #111827; border-color: transparent; letter-spacing: .04em; }
.si-chip--pos { background: var(--pos-bg); color: var(--pos); border-color: transparent; }
.si-chip--neg { background: var(--neg-bg); color: var(--neg); border-color: transparent; }
.si-chip--settled { background: var(--settled-bg); color: var(--settled); border-color: transparent; }
.si-chip--slate { background: rgba(37, 99, 235, .10); color: var(--info); border-color: transparent; }
.si-chip--pending { background: var(--neg-bg); color: var(--neg); border-color: transparent; }

/* Directional balance line */
.bal-line {
  display: grid; grid-template-columns: auto 1fr auto; gap: var(--s3);
  align-items: center; padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--line);
}
.bal-line:last-child { border-bottom: none; }
.bal-line__who { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.bal-line__name { font-weight: 600; font-size: var(--f-item); }
.bal-line__phrase { display: inline-flex; align-items: center; gap: 5px; font-size: var(--f-meta); font-weight: 600; }
.bal-line__phrase.pos { color: var(--pos); }
.bal-line__phrase.neg { color: var(--neg); }
.bal-line__phrase.settled { color: var(--settled); }
.bal-line__amt { font-weight: 700; font-size: var(--f-item); text-align: right; white-space: nowrap; }
.bal-line__amt.pos { color: var(--pos); }
.bal-line__amt.neg { color: var(--neg); }
.bal-line__amt.settled { color: var(--settled); }
.diverge { grid-column: 1 / -1; height: 8px; position: relative; margin-top: 4px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.diverge__mid { position: absolute; left: 50%; top: -2px; bottom: -2px; width: 2px; background: var(--line-2); transform: translateX(-50%); }
.diverge__fill { position: absolute; top: 0; bottom: 0; border-radius: 999px; }
.diverge__fill.neg { right: 50%; background: var(--neg); }
.diverge__fill.pos { left: 50%; background: var(--pos); }

/* Settlement / settle card */
.settle-card {
  display: grid; grid-template-columns: 1fr auto; gap: var(--s3) var(--s4);
  align-items: center; padding: var(--s3) var(--s4);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-card); margin-bottom: var(--s2);
}
.settle-flow { display: flex; align-items: center; gap: var(--s3); min-width: 0; flex-wrap: wrap; }

/* Expense line */
.exp-line {
  display: grid; grid-template-columns: auto 1fr auto auto; gap: var(--s3);
  align-items: center; padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--line);
}
.exp-line:last-child { border-bottom: none; }
.exp-cat {
  width: 44px; height: 44px; border-radius: 50%; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-100); color: var(--primary);
}
.exp-line__main { min-width: 0; }
.exp-line__title { font-weight: 600; font-size: var(--f-item); }
.exp-line__meta { font-size: var(--f-meta); color: var(--text-3); }
.exp-line__amt { font-weight: 700; font-size: var(--f-item); white-space: nowrap; }

/* Info note (subtle, informational — never an error) */
.si-note { display: flex; gap: 10px; align-items: flex-start; padding: var(--s3) var(--s4); background: rgba(37, 99, 235, .06); border: 1px solid rgba(37, 99, 235, .16); border-radius: var(--r-control); color: var(--text-2); font-size: var(--f-body); margin-bottom: var(--s4); }
.si-note .mud-icon-root { color: var(--info); flex: 0 0 auto; margin-top: 1px; }

/* Empty state */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s3); padding: var(--s7) var(--s4); color: var(--text-2); }
.empty__picto { width: 72px; height: 72px; color: var(--text-3); opacity: .8; }
.empty h3 { margin: 0; font-size: var(--f-section); font-weight: 600; color: var(--text); }
.empty p { margin: 0; max-width: 340px; font-size: var(--f-body); }

/* FAB (cœur vert solide + anneau de verre) */
.fab {
  position: relative; width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: none; background: transparent; transition: transform .12s;
}
.fab::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: var(--glass-tint);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-shadow);
}
.fab__core {
  position: relative; width: 50px; height: 50px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--e1), inset 0 1px 0 rgba(255, 255, 255, .25);
  transition: background .15s;
}
@media (hover: hover) and (pointer: fine) { .fab:hover .fab__core { background: var(--primary-600); } }
.fab:active { transform: scale(.95); }
[data-rt="1"] .fab::before { background: var(--primary); -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: var(--e2); }

/* ============================================================
   SHELL — app, nav-rail (desktop), bottom-nav (mobile)
   ============================================================ */
.app-shell { position: relative; display: flex; min-height: 100dvh; }
.app-scroll { flex: 1; min-width: 0; overflow-x: clip; }

/* Slim utility bar (in-flow) — brand on mobile, notifications + logout right */
.app-topbar { display: flex; align-items: center; gap: var(--s2); padding: var(--s3) var(--s5) 0; }
.app-topbar .spacer { flex: 1; }
.topbar-brand { display: none; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; color: var(--primary); text-decoration: none; letter-spacing: -.02em; }
.topbar-brand .logo { width: 26px; height: 26px; border-radius: 8px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; }
.app-main { max-width: 980px; margin: 0 auto; padding: var(--s5) var(--s5) 120px; }
.app-main--wide { max-width: 1240px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s5); flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-sub { color: var(--text-2); font-size: var(--f-body); margin-top: 4px; }

/* Desktop / tablet rail */
.nav-rail {
  flex: 0 0 auto; z-index: 35;
  display: flex; flex-direction: column; gap: 6px;
  padding: var(--s4) 14px;
  background: var(--surface); border-right: 1px solid var(--line);
  width: 232px; align-self: stretch;
}
.nav-rail .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; color: var(--primary); padding: 8px 10px var(--s4); letter-spacing: -.02em; }
.nav-rail .brand .logo { width: 30px; height: 30px; border-radius: 9px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.nav-item {
  display: flex; align-items: center; gap: 14px;
  min-height: 48px; padding: 0 14px; border-radius: var(--r-control);
  color: var(--text-2); font-weight: 600; font-size: var(--f-item);
  cursor: pointer; border: none; background: transparent; width: 100%; text-align: left;
  text-decoration: none; transition: background .15s, color .15s; position: relative;
}
.nav-item .ic { flex: 0 0 auto; display: flex; }
@media (hover: hover) and (pointer: fine) { .nav-item:hover { background: var(--surface-2); color: var(--text); } }
.nav-item.is-active { background: var(--primary-100); color: var(--primary); }
.nav-item.is-active::before { content: ""; position: absolute; left: -14px; top: 50%; transform: translateY(-50%); width: 4px; height: 22px; background: var(--primary); border-radius: 0 4px 4px 0; }
.nav-rail .spacer { flex: 1; }
.nav-rail .rail-foot { border-top: 1px solid var(--line); padding-top: var(--s2); margin-top: var(--s2); }

/* Bottom nav mobile (verre, capsule détachée) */
.bottomnav {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 45;
  height: 68px; display: none; align-items: center; justify-content: space-around;
  padding: 0 8px; border-radius: var(--r-pill);
}
.bn-item {
  flex: 1; max-width: 80px; min-height: 52px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: none; background: transparent; cursor: pointer; color: var(--text-2);
  font-size: 11px; font-weight: 600; border-radius: var(--r-pill); position: relative; text-decoration: none;
  transition: color .15s;
}
.bn-item.is-active { color: var(--primary); }
.bn-item.is-active .bn-pill { position: absolute; top: 6px; width: 44px; height: 30px; border-radius: 999px; background: var(--primary-100); z-index: -1; }

/* Master-detail (desktop pool) */
.md { display: grid; grid-template-columns: 340px 1fr; gap: var(--s5); align-items: start; }

/* Pools grid + hero */
.pools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: var(--s4); }
.pool-card { padding: var(--s4); cursor: pointer; transition: transform .15s, box-shadow .15s; }
@media (hover: hover) and (pointer: fine) { .pool-card:hover { transform: translateY(-2px); box-shadow: var(--e2); } }
.pool-card__top { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s3); }
.pool-card__mini { margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--line); display: flex; align-items: center; gap: 8px; font-size: var(--f-body); font-weight: 600; }
.hero { padding: var(--s5); margin-bottom: var(--s5); }
.hero__label { font-size: var(--f-meta); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--primary); }
.hero__amount { font-size: 40px; font-weight: 800; letter-spacing: -.03em; line-height: 1.05; margin: 8px 0; }
.hero__phrase { font-size: var(--f-section); font-weight: 600; }
.hero__row { display: flex; gap: var(--s3); margin-top: var(--s4); flex-wrap: wrap; }

/* ============================================================
   AUTH / ONBOARDING — glass card on a soft brand glow
   ============================================================ */
.auth-wrap {
  width: 100vw; margin-left: calc(50% - 50vw);
  min-height: 86vh; display: flex; align-items: center; justify-content: center;
  padding: var(--s7) var(--s4);
  background: radial-gradient(1300px 760px at 50% -12%, var(--primary-100), transparent 68%);
}
.auth-card { width: 100%; max-width: 420px; padding: var(--s6); }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 800; font-size: 22px; color: var(--primary); letter-spacing: -.02em; margin-bottom: var(--s5); }
.auth-brand .logo { width: 34px; height: 34px; border-radius: 10px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.auth-card h1 { font-size: var(--f-title); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; margin: 0 0 6px; text-align: center; }
.auth-sub { color: var(--text-2); text-align: center; margin: 0 0 var(--s5); font-size: var(--f-body); }
.auth-foot { text-align: center; margin-top: var(--s4); color: var(--text-2); font-size: var(--f-body); }

/* Inputs inside the auth card adopt the design tokens */
.auth-card .splitit-form .field { margin-bottom: var(--s4); }
.auth-card .splitit-form label { color: var(--text-2); font-weight: 600; font-size: var(--f-meta); margin-bottom: 6px; }
.auth-card .splitit-form input { border-radius: var(--r-control); border: 1px solid var(--line-2); padding: 0.72rem 0.9rem; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.auth-card .splitit-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
.auth-card .btn-submit { border-radius: var(--r-control); padding: 0.78rem 1.25rem; font-size: var(--f-item); font-weight: 600; margin-top: var(--s2); }

/* ---------- Responsive : bascule rail -> bottom-nav ---------- */
@media (max-width: 599px) {
  .nav-rail { display: none; }
  .bottomnav { display: flex; }
  .app-main { padding: var(--s4) var(--s4) 96px; }
  .app-topbar { padding: var(--s3) var(--s4) 0; }
  .topbar-brand { display: inline-flex; }
  .md { grid-template-columns: 1fr; }
}

/* ============================================================
   PONT MUDBLAZOR — on garde les composants Mud, on adopte le look
   (override ciblé : police, rayons, app-bar en verre)
   ============================================================ */
body,
.mud-typography,
.mud-input-root,
.mud-input,
.mud-button-root,
.mud-list-item,
.mud-tabs,
.mud-table {
  font-family: var(--font);
}

/* App-bar = chrome flottant -> matériau verre */
.mud-appbar.mud-appbar-fixed-top,
.mud-appbar {
  background: var(--glass-bg-strong) !important;
  -webkit-backdrop-filter: blur(24px) saturate(160%) brightness(1.03);
  backdrop-filter: blur(24px) saturate(160%) brightness(1.03);
  border-bottom: 1px solid var(--glass-hairline);
  box-shadow: var(--glass-shadow) !important;
  color: var(--text) !important;
}
[data-rt="1"] .mud-appbar {
  background: var(--surface) !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

/* Surfaces solides du contenu : rayon carte + page sur fond --bg */
.mud-main-content { background: var(--bg); }
.mud-paper:not(.mud-appbar) { border-radius: var(--r-card); }
.mud-card { border-radius: var(--r-card); }

/* Logout button in the utility bar — discreet ghost */
.app-topbar form { display: inline-flex; }


/* ============================================================
   LIQUID GLASS — remaining screens (profile/details/scan/create/
   dialogs/join/status). Generated from the redesign spec workflow.
   ============================================================ */

/* --- from Pages__AccessDenied.razor --- */
/* Standalone status pages (access-denied, not-found, error): centre the .empty
   block in the available space, mirroring .auth-wrap. */
.status-page {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.status-page__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  justify-content: center;
  margin-top: var(--s2);
}

/* --- from Pages__Error.razor --- */
/* ============================================================
   STATUS PAGES — error / status pictogram + request-id chip
   Used by Error.razor (centered .empty inside an .auth-card).
   ============================================================ */
.status-picto {
  width: 72px; height: 72px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.status-picto--error {
  color: var(--error);
  background: color-mix(in srgb, var(--error) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--error) 24%, transparent);
}

.status-reqid {
  display: inline-flex; align-items: center; gap: var(--s2);
  flex-wrap: wrap; justify-content: center;
  max-width: 100%;
}
.status-reqid__label {
  font-size: var(--f-meta); font-weight: 600;
  color: var(--text-3); text-transform: uppercase;
  letter-spacing: .04em;
}
.status-reqid code {
  font-size: var(--f-meta); color: var(--text-2);
  background: var(--surface-2, var(--surface)); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: 2px 10px;
  word-break: break-all;
}

/* --- from Pages__JoinPool.razor --- */
/* ============================================================
   JOIN-BY-INVITE — decorative pool glyph + stacked link actions
   inside the shared .auth-card. Reuses auth tokens; adds only
   the patterns the auth card was missing (centred glyph, a
   vertical stack of full-width link buttons).
   ============================================================ */
.auth-glyph { display: flex; justify-content: center; margin-bottom: var(--s4); }
.auth-actions { display: flex; flex-direction: column; gap: var(--s3); margin-top: var(--s5); }

/* --- from Pages__NotFound.razor --- */
/* ============================================================
   STATUS PAGES — centered empty-state on a soft brand glow
   (not-found, and reusable for other full-page status screens)
   ============================================================ */
.status-wrap {
  width: 100%;
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s6) var(--s4);
  background: radial-gradient(1100px 620px at 50% -10%, var(--primary-100), transparent 66%);
}
.status-wrap .empty { padding: 0; }

/* --- from Pages__Profile.razor --- */
/* ============================================================
   PROFILE — identity header, settings sections, preferences
   ============================================================ */
.profile-id { display: flex; align-items: center; gap: var(--s4); }
.profile-id .mud-avatar { width: 56px; height: 56px; font-size: 20px; }

/* Right-align the primary action inside a settings card */
.profile-actions { display: flex; justify-content: flex-end; }
@media (max-width: 599px) {
  .profile-actions { justify-content: stretch; }
  .profile-actions .mud-button-root { width: 100%; }
}

/* Display-preference rows (dark mode, reduced transparency) */
.pref-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s4); padding: var(--s3) 0;
  border-bottom: 1px solid var(--line);
}
.pref-row--last { border-bottom: none; padding-bottom: 0; }
.pref-row:first-child { padding-top: 0; }
.pref-row__text { min-width: 0; }
@media (max-width: 599px) {
  .pref-row { align-items: flex-start; flex-wrap: wrap; gap: var(--s2); }
}

/* Cross-pool slate promo */
.slate-promo { display: flex; align-items: center; gap: var(--s4); }
.slate-promo__icon {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-100); color: var(--primary);
}
@media (max-width: 599px) {
  .slate-promo { flex-wrap: wrap; }
  .slate-promo .mud-button-root { width: 100%; }
}

/* --- from Pages__Scan.razor --- */
/* ============================================================
   SCAN — QR join page (focused glass card, reuses .auth-* shell)
   IDs qr-video-section / qr-video / qr-upload-section / qr-file /
   qr-status / qr-link / qr-go are wired by js/qr-scanner.js — keep them.
   ============================================================ */
.scan-card { max-width: 460px; }
.scan-card h1 { text-align: center; }

.scan-wrap .scan-hint {
  color: var(--text-2);
  font-size: var(--f-body);
  margin: 0 0 var(--s3);
  text-align: center;
}
.scan-wrap .scan-label {
  color: var(--text-2);
  font-weight: 600;
  font-size: var(--f-meta);
  margin: 0 0 var(--s2);
}

/* Camera viewport — square, rounded, with a corner-frame guide overlay */
.scan-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #000;
  border-radius: var(--r-card);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--glass-hairline), var(--e1);
}
.scan-viewport #qr-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.scan-frame {
  position: absolute;
  inset: 14%;
  border-radius: var(--r-control);
  pointer-events: none;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.18),
    0 0 0 9999px rgba(0, 0, 0, 0.22);
}
.scan-frame::before,
.scan-frame::after {
  content: "";
  position: absolute;
  width: 26px;
  height: 26px;
  border: 3px solid var(--surface);
  border-radius: 3px;
}
.scan-frame::before { top: -3px; left: -3px; border-right: 0; border-bottom: 0; }
.scan-frame::after { bottom: -3px; right: -3px; border-left: 0; border-top: 0; }
@media (prefers-reduced-motion: no-preference) {
  .scan-frame { transition: box-shadow .3s; }
}

/* File input styled as a tappable drop target (native input kept for JS change) */
.scan-card .splitit-form .scan-file {
  width: 100%;
  padding: var(--s4);
  border: 1.5px dashed var(--line-2);
  border-radius: var(--r-control);
  background: var(--surface-2);
  color: var(--text-2);
  font: inherit;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.scan-card .splitit-form .scan-file:hover { border-color: var(--primary); background: var(--primary-100); }
.scan-card .splitit-form .scan-file:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
.scan-card .splitit-form .scan-file::file-selector-button {
  margin-right: var(--s3);
  padding: 6px 12px;
  border: none;
  border-radius: var(--r-pill);
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* Status line — informational; JS swaps textContent (never an error colour) */
.scan-status {
  margin: var(--s3) 0 0;
  min-height: 1.2em;
  font-size: var(--f-body);
  color: var(--text-3);
  text-align: center;
}
.scan-status:empty { margin: 0; }

/* Labelled "ou" divider between scan options and the manual-link fallback */
.scan-or {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin: var(--s5) 0 var(--s4);
  color: var(--text-3);
  font-size: var(--f-meta);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.scan-or::before,
.scan-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* Manual link: input + full-width Rejoindre, stacked (comfortable on phones) */
.scan-link-form .field { margin-bottom: var(--s3); }
.scan-card .scan-link-form .btn-submit { margin-top: 0; }

/* --- from Pools__Create.razor --- */
/* New-pool form — centred single-purpose card inside the app shell */
.create-pool { max-width: 520px; }
.create-pool__actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--s2); margin-top: var(--s2); }
@media (max-width: 599px) {
  .create-pool { max-width: 100%; }
  .create-pool__actions { flex-direction: column-reverse; align-items: stretch; gap: var(--s3); }
  .create-pool__actions .mud-button-root { width: 100%; }
}

/* --- from Pools__Details.razor --- */
/* ============================================================
   POOL DETAIL — member rows + invite block (Liquid Glass)
   ============================================================ */
/* Member row — same rhythm as .exp-line / .bal-line, person-centric */
.mbr-line {
  display: grid; grid-template-columns: auto 1fr auto; gap: var(--s3);
  align-items: center; padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--line);
}
.mbr-line:last-child { border-bottom: none; }
.mbr-line__main { min-width: 0; }
.mbr-line__name { font-weight: 600; font-size: var(--f-item); }
.mbr-line__meta { font-size: var(--f-meta); color: var(--text-3); }

/* Invite QR + link — wraps to a column on narrow phones */
.invite-grid { display: flex; gap: var(--s5); align-items: flex-start; flex-wrap: wrap; }
.invite-qr { border: 1px solid var(--line); border-radius: var(--r-control); background: #fff; flex: 0 0 auto; }

/* MudTabs adopt the design tokens (rounded pill bar, brand active state) */
.pool-tabs .mud-tabs-toolbar { border-radius: var(--r-control); }
.pool-tabs .mud-tab { font-weight: 600; text-transform: none; }
.pool-tabs .mud-tab-slider { background: var(--primary); }

/* --- from Pools__ExpenseDialog.razor --- */
/* ============================================================
   EXPENSE DIALOG (.ed-*) — add/edit expense modal, Liquid Glass.
   Presentation only; MudDialog/MudForm behaviour untouched.
   ============================================================ */
.ed-dialog .mud-dialog { border-radius: var(--r-container); max-width: 520px; }
.ed-dialog .mud-dialog-content { padding-top: var(--s2); }

/* Title with category-style icon chip */
.ed-title { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.ed-title__icon {
  width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-100); color: var(--primary);
}
.ed-title__text { letter-spacing: -0.01em; }

.ed-body { width: 100%; }

/* Logical groups of fields */
.ed-section { display: flex; flex-direction: column; gap: var(--s3); }
.ed-section__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.ed-section__label { font-size: var(--f-meta); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }

/* Amount + currency on one row, currency stays compact */
.ed-row { display: flex; gap: var(--s2); align-items: flex-start; }
.ed-row__grow { flex: 1 1 auto; min-width: 0; }
.ed-currency { flex: 0 0 104px; max-width: 104px; }

/* Split-mode segmented control */
.ed-modes .mud-button-root { border-radius: var(--r-pill); }
.ed-modes .mud-button-root:not(:last-child) { margin-right: 4px; }

/* Split list inside a flat card */
.ed-split { overflow: hidden; }
.ed-split .mud-list { padding: 0; }
.ed-split__item { padding: 2px var(--s3); border-bottom: 1px solid var(--line); transition: background .15s; }
.ed-split .mud-list-item:last-of-type { border-bottom: none; }
.ed-split__item.is-on { background: var(--surface-2); }
.ed-split__row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); width: 100%; }
.ed-split__row .mud-checkbox { min-width: 0; }
.ed-split__amt { flex: 0 0 132px; max-width: 132px; }

/* Remaining-to-split status line (semantic colour: green ok / red imbalance) */
.ed-remaining {
  display: flex; align-items: center; gap: var(--s2);
  padding: var(--s3) var(--s4); border-top: 1px solid var(--line);
  font-size: var(--f-body); font-weight: 600;
}
.ed-remaining__ic { flex: 0 0 auto; }
.ed-remaining__amt { margin-left: auto; font-weight: 700; }
.ed-remaining.is-ok { color: var(--pos); }
.ed-remaining.is-ok .ed-remaining__ic { color: var(--pos); }
.ed-remaining.is-off { color: var(--error); }
.ed-remaining.is-off .ed-remaining__ic { color: var(--error); }

/* Info note tuned for inside the dialog (no bottom margin gap) */
.ed-note { margin-bottom: 0; }

.ed-error { border-radius: var(--r-control); }

/* Comfortable, full-width-friendly action bar */
.ed-actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--s2); width: 100%; }
.ed-actions__cancel { color: var(--text-2); }

/* Phone comfort: dialog hugs the screen, actions stretch for big tap targets */
@media (max-width: 599px) {
  .ed-dialog .mud-dialog { width: calc(100vw - 24px); max-width: calc(100vw - 24px); margin: 12px; }
  .ed-currency { flex-basis: 96px; max-width: 96px; }
  .ed-split__amt { flex-basis: 116px; max-width: 116px; }
  .ed-actions { flex-direction: row; }
  .ed-actions .mud-button-root { flex: 1 1 0; }
}

/* --- from Pools__RecordSettlementDialog.razor --- */
/* Dialog title row — icon chip + heading (reused by pool dialogs) */
.dlg-title { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.dlg-title__icon {
  width: 34px; height: 34px; border-radius: var(--r-control); flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-100); color: var(--primary);
}
.dlg-title .mud-typography { margin: 0; }

/* Keep the glass FAB fixed: 2-class selector beats .fab{position:relative}. */
.fab.splitit-fab { position: fixed; }

/* ============================================================
   DARK MODE — MudBlazor palette overrides
   Scoped html[data-theme="dark"] (specificity 0,1,1) so it beats the
   MudThemeProvider :root (0,1,0) palette injected later in the body.
   This flips Mud components (inputs, dialogs, menus, tabs) to dark so
   they match the CSS-token chrome (.card/.nav-rail/.glass) under dark mode.
   ============================================================ */
html[data-theme="dark"] {
  --mud-palette-black: #0B0C10;
  --mud-palette-background: #181A20;
  --mud-palette-background-gray: #131419;
  --mud-palette-surface: #20232B;
  --mud-palette-drawer-background: #1C1F26;
  --mud-palette-drawer-text: #F1F3F6;
  --mud-palette-drawer-icon: #B7BDC8;
  --mud-palette-appbar-background: #20232B;
  --mud-palette-appbar-text: #F1F3F6;
  --mud-palette-text-primary: #F1F3F6;
  --mud-palette-text-secondary: #B7BDC8;
  --mud-palette-text-disabled: rgba(255, 255, 255, 0.30);
  --mud-palette-action-default: #B7BDC8;
  --mud-palette-action-disabled: rgba(255, 255, 255, 0.26);
  --mud-palette-action-disabled-background: rgba(255, 255, 255, 0.12);
  --mud-palette-divider: rgba(255, 255, 255, 0.10);
  --mud-palette-divider-light: rgba(255, 255, 255, 0.06);
  --mud-palette-lines-default: rgba(255, 255, 255, 0.10);
  --mud-palette-lines-inputs: rgba(255, 255, 255, 0.30);
  --mud-palette-table-lines: rgba(255, 255, 255, 0.10);
  --mud-palette-table-hover: rgba(255, 255, 255, 0.04);
  --mud-palette-surface-2: #282C35;
  --mud-palette-overlay-dark: rgba(17, 19, 24, 0.75);
}
/* Surfaces Mud paints directly (cards/menus/dialogs) -> dark surface token. */
html[data-theme="dark"] .mud-paper:not(.mud-appbar),
html[data-theme="dark"] .mud-card,
html[data-theme="dark"] .mud-popover,
html[data-theme="dark"] .mud-dialog {
  background-color: var(--surface);
  color: var(--text);
}

/* Dark mode: lift the brand-green text/icons that sit on dark tint surfaces to AA. */
html[data-theme="dark"] .nav-item.is-active,
html[data-theme="dark"] .bn-item.is-active,
html[data-theme="dark"] .exp-cat,
html[data-theme="dark"] .slate-promo__icon,
html[data-theme="dark"] .dlg-title__icon,
html[data-theme="dark"] .ed-title__icon { color: #6EE7B7; }
