/**
 * App shell · layout, chrome, home hub
 * Depends on vifc-theme.css (load first in HTML).
 */

html,
body {
  margin: 0;
  height: 100%;
}

body {
  font-family: var(--vifc-font-sans);
  background: var(--vifc-bg-base);
  color: var(--vifc-text);
}

.shell-skip {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.shell-skip:focus {
  left: var(--vifc-space-4);
  top: var(--vifc-space-4);
  width: auto;
  height: auto;
  padding: var(--vifc-space-2) var(--vifc-space-3);
  z-index: 100;
  background: var(--vifc-bg-raised);
  border: 1px solid var(--vifc-border-default);
  border-radius: var(--vifc-radius-sm);
  color: var(--vifc-text);
  font-size: var(--vifc-text-sm);
  font-weight: 500;
  box-shadow: var(--vifc-focus-ring);
}

/* Subtle top light · restrained, not a “hero gradient template” */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(120% 80% at 50% -30%, rgba(45, 212, 191, 0.07), transparent 55%);
  z-index: 0;
}

.shell {
  position: relative;
  z-index: 1;
  display: grid;
  /* minmax(0, 1fr): without the 0 floor, the main row can size to the iframe’s
   * intrinsic height (~150px) and the hub module frame stays a short strip. */
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100%;
  min-height: 100dvh;
  height: 100%;
}

/* RBAC left no top-level nav links · avoid empty drawer / pill breaking the row */
.shell-header.shell-header--nav-empty .shell-nav {
  display: none !important;
}

.shell-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--vifc-space-4);
  padding-top: max(var(--vifc-space-3), env(safe-area-inset-top, 0px));
  padding-bottom: var(--vifc-space-3);
  padding-left: max(var(--vifc-page-gutter-x), env(safe-area-inset-left, 0px));
  padding-right: max(var(--vifc-page-gutter-x), env(safe-area-inset-right, 0px));
  min-height: 3.5rem;
  border-bottom: 1px solid var(--vifc-border-subtle);
  background: rgba(12, 14, 20, 0.92);
  background: color-mix(in srgb, var(--vifc-bg-surface) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  flex-wrap: nowrap;
  /* Let mega / dropdown panels paint outside the header row */
  overflow: visible;
}

.shell-burger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  margin: 0;
  background: var(--vifc-bg-raised);
  border: 1px solid var(--vifc-border-default);
  border-radius: var(--vifc-radius-sm);
  color: var(--vifc-text);
  cursor: pointer;
  flex-shrink: 0;
  transition:
    background var(--vifc-duration) var(--vifc-ease-out),
    border-color var(--vifc-duration) var(--vifc-ease-out);
}

.shell-burger:hover {
  border-color: var(--vifc-border-strong);
  background: #181c28;
}

.shell-burger:focus-visible {
  outline: none;
  box-shadow: var(--vifc-focus-ring);
}

.shell-burger-box {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 14px;
}

.shell-burger-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition:
    transform var(--vifc-duration) var(--vifc-ease-out),
    opacity var(--vifc-duration) var(--vifc-ease-out),
    top var(--vifc-duration) var(--vifc-ease-out);
}

.shell-burger-line:nth-child(1) { top: 0; }
.shell-burger-line:nth-child(2) { top: 6px; }
.shell-burger-line:nth-child(3) { top: 12px; }

.shell-burger[aria-expanded="true"] .shell-burger-line:nth-child(1) {
  top: 6px;
  transform: rotate(45deg);
}

.shell-burger[aria-expanded="true"] .shell-burger-line:nth-child(2) {
  opacity: 0;
}

.shell-burger[aria-expanded="true"] .shell-burger-line:nth-child(3) {
  top: 6px;
  transform: rotate(-45deg);
}

.shell-brand-wrap {
  display: flex;
  align-items: center;
  gap: var(--vifc-space-3);
  min-width: 0;
}

