
/* ═══════════════════════════════════════════════════════
   DESIGN SYSTEM — TOKENS
   HydroCalc v3 · Unified Design Language
═══════════════════════════════════════════════════════ */
:root {
  /* COULEURS PRIMAIRES */
  --c-primary:    #0A7460;
  --c-primary-d:  #065A48;
  --c-primary-l:  #E0F4F0;
  --c-primary-m:  #7ECABB;

  /* SURFACES */
  --c-bg:         #F3F6F4;
  --c-surface:    #FFFFFF;
  --c-surface-2:  #F8FAF9;
  --c-surface-3:  #EFF3F1;

  /* TEXTE */
  --c-text:       #141C18;
  --c-text-2:     #3A4840;
  --c-text-3:     #617068;
  --c-text-4:     #8A9890;

  /* BORDURES */
  --c-border:     #DEE8E4;
  --c-border-2:   #CDD8D4;

  /* CATÉGORIES */
  --c-anc:        #0A7460;  --c-anc-l:   #E0F4F0;
  --c-ac:         #1550A0;  --c-ac-l:    #E6EEF8;
  --c-ep:         #886000;  --c-ep-l:    #FDF0D8;
  --c-riv:        #0A5090;  --c-riv-l:   #E0ECF8;
  --c-form:       #6B4C00;  --c-form-l:  #FDF4DC;
  --c-regl:       #A02020;  --c-regl-l:  #FCEAEA;
  --c-ref:        #3A4840;  --c-ref-l:   #EFF3F1;
  --c-nc:         #A82018;  --c-nc-l:    #FCEAEA;
  --c-aides:      #166038;  --c-aides-l: #E2F0E8;
  --c-mat:        #2C3A50;  --c-mat-l:   #E8ECF2;

  /* SÉMANTIQUE */
  --c-ok:         #166038;  --c-ok-l:    #E2F0E8;
  --c-warn:       #885800;  --c-warn-l:  #FDF0D4;
  --c-danger:     #A02020;  --c-danger-l:#FCEAEA;
  --c-info:       #1550A0;  --c-info-l:  #E6EEF8;

  /* TYPOGRAPHIE */
  --f-display:    'Fraunces', serif;
  --f-body:       'Outfit', sans-serif;

  /* TAILLES */
  --t-xs:   10px;
  --t-sm:   11px;
  --t-base: 13px;
  --t-md:   14px;
  --t-lg:   16px;
  --t-xl:   20px;
  --t-2xl:  24px;
  --t-3xl:  30px;

  /* ESPACEMENT */
  --s-1: 4px;   --s-2: 8px;   --s-3: 12px;
  --s-4: 16px;  --s-5: 20px;  --s-6: 24px;

  /* BORDURES ARRONDIES */
  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  22px;
  --r-pill:99px;

  /* OMBRES */
  --sh-1:  0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --sh-2:  0 3px 10px rgba(0,0,0,.08), 0 1px 4px rgba(0,0,0,.05);
  --sh-3:  0 8px 24px rgba(0,0,0,.10), 0 2px 8px rgba(0,0,0,.06);

  /* NAVIGATION */
  --nav-h: 62px;
}

/* ─── MODE SOMBRE ─── */
[data-theme="dark"] {
  --c-bg:         #0E1512;
  --c-surface:    #192420;
  --c-surface-2:  #1F2D28;
  --c-surface-3:  #253530;
  --c-text:       #E2EDE8;
  --c-text-2:     #A8C4BC;
  --c-text-3:     #7A9890;
  --c-text-4:     #506860;
  --c-border:     #2A3C38;
  --c-border-2:   #364C47;
  --c-primary-l:  #0A2C28;
  --c-primary-m:  #3A7A70;
  --c-ok-l:       #0A2820;
  --c-warn-l:     #2A1E00;
  --c-danger-l:   #280A0A;
  --c-info-l:     #0A1830;
  --c-anc-l:      #0A2420;
  --c-ac-l:       #0A1428;
  --c-ep-l:       #201400;
  --c-riv-l:      #0A1428;
  --c-form-l:     #201400;
  --c-regl-l:     #280808;
  --c-ref-l:      #1A2420;
  --c-aides-l:    #0A2018;
  --c-mat-l:      #141C28;
  --sh-1:  0 1px 3px rgba(0,0,0,.3), 0 1px 2px rgba(0,0,0,.2);
  --sh-2:  0 3px 10px rgba(0,0,0,.35), 0 1px 4px rgba(0,0,0,.25);
  --sh-3:  0 8px 24px rgba(0,0,0,.45), 0 2px 8px rgba(0,0,0,.3);
}

/* ─── TAILLE DU TEXTE ─── */
[data-font="small"] {
  --t-xs:   9px;  --t-sm: 10px; --t-base: 11px;
  --t-md:   12px; --t-lg: 14px; --t-xl:   18px;
  --t-2xl:  21px; --t-3xl: 26px;
}
[data-font="large"] {
  --t-xs:   11px; --t-sm: 12px; --t-base: 15px;
  --t-md:   16px; --t-lg: 18px; --t-xl:   22px;
  --t-2xl:  27px; --t-3xl: 34px;
}

