/* Dashboard standalone — theme violet (d'apres les maquettes).
   Aucune ressource externe. */

:root {
  --violet: #8b5cf6;
  --violet-dark: #7c3aed;
  --violet-deep: #6d28d9;
  --violet-light: #f4f0fd;
  --violet-border: #e5ddf7;
  --ink: #27213a;
  --muted: #857f96;
  --bg: #f6f5fa;
  --card: #ffffff;
  --panel-border: #efedf5;
  --panel-head-border: #f2f0f7;
  --input-bg: #f5f4f8;
  --input-focus-bg: #fff;
  --table-hover: #faf9fd;
  --table-border: #f5f3f9;
  --sidebar-bg: #fff;
  --sidebar-border: #efedf5;
  --top-bg: #fff;
  --top-border: #efedf5;
  --chart-grid: #efedf5;
  --chart-label: #a49eb5;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(39, 33, 58, .05), 0 8px 24px rgba(109, 40, 217, .06);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --violet-light: rgba(139, 92, 246, .14);
  --violet-border: rgba(139, 92, 246, .28);
  --ink: #e5e7eb;
  --muted: #9ca3af;
  --bg: #0f1115;
  --card: #1b2030;
  --panel-border: #2a3144;
  --panel-head-border: #2a3144;
  --input-bg: #161a22;
  --input-focus-bg: #1f2433;
  --table-hover: rgba(139, 92, 246, .06);
  --table-border: #252b3a;
  --sidebar-bg: #161a22;
  --sidebar-border: #2a3144;
  --top-bg: #161a22;
  --top-border: #2a3144;
  --chart-grid: #2a3144;
  --chart-label: #6b7280;
  --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 8px 24px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.5;
}

button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; font-size: 14px; }

/* ============ Boutons / champs generiques ============ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 10px;
  background: var(--violet);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  padding: 11px 20px;
  transition: background .15s ease, transform .1s ease;
  text-decoration: none;
}
.btn:hover { background: var(--violet-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-block { width: 100%; }

.btn-secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--violet-border);
}
.btn-secondary:hover { background: var(--violet-light); }

.btn-danger { background: #fef2f2; color: var(--red); }
.btn-danger:hover { background: #fee2e2; }

.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }

.btn-hero { background: #fff; color: var(--violet-deep); }
.btn-hero:hover { background: var(--violet-light); }

.linklike {
  background: none;
  border: 0;
  padding: 0;
  color: var(--muted);
  font-size: 13px;
}
.linklike:hover { color: var(--violet); }

.error { color: var(--red); font-size: 13px; margin: 4px 0 10px; min-height: 18px; }
.ok { color: var(--green); font-size: 13px; margin: 4px 0 10px; min-height: 18px; }
.note { color: var(--muted); font-size: 13px; margin: 0; }

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid transparent;
  background: #f5f4f8;
  border-radius: 10px;
  padding: 12px 14px;
  outline: none;
  transition: border-color .15s ease, background .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--violet);
  background: #fff;
}
.field textarea { font: inherit; resize: vertical; min-height: 90px; }

/* ================================================================
   PAGE LOGIN
   ================================================================ */

.login-body { background: var(--bg); min-height: 100vh; }

.login-social {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 10px;
}

.soc {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--violet-border);
  border-radius: 10px;
  padding: 11px 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  transition: border-color .15s ease, background .15s ease;
}
.soc:hover { border-color: var(--violet); background: var(--violet-light); }

.login-hint { color: var(--muted); font-size: 12.5px; margin: 0 0 8px; }

.login-sep {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
  margin: 18px 0 24px;
}
.login-sep::before, .login-sep::after {
  content: "";
  flex: 1;
  border-top: 1px dashed var(--violet-border);
}

.login-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 0 14px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  cursor: pointer;
}
.check input { accent-color: var(--violet); width: 15px; height: 15px; }

/* ================================================================
   APPLICATION
   ================================================================ */

.app { display: flex; min-height: 100vh; }

.splash {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 14px;
}

/* ---- Sidebar ---- */

.side {
  width: 252px;
  flex: 0 0 252px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.side-head { display: flex; align-items: center; gap: 10px; padding: 20px 20px 16px; }
.side-head strong { font-size: 18px; letter-spacing: 1.5px; }
.side-head strong span { color: var(--violet); }

.side-nav { padding: 6px 12px 12px; flex: 1; }

.side-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #b6b1c6;
  margin: 16px 10px 6px;
}

