/* Popote Alpha — reprend la maquette validée (noir + rouge du logo) */
:root {
  color-scheme: dark;
  --bg: #0B0D12; --surface: #141821; --surface2: #1B2029; --line: #272D3A;
  --text: #EEEAE0; --muted: #8E95A5;
  --gold: #E5483C; --gold-ink: #FFFFFF;          /* accent rouge (nom historique "gold") */
  --blue: #3563E0; --red: #FF7A6E; --ok: #43B478;
  --display: "Saira Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --tabbar-h: 72px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--body); font-size: 15px; line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
  padding-top: env(safe-area-inset-top, 0px);
}
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
a { color: var(--gold); }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.v, .price, .amt, .amount, .pill, .linkbtn, .stat .v, .tbl .btn { white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 600; }
.accent { color: var(--gold); }
.ok-ink { color: var(--ok) !important; }
.push-right { margin-left: auto; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.shell { max-width: 480px; margin: 0 auto; min-height: 100%; position: relative; padding-inline: 16px; }
.shell.app { padding-bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom, 0px)); }

/* Démarrage */
.boot { min-height: 100vh; display: grid; place-content: center; gap: 22px; justify-items: center; }
.boot img { width: 140px; border-radius: 50%; box-shadow: 0 0 0 1px #3a1f1d, 0 18px 60px -10px rgba(229,72,60,.30); }
.boot-bar { width: 140px; height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; }
.boot-bar span { display: block; width: 40%; height: 100%; background: var(--gold); animation: boot 1.1s ease-in-out infinite; }
@keyframes boot { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }

/* Connexion */
.login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding-block: 32px; text-align: center; }
.logo-big { width: min(62vw, 240px); aspect-ratio: 1; border-radius: 50%; box-shadow: 0 0 0 1px #3a1f1d, 0 18px 60px -10px rgba(229,72,60,.30); }
.login h1 { font-family: var(--display); font-weight: 800; font-size: 34px; letter-spacing: .06em; text-transform: uppercase; margin: 0; line-height: 1; }
.login h1 span, .topbar .t span { color: var(--gold); }
.motto { font-family: var(--display); letter-spacing: .22em; font-size: 12px; color: var(--muted); text-transform: uppercase; margin-top: 6px; }
.login-form { width: 100%; max-width: 320px; display: flex; flex-direction: column; gap: 10px; }
.field { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px; font-size: 17px; }
.field:focus { border-color: var(--gold); outline: none; }
textarea.field { font-size: 15px; min-height: 96px; resize: vertical; }
.btn { border: 0; border-radius: 10px; padding: 14px 16px; font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: .08em; text-transform: uppercase; }
.btn-gold { background: var(--gold); color: var(--gold-ink); }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn-sm { padding: 9px 12px; font-size: 14px; border-radius: 8px; }
.err { color: var(--red); font-size: 14px; min-height: 20px; }

/* Barre du haut */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: rgba(11,13,18,.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); margin-inline: -16px; }
.topbar img { width: 34px; height: 34px; border-radius: 50%; }
.topbar .t { font-family: var(--display); font-weight: 800; font-size: 20px; letter-spacing: .06em; text-transform: uppercase; flex: 1; line-height: 1; }
.chip { font-family: var(--display); font-weight: 600; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); }
.chip.admin { border-color: var(--gold); color: var(--gold); }
.iconbtn { background: none; border: 1px solid var(--line); border-radius: 8px; width: 36px; height: 36px; display: grid; place-items: center; color: var(--muted); flex: none; }
.view { display: flex; flex-direction: column; gap: 18px; padding-top: 18px; }
.eyebrow { font-family: var(--display); font-weight: 600; font-size: 13px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
h2 { font-family: var(--display); font-weight: 700; font-size: 26px; letter-spacing: .03em; margin: 0; line-height: 1.1; text-wrap: balance; }
h2:focus { outline: none; }
.h-sheet { font-size: 22px; }

/* Carte du total */
.due { background: linear-gradient(160deg, #1a1f2b 0%, #12151c 100%); border: 1px solid var(--line); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; }
.due::after { content: ""; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; background: conic-gradient(from 200deg, var(--blue), transparent 30%, var(--red) 60%, transparent 80%); opacity: .18; }
.due .amount { font-family: var(--display); font-weight: 800; font-size: 60px; line-height: 1; color: var(--gold); }
.due .sub { color: var(--muted); font-size: 14px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.row { display: flex; align-items: center; gap: 12px; }
.row.end { justify-content: flex-end; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.card.notif { display: flex; flex-direction: column; gap: 8px; }
.price { font-family: var(--display); font-weight: 700; font-size: 20px; margin-left: auto; }
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.prod { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; transition: transform .08s, border-color .15s; }
.prod:active { transform: scale(.96); }
.prod .ic { height: 26px; display: grid; place-items: center; }
.prod .ic svg { width: 26px; height: 26px; }
.prod .n { font-size: 13px; font-weight: 600; line-height: 1.2; }
.prod .p { font-family: var(--display); font-weight: 700; color: var(--gold); font-size: 17px; }
.linkbtn { background: none; border: 0; color: var(--gold); padding: 0; font-weight: 600; font-size: 14px; text-align: left; }
.linkbtn.plain { color: var(--text); font-size: 15px; }
.muted-link { color: var(--muted); font-weight: 500; margin-left: auto; }

/* Listes */
.feed, .people { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.feed .it { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.feed .it:last-child { border-bottom: 0; }
.feed .avatar { width: 34px; height: 34px; font-size: 13px; }
.w { font-size: 12.5px; color: var(--muted); }
.feed .v { margin-left: auto; font-family: var(--display); font-weight: 700; font-size: 17px; }
.mini { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; width: 100%; text-align: left; }
.mini .arrow { margin-left: auto; color: var(--gold); font-weight: 700; }
.search { position: relative; }
.search input { padding-left: 40px; }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.person { display: flex; align-items: center; gap: 12px; padding: 13px 14px; background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; width: 100%; }
.person:last-child { border-bottom: 0; }
button.person:active { background: var(--surface2); }
.person.inactif { opacity: .5; }
.person .nm { font-weight: 600; }
.person .amt { margin-left: auto; font-family: var(--display); font-weight: 700; font-size: 19px; }
.empty { padding: 16px; color: var(--muted); }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--surface2); border: 1px solid var(--line); display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 15px; color: var(--gold); flex: none; }
.avatar.lg { width: 48px; height: 48px; font-size: 19px; }
.amt.zero { color: var(--muted); }
.pill { font-family: var(--display); font-weight: 600; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; padding: 3px 7px; border-radius: 5px; }
.pill.ok { background: rgba(67,180,120,.14); color: var(--ok); }
.pill.due { background: rgba(229,72,60,.16); color: var(--red); }
.pill.off { background: var(--surface2); color: var(--muted); }

/* Récap */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat .v { font-family: var(--display); font-weight: 800; font-size: 28px; line-height: 1; }
.stat .sur { font-size: 18px; color: var(--muted); }
.stat .l { font-size: 12.5px; color: var(--muted); }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.actions .btn { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 15px; padding: 13px 10px; }
.tablewrap { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { font-family: var(--display); font-weight: 600; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; }
.tbl .amt { font-family: var(--display); font-weight: 700; font-size: 18px; }
.locked { text-align: center; padding: 40px 0; display: flex; flex-direction: column; gap: 12px; align-items: center; color: var(--gold); }
.locked h2, .locked p { color: var(--text); }
.locked p { color: var(--muted); }

/* Barre d'onglets */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: rgba(14,17,23,.96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px)); }
.tabbar .in { max-width: 480px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; color: var(--muted); font-family: var(--display); font-weight: 600; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; border-radius: 10px; text-decoration: none; }
.tab svg { width: 22px; height: 22px; }
.tab.active { color: var(--gold); background: rgba(229,72,60,.10); }

/* Feuilles (panneaux du bas) */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 20; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { background: var(--bg); border: 1px solid var(--line); border-bottom: 0; border-radius: 18px 18px 0 0; width: 100%; max-width: 480px; max-height: 92%; overflow-y: auto; overscroll-behavior: contain; padding: 10px 16px calc(24px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 16px; animation: up .2s ease-out; }
.grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 4px; }
.sheet-head { display: flex; align-items: center; gap: 12px; }
.sheet-head .x { margin-left: auto; }
.hist { display: flex; flex-direction: column; gap: 14px; }
.day .d { font-family: var(--display); font-weight: 600; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; display: flex; justify-content: space-between; }
.day ul { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.day li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
.day li:last-child { border-bottom: 0; }
.day li .h { color: var(--muted); font-size: 12.5px; width: 42px; flex: none; }
.day li .v { margin-left: auto; font-family: var(--display); font-weight: 700; font-size: 16px; }
.day li.pay { color: var(--ok); }
.del { background: none; border: 0; color: var(--muted); padding: 2px 4px; font-size: 16px; line-height: 1; }
.del.confirm-del { color: var(--red); font-size: 13px; font-weight: 600; }
.confirm { background: var(--surface2); border: 1px solid var(--gold); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.opts { display: flex; flex-wrap: wrap; gap: 6px; }
.opt { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 12px; font-size: 13.5px; }
.opt.on { border-color: var(--gold); color: var(--gold); background: rgba(229,72,60,.10); }
.lb { font-size: 13px; color: var(--muted); font-weight: 600; }
.recip { font-size: 13px; color: var(--muted); line-height: 1.6; }
.recip b { color: var(--text); font-weight: 600; }
.recip-item:not(:last-child)::after { content: ", "; }
.recip.warn { color: var(--red); }
.note { font-size: 12.5px; color: var(--muted); border-left: 2px solid var(--gold); padding-left: 10px; }
code { font-family: ui-monospace, Menlo, monospace; }

/* Toast */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + 20px + env(safe-area-inset-bottom, 0px)); z-index: 30; background: var(--text); color: #111; border-radius: 10px; padding: 11px 14px; display: flex; align-items: center; gap: 14px; font-weight: 600; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.4); max-width: calc(100% - 32px); animation: toast .18s ease-out; }
.toast.err-toast { background: #3a1512; color: #ffd9d4; border: 1px solid var(--gold); }
.toast button { background: none; border: 0; color: #c62d21; font-weight: 700; padding: 0; }

/* Erreur Blazor */
#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000; background: #3a1512; color: #ffd9d4; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); }
#blazor-error-ui .dismiss { float: right; cursor: pointer; }
#blazor-error-ui .reload { color: #fff; margin-left: 8px; }

@keyframes up { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes toast { from { transform: translate(-50%, 16px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@keyframes fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
