/* Navigation shell (assets/shell.js): a slim bar on every page, the menu in it (top mode) or in a sidebar (side mode),
   and a drawer on phones. Colours follow the masthead so it reads as part of the page. */
:root { --mg-bar-h: 56px; --mg-side-w: 264px; --mg-bar: #131c38; --mg-bar-2: #1f2b55; --mg-gold: #f1c27a; --mg-amber: #d49a3a; --mg-violet: #5b4f9e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --mg-bar: #0e1530; --mg-bar-2: #18214a; } }
:root[data-theme="dark"] { --mg-bar: #0e1530; --mg-bar-2: #18214a; }

body { padding-top: calc(var(--mg-bar-h) + env(safe-area-inset-top)); padding-bottom: env(safe-area-inset-bottom); }
.dash-nav { display: none !important; }              /* the old one-line page links: the bar replaces them */

.mg-bar { position: fixed; inset: 0 0 auto 0; z-index: 60; height: calc(var(--mg-bar-h) + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); box-sizing: border-box; display: flex; align-items: center; gap: 10px; padding: 0 clamp(12px, 2vw, 24px);
  background: linear-gradient(90deg, var(--mg-bar), var(--mg-bar-2)); color: #fff; box-shadow: 0 2px 14px rgba(0,0,0,.25); font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif; }
.mg-bar::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, var(--mg-violet) 0 72%, var(--mg-amber) 72% 100%); }
.mg-bar svg { width: 20px; height: 20px; }
.mg-ic { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 10px; border: 0; background: transparent; color: #fff; cursor: pointer; text-decoration: none; }
.mg-ic:hover { background: rgba(255,255,255,.12); }
.mg-burger { display: none; }
.mg-brand { flex: none; display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; margin-right: 6px; white-space: nowrap; }
.mg-brand .tile { background: #fff; border-radius: 8px; padding: 3px 5px; line-height: 0; }
.mg-brand img { height: 32px; width: auto; }
.mg-brand b { font-size: 15px; font-weight: 800; }
.mg-brand small { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; opacity: .7; margin-left: 2px; }
/* the bar compresses in steps: shorter labels, then icons only, then the drawer */
@media (max-width: 1560px) { .mg-brand small, .mg-who .nm small { display: none; } .mg-top-a { padding: 8px 9px; font-size: 13px; } }
@media (max-width: 1440px) { .mg-who .nm { display: none; } }
/* with the Install app button in the bar, everything compresses a step earlier */
@media (max-width: 1720px) { body.mg-has-install .mg-brand small, body.mg-has-install .mg-who .nm { display: none; } body.mg-has-install .mg-top-a { padding: 8px 9px; font-size: 13px; } }
@media (min-width: 901px) and (max-width: 1480px) { body.mg-has-install .mg-top-a .lbl { display: none; } body.mg-has-install .mg-top-a { padding: 8px 10px; } body.mg-has-install .mg-top-a .ic { width: 21px; height: 21px; opacity: 1; } body.mg-has-install .mg-top-a .chev { display: none; } body.mg-has-install .mg-who .nm { display: none; } }
@media (min-width: 901px) and (max-width: 1280px) { .mg-top-a .lbl { display: none; } .mg-top-a { padding: 8px 10px; } .mg-top-a .ic { width: 21px; height: 21px; opacity: 1; } .mg-top-a .chev { display: none; } }

/* ----- top menu */
.mg-topnav { flex: 1 1 auto; min-width: 0; display: flex; justify-content: center; }
.mg-topnav > ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: nowrap; gap: 2px; }
.mg-topnav li { position: relative; }
.mg-top-a { display: inline-flex; align-items: center; gap: 7px; padding: 8px 11px; border-radius: 10px; color: rgba(255,255,255,.88); text-decoration: none; font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.mg-top-a .ic { width: 17px; height: 17px; opacity: .85; }
.mg-top-a .chev { width: 14px; height: 14px; opacity: .6; margin-left: -2px; }
.mg-top-a:hover, .mg-topnav li.on > .mg-top-a { background: rgba(255,255,255,.12); color: #fff; }
.mg-topnav li.on > .mg-top-a { box-shadow: inset 0 -2px 0 var(--mg-gold); border-radius: 10px 10px 4px 4px; }
.mg-drop { position: absolute; left: 0; top: calc(100% + 6px); min-width: 230px; background: var(--color-panel, var(--surface, #fffcf7)); color: var(--color-fg, var(--ink, #2a241f));
  border: 1px solid var(--color-border-line, var(--line, #e8dfd1)); border-radius: 14px; padding: 8px; box-shadow: 0 18px 44px rgba(20, 12, 4, .22); display: none; z-index: 70; }
.mg-topnav li.has:hover > .mg-drop, .mg-topnav li.has:focus-within > .mg-drop, .mg-topnav li.open > .mg-drop { display: block; }
.mg-drop::before { content: ""; position: absolute; left: 0; right: 0; top: -8px; height: 8px; }  /* keeps hover alive crossing the gap */
.mg-drop ul { list-style: none; margin: 0; padding: 0; }
.mg-drop a { display: block; padding: 8px 10px; border-radius: 9px; color: inherit; text-decoration: none; font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.mg-drop a:hover { background: rgba(91, 79, 158, .1); }
.mg-drop a[aria-current="page"] { background: var(--mg-violet); color: #fff; }
.mg-drop a.grp { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--mg-amber); margin-top: 6px; padding-bottom: 4px; }
.mg-drop a.grp:hover { background: rgba(212, 154, 58, .14); }
.mg-drop ul ul { padding-left: 10px; border-left: 2px solid rgba(212, 154, 58, .35); margin-left: 10px; }
.mg-drop ul ul a { font-weight: 500; padding: 6px 10px; }

/* ----- right cluster */
.mg-right { flex: none; margin-left: auto; display: flex; align-items: center; gap: 8px; }
.mg-theme { display: inline-flex; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.14); border-radius: 999px; padding: 3px; }
.mg-theme button { width: 32px; height: 28px; border: 0; border-radius: 999px; background: transparent; color: rgba(255,255,255,.8); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.mg-theme button svg { width: 16px; height: 16px; }
.mg-theme button[aria-pressed="true"] { background: var(--mg-gold); color: #1d1408; }
.mg-who { display: flex; align-items: center; gap: 8px; padding-left: 6px; }
.mg-who .av { width: 32px; height: 32px; border-radius: 50%; background: var(--mg-gold); color: #1d1408; font-weight: 800; font-size: 12.5px; display: inline-flex; align-items: center; justify-content: center; }
.mg-who .nm { display: flex; flex-direction: column; line-height: 1.15; }
.mg-who .nm b { font-size: 13px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mg-who .nm small { font-size: 10.5px; opacity: .7; letter-spacing: .06em; text-transform: uppercase; }
.mg-out { font: inherit; font-size: 12.5px; font-weight: 700; color: #1d1408; background: var(--mg-amber); border: 0; border-radius: 999px; padding: 7px 12px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.mg-out:hover { filter: brightness(1.08); }

/* ----- sidebar / drawer */
.mg-sidenav { position: fixed; top: calc(var(--mg-bar-h) + env(safe-area-inset-top)); bottom: 0; left: 0; width: var(--mg-side-w); z-index: 55; overflow-y: auto; display: flex; flex-direction: column;
  background: var(--color-panel, var(--surface, #fffcf7)); color: var(--color-fg, var(--ink, #2a241f)); border-right: 1px solid var(--color-border-line, var(--line, #e8dfd1));
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif; transform: translateX(-100%); transition: transform .22s ease; }
.mg-sidenav > ul { list-style: none; margin: 0; padding: 12px 10px; flex: 1; }
.mg-sidenav ul ul { list-style: none; margin: 2px 0 6px; padding: 0 0 0 12px; }
.mg-sidenav .row { display: flex; align-items: center; }
.mg-side-a { flex: 1; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: inherit; text-decoration: none; font-size: 14px; font-weight: 600; }
.mg-side-a .ic { width: 18px; height: 18px; color: var(--mg-violet); }
.mg-side-a:hover { background: rgba(91, 79, 158, .1); }
.mg-side-a[aria-current="page"] { background: var(--mg-violet); color: #fff; } .mg-side-a[aria-current="page"] .ic { color: #fff; }
.mg-sidenav .tg { flex: none; width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: inherit; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; opacity: .7; }
.mg-sidenav .tg svg { width: 16px; height: 16px; transition: transform .2s; } .mg-sidenav .tg[aria-expanded="true"] svg { transform: rotate(180deg); }
.mg-sidenav .sub a { display: block; padding: 7px 10px 7px 30px; border-radius: 8px; color: inherit; text-decoration: none; font-size: 13.5px; }
.mg-sidenav .sub a:hover { background: rgba(91, 79, 158, .1); }
.mg-sidenav .sub a[aria-current="page"] { background: rgba(91, 79, 158, .16); color: var(--mg-violet); font-weight: 700; }
:root[data-theme="dark"] .mg-sidenav .sub a[aria-current="page"], :root[data-theme="dark"] .mg-side-a .ic { color: #c9bff5; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mg-sidenav .sub a[aria-current="page"], :root:not([data-theme="light"]) .mg-side-a .ic { color: #c9bff5; } }
.mg-sidenav .sub a.grp { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--mg-amber); font-weight: 800; margin-top: 6px; }
.mg-sidenav .sub3 { padding-left: 14px; margin-left: 30px; border-left: 2px solid rgba(212, 154, 58, .35); }
.mg-sidenav .sub3 a { padding-left: 10px; font-weight: 500; }
.mg-side-foot { padding: 10px; border-top: 1px solid var(--color-border-line, var(--line, #e8dfd1)); }
.mg-layout { width: 100%; display: flex; align-items: center; gap: 9px; font: inherit; font-size: 13px; font-weight: 600; color: inherit; background: transparent; border: 1px solid var(--color-border-line, var(--line, #e8dfd1)); border-radius: 10px; padding: 9px 10px; cursor: pointer; }
.mg-layout:hover { border-color: var(--mg-violet); }
.mg-layout svg { width: 18px; height: 18px; color: var(--mg-violet); }
.mg-scrim { position: fixed; inset: 0; z-index: 50; background: rgba(10, 8, 20, .45); opacity: 0; pointer-events: none; transition: opacity .2s; }

/* side mode on wide screens: the sidebar is always there and the page moves over */
@media (min-width: 901px) {
  body.mg-nav-side { padding-left: var(--mg-side-w); }
  body.mg-nav-side .mg-sidenav.is-side { transform: none; }
  body.mg-nav-side .mg-bar { padding-left: clamp(12px, 2vw, 24px); }
  body.mg-nav-top .mg-burger { display: none; }
  body.mg-nav-top .mg-sidenav.is-drawer { display: none; }
}
/* drawer: phones in either mode, and the hamburger */
@media (max-width: 900px) {
  .mg-burger { display: inline-flex; }
  .mg-topnav { display: none; }
  body.mg-open .mg-sidenav { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.35); }
  body.mg-open .mg-scrim { opacity: 1; pointer-events: auto; }
  .mg-who .nm { display: none; }
  .mg-brand b { font-size: 14px; }
  .mg-sidenav { width: min(var(--mg-side-w), 86vw); }
}
@media (max-width: 480px) { .mg-theme button:not([aria-pressed="true"]) { display: none; } .mg-theme { padding: 2px; } }
@media (prefers-reduced-motion: reduce) { .mg-sidenav, .mg-scrim, .mg-sidenav .tg svg { transition: none; } }
@media print { .mg-bar, .mg-sidenav, .mg-scrim { display: none !important; } body { padding: 0 !important; } }