/* ─── ACCENT BLEU ─── */
[data-accent="blue"] {
  --c-primary:   #1550A0; --c-primary-d: #0E3A78;
  --c-primary-m: #6A9FD8;
}
[data-accent="blue"][data-theme="light"] { --c-primary-l: #E6EEF8; }
[data-accent="blue"][data-theme="dark"]  { --c-primary-l: #0A1428; }

/* ─── ACCENT VIOLET ─── */
[data-accent="violet"] {
  --c-primary:   #5A189A; --c-primary-d: #3D0D6A;
  --c-primary-m: #9A6AD0;
}
[data-accent="violet"][data-theme="light"] { --c-primary-l: #F0E6FF; }
[data-accent="violet"][data-theme="dark"]  { --c-primary-l: #1A0A30; }

/* ─── ACCENT ORANGE ─── */
[data-accent="orange"] {
  --c-primary:   #C05A10; --c-primary-d: #8C3E08;
  --c-primary-m: #E09060;
}
[data-accent="orange"][data-theme="light"] { --c-primary-l: #FEF0E6; }
[data-accent="orange"][data-theme="dark"]  { --c-primary-l: #2A1408; }

/* ─── ACCENT TURQUOISE ─── */
[data-accent="teal"] {
  --c-primary:   #0891B2; --c-primary-d: #066880;
  --c-primary-m: #54C0DA;
}
[data-accent="teal"][data-theme="light"] { --c-primary-l: #E0F5FA; }
[data-accent="teal"][data-theme="dark"]  { --c-primary-l: #041820; }

/* ─── DENSITY COMPACT ─── */
[data-density="compact"] { --s-3: 8px; --s-4: 12px; }
[data-density="airy"]    { --s-3: 16px; --s-4: 24px; }

/* ─── RESET ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; margin: 0; padding: 0; }
body { font-family: var(--f-body); background: var(--c-bg); color: var(--c-text); font-size: var(--t-base); line-height: 1.5; }

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 3px; height: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: var(--r-pill); }

/* ═══ SHELL ═══ */
#shell {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1;
}

/* ─── STATUS BAR ─── */
.status-bar {
  height: 44px; background: var(--c-surface);
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 0 20px 8px; flex-shrink: 0;
  font-size: var(--t-xs); font-weight: 700; color: var(--c-text-2);
}
.sb-right { display: flex; gap: 5px; align-items: center; }

/* ─── TOP BAR ─── */
.top-bar {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  height: 52px;
  display: flex; align-items: center;
  padding: 0 var(--s-4);
  gap: var(--s-2);
  flex-shrink: 0;
  box-shadow: var(--sh-1);
  position: relative; z-index: 10;
}
.top-bar-title {
  font-family: var(--f-display);
  font-size: var(--t-lg);
  color: var(--c-text);
  flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.top-bar-logo { font-family: var(--f-display); font-size: 19px; color: var(--c-primary); flex: 1; }
.tb-icon-btn {
  width: 34px; height: 34px;
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-surface-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; cursor: pointer;
  transition: all .15s;
  flex-shrink: 0;
}
.tb-icon-btn:hover { background: var(--c-primary-l); border-color: var(--c-primary-m); }
.tb-back-btn {
  font-size: 18px; color: var(--c-text-3);
}

/* ─── TAB BAR ─── */
.tab-bar {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  padding: var(--s-2) var(--s-4);
  display: flex; gap: 6px;
  overflow-x: auto; scrollbar-width: none;
  flex-shrink: 0;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-pill {
  padding: 5px 14px;
  border-radius: var(--r-pill);
  font-size: var(--t-xs);
  font-weight: 700;
  border: 1.5px solid var(--c-border);
  background: var(--c-surface-2);
  cursor: pointer;
  white-space: nowrap;
  color: var(--c-text-3);
  transition: all .15s;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.tab-pill.active {
  background: var(--c-primary);
  color: #fff;
  border-color: var(--c-primary);
}

/* ─── MAIN SCROLL ─── */
.main-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  position: relative;
}

/* ─── BOTTOM NAV ─── */
.bottom-nav {
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
  height: var(--nav-h);
  display: flex;
  flex-shrink: 0;
  box-shadow: 0 -2px 12px rgba(0,0,0,.06);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; cursor: pointer;
  border: none; background: none;
  padding: var(--s-2) 0; transition: all .15s;
  position: relative;
}
.nav-btn::before {
  content: '';
  position: absolute; top: 0; left: 25%; right: 25%; height: 2px;
  background: var(--c-primary); border-radius: 0 0 var(--r-sm) var(--r-sm);
  opacity: 0; transition: opacity .15s;
}
.nav-btn.active::before { opacity: 1; }
.nav-ico { font-size: 22px; transition: transform .2s ease; }
.nav-lbl {
  font-size: 9px; font-weight: 700;
  color: var(--c-text-4); letter-spacing: .04em;
  text-transform: uppercase; transition: color .15s;
}
.nav-btn.active .nav-lbl { color: var(--c-primary); }
.nav-btn.active .nav-ico { transform: scale(1.1) translateY(-1px); }

/* ═══ COMPOSANTS ═══ */

/* ─── HERO ─── */
.module-hero {
  background: linear-gradient(145deg, var(--cat-color, #0A7460), color-mix(in srgb, var(--cat-color, #0A7460) 70%, #000));
  padding: var(--s-5) var(--s-4) var(--s-4);
  position: relative; overflow: hidden;
}
.module-hero::after {
  content: '';
  position: absolute; right: -30px; top: -30px;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
  pointer-events: none;
}
.mh-icon { font-size: 34px; margin-bottom: var(--s-2); display: block; }
.mh-title {
  font-family: var(--f-display);
  font-size: var(--t-2xl);
  color: #fff;
  margin-bottom: 4px;
  letter-spacing: -.02em;
  line-height: 1.2;
}
.mh-sub { font-size: var(--t-sm); color: rgba(255,255,255,.72); line-height: 1.6; margin-bottom: var(--s-2); }
.mh-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.mh-tag {
  font-size: 9px; font-weight: 700;
  padding: 2px 9px; border-radius: var(--r-pill);
  background: rgba(255,255,255,.18); color: #fff;
  letter-spacing: .03em; backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,.2);
}

/* ─── SECTION HEADER ─── */
.section-header {
  font-size: 13px; font-weight: 800;
  color: var(--c-text-1);
  text-transform: uppercase; letter-spacing: .06em;
  padding: var(--s-4) var(--s-4) var(--s-2);
  display: flex; align-items: center; justify-content: space-between;
}
.section-header + .section-header { padding-top: var(--s-2); }
.sh-count {
  font-size: var(--t-xs); font-weight: 500;
  color: var(--c-text-4);
}

/* ─── CARD ─── */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
  overflow: hidden;
  transition: box-shadow .18s, transform .18s;
}
.card:active { transform: scale(.99); }
.card.hoverable:hover { box-shadow: var(--sh-2); }
.card-p { padding: var(--s-3) var(--s-4); }
.card + .card { margin-top: var(--s-2); }

/* ─── KV GRID ─── */
.kv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.kv-item {
  background: var(--c-surface-2);
  border-radius: var(--r-sm);
  padding: var(--s-2) var(--s-3);
}
.kv-item.full { grid-column: 1 / -1; }
.kv-key {
  font-size: 9px; font-weight: 700;
  color: var(--c-text-4);
  text-transform: uppercase; letter-spacing: .05em;
  margin-bottom: 3px;
}
.kv-val {
  font-size: var(--t-sm); font-weight: 500;
  color: var(--c-text); line-height: 1.4;
}

/* ─── BADGE / TAG ─── */
.badge {
  display: inline-flex; align-items: center;
  font-size: 9px; font-weight: 700;
  padding: 2px 8px; border-radius: var(--r-pill);
  letter-spacing: .03em;
}
.badge-primary  { background: var(--c-primary-l); color: var(--c-primary); }
.badge-ok       { background: var(--c-ok-l);      color: var(--c-ok);      }
.badge-warn     { background: var(--c-warn-l);     color: var(--c-warn);    }
.badge-danger   { background: var(--c-danger-l);   color: var(--c-danger);  }
.badge-info     { background: var(--c-info-l);     color: var(--c-info);    }
.badge-new      { background: var(--c-primary);    color: #fff;             }

/* ─── ALERT ─── */
.alert {
  border-radius: var(--r-sm);
  padding: var(--s-2) var(--s-3);
  font-size: var(--t-sm); line-height: 1.65;
  border-left: 3px solid;
  display: flex; gap: var(--s-2); align-items: flex-start;
}
.alert-icon { flex-shrink: 0; font-size: 13px; }
.alert.ok      { background: var(--c-ok-l);     color: var(--c-ok);     border-color: var(--c-ok);     }
.alert.warn    { background: var(--c-warn-l);   color: var(--c-warn);   border-color: var(--c-warn);   }
.alert.danger  { background: var(--c-danger-l); color: var(--c-danger); border-color: var(--c-danger); }
.alert.info    { background: var(--c-info-l);   color: var(--c-info);   border-color: var(--c-info);   }

/* ─── FORMULA BOX ─── */
.formula-box {
  background: var(--c-surface-2);
  border-left: 2px solid var(--c-primary);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: var(--s-2) var(--s-3);
  font-family: 'Courier New', monospace;
  font-size: var(--t-sm); color: var(--c-primary);
  line-height: 1.7;
}

/* ─── SOURCE PILL ─── */
.src-pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; color: var(--c-primary);
  background: var(--c-primary-l);
  padding: 3px 10px; border-radius: var(--r-pill);
  margin-top: 6px;
}

/* ─── CALC ZONE ─── */
.calc-zone { background: var(--c-surface-3); border-radius: var(--r-md); padding: var(--s-3); }
.calc-zone .card-p + .card-p { border-top: 1px solid var(--c-border); }

.field { margin-bottom: var(--s-3); }
.field:last-child { margin-bottom: 0; }
.field-label {
  font-size: var(--t-sm); font-weight: 700;
  color: var(--c-text); margin-bottom: 3px;
  display: flex; align-items: center; gap: 6px;
}
.field-hint { font-size: 10px; color: var(--c-text-3); line-height: 1.5; margin-bottom: 4px; }
.field-tip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; color: var(--c-warn);
  background: var(--c-warn-l); padding: 2px 8px;
  border-radius: var(--r-pill); margin-bottom: 5px;
}
.field-row { display: flex; align-items: center; gap: var(--s-2); }
.field-row input, .field-row select {
  flex: 1; max-width: 140px;
  padding: 9px 12px;
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-sm);
  font-family: var(--f-body); font-size: var(--t-base); font-weight: 600;
  color: var(--c-text); background: var(--c-surface);
  transition: border .15s, box-shadow .15s;
  appearance: none;
}
.field-row input:focus, .field-row select:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-l);
}
.field-unit { font-size: var(--t-sm); color: var(--c-text-3); white-space: nowrap; }

/* ─── BOUTONS ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: var(--f-body); font-weight: 700;
  border: none; border-radius: var(--r-sm);
  cursor: pointer; transition: all .15s;
  letter-spacing: .02em;
}
.btn-primary {
  background: var(--c-primary); color: #fff;
  padding: 11px var(--s-4); font-size: var(--t-base);
  width: 100%; border-radius: var(--r-md);
  box-shadow: 0 2px 8px rgba(10,116,96,.3);
}
.btn-primary:hover { background: var(--c-primary-d); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(10,116,96,.35); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost {
  background: transparent; color: var(--c-text-3);
  padding: 9px var(--s-4); font-size: var(--t-sm);
  width: 100%; border: 1.5px solid var(--c-border);
  border-radius: var(--r-md);
}

/* ─── RESULT BOX ─── */
.result-box {
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  margin-top: var(--s-3);
  display: none;
  border-left: 4px solid var(--c-primary);
}
.result-box.show { display: block; animation: fadeIn .22s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.result-value {
  font-family: var(--f-display);
  font-size: var(--t-2xl); color: var(--c-primary);
  margin-bottom: 5px; line-height: 1.2;
}
.result-detail {
  font-size: var(--t-sm); color: var(--c-text-3);
  line-height: 1.85; margin-bottom: 6px;
}
.result-formula {
  font-size: 12px; color: var(--c-text-4);
  font-style: normal;
  padding-top: 8px; border-top: 1px solid var(--c-border);
  margin-top: 8px;
  line-height: 2.2;
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 2px;
}
.rf-sep { margin: 0 6px; opacity: 0.5; font-size: 14px; }
.mf {
  display: inline-flex; flex-direction: column; align-items: center;
  vertical-align: middle; margin: 0 2px; line-height: 1.15;
}
.mf .n { border-bottom: 1.5px solid currentColor; padding: 0 4px 2px; text-align: center; font-size: 0.88em; }
.mf .d { padding: 2px 4px 0; text-align: center; font-size: 0.88em; }
.msq { display: inline-flex; align-items: center; vertical-align: middle; }
.msq .rd { border-top: 1.5px solid currentColor; padding: 1px 3px 0; margin-left: 1px; }
.result-src { font-size: 10px; color: var(--c-primary); margin-top: 4px; }

/* ─── MODULE CARD (liste modules) ─── */
.mod-list-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
  padding: var(--s-3) var(--s-4);
  display: flex; align-items: flex-start; gap: var(--s-3);
  cursor: pointer; transition: all .18s;
  position: relative; overflow: hidden;
}
.mod-list-card::before {
  content: ''; position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--cat-color, var(--c-primary));
  border-radius: var(--r-sm) 0 0 var(--r-sm);
}
.mod-list-card:hover { box-shadow: var(--sh-2); transform: translateX(2px); }
.mlc-icon {
  width: 42px; height: 42px; flex-shrink: 0;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  background: color-mix(in srgb, var(--cat-color, var(--c-primary)) 12%, transparent);
}
.mlc-body { flex: 1; min-width: 0; }
.mlc-name { font-size: var(--t-base); font-weight: 700; margin-bottom: 2px; }
.mlc-sub { font-size: var(--t-sm); color: var(--c-text-3); line-height: 1.4; margin-bottom: 5px; }
.mlc-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.mlc-tag {
  font-size: 9px; font-weight: 700; padding: 1px 7px;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--cat-color, var(--c-primary)) 10%, transparent);
  color: var(--cat-color, var(--c-primary));
  border: 1px solid color-mix(in srgb, var(--cat-color, var(--c-primary)) 25%, transparent);
}
.mlc-arrow { font-size: 18px; color: var(--c-text-4); flex-shrink: 0; align-self: center; }

/* ─── FICHE / OUVRAGE CARD ─── */
.fiche-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow .18s;
}
.fiche-card:hover { box-shadow: var(--sh-2); }
.fiche-stripe { height: 3px; width: 100%; }
.fiche-head { padding: var(--s-3) var(--s-4); display: flex; align-items: center; gap: var(--s-3); }
.fiche-icon {
  width: 42px; height: 42px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center; font-size: 20px;
  flex-shrink: 0;
}
.fiche-name { font-size: var(--t-sm); font-weight: 700; margin-bottom: 2px; }
.fiche-sub { font-size: 10px; color: var(--c-text-3); }
.fiche-arrow { font-size: 18px; color: var(--c-text-4); margin-left: auto; }
.fiche-body {
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--c-border);
  display: none;
}
.fiche-body.open { display: block; animation: fadeIn .2s ease; }
.fiche-desc { font-size: var(--t-sm); color: var(--c-text-3); line-height: 1.8; margin-bottom: var(--s-3); }

