/* ============================================================
   BANQUE V&L · STYLE GLOBAL
   ============================================================ */
:root {
  --bg: #f1e9d8;
  --bg-paper: #fbf6ea;
  --bg-paper-2: #f5eedc;
  --ink: #1d1a17;
  --ink-soft: #6b6253;
  --line: #d8cfbb;
  --line-strong: #b8ad94;
  --accent: #b8472d;
  --accent-deep: #8a3320;
  --accent-2: #2d6a4f;
  --gold: #c9a24a;
  --warn: #d4830f;
  --info: #3d6e9c;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(rgba(184,71,45,.04) 1px, transparent 1px),
    radial-gradient(rgba(29,26,23,.04) 1px, transparent 1px);
  background-size: 32px 32px, 16px 16px;
  background-position: 0 0, 8px 8px;
  background-attachment: fixed;
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.5;
}
::selection { background: var(--ink); color: var(--bg-paper); }

a { color: inherit; }
button { font-family: inherit; }
code {
  background: rgba(0,0,0,.06);
  padding: .15rem .4rem;
  border-radius: 4px;
  font-family: 'DM Mono', monospace;
  font-size: .85em;
}

/* ============================================================
   ÉCRAN DE CONNEXION
   ============================================================ */
.login-body {
  background: linear-gradient(135deg, #f1e9d8 0%, #e8dcc4 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-screen {
  width: 100%;
  max-width: 1100px;
  padding: 3rem 2rem;
  text-align: center;
}
.login-header { margin-bottom: 4rem; }
.login-header .brand-mark {
  font-size: 4rem;
  color: var(--gold);
  text-shadow: 4px 4px 0 var(--ink);
  display: inline-block;
  transform: rotate(-8deg);
  margin-bottom: 1rem;
}
.login-header h1 {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: clamp(2.5rem, 6vw, 4rem);
  letter-spacing: -0.04em;
  line-height: 1;
}
.login-header h1 .amp { color: var(--accent); }
.login-sub {
  font-family: 'DM Mono', monospace;
  font-size: .85rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: .25em;
  margin-top: 1rem;
}
.login-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2rem;
  max-width: 900px;
  margin: 0 auto;
}

/* === Nouveaux : étapes & cards d'espace === */
.login-step { animation: fadePanel .35s; }

.space-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  max-width: 800px;
  margin: 2rem auto 0;
}
.space-card {
  background: var(--bg-paper);
  border: 3px solid var(--ink);
  border-radius: 24px;
  padding: 3rem 2rem;
  cursor: pointer;
  transition: all .25s cubic-bezier(.34,1.56,.64,1);
  box-shadow: 8px 8px 0 var(--ink);
  font-family: inherit;
  text-align: center;
}
.space-card:hover {
  transform: translate(-4px, -4px) rotate(-1deg);
  box-shadow: 12px 12px 0 var(--accent);
}
.space-card[data-space="admin"]:hover { box-shadow: 12px 12px 0 var(--accent-2); }
.space-emoji {
  font-size: 5rem;
  display: block;
  margin-bottom: 1rem;
  filter: drop-shadow(2px 2px 0 rgba(0,0,0,.15));
}
.space-card h2 {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: 2rem;
  letter-spacing: -0.02em;
  margin-bottom: .35rem;
}
.space-card p {
  font-family: 'DM Mono', monospace;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .2em;
  color: var(--ink-soft);
}

.step-back {
  background: transparent;
  border: 1.5px solid var(--ink);
  padding: .55rem 1.1rem;
  font-family: 'DM Mono', monospace;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .15em;
  border-radius: 999px;
  cursor: pointer;
  margin-bottom: 2rem;
  transition: all .15s;
}
.step-back:hover { background: var(--ink); color: var(--bg-paper); }

.pin-step-card {
  background: var(--bg-paper);
  border: 3px solid var(--ink);
  border-radius: 24px;
  padding: 2.5rem 2rem;
  max-width: 380px;
  width: 100%;
  margin: 0 auto;
  box-shadow: 8px 8px 0 var(--ink);
  text-align: center;
}
.pin-step-icon {
  font-size: 4rem;
  display: block;
  margin-bottom: .75rem;
  filter: drop-shadow(2px 2px 0 rgba(0,0,0,.15));
}
.pin-step-card h2 {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: 1.85rem;
  letter-spacing: -0.02em;
  margin-bottom: .35rem;
}
.pin-step-card .login-sub { margin: 0 0 1rem; }
.login-card {
  background: var(--bg-paper);
  border: 3px solid var(--ink);
  border-radius: 24px;
  padding: 2.5rem 1.5rem;
  cursor: pointer;
  transition: all .25s cubic-bezier(.34,1.56,.64,1);
  box-shadow: 8px 8px 0 var(--ink);
  position: relative;
  overflow: hidden;
}
.login-card:hover {
  transform: translate(-3px, -3px) rotate(-1deg);
  box-shadow: 11px 11px 0 var(--card-color, var(--accent));
}
.login-card .card-avatar {
  width: 130px; height: 130px;
  margin: 0 auto 1.25rem;
  border-radius: 50%;
  background: var(--card-color, var(--accent));
  border: 4px solid var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-size: 4rem;
  overflow: hidden;
  box-shadow: 4px 4px 0 var(--ink);
}
.login-card .card-avatar img { width: 100%; height: 100%; object-fit: cover; }
.login-card h3 {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: 2rem;
  letter-spacing: -0.02em;
  margin-bottom: .25rem;
}
.login-card .card-role {
  font-family: 'DM Mono', monospace;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .2em;
  color: var(--ink-soft);
}

.login-footer {
  margin-top: 4rem;
  font-family: 'DM Mono', monospace;
  font-size: .7rem;
  color: var(--ink-soft);
  letter-spacing: .15em;
  text-transform: uppercase;
}

/* ============================================================
   MODAL & PIN PAD (commun)
   ============================================================ */
