/* ==========================================================================
   L'Atelier du Cours · Portail de Cursus UE 2.1 (IFSI)
   Charte graphique didactique : fond papier chaud, typographie littéraire,
   accents vert chirurgical / pin et or chaud.
   ========================================================================== */

:root {
  --paper: #faf9f5;
  --white: #ffffff;
  --ink: #253c36;
  --ink-subtle: #3a504a;
  --muted: #65736c;
  --line: #dedfd5;
  --line-subtle: #ecefe6;
  --green: #175848;
  --green-hover: #103f33;
  --green-light: #e6eee5;
  --deep: #193f37;
  --gold: #b17b31;
  --gold-hover: #8f6022;
  --gold-light: #fbf6ec;
  --gold-border: #dfc699;
  --accent: #f0dabc;
  --red: #904839;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: Arial, Helvetica, sans-serif;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

html {
  box-sizing: border-box;
  scroll-behavior: smooth;
  scroll-padding-top: 68px;
}

*, *:before, *:after {
  box-sizing: inherit;
}

body.portal-body {
  margin: 0;
  padding: 0;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Header & Topbar (aligné sur .topbar des cours)
   ========================================================================== */
.portal-header {
  border-bottom: 1px solid var(--line);
  background: rgba(250, 249, 245, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 40;
  padding-top: env(safe-area-inset-top, 0px);
}

.portal-header-inner {
  max-width: 1240px;
  margin: 0 auto;
  height: 56px;
  padding: 0 max(5.5%, env(safe-area-inset-right, 0px)) 0 max(5.5%, env(safe-area-inset-left, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.portal-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.95rem;
  line-height: 1.2;
  flex-shrink: 0;
  white-space: nowrap;
}

.portal-brand-logo {
  height: 34px;
  width: auto;
  max-width: 38px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
  transition: transform .15s ease;
}
.portal-brand:hover .portal-brand-logo {
  transform: scale(1.05);
}

.portal-brand-mark {
  font-family: var(--serif);
  font-size: 32px;
  line-height: 1;
  letter-spacing: -3px;
  padding-right: 4px;
  color: var(--ink);
}
.portal-brand-mark span {
  color: var(--gold);
}

.portal-brand-text {
  display: flex;
  flex-direction: column;
}

.portal-brand-text b {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
  letter-spacing: -0.01em;
  display: block;
  line-height: 1.15;
}

.portal-brand-text small {
  font-size: 0.65rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 600;
  display: block;
  line-height: 1.2;
}

.portal-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 auto 0 16px;
  flex-wrap: nowrap;
}

.portal-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: var(--radius-md);
  color: var(--ink-subtle);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.portal-nav-link:hover {
  background: var(--line-subtle);
  color: var(--green);
}

.portal-nav-link.active {
  background: var(--green-light);
  color: var(--green);
  font-weight: 600;
  border-color: #cbd8c8;
}

.portal-nav-pill {
  font-size: 0.70rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--white);
  color: var(--muted);
  border: 1px solid var(--line);
  line-height: 1.3;
}

.portal-nav-link.active .portal-nav-pill,
.portal-nav-link:hover .portal-nav-pill {
  background: #d5e5d3;
  color: var(--green-hover);
  border-color: transparent;
}

.portal-nav-link .nav-ic {
  font-size: 0.9rem;
  line-height: 1;
}

.portal-nav-actions,
.portal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.portal-search-btn {
  background: var(--white);
  border: 1px solid var(--line);
  color: var(--muted);
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(37, 60, 54, 0.03);
}

.portal-search-btn:hover {
  background: var(--white);
  border-color: #a8b8a5;
  color: var(--ink);
  box-shadow: 0 2px 5px rgba(23, 88, 72, 0.08);
}

.portal-search-btn .search-placeholder {
  color: var(--muted);
  font-weight: 400;
}

.portal-search-btn:hover .search-placeholder {
  color: var(--ink);
}

.portal-search-btn kbd {
  background: #f0f2eb;
  border: 1px solid #d2d6cb;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.68rem;
  color: var(--muted);
  font-family: var(--sans);
  line-height: 1;
  margin-left: 4px;
}

/* ==========================================================================
   Main Canvas & Hero
   ========================================================================== */
.portal-main {
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  padding: 0 5.5% 60px;
  flex: 1;
}

.portal-hero {
  padding: 45px 0 25px;
}

.portal-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--green);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.portal-hero h1 {
  font-family: var(--serif);
  font-size: clamp(2.4rem, 4.4vw, 3.8rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  font-weight: 400;
  margin: 0 0 16px;
  color: var(--ink);
}

.portal-hero p.lead {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--muted);
  max-width: 760px;
  margin: 0 0 25px;
}

/* ==========================================================================
   Hero Spotlight : La Présentation Interactive
   ========================================================================== */
.deck-showcase-card {
  border-radius: var(--radius-lg);
  background: var(--deep);
  color: #e8eee2;
  padding: 32px 36px;
  margin-bottom: 35px;
  box-shadow: 0 12px 35px rgba(25, 63, 55, 0.12);
  position: relative;
  overflow: hidden;
}

.deck-showcase-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(223, 179, 106, 0.18);
  color: #f2cb7b;
  border: 1px solid rgba(223, 179, 106, 0.35);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.deck-showcase-card h2 {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 2.8vw, 2.2rem);
  color: #ffffff;
  font-weight: 400;
  margin: 0 0 10px;
}

.deck-showcase-card p {
  font-size: 0.95rem;
  line-height: 1.65;
  color: #b7cebf;
  max-width: 760px;
  margin: 0 0 22px;
}

.deck-quick-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 15px;
}

