/* StudioVA : thème sombre violet, pensé pour l'ordinateur ET le téléphone.
   Ordinateur : menu à gauche. Téléphone : barre de navigation en bas, à portée du pouce. */

@font-face { font-family: "Sora"; font-weight: 100 800; font-display: swap;
  src: url("/static/fonts/sora-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Sora"; font-weight: 100 800; font-display: swap;
  src: url("/static/fonts/sora-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Figtree"; font-weight: 300 900; font-display: swap;
  src: url("/static/fonts/figtree-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Figtree"; font-weight: 300 900; font-display: swap;
  src: url("/static/fonts/figtree-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  color-scheme: dark;
  --fond: #0f0e1a;          /* nuit d'atelier */
  --surface: #171629;
  --surface-2: #201e38;
  --trait: #2d2b4d;
  --texte: #eceafb;
  --discret: #9d9bc2;
  --violet: #8b7cff;        /* couleur de la marque */
  --violet-fort: #6c5cff;
  --violet-voile: rgba(139, 124, 255, .14);
  --menthe: #4ade9b;
  --corail: #ff6b7a;
  --police-titre: "Sora", system-ui, sans-serif;
  --police: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --rayon: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 1rem/1.55 var(--police); color: var(--texte); background: var(--fond); min-height: 100vh; }
body.sans-menu { display: grid; place-items: center; padding: 1.5rem 1rem;
  background: radial-gradient(60rem 30rem at 50% -10%, rgba(108, 92, 255, .28), transparent 70%), var(--fond); }

h1, h2 { font-family: var(--police-titre); letter-spacing: -.02em; line-height: 1.2; margin: 0; }
h1 { font-size: 1.75rem; font-weight: 650; margin-bottom: 1.4rem; }
h2 { font-size: 1.05rem; font-weight: 600; margin-bottom: .6rem; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
small { font-weight: 400; color: var(--discret); font-size: .82rem; font-family: var(--police); letter-spacing: 0; }
a { color: var(--violet); text-underline-offset: 3px; }
a:hover { color: #b3a9ff; }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; border-radius: 6px; }

/* ---------- Coque : menu + contenu ---------- */
body.avec-menu { display: grid; grid-template-columns: 16rem minmax(0, 1fr); }
main { width: 100%; max-width: 66rem; padding: 2.2rem 2.5rem 3rem; margin: 0 auto; }
body.sans-menu main { padding: 0; max-width: 24rem; }

.menu { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 1.6rem; padding: 1.5rem 1rem;
  background: var(--surface); border-right: 1px solid var(--trait); }
.marque { display: flex; align-items: center; gap: .7rem; padding: 0 .6rem; text-decoration: none; color: var(--texte);
  font: 650 1.2rem var(--police-titre); letter-spacing: -.02em; }
.logo { width: 2rem; height: 2rem; flex: none; } .logo rect { fill: var(--violet-fort); } .logo path { fill: #fff; }
.logo.grand { width: 3.4rem; height: 3.4rem; margin-bottom: 1rem; }
.menu nav { display: flex; flex-direction: column; gap: .2rem; }
.menu nav a { display: flex; align-items: center; gap: .75rem; padding: .65rem .8rem; border-radius: 10px; color: var(--discret); text-decoration: none; font-weight: 500; transition: background .15s, color .15s; }
.menu nav a svg { width: 1.3rem; height: 1.3rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.menu nav a:hover { background: var(--surface-2); color: var(--texte); }
.menu nav a[aria-current="page"] { background: var(--violet-voile); color: #fff; box-shadow: inset 3px 0 0 var(--violet); }
.sortie { margin-top: auto; padding: 0 .6rem; }

/* ---------- Cartes et textes ---------- */
.carte { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 1.25rem 1.4rem; margin: 0 0 1.1rem; }
.etroite { width: 100%; }
.accueil { text-align: center; padding: 2.2rem 1.6rem; box-shadow: 0 30px 80px -30px rgba(108, 92, 255, .45); }
.accueil .logo.grand { margin-inline: auto; display: block; } .accueil h1 { margin-bottom: .4rem; }
.accueil form { text-align: left; margin-top: 1.4rem; }
.aide { color: var(--discret); font-size: .9rem; margin: .2rem 0 .8rem; max-width: 62ch; }
.bas { color: var(--corail); font-weight: 600; }
.vide { color: var(--discret); padding: 1rem 0; }

/* ---------- Formulaires ---------- */
label { display: block; margin: .8rem 0; font-size: .88rem; color: var(--discret); font-weight: 500; }
input, select, textarea, button, .bouton { font: inherit; color: var(--texte); max-width: 100%; }
input, select, textarea { padding: .62rem .8rem; border-radius: 10px; border: 1px solid var(--trait); background: var(--fond); min-height: 2.7rem; }
input::placeholder, textarea::placeholder { color: #6f6d97; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--violet); outline-offset: 0; border-color: transparent; }
label input, label select, label textarea { display: block; width: 100%; margin-top: .35rem; }
input[type="file"] { background: transparent; border: 0; padding: .4rem 0; }
button, .bouton { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 2.7rem; padding: .55rem 1.1rem; border-radius: 10px; border: 1px solid var(--trait);
  background: var(--surface-2); font-weight: 600; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .05s; }
button:hover, .bouton:hover { background: #2a2750; border-color: #3c3968; color: var(--texte); }
button:active, .bouton:active { transform: translateY(1px); }
button.principal, a.bouton, .plein { background: var(--violet-fort); border-color: transparent; color: #fff; }
button.principal:hover, a.bouton:hover, .plein:hover { background: #7b6dff; color: #fff; }
.plein { width: 100%; margin-top: .6rem; }
button.danger { background: transparent; color: var(--corail); border-color: rgba(255, 107, 122, .4); }
button.danger:hover { background: rgba(255, 107, 122, .12); border-color: var(--corail); color: var(--corail); }
button.lien { background: none; border: 0; padding: .3rem 0; min-height: 0; color: var(--discret); font-weight: 500; } button.lien:hover { background: none; color: var(--texte); }
.ligne { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; } .ligne input { flex: 1; min-width: 10rem; }
.inline { display: inline; } .actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: .6rem 0 1rem; }
.filtres { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; margin-bottom: 1rem; } .filtres label { margin: 0; } .filtres input { flex: 1; min-width: 12rem; }
.cases { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: .3rem .9rem; margin: .6rem 0; }
.case { display: flex; gap: .6rem; align-items: center; margin: 0; color: var(--texte); } .case input { width: 1.1rem; min-height: 0; height: 1.1rem; margin: 0; accent-color: var(--violet-fort); }
details summary { cursor: pointer; padding: .4rem 0; font-weight: 600; }

/* ---------- Messages ---------- */
.message { padding: .75rem 1rem; border-radius: 10px; margin: 0 0 1rem; border: 1px solid; }
.message.ok { background: rgba(74, 222, 155, .1); color: var(--menthe); border-color: rgba(74, 222, 155, .3); }
.message.erreur { background: rgba(255, 107, 122, .1); color: var(--corail); border-color: rgba(255, 107, 122, .35); }

/* ---------- Pastilles et étiquettes ---------- */
.pt { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; flex: none; vertical-align: middle; }
.pt.on { background: var(--violet); box-shadow: 0 0 0 3px var(--violet-voile); } .pt.off { background: transparent; border: 2px solid #5b5984; }
.etiq { display: inline-block; padding: .1rem .55rem; border-radius: 99px; background: var(--surface-2); color: var(--discret); font-size: .8rem; font-weight: 600; }

/* ---------- Tableau de bord : le stock par compte ---------- */
.stock header { margin-bottom: .4rem; }
.jauges { list-style: none; margin: 0; padding: 0; }
.jauges li { display: grid; grid-template-columns: minmax(9rem, 14rem) 1fr 5.5rem; gap: 1.2rem; align-items: center; padding: .95rem 0; border-top: 1px solid var(--trait); }
.jauges li.vide { display: block; }
.jauges .nom { display: flex; flex-direction: column; min-width: 0; } .jauges .nom strong { overflow-wrap: anywhere; } .jauges .nom .aide { margin: 0; font-size: .82rem; }
.jauges .valeur { text-align: right; display: flex; flex-direction: column; line-height: 1.2; }
.jauges .valeur strong { font: 650 1.5rem var(--police-titre); letter-spacing: -.02em; } .jauges .valeur .aide { margin: 0; font-size: .78rem; }
.jauges li.bas .valeur strong { color: var(--corail); }
meter { -webkit-appearance: none; appearance: none; width: 100%; height: .6rem; border: 0; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
meter::-webkit-meter-bar { background: var(--surface-2); border: 0; height: .6rem; border-radius: 99px; }
meter::-webkit-meter-optimum-value, meter::-webkit-meter-suboptimum-value, meter::-webkit-meter-even-less-good-value { background: linear-gradient(90deg, var(--violet-fort), var(--violet)); border-radius: 99px; }
meter::-moz-meter-bar { background: var(--violet); border-radius: 99px; }
.jauges li.bas meter::-webkit-meter-optimum-value, .jauges li.bas meter::-webkit-meter-suboptimum-value, .jauges li.bas meter::-webkit-meter-even-less-good-value { background: var(--corail); }
.jauges li.bas meter::-moz-meter-bar { background: var(--corail); }

.bilan { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; margin: 0; }
.bilan div { padding: .9rem 1rem; border-radius: var(--rayon); background: var(--surface); border: 1px solid var(--trait); }
.bilan dt { color: var(--discret); font-size: .82rem; margin: 0; } .bilan dd { margin: .15rem 0 0; font: 650 1.4rem var(--police-titre); letter-spacing: -.02em; }

/* ---------- Tableaux ---------- */
.defile { overflow-x: auto; border-radius: var(--rayon); }
.defile td { white-space: nowrap; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: .7rem .8rem; border-bottom: 1px solid var(--trait); vertical-align: middle; }
th { color: var(--discret); font-weight: 600; font-size: .82rem; white-space: nowrap; }
tbody tr:hover { background: rgba(139, 124, 255, .05); }
td.actions { display: table-cell; margin: 0; white-space: nowrap; } td.actions form { display: inline-block; margin: .15rem .4rem .15rem 0; }
.pages { display: flex; gap: 1.2rem; justify-content: center; margin: 1.2rem 0; align-items: center; color: var(--discret); }

/* ---------- Médias ---------- */
.apercu { max-width: 100%; max-height: 62vh; border-radius: var(--rayon); background: #000; display: block; margin: 0 auto 1.2rem; }
.infos { list-style: none; padding: 0; margin: 0; color: var(--discret); display: grid; gap: .3rem; }
.depot { border: 2px dashed var(--trait); border-radius: var(--rayon); padding: 1.6rem; text-align: center; margin: 1rem 0; transition: border-color .15s, background .15s; }
.depot.survol { border-color: var(--violet); background: var(--violet-voile); }
.envois { list-style: none; padding: 0; } .envois li { padding: .3rem 0; font-size: .9rem; } .envois .ok { color: var(--menthe); } .envois .erreur { color: var(--corail); }

/* ---------- Téléphone et tablette étroite : menu en bas ---------- */
@media (max-width: 820px) {
  body.avec-menu { display: block; padding-bottom: calc(5rem + env(safe-area-inset-bottom)); }
  main { padding: 1.3rem 1rem 2rem; }
  h1 { font-size: 1.5rem; margin-bottom: 1.1rem; }
  .menu { position: static; height: auto; flex-direction: row; align-items: center; justify-content: space-between; padding: .7rem 1rem; border-right: 0; border-bottom: 1px solid var(--trait); }
  .menu .sortie { margin: 0; padding: 0; }
  .menu nav { position: fixed; z-index: 10; left: 0; right: 0; bottom: 0; flex-direction: row; justify-content: space-around; gap: 0; padding: .4rem .3rem calc(.4rem + env(safe-area-inset-bottom));
    background: rgba(23, 22, 41, .96); backdrop-filter: blur(10px); border-top: 1px solid var(--trait); }
  .menu nav a { flex: 1; flex-direction: column; gap: .15rem; padding: .45rem .1rem; font-size: .7rem; text-align: center; min-height: 3.2rem; }
  .menu nav a[aria-current="page"] { box-shadow: none; background: transparent; color: #fff; }
  .menu nav a[aria-current="page"] svg { color: var(--violet); }
  .jauges li { grid-template-columns: 1fr auto; gap: .5rem .8rem; }
  .jauges meter { grid-column: 1 / -1; grid-row: 2; }
  .jauges .valeur { grid-column: 2; grid-row: 1; }
  .bilan { grid-template-columns: repeat(2, 1fr); }
  .carte { padding: 1.05rem 1rem; }
  .ligne input, .filtres input { min-width: 0; flex-basis: 100%; }
  .ligne button, .filtres button, .filtres select { flex: 1; }
  .depot { padding: 1.1rem; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
