/* ============================================================================
 * Module : artisan/styles/pages/dashboard.css
 * Rôle   : Styles spécifiques à la page d'accueil du dashboard.
 *          - Sélecteur de période (boutons toggle)
 *          - Actions rapides (4 boutons icône+label)
 *          - Charts SVG : bar chart CA + donut statuts
 *          - 3 listes (top clients / activité récente / alertes)
 *
 *          Les classes communes (`.stats-row`, `.stat-card`, `.stat-change`,
 *          `.tut-banner`, …) sont désormais dans `dashboard-shell.css`
 *          (D-133/D-134).
 *
 * Dépend de : tokens.css + dashboard-shell.css
 * Utilisé par : /artisan/dashboard.html
 * ============================================================================ */

.dashboard-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ─── Sélecteur période ──────────────────────────────────────── */
.dash-period-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.dash-period-label {
  font-size: .82rem;
  color: var(--gray-600);
  font-weight: var(--weight-medium);
}

.dash-period-group {
  display: flex;
  gap: 6px;
  background: white;
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-100);
}

.dash-period-btn {
  padding: 7px 14px;
  background: transparent;
  border: none;
  border-radius: 6px;
  font-family: var(--font-heading);
  font-weight: var(--weight-semibold);
  font-size: .82rem;
  color: var(--gray-600);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.dash-period-btn:hover { color: var(--brand-dark); }
.dash-period-btn.active {
  background: var(--brand);
  color: white;
  box-shadow: var(--shadow-sm);
}

/* ─── Actions rapides ────────────────────────────────────────── */
.dash-quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.dash-action-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  background: white;
  border: 1px solid var(--gray-100);
  border-radius: var(--radius);
  padding: 16px 18px;
  cursor: pointer;
  text-decoration: none;
  transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
}
.dash-action-btn:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--brand-mid);
}

.dash-action-ic {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: white;
  flex-shrink: 0;
}
.dash-action-ic-brand { background: var(--brand); }
.dash-action-ic-blue  { background: #2563eb; }
.dash-action-ic-amber { background: #F59E0B; }
.dash-action-ic-gray  { background: var(--gray-700); }

.dash-action-lbl {
  font-family: var(--font-heading);
  font-weight: var(--weight-bold);
  color: var(--brand-dark);
  font-size: .95rem;
}

/* ─── Grille graphiques ──────────────────────────────────────── */
.dash-grid-charts {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

.dash-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.dash-card-title {
  font-family: var(--font-heading);
  font-weight: var(--weight-bold);
  color: var(--brand-dark);
  font-size: 1.05rem;
  margin: 0;
}

.dash-card-sub {
  font-size: .82rem;
  color: var(--gray-500);
  margin: 2px 0 0;
}

.dash-card-total {
  text-align: right;
}

.dash-card-total-label {
  display: block;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--gray-400);
  font-weight: var(--weight-bold);
}

.dash-card-total strong {
  font-family: var(--font-heading);
  font-weight: var(--weight-black);
  font-size: 1.2rem;
  color: var(--brand-dark);
}

.dash-see-all {
  font-size: .82rem;
  color: var(--brand);
  font-weight: var(--weight-semibold);
  text-decoration: none;
  white-space: nowrap;
}
.dash-see-all:hover { color: var(--brand-dark); }

/* ─── Bar chart CA ───────────────────────────────────────────── */
.dash-chart svg {
  width: 100%;
  height: auto;
  display: block;
}

.dash-chart .axis-label {
  font-size: 10px;
  fill: var(--gray-400);
}

.dash-chart .bar-value {
  font-size: 10px;
  font-weight: 600;
  fill: var(--brand-dark);
}

.dash-chart .bar-label {
  font-size: 10px;
  fill: var(--gray-500);
}

/* ─── Donut ─────────────────────────────────────────────────── */
.dash-donut-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
}

.dash-donut-wrap svg {
  width: 160px;
  height: 160px;
  flex-shrink: 0;
}

.dash-donut-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lg-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: .85rem;
}

.lg-left {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gray-700);
}

.lg-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.lg-value {
  font-weight: var(--weight-bold);
  color: var(--brand-dark);
}

/* ─── Grille listes (3 colonnes) ──────────────────────────────── */
.dash-grid-lists {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.dash-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dash-list-empty {
  text-align: center;
  padding: 24px 12px;
  color: var(--gray-400);
  font-size: .85rem;
  font-style: italic;
}

.dash-list-empty .emoji {
  display: block;
  font-size: 1.8rem;
  margin-bottom: 8px;
  font-style: normal;
}

/* ─── Items de liste (récent + alertes) ──────────────────────── */
.dash-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-sm);
  background: white;
  text-decoration: none;
  transition: background var(--transition-fast);
}
.dash-list-item:hover { background: var(--gray-50); }

.dash-list-item.alert-impayee { background: #fef2f2; border-color: #fecaca; }
.dash-list-item.alert-expire  { background: #fff7ed; border-color: #fed7aa; }

.di-main { min-width: 0; flex: 1; }
.di-title {
  font-weight: var(--weight-bold);
  color: var(--brand-dark);
  font-size: .9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.di-sub {
  font-size: .78rem;
  color: var(--gray-500);
  margin-top: 2px;
}
.di-sub.txt-red { color: #dc2626; }
.di-sub.txt-orange { color: #f97316; }

.di-right { text-align: right; }
.di-amount {
  font-weight: var(--weight-bold);
  color: var(--brand-dark);
  font-size: .9rem;
}
.di-amount.txt-red { color: #dc2626; }

/* ─── Top clients (bar) ──────────────────────────────────────── */
.dash-topclient + .dash-topclient {
  margin-top: 6px;
}

.tc-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  font-size: .85rem;
}

.tc-name {
  font-weight: var(--weight-semibold);
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70%;
}

.tc-amount {
  font-weight: var(--weight-bold);
  color: var(--brand-dark);
  white-space: nowrap;
}

.tc-bar-bg {
  width: 100%;
  height: 8px;
  background: var(--gray-100);
  border-radius: 4px;
  overflow: hidden;
}

.tc-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand-mid) 100%);
  border-radius: 4px;
  transition: width var(--transition-base);
}

/* ─── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .dash-quick-actions { grid-template-columns: repeat(2, 1fr); }
  .dash-grid-charts { grid-template-columns: 1fr; }
  .dash-grid-lists { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .dash-quick-actions { grid-template-columns: 1fr; }
  .dash-donut-wrap { flex-direction: column; }
  .dash-period-group { width: 100%; overflow-x: auto; }
}
