/* ============================================================================
   dashboard.css — Tableau de bord professeur (étape 4 de l'audit, 06/10/2026)
   Chargé après om-ui.css. Remplace les anciens styles « Dashboard V2/V3 »
   de styles.css. Tokens : --brand-*, --ink-*, --line, --surface(-alt).
   Structure (app.js › renderDashboard) :
     .dash
       .dash-top            accueil + raccourcis
       .dash-month          mois sélectionné + 4 chiffres clés
       .dash-grid           2 colonnes : cours du jour | à surveiller + activité
       .dash-charts-section graphiques (une seule teinte)
   ============================================================================ */

.dash { max-width: 1320px; margin: 0 auto; padding: 4px 24px 40px; display: flex; flex-direction: column; gap: 20px; }

/* --- Cartes génériques --------------------------------------------------- */
.dash-panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card);
  padding: 18px 20px;
}
.dash-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.dash-panel-title { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 15px; font-weight: 700; color: var(--ink-900); }
.dash-panel-title .om-ic { color: var(--brand-700); }
.dash-count {
  min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-50); color: var(--brand-800); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
}

/* Petits boutons carrés (flèches) et navigation de date */
.dash-nav { display: flex; align-items: center; gap: 6px; }
.dash-iconbtn {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-600); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0;
}
.dash-iconbtn:hover:not(:disabled) { background: var(--brand-50); border-color: var(--brand-200); color: var(--brand-800); }
.dash-iconbtn:disabled { opacity: .4; cursor: default; }
.dash-nav-label { min-width: 92px; text-align: center; font-size: 13px; font-weight: 600; color: var(--ink-700); text-transform: capitalize; }
.dash-linkbtn { border: 0; background: none; color: var(--brand-700); font-size: 12px; font-weight: 600; cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.dash-linkbtn:hover { background: var(--brand-50); }

/* --- Accueil -------------------------------------------------------------- */
.dash-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.dash-top h2 { margin: 0; font-size: 22px; font-weight: 800; color: var(--ink-900); letter-spacing: -.01em; }
.dash-top p { margin: 4px 0 0; font-size: 14px; color: var(--ink-500); }
.dash-top-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dash-top-actions .btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; }

/* --- Mois + chiffres clés ------------------------------------------------- */
.dash-month-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.dash-month-nav { display: flex; align-items: center; gap: 8px; }
.dash-month-picker { position: relative; }
.dash-month-label {
  margin: 0; min-width: 160px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 17px; font-weight: 700; color: var(--ink-900); background: none; border: 1px solid transparent;
  border-radius: 8px; padding: 4px 10px; cursor: pointer;
}
.dash-month-label:hover, .dash-month-label[aria-expanded="true"] { background: var(--brand-50); border-color: var(--brand-200); }
.dash-month-label .om-ic { color: var(--brand-700); }
.dash-month-pop {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: var(--z-dropdown, 100);
  width: 264px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, .14); padding: 12px;
}
.dash-month-pop[hidden] { display: none; }
.dash-mp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.dash-mp-annee { font-size: 15px; font-weight: 800; color: var(--ink-900); font-variant-numeric: tabular-nums; }
.dash-mp-grille { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.dash-mp-mois {
  height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface);
  font-size: 13px; font-weight: 600; color: var(--ink-700); cursor: pointer;
}
.dash-mp-mois:hover { background: var(--brand-50); border-color: var(--brand-200); color: var(--brand-800); }
.dash-mp-mois.auj { border-color: var(--brand-300); }
.dash-mp-mois.sel { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }
.dash-mp-auj { display: block; width: 100%; margin-top: 10px; text-align: center; }
.dash-actions-area { position: relative; }
.dash-actions-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; font-size: 13px; }
.dash-actions-menu {
  display: none; position: absolute; right: 0; top: calc(100% + 6px); z-index: var(--z-dropdown, 100);
  min-width: 240px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .12); padding: 6px;
}
.dash-actions-menu.show { display: block; }
.dash-actions-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none;
  border-radius: 7px; font-size: 13px; color: var(--ink-700); text-align: left; cursor: pointer;
}
.dash-actions-item:hover { background: var(--brand-50); color: var(--brand-800); }
.dash-actions-item .om-ic { color: var(--ink-500); }

/* 4 cartes côte à côte, 2 × 2 si le bloc est étroit (fenêtre réduite), 1 sur téléphone.
   Requête de conteneur : dépend de la largeur réelle du bloc, pas de l'écran. */