a.shell-brand-wrap {
  color: inherit;
  text-decoration: none;
  border-radius: var(--vifc-radius-sm);
}

a.shell-brand-wrap:hover {
  color: var(--vifc-text);
}

a.shell-brand-wrap:hover .shell-brand-kicker {
  color: var(--vifc-text-secondary);
}

a.shell-brand-wrap:focus-visible {
  outline: none;
  box-shadow: var(--vifc-focus-ring);
}

.shell-mark {
  width: 2rem;
  height: 2rem;
  border-radius: var(--vifc-radius-sm);
  object-fit: contain;
  flex-shrink: 0;
}

.shell-brand {
  font-weight: 650;
  font-size: var(--vifc-text-md);
  letter-spacing: var(--vifc-tracking-tight);
  line-height: var(--vifc-leading-tight);
}

.shell-brand-kicker {
  display: block;
  font-size: var(--vifc-text-xs);
  font-weight: 500;
  color: var(--vifc-text-tertiary);
  letter-spacing: var(--vifc-tracking-wide);
  text-transform: uppercase;
  margin-top: 2px;
}

.shell-nav {
  display: flex;
  align-items: center;
  gap: var(--vifc-space-1);
  flex-wrap: nowrap;
  padding: var(--vifc-space-1);
  margin: 0;
  border-radius: var(--vifc-radius-md);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--vifc-border-subtle);
  min-width: 0;
  /* overflow-x: auto here clips position:absolute flyouts (mega panels) */
  overflow: visible;
}

/* Desktop: nav grows between brand and user; no horizontal scroll (breaks flyouts). */
@media (min-width: 1024px) {
  .shell-header .shell-nav {
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: wrap;
    row-gap: var(--vifc-space-1);
  }
}

.shell-nav > a,
.shell-nav > .shell-nav-group,
.shell-nav > .shell-nav-mega {
  flex-shrink: 0;
}

.shell-nav a {
  color: var(--vifc-text-secondary);
  text-decoration: none;
  padding: 0.45rem 0.85rem;
  border-radius: var(--vifc-radius-sm);
  font-size: var(--vifc-text-sm);
  font-weight: 500;
  letter-spacing: var(--vifc-tracking-tight);
  border: 1px solid transparent;
  transition:
    background var(--vifc-duration) var(--vifc-ease-out),
    color var(--vifc-duration) var(--vifc-ease-out),
    border-color var(--vifc-duration) var(--vifc-ease-out);
}

.shell-nav a:hover {
  color: var(--vifc-text);
  background: rgba(255, 255, 255, 0.05);
}

.shell-nav a:focus-visible {
  outline: none;
  box-shadow: var(--vifc-focus-ring);
  border-radius: var(--vifc-radius-sm);
}

.shell-nav a.active {
  color: var(--vifc-text);
  background: rgba(45, 212, 191, 0.1);
  border-color: rgba(45, 212, 191, 0.28);
}

/* Megamenu · few top-level categories; many links live in the flyout grid */
.shell-nav-mega {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.shell-nav-mega-trigger {
  position: relative;
  box-sizing: border-box;
  margin: 0;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  color: var(--vifc-text-secondary);
  text-decoration: none;
  padding: 0.45rem 0.85rem;
  padding-right: 2.1rem;
  border-radius: var(--vifc-radius-sm);
  font-size: var(--vifc-text-sm);
  font-weight: 500;
  letter-spacing: var(--vifc-tracking-tight);
  border: 1px solid transparent;
  background: transparent;
  transition:
    background var(--vifc-duration) var(--vifc-ease-out),
    color var(--vifc-duration) var(--vifc-ease-out),
    border-color var(--vifc-duration) var(--vifc-ease-out);
}

a.shell-nav-mega-trigger {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.85rem;
  padding-right: 2.1rem;
}

.shell-nav-mega:has(.shell-nav-mega-panel) .shell-nav-mega-trigger::after {
  content: "";
  position: absolute;
  right: 0.65rem;
  top: 50%;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-70%) rotate(45deg);
  opacity: 0.6;
  transition: transform var(--vifc-duration) var(--vifc-ease-out);
}