/* ─── GLOSSAIRE ITEM ─── */
.gloss-item {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  box-shadow: var(--sh-1);
}
.gi-top { display: flex; align-items: baseline; gap: var(--s-2); flex-wrap: wrap; margin-bottom: 5px; }
.gi-word { font-size: var(--t-md); font-weight: 700; color: var(--c-text); }
.gi-en { font-size: var(--t-sm); color: var(--c-text-4); font-style: italic; flex: 1; }
.gi-def { font-size: var(--t-sm); color: var(--c-text-3); line-height: 1.78; }
.gi-formula {
  font-family: 'Courier New', monospace; font-size: 10px;
  color: var(--c-primary); background: var(--c-primary-l);
  padding: 3px 9px; border-radius: 6px;
  margin-top: 5px; display: inline-block;
}

/* ─── QCM ─── */
.qcm-wrap { padding: var(--s-4); }
.qcm-progress { height: 3px; background: var(--c-border); border-radius: var(--r-pill); margin-bottom: var(--s-3); overflow: hidden; }
.qcm-fill { height: 100%; background: var(--c-primary); border-radius: var(--r-pill); transition: width .4s ease; }
.qcm-meta { display: flex; justify-content: space-between; margin-bottom: var(--s-3); font-size: var(--t-xs); color: var(--c-text-3); font-weight: 700; }
.qcm-question { font-size: var(--t-md); font-weight: 600; color: var(--c-text); line-height: 1.55; margin-bottom: var(--s-4); }
.qcm-choices { display: flex; flex-direction: column; gap: var(--s-2); }
.qcm-choice {
  text-align: left; padding: 11px var(--s-3);
  border: 1.5px solid var(--c-border); border-radius: var(--r-sm);
  background: var(--c-surface-2);
  font-family: var(--f-body); font-size: var(--t-sm);
  cursor: pointer; color: var(--c-text); line-height: 1.4;
  transition: all .15s;
}
.qcm-choice:hover:not(:disabled) { border-color: var(--c-primary); background: var(--c-primary-l); color: var(--c-primary); }
.qcm-choice.correct { background: var(--c-ok-l) !important; border-color: var(--c-ok) !important; color: var(--c-ok) !important; font-weight: 600; }
.qcm-choice.wrong   { background: var(--c-danger-l) !important; border-color: var(--c-danger) !important; color: var(--c-danger) !important; }
.qcm-feedback { padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); font-size: var(--t-sm); line-height: 1.6; margin-top: var(--s-3); display: none; }
.qcm-next {
  width: 100%; margin-top: var(--s-3); padding: 10px;
  background: var(--c-primary); color: #fff; border: none;
  border-radius: var(--r-md); font-family: var(--f-body);
  font-size: var(--t-sm); font-weight: 700; cursor: pointer;
  display: none; transition: background .15s;
}