.side-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 0;
  background: none;
  color: #6f6a80;
  font-size: 14px;
  font-weight: 500;
  padding: 11px 12px;
  border-radius: 10px;
  text-align: left;
  text-decoration: none;
  transition: background .2s ease, color .2s ease, padding-left .2s ease;
}
html[data-theme="dark"] .side-btn { color: #9ca3af; }
html[data-theme="dark"] .side-btn:hover { color: #e5e7eb; }
.side-btn.active { padding-left: 16px; }
.side-btn svg { width: 18px; height: 18px; flex: 0 0 18px; }
.side-btn:hover { background: var(--violet-light); color: var(--violet-deep); }

.side-btn.active {
  background: linear-gradient(90deg, var(--violet), var(--violet-dark));
  color: #fff;
  box-shadow: 0 6px 14px rgba(139, 92, 246, .35);
}

.side-badge {
  margin-left: auto;
  background: #34d399;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 6px;
  padding: 2px 7px;
}
.side-btn.active .side-badge { background: rgba(255, 255, 255, .25); }

.side-foot { padding: 12px; border-top: 1px solid #efedf5; }

.side-user { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; }

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--violet), var(--violet-deep));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex: 0 0 36px;
}

.side-user-meta { min-width: 0; flex: 1; }
.side-user-meta strong { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-meta span { font-size: 12px; color: var(--muted); }

.icon-btn {
  border: 0;
  background: none;
  color: var(--muted);
  border-radius: 8px;
  padding: 7px;
  display: inline-flex;
}
.icon-btn:hover { background: var(--violet-light); color: var(--violet-deep); }
.icon-btn svg { width: 17px; height: 17px; }

/* ---- Main ---- */

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.top {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--top-bg);
  border-bottom: 1px solid var(--top-border);
  padding: 12px 26px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.burger {
  display: none;
  border: 1px solid var(--violet-border);
  background: #fff;
  border-radius: 8px;
  padding: 8px;
}
.burger svg { width: 18px; height: 18px; display: block; }

.top-title { margin: 0; font-size: 17px; font-weight: 700; }
.top-title small {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-top: 1px;
}

.search { margin-left: auto; position: relative; width: min(340px, 34vw); }
.search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: #a49eb5;
}
.search input {
  width: 100%;
  border: 1px solid transparent;
  background: #f5f4f8;
  border-radius: 10px;
  padding: 10px 12px 10px 36px;
  outline: none;
}
.search input:focus { border-color: var(--violet); background: #fff; }

.top-user {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--violet-border);
  border-radius: 999px;
  padding: 5px 14px 5px 6px;
  background: #fff;
}
.top-user-meta { line-height: 1.15; }
.top-user-meta strong { display: block; font-size: 13px; }
.top-user-meta span { font-size: 11px; color: var(--violet); font-weight: 600; text-transform: capitalize; }

/* ---- Contenu ---- */

.content { padding: 24px 26px 40px; }
.view[hidden] { display: none; }

.view-head { margin-bottom: 18px; }
.view-head h2 { margin: 0; font-size: 20px; letter-spacing: -.3px; }
.view-head p { margin: 3px 0 0; color: var(--muted); font-size: 13.5px; }

/* ---- Cartes ---- */

.card {
  background: var(--card);
  border: 1px solid #efedf5;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #f2f0f7;
}
.card-head h3 { margin: 0; font-size: 15px; }
.card-head .linklike { font-weight: 600; }

/* ---- Hero + KPI ---- */