.shell-nav-mega:hover .shell-nav-mega-trigger::after,
.shell-nav-mega:focus-within .shell-nav-mega-trigger::after {
  transform: translateY(-30%) rotate(225deg);
  opacity: 1;
}

.shell-nav-mega-trigger:hover {
  color: var(--vifc-text);
  background: rgba(255, 255, 255, 0.05);
}

.shell-nav-mega-trigger:focus-visible {
  outline: none;
  box-shadow: var(--vifc-focus-ring);
  border-radius: var(--vifc-radius-sm);
}

.shell-nav-mega-trigger.active {
  color: var(--vifc-text);
  background: rgba(45, 212, 191, 0.1);
  border-color: rgba(45, 212, 191, 0.28);
}

.shell-nav-mega-panel {
  position: absolute;
  /* Slight overlap + desktop ::before bridge (below) — avoids losing :hover in the
     dead air between trigger and panel, which snapped the flyout shut mid-move. */
  top: calc(100% - 2px);
  left: 0;
  min-width: min(22rem, calc(100vw - 2.5rem));
  max-width: min(38rem, calc(100vw - 2rem));
  padding: var(--vifc-space-3);
  margin: 0;
  border-radius: var(--vifc-radius-md);
  background: color-mix(in srgb, var(--vifc-bg-surface) 96%, transparent);
  border: 1px solid var(--vifc-border-subtle);
  box-shadow: var(--vifc-shadow-md);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition:
    opacity var(--vifc-duration) var(--vifc-ease-out),
    transform var(--vifc-duration) var(--vifc-ease-out),
    visibility 0s linear var(--vifc-duration);
  z-index: 70;
}

.shell-nav-mega-cols {
  display: flex;
  flex-direction: column;
  gap: var(--vifc-space-1);
  align-items: stretch;
}

.shell-nav-mega-panel a {
  display: block;
  padding: 0.5rem 0.75rem;
  font-size: var(--vifc-text-sm);
  border-radius: var(--vifc-radius-sm);
  color: var(--vifc-text-secondary);
  text-decoration: none;
  font-weight: 500;
  letter-spacing: var(--vifc-tracking-tight);
  border: 1px solid transparent;
  transition:
    background var(--vifc-duration) var(--vifc-ease-out),
    color var(--vifc-duration) var(--vifc-ease-out),
    border-color var(--vifc-duration) var(--vifc-ease-out);
}

.shell-nav-mega-panel a:hover {
  color: var(--vifc-text);
  background: rgba(255, 255, 255, 0.06);
}

.shell-nav-mega-panel a:focus-visible {
  outline: none;
  box-shadow: var(--vifc-focus-ring);
}

.shell-nav-mega:hover > .shell-nav-mega-panel,
.shell-nav-mega:focus-within > .shell-nav-mega-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition:
    opacity var(--vifc-duration) var(--vifc-ease-out),
    transform var(--vifc-duration) var(--vifc-ease-out),
    visibility 0s linear 0s;
}

/* Nav group (Analytics > Monthly / Weekly) */
.shell-nav-group {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.shell-nav-group > a.shell-nav-parent {
  padding-right: 2.1rem;
}

.shell-nav-group > a.shell-nav-parent::after {
  content: "";
  position: absolute;
  right: 0.65rem;
  top: 50%;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-70%) rotate(45deg);
  opacity: 0.6;
  transition: transform var(--vifc-duration) var(--vifc-ease-out);
}

.shell-nav-group:hover > a.shell-nav-parent::after,
.shell-nav-group:focus-within > a.shell-nav-parent::after {
  transform: translateY(-30%) rotate(225deg);
  opacity: 1;
}

