/* ============================================================================
   Dashboard Shell — Command Center Aesthetic
   All values in rem (ZERO px). Dark-first, professional, colored accents.
   ============================================================================ */

/* --- Design Tokens --- */
:root {
  /* Surface palette */
  --dash-bg-primary: #0b0f19;
  --dash-bg-secondary: #111827;
  --dash-bg-tertiary: #1a2236;
  --dash-bg-elevated: #1f2a40;
  --dash-bg-hover: #253350;
  --dash-bg-active: #2d3f5f;

  /* Text palette */
  --dash-text-primary: #f1f5f9;
  --dash-text-secondary: #94a3b8;
  --dash-text-tertiary: #94a3b8;
  --dash-text-muted: #94a3b8;

  /* Accent colors for category icons */
  --icon-blue: #3b82f6;
  --icon-green: #22c55e;
  --icon-purple: #a855f7;
  --icon-amber: #f59e0b;
  --icon-rose: #f43f5e;
  --icon-teal: #14b8a6;
  --icon-indigo: #6366f1;
  --icon-cyan: #06b6d4;

  /* Accent glow (used for active states) */
  --icon-blue-glow: rgba(59, 130, 246, 0.15);
  --icon-green-glow: rgba(34, 197, 94, 0.15);
  --icon-purple-glow: rgba(168, 85, 247, 0.15);
  --icon-amber-glow: rgba(245, 158, 11, 0.15);
  --icon-rose-glow: rgba(244, 63, 94, 0.15);
  --icon-teal-glow: rgba(20, 184, 166, 0.15);

  /* Brand accent. Each token reads the site's generated theme first and keeps
     the historical fleet literal as its fallback, so a site that has not opted
     into shared-chrome theming computes byte-identically to before (the
     --site-* properties simply do not exist for it).
     --site-accent-fill (NOT --site-accent) is the text-bearing fill: it is
     luminance-clamped so --site-on-accent clears WCAG AA on top of it.
     See DOCS/NEW_WEBSITE_BUILD/SHARED_COMPONENT_THEMING_DESIGN.md §4. */
  --dash-accent: var(--site-accent-fill, #3b82f6);
  --dash-accent-hover: var(--site-accent-hover, #2563eb);
  --dash-accent-glow: var(--site-accent-glow, rgba(59, 130, 246, 0.2));

  /* Per-site brand mark gradient. No runtime writer: dashboard-shell.js only
     stamps data-site on <html>, which keys the brand-themes.css blocks; the
     bridge below prefers the hub-served --site-grad-* pair. The fallbacks
     reproduce the historical neutral mark, so an unopted site is visually
     unchanged. (The nav payload's brand.grad_start/grad_end fields have no
     consumer — do not "restore" a JS writer from them.) */
  --dash-brand-grad-start: var(--site-grad-start, var(--dash-accent));
  --dash-brand-grad-end: var(--site-grad-end, var(--icon-purple));

  /* Border */
  --dash-border: rgba(255, 255, 255, 0.06);
  --dash-border-hover: rgba(255, 255, 255, 0.12);

  /* Sizing */
  --header-height: 3.75rem;
  --sidebar-width: 17rem;
  --sidebar-collapsed: 4rem;
  --breadcrumb-height: 2.75rem;
  --touch-min: 2.75rem;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);

  /* Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;

  /* Shadows */
  --shadow-sm: 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.3);
  --shadow-md: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 1rem var(--dash-accent-glow);
}

/* --- Light Theme Override --- */
[data-theme="light"] {
  --dash-bg-primary: #f8fafc;
  --dash-bg-secondary: #ffffff;
  --dash-bg-tertiary: #f1f5f9;
  --dash-bg-elevated: #e2e8f0;
  --dash-bg-hover: #dbeafe;
  --dash-bg-active: #bfdbfe;
  --dash-text-primary: #0f172a;
  --dash-text-secondary: #475569;
  --dash-text-tertiary: #475569;
  --dash-text-muted: #475569;
  --dash-border: rgba(0, 0, 0, 0.08);
  --dash-border-hover: rgba(0, 0, 0, 0.15);
  --shadow-sm: 0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.08);
  --shadow-md: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.12);
}

/* --- Resets & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.dashboard-body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--dash-bg-primary);
  color: var(--dash-text-primary);
  min-height: 100vh;
  overflow: hidden;
}

/* --- Layout Container --- */
.dashboard-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Hidden until /auth/me has answered signed in, so a signed-out visitor goes to
   sign-in without seeing the shell first. dashboard.html ships the class and
   boot() in dashboard-shell.js removes it; the body keeps its theme background.
   Fail visible: the animation reveals the shell after 5s whatever the scripts
   did. Its !important must stay: the reduced-motion rule below sets
   `animation: none !important` on everything in .dashboard-body. */
body.shell-auth-pending .dashboard-container {
  visibility: hidden;
  animation: shell-auth-reveal 0s linear 5s forwards !important;
}

@keyframes shell-auth-reveal {
  to { visibility: visible; }
}

/* No scripts: nothing will ever answer, so do not wait for the timer. */
@media (scripting: none) {
  body.shell-auth-pending .dashboard-container { visibility: visible; }
}

.dashboard-main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ============================================================================
   TOP BAR / HEADER
   ============================================================================ */
.dashboard-header {
  display: flex;
  align-items: center;
  height: var(--header-height);
  background: var(--dash-bg-secondary);
  border-bottom: 0.0625rem solid var(--dash-border);
  padding: 0 1rem;
  position: relative;
  z-index: 50;
  flex-shrink: 0;
}

