/* ═══════════════════════════════════════════
   Pharma Admin — Extended Components
   Extends tokens.css + base.html design system
   ═══════════════════════════════════════════ */

/* ─── KPI Cards ─── */
.pa-kpi {
  display: flex;
  align-items: flex-start;
  gap: var(--pa-s-4);
  background: var(--pa-surface);
  border: 1px solid var(--pa-border);
  border-radius: var(--pa-r-md);
  padding: 18px var(--pa-s-5);
  box-shadow: var(--pa-shadow-xs);
  transition: box-shadow var(--pa-t-base), transform var(--pa-t-base);
  position: relative;
  overflow: hidden;
}

.pa-kpi::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--pa-r-md) var(--pa-r-md) 0 0;
  opacity: 0;
  transition: opacity var(--pa-t-base);
}

.pa-kpi:hover {
  box-shadow: var(--pa-shadow-sm);
  transform: translateY(-1px);
}

.pa-kpi:hover::after {
  opacity: 1;
}

.pa-kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--pa-r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  transition: transform var(--pa-t-base);
}

.pa-kpi:hover .pa-kpi-icon {
  transform: scale(1.05);
}

.pa-kpi-body {
  flex: 1;
  min-width: 0;
}

.pa-kpi-label {
  font-size: var(--pa-fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--pa-text-muted);
  font-weight: 600;
  margin-bottom: var(--pa-s-1);
  line-height: 1.3;
}

.pa-kpi-value {
  font-family: var(--pa-font-mono);
  font-size: var(--pa-fs-2xl);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--pa-text);
  line-height: 1;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pa-kpi-value .pa-kpi-unit {
  font-size: var(--pa-fs-md);
  font-weight: 500;
  color: var(--pa-text-muted);
  letter-spacing: 0;
}

.pa-kpi-sub {
  font-size: var(--pa-fs-xs);
  color: var(--pa-text-muted);
  margin-top: var(--pa-s-1);
  letter-spacing: 0.01em;
}

/* KPI color variants — icon bg + accent bar */
.pa-kpi--emerald .pa-kpi-icon {
  background: var(--pa-emerald-50);
  color: var(--pa-emerald-600);
}
.pa-kpi--emerald::after {
  background: var(--pa-emerald-400);
}

.pa-kpi--success .pa-kpi-icon {
  background: var(--pa-success-bg);
  color: #2c6230;
}
.pa-kpi--success::after {
  background: var(--pa-success);
}

.pa-kpi--warning .pa-kpi-icon {
  background: var(--pa-warning-bg);
  color: #8a4814;
}
.pa-kpi--warning::after {
  background: var(--pa-warning);
}

.pa-kpi--info .pa-kpi-icon {
  background: var(--pa-info-bg);
  color: #1f4e58;
}
.pa-kpi--info::after {
  background: var(--pa-info);
}

.pa-kpi--danger .pa-kpi-icon {
  background: var(--pa-danger-bg);
  color: #8d2e26;
}
.pa-kpi--danger::after {
  background: var(--pa-danger);
}

/* KPI XL variant — for primary dashboard KPIs that need visual impact */
.pa-kpi--xl {
  padding: var(--pa-s-6) var(--pa-s-5);
}

.pa-kpi--xl .pa-kpi-icon {
  width: 48px;
  height: 48px;
  font-size: 19px;
}

.pa-kpi--xl .pa-kpi-value {
  font-size: var(--pa-fs-3xl);
}

.pa-kpi--xl .pa-kpi-label {
  margin-bottom: var(--pa-s-2);
}

/* ─── Filter Card ─── */
.pa-filter-card {
  background: var(--pa-surface);
  border: 1px solid var(--pa-border);
  border-radius: var(--pa-r-md);
  box-shadow: var(--pa-shadow-xs);
  padding: var(--pa-s-5) var(--pa-s-6);
  margin-bottom: var(--pa-s-5);
}

.pa-filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--pa-s-5);
  padding-bottom: var(--pa-s-3);
  border-bottom: 1px solid var(--pa-divider);
  gap: var(--pa-s-3);
  flex-wrap: wrap;
}

.pa-filter-title {
  display: flex;
  align-items: center;
  gap: var(--pa-s-2);
  font-size: var(--pa-fs-sm);
  font-weight: 600;
  color: var(--pa-text-soft);
  letter-spacing: 0.01em;
}