.deck-quick-btn {
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.20);
  color: #ffffff;
  padding: 10px 15px;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.18s ease;
}
.deck-quick-btn:hover {
  background: #ffffff;
  color: var(--deep);
  border-color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}
.deck-quick-btn .play-icon {
  color: var(--gold);
  font-size: 0.75rem;
}
.deck-quick-btn:hover .play-icon {
  color: var(--green);
}

/* ==========================================================================
   Stats Bar
   ========================================================================== */
.portal-stats-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 30px;
}

.stat-item {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  box-shadow: 0 1px 4px rgba(37, 60, 54, 0.03);
}

.stat-item .num {
  font-family: var(--serif);
  font-size: 1.55rem;
  color: var(--green);
  font-weight: 700;
  line-height: 1;
}

.stat-item .label {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

/* ==========================================================================
   Student Progress Card (Carnet de route)
   ========================================================================== */
.portal-progress-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 22px 26px;
  margin-bottom: 45px;
  box-shadow: 0 2px 8px rgba(37, 60, 54, 0.03);
}

.portal-progress-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.portal-progress-card-head h2 {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
  color: var(--ink);
}

.portal-progress-card-head .progress-pct {
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--green);
}

.portal-progress-bar {
  width: 100%;
  height: 8px;
  background: #e3e8de;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 10px;
}

.portal-progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--green), #248b6f);
  border-radius: 6px;
  transition: width 0.4s ease;
}

.portal-progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--muted);
  flex-wrap: wrap;
  gap: 10px;
}

/* ==========================================================================
   Diagnostic Dashboard Card
   ========================================================================== */
.portal-diagnostic-card {
  background: #fffdf5;
  border: 1.5px solid #e9d5a1;
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 36px;
  box-shadow: 0 4px 16px rgba(180, 83, 9, 0.06);
}
.portal-diagnostic-card.has-misconception {
  background: #fdf7f6;
  border-color: #f1b8af;
  box-shadow: 0 4px 16px rgba(185, 28, 28, 0.07);
}
.diag-header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}
.diag-icon {
  font-size: 1.8rem;
  line-height: 1;
}
.diag-header h3 {
  font-family: var(--serif);
  font-size: 1.25rem;
  color: #92400e;
  margin: 0 0 4px;
  font-weight: 600;
}
.portal-diagnostic-card.has-misconception .diag-header h3 {
  color: #991b1b;
}
.diag-header p {
  font-size: 0.85rem;
  line-height: 1.6;
  color: #4b5563;
  margin: 0;
}
.diag-courses-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 14px;
  border-top: 1px solid rgba(217, 119, 6, 0.15);
}
.diag-course-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid #d97706;
  border-radius: 8px;
  padding: 8px 14px;
  text-decoration: none;
  font-size: 0.82rem;
  color: #92400e;
  transition: all 0.18s ease;
}
.diag-course-chip:hover {
  background: #fef3c7;
  transform: translateY(-1px);
}
.diag-course-chip.chip-misc {
  border-color: #dc2626;
  color: #991b1b;
}
.diag-course-chip.chip-misc:hover {
  background: #fee2e2;
}

/* ==========================================================================
   Curriculum Grid & Cards
   ========================================================================== */
.portal-section-title {
  margin-bottom: 22px;
}

.portal-section-title h2 {
  font-family: var(--serif);
  font-size: 1.85rem;
  font-weight: 400;
  color: var(--ink);
  margin: 0 0 6px;
}

.portal-section-title p {
  font-size: 0.92rem;
  color: var(--muted);
  margin: 0;
}

.curriculum-grid {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 50px;
}

.course-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  display: grid;
  grid-template-columns: 52px 1fr 340px;
  gap: 22px;
  align-items: center;
  box-shadow: 0 2px 8px rgba(37, 60, 54, 0.03);
  transition: all 0.2s ease;
}

.course-card:hover {
  border-color: #b7c7b4;
  box-shadow: 0 8px 24px rgba(23, 88, 72, 0.08);
  transform: translateY(-2px);
}

.course-step-badge {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: #f0f4ee;
  border: 1px solid #d5dfd3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  flex-shrink: 0;
}

.course-info {
  min-width: 0;
}

