/**
 * ActivGate Shell UI
 * ==================
 * Three-column grid layout: Left Sidebar | Main Content | Right Sidebar
 * with a full-width sticky top bar spanning all columns.
 *
 * BEM block: .shell
 */

/* ========================================
 * SHELL VARIABLES
 * ======================================== */
:root {
  --shell-sidebar-w: 272px;
  --shell-sidebar-collapsed-w: 70px;
  --shell-aside-w: 300px;
  --shell-main-max: 900px;
  --shell-transition: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
 * SHELL GRID
 * ======================================== */
.shell {
  display: grid;
  grid-template-areas:
    "topbar  topbar  topbar"
    "sidebar main   aside";
  grid-template-columns: var(--shell-sidebar-w) 1fr var(--shell-aside-w);
  grid-template-rows: var(--ag-header-height) 1fr;
  min-height: 100vh;
  flex: 1 0 auto;
}

.shell--no-aside {
  grid-template-areas:
    "topbar  topbar"
    "sidebar main";
  grid-template-columns: var(--shell-sidebar-w) 1fr;
}

/* ========================================
 * TOPBAR (grid area)
 * ======================================== */
.shell__topbar {
  grid-area: topbar;
  position: sticky;
  top: 0;
  z-index: var(--ag-z-header);
  display: grid;
  grid-template-columns: 1fr minmax(0, 580px) 1fr;
  align-items: center;
  gap: 16px;
  height: var(--ag-header-height);
  padding: 0 var(--ag-space-lg);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--ag-color-border);
}

.shell__topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex-shrink: 0;
}

.shell__topbar-center {
  display: flex;
  justify-content: center;
  min-width: 0;
}

.shell__topbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.shell__search {
  width: 100%;
  position: relative;
}

.shell__search-input {
  width: 100%;
  height: 40px;
  padding: 0 16px 0 42px;
  border: 1px solid var(--ag-color-border);
  border-radius: var(--ag-radius-full);
  background: var(--ag-color-bg-surface-alt);
  font-size: var(--ag-font-size-base);
  color: var(--ag-color-text-body);
  outline: none;
  transition: border-color var(--ag-transition-normal),
              box-shadow var(--ag-transition-normal),
              background var(--ag-transition-normal);
}

.shell__search-input::placeholder {
  color: var(--ag-color-text-muted);
}

.shell__search-input:focus {
  border-color: var(--ag-color-brand-primary);
  background: var(--ag-color-bg-surface);
  box-shadow: var(--ag-shadow-focus);
}

.shell__search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ag-color-text-muted);
  font-size: 16px;
  pointer-events: none;
}

.shell__topbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--ag-radius-lg);
  border: 1px solid transparent;
  background: transparent;
  color: var(--ag-color-text-body);
  cursor: pointer;
  position: relative;
  font-size: 18px;
  transition: background var(--ag-transition-normal),
              border-color var(--ag-transition-normal),
              color var(--ag-transition-normal);
}

.shell__topbar-btn:hover {
  background: var(--ag-color-interactive-hover);
  border-color: var(--ag-color-border);
}

.shell__topbar-btn.is-active {
  color: var(--ag-color-brand-primary);
  background: var(--ag-color-brand-primary-softer);
  border-color: var(--ag-color-brand-primary-border);
}

.shell__topbar-btn.dropdown-toggle::after {
  display: none;
}

.shell__topbar-btn__badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--ag-radius-full);
  background: var(--ag-color-error);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  line-height: 16px;
  text-align: center;
}

.shell__sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--ag-radius-md);
  border: none;
  background: transparent;
  color: var(--ag-color-text-muted);
  cursor: pointer;
  font-size: 18px;
  transition: background var(--ag-transition-normal),
              color var(--ag-transition-normal);
}

.shell__sidebar-toggle:hover {
  background: var(--ag-color-interactive-hover);
  color: var(--ag-color-text-body);
}

/* ========================================
 * LEFT SIDEBAR
 * ======================================== */
.sidebar-left {
  grid-area: sidebar;
  position: sticky;
  top: var(--ag-header-height);
  height: calc(100vh - var(--ag-header-height));
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-right: 1px solid var(--ag-color-border);
  padding: var(--ag-space-md) var(--ag-space-sm);
  transition: width var(--shell-transition),
              padding var(--shell-transition);
  width: var(--shell-sidebar-w);
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.12) transparent;
}

.sidebar-left::-webkit-scrollbar {
  width: 4px;
}
.sidebar-left::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 4px;
}

