/* Hermès Mini App — identité laiton/encre du proto validé (Artifact 96f3e601).
   Pièges webview appliqués (research.md) : hauteur sur --tg-viewport-stable-height (jamais
   la hauteur viewport CSS classique, non fiable dans la webview), safe-area, fond sombre. */

:root {
	--ink: #17130e;
	--ink-2: #1e1811;
	--surface: #221c15;
	--surface-2: #2c251c;
	--line: #38301f;
	--brass: #d2a76a;
	--brass-dim: #9c7f52;
	--sage: #93b39b;
	--text: #ece4d6;
	--muted: #a99b84;
	--danger-soft: #c88b7a;
	--serif: ui-serif, "New York", Georgia, "Times New Roman", serif;
	--ui: system-ui, -apple-system, "SF Pro Text", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
	font-family: var(--ui);
	color: var(--text);
	-webkit-font-smoothing: antialiased;
}

.screen {
	/* Épinglé sur la hauteur STABLE de la webview (le viewport bouge pendant le drag du
	   bottom-sheet) ; repli 100dvh hors Telegram. */
	height: var(--tg-viewport-stable-height, 100dvh);
	background: linear-gradient(180deg, #1b160f 0%, var(--ink) 46%);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	position: relative;
}

/* ── Corps scrollable + panneaux ──────────────────────────────────────────── */
/* Plus de top bar (doublon de l'en-tête Telegram) : la safe-area haute, jadis portée
   par .topbar, est reprise ici pour que le contenu ne passe pas sous l'encoche. */
.body { flex: 1; overflow-y: auto; padding: calc(18px + env(safe-area-inset-top)) 16px 22px; scrollbar-width: none; }
.body::-webkit-scrollbar { display: none; }
.panel { display: none; animation: rise 0.32s ease both; }
.panel.on { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .panel { animation: none; } }

.lead {
	font-family: var(--serif);
	font-weight: 500;
	font-size: 21px;
	line-height: 1.3;
	text-wrap: balance;
	margin: 4px 2px 4px;
}
.sub { color: var(--muted); font-size: 13.5px; line-height: 1.5; margin: 0 2px 16px; }
.kicker {
	font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
	color: var(--brass-dim); margin: 20px 2px 10px;
}

.card {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: 16px;
	padding: 15px 15px;
}
.stack { display: flex; flex-direction: column; gap: 11px; }
.card.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 22px 15px; }

/* ── Bandeaux d'état des données (démo / indisponible / session) ──────────── */
.banner {
	display: flex; align-items: center; gap: 9px;
	font-size: 12px; line-height: 1.45;
	border-radius: 12px;
	padding: 9px 12px;
	margin: 0 0 13px;
}
.banner.demo {
	color: var(--brass);
	background: rgba(210, 167, 106, 0.09);
	border: 1px solid rgba(210, 167, 106, 0.22);
}
.banner.down {
	color: var(--danger-soft);
	background: rgba(200, 139, 122, 0.09);
	border: 1px solid rgba(200, 139, 122, 0.24);
}

/* ── Cartes capacités (Accueil) ───────────────────────────────────────────── */
.cap { display: flex; gap: 13px; align-items: flex-start; }
.cap .ic {
	width: 38px; height: 38px; flex: none;
	border-radius: 11px;
	background: var(--surface-2);
	border: 1px solid var(--line);
	display: grid; place-items: center;
	color: var(--brass);
}
.cap .ic svg { width: 19px; height: 19px; }
.cap h3 { margin: 1px 0 3px; font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; }
.cap p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.cap .cmd, .cmd-chip {
	display: inline-block; margin-top: 6px;
	font-size: 11px; color: var(--brass);
	background: rgba(210, 167, 106, 0.1);
	border: 1px solid rgba(210, 167, 106, 0.22);
	padding: 1px 7px; border-radius: 6px;
}

/* Groupes de commandes (dérivés d'onboarding.json) */
.cmd-group .g-name {
	font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
	color: var(--brass-dim); margin: 0 0 8px;
}
.cmd-row { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; border-top: 1px solid var(--line); }
.cmd-row:first-of-type { border-top: none; }
.cmd-row .name { font-size: 13px; color: var(--brass); white-space: nowrap; }
.cmd-row .desc { font-size: 12.5px; color: var(--muted); line-height: 1.45; }