.modal {
  position: fixed; inset: 0;
  background: rgba(29,26,23,.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 1rem;
  animation: fadeIn .2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal[hidden] { display: none; }

.modal-card {
  background: var(--bg-paper);
  border: 3px solid var(--ink);
  border-radius: 24px;
  padding: 2.5rem 2rem;
  max-width: 380px;
  width: 100%;
  box-shadow: 8px 8px 0 var(--ink);
  text-align: center;
  position: relative;
  animation: popIn .3s cubic-bezier(.34,1.56,.64,1);
}
@keyframes popIn {
  from { transform: scale(.85); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.modal-close {
  position: absolute; top: .75rem; right: 1rem;
  background: transparent; border: none; cursor: pointer;
  font-size: 1.75rem; color: var(--ink-soft);
  line-height: 1;
}
.modal-close:hover { color: var(--accent); }
.modal-icon {
  width: 90px; height: 90px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: var(--user-color, var(--accent));
  border: 3px solid var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem;
  overflow: hidden;
}
.modal-icon img { width: 100%; height: 100%; object-fit: cover; }
.modal-card h2 {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: 1.5rem;
  margin-bottom: .25rem;
}
.modal-card .muted { color: var(--ink-soft); margin-bottom: 1.25rem; font-size: .9rem; }
.modal-error {
  color: var(--accent);
  font-size: .85rem;
  font-weight: 500;
  min-height: 1.25em;
  margin-top: .75rem;
}

.pin-display {
  display: flex;
  justify-content: center;
  gap: .85rem;
  margin: 1rem 0 1.5rem;
}
.pin-display span {
  width: 18px; height: 18px;
  border: 2.5px solid var(--ink);
  border-radius: 50%;
  background: var(--bg-paper-2);
  transition: all .15s;
}
.pin-display span.filled {
  background: var(--ink);
  transform: scale(1.15);
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .5rem;
}
.pin-pad button {
  padding: 1rem 0;
  font-size: 1.5rem;
  font-weight: 700;
  font-family: 'Fraunces', serif;
  background: white;
  border: 2px solid var(--ink);
  border-radius: 12px;
  cursor: pointer;
  transition: all .1s;
  box-shadow: 2px 2px 0 var(--ink);
}
.pin-pad button:hover {
  background: var(--bg-paper-2);
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--ink);
}
.pin-pad button:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--ink);
}
.pin-pad .pad-action {
  background: var(--bg-paper-2);
  font-size: 1rem;
  font-family: 'DM Sans', sans-serif;
}
.pin-pad .pad-action.ok {
  background: var(--accent-2);
  color: white;
  border-color: var(--accent-2);
  box-shadow: 2px 2px 0 var(--ink);
}

/* ============================================================
   ESPACE PARENTS (topbar, panels…)
   ============================================================ */
.topbar {
  background: var(--bg-paper);
  border-bottom: 2px solid var(--ink);
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 1rem; }
.brand-mark {
  font-size: 2rem;
  color: var(--gold);
  text-shadow: 2px 2px 0 var(--ink);
  display: inline-block;
  transform: rotate(-8deg);
}
.topbar h1 {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: 1.6rem;
  letter-spacing: -0.03em;
  line-height: 1;
}
.brand-sub {
  font-family: 'DM Mono', monospace;
  font-size: .7rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: .15em;
  margin-top: .25rem;
}
.tabs { display: flex; gap: .25rem; flex-wrap: wrap; align-items: center; }
.tab {
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  padding: .55rem 1.05rem;
  font-size: .9rem;
  font-weight: 500;
  color: var(--ink-soft);
  border-radius: 999px;
  transition: all .2s;
  text-decoration: none;
  display: inline-block;
}
.tab:hover { background: rgba(29,26,23,.05); color: var(--ink); }
.tab.active { background: var(--ink); color: var(--bg-paper); border-color: var(--ink); }
.tab.logout { color: var(--accent); border-color: var(--accent); }
.tab.logout:hover { background: var(--accent); color: var(--bg-paper); }

main {
  max-width: 1200px;
  margin: 2.5rem auto;
  padding: 0 2rem;
}
.tab-panel { display: none; animation: fadePanel .35s; }
.tab-panel.active { display: block; }
@keyframes fadePanel {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* CARDS COMPTES */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
}
.account-card {
  background: var(--bg-paper);
  border: 2px solid var(--ink);
  border-radius: 20px;
  padding: 2rem;
  position: relative;
  overflow: hidden;
  box-shadow: 6px 6px 0 var(--ink);
  transition: all .25s;
}
.account-card:hover { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--ink); }
.account-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 8px;
  background: var(--user-color, var(--accent));
  border-bottom: 2px solid var(--ink);
}
.account-card::after {
  content: 'COMPTE COURANT';
  position: absolute;
  top: 1.25rem; right: 1.25rem;
  font-family: 'DM Mono', monospace;
  font-size: .6rem;
  letter-spacing: .2em;
  color: var(--ink-soft);
  background: var(--bg-paper-2);
  padding: .25rem .55rem;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
}
.account-card .account-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--user-color);
  border: 3px solid var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem;
  overflow: hidden;
  margin: .5rem 0 .25rem;
  box-shadow: 3px 3px 0 var(--ink);
}
.account-card .account-avatar img { width: 100%; height: 100%; object-fit: cover; }
.account-card h2 {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: 2.2rem;
  letter-spacing: -0.03em;
  margin-top: 1rem;
  line-height: 1.1;
}
.account-card .label {
  font-family: 'DM Mono', monospace;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--ink-soft);
  margin-top: 1.25rem;
}
.account-card .balance {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: 4rem;
  letter-spacing: -0.045em;
  color: var(--user-color);
  line-height: 1;
  margin-top: .25rem;
  text-shadow: 3px 3px 0 rgba(29,26,23,.08);
}
.account-card .balance .euro { font-size: 2.2rem; vertical-align: super; }
.account-card .meta {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 2px dashed var(--line-strong);
  display: flex;
  justify-content: space-between;
  font-family: 'DM Mono', monospace;
  font-size: .72rem;
  color: var(--ink-soft);
}

/* PANELS */
.panel {
  background: var(--bg-paper);
  border: 2px solid var(--ink);
  border-radius: 20px;
  padding: 2.5rem;
  box-shadow: 6px 6px 0 var(--ink);
}
.panel h2 {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: 1.85rem;
  margin-bottom: .35rem;
  letter-spacing: -0.025em;
}
.panel h3 {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 1.25rem;
  margin: 2rem 0 .75rem;
}
.muted { color: var(--ink-soft); margin-bottom: 1.5rem; font-size: .92rem; }

/* FORMS */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.form-grid label.full { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: .35rem; }
label > span {
  font-family: 'DM Mono', monospace;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--ink-soft);
  font-weight: 500;
}
input, select, textarea {
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  padding: .75rem .95rem;
  border: 1.5px solid var(--line-strong);
  border-radius: 10px;
  background: white;
  color: var(--ink);
  transition: all .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  transform: translate(-1px, -1px);
}
input[type="file"] { padding: .5rem; }
input[type="color"] { padding: 2px; height: 40px; cursor: pointer; }

.btn-primary {
  background: var(--ink);
  color: var(--bg-paper);
  border: 2px solid var(--ink);
  padding: .9rem 1.85rem;
  font-weight: 700;
  font-size: .95rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s;
  box-shadow: 3px 3px 0 var(--accent);
}
.btn-primary:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--accent); }
.btn-primary:active { transform: translate(0, 0); box-shadow: 2px 2px 0 var(--accent); }