.course-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.c-badge {
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: #f5f6f2;
  border: 1px solid var(--line);
  color: var(--muted);
  font-weight: 500;
}
.c-badge.accent {
  background: #eef4ec;
  border-color: #c4d7c0;
  color: var(--green);
  font-weight: 700;
}
.c-badge.check {
  background: #dfe8dd;
  border-color: #9cb597;
  color: var(--green);
  font-weight: 700;
}
.c-badge.ref2026 {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.c-badge.ref2026 small {
  font-weight: 500;
  color: #047857;
  opacity: 0.85;
}

.course-info h3 {
  font-family: var(--serif);
  font-size: 1.42rem;
  line-height: 1.25;
  font-weight: 600;
  margin: 0 0 8px;
}

.course-info h3 a {
  color: var(--ink);
  text-decoration: none;
}
.course-info h3 a:hover {
  color: var(--green);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.course-hook {
  font-size: 0.88rem;
  line-height: 1.6;
  color: #4a5c54;
  margin: 0;
}

/* ==========================================================================
   Course Actions (Mise en valeur de la Présentation Interactive)
   ========================================================================== */
.course-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Le bouton vedette pour démarrer : Présentation interactive */
.btn-deck-highlight {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--gold-light);
  border: 1.5px solid var(--gold-border);
  color: #3b2b17;
  font-weight: 700;
  font-size: 0.86rem;
  padding: 12px 18px;
  min-height: 46px;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: all 0.18s ease;
  box-shadow: 0 2px 8px rgba(177, 123, 49, 0.08);
  position: relative;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.btn-deck-highlight:hover {
  background: #f5edd8;
  border-color: var(--gold);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(177, 123, 49, 0.18);
  color: #291e0e;
}
.btn-deck-highlight .play-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--green);
  color: #ffffff;
  font-size: 0.72rem;
  line-height: 1;
}

/* Le bouton pour approfondir : Cours complet */
.btn-primary-course {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--green);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.86rem;
  padding: 11px 18px;
  min-height: 44px;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: all 0.18s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary-course:hover {
  background: var(--green-hover);
}

/* Outils d'entraînement et documents */
.btn-sub-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-sub {
  flex: 1 1 calc(33.333% - 6px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-align: center;
  font-size: 0.76rem;
  color: var(--ink-subtle);
  background: #f7f8f4;
  border: 1px solid var(--line);
  padding: 8px 10px;
  min-height: 42px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  font-weight: 500;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn-sub:hover {
  background: #e9eee4;
  color: var(--green);
  border-color: #b9cab5;
  transform: translateY(-1px);
}
.btn-sub-ic {
  font-size: 0.8rem;
  line-height: 1;
  display: inline-block;
}
.btn-sub.btn-notes {
  background: #fbf5e8;
  border-color: #eeddbb;
  color: #7d4e0e;
  font-weight: 600;
}
.btn-sub.btn-notes:hover {
  background: #f5ecd3;
  border-color: #d9ad59;
  color: #553406;
}
.btn-sub.btn-schema {
  background: #f0f4ff;
  border-color: #cbd5e1;
  color: #2b4c7e;
  font-weight: 600;
}
.btn-sub.btn-schema:hover {
  background: #e2ebfd;
  border-color: #93b4e6;
  color: #1a365d;
}
.btn-sub.btn-pdf {
  flex: 1 1 calc(50% - 6px);
  background: #f8faf6;
  border-color: #d2ddd0;
  color: #274b3f;
  font-weight: 600;
}
.btn-sub.btn-pdf:hover {
  background: #edf4eb;
  border-color: #8dae88;
  color: #175848;
}
.btn-sub.btn-pdf-source {
  flex: 1 1 calc(50% - 6px);
  background: #f4f6f8;
  border-color: #cbd5e1;
  color: #334155;
  font-weight: 600;
}
.btn-sub.btn-pdf-source:hover {
  background: #e2e8f0;
  border-color: #64748b;
  color: #0f172a;
}

/* ==========================================================================
   Meta-Glossary Section
   ========================================================================== */
.portal-glossary-section {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  margin-bottom: 50px;
  box-shadow: 0 2px 8px rgba(37, 60, 54, 0.03);
}

.glossary-az-nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin: 16px 0 24px;
}

.glossary-az-btn {
  background: #f4f6f1;
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}
.glossary-az-btn:hover,
.glossary-az-btn.active {
  background: var(--green);
  color: #ffffff;
  border-color: var(--green);
}

.glossary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  gap: 18px;
}

.glossary-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 1px 4px rgba(20, 42, 37, 0.03);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.glossary-card:hover {
  border-color: #a3c4a0;
  box-shadow: 0 6px 18px rgba(23, 88, 72, 0.08);
  transform: translateY(-2px);
}

.glossary-card h4 {
  font-family: var(--serif);
  font-size: 1.22rem;
  color: var(--green);
  margin: 0;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.glossary-card p {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--ink);
  margin: 0;
  flex: 1;
}

.glossary-occurrences {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 12px;
  margin-top: auto;
  border-top: 1px solid var(--line-subtle);
}

.occ-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #175848;
  background: #f0f5f2;
  border: 1px solid #d5dfd8;
  padding: 6px 13px;
  border-radius: 999px;
  text-decoration: none;
  line-height: 1.2;
  min-height: 32px;
  box-sizing: border-box;
  transition: all 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.occ-tag:hover,
.occ-tag:focus-visible {
  background: #175848;
  border-color: #175848;
  color: #ffffff;
  text-decoration: none;
  box-shadow: 0 3px 8px rgba(23, 88, 72, 0.25);
  transform: translateY(-1px);
}

.occ-tag .occ-icon {
  font-size: 0.95rem;
  line-height: 1;
}

.occ-tag .occ-title {
  color: inherit;
}

.occ-tag .occ-arrow {
  font-size: 0.82rem;
  opacity: 0.7;
  transition: transform 0.15s ease;
}

.occ-tag:hover .occ-arrow,
.occ-tag:focus-visible .occ-arrow {
  opacity: 1;
  transform: translateX(2px);
}

