/* CRIB ⌐▣ — la surface produit. Bleu roi, mandarine, menthe, creme. Mat, contour noir fin.
   🔴 C'est une APP : hauteur pleine, la page ne defile pas, chaque panneau defile chez lui. */
:root {
  --blue:      #1531C4;
  --deep:      #0E2288;
  --deeper:    #0A1A6B;
  --lift:      #1B3AD8;
  --mandarin:  #F5761A;
  --mint:      #7FD4A0;
  --cream:     #F2E9D8;
  --ink:       #0D0D12;
  --faint:     #A9BAF5;
  --dim:       #6E86DC;
  --red:       #FF7A6B;
  --r: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--blue);
  color: var(--cream);
  font: 400 14px/1.5 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  /* 🔴 100dvh et pas 100vh : sur mobile la barre d'adresse mange le vh et coupe le bas. */
  height: 100dvh; overflow: hidden;
}
button, input { font: inherit; color: inherit; }
a { color: var(--mint); text-decoration: none; }

/* ── la charpente ─────────────────────────────────────────────────────── */
#app {
  height: 100dvh;
  display: grid;
  /* 🔴 minmax(0,1fr) et pas 1fr : sans le 0, une colonne refuse de retrecir et rien ne defile. */
  grid-template-rows: auto minmax(0, 1fr);
}

