/* Icons */
.icon {
  display: inline-block;
  vertical-align: -0.15em;
  flex-shrink: 0;
}

/* Page header block (icon badge + title + subtitle + actions), used by Matériel/Mvt.
   Stock/Emplacements Commandes/Retours — Planning skips it, matching the reference. */
.page-header-block {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  margin-bottom: 1.5rem;
}
.page-header-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--blue-50);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}
.page-header-block .page-title { margin-bottom: 0.1rem; }
.page-header-block .page-subtitle { margin: 0; }
.page-header-actions { margin-left: auto; display: flex; gap: 0.5rem; align-items: center; flex-shrink: 0; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.55rem 1rem;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  line-height: 1.2;
}

.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn-block { display: flex; width: 100%; }

.btn-primary { background: var(--blue-600); color: #fff; }
.btn-primary:hover { background: var(--blue-700); text-decoration: none; }

.btn-secondary { background: #fff; color: var(--slate-800); border-color: var(--slate-200); }
.btn-secondary:hover { background: var(--slate-100); text-decoration: none; }
.btn-secondary.active { background: var(--blue-600); color: #fff; border-color: var(--blue-600); }
.btn-secondary.active:hover { background: var(--blue-700); }

.btn-ghost { background: transparent; color: var(--slate-600); }
.btn-ghost:hover { background: var(--slate-100); text-decoration: none; }

.btn-destructive { background: var(--red-600); color: #fff; }
.btn-destructive:hover { background: var(--red-700); text-decoration: none; }

.btn-orange { background: var(--color-accent-orange); color: #fff; }
.btn-orange:hover { background: #d97e00; text-decoration: none; }

/* Badges / pills */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border: 1px solid transparent;
}

.badge-slate { background: var(--slate-100); color: var(--slate-600); }
.badge-blue { background: var(--blue-100); color: var(--blue-700); border-color: var(--blue-100); }
.badge-red { background: var(--red-100); color: var(--red-700); border-color: var(--red-100); }
.badge-amber { background: var(--amber-100); color: var(--amber-700); border-color: var(--amber-100); }
.badge-emerald { background: var(--emerald-100); color: var(--emerald-700); border-color: var(--emerald-100); }
.badge-orange { background: #ffedd5; color: #c2410c; border-color: #ffedd5; }
.badge-violet { background: #ede9fe; color: #6d28d9; border-color: #ede9fe; }
.badge-indigo { background: #e0e7ff; color: #4338ca; border-color: #e0e7ff; }
.badge-pink { background: #fce7f3; color: #be185d; border-color: #fce7f3; }
.badge-teal { background: #ccfbf1; color: #0f766e; border-color: #ccfbf1; }
.badge-cyan { background: #cffafe; color: #0e7490; border-color: #cffafe; }
.badge-lime { background: #ecfccb; color: #4d7c0f; border-color: #ecfccb; }

.role-badge {
  display: inline-flex;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.role-badge-dev { background: var(--purple-100); color: var(--purple-700); }
.role-badge-admin { background: var(--blue-100); color: var(--blue-700); }
.role-badge-user { background: var(--slate-100); color: var(--slate-600); }

/* Cards */
.card {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

a.card {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
a.card:hover {
  border-color: var(--blue-600);
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.08);
  text-decoration: none;
}

.card-title {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
}

.card-description {
  color: var(--slate-600);
  font-size: 0.9rem;
  margin: 0 0 0.75rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.card-disabled { opacity: 0.65; }

.card-accent-blue { border-left: 4px solid var(--blue-600); }
.card-accent-orange { border-left: 4px solid var(--color-accent-orange); }
.card-accent-red { border-left: 4px solid var(--red-600); }
.card-accent-amber { border-left: 4px solid var(--amber-500); }
.card-accent-emerald { border-left: 4px solid var(--emerald-600); }

/* Alerts / flash messages — floating overlay, never pushes page content (fixed positioning takes
   it out of document flow entirely), auto-dismissed by app.js after 3s. */
.alerts {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
  width: 100%;
  max-width: 480px;
  padding: 0 1rem;
  pointer-events: none;
}
.alerts .alert { box-shadow: 0 4px 16px rgba(15, 23, 42, 0.12); pointer-events: auto; }
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
  border: 1px solid transparent;
  transition: opacity 0.3s ease;
}
.alert-fade-out { opacity: 0; }
.alert-error { background: var(--red-50); color: var(--red-700); border-color: var(--red-100); }
.alert-success { background: var(--emerald-50); color: var(--emerald-700); border-color: var(--emerald-100); }
.alert-info { background: var(--blue-50); color: var(--blue-700); border-color: var(--blue-100); }

/* Forms */
.form { display: flex; flex-direction: column; gap: 0.25rem; }
.form-inline { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 0.65rem; }
.form-inline .btn { height: 2.35rem; }
.form-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--slate-400);
  margin-top: 0.75rem;
}
.form-input {
  height: 2.35rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--slate-200);
  background: #fff;
  padding: 0 0.75rem;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--slate-800);
}
textarea.form-input { height: auto; padding: 0.6rem 0.75rem; }
.form-input:focus {
  outline: none;
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px var(--blue-100);
}
.form-input-otp { letter-spacing: 0.3em; font-variant-numeric: tabular-nums; }
.form-hint { font-size: 0.78rem; color: var(--slate-400); margin: 0.2rem 0 0; }
.form-checkbox-row { display: flex; gap: 1.5rem; margin-top: 0.75rem; font-size: 0.875rem; }
.form button[type="submit"] { margin-top: 1.1rem; align-self: flex-start; }
.form-block .btn-block { align-self: stretch; }
.form-input:disabled { opacity: 0.7; cursor: not-allowed; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.25rem; }
.form-radio-label { display: block; font-weight: normal; font-size: 0.85rem; margin-top: 0.3rem; text-transform: none; }
.form-actions-row { display: flex; gap: 0.6rem; justify-content: flex-end; margin-top: 1.25rem; }

/* All fields of a form laid out on a single row (wraps on narrow viewports) instead of a rigid
   2-column grid — each field is its own compact label+input stack. */
.form-row { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; }
.form-row .form-field { display: flex; flex-direction: column; flex: 1 1 160px; min-width: 140px; }
.form-row .form-field .form-label { margin-top: 0; }

/* A visually framed group of action/quick-choice buttons, so they read as one distinct control
   rather than floating loosely in the card (SMTP save/test, stock quick-reason chips, etc.). */
.button-frame {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  background: var(--slate-50);
  padding: 0.65rem 0.9rem;
  margin-top: 0.75rem;
}
.button-frame .form-label { margin-top: 0; margin-right: 0.15rem; }

.inline-form { display: inline-block; margin: 0; }

/* Status filter tabs (Retours) */
.status-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 1.25rem;
  padding: 0.3rem;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
}
.status-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.8rem;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--slate-600);
  cursor: pointer;
}
.status-tab:hover { background: var(--slate-100); }
.status-tab.active { background: var(--slate-800); color: #fff; }
.status-tab-count {
  background: rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
  font-size: 0.7rem;
}
.status-tab.active .status-tab-count { background: rgba(255, 255, 255, 0.25); }

/* Return history timeline */
.return-history-list {
  list-style: none;
  margin: 0.3rem 0 0;
  padding: 0;
  font-size: 0.78rem;
  color: var(--slate-600);
  max-height: 160px;
  overflow-y: auto;
}
.return-history-list li { padding: 0.3rem 0; border-bottom: 1px solid var(--slate-100); }

/* Color-swatch picker (Statuts Retours admin) */
.color-swatch-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.3rem; }
.color-swatch {
  border: 2px solid transparent;
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--slate-100);
  color: var(--slate-600);
}
.color-swatch.selected { border-color: var(--slate-800); }
.color-swatch-blue { background: var(--blue-100); color: var(--blue-700); }
.color-swatch-amber { background: var(--amber-100); color: var(--amber-700); }
.color-swatch-orange { background: #ffedd5; color: #c2410c; }
.color-swatch-emerald { background: var(--emerald-100); color: var(--emerald-700); }
.color-swatch-red { background: var(--red-100); color: var(--red-700); }
.color-swatch-violet { background: #ede9fe; color: #6d28d9; }
.color-swatch-indigo { background: #e0e7ff; color: #4338ca; }
.color-swatch-pink { background: #fce7f3; color: #be185d; }
.color-swatch-teal { background: #ccfbf1; color: #0f766e; }
.color-swatch-slate { background: var(--slate-100); color: var(--slate-600); }
.color-swatch-cyan { background: #cffafe; color: #0e7490; }
.color-swatch-lime { background: #ecfccb; color: #4d7c0f; }

.status-preview-box { background: var(--slate-50); border-radius: var(--radius-md); padding: 1rem; margin-top: 0.3rem; }

.status-list { list-style: none; margin: 0; padding: 0; }
.status-list-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--slate-100);
}
.status-list-item:last-child { border-bottom: none; }
.status-slug { font-size: 0.75rem; color: var(--slate-400); font-family: "SF Mono", Consolas, monospace; }
.status-list-count { font-size: 0.78rem; color: var(--slate-400); }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--slate-200); border-radius: var(--radius-lg); background: #fff; }
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table thead tr { background: var(--slate-50); border-bottom: 1px solid var(--slate-200); }
.table th {
  text-align: left;
  padding: 0.65rem 1rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--slate-400);
}
.table td { padding: 0.7rem 1rem; border-bottom: 1px solid var(--slate-100); vertical-align: middle; }
.table tbody tr:hover { background: rgba(37, 99, 235, 0.03); }
.table-actions { display: flex; gap: 0.4rem; flex-wrap: nowrap; align-items: center; }
.log-details { max-width: 320px; font-size: 0.75rem; color: var(--slate-600); word-break: break-word; }

/* Misc */
.totp-secret {
  display: inline-block;
  background: var(--slate-100);
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  font-family: "SF Mono", Consolas, monospace;
  letter-spacing: 0.05em;
}
.totp-steps { padding-left: 1.2rem; color: var(--slate-600); font-size: 0.9rem; }
.totp-qr-wrap { display: flex; justify-content: center; margin: 1rem 0; }
.recovery-code-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
}
.recovery-code-list code {
  display: block;
  background: var(--slate-100);
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius-sm);
  text-align: center;
  font-family: "SF Mono", Consolas, monospace;
}