/* Left: Logo + site name */
.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: var(--sidebar-width);
  padding-right: 1rem;
  border-right: 0.0625rem solid var(--dash-border);
  height: 100%;
}

/* The brand is a link to the site's landing page (2026-10-08): keep it
   looking like the brand, not like a hyperlink. */
a.header-brand {
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius-md);
}

a.header-brand:focus-visible,
a.header-icon-btn:focus-visible {
  outline: 0.125rem solid var(--dash-accent, currentColor);
  outline-offset: 0.125rem;
}

a.header-icon-btn {
  text-decoration: none;
}

.header-brand-icon {
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--dash-brand-grad-start), var(--dash-brand-grad-end));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--site-on-grad, #fff);
  font-size: 0.875rem;
  flex-shrink: 0;
}

.header-brand-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--dash-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

/* The per-site WORDMARK gradient now lives in brand-themes.css, keyed by
   html[data-site=...], so every site's logo + title colors sit in one file.
   The brand-mark ICON above still reads --dash-brand-grad-* (which
   brand-themes.css sets per site); default sites keep the neutral values. */

/* Sidebar drawer: "Home page" + "Network sites" (2026-10-08). Phones only —
   the desktop header carries the same two controls; the @media (max-width:
   48rem) block below shows this row. */
.sidebar-site-links {
  display: none;
  flex-direction: column;
  gap: 0.125rem;
  padding: 0 0.75rem 0.5rem;
}

.sidebar-site-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-height: var(--touch-min);
  padding: 0 0.75rem;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--dash-text-secondary);
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.sidebar-site-link:hover {
  background: var(--dash-bg-hover);
  color: var(--dash-text-primary);
}

.sidebar-site-link[hidden] {
  display: none;
}

/* Center: Header menus */
.header-menus {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
  padding: 0 1.5rem;
}

.header-menu-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  min-height: var(--touch-min);
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  color: var(--dash-text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
  white-space: nowrap;
}

.header-menu-item:hover {
  background: var(--dash-bg-hover);
  color: var(--dash-text-primary);
}

.header-menu-item.active {
  background: var(--dash-accent-glow);
  color: var(--dash-accent);
}

.header-menu-item i {
  font-size: 0.875rem;
}

.header-menu-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  min-width: 12rem;
  background: var(--dash-bg-elevated);
  border: 0.0625rem solid var(--dash-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 0.375rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-0.5rem);
  transition: all var(--transition-normal);
  z-index: 100;
}

.header-menu-item:focus-within .header-menu-dropdown,
.header-menu-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Visible at once when opening, so the keyboard can focus its first item
   (an item is not focusable while visibility is still hidden mid-transition). */
.header-menu-dropdown.open {
  transition: opacity var(--transition-normal), transform var(--transition-normal),
              visibility 0s;
}

/* Header fit (dashboard-shell.js _fitHeaderMenus): menus that do not fit
   beside the actions first lose their icons and the user name, then show
   icon-only items (label kept for screen readers and as a tooltip). */
.dashboard-header.header-menus-compact .header-menus .header-menu-item > i:first-child,
.dashboard-header.header-menus-compact .header-user .user-name {
  display: none;
}

.dashboard-header.header-menus-compact .header-menus {
  padding: 0 0.5rem;
}

.dashboard-header.header-menus-compact .header-menus .header-menu-item {
  padding: 0.5rem 0.5rem;
}

.dashboard-header.header-menus-iconic .header-menus .header-menu-item.has-icon > i:first-child {
  display: inline-block;
}

.dashboard-header.header-menus-iconic .header-menus .header-menu-item.has-icon > span {
  position: absolute;
  width: 0.0625rem;
  height: 0.0625rem;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  min-height: var(--touch-min);
  border-radius: var(--radius-sm);
  color: var(--dash-text-secondary);
  font-size: 0.8125rem;
  text-decoration: none;
  cursor: pointer;
  /* Not `all`: an inherited visibility change would itself transition, leaving
     the item unfocusable for a frame when its menu opens from the keyboard. */
  transition: background-color var(--transition-fast), color var(--transition-fast);
  border: none;
  background: none;
  width: 100%;
  font-family: inherit;
}

.dropdown-item:hover {
  background: var(--dash-bg-hover);
  color: var(--dash-text-primary);
}

.dropdown-item i {
  width: 1.125rem;
  text-align: center;
  font-size: 0.8125rem;
}

/* Right: Header icons + user avatar */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

/* The network-overlay globe ships hidden; .header-icon-btn's display:flex
   would otherwise override the attribute. dashboard-shell.js unhides it on
   a site that serves SHARED_NETWORK_OVERLAY. */
#otrotl-network-btn[hidden] {
  display: none !important;
}

.header-icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-min);
  height: var(--touch-min);
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  color: var(--dash-text-secondary);
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.header-icon-btn:hover {
  background: var(--dash-bg-hover);
  color: var(--dash-text-primary);
}

/* Colored icon variants */
.header-icon-btn[data-color="blue"] { color: var(--icon-blue); }
.header-icon-btn[data-color="green"] { color: var(--icon-green); }
.header-icon-btn[data-color="purple"] { color: var(--icon-purple); }
.header-icon-btn[data-color="amber"] { color: var(--icon-amber); }
.header-icon-btn[data-color="rose"] { color: var(--icon-rose); }
.header-icon-btn[data-color="teal"] { color: var(--icon-teal); }