.shell-nav-submenu {
  position: absolute;
  top: calc(100% - 2px);
  left: 0;
  min-width: 12rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--vifc-space-1);
  margin: 0;
  border-radius: var(--vifc-radius-md);
  background: color-mix(in srgb, var(--vifc-bg-surface) 96%, transparent);
  border: 1px solid var(--vifc-border-subtle);
  box-shadow: var(--vifc-shadow-md);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition:
    opacity var(--vifc-duration) var(--vifc-ease-out),
    transform var(--vifc-duration) var(--vifc-ease-out),
    visibility 0s linear var(--vifc-duration);
  z-index: 70;
}

.shell-nav-group:hover > .shell-nav-submenu,
.shell-nav-group:focus-within > .shell-nav-submenu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition:
    opacity var(--vifc-duration) var(--vifc-ease-out),
    transform var(--vifc-duration) var(--vifc-ease-out),
    visibility 0s linear 0s;
}

/* Desktop: invisible hit targets so the pointer never leaves the mega/submenu
   wrapper in the gap under the trigger (absolute children do not extend the
   parent's hover box). Omit on small screens where flyouts are static in-drawer. */
@media (min-width: 1024px) {
  .shell-nav-mega:has(> .shell-nav-mega-panel)::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 0.75rem;
    z-index: 69;
  }

  .shell-nav-group:has(> .shell-nav-submenu)::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 0.75rem;
    z-index: 69;
  }
}

.shell-nav-submenu a {
  padding: 0.5rem 0.75rem;
  font-size: var(--vifc-text-sm);
  border-radius: var(--vifc-radius-sm);
}

.shell-user {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--vifc-space-3);
  flex-wrap: wrap;
  font-size: var(--vifc-text-sm);
  color: var(--vifc-text-secondary);
  min-width: 0;
}

@keyframes shell-notif-bell {
  0%,
  100% {
    transform: rotate(0deg);
  }
  20% {
    transform: rotate(-10deg);
  }
  40% {
    transform: rotate(8deg);
  }
  60% {
    transform: rotate(-4deg);
  }
}

@keyframes shell-notif-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(232, 93, 93, 0.4);
  }
  50% {
    box-shadow: 0 0 0 0.3rem rgba(232, 93, 93, 0.15);
  }
}

