/* Omniversity Admin — the shell around every Studio and analytics-admin page: sidebar spine, main
   area, page header, popover menu. Ported from the Omniversity Admin design system
   (components/bundle.css) and loaded by src/components/lms/admin-shell.tsx after /lms.css.

   Colours and type come from /lms.css (its token names are the design system's), so nothing here
   redefines a colour or a font. The tokens the LMS does not have yet — spacing, radii, the overlay
   shadow and the scrim — are defined on .oa-shell, and every rule is under an .oa-* class, so the
   rest of the LMS cannot be touched by this sheet even though React keeps it in the document after
   a client-side navigation away. The toaster (.oa-toaster) is the one piece mounted outside the
   shell — ToastProvider sits above it in LmsChrome — so the rules a toast needs name it as well. Light theme is html[data-lms-theme="light"]; the rail is
   html[data-admin-sidebar="rail"] (set before paint by ADMIN_SIDEBAR_BOOTSTRAP). */

.oa-shell,.oa-toaster{
  --space-4:4px;--space-8:8px;--space-10:10px;--space-14:14px;--space-16:16px;--space-18:18px;--space-22:22px;--space-34:34px;
  --radius-6:6px;--radius-8:8px;--radius-12:12px;--radius-pill:999px;
  --shadow-overlay:0 16px 36px -8px rgba(0,0,0,.6);
  --scrim:rgba(0,0,0,.6);
  --oa-sidebar-w:248px;
  --oa-rail-w:64px;
  --oa-topbar-h:52px;
}
html[data-lms-theme="light"] .oa-shell,html[data-lms-theme="light"] .oa-toaster{--shadow-overlay:0 18px 40px -18px rgba(20,20,20,.2)}

.oa-shell,.oa-shell *,.oa-toaster,.oa-toaster *{box-sizing:border-box}
.oa-shell :focus-visible,.oa-toaster :focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.oa-shell .oa-ico,.oa-toaster .oa-ico{width:16px;height:16px;flex:none}
.oa-shell .oa-ico.sm,.oa-toaster .oa-ico.sm{width:14px;height:14px}
.oa-shell kbd{font-family:var(--mono);font-size:10px;letter-spacing:.04em;color:var(--muted);background:var(--code-bg);border:1px solid var(--line-2);border-radius:var(--radius-6);padding:1px 5px}
.oa-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}

/* ── Shell: sidebar spine + main column ──────────────────────── */
.oa-shell{
  display:grid;
  grid-template-columns:var(--oa-sidebar-w) minmax(0,1fr);
  min-height:100vh;min-height:100dvh;
  background:var(--bg);color:var(--text);
}
.oa-col{min-width:0;display:flex;flex-direction:column;min-height:100vh;min-height:100dvh}
.oa-main{flex:1;min-width:0;padding:var(--space-22) var(--space-22) var(--space-34)}
.oa-main-inner{max-width:1280px;margin:0 auto;min-width:0}
.oa-main:focus{outline:none}

.oa-skip{position:absolute;left:var(--space-8);top:-48px;z-index:60;padding:8px 12px;background:var(--panel-solid);color:var(--heading);border:1px solid var(--line);border-radius:var(--radius-8);font-family:var(--mono);font-size:12px;letter-spacing:.06em;text-transform:uppercase}
.oa-skip:focus{top:var(--space-8)}

/* Global `footer{}` in /styles.css (the marketing footer) would otherwise give this one a dark band,
   40px of margin, 64px of padding and two decorative glows (one 650px wide, which overflows a phone
   screen), so every one of those is set or switched off here. */
footer.oa-foot::before,footer.oa-foot::after{content:none}
footer.oa-foot{
  position:static;z-index:auto;overflow:visible;margin:0;
  border-top:1px solid var(--line-2);background:transparent;
  padding:var(--space-14) var(--space-22);
  font-family:var(--mono);font-size:11px;color:var(--muted-2);text-align:center;
}
footer.oa-foot a{color:var(--muted);text-decoration:underline;text-underline-offset:2px}
footer.oa-foot a:hover{color:var(--text)}

/* ── Sidebar ─────────────────────────────────────────────────── */
.oa-sidebar{position:sticky;top:0;height:100vh;height:100dvh;display:flex;flex-direction:column;background:var(--bg-2);border-right:1px solid var(--line-2);min-width:0;z-index:20}
.oa-sb-top{display:flex;align-items:center;justify-content:space-between;gap:var(--space-8);padding:var(--space-14) var(--space-14) var(--space-10)}
.oa-sb-brand{display:flex;align-items:center;gap:var(--space-8);min-width:0;color:inherit;text-decoration:none;border-radius:var(--radius-6)}
.oa-sb-brand img{height:22px;width:auto;display:block}
.oa-sb-brand .logo-light{display:none}
html[data-lms-theme="light"] .oa-sb-brand .logo-dark{display:none}
html[data-lms-theme="light"] .oa-sb-brand .logo-light{display:block}
.oa-sb-brand small{font-family:var(--mono);font-size:10px;letter-spacing:.14em;text-transform:uppercase;color:var(--muted);border-left:1px solid var(--line);padding-left:var(--space-8)}