/* Badge on icons */
.icon-badge {
  position: absolute;
  top: 0.375rem;
  right: 0.375rem;
  min-width: 1.125rem;
  height: 1.125rem;
  border-radius: 999rem;
  background: var(--icon-rose);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.25rem;
  border: 0.125rem solid var(--dash-bg-secondary);
  line-height: 1;
}

.icon-badge.dot {
  min-width: 0.5rem;
  height: 0.5rem;
  padding: 0;
  top: 0.5rem;
  right: 0.5rem;
}

/* Theme toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-min);
  height: var(--touch-min);
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  color: var(--icon-amber);
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.theme-toggle:hover {
  background: var(--dash-bg-hover);
}

/* User avatar */
.header-user {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.375rem 0.625rem;
  margin-left: 0.5rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  background: none;
  min-height: var(--touch-min);
}

.header-user:hover {
  background: var(--dash-bg-hover);
}

.user-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--icon-teal), var(--icon-blue));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.user-name {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--dash-text-primary);
  max-width: 8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* User dropdown */
.user-dropdown {
  position: absolute;
  top: calc(var(--header-height) - 0.25rem);
  right: 0.75rem;
  width: 14rem;
  background: var(--dash-bg-elevated);
  border: 0.0625rem solid var(--dash-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 0.375rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-0.5rem);
  transition: all var(--transition-normal);
  z-index: 100;
}

.user-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-dropdown-header {
  padding: 0.75rem;
  border-bottom: 0.0625rem solid var(--dash-border);
  margin-bottom: 0.25rem;
}

.user-dropdown-email {
  font-size: 0.75rem;
  color: var(--dash-text-tertiary);
  margin-top: 0.125rem;
}

.user-dropdown-role {
  display: inline-block;
  margin-top: 0.375rem;
  padding: 0.125rem 0.5rem;
  border-radius: 999rem;
  background: var(--dash-accent-glow);
  color: var(--dash-accent);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ============================================================================
   SIDEBAR
   ============================================================================ */
.dashboard-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--dash-bg-secondary);
  border-right: 0.0625rem solid var(--dash-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width var(--transition-smooth), min-width var(--transition-smooth);
  position: relative;
  z-index: 40;
}

.dashboard-sidebar.collapsed {
  width: var(--sidebar-collapsed);
  min-width: var(--sidebar-collapsed);
}

/* Sidebar toggle */
.sidebar-toggle {
  position: absolute;
  top: 0.75rem;
  right: -0.875rem;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--dash-bg-elevated);
  border: 0.0625rem solid var(--dash-border);
  color: var(--dash-text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 60;
  font-size: 0.625rem;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.sidebar-toggle:hover {
  background: var(--dash-bg-hover);
  color: var(--dash-text-primary);
  border-color: var(--dash-border-hover);
}

.sidebar-toggle i {
  transition: transform var(--transition-normal);
}

.dashboard-sidebar.collapsed .sidebar-toggle i {
  transform: rotate(180deg);
}

/* Search box */
.sidebar-search {
  padding: 0.75rem;
  border-bottom: 0.0625rem solid var(--dash-border);
  flex-shrink: 0;
}

.sidebar-search-input {
  width: 100%;
  height: var(--touch-min);
  padding: 0 0.75rem 0 2.25rem;
  background: var(--dash-bg-tertiary);
  border: 0.0625rem solid var(--dash-border);
  border-radius: var(--radius-md);
  color: var(--dash-text-primary);
  font-size: 0.8125rem;
  font-family: inherit;
  outline: none;
  transition: all var(--transition-fast);
}

.sidebar-search-input::placeholder {
  color: var(--dash-text-muted);
}

.sidebar-search-input:focus {
  border-color: var(--dash-accent);
  box-shadow: 0 0 0 0.1875rem var(--dash-accent-glow);
}

.sidebar-search-wrapper {
  position: relative;
}

.sidebar-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--dash-text-muted);
  font-size: 0.8125rem;
  pointer-events: none;
}

.dashboard-sidebar.collapsed .sidebar-search {
  display: none;
}

/* Search suggestions listbox (opt-in; dashboard-shell.js _bindNavSuggestions).
   Colours come from the theme tokens, so light and dark both follow
   [data-theme]. */
.sidebar-search-list {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 20rem;
  overflow-y: auto;
  list-style: none;
  padding: 0.25rem;
  background: var(--dash-bg-secondary);
  border: 0.0625rem solid var(--dash-border-hover, var(--dash-border));
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.sidebar-search-list[hidden] {
  display: none;
}

.sidebar-search-heading {
  padding: 0.375rem 0.5rem 0.25rem;
  color: var(--dash-text-muted);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-search-option {
  display: block;
  padding: 0.4375rem 0.5rem;
  border-radius: var(--radius-sm, 0.375rem);
  color: var(--dash-text-primary);
  font-size: 0.8125rem;
  line-height: 1.3;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-search-option:hover,
.sidebar-search-option.active {
  background: var(--dash-bg-hover);
}

.sidebar-search-crumb {
  color: var(--dash-text-muted);
  font-size: 0.75rem;
}

.sidebar-search-mark {
  background: var(--dash-accent-glow);
  color: inherit;
  border-radius: 0.125rem;
  font-weight: 600;
}

.sidebar-search-empty {
  padding: 0.5rem;
  color: var(--dash-text-muted);
  font-size: 0.8125rem;
}

/* Navigation tree */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--dash-bg-hover) transparent;
}

.sidebar-nav::-webkit-scrollbar {
  width: 0.375rem;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--dash-bg-hover);
  border-radius: 999rem;
}

/* Category */
.sidebar-category {
  margin-bottom: 0.25rem;
}

