/* ==========================================================================
   ENSP/TA — Design system v4 (« FREECOM »)
   Fichier 2/4 : ossature (barre du haut fixe, menu latéral, menus, palette de commandes,
   notifications, dialogues, barre d'onglets mobile).
   ========================================================================== */

/* --- Ossature : barre du haut fixe + menu latéral fixe + contenu --- */
body.app { padding-top: var(--topbar-h); }
body.app.nav-collapsed { --sidebar-w: var(--sidebar-w-collapsed); }
.main { display: flex; flex-direction: column; min-width: 0; min-height: calc(100dvh - var(--topbar-h)); margin-left: var(--sidebar-w); transition: margin-left var(--t) var(--ease); }
.content { flex: 1; width: 100%; max-width: var(--content-max); margin-inline: auto; padding: 22px clamp(14px, 2vw, 30px) 52px; min-width: 0; }
.foot { padding: 18px clamp(14px, 2vw, 30px); border-top: 1px solid var(--line); color: var(--muted); font-size: var(--fs-xs); display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: space-between; }
.foot a { color: var(--muted); }

/* Entrée de page : légère montée, sans effet une fois terminée (pas de contexte d'empilement persistant) */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.content > *:not(.toasts) { animation: rise .38s var(--ease) backwards; }
.content > *:nth-child(2) { animation-delay: .04s; } .content > *:nth-child(3) { animation-delay: .08s; } .content > *:nth-child(4) { animation-delay: .12s; }
.content > *:nth-child(5) { animation-delay: .16s; } .content > *:nth-child(6) { animation-delay: .2s; } .content > *:nth-child(n+7) { animation-delay: .24s; }