.hero-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1.1fr) repeat(4, minmax(150px, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 55%, #a78bfa 100%);
  color: #fff;
  padding: 24px;
  box-shadow: 0 12px 28px rgba(124, 58, 237, .35);
}

.hero h3 { margin: 0 0 4px; font-size: 16px; }
.hero-big { font-size: 32px; font-weight: 800; letter-spacing: -.5px; margin: 0 0 14px; }
.hero > p { margin: 0 0 18px; font-size: 13px; color: rgba(255, 255, 255, .85); max-width: 260px; }

.hero-blob {
  position: absolute;
  right: -38px;
  top: -30px;
  width: 190px;
  height: 190px;
  opacity: .35;
  pointer-events: none;
}

.kpi { padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 6px; }

.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-top span { font-size: 12.5px; color: var(--muted); font-weight: 600; }

.kpi-ico {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.kpi-ico svg { width: 17px; height: 17px; }
.kpi-ico.violet { background: var(--violet-light); color: var(--violet); }
.kpi-ico.pink { background: #fdf0f6; color: #db2777; }
.kpi-ico.amber { background: #fef6e7; color: var(--amber); }
.kpi-ico.green { background: #ecfdf3; color: var(--green); }

.kpi strong { font-size: 24px; letter-spacing: -.5px; }

.kpi-trend { font-size: 12.5px; font-weight: 600; }
.kpi-trend.up { color: var(--green); }
.kpi-trend.down { color: var(--red); }
.kpi-trend.flat { color: var(--muted); }

.kpi-link {
  margin-top: auto;
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  color: var(--violet);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
}
.kpi-link:hover { text-decoration: underline; }

/* ---- Grilles / graphique ---- */

.grid-2 { display: grid; grid-template-columns: 1.7fr 1fr; gap: 18px; margin-bottom: 18px; }

.chart-wrap { padding: 10px 14px 14px; }
.chart-wrap svg { display: block; width: 100%; height: auto; }

.rank-list { list-style: none; margin: 0; padding: 8px; }
.rank-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; }
.rank-list li:hover { background: var(--violet-light); }

.rank-num {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--violet-light);
  color: var(--violet-deep);
  font-size: 12.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 28px;
}

.rank-meta { min-width: 0; flex: 1; }
.rank-meta strong { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-meta span { font-size: 12px; color: var(--muted); }

.rank-val { font-weight: 700; font-size: 13.5px; white-space: nowrap; }

/* ---- Tableaux ---- */

.table-scroll { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: #a49eb5;
  font-weight: 700;
  padding: 12px 16px;
  border-bottom: 1px solid #f2f0f7;
  white-space: nowrap;
}
.table td { padding: 13px 16px; border-bottom: 1px solid #f5f3f9; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #faf9fd; }

.num { text-align: right; font-variant-numeric: tabular-nums; }

.status {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  padding: 4px 11px;
  white-space: nowrap;
}
.status.pending { background: #fef6e7; color: var(--amber); }
.status.paid { background: #eff6ff; color: #2563eb; }
.status.shipped { background: #ecfdf3; color: var(--green); }
.status.cancelled { background: #fef2f2; color: var(--red); }
.status.role { background: var(--violet-light); color: var(--violet-deep); }
.status.manager { background: #eff6ff; color: #2563eb; }

.lines { margin: 0; padding-left: 18px; }
.lines li { margin: 2px 0; }

.status-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.status-form select {
  border: 1px solid var(--violet-border);
  background: #fff;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 13px;
  outline: none;
}
.status-form select:focus { border-color: var(--violet); }

.upload-grid { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 18px; align-items: start; }
@media (max-width: 980px) { .upload-grid { grid-template-columns: 1fr; } }

.smtp-counts { display: flex; gap: 16px; flex-wrap: wrap; margin: -4px 0 14px; font-size: 13px; color: var(--muted); }
.smtp-counts strong { color: var(--violet-deep); }

.smtp-models { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.smtp-models li { margin: 0; }
.smtp-item {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--mbd);
  border-radius: 12px;
  background: var(--mbg);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
.smtp-item:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(39,33,58,.08); }
.smtp-item.open { box-shadow: 0 0 0 1px var(--mc); }
.smtp-avatar {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--mc);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex: none;
}
.smtp-name { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.smtp-tip {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  width: max-content;
  max-width: 250px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  line-height: 1.45;
  padding: 8px 11px;
  border-radius: 9px;
  box-shadow: 0 6px 16px rgba(39,33,58,.18);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity .15s ease, transform .15s ease, visibility .15s;
  z-index: 10;
  pointer-events: none;
}
.smtp-tip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 18px;
  border: 6px solid transparent;
  border-top-color: var(--ink);
}
.smtp-tip strong { color: #fbbf24; }
.smtp-item.open .smtp-tip { opacity: 1; visibility: visible; transform: translateY(0); }

/* Couleurs par modele : --mc = logo, --mbg = fond, --mbd = contour */
.smtp-aws       { --mc: #ff9900; --mbg: #fff4e0; --mbd: #ffdf9e; }
.smtp-sendgrid  { --mc: #1a82e2; --mbg: #e8f2fd; --mbd: #b7daf9; }
.smtp-mandrill  { --mc: #d64541; --mbg: #fdecea; --mbd: #f2c4c0; }
.smtp-zeptomail { --mc: #0e9384; --mbg: #e4f5f2; --mbd: #b9e4de; }

/* Cartes de modeles en ligne + filtre actif (detail commande) */
.smtp-models-row { display: flex; flex-wrap: wrap; gap: 8px; }
.smtp-models-row li { margin: 0; }
.smtp-models-row .smtp-item { width: auto; }
a.smtp-item { text-decoration: none; }
a.smtp-item.active { box-shadow: 0 0 0 1px var(--mc); }
.smtp-num { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--mc); background: #fff; border-radius: 999px; padding: 1px 8px; }

/* Libelle de groupe de lignes (par modele) */
.model-group { display: flex; align-items: center; gap: 8px; margin: 14px 0 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--mc); }
.model-group::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--mc); flex: none; }
.model-group.other { color: var(--muted); }
.model-group.other::before { background: var(--muted); }

/* Pastilles "Modele : n" (quantites par modele) */
.qchips { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.qchip {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--mbg);
  border: 1px solid var(--mbd);
  color: var(--ink);
  white-space: nowrap;
}
.qchip.dup { --mbg: #fef2f2; --mbd: #fecaca; color: var(--red); }

.smtp-count.has-dup strong { color: var(--red); }

/* Reference cliquable dans le tableau des commandes */
.table a { color: var(--violet-deep); font-weight: 600; text-decoration: none; }
.table a:hover { color: var(--violet); text-decoration: underline; }

/* Detail d'une commande */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.detail-grid > div > span { display: block; font-size: 11.5px; font-weight: 600; text-transform: uppercase; color: var(--muted); margin-bottom: 5px; }
.detail-grid strong { font-size: 14px; }
.order-text { margin: 0; background: #f5f4f8; border-radius: 10px; padding: 12px 14px; font-family: inherit; font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-break: break-all; }

/* Adresses de wallet (police monospace) */
.wallet { font-family: ui-monospace, Consolas, monospace; font-size: 12px; font-weight: 600; word-break: break-all; }
button.wallet-copy { display: block; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; color: inherit; }
button.wallet-copy:hover { color: var(--violet); text-decoration: underline dotted; }
button.wallet-copy.copied, button.wallet-copy.copied:hover { color: var(--green); text-decoration: none; }

.empty { color: var(--muted); text-align: center; padding: 34px 16px; font-size: 13.5px; }

/* ---- Filtres / formulaires ---- */

.filters { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.filters .search { margin-left: 0; width: min(320px, 100%); }
.filters select {
  border: 1px solid var(--violet-border);
  background: #fff;
  border-radius: 10px;
  padding: 10px 14px;
  outline: none;
}
.filters select:focus { border-color: var(--violet); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.form-grid .field { margin-bottom: 0; }

.form-foot { display: flex; align-items: center; gap: 14px; margin-top: 16px; flex-wrap: wrap; }

/* ---- Responsive ---- */

@media (max-width: 1280px) {
  .hero-grid { grid-template-columns: repeat(2, 1fr); }
  .hero { grid-column: 1 / -1; }
}

@media (max-width: 980px) {
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .side {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: 0 0 40px rgba(39, 33, 58, .18);
    height: 100vh;
  }
  .app.side-open .side { transform: translateX(0); }
  .burger { display: inline-flex; }
  .top-user-meta { display: none; }
  .search { width: auto; flex: 1; }
  .content { padding: 18px 14px 32px; }
}

@media (max-width: 560px) {
  .hero-grid { grid-template-columns: 1fr; }
  .login-social { grid-template-columns: 1fr; }
}

/* ================================================================
   VUE ANALYSER / IMPORT — préfixe .analyze- pour éviter tout conflit
   ================================================================ */

.analyze-form { max-width: 880px; }

.analyze-toolbar { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: -8px 0 16px; }
.analyze-price { margin: 0; width: 140px; }
.analyze-price input { width: 100%; }

.analyze-results { margin: 4px 0 16px; }

.analyze-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.analyze-line {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid #efedf5;
  border-radius: 12px;
  padding: 10px 14px;
}

.analyze-index {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  min-width: 34px;
  flex: none;
}

.analyze-key {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  word-break: break-all;
  min-width: 0;
  flex: 1;
}

.analyze-meta { color: var(--muted); font-size: 12.5px; white-space: nowrap; }

.analyze-reason {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 12px;
  margin: -2px 0 0 46px;
}

.analyze-badge {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  padding: 4px 11px;
  white-space: nowrap;
  flex: none;
}
.analyze-badge.ok { background: #ecfdf3; color: var(--green); }
.analyze-badge.auth { background: #fef2f2; color: var(--red); }
.analyze-badge.timeout,
.analyze-badge.quota,
.analyze-badge.rate { background: #fef6e7; color: var(--amber); }
.analyze-badge.region,
.analyze-badge.ignored { background: #f2f0f7; color: var(--muted); }

/* ================================================================
   DASHBOARD v2 — remplace la vue "orders" par des fiches produit
   (chaque cle SMTP = une fiche directe). Classes dediees.
   ================================================================ */

/* ---- Panneaux (equivalents .card) ---- */
.panel {
  background: var(--card);
  border: 1px solid #efedf5;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.panel-head { padding: 16px 20px; border-bottom: 1px solid #f2f0f7; }
.panel-head h2 { margin: 0; font-size: 15px; }
.panel-sub { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.panel-body { padding: 20px; }

/* ---- Flash / retours ---- */
.flash { border-radius: 10px; padding: 11px 14px; font-size: 13.5px; font-weight: 600; margin-bottom: 16px; }
.flash-ok { background: #ecfdf3; color: var(--green); }
.flash-err { background: #fef2f2; color: var(--red); }

/* ---- Boutons complementaires ---- */
.btn-primary { background: var(--violet); }
.btn-primary:hover { background: var(--violet-dark); }
.btn-success { background: var(--green); }
.btn-success:hover { background: #15803d; }
.btn-ghost { background: #fff; color: var(--ink); border: 1px solid var(--violet-border); }
.btn-ghost:hover { background: var(--violet-light); }

/* ---- Tableaux ---- */
.table-wrap { overflow-x: auto; }
.ta-r { text-align: right; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Consolas, "SF Mono", Menlo, monospace; }
.cell-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-user .avatar.sm { width: 30px; height: 30px; flex: 0 0 30px; font-size: 12px; }
.cell-user strong { display: block; font-size: 13.5px; }
.cell-user .muted { font-size: 12px; }

.role-badge { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 4px 11px; text-transform: capitalize; }
.role-seller { background: var(--violet-light); color: var(--violet-deep); }
.role-manager { background: #eff6ff; color: #2563eb; }
.role-buyer { background: #ecfdf5; color: #059669; }

/* ---- Empty state ---- */
.empty-state { text-align: center; padding: 30px 16px; color: var(--muted); }
.empty-icon { font-size: 30px; margin-bottom: 8px; }
.empty-state p { margin: 0 0 14px; font-size: 13.5px; }

/* ---- Formulaires sections ---- */
.form-section { border: 1px solid #f2f0f7; border-radius: 12px; padding: 14px 16px; margin: 0; grid-column: 1 / -1; }
.form-section legend { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); padding: 0 6px; }
.form-actions { grid-column: 1 / -1; display: flex; gap: 12px; margin-top: 4px; }

/* ---- KPI overview ---- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px; margin-bottom: 18px; }
.kpi-card {
  background: var(--card);
  border: 1px solid #efedf5;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.kpi-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 44px;
}
.kpi-icon svg { width: 21px; height: 21px; }
.kpi-meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.kpi-value { font-size: 24px; letter-spacing: -.5px; line-height: 1.1; }
.kpi-trend { font-size: 12.5px; font-weight: 600; }
.kpi-trend.up { color: var(--green); }
.kpi-trend.down { color: var(--red); }
.kpi-trend.flat { color: var(--muted); }

/* ---- Badges de statut ---- */
.status-badge { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 4px 11px; white-space: nowrap; }
.status-in_stock { background: #ecfdf3; color: var(--green); }
.status-sold { background: #eff6ff; color: #2563eb; }
.status-dead { background: #fef2f2; color: var(--red); }
.status-other { background: #f2f0f7; color: var(--muted); }

/* ---- Chips fournisseurs ---- */
.chip {
  display: inline-flex; align-items: center;
  font-size: 12px; font-weight: 600;
  border-radius: 999px; padding: 4px 11px; white-space: nowrap;
  background: #f2f0f7; color: var(--ink);
}
.chip-aws { background: #fff4e0; color: #b45309; }
.chip-aws_smtp { background: #fff4e0; color: #b45309; }
.chip-sendgrid { background: #e8f2fd; color: #1d4ed8; }
.chip-mandrill { background: #fdecea; color: #b91c1c; }
.chip-zeptomail { background: #e4f5f2; color: #0f766e; }
.provider-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }

/* ---- Repartition par fournisseur ---- */
.provider-dist { display: grid; gap: 12px; }
.dist-row { display: flex; align-items: center; gap: 12px; }
.dist-label { width: 110px; flex: none; font-size: 13px; font-weight: 600; }
.dist-bar { flex: 1; height: 10px; border-radius: 999px; background: #f2f0f7; overflow: hidden; }
.dist-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--violet), var(--violet-dark)); }
.dist-count { width: 40px; text-align: right; font-weight: 700; font-size: 13.5px; font-variant-numeric: tabular-nums; }

/* ---- Analyser / Import ---- */
.import-bar { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 14px 0 18px; }
.price-field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; }
.price-input { position: relative; }
.price-input input { width: 140px; border: 1px solid transparent; background: #f5f4f8; border-radius: 10px; padding: 11px 34px 11px 14px; outline: none; font-size: 14px; }
.price-input input:focus { border-color: var(--violet); background: #fff; }
.price-cur { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; }

.analyze-status { font-size: 13px; font-weight: 600; min-height: 18px; margin: 4px 0 12px; }
.analyze-status.ok { color: var(--green); }
.analyze-status.err { color: var(--red); }

.unit-results { display: grid; gap: 8px; margin-bottom: 14px; }
.unit-row {
  display: flex; gap: 12px;
  background: #fff; border: 1px solid #efedf5; border-radius: 12px; padding: 11px 14px;
}
.unit-row.invalid { border-color: #fee2e2; background: #fffafa; }
.unit-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; margin-top: 5px; }
.unit-dot.ok { background: var(--green); }
.unit-dot.bad { background: var(--red); }
.unit-info { flex: 1; min-width: 0; }
.unit-info code { font-size: 12.5px; font-weight: 600; word-break: break-all; }
.unit-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 5px; }
.unit-valid { font-size: 12px; font-weight: 700; color: var(--green); }
.unit-invalid { font-size: 12px; font-weight: 600; color: var(--red); }
.unit-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.meta-badge { font-size: 11.5px; font-weight: 600; background: #f2f0f7; color: var(--muted); border-radius: 999px; padding: 2px 9px; }
.meta-badge.warn { background: #fef6e7; color: var(--amber); }

.import-actions { margin: 4px 0 6px; }


/* ================================================================
   AMÉLIORATIONS UI — burger mobile, analyse, fournisseurs, focus
   (classes nouvelles, aucune règle partagée réécrite)
   ================================================================ */

/* ---- Labels de formulaire (équivalent .field > span) ---- */
.field label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
}

/* ---- Sidebar mobile : voile cliquable ---- */
.side-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(39, 33, 58, .35);
  z-index: 35;
}

@media (max-width: 860px) {
  .app.side-open .side-backdrop { display: block; }
  .top { padding: 12px 14px; }
}

@media (max-width: 560px) {
  .top-title small { display: none; }
}

/* ---- Focus visible (accessibilité) ---- */
.btn:focus-visible,
.side-btn:focus-visible,
.icon-btn:focus-visible,
.burger:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 2px;
}

/* ---- Analyse : zone de saisie ---- */
.analyze-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 6px;
}
.analyze-textarea {
  width: 100%;
  border: 1px solid transparent;
  background: #f5f4f8;
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.analyze-textarea:focus {
  border-color: var(--violet);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, .12);
}

/* ---- Analyse : état de chargement (spinner CSS pur) ---- */
.analyze-status { display: flex; align-items: center; gap: 8px; }
.analyze-status.loading::before {
  content: "";
  width: 14px;
  height: 14px;
  flex: none;
  border: 2px solid var(--violet-border);
  border-top-color: var(--violet);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Analyse : lignes de résultats (hiérarchie claire) ---- */
.unit-main { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.unit-row:hover { border-color: var(--violet-border); }

/* ---- Settings : grille des fieldsets (Telegram + wallets) ---- */
.fieldset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}
.fieldset-grid .field { margin-bottom: 0; }

/* ---- Répartition par fournisseur : couleurs dédiées ---- */
.dist-fill.dist-aws       { background: #f59e0b; }
.dist-fill.dist-sendgrid  { background: #2563eb; }
.dist-fill.dist-mandrill  { background: #dc2626; }
.dist-fill.dist-zeptomail { background: #0f766e; }

/* ---- Ventes : statuts de commande CryptAPI ---- */
.status-pending { background: #fef3c7; color: #b45309; }
.status-paid    { background: #ecfdf3; color: var(--green); }
.status-expired { background: #f3f4f6; color: #6b7280; }

/* ---- Journal des paiements : statut "créée" ---- */
.status-created { background: #e0f2fe; color: #0369a1; }

/* ---- Logs : activité générale ---- */
.status-login           { background: #eef2ff; color: #4338ca; }
.status-logout          { background: #f3f4f6; color: #6b7280; }
.status-test_ib         { background: #fef3c7; color: #b45309; }
.status-import_units    { background: #ecfdf3; color: #15803d; }
.status-analyze         { background: #e0f2fe; color: #0369a1; }
.status-account_created { background: #dcfce7; color: #15803d; }
.status-account_deleted { background: #fee2e2; color: #b91c1c; }
.status-settings_saved  { background: #f3e8ff; color: #7c3aed; }
.status-checkout        { background: #e0f2fe; color: #0369a1; }
.status-unit_updated    { background: #fef3c7; color: #b45309; }

/* ---- Mon stock : actions inline ---- */
.stock-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.stock-price-form {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.stock-price-form input[type="number"] {
  width: 72px;
  padding: 6px 8px;
  border: 1px solid var(--violet-border);
  border-radius: 8px;
}

.status-reserved { background: #fef3c7; color: #b45309; }

/* ================================================================
   DARK MODE — composants (utilise les variables redéfinies ci-dessus)
   ================================================================ */

html[data-theme="dark"] body { background: var(--bg); color: var(--ink); }

html[data-theme="dark"] .side-foot { border-top-color: var(--sidebar-border); }
html[data-theme="dark"] .side-label { color: #6b7280; }

html[data-theme="dark"] .btn-secondary,
html[data-theme="dark"] .btn-ghost {
  background: var(--input-bg);
  color: var(--ink);
  border-color: var(--violet-border);
}
html[data-theme="dark"] .btn-secondary:hover,
html[data-theme="dark"] .btn-ghost:hover { background: var(--violet-light); }

html[data-theme="dark"] .btn-danger { background: rgba(220, 38, 38, .15); color: #f87171; }
html[data-theme="dark"] .btn-danger:hover { background: rgba(220, 38, 38, .25); }

html[data-theme="dark"] .field input,
html[data-theme="dark"] .field select,
html[data-theme="dark"] .field textarea,
html[data-theme="dark"] .search input,
html[data-theme="dark"] .filters select,
html[data-theme="dark"] .price-input input,
html[data-theme="dark"] .analyze-textarea,
html[data-theme="dark"] .stock-price-form input[type="number"] {
  background: var(--input-bg);
  color: var(--ink);
  border-color: transparent;
}
html[data-theme="dark"] .field input:focus,
html[data-theme="dark"] .field select:focus,
html[data-theme="dark"] .field textarea:focus,
html[data-theme="dark"] .search input:focus,
html[data-theme="dark"] .analyze-textarea:focus {
  background: var(--input-focus-bg);
  border-color: var(--violet);
}

html[data-theme="dark"] .top-user {
  background: var(--card);
  border-color: var(--violet-border);
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .kpi-card {
  border-color: var(--panel-border);
}

html[data-theme="dark"] .panel-head,
html[data-theme="dark"] .card-head { border-bottom-color: var(--panel-head-border); }

html[data-theme="dark"] .table th { color: var(--chart-label); border-bottom-color: var(--panel-head-border); }
html[data-theme="dark"] .table td { border-bottom-color: var(--table-border); }
html[data-theme="dark"] .table tbody tr:hover { background: var(--table-hover); }

html[data-theme="dark"] .analyze-line,
html[data-theme="dark"] .unit-row {
  background: var(--card);
  border-color: var(--panel-border);
}
html[data-theme="dark"] .unit-row.invalid { background: rgba(220, 38, 38, .08); border-color: rgba(220, 38, 38, .25); }

html[data-theme="dark"] .form-section { border-color: var(--panel-border); }
html[data-theme="dark"] .order-text { background: var(--input-bg); color: var(--ink); }
html[data-theme="dark"] .dist-bar { background: var(--input-bg); }
html[data-theme="dark"] .meta-badge { background: var(--input-bg); }
html[data-theme="dark"] .chip:not([class*="chip-"]) { background: var(--input-bg); color: var(--ink); }

html[data-theme="dark"] .status-in_stock { background: rgba(22, 163, 74, .15); color: #4ade80; }
html[data-theme="dark"] .status-sold { background: rgba(37, 99, 235, .15); color: #60a5fa; }
html[data-theme="dark"] .status-dead { background: rgba(220, 38, 38, .15); color: #f87171; }
html[data-theme="dark"] .status-other { background: var(--input-bg); color: var(--muted); }
html[data-theme="dark"] .status-pending { background: rgba(217, 119, 6, .15); color: #fbbf24; }
html[data-theme="dark"] .status-paid { background: rgba(22, 163, 74, .15); color: #4ade80; }
html[data-theme="dark"] .status-expired { background: var(--input-bg); color: var(--muted); }

html[data-theme="dark"] .flash-ok { background: rgba(22, 163, 74, .15); color: #4ade80; }
html[data-theme="dark"] .flash-err { background: rgba(220, 38, 38, .15); color: #f87171; }

html[data-theme="dark"] .chip-aws,
html[data-theme="dark"] .chip-aws_smtp { background: rgba(245, 158, 11, .15); color: #fbbf24; }
html[data-theme="dark"] .chip-sendgrid { background: rgba(37, 99, 235, .15); color: #60a5fa; }
html[data-theme="dark"] .chip-mandrill { background: rgba(220, 38, 38, .15); color: #f87171; }
html[data-theme="dark"] .chip-zeptomail { background: rgba(15, 118, 110, .15); color: #2dd4bf; }

html[data-theme="dark"] .role-seller { background: var(--violet-light); color: #c4b5fd; }
html[data-theme="dark"] .role-manager { background: rgba(37, 99, 235, .15); color: #60a5fa; }
html[data-theme="dark"] .role-buyer { background: rgba(5, 150, 105, .15); color: #34d399; }

html[data-theme="dark"] .kpi-ico.violet { background: var(--violet-light); }
html[data-theme="dark"] .kpi-ico.pink { background: rgba(219, 39, 119, .15); color: #f472b6; }
html[data-theme="dark"] .kpi-ico.amber { background: rgba(217, 119, 6, .15); color: #fbbf24; }
html[data-theme="dark"] .kpi-ico.green { background: rgba(22, 163, 74, .15); color: #4ade80; }

html[data-theme="dark"] .side-backdrop { background: rgba(0, 0, 0, .55); }
html[data-theme="dark"] .burger { background: var(--card); border-color: var(--violet-border); color: var(--ink); }

html[data-theme="dark"] .smtp-item { background: var(--input-bg); border-color: var(--panel-border); }
html[data-theme="dark"] .smtp-name { color: var(--ink); }

html[data-theme="dark"] .chart-wrap line { stroke: var(--chart-grid) !important; }
html[data-theme="dark"] .chart-wrap text { fill: var(--chart-label) !important; }

/* ---- Toggle thème ---- */
.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.theme-toggle { flex-shrink: 0; }
.theme-toggle .icon-sun,
.theme-toggle .icon-moon { width: 18px; height: 18px; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
html:not([data-theme="dark"]) .theme-toggle .icon-sun { display: none; }
html:not([data-theme="dark"]) .theme-toggle .icon-moon { display: block; }
html[data-theme="dark"] .theme-toggle { color: #fbbf24; }
html:not([data-theme="dark"]) .theme-toggle { color: var(--muted); }

/* ---- Glyphs fournisseurs ---- */
.provider-glyph {
  flex: none;
  display: inline-block;
  vertical-align: middle;
}
.chip .provider-glyph,
.badge-provider .provider-glyph { margin-right: 2px; }

/* ---- Toasts (dashboard) ---- */
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  max-width: min(92vw, 380px);
  padding: 13px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
  color: #fff;
  background: rgba(39, 33, 58, .92);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .35);
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .3s ease, transform .3s ease;
}
.toast.toast-show { opacity: 1; transform: translateY(0); }
.toast.toast-ok { background: #15803d; }
.toast.toast-err { background: #b91c1c; }
.toast.toast-warn { background: #b45309; }
html[data-theme="dark"] .toast:not(.toast-ok):not(.toast-err):not(.toast-warn) {
  background: #1b2030;
  border: 1px solid var(--panel-border);
}

/* Masque les flash quand JS actif (toasts les remplacent) */
.js-toasts .flash { display: none; }

/* ---- Bannière onboarding (wallet obligatoire) : gros, persistant, visible ---- */
.onboard-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  margin-bottom: 20px;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.5;
  color: #fff;
  background: linear-gradient(135deg, #b45309, #b91c1c);
  box-shadow: 0 10px 26px rgba(185, 28, 28, .28);
}
.onboard-banner strong { font-weight: 800; }
.onboard-banner-icon {
  font-size: 26px;
  line-height: 1;
  flex-shrink: 0;
}
@media (max-width: 640px) {
  .onboard-banner { font-size: 15px; padding: 15px 16px; }
}

/* ---- Liaison Telegram (code plateforme) ---- */
.tg-code {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  padding: 12px 20px;
  margin: 8px 0 12px;
  border-radius: 10px;
  background: rgba(139, 92, 246, .15);
  border: 1px solid rgba(139, 92, 246, .35);
  color: var(--text, #e9e4f5);
  user-select: all;
}
.tg-link-steps {
  margin: 0 0 16px 1.2rem;
  line-height: 1.7;
}
.tg-link-steps code {
  font-size: .95em;
}

/* ---- Modale (Test IB dashboard stock) ---- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal[hidden] { display: none; }

.modal-backdrop { position: absolute; inset: 0; background: rgba(39, 33, 58, .45); }
html[data-theme="dark"] .modal-backdrop { background: rgba(0, 0, 0, .6); }

.modal-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--panel-border, transparent);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(39, 33, 58, .25);
  overflow: hidden;
}
html[data-theme="dark"] .modal-card { box-shadow: 0 20px 50px rgba(0, 0, 0, .5); }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--panel-head-border, #f2f0f7);
}
.modal-head h2 { margin: 0; font-size: 16px; }

.modal-close {
  border: 0;
  background: none;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease, color .15s ease;
}
.modal-close:hover { color: var(--ink); background: var(--violet-light); }

.modal-body { padding: 18px 20px; }

.modal-msg { margin: 0; font-size: 13px; min-height: 18px; }
.modal-msg.msg-ok      { color: var(--green); }
.modal-msg.msg-sandbox { color: var(--amber); }
.modal-msg.msg-fail    { color: var(--red); }

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--panel-head-border, #f2f0f7);
}

#stock-test-submit:disabled { gap: 8px; }
#stock-test-submit:disabled::before {
  content: "";
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: modal-spin .7s linear infinite;
  flex: none;
}
@keyframes modal-spin { to { transform: rotate(360deg); } }

.stock-ib-ok { font-size: 12px; white-space: nowrap; }

/* ---- Tri colonne tableau stock ---- */
.th-sort a {
  color: inherit;
  text-decoration: none;
  font-weight: inherit;
  white-space: nowrap;
}
.th-sort a:hover { color: var(--violet); }

.modal-close:focus-visible,
.modal-body .field input:focus-visible,
.modal-body .field select:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 2px;
}

@media (max-width: 560px) {
  .modal { padding: 14px; }
  .modal-card { max-width: 100%; }
}

/* ---- Micro-animations ---- */
@media (prefers-reduced-motion: no-preference) {
  .modal:not([hidden]) {
    animation: modal-fade-in .25s ease;
  }
  .modal:not([hidden]) .modal-card {
    animation: modal-scale-in .25s ease;
  }
}
@keyframes modal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes modal-scale-in {
  from { opacity: 0; transform: scale(.96); }
  to { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .badge:hover { transform: none; }
  .side-btn.active { padding-left: 12px; }
}

/* ---- Login refonte ---- */
html[data-theme="dark"] .login-body { background: var(--bg); }

.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(109, 40, 217, .22), transparent 55%),
    radial-gradient(ellipse 60% 50% at 100% 100%, rgba(139, 92, 246, .12), transparent 50%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 32px 32px;
}

.login-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}
.login-logo svg { width: 64px; height: 64px; }

.login-card h1 {
  font-size: 26px;
  margin: 0 0 4px;
  letter-spacing: -.4px;
  text-align: center;
}
.login-sub {
  color: var(--muted);
  margin: 0 0 28px;
  font-size: 14px;
  text-align: center;
  line-height: 1.5;
}

.login-card .field input {
  background: var(--input-bg);
}
.login-card .field input:focus {
  background: var(--input-focus-bg);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, .18);
}

.login-brand {
  display: block;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--violet);
  margin-bottom: 8px;
}

@media (max-width: 375px) {
  .login-card { padding: 28px 20px 24px; }
  .top-actions { gap: 4px; }
  .toast { right: 12px; bottom: 12px; left: 12px; max-width: none; }
}
