/* =====================================================================
   Alertes de stock ThriveCart — feuille de style unique
   ===================================================================== */

:root {
  --ink:        #151a21;
  --ink-soft:   #5a6472;
  --paper:      #f6f7f9;
  --card:       #ffffff;
  --line:       #e3e7ed;
  --petrol:     #0d5c63;   /* actions principales */
  --petrol-dk:  #094348;
  --amber:      #a2590a;   /* alerte deja notifiee */
  --amber-bg:   #fdf3e3;
  --moss:       #2f6b3f;   /* en veille, tout va bien */
  --moss-bg:    #eaf3ec;
  --rust:       #a3231f;   /* incident */
  --rust-bg:    #fbecec;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---- En-tete ------------------------------------------------------- */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 28px;
  background: var(--ink);
  color: #fff;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
}

/* Petite jauge qui sert de logo : le sujet de l'application. */
.brand-mark {
  width: 22px; height: 10px;
  border: 1.5px solid rgba(255,255,255,.55);
  border-radius: 2px;
  background: linear-gradient(to right, #fff 35%, transparent 35%);
}

.masthead nav { display: flex; gap: 20px; align-items: center; }
.masthead nav a {
  color: rgba(255,255,255,.72);
  text-decoration: none;
  font-size: 14px;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}
.masthead nav a:hover { color: #fff; }
.masthead nav a.on { color: #fff; border-bottom-color: #fff; }
.masthead nav a.quiet { color: rgba(255,255,255,.45); margin-left: 8px; }

/* ---- Structure ----------------------------------------------------- */

main { max-width: 1080px; margin: 0 auto; padding: 32px 28px 64px; }

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

h1 { font-size: 24px; letter-spacing: -0.02em; margin: 0; }
h2 { font-size: 18px; margin: 0 0 8px; }

.lead   { color: var(--ink-soft); margin-top: 4px; }
.sub    { color: var(--ink-soft); font-size: 13px; }
.nowrap { white-space: nowrap; }
.err    { color: var(--rust); }

.footnote {
  margin-top: 20px;
  color: var(--ink-soft);
  font-size: 13px;
}

/* ---- Boutons et liens ---------------------------------------------- */

.btn, button {
  display: inline-block;
  padding: 9px 16px;
  border: 0;
  border-radius: 6px;
  background: var(--petrol);
  color: #fff;
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover, button:hover { background: var(--petrol-dk); }

.btn-danger { background: var(--rust); }
.btn-danger:hover { background: #7f1b18; }

a { color: var(--petrol); }
a.quiet { color: var(--ink-soft); text-decoration: none; }
a.quiet:hover { text-decoration: underline; }
a.danger { color: var(--rust); }

button.link {
  background: none;
  color: var(--petrol);
  padding: 0;
  font-size: inherit;
  text-decoration: underline;
}
button.link:hover { background: none; color: var(--petrol-dk); }

form.inline { display: inline; }

/* ---- Bandeaux ------------------------------------------------------- */

.flash {
  margin: 0 0 18px;
  padding: 12px 16px;
  border-radius: 6px;
  border-left: 3px solid;
  font-size: 14px;
}
.flash-ok    { background: var(--moss-bg);  border-color: var(--moss);  color: #1d4a2a; }
.flash-warn  { background: var(--amber-bg); border-color: var(--amber); color: #6f3d05; }
.flash-error { background: var(--rust-bg);  border-color: var(--rust);  color: #7f1b18; }

/* ---- Tableau -------------------------------------------------------- */

.grid {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.grid th {
  text-align: left;
  padding: 11px 14px;
  background: #fbfcfd;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-soft);
}

.grid td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.grid tr:last-child td { border-bottom: 0; }
.grid tr.off { opacity: .55; }

.grid .num { text-align: right; white-space: nowrap; }
.grid th.num, .grid th.actions { text-align: right; }
.grid .actions { text-align: right; white-space: nowrap; }
.grid .actions a, .grid .actions button { margin-left: 12px; font-size: 13px; }

.pname { display: block; font-weight: 500; }
.ext   { font-size: 12px; }
.hint  {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: var(--amber);
}
.grid td .sub { display: block; margin-top: 3px; }

/* Le stock en chiffres tabulaires : les colonnes s'alignent a l'oeil. */
.stock {
  font-variant-numeric: tabular-nums;
  font-size: 17px;
  font-weight: 600;
}
.stock.low  { color: var(--amber); }
.stock.err  { font-size: 13px; font-weight: 400; color: var(--rust); }
.stock.none { color: var(--ink-soft); }

/* Jauge : d'un coup d'oeil, quels produits approchent de leur seuil. */
.gauge {
  display: block;
  width: 62px;
  height: 3px;
  margin: 5px 0 0 auto;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}
.gauge > span {
  display: block;
  height: 100%;
  background: var(--moss);
}
.stock.low + .gauge > span { background: var(--amber); }

/* ---- Etiquettes ----------------------------------------------------- */

.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.tag-armed { background: var(--moss-bg);  color: var(--moss); }
.tag-sent  { background: var(--amber-bg); color: var(--amber); }
.tag-err   { background: var(--rust-bg);  color: var(--rust); }
.tag-off   { background: #eef0f3;         color: var(--ink-soft); }

.lvl-error   td { background: var(--rust-bg); }
.lvl-warning td { background: var(--amber-bg); }

/* ---- Formulaires ---------------------------------------------------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 26px;
}
.card.narrow { max-width: 520px; }

label {
  display: block;
  margin: 18px 0 6px;
  font-weight: 500;
  font-size: 14px;
}
.card > label:first-of-type { margin-top: 0; }

input[type=text], input[type=email], input[type=password], input[type=number], select {
  width: 100%;
  max-width: 460px;
  padding: 9px 11px;
  border: 1px solid #c8cfd8;
  border-radius: 6px;
  background: #fff;
  font: inherit;
  color: var(--ink);
}
input:focus, select:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--petrol);
  outline-offset: 2px;
}

input[type=number] { max-width: 140px; }

.help {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
  max-width: 460px;
}

label.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
  font-weight: 400;
}
label.check input { width: auto; }

.form-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.filters { display: flex; gap: 16px; font-size: 14px; }
.filters a { color: var(--ink-soft); text-decoration: none; }
.filters a.on { color: var(--ink); font-weight: 600; }

/* ---- Connexion ------------------------------------------------------ */

.signin {
  max-width: 380px;
  margin: 60px auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 32px;
}
.signin button { width: 100%; margin-top: 24px; padding: 11px; }

/* ---- Etat vide ------------------------------------------------------ */

.empty {
  background: var(--card);
  border: 1px dashed #cfd6df;
  border-radius: 8px;
  padding: 48px 32px;
  text-align: center;
}
.empty p { color: var(--ink-soft); margin: 0 0 20px; }

/* ---- Petits écrans -------------------------------------------------- */

@media (max-width: 720px) {
  main { padding: 22px 16px 48px; }
  .masthead { padding: 12px 16px; }
  .grid, .grid thead, .grid tbody, .grid tr, .grid td { display: block; width: 100%; }
  .grid thead { display: none; }
  .grid tr { border-bottom: 1px solid var(--line); padding: 6px 0; }
  .grid td { border: 0; padding: 5px 14px; text-align: left; }
  .grid .num, .grid .actions { text-align: left; }
  .grid .actions a, .grid .actions button { margin: 0 14px 0 0; }
  .gauge { margin-left: 0; }
}

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