/* ════════════════════════════════════════
   BACKOFFICE — layout + sidenav
════════════════════════════════════════ */

body {
  display: flex;
  min-height: 100vh;
}

/* ── Sidenav ────────────────────────────────────────────────── */
.sidenav {
  width: 240px;
  flex-shrink: 0;
  background: var(--d800);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 2rem 0;
  min-height: 100vh;
  position: fixed;
}

.sidenav__logo {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--accent);
  padding: 0 1.5rem 2rem;
  border-bottom: 1px solid var(--border-dim);
  margin-bottom: 1rem;
  letter-spacing: 0.05em;
}

.sidenav ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidenav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-sub);
  border-left: 2px solid transparent;
  transition: color var(--t), background var(--t), border-color var(--t);
}

.sidenav a:hover {
  color: var(--text);
  background: var(--accent-soft);
}

.sidenav a.active {
  color: var(--accent-lt);
  background: var(--accent-glow);
  border-left-color: var(--accent);
}

/* ── Contenu principal ──────────────────────────────────────── */
.backoffice-content {
  margin-left: 240px;
  flex: 1;
  padding: 1.5rem 3rem;
  overflow-y: auto;
  background: #faf9f6;
  color: #1a1714;
}

.backoffice-content h1 {
  color: #1a1714;
}

.bo-empty {
  color: #9a9280;
}

/* ════════════════════════════════════════
   DASHBOARD
════════════════════════════════════════ */

.dash-main {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ── Header ─────────────────────────────────────────────────── */
.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dash-eyebrow {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.2rem;
  font-family: var(--font-body);
}

.dash-title {
  font-size: 1.75rem;
  color: #1a1714;
}

/* ── Period Selector ────────────────────────────────────────── */
.period-selector {
  display: flex;
  gap: 0.2rem;
  background: #ece8df;
  padding: 0.2rem;
  border-radius: 8px;
}

.period-btn {
  padding: 0.38rem 1rem;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 0.8rem;
  font-family: var(--font-body);
  font-weight: 500;
  color: #6e6552;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}

.period-btn.active {
  background: #fff;
  color: #1a1714;
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
}

/* ── KPI Grid ───────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.kpi-skeleton {
  height: 110px;
  background: linear-gradient(90deg, #f0ede6 25%, #e6e1d8 50%, #f0ede6 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 12px;
}

.kpi-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  border: 1px solid rgba(0,0,0,.07);
  box-shadow: 0 1px 3px rgba(0,0,0,.05), 0 4px 12px rgba(0,0,0,.04);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.kpi-card--accent {
  background: linear-gradient(135deg, #a06a0a, #C28E26 55%, #d9a83e);
  border-color: transparent;
  box-shadow: 0 4px 20px rgba(194,142,38,.32);
}

.kpi-label {
  font-size: 0.67rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8a8070;
  font-family: var(--font-body);
}

.kpi-card--accent .kpi-label { color: rgba(255,255,255,.72); }

.kpi-value {
  font-size: 1.9rem;
  font-weight: 700;
  font-family: var(--font-body);
  color: #1a1714;
  line-height: 1.1;
  margin-top: 0.2rem;
  letter-spacing: -0.02em;
}

.kpi-card--accent .kpi-value { color: #fff; }

.kpi-delta {
  font-size: 0.74rem;
  font-weight: 500;
  margin-top: 0.1rem;
  font-family: var(--font-body);
}

.kpi-delta--up      { color: #16a34a; }
.kpi-delta--down    { color: #dc2626; }
.kpi-delta--neutral { color: #9a9280; }
.kpi-card--accent .kpi-delta { color: rgba(255,255,255,.75); }

.kpi-progress {
  margin-top: 0.7rem;
  height: 3px;
  background: rgba(0,0,0,.08);
  border-radius: 2px;
  overflow: hidden;
}

.kpi-progress__bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.7s cubic-bezier(.4,0,.2,1);
}

/* ── Cards génériques dashboard ─────────────────────────────── */
.dash-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  border: 1px solid rgba(0,0,0,.07);
  box-shadow: 0 1px 3px rgba(0,0,0,.05), 0 4px 12px rgba(0,0,0,.04);
}

.dash-card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.1rem;
}