/* --- Barre du haut (fixe) --- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 65; height: var(--topbar-h);
  display: flex; align-items: center; gap: 6px; padding: 0 12px 3px;
  background: var(--nav-bg); color: var(--nav-strong); border-bottom: 1px solid var(--nav-line);
  box-shadow: 0 2px 12px -6px rgba(0, 0, 0, .45);
}
.topbar::after { /* liseré aux couleurs du pays : orange · blanc · vert */
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; pointer-events: none;
  background: linear-gradient(90deg, #E8731A 0 33.33%, #FFFFFF 33.33% 66.66%, #1FA64A 66.66%); opacity: .92;
}
.tb-burger { flex: none; }
.tb-brand { display: flex; align-items: center; gap: 10px; min-width: 0; margin-left: 2px; padding-right: 8px; color: inherit; text-decoration: none; }
.tb-brand:hover { text-decoration: none; }
.tb-logo { flex: none; width: 36px; height: 36px; padding: 2px; border-radius: 10px; background: #FFFFFF; border: 1px solid var(--nav-logo-ring); display: grid; place-items: center; }
.tb-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.tb-title { min-width: 0; line-height: 1.1; }
.tb-title strong { display: block; font-family: var(--font-display); font-size: 1.02rem; font-weight: 700; letter-spacing: -.01em; color: var(--nav-strong); white-space: nowrap; }
.tb-title small { display: block; margin-top: 2px; font-size: .72rem; color: var(--nav-muted); white-space: nowrap; }
.tb-year {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 13px 0 11px; border-radius: var(--r-pill); white-space: nowrap;
  border: 1px solid var(--nav-line); background: var(--nav-ctx-bg); color: var(--nav-strong); font-size: .84rem; font-weight: 600;
}
.tb-year small { color: var(--nav-muted); font-weight: 500; font-size: .78rem; }
.tb-year .pulse { flex: none; width: 8px; height: 8px; border-radius: 50%; background: #3DDC97; box-shadow: 0 0 0 0 rgba(61, 220, 151, .55); animation: pulse 2.4s ease-out infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(61, 220, 151, 0); } 100% { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0); } }
.tb-search {
  display: flex; align-items: center; gap: 10px; height: 38px; width: min(380px, 100%); margin-left: auto; padding: 0 8px 0 13px; text-align: left;
  border: 1px solid var(--nav-line); border-radius: var(--r-md); background: var(--nav-ctx-bg); color: var(--nav-muted); font-size: .86rem; transition: border-color var(--t-fast), background var(--t-fast);
}
.tb-search:hover { border-color: var(--nav-muted); color: var(--nav-strong); }
.tb-search > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-search kbd { background: transparent; border-color: var(--nav-line); color: var(--nav-muted); }
.tb-actions { display: flex; align-items: center; gap: 4px; margin-left: 4px; }
.tb-cta {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 15px; margin-right: 4px; border-radius: var(--r-pill);
  background: var(--nav-cta-bg); color: var(--nav-cta-fg); font-size: .88rem; font-weight: 700; white-space: nowrap; text-decoration: none;
  box-shadow: 0 4px 14px -6px rgba(0, 0, 0, .45); transition: filter var(--t-fast), transform var(--t-fast);
}
.tb-cta:hover { filter: brightness(1.06); color: var(--nav-cta-fg); text-decoration: none; }
.tb-cta:active { transform: translateY(1px); }
.tb-cta .i { width: 17px; height: 17px; }
.tb-clock { display: inline-flex; align-items: center; gap: 6px; padding: 0 8px; color: var(--nav-text); font-size: .85rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tb-clock .i { width: 16px; height: 16px; opacity: .8; }
.tb-clock b { color: inherit; font-weight: 600; }

.icon-btn { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-md); border: 1px solid transparent; background: transparent; color: var(--muted); transition: background var(--t-fast), color var(--t-fast); }
.icon-btn:hover, .icon-btn[aria-expanded="true"] { background: var(--bg-sunk); color: var(--ink); }
.topbar .icon-btn { color: var(--nav-text); }
.topbar .icon-btn:hover, .topbar .icon-btn[aria-expanded="true"] { background: var(--nav-hover); color: var(--nav-strong); }
.icon-btn .count { position: absolute; top: -1px; right: -3px; min-width: 18px; height: 18px; padding: 0 4px; display: grid; place-items: center; border-radius: var(--r-pill); background: var(--nav-badge-bg); color: var(--nav-badge-fg); font-size: .64rem; font-weight: 700; line-height: 1; border: 2px solid var(--nav-bg); box-sizing: border-box; }
.icon-btn .count.is-warn { background: var(--accent); color: #2A1B00; }
.icon-btn.ring-pulse .count { animation: pop-in .4s var(--ease); }
@keyframes pop-in { from { transform: scale(.4); opacity: 0; } }

.user-btn { display: flex; align-items: center; gap: 9px; height: 44px; padding: 0 8px 0 4px; border-radius: var(--r-md); border: 1px solid transparent; background: transparent; color: inherit; text-align: left; transition: background var(--t-fast); }
.user-btn:hover, .user-btn[aria-expanded="true"] { background: var(--nav-hover); }
.user-btn .who { line-height: 1.15; min-width: 0; }
.user-btn .who b { display: block; font-size: .85rem; font-weight: 700; color: var(--nav-strong); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-btn .who small { display: block; margin-top: 1px; font-size: .72rem; color: var(--nav-muted); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-btn > .i { color: var(--nav-muted); width: 16px; height: 16px; }

/* Thème : liste de pastilles (comme FREECOM) */
.theme-pop { min-width: 220px; }
.pop-title { padding: 8px 12px 4px; color: var(--subtle); font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.theme-opt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 12px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text); font-size: var(--fs-sm); font-weight: 500; text-align: left; }
.theme-opt:hover { background: var(--bg-sunk); }
.theme-opt[aria-pressed="true"] { background: var(--primary-soft); color: var(--ink); font-weight: 700; }
.swatch { flex: none; width: 24px; height: 24px; border-radius: 7px; border: 1px solid rgba(0, 0, 0, .18); }
.sw-ensp { background: linear-gradient(135deg, #0B1730 50%, #8CC63F 50%); }
.sw-light { background: linear-gradient(135deg, #FFFFFF 50%, #2342A6 50%); }
.sw-dark { background: linear-gradient(135deg, #2F363D 50%, #58B4EA 50%); }
.sw-blue { background: linear-gradient(135deg, #1D4F91 50%, #D6E8FF 50%); }
.sw-green { background: linear-gradient(135deg, #2A7449 50%, #DDF5E7 50%); }

/* --- Menu latéral (fixe sous la barre du haut ; réduit en rail de pictogrammes) --- */
.sidebar {
  position: fixed; top: var(--topbar-h); bottom: 0; left: 0; z-index: 60; width: var(--sidebar-w); display: flex; flex-direction: column; overflow: hidden;
  background: var(--side-bg); color: var(--nav-text); border-right: 1px solid var(--nav-line);
  transition: width var(--t) var(--ease), transform var(--t) var(--ease);
}
.sb-nav { position: relative; flex: 1; overflow-y: auto; overflow-x: hidden; padding: 6px 10px 16px; scrollbar-color: var(--nav-line) transparent; }
.nav-group + .nav-group { margin-top: 2px; }
.nav-label {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 10px 5px; background: none; border: 0; text-align: left;
  color: var(--nav-muted); font-size: .66rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap;
}
.nav-label:hover { color: var(--nav-text); }
.nav-label .i { width: 14px; height: 14px; transition: transform var(--t) var(--ease); }
.nav-group[data-collapsed] .nav-label .i { transform: rotate(-90deg); }
.nav-items { display: grid; grid-template-rows: 1fr; transition: grid-template-rows var(--t) var(--ease); }
.nav-group[data-collapsed] .nav-items { grid-template-rows: 0fr; }
.nav-items-inner { overflow: hidden; min-height: 0; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 10px; margin: 0; border-radius: 9px;
  color: var(--nav-text); font-size: .9rem; font-weight: 500; white-space: nowrap; text-decoration: none; transition: background var(--t-fast), color var(--t-fast);
}
.nav-item .i { width: 20px; height: 20px; flex: none; opacity: .85; }
.nav-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item:hover { background: var(--nav-hover); color: var(--nav-strong); text-decoration: none; }
.nav-item:hover .i { opacity: 1; }
.nav-item.is-active { background: var(--nav-sel-bg); color: var(--nav-sel-fg); font-weight: 700; box-shadow: 0 6px 16px -10px rgba(0, 0, 0, .5); }
.nav-item.is-active .i { opacity: 1; color: inherit; }
.nav-badge { flex: none; min-width: 22px; height: 20px; padding: 0 7px; display: inline-grid; place-items: center; border-radius: var(--r-pill); background: var(--nav-badge-bg); color: var(--nav-badge-fg); font-size: .68rem; font-weight: 700; font-style: normal; line-height: 1; }
.nav-badge[hidden] { display: none; }
.nav-item.is-active .nav-badge { background: var(--nav-sel-fg); color: var(--nav-sel-bg); }
.sb-foot { padding: 10px 16px; border-top: 1px solid var(--nav-line); color: var(--nav-muted); font-size: .72rem; white-space: nowrap; }

/* Rail replié (bureau) */
body.nav-collapsed .nav-item span, body.nav-collapsed .nav-badge, body.nav-collapsed .nav-label span, body.nav-collapsed .sb-foot span { display: none; }
body.nav-collapsed .nav-item { justify-content: center; padding: 0; }
body.nav-collapsed .nav-label { justify-content: center; padding: 8px 0 2px; pointer-events: none; }
body.nav-collapsed .nav-label::after { content: ""; display: block; width: 20px; height: 1px; background: var(--nav-line); }
body.nav-collapsed .nav-label .i { display: none; }
body.nav-collapsed .nav-group[data-collapsed] .nav-items { grid-template-rows: 1fr; }
body.nav-collapsed .sb-foot { text-align: center; padding-inline: 0; }
.rail-tip { position: fixed; z-index: 90; pointer-events: none; background: var(--ink); color: var(--bg); font-size: var(--fs-sm); font-weight: 500; padding: 6px 10px; border-radius: 8px; box-shadow: var(--sh-2); opacity: 0; transform: translateX(-4px); transition: opacity var(--t-fast), transform var(--t-fast); white-space: nowrap; }
.rail-tip.show { opacity: 1; transform: none; }

.scrim { position: fixed; inset: var(--topbar-h) 0 0 0; background: rgba(8, 15, 38, .55); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity var(--t) var(--ease); z-index: 55; }

/* Focus clavier lisible sur les barres colorées (le bleu du thème se perdrait sur le marine) */
.topbar :focus-visible, .sidebar :focus-visible { outline-color: var(--nav-strong); }
.topbar .tb-cta:focus-visible { outline-color: var(--nav-strong); outline-offset: 3px; }
/* --- Menus déroulants / popovers --- */
.dropdown { position: relative; }
.popover { position: absolute; right: 0; top: calc(100% + 10px); z-index: 70; min-width: 250px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--sh-3); padding: 6px; transform-origin: top right; animation: pop .16s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.97); } }
.popover-head { display: flex; align-items: center; gap: 12px; padding: 12px 12px 10px; }
.popover-head b { display: block; color: var(--ink); font-size: var(--fs-base); line-height: 1.25; }
.popover-head small { color: var(--muted); font-size: var(--fs-xs); }
.popover hr { margin: 6px -6px; }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--text); font-size: var(--fs-sm); font-weight: 500; text-align: left; text-decoration: none; }
.menu-item .i { color: var(--muted); }
.menu-item:hover, .menu-item:focus-visible { background: var(--bg-sunk); color: var(--ink); text-decoration: none; }
.menu-item.is-danger, .menu-item.is-danger .i { color: var(--danger); }
.menu-item small { margin-left: auto; color: var(--subtle); font-size: var(--fs-xs); }

.attn-pop { width: min(400px, calc(100vw - 24px)); padding: 0; overflow: hidden; }
.attn-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 12px; border-bottom: 1px solid var(--line); }
.attn-pop-head h3 { margin: 0; font-size: var(--fs-md); }
.attn-pop-body { max-height: min(60vh, 420px); overflow-y: auto; padding: 6px; }
.attn-pop-foot { padding: 10px 16px; border-top: 1px solid var(--line); background: var(--surface-2); display: flex; justify-content: space-between; align-items: center; font-size: var(--fs-sm); }

/* --- Palette de commandes (Ctrl/Cmd + K) --- */
.cmdk { position: fixed; inset: 0; z-index: 150; display: grid; justify-items: center; align-items: start; padding: 11vh 12px 12px; }
.cmdk-backdrop { position: absolute; inset: 0; background: rgba(8, 15, 38, .52); backdrop-filter: blur(3px); animation: fade .18s var(--ease); }
@keyframes fade { from { opacity: 0; } }
.cmdk-panel { position: relative; width: min(680px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--sh-3); overflow: hidden; animation: pop-c .2s var(--ease); display: flex; flex-direction: column; max-height: 78vh; }
@keyframes pop-c { from { opacity: 0; transform: translateY(-10px) scale(.985); } }
.cmdk-input { display: flex; align-items: center; gap: 12px; padding: 0 18px; height: 60px; border-bottom: 1px solid var(--line); color: var(--muted); }
.cmdk-input .i { width: 20px; height: 20px; }
.cmdk-input input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font-size: 1.0625rem; color: var(--ink); box-shadow: none; padding: 0; }
.cmdk-input input::placeholder { color: var(--subtle); }
.cmdk-input input::-webkit-search-cancel-button { display: none; }
.cmdk-body { flex: 1; overflow-y: auto; padding: 8px; min-height: 120px; overscroll-behavior: contain; }
.cmdk-group { padding: 10px 12px 6px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--subtle); }
.cmdk-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 12px; color: var(--text); text-decoration: none; position: relative; }
.cmdk-item:hover { text-decoration: none; }
.cmdk-item[aria-selected="true"] { background: var(--primary-soft); color: var(--ink); }
.cmdk-item[aria-selected="true"]::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary); }
.cmdk-ico { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--bg-sunk); color: var(--muted); }
.cmdk-item[aria-selected="true"] .cmdk-ico { background: var(--surface); color: var(--primary); }
.cmdk-ico.is-student { background: var(--primary-soft); color: var(--primary); }
.cmdk-ico.is-money { background: var(--success-soft); color: var(--success); }
.cmdk-ico.is-warn { background: var(--accent-soft); color: var(--accent-ink); }
.cmdk-txt { flex: 1; min-width: 0; line-height: 1.3; }
.cmdk-txt b { display: block; font-weight: 600; color: var(--ink); font-size: var(--fs-base); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-txt small { display: block; color: var(--muted); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-txt mark { background: var(--accent-soft-2); color: inherit; border-radius: 3px; padding: 0 1px; }
.cmdk-meta { flex: none; }
.cmdk-empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.cmdk-empty .i { width: 28px; height: 28px; margin-bottom: 8px; color: var(--subtle); }
.cmdk-empty b { display: block; color: var(--ink); margin-bottom: 4px; }
.cmdk-foot { display: flex; align-items: center; gap: 18px; padding: 10px 18px; border-top: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-size: var(--fs-xs); }
.cmdk-foot span { display: inline-flex; align-items: center; gap: 6px; }
.cmdk-foot .sp { margin-left: auto; }
.cmdk-loading { height: 2px; background: linear-gradient(90deg, transparent, var(--primary), transparent); background-size: 40% 100%; background-repeat: no-repeat; animation: slide 1s linear infinite; opacity: 0; }
.cmdk.is-loading .cmdk-loading { opacity: 1; }
@keyframes slide { from { background-position: -40% 0; } to { background-position: 140% 0; } }
kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; background: var(--surface); color: var(--muted); font-family: var(--font-ui); font-size: 11.5px; font-weight: 500; line-height: 1; }

/* --- Notifications (toasts) --- */
.toasts { position: fixed; z-index: 140; right: 20px; top: calc(var(--topbar-h) + 14px); display: flex; flex-direction: column; gap: 10px; width: min(400px, calc(100vw - 24px)); pointer-events: none; }
.toast { position: relative; pointer-events: auto; overflow: hidden; display: flex; align-items: flex-start; gap: 12px; padding: 14px 14px 14px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--sh-3); animation: toast-in .35s var(--ease); }
.toast.is-leaving { animation: toast-out .22s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px); } }
.toast-ico { flex: none; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.toast-success .toast-ico { background: var(--success-soft); color: var(--success); }
.toast-error .toast-ico { background: var(--danger-soft); color: var(--danger); }
.toast-warning .toast-ico { background: var(--accent-soft); color: var(--accent-ink); }
.toast-body { flex: 1; min-width: 0; padding-top: 1px; }
.toast-body b { display: block; color: var(--ink); font-size: var(--fs-sm); font-weight: 600; line-height: 1.3; }
.toast-body p { margin: 2px 0 0; color: var(--muted); font-size: var(--fs-sm); line-height: 1.45; }
.toast-x { flex: none; width: 28px; height: 28px; margin: -4px -4px 0 0; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--subtle); }
.toast-x:hover { background: var(--bg-sunk); color: var(--ink); }
.toast-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--primary); transform-origin: left; animation: toast-bar linear forwards; }
.toast-success .toast-bar { background: var(--success); } .toast-error .toast-bar { background: var(--danger); } .toast-warning .toast-bar { background: var(--accent); }
@keyframes toast-bar { to { transform: scaleX(0); } }
.toast:hover .toast-bar { animation-play-state: paused; }

