/* ============================================================================
   Suivi du stock de tôles — thème CMA (bleu nuit + cyan), repris de la maquette.
   Interface en thème sombre ; l'impression (#print-area) reste en noir/blanc.
   ========================================================================== */
:root{
  --bg:#0f1729;          /* fond de page (bleu nuit) */
  --bg2:#0b1120;         /* en-tête (plus sombre) */
  --card:#1e293b;        /* panneaux, cartes, tableau */
  --card2:#27324a;       /* survol / éléments secondaires */
  --elev:#1a2436;        /* entêtes de tableau */
  --line:#2c3a52;        /* bordures */
  --ink:#e8edf5;         /* texte principal */
  --muted:#94a6c0;       /* texte secondaire */
  --accent:#0a85a8;      /* cyan CMA */
  --accent-2:#0b97c0;    /* cyan survol */
  --green:#22b06a;
  --red:#ef5f5b;
  --ok:#22c55e; --bas:#f0a73a; --rupture:#ef4444;
  --radius:14px;
  --shadow:0 14px 34px rgba(0,0,0,.45);
}

*{ box-sizing:border-box; }
html,body{ margin:0; padding:0; }
body{
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  background:var(--bg); color:var(--ink);
  -webkit-font-smoothing:antialiased; font-size:15px; line-height:1.45;
}
.hidden{ display:none !important; }
button{ font-family:inherit; cursor:pointer; }

/* ============================================================================
   Écran de connexion (façon maquette)
   ========================================================================== */
