/* ==========================================================================
   BizFlow — components.css
   Composants réutilisables par toutes les pages : boutons, cartes, badges,
   avatars, tableaux, menus déroulants, onglets segmentés, barres de
   progression, toasts, états vides.
   ========================================================================== */

/* ---------- Boutons ---------- */
.btn {
  --btn-bg: var(--surface);
  --btn-color: var(--text);
  --btn-border: var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--btn-border);
  border-radius: var(--radius);
  background: var(--btn-bg);
  color: var(--btn-color);
  font-size: var(--fs-base);
  font-weight: 550;
  white-space: nowrap;
  user-select: none;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.btn .lucide {
  width: 16px;
  height: 16px;
}

.btn:active {
  transform: scale(0.97);
}

.btn--primary {
  --btn-bg: var(--primary-solid);
  --btn-color: #fff;
  --btn-border: transparent;
  box-shadow: 0 1px 2px rgba(16, 16, 30, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.btn--primary:hover {
  --btn-bg: var(--primary-solid-hover);
}

.btn--primary:focus-visible {
  box-shadow: var(--ring);
}

.btn--secondary {
  box-shadow: var(--shadow-xs);
}

.btn--secondary:hover {
  --btn-bg: var(--surface-hover);
  --btn-border: var(--border-strong);
}

.btn--block {
  width: 100%;
}

/* Bouton icône (header, actions de ligne…) */
.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: var(--radius);
  color: var(--text-2);
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.icon-btn:hover,
.icon-btn[aria-expanded="true"] {
  background: var(--surface-hover);
  color: var(--text);
}

.icon-btn:active .lucide {
  transform: scale(0.9);
}

/* Lien-bouton discret */
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-sm);
  font-weight: 550;
  color: var(--primary-text);
  white-space: nowrap;
  text-underline-offset: 3px;
  transition: color var(--dur-fast) var(--ease);
}

.link-btn .lucide {
  width: 15px;
  height: 15px;
}

.link-btn:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* ---------- Cartes ---------- */
.card {
  position: relative;
  min-width: 0;
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.card--flush {
  padding: 0;
  overflow: hidden;
}

.card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.card__head--padded {
  padding: var(--space-5) var(--space-5) 0;
  margin-bottom: var(--space-4);
}

.card__title {
  font-family: var(--font-display);
  font-size: var(--fs-md);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card__subtitle {
  margin-top: 2px;
  font-size: var(--fs-sm);
  color: var(--text-3);
}

/* ---------- Badges & statuts ---------- */
.badge {
  --badge-bg: var(--surface-active);
  --badge-color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--radius-full);
  background: var(--badge-bg);
  color: var(--badge-color);
  font-size: var(--fs-xs);
  font-weight: 550;
  white-space: nowrap;
}

.badge .lucide {
  width: 12px;
  height: 12px;
  stroke-width: 2.4;
}

.badge--success { --badge-bg: var(--success-soft); --badge-color: var(--success-text); }
.badge--warning { --badge-bg: var(--warning-soft); --badge-color: var(--warning-text); }
.badge--danger  { --badge-bg: var(--danger-soft);  --badge-color: var(--danger-text); }
.badge--info    { --badge-bg: var(--info-soft);    --badge-color: var(--info-text); }
.badge--primary { --badge-bg: var(--primary-soft); --badge-color: var(--primary-text); }

/* Variante avec pastille colorée */
.badge--dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.dot-indicator {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 2px var(--bg);
}

.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--dot-color, var(--text-3));
}

.legend-dot--primary { --dot-color: var(--primary); }
.legend-dot--profit { --dot-color: var(--series-profit); }

/* ---------- Avatars ---------- */
.avatar {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--avatar-bg, var(--primary-solid));
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.avatar--sm { width: 28px; height: 28px; font-size: 11px; }
.avatar--md { width: 34px; height: 34px; font-size: 12px; }

/* ---------- Tableaux ---------- */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  font-size: var(--fs-base);
}