.category-header {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.625rem;
  min-height: var(--touch-min);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  background: none;
  width: 100%;
  font-family: inherit;
  text-align: left;
}

.category-header:hover {
  background: var(--dash-bg-hover);
}

.category-icon {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

/* Colored category icons with subtle background */
.category-icon[data-color="blue"] { color: var(--icon-blue); background: var(--icon-blue-glow); }
.category-icon[data-color="green"] { color: var(--icon-green); background: var(--icon-green-glow); }
.category-icon[data-color="purple"] { color: var(--icon-purple); background: var(--icon-purple-glow); }
.category-icon[data-color="amber"] { color: var(--icon-amber); background: var(--icon-amber-glow); }
.category-icon[data-color="rose"] { color: var(--icon-rose); background: var(--icon-rose-glow); }
.category-icon[data-color="teal"] { color: var(--icon-teal); background: var(--icon-teal-glow); }

.category-name {
  flex: 1;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--dash-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-chevron {
  font-size: 0.625rem;
  color: var(--dash-text-muted);
  transition: transform var(--transition-normal);
  flex-shrink: 0;
}

.sidebar-category.expanded .category-chevron {
  transform: rotate(180deg);
}

/* Category apps list */
.category-apps {
  overflow: hidden;
  max-height: 0;
  transition: max-height var(--transition-smooth);
}

.sidebar-category.expanded .category-apps {
  max-height: 62.5rem;
}

/* App link */
.app-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.4375rem 0.625rem 0.4375rem 2.875rem;
  min-height: var(--touch-min);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  font-family: inherit;
  text-align: left;
}

.app-link:hover {
  background: var(--dash-bg-hover);
}

.app-link.active {
  background: var(--dash-accent-glow);
}

.app-link-icon {
  font-size: 0.875rem;
  color: var(--dash-text-tertiary);
  width: 1.125rem;
  text-align: center;
  flex-shrink: 0;
  transition: color var(--transition-fast);
}

.app-link.active .app-link-icon {
  color: var(--dash-accent);
}

.app-link-name {
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--dash-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--transition-fast);
}

.app-link:hover .app-link-name {
  color: var(--dash-text-primary);
}

.app-link.active .app-link-name {
  color: var(--dash-accent);
  font-weight: 500;
}

/* Active indicator bar */
.app-link.active::before {
  content: '';
  position: absolute;
  left: 0.375rem;
  top: 50%;
  transform: translateY(-50%);
  width: 0.1875rem;
  height: 1.25rem;
  border-radius: 999rem;
  background: var(--dash-accent);
}

.app-link {
  position: relative;
}

/* Collapsed sidebar: icon-only mode */
.dashboard-sidebar.collapsed .category-name,
.dashboard-sidebar.collapsed .category-chevron,
.dashboard-sidebar.collapsed .app-link-name {
  display: none;
}

.dashboard-sidebar.collapsed .category-header {
  justify-content: center;
  padding: 0.5rem;
}

.dashboard-sidebar.collapsed .app-link {
  padding: 0.5rem;
  justify-content: center;
}

.dashboard-sidebar.collapsed .category-apps {
  max-height: none !important;
}

.dashboard-sidebar.collapsed .sidebar-category.expanded .category-apps {
  max-height: 62.5rem;
}

/* ============================================================================
   WORKSPACE (Right Pane)
   ============================================================================ */
.dashboard-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--dash-bg-primary);
}

/* Breadcrumb bar */
.workspace-breadcrumb {
  display: flex;
  align-items: center;
  height: var(--breadcrumb-height);
  padding: 0 1.25rem;
  background: var(--dash-bg-secondary);
  border-bottom: 0.0625rem solid var(--dash-border);
  flex-shrink: 0;
  gap: 0.5rem;
}

.breadcrumb-item {
  font-size: 0.8125rem;
  color: var(--dash-text-tertiary);
}

.breadcrumb-item.current {
  color: var(--dash-text-primary);
  font-weight: 500;
}

.breadcrumb-separator {
  font-size: 0.625rem;
  color: var(--dash-text-muted);
}

/* Content area */
.workspace-content {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.content-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: var(--dash-bg-primary);
}

/* ============================================================================
   FULL-BLEED WORKSPACE — page-declared opt-out of the shell's repeated chrome
   (tools-shared-portal docs/plans/2026-09-28-browse-chrome-compaction-design.md
   §3.5, plus the owner's 2026-09-28 sidebar decision).

   content-loader.js adds .is-full-bleed to .dashboard-workspace when the
   SAME-ORIGIN framed page declares <meta name="otrotl-workspace"
   content="full-bleed">, and .has-workspace-home while the "My work" toggle
   that lives inside the bar is visible (the bar then stays, or that control
   would be lost). dashboard-shell.js adds .is-full-bleed to .dashboard-main on
   desktop and forces the sidebar to its icon rail (.collapsed); .is-peek is the
   transient text+icons overlay. Every rule is scoped to those classes, so a
   page without the meta computes byte-identically to before. Classes only —
   no inline styles (strict-CSP sites drop them, see CSP-SAFE LAYOUT below).
   ============================================================================ */
.dashboard-workspace.is-full-bleed:not(.has-workspace-home) .workspace-breadcrumb {
  display: none;
}

