:root {
  --blue: #185ca8;
  --blue-dark: #0d3d75;
  --bg: #eef2f7;
  --text: #172033;
  --muted: #64748b;
  --gold: #c8873f;
  --line: #e7ebf0;
  --navy: #102f59;
  color-scheme: light;
  font-family: "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: #dfe5ec; color: var(--text); min-height: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--blue); }

.banner { margin: 12px auto; width: min(100%, 480px); background: #fff7e7; color: #5f481c; border-left: 4px solid #d38a18; border-radius: 8px; padding: 12px 13px; }
.login-shell { width: min(100%, 430px); min-height: 100vh; margin: 0 auto; background: white; box-shadow: 0 0 40px rgba(15, 35, 60, 0.18); }
.login-visual { min-height: 220px; background: url("marche.jpg") center 28% / cover no-repeat; }
.login-panel { padding: 26px 25px 32px; }
.brand-row { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.brand-row .lang-toggle { margin-left: auto; }
.brand-logo { width: min(220px, 58vw); height: auto; display: block; }
.app-id { display: flex; align-items: center; gap: 8px; min-width: 0; }
.app-logo { width: 38px; height: 38px; object-fit: cover; object-position: center top; border-radius: 10px; background: white; }
.brand-name { font-size: 1.75rem; font-weight: 800; color: #183b68; letter-spacing: -0.04em; }
.brand-tagline, .lead, .hint { color: var(--muted); line-height: 1.45; }
.brand-tagline { margin-top: 2px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 16px 0; padding: 5px; background: #e4eaf1; border-radius: 14px; }
.tabs button, .text-btn, .bar-button { border: 0; background: transparent; border-radius: 10px; cursor: pointer; }
.tabs button { min-height: 40px; font-weight: 700; color: #526176; }
.tabs button.on { background: white; color: var(--blue); box-shadow: 0 2px 8px rgba(18, 38, 63, 0.08); }
.text-btn { display: block; width: 100%; margin-top: 8px; color: var(--blue); font-weight: 700; min-height: 40px; text-align: center; text-decoration: none; }
.check-line { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.check-line input { width: 18px; min-height: 18px; margin-top: 2px; }
.text-btn.back { width: auto; margin: 8px 0 12px; padding: 0; }
label { display: grid; gap: 6px; margin-bottom: 14px; font-size: 0.86rem; font-weight: 700; color: #33506f; }
input, textarea, select { border: 1px solid #cdd6e2; background: #f8fafc; border-radius: 14px; min-height: 50px; padding: 12px 14px; outline: none; }
input:focus, textarea:focus, select:focus { background: white; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(24, 92, 168, 0.14); }
.primary { width: 100%; border: 0; border-radius: 14px; min-height: 46px; background: var(--blue); color: white; font-weight: 700; cursor: pointer; }
.primary:disabled { opacity: 0.45; cursor: default; }
.primary.mini { width: auto; min-height: 34px; padding: 4px 12px; border-radius: 9px; }
.hint { font-size: 0.8rem; margin: -4px 0 14px; }
.step-title { margin: 0 0 12px; font-size: 1.05rem; }
.note { margin: 0 0 14px; padding: 12px; border-radius: 12px; background: #eef4fb; color: #33506f; font-size: 0.86rem; line-height: 1.45; white-space: pre-wrap; }
.field-label { margin-bottom: 8px; font-size: 0.86rem; font-weight: 700; color: #33506f; }
.product-row { display: grid; grid-template-columns: 1fr 118px; gap: 8px; margin-bottom: 8px; }
.product-row input { margin: 0; }
.check-grid { display: grid; gap: 8px; margin-bottom: 14px; }
.check-grid label { display: flex; align-items: center; gap: 10px; margin: 0; font-weight: 600; }
.check-grid input { width: 18px; min-height: 18px; padding: 0; }
.reg-actions { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: center; }
.reg-actions .text-btn { width: auto; margin: 0; padding: 0 8px; }
label[hidden], .soft-card div[hidden], form[hidden], #regular-fields[hidden], #build-regular[hidden] { display: none !important; }
.primary.link { display: grid; place-items: center; text-decoration: none; }
.error { color: #b42318; font-size: 0.9rem; }
.mobile-container { width: min(100%, 480px); min-height: 100vh; margin: 0 auto; padding: 0 16px 28px; background: var(--bg); box-shadow: 0 0 40px rgba(15, 35, 60, 0.16); }
.app-bar { position: sticky; top: 0; z-index: 20; margin: 0 -16px 0; padding: 12px 16px; min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--blue); color: white; box-shadow: 0 3px 12px rgba(13, 61, 117, 0.25); }
.app-bar-title { font-size: 1.15rem; font-weight: 800; }
.app-bar-sub { font-size: 0.76rem; opacity: 0.82; }
.app-bar-actions { display: flex; align-items: center; gap: 8px; }
.header-balance { min-width: 92px; padding: 7px 10px; border: 1px solid rgba(255, 255, 255, 0.28); border-radius: 10px; background: rgba(255, 255, 255, 0.1); text-align: right; line-height: 1.1; }
.header-balance-label { display: block; font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.76; }
.header-balance-value { display: block; margin-top: 3px; font-size: 0.92rem; font-weight: 800; white-space: nowrap; }
.bar-button { min-height: 36px; padding: 0 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.16); color: white; font-weight: 700; }
.home-nav { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin: 14px 0; }
.home-nav button { border: 0; min-height: 58px; padding: 8px 6px; border-radius: 14px; background: white; color: #526176; font-weight: 750; font-size: 0.78rem; line-height: 1.2; cursor: pointer; box-shadow: 0 3px 10px rgba(18, 38, 63, 0.06); }
.home-nav button.on { background: var(--blue); color: white; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.stat-card { background: white; border-radius: 14px; padding: 12px 10px; box-shadow: 0 3px 10px rgba(18, 38, 63, 0.06); }
.stat-card span { display: block; color: #6b7789; font-size: 0.68rem; }
.stat-card strong { display: block; margin-top: 4px; color: var(--navy); font-size: 0.92rem; }
.profile-strip { margin: 0 -16px 18px; padding: 12px 16px; background: white; border-bottom: 1px solid #dfe5ec; }
.profile-name { font-weight: 750; }
.profile-location { margin-top: 2px; color: #6b7789; font-size: 0.8rem; }
.balance-card { background: var(--navy); color: white; border-radius: 22px; padding: 22px; box-shadow: 0 9px 22px rgba(16, 47, 89, 0.2); margin-bottom: 14px; }
.balance-label { opacity: 0.75; font-size: 0.86rem; text-transform: uppercase; letter-spacing: 0.08em; }
.balance-value { font-size: 2.4rem; font-weight: 800; margin: 4px 0; }
.balance-card p { opacity: 0.88; }
.withdraw-note { margin: 0 0 14px; padding: 11px 13px; border-radius: 10px; background: #eef4fb; color: #33506f; font-size: 0.8rem; }
#convert { margin-bottom: 14px; }
.soft-card, .panel { background: white; border-radius: 20px; padding: 19px; box-shadow: 0 4px 14px rgba(18, 38, 63, 0.07); margin-bottom: 14px; }
.section-heading { margin: 22px 2px 11px; font-size: 1.05rem; font-weight: 800; }
.question-list, .completed-list { background: white; border-radius: 16px; overflow: hidden; box-shadow: 0 3px 12px rgba(18, 38, 63, 0.06); }
.question-card { padding: 18px; border-bottom: 1px solid var(--line); }
[data-category="demographie"] { --cat: #185ca8; --cat-bg: #f4f8fd; }
[data-category="economie"] { --cat: #1c7a4a; --cat-bg: #f3faf6; }
[data-category="culture"] { --cat: #6d3bb0; --cat-bg: #f7f4fc; }
[data-category="marques"] { --cat: #b5792e; --cat-bg: #fbf7f1; }
[data-category="marche"] { --cat: #c45c26; --cat-bg: #fdf6f2; }
[data-category="environnement"] { --cat: #0d7a78; --cat-bg: #f2fafa; }
.question-card[data-category], .soft-card[data-category], .row[data-category] { background: var(--cat-bg); box-shadow: inset 5px 0 0 var(--cat); }
.question-card[data-category] .primary, .soft-card[data-category] .primary { background: var(--cat); }
.q-table td[data-category] { box-shadow: inset 4px 0 0 var(--cat); background: var(--cat-bg); }
.question-card:last-child { border-bottom: 0; }
.question-card h4 { margin: 0 0 6px; font-size: 1rem; font-weight: 800; }
.question-description { color: #647184; font-size: 0.87rem; line-height: 1.45; margin: 0 0 8px; }
.reward-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 12px 0; padding: 10px 0; border-top: 1px solid #edf0f4; border-bottom: 1px solid #edf0f4; }
.reward-label { color: #6a7687; font-size: 0.8rem; }
.reward-value { color: #174f8e; font-weight: 800; white-space: nowrap; }
.choices { display: grid; gap: 8px; margin-top: 12px; }
.choice { text-align: left; border: 1px solid #dbe3ec; background: #f8fafc; border-radius: 12px; padding: 12px; cursor: pointer; }
.choice.on { border-color: var(--blue); background: #edf5ff; }
.choice.good { background: #e4f7f1; border-color: #b7e6da; }
.choice.bad { background: #fdecec; border-color: #f3c7c7; }
.question-card .primary { margin-top: 12px; }
.completed-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.completed-card:last-child { border-bottom: 0; }
.completed-title { font-size: 0.92rem; font-weight: 750; }
.completed-badge { display: inline-block; margin-top: 5px; padding: 3px 8px; border-radius: 999px; color: #08775f; background: #e4f7f1; font-size: 0.72rem; font-weight: 750; }
.completed-amount { color: #08775f; font-weight: 800; white-space: nowrap; }
.empty { padding: 18px; color: var(--muted); }
.soft-card h2 { font-size: 1.05rem; margin-bottom: 8px; }
.purchase-list { display: grid; gap: 10px; margin-top: 14px; }
.purchase { display: grid; grid-template-columns: 72px 1fr; gap: 12px; align-items: center; }
.purchase img { width: 72px; height: 72px; object-fit: cover; border-radius: 12px; background: #e4eaf1; }
textarea { min-height: 80px; }

.desk { min-height: 100vh; padding: 28px; background: var(--bg); }
.top, .top-actions, .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.top { margin-bottom: 18px; }
.top h1 { font-size: 2rem; letter-spacing: -0.04em; color: #183b68; }
.eyebrow { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.quiet { font-weight: 700; text-decoration: none; }
.rule { color: var(--muted); line-height: 1.45; margin-bottom: 8px; }
.narrow { max-width: 440px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 16px 0; }
.stats article, .row { background: white; border-radius: 18px; padding: 16px; box-shadow: 0 4px 14px rgba(18, 38, 63, 0.06); }
.stats strong { display: block; font-size: 1.6rem; color: var(--navy); }
.stats span, .meta { color: var(--muted); font-size: 0.82rem; }
.grid { display: grid; grid-template-columns: 360px 1fr; gap: 16px; align-items: start; }
.panel + .panel, .row { margin-top: 10px; }
.panel h2 { font-size: 1.05rem; margin-bottom: 12px; }
.row p { display: grid; gap: 3px; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { width: 88px; min-height: 40px; }
.ghost { border: 1px solid #cdd6e2; background: white; border-radius: 999px; min-height: 38px; padding: 0 14px; font-weight: 700; cursor: pointer; }
.dash { height: calc(100vh - 148px); min-height: 460px; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 12px; }
.dash-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.dash-kpis article { background: white; border-radius: 18px; padding: 18px 18px 16px; min-height: 128px; border-top: 4px solid var(--blue); box-shadow: 0 4px 14px rgba(18, 38, 63, 0.06); }
.dash-kpis span { display: block; color: #33506f; font-size: 0.78rem; font-weight: 750; line-height: 1.3; min-height: 2.6em; }
.dash-kpis strong { display: block; margin-top: 8px; color: var(--navy); font-size: 1.45rem; letter-spacing: -0.03em; line-height: 1.1; }
.dash-kpis em { display: block; margin-top: 6px; color: var(--muted); font-style: normal; font-size: 0.75rem; }
.amount-cell { color: var(--navy); font-weight: 800; font-size: 1rem; white-space: nowrap; }
.dash-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; min-height: 0; }
.dash-charts .panel { margin: 0; height: 100%; display: flex; flex-direction: column; }
.chart { flex: 1; min-height: 0; }
.chart svg { width: 100%; height: 100%; display: block; }
.table-wrap { overflow: auto; }
.q-table { width: 100%; border-collapse: collapse; }
.q-table th { text-align: left; font-size: 0.75rem; color: var(--muted); font-weight: 700; padding: 0 12px 10px; }
.q-table td { padding: 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.q-table td:last-child, .q-table th:last-child { text-align: right; }
.sheet-head, .person-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sheet-fields { display: grid; gap: 8px; margin: 14px 0; }
.sheet-fields article { padding: 10px 12px; border-radius: 12px; background: #f8fafc; }
.find-bar { margin-bottom: 12px; }
.person { background: white; border-radius: 20px; padding: 22px; box-shadow: 0 4px 14px rgba(18, 38, 63, 0.07); margin-bottom: 14px; }
.person h2 { margin: 0; }
.person-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin: 16px 0; }
.person-grid span { display: block; color: var(--muted); font-size: 0.75rem; }
.person-grid strong { font-size: 0.95rem; }
.password-box { margin: 8px 0 16px; padding: 14px; border-radius: 14px; background: #102f59; color: white; }
.password-box span { display: block; opacity: 0.75; font-size: 0.75rem; }
.password-box strong { font-size: 1.35rem; letter-spacing: 0.08em; }
.admin-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px; }
.admin-nav button { border: 0; min-height: 42px; padding: 8px 14px; border-radius: 999px; background: white; color: #33506f; font-weight: 750; cursor: pointer; }
.admin-nav button.on { background: var(--blue); color: white; }
.section-switch { display: flex; gap: 8px; margin-bottom: 12px; }
.section-switch button { border: 0; min-height: 40px; padding: 8px 14px; border-radius: 999px; background: white; color: #33506f; font-weight: 750; cursor: pointer; }
.section-switch button.on { background: var(--navy); color: white; }
.etat { display: inline-block; margin: 8px 0 0; padding: 4px 10px; border-radius: 999px; background: #e4f7f1; color: #08775f; font-size: 0.78rem; font-weight: 750; }
.etat.off { background: #fdecec; color: #b42318; }
.admin-panel[hidden] { display: none !important; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bars { display: flex; align-items: flex-end; gap: 6px; min-height: 140px; overflow-x: auto; padding-top: 8px; }
.bar-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-width: 28px; height: 140px; }
.bar-col i { display: block; width: 100%; max-width: 28px; background: var(--blue); border-radius: 6px 6px 0 0; }
.bar-col span { margin-top: 4px; color: var(--muted); font-size: 0.65rem; }
.field-card { border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 10px; background: #f8fafc; }
.kind-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.kind-row button { border: 1px solid #cdd6e2; background: white; border-radius: 999px; min-height: 34px; padding: 0 12px; cursor: pointer; font-weight: 700; color: #33506f; }
.kind-row button.on { background: var(--blue); color: white; border-color: var(--blue); }
.option-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.option-row .text-btn { width: auto; margin: 0; }
.field-card .product-row { grid-template-columns: 1fr 180px auto; }
.click-row { cursor: pointer; }
.click-row:hover { outline: 2px solid rgba(24, 92, 168, 0.25); }
@media (max-width: 900px) {
  .stats, .grid, .split, .dash-kpis, .dash-charts, .person-grid { grid-template-columns: 1fr; }
  .dash { height: auto; }
  .desk { padding: 16px; }
}
@media (max-width: 600px) { html, body { background: var(--bg); } .login-shell, .mobile-container { box-shadow: none; } }
