@font-face { font-family: "Bebas"; src: url(/fonts/BebasNeue-Regular.ttf) format("truetype"); font-display: swap; }
@font-face { font-family: "Grotesk"; src: url(/fonts/SpaceGrotesk.ttf) format("truetype"); font-weight: 300 700; font-display: swap; }

:root {
  --nuit: #060606;
  --os: #F2F2F2;
  --spectre: #A9C2E8;
  --beton: #CBC8C2;
  --dim: rgba(242, 242, 242, .56);
  --faint: rgba(242, 242, 242, .14);
  --line: rgba(242, 242, 242, .1);
  --card: #0d0d0f;
  --bad: #e8a9a9;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--nuit); color: var(--os); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { -webkit-user-select: none; user-select: none; }
input, .num, td { -webkit-user-select: text; user-select: text; }
body { font-family: "Grotesk", system-ui, sans-serif; font-size: 15px; line-height: 1.45; min-height: 100dvh; overscroll-behavior-y: none; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
#app { padding: calc(var(--safe-t) + 14px) 16px calc(var(--safe-b) + 96px); max-width: 560px; margin: 0 auto; }

.display { font-family: "Bebas", Impact, sans-serif; font-weight: 400; letter-spacing: .02em; line-height: .92; }
.meta { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); }
.dim { color: var(--dim); }
.num { font-variant-numeric: tabular-nums; }
h1, h2, h3 { margin: 0; font-weight: 400; }
h2.sec { font-family: "Bebas"; font-size: 26px; letter-spacing: .03em; margin: 34px 0 12px; display: flex; align-items: baseline; gap: 10px; }
h2.sec small { font-family: "Grotesk"; font-size: 11px; letter-spacing: .14em; color: var(--dim); }

/* ---------- login */
.login { min-height: calc(100dvh - 40px); display: grid; align-content: center; gap: 28px; }
.login .bg { position: fixed; inset: 0; background: linear-gradient(rgba(6,6,6,.55), var(--nuit) 78%), url(/img/nuit.jpg) center/cover; z-index: -1; }
.login img { width: 78%; max-width: 340px; justify-self: center; }
.field { display: grid; gap: 6px; }
.field input { background: rgba(6,6,6,.7); border: 1px solid var(--faint); border-radius: 0; padding: 14px; font-size: 16px; outline: none; }
.field input:focus { border-color: var(--os); }
.btn { display: inline-flex; justify-content: center; align-items: center; gap: 8px; border: 1px solid var(--os); background: var(--os); color: var(--nuit); padding: 14px 18px; font-family: "Bebas"; font-size: 21px; letter-spacing: .06em; cursor: pointer; text-decoration: none; min-height: 48px; }
.btn.ghost { background: transparent; color: var(--os); border-color: var(--faint); }
.btn:disabled { opacity: .5; }
.err { color: var(--bad); font-size: 13px; min-height: 18px; }

/* ---------- top */
.top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.top img { height: 30px; }
.top .meta { text-align: right; }
.back { text-decoration: none; font-size: 13px; letter-spacing: .12em; color: var(--dim); display: inline-flex; align-items: center; min-height: 44px; padding-right: 20px; }

/* ---------- HUB (sobre) */
.next { display: grid; gap: 8px; text-decoration: none; padding: 22px 0 20px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: 26px; }
.next .nm { font-size: 46px; }
.next .bar { margin-top: 10px; }
.next .row { display: flex; justify-content: space-between; font-size: 13px; }

/* ---------- hero soirée */
.hero { position: relative; overflow: hidden; border: 1px solid var(--line); background: var(--card); }
.hero .cover { position: absolute; inset: 0; background-size: cover; background-position: center; filter: grayscale(1) contrast(1.1) brightness(.45); }
.hero .veil { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(6,6,6,.15), var(--nuit) 92%); }
.hero .in { position: relative; padding: 120px 18px 18px; }
.hero .roman { position: absolute; top: 14px; left: 18px; font-family: "Bebas"; font-size: 15px; letter-spacing: .3em; color: var(--dim); }
.hero h1 { font-family: "Bebas"; font-size: 54px; line-height: .9; }
.hero .lineup { font-family: "Bebas"; font-size: 20px; letter-spacing: .04em; margin-top: 8px; color: var(--dim); }
.metablock { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--faint); margin-top: 16px; padding-top: 10px; gap: 8px; }
.metablock b { display: block; font-family: "Bebas"; font-size: 22px; font-weight: 400; letter-spacing: .03em; }

/* ---------- jauge */
.gauge { display: grid; grid-template-columns: 148px 1fr; gap: 18px; align-items: center; margin-top: 18px; }
.gauge svg { width: 148px; height: 148px; }
.gauge .big { font-family: "Bebas"; font-size: 64px; line-height: .85; }
.gauge .big small { font-size: 26px; color: var(--dim); }

