/* Petits écrans par défaut ; adaptations progressives en min-width. */
@layer fondations, interface;
@layer interface {
  .app-shell { display: block; min-height: 100vh; }
  .topbar { background: rgb(255, 255, 255); position: sticky; top: 0px; z-index: 30; border-bottom: 1px solid rgb(229, 233, 223); height: 67px; padding: 0px 17px; }
  .topbar-inner { height: 100%; display: flex; align-items: center; width: 100%; gap: 12px; }
  .brand { flex: 0 0 auto; background: transparent; border-radius: 11px; width: 148px; padding: 6px 8px; }
  .brand img { width: 100%; max-width: none; background: none; border-radius: 0px; padding: 0px; }
  .page-context { border-left: 1px solid rgb(220, 228, 214); padding-left: 23px; flex-direction: column; gap: 3px; display: none; }
  .page-context span { font-size: var(--texte-discret); letter-spacing: 0.15em; color: rgb(154, 170, 148); font-weight: 700; }
  .page-context strong { font-size: var(--texte-secondaire); }
  .top-actions { margin-left: auto; gap: 11px; }
  .student-label { font-size: var(--texte-discret); color: rgb(146, 162, 139); font-weight: 700; letter-spacing: 0.12em; white-space: nowrap; display: none; }
  .top-avatar { width: 35px; height: 35px; }
  .shell-body { grid-template-columns: 83px minmax(0px, 1fr); display: block; min-height: calc(-67px + 100vh); }
  .main-nav { background: rgb(255, 255, 255); border-right: 1px solid rgb(229, 233, 223); min-height: calc(-82px + 100vh); height: calc(-82px + 100vh); position: sticky; top: 82px; flex-direction: column; align-items: center; padding: 24px 4px; gap: 9px; z-index: 10; display: none; }
  .main-nav .nav-item { min-height: 68px; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 5px 3px; color: rgb(136, 151, 131); font-weight: 700; text-align: center; width: 73px; font-size: var(--texte-discret); }
  @media (hover: hover) and (pointer: fine) {
    .main-nav .nav-item:hover { background: rgb(240, 245, 233); color: rgb(63, 111, 31); }
  }
  .main-nav .nav-item.active { background: rgb(230, 241, 215); color: rgb(63, 111, 31); }
  .main-nav .nav-item:last-child { margin-top: 0px; }
  .main-column { min-width: 0px; width: 100%; }
  .mobile-nav { display: flex; position: fixed; bottom: 0px; left: 0px; right: 0px; z-index: 30; background: rgb(255, 255, 255); border-top: 1px solid rgb(226, 233, 223); box-shadow: rgba(35, 55, 33, 0.07) 0px -9px 25px; height: 65px; align-items: stretch; justify-content: space-around; padding: 3px 3px max(3px,env(safe-area-inset-bottom)); }
  .curriculum-page .page-heading { margin-top: 10px; }
  .course-path { display: flex; align-items: center; flex-wrap: wrap; margin: 0px 0px 24px; color: rgb(155, 173, 149); font-size: var(--texte-discret); gap: 6px; }
  .course-path button { border: 0px; background: none; color: rgb(102, 139, 84); padding: 0px; font-weight: 600; font-size: var(--texte-discret); }
  @media (hover: hover) and (pointer: fine) {
    .course-path button:hover { text-decoration: underline; }
  }
  .course-path span { font-size: clamp(1.0625rem, 0.9375rem + 0.6vw, 1.3125rem); line-height: 1; }
  .content-type-icon { width: 41px; height: 41px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 18px; }
  .content-type-icon.green { background: rgb(237, 245, 232); color: rgb(75, 129, 48); }
  .content-type-icon.yellow { background: rgb(255, 244, 218); color: rgb(173, 135, 56); }
  .content-type-icon.purple { background: rgb(241, 238, 254); color: rgb(134, 116, 175); }
  .mobile-nav .nav-item { min-height: 0px; border-radius: 9px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 5px 2px; color: rgb(136, 151, 131); font-weight: 700; text-align: center; gap: 4px; width: 25%; font-size: var(--texte-discret); }
  .mobile-nav .nav-item svg { width: 19px; height: 19px; }
  @media (hover: hover) and (pointer: fine) {
    .mobile-nav .nav-item:hover { background: rgb(230, 241, 215); color: rgb(63, 111, 31); }
  }
  .mobile-nav .nav-item.active { background: rgb(230, 241, 215); color: rgb(63, 111, 31); }
  .page { padding-bottom: 95px; }
  .site-footer { padding-bottom: 80px; }
  .toast { bottom: 80px; }
  .record-list { display: grid; gap: 12px; }
  .record-row { display: flex; align-items: center; background: rgb(255, 255, 255); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 15px; padding: 15px; gap: 10px; }
  .record-mark { display: grid; place-items: center; border-radius: 11px; font-family: "Concert One"; flex: 0 0 auto; width: 39px; height: 39px; font-size: clamp(1.25rem, 1.125rem + 0.6vw, 1.5rem); }
  .record-mark.lime { background: rgb(231, 241, 215); color: rgb(101, 142, 61); }
  .record-mark.peach { background: rgb(250, 230, 217); color: rgb(179, 116, 85); }
  .record-mark.lavender { background: rgb(238, 233, 248); color: rgb(138, 113, 163); }
  .record-mark.mint { background: rgb(220, 239, 229); color: rgb(87, 139, 108); }
  .record-row h3 { margin: 0px 0px 3px; font-size: clamp(1.125rem, 1rem + 0.6vw, 1.375rem); }
  .record-row p { font-size: var(--texte-discret); color: rgb(139, 154, 133); margin: 0px; }
  .record-score { margin-left: auto; white-space: nowrap; font-family: "Concert One"; font-weight: 400; color: rgb(63, 111, 31); font-size: clamp(1.25rem, 1.125rem + 0.6vw, 1.5rem); }
  .settings-grid { display: grid; gap: 17px; grid-template-columns: 1fr; }
  .settings-panel { padding: 21px; }
  .settings-side { align-self: start; background: rgb(242, 247, 237); padding: 21px; }
  .settings-panel h2 { font-size: clamp(2rem, 1.875rem + 0.6vw, 2.25rem); margin: 0px 0px 5px; }
  .settings-panel p { font-size: var(--texte-secondaire); color: rgb(123, 140, 118); margin: 0px; }
  .settings-side p { font-size: var(--texte-secondaire); color: rgb(123, 140, 118); margin: 0px; }
  .settings-divider { height: 1px; background: rgb(230, 237, 225); margin: 30px 0px; }
  .setting-option { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 15px 0px; cursor: pointer; }
  .setting-option strong { display: block; font-size: var(--texte-secondaire); }
  .setting-option small { display: block; font-size: var(--texte-discret); color: rgb(137, 153, 134); margin-top: 5px; }
  .setting-option input { width: 20px; height: 20px; accent-color: rgb(63, 111, 31); flex: 0 0 auto; }
  .settings-side-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; background: rgb(225, 239, 218); color: rgb(63, 111, 31); margin-bottom: 19px; }
  .settings-side h2 { font-size: clamp(1.625rem, 1.5rem + 0.6vw, 1.875rem); margin: 0px 0px 8px; }
  .settings-side .text-link { margin-top: 24px; }
  .exit-page { display: flex; align-items: center; justify-content: center; min-height: calc(-67px + 100vh); }
  .exit-card { width: min(100%, 580px); text-align: center; padding: 27px 21px; }
  .exit-symbol { display: block; font-family: "Concert One"; font-size: 78px; line-height: 1; color: rgb(143, 185, 99); margin-bottom: 16px; }
  .exit-card h1 { margin: 0px 0px 10px; font-size: clamp(2rem, 1.875rem + 0.6vw, 2.25rem); }
  .exit-card p { font-size: var(--texte-secondaire); color: rgb(123, 140, 118); margin: 0px 0px 24px; }
  .exit-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
  .signed-out .main-nav { display: none; }
  .signed-out .mobile-nav { display: none; }
  .signed-out .top-actions { display: none; }
  .signed-out .page-context { display: none; }
  .signed-out .site-footer { display: none; }
  .signed-out .shell-body { display: block; }
  .reduce-motion * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .reduce-motion ::before { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .reduce-motion ::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .profile-menu { position: relative; }
  .profile-menu .top-avatar { border: 0px; cursor: pointer; }
  @media (hover: hover) and (pointer: fine) {
    .profile-menu .top-avatar:hover { background: rgb(199, 226, 165); }
  }
  .profile-menu .top-avatar[aria-expanded="true"] { background: rgb(199, 226, 165); }
  .profile-menu .top-avatar:focus-visible { outline: rgb(63, 111, 31) solid 2px; outline-offset: 3px; }
  .profile-dropdown { position: absolute; right: 0px; top: calc(100% + 13px); width: 224px; display: flex; flex-direction: column; padding: 8px; background: rgb(255, 255, 255); border: 1px solid rgb(225, 233, 219); border-radius: 14px; box-shadow: rgba(37, 57, 34, 0.145) 0px 18px 45px; z-index: 40; }
  .profile-dropdown[hidden] { display: none; }
  .profile-summary { display: flex; flex-direction: column; gap: 3px; padding: 12px 13px 13px; border-bottom: 1px solid rgb(232, 238, 227); margin-bottom: 5px; }
  .profile-summary strong { font-size: var(--texte-secondaire); }
  .profile-summary span { font-size: var(--texte-discret); color: rgb(136, 153, 132); }
  .profile-dropdown a { display: block; padding: 10px 13px; border-radius: 8px; color: rgb(53, 78, 44); font-size: var(--texte-secondaire); font-weight: 600; }
  @media (hover: hover) and (pointer: fine) {
    .profile-dropdown a:hover { background: rgb(237, 245, 232); outline: none; }
  }
  .profile-dropdown a:focus-visible { background: rgb(237, 245, 232); outline: none; }
  .continuation-mark { display: grid; place-items: center; width: 39px; height: 39px; border-radius: 9px; font-family: "Concert One"; font-size: clamp(1.375rem, 1.25rem + 0.6vw, 1.625rem); margin-bottom: 12px; }
  .continuation-mark.peach { background: rgb(250, 230, 217); color: rgb(179, 116, 85); }
  .continuation-mark.lavender { background: rgb(238, 233, 248); color: rgb(138, 113, 163); }
  .continuation-mark.mint { background: rgb(220, 239, 229); color: rgb(87, 139, 108); }
  .dashboard-page > .section-heading:first-of-type { display: block; }
  .dashboard-page > .section-heading:first-of-type .text-link { margin-top: 8px; }
  .welcome-one { position: relative; overflow: hidden; background: rgb(63, 111, 31); color: rgb(255, 255, 255); border-radius: 20px; padding: 23px 21px; }
  .welcome-one::before { content: ""; position: absolute; width: 310px; height: 310px; border: 1px solid rgba(255, 255, 255, 0.153); border-radius: 50%; right: 5%; top: -95px; }
  .welcome-one-top { display: grid; align-items: center; position: relative; grid-template-columns: 1fr; gap: 18px; }
  .welcome-one-copy h1 { margin: 0px 0px 8px; font-size: clamp(2.25rem, 2.125rem + 0.6vw, 2.5rem); }
  .welcome-one-copy p { font-size: var(--texte-secondaire); color: rgb(217, 234, 203); margin: 0px 0px 18px; }
  .welcome-one-focus { width: 100%; background: rgb(237, 245, 223); color: rgb(49, 91, 32); border-radius: 15px; padding: 18px 20px; box-shadow: rgba(37, 70, 15, 0.106) 0px 13px 30px; justify-self: start; max-width: none; transform: none; }
  .welcome-one-focus > strong { display: block; font-family: "Concert One"; font-size: 65px; font-weight: 400; line-height: 1; }
  .welcome-one-focus > strong span { font-size: clamp(1.875rem, 1.75rem + 0.6vw, 2.125rem); }
  .welcome-one-focus p { font-size: var(--texte-discret); margin: 2px 0px 16px; color: rgb(105, 136, 90); }
  .welcome-one-focus .progress-track { background: rgb(212, 229, 195); }
  .welcome-kpis { display: grid; grid-template-columns: repeat(2, minmax(0px, 1fr)); gap: 10px; margin-top: 10px; }
  .welcome-kpi { position: relative; display: flex; align-items: center; overflow: hidden; background: rgb(255, 255, 255); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); gap: 10px; padding: 14px 11px 19px; min-height: 100px; }
  .welcome-kpi-icon { display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: rgb(226, 236, 217); color: rgb(63, 111, 31); width: 41px; height: 41px; }
  .welcome-kpi-copy { min-width: 0px; }
  .welcome-kpi-copy span { display: block; color: rgb(104, 119, 102); line-height: 1.25; font-size: var(--texte-discret); }
  .welcome-kpi-copy strong { display: block; color: rgb(32, 39, 33); font-family: "Concert One"; font-weight: 400; line-height: 1.1; margin-top: 5px; white-space: nowrap; font-size: clamp(1.5625rem, 1.4375rem + 0.6vw, 1.8125rem); }
  .welcome-kpi-accent { position: absolute; left: 0px; right: 0px; bottom: 0px; height: 4px; background: rgb(109, 159, 67); }
  .welcome-kpi-icon svg { width: 21px; height: 21px; }

  @media (min-width: 701px) {
    .topbar { height: 82px; padding: 0px 38px; }
    .topbar-inner { gap: 24px; }
    .brand { width: 184px; padding: 7px 9px; }
    .page-context { display: flex; }
    .top-actions { gap: 20px; }
    .student-label { display: revert-layer; }
    .shell-body { display: grid; min-height: calc(-82px + 100vh); }
    .main-nav { display: flex; }
    .mobile-nav { position: revert-layer; bottom: revert-layer; left: revert-layer; right: revert-layer; z-index: revert-layer; background: revert-layer; border-top: revert-layer; box-shadow: revert-layer; height: revert-layer; align-items: revert-layer; justify-content: revert-layer; padding: revert-layer; display: none; }
    .course-path { gap: 9px; font-size: var(--texte-discret); }
    .course-path button { font-size: var(--texte-discret); }
    .mobile-nav .nav-item { min-height: revert-layer; border-radius: revert-layer; display: revert-layer; flex-direction: revert-layer; align-items: revert-layer; justify-content: revert-layer; padding: revert-layer; color: revert-layer; font-weight: revert-layer; text-align: revert-layer; gap: revert-layer; width: revert-layer; font-size: revert-layer; }
    .mobile-nav .nav-item svg { width: revert-layer; height: revert-layer; }
    @media (hover: hover) and (pointer: fine) {
      .mobile-nav .nav-item:hover { background: revert-layer; color: revert-layer; }
    }
    .mobile-nav .nav-item.active { background: revert-layer; color: revert-layer; }
    .page { padding-bottom: revert-layer; }
    .site-footer { padding-bottom: revert-layer; }
    .toast { bottom: revert-layer; }
    .record-row { gap: 17px; padding: 19px 22px; }
    .record-mark { width: 48px; height: 48px; font-size: clamp(1.5rem, 1.375rem + 0.6vw, 1.75rem); }
    .record-row h3 { font-size: clamp(1.375rem, 1.25rem + 0.6vw, 1.625rem); }
    .record-score { font-size: clamp(1.625rem, 1.5rem + 0.6vw, 1.875rem); }
    .settings-grid { grid-template-columns: minmax(0px, 1.5fr) minmax(240px, 0.7fr); }
    .settings-panel { padding: 27px; }
    .settings-side { padding: 27px; }
    .exit-page { min-height: calc(-82px + 100vh); }
    .exit-card { padding: 42px; }
    .exit-card h1 { font-size: clamp(2.5rem, 2.375rem + 0.6vw, 2.75rem); }
    .dashboard-page > .section-heading:first-of-type { display: revert-layer; }
    .dashboard-page > .section-heading:first-of-type .text-link { margin-top: revert-layer; }
    .welcome-one { padding: 28px 30px; }
    .welcome-one-top { gap: 25px; }
    .welcome-one-copy h1 { font-size: clamp(38px, 3.3vw, 49px); }
    .welcome-one-focus { transform: rotate(-3deg); max-width: 290px; }
    .welcome-kpis { gap: 14px; margin-top: 14px; }
    .welcome-kpi { gap: 14px; min-height: 107px; padding: 16px 17px 21px; }
    .welcome-kpi-icon { width: 51px; height: 51px; }
    .welcome-kpi-copy span { font-size: var(--texte-discret); }
    .welcome-kpi-copy strong { font-size: clamp(1.875rem, 1.75rem + 0.6vw, 2.125rem); }
    .welcome-kpi-icon svg { width: revert-layer; height: revert-layer; }
  }

  @media (min-width: 901px) {
    .welcome-one-top { grid-template-columns: minmax(0px, 1.4fr) minmax(230px, 0.6fr); }
    .welcome-one-focus { justify-self: end; max-width: 250px; }
  }

  @media (min-width: 981px) {
    .shell-body { grid-template-columns: 104px minmax(0px, 1fr); }
    .main-nav { padding: 24px 8px; }
    .main-nav .nav-item { width: 86px; font-size: var(--texte-discret); }
  }

  @media (min-width: 1101px) {
    .welcome-kpis { grid-template-columns: repeat(4, minmax(0px, 1fr)); }
  }
}