.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--ink);
  padding: .55rem 1rem;
  font-weight: 500;
  font-size: .85rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s;
}
.btn-ghost:hover { background: var(--ink); color: var(--bg-paper); }
.btn-ghost.danger { border-color: var(--accent); color: var(--accent); }
.btn-ghost.danger:hover { background: var(--accent); color: var(--bg-paper); }

.feedback { margin-top: 1rem; min-height: 1.5em; font-size: .9rem; font-weight: 500; }
.feedback.ok    { color: var(--accent-2); }
.feedback.error { color: var(--accent); }

/* BOUTIQUE ADMIN */
.boutique-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}
.boutique-admin-card {
  background: white;
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 3px 3px 0 var(--ink);
  display: flex; flex-direction: column; gap: .5rem;
}
.boutique-admin-card .item-img-wrap {
  width: 100%; aspect-ratio: 1;
  background: var(--bg-paper-2);
  border: 1.5px solid var(--line-strong);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 3.5rem;
  overflow: hidden;
}
.boutique-admin-card .item-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.boutique-admin-card input { font-size: .9rem; padding: .5rem .7rem; }
.boutique-admin-card .price-row { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; }
.boutique-admin-card .actions { display: flex; gap: .35rem; margin-top: auto; }
.boutique-admin-card .actions button { flex: 1; font-size: .8rem; padding: .45rem .5rem; }
.boutique-admin-card .stock-info {
  font-family: 'DM Mono', monospace;
  font-size: .68rem;
  color: var(--ink-soft);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .1em;
}

.boutique-add {
  background: var(--bg-paper-2);
  border: 1.5px dashed var(--line-strong);
  border-radius: 14px;
  padding: 1.5rem;
}
.upload-row { display: flex; gap: 1rem; align-items: center; }
.upload-preview {
  width: 80px; height: 80px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: white;
  font-size: 1.5rem;
  color: var(--ink-soft);
  overflow: hidden;
  flex-shrink: 0;
}
.upload-preview img { width: 100%; height: 100%; object-fit: cover; }

/* PROFILS */
.profils-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; }
.profil-card {
  background: white;
  border: 2px solid var(--ink);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 4px 4px 0 var(--ink);
}
.profil-preview {
  width: 100px; height: 100px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem;
  margin: 0 auto 1rem;
  overflow: hidden;
  box-shadow: 3px 3px 0 var(--ink);
}
.profil-preview img { width: 100%; height: 100%; object-fit: cover; }
.profil-card h3 { font-family: 'Fraunces', serif; font-size: 1.5rem; text-align: center; margin-bottom: 1rem; }