/* ─── HOME HERO ─── */
.home-hero {
  background: linear-gradient(145deg, #072018, #0A3828, #0A5040);
  padding: var(--s-5) var(--s-4) var(--s-4);
  position: relative; overflow: hidden;
}
.home-hero::before {
  content: '';
  position: absolute; right: -40px; bottom: -40px;
  width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle, rgba(10,116,96,.3) 0%, transparent 70%);
}
.hh-brand { display: flex; align-items: center; gap: 10px; margin-bottom: var(--s-4); }
.hh-icon { width: 46px; height: 46px; background: rgba(255,255,255,.12); border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 24px; backdrop-filter: blur(4px); }
.hh-name { font-family: var(--f-display); font-size: 22px; color: #fff; margin-bottom: 2px; }
.hh-sub { font-size: var(--t-xs); color: rgba(255,255,255,.55); letter-spacing: .04em; text-transform: uppercase; }
.hh-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-2); }
.hs-item { background: rgba(255,255,255,.09); border-radius: var(--r-md); padding: 10px; text-align: center; border: 1px solid rgba(255,255,255,.08); }
.hs-val { font-family: var(--f-display); font-size: 23px; color: #96F0D8; margin-bottom: 2px; }
.hs-lbl { font-size: 9px; color: rgba(255,255,255,.5); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }

/* ─── HOME SHORTCUTS GRID ─── */
.home-sc-card {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--s-3) var(--s-3);
  cursor: pointer;
  transition: background .15s, transform .1s;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 80px;
}
.home-sc-card:active { background: var(--c-surface-3); transform: scale(.97); }
.hsc-ico { font-size: 26px; line-height: 1; }
.hsc-name { font-size: var(--t-sm); font-weight: 700; color: var(--c-text-1); line-height: 1.2; }
.hsc-sub { font-size: 10px; color: var(--c-text-3); line-height: 1.3; }

/* ─── SEARCH BAR ─── */
.search-container { padding: var(--s-3) var(--s-4); background: var(--c-bg); }
.search-bar {
  display: flex; align-items: center; gap: var(--s-2);
  background: var(--c-surface); border: 1.5px solid var(--c-border);
  border-radius: var(--r-pill); padding: 9px var(--s-4);
  box-shadow: var(--sh-1); transition: border .15s;
}
.search-bar:focus-within { border-color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-primary-l); }
.search-bar input {
  flex: 1; border: none; background: none;
  font-family: var(--f-body); font-size: var(--t-sm);
  color: var(--c-text);
}
.search-bar input:focus { outline: none; }
.search-bar input::placeholder { color: var(--c-text-4); }
.search-ico { font-size: 15px; color: var(--c-text-4); }