.shell-notif {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 9999px;
  color: var(--vifc-text-secondary);
  text-decoration: none;
  border: 1px solid var(--vifc-border-default, rgba(255, 255, 255, 0.12));
  background: var(--vifc-bg-raised, #12151e);
  transition:
    color 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}

.shell-notif:hover,
.shell-notif:focus-visible {
  color: #5eead4;
  border-color: rgba(94, 234, 212, 0.35);
  background: #181c28;
  outline: none;
  box-shadow: var(--vifc-focus-ring, 0 0 0 2px rgba(94, 234, 212, 0.35));
}

.shell-notif.has-pending {
  color: #5eead4;
  animation: shell-notif-bell 0.65s ease-in-out 1;
}

.shell-notif.has-pending .shell-notif-bell {
  filter: drop-shadow(0 0 6px rgba(94, 234, 212, 0.4));
}

.shell-notif-bell {
  display: block;
  pointer-events: none;
}

.shell-notif-badge {
  position: absolute;
  top: 0.05rem;
  right: 0.05rem;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.2rem;
  line-height: 1.1rem;
  text-align: center;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #0f1115;
  background: linear-gradient(140deg, #5eead4, #2dd4bf);
  border-radius: 9px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  transform-origin: center;
  transition:
    transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.2s ease;
}

.shell-notif-badge.is-hidden {
  display: none;
}

.shell-notif.has-pending .shell-notif-badge {
  animation: shell-notif-pulse 1.4s ease-in-out infinite;
}

.shell-notif-badge::after {
  content: none;
}

.shell-user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 14rem;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  border-radius: var(--vifc-radius-sm);
  padding: 0.1rem 0.25rem;
  margin: -0.1rem -0.25rem;
}

.shell-user-name:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.shell-user-name:focus-visible {
  outline: none;
  box-shadow: var(--vifc-focus-ring);
}

.shell-user button {
  font-family: inherit;
  margin: 0;
  padding: 0.45rem 0.9rem;
  border-radius: var(--vifc-radius-sm);
  border: 1px solid var(--vifc-border-default);
  background: var(--vifc-bg-raised);
  color: var(--vifc-text);
  cursor: pointer;
  font-size: var(--vifc-text-sm);
  font-weight: 500;
  transition:
    background var(--vifc-duration) var(--vifc-ease-out),
    border-color var(--vifc-duration) var(--vifc-ease-out);
}

.shell-user button:hover {
  border-color: var(--vifc-border-strong);
  background: #181c28;
}

.shell-user button:focus-visible {
  outline: none;
  box-shadow: var(--vifc-focus-ring);
}

.shell-main {
  min-height: 0;
  position: relative;
}

.shell-home {
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  margin: 0;
  padding-top: var(--vifc-space-6);
  padding-bottom: max(var(--vifc-space-10), env(safe-area-inset-bottom, 0px));
  padding-left: max(var(--vifc-page-gutter-x), env(safe-area-inset-left, 0px));
  padding-right: max(var(--vifc-page-gutter-x), env(safe-area-inset-right, 0px));
}

.shell-home-hero {
  margin-bottom: var(--vifc-space-8);
}

.shell-home h1 {
  margin: 0 0 var(--vifc-space-2);
  font-size: clamp(1.5rem, 2.5vw, 1.875rem);
  font-weight: 650;
  letter-spacing: var(--vifc-tracking-tight);
  line-height: var(--vifc-leading-tight);
}

.shell-home-lead {
  color: var(--vifc-text-secondary);
  margin: 0;
  max-width: none;
  line-height: var(--vifc-leading-relaxed);
  font-size: var(--vifc-text-md);
}

.shell-home-tabstrip {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--vifc-space-2);
  margin-bottom: var(--vifc-space-5);
  padding: var(--vifc-space-1);
  border-radius: var(--vifc-radius-md);
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--vifc-border-subtle);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.shell-home-tabstrip::-webkit-scrollbar {
  height: 6px;
}

.shell-home-tabstrip::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

.shell-home-tab {
  font-family: inherit;
  font-size: var(--vifc-text-sm);
  font-weight: 600;
  letter-spacing: var(--vifc-tracking-tight);
  padding: 0.5rem 1rem;
  border-radius: var(--vifc-radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--vifc-text-secondary);
  cursor: pointer;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-sizing: border-box;
  transition:
    background var(--vifc-duration) var(--vifc-ease-out),
    color var(--vifc-duration) var(--vifc-ease-out),
    border-color var(--vifc-duration) var(--vifc-ease-out);
}

.shell-home-tab:hover {
  color: var(--vifc-text);
  background: rgba(255, 255, 255, 0.05);
}

.shell-home-tab[aria-selected="true"] {
  color: var(--vifc-text);
  background: rgba(45, 212, 191, 0.12);
  border-color: rgba(45, 212, 191, 0.35);
}

.shell-home-tab:focus-visible {
  outline: none;
  box-shadow: var(--vifc-focus-ring);
}

.shell-home-tabpanel {
  margin-bottom: var(--vifc-space-6);
}

.shell-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: var(--vifc-space-4);
}

/** Custom home URL cards are appended as children; wrapper must not break the grid. */
.shell-custom-home-links {
  display: contents;
}

.shell-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: var(--vifc-space-5);
  min-height: 10.5rem;
  background: var(--vifc-bg-surface);
  border: 1px solid var(--vifc-border-default);
  border-radius: var(--vifc-radius-lg);
  box-shadow: var(--vifc-shadow-xs), var(--vifc-shadow-sm);
  transition:
    border-color var(--vifc-duration) var(--vifc-ease-out),
    box-shadow var(--vifc-duration) var(--vifc-ease-out);
}