.pa-filter-title i {
  color: var(--pa-emerald-500);
  font-size: 0.85rem;
}

.pa-filter-meta {
  display: flex;
  align-items: center;
  gap: var(--pa-s-2);
}

.pa-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--pa-s-4);
  align-items: end;
}

.pa-filter-grid .form-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.pa-filter-grid .form-label i {
  font-size: 0.7rem;
  opacity: 0.5;
}

.pa-filter-actions {
  display: flex;
  align-items: flex-end;
  gap: var(--pa-s-2);
  padding-top: var(--pa-s-1);
}

/* ─── Table Wrap ─── */
.pa-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  /* Horizontal scroll shadow cue: shadows fade in/out at scrollable edges */
  background:
    linear-gradient(to right, var(--pa-surface) 30%, rgba(255, 255, 255, 0)) left center,
    linear-gradient(to left, var(--pa-surface) 30%, rgba(255, 255, 255, 0)) right center,
    radial-gradient(farthest-side at 0 50%, rgba(28, 34, 32, 0.14), rgba(28, 34, 32, 0)) left center,
    radial-gradient(farthest-side at 100% 50%, rgba(28, 34, 32, 0.14), rgba(28, 34, 32, 0)) right center;
  background-repeat: no-repeat;
  background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
  background-attachment: local, local, scroll, scroll;
}

.pa-table-wrap::-webkit-scrollbar {
  height: 5px;
}

.pa-table-wrap::-webkit-scrollbar-track {
  background: var(--pa-sand-100);
}

.pa-table-wrap::-webkit-scrollbar-thumb {
  background: var(--pa-sand-300);
  border-radius: 3px;
}

.pa-table-wrap::-webkit-scrollbar-thumb:hover {
  background: var(--pa-sand-400);
}

/* ─── Table Actions (inline button group in cells) ─── */
.pa-table-actions {
  display: inline-flex;
  gap: var(--pa-s-1);
  white-space: nowrap;
}

/* ─── Page Section Header ─── */
.pa-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--pa-s-4);
  flex-wrap: wrap;
  margin-bottom: var(--pa-s-6);
}

.pa-section-title {
  display: flex;
  align-items: center;
  gap: var(--pa-s-3);
}

.pa-section-title h1 {
  font-family: var(--pa-font-display);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--pa-text);
  margin: 0;
  line-height: 1.15;
}

.pa-section-title i {
  color: var(--pa-emerald-500);
  font-size: 1.2rem;
  opacity: 0.8;
}

.pa-section-sub {
  color: var(--pa-text-faint);
  font-size: var(--pa-fs-sm);
  margin-top: var(--pa-s-1);
  letter-spacing: 0.01em;
}

/* ─── Context Toolbar ─── */
.pa-contextbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--pa-s-4);
  border-bottom: 1px solid var(--pa-border-soft);
  margin-bottom: var(--pa-s-6);
  padding: 0;
}