/* ─── RECENTS CHIPS ─── */
.recent-section { padding: 0 var(--s-4); margin-bottom: 2px; }
.recent-chips { display: flex; gap: var(--s-2); overflow-x: auto; scrollbar-width: none; padding: 2px 0 var(--s-2); }
.recent-chips::-webkit-scrollbar { display: none; }
.recent-chip {
  display: flex; align-items: center; gap: 6px;
  background: var(--c-surface); border: 1.5px solid var(--c-border);
  border-radius: var(--r-pill); padding: 6px 12px;
  font-size: var(--t-sm); font-weight: 600; white-space: nowrap;
  cursor: pointer; flex-shrink: 0;
  box-shadow: var(--sh-1); transition: all .15s;
}
.recent-chip:hover { border-color: var(--c-primary-m); background: var(--c-primary-l); color: var(--c-primary); }

/* ─── MODULE GRID ─── */
.mod-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); padding: 0 var(--s-4); }
.mod-grid-card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r-md); padding: var(--s-3);
  cursor: pointer; transition: all .18s;
  box-shadow: var(--sh-1); position: relative; overflow: hidden;
}
.mod-grid-card::after { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--cat-color, var(--c-primary)); }
.mod-grid-card:hover { box-shadow: var(--sh-2); transform: translateY(-2px); }
.mod-grid-card:active { transform: translateY(0); }
.mgc-icon { font-size: 26px; margin-bottom: var(--s-2); display: block; }
.mgc-name { font-size: 12px; font-weight: 700; margin-bottom: 2px; line-height: 1.3; }
.mgc-sub { font-size: 10px; color: var(--c-text-3); line-height: 1.4; margin-bottom: var(--s-2); }
.mgc-tags { display: flex; gap: 3px; flex-wrap: wrap; }
.mgc-tag { font-size: 8px; font-weight: 700; padding: 1px 6px; border-radius: var(--r-pill); background: color-mix(in srgb, var(--cat-color, var(--c-primary)) 12%, transparent); color: var(--cat-color, var(--c-primary)); }
.mod-grid-card.span2 { grid-column: 1 / -1; display: flex; align-items: center; gap: var(--s-3); }
.mod-grid-card.span2 .mgc-icon { font-size: 32px; margin-bottom: 0; flex-shrink: 0; }
.mod-grid-card.span2 .mgc-name { font-size: var(--t-md); }
.new-badge {
  position: absolute; top: var(--s-2); right: var(--s-2);
  background: var(--c-primary); color: #fff;
  font-size: 8px; font-weight: 800; padding: 1px 6px;
  border-radius: var(--r-pill);
}

/* ─── SEPARATOR ─── */
.separator { height: 1px; background: var(--c-border); margin: 0 var(--s-4); }

/* ─── DEPT CARD (SPANC) ─── */
.dept-card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r-md); overflow: hidden;
  box-shadow: var(--sh-1);
  border-left: 3px solid var(--c-primary);
}
.dc-head { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); }
.dc-num {
  width: 36px; height: 36px; border-radius: var(--r-sm);
  background: var(--c-primary-l); display: flex; align-items: center;
  justify-content: center; font-size: var(--t-xs); font-weight: 800;
  color: var(--c-primary); flex-shrink: 0;
}
.dc-name { font-size: var(--t-md); font-weight: 700; }
.dc-region { font-size: var(--t-sm); color: var(--c-text-3); }

/* ─── AIDE CARD ─── */
.aide-card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r-md); box-shadow: var(--sh-1);
  overflow: hidden;
}
.ac-top { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); }
.ac-icon { width: 42px; height: 42px; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.ac-info { flex: 1; }
.ac-name { font-size: var(--t-sm); font-weight: 700; margin-bottom: 2px; }
.ac-org { font-size: 10px; color: var(--c-text-3); }
.ac-amount { font-size: var(--t-sm); font-weight: 800; padding: 4px 11px; border-radius: var(--r-pill); color: #fff; white-space: nowrap; flex-shrink: 0; }
.ac-body { padding: 0 var(--s-4) var(--s-3); font-size: var(--t-sm); color: var(--c-text-3); line-height: 1.75; border-top: 1px solid var(--c-border); padding-top: var(--s-2); }

/* ─── REGLM CARD ─── */
.regl-card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r-md); box-shadow: var(--sh-1);
  overflow: hidden;
}
.rc-head { display: flex; align-items: flex-start; gap: var(--s-3); padding: var(--s-3) var(--s-4); }
.rc-icon { width: 44px; height: 44px; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.rc-name { font-size: var(--t-md); font-weight: 700; margin-bottom: 3px; line-height: 1.4; }
.rc-ref { font-size: 12px; color: var(--c-text-3); line-height: 1.5; }
.rc-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.rc-year { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: var(--r-pill); background: var(--c-surface-2); color: var(--c-text-3); border: 1px solid var(--c-border); }
.rc-pts { padding: 0 var(--s-4) var(--s-3); display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--c-border); padding-top: var(--s-2); }
.rc-pt { font-size: var(--t-sm); padding: 5px 10px; border-radius: var(--r-sm); line-height: 1.55; border-left: 3px solid; }

/* SCROLL PADDING BOTTOM */
.main-scroll > *:last-child { margin-bottom: var(--s-6); }
.pb-nav { height: var(--s-4); }