.shell-card:hover {
  border-color: rgba(45, 212, 191, 0.22);
  box-shadow: var(--vifc-shadow-xs), var(--vifc-shadow-md);
}

.shell-card h2 {
  margin: 0 0 var(--vifc-space-2);
  font-size: var(--vifc-text-md);
  font-weight: 600;
  letter-spacing: var(--vifc-tracking-tight);
}

.shell-card p {
  margin: 0 0 var(--vifc-space-4);
  font-size: var(--vifc-text-sm);
  color: var(--vifc-text-secondary);
  line-height: var(--vifc-leading-relaxed);
  flex: 1;
}

.shell-card a {
  align-self: flex-start;
  margin-top: auto;
  font-size: var(--vifc-text-sm);
  font-weight: 600;
  color: var(--vifc-accent-text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.shell-card a::after {
  content: "→";
  transition: transform var(--vifc-duration) var(--vifc-ease-out);
}

.shell-card a:hover::after {
  transform: translateX(3px);
}

.shell-card a:focus-visible {
  outline: none;
  border-radius: 4px;
  box-shadow: var(--vifc-focus-ring);
}

#widget-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: var(--vifc-bg-base);
}

.shell-main.frame-mode {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.shell-main.frame-mode .shell-home {
  display: none;
}

.shell-main.frame-mode #widget-frame {
  display: block;
  /* basis 0 so the iframe fills the main column instead of shrinking to ~150px intrinsic height */
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  height: auto;
  align-self: stretch;
}

.shell-main:not(.frame-mode) #widget-frame {
  display: none;
}