@media (min-width: 48.0625rem) {
  /* The rail leaves the flex flow so an expansion overlays the workspace
     instead of reflowing it: the iframe stays at (main width - 4rem) in both
     states. ::before holds the rail's 4rem footprint. */
  .dashboard-main.is-full-bleed {
    position: relative;
  }

  .dashboard-main.is-full-bleed::before {
    content: '';
    flex: 0 0 var(--sidebar-collapsed);
  }

  .dashboard-main.is-full-bleed > .dashboard-sidebar {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--sidebar-collapsed);
    min-width: var(--sidebar-collapsed);
  }

  .dashboard-main.is-full-bleed > .dashboard-sidebar.is-peek {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    box-shadow: var(--shadow-lg);
  }
}

/* ============================================================================
   CSP-SAFE LAYOUT — rules that used to live in style="..." on dashboard.html

   Strict-CSP sites serve `style-src 'self'` with no 'unsafe-inline' and no
   nonce (RetirePlusPlus, wave30). Browsers DISCARD every style attribute on
   such a page — silently, with only a console warning.

   #headerIcons was the severe case: it had NO rule in any stylesheet, so the
   attribute was its only layout. Without it the container computed to
   display:block and its four .header-icon-btn children (each 2.75rem, itself
   display:flex, so block-level here) stacked into a ~11rem column. Centred in
   a 3.75rem header by .header-actions, that column overflowed above and below
   the header — surfacing as three "floating widgets" (the fourth clipped
   off-screen) piled over the breadcrumb.

   DO NOT reintroduce inline styles on the shared shell pages. Every value
   below is byte-identical to the attribute it replaces, and each selector
   outranks any existing rule for the same property, so sites that DO allow
   inline styles compute exactly as before.
   ============================================================================ */
#headerIcons {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

/* Hidden until the shell populates them (was style="display:none"). ID
   selectors so the shared .breadcrumb-separator / .content-iframe classes keep
   working for every other element that uses them. JS still unhides via
   element.style, which outranks these. */
#breadcrumbSeparator,
#appFrame {
  display: none;
}

/* User menu: the dropdown's name line overrides the compact .user-name used in
   the header button, so it must outrank .user-name (ID does). */
#dropdownUserName {
  display: block;
  max-width: none;
  font-weight: 600;
  font-size: 0.875rem;
}

.user-chevron {
  font-size: 0.625rem;
  color: var(--dash-text-muted);
}

.dropdown-item[data-action="logout"] {
  color: var(--icon-rose);
}

/* Notifications modal */
#notifModalTitle {
  font-size: 1rem;
  font-weight: 600;
}

.notif-empty {
  color: var(--dash-text-tertiary);
  font-size: 0.875rem;
}

/* Muted variant of .error-retry-btn used as the modal's Close button. Also
   keeps its ink tokenised rather than reverting to the accent button's ink. */
#closeNotifModalBtn {
  background: var(--dash-bg-hover);
  color: var(--dash-text-secondary);
}

/* Loading overlay */
.workspace-loading {
  position: absolute;
  inset: 0;
  background: var(--dash-bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  z-index: 30;
  transition: opacity var(--transition-normal);
}

.workspace-loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-spinner {
  width: 2.5rem;
  height: 2.5rem;
  border: 0.1875rem solid var(--dash-border);
  border-top-color: var(--dash-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: 0.8125rem;
  color: var(--dash-text-tertiary);
}

/* Error state */
.workspace-error {
  position: absolute;
  inset: 0;
  background: var(--dash-bg-primary);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  z-index: 25;
}

.workspace-error.visible {
  display: flex;
}

.error-icon {
  font-size: 2.5rem;
  color: var(--icon-rose);
}

.error-message {
  font-size: 0.875rem;
  color: var(--dash-text-secondary);
  text-align: center;
  max-width: 20rem;
}

.error-retry-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  min-height: var(--touch-min);
  border-radius: var(--radius-md);
  background: var(--dash-accent);
  color: var(--site-on-accent, #fff);
  border: none;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition-fast);
}

.error-retry-btn:hover {
  background: var(--dash-accent-hover);
  box-shadow: var(--shadow-glow);
}

/* Empty state / Not provisioned */
.workspace-empty {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  text-align: center;
  padding: 2rem;
}

.workspace-empty.visible {
  display: flex;
}

.empty-icon {
  font-size: 3rem;
  color: var(--dash-text-muted);
}

.empty-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--dash-text-primary);
}

.empty-description {
  font-size: 0.875rem;
  color: var(--dash-text-tertiary);
  max-width: 24rem;
}

/* ============================================================================
   MODALS (85vh max, scrollable body, fixed header/footer)
   ============================================================================ */
.dash-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(0.25rem);
}

.dash-modal-overlay.open {
  display: flex;
}

.dash-modal {
  background: var(--dash-bg-secondary);
  border: 0.0625rem solid var(--dash-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 32rem;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dash-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 0.0625rem solid var(--dash-border);
  flex-shrink: 0;
}

.dash-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
}

.dash-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  border-top: 0.0625rem solid var(--dash-border);
  flex-shrink: 0;
}

/* ============================================================================
   RESPONSIVE — Mobile first (22.5rem / 360px min)
   ============================================================================ */

/* Mobile: sidebar becomes slide-over drawer */
@media (max-width: 48rem) {
  .dashboard-sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    z-index: 90;
    transform: translateX(-100%);
    transition: transform var(--transition-smooth);
    box-shadow: var(--shadow-lg);
  }

  .dashboard-sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-toggle {
    display: none;
  }

  .mobile-sidebar-toggle {
    display: flex;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    top: var(--header-height);
    background: rgba(0, 0, 0, 0.5);
    z-index: 85;
    display: none;
  }

  .sidebar-backdrop.visible {
    display: block;
  }

  .header-brand {
    min-width: auto;
    border-right: none;
    padding-right: 0.5rem;
  }

  .header-brand-name {
    display: none;
  }

  .user-name {
    display: none;
  }

  .header-menus {
    display: none;
  }

  /* Phone header (2026-10-08): the house and the globe move into the
     sidebar drawer (.sidebar-site-links below), so this header keeps exactly
     the controls it had — the fleet's 3–7 DB header icons already fill a
     375px screen, and a globe here pushed the avatar off it (QA, PR #56). The
     brand icon stays visible and is itself the home link. */
  #siteHomeLink,
  #otrotl-network-btn {
    display: none;
  }

  .sidebar-site-links {
    display: flex;
  }
}

