/* Composants : cartes en verre, chiffres clés, pastilles, tableaux, champs, boutons. */

/* ---------- Carte en verre ---------- */
.card {
  position: relative; min-width: 0; border-radius: var(--r-lg); background: var(--card); border: 1px solid var(--line);
  box-shadow: var(--highlight), var(--shadow-card); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); }
.card__head--ruled { border-bottom: 1px solid var(--line); }
.card__title { display: flex; align-items: center; gap: 8px; margin: 0; font-size: var(--t-lg); font-weight: 600; letter-spacing: -0.01em; }
.card__title svg { width: 17px; height: 17px; color: var(--accent); }
.card__sub { margin: 2px 0 0; color: var(--muted); font-size: var(--t-sm); }
.card__body { padding: 0 var(--sp-5) var(--sp-5); }
.card__body--top { padding-top: var(--sp-4); }
.link {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--card); color: var(--ink-2); font-size: var(--t-xs); font-weight: 600; white-space: nowrap;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.link:hover { background: var(--hover); color: var(--ink); }
.link svg { width: 13px; height: 13px; }

/* Variation par rapport à la période d'avant : flèche + chiffre + couleur. */
.delta { display: inline-flex; align-items: center; gap: 2px; height: 20px; padding: 0 7px; border-radius: var(--r-pill); font-size: var(--t-xs); font-weight: 600; white-space: nowrap; }
.delta svg { width: 11px; height: 11px; }
.delta--up { color: var(--ok); background: var(--ok-soft); }
.delta--down { color: var(--bad); background: var(--bad-soft); }
.delta--flat { color: var(--ink-2); background: var(--chip); }

/* ---------- Filtres ---------- */
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-pill); background: var(--well); border: 1px solid var(--line-strong); }
.seg button {
  height: 28px; padding: 0 12px; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--ink-2);
  font-size: var(--t-sm); font-weight: 500; white-space: nowrap; transition: background var(--dur-fast), color var(--dur-fast);
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--seg-on-bg); color: var(--seg-on-ink); font-weight: 600; box-shadow: var(--seg-on-shadow); }
.select {
  height: 34px; padding: 0 32px 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line-strong);
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%237f8ba3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
  appearance: none; font-size: var(--t-sm); font-weight: 500; color: var(--ink);
}
.select option { background: var(--select-bg); color: var(--ink); }

/* ---------- Statut d'une vente : icône + libellé ---------- */
.status { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: var(--r-pill); font-size: var(--t-xs); font-weight: 600; white-space: nowrap; }
.status svg { width: 11px; height: 11px; }
.status--paid { color: var(--ok); background: var(--ok-soft); }
.status--refunded { color: var(--warn); background: var(--warn-soft); }
.status--disputed { color: var(--bad); background: var(--bad-soft); }
.status--live { color: var(--ok); background: var(--ok-soft); }
.status--live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--live); }
.status--idle { color: var(--ink-2); background: var(--chip); }
.pulse { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--live); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); } 70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); } 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); } }

/* ---------- Tableau des ventes ---------- */
.table { width: 100%; border-collapse: collapse; font-size: var(--t-base); }
.table th {
  padding: 10px var(--sp-5); border-bottom: 1px solid var(--line); color: var(--faint); font-size: var(--t-2xs); font-weight: 600;
  letter-spacing: 0.08em; text-align: left; text-transform: uppercase; white-space: nowrap;
}
.table td { padding: 12px var(--sp-5); border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background var(--dur-fast); }
.table tbody tr:hover { background: var(--hover); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .right { text-align: right; }
.cust { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cust__avatar {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; flex: none; font-size: var(--t-2xs); font-weight: 700;
  color: var(--ink-2); background: var(--chip);
}
.cust div strong { display: block; font-weight: 600; white-space: nowrap; }
.cust div span { display: block; color: var(--muted); font-size: var(--t-xs); white-space: nowrap; }
.shop-tag { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); white-space: nowrap; }
.amount { font-weight: 600; white-space: nowrap; }
.amount--void { color: var(--muted); text-decoration: line-through; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* Un tableau défile dans sa carte, jamais la page. Les colonnes secondaires se masquent selon la largeur
   RÉELLE de la carte (barre latérale ouverte ou repliée), pas celle de l'écran. */
.table-wrap { overflow-x: auto; overscroll-behavior-x: contain; container: table-wrap / inline-size; }
@container table-wrap (max-width: 799px) { .table .col-shop { display: none; } }
@container table-wrap (max-width: 659px) { .table .col-date { display: none; } }
@container table-wrap (max-width: 499px) {
  .table .col-status { display: none; }
  .table th, .table td { padding-left: 10px; padding-right: 10px; }
  .table :is(th, td):first-child { padding-left: var(--sp-5); }
  .table :is(th, td):last-child { padding-right: var(--sp-5); }
  .cust div :is(strong, span) { white-space: normal; overflow-wrap: anywhere; }
}

/* ---------- Boutons et champs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); font-size: var(--t-sm); font-weight: 600;
  transition: background var(--dur-fast), filter var(--dur-fast), transform var(--dur-fast);
}
.btn:hover { background: var(--hover); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn:disabled:hover { background: var(--card); }
.btn--primary { border-color: transparent; background: var(--accent-strong); color: var(--on-accent); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 8px 20px -10px var(--accent); }
.btn--primary:hover { background: var(--accent-strong); filter: brightness(1.08); }
.btn svg { width: 15px; height: 15px; }

.field { display: grid; gap: 6px; }
.field label { color: var(--ink-2); font-size: var(--t-sm); font-weight: 500; }
.input {
  height: 40px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--card);
  font-size: 16px; color: var(--ink); transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.input::placeholder { color: var(--faint); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.empty { display: grid; place-items: center; gap: var(--sp-2); padding: var(--sp-7) var(--sp-4); color: var(--muted); text-align: center; font-size: var(--t-sm); }
.empty svg { width: 24px; height: 24px; color: var(--faint); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--s1)); flex: none; }
.mark {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; flex: none; color: #fff; font-size: var(--t-2xs); font-weight: 700;
  background: var(--c, var(--s1)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