.glossary-card-links {
  font-size: 0.75rem;
  padding-top: 8px;
  border-top: 1px solid var(--line-subtle);
  color: var(--muted);
}
.glossary-card-links a {
  color: var(--green);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.portal-footer {
  border-top: 1px solid var(--line);
  padding: 30px max(5.5%, env(safe-area-inset-right, 0px)) max(40px, calc(30px + env(safe-area-inset-bottom, 0px))) max(5.5%, env(safe-area-inset-left, 0px));
  background: var(--paper);
  font-size: 0.78rem;
  color: var(--muted);
}

.portal-footer-inner {
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

.portal-footer a {
  color: var(--green);
  text-decoration: none;
}
.portal-footer a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Modal Dialogs (Recherche Cross-Cours & Vue Glossaire)
   ========================================================================== */
dialog.portal-dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 0;
  width: min(780px, 94vw);
  max-height: 88dvh;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 25px 90px rgba(25, 63, 55, 0.25);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

dialog.portal-dialog::backdrop {
  background: rgba(25, 63, 55, 0.35);
  backdrop-filter: blur(3px);
}

.portal-dialog-head {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: var(--white);
}

.portal-dialog-head h2 {
  font-family: var(--serif);
  font-size: 1.45rem;
  margin: 0;
  color: var(--ink);
  font-weight: 600;
}

.portal-dialog-close {
  background: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  font-size: 1.4rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  position: relative;
  z-index: 2;
  user-select: none;
  -webkit-appearance: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.15s ease;
}
.portal-dialog-close:hover {
  background: #f0f2eb;
  color: var(--ink);
  border-color: var(--muted);
}
.portal-dialog-close:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.portal-dialog-search-bar {
  padding: 16px 20px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}

.portal-dialog-search-bar input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  font-size: 16px; /* Prévention auto-zoom iOS / iPadOS Safari */
  color: var(--ink);
  background: #fafbf8;
  outline: none;
  touch-action: manipulation;
}
.portal-dialog-search-bar input:focus {
  border-color: var(--green);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(23, 88, 72, 0.12);
}

.portal-dialog-scroll {
  padding: 18px 20px;
  overflow-y: auto;
  max-height: calc(88dvh - 150px);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.search-result-item {
  display: block;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  text-decoration: none;
  color: inherit;
  margin-bottom: 10px;
  background: var(--white);
  border: 1px solid var(--line-subtle);
  transition: all 0.15s ease;
}
.search-result-item:hover {
  border-color: var(--green);
  background: #f8faf6;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(23, 88, 72, 0.06);
}

.res-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.72rem;
  margin-bottom: 4px;
}
.res-type {
  font-weight: 700;
  color: var(--green);
  background: #eef4ec;
  padding: 2px 6px;
  border-radius: 3px;
}
.res-course {
  color: var(--muted);
}
.res-title {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}
.res-snippet {
  font-size: 0.82rem;
  color: #4a5c54;
  line-height: 1.5;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 960px) {
  .course-card {
    grid-template-columns: 48px 1fr;
  }
  .course-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .btn-sub-group {
    grid-column: 1 / -1;
  }
}

@media (max-width: 860px) {
  .portal-brand-text small {
    display: none;
  }
  .portal-search-btn .search-placeholder {
    display: none;
  }
  .portal-nav {
    gap: 2px;
  }
  .portal-nav-link {
    padding: 6px 8px;
    font-size: 0.8rem;
  }
}

@media (max-width: 1100px) {
  .portal-header-inner {
    height: auto;
    padding-top: 8px;
    padding-bottom: 8px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .portal-brand {
    min-width: 0;
  }
  .portal-actions,
  .portal-nav-actions {
    margin-left: auto;
  }
  .portal-nav {
    order: 3;
    width: 100%;
    margin: 0;
    overflow-x: auto;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .portal-nav::-webkit-scrollbar {
    display: none;
  }
}

@media (max-width: 680px) {
  .portal-hero h1 {
    font-size: 2.3rem;
  }
  .course-card {
    grid-template-columns: 1fr;
    padding: 20px;
  }
  .course-actions {
    grid-template-columns: 1fr;
  }
  .deck-showcase-card {
    padding: 24px 20px;
  }
  .deck-quick-btn {
    width: 100%;
    justify-content: center;
  }
}

/* ==========================================================================
   Reprise de travail : Derniers cours consultés
   ========================================================================== */
.portal-resume-section {
  margin-bottom: 40px;
}

.portal-resume-head {
  margin-bottom: 18px;
}

.portal-resume-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(35, 78, 73, 0.08);
  color: var(--green);
  border: 1px solid rgba(35, 78, 73, 0.20);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.portal-resume-head h2 {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 2.6vw, 2.1rem);
  color: var(--ink);
  font-weight: 400;
  margin: 0 0 8px;
}

.portal-resume-lead {
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0;
  max-width: 780px;
}

.resume-spotlight-card {
  background: linear-gradient(135deg, #ffffff 0%, #f7f9f5 100%);
  border: 2px solid #89b5a8;
  border-radius: var(--radius-lg);
  padding: 26px 30px;
  box-shadow: 0 8px 24px rgba(23, 88, 72, 0.07);
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
  overflow: hidden;
}

.resume-spotlight-top {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.resume-spotlight-step {
  font-size: 2.2rem;
  line-height: 1;
  background: #eef4eb;
  border: 1px solid #d2ded0;
  width: 58px;
  height: 58px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.resume-spotlight-meta {
  flex: 1;
  min-width: 0;
}

.resume-spotlight-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.resume-spotlight-meta h3 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--ink);
  margin: 0 0 6px;
}

.resume-spotlight-sub {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
}

.resume-spotlight-location {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fbf6ec;
  border: 1px solid #ecd59b;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.9rem;
  color: #7d4e0e;
}

.resume-spotlight-location .loc-pin {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.resume-spotlight-location .loc-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 2px;
}

.resume-spotlight-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  padding-top: 6px;
}

.btn-resume-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--green);
  color: #ffffff;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 3px 10px rgba(35, 78, 73, 0.25);
  transition: all 0.18s ease;
  min-height: 44px;
}