.sidebar-left__section {
  margin-bottom: var(--ag-space-xs);
}

.sidebar-left__heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ag-color-text-muted);
  padding: var(--ag-space-sm) var(--ag-space-sm) var(--ag-space-xs);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--shell-transition);
}

.sidebar-left__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-left__item {
  margin-bottom: 2px;
}

.sidebar-left__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--ag-radius-lg);
  color: var(--ag-color-text-body);
  text-decoration: none;
  font-size: var(--ag-font-size-base);
  font-weight: 500;
  border: 1px solid transparent;
  transition: background var(--ag-transition-normal),
              border-color var(--ag-transition-normal),
              color var(--ag-transition-normal);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-left__link:hover {
  background: var(--ag-color-interactive-hover);
  border-color: rgba(46, 116, 184, 0.15);
  color: var(--ag-color-text-heading);
  text-decoration: none;
}

.sidebar-left__link.is-active {
  background: var(--ag-color-brand-primary-softer);
  border-color: var(--ag-color-brand-primary-border);
  color: var(--ag-color-brand-primary);
  font-weight: 600;
  position: relative;
}

.sidebar-left__link.is-active::before {
  content: "";
  position: absolute;
  left: -2px;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 2px;
  background: var(--ag-gradient-button);
}

.sidebar-left__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  min-width: 24px;
  height: 24px;
  font-size: 18px;
  color: inherit;
  flex-shrink: 0;
}

.sidebar-left__avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.sidebar-left__label {
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity var(--shell-transition),
              width var(--shell-transition);
}

/* ── Gamification widgets ── */
.sidebar-left__widgets {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 var(--ag-space-xs) var(--ag-space-xs);
  margin-bottom: var(--ag-space-xs);
  border-bottom: 1px solid var(--ag-color-border);
}

.sidebar-left__widget {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: var(--ag-radius-md);
  text-decoration: none;
  color: inherit;
  transition: background 0.12s ease;
}
.sidebar-left__widget:hover {
  background: rgba(0, 0, 0, 0.04);
  text-decoration: none;
  color: inherit;
}

.sidebar-left__widget-icon {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

.sidebar-left__widget-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.sidebar-left__widget-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--ag-color-text-primary, #1e293b);
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 4px;
}

.sidebar-left__widget-sub {
  font-size: 11px;
  color: var(--ag-color-text-muted);
  line-height: 1.3;
}

.sidebar-left__widget-bar {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--ag-color-border);
  overflow: hidden;
}
.sidebar-left__widget-fill {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #2563eb, #4f46e5);
  transition: width 0.6s ease;
}