/* Lecture et interaction sur mobile. */
@layer interface {
  :root {
    --hauteur-menu-mobile: 65px;
    --zone-securisee-basse: env(safe-area-inset-bottom, 0px);
  }
  .app-shell { min-height: 100svh; }
  .topbar-inner, .main-column, .page-heading > div, .section-heading > div { min-width: 0; }
  .shell-body { padding-bottom: calc(var(--hauteur-menu-mobile) + var(--zone-securisee-basse)); }
  .page { padding-bottom: 40px; }
  .site-footer { padding-bottom: 24px; flex-wrap: wrap; }
  .mobile-nav {
    height: calc(var(--hauteur-menu-mobile) + var(--zone-securisee-basse));
    min-height: calc(var(--hauteur-menu-mobile) + var(--zone-securisee-basse));
    padding: 3px 3px calc(3px + var(--zone-securisee-basse));
    flex-shrink: 0;
  }
  .mobile-nav .nav-item { flex: 1 0 0; width: auto; min-width: 0; min-height: 59px; transition: none; }
  .mobile-nav .nav-item svg { flex-shrink: 0; }
  .mobile-nav, .main-nav, .top-actions { touch-action: manipulation; }
  body:has(.td-barre-edition) .toast { margin-bottom: 20px; }
  .toast { bottom: calc(var(--hauteur-menu-mobile) + var(--zone-securisee-basse) + var(--hauteur-actions-edition, 0px) + 12px); width: max-content; max-width: calc(100% - 32px); }
  .signed-out .shell-body { padding-bottom: 0; }
  .page p { font-size: var(--texte-courant); line-height: 1.6; }
  .course-path, .course-path button, .profile-summary span, .setting-option small { font-size: var(--texte-secondaire); }
  h1, h2, h3, .profile-summary, .settings-panel p { overflow-wrap: anywhere; }
  .button, .text-link, .icon-button, .top-avatar, .profile-dropdown a, .course-path button, .filter-chip { min-height: 44px; }
  .top-avatar, .icon-button { min-width: 44px; }
  .top-avatar { width: 44px; height: 44px; }
  .profile-dropdown { width: min(320px, calc(100vw - 32px)); max-height: 70dvh; overflow-y: auto; }
  .profile-dropdown a { display: flex; align-items: center; }
  .course-path button { display: inline-flex; align-items: center; text-align: left; max-width: 100%; }
  .page input:not([type="checkbox"]):not([type="radio"]), .page select, .page textarea { font-size: var(--texte-courant); min-height: 44px; }
  .section-heading { flex-wrap: wrap; }
  .record-row > div { min-width: 0; flex: 1; }
  .record-row .record-score { flex-shrink: 0; }