/* ─── AUTHENTIFICATION ─── */
.auth-screen {
  position: fixed; inset: 0; z-index: 999;
  display: flex; flex-direction: column;
  background: var(--c-bg);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.auth-screen.hidden { display: none; }

/* Splash auth */
.auth-splash {
  background: linear-gradient(160deg, #061410, #0A2820, #0A5040);
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: var(--s-6) var(--s-5);
}
.auth-logo { font-size: 56px; margin-bottom: var(--s-4); animation: authFloat 3s ease infinite; }
@keyframes authFloat { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-6px)} }
.auth-app-name { font-family: var(--f-display); font-size: 34px; color: #fff; margin-bottom: 6px; letter-spacing: -.02em; }
.auth-tagline { font-size: 12px; color: rgba(255,255,255,.55); margin-bottom: 48px; text-align: center; line-height: 1.6; max-width: 280px; }
.auth-btns { display: flex; flex-direction: column; gap: var(--s-3); width: 100%; max-width: 320px; }
.auth-btn {
  padding: 14px var(--s-4); border-radius: var(--r-lg);
  font-family: var(--f-body); font-size: var(--t-md); font-weight: 700;
  cursor: pointer; border: none; transition: all .15s;
  display: flex; align-items: center; gap: var(--s-3);
}
.auth-btn-primary { background: var(--c-primary); color: #fff; box-shadow: 0 4px 20px rgba(10,116,96,.4); }
.auth-btn-primary:hover { background: var(--c-primary-d); transform: translateY(-2px); }
.auth-btn-outline { background: rgba(255,255,255,.1); color: #fff; border: 1.5px solid rgba(255,255,255,.25); }
.auth-btn-outline:hover { background: rgba(255,255,255,.18); }
.auth-btn-ico { font-size: 20px; flex-shrink: 0; }
.auth-btn-text { text-align: left; }
.auth-btn-title { font-size: 14px; font-weight: 700; }
.auth-btn-sub { font-size: 10px; opacity: .75; font-weight: 400; }
.auth-version { position: absolute; bottom: 20px; font-size: 10px; color: rgba(255,255,255,.25); }

.auth-modules {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 8px; width: 100%; max-width: 320px; margin: 18px 0 14px;
}
.auth-mod {
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.10);
  border-radius: 10px; padding: 10px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  transition: background .15s;
}
.auth-mod span:first-child { font-size: 20px; }
.auth-mod span:last-child { font-size: 9px; color: rgba(255,255,255,.5); font-weight: 500; }

.auth-stats {
  display: flex; width: 100%; max-width: 320px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px; overflow: hidden; margin-bottom: 20px;
}
.auth-stat {
  flex: 1; text-align: center; padding: 10px 0;
  border-right: 1px solid rgba(255,255,255,.08);
}
.auth-stat:last-child { border-right: none; }
.auth-stat-n { font-size: 18px; font-weight: 700; color: var(--c-primary-m, #5DCAA5); line-height: 1; }
.auth-stat-l { font-size: 9px; color: rgba(255,255,255,.4); margin-top: 3px; }

/* Formulaire auth */
.auth-form-wrap { flex: 1; display: flex; flex-direction: column; }
.auth-form-hdr {
  background: var(--c-surface); border-bottom: 1px solid var(--c-border);
  padding: 0 var(--s-4); height: 52px;
  display: flex; align-items: center; gap: var(--s-3);
  box-shadow: var(--sh-1); flex-shrink: 0;
}
.auth-back {
  width: 34px; height: 34px; border: 1.5px solid var(--c-border);
  border-radius: var(--r-sm); background: var(--c-surface-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; cursor: pointer; color: var(--c-text-3);
  transition: all .15s; flex-shrink: 0;
}
.auth-back:hover { background: var(--c-primary-l); border-color: var(--c-primary-m); }
.auth-hdr-title { font-family: var(--f-display); font-size: var(--t-lg); flex: 1; }
.auth-body { flex: 1; padding: var(--s-5) var(--s-4); }
.auth-icon { font-size: 44px; text-align: center; margin-bottom: var(--s-3); }
.auth-title { font-family: var(--f-display); font-size: 24px; text-align: center; margin-bottom: 5px; }
.auth-sub { font-size: 12px; color: var(--c-text-3); text-align: center; line-height: 1.65; margin-bottom: var(--s-5); }
.auth-label { font-size: 11px; font-weight: 700; color: var(--c-text); margin-bottom: 5px; display: block; }
.auth-input {
  width: 100%; padding: 11px var(--s-3);
  border: 1.5px solid var(--c-border); border-radius: var(--r-sm);
  font-family: var(--f-body); font-size: var(--t-base); color: var(--c-text);
  background: var(--c-surface-2); margin-bottom: var(--s-3);
  transition: border .15s, box-shadow .15s;
}
.auth-input:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-primary-l); }
.auth-pwd-wrap { position: relative; width: 100%; }
.auth-pwd-wrap .auth-input { padding-right: 42px; }
.auth-pwd-toggle {
  position: absolute; right: 10px; top: 0; bottom: var(--s-3);
  height: 44px; width: 28px; display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer; font-size: 16px; color: var(--c-text-3);
  padding: 0;
}
.auth-btn-submit {
  width: 100%; padding: 13px; background: var(--c-primary); color: #fff;
  border: none; border-radius: var(--r-lg); font-family: var(--f-body);
  font-size: var(--t-base); font-weight: 700; cursor: pointer;
  transition: all .15s; margin-top: 4px;
  box-shadow: 0 2px 8px rgba(10,116,96,.3);
}
.auth-btn-submit:hover { background: var(--c-primary-d); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(10,116,96,.35); }
.auth-btn-ghost {
  width: 100%; padding: 11px; background: transparent;
  border: 1.5px solid var(--c-border); border-radius: var(--r-lg);
  font-family: var(--f-body); font-size: 13px; color: var(--c-text-3);
  cursor: pointer; margin-top: var(--s-2); transition: all .15s;
}
.auth-btn-ghost:hover { border-color: var(--c-primary-m); color: var(--c-primary); }
.auth-divider { display: flex; align-items: center; gap: var(--s-3); margin: var(--s-4) 0; }
.auth-divider-line { flex: 1; height: 1px; background: var(--c-border); }
.auth-divider-txt { font-size: 11px; color: var(--c-text-4); }
.auth-error {
  background: var(--c-danger-l); color: var(--c-danger);
  border-radius: var(--r-sm); padding: var(--s-2) var(--s-3);
  font-size: 12px; margin-bottom: var(--s-2); display: none;
  border-left: 3px solid var(--c-danger);
}
.auth-hint { font-size: 10px; color: var(--c-text-4); text-align: center; line-height: 1.6; margin-top: var(--s-3); }
.auth-link { color: var(--c-primary); font-weight: 700; cursor: pointer; text-decoration: none; }

/* Profil utilisateur */
.profile-hero {
  background: linear-gradient(135deg, var(--c-primary-d), var(--c-primary));
  padding: var(--s-5) var(--s-4) var(--s-4); text-align: center;
}
.profile-avatar {
  width: 68px; height: 68px; border-radius: 50%;
  background: rgba(255,255,255,.2); margin: 0 auto var(--s-3);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--f-display); font-size: 26px; color: #fff;
  border: 3px solid rgba(255,255,255,.3);
}
.profile-name { font-family: var(--f-display); font-size: 22px; color: #fff; margin-bottom: 4px; }
.profile-email { font-size: 11px; color: rgba(255,255,255,.65); margin-bottom: var(--s-3); }
.profile-plan-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 14px; border-radius: var(--r-pill);
  font-size: 11px; font-weight: 700;
}
.plan-free-badge  { background: rgba(255,255,255,.15); color: #fff; }
.plan-pro-badge   { background: #C8B4FF; color: #1A0850; }
.plan-etab-badge  { background: #96F0D8; color: #065A48; }

.profile-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: var(--s-2); margin-top: var(--s-3); }
.pstat { background: rgba(255,255,255,.1); border-radius: var(--r-md); padding: 10px; text-align: center; }
.pstat-val { font-family: var(--f-display); font-size: 20px; color: #96F0D8; margin-bottom: 2px; }
.pstat-lbl { font-size: 9px; color: rgba(255,255,255,.55); text-transform: uppercase; letter-spacing: .05em; }

/* Plan card dans profil */
.plan-row {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r-lg); padding: var(--s-3) var(--s-4);
  margin: 0 var(--s-4) var(--s-2); box-shadow: var(--sh-1);
  cursor: pointer; transition: all .15s; display: flex; align-items: center; gap: var(--s-3);
}
.plan-row:hover { box-shadow: var(--sh-2); transform: translateX(2px); }
.plan-row-ico { font-size: 24px; flex-shrink: 0; }
.plan-row-info { flex: 1; }
.plan-row-name { font-size: var(--t-sm); font-weight: 700; margin-bottom: 2px; }
.plan-row-desc { font-size: 10px; color: var(--c-text-3); }
.plan-row-price { font-family: var(--f-display); font-size: var(--t-lg); color: var(--c-primary); flex-shrink: 0; }
.plan-row.current { border-color: var(--c-primary); border-width: 2px; }
.plan-row.current .plan-row-name::after { content: ' ✓'; color: var(--c-primary); }

/* Plan upgrade banner */
.upgrade-banner {
  background: linear-gradient(135deg, #1A0850, #2D1580);
  border-radius: var(--r-xl); padding: var(--s-4);
  margin: var(--s-3) var(--s-4);
  display: flex; align-items: center; gap: var(--s-3);
}
.ub-ico { font-size: 30px; flex-shrink: 0; }
.ub-text { flex: 1; }
.ub-title { font-size: 13px; font-weight: 700; color: #fff; margin-bottom: 3px; }
.ub-sub { font-size: 11px; color: rgba(255,255,255,.65); line-height: 1.5; }
.ub-btn {
  padding: 8px 14px; background: #C8B4FF; color: #1A0850;
  border: none; border-radius: var(--r-pill);
  font-size: 11px; font-weight: 800; cursor: pointer;
  font-family: var(--f-body); white-space: nowrap; flex-shrink: 0;
}

/* Toast auth */
#auth-toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: var(--c-text); color: #fff; padding: 8px 16px;
  border-radius: var(--r-pill); font-size: 12px; font-weight: 600;
  z-index: 9999; opacity: 0; transition: opacity .3s; pointer-events: none;
  white-space: nowrap;
}
#auth-toast.show { opacity: 1; }

/* ─── BOUTON SAUVEGARDE FLOTTANT ─── */
.fab-save {
  position: fixed;
  right: 16px;
  bottom: calc(var(--nav-h) + 16px);
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--c-primary);
  color: #fff; border: none;
  font-size: 22px; cursor: pointer;
  box-shadow: 0 4px 16px rgba(10,116,96,.45);
  z-index: 50;
  display: none;
  align-items: center; justify-content: center;
  transition: transform .15s, background .15s;
}
.fab-save:active { transform: scale(.9); }
.fab-save.show { display: flex; }

/* ─── HISTORIQUE DES CALCULS ─── */
.calc-hist-item {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--s-3) var(--s-4);
  margin: 0 var(--s-4) var(--s-2);
  box-shadow: var(--sh-1);
}
.chi-head { display: flex; align-items: center; gap: var(--s-2); margin-bottom: 4px; }
.chi-module {
  font-size: 9px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .05em; padding: 2px 8px; border-radius: var(--r-pill);
  background: var(--c-primary-l); color: var(--c-primary);
}
.chi-date { font-size: 10px; color: var(--c-text-4); margin-left: auto; }
.chi-value { font-family: var(--f-display); font-size: var(--t-md); color: var(--c-primary); margin: 2px 0; }
.chi-detail { font-size: 11px; color: var(--c-text-3); line-height: 1.6; }
.chi-del {
  background: none; border: none; color: var(--c-danger);
  font-size: 16px; cursor: pointer; padding: 2px 6px;
}

/* ─── SIDEBAR ─── */
.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 199;
  opacity: 0; pointer-events: none;
  transition: opacity .28s;
}
.sidebar-overlay.open { opacity: 1; pointer-events: all; }

.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: 300px;
  background: var(--c-surface);
  z-index: 200;
  transform: translateX(-100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
  box-shadow: 4px 0 24px rgba(0,0,0,.15);
  overflow: hidden;
}
.sidebar.open { transform: translateX(0); }

.sidebar-hdr {
  background: linear-gradient(135deg, #061410, #0A3828);
  padding: 48px var(--s-4) var(--s-4);
  flex-shrink: 0;
}
.sidebar-logo { font-size: 32px; margin-bottom: 6px; }
.sidebar-app-name { font-family: var(--f-display); font-size: 20px; color: #fff; margin-bottom: 2px; }
.sidebar-tagline { font-size: 10px; color: rgba(255,255,255,.5); letter-spacing: .04em; }
.sidebar-close {
  position: absolute; top: 12px; right: 12px;
  width: 32px; height: 32px;
  background: rgba(255,255,255,.12); border: none;
  border-radius: var(--r-sm); color: #fff;
  font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

.sidebar-body { flex: 1; overflow-y: auto; padding: var(--s-4) var(--s-3); }

.sidebar-section-title {
  font-size: 9px; font-weight: 800; color: var(--c-text-4);
  text-transform: uppercase; letter-spacing: .08em;
  margin-bottom: var(--s-3); padding-left: 4px;
}

/* Plans */
.plan-card {
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-md);
  padding: var(--s-3);
  margin-bottom: var(--s-2);
  transition: all .15s;
  cursor: pointer;
}
.plan-card:hover { box-shadow: var(--sh-2); }
.plan-card.current { border-color: var(--c-primary); border-width: 2px; }
.plan-card-top { display: flex; align-items: center; gap: var(--s-2); margin-bottom: var(--s-2); }
.plan-card-ico { font-size: 22px; }
.plan-card-name { font-size: var(--t-sm); font-weight: 800; flex: 1; }
.plan-card-price { font-family: var(--f-display); font-size: var(--t-lg); color: var(--c-primary); }
.plan-card-price span { font-size: 10px; font-weight: 400; color: var(--c-text-3); }
.plan-card-desc { font-size: 10px; color: var(--c-text-3); line-height: 1.6; margin-bottom: var(--s-2); }
.plan-card-features { display: flex; flex-direction: column; gap: 3px; }
.plan-feat { font-size: 10px; color: var(--c-text-3); display: flex; gap: 5px; align-items: flex-start; }
.plan-feat.ok { color: var(--c-ok); }
.plan-feat.no { color: var(--c-text-4); text-decoration: line-through; }
.plan-card-btn {
  width: 100%; margin-top: var(--s-2);
  padding: 8px; border-radius: var(--r-sm);
  font-family: var(--f-body); font-size: 12px; font-weight: 700;
  border: none; cursor: pointer; transition: all .15s;
}
.plan-btn-primary { background: var(--c-primary); color: #fff; }
.plan-btn-current { background: var(--c-primary-l); color: var(--c-primary); }
.plan-btn-outline { background: transparent; border: 1.5px solid var(--c-border) !important; color: var(--c-text-3); }

/* Tableau comparaison */
.compare-table { width: 100%; border-collapse: collapse; font-size: 10px; margin-top: var(--s-3); }
.compare-table th {
  background: var(--c-surface-3); padding: 6px 4px;
  text-align: center; font-weight: 800; color: var(--c-text-2);
  border-bottom: 2px solid var(--c-border);
}
.compare-table th:first-child { text-align: left; }
.compare-table td { padding: 5px 4px; border-bottom: 1px solid var(--c-border); color: var(--c-text-3); }
.compare-table td:first-child { font-weight: 600; color: var(--c-text-2); }
.compare-table td:not(:first-child) { text-align: center; }
.compare-table tr:last-child td { border-bottom: none; }
.ct-ok { color: var(--c-ok); font-weight: 700; }
.ct-no { color: var(--c-text-4); }
.ct-part { color: var(--c-warn); font-weight: 600; }

/* ─── BOUTON COPIER / PARTAGER RÉSULTAT ─── */
.result-box { position: relative; }
.result-copy-btn {
  position: absolute; top: 8px; right: 8px;
  background: none; border: 1px solid var(--c-border);
  border-radius: var(--r-sm); cursor: pointer;
  font-size: 12px; color: var(--c-text-4); padding: 2px 6px;
  font-family: var(--f-body); transition: all .15s; line-height: 1.5;
}
.result-copy-btn:hover { background: var(--c-primary-l); color: var(--c-primary); border-color: var(--c-primary); }
.result-copy-btn.copied { background: var(--c-ok-l); color: var(--c-ok); border-color: var(--c-ok); }
.result-share-btn {
  position: absolute; top: 8px; right: 52px;
  background: none; border: 1px solid var(--c-border);
  border-radius: var(--r-sm); cursor: pointer;
  font-size: 12px; color: var(--c-text-4); padding: 2px 6px;
  font-family: var(--f-body); transition: all .15s; line-height: 1.5;
}
.result-share-btn:hover { background: var(--c-primary-l); color: var(--c-primary); border-color: var(--c-primary); }

/* ─── RECHERCHE GLOBALE ─── */
.search-overlay {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(0,0,0,.55);
  display: none; flex-direction: column;
  padding: env(safe-area-inset-top, 12px) 0 0;
}
.search-overlay.open { display: flex; animation: fadeIn .18s ease; }
.search-box {
  background: var(--c-surface);
  margin: 12px var(--s-4) var(--s-3);
  border-radius: var(--r-xl);
  display: flex; align-items: center; gap: var(--s-2);
  padding: 0 var(--s-3);
  box-shadow: var(--sh-3);
}
.search-box input {
  flex: 1; border: none; background: none;
  font-family: var(--f-body); font-size: var(--t-md);
  padding: 14px 0; outline: none; color: var(--c-text);
}
.search-box-ico { font-size: 18px; }
.search-close-btn {
  background: none; border: none; font-size: 18px;
  cursor: pointer; padding: 8px; color: var(--c-text-3); font-family: var(--f-body);
}
.search-results {
  flex: 1; overflow-y: auto;
  padding: 0 var(--s-4) 80px;
  -webkit-overflow-scrolling: touch;
}
.search-section-title {
  font-size: 9px; font-weight: 800; color: var(--c-text-4);
  text-transform: uppercase; letter-spacing: .08em;
  padding: var(--s-3) 0 var(--s-2);
}
.search-item {
  background: var(--c-surface); border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4); margin-bottom: var(--s-2);
  cursor: pointer; box-shadow: var(--sh-1);
  border-left: 3px solid var(--c-border); transition: box-shadow .15s;
}
.search-item:active { box-shadow: var(--sh-2); }
.search-item-title { font-size: var(--t-base); font-weight: 700; color: var(--c-text); margin-bottom: 2px; }
.search-item-sub { font-size: var(--t-sm); color: var(--c-text-3); line-height: 1.5; }
.search-item mark { background: var(--c-primary-l); color: var(--c-primary); border-radius: 2px; padding: 0 2px; font-style: normal; font-weight: 700; }
.search-empty { text-align: center; padding: var(--s-6) var(--s-4); color: var(--c-text-3); font-size: var(--t-base); }

/* ─── GRAPHIQUE MANNING ─── */
.chart-wrap {
  margin-top: var(--s-3); border-top: 1px solid var(--c-border);
  padding-top: var(--s-3);
}
.chart-title {
  font-size: var(--t-xs); font-weight: 800; color: var(--c-text-4);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: var(--s-2);
}

/* ─── COMPARATEUR FILIÈRES ANC ─── */
.comparateur-table {
  width: 100%; border-collapse: collapse; font-size: 11px; margin-top: var(--s-2);
}
.comparateur-table th {
  background: var(--c-primary); color: #fff;
  padding: 6px 8px; text-align: left; font-weight: 700; font-size: 10px;
}
.comparateur-table th:not(:first-child) { text-align: center; }
.comparateur-table td {
  padding: 6px 8px; border-bottom: 1px solid var(--c-border);
  color: var(--c-text-3); vertical-align: middle;
}
.comparateur-table td:first-child { font-weight: 600; color: var(--c-text-2); font-size: 10px; }
.comparateur-table td:not(:first-child) { text-align: center; }
.comparateur-table tr.row-hl td { background: var(--c-primary-l); }
.comparateur-table .cf-ok { color: var(--c-ok); font-weight: 700; }
.comparateur-table .cf-no { color: var(--c-text-4); }
.comparateur-table .cf-warn { color: var(--c-warn); font-weight: 600; }

/* ─── BADGE UNITÉS ─── */
.unit-badge {
  display: inline-block; font-size: 9px; font-weight: 700;
  background: var(--c-primary-l); color: var(--c-primary);
  border-radius: var(--r-pill); padding: 1px 6px; margin-left: 6px;
  vertical-align: middle; letter-spacing: .04em;
}