/* --- Dialogue de confirmation --- */
dialog.dlg { border: 0; padding: 0; width: min(440px, calc(100vw - 32px)); border-radius: 22px; background: var(--surface); color: var(--text); box-shadow: var(--sh-3); overflow: hidden; }
dialog.dlg[open] { animation: pop-c .22s var(--ease); }
dialog.dlg::backdrop { background: rgba(8, 15, 38, .55); backdrop-filter: blur(3px); animation: fade .2s var(--ease); }
.dlg-body { padding: 26px 26px 20px; display: grid; gap: 4px; justify-items: start; }
.dlg-ico { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 10px; background: var(--primary-soft); color: var(--primary); }
.dlg-ico.is-danger { background: var(--danger-soft); color: var(--danger); }
.dlg-body h2 { margin: 0; font-size: var(--fs-xl); }
.dlg-body p { margin: 4px 0 0; color: var(--muted); line-height: 1.55; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px 20px; }

/* --- Barre de progression de navigation --- */
.navprog { position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 300; background: linear-gradient(90deg, var(--primary), var(--lime)); box-shadow: 0 0 10px rgba(140, 198, 63, .6); opacity: 0; transition: width .35s var(--ease), opacity .3s; pointer-events: none; }
.navprog.on { opacity: 1; }