.login{
  min-height:100vh; min-height:100dvh;
  display:flex; align-items:center; justify-content:center;
  padding:24px; background:var(--bg);
}
.login-card{
  width:100%; max-width:404px;
  background:var(--card);
  border:1px solid rgba(255,255,255,.06);
  border-radius:18px;
  box-shadow:var(--shadow);
  padding:38px 32px 30px;
}
.login-logo{ display:block; width:158px; height:auto; margin:0 auto 4px; }
.login-sub{ text-align:center; color:var(--muted); font-size:13.5px; margin:14px 0 22px; }
.login-card label{
  display:block; font-size:11px; font-weight:700; letter-spacing:.09em;
  text-transform:uppercase; color:var(--muted); margin:14px 0 7px;
}
.login-card input{
  width:100%; padding:12px 13px; font-size:15px;
  background:#1e293d; color:var(--ink);
  border:1px solid var(--line); border-radius:10px; outline:none;
}
.login-card input::placeholder{ color:#64748b; }
.login-card input:focus{ border-color:var(--accent); box-shadow:0 0 0 3px rgba(10,133,168,.30); }
.login-card .btn-primary{
  width:100%; margin-top:22px;
  text-transform:uppercase; letter-spacing:.08em; font-weight:700; font-size:13.5px;
}
.login-foot{ text-align:center; color:#5b6b85; font-size:11.5px; margin:24px 0 0; letter-spacing:.04em; }
.banner-error{
  background:rgba(239,68,68,.12); color:#fca5a5;
  border:1px solid rgba(239,68,68,.35); border-radius:10px;
  padding:10px 12px; font-size:13px; margin-bottom:4px;
}

/* ============================================================================
   Boutons génériques
   ========================================================================== */
.btn-primary{
  border:none; background:var(--accent); color:#fff;
  padding:12px 16px; border-radius:11px; font-size:15px; font-weight:600;
}
.btn-primary:hover{ background:var(--accent-2); }
.btn-primary:disabled{ opacity:.6; cursor:default; }
.btn-ghost{
  border:1px solid var(--line); background:transparent; color:var(--ink);
  padding:9px 13px; border-radius:10px; font-size:13.5px; font-weight:600;
}
.btn-ghost:hover{ background:var(--card2); }

/* ============================================================================
   En-tête de l'application
   ========================================================================== */
.header{
  background:var(--bg2);
  border-bottom:1px solid var(--line);
  padding:14px 16px 0;
  position:sticky; top:0; z-index:20;
}
.header-top{ display:flex; align-items:center; justify-content:space-between; gap:12px; }
.brand{ display:flex; align-items:center; gap:12px; min-width:0; }
.brand-logo{ height:30px; width:auto; flex:none; }
.header-title{ font-size:16px; font-weight:700; color:#fff; line-height:1.1; }
.header-title small{ display:block; font-size:11.5px; font-weight:500; color:var(--muted); margin-top:2px; }
.header-actions{ display:flex; align-items:center; gap:8px; }
.icon-btn{
  width:38px; height:38px; border-radius:10px; border:1px solid var(--line);
  background:transparent; color:var(--ink); font-size:17px; line-height:1;
}
.icon-btn:hover{ background:var(--card2); }
.user-chip{
  display:flex; align-items:center; gap:8px; cursor:pointer;
  background:var(--card); border:1px solid var(--line); border-radius:999px;
  padding:4px 6px 4px 12px; font-size:13px; color:var(--ink);
}
.user-chip .avatar{
  width:30px; height:30px; border-radius:50%; background:var(--accent);
  color:#fff; display:flex; align-items:center; justify-content:center;
  font-size:12px; font-weight:700;
}

/* statistiques */
.stats{ display:flex; gap:10px; margin-top:14px; }
.stat{
  flex:1; background:var(--card); border:1px solid var(--line);
  border-radius:12px; padding:10px 12px;
}
.stat .n{ font-size:21px; font-weight:700; color:#fff; }
.stat .l{ font-size:11px; color:var(--muted); text-transform:uppercase; letter-spacing:.05em; }
.stat.alert .n{ color:var(--rupture); }

/* onglets */
.tabs{ display:flex; gap:4px; margin-top:14px; }
.tab{
  flex:1; padding:11px 8px; border:none; background:transparent;
  color:var(--muted); font-size:14px; font-weight:600;
  border-bottom:2.5px solid transparent;
}
.tab.active{ color:#fff; border-bottom-color:var(--accent); }

/* ============================================================================
   Barre d'outils
   ========================================================================== */
.toolbar{ padding:12px 16px 0; }
.search-row{ display:flex; gap:8px; align-items:center; }
.search{
  flex:1; display:flex; align-items:center; gap:8px;
  background:var(--card); border:1px solid var(--line); border-radius:11px;
  padding:0 12px; color:var(--muted);
}
.search input{
  flex:1; border:none; background:transparent; outline:none;
  padding:11px 0; font-size:14.5px; color:var(--ink);
}
.search input::placeholder{ color:#64748b; }
.tool-actions{ display:flex; align-items:center; gap:8px; margin-top:10px; }
.tool-actions .spacer{ flex:1; }
.filters{
  margin-top:12px; padding:12px; background:var(--card);
  border:1px solid var(--line); border-radius:12px;
  display:flex; flex-wrap:wrap; gap:14px; align-items:center;
}
.filters > div{ display:flex; flex-direction:column; gap:6px; }
.filters label{ font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); }
.chk{ flex-direction:row !important; align-items:center; gap:8px; text-transform:none !important; font-weight:600 !important; color:var(--ink) !important; }
.chk input{ width:16px; height:16px; accent-color:var(--accent); }
.sel{
  background:#1e293d; color:var(--ink); border:1px solid var(--line);
  border-radius:9px; padding:9px 10px; font-size:14px; outline:none;
}
.sel:focus{ border-color:var(--accent); }

/* ============================================================================
   Liste
   ========================================================================== */
.list{ padding:14px 16px 96px; }
.empty{ text-align:center; color:var(--muted); padding:46px 16px; font-size:14px; line-height:1.6; }

/* ---------- vue TABLEAU ---------- */
.tbl-wrap{
  background:var(--card); border:1px solid var(--line);
  border-radius:14px; overflow-x:auto;
}
table.tbl{ width:100%; border-collapse:collapse; font-size:14px; min-width:460px; }
.tbl thead th{
  position:sticky; top:0; z-index:2;
  background:var(--elev); color:var(--muted);
  text-align:left; font-size:11px; font-weight:700; letter-spacing:.05em; text-transform:uppercase;
  padding:11px 12px; white-space:nowrap; border-bottom:1px solid var(--line);
}
.tbl th.num, .tbl td.num{ text-align:right; white-space:nowrap; }
.tbl tbody td{ padding:11px 12px; border-bottom:1px solid var(--line); color:var(--ink); vertical-align:middle; }
.tbl tbody tr:last-child td{ border-bottom:none; }
.tbl tbody tr:hover td{ background:var(--card2); }
.cell-strong{ font-weight:600; display:inline-flex; align-items:center; gap:8px; }
.tbl .u{ color:var(--muted); font-size:12px; }
.etat-dot{ display:inline-block; width:8px; height:8px; border-radius:50%; margin-left:6px; vertical-align:middle; }
.etat-dot.bas{ background:var(--bas); }
.etat-dot.rupture{ background:var(--rupture); }
.swatch.sm{ width:14px; height:14px; border-radius:4px; border:1px solid rgba(255,255,255,.18); flex:none; }
/* colonnes figées */
.tbl .col-principal{ position:sticky; left:0; z-index:1; background:var(--card); }
.tbl thead .col-principal{ z-index:3; background:var(--elev); }
.tbl .col-actions{ position:sticky; right:0; z-index:1; background:var(--card); box-shadow:-8px 0 12px -10px rgba(0,0,0,.6); white-space:nowrap; }
.tbl thead .col-actions{ z-index:3; background:var(--elev); }
.tbl tbody tr:hover .col-principal,
.tbl tbody tr:hover .col-actions{ background:var(--card2); }
.rbtn{
  width:30px; height:30px; border-radius:8px; border:1px solid var(--line);
  background:#1b2536; color:var(--ink); font-size:15px; line-height:1; margin-left:4px;
}
.rbtn.out{ color:#fca5a5; border-color:rgba(239,95,91,.4); }
.rbtn.in{ color:#86e3b4; border-color:rgba(34,176,106,.4); }
.rbtn:hover{ background:var(--card2); }

/* ---------- vue CARTES ---------- */
.card{
  position:relative; display:flex; gap:12px;
  background:var(--card); border:1px solid var(--line);
  border-radius:14px; padding:14px 14px 14px 18px; margin-bottom:10px; overflow:hidden;
}
.stripe{ position:absolute; left:0; top:0; bottom:0; width:5px; }
.card-main{ flex:1; min-width:0; }
.card-primary{ font-size:15.5px; font-weight:700; color:#fff; display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.swatch{ width:18px; height:18px; border-radius:5px; border:1px solid rgba(255,255,255,.18); flex:none; }
.micron-chip{
  font-size:11.5px; font-weight:600; color:#bfe7f2;
  background:rgba(10,133,168,.18); border:1px solid rgba(10,133,168,.4);
  padding:1px 8px; border-radius:999px;
}
.card-meta{ color:var(--muted); font-size:13px; margin-top:3px; }
.badge{ display:inline-block; margin-top:8px; font-size:11.5px; font-weight:700; padding:2px 9px; border-radius:999px; }
.badge.bas{ background:rgba(240,167,58,.16); color:#f5c887; border:1px solid rgba(240,167,58,.4); }
.badge.rupture{ background:rgba(239,68,68,.16); color:#fca5a5; border:1px solid rgba(239,68,68,.4); }
.card-actions{ display:flex; gap:8px; margin-top:12px; }
.mini{
  border:1px solid var(--line); background:transparent; color:var(--ink);
  font-size:12.5px; font-weight:600; padding:6px 10px; border-radius:8px;
}
.mini:hover{ background:var(--card2); }
.qty-block{ display:flex; flex-direction:column; align-items:flex-end; justify-content:space-between; gap:12px; }
.qty-num{ font-size:26px; font-weight:800; color:#fff; line-height:1; text-align:right; }
.qty-unit{ font-size:11px; color:var(--muted); text-align:right; }
.qty-btns{ display:flex; gap:8px; }
.round{
  width:42px; height:42px; border-radius:50%; border:none; color:#fff;
  font-size:22px; line-height:1; display:flex; align-items:center; justify-content:center;
}
.round.plus{ background:var(--accent); }
.round.plus:hover{ background:var(--accent-2); }
.round.minus{ background:#37425a; }
.round.minus:hover{ background:#43506c; }

/* bouton flottant */
.fab{
  position:fixed; right:18px; bottom:18px; z-index:30;
  width:56px; height:56px; border-radius:50%; border:none;
  background:var(--accent); color:#fff; font-size:28px; line-height:1;
  box-shadow:0 10px 24px rgba(10,133,168,.5);
}
.fab:hover{ background:var(--accent-2); }

/* ============================================================================
   Modales (bottom-sheet)
   ========================================================================== */
.overlay{
  position:fixed; inset:0; z-index:50; background:rgba(2,6,16,.62);
  display:flex; align-items:flex-end; justify-content:center;
  backdrop-filter:blur(2px);
}
.sheet{
  width:100%; max-width:540px; max-height:92vh; overflow:auto;
  background:var(--card); border:1px solid var(--line);
  border-radius:18px 18px 0 0; padding:18px 18px 26px;
  box-shadow:var(--shadow);
}
@media (min-width:560px){
  .overlay{ align-items:center; }
  .sheet{ border-radius:18px; }
}
.sheet-head{ display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.sheet-head h2{ margin:0; font-size:18px; color:#fff; }
.sheet-head .sub{ color:var(--muted); font-size:13px; margin-top:3px; }
.x{ border:none; background:transparent; color:var(--muted); font-size:18px; padding:4px 8px; border-radius:8px; }
.x:hover{ background:var(--card2); color:var(--ink); }
.menu-row{
  display:block; width:100%; text-align:left; margin-top:10px;
  background:#1b2536; border:1px solid var(--line); color:var(--ink);
  padding:14px; border-radius:11px; font-size:15px; font-weight:600;
}
.menu-row:hover{ background:var(--card2); }

/* champs de formulaire */
.field{ margin-top:14px; }
.field > label{
  display:block; font-size:11px; font-weight:700; letter-spacing:.05em;
  text-transform:uppercase; color:var(--muted); margin-bottom:7px;
}
.field .hint{ text-transform:none; letter-spacing:0; font-weight:500; color:#7488a6; }
.inp{
  width:100%; padding:11px 12px; font-size:15px;
  background:#1e293d; color:var(--ink);
  border:1px solid var(--line); border-radius:10px; outline:none;
}
.inp::placeholder{ color:#64748b; }
.inp:focus, .sel:focus{ border-color:var(--accent); box-shadow:0 0 0 3px rgba(10,133,168,.25); }
.field .sel{ width:100%; }
.row2{ display:grid; grid-template-columns:1fr 1fr 1fr; gap:10px; }
@media (max-width:480px){ .row2{ grid-template-columns:1fr 1fr; } }

/* stepper quantité */
.stepper{ display:flex; align-items:center; gap:10px; }
.stepper button{
  width:50px; height:50px; border-radius:12px; border:1px solid var(--line);
  background:#1b2536; color:var(--ink); font-size:24px; line-height:1;
}
.stepper button:hover{ background:var(--card2); }
.stepper .val{ flex:1; text-align:center; font-size:30px; font-weight:800; color:#fff; }
.quick{ display:flex; gap:8px; margin-top:10px; }
.quick button{
  flex:1; padding:8px; border:1px solid var(--line); background:transparent;
  color:var(--ink); border-radius:9px; font-size:14px; font-weight:600;
}
.quick button:hover{ background:var(--card2); }

.after{
  margin-top:16px; padding:12px 14px; border-radius:11px;
  background:rgba(10,133,168,.12); border:1px solid rgba(10,133,168,.32);
  display:flex; align-items:center; justify-content:space-between; color:#bfe7f2;
}
.after b{ color:#fff; font-size:17px; }
.after.warn{ background:rgba(239,68,68,.12); border-color:rgba(239,68,68,.4); color:#fca5a5; }
.after.warn b{ color:#fecaca; }

.actions{ display:flex; gap:10px; margin-top:20px; }
.actions .btn-ghost{ flex:1; text-align:center; }
.actions .btn-primary{ flex:2; }

.note{
  margin-top:16px; font-size:12.5px; color:var(--muted); line-height:1.5;
  background:#16203200; border-left:3px solid var(--accent);
  background:rgba(10,133,168,.08); padding:11px 12px; border-radius:0 10px 10px 0;
}
.note b{ color:var(--ink); }

.trace{
  background:rgba(255,255,255,.04); border:1px solid var(--line); border-radius:10px;
  padding:9px 11px; font-size:12.5px; color:var(--muted); margin-top:10px;
}
.trace b{ color:#cdd9ea; font-weight:700; }

/* historique / journal */
.mvt{ display:flex; gap:12px; padding:12px 2px; border-bottom:1px solid var(--line); }
.mvt:last-child{ border-bottom:none; }
.mvt .dot{
  width:34px; height:34px; border-radius:50%; flex:none; color:#fff;
  display:flex; align-items:center; justify-content:center; font-size:17px;
}
.mvt .dot.in{ background:var(--green); }
.mvt .dot.out{ background:#37425a; }
.mvt .t{ font-weight:600; color:var(--ink); }
.mvt .d{ font-size:12.5px; color:var(--muted); margin-top:2px; }

/* tableau de bord */
.dash-cat{
  display:flex; align-items:center; justify-content:space-between;
  padding:12px; background:#1b2536; border:1px solid var(--line);
  border-radius:11px; margin-top:10px;
}
.dash-cat .name{ font-weight:700; color:#fff; }
.dash-cat .vals{ font-size:13px; color:var(--muted); }
.section-title{ margin-top:20px; font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); }
.lowrow{
  display:flex; align-items:center; justify-content:space-between;
  padding:11px 2px; border-bottom:1px solid var(--line); font-size:14px;
}
.ok-box{
  margin-top:12px; padding:16px; text-align:center; border-radius:12px;
  background:rgba(34,176,106,.10); border:1px solid rgba(34,176,106,.3); color:#86e3b4; font-size:14px;
}

/* menu utilisateur */
.menu{
  position:fixed; top:64px; right:16px; z-index:60; width:230px;
  background:var(--card); border:1px solid var(--line); border-radius:13px;
  box-shadow:var(--shadow); padding:8px; overflow:hidden;
}
.menu .who{ padding:10px 12px 12px; border-bottom:1px solid var(--line); margin-bottom:6px; }
.menu .who b{ display:block; color:#fff; }
.menu .who small{ color:var(--muted); font-size:12px; }
.menu button{
  display:block; width:100%; text-align:left; background:transparent; border:none;
  color:var(--ink); padding:11px 12px; border-radius:9px; font-size:14px; font-weight:600;
}
.menu button:hover{ background:var(--card2); }

/* utilisateurs */
.urow{
  display:flex; align-items:center; justify-content:space-between;
  padding:12px 2px; border-bottom:1px solid var(--line);
}
.urow .who{ display:flex; flex-direction:column; }
.urow .who small{ color:var(--muted); font-size:12px; }
.tag{ font-size:11px; font-weight:700; padding:2px 9px; border-radius:999px; }
.tag.admin{ background:rgba(10,133,168,.2); color:#9fdcec; border:1px solid rgba(10,133,168,.4); }
.tag.op{ background:rgba(148,166,192,.16); color:#b8c6dc; border:1px solid var(--line); }
.tag.off{ background:rgba(239,68,68,.16); color:#fca5a5; border:1px solid rgba(239,68,68,.4); }

/* toast */
.toast{
  position:fixed; left:50%; bottom:84px; transform:translateX(-50%); z-index:80;
  background:#0a1322; color:#fff; border:1px solid var(--line);
  padding:12px 18px; border-radius:11px; font-size:14px; box-shadow:var(--shadow);
  max-width:90%;
}
.toast.err{ background:#3a1414; border-color:rgba(239,68,68,.5); }

/* ============================================================================
   Impression (export PDF) — NOIR / BLANC sur papier
   ========================================================================== */
#print-area{ display:none; }
@media print{
  body{ background:#fff !important; color:#000 !important; }
  #login, #app, #modal-root, #toast{ display:none !important; }
  #print-area{ display:block !important; padding:0; color:#000; }
  .print-head{ display:flex; align-items:baseline; justify-content:space-between; border-bottom:2px solid #000; padding-bottom:8px; margin-bottom:14px; }
  .print-head h1{ font-size:18px; margin:0; }
  .print-date{ font-size:11px; color:#333; }
  #print-area section{ margin-bottom:18px; page-break-inside:avoid; }
  #print-area h2{ font-size:14px; margin:0 0 6px; }
  #print-area h2 .cnt{ font-weight:400; font-size:11px; color:#444; }
  #print-area table{ width:100%; border-collapse:collapse; font-size:11px; }
  #print-area th, #print-area td{ border:1px solid #000; padding:5px 7px; text-align:left; }
  #print-area th.num, #print-area td.num{ text-align:right; }
  #print-area thead{ display:table-header-group; }
  #print-area .muted{ color:#666; text-align:center; }
  #print-area .print-foot{ margin-top:8px; font-size:10px; color:#444; }
  @page{ margin:14mm; }
}