/* ---------- tuiles */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.tile { background: var(--nuit); padding: 14px 12px; min-width: 0; }
.tile b { display: block; font-family: "Bebas"; font-weight: 400; font-size: 30px; line-height: 1; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .s { font-size: 12px; color: var(--dim); margin-top: 4px; }
.tile.full { grid-column: 1 / -1; }
.pos { color: var(--os); }
.neg { color: var(--bad); }

/* ---------- phases */
.phase { padding: 12px 0; border-bottom: 1px solid var(--line); }
.phase .row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.bar { height: 6px; background: var(--faint); margin-top: 8px; position: relative; }
.bar i { position: absolute; inset: 0 auto 0 0; background: var(--os); }
.bar i.sp { background: var(--spectre); }

/* ---------- onglets */
.tabs { display: flex; gap: 0; margin: 22px -16px 0; padding: 0 16px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; position: sticky; top: 0; background: var(--nuit); z-index: 5; padding-top: var(--safe-t); }
.tabs button { background: none; border: 0; padding: 12px 14px; font-family: "Bebas"; font-size: 19px; letter-spacing: .06em; color: var(--dim); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--os); border-bottom-color: var(--os); }

/* ---------- interrupteur */
.switch { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--line); margin-top: 14px; cursor: pointer; }
.switch input { appearance: none; width: 50px; height: 28px; border-radius: 28px; background: var(--faint); position: relative; flex: none; cursor: pointer; transition: background .2s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--os); transition: transform .2s; }
.switch input:checked { background: var(--spectre); }
.switch input:checked::after { transform: translateX(22px); background: var(--nuit); }

/* ---------- listes */
.list { border-top: 1px solid var(--line); }
.item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.item .l { display: flex; gap: 14px; align-items: baseline; min-width: 0; }
.item .rn { font-family: "Bebas"; color: var(--dim); width: 34px; flex: none; }
.item > .meta { white-space: nowrap; flex: none; }
.item .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- graphe */
.chart { width: 100%; height: auto; display: block; margin-top: 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--dim); margin-top: 8px; }
.legend i { display: inline-block; width: 14px; height: 2px; background: var(--os); vertical-align: middle; margin-right: 6px; }

/* ---------- budget */
.bgroup { margin-top: 18px; }
.bline { display: grid; grid-template-columns: 1fr 96px 40px; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.bline input { background: transparent; border: 0; border-bottom: 1px solid transparent; padding: 8px 0; font-size: 16px; min-width: 0; outline: none; }
.bline input:focus { border-bottom-color: var(--os); }
.bline input.amt { text-align: right; font-variant-numeric: tabular-nums; }
.bline button { background: none; border: 0; color: var(--dim); font-size: 20px; cursor: pointer; min-width: 40px; min-height: 40px; }
.add { background: none; border: 0; color: var(--dim); padding: 14px 0; min-height: 44px; font-size: 13px; letter-spacing: .1em; cursor: pointer; }
.beton { background: var(--beton) url(/img/beton.jpg) center/cover; color: var(--nuit); padding: 16px; margin-top: 16px; }
.beton .meta { color: rgba(6,6,6,.6); }
.beton b { font-family: "Bebas"; font-weight: 400; font-size: 34px; display: block; line-height: 1; }

/* ---------- estimations */
input[type=range] { width: 100%; accent-color: var(--spectre); height: 32px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 4px; border-bottom: 1px solid var(--line); }
th { font-weight: 400; color: var(--dim); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }
.note { font-size: 12.5px; color: var(--dim); margin-top: 10px; }

/* ---------- DA */
.sw { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sw div { aspect-ratio: 1; border: 1px solid var(--line); display: flex; align-items: flex-end; padding: 6px; font-size: 10px; letter-spacing: .08em; }

/* ---------- tab bar */
#tabbar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: rgba(6,6,6,.92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); z-index: 20; }
#tabbar[hidden] { display: none; }
#tabbar a { flex: 1; text-align: center; text-decoration: none; padding: 14px 0 12px; font-family: "Bebas"; font-size: 17px; letter-spacing: .14em; color: var(--dim); }
#tabbar a.on { color: var(--os); }

#toast { position: fixed; left: 16px; right: 16px; bottom: calc(var(--safe-b) + 74px); background: var(--os); color: var(--nuit); padding: 12px 14px; font-size: 14px; transform: translateY(20px); opacity: 0; pointer-events: none; transition: .25s; z-index: 30; max-width: 528px; margin: 0 auto; }
#toast.on { transform: none; opacity: 1; }

.skel { height: 120px; background: linear-gradient(90deg, var(--card), #151518, var(--card)); background-size: 200% 100%; animation: sk 1.2s infinite; margin-top: 14px; }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (max-width: 360px) { .gauge { grid-template-columns: 120px 1fr; } .gauge svg { width: 120px; height: 120px; } .hero h1 { font-size: 44px; } }