.btn-resume-cta:hover {
  background: var(--deep);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(20, 42, 37, 0.35);
  text-decoration: none;
  color: #ffffff;
}

.resume-sub-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-resume-tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--ink-subtle);
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  min-height: 44px;
  transition: all 0.15s ease;
}

.btn-resume-tool:hover {
  background: #f4f6f1;
  color: var(--green);
  border-color: #b7c7b4;
  text-decoration: none;
}

/* Starter card si aucun cours n'a été entamé */
.resume-starter-card {
  background: #fdfdfb;
  border: 1px solid #d5dfd3;
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 20px;
  align-items: center;
  box-shadow: 0 3px 12px rgba(23, 88, 72, 0.04);
}

.starter-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: #f0f4ee;
  border: 1px solid #d5dfd3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  flex-shrink: 0;
}

.starter-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.resume-starter-card h3 {
  font-family: var(--serif);
  font-size: 1.25rem;
  margin: 0 0 6px;
  color: var(--ink);
}

.resume-starter-card p {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
}

/* ==========================================================================
   Historique de lecture automatique
   ========================================================================== */
.portal-history-section {
  margin-bottom: 45px;
}

.portal-history-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.portal-history-title-wrap {
  flex: 1;
  min-width: 280px;
}

.portal-history-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(35, 78, 73, 0.08);
  color: var(--green);
  border: 1px solid rgba(35, 78, 73, 0.20);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.portal-history-head h2 {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 2.5vw, 2.0rem);
  color: var(--ink);
  font-weight: 400;
  margin: 0 0 8px;
}

.portal-history-lead {
  font-size: 0.93rem;
  color: var(--muted);
  margin: 0;
  max-width: 780px;
  line-height: 1.6;
}

.btn-clear-history {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  transition: all 0.18s ease;
  align-self: flex-start;
}

.btn-clear-history:hover {
  background: #fdf2f2;
  color: #991b1b;
  border-color: #f1b8af;
}

.history-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-item {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 2px 6px rgba(37, 60, 54, 0.02);
  transition: all 0.18s ease;
}

.history-item:hover {
  border-color: #89b5a8;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(23, 88, 72, 0.06);
}

.history-item-icon {
  font-size: 1.8rem;
  line-height: 1;
  width: 48px;
  height: 48px;
  background: #f0f5ee;
  border: 1px solid #d4e2d2;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.history-item-body {
  flex: 1;
  min-width: 0;
}

.history-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.history-time-pill {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
}

.history-course-tag {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--green);
  background: rgba(23, 88, 72, 0.08);
  padding: 2px 8px;
  border-radius: 4px;
}

.history-auto-badge {
  font-size: 0.68rem;
  font-weight: 600;
  color: #1e6b48;
  background: #e6f4ea;
  border: 1px solid #b7dfca;
  padding: 2px 7px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.history-path-tag {
  font-size: 0.68rem;
  color: #8c734b;
  background: #fdf6ec;
  padding: 2px 6px;
  border-radius: 4px;
}

.history-item-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.35;
}

.history-item-title a {
  color: var(--ink);
  text-decoration: none;
  transition: color 0.15s ease;
}

.history-item-title a:hover {
  color: var(--green);
  text-decoration: underline;
}

.history-sec {
  color: var(--muted);
  font-size: 0.95rem;
}

.history-sep {
  color: #b5b8ae;
  margin: 0 4px;
}

.history-blk {
  font-weight: 600;
  color: var(--ink);
}

.history-item-action {
  flex-shrink: 0;
}

.btn-history-resume {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f7faf5;
  border: 1px solid #c2d6c9;
  color: var(--green);
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  min-height: 44px;
  transition: all 0.18s ease;
}

.btn-history-resume:hover {
  background: var(--green);
  color: #ffffff;
  border-color: var(--green);
  box-shadow: 0 3px 10px rgba(23, 88, 72, 0.20);
  text-decoration: none;
}