/* ── Aujourd'hui ──────────────────────────────────────────────────────────── */
.focal {
	background:
		radial-gradient(120% 120% at 100% 0%, rgba(210, 167, 106, 0.14) 0%, rgba(210, 167, 106, 0) 55%),
		var(--surface);
	border: 1px solid var(--line);
	border-radius: 18px;
	padding: 17px 16px 16px;
}
.focal .tag { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--brass); }
.focal h2 { font-family: var(--serif); font-weight: 500; font-size: 22px; line-height: 1.25; margin: 8px 0 0; text-wrap: balance; }
.todo-row { display: flex; align-items: baseline; gap: 10px; font-size: 14px; padding: 9px 0; border-top: 1px solid var(--line); }
.todo-row:first-of-type { border-top: none; }
.todo-row .num { font-size: 11.5px; color: var(--brass-dim); font-variant-numeric: tabular-nums; min-width: 20px; }
.todo-row .txt { flex: 1; line-height: 1.4; }
.todo-row.muted .txt { color: var(--muted); }
.badge {
	font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase;
	padding: 1px 7px; border-radius: 20px; white-space: nowrap;
}
.badge.focal { color: var(--brass); background: rgba(210, 167, 106, 0.1); border: 1px solid rgba(210, 167, 106, 0.24); }
.badge.second { color: var(--sage); background: rgba(147, 179, 155, 0.1); border: 1px solid rgba(147, 179, 155, 0.24); }
.badge.snooze { color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); }
.badge.proj { color: var(--muted); border: 1px solid var(--line); }

/* ── Élan ─────────────────────────────────────────────────────────────────── */
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 13px 14px; }
.metric .n { font-family: var(--serif); font-size: 25px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.metric .n.good { color: var(--sage); }
.metric .l { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.dom { font-size: 13px; display: flex; justify-content: space-between; align-items: baseline; }
.dom .lvl { color: var(--muted); }
.dom .trend-up { color: var(--sage); }
.dom .trend-down { color: var(--danger-soft); }
.dom + .bar { margin-top: 9px; }
.bar { height: 7px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--brass-dim), var(--brass)); }
.bar + .dom { margin-top: 13px; }
.event { display: flex; gap: 10px; align-items: baseline; font-size: 12.5px; padding: 7px 0; border-top: 1px solid var(--line); }
.event:first-of-type { border-top: none; }
.event .xp { color: var(--sage); font-variant-numeric: tabular-nums; white-space: nowrap; }
.event .lbl { flex: 1; color: var(--text); line-height: 1.4; }
.event .cat { color: var(--muted); font-size: 11px; white-space: nowrap; }
.reassure {
	display: flex; gap: 10px; align-items: flex-start;
	margin-top: 14px; padding: 12px 13px;
	background: rgba(147, 179, 155, 0.08);
	border: 1px solid rgba(147, 179, 155, 0.2);
	border-radius: 13px;
	font-size: 12.5px; color: #cfe0d3; line-height: 1.5;
}
.reassure .ic { color: var(--sage); flex: none; margin-top: 1px; }

/* ── Nouveautés ───────────────────────────────────────────────────────────── */
.note { padding: 14px 15px; }
.note + .note { margin-top: 11px; }
.note .when { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--brass-dim); }
.note h3 { font-size: 14.5px; font-weight: 600; margin: 5px 0 4px; letter-spacing: -0.01em; }
.note p { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin: 0 0 3px; }
.chip { display: inline-block; margin-top: 8px; font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; padding: 2px 8px; border-radius: 20px; }
.chip.live { color: var(--sage); background: rgba(147, 179, 155, 0.12); border: 1px solid rgba(147, 179, 155, 0.28); }
.chip.soon { color: var(--brass); background: rgba(210, 167, 106, 0.1); border: 1px solid rgba(210, 167, 106, 0.24); }

/* ── Barre d'onglets ──────────────────────────────────────────────────────── */
.tabs {
	display: flex;
	border-top: 1px solid var(--line);
	background: rgba(20, 16, 11, 0.92);
	backdrop-filter: blur(8px);
	padding: 7px 6px calc(7px + env(safe-area-inset-bottom));
}
.tab {
	flex: 1; background: none; border: none; cursor: pointer;
	color: var(--muted); font-family: var(--ui);
	display: flex; flex-direction: column; align-items: center; gap: 4px;
	padding: 6px 2px; border-radius: 12px;
	font-size: 10.5px; letter-spacing: 0.02em;
	transition: color 0.18s;
}
.tab svg { width: 22px; height: 22px; }
.tab.on { color: var(--brass); }
.tab:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