.oa-sb-search{margin:0 var(--space-14) var(--space-10);display:flex;align-items:center;gap:var(--space-8);width:calc(100% - 28px);height:34px;padding:0 var(--space-10);background:var(--glass-fill);border:1px solid var(--line-2);border-radius:var(--radius-8);color:var(--muted);font-family:var(--mono);font-size:12px;text-align:left;cursor:pointer}
.oa-sb-search:hover{border-color:var(--line);color:var(--text)}
.oa-sb-search[aria-disabled="true"]{opacity:.45;cursor:not-allowed}
.oa-sb-search[aria-disabled="true"]:hover{border-color:var(--line-2);color:var(--muted)}
.oa-sb-search .oa-sb-search-label{flex:1}

.oa-sb-nav{flex:1;overflow-y:auto;padding:var(--space-4) var(--space-8) var(--space-14);scrollbar-width:thin}
.oa-sb-group + .oa-sb-group{margin-top:var(--space-10)}
.oa-sb-group-label{display:flex;align-items:center;justify-content:space-between;width:100%;padding:6px var(--space-8);background:none;border:0;cursor:pointer;font-family:var(--mono);font-size:10px;letter-spacing:.14em;text-transform:uppercase;color:var(--muted);border-radius:var(--radius-6)}
.oa-sb-group-label:hover{color:var(--text)}
.oa-sb-group-label .oa-ico{transition:transform .15s ease-out}
.oa-sb-group-label[aria-expanded="false"] .oa-ico{transform:rotate(-90deg)}
.oa-sb-items{list-style:none;margin:2px 0 0;padding:0;display:flex;flex-direction:column;gap:1px}
.oa-sb-items[hidden]{display:none}