/* Empty state card */
.history-empty-card {
  background: #fafbf8;
  border: 1px dashed #cdd7ca;
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.history-empty-card .empty-icon {
  font-size: 2.2rem;
  background: #ffffff;
  border: 1px solid #d8e2d4;
  width: 58px;
  height: 58px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.history-empty-card .empty-text {
  flex: 1;
  min-width: 260px;
}

.history-empty-card h3 {
  font-family: var(--serif);
  font-size: 1.15rem;
  color: var(--ink);
  margin: 0 0 6px;
  font-weight: 600;
}

.history-empty-card p {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}

.btn-empty-start {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--green);
  color: #ffffff;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
  min-height: 44px;
  transition: all 0.18s ease;
  flex-shrink: 0;
}

.btn-empty-start:hover {
  background: var(--deep);
  color: #ffffff;
  text-decoration: none;
}

@media (max-width: 720px) {
  .history-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .history-item-action {
    width: 100%;
  }
  .btn-history-resume {
    width: 100%;
    justify-content: center;
  }
}

/* Gateway card vers schemas.html */
.portal-diagram-gateway-card {
  background: linear-gradient(135deg, #f7f9fd 0%, #f0f4fb 100%);
  border: 1.5px solid #c8d7eb;
  border-radius: var(--radius-lg);
  padding: 28px 34px;
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 24px;
  align-items: center;
  margin-bottom: 24px;
  box-shadow: 0 3px 12px rgba(35, 65, 100, 0.04);
}

.portal-diagram-gateway-card .gateway-tag {
  color: #2b4c7e;
}

.portal-diagram-gateway-card h2 {
  font-family: var(--serif);
  font-size: 1.55rem;
  color: var(--ink);
  font-weight: 500;
  margin: 0 0 6px;
}

.portal-diagram-gateway-card p {
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
  max-width: 720px;
}

.portal-diagram-gateway-card .btn-gateway-primary {
  background: #1e3a63;
}

.portal-diagram-gateway-card .btn-gateway-primary:hover {
  background: #152b4b;
  box-shadow: 0 4px 14px rgba(21, 43, 75, 0.25);
}

/* Gateway card vers glossaire.html */
.portal-glossary-gateway-card {
  background: linear-gradient(135deg, #fbfaf7 0%, #f4f7f2 100%);
  border: 1.5px solid #c9d8c5;
  border-radius: var(--radius-lg);
  padding: 28px 34px;
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 24px;
  align-items: center;
  margin-bottom: 50px;
  box-shadow: 0 3px 12px rgba(37, 60, 54, 0.04);
}

.gateway-icon {
  font-size: 2.4rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gateway-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--green);
  margin-bottom: 6px;
}

.portal-glossary-gateway-card h2 {
  font-family: var(--serif);
  font-size: 1.55rem;
  color: var(--ink);
  font-weight: 500;
  margin: 0 0 6px;
}

.portal-glossary-gateway-card p {
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
  max-width: 720px;
}

.btn-gateway-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--deep);
  color: #ffffff;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.18s ease;
  white-space: nowrap;
  min-height: 44px;
}

.btn-gateway-primary:hover {
  background: var(--green);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(20, 42, 37, 0.25);
  text-decoration: none;
  color: #ffffff;
}

/* Page spécifique glossaire.html */
.glossary-page-hero {
  margin-bottom: 28px;
}

.glossary-search-toolbar {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.glossary-search-input-wrap {
  flex: 1;
  min-width: 260px;
  position: relative;
}

.glossary-search-input {
  width: 100%;
  padding: 12px 18px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  background: #ffffff;
  color: var(--ink);
  outline: none;
  transition: border-color 0.18s;
  min-height: 46px;
}

.glossary-search-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(35, 78, 73, 0.15);
}

.glossary-counter-pill {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--green);
  background: #eef5f1;
  border: 1px solid #cbe0d5;
  border-radius: 20px;
  padding: 6px 14px;
  white-space: nowrap;
}

@media (max-width: 850px) {
  .portal-diagram-gateway-card,
  .portal-glossary-gateway-card {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
  .resume-starter-card {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .btn-resume-cta, .btn-gateway-primary {
    width: 100%;
    justify-content: center;
    white-space: normal;
    text-align: center;
  }
}

/* ==========================================================================
   Section 2c : Analyse d'activité, Temps investi & Neuro-ergonomie
   ========================================================================== */
.portal-time-stats-section {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  margin-bottom: 40px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.portal-time-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.portal-time-title-group {
  flex: 1;
  min-width: 280px;
}

.portal-badge-track {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--green);
  background: #eef6f2;
  border: 1px solid #cbe0d5;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

#time-stats-heading {
  font-family: var(--serif);
  font-size: 1.7rem;
  color: var(--deep);
  margin: 4px 0 8px 0;
  letter-spacing: -0.01em;
}

.portal-time-lead {
  font-size: 0.92rem;
  color: var(--muted);
  max-width: 780px;
  margin: 0;
  line-height: 1.5;
}

/* Sensor live pill */
.sensor-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #175848;
  background: #f1f8f4;
  border: 1px solid #bfe3d0;
  padding: 6px 14px;
  border-radius: 20px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(23, 88, 72, 0.08);
  transition: all 0.3s ease;
}

.sensor-live-pill.idle {
  color: #7a5a22;
  background: #fdf8ed;
  border-color: #ebdcb9;
  box-shadow: 0 2px 6px rgba(177, 123, 49, 0.08);
}

.sensor-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #1cb886;
  box-shadow: 0 0 0 0 rgba(28, 184, 134, 0.7);
  animation: pulse-sensor 2s infinite;
}

.sensor-live-pill.idle .sensor-dot {
  background: #c9933d;
  box-shadow: none;
  animation: none;
}

@keyframes pulse-sensor {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(28, 184, 134, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(28, 184, 134, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(28, 184, 134, 0);
  }
}

/* 4 Top KPI Cards */
.time-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.time-kpi-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.time-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.time-kpi-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.time-kpi-num {
  font-family: var(--serif);
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--deep);
  margin: 8px 0 4px 0;
  line-height: 1.15;
}