/* Desktop: hide mobile toggle */
@media (min-width: 48.0625rem) {
  .mobile-sidebar-toggle {
    display: none;
  }

  .sidebar-backdrop {
    display: none !important;
  }
}

/* ============================================================================
   ANIMATIONS — AOS-compatible entrance animations
   ============================================================================ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(0.75rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.animate-fade-in-up {
  animation: fadeInUp 0.4s ease forwards;
}

.animate-fade-in {
  animation: fadeIn 0.3s ease forwards;
}

/* Staggered entrance for sidebar categories */
.sidebar-category:nth-child(1) { animation-delay: 0.05s; }
.sidebar-category:nth-child(2) { animation-delay: 0.1s; }
.sidebar-category:nth-child(3) { animation-delay: 0.15s; }
.sidebar-category:nth-child(4) { animation-delay: 0.2s; }
.sidebar-category:nth-child(5) { animation-delay: 0.25s; }
.sidebar-category:nth-child(6) { animation-delay: 0.3s; }

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */
.sr-only {
  position: absolute;
  width: 0.0625rem;
  height: 0.0625rem;
  padding: 0;
  margin: -0.0625rem;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── App Store Right Sidebar ────────────────────────────────────── */

.app-store-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}

.app-store-overlay.is-visible,
.app-store-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.app-store-sidebar {
    position: fixed;
    top: var(--header-height);
    right: 0;
    bottom: 0;
    width: 17rem;
    background: var(--dash-bg-secondary);
    border-left: 0.0625rem solid var(--dash-border);
    transform: translateX(100%);
    transition: transform var(--transition-smooth);
    z-index: 95;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.app-store-sidebar.is-open,
.app-store-sidebar.open {
    transform: translateX(0);
}

.app-store-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 0.0625rem solid var(--dash-border);
    flex-shrink: 0;
}

.app-store-header h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--dash-text-primary);
    margin: 0;
}

.app-store-close {
    min-width: 2.75rem;
    min-height: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--dash-text-secondary);
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.app-store-close:hover {
    background: var(--dash-bg-hover);
    color: var(--dash-text-primary);
}

.app-store-content {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.app-store-search {
    padding: 0.5rem;
    position: relative;
}

.app-store-search-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--dash-text-muted);
    width: 1rem;
    height: 1rem;
    pointer-events: none;
}

.app-store-search-input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    background: var(--dash-bg-tertiary);
    border: 0.0625rem solid var(--dash-border);
    border-radius: 0.375rem;
    color: var(--dash-text-primary);
    font-size: 0.8125rem;
    outline: none;
    transition: border-color var(--transition-fast);
}

.app-store-search-input:focus {
    border-color: var(--dash-accent);
    box-shadow: 0 0 0 0.1875rem var(--dash-accent-glow);
}

.app-store-search-input::placeholder {
    color: var(--dash-text-muted);
}

.app-store-category {
    margin-bottom: 0.25rem;
}

.app-store-category-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    min-height: 2.75rem;
    background: transparent;
    border: none;
    color: var(--dash-text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.app-store-category-header:hover {
    color: var(--dash-text-primary);
}

.app-store-category-chevron,
.app-store-chevron {
    width: 0.875rem;
    height: 0.875rem;
    transition: transform var(--transition-normal);
}

.app-store-category:not(.expanded) .app-store-category-chevron,
.app-store-chevron.rotated {
    transform: rotate(-90deg);
}

.app-store-category-items,
.app-store-app-list {
    overflow: hidden;
    transition: max-height var(--transition-normal);
}

.app-store-category:not(.expanded) .app-store-category-items,
.app-store-app-list.collapsed {
    max-height: 0 !important;
    overflow: hidden;
}

.app-store-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem 0.375rem 1.75rem;
    min-height: 2.75rem;
    border-radius: 0.375rem;
    transition: background var(--transition-fast);
}

.app-store-item:hover {
    background: var(--dash-bg-hover);
}

.app-store-item-icon {
    width: 1rem;
    height: 1rem;
    color: var(--dash-text-secondary);
    flex-shrink: 0;
}