/* Burger + drawer: tablets & phones only (1024px+ = desktop horizontal nav). */
@media (max-width: 1023px) {
  .shell .shell-header {
    gap: var(--vifc-space-3);
    padding-top: max(var(--vifc-space-3), env(safe-area-inset-top, 0px));
    padding-bottom: var(--vifc-space-3);
    padding-left: max(var(--vifc-space-4), env(safe-area-inset-left, 0px));
    padding-right: max(var(--vifc-space-4), env(safe-area-inset-right, 0px));
  }

  .shell .shell-brand-wrap {
    flex: 1 1 auto;
  }

  .shell .shell-brand-kicker {
    display: none;
  }

  .shell .shell-burger {
    display: inline-flex;
    order: 3;
  }

  .shell .shell-header.shell-header--nav-empty .shell-burger {
    display: none !important;
  }

  .shell .shell-user {
    order: 2;
    gap: var(--vifc-space-2);
    flex: 0 0 auto;
    flex-wrap: nowrap;
  }

  .shell .shell-user-name {
    display: none;
  }

  .shell .shell-user button {
    padding: 0.4rem 0.7rem;
  }

  .shell .shell-nav {
    order: 4;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 60;
    flex-direction: column;
    align-items: stretch;
    gap: var(--vifc-space-1);
    padding: var(--vifc-space-3);
    margin: 0;
    border-radius: 0;
    background: color-mix(in srgb, var(--vifc-bg-surface) 96%, transparent);
    border: 0;
    border-bottom: 1px solid var(--vifc-border-subtle);
    box-shadow: var(--vifc-shadow-md);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-sizing: border-box;
    max-height: calc(100vh - 3.75rem);
    max-height: calc(100dvh - 3.75rem);
    overflow-y: auto;
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
      transform var(--vifc-duration) var(--vifc-ease-out),
      opacity var(--vifc-duration) var(--vifc-ease-out),
      visibility 0s linear var(--vifc-duration);
  }

  .shell .shell-nav.is-open {
    height: calc(100vh - 3.75rem);
    height: calc(100dvh - 3.75rem);
    max-height: calc(100vh - 3.75rem);
    max-height: calc(100dvh - 3.75rem);
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition:
      transform var(--vifc-duration) var(--vifc-ease-out),
      opacity var(--vifc-duration) var(--vifc-ease-out),
      visibility 0s linear 0s;
  }

  .shell .shell-nav a {
    padding: 0.75rem 0.85rem;
    font-size: var(--vifc-text-md);
  }

  /* In the burger drawer the submenu becomes indented children under the
     parent · hover is disabled since touch users expect them visible. */
  .shell .shell-nav-group {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .shell .shell-nav-group > a.shell-nav-parent {
    padding-right: 0.85rem;
  }

  .shell .shell-nav-group > a.shell-nav-parent::after {
    display: none;
  }

  .shell .shell-nav-submenu {
    position: static;
    opacity: 1;
    visibility: inherit;
    transform: none;
    min-width: 0;
    margin: 0 0 0 var(--vifc-space-3);
    padding: 0;
    gap: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    transition: none;
  }

  .shell .shell-nav-submenu a {
    padding: 0.6rem 0.85rem;
    font-size: var(--vifc-text-md);
  }

  .shell .shell-nav-mega {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  /* Buttons are not `.shell-nav a` · match link typography so section titles
     (Operations, Workspace, …) align with Home, Admin, and mega children. */
  .shell .shell-nav-mega-trigger {
    width: 100%;
    font-size: var(--vifc-text-md);
    font-weight: 500;
    letter-spacing: var(--vifc-tracking-tight);
    padding: 0.75rem 0.85rem;
  }

  .shell .shell-nav-mega:has(.shell-nav-mega-panel) .shell-nav-mega-trigger::after {
    display: none;
  }

  .shell .shell-nav-mega-panel {
    position: static;
    opacity: 1;
    visibility: inherit;
    transform: none;
    min-width: 0;
    max-width: none;
    margin: 0 0 0 var(--vifc-space-3);
    padding: 0 0 var(--vifc-space-2);
    background: transparent;
    border: 0;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    transition: none;
  }

  .shell .shell-nav-mega-cols {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .shell .shell-nav-mega-panel a {
    padding: 0.6rem 0.85rem;
    font-size: var(--vifc-text-md);
  }

  /* Hub category tabs: fixed 2×2 grid so tabs never wrap into uneven rows (was flex-wrap). */
  .shell .shell-home {
    padding-left: max(var(--vifc-page-gutter-x), env(safe-area-inset-left, 0px));
    padding-right: max(var(--vifc-page-gutter-x), env(safe-area-inset-right, 0px));
  }

  .shell .shell-home-tabstrip {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    overflow-x: visible;
    -webkit-overflow-scrolling: auto;
  }

  .shell .shell-home-tab {
    width: 100%;
    min-height: 2.75rem;
    flex: none;
    padding: 0.5rem 0.5rem;
  }

  @media (max-width: 380px) {
    .shell .shell-home-tab {
      font-size: var(--vifc-text-xs);
      padding: 0.45rem 0.35rem;
    }
  }

  /* Wider phones / tablets in the drawer range: restore context without crowding the header row */
  @media (min-width: 600px) and (max-width: 1023px) {
    .shell .shell-brand-kicker {
      display: block;
    }

    .shell .shell-user-name {
      display: inline;
      max-width: 11rem;
    }
  }

  @media (max-width: 420px) {
    .shell .shell-user button {
      font-size: var(--vifc-text-xs);
      padding: 0.4rem 0.55rem;
    }
  }
}

/* Hub home · predictable two-up cards on tablets; safe-area for notched tablets */
@media (min-width: 600px) and (max-width: 1023px) {
  .shell-home {
    padding-left: max(var(--vifc-page-gutter-x), env(safe-area-inset-left, 0px));
    padding-right: max(var(--vifc-page-gutter-x), env(safe-area-inset-right, 0px));
    padding-bottom: max(var(--vifc-space-10), env(safe-area-inset-bottom, 0px));
  }
}