.dash-month { container-type: inline-size; }
.dash-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@container (max-width: 1000px) { .dash-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (max-width: 480px)  { .dash-stats { grid-template-columns: minmax(0, 1fr); } }
.dash-stat-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--surface-alt); min-width: 0; }
.dash-stat-label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-600); white-space: nowrap; }
.dash-stat-label .om-ic { color: var(--brand-700); }
.dash-stat-value { margin-top: 6px; font-size: clamp(21px, 1.2vw + 10px, 26px); font-weight: 800; color: var(--ink-900); line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dash-stat-sub { margin-top: 4px; font-size: 12px; color: var(--ink-500); }
.dash-trend { margin-left: auto; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; padding: 1px 6px; border-radius: 999px; }
.dash-trend.up { color: #047857; background: #ecfdf5; }
.dash-trend.down { color: #b91c1c; background: #fef2f2; }
.dash-trend.flat { color: var(--ink-500); background: #f1f5f9; }
.dash-stat-cmps { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); display: flex; flex-direction: column; gap: 4px; }
.dash-stat-cmp { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 2px 8px; font-size: 12px; color: var(--ink-600); font-variant-numeric: tabular-nums; }
.dash-stat-cmp > span { white-space: nowrap; }
.dash-stat-cmp > span:first-child { color: var(--ink-500); text-transform: capitalize; }
.dash-stat-cmp .dash-trend { margin-left: 4px; }
.dash-cmp-vide { color: var(--ink-500); font-style: italic; }

/* --- Grille principale ---------------------------------------------------- */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); gap: 20px; align-items: stretch; }
.dash-col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
/* Colonnes de même hauteur : le dernier bloc de chaque colonne s'étire (plus de vide gris) */
.dash-zone { display: flex; flex-direction: column; }
.dash-zone > .dash-panel { flex: 1; }
.dash-col > :last-child { flex: 1; }

/* Cours du jour */
.dash-today-list { display: flex; flex-direction: column; }
.dash-today-item {
  display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 9px 8px; border-top: 1px solid var(--line); border-radius: 8px; cursor: pointer;
}
.dash-today-item:first-child { border-top: 0; }
.dash-today-item:hover { background: var(--surface-alt); }
.dash-today-item + .dash-today-item.same-cours { border-top-color: transparent; padding-top: 2px; }
.dash-today-time { font-size: 14px; font-weight: 700; color: var(--brand-800); font-variant-numeric: tabular-nums; }
.dash-today-name { font-size: 14px; font-weight: 600; color: var(--ink-900); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-today-meta { font-size: 12px; color: var(--ink-500); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.dash-tag { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: #f1f5f9; color: var(--ink-600); }
.dash-tag.visio { background: var(--brand-50); color: var(--brand-800); }
.dash-today-actions { display: flex; gap: 6px; }
.dash-pill-btn {
  display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-700); font-size: 12px; font-weight: 600; cursor: pointer;
}
.dash-pill-btn:hover { border-color: var(--brand-200); background: var(--brand-50); color: var(--brand-800); }
.dash-pill-btn .om-ic { width: 14px; height: 14px; color: var(--brand-700); }
.dash-empty { display: flex; align-items: center; gap: 10px; padding: 22px 8px; color: var(--ink-500); font-size: 14px; }
.dash-empty .om-ic { color: var(--ink-500); }

/* À surveiller */
.dash-alerts { display: flex; flex-direction: column; }
.dash-alert {
  --tone: var(--brand-700); --tone-bg: var(--brand-50);
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 10px 4px; border-top: 1px solid var(--line);
}
.dash-alert:first-child { border-top: 0; padding-top: 2px; }
.dash-alert.tone-danger { --tone: #b91c1c; --tone-bg: #fef2f2; }
.dash-alert.tone-warn   { --tone: #b45309; --tone-bg: #fffbeb; }
.dash-alert.tone-ok     { --tone: #047857; --tone-bg: #ecfdf5; }
.dash-alert.tone-muted  { --tone: var(--ink-500); --tone-bg: #f1f5f9; }
.dash-alert-ic { width: 34px; height: 34px; border-radius: 10px; background: var(--tone-bg); color: var(--tone); display: flex; align-items: center; justify-content: center; }
.dash-alert-title { font-size: 14px; font-weight: 700; color: var(--ink-900); }
.dash-alert-body { font-size: 12.5px; color: var(--ink-500); margin-top: 1px; }
.dash-alert-body strong { color: var(--tone); font-weight: 700; }
.dash-alert-side { display: flex; align-items: center; gap: 8px; }
.dash-alert-badge { min-width: 24px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--tone-bg); color: var(--tone); font-size: 12px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.dash-alert-action { border: 1px solid var(--line); background: var(--surface); color: var(--brand-800); font-size: 12px; font-weight: 600; height: 28px; padding: 0 10px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.dash-alert-action:hover { background: var(--brand-50); border-color: var(--brand-200); }

/* Activité des élèves (activite-jour-widget.js) */
.aj-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.aj-kpi { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface-alt); min-width: 0; }
.aj-kpi-value { font-size: 20px; font-weight: 800; color: var(--ink-900); font-variant-numeric: tabular-nums; line-height: 1.1; white-space: nowrap; }
.aj-kpi-value small { font-size: 13px; font-weight: 600; color: var(--ink-500); }
.aj-kpi-label { font-size: 12px; color: var(--ink-500); margin-top: 2px; }
.aj-kpi.warn .aj-kpi-value { color: #b45309; }
.aj-sub { font-size: 11px; font-weight: 700; color: var(--ink-500); text-transform: uppercase; letter-spacing: .05em; margin: 4px 4px 6px; }
.aj-row { display: flex; align-items: center; gap: 10px; padding: 7px 6px; border-radius: 8px; cursor: pointer; }
.aj-row:hover { background: var(--surface-alt); }
.aj-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-50); color: var(--brand-800); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex-shrink: 0; }
.aj-row.absent .aj-avatar { width: 24px; height: 24px; font-size: 10px; background: #f1f5f9; color: var(--ink-500); }
.aj-main { flex: 1; min-width: 0; }
.aj-name { font-size: 13px; font-weight: 600; color: var(--ink-900); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aj-row.absent .aj-name { font-weight: 500; color: var(--ink-600); font-size: 12.5px; }
.aj-action { font-size: 12px; color: var(--ink-500); }
.aj-time { font-size: 11.5px; color: var(--ink-500); font-variant-numeric: tabular-nums; }
.aj-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--brand-500); margin-right: 5px; vertical-align: 1px; }
.aj-dot.warn { background: #f59e0b; }
.aj-more { text-align: center; font-size: 12px; color: var(--ink-500); padding: 6px; }
.aj-empty { text-align: center; padding: 16px; color: var(--ink-500); font-size: 13px; }
.aj-absents { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.aj-absents summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--ink-600); }

/* Dates clés (dates-cles.js) */
.dc-zone { font-size: 11.5px; font-weight: 700; color: var(--brand-800); background: var(--brand-50); padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.dc-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 8px 4px; border-top: 1px solid var(--line); }
.dash-panel-head + .dc-row { border-top: 0; padding-top: 2px; }
.dc-lien { cursor: pointer; border-radius: 8px; }
.dc-lien:hover, .dc-lien:focus-visible { background: var(--surface-alt); }
.dc-date { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 42px; border-radius: 10px; background: var(--surface-alt); border: 1px solid var(--line); line-height: 1; }
.dc-jour { font-size: 16px; font-weight: 800; color: var(--ink-900); font-variant-numeric: tabular-nums; }
.dc-mois { font-size: 10.5px; font-weight: 700; color: var(--ink-500); text-transform: uppercase; margin-top: 2px; }
.dc-examen .dc-date { background: var(--brand-50); border-color: var(--brand-200); }
.dc-examen .dc-jour { color: var(--brand-800); }
.dc-admin .dc-date { background: #fffbeb; border-color: #fde68a; }
.dc-admin .dc-jour { color: #b45309; }
.dc-titre { display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 700; color: var(--ink-900); }
.dc-titre .om-ic { color: var(--ink-500); flex-shrink: 0; }
.dc-detail { font-size: 12px; color: var(--ink-500); margin-top: 1px; }
.dc-delai { font-size: 11.5px; font-weight: 700; color: var(--ink-500); white-space: nowrap; font-variant-numeric: tabular-nums; }
.dc-delai.proche { color: var(--brand-800); background: var(--brand-50); padding: 1px 7px; border-radius: 999px; }
.dc-plus { margin-top: 6px; }
.dc-plus summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--brand-700); padding: 6px 4px; }

/* --- Graphiques ----------------------------------------------------------- */
.dash-charts-section { display: flex; flex-direction: column; gap: 12px; }
.dash-section-title { margin: 4px 0 0; font-size: 15px; font-weight: 700; color: var(--ink-900); }
.dash-charts-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.dash-chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 16px 18px; min-width: 0; }
.dash-chart-card h4 { margin: 0 0 10px; font-size: 13.5px; font-weight: 700; color: var(--ink-700); display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.dash-chart-card h4 span { font-size: 12px; font-weight: 600; color: var(--ink-500); }

/* --- Responsive ----------------------------------------------------------- */
@media (max-width: 1180px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .dash { padding: 4px 12px 32px; gap: 14px; }
  .dash-charts-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .dash-top-actions { width: 100%; }
  .dash-top-actions .btn { flex: 1; justify-content: center; }
  .dash-month-head { flex-wrap: wrap; }
  .dash-today-item { grid-template-columns: 50px minmax(0, 1fr); }
  .dash-today-actions { grid-column: 2; }
  .aj-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