/* --- Barre d'onglets mobile (tous profils : accès rapide + bouton Menu) --- */
.tabbar { display: none; }
.theme-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px 10px; }
.theme-row > span { color: var(--muted); font-size: var(--fs-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.theme-row > div { display: flex; gap: 8px; }
.theme-dot { width: 30px; height: 30px; padding: 0; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line-strong); }
.theme-dot[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--primary); }
.theme-dot.swatch { border-radius: 50%; }

@media (max-width: 1180px) {
  .tb-clock, .tb-year small, .user-btn .who, .user-btn > .i { display: none; }
  .user-btn { padding: 0 4px; }
}

@media (max-width: 1023px) {
  .main { margin-left: 0; }
  .sidebar { width: min(86vw, 300px); transform: translateX(-104%); box-shadow: var(--sh-3); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }
  body.nav-collapsed .nav-item span, body.nav-collapsed .nav-badge, body.nav-collapsed .nav-label span, body.nav-collapsed .sb-foot span { display: revert; }
  body.nav-collapsed .nav-item { justify-content: flex-start; padding: 0 10px; }
  body.nav-collapsed .nav-label { justify-content: space-between; padding: 14px 10px 5px; pointer-events: auto; }
  body.nav-collapsed .nav-label::after { display: none; }
  body.nav-collapsed .nav-label .i { display: inline-block; }
  .tb-search kbd { display: none; }
  .content { padding: 16px 14px 40px; }
  .toasts { right: 12px; left: 12px; width: auto; top: calc(var(--topbar-h) + 10px); }
  body.has-tabbar .content { padding-bottom: calc(92px + var(--safe-bottom)); }
  body.has-tabbar .foot { padding-bottom: calc(84px + var(--safe-bottom)); }
  body.has-tabbar .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; height: calc(64px + var(--safe-bottom)); padding: 6px 6px var(--safe-bottom);
    background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px -12px rgba(14, 26, 51, .22);
  }
  .tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 52px; padding: 0; border: 0; border-radius: 12px; background: none; color: var(--muted); font-size: 11.5px; font-weight: 600; line-height: 1.1; text-decoration: none; }
  .tab .i { width: 22px; height: 22px; }
  .tab:hover { text-decoration: none; color: var(--ink); }
  .tab.is-active { color: var(--primary); }
  .tab.is-active::before { content: ""; position: absolute; top: -7px; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--primary); }
  .tab.is-cta { color: var(--ink); }
  .tab.is-cta .tab-ico { display: grid; place-items: center; width: 50px; height: 50px; margin-top: -26px; border-radius: 16px; background: var(--lime); color: var(--on-lime); box-shadow: 0 0 0 5px var(--surface), 0 10px 20px -8px rgba(0, 0, 0, .5); }
  .tab.is-cta .i { width: 24px; height: 24px; }
  .tab.is-cta.is-active::before { display: none; }
  .tab.is-cta span:not(.tab-ico) { margin-top: 2px; }
}

