/* Iroko Stages — composants réutilisables.
   Réutiliser ces classes avant d'en créer de nouvelles. */

/* ---------- Cartes ---------- */

.card {
  border: 1px solid rgba(223, 229, 238, .92);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-body {
  padding: 22px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title h2 {
  margin: 0;
  font-size: 1.04rem;
  letter-spacing: -.02em;
}

.section-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: .78rem;
}

.section-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: var(--radius-md);
  color: var(--blue-800);
  background: var(--blue-100);
}

/* ---------- Indicateurs ---------- */

.kpi-card .card-body {
  padding: 18px 20px;
}

.kpi-label {
  color: var(--muted);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.kpi-value {
  margin-top: 8px;
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}

.kpi-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}

.kpi-row + .kpi-row {
  margin-top: 16px;
}

.kpi-group .kpi-card .card-body,
.kpi-row .kpi-card .card-body {
  padding: 16px 18px;
}

@media (max-width: 1199px) {
  .kpi-row {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }
}

/* ---------- Boutons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: .9rem;
  font-weight: 800;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn[hidden] {
  display: none;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--blue-700), var(--blue-800));
  box-shadow: 0 10px 22px rgba(7, 87, 166, .24);
}

.btn-secondary {
  color: var(--blue-800);
  border-color: #b9d8fb;
  background: var(--blue-50);
}

.btn-ghost {
  color: var(--ink-soft);
  border-color: var(--line);
  background: var(--surface);
}

.btn-danger {
  color: #fff;
  background: linear-gradient(135deg, var(--red-600), var(--red-700));
  box-shadow: 0 10px 22px rgba(201, 0, 24, .2);
}

.btn-block {
  width: 100%;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--ink-soft);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.icon-btn-ghost {
  width: 34px;
  height: 34px;
  color: rgba(255, 255, 255, .78);
  border-color: rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .06);
  box-shadow: none;
}

.icon-btn-ghost:hover {
  color: #fff;
  background: rgba(255, 255, 255, .14);
}

/* ---------- Pastilles et badges ---------- */

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid #cdeedd;
  border-radius: 999px;
  color: var(--success);
  background: var(--success-bg);
  font-size: .8rem;
  font-weight: 750;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22a863;
  box-shadow: 0 0 0 4px rgba(34, 168, 99, .12);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 850;
}

.badge-success {
  color: var(--success);
  background: var(--success-bg);
}

.badge-warning {
  color: var(--warning);
  background: var(--warning-bg);
}

.badge-danger {
  color: var(--danger);
  background: var(--danger-bg);
}

.badge-neutral {
  color: var(--muted);
  background: var(--surface-2);
}

.badge-info {
  color: var(--blue-800);
  background: var(--blue-50);
}

.text-muted {
  color: var(--muted);
  font-size: .78rem;
}

/* ---------- Alertes ---------- */

.alert {
  max-width: 1500px;
  margin: 0 auto 18px;
  padding: 13px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: .88rem;
  font-weight: 650;
}

.alert ul {
  margin: 0;
  padding-left: 18px;
}

.alert-success {
  color: var(--success);
  border-color: #cdeedd;
  background: var(--success-bg);
}

.alert-danger {
  color: var(--danger);
  border-color: #ffd0d7;
  background: var(--danger-bg);
}

.alert-info {
  color: var(--blue-800);
  border-color: #b9d8fb;
  background: var(--blue-50);
}

/* ---------- Formulaires ---------- */

.field {
  display: grid;
  gap: 7px;
}

.field[hidden] {
  display: none;
}

.field label {
  color: var(--ink-soft);
  font-size: .73rem;
  font-weight: 800;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--ink);
  background: var(--surface-2);
  font: inherit;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.field textarea {
  padding: 11px 13px;
  min-height: 96px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--blue-700);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(9, 104, 199, .08);
}

.field input[readonly] {
  color: var(--muted);
}

.input-wrap {
  position: relative;
}

.input-action {
  position: absolute;
  top: 6px;
  right: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid #b9d8fb;
  border-radius: var(--radius-sm);
  color: var(--blue-800);
  background: var(--blue-50);
  font-size: .72rem;
  font-weight: 850;
}

.checkbox-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--ink);
}

.checkbox-item input {
  width: auto;
  min-height: 0;
  accent-color: var(--blue-700);
}

.member-hint {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--muted);
  font-size: .72rem;
}

.member-hint .mini-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--yellow-500);
}

.field-error {
  color: var(--danger);
  font-size: .74rem;
  font-weight: 700;
}

.form {
  display: grid;
  gap: 18px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 4px;
}

/* ---------- Choix binaire et filtres ---------- */

.segmented {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
}

.segmented button {
  min-height: 40px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  color: var(--ink-soft);
  background: transparent;
  font-size: .86rem;
  font-weight: 800;
}

.segmented button.active {
  color: #fff;
  background: var(--blue-800);
  box-shadow: 0 7px 16px rgba(7, 87, 166, .24);
}

.products-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: var(--surface);
  font-size: .78rem;
  font-weight: 800;
}