.pa-contextbar-nav {
  display: flex;
  align-items: center;
  gap: var(--pa-s-1);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.pa-contextbar-nav::-webkit-scrollbar {
  display: none;
}

.pa-contextbar-link {
  display: inline-flex;
  align-items: center;
  gap: var(--pa-s-2);
  padding: var(--pa-s-3) var(--pa-s-4);
  font-family: var(--pa-font-sans);
  font-size: var(--pa-fs-sm);
  font-weight: 500;
  color: var(--pa-text-muted);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  border-radius: var(--pa-r-sm) var(--pa-r-sm) 0 0;
  transition: color var(--pa-t-fast), border-color var(--pa-t-fast), background var(--pa-t-fast);
}

.pa-contextbar-link i {
  font-size: 13px;
  opacity: 0.7;
}

.pa-contextbar-link:hover {
  color: var(--pa-text-soft);
  background: var(--pa-sand-100);
  text-decoration: none;
}

.pa-contextbar-link-active,
.pa-contextbar-link-active:hover {
  color: var(--pa-emerald-600);
  border-bottom-color: var(--pa-emerald-500);
  background: transparent;
}

.pa-contextbar-link-active i {
  opacity: 1;
}

.pa-contextbar-actions {
  display: flex;
  align-items: center;
  gap: var(--pa-s-2);
  flex-shrink: 0;
  padding-bottom: var(--pa-s-2);
}

/* ─── Fiche article (modale globale, composant fiche_article.html) ─── */
.fiche-overlay {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(0,0,0,0.5);
    display: none; align-items: center; justify-content: center;
    padding: 1rem;
}
.fiche-overlay.open { display: flex; }
.fiche-panel {
    width: min(620px, 100%); max-height: 90vh; overflow-y: auto;
    background: var(--pa-surface, #fff);
    border-radius: var(--pa-r-lg, 10px);
    box-shadow: 0 8px 40px rgba(0,0,0,0.28);
    transform: scale(0.95); opacity: 0;
    transition: transform 0.22s cubic-bezier(.4,0,.2,1), opacity 0.22s;
    display: flex; flex-direction: column;
}
.fiche-overlay.open .fiche-panel { transform: scale(1); opacity: 1; }
.fiche-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    padding: 1.1rem 1.25rem 0.9rem;
    border-bottom: 1px solid var(--pa-border, #e5e7eb);
    position: sticky; top: 0;
    background: var(--pa-surface, #fff);
    border-radius: var(--pa-r-lg, 10px) var(--pa-r-lg, 10px) 0 0;
    z-index: 1;
}
.fiche-header-title { font-size: 0.95rem; font-weight: 700; color: var(--pa-text, #1c2220); line-height: 1.3; }
.fiche-header-sub  { font-size: 0.78rem; color: var(--pa-text-muted, #6b7280); margin-top: 2px; }
.fiche-close {
    background: none; border: none; cursor: pointer; font-size: 1.1rem;
    color: var(--pa-text-muted); padding: 2px 6px; border-radius: 4px; flex-shrink: 0;
}
.fiche-close:hover { background: var(--pa-sand-100); color: var(--pa-text); }
.fiche-body { padding: 0; flex: 1; overflow-y: auto; }
.fiche-loader {
    display: flex; align-items: center; justify-content: center;
    height: 200px; font-size: 1.5rem; color: var(--pa-text-muted);
}
.fiche-section { margin-bottom: 0; padding: 0; }
.fiche-section-title {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.07em; color: var(--pa-emerald-500, #3a7b3e);
    background: var(--pa-sand-50, #f8fafc);
    border-top: 1px solid var(--pa-border, #e5e7eb);
    border-bottom: 1px solid var(--pa-border, #e5e7eb);
    padding: 0.55rem 1.25rem; margin-bottom: 0;
}
.fiche-section:first-child .fiche-section-title { border-top: none; }
.fiche-section-body { padding: 0.9rem 1.25rem; }
.fiche-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 1rem; }
.fiche-field { display: flex; flex-direction: column; gap: 2px; }
.fiche-field-label { font-size: 0.68rem; color: var(--pa-text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.fiche-field-value { font-size: 0.88rem; font-weight: 600; color: var(--pa-text); }
.fiche-field-value.num { font-family: var(--pa-font-mono, monospace); }
.fiche-statut-rupture  { color: #922b21; }
.fiche-statut-critique { color: #935116; }
.fiche-statut-faible   { color: #7d6608; }
.fiche-statut-normal   { color: #1e8449; }
.fiche-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.fiche-table th {
    padding: 0.4rem 1.25rem; text-align: left; font-size: 0.68rem;
    font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--pa-text-muted); border-bottom: 1px solid var(--pa-border);
    background: var(--pa-sand-50, #f8fafc);
}
.fiche-table td {
    padding: 0.45rem 1.25rem; border-bottom: 1px solid var(--pa-divider, var(--pa-border));
    color: var(--pa-text);
}
.fiche-table tbody tr:last-child td { border-bottom: none; }
.fiche-table tbody tr:hover td { background: var(--pa-sand-50, #f8fafc); }

/* ─── Panier d'évaluation d'ordonnance (composant panier_evaluation.html) ─── */
.panier-overlay {
    position: fixed; inset: 0;
    background: rgba(28, 34, 32, 0.5);
    z-index: 1500; display: none;
    backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}
.panier-overlay.open { display: block; }

.panier-drawer {
    position: fixed; top: 0; right: 0; height: 100%;
    width: min(400px, 100%);
    background: var(--pa-surface);
    border-left: 1px solid var(--pa-border-soft);
    box-shadow: -8px 0 40px rgba(28, 34, 32, 0.18);
    transform: translateX(100%);
    transition: transform var(--pa-t-base);
    z-index: 1600;
    display: flex; flex-direction: column;
}
.panier-drawer.open { transform: translateX(0); }

.panier-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    padding: var(--pa-s-4) var(--pa-s-5);
    border-bottom: 1px solid var(--pa-border-soft);
    flex-shrink: 0;
}
.panier-title {
    display: flex; align-items: center; gap: var(--pa-s-2);
    font-family: var(--pa-font-display);
    font-size: var(--pa-fs-md); font-weight: 600; color: var(--pa-text);
}
.panier-title i { color: var(--pa-emerald-500); }
.panier-sub { font-size: var(--pa-fs-xs); color: var(--pa-text-muted); margin-top: 2px; }
.panier-close {
    background: none; border: none; cursor: pointer;
    font-size: 1.1rem; color: var(--pa-text-muted);
    padding: 2px 6px; border-radius: var(--pa-r-sm); flex-shrink: 0;
}
.panier-close:hover { background: var(--pa-sand-100); color: var(--pa-text); }

/* Zone scrollable unique : articles + résumé (le vide éventuel reste en bas) */
.panier-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: var(--pa-s-4);
    display: flex;
    flex-direction: column;
    gap: var(--pa-s-4);
}

.panier-body { display: flex; flex-direction: column; gap: var(--pa-s-2); }

.panier-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 240px; gap: var(--pa-s-3); padding: var(--pa-s-5);
    color: var(--pa-text-faint); text-align: center;
}
.panier-empty i { font-size: 2.2rem; opacity: 0.4; }
.panier-empty p { font-size: var(--pa-fs-sm); margin: 0; line-height: 1.5; }

/* Carte article */
.panier-item {
    position: relative;
    padding: var(--pa-s-3);
    background: var(--pa-surface);
    border: 1px solid var(--pa-border-soft);
    border-radius: var(--pa-r-md);
    box-shadow: var(--pa-shadow-xs);
}
.panier-item-name {
    font-size: var(--pa-fs-sm); font-weight: 700; color: var(--pa-text);
    line-height: 1.3; padding-right: 24px;
}
.panier-item-sub {
    font-family: var(--pa-font-mono); font-size: var(--pa-fs-xs);
    color: var(--pa-text-faint); margin-top: 2px;
}
.panier-item-row {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: var(--pa-s-3);
}
.panier-item-qty { display: flex; align-items: center; gap: 4px; }
.panier-qty-btn {
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    background: var(--pa-surface-soft); border: 1px solid var(--pa-border-soft);
    border-radius: var(--pa-r-sm); color: var(--pa-text-soft);
    font-size: var(--pa-fs-md); font-weight: 600; line-height: 1; cursor: pointer;
    transition: all var(--pa-t-fast);
}
.panier-qty-btn:hover {
    background: var(--pa-emerald-50); border-color: var(--pa-emerald-200);
    color: var(--pa-emerald-700);
}
.panier-qty-input {
    width: 42px; height: 28px; text-align: center;
    border: 1px solid var(--pa-border-soft); border-radius: var(--pa-r-sm);
    font-family: var(--pa-font-mono); font-size: var(--pa-fs-sm); font-weight: 600; color: var(--pa-text);
    background: var(--pa-surface);
}
.panier-qty-input:focus { outline: none; border-color: var(--pa-emerald-400); }
.panier-item-total {
    font-family: var(--pa-font-mono); font-size: var(--pa-fs-md); font-weight: 700;
    color: var(--pa-text);
}
.panier-item-del {
    position: absolute; top: 6px; right: 6px;
    width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
    background: none; border: none; cursor: pointer;
    color: var(--pa-text-faint); border-radius: var(--pa-r-sm);
    transition: all var(--pa-t-fast);
}
.panier-item-del:hover { background: var(--pa-danger-bg); color: var(--pa-danger); }

/* Carte résumé */
.panier-summary {
    background: var(--pa-surface-soft);
    border: 1px solid var(--pa-border-soft);
    border-radius: var(--pa-r-md);
    padding: var(--pa-s-4);
    display: flex; flex-direction: column; gap: var(--pa-s-2);
}
.panier-summary[hidden] { display: none; }

.psum-line {
    display: flex; align-items: center; justify-content: space-between;
    font-size: var(--pa-fs-sm); color: var(--pa-text-soft);
}
.psum-num { font-family: var(--pa-font-mono); color: var(--pa-text); font-weight: 600; }
.psum-neg { color: var(--pa-danger); }
.psum-hint { color: var(--pa-text-faint); font-size: var(--pa-fs-xs); }
.psum-line-strong { color: var(--pa-text); }
.psum-line-strong .psum-num { font-weight: 700; }

.psum-field {
    display: flex; align-items: center; justify-content: space-between; gap: var(--pa-s-3);
    padding: var(--pa-s-1) 0;
    border-top: 1px solid var(--pa-divider);
    border-bottom: 1px solid var(--pa-divider);
}
.psum-field label { font-size: var(--pa-fs-sm); font-weight: 500; color: var(--pa-text); }
.psum-input { display: flex; align-items: center; gap: var(--pa-s-1); flex-shrink: 0; }
.psum-input .pa-input { width: 64px; text-align: right; }
.psum-input > span { font-size: var(--pa-fs-sm); color: var(--pa-text-muted); }

.psum-total {
    display: flex; align-items: center; justify-content: space-between; gap: var(--pa-s-2);
    margin-top: var(--pa-s-2); padding: var(--pa-s-3) var(--pa-s-4);
    background: var(--pa-emerald-50);
    border: 1px solid var(--pa-emerald-100);
    border-radius: var(--pa-r-md);
}
.psum-total-label { font-size: var(--pa-fs-sm); font-weight: 600; color: var(--pa-emerald-800); }
.psum-total-val {
    font-family: var(--pa-font-mono); font-size: var(--pa-fs-xl); font-weight: 800;
    color: var(--pa-emerald-700); white-space: nowrap;
}

.panier-clear { margin-top: var(--pa-s-1); align-self: stretch; justify-content: center; }

.panier-toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
    background: var(--pa-ink-800, #1c2220); color: #fff;
    padding: var(--pa-s-2) var(--pa-s-4); border-radius: var(--pa-r-pill);
    font-size: var(--pa-fs-sm); box-shadow: var(--pa-shadow-lg);
    opacity: 0; pointer-events: none; z-index: 2500;
    transition: opacity var(--pa-t-fast), transform var(--pa-t-fast);
}
.panier-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ─── Recherche produit + panier (chrome header, accès libre) ─── */
.header-right {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-left: auto;
}

.header-search {
    position: relative;
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}

/* État replié : bouton loupe rond */
.header-search-toggle {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--pa-surface-soft);
    border: 1px solid var(--pa-border-soft);
    border-radius: var(--pa-r-pill);
    color: var(--pa-text-soft);
    font-size: var(--pa-fs-sm);
    cursor: pointer;
    transition: all var(--pa-t-fast);
}

.header-search-toggle:hover {
    background: var(--pa-sand-100);
    color: var(--pa-text);
}

/* État déplié : la loupe devient l'icône interne du champ */
.header-search.expanded .header-search-toggle {
    position: absolute;
    left: 0.4rem;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    color: var(--pa-text-faint);
    z-index: 1;
}

.header-search-input {
    width: 0;
    height: 38px;
    padding: 0;
    border: 1px solid transparent;
    opacity: 0;
    pointer-events: none;
    font-family: var(--pa-font-sans);
    font-size: var(--pa-fs-sm);
    color: var(--pa-text);
    background: var(--pa-surface-soft);
    border-radius: var(--pa-r-pill);
    transition: width var(--pa-t-base), opacity var(--pa-t-fast), padding var(--pa-t-base);
}

.header-search.expanded .header-search-input {
    width: 280px;
    padding: 0 0.85rem 0 2.1rem;
    border-color: var(--pa-border-soft);
    opacity: 1;
    pointer-events: auto;
}

.header-search-input::placeholder {
    color: var(--pa-text-faint);
}

.header-search-input:focus {
    outline: none;
    background: var(--pa-surface);
    border-color: var(--pa-emerald-400);
    box-shadow: 0 0 0 3px var(--pa-emerald-100);
}

.header-search-results {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    left: auto;
    width: 360px;
    max-width: calc(100vw - 1.5rem);
    max-height: 380px;
    overflow-y: auto;
    background: var(--pa-surface);
    border: 1px solid var(--pa-border-soft);
    border-radius: var(--pa-r-md);
    box-shadow: var(--pa-shadow-lg);
    z-index: 300;
}

.header-search.open .header-search-results {
    display: block;
}

.header-search-item {
    display: flex;
    align-items: center;
    width: 100%;
    border-bottom: 1px solid var(--pa-divider);
    transition: background var(--pa-t-fast);
}

.header-search-item:hover {
    background: var(--pa-surface-soft);
}

.header-search-item:last-child {
    border-bottom: none;
}

.header-search-item-open {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.6rem 0.5rem 0.6rem 0.85rem;
    background: none;
    border: none;
    text-align: left;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

.header-search-item-add {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    margin-right: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--pa-emerald-50);
    color: var(--pa-emerald-700);
    border: 1px solid var(--pa-emerald-100);
    border-radius: var(--pa-r-sm);
    cursor: pointer;
    transition: all var(--pa-t-fast);
}

.header-search-item-add:hover {
    background: var(--pa-emerald-600);
    color: #fff;
    border-color: var(--pa-emerald-600);
}

.header-search-item-main {
    flex: 1 1 auto;
    min-width: 0;
}

.header-search-item-name {
    font-size: var(--pa-fs-sm);
    font-weight: 700;
    color: var(--pa-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-search-item-code {
    font-family: var(--pa-font-mono);
    font-size: var(--pa-fs-xs);
    color: var(--pa-text-faint);
}

.header-search-item-meta {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    flex-shrink: 0;
}

.header-search-stock {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    min-width: 56px;
}

.header-search-stock .hs-stk-label {
    font-size: var(--pa-fs-xs);
    color: var(--pa-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1;
}

.header-search-stock .hs-stk-val {
    font-family: var(--pa-font-mono);
    font-size: var(--pa-fs-xl);
    font-weight: 800;
    color: var(--pa-text);
    line-height: 1.15;
}

.header-search-price {
    display: flex;
    align-items: baseline;
    gap: 2px;
    min-width: 58px;
    justify-content: flex-end;
    font-family: var(--pa-font-mono);
    font-size: var(--pa-fs-lg);
    font-weight: 700;
    color: var(--pa-emerald-700);
    white-space: nowrap;
}

.header-search-price .hs-cur {
    font-size: var(--pa-fs-xs);
    font-weight: 600;
    color: var(--pa-text-muted);
}

.header-search-empty {
    padding: 0.85rem;
    text-align: center;
    font-size: var(--pa-fs-sm);
    color: var(--pa-text-faint);
}

.header-cart-btn {
    position: relative;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--pa-surface-soft);
    border: 1px solid var(--pa-border-soft);
    border-radius: var(--pa-r-pill);
    color: var(--pa-text-soft);
    font-size: var(--pa-fs-sm);
    cursor: pointer;
    transition: all var(--pa-t-fast);
}

.header-cart-btn:hover {
    background: var(--pa-sand-100);
    color: var(--pa-text);
}

.header-cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--pa-emerald-600);
    color: #fff;
    font-family: var(--pa-font-sans);
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    border-radius: var(--pa-r-pill);
    box-shadow: 0 0 0 2px var(--pa-surface);
}

/* ─── Responsive adjustments ─── */
@media (max-width: 767px) {
  .pa-filter-card {
    padding: var(--pa-s-4);
  }

  .pa-filter-grid {
    grid-template-columns: 1fr;
  }

  .pa-section-head {
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: var(--pa-s-5);
  }

  .pa-section-title h1 {
    font-size: 24px;
  }

  /* Recherche dépliée : largeur réduite + masquer le texte de marque pour la place */
  .header:has(.header-search.expanded) .header-brand-text {
    display: none;
  }

  .header-search.expanded .header-search-input {
    width: 190px;
  }

  /* Résultats : panneau fixe pleine largeur sous le header (évite le débordement
     hors écran quand le champ n'est pas au bord droit) */
  .header-search-results {
    position: fixed;
    top: calc(var(--pa-header-h) + 4px);
    left: 8px;
    right: 8px;
    width: auto;
    max-width: none;
    max-height: calc(100vh - var(--pa-header-h) - 16px);
  }

  /* Lignes plus aérées : code sous le nom, stock + prix alignés à droite */
  .header-search-item-open {
    padding: 0.65rem 0.5rem 0.65rem 0.85rem;
  }

  .header-search-item-name {
    white-space: normal;
  }
}

@media (min-width: 768px) and (max-width: 991px) {
  .pa-kpi-value {
    font-size: var(--pa-fs-2xl);
  }
}