/* HISTORIQUE */
.filter-bar { display: flex; gap: .5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.chip {
  border: 1.5px solid var(--ink);
  background: transparent;
  padding: .4rem .9rem;
  border-radius: 999px;
  font-family: 'DM Mono', monospace;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  cursor: pointer;
  transition: all .15s;
  color: var(--ink);
}
.chip:hover { background: rgba(29,26,23,.08); }
.chip.active { background: var(--ink); color: var(--bg-paper); }
.chip.mini { padding: .3rem .7rem; font-size: .68rem; border-width: 1px; }

.ledger { display: flex; flex-direction: column; }
.tx-row {
  display: grid;
  grid-template-columns: 90px 1fr auto auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1.5px dashed var(--line-strong);
}
.tx-row:last-child { border-bottom: none; }
.tx-date { font-family: 'DM Mono', monospace; font-size: .72rem; color: var(--ink-soft); }
.tx-label { font-weight: 500; }
.tx-label .by { display: block; font-size: .7rem; color: var(--ink-soft); margin-top: .15rem; font-family: 'DM Mono', monospace; }
.tx-user {
  font-family: 'DM Mono', monospace;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  padding: .3rem .7rem;
  border-radius: 999px;
  color: white;
  font-weight: 500;
}
.tx-amount {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: 1.2rem;
  min-width: 90px;
  text-align: right;
}
.tx-amount.credit { color: var(--accent-2); }
.tx-amount.debit, .tx-amount.achat { color: var(--accent); }

/* STATS */
.stats-grid { display: grid; grid-template-columns: 1fr; gap: 2rem; }
@media (min-width: 900px) { .stats-grid { grid-template-columns: 1fr 1fr; } }
.stat-card {
  background: white;
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: 3px 3px 0 var(--ink);
}
.stat-card h3 { font-family: 'Fraunces', serif; font-weight: 700; font-size: 1.1rem; margin-bottom: 1rem; }

/* JOURNAL */
.logs-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: flex-end;
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  background: var(--bg-paper-2);
  border: 1.5px dashed var(--line-strong);
  border-radius: 12px;
}
.filter-group { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.filter-group.flex-grow { flex: 1; min-width: 200px; }
.filter-group input[type="search"] { width: 100%; padding: .5rem .8rem; font-size: .9rem; }
.filter-label {
  font-family: 'DM Mono', monospace;
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .15em;
  color: var(--ink-soft);
  margin-right: .35rem;
}
.logs-meta { font-family: 'DM Mono', monospace; font-size: .75rem; color: var(--ink-soft); margin-bottom: .75rem; }

.logs-list {
  background: #1a1714;
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: .75rem;
  max-height: 600px;
  overflow-y: auto;
  font-family: 'DM Mono', monospace;
  font-size: .78rem;
  line-height: 1.55;
  color: #e8dfc9;
  box-shadow: inset 0 0 24px rgba(0,0,0,.4);
}
.logs-list::-webkit-scrollbar { width: 10px; }
.logs-list::-webkit-scrollbar-track { background: #0e0c0a; }
.logs-list::-webkit-scrollbar-thumb { background: #3d362d; border-radius: 4px; }

.log-entry {
  display: grid;
  grid-template-columns: 80px 24px 110px 1fr;
  gap: .75rem;
  padding: .35rem .6rem;
  border-radius: 6px;
  align-items: baseline;
  border-left: 3px solid transparent;
}
.log-entry:hover { background: rgba(255,255,255,.04); }
.log-entry.success { border-left-color: #4ade80; }
.log-entry.info    { border-left-color: #60a5fa; }
.log-entry.warn    { border-left-color: #fbbf24; background: rgba(251,191,36,.05); }
.log-entry.error   { border-left-color: #f87171; background: rgba(248,113,113,.06); }
.log-time { color: #8b8275; }
.log-icon { text-align: center; font-weight: bold; }
.log-entry.success .log-icon { color: #4ade80; }
.log-entry.info    .log-icon { color: #60a5fa; }
.log-entry.warn    .log-icon { color: #fbbf24; }
.log-entry.error   .log-icon { color: #f87171; }
.log-type { color: #c9a24a; text-transform: uppercase; font-size: .68rem; letter-spacing: .1em; }
.log-msg { color: #e8dfc9; word-break: break-word; }
.log-details { margin-top: .25rem; font-size: .72rem; color: #8b8275; cursor: pointer; user-select: none; }
.log-details:hover { color: #c9a24a; }
.log-details-content { display: none; margin-top: .35rem; padding: .5rem .75rem; background: rgba(0,0,0,.4); border-radius: 4px; font-size: .72rem; color: #b0a78f; white-space: pre-wrap; }
.log-details-content.open { display: block; }
.logs-empty { text-align: center; padding: 3rem 1rem; color: #8b8275; font-style: italic; }

footer {
  text-align: center;
  padding: 2rem;
  font-family: 'DM Mono', monospace;
  font-size: .72rem;
  color: var(--ink-soft);
}

/* ============================================================
   ESPACE ENFANT
   ============================================================ */
.kid-body { background: #f0e6d2; }

/* === Thème Spider-Man (Valentin) === */
.kid-body.theme-spiderman {
  background:
    linear-gradient(135deg, #dc2626 0%, #1e3a8a 100%);
  background-attachment: fixed;
  position: relative;
}
.kid-body.theme-spiderman::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    linear-gradient(45deg, rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(-45deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 30px 30px;
  pointer-events: none;
}
.theme-spiderman .kid-locked-card,
.theme-spiderman .kid-app .kid-header,
.theme-spiderman .kid-shop-grid .shop-card,
.theme-spiderman .kid-history-row,
.theme-spiderman .modal-card { font-family: 'Fredoka', sans-serif; }
.theme-spiderman h1, .theme-spiderman h2 {
  font-family: 'Bangers', cursive !important;
  letter-spacing: .04em !important;
  font-weight: 400 !important;
}
.theme-spiderman .kid-balance {
  font-family: 'Bangers', cursive !important;
  color: #ffd700 !important;
  text-shadow: 2px 2px 0 #1e3a8a, 4px 4px 0 rgba(0,0,0,.3) !important;
}
.theme-spiderman .kid-tab.active { background: #dc2626 !important; color: white !important; border-color: #1e3a8a !important; }
.theme-spiderman .shop-card .shop-price { color: #dc2626 !important; font-family: 'Bangers', cursive !important; font-size: 1.6rem !important; }

/* === Thème Pop Star (Lana) === */
.kid-body.theme-popstar {
  background:
    linear-gradient(135deg, #ec4899 0%, #a855f7 50%, #fb7185 100%);
  background-attachment: fixed;
  position: relative;
}
.kid-body.theme-popstar::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,.15) 2px, transparent 2px),
    radial-gradient(circle at 70% 60%, rgba(255,255,255,.1) 1.5px, transparent 1.5px),
    radial-gradient(circle at 40% 80%, rgba(255,255,255,.12) 2px, transparent 2px);
  background-size: 80px 80px, 60px 60px, 100px 100px;
  pointer-events: none;
}
.theme-popstar .kid-locked-card,
.theme-popstar .kid-app .kid-header,
.theme-popstar .kid-shop-grid .shop-card,
.theme-popstar .kid-history-row,
.theme-popstar .modal-card { font-family: 'Fredoka', sans-serif; }
.theme-popstar h1, .theme-popstar h2 {
  font-family: 'Bungee', cursive !important;
  letter-spacing: 0 !important;
  font-weight: 400 !important;
}
.theme-popstar .kid-balance {
  font-family: 'Bungee', cursive !important;
  background: linear-gradient(135deg, #ec4899, #a855f7) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  text-shadow: none !important;
}
.theme-popstar .kid-tab.active { background: #ec4899 !important; color: white !important; }
.theme-popstar .shop-card .shop-price { color: #a855f7 !important; font-family: 'Bungee', cursive !important; font-size: 1.6rem !important; }
.theme-popstar .shop-card { box-shadow: 4px 4px 0 #a855f7 !important; }

/* === Layout enfant commun === */
.kid-locked {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 2rem 1rem;
  position: relative; z-index: 1;
}
.kid-locked-card {
  background: white;
  border: 4px solid #1d1a17;
  border-radius: 24px;
  padding: 2.5rem 2rem;
  max-width: 380px; width: 100%;
  box-shadow: 8px 8px 0 #1d1a17;
  text-align: center;
}
.kid-locked-card h1 {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: 2rem;
  margin: 1rem 0 .5rem;
}
.kid-locked-card p {
  color: var(--ink-soft);
  font-size: .9rem;
  margin-bottom: 1rem;
}
.back-link {
  display: inline-block;
  margin-top: 1rem;
  font-size: .85rem;
  color: var(--ink-soft);
  text-decoration: none;
  font-family: 'DM Mono', monospace;
  text-transform: uppercase;
  letter-spacing: .1em;
}
.back-link:hover { color: var(--accent); }

.kid-avatar-wrap {
  width: 130px; height: 130px;
  margin: 0 auto;
  border-radius: 50%;
  background: var(--user-color, var(--accent));
  border: 4px solid #1d1a17;
  display: flex; align-items: center; justify-content: center;
  font-size: 4rem;
  overflow: hidden;
  box-shadow: 4px 4px 0 #1d1a17;
}
.kid-avatar-wrap img { width: 100%; height: 100%; object-fit: cover; }
.kid-avatar-wrap.small { width: 64px; height: 64px; font-size: 2rem; box-shadow: 2px 2px 0 #1d1a17; border-width: 3px; }

.kid-app { position: relative; z-index: 1; }
.kid-header {
  background: white;
  border-bottom: 3px solid #1d1a17;
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.kid-header-left { display: flex; align-items: center; gap: 1rem; }
.kid-hello {
  font-family: 'DM Mono', monospace;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .2em;
  color: var(--ink-soft);
}
.kid-header h1 {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: 1.75rem;
  letter-spacing: -0.02em;
  line-height: 1;
}
.kid-balance-block { display: flex; flex-direction: column; align-items: flex-end; }
.kid-balance-label {
  font-family: 'DM Mono', monospace;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .15em;
  color: var(--ink-soft);
}
.kid-balance {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: 2.25rem;
  letter-spacing: -0.03em;
  color: var(--user-color, var(--accent));
  line-height: 1;
  margin-top: .15rem;
}
.kid-logout {
  background: transparent;
  border: 2px solid var(--accent);
  color: var(--accent);
  padding: .5rem .85rem;
  border-radius: 50%;
  cursor: pointer;
  text-decoration: none;
  font-size: 1.1rem;
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.kid-logout:hover { background: var(--accent); color: white; }

.kid-tabs {
  display: flex;
  gap: .5rem;
  padding: 1rem 2rem;
  justify-content: center;
}
.kid-tab {
  background: rgba(255,255,255,.85);
  border: 2.5px solid #1d1a17;
  padding: .75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s;
  box-shadow: 3px 3px 0 #1d1a17;
}
.kid-tab:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 #1d1a17; }
.kid-tab.active { background: var(--user-color, var(--ink)); color: white; }

.kid-main { padding: 1.5rem 2rem 4rem; max-width: 1100px; margin: 0 auto; }
.kid-panel { display: none; animation: fadePanel .35s; }
.kid-panel.active { display: block; }

.kid-shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.25rem;
}
.shop-card {
  background: white;
  border: 3px solid #1d1a17;
  border-radius: 18px;
  overflow: hidden;
  cursor: pointer;
  transition: all .2s cubic-bezier(.34,1.56,.64,1);
  box-shadow: 4px 4px 0 #1d1a17;
  display: flex; flex-direction: column;
}
.shop-card:hover {
  transform: translate(-3px, -3px) rotate(-1deg);
  box-shadow: 7px 7px 0 var(--user-color, #1d1a17);
}
.shop-card.disabled { opacity: .5; cursor: not-allowed; filter: grayscale(.5); }
.shop-card.disabled:hover { transform: none; box-shadow: 4px 4px 0 #1d1a17; }
.shop-card .shop-img-wrap {
  width: 100%; aspect-ratio: 1;
  background: linear-gradient(135deg, var(--bg-paper-2), white);
  border-bottom: 2px solid #1d1a17;
  display: flex; align-items: center; justify-content: center;
  font-size: 4rem;
  overflow: hidden;
}
.shop-card .shop-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.shop-card .shop-info {
  padding: .85rem 1rem 1rem;
  text-align: center;
  display: flex; flex-direction: column; gap: .25rem;
  flex: 1;
}
.shop-card .shop-label { font-size: .95rem; font-weight: 600; line-height: 1.25; }
.shop-card .shop-price {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: 1.4rem;
  color: var(--accent);
  margin-top: auto;
}
.shop-card .shop-stock {
  font-family: 'DM Mono', monospace;
  font-size: .65rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: .1em;
}

.kid-history { display: flex; flex-direction: column; gap: .5rem; }
.kid-history-row {
  background: white;
  border: 2px solid #1d1a17;
  border-radius: 12px;
  padding: .85rem 1rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: center;
  box-shadow: 2px 2px 0 #1d1a17;
}
.kid-history-row .h-label { font-weight: 500; font-size: .95rem; }
.kid-history-row .h-date { display: block; font-size: .7rem; color: var(--ink-soft); margin-top: .15rem; font-family: 'DM Mono', monospace; }
.kid-history-row .h-amount { font-family: 'Fraunces', serif; font-weight: 900; font-size: 1.2rem; }
.kid-history-row .h-amount.credit { color: var(--accent-2); }
.kid-history-row .h-amount.debit, .kid-history-row .h-amount.achat { color: var(--accent); }
.kid-history-empty { text-align: center; padding: 3rem; color: white; font-size: 1.1rem; opacity: .8; }

/* Modal achat / succès */
.buy-modal-card { max-width: 400px; }
.buy-image-wrap {
  width: 160px; height: 160px;
  margin: 0 auto 1rem;
  border-radius: 16px;
  border: 3px solid #1d1a17;
  background: var(--bg-paper-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 5rem;
  overflow: hidden;
  box-shadow: 4px 4px 0 #1d1a17;
}
.buy-image-wrap img { width: 100%; height: 100%; object-fit: cover; }
.buy-price {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: 2.5rem;
  color: var(--accent);
  margin: .5rem 0 .25rem;
}
.btn-big {
  display: block;
  width: 100%;
  background: var(--accent-2);
  color: white;
  border: 3px solid #1d1a17;
  padding: 1rem;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: 14px;
  cursor: pointer;
  margin-top: 1rem;
  box-shadow: 3px 3px 0 #1d1a17;
  transition: all .15s;
}
.btn-big:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 #1d1a17; }
.btn-big:disabled { background: #888; cursor: not-allowed; }
.btn-text {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--ink-soft);
  padding: .75rem;
  cursor: pointer;
  font-size: .9rem;
  margin-top: .25rem;
}
.btn-text:hover { color: var(--accent); }

.success-card { text-align: center; }
.success-burst {
  font-size: 5rem;
  animation: bounce .6s cubic-bezier(.34,1.56,.64,1);
}
@keyframes bounce {
  0% { transform: scale(0) rotate(-180deg); }
  100% { transform: scale(1) rotate(0); }
}

/* ============================================================
   NOUVELLES SECTIONS ENFANT V3 (accueil/stats/tâches/objectif)
   ============================================================ */

/* Confettis */
#confetti-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  pointer-events: none;
  z-index: 9999;
  display: none;
}

/* Toast notif */
.kid-toast {
  position: fixed;
  bottom: 2rem; left: 50%;
  transform: translate(-50%, 160%);
  background: #1d1a17;
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 999px;
  border: 2px solid white;
  font-weight: 600;
  z-index: 500;
  transition: transform .35s cubic-bezier(.34,1.56,.64,1);
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
  max-width: 90vw;
  text-align: center;
}
.kid-toast.show { transform: translate(-50%, 0); }

/* Titres de section kid */
.kid-section-title {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: 1.6rem;
  color: white;
  margin: 1.5rem 0 .5rem;
  letter-spacing: -0.02em;
  text-shadow: 2px 2px 0 rgba(0,0,0,.25);
}
.kid-section-sub {
  color: white;
  opacity: 0.92;
  font-size: .95rem;
  margin-bottom: 1.25rem;
}
.kid-sub-title {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 1.2rem;
  color: white;
  margin: 1.75rem 0 .75rem;
  opacity: .95;
}

/* BANNIÈRE OBJECTIF */
.goal-banner {
  background: white;
  border: 3px solid #1d1a17;
  border-radius: 20px;
  margin: 1rem 2rem 0;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 4px 4px 0 #1d1a17;
  position: relative;
}
.goal-banner-img {
  width: 70px; height: 70px;
  border-radius: 14px;
  border: 2px solid #1d1a17;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem;
  overflow: hidden;
  flex-shrink: 0;
}
.goal-banner-img img { width: 100%; height: 100%; object-fit: cover; }
.goal-banner-content { flex: 1; min-width: 0; }
.goal-banner-label {
  font-family: 'DM Mono', monospace;
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .15em;
  color: var(--ink-soft);
}
.goal-banner h3 {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: 1.15rem;
  margin: .15rem 0 .5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.goal-progress-bar {
  height: 10px;
  background: #f0e6d2;
  border-radius: 999px;
  overflow: hidden;
  border: 1.5px solid #1d1a17;
}
.goal-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--user-color), var(--user-color2));
  border-radius: 999px;
  transition: width .8s cubic-bezier(.34,1.56,.64,1);
}
.goal-progress-fill.ready {
  background: linear-gradient(90deg, #2d6a4f, #52b788);
  animation: goalPulse 1.5s ease infinite;
}
@keyframes goalPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.3); }
}
.goal-progress-text {
  font-size: .78rem;
  color: var(--ink-soft);
  margin-top: .4rem;
}
.goal-banner-clear {
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: 1.5rem;
  cursor: pointer;
  padding: .25rem .5rem;
  border-radius: 50%;
  flex-shrink: 0;
}
.goal-banner-clear:hover { background: rgba(184,71,45,.1); }

/* ACCUEIL - grid solde */
.kid-home-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin-bottom: 1rem;
}
@media (min-width: 700px) {
  .kid-home-grid { grid-template-columns: 1.3fr 1fr; }
}

.home-solde-card {
  background: white;
  border: 3px solid #1d1a17;
  border-radius: 20px;
  padding: 2rem 1.5rem;
  position: relative;
  overflow: hidden;
  box-shadow: 5px 5px 0 #1d1a17;
}
.home-solde-bg {
  position: absolute;
  top: -30%; right: -20%;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--user-color), var(--user-color2));
  opacity: .15;
  pointer-events: none;
}
.home-solde-label {
  font-family: 'DM Mono', monospace;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .2em;
  color: var(--ink-soft);
  position: relative;
}
.home-solde-amount {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: 3.5rem;
  letter-spacing: -0.04em;
  color: var(--user-color);
  line-height: 1;
  margin: .3rem 0 1.25rem;
  position: relative;
  text-shadow: 2px 2px 0 rgba(0,0,0,.08);
}

.home-level-bar { position: relative; }
.home-level-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: .4rem;
}
.home-level-name {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: 1rem;
}
.home-level-xp {
  font-family: 'DM Mono', monospace;
  font-size: .7rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: .1em;
}
.home-level-progress {
  height: 14px;
  background: #f0e6d2;
  border-radius: 999px;
  border: 2px solid #1d1a17;
  overflow: hidden;
}
.home-level-fill {
  height: 100%;
  background: linear-gradient(90deg, #FFD700, #FFA500, #FF6347);
  border-radius: 999px;
  transition: width .8s cubic-bezier(.34,1.56,.64,1);
  box-shadow: inset 0 0 8px rgba(255,255,255,.4);
}

/* Quick stats */
.home-quick-grid {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.quick-stat {
  background: white;
  border: 2.5px solid #1d1a17;
  border-radius: 14px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 3px 3px 0 #1d1a17;
  transition: transform .2s;
}
.quick-stat:hover { transform: translate(-1px, -1px); }
.quick-emoji { font-size: 2rem; flex-shrink: 0; }
.quick-label {
  font-family: 'DM Mono', monospace;
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--ink-soft);
  margin-bottom: .1rem;
}
.quick-value {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
}

/* BADGES */
.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: .75rem;
  margin-bottom: 1rem;
}
.badge-card {
  background: white;
  border: 2.5px solid #1d1a17;
  border-radius: 14px;
  padding: 1rem .5rem;
  text-align: center;
  box-shadow: 3px 3px 0 #1d1a17;
  transition: transform .3s cubic-bezier(.34,1.56,.64,1);
  cursor: help;
}
.badge-card:hover { transform: translateY(-4px) rotate(-3deg); }
.badge-emoji {
  font-size: 2.5rem;
  margin-bottom: .35rem;
  filter: drop-shadow(2px 2px 0 rgba(0,0,0,.15));
}
.badge-name {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: .8rem;
  line-height: 1.1;
}
.badges-empty {
  background: rgba(255,255,255,.15);
  border: 2px dashed rgba(255,255,255,.5);
  border-radius: 14px;
  padding: 2rem;
  text-align: center;
  color: white;
  font-style: italic;
}

/* BOUTIQUE enrichie */
.shop-card.cant-afford { opacity: .75; }
.shop-card.cant-afford .shop-img-wrap { filter: grayscale(.4); }
.shop-card .shop-missing {
  font-family: 'DM Mono', monospace;
  font-size: .62rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-top: .1rem;
  font-weight: 700;
}
.shop-card.is-goal {
  box-shadow: 4px 4px 0 #FFD700 !important;
  border-color: #FFD700 !important;
}
.shop-card .goal-tag {
  position: absolute;
  top: .5rem; right: .5rem;
  background: #FFD700;
  color: #1d1a17;
  padding: .15rem .5rem;
  border-radius: 999px;
  font-size: .62rem;
  font-weight: 900;
  z-index: 1;
  border: 1.5px solid #1d1a17;
}
.shop-card { position: relative; }
.shop-card .shop-stock.rupture { color: var(--accent); font-weight: 700; }

/* TÂCHES */
.tasks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .85rem;
}
.task-card {
  background: white;
  border: 2.5px solid #1d1a17;
  border-radius: 14px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 3px 3px 0 #1d1a17;
  transition: transform .2s;
}
.task-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 var(--user-color);
}
.task-emoji {
  font-size: 2.25rem;
  flex-shrink: 0;
}
.task-info { flex: 1; min-width: 0; }
.task-label {
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.25;
}
.task-reward {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: 1.25rem;
  color: var(--accent-2);
  margin-top: .15rem;
}

/* HISTORIQUE enrichi */
.history-filter {
  display: flex;
  gap: .5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.chip-kid {
  background: rgba(255,255,255,.85);
  border: 2px solid #1d1a17;
  padding: .45rem 1rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: .85rem;
  cursor: pointer;
  transition: all .15s;
  box-shadow: 2px 2px 0 #1d1a17;
}
.chip-kid:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 #1d1a17; }
.chip-kid.active {
  background: #1d1a17;
  color: white;
}

.kid-history-row {
  grid-template-columns: auto 1fr auto !important;
}
.kid-history-row .h-type-icon {
  font-size: 1.5rem;
  width: 40px;
  text-align: center;
}
.kid-history-row.credit { border-left: 4px solid var(--accent-2); }
.kid-history-row.achat  { border-left: 4px solid var(--accent); }
.kid-history-row.debit  { border-left: 4px solid #d4830f; }

/* STATS */
.stats-total-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .75rem;
  margin-bottom: 1rem;
}
.stat-big {
  background: white;
  border: 2.5px solid #1d1a17;
  border-radius: 14px;
  padding: 1.25rem 1rem;
  text-align: center;
  box-shadow: 3px 3px 0 #1d1a17;
}
.stat-big-label {
  font-family: 'DM Mono', monospace;
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--ink-soft);
  margin-bottom: .35rem;
}
.stat-big-value {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: 1.75rem;
  letter-spacing: -0.02em;
  line-height: 1;
}
.stat-big.credit .stat-big-value { color: var(--accent-2); }
.stat-big.depense .stat-big-value { color: var(--accent); }
.stat-big.debit .stat-big-value { color: #d4830f; }

.stats-month {
  background: white;
  border: 2.5px solid #1d1a17;
  border-radius: 14px;
  padding: 1.25rem;
  box-shadow: 3px 3px 0 #1d1a17;
}
.month-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .65rem 0;
  border-bottom: 1px dashed var(--line);
  font-size: .95rem;
}
.month-row:last-child { border: none; }
.month-row.total {
  font-weight: 700;
  font-size: 1.05rem;
  padding-top: .85rem;
  margin-top: .25rem;
  border-top: 2px solid var(--line);
  border-bottom: none !important;
}
.month-row.muted { color: var(--ink-soft); font-size: .85rem; }
.month-row strong { font-family: 'Fraunces', serif; font-weight: 900; font-size: 1.1rem; }
.month-row strong.credit { color: var(--accent-2); }
.month-row strong.achat  { color: var(--accent); }
.month-row strong.debit  { color: #d4830f; }

.chart-wrap {
  background: white;
  border: 2.5px solid #1d1a17;
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 3px 3px 0 #1d1a17;
  height: 280px;
}

/* Bouton alt */
.btn-big.btn-alt {
  background: white;
  color: #1d1a17;
  border: 3px solid #1d1a17;
  margin-top: .5rem;
}
.btn-big.btn-alt:hover { background: #FFD700; }
.btn-big:disabled { background: #888 !important; color: white !important; cursor: not-allowed; opacity: .7; }

/* Responsive spé enfant v3 */
@media (max-width: 700px) {
  .goal-banner { margin: .85rem 1rem 0; padding: .85rem 1rem; gap: .75rem; }
  .goal-banner-img { width: 60px; height: 60px; font-size: 2rem; }
  .goal-banner h3 { font-size: 1rem; }
  .goal-progress-text { font-size: .72rem; }
  .kid-section-title { font-size: 1.3rem; margin: 1.25rem 0 .4rem; }
  .home-solde-amount { font-size: 2.75rem; }
  .kid-tabs {
    overflow-x: auto !important;
    justify-content: flex-start !important;
    scrollbar-width: none;
    padding: .65rem 1rem !important;
    flex-wrap: nowrap !important;
  }
  .kid-tabs::-webkit-scrollbar { display: none; }
  .kid-tab { flex-shrink: 0; padding: .55rem .9rem !important; font-size: .8rem !important; flex: 0 0 auto !important; }
  .badges-grid { grid-template-columns: repeat(3, 1fr); }
  .badge-emoji { font-size: 2rem; }
  .badge-name { font-size: .72rem; }
  .stats-total-grid { grid-template-columns: 1fr; }
  .stat-big-value { font-size: 1.5rem; }
  .chart-wrap { height: 240px; }
  .tasks-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   RESPONSIVE — TABLETTE & MOBILE
   ============================================================ */

/* Boutons tactiles : taille minimum confortable au doigt */
@media (hover: none) and (pointer: coarse) {
  button, .tab, .chip, .login-card, .shop-card, .kid-tab, .pin-pad button {
    -webkit-tap-highlight-color: rgba(0,0,0,.1);
    touch-action: manipulation;
  }
  /* Désactive les hover qui restent "collés" sur mobile */
  .login-card:hover, .shop-card:hover, .account-card:hover,
  .kid-tab:hover, .pin-pad button:hover, .btn-primary:hover {
    transform: none !important;
  }
}

/* === TABLETTE (≤900px) === */
@media (max-width: 900px) {
  .topbar { padding: 1rem 1.25rem; }
  main { padding: 0 1.25rem; margin: 1.5rem auto; }

  /* Tabs parents en scroll horizontal au lieu de wrap moche */
  .tabs {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: .25rem;
    margin: 0 -1.25rem;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex-shrink: 0; }

  .panel { padding: 1.5rem; }
  .panel h2 { font-size: 1.5rem; }

  .form-grid { grid-template-columns: 1fr 1fr; gap: .75rem; }
  .form-grid label.full { grid-column: 1 / -1; }

  .stats-grid { grid-template-columns: 1fr; }
}

/* === MOBILE (≤640px) === */
@media (max-width: 640px) {
  body { font-size: 15px; }

  /* Topbar : compacte */
  .topbar {
    padding: .85rem 1rem;
    gap: .5rem;
    /* Safe-area pour iPhone avec encoche */
    padding-top: max(.85rem, env(safe-area-inset-top));
  }
  .topbar .brand { gap: .65rem; }
  .topbar h1 { font-size: 1.2rem; }
  .brand-mark { font-size: 1.5rem; }
  .brand-sub { font-size: .62rem; letter-spacing: .12em; }

  /* Tabs parents */
  .tab { padding: .5rem .85rem; font-size: .85rem; }

  main { padding: 0 .85rem; margin: 1rem auto; }
  .panel { padding: 1.25rem 1rem; border-radius: 16px; box-shadow: 4px 4px 0 var(--ink); }
  .panel h2 { font-size: 1.35rem; }
  .muted { font-size: .85rem; }

  /* === FORMS === */
  .form-grid { grid-template-columns: 1fr; gap: .75rem; }
  input, select, textarea { font-size: 16px; padding: .7rem .85rem; } /* 16px évite le zoom auto iOS */
  .btn-primary { width: 100%; padding: 1rem; font-size: 1rem; }

  /* === COMPTES === */
  .cards-grid { grid-template-columns: 1fr; gap: 1.25rem; }
  .account-card {
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 4px 4px 0 var(--ink);
  }
  .account-card::after { font-size: .55rem; padding: .2rem .45rem; }
  .account-card .account-avatar { width: 64px; height: 64px; font-size: 2rem; }
  .account-card h2 { font-size: 1.85rem; }
  .account-card .balance { font-size: 3.25rem; }
  .account-card .balance .euro { font-size: 1.85rem; }
  .account-card .meta { font-size: .68rem; }

  /* === BOUTIQUE ADMIN === */
  .boutique-admin-grid { grid-template-columns: 1fr 1fr; gap: .75rem; }
  .boutique-admin-card { padding: .75rem; border-radius: 12px; }
  .boutique-admin-card .item-img-wrap { font-size: 2.5rem; }
  .boutique-admin-card input { font-size: 14px; padding: .45rem .55rem; }
  .boutique-admin-card .actions button { font-size: .7rem; padding: .4rem .3rem; }
  .boutique-add { padding: 1rem; }

  /* === PROFILS === */
  .profils-grid { grid-template-columns: 1fr; }
  .profil-card { padding: 1.25rem; }

  /* === HISTORIQUE === */
  .tx-row {
    grid-template-columns: 1fr auto;
    gap: .5rem;
    padding: .85rem 0;
  }
  .tx-date, .tx-user { display: none; }
  .tx-amount { font-size: 1.1rem; min-width: auto; }
  .filter-bar { gap: .35rem; }
  .chip { padding: .4rem .75rem; font-size: .68rem; }

  /* === JOURNAL === */
  .logs-toolbar { padding: .85rem; gap: .85rem; }
  .filter-group .filter-label { font-size: .58rem; margin-right: .25rem; }
  .chip.mini { padding: .3rem .55rem; font-size: .62rem; }
  .logs-list { font-size: .72rem; padding: .5rem; max-height: 500px; }
  .log-entry {
    grid-template-columns: 56px 18px 1fr;
    gap: .5rem;
    padding: .35rem .45rem;
  }
  .log-type { display: none; }
  .log-time { font-size: .65rem; }

  /* === FOOTER === */
  footer { padding: 1.5rem 1rem; font-size: .68rem; }

  /* === ÉCRAN DE CONNEXION === */
  .login-screen { padding: 2rem 1rem; }
  .login-header { margin-bottom: 2.5rem; }
  .login-header .brand-mark { font-size: 3rem; }

  /* Anciennes cards (au cas où) */
  .login-cards { grid-template-columns: 1fr; gap: 1rem; max-width: 360px; }
  .login-card {
    padding: 1.5rem 1.25rem;
    border-radius: 18px;
    box-shadow: 5px 5px 0 var(--ink);
    display: flex;
    align-items: center;
    gap: 1rem;
    text-align: left;
  }
  .login-card .card-avatar {
    width: 70px; height: 70px;
    margin: 0;
    font-size: 2.25rem;
    flex-shrink: 0;
  }
  .login-card h3 { font-size: 1.4rem; margin: 0; }
  .login-card .card-role { font-size: .65rem; }

  /* Nouveaux : space cards en stack vertical */
  .space-cards { grid-template-columns: 1fr; gap: 1rem; margin-top: 1rem; }
  .space-card {
    padding: 1.75rem 1.5rem;
    border-radius: 20px;
    box-shadow: 5px 5px 0 var(--ink);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    text-align: left;
  }
  .space-card:hover {
    transform: none;
    box-shadow: 5px 5px 0 var(--accent);
  }
  .space-emoji { font-size: 3.5rem; margin-bottom: 0; flex-shrink: 0; }
  .space-card h2 { font-size: 1.4rem; margin-bottom: .15rem; }
  .space-card p { font-size: .65rem; letter-spacing: .15em; }

  .pin-step-card {
    padding: 1.75rem 1.25rem;
    box-shadow: 5px 5px 0 var(--ink);
  }
  .pin-step-icon { font-size: 3rem; }
  .pin-step-card h2 { font-size: 1.45rem; }

  /* === MODAL & PIN PAD === */
  .modal { padding: .75rem; align-items: flex-end; }
  .modal-card {
    padding: 1.5rem 1.25rem 1.75rem;
    max-width: 100%;
    border-radius: 24px 24px 16px 16px;
    box-shadow: 0 -4px 0 var(--ink);
  }
  .modal-card h2 { font-size: 1.35rem; }
  .pin-display { gap: .75rem; margin: .85rem 0 1.25rem; }
  .pin-display span { width: 16px; height: 16px; }
  .pin-pad { gap: .55rem; }
  .pin-pad button {
    padding: 1.2rem 0; /* + tactile */
    font-size: 1.4rem;
    border-radius: 14px;
  }

  /* === ESPACE ENFANT === */
  .kid-locked { padding: 1.5rem .85rem; }
  .kid-locked-card {
    padding: 1.75rem 1.25rem;
    border-radius: 20px;
    box-shadow: 5px 5px 0 #1d1a17;
  }
  .kid-locked-card h1 { font-size: 1.65rem; margin: .85rem 0 .35rem; }
  .kid-avatar-wrap { width: 100px; height: 100px; font-size: 3rem; border-width: 3px; }

  .kid-header {
    padding: .85rem 1rem;
    padding-top: max(.85rem, env(safe-area-inset-top));
    flex-wrap: nowrap;
    gap: .75rem;
  }
  .kid-header-left { gap: .65rem; min-width: 0; }
  .kid-avatar-wrap.small { width: 48px; height: 48px; font-size: 1.5rem; border-width: 2px; }
  .kid-hello { font-size: .6rem; }
  .kid-header h1 {
    font-size: 1.2rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .kid-balance-block { align-items: flex-end; }
  .kid-balance-label { font-size: .58rem; }
  .kid-balance { font-size: 1.5rem; }
  .kid-logout { width: 38px; height: 38px; font-size: 1rem; padding: 0; flex-shrink: 0; }

  .kid-tabs { padding: .85rem 1rem; gap: .5rem; }
  .kid-tab {
    padding: .65rem 1rem;
    font-size: .9rem;
    flex: 1;
    text-align: center;
  }

  .kid-main {
    padding: 1rem 1rem 2.5rem;
    padding-bottom: max(2.5rem, env(safe-area-inset-bottom));
  }

  .kid-shop-grid { grid-template-columns: 1fr 1fr; gap: .85rem; }
  .shop-card { border-radius: 14px; box-shadow: 3px 3px 0 #1d1a17; }
  .shop-card .shop-img-wrap { font-size: 3rem; }
  .shop-card .shop-info { padding: .65rem .65rem .85rem; gap: .2rem; }
  .shop-card .shop-label { font-size: .85rem; line-height: 1.2; }
  .shop-card .shop-price { font-size: 1.2rem; }

  .kid-history-row { padding: .75rem .85rem; border-radius: 10px; gap: .75rem; }
  .kid-history-row .h-label { font-size: .9rem; }
  .kid-history-row .h-date { font-size: .65rem; }
  .kid-history-row .h-amount { font-size: 1.1rem; }

  .buy-modal-card { padding: 1.5rem 1.25rem; }
  .buy-image-wrap { width: 130px; height: 130px; font-size: 4rem; border-radius: 14px; }
  .buy-price { font-size: 2.1rem; }
  .btn-big { padding: .9rem; font-size: 1rem; border-radius: 12px; }

  /* Stats */
  .stat-card { padding: 1rem; }
}

/* === TRÈS PETIT MOBILE (≤380px) === */
@media (max-width: 380px) {
  .kid-shop-grid { grid-template-columns: 1fr; }
  .boutique-admin-grid { grid-template-columns: 1fr; }
  .pin-pad button { font-size: 1.25rem; padding: 1rem 0; }
  .account-card .balance { font-size: 2.75rem; }
  .topbar h1 { font-size: 1.05rem; }
  .brand-sub { display: none; }
}

/* === MODE PAYSAGE MOBILE === */
@media (max-height: 500px) and (orientation: landscape) {
  .login-screen { padding: 1rem; }
  .login-header { margin-bottom: 1.5rem; }
  .login-cards { grid-template-columns: 1fr 1fr 1fr; }
  .modal { align-items: center; }
  .modal-card { border-radius: 20px; }
  .pin-pad button { padding: .65rem 0; font-size: 1.1rem; }
  .kid-locked { padding: 1rem; }
}