  @media (min-width: 701px) {
    .shell-body { padding-bottom: 0; }
    .page { padding-bottom: 70px; }
    .toast { bottom: calc(var(--hauteur-actions-edition, 0px) + 25px); }
  }
}

@layer interface {
  .brand { position: relative; }
  .brand-trigger { display: flex; align-items: center; gap: 7px; width: 100%; min-height: 44px; padding: 0; border: 0; border-radius: 8px; color: var(--green); background: transparent; cursor: pointer; touch-action: manipulation; }
  .brand-trigger img { min-width: 0; width: calc(100% - 22px); }
  .brand-chevron { flex-shrink: 0; transition: transform .18s ease; }
  .brand-trigger[aria-expanded="true"] .brand-chevron { transform: rotate(180deg); }
  .brand-trigger:focus-visible { outline: 2px solid var(--green); outline-offset: 4px; }
  .variantes-accueil { position: absolute; top: calc(100% + 10px); left: 0; width: min(340px, calc(100vw - 34px)); max-height: calc(100dvh - 110px); overflow-y: auto; padding: 10px; border: 1px solid #e1e9db; border-radius: 16px; background: #fff; color: var(--ink); box-shadow: 0 18px 45px #25392225; touch-action: manipulation; }
  .variantes-accueil[hidden] { display: none; }
  .variantes-titre { margin: 0; padding: 10px 12px 14px; color: #6d8063; font-size: var(--texte-discret); }
  .variantes-accueil section { padding: 10px 0; border-top: 1px solid #edf1e8; }
  .variantes-accueil section:last-child { padding-bottom: 0; }
  .variantes-accueil h2 { margin: 0 12px 7px; font-family: inherit; font-size: var(--texte-discret); font-weight: 700; line-height: 1.5; color: #4e6b3d; }
  .variantes-accueil a { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 10px 12px; border-radius: 9px; font-size: var(--texte-secondaire); line-height: 1.4; }
  .variantes-accueil a { color: #35502b; }
  .variantes-accueil a[aria-current] { background: #eaf3df; font-weight: 600; }
  .variantes-accueil a[aria-current]::after { content: "✓"; color: var(--green); }
  .variantes-accueil a:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; }
  @media (hover: hover) and (pointer: fine) {
    .brand-trigger:hover { background: #f2f6ed; }
    .variantes-accueil a:hover { background: #f0f5e9; }
  }
  @media (prefers-reduced-motion: reduce) {
    .brand-chevron { transition: none; }
  }
}

@layer interface {
  .main-nav .nav-item > svg { transform-origin: center; transform-box: fill-box; }
}

/* Variante du bandeau avec accès aux messages. */
@layer interface {
  [data-acces-messages] { position: relative; }
  .messages-acces-entete { display: inline-flex; align-items: center; justify-content: center; color: var(--green); border-radius: 10px; flex-shrink: 0; }
  .messages-compteur { position: absolute; top: 2px; right: 3px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 10px; display: grid; place-items: center; background: var(--green); color: white; font: 700 11px/1 "IBM Plex Sans", sans-serif; }
  .messages-compteur[hidden] { display: none; }
  .topbar-avec-messages { padding-inline: 8px; }
  .topbar-avec-messages .topbar-inner { gap: 4px; }
  .topbar-avec-messages .top-actions { gap: 3px; }
  .topbar-avec-messages .brand { width: 140px; }
  .messages-acces-entete[aria-current] { background: #e6f1d7; }
  .main-nav { overflow-y: auto; }
  @media (min-width: 701px) {
    .topbar-avec-messages { padding-inline: 38px; }
    .topbar-avec-messages .topbar-inner { gap: 24px; }
    .topbar-avec-messages .top-actions { gap: 20px; }
    .topbar-avec-messages .brand { width: 184px; }
  }
}