.table th {
  padding: 10px var(--space-5);
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

.table td {
  padding: 12px var(--space-5);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr {
  transition: background-color var(--dur-fast) var(--ease);
}

.table tbody tr:hover {
  background: var(--surface-2);
}

.table .text-right {
  text-align: right;
}

.cell-ref {
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
}

.cell-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.cell-user__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}

.cell-user__name {
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell-user__meta {
  font-size: var(--fs-xs);
  color: var(--text-3);
}

.cell-amount {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.cell-payment {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
}

.cell-payment .lucide {
  width: 15px;
  height: 15px;
  color: var(--text-3);
}

/* ---------- Menus déroulants ---------- */
.dropdown {
  position: relative;
}

.dropdown-panel {
  position: absolute;
  top: calc(100% + 8px);
  z-index: 80;
  min-width: 220px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  transform-origin: top right;
  animation: dropdown-in var(--dur) var(--ease-out);
}

.dropdown-panel--right {
  right: 0;
}

@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.dropdown-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
  font-weight: 600;
}

.menu {
  width: 240px;
}

.menu__header {
  display: flex;
  flex-direction: column;
  padding: 8px 10px 10px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
  line-height: 1.35;
}

.menu__title {
  font-weight: 600;
}

.menu__subtitle {
  font-size: var(--fs-xs);
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: var(--fs-base);
  text-align: left;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.menu__item .lucide {
  width: 16px;
  height: 16px;
  color: var(--text-3);
}

.menu__item:hover,
.menu__item:focus-visible {
  background: var(--surface-hover);
  color: var(--text);
}

.menu__item--danger:hover,
.menu__item--danger:focus-visible {
  background: var(--danger-soft);
  color: var(--danger-text);
}

.menu__item--danger:hover .lucide,
.menu__item--danger:focus-visible .lucide {
  color: var(--danger-text);
}

.menu__sep {
  height: 1px;
  margin: 6px 0;
  background: var(--border);
}

/* Notifications */
.notifications {
  width: 360px;
}

.notifications__list {
  max-height: 360px;
  overflow-y: auto;
}

.notification {
  display: flex;
  gap: 12px;
  padding: 10px;
  border-radius: var(--radius-sm);
  transition: background-color var(--dur-fast) var(--ease);
}

.notification:hover {
  background: var(--surface-hover);
}

.notification__icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: var(--icon-bg, var(--surface-active));
  color: var(--icon-color, var(--text-2));
}

.notification__icon .lucide {
  width: 16px;
  height: 16px;
}

.notification__body {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-sm);
  line-height: 1.4;
}

.notification__title,
.notification__text {
  display: block;
}

.notification__title {
  font-weight: 550;
}

.notification__text {
  color: var(--text-3);
}

.notification.is-unread .notification__title::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 6px;
  vertical-align: middle;
  border-radius: 50%;
  background: var(--primary);
}

/* Résultats de recherche */
.search-results {
  left: 0;
  right: 0;
  max-height: 420px;
  overflow-y: auto;
  transform-origin: top center;
}

.search-results__group {
  padding: 8px 10px 4px;
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-3);
}

.search-result {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  text-align: left;
  transition: background-color var(--dur-fast) var(--ease);
}

.search-result:hover,
.search-result.is-focused {
  background: var(--surface-hover);
}

.search-result__icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: var(--radius-xs);
  background: var(--surface-active);
  color: var(--text-2);
}

.search-result__icon .lucide {
  width: 15px;
  height: 15px;
}

.search-result__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.search-result__title {
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result__meta {
  font-size: var(--fs-xs);
  color: var(--text-3);
}

.search-result mark {
  background: var(--primary-soft);
  color: var(--primary-text);
  border-radius: 3px;
}

.search-results__empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--text-3);
  font-size: var(--fs-sm);
}

/* ---------- Contrôle segmenté ---------- */
.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--surface-active);
  border-radius: var(--radius);
  flex-shrink: 0;
}

.segmented__item {
  height: 28px;
  padding: 0 12px;
  border-radius: 7px;
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 550;
  white-space: nowrap;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.segmented__item:hover {
  color: var(--text);
}

.segmented__item.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* ---------- Barre de progression ---------- */
.progress {
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--surface-active);
  overflow: hidden;
}

.progress__bar {
  height: 100%;
  width: var(--value, 0%);
  border-radius: inherit;
  background: var(--progress-color, var(--primary));
}

.progress--danger { --progress-color: var(--danger); }
.progress--warning { --progress-color: var(--warning); }

/* ---------- Toasts ---------- */
.toast-region {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 360px;
  max-width: calc(100vw - 32px);
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toast-in var(--dur-slow) var(--ease-out);
}

.toast.is-leaving {
  animation: toast-out var(--dur) var(--ease) forwards;
}

.toast__icon {
  color: var(--toast-color, var(--primary));
  margin-top: 1px;
}

.toast--success { --toast-color: var(--success); }
.toast--warning { --toast-color: var(--warning); }
.toast--danger  { --toast-color: var(--danger); }

.toast__body {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-sm);
  line-height: 1.45;
}

.toast__title {
  font-weight: 600;
}