.time-kpi-label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}

.time-kpi-sub {
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.35;
}

/* Two-column layout */
.time-split-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 28px;
}

.time-card-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 24px;
}

.time-card-panel .panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.time-card-panel .panel-head h3 {
  font-family: var(--serif);
  font-size: 1.18rem;
  color: var(--deep);
  margin: 0;
}

.panel-tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gold);
  background: var(--gold-light);
  border: 1px solid var(--gold-border);
  padding: 3px 8px;
  border-radius: 4px;
}

.time-card-panel .panel-sub {
  font-size: 0.84rem;
  color: var(--muted);
  margin: 0 0 18px 0;
  line-height: 1.4;
}

/* Course progress list */
.course-time-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.course-time-row {
  background: var(--white);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  transition: border-color 0.15s ease;
}

.course-time-row:hover {
  border-color: var(--line);
}

.course-time-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.course-time-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--ink);
  flex-wrap: wrap;
}

.course-time-title strong {
  font-weight: 600;
}

.course-time-metric {
  text-align: right;
  white-space: nowrap;
}

.course-time-metric .time-val {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 0.94rem;
  color: var(--deep);
}

.course-time-metric .time-target {
  font-size: 0.76rem;
  color: var(--muted);
  margin-left: 4px;
}

.course-time-bar-track {
  height: 7px;
  background: #e6eae3;
  border-radius: 4px;
  overflow: hidden;
  margin: 8px 0 6px 0;
}

.course-time-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #175848, #2a836d);
  border-radius: 4px;
  transition: width 0.4s ease;
  min-width: 2px;
}

.course-time-bar-fill.complete {
  background: linear-gradient(90deg, #b17b31, #d6983f);
}

.course-time-row-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.76rem;
  color: var(--muted);
}

.course-time-jump {
  color: var(--green);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.15s;
}

.course-time-jump:hover {
  color: var(--green-hover);
  text-decoration: underline;
}

/* Circadian 3-slot grid */
.circadian-slots-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.circadian-slot-box {
  background: var(--white);
  border: 1.5px solid var(--line-subtle);
  border-radius: var(--radius-md);
  padding: 14px 12px;
  text-align: center;
  transition: all 0.2s ease;
}

.circadian-slot-box.favored {
  border-color: var(--green);
  background: #f2f8f5;
  box-shadow: 0 0 0 2px rgba(23, 88, 72, 0.12);
}

.slot-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.88rem;
  color: var(--deep);
}

.slot-hours {
  font-size: 0.74rem;
  color: var(--muted);
  margin: 3px 0;
}

.slot-pct {
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--deep);
  line-height: 1.1;
  margin: 6px 0 2px 0;
}

.circadian-slot-box.favored .slot-pct {
  color: var(--green);
}

.slot-time {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-subtle);
}

.slot-desc {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 6px;
  border-top: 1px solid var(--line-subtle);
  padding-top: 6px;
}

/* 24h Histogram */
.histogram-section {
  background: var(--white);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-md);
  padding: 16px 14px;
}

.histogram-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.histogram-head h4 {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}

.hist-peak-hint {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--gold);
}

.histogram-chart {
  display: flex;
  align-items: flex-end;
  height: 110px;
  gap: 3px;
  padding-top: 8px;
}

.hist-col {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  cursor: pointer;
}

.hist-bar-wrap {
  width: 100%;
  flex: 1;
  display: flex;
  align-items: flex-end;
}

.hist-bar {
  width: 100%;
  border-radius: 2px 2px 0 0;
  min-height: 2px;
  transition: height 0.25s ease, background 0.15s ease;
}

.hist-bar.bar-morning {
  background: #d4e5de;
}
.hist-bar.bar-morning.has-activity {
  background: #175848;
}
.hist-bar.bar-afternoon {
  background: #ede6d6;
}
.hist-bar.bar-afternoon.has-activity {
  background: #b17b31;
}
.hist-bar.bar-evening {
  background: #dce3ed;
}
.hist-bar.bar-evening.has-activity {
  background: #395275;
}

.hist-col:hover .hist-bar {
  filter: brightness(1.15);
  transform: scaleY(1.05);
}

.hist-hour {
  font-size: 0.62rem;
  color: var(--muted);
  margin-top: 4px;
  height: 12px;
  white-space: nowrap;
}

/* Recent Sessions Log */
.session-history-panel {
  margin-bottom: 28px;
}

.session-timeline-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.session-item-row {
  display: grid;
  grid-template-columns: 180px 1fr 140px 120px;
  align-items: center;
  gap: 12px;
  background: var(--white);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  transition: border-color 0.15s;
}

.session-item-row:hover {
  border-color: var(--line);
}

.session-time-col {
  display: flex;
  flex-direction: column;
}

.session-date {
  font-size: 0.72rem;
  color: var(--muted);
}

.session-interval {
  font-family: var(--serif);
  font-size: 0.92rem;
  color: var(--ink);
  font-weight: 600;
}

.session-course-col {
  display: flex;
  align-items: center;
  gap: 10px;
}

.session-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.session-course-col strong {
  font-size: 0.88rem;
  color: var(--deep);
  display: block;
}

.session-type {
  font-size: 0.74rem;
  color: var(--muted);
}

.session-slot-badge {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  white-space: nowrap;
}