.app-store-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.app-store-item-name {
    font-size: 0.8125rem;
    color: var(--dash-text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-store-item-desc {
    font-size: 0.6875rem;
    color: var(--dash-text-tertiary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-store-btn {
    min-width: 3.75rem;
    min-height: 2rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.6875rem;
    font-weight: 500;
    cursor: pointer;
    border: 0.0625rem solid transparent;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.app-store-btn-add,
.app-store-btn.add {
    background: transparent;
    border-color: var(--dash-accent);
    color: var(--dash-accent);
}

.app-store-btn-add:hover,
.app-store-btn.add:hover {
    background: var(--dash-accent-glow);
}

.app-store-btn-added,
.app-store-btn.added {
    background: var(--icon-green-glow);
    border-color: var(--icon-green);
    color: var(--icon-green);
}

.app-store-btn-added:hover,
.app-store-btn.added:hover {
    background: var(--icon-rose-glow);
    border-color: var(--icon-rose);
    color: var(--icon-rose);
}

.app-store-badge,
.app-store-badge-pinned {
    font-size: 0.6875rem;
    font-weight: 500;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    flex-shrink: 0;
}

.app-store-badge-pinned,
.app-store-badge.mandatory {
    background: var(--icon-amber-glow);
    color: var(--icon-amber);
}

.app-store-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--dash-text-muted);
    font-size: 0.8125rem;
}

[data-theme="light"] .app-store-sidebar {
    background: var(--dash-bg-secondary);
}

[data-theme="light"] .app-store-search-input {
    background: var(--dash-bg-primary);
}

@media (max-width: 48rem) {
    .app-store-sidebar {
        width: 100%;
    }
}

/* ============================================================================
   PLATFORM TOOLS DROPDOWN
   ============================================================================ */
.platform-tools-dropdown {
  position: relative;
}

.platform-tools-menu {
  position: absolute;
  top: calc(var(--header-height) - 0.5rem);
  right: 0;
  width: 20rem;
  background: var(--dash-bg-elevated);
  border: 0.0625rem solid var(--dash-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-0.5rem) scale(0.97);
  transition: opacity var(--transition-normal),
              visibility var(--transition-normal),
              transform var(--transition-normal);
  z-index: 100;
}

.platform-tools-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.platform-tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.25rem;
}

.platform-tool-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  padding: 0.75rem 0.5rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--dash-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.platform-tool-item:hover {
  background: var(--dash-bg-hover);
  color: var(--dash-text-primary);
}

.platform-tool-item:hover .platform-tool-icon {
  color: var(--dash-accent);
  transform: scale(1.1);
}

.platform-tool-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
  background: var(--dash-bg-tertiary);
  font-size: 1.125rem;
  color: var(--dash-text-secondary);
  transition: all var(--transition-fast);
}

.platform-tool-label {
  font-size: 0.6875rem;
  font-weight: 500;
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Responsive: 2 columns on narrow screens */
@media (max-width: 30rem) {
  .platform-tools-menu {
    width: 14rem;
    right: -2rem;
  }
  .platform-tools-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
/* Workspace overlays share the shell palette and preserve partner accents. */
.workspace-ask-toggle { width: auto; padding: 0 .75rem; gap: .5rem; font-size: .75rem; }
.workspace-home-toggle { min-height: 2.75rem; border: 0; background: transparent; color: var(--dash-text-primary); padding: 0 .75rem 0 0; font: inherit; cursor: pointer; font-weight: 600; }
.workspace-ask-dialog { width: min(38rem, calc(100% - 1.5rem)); height: 85vh; height: 85dvh; max-height: 85vh; max-height: 85dvh; padding: 0; margin: auto 1rem auto auto; border: .0625rem solid var(--dash-border-hover); border-radius: .75rem; color: var(--dash-text-primary); background: var(--dash-bg-secondary); }
.workspace-ask-dialog[open] { display: flex; flex-direction: column; }
.workspace-ask-dialog::backdrop { background: rgba(0,0,0,.6); }
.workspace-ask-head { flex-shrink: 0; padding: .75rem 1rem; display: flex; justify-content: space-between; align-items: center; border-bottom: .0625rem solid var(--dash-border); }
.workspace-ask-head h2 { font-size: 1rem; font-weight: 600; }
#workspaceAskFrame { border: 0; width: 100%; flex: 1; min-height: 0; }
.dashboard-body :focus-visible { outline: .1875rem solid var(--dash-text-primary); outline-offset: .125rem; }
.dash-modal { max-height: 85vh; max-height: 85dvh; }
.dash-modal-header, .dash-modal-footer { flex-shrink: 0; }
@media (max-width: 47.9375rem) { .workspace-ask-toggle span { display: none; } .workspace-ask-dialog { margin: auto; } }
@media (prefers-reduced-motion: reduce) { .dashboard-body *, .dashboard-body *::before, .dashboard-body *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
#workspaceAskToggle[hidden], #workspaceHomeToggle[hidden] { display: none !important; }

/* "Available to you" panel: a dropdown from the header, a full-width section on phones. */
.pool-apps { position: relative; }
.pool-apps[hidden], .pool-apps-panel[hidden] { display: none !important; }
body.dn-restricted .pool-apps { display: none !important; }
.pool-apps-count {
  position: absolute;
  top: 0.125rem;
  right: 0.125rem;
  min-width: 1.125rem;
  padding: 0 0.25rem;
  border-radius: 0.5625rem;
  background: var(--dash-accent);
  color: var(--site-on-accent, #fff);
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1.125rem;
  text-align: center;
}
.pool-apps-panel {
  position: absolute;
  top: calc(100% + 0.25rem);
  right: 0;
  width: 26rem;
  max-width: calc(100vw - 2rem);
  max-height: calc(100vh - var(--header-height) - 1rem);
  max-height: calc(100dvh - var(--header-height) - 1rem);
  overflow-y: auto;
  padding: 1rem;
  background: var(--dash-bg-secondary);
  border: 0.0625rem solid var(--dash-border-hover);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 100;
}
.pool-apps-title { margin: 0; color: var(--dash-text-primary); font-size: 1rem; font-weight: 600; }
.pool-apps-status { margin: 0.25rem 0 0; color: var(--dash-text-secondary); font-size: 0.8125rem; }
.pool-apps-status:empty { display: none; }
.pool-apps-list { margin: 0.5rem 0 0; padding: 0; list-style: none; }
.pool-app { display: flex; align-items: center; gap: 0.75rem; padding: 0.625rem 0; border-top: 0.0625rem solid var(--dash-border); }
.pool-app:first-child { border-top: none; }
.pool-app-icon {
  display: flex;
  flex: 0 0 2.25rem;
  align-items: center;
  justify-content: center;
  height: 2.25rem;
  border-radius: var(--radius-md);
  background: var(--dash-bg-tertiary);
  color: var(--dash-text-secondary);
}
.pool-app-text { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; }
.pool-app-name { color: var(--dash-text-primary); font-size: 0.875rem; font-weight: 600; overflow-wrap: anywhere; }
.pool-app-desc {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  color: var(--dash-text-secondary);
  font-size: 0.75rem;
}
.pool-app-meta { display: flex; flex: 0 0 auto; align-items: center; gap: 0.5rem; }
.pool-app-badge {
  padding: 0.125rem 0.5rem;
  border: 0.0625rem solid var(--dash-border-hover);
  border-radius: 0.75rem;
  color: var(--dash-text-secondary);
  font-size: 0.6875rem;
  font-weight: 600;
  white-space: nowrap;
}
.pool-app-note { color: var(--dash-text-secondary); font-size: 0.75rem; white-space: nowrap; }
.pool-app-add {
  min-width: 4rem;
  min-height: var(--touch-min);
  padding: 0 0.75rem;
  border: none;
  border-radius: var(--radius-md);
  background: var(--dash-accent);
  color: var(--site-on-accent, #fff);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}
.pool-app-add:hover { background: var(--dash-accent-hover); }
.pool-app-add[aria-disabled="true"] { opacity: 0.7; cursor: progress; }
@media (max-width: 48rem) {
  .pool-apps { position: static; }
  .pool-apps-panel {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    width: auto;
    max-width: none;
    max-height: calc(100vh - var(--header-height));
    max-height: calc(100dvh - var(--header-height));
    border-width: 0 0 0.0625rem;
    border-radius: 0;
  }
}

/* ============================================================================
   PHONE HEADER FIT (2026-11-18)

   A phone header carries the menu button, the brand icon and up to ~10
   actions (the site's DB header icons, Platform Tools, Global library, App
   Store, theme, user menu, and the pool-apps / Directory buttons the shell
   appends). Each is a 2.75rem touch target, so on a 320-414px screen they do
   not all fit. Before this nothing shrank or scrolled: the menu button was
   squeezed to 0.875rem and the user menu sat past the right edge, out of
   reach (the page itself does not scroll sideways).

   Now the action strip is a horizontal scroller that keeps its RIGHT end in
   view: row-reverse packs it against the right edge and lets the overflow
   run off the LEFT side, where it can be scrolled to. The nth-last-child
   orders put the children back in source order, so what you see, the tab
   order and the screen-reader order still agree. The first children (the DB
   icons) are the ones that scroll; the user menu, theme, App Store and
   library stay on screen.

   A dropdown inside the strip would be clipped by its overflow, so the
   Platform Tools menu is fixed below the header here (the pool-apps panel
   already is, above). The user menu's dropdown is outside the strip.

   The strip's overflow also clips focus rings. The widest one in the shell
   (.dashboard-body :focus-visible) reaches 0.3125rem past its control, so the
   strip has 0.375rem of inline padding. The header's right padding shrinks
   by the same amount, so the user menu stays where it was.
   ============================================================================ */
@media (max-width: 48rem) {
  .dashboard-header {
    padding: 0 0.125rem 0 0.5rem;
    gap: 0.25rem;
  }

  .dashboard-header > * {
    flex-shrink: 0;
  }

  .dashboard-header > .header-actions {
    flex: 1 1 auto;
    min-width: 0;
    align-self: stretch;
    flex-direction: row-reverse;
    gap: 0.25rem;
    padding: 0 0.375rem;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .dashboard-header > .header-actions::-webkit-scrollbar {
    display: none;
  }

  .header-actions > *,
  #headerIcons > * {
    flex-shrink: 0;
  }

  .header-actions > :nth-last-child(1) { order: 1; }
  .header-actions > :nth-last-child(2) { order: 2; }
  .header-actions > :nth-last-child(3) { order: 3; }
  .header-actions > :nth-last-child(4) { order: 4; }
  .header-actions > :nth-last-child(5) { order: 5; }
  .header-actions > :nth-last-child(6) { order: 6; }
  .header-actions > :nth-last-child(7) { order: 7; }
  .header-actions > :nth-last-child(8) { order: 8; }
  .header-actions > :nth-last-child(9) { order: 9; }
  .header-actions > :nth-last-child(10) { order: 10; }
  .header-actions > :nth-last-child(11) { order: 11; }
  .header-actions > :nth-last-child(12) { order: 12; }
  .header-actions > :nth-last-child(13) { order: 13; }
  .header-actions > :nth-last-child(14) { order: 14; }
  .header-actions > :nth-last-child(15) { order: 15; }
  .header-actions > :nth-last-child(16) { order: 16; }
  .header-actions > :nth-last-child(n+17) { order: 17; }

  .header-user {
    margin-left: 0;
    padding: 0.375rem 0.5rem;
    gap: 0.375rem;
  }

  .platform-tools-dropdown {
    position: static;
  }

  .platform-tools-menu {
    position: fixed;
    top: var(--header-height);
    right: 0.5rem;
    left: auto;
    max-width: calc(100vw - 1rem);
    max-height: calc(100vh - var(--header-height) - 1rem);
    max-height: calc(100dvh - var(--header-height) - 1rem);
    overflow-y: auto;
  }
}