.toast__text {
  color: var(--text-3);
}

.toast__close {
  width: 24px;
  height: 24px;
  margin: -2px -6px 0 0;
  border-radius: var(--radius-xs);
}

.toast__close .lucide {
  width: 14px;
  height: 14px;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateX(16px); }
}

/* ---------- Message vide dans une liste ---------- */
.empty-inline {
  padding: 20px 0;
  text-align: center;
  color: var(--text-3);
  font-size: var(--fs-sm);
}

/* ==========================================================================
   Composants des pages (phase 2)
   ========================================================================== */

.badge--neutral { --badge-bg: var(--surface-active); --badge-color: var(--text-2); }

/* ---------- Bandeau de chiffres ---------- */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  padding: 0;
  margin-bottom: var(--space-4);
}

.stat-strip__item {
  padding: 16px 20px;
  border-left: 1px solid var(--border);
}

.stat-strip__item:first-child {
  border-left: none;
}

.stat-strip__label {
  font-size: var(--fs-sm);
  color: var(--text-2);
}

.stat-strip__value {
  margin-top: 4px;
  font-size: var(--fs-xl);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.stat-strip__value small {
  margin-left: 4px;
  font-size: var(--fs-sm);
  font-weight: 500;
  letter-spacing: 0;
  color: var(--text-3);
}

.stat-strip__value.is-danger  { color: var(--danger-text); }
.stat-strip__value.is-warning { color: var(--warning-text); }

.stat-strip__detail {
  margin-top: 2px;
  font-size: var(--fs-xs);
  color: var(--text-3);
}

/* ---------- Barre d'outils ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
}

.toolbar__search {
  flex: 1 1 240px;
  max-width: 320px;
}

.toolbar__end {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

.toolbar__count {
  font-size: var(--fs-sm);
  color: var(--text-3);
  white-space: nowrap;
}

/* Onglets de filtre (soulignés, distincts du contrôle segmenté) */
.filter-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-tabs__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 500;
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.filter-tabs__item:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.filter-tabs__item.is-active {
  background: var(--primary-soft);
  color: var(--primary-text);
}

.filter-tabs__count {
  min-width: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--surface-active);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.filter-tabs__item.is-active .filter-tabs__count {
  background: var(--surface);
  color: var(--primary-text);
}

/* ---------- Champs ---------- */
.input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-base);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.input:hover {
  border-color: var(--text-3);
}

.input:focus {
  outline: 2px solid transparent;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.input[aria-invalid="true"] {
  border-color: var(--danger);
}

.input--sm {
  height: 36px;
  font-size: var(--fs-sm);
}

.input--textarea {
  height: auto;
  padding: 10px 12px;
  line-height: 1.5;
  resize: vertical;
}

select.input {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23626c66' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.input-group {
  display: flex;
}

.input-group .input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.input-group__suffix {
  display: grid;
  place-items: center;
  padding: 0 12px;
  border: 1px solid var(--border-input);
  border-left: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: var(--fs-sm);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field--full {
  grid-column: 1 / -1;
}

.field__label {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text);
}

.field__optional {
  font-weight: 400;
  color: var(--text-3);
}

.field__hint {
  font-size: var(--fs-xs);
  color: var(--text-3);
}

.field__error {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--danger-text);
}

/* ---------- Fenêtre modale ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(12, 17, 15, 0.5);
  animation: fade-in var(--dur) var(--ease);
}

.modal-backdrop.is-leaving {
  animation: fade-out 160ms var(--ease) forwards;
}

.modal-open {
  overflow: hidden;
}

.modal {
  width: 100%;
  max-height: calc(100dvh - 48px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  animation: modal-in var(--dur-slow) var(--ease-out);
}

.modal--md { max-width: 560px; }
.modal--lg { max-width: 760px; }

.modal__form {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.modal__title {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.modal__description {
  margin-top: 2px;
  font-size: var(--fs-sm);
  color: var(--text-3);
}

.modal__head .icon-btn {
  margin: -6px -10px 0 0;
}

.modal__body {
  padding: 20px 24px;
  overflow-y: auto;
}

.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* ---------- Tableaux de données ---------- */
.data-table .row-link {
  font-weight: 550;
  color: var(--text);
  text-align: left;
  border-radius: var(--radius-xs);
}