.oa-sb-item{position:relative;display:flex;align-items:center;gap:var(--space-10);width:100%;padding:8px var(--space-10);border:0;border-radius:var(--radius-6);background:none;color:var(--muted);text-decoration:none;text-align:left;cursor:pointer;font-family:var(--mono);font-size:11px;letter-spacing:.1em;text-transform:uppercase;white-space:nowrap;transition:color .15s ease-out,background .15s ease-out}
.oa-sb-item .oa-ico{color:var(--muted-2)}
.oa-sb-item:hover{color:var(--heading);background:var(--hover)}
.oa-sb-item[aria-current="page"]{color:var(--heading);background:var(--hover);font-weight:600}
.oa-sb-item[aria-current="page"] .oa-ico{color:var(--accent)}
.oa-sb-item[aria-current="page"]::before{content:"";position:absolute;left:-8px;top:7px;bottom:7px;width:2px;border-radius:2px;background:var(--accent)}
.oa-sb-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis}
.oa-sb-caret{transition:transform .15s ease-out}
.oa-sb-item[aria-expanded="false"] .oa-sb-caret{transform:rotate(-90deg)}
.oa-sb-item[data-child-current]{color:var(--heading)}
.oa-sb-item[data-child-current] > .oa-ico:first-child{color:var(--accent)}
.oa-sb-sub{list-style:none;margin:1px 0 4px 17px;padding:0 0 0 var(--space-10);border-left:1px solid var(--line-2);display:flex;flex-direction:column;gap:1px}
.oa-sb-sub[hidden]{display:none}
.oa-sb-sub .oa-sb-item{padding-top:6px;padding-bottom:6px;letter-spacing:.06em}
/* Work waiting on staff (src/lib/admin-attention.ts). Coral is reserved for this: a count, never a status. */
.oa-sb-count{margin-left:auto;min-width:18px;height:16px;padding:0 5px;display:inline-flex;align-items:center;justify-content:center;border-radius:var(--radius-pill);background:var(--coral);color:#ffffff;font-family:var(--mono);font-size:9px;font-weight:600;letter-spacing:0}
.oa-sb-sub .oa-sb-item[aria-current="page"]::before{left:-11px}

.oa-sb-foot{position:relative;border-top:1px solid var(--line-2);padding:var(--space-10) var(--space-8)}
.oa-sb-profile{display:flex;align-items:center;gap:var(--space-10);width:100%;padding:6px var(--space-8);border:0;border-radius:var(--radius-8);background:none;color:var(--text);text-align:left;cursor:pointer;font:inherit}
.oa-sb-profile:hover,.oa-sb-profile[aria-expanded="true"]{background:var(--hover)}
.oa-sb-profile .oa-who{flex:1;min-width:0;line-height:1.25}
.oa-sb-profile .oa-who b{display:block;font-size:13px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.oa-sb-profile .oa-who span{display:block;font-family:var(--mono);font-size:10px;letter-spacing:.1em;text-transform:uppercase;color:var(--muted)}
.oa-sb-profile > .oa-ico{color:var(--muted-2)}

/* The panel button and the drawer's close button share a slot; which one shows depends on width. */
.oa-icon-btn.oa-sb-close{display:none}

/* ── Rail (64px), desktop only ───────────────────────────────── */
@media (min-width: 900px){
  .oa-shell{transition:grid-template-columns .18s ease-out}
  html[data-admin-sidebar="rail"] .oa-shell{grid-template-columns:var(--oa-rail-w) minmax(0,1fr)}
  /* Labels leave the layout but stay in the accessibility tree, so each icon keeps its name. */
  html[data-admin-sidebar="rail"] .oa-shell .oa-sb-label,
  html[data-admin-sidebar="rail"] .oa-shell .oa-sb-search-label,
  html[data-admin-sidebar="rail"] .oa-shell .oa-who{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
  html[data-admin-sidebar="rail"] .oa-shell .oa-sb-brand,
  html[data-admin-sidebar="rail"] .oa-shell .oa-sb-group-label,
  html[data-admin-sidebar="rail"] .oa-shell .oa-sb-search kbd,
  html[data-admin-sidebar="rail"] .oa-shell .oa-sb-sub,
  html[data-admin-sidebar="rail"] .oa-shell .oa-sb-caret,
  html[data-admin-sidebar="rail"] .oa-shell .oa-sb-profile > .oa-ico{display:none}
  html[data-admin-sidebar="rail"] .oa-shell .oa-sb-items[hidden]{display:flex}
  html[data-admin-sidebar="rail"] .oa-shell .oa-sb-top{justify-content:center;padding-left:0;padding-right:0}
  html[data-admin-sidebar="rail"] .oa-shell .oa-sb-search{width:36px;margin:0 auto var(--space-10);justify-content:center;padding:0}
  html[data-admin-sidebar="rail"] .oa-shell .oa-sb-item{justify-content:center;padding:9px 0}
  html[data-admin-sidebar="rail"] .oa-shell .oa-sb-group + .oa-sb-group{margin-top:var(--space-8);padding-top:var(--space-8);border-top:1px solid var(--line-2)}
  html[data-admin-sidebar="rail"] .oa-shell .oa-sb-profile{justify-content:center;padding:6px 0}
  /* No room for the number: it shrinks to a dot on the icon's corner. The name still carries it. */
  html[data-admin-sidebar="rail"] .oa-shell .oa-sb-count{position:absolute;top:5px;left:calc(50% + 5px);min-width:0;width:8px;height:8px;padding:0;font-size:0}
  html[data-admin-sidebar="rail"] .oa-shell .oa-sb-foot .oa-popover{min-width:220px}
}

/* ── Top bar + drawer, below 900px ───────────────────────────── */
.oa-topbar{display:none}
.oa-scrim{display:none}
@media (max-width: 899.98px){
  .oa-shell{display:block}
  .oa-topbar{position:sticky;top:0;z-index:30;display:flex;align-items:center;gap:var(--space-10);height:var(--oa-topbar-h);padding:0 var(--space-14);background:var(--nav-bg);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);border-bottom:1px solid var(--line-2)}
  .oa-topbar .oa-sb-brand{min-width:0}
  .oa-col{min-height:100vh;min-height:100dvh}
  .oa-main{padding:var(--space-16) var(--space-16) var(--space-34)}
  .oa-sidebar{position:fixed;left:0;top:0;bottom:0;height:100dvh;width:min(288px,86vw);z-index:50;transform:translateX(-100%);visibility:hidden;transition:transform .2s ease-out,visibility 0s linear .2s;box-shadow:var(--shadow-overlay)}
  .oa-shell[data-drawer="open"] .oa-sidebar{transform:none;visibility:visible;transition:transform .2s ease-out,visibility 0s}
  .oa-scrim{display:block;position:fixed;inset:0;z-index:45;background:var(--scrim);opacity:0;pointer-events:none;transition:opacity .2s ease-out}
  .oa-shell[data-drawer="open"] .oa-scrim{opacity:1;pointer-events:auto}
  .oa-icon-btn.oa-sb-collapse{display:none}
  .oa-icon-btn.oa-sb-close{display:inline-flex}
}

/* ── Avatar ──────────────────────────────────────────────────── */
.oa-avatar{width:30px;height:30px;border-radius:var(--radius-pill);display:inline-flex;align-items:center;justify-content:center;flex:none;background:var(--avatar-bg);border:1.5px solid var(--avatar-line);font-family:var(--mono);font-size:11px;font-weight:600;color:var(--soft);overflow:hidden}
.oa-avatar img{width:100%;height:100%;object-fit:cover;display:block}
.oa-avatar.sm{width:24px;height:24px;font-size:9.5px}

/* ── Icon button ─────────────────────────────────────────────── */
.oa-icon-btn{width:32px;height:32px;padding:0;display:inline-flex;align-items:center;justify-content:center;flex:none;border:1px solid transparent;border-radius:var(--radius-8);background:transparent;color:var(--muted);cursor:pointer}
.oa-icon-btn:hover,.oa-icon-btn[aria-expanded="true"],.oa-icon-btn[aria-pressed="true"]{color:var(--text);background:var(--hover)}
.oa-icon-btn.is-outline{border-color:var(--line)}

/* ── Page header ─────────────────────────────────────────────── */
.oa-pagehead{display:flex;align-items:flex-end;justify-content:space-between;gap:var(--space-16);flex-wrap:wrap;margin-bottom:var(--space-22)}
.oa-crumbs{display:flex;align-items:center;gap:6px;font-family:var(--mono);font-size:11px;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);margin-bottom:6px}
.oa-crumbs a{color:var(--muted);text-decoration:none}
.oa-crumbs a:hover{color:var(--text)}
.oa-crumbs .oa-ico{width:12px;height:12px;color:var(--muted-2)}
.oa-title{margin:0;font-size:26px;line-height:1.15;font-weight:700;letter-spacing:-.02em;text-transform:uppercase;color:var(--heading)}
.oa-subtitle{margin:4px 0 0;font-size:13px;color:var(--muted)}
.oa-actions{display:flex;align-items:center;gap:var(--space-8);flex-wrap:wrap}

/* ── Popover / menu ──────────────────────────────────────────── */
/* Opened in the top layer by usePopover and placed from its trigger (top/left set in script), so a
   table or card that clips cannot cut it off. The resets undo the UA [popover] centring. */
.oa-popover{position:fixed;inset:auto;margin:0;overflow:visible;color:var(--text);z-index:60;min-width:200px;padding:6px;background:var(--panel-solid);border:1px solid var(--line);border-radius:var(--radius-12);box-shadow:var(--shadow-overlay);transform-origin:top right;animation:oa-pop .12s ease-out}
.oa-popover[data-side="top"]{transform-origin:bottom right}
.oa-popover.at-left[data-side="top"]{transform-origin:bottom left}
html[data-lms-theme="light"] .oa-popover{border-color:var(--glass-line)}
.oa-popover[hidden]{display:none}
.oa-popover.at-left{transform-origin:top left}
.oa-popover-title{padding:6px 8px 8px;font-family:var(--mono);font-size:10px;letter-spacing:.14em;text-transform:uppercase;color:var(--muted)}
.oa-menu-item{display:flex;align-items:center;gap:var(--space-10);width:100%;margin:0;padding:7px 8px;border:0;border-radius:var(--radius-8);background:none;color:var(--text);font-family:var(--sans);font-size:13px;line-height:1.4;text-align:left;text-transform:none;letter-spacing:0;text-decoration:none;cursor:pointer}
.oa-menu-item .oa-ico{color:var(--muted)}
.oa-menu-item:hover,.oa-menu-item:focus-visible{background:var(--hover)}
.oa-menu-item:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}
.oa-menu-item.is-danger,.oa-menu-item.is-danger .oa-ico{color:var(--err)}
.oa-menu-sep{height:1px;background:var(--line-2);margin:4px -6px}
.oa-popover form{margin:0}
/* The theme item names the theme it switches to; only the matching half is in the tree. */
.oa-when-light{display:none}
html[data-lms-theme="light"] .oa-shell .oa-when-light{display:contents}
html[data-lms-theme="light"] .oa-shell .oa-when-dark{display:none}
.oa-when-dark{display:contents}
@keyframes oa-pop{from{opacity:0;transform:scale(.96)}to{opacity:1;transform:none}}

@media (prefers-reduced-motion: reduce){
  .oa-shell,.oa-shell *,.oa-shell *::before,.oa-shell *::after{animation-duration:1ms !important;transition-duration:1ms !important}
}
