:root { --shared-phone-nav-h:calc(58px + env(safe-area-inset-bottom, 0px)); }

/* owner: A — public/css/learner.css:290–405 @ 31c3d521, verbatim. */
.app-sidebar {
  grid-area: sidebar;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 0 0 16px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-soft);
  z-index: 20;
  overflow: visible;
}

.sidebar-brand {
  width: 100%;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
}

.sidebar-brand-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: brightness(1.1);
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 0;
  width: 100%;
}

.sidebar-item {
  position: relative;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  color: var(--text-dim);
  text-decoration: none;
  border: 1px solid transparent;
  transition: color .16s, background .16s, border-color .16s;
  cursor: pointer;
}

.sidebar-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-item:hover {
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
}

.sidebar-item.active {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-color: color-mix(in srgb, var(--accent) 22%, transparent);
}

.sidebar-item--disabled {
  opacity: 0.32;
  cursor: default;
  pointer-events: none;
}

.sidebar-tooltip {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  background: var(--bg-panel-strong);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-sm);
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-main);
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 100;
  box-shadow: var(--sh-card);
}

.sidebar-item:hover .sidebar-tooltip { opacity: 1; }

.sidebar-divider {
  width: 28px;
  height: 1px;
  background: var(--border-soft);
  margin: 6px 0;
  flex-shrink: 0;
}

.sidebar-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 0;
}

/* Shared additions. Keep the grid-owned learner/mission rail in its existing shell. */
@scope (.learner-frame, .learner-mission-page, .manager-frame) {
  .shared-nav.app-sidebar { width:var(--sidebar-w); min-height:0; box-sizing:border-box; background:var(--bg-sidebar); }
  .shared-nav .sidebar-groups { flex:1; width:100%; padding-top:8px; display:flex; flex-direction:column; align-items:center; }
  .shared-nav .sidebar-group { position:relative; width:100%; padding-top:28px; }
  .shared-nav .sidebar-nav { flex:none; }
  .shared-nav .sidebar-group-name {
    position:absolute; width:1px; height:1px; padding:0; margin:-1px;
    overflow:hidden; clip-path:inset(50%); white-space:nowrap; border:0;
  }
  .shared-nav .sidebar-group-label {
    position:absolute; top:0; left:0; width:100%; min-height:26px; box-sizing:border-box;
    padding:6px 0; color:var(--text-muted); text-align:center; white-space:nowrap;
    font:700 8px/1.3 Inter,system-ui,sans-serif; letter-spacing:.04em; text-transform:uppercase;
  }
  .shared-nav .sidebar-divider { width:calc(var(--sidebar-w) - 12px); background:var(--border-mid); }
  .shared-nav .sidebar-item { box-sizing:border-box; background:var(--bg-sidebar); }
  .shared-nav .sidebar-item:hover { background:var(--bg-nav-hover); }
  .shared-nav .sidebar-item.active { background:var(--bg-nav-hover); border-color:var(--border-mid); color:var(--accent); }
  .shared-nav .sidebar-tooltip { background:var(--bg-sidebar); box-shadow:none; }
  .shared-nav .sidebar-item:focus-visible .sidebar-tooltip { opacity:1; }
  /* A local route retains hover/focus on its launcher; the current page needs no tooltip. */
  .shared-nav .sidebar-item[aria-current="page"] .sidebar-tooltip { opacity:0; }
  .shared-nav .sidebar-item:focus-visible { outline:2px solid var(--accent); outline-offset:1px; }
  .shared-nav .sidebar-bottom { flex-shrink:0; }
  .shared-phone.mobile-bottomnav {
    display:none; position:fixed; inset:auto 0 0; z-index:50; box-sizing:border-box;
    height:var(--shared-phone-nav-h); min-height:var(--shared-phone-nav-h); padding:0 4px env(safe-area-inset-bottom, 0px);
    background:var(--bg-mobile-nav); border-top:1px solid var(--border-soft); gap:0; align-items:stretch;
  }
  .shared-phone.mobile-bottomnav::before { display:none; }
  .shared-phone .phone-learner-group { display:flex; flex:3 1 0; min-width:0; }
  .shared-phone .phone-manager-group, .shared-phone .phone-mia-group { display:flex; flex:1 1 0; min-width:0; }
  .shared-phone .phone-manager-group { position:relative; }
  .shared-phone .phone-manager-group::before {
    content:''; position:absolute; left:0; top:12px; bottom:12px; width:1px; background:var(--border-mid); z-index:3; pointer-events:none;
  }
  .shared-phone.mobile-bottomnav .mobile-bottomnav-item {
    display:flex; position:relative; box-sizing:border-box; flex:1 1 0; min-width:44px; min-height:54px; height:auto;
    flex-direction:column; align-items:center; justify-content:center; gap:3px; padding:3px 1px;
    border:0; border-radius:var(--r-sm); text-decoration:none; background:var(--bg-mobile-nav); color:var(--text-muted);
    font:600 9px/1.15 Inter,system-ui,sans-serif; text-align:center; letter-spacing:0; text-transform:none; cursor:pointer;
  }
  .shared-phone.mobile-bottomnav .mobile-bottomnav-item.active { background:var(--bg-nav-hover); color:var(--accent); }
  .shared-phone.mobile-bottomnav .mobile-bottomnav-item:focus-visible { outline:2px solid var(--accent); outline-offset:-2px; }
  .shared-phone.mobile-bottomnav .mobile-bottomnav-item svg { width:18px; height:18px; flex-shrink:0; }
  .shared-phone.mobile-bottomnav .mobile-bottomnav-label { display:block; white-space:normal; color:inherit; line-height:1.15; }
  .shared-phone.mobile-bottomnav .mobile-bottomnav-item--mia::before { display:none; }
  .shared-phone.mobile-bottomnav .mobile-bottomnav-mia-img {
    position:absolute; width:28px; height:28px; left:50%; top:3px; transform:translateX(-50%);
    object-fit:cover; object-position:center 12%; border-radius:50%; background:var(--bg-mobile-nav); opacity:0;
  }
  .shared-phone.mobile-bottomnav .mobile-bottomnav-mia-img--idle { opacity:1; }
  .shared-phone.mobile-bottomnav [data-mia-state="active"] .mobile-bottomnav-mia-img--idle { opacity:0; }
  .shared-phone.mobile-bottomnav [data-mia-state="active"] .mobile-bottomnav-mia-img--active { opacity:1; }
  .shared-phone.mobile-bottomnav .mobile-bottomnav-mia .mobile-bottomnav-label { margin-top:30px; }
  .shared-phone.mobile-bottomnav .shared-mia-disabled { opacity:.4; cursor:default; }
  @media (max-width:900px) {
    .shared-nav.app-sidebar { display:none; }
    .shared-phone.mobile-bottomnav { display:flex; }
  }
}