.dash-card-title {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: #1a1714;
}

.dash-card__sub {
  font-size: 0.75rem;
  color: #9a9280;
  font-family: var(--font-body);
}

.dash-see-all {
  font-size: 0.75rem;
  color: var(--accent);
  font-family: var(--font-body);
  transition: color var(--t);
}

.dash-see-all:hover { color: var(--accent-lt); }

/* ── Main Chart ─────────────────────────────────────────────── */
.dash-chart-card { padding: 1.5rem; }

.dash-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.dash-chart-sub {
  font-size: 0.8rem;
  color: #9a9280;
  margin-top: 0.2rem;
  font-family: var(--font-body);
}

.chart-tabs { display: flex; gap: 0.25rem; }

.chart-tab {
  padding: 0.3rem 0.85rem;
  border: 1px solid #dedad2;
  background: transparent;
  border-radius: 6px;
  font-size: 0.78rem;
  font-family: var(--font-body);
  font-weight: 500;
  color: #6e6552;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
}

.chart-tab.active {
  background: #1a1714;
  border-color: #1a1714;
  color: #fff;
}

.dash-chart-wrap {
  position: relative;
  height: 300px;
}

/* ── Bottom Layout ──────────────────────────────────────────── */
.dash-bottom {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

.dash-right-col {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ── Clients Table ──────────────────────────────────────────── */
.dash-loading-cell {
  color: #9a9280;
  font-size: 0.84rem;
  padding: 0.5rem 0;
  font-family: var(--font-body);
}

.dash-clients-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.dash-clients-table th {
  text-align: left;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #9a9280;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid #ede9e1;
  font-family: var(--font-body);
}

.dash-clients-table td {
  padding: 0.6rem 0;
  color: #1a1714;
  border-bottom: 1px solid #f4f1eb;
  vertical-align: middle;
}

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

.dash-client-name  { font-weight: 500; color: #1a1714; font-family: var(--font-body); }
.dash-client-email { font-size: 0.72rem; color: #9a9280; margin-top: 0.1rem; }
.dash-client-date  { font-size: 0.72rem; color: #9a9280; margin-top: 0.1rem; }
.dash-amount       { font-weight: 600; color: #1a1714; font-family: var(--font-body); }

/* ── Donut Chart ────────────────────────────────────────────── */
.dash-donut-row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.dash-donut-wrap {
  width: 110px;
  flex-shrink: 0;
}

.dash-status-legend {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex: 1;
}

.dash-legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-family: var(--font-body);
}

.dash-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dash-legend-name { color: #1a1714; flex: 1; }
.dash-legend-pct  { color: #9a9280; font-weight: 500; font-size: 0.74rem; }

/* ── Top Products ───────────────────────────────────────────── */
.dash-product-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid #f4f1eb;
}

.dash-product-row:last-child { border-bottom: none; }

.dash-product-rank {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f0ede6;
  color: #6e6552;
  font-size: 0.68rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: var(--font-body);
}

.dash-product-name { font-size: 0.83rem; color: #1a1714; font-weight: 500; flex: 1; font-family: var(--font-body); }
.dash-product-meta { font-size: 0.74rem; color: #9a9280; white-space: nowrap; font-family: var(--font-body); }

/* ── Table générique ────────────────────────────────────────── */
.bo-table-wrap {
  overflow-x: auto;
  margin-top: 1.5rem;
  background: #fff;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,.07);
  box-shadow: 0 1px 3px rgba(0,0,0,.05), 0 4px 12px rgba(0,0,0,.04);
}

.bo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.bo-table thead tr {
  border-bottom: 1px solid #ede9e1;
}

.bo-table th {
  padding: 1rem 1.5rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #9a9280;
}

.bo-table td {
  padding: 1rem 1.5rem;
  color: #1a1714;
  border-bottom: 1px solid #f4f1eb;
}

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

.bo-table tbody tr {
  transition: background var(--t);
}

.bo-table tbody tr:hover td {
  background: #faf8f4;
}

.bo-table__id {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  padding: 0.2rem 0.6rem;
  background: rgba(194, 142, 38, .1);
  border: 1px solid rgba(194, 142, 38, .3);
  border-radius: 20px;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  transition: background var(--t), border-color var(--t);
  white-space: nowrap;
}

.bo-table__id:hover {
  background: rgba(194, 142, 38, .18);
  border-color: var(--accent);
}

/* ── Vue détail ─────────────────────────────────────────────── */
.bo-back {
  display: inline-block;
  font-size: 0.85rem;
  color: #6e6552;
  padding: 1rem 0;
  transition: color var(--t);
}

.bo-back:hover { color: #1a1714; }

#detail-container h1 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
}

.bo-detail {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.5rem 2rem;
  margin-top: 0.5rem;
  background: #fff;
  border: 1px solid #ede9e1;
  border-radius: 8px;
  padding: 1.5rem;
}


/* ── Card informations client ───────────────────────────────── */
.bo-client-card {
  background: #fff;
  border: 1px solid #ede9e1;
  border-radius: 8px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.25rem;
}

.bo-client-card__title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: 1rem;
  color: #1a1714;
}

.bo-client-card__info {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.875rem;
  color: #1a1714;
}

.bo-client-label {
  color: #9a9280;
  font-size: 0.8rem;
  margin-right: 0.4rem;
}

.bo-client-label::after { content: ' :'; }

.bo-address-block {
  background: #f4f1eb;
  border: 1px solid #ede9e1;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
}

.bo-address-block #addr-fact {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.bo-address-block strong {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #9a9280;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

.bo-address-block p { line-height: 1.6; color: #1a1714; }

.bo-address-same { color: #9a9280; font-style: italic; }

/* ── Badges statut ──────────────────────────────────────────── */
.bo-badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.bo-th--sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.bo-th--sortable:hover { color: #1a1714; }

.bo-sort-arrow {
  font-style: normal;
  color: var(--accent);
}

.bo-sort-arrow--idle {
  color: #c8c2b8;
}

.bo-truncated {
  cursor: default;
  border-bottom: 1px dashed #9a9280;
}

.bo-badge--green  { background: rgba(22, 163, 74, .1);  color: #16a34a; }
.bo-badge--orange { background: rgba(234, 88, 12, .1);  color: #c05a08; }
.bo-badge--gray   { background: rgba(100, 116, 139, .1); color: #4e6074; }
.bo-badge--red    { background: rgba(220, 38, 38, .1);  color: #dc2626; }

.bo-detail dt {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9a9280;
  align-self: center;
}

.bo-detail dd {
  font-size: 0.9rem;
  color: #1a1714;
  font-family: monospace;
}

.bo-produits {
  margin-top: 1.5rem;
}

.bo-produits__title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: #6e6552;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.bo-produit-link {
  color: var(--accent);
  transition: color var(--t);
}

.bo-produit-link:hover { color: #a06a0a; }

.bo-empty {
  margin-top: 2rem;
  color: #9a9280;
  font-size: 0.9rem;
}

/* ── Documentation API ──────────────────────────────────────── */
.api-doc {
  margin-top: 2rem;
}

.api-doc h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: #1a1714;
  margin: 2rem 0 1rem;
}

.api-doc__list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.api-doc__item {
  background: #fff;
  border: 1px solid #ede9e1;
  border-radius: 6px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.api-doc__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.api-doc__method {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: rgba(122, 138, 72, .12);
  color: #5a6e28;
}

.api-doc__method--post {
  background: rgba(194, 142, 38, .12);
  color: var(--accent);
}

.api-doc__url {
  font-size: 0.9rem;
  color: #1a1714;
  font-family: monospace;
}

.api-doc__desc {
  font-size: 0.85rem;
  color: #6e6552;
}

.api-doc__params {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin-top: 0.25rem;
}

.api-doc__params li {
  font-size: 0.8rem;
  color: #9a9280;
}

.api-doc__params code {
  color: var(--accent);
  font-family: monospace;
}
