/* ==========================================================================
   Learning Hub — global tokens, reset, typography and app shell
   ========================================================================== */
:root {
  /* Brand: deep "press ink" indigo + marigold accent */
  --ink-900: #141a3f;
  --ink-800: #1d2457;
  --ink-700: #283378;
  --ink-600: #34429a;
  --ink-500: #4a59b8;
  --ink-100: #e7e9f7;
  --ink-50:  #f3f4fb;
  --marigold-500: #f2a20c;
  --marigold-600: #d98c00;
  --marigold-100: #fdf0d3;
  --marigold-ink: #7a4b00;

  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-2: #f9fafd;
  --border: #e1e4ef;
  --border-strong: #c9cee0;
  --text: #1a1f36;
  --text-2: #4a5170;
  --muted: #5f6684;

  --success: #187a50;  --success-bg: #e3f5ec;
  --danger:  #b42b22;  --danger-bg:  #fbe6e4;
  --warning: #8a5a00;  --warning-bg: #fff3d6;
  --info:    #1f5fa8;  --info-bg:    #e4effb;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(20, 26, 63, .06);
  --shadow: 0 2px 8px rgba(20, 26, 63, .07), 0 1px 2px rgba(20, 26, 63, .05);
  --shadow-lg: 0 18px 48px rgba(20, 26, 63, .18);

  --font: "Mukta", "Noto Sans Devanagari", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", Consolas, monospace;

  --sidebar-w: 264px;
  --sidebar-w-collapsed: 76px;
  --topbar-h: 60px;
  --bottomnav-h: 64px;
  --focus: 0 0 0 3px rgba(242, 162, 12, .55);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img, svg, canvas, iframe, video { max-width: 100%; }
:where(svg[aria-hidden="true"]) { width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex: none; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; color: var(--ink-900); font-weight: 700; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .8em; }
a { color: var(--ink-600); }
a:hover { color: var(--ink-800); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 8px; top: -60px; background: var(--ink-800); color: #fff; padding: 8px 14px; border-radius: 6px; z-index: 1000; }
.skip-link:focus { top: 8px; color: #fff; }
.mr, [lang="mr"] { font-family: "Mukta", "Noto Sans Devanagari", var(--font); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--font-mono); font-size: .85em; }
.text-right { text-align: right; }
.break { overflow-wrap: anywhere; }

/* ---------- App shell ---------- */
.shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
  display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--border);
  z-index: 60; transition: width .18s ease, transform .2s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 14px 16px; height: var(--topbar-h); border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; }
.brand-mark { width: 36px; height: 36px; border-radius: 9px; flex: none; display: grid; place-items: center; background: var(--ink-800); color: var(--marigold-500); font-weight: 800; font-size: 15px; letter-spacing: .5px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand-text strong { font-size: 1.02rem; color: var(--ink-900); white-space: nowrap; }
.brand-text span { font-size: .75rem; color: var(--muted); white-space: nowrap; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 10px 16px; }
.nav-group-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 14px 10px 6px; font-weight: 600; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; margin: 1px 0;
  border-radius: 8px; color: var(--text-2); text-decoration: none; font-weight: 500; min-height: 42px;
}
.nav-link svg { width: 20px; height: 20px; flex: none; }
.nav-link:hover { background: var(--ink-50); color: var(--ink-800); }
.nav-link[aria-current="page"] { background: var(--ink-100); color: var(--ink-800); font-weight: 600; }
.nav-link[aria-current="page"] svg { color: var(--marigold-600); }
.nav-link .nav-badge { margin-left: auto; font-size: .72rem; background: var(--marigold-100); color: var(--marigold-ink); border-radius: 999px; padding: 0 8px; font-weight: 600; }
.nav-link .nav-soon { margin-left: auto; font-size: .68rem; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 0 6px; }
.sidebar-foot { padding: 12px 16px; border-top: 1px solid var(--border); font-size: .78rem; color: var(--muted); }

.shell-main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; transition: margin-left .18s ease; }
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
  background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { font-size: 1.08rem; font-weight: 700; color: var(--ink-900); margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.net-status { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--success); padding: 2px 10px; border-radius: 999px; background: var(--success-bg); border: 0; cursor: pointer; min-height: 28px; font-weight: 600; }
.net-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.net-status.offline { color: var(--danger); background: var(--danger-bg); }
.user-chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; min-height: 40px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--ink-700); color: #fff; font-weight: 700; font-size: .85rem; flex: none; }
.user-chip .uc-name { font-size: .88rem; font-weight: 600; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-pop { position: absolute; right: 16px; top: calc(var(--topbar-h) - 4px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); min-width: 220px; padding: 6px; z-index: 70; }
.menu-pop a, .menu-pop button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 6px; border: 0; background: none; text-align: left; text-decoration: none; color: var(--text); cursor: pointer; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--ink-50); }
.menu-pop .menu-meta { padding: 8px 10px; font-size: .8rem; color: var(--muted); border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); display: inline-grid; place-items: center; cursor: pointer; color: var(--text-2); flex: none; }
.icon-btn:hover { background: var(--ink-50); color: var(--ink-800); }
.icon-btn svg { width: 20px; height: 20px; }
.menu-toggle { display: none; }

.demo-banner { display: flex; gap: 10px; align-items: flex-start; background: var(--marigold-100); color: var(--marigold-ink); border-bottom: 1px solid #f3dca4; padding: 8px 20px; font-size: .85rem; }
.demo-banner svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.demo-banner button { margin-left: auto; background: none; border: 0; color: inherit; cursor: pointer; padding: 2px 6px; font-weight: 600; flex: none; }

.content { flex: 1; width: 100%; max-width: 1440px; margin: 0 auto; padding: 24px; min-width: 0; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 16px; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.section { margin-bottom: 28px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.section-head h2 { margin: 0; font-size: 1.12rem; }

.drawer-backdrop { display: none; position: fixed; inset: 0; background: rgba(15, 18, 40, .45); z-index: 55; }
.bottom-nav { display: none; }

/* Collapsed sidebar (desktop) */
.shell.collapsed .sidebar { width: var(--sidebar-w-collapsed); }
.shell.collapsed .shell-main { margin-left: var(--sidebar-w-collapsed); }
.shell.collapsed .brand-text, .shell.collapsed .nav-link span, .shell.collapsed .nav-group-label, .shell.collapsed .sidebar-foot, .shell.collapsed .nav-badge, .shell.collapsed .nav-soon { display: none; }
.shell.collapsed .nav-link { justify-content: center; }

/* Loading */
.boot { display: grid; place-items: center; min-height: 60vh; color: var(--muted); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--ink-100); border-top-color: var(--ink-600); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }

@media print {
  .sidebar, .topbar, .bottom-nav, .demo-banner, .no-print { display: none !important; }
  .shell-main { margin: 0 !important; }
  body { background: #fff; }
}