.session-slot-badge.morning {
  background: #eef6f2;
  color: #175848;
  border: 1px solid #cbe0d5;
}

.session-slot-badge.afternoon {
  background: #fcf6eb;
  color: #8f6022;
  border: 1px solid #dfc699;
}

.session-slot-badge.evening, .session-slot-badge.night {
  background: #eff2f8;
  color: #2b405e;
  border: 1px solid #cad4e5;
}

.session-dur-pill {
  display: inline-block;
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: 0.82rem;
  font-weight: 700;
  font-family: var(--serif);
  color: var(--deep);
  padding: 4px 10px;
  border-radius: 4px;
  text-align: right;
  width: 100%;
  box-sizing: border-box;
}

.session-empty-state {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--white);
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-md);
  padding: 24px;
  color: var(--muted);
}

.session-empty-state .empty-clock {
  font-size: 2rem;
}

.session-empty-state strong {
  display: block;
  color: var(--ink);
  font-size: 0.95rem;
  margin-bottom: 2px;
}

.session-empty-state p {
  margin: 0;
  font-size: 0.84rem;
}

/* Neuro-ergonomics Coaching */
.neuro-panel {
  margin-bottom: 24px;
}

.neuro-advice-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.neuro-advice-card {
  background: var(--white);
  border: 1px solid var(--line-subtle);
  border-left: 4px solid var(--green);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.15s ease;
}

.neuro-advice-card:hover {
  transform: translateY(-1px);
}

.advice-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--deep);
}

.advice-icon {
  font-size: 1.15rem;
}

.neuro-advice-card p {
  margin: 0;
  font-size: 0.86rem;
  color: var(--ink-subtle);
  line-height: 1.5;
}

/* Controls Toolbar */
.time-stats-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid var(--line-subtle);
}

.btn-time-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--white);
  border: 1.5px solid var(--line);
  color: var(--ink);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-time-action:hover {
  background: var(--paper);
  border-color: var(--green);
  color: var(--deep);
}

.btn-time-action.danger {
  color: #8c3226;
  border-color: #f1cfc8;
  background: #fffafa;
}

.btn-time-action.danger:hover {
  background: #faecea;
  border-color: #d15647;
  color: #721e14;
}

/* Responsive adjustments */
@media (max-width: 980px) {
  .time-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .time-split-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .neuro-advice-grid {
    grid-template-columns: 1fr;
  }
  .session-item-row {
    grid-template-columns: 160px 1fr 120px 100px;
  }
}

@media (max-width: 680px) {
  .portal-time-stats-section {
    padding: 20px 16px;
  }
  .portal-time-title-group {
    min-width: 0;
  }
  .course-time-row-head {
    flex-wrap: wrap;
  }
  .time-kpi-grid {
    grid-template-columns: 1fr;
  }
  .circadian-slots-grid {
    grid-template-columns: 1fr;
  }
  .session-item-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .session-time-col, .session-slot-col, .session-dur-col {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  .session-dur-pill {
    width: auto;
  }
  .time-stats-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .btn-time-action {
    justify-content: center;
  }
}

/* ==========================================================================
   Distribution par enseignement intégrée dans les cartes du Cursus
   ========================================================================== */
.course-time-tracker {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--line-subtle);
}

.course-time-tracker-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.course-time-tracker-label {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 0.84rem;
  color: var(--ink);
  flex-wrap: wrap;
}

.course-time-icon {
  font-size: 0.95rem;
}

.course-time-tracker-label strong {
  font-family: var(--serif);
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--deep);
}

.course-time-budget {
  font-size: 0.76rem;
  color: var(--muted);
}

.course-time-tracker-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
  white-space: nowrap;
}

.course-time-tracker-badge.empty {
  background: #f1f3ee;
  color: var(--muted);
  border: 1px solid #dcdfd6;
}

.course-time-tracker-badge.active {
  background: #eef6f2;
  color: var(--green);
  border: 1px solid #cbe0d5;
}

.course-time-tracker-badge.complete {
  background: var(--gold-light);
  color: var(--gold-hover);
  border: 1px solid var(--gold-border);
}

.course-time-tracker-bar {
  height: 6px;
  background: #e6eae3;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 5px;
}

.course-time-tracker-fill {
  height: 100%;
  background: linear-gradient(90deg, #175848, #2a836d);
  border-radius: 4px;
  transition: width 0.4s ease;
  min-width: 0;
}

.course-time-tracker-fill.complete {
  background: linear-gradient(90deg, #b17b31, #dfa34b);
}

.course-time-tracker-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.74rem;
  color: var(--muted);
}

.course-time-status {
  font-style: italic;
}

.course-time-ref {
  font-weight: 600;
  color: var(--muted);
}

/* Bannière de liaison distribution -> Cursus */
.time-distribution-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #f4f8f5;
  border: 1px solid #d0e3d7;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.time-distribution-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
  color: var(--ink);
  flex: 1;
  min-width: 260px;
}

.time-distribution-banner .dist-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}

.time-distribution-banner strong {
  color: var(--deep);
  margin-right: 4px;
}

.btn-time-jump-curriculum {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--deep);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 15px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.18s ease;
}

.btn-time-jump-curriculum:hover {
  background: var(--green);
  color: #ffffff;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(23, 88, 72, 0.18);
}

.circadian-panel {
  margin-bottom: 28px;
}