.data-table .row-link:hover {
  color: var(--primary-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cell-muted {
  color: var(--text-3);
}

.cell-stock {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 140px;
}

.cell-stock .progress {
  flex: 1;
  max-width: 80px;
}

.cell-stock__qty {
  min-width: 34px;
  font-variant-numeric: tabular-nums;
  font-weight: 550;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 2px;
}

.icon-btn--sm {
  width: 32px;
  height: 32px;
}

.icon-btn--sm .lucide {
  width: 16px;
  height: 16px;
}

.empty-inline--padded {
  padding: 48px 24px;
}

.empty-inline__title {
  margin-bottom: 4px;
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--text);
}

/* ---------- Bouton destructeur ---------- */
.btn--danger {
  --btn-bg: var(--danger-text);
  --btn-color: #fff;
  --btn-border: transparent;
}

.btn--danger:hover {
  --btn-bg: #8f231b;
}

[data-theme="dark"] .btn--danger {
  --btn-bg: #b3261e;
}

.btn--ghost-danger {
  --btn-border: transparent;
  --btn-bg: transparent;
  --btn-color: var(--danger-text);
}

.btn--ghost-danger:hover {
  --btn-bg: var(--danger-soft);
}

.modal__foot .btn--ghost-danger {
  margin-right: auto;
}

.confirm-text {
  color: var(--text-2);
  line-height: 1.6;
}

/* ---------- En-têtes triables ---------- */
.th-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: -4px -6px;
  padding: 4px 6px;
  border-radius: var(--radius-xs);
  color: inherit;
  font: inherit;
  white-space: nowrap;
}

.th-sort .lucide {
  width: 13px;
  height: 13px;
  opacity: 0.55;
}

.th-sort:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.th-sort.is-active {
  color: var(--text);
}

.th-sort.is-active .lucide {
  opacity: 1;
}

.text-right .th-sort {
  flex-direction: row-reverse;
}

/* ---------- Lien dans une liste (ouvre une fiche) ---------- */
.row-link {
  color: inherit;
  border-radius: var(--radius-xs);
}

.row-link:hover {
  color: var(--primary-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Menu de tri : seulement quand les en-têtes de colonnes sont masqués */
.sort-select {
  display: none;
}

@media (max-width: 1024px) {
  .sort-select {
    display: block;
  }
}

.btn--sm {
  height: 32px;
  padding: 0 10px;
  font-size: var(--fs-sm);
}

/* ---------- Écran de verrouillage ---------- */
.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--nav-bg); /* opaque : rien de la boutique ne se voit avant le code */
  animation: fade-in var(--dur) var(--ease);
}

.lock-open {
  overflow: hidden;
}

.lock-screen__card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-4);
  width: min(360px, 100%);
  padding: 32px 28px 24px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.lock-screen__logo {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  background: var(--primary-soft);
  color: var(--primary);
}

.lock-screen__logo--warning {
  background: var(--warning-soft);
  color: var(--warning-text);
}

.lock-screen__title {
  font-size: var(--fs-lg);
  font-weight: 600;
}

.lock-screen__text {
  margin-top: -8px;
  color: var(--text-2);
  font-size: var(--fs-sm);
  line-height: 1.55;
}

.lock-screen .field {
  text-align: left;
}

.lock-screen__input {
  height: 48px;
  font-size: 22px;
  letter-spacing: 0.4em;
  text-align: center;
}

.lock-screen__forgot {
  align-self: center;
}

/* ---------- Scanner de codes-barres ---------- */
.scanner {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(12, 17, 15, 0.7);
}

.scanner__card {
  width: min(440px, 100%);
  padding: 16px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.scanner__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.scanner__view {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--radius);
  background: #000;
}

.scanner__view video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner__frame {
  position: absolute;
  inset: 30% 12%;
  border: 2px solid var(--sun);
  border-radius: var(--radius);
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.35);
}

.scanner__status {
  margin-top: 12px;
  font-size: var(--fs-sm);
  color: var(--text-2);
  text-align: center;
}

/* Bouton accolé à un champ (scanner) */
.input-group__button {
  display: grid;
  place-items: center;
  width: 44px;
  border: 1px solid var(--border-input);
  border-left: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--surface-2);
  color: var(--text-2);
}

.input-group__button:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.input-group:has(.input-group__button) .input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.input-group:not(:has(.input-group__button)):not(:has(.input-group__suffix)) .input {
  border-radius: var(--radius);
}

/* Cadre d'impression du ticket : présent mais invisible */
.print-frame {
  position: fixed;
  right: 0;
  bottom: 0;
  width: 0;
  height: 0;
  border: 0;
}

/* Explication à gauche du pied de fenêtre (ex. fiche produit d'un employé) */
.modal__foot-note {
  margin-right: auto;
  font-size: var(--fs-sm);
  color: var(--text-2);
}