.filter-chip.active {
  color: var(--blue-800);
  border-color: #b9d8fb;
  background: var(--blue-50);
}

/* ---------- Tuiles d'offres ---------- */

.product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 16px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-align: left;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.product-card:hover {
  transform: translateY(-3px);
  border-color: #b8d7f8;
  box-shadow: 0 16px 28px rgba(28, 53, 89, .1);
}

.product-card.selected {
  border-color: var(--blue-700);
  box-shadow: 0 0 0 3px rgba(9, 104, 199, .09), 0 16px 30px rgba(28, 53, 89, .1);
}

.product-accent {
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  border-radius: 18px 18px 0 0;
  background: var(--blue-700);
}

.product-card:nth-child(2) .product-accent {
  background: var(--red-600);
}

.product-card:nth-child(3) .product-accent {
  background: var(--yellow-500);
}

.product-title {
  font-size: .98rem;
  font-weight: 850;
}

.product-price {
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}

/* ---------- Graphiques reporting ---------- */

.chart-wrap {
  display: grid;
  justify-items: center;
  gap: 16px;
  padding-top: 6px;
}

.chart-pie {
  overflow: visible;
}

.chart-bars {
  overflow: visible;
}

.chart-empty {
  margin: 0;
  color: var(--muted);
  font-size: .86rem;
  text-align: center;
}

.chart-legend {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: .86rem;
  color: var(--ink-soft);
}

.chart-legend li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
}

.chart-slice-1 { stroke: var(--blue-700); }
.chart-slice-2 { stroke: var(--yellow-500); }
.chart-slice-3 { stroke: var(--success); }
.chart-slice-4 { stroke: var(--red-600); }
.chart-slice-empty { stroke: var(--line); }

.chart-bar-1 { fill: var(--blue-700); }
.chart-bar-2 { fill: var(--yellow-500); }
.chart-bar-3 { fill: var(--success); }
.chart-bar-4 { fill: var(--red-600); }

.chart-axis,
.chart-grid {
  stroke: var(--ink-soft);
  stroke-width: 1;
}

.chart-grid {
  stroke-dasharray: 2 2;
  opacity: .4;
}

.chart-axis-label,
.chart-axis-value {
  font-size: .7rem;
  fill: var(--ink-soft);
}

.chart-axis-label {
  transform-box: fill-box;
  transform-origin: center;
}

.chart-dot.chart-slice-1 { background: var(--blue-700); }
.chart-dot.chart-slice-2 { background: var(--yellow-500); }
.chart-dot.chart-slice-3 { background: var(--success); }
.chart-dot.chart-slice-4 { background: var(--red-600); }

/* ---------- Tableaux ---------- */

.data-table {
  font-size: .88rem;
}

.data-table th {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface-2);
  font-size: .74rem;
  font-weight: 850;
  letter-spacing: .04em;
  text-align: left;
  text-transform: uppercase;
}

.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.data-table tbody tr:hover {
  background: var(--blue-50);
}

.data-table .num {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data-table .num .logout-form {
  margin: 0;
}

.table-wrapper {
  max-height: 320px;
  overflow-y: auto;
  border-radius: var(--radius-md);
}

.table-wrapper .data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

/* ---------- État vide ---------- */

.empty-state {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 34px 18px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  color: var(--muted);
  background: var(--surface-2);
  text-align: center;
}

.empty-state p {
  margin: 0;
  font-size: .86rem;
}

.empty-state svg {
  color: var(--blue-700);
  opacity: .5;
}

/* ---------- Connexion : clavier PIN ---------- */

.auth-title {
  font-size: 1.4rem;
}

.auth-subtitle {
  margin: 6px 0 20px;
  color: var(--muted);
  font-size: .86rem;
}

.auth-form {
  display: grid;
  gap: 16px;
}

.pin-display {
  letter-spacing: .5em;
  font-size: 1.1rem;
  text-align: center;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.keypad-key {
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  font-size: 1.1rem;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.keypad-key:hover {
  border-color: #b8d7f8;
  background: var(--blue-50);
}

.keypad-action {
  grid-column: span 2;
  color: var(--ink-soft);
  background: var(--surface-2);
  font-size: .8rem;
  font-weight: 800;
}

.auth-links {
  margin: 0;
  text-align: center;
  font-size: .82rem;
}

/* ---------- Pages d'erreur ---------- */

.error-card {
  text-align: center;
}

.error-code {
  color: var(--blue-700);
  font-size: 3.4rem;
  font-weight: 900;
  letter-spacing: -.05em;
  line-height: 1;
}

.error-detail {
  margin: 14px 0;
  padding: 12px;
  border-radius: var(--radius-md);
  color: var(--ink-soft);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: .74rem;
  text-align: left;
  white-space: pre-wrap;
  overflow-x: auto;
}

.error-trace {
  max-height: 240px;
  overflow-y: auto;
}

/* ---------- Sélecteur de saison (reporting) ---------- */

.season-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.season-form .input {
  min-width: 180px;
}