header.bar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px; border-bottom: 1.5px solid var(--ink); background: var(--deep);
}
.mark { width: 26px; height: 26px; flex: 0 0 26px; }
.brand { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.brand .sig { color: var(--mandarin); margin-left: 4px; }
.bar .spacer { flex: 1; }
.net {
  font-size: 11.5px; padding: 5px 10px; border-radius: 999px;
  background: var(--deeper); border: 1.5px solid var(--ink); color: var(--faint);
  display: flex; align-items: center; gap: 6px; white-space: nowrap;
}
.net .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); }
.net.ok .dot { background: var(--mint); }
.net.bad .dot { background: var(--red); }
.btn {
  border: 1.5px solid var(--ink); border-radius: 10px; padding: 8px 14px;
  background: var(--lift); cursor: pointer; font-size: 13px; font-weight: 500;
  transition: transform .06s ease;
}
.btn:hover { background: #2044ea; }
.btn:active { transform: translateY(1px); }
.btn.go { background: var(--mandarin); color: var(--ink); font-weight: 600; }
.btn.go:hover { background: #ff8a2e; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.sm { padding: 6px 11px; font-size: 12px; }

/* ── le corps : rail + panneau ────────────────────────────────────────── */
main {
  display: grid; grid-template-columns: 296px minmax(0, 1fr);
  min-height: 0; /* 🔴 sinon la grille refuse de retrecir et le defilement remonte a la page */
}
aside {
  border-right: 1.5px solid var(--ink); background: var(--deep);
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-height: 0;
}
.side-h { padding: 13px 16px 9px; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.list { overflow-y: auto; min-height: 0; padding: 0 8px 8px; }

.row {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center;
  padding: 10px 10px; border-radius: 11px; cursor: pointer; border: 1.5px solid transparent;
}
.row:hover { background: var(--deeper); }
.row.on { background: var(--deeper); border-color: var(--mandarin); }
.row .sym { font-size: 14.5px; font-weight: 600; }
.row .rate { font-size: 14.5px; font-weight: 600; color: var(--mandarin); font-variant-numeric: tabular-nums; }
.row .sub { font-size: 11.5px; color: var(--dim); grid-column: 1; }
.row .util { font-size: 11.5px; color: var(--faint); text-align: right; font-variant-numeric: tabular-nums; }
.row .meter { grid-column: 1 / -1; height: 4px; border-radius: 3px; background: #081555; overflow: hidden; }
.row .meter span { display: block; height: 100%; background: var(--mandarin); width: 0; transition: width .4s ease; }

.mine { border-top: 1.5px solid var(--ink); padding: 12px 16px; display: grid; gap: 7px; }
.mine .l { display: flex; justify-content: space-between; font-size: 12.5px; }
.mine .l i { font-style: normal; color: var(--dim); }
.mine .l b { font-variant-numeric: tabular-nums; }

.panel { overflow-y: auto; min-height: 0; padding: 18px 22px 40px; }

/* ── l'en-tete du crib ────────────────────────────────────────────────── */
.crib-h { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.crib-h h1 { margin: 0; font-size: 26px; letter-spacing: -0.02em; font-weight: 600; }
.crib-h .co { color: var(--dim); font-size: 13px; margin-bottom: 3px; }
.crib-h .big { margin-left: auto; text-align: right; }
.crib-h .big b { display: block; font-size: 28px; font-weight: 600; color: var(--mandarin); font-variant-numeric: tabular-nums; line-height: 1; }
.crib-h .big i { font-style: normal; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
.stat { background: var(--deep); border: 1.5px solid var(--ink); border-radius: var(--r); padding: 12px 13px; min-width: 0; }
.stat i { display: block; font-style: normal; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); margin-bottom: 5px; }
.stat b { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat s { display: block; text-decoration: none; font-size: 11.5px; color: var(--faint); margin-top: 2px; }

/* ── les onglets et les formulaires ───────────────────────────────────── */
.tabs { display: flex; gap: 7px; margin-bottom: 12px; }
.tab {
  padding: 8px 16px; border-radius: 10px; border: 1.5px solid var(--ink);
  background: var(--deep); cursor: pointer; font-size: 13px; font-weight: 500;
}
.tab.on { background: var(--mandarin); color: var(--ink); font-weight: 600; }

.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card { background: var(--deep); border: 1.5px solid var(--ink); border-radius: var(--r); padding: 15px; min-width: 0; }
.card h3 { margin: 0 0 3px; font-size: 14.5px; font-weight: 600; }
.card .hint { font-size: 12px; color: var(--dim); margin: 0 0 12px; }

.field { display: flex; gap: 8px; align-items: stretch; }
.field input {
  flex: 1; min-width: 0; background: var(--deeper); border: 1.5px solid var(--ink);
  border-radius: 10px; padding: 9px 11px; font-variant-numeric: tabular-nums; font-size: 14px;
}
.field input:focus { outline: none; border-color: var(--mint); }
.field .max {
  border: 1.5px solid var(--ink); border-radius: 10px; background: var(--lift);
  padding: 0 10px; font-size: 11px; cursor: pointer; color: var(--faint);
}
.card .btn { width: 100%; margin-top: 9px; }
.pair { display: grid; gap: 8px; }

.you { display: grid; gap: 6px; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1.5px solid #0B1C71; }
.you .l { display: flex; justify-content: space-between; font-size: 12.5px; }
.you .l i { font-style: normal; color: var(--dim); }
.you .l b { font-variant-numeric: tabular-nums; }
.you .l b.warn { color: var(--mandarin); }
.you .l b.bad { color: var(--red); }

.why {
  margin-top: 10px; font-size: 12px; color: var(--dim);
  border-left: 2.5px solid var(--mandarin); padding-left: 11px;
}

/* ── le mur, en petit, dans l'app ─────────────────────────────────────── */
.wallbox { background: var(--deep); border: 1.5px solid var(--ink); border-radius: var(--r); overflow: hidden; margin-bottom: 18px; }
#wall { height: 168px; }
/* 🔴 width/height explicites : `inset:0` ou un parent seul laissent le canvas a 300x150. */
#wall canvas { display: block; width: 100% !important; height: 100% !important; }
.wallbox .cap { padding: 8px 13px 11px; font-size: 11.5px; color: var(--dim); border-top: 1.5px solid var(--ink); }

.note { font-size: 12px; color: var(--dim); border-left: 2.5px solid var(--mint); padding-left: 12px; margin-top: 16px; }

/* ── responsive. Mesure a 320, 360, 390, 430. ─────────────────────────── */
@media (max-width: 980px) { .stats { grid-template-columns: 1fr 1fr; } .cards { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  main { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  aside { border-right: none; border-bottom: 1.5px solid var(--ink); grid-template-rows: auto auto auto; }
  .list { display: flex; gap: 7px; overflow-x: auto; overflow-y: hidden; padding: 0 10px 10px; }
  .row { min-width: 132px; }
  .row .meter { display: none; }
  .mine { display: none; }
  .panel { padding: 14px 14px 32px; }
  .crib-h .big { margin-left: 0; text-align: left; width: 100%; }
}
@media (max-width: 380px) { .stats { grid-template-columns: 1fr; } }