@media (max-width: 880px) {
  .tb-year { display: none; }
  .tb-cta span { display: none; }
  .tb-cta { width: 38px; padding: 0; justify-content: center; }
  .tb-theme { display: none; }
}

@media (max-width: 720px) {
  .tb-title small { display: none; }
  .tb-title strong { max-width: 38vw; overflow: hidden; text-overflow: ellipsis; }
  .tb-search { width: 40px; padding: 0; justify-content: center; border-color: transparent; background: transparent; }
  .tb-search > span, .tb-search kbd { display: none; }
  .tb-search:hover { background: var(--nav-hover); }
}

@media (max-width: 440px) {
  .tb-title { display: none; }
}

/* --- En-tête de page --- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin: 0 0 20px; }
.page-head .crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-bottom: 6px; font-size: var(--fs-sm); color: var(--muted); }
.page-head .crumbs a { color: var(--muted); }
.page-head .crumbs a:hover { color: var(--ink); text-decoration: none; }
.page-head .crumbs .i { width: 14px; height: 14px; opacity: .55; }
.page-head h1 { margin: 0; }
.page-head .sub { margin: 6px 0 0; color: var(--muted); max-width: 70ch; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

@media print {
  .sidebar, .topbar, .tabbar, .toasts, .scrim, .navprog, .foot, .no-print, .page-head .actions, .cmdk { display: none !important; }
  body.app { padding-top: 0; background: #fff; }
  .main { margin-left: 0; }
  .content { padding: 0; max-width: none; animation: none; }
  .content > * { animation: none !important; }
}