.sidebar-left__aura-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.sidebar-left__widget-info {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--ag-color-border, #e2e8f0);
  background: transparent;
  color: var(--ag-color-text-muted, #94a3b8);
  font-size: 11px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
  position: relative;
}
.sidebar-left__widget-info:hover {
  border-color: #2563eb;
  color: #2563eb;
  background: rgba(37, 99, 235, 0.06);
}

.sidebar-left__widget-info.is-open {
  border-color: #2563eb;
  color: #2563eb;
  background: rgba(37, 99, 235, 0.06);
}

/* Popover rendered on <body> by JS */
.sidebar-info-popover {
  position: fixed;
  width: 240px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #1e293b;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  white-space: normal;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 99999;
  pointer-events: none;
}
.sidebar-info-popover::before {
  content: "";
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-right-color: #1e293b;
}

/* Hide widgets when sidebar is collapsed */
html.shell-preload-collapsed .sidebar-left__widgets,
.shell.is-collapsed .sidebar-left__widgets {
  display: none;
}

/* ========================================
 * STREAK RISK BANNER
 * ======================================== */
.streak-risk-banner {
  background: #fef3c7;
  border-bottom: 1px solid rgba(245, 158, 11, 0.2);
  padding: 10px 16px;
}
.streak-risk-banner--broken {
  background: #fef2f2;
  border-bottom-color: rgba(239, 68, 68, 0.2);
}
.streak-risk-banner__inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
}
.streak-risk-banner__icon { font-size: 16px; }
.streak-risk-banner__text { flex: 1; font-weight: 600; color: #92400e; }
.streak-risk-banner--broken .streak-risk-banner__text { color: #991b1b; }
.streak-risk-banner__btn {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  cursor: pointer;
}
.streak-risk-banner__btn--shield { background: #f59e0b; color: #fff; }
.streak-risk-banner__btn--shield:hover { background: #d97706; }
.streak-risk-banner__btn--dismiss {
  background: transparent;
  color: #92400e;
  border: 1px solid rgba(146, 64, 14, 0.2);
}

/* ========================================
 * MILESTONE TOAST
 * ======================================== */
.streak-milestone-toast {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 99999;
  animation: streak-toast-in 0.3s ease;
}
.streak-milestone-toast__inner {
  background: linear-gradient(135deg, #1e1b4b, #312e81);
  color: #fff;
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 12px;
}
.streak-milestone-toast__inner button {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 18px;
  cursor: pointer;
}
@keyframes streak-toast-in {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========================================
 * SIDEBAR WIDGET AT-RISK STATE
 * ======================================== */
.sidebar-left__widget--at-risk {
  animation: streak-pulse 1.5s ease-in-out infinite;
}
.sidebar-left__widget--at-risk .sidebar-left__widget-value { color: #d97706; }
.sidebar-left__widget--at-risk .sidebar-left__widget-sub { color: #b45309; font-weight: 700; }
@keyframes streak-pulse {
  0%, 100% { background: transparent; }
  50% { background: rgba(245, 158, 11, 0.08); }
}

/* ========================================
 * SIDEBAR WIDGET BROKEN STATE
 * ======================================== */
.sidebar-left__widget--broken { opacity: 0.5; }
.sidebar-left__widget--broken .sidebar-left__widget-value { color: var(--ag-color-text-muted); }

.sidebar-left__divider {
  height: 1px;
  background: var(--ag-color-border);
  margin: var(--ag-space-sm) var(--ag-space-sm);
}

.sidebar-left__footer {
  margin-top: auto;
  padding-top: var(--ag-space-sm);
  border-top: 1px solid var(--ag-color-border);
}

/* ========================================
 * SIDEBAR COLLAPSED STATE
 * ======================================== */
/* Pre-JS collapsed state (set by inline <head> script to prevent FOUC) */
html.shell-preload-collapsed .shell {
  grid-template-columns: var(--shell-sidebar-collapsed-w) 1fr var(--shell-aside-w);
}
html.shell-preload-collapsed .shell.shell--no-aside {
  grid-template-columns: var(--shell-sidebar-collapsed-w) 1fr;
}
html.shell-preload-collapsed .sidebar-left {
  width: var(--shell-sidebar-collapsed-w);
  padding: var(--ag-space-md) var(--ag-space-xs);
  align-items: center;
}
html.shell-preload-collapsed .sidebar-left__heading {
  opacity: 0; height: 0; padding: 0; margin: 0; overflow: hidden;
}
html.shell-preload-collapsed .sidebar-left__label {
  opacity: 0; width: 0; overflow: hidden;
}
html.shell-preload-collapsed .sidebar-left__link {
  justify-content: center; padding: 10px;
}

.shell.is-collapsed {
  grid-template-columns: var(--shell-sidebar-collapsed-w) 1fr var(--shell-aside-w);
}

.shell.is-collapsed.shell--no-aside {
  grid-template-columns: var(--shell-sidebar-collapsed-w) 1fr;
}

.shell.is-collapsed .sidebar-left {
  width: var(--shell-sidebar-collapsed-w);
  padding: var(--ag-space-md) var(--ag-space-xs);
  align-items: center;
}

.shell.is-collapsed .sidebar-left__heading {
  opacity: 0;
  height: 0;
  padding: 0;
  margin: 0;
  overflow: hidden;
}

.shell.is-collapsed .sidebar-left__label {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.shell.is-collapsed .sidebar-left__link {
  justify-content: center;
  padding: 10px;
}

.shell.is-collapsed .sidebar-left__link {
  position: relative;
}

.shell.is-collapsed .sidebar-left__link[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  padding: 4px 10px;
  border-radius: var(--ag-radius-md);
  background: var(--ag-color-brand-secondary);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  z-index: var(--ag-z-tooltip);
  box-shadow: var(--ag-shadow-md);
  pointer-events: none;
}

/* ========================================
 * MAIN CONTENT AREA
 * ======================================== */
.shell__main {
  grid-area: main;
  min-width: 0;
  padding: var(--ag-space-xl) var(--ag-space-lg);
}

.shell__main-inner {
  max-width: var(--shell-main-max);
  margin: 0 auto;
}

/* ========================================
 * RIGHT SIDEBAR (optional)
 * ======================================== */
.sidebar-right {
  grid-area: aside;
  position: sticky;
  top: var(--ag-header-height);
  height: calc(100vh - var(--ag-header-height));
  overflow-y: auto;
  padding: var(--ag-space-lg) var(--ag-space-md);
  border-left: 1px solid var(--ag-color-border);
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.08) transparent;
}

.sidebar-right__section {
  margin-bottom: var(--ag-space-xl);
}

.sidebar-right__heading {
  font-size: var(--ag-font-size-md);
  font-weight: 700;
  color: var(--ag-color-text-heading);
  margin: 0 0 var(--ag-space-md);
}

.sidebar-right__card {
  padding: var(--ag-space-md);
  border: 1px solid var(--ag-color-border);
  border-radius: var(--ag-radius-xl);
  background: var(--ag-color-bg-surface);
  margin-bottom: var(--ag-space-sm);
}

/* ========================================
 * FOCUS-VISIBLE ACCESSIBILITY
 * ======================================== */
.shell__topbar-btn:focus-visible,
.shell__sidebar-toggle:focus-visible,
.sidebar-left__link:focus-visible,
.shell__create-menu-item:focus-visible,
.shell__search-input:focus-visible {
  outline: 2px solid var(--ag-color-brand-primary);
  outline-offset: 2px;
}

/* ========================================
 * RESPONSIVE — MOBILE (< 992px)
 * ======================================== */
body.sidebar-open {
  overflow: hidden;
}

@media (max-width: 991px) {
  .shell,
  .shell.is-collapsed,
  .shell--no-aside,
  .shell.is-collapsed.shell--no-aside {
    grid-template-areas:
      "topbar"
      "main";
    grid-template-columns: 1fr;
  }

  .sidebar-right {
    display: none;
  }

  .sidebar-left {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    width: min(320px, 85vw);
    height: 100vh;
    padding-top: max(var(--ag-space-lg), var(--safe-top, 0px));
    padding-bottom: max(var(--ag-space-lg), var(--safe-bottom, 0px));
    transform: translateX(-102%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  html[dir="rtl"] .sidebar-left {
    left: auto;
    right: 0;
    transform: translateX(102%);
  }

  body.sidebar-open .sidebar-left {
    transform: translateX(0);
    box-shadow: 16px 0 48px rgba(15, 23, 42, 0.18);
  }

  html[dir="rtl"] body.sidebar-open .sidebar-left {
    box-shadow: -16px 0 48px rgba(15, 23, 42, 0.18);
  }

  .sidebar-left__heading {
    opacity: 1 !important;
    height: auto !important;
    padding: var(--ag-space-sm) var(--ag-space-sm) var(--ag-space-xs) !important;
  }

  .sidebar-left__label {
    opacity: 1 !important;
    width: auto !important;
  }

  .sidebar-left__link {
    justify-content: flex-start !important;
  }

  .shell__topbar {
    grid-template-columns: auto 1fr auto;
  }

  .shell__main {
    padding: var(--ag-space-md) var(--ag-space-sm);
  }

  /* Compact logo on mobile — hide full logo, show mountain icon */
  .brand-logo-wrap,
  .brand-text,
  .brand-mark {
    display: none !important;
  }
  .brand-icon-mobile {
    display: block !important;
  }
}

.shell__overlay {
  display: none;
}

@media (max-width: 991px) {
  .shell__overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  body.sidebar-open .shell__overlay {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (max-width: 575px) {
  .shell__topbar {
    padding: 0 var(--ag-space-sm);
    gap: 6px;
  }
  .shell__topbar-right {
    gap: 2px;
  }
  .shell__topbar-btn {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  /* Collapse search to icon on small phones */
  .shell__topbar-center {
    flex: 0 0 auto;
  }
  .shell__search-input {
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    background: transparent;
    font-size: 0;
    cursor: pointer;
  }
  .shell__search-input::placeholder {
    color: transparent;
  }
  .shell__search-icon {
    position: static;
    transform: none;
    pointer-events: none;
  }
  .shell__search {
    width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .shell__search-input:focus {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: var(--ag-header-height, 56px);
    padding: 0 16px 0 42px;
    border: none;
    border-bottom: 1px solid var(--ag-color-border);
    background: var(--ag-color-bg-surface);
    font-size: var(--ag-font-size-base);
    z-index: 9999;
    border-radius: 0;
  }
  .shell__search-input:focus::placeholder {
    color: var(--ag-color-text-muted);
  }
  .shell__search-input:focus + .shell__search-icon,
  .shell__search:has(.shell__search-input:focus) .shell__search-icon {
    position: fixed;
    left: 14px;
    top: calc(var(--ag-header-height, 56px) / 2);
    transform: translateY(-50%);
    z-index: 10000;
  }

  /* Ensure instant-search dropdown sits above the fixed search bar */
  .shell__search-input:focus ~ .omni-search-dropdown,
  .shell__search:has(.shell__search-input:focus) .omni-search-dropdown {
    position: fixed;
    top: var(--ag-header-height, 56px);
    left: 0;
    right: 0;
    width: 100%;
    max-height: 60vh;
    border-radius: 0 0 12px 12px;
    z-index: 10001;
    margin-top: 0;
  }
}

/* ========================================
 * PAGE-SIDEBAR MODE
 * On pages with their own sidebar, the global nav becomes an
 * overlay drawer on desktop — identical to the mobile pattern.
 * Activated by adding  shell--page-sidebar  to the .shell div.
 * ======================================== */
@media (min-width: 992px) {
  .shell.shell--page-sidebar,
  .shell.shell--page-sidebar.shell--no-aside {
    grid-template-areas:
      "topbar"
      "main";
    grid-template-columns: 1fr;
  }

  .shell--page-sidebar .sidebar-left {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    width: min(320px, 85vw);
    height: 100vh;
    padding-top: var(--ag-space-lg);
    transform: translateX(-102%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  html[dir="rtl"] .shell--page-sidebar .sidebar-left {
    left: auto;
    right: 0;
    transform: translateX(102%);
  }

  .shell--page-sidebar .sidebar-left__heading {
    opacity: 1 !important;
    height: auto !important;
    padding: var(--ag-space-sm) var(--ag-space-sm) var(--ag-space-xs) !important;
  }

  .shell--page-sidebar .sidebar-left__label {
    opacity: 1 !important;
    width: auto !important;
  }

  .shell--page-sidebar .sidebar-left__link {
    justify-content: flex-start !important;
  }

  body.sidebar-open .shell--page-sidebar .sidebar-left {
    transform: translateX(0);
    box-shadow: 16px 0 48px rgba(15, 23, 42, 0.18);
  }

  html[dir="rtl"] body.sidebar-open .shell--page-sidebar .sidebar-left {
    box-shadow: -16px 0 48px rgba(15, 23, 42, 0.18);
  }

  .shell--page-sidebar .shell__overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  body.sidebar-open .shell--page-sidebar .shell__overlay {
    opacity: 1;
    pointer-events: auto;
  }
}

/* ========================================
 * RESPONSIVE — TABLET (992px – 1279px)
 * ======================================== */
@media (min-width: 992px) and (max-width: 1279px) {
  .sidebar-right {
    display: none;
  }

  .shell:not(.shell--page-sidebar),
  .shell--no-aside:not(.shell--page-sidebar) {
    grid-template-areas:
      "topbar  topbar"
      "sidebar main";
    grid-template-columns: var(--shell-sidebar-w) 1fr;
  }

  .shell.is-collapsed:not(.shell--page-sidebar) {
    grid-template-columns: var(--shell-sidebar-collapsed-w) 1fr;
  }
}

/* ========================================
 * REDUCED MOTION
 * ======================================== */
@media (prefers-reduced-motion: reduce) {
  .sidebar-left,
  .sidebar-left__heading,
  .sidebar-left__label,
  .sidebar-left__partner-toggle-label,
  .shell__overlay {
    transition-duration: 0ms !important;
  }
}

/* ========================================
 * CREATE DROPDOWN (+ button in topbar)
 * ======================================== */
.shell__create-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: var(--ag-color-bg-surface);
  border: 1px solid var(--ag-color-border);
  border-radius: var(--ag-radius-xl);
  box-shadow: var(--ag-shadow-xl);
  padding: var(--ag-space-xs);
  z-index: var(--ag-z-dropdown);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity var(--ag-transition-fast),
              visibility var(--ag-transition-fast),
              transform var(--ag-transition-fast);
}

.shell__create-menu.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.shell__create-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: var(--ag-radius-md);
  background: transparent;
  color: var(--ag-color-text-body);
  font-size: var(--ag-font-size-base);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--ag-transition-fast);
}

.shell__create-menu-item:hover {
  background: var(--ag-color-interactive-hover);
  text-decoration: none;
}

.shell__create-menu-item i {
  font-size: 16px;
  color: var(--ag-color-text-muted);
}

.streak-profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
}