/* owner: A — DA-m117 avatar balloon. */
.visit-balloon {
  position:fixed; z-index:60; pointer-events:none; box-sizing:border-box;
  width:max-content; max-width:min(240px, calc(100vw - 16px));
  padding:10px 14px; border:1px solid var(--border-mid); border-radius:12px;
  background:var(--bg-card); color:var(--text-main);
  box-shadow:0 6px 24px var(--shadow-dialog-color);
  font:500 13px/1.4 var(--font-body); white-space:nowrap;
  opacity:0; visibility:hidden; transform:translateY(-4px);
  transition:opacity 160ms, transform 160ms, visibility 160ms;
}
.visit-balloon.is-visible { opacity:1; visibility:visible; transform:translateY(0); }
.visit-balloon::before {
  content:""; position:absolute; left:var(--visit-balloon-arrow-x); top:-7px;
  width:12px; height:12px; background:var(--bg-card);
  border-top:1px solid var(--border-mid); border-left:1px solid var(--border-mid);
  transform:translateX(-50%) rotate(45deg);
}
.visit-balloon.is-above::before { top:auto; bottom:-7px; transform:translateX(-50%) rotate(225deg); }
@media (prefers-reduced-motion: reduce) { .visit-balloon { transition:none; } }

/* Keep the manager title flexible and the two account controls together at right. */
.manager-frame .manager-topbar { justify-content:flex-start; gap:8px; }
.manager-frame .manager-topbar > div { margin-right:auto; }

/* Native dialog semantics/focus, with the shell's existing surface/primary tokens. */
.sound-gate {
  position:fixed; box-sizing:border-box; max-width:min(440px, calc(100vw - 32px)); padding:28px;
  border:1px solid var(--border-mid); border-radius:var(--r-md); background:linear-gradient(var(--bg-card), var(--bg-card)), var(--bg-main); color:var(--text-main);
  box-shadow:var(--sh-card);
}
/* Same shared-close geometry; scoped to the gate on every learner surface. */
.sound-gate > button[aria-label="Fermer"] { position:absolute; top:10px; right:10px; display:grid; place-items:center; width:44px; height:44px; padding:0; border:0; border-radius:var(--r-sm); background:var(--bg-card); color:var(--text-main); font-size:26px; line-height:1; }
.sound-gate h2 { padding-right:40px; font:600 20px/1.4 var(--font-body); }
.sound-gate .primary { min-height:44px; padding:10px 18px; border:0; border-radius:var(--r-sm); background:var(--accent); color:var(--on-accent); cursor:pointer; }
.sound-gate button:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.sound-gate::backdrop { background:var(--shadow-dialog-color); }
