/**
 * Apple Human Interface Guidelines (HIG) Design System Tokens & Components
 * Creator Hub Design System
 * 
 * Complies with:
 * - Semantic System Surfaces & Materials (Frosted Vibrancy & UltraThin Blurs)
 * - SF Pro Dynamic Type Scale (LargeTitle -> Caption2 with calibrated tracking)
 * - Interactive Touch Targets (>=44px touch, >=28px pointer)
 * - Apple Spring Physics (cubic-bezier(0.32, 0.72, 0, 1))
 * - Responsive Apple HIG Slide-Over Drawer & Sheet Modals
 */

/* ==========================================================================
   1. Design Tokens & Semantic Variables
   ========================================================================== */

:root {
  /* Typography Stacks */
  --font-system: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "SF Pro", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-rounded: "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  /* Shared spacing and editorial type tokens */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --type-large-title: 34px;
  --type-title1: 28px;
  --type-title2: 22px;
  --type-title3: 20px;
  --type-body: 17px;
  --type-callout: 16px;
  --type-subheadline: 15px;
  --type-footnote: 13px;
  --type-caption: 12px;
  --tracking-large-title: -0.015em;
  --tracking-title1: -0.012em;
  --tracking-title2: -0.010em;
  --tracking-body: 0em;
  --tracking-footnote: 0.005em;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --line-height-reading: 1.6;
  --line-height-heading: 1.15;

  /* System Surfaces (Light Mode) */
  --system-background: #ffffff;
  --secondary-system-background: #f2f2f7;
  --tertiary-system-background: #ffffff;
  --system-grouped-background: #f2f2f7;
  --secondary-system-grouped-background: #ffffff;
  --tertiary-system-grouped-background: #f2f2f7;

  /* Semantic Labels (Light Mode - Causes Deep Slate Typography) */
  --label: #0f172a;
  --secondary-label: rgba(60, 60, 67, 0.60);
  --tertiary-label: rgba(60, 60, 67, 0.30);
  --quaternary-label: rgba(60, 60, 67, 0.18);
  --placeholder-text: rgba(60, 60, 67, 0.30);

  /* Fills & Separators (Light Mode) */
  --system-fill: rgba(120, 120, 128, 0.20);
  --secondary-system-fill: rgba(120, 120, 128, 0.16);
  --tertiary-system-fill: rgba(118, 118, 128, 0.12);
  --quaternary-system-fill: rgba(116, 116, 128, 0.08);
  --separator: rgba(60, 60, 67, 0.20);
  --opaque-separator: #c6c6c8;
  --card-border: rgba(0, 0, 0, 0.08);

  /* System Tints & Accent Colors */
  --system-blue: #007aff;
  --system-indigo: #5856d6;
  --system-purple: #af52de;
  --system-pink: #ff2d55;
  --system-red: #ff3b30;
  --system-orange: #ff9500;
  --system-yellow: #ffcc00;
  --system-green: #34c759;
  --system-mint: #00c7be;
  --system-teal: #30b0c7;
  --system-cyan: #32ade6;
  --system-gray: #8e8e93;

  /* Primary Brand Accent */
  --system-accent: #3b2fc9;
  --system-accent-hover: #2b20b2;
  --system-accent-subtle: rgba(59, 47, 201, 0.08);
  --system-accent-contrast: #ffffff;

  /* Apple Materials / Frosted Vibrancy */
  --material-ultra-thin: rgba(255, 255, 255, 0.45);
  --material-thin: rgba(255, 255, 255, 0.65);
  --material-regular: rgba(255, 255, 255, 0.82);
  --material-thick: rgba(255, 255, 255, 0.92);
  --material-blur: 24px;
  --material-border: rgba(255, 255, 255, 0.60);

  /* Apple Spring Motion */
  --spring-timing: cubic-bezier(0.32, 0.72, 0, 1);
  --spring-duration-fast: 0.22s;
  --spring-duration-normal: 0.35s;
  --spring-duration-slow: 0.50s;
  --spring-transition: all 0.35s cubic-bezier(0.32, 0.72, 0, 1);

  /* Touch & Pointer Dimensions */
  --touch-target-min: 44px;
  --pointer-target-min: 28px;

  /* Continuous Squircle Radii */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --radius-full: 9999px;

  /* Elevation & Shadows */
  --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.03);
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.03);
  --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-sheet: 0 -8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-drawer: -10px 0 40px rgba(0, 0, 0, 0.15);
}

/* Explicit data-theme rules (Binary Light & Dark Mode) */
[data-theme="light"] {
  --system-background: #ffffff;
  --secondary-system-background: #f2f2f7;
  --tertiary-system-background: #ffffff;
  --system-grouped-background: #f2f2f7;
  --secondary-system-grouped-background: #ffffff;
  --tertiary-system-grouped-background: #f2f2f7;
  --label: #0f172a;
  --secondary-label: rgba(60, 60, 67, 0.60);
  --tertiary-label: rgba(60, 60, 67, 0.30);
  --quaternary-label: rgba(60, 60, 67, 0.18);
  --placeholder-text: rgba(60, 60, 67, 0.30);
  --system-fill: rgba(120, 120, 128, 0.20);
  --secondary-system-fill: rgba(120, 120, 128, 0.16);
  --tertiary-system-fill: rgba(118, 118, 128, 0.12);
  --quaternary-system-fill: rgba(116, 116, 128, 0.08);
  --separator: rgba(60, 60, 67, 0.20);
  --opaque-separator: #c6c6c8;
  --card-border: rgba(0, 0, 0, 0.08);
  --system-accent: #3b2fc9;
  --system-accent-hover: #2b20b2;
  --system-accent-subtle: rgba(59, 47, 201, 0.08);
  --system-accent-contrast: #ffffff;
  --material-ultra-thin: rgba(255, 255, 255, 0.45);
  --material-thin: rgba(255, 255, 255, 0.65);
  --material-regular: rgba(255, 255, 255, 0.82);
  --material-thick: rgba(255, 255, 255, 0.92);
  --material-border: rgba(255, 255, 255, 0.60);
  --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.03);
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.03);
  --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-sheet: 0 -8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-drawer: -10px 0 40px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] {
  --system-background: #000000;
  --secondary-system-background: #1c1c1e;
  --tertiary-system-background: #2c2c2e;
  --system-grouped-background: #000000;
  --secondary-system-grouped-background: #1c1c1e;
  --tertiary-system-grouped-background: #2c2c2e;
  --label: #f8fafc;
  --secondary-label: rgba(235, 235, 245, 0.60);
  --tertiary-label: rgba(235, 235, 245, 0.30);
  --quaternary-label: rgba(235, 235, 245, 0.18);
  --placeholder-text: rgba(235, 235, 245, 0.30);
  --system-fill: rgba(120, 120, 128, 0.36);
  --secondary-system-fill: rgba(120, 120, 128, 0.32);
  --tertiary-system-fill: rgba(118, 118, 128, 0.24);
  --quaternary-system-fill: rgba(116, 116, 128, 0.18);
  --separator: rgba(255, 255, 255, 0.12);
  --opaque-separator: #38383a;
  --card-border: rgba(255, 255, 255, 0.10);
  --system-accent: #6366f1;
  --system-accent-hover: #7c7eff;
  --system-accent-subtle: rgba(99, 102, 241, 0.18);
  --system-accent-contrast: #ffffff;
  --material-ultra-thin: rgba(15, 23, 42, 0.55);
  --material-thin: rgba(15, 23, 42, 0.70);
  --material-regular: rgba(15, 23, 42, 0.85);
  --material-thick: rgba(15, 23, 42, 0.95);
  --material-border: rgba(255, 255, 255, 0.12);
  --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.6), 0 2px 6px rgba(0, 0, 0, 0.4);
  --shadow-sheet: 0 -8px 32px rgba(0, 0, 0, 0.7), 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-drawer: -10px 0 40px rgba(0, 0, 0, 0.7);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --system-background: #000000;
    --secondary-system-background: #1c1c1e;
    --tertiary-system-background: #2c2c2e;
    --system-grouped-background: #000000;
    --secondary-system-grouped-background: #1c1c1e;
    --tertiary-system-grouped-background: #2c2c2e;
    --label: #f8fafc;
    --secondary-label: rgba(235, 235, 245, 0.60);
    --tertiary-label: rgba(235, 235, 245, 0.30);
    --quaternary-label: rgba(235, 235, 245, 0.18);
    --placeholder-text: rgba(235, 235, 245, 0.30);
    --system-fill: rgba(120, 120, 128, 0.36);
    --secondary-system-fill: rgba(120, 120, 128, 0.32);
    --tertiary-system-fill: rgba(118, 118, 128, 0.24);
    --quaternary-system-fill: rgba(116, 116, 128, 0.18);
    --separator: rgba(255, 255, 255, 0.12);
    --opaque-separator: #38383a;
    --card-border: rgba(255, 255, 255, 0.10);
    --system-accent: #6366f1;
    --system-accent-hover: #7c7eff;
    --system-accent-subtle: rgba(99, 102, 241, 0.18);
    --system-accent-contrast: #ffffff;
    --material-ultra-thin: rgba(15, 23, 42, 0.55);
    --material-thin: rgba(15, 23, 42, 0.70);
    --material-regular: rgba(15, 23, 42, 0.85);
    --material-thick: rgba(15, 23, 42, 0.95);
    --material-border: rgba(255, 255, 255, 0.12);
    --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.6), 0 2px 6px rgba(0, 0, 0, 0.4);
    --shadow-sheet: 0 -8px 32px rgba(0, 0, 0, 0.7), 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-drawer: -10px 0 40px rgba(0, 0, 0, 0.7);
  }
}

/* ==========================================================================
   Apple HIG Theme Toggle Button Component
   ========================================================================== */

.hig-theme-toggle-btn {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  border-radius: var(--radius-full, 9999px);
  border: 1px solid var(--card-border, rgba(0, 0, 0, 0.08));
  background: var(--secondary-system-background, #f2f2f7);
  color: var(--label, #0f172a);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.32, 0.72, 0, 1);
  flex-shrink: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  box-sizing: border-box;
}

.hig-theme-toggle-btn:hover {
  background: var(--system-background, #ffffff);
  border-color: var(--separator, rgba(60, 60, 67, 0.20));
  color: var(--system-accent);
  transform: scale(1.05);
}

.hig-theme-toggle-btn:active {
  transform: scale(0.95);
}

.hig-theme-toggle-btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
  flex-shrink: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1);
}

/* Light mode: Show Moon icon (to switch to Dark), Hide Sun icon */
:root:not([data-theme="dark"]) .theme-icon-sun,
[data-theme="light"] .theme-icon-sun {
  display: none !important;
}

:root:not([data-theme="dark"]) .theme-icon-moon,
[data-theme="light"] .theme-icon-moon {
  display: block !important;
}

/* Dark mode: Show Sun icon (to switch to Light), Hide Moon icon */
[data-theme="dark"] .theme-icon-sun {
  display: block !important;
}

[data-theme="dark"] .theme-icon-moon {
  display: none !important;
}

/* Dark theme component overrides */
[data-theme="dark"] .hig-user-menu {
  background: rgba(15, 23, 42, 0.78);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 24px 48px -8px rgba(0, 0, 0, 0.6), 0 4px 16px -2px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .hig-user-menu-header {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .hig-user-menu-divider {
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .hig-user-menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .btn-signout {
  background: var(--secondary-system-background);
  color: var(--label);
  border-color: var(--card-border);
}

[data-theme="dark"] .btn-signout:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .hig-floating-preview-dock {
  background: rgba(22, 27, 38, 0.92);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .hig-floating-pill-actions {
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .hig-floating-pill-btn {
  color: var(--secondary-label);
}

[data-theme="dark"] .hig-floating-pill-btn:hover {
  color: var(--label);
}

[data-theme="dark"] .hig-floating-pill-btn.active {
  background: var(--card, #161b26);
  color: var(--label);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .hig-floating-pill-btn.active.admin-active {
  color: var(--system-accent, #6366f1);
}

[data-theme="dark"] .hig-floating-pill-btn.active.creator-active {
  color: #fb923c;
}

[data-theme="dark"] .hig-floating-pill-btn.active.client-active {
  color: #818cf8;
}


/* ==========================================================================
   2. SF Pro Dynamic Type Scale
   ========================================================================== */

.hig-large-title {
  font-family: var(--font-system);
  font-size: 34px;
  line-height: 41px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--label);
}

.hig-title1 {
  font-family: var(--font-system);
  font-size: 28px;
  line-height: 34px;
  font-weight: 700;
  letter-spacing: -0.012em;
  color: var(--label);
}

.hig-title2 {
  font-family: var(--font-system);
  font-size: 22px;
  line-height: 28px;
  font-weight: 700;
  letter-spacing: -0.010em;
  color: var(--label);
}

.hig-title3 {
  font-family: var(--font-system);
  font-size: 20px;
  line-height: 25px;
  font-weight: 600;
  letter-spacing: -0.008em;
  color: var(--label);
}

.hig-headline {
  font-family: var(--font-system);
  font-size: 17px;
  line-height: 22px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--label);
}

.hig-body {
  font-family: var(--font-system);
  font-size: 17px;
  line-height: 22px;
  font-weight: 400;
  letter-spacing: 0.000em;
  color: var(--label);
}

.hig-callout {
  font-family: var(--font-system);
  font-size: 16px;
  line-height: 21px;
  font-weight: 400;
  letter-spacing: 0.000em;
  color: var(--label);
}

.hig-subheadline {
  font-family: var(--font-system);
  font-size: 15px;
  line-height: 20px;
  font-weight: 400;
  letter-spacing: 0.000em;
  color: var(--secondary-label);
}

.hig-footnote {
  font-family: var(--font-system);
  font-size: 13px;
  line-height: 18px;
  font-weight: 400;
  letter-spacing: 0.005em;
  color: var(--secondary-label);
}

.hig-caption1 {
  font-family: var(--font-system);
  font-size: 12px;
  line-height: 16px;
  font-weight: 400;
  letter-spacing: 0.010em;
  color: var(--secondary-label);
}

.hig-caption2 {
  font-family: var(--font-system);
  font-size: 11px;
  line-height: 13px;
  font-weight: 400;
  letter-spacing: 0.015em;
  color: var(--tertiary-label);
}


/* ==========================================================================
   3. Apple Materials & Frosted Vibrancy Layers
   ========================================================================== */

.hig-material-ultra-thin {
  background-color: var(--material-ultra-thin);
  backdrop-filter: blur(var(--material-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--material-blur)) saturate(180%);
  border: 1px solid var(--material-border);
}

.hig-material-thin {
  background-color: var(--material-thin);
  backdrop-filter: blur(var(--material-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--material-blur)) saturate(180%);
  border: 1px solid var(--material-border);
}

.hig-material-regular {
  background-color: var(--material-regular);
  backdrop-filter: blur(var(--material-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--material-blur)) saturate(180%);
  border: 1px solid var(--material-border);
}

.hig-material-thick {
  background-color: var(--material-thick);
  backdrop-filter: blur(var(--material-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--material-blur)) saturate(180%);
  border: 1px solid var(--material-border);
}

.hig-glass {
  background: var(--material-regular);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--material-border);
  box-shadow: var(--shadow-subtle);
}


/* ==========================================================================
   4. Interactive Touch & Pointer Hit Targets (44px Mobile / 28px Desktop)
   ========================================================================== */

.hig-touch-target {
  min-height: var(--touch-target-min);
  min-width: var(--touch-target-min);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

@media (pointer: fine) {
  .hig-touch-target {
    min-height: var(--pointer-target-min);
    min-width: var(--pointer-target-min);
  }
}

/* Hit Area Expander (Pseudo-element invisible hit-box expansion) */
.hig-hit-area-expand {
  position: relative;
  touch-action: manipulation;
}

.hig-hit-area-expand::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: var(--touch-target-min);
  min-height: var(--touch-target-min);
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: auto;
}

@media (pointer: fine) {
  .hig-hit-area-expand::before {
    min-width: var(--pointer-target-min);
    min-height: var(--pointer-target-min);
  }
}

/* Accessibility Focus Ring */
:focus-visible {
  outline: 2px solid var(--system-accent);
  outline-offset: 2px;
}


/* ==========================================================================
   5. Apple Spring Motion & Microinteractions
   ========================================================================== */

.hig-spring-press {
  transition: transform var(--spring-duration-fast) var(--spring-timing), opacity var(--spring-duration-fast) ease;
}

.hig-spring-press:active {
  transform: scale(0.96);
  opacity: 0.85;
}

.hig-spring-bounce {
  transition: transform var(--spring-duration-normal) var(--spring-timing);
}

.hig-spring-bounce:hover {
  transform: translateY(-2px);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}


/* ==========================================================================
   6. Apple HIG Buttons & Controls
   ========================================================================== */

.hig-btn {
  font-family: var(--font-system);
  font-size: 15px;
  font-weight: 600;
  line-height: 20px;
  letter-spacing: -0.005em;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--touch-target-min);
  transition: transform var(--spring-duration-fast) var(--spring-timing),
              background-color var(--spring-duration-fast) ease,
              box-shadow var(--spring-duration-fast) ease,
              opacity var(--spring-duration-fast) ease;
  user-select: none;
  -webkit-user-select: none;
  box-sizing: border-box;
}

@media (pointer: fine) {
  .hig-btn {
    min-height: var(--pointer-target-min);
  }
}

.hig-btn:active {
  transform: scale(0.97);
}

.hig-btn:disabled, .hig-btn[disabled], .hig-btn.is-disabled {
  opacity: 0.25 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  filter: grayscale(1);
  box-shadow: none !important;
}

.hig-btn-primary {
  background-color: var(--system-accent);
  color: var(--system-accent-contrast);
  box-shadow: 0 2px 8px rgba(59, 47, 201, 0.25);
}

.hig-btn-primary:hover {
  background-color: var(--system-accent-hover);
  box-shadow: 0 4px 12px rgba(59, 47, 201, 0.35);
}

.hig-btn-secondary {
  background-color: var(--secondary-system-fill);
  color: var(--label);
}

.hig-btn-secondary:hover {
  background-color: var(--system-fill);
}

.hig-btn-destructive {
  background-color: rgba(255, 59, 48, 0.12);
  color: var(--system-red);
}

.hig-btn-destructive:hover {
  background-color: var(--system-red);
  color: #ffffff;
}

.hig-btn-ghost {
  background: transparent;
  color: var(--system-accent);
}

.hig-btn-ghost:hover {
  background-color: var(--system-accent-subtle);
}

/* Apple Segmented Control */
.hig-segmented-control {
  display: inline-flex;
  background-color: var(--tertiary-system-fill);
  padding: 3px;
  border-radius: var(--radius-sm);
  gap: 2px;
  user-select: none;
  -webkit-user-select: none;
}

.hig-segment-btn {
  font-family: var(--font-system);
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
  padding: 5px 12px;
  border-radius: calc(var(--radius-sm) - 3px);
  border: none;
  background: transparent;
  color: var(--secondary-label);
  cursor: pointer;
  min-height: 28px;
  transition: all var(--spring-duration-fast) var(--spring-timing);
}

.hig-segment-btn:hover {
  color: var(--label);
}

.hig-segment-btn.active {
  background: var(--system-background);
  color: var(--label);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

/* Apple HIG Inputs & Form Controls */
.hig-input,
.hig-textarea,
.hig-select {
  font-family: var(--font-system);
  font-size: 15px;
  line-height: 20px;
  color: var(--label);
  background-color: var(--secondary-system-background);
  border: 1px solid var(--separator);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  width: 100%;
  box-sizing: border-box;
  transition: border-color var(--spring-duration-fast) ease, box-shadow var(--spring-duration-fast) ease;
}

.hig-input:focus,
.hig-textarea:focus,
.hig-select:focus {
  border-color: var(--system-accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--system-accent-subtle);
}

.hig-input::placeholder,
.hig-textarea::placeholder {
  color: var(--placeholder-text);
}

/* Apple iOS Toggle Switch */
.hig-toggle {
  position: relative;
  display: inline-block;
  width: 51px;
  height: 31px;
  cursor: pointer;
  user-select: none;
}

.hig-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.hig-toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--tertiary-system-fill);
  border-radius: var(--radius-full);
  transition: background-color var(--spring-duration-fast) var(--spring-timing);
}

.hig-toggle-slider::before {
  position: absolute;
  content: "";
  height: 27px;
  width: 27px;
  left: 2px;
  bottom: 2px;
  background-color: #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform var(--spring-duration-normal) var(--spring-timing);
}

.hig-toggle input:checked + .hig-toggle-slider {
  background-color: var(--system-green);
}

.hig-toggle input:checked + .hig-toggle-slider::before {
  transform: translateX(20px);
}


/* ==========================================================================
   7. Apple HIG Badges & Status Indicators
   ========================================================================== */

.hig-badge {
  font-family: var(--font-system);
  font-size: 11px;
  font-weight: 600;
  line-height: 14px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-sizing: border-box;
}

.hig-badge-required {
  background-color: rgba(255, 59, 48, 0.12);
  color: var(--system-red);
  border: 1px solid rgba(255, 59, 48, 0.25);
}

.hig-badge-important {
  background-color: rgba(255, 149, 0, 0.12);
  color: var(--system-orange);
  border: 1px solid rgba(255, 149, 0, 0.25);
}

.hig-badge-optional {
  background-color: var(--quaternary-system-fill);
  color: var(--secondary-label);
  border: 1px solid var(--separator);
}

.hig-badge-new {
  background-color: rgba(0, 122, 255, 0.12);
  color: var(--system-blue);
  border: 1px solid rgba(0, 122, 255, 0.25);
}

.hig-badge-success {
  background-color: rgba(52, 199, 89, 0.12);
  color: var(--system-green);
  border: 1px solid rgba(52, 199, 89, 0.25);
}

.hig-beta-pill {
  font-family: var(--font-system);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 6px;
  border-radius: var(--radius-full);
  background-color: rgba(255, 149, 0, 0.12);
  color: var(--system-orange, #c25e00);
  border: 1px solid rgba(255, 149, 0, 0.28);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  user-select: none;
  vertical-align: middle;
  flex-shrink: 0;
}

[data-theme="dark"] .hig-beta-pill {
  background-color: rgba(255, 159, 10, 0.16);
  color: #ff9f0a;
  border-color: rgba(255, 159, 10, 0.32);
}


/* ==========================================================================
   8. Responsive Video Player Container (16:9 Aspect Ratio)
   ========================================================================== */

.hig-video-wrapper {
  margin: 12px 0 16px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--separator);
  background-color: var(--secondary-system-background);
  box-shadow: var(--shadow-card);
}

.hig-video-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.hig-video-iframe,
.hig-video-player {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  object-fit: cover;
}


/* ==========================================================================
   9. Fluid Spring Progress Bar
   ========================================================================== */

.hig-progress-track {
  width: 100%;
  height: 8px;
  background-color: var(--secondary-system-fill);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.hig-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--system-accent) 0%, #6366f1 100%);
  border-radius: var(--radius-full);
  transition: width var(--spring-duration-slow) var(--spring-timing);
}


/* ==========================================================================
   10. Apple HIG Slide-Over Drawer & Sheet Modal Ergonomics
   ========================================================================== */

/* Sheet / Drawer Backdrop Overlay */
.hig-sheet-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.40);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9990;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--spring-duration-normal) var(--spring-timing),
              visibility var(--spring-duration-normal) var(--spring-timing);
}

.hig-sheet-backdrop.active {
  opacity: 1;
  visibility: visible;
}

/* Slide-Over Drawer (Right side on Desktop, Bottom Sheet on Mobile) */
.hig-sheet-panel {
  position: fixed;
  z-index: 9999;
  background-color: var(--secondary-system-background);
  box-shadow: var(--shadow-drawer);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  transition: transform var(--spring-duration-normal) var(--spring-timing);
}

/* Desktop Slide-Over Drawer (Right side) */
@media (min-width: 769px) {
  .hig-sheet-panel.hig-drawer-right {
    top: 0;
    right: 0;
    bottom: 0;
    width: min(560px, 90vw);
    height: 100vh;
    border-left: 1px solid var(--separator);
    transform: translateX(100%);
  }

  .hig-sheet-panel.hig-drawer-right.active {
    transform: translateX(0);
  }
}

/* Mobile Bottom Sheet */
@media (max-width: 768px) {
  .hig-sheet-panel {
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 92vh;
    height: auto;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-top: 1px solid var(--separator);
    box-shadow: var(--shadow-sheet);
    transform: translateY(100%);
  }

  .hig-sheet-panel.active {
    transform: translateY(0);
  }
}

/* Drag Handle Grab Indicator for Apple Bottom Sheet */
.hig-sheet-drag-indicator,
.presentationDragIndicator {
  width: 36px;
  height: 5px;
  background-color: var(--quaternary-label);
  border-radius: var(--radius-full);
  margin: 8px auto 4px auto;
  flex-shrink: 0;
}

@media (min-width: 769px) {
  .hig-sheet-drag-indicator {
    display: none;
  }
}

/* Sheet Header Controls */
.hig-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--separator);
  background-color: var(--material-regular);
  backdrop-filter: blur(var(--material-blur));
  -webkit-backdrop-filter: blur(var(--material-blur));
  position: sticky;
  top: 0;
  z-index: 10;
}

.hig-sheet-title {
  font-family: var(--font-system);
  font-size: 17px;
  font-weight: 600;
  line-height: 22px;
  letter-spacing: -0.005em;
  color: var(--label);
  margin: 0;
  text-align: center;
  flex: 1;
}

.hig-sheet-btn-secondary {
  font-family: var(--font-system);
  font-size: 16px;
  font-weight: 400;
  color: var(--system-accent);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  min-height: var(--touch-target-min);
  display: inline-flex;
  align-items: center;
}

@media (pointer: fine) {
  .hig-sheet-btn-secondary {
    min-height: var(--pointer-target-min);
  }
}

.hig-sheet-btn-primary {
  font-family: var(--font-system);
  font-size: 16px;
  font-weight: 600;
  color: var(--system-accent);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  min-height: var(--touch-target-min);
  display: inline-flex;
  align-items: center;
}

@media (pointer: fine) {
  .hig-sheet-btn-primary {
    min-height: var(--pointer-target-min);
  }
}

.hig-sheet-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.hig-sheet-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--separator);
  background-color: var(--secondary-system-background);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* ==========================================================================
   11. Unified Apple HIG Persistent Admin Floating Role Switcher Pill
   ========================================================================== */

.hig-floating-preview-dock {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: none;
  align-items: center;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-full, 9999px);
  padding: 5px 6px 5px 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.04);
  animation: higPillFloatIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
  font-family: var(--font-system, -apple-system, BlinkMacSystemFont, sans-serif);
  user-select: none;
}

.hig-floating-preview-dock:hover {
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.16), 0 4px 12px rgba(0, 0, 0, 0.06);
}

.hig-floating-pill-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hig-floating-pill-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--secondary-label, #475569);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.hig-floating-pill-label svg {
  color: var(--system-accent, #3b2fc9);
}

.hig-floating-pill-actions {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-full, 9999px);
  padding: 3px;
  gap: 2px;
}

.hig-floating-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-full, 9999px);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  background: transparent;
  color: var(--secondary-label, #475569);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s cubic-bezier(0.25, 1, 0.5, 1);
  white-space: nowrap;
}

.hig-floating-pill-btn:hover {
  color: var(--label, #0f172a);
}

.hig-floating-pill-btn.active {
  background: var(--system-background, #ffffff);
  color: var(--label, #0f172a);
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.10);
}

.hig-floating-pill-btn.active.admin-active {
  color: var(--system-accent, #3b2fc9);
}

.hig-floating-pill-btn.active.creator-active {
  color: var(--system-orange, #f97316);
}

.hig-floating-pill-btn.active.client-active {
  color: var(--system-indigo, #6366f1);
}

.preview-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.preview-dot.admin-dot {
  background: var(--system-accent, #3b2fc9);
}

.preview-dot.creator-dot,
.hig-preview-pill-creator .dot {
  background: var(--system-orange, #f97316);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.preview-dot.client-dot,
.hig-preview-pill-client .dot {
  background: var(--system-indigo, #6366f1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

/* Simulated Action Toast */
.hig-preview-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background-color: var(--material-thick);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--separator);
  box-shadow: var(--shadow-hover);
  color: var(--label);
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-family: var(--font-system);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 10001;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.35s ease;
}

.hig-preview-toast.active {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Apple HIG Shared Toast System */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10090;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-pill {
  background-color: var(--material-thick);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  color: var(--label);
  border: 1px solid var(--separator);
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-family: var(--font-system);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-hover);
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

.toast-pill.show {
  transform: translateY(0);
  opacity: 1;
}

@keyframes higPillFloatIn {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 640px) {
  .hig-floating-preview-dock {
    bottom: 16px;
    right: 16px;
    left: 16px;
    justify-content: center;
  }
  .hig-preview-title span.meta {
    display: none;
  }
}

/* ==========================================================================
   12. Apple HIG Textarea Document Upload & Dropzone
   ========================================================================== */

.hig-textarea-dropzone-wrapper {
  position: relative;
  width: 100%;
}

.hig-textarea.drag-over,
.hig-textarea-dropzone-wrapper.drag-over textarea {
  border-color: var(--system-accent) !important;
  background-color: var(--system-accent-subtle) !important;
  outline: 2px dashed var(--system-accent) !important;
  outline-offset: -2px;
  transition: all var(--spring-duration-fast) var(--spring-timing);
}

.hig-file-upload-btn {
  font-family: var(--font-system);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--system-accent);
  background-color: var(--system-accent-subtle);
  border: 1px solid rgba(59, 47, 201, 0.20);
  border-radius: var(--radius-full);
  padding: 3px 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  min-height: 26px;
  user-select: none;
  transition: all var(--spring-duration-fast) var(--spring-timing);
}

.hig-file-upload-btn:hover {
  background-color: var(--system-accent);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(59, 47, 201, 0.25);
}

.hig-file-upload-btn:active {
  transform: scale(0.96);
}

.hig-upload-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-system);
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background-color: rgba(52, 199, 89, 0.12);
  color: var(--system-green);
  border: 1px solid rgba(52, 199, 89, 0.25);
  animation: hig-fade-in 0.25s var(--spring-timing);
}

@keyframes hig-fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.hig-logo-preview-box {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
  cursor: pointer;
  transition: all var(--spring-duration-fast) var(--spring-timing);
}

[data-theme="dark"] .hig-logo-preview-box {
  background: #1e1e24;
  border-color: var(--border);
}

.hig-logo-preview-box:hover {
  border-color: var(--system-accent);
  box-shadow: 0 0 0 2px var(--system-accent-subtle);
}

.hig-logo-preview-box.drag-over {
  border-color: var(--system-accent) !important;
  background-color: var(--system-accent-subtle) !important;
  outline: 2px dashed var(--system-accent) !important;
  outline-offset: -2px;
  transform: scale(1.04);
}

.hig-logo-preview-box .upload-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease;
  color: #ffffff;
}

.hig-logo-preview-box:hover .upload-overlay {
  opacity: 1;
}

/* ==========================================================================
   13. Admin OS Campaign-Centric Full-Canvas Workspace (Apple HIG)
   ========================================================================== */

/* Main Canvas Container */
.admin-os-canvas,
.hig-admin-workspace {
  width: 100%;
  min-height: calc(100vh - 56px);
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 28px 80px 28px;
  background-color: var(--system-background);
  color: var(--label);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  overflow-x: hidden;
  font-family: var(--font-system);
  animation: hig-fade-in 0.25s var(--spring-timing);
}

.hig-admin-header-area {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--material-thick);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  padding-top: 16px;
  margin-top: -16px;
  border-bottom: 1px solid var(--separator);
  margin-bottom: 24px;
}

[data-theme="dark"] .hig-admin-header-area {
  background-color: rgba(15, 23, 42, 0.92);
  border-bottom-color: var(--separator);
}

/* ── Top Header Context Bar ── */
.admin-os-top-header {
  position: sticky;
  top: 56px;
  z-index: 180;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px;
  background-color: var(--material-thick);
  backdrop-filter: blur(var(--material-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--material-blur)) saturate(180%);
  border-bottom: 1px solid var(--separator);
  gap: 16px;
}

.admin-os-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.admin-os-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ── Campaign Selector Popover ── */
.hig-campaign-selector-wrap,
.hig-campaign-picker-wrap {
  position: relative;
  display: inline-block;
  font-family: var(--font-system);
}

.hig-campaign-trigger,
.hig-campaign-picker-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 6px 14px 6px 10px;
  background-color: var(--secondary-system-background);
  border: 1px solid var(--separator);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-system);
  transition: all var(--spring-duration-fast) var(--spring-timing);
  color: var(--label);
  user-select: none;
  text-align: left;
}

.hig-campaign-trigger:hover,
.hig-campaign-picker-btn:hover {
  background-color: var(--system-fill);
  border-color: var(--opaque-separator);
  box-shadow: var(--shadow-subtle);
}

.hig-campaign-trigger.open,
.hig-campaign-picker-btn[aria-expanded="true"] {
  border-color: var(--system-accent);
  box-shadow: 0 0 0 3px var(--system-accent-subtle);
}

.hig-campaign-logo-badge-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  border-radius: var(--radius-xs);
  transition: transform var(--spring-duration-fast) var(--spring-timing);
}

.hig-campaign-logo-badge-wrap:hover {
  transform: scale(1.02);
}

.hig-campaign-logo-badge-wrap.drag-over {
  outline: 2px dashed var(--system-accent);
  outline-offset: 2px;
}

.hig-logo-swap-badge {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  opacity: 0;
  transform: scale(0.92);
  transition: opacity var(--spring-duration-fast) var(--spring-timing), transform var(--spring-duration-fast) var(--spring-timing);
  pointer-events: none;
}

.hig-campaign-logo-badge-wrap:hover .hig-logo-swap-badge {
  opacity: 1;
  transform: scale(1);
}

.hig-campaign-brand-logo,
.hig-campaign-logo {
  width: 36px;
  height: 24px;
  max-width: 36px;
  max-height: 24px;
  border-radius: var(--radius-xs);
  object-fit: contain !important;
  background: #ffffff;
  padding: 1.5px 3px;
  border: 1px solid var(--separator);
  box-shadow: 0 0.5px 1.5px rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
  display: block;
}

.hig-campaign-picker-info,
.hig-campaign-trigger-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.hig-campaign-picker-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--secondary-label);
  line-height: 1.1;
}

.hig-campaign-title-text,
.hig-campaign-picker-title {
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--label);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

.hig-campaign-caret,
.hig-chevron-icon {
  color: var(--secondary-label);
  transition: transform var(--spring-duration-fast) var(--spring-timing);
}

.hig-campaign-trigger.open .hig-campaign-caret,
.hig-campaign-picker-btn[aria-expanded="true"] .hig-chevron-icon {
  transform: rotate(180deg);
}

/* Popover Menu */
.hig-campaign-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 380px;
  max-width: 90vw;
  background-color: var(--material-thick);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid var(--material-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card), 0 20px 40px rgba(0, 0, 0, 0.12);
  z-index: 1000;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: hig-scale-in 0.22s var(--spring-timing);
}

@keyframes hig-scale-in {
  from { opacity: 0; transform: scale(0.95) translateY(-6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.hig-campaign-search-wrap,
.hig-popover-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background-color: var(--tertiary-system-background);
  border: 1px solid var(--separator);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
}

.hig-campaign-search-input,
.hig-popover-search input {
  border: none;
  background: transparent;
  outline: none;
  font-family: var(--font-system);
  font-size: 13px;
  color: var(--label);
  width: 100%;
}

.hig-campaign-picker-list,
.hig-popover-list {
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-right: 2px;
}

.hig-campaign-group-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--secondary-label);
  padding: 6px 8px 2px;
  letter-spacing: 0.02em;
}

.hig-campaign-picker-item,
.hig-campaign-option,
.camp-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color var(--spring-duration-fast) ease;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  gap: 10px;
}

.hig-campaign-picker-item:hover,
.hig-campaign-option:hover,
.camp-item-row:hover {
  background-color: var(--secondary-system-fill);
}

.hig-campaign-picker-item.active,
.hig-campaign-option.selected,
.camp-item-row.selected {
  background-color: var(--system-accent-subtle);
  border: 1px solid rgba(59, 47, 201, 0.20);
}

.hig-campaign-popover-footer,
.hig-popover-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--separator);
  padding-top: 8px;
  margin-top: 4px;
  gap: 8px;
}

/* ── 2. Campaign Health & Quota Status Bar ── */
.admin-os-health-bar,
.hig-health-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 16px 20px;
  background-color: var(--secondary-system-background);
  border: 1px solid var(--separator);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  box-shadow: var(--shadow-subtle);
}

.admin-os-metric-card {
  background-color: var(--system-background);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-subtle);
  transition: transform var(--spring-duration-fast) var(--spring-timing), box-shadow var(--spring-duration-fast) ease;
}

.admin-os-metric-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
}

.admin-os-metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-os-metric-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--secondary-label);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.admin-os-metric-value {
  font-size: 17px;
  font-weight: 800;
  color: var(--label);
  letter-spacing: -0.01em;
}

.admin-os-metric-sub {
  font-size: 12px;
  color: var(--secondary-label);
  font-weight: 500;
}

.admin-os-metric-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background-color: var(--quaternary-system-fill);
  color: var(--secondary-label);
}

.hig-progress-mini {
  height: 6px;
  margin-top: 4px;
}

.hig-health-chip {
  font-family: var(--font-system);
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background-color: var(--tertiary-system-fill);
  color: var(--label);
  border: 1px solid var(--separator);
}

.hig-health-chip-qa {
  background-color: rgba(255, 149, 0, 0.12);
  color: var(--system-orange);
  border-color: rgba(255, 149, 0, 0.25);
}

.hig-health-chip-qa .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--system-orange);
  animation: hig-pulse 2s infinite ease-in-out;
}

.hig-health-chip-approved {
  background-color: rgba(52, 199, 89, 0.12);
  color: var(--system-green);
  border-color: rgba(52, 199, 89, 0.25);
}

.hig-health-actions-block {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── 3. Cupertino Segmented Navigation Bar ── */
.admin-os-nav-container,
.hig-admin-pillar-nav-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0 20px 0;
}

.hig-segmented-control-lg,
.hig-admin-pillar-nav {
  max-width: 760px;
  width: 100%;
  padding: 4px;
  border-radius: var(--radius-full);
  background-color: var(--tertiary-system-fill);
  display: flex;
  gap: 4px;
}

.hig-segment-btn-lg,
.hig-admin-pillar-nav .hig-segment-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-full);
  white-space: nowrap;
  border: none;
  background: transparent;
  color: var(--secondary-label);
  cursor: pointer;
  transition: all var(--spring-duration-fast) var(--spring-timing);
}

.hig-segment-btn-lg:hover:not(.active),
.hig-admin-pillar-nav .hig-segment-btn:hover:not(.active) {
  color: var(--label);
  background-color: var(--system-fill);
}

.hig-segment-btn-lg.active,
.hig-admin-pillar-nav .hig-segment-btn.active {
  background-color: var(--system-background);
  color: var(--label);
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
}

.hig-tab-counter,
.hig-segment-count-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: var(--quaternary-system-fill);
  color: var(--secondary-label);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  min-width: 18px;
  box-sizing: border-box;
  vertical-align: middle;
  border: none;
}

.hig-tab-counter.alert,
.hig-segment-badge {
  background: rgba(255, 149, 0, 0.15);
  color: var(--system-orange);
  border: none;
}

.hig-segment-btn-lg.active .hig-tab-counter.alert,
.hig-segment-btn-lg.active .hig-segment-badge {
  background: var(--system-orange);
  color: #ffffff;
}

.hig-segment-btn-lg.active .hig-tab-counter:not(.alert),
.hig-segment-btn-lg.active .hig-segment-count-badge:not(.alert) {
  background: var(--tertiary-system-fill);
  color: var(--label);
}

/* ── 4. Pane Body & Split Layouts ── */
.admin-os-body {
  flex: 1;
  width: 100%;
}

.admin-os-pane,
.hig-admin-pane {
  display: none;
  flex-direction: column;
  gap: 20px;
  animation: hig-pane-fade 0.22s var(--spring-timing);
}

.admin-os-pane.active,
.hig-admin-pane.active {
  display: flex;
}

@keyframes hig-pane-fade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.admin-pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.admin-pane-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-os-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.admin-card {
  background-color: var(--system-background);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-card);
}

.admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

/* ── Split Markdown Editor & Live Preview ── */
.admin-brief-split-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  min-height: 560px;
}

.admin-brief-editor-col,
.admin-brief-preview-col {
  background-color: var(--system-background);
  border: 1px solid var(--separator);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  max-height: 800px;
  box-shadow: var(--shadow-subtle);
}

.admin-markdown-toolbar {
  background-color: var(--tertiary-system-background);
  border-bottom: 1px solid var(--separator);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 10;
}

.toolbar-divider {
  width: 1px;
  height: 16px;
  background: var(--separator);
  margin: 0 4px;
}

.admin-textarea-wrapper {
  display: flex;
  min-height: 200px;
}

.admin-brief-textarea {
  width: 100%;
  min-height: 220px;
  border: none;
  border-radius: 0;
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  background: var(--system-background);
  color: var(--label);
  resize: vertical;
  outline: none;
}

.admin-preview-header {
  padding: 10px 16px;
  background-color: var(--tertiary-system-background);
  border-bottom: 1px solid var(--separator);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.admin-brief-preview-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: var(--system-background);
}

/* ── Split Agency QA Review Station ── */
.admin-qa-split-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 20px;
  min-height: 600px;
}

.admin-qa-queue-col {
  background-color: var(--secondary-system-background);
  border: 1px solid var(--separator);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 80vh;
  overflow-y: auto;
}

.admin-qa-filter-bar {
  display: flex;
  gap: 6px;
}

.admin-qa-submissions-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-qa-card {
  background-color: var(--system-background);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: all var(--spring-duration-fast) var(--spring-timing);
}

.admin-qa-card:hover {
  transform: translateY(-1px);
  border-color: var(--system-accent);
  box-shadow: var(--shadow-card);
}

.admin-qa-card.active {
  border-color: var(--system-accent);
  background-color: var(--system-accent-subtle);
  box-shadow: var(--shadow-card);
}

.admin-qa-station-col {
  background-color: var(--system-background);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
}

.admin-qa-decision-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background-color: var(--secondary-system-background);
  border: 1px solid var(--separator);
  border-radius: var(--radius-md);
  margin-bottom: 18px;
  gap: 12px;
}

.decision-banner-btns {
  display: flex;
  gap: 8px;
}

.hig-btn-approve {
  background-color: var(--system-green);
  color: #ffffff;
  font-weight: 600;
  padding: 8px 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all var(--spring-duration-fast) var(--spring-timing);
}
.hig-btn-approve:hover {
  filter: brightness(0.92);
  box-shadow: 0 2px 8px rgba(52, 199, 89, 0.25);
}

.hig-btn-changes {
  background-color: rgba(255, 149, 0, 0.12);
  color: var(--system-orange);
  border: 1px solid rgba(255, 149, 0, 0.25);
  font-weight: 600;
  padding: 8px 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--spring-duration-fast) var(--spring-timing);
}
.hig-btn-changes:hover {
  background-color: rgba(255, 149, 0, 0.20);
}

.hig-btn-reject {
  background-color: rgba(255, 59, 48, 0.12);
  color: var(--system-red);
  border: 1px solid rgba(255, 59, 48, 0.25);
  font-weight: 600;
  padding: 8px 12px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--spring-duration-fast) var(--spring-timing);
}
.hig-btn-reject:hover {
  background-color: rgba(255, 59, 48, 0.20);
}

.admin-qa-player-notes-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
}

.admin-qa-vertical-frame {
  width: 100%;
  aspect-ratio: 9 / 16;
  background-color: var(--secondary-system-background);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--separator);
  position: relative;
}

.admin-qa-vertical-frame video,
.admin-qa-vertical-frame iframe {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-qa-scrubber-wrapper {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.video-scrubber-bar {
  position: relative;
  width: 100%;
  height: 12px;
  background: var(--tertiary-system-fill);
  border-radius: var(--radius-full);
  cursor: pointer;
  user-select: none;
}

.video-scrubber-progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--system-accent);
  border-radius: var(--radius-full);
  pointer-events: none;
}

.scrubber-pins-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.scrubber-comment-pin {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--system-orange);
  border: 2px solid #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  pointer-events: auto;
  transition: transform var(--spring-duration-fast) var(--spring-timing);
}

.scrubber-comment-pin:hover {
  transform: translate(-50%, -50%) scale(1.3);
}

.scrubber-time-display {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--secondary-label);
  font-family: var(--font-mono);
}

/* ── Responsive Breakpoints ── */
@media (max-width: 1200px) {
  .admin-os-health-bar,
  .hig-health-strip {
    grid-template-columns: repeat(2, 1fr);
  }
  .admin-brief-split-container {
    grid-template-columns: 1fr;
  }
  .admin-qa-split-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .admin-os-top-header {
    padding: 10px 16px;
  }
  .admin-os-health-bar,
  .hig-health-strip {
    grid-template-columns: 1fr;
    padding: 12px 16px;
  }
  .admin-os-canvas,
  .hig-admin-workspace {
    padding: 16px;
  }
  .admin-os-grid-2col {
    grid-template-columns: 1fr;
  }
  .admin-qa-player-notes-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Consolidated Global Header & Brand Container Tokens ── */
.hub-header {
  position: sticky;
  top: 0;
  z-index: 500;
  width: 100%;
  height: 64px;
  background: var(--material-thick, rgba(255, 255, 255, 0.92));
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border-bottom: 1px solid var(--card-border, rgba(0, 0, 0, 0.08));
  padding: 0 24px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: border-color 0.3s ease, background 0.3s ease;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 0;
  text-decoration: none;
  color: var(--label, #0f172a);
  transition: opacity 0.15s ease;
}

.brand-container:hover {
  opacity: 0.92;
}

.brand-logo-frame {
  width: auto;
  height: 44px;
  max-height: 44px;
  background: transparent;
  border: none;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  overflow: hidden;
  box-shadow: none;
  flex-shrink: 0;
}

.brand-logo-img {
  height: 44px !important;
  max-height: 44px !important;
  width: auto !important;
  object-fit: contain !important;
  display: block !important;
}

.brand-info {
  display: none !important;
}

.brand-name-text {
  display: none !important;
}

.brand-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: var(--radius-full, 9999px);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: rgba(52, 199, 89, 0.12);
  color: var(--system-green, #34c759);
  border: 1px solid rgba(52, 199, 89, 0.25);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--system-green, #34c759);
  box-shadow: 0 0 8px var(--system-green, #34c759);
  animation: pulse-glow 2s infinite ease-in-out;
}

@keyframes pulse-glow {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.5; }
}

.nav-center {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  justify-content: center;
}

.nav-right, .hub-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.hub-header .hig-segmented-control {
  display: inline-flex;
  align-items: center;
  background: var(--tertiary-system-fill, rgba(118, 118, 128, 0.12));
  padding: 3px;
  border-radius: var(--radius-full, 9999px);
  gap: 2px;
  user-select: none;
}

.hub-header .hig-segment-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-full, 9999px);
  border: none;
  background: transparent;
  font-family: var(--font-system);
  font-size: 12px;
  font-weight: 600;
  color: var(--secondary-label, rgba(60, 60, 67, 0.60));
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.32, 0.72, 0, 1);
  white-space: nowrap;
}

.hub-header .hig-segment-btn:hover {
  color: var(--label, #0f172a);
}

.hub-header .hig-segment-btn.active {
  background: var(--system-background, #ffffff);
  color: var(--system-accent, #3b2fc9);
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.hub-header .hig-segment-btn svg {
  width: 14px;
  height: 14px;
  stroke-width: 2;
  flex-shrink: 0;
}

.btn-icon-only {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--card-border, rgba(0, 0, 0, 0.08));
  background: var(--secondary-system-background, #f2f2f7);
  color: var(--secondary-label, rgba(60, 60, 67, 0.60));
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}

.btn-icon-only:hover {
  background: var(--system-background, #ffffff);
  color: var(--label, #0f172a);
  transform: scale(1.05);
  border-color: var(--separator, rgba(60, 60, 67, 0.20));
}

/* ── Top Nav Admin Action Button (Create Campaign) ── */
.top-nav-create-btn,
#top-nav-create-campaign-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-full, 9999px);
  background: var(--system-accent, #3b2fc9);
  color: #ffffff;
  font-family: var(--font-system);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 1px 3px rgba(59, 47, 201, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.32, 0.72, 0, 1);
  user-select: none;
}

.top-nav-create-btn:hover,
#top-nav-create-campaign-btn:hover {
  background: var(--system-accent-hover, #2b20b2);
  transform: translateY(-0.5px);
  box-shadow: 0 3px 10px rgba(59, 47, 201, 0.35);
}

.top-nav-create-btn:active,
#top-nav-create-campaign-btn:active {
  transform: scale(0.97);
  box-shadow: 0 1px 2px rgba(59, 47, 201, 0.2);
}

.top-nav-create-btn svg,
#top-nav-create-campaign-btn svg {
  width: 13px;
  height: 13px;
  stroke-width: 2.5;
  flex-shrink: 0;
}


.client-auth-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  background: var(--secondary-system-background, #f2f2f7);
  border: 1px solid var(--card-border, rgba(0, 0, 0, 0.08));
  border-radius: var(--radius-full, 9999px);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}

.client-auth-pill:hover {
  background: var(--system-background, #ffffff);
  border-color: var(--separator, rgba(60, 60, 67, 0.20));
}

.client-avatar-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--system-accent, #3b2fc9);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.client-pill-text {
  font-family: var(--font-system);
  font-size: 13px;
  font-weight: 600;
  color: var(--label, #0f172a);
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-signout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full, 9999px);
  border: 1px solid var(--card-border, rgba(0, 0, 0, 0.08));
  background: var(--system-background, #ffffff);
  font-family: var(--font-system);
  font-size: 12px;
  font-weight: 600;
  color: var(--label, #0f172a);
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: var(--shadow-subtle, 0 1px 3px rgba(0, 0, 0, 0.04));
  white-space: nowrap;
}

.btn-signout:hover {
  background: #f8fafc;
  border-color: rgba(226, 232, 240, 1);
  transform: translateY(-0.5px);
  color: var(--system-red, #ff3b30);
}

/* ==========================================================================
   Apple HIG User Profile Dropdown Popover & Settings System
   ========================================================================== */

.hub-user-pill-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.hub-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  background: var(--secondary-system-background, #f2f2f7);
  border: 1px solid var(--card-border, rgba(0, 0, 0, 0.08));
  border-radius: var(--radius-full, 9999px);
  cursor: pointer;
  user-select: none;
  transition: all 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}

.hub-user-pill:hover,
.hub-user-pill[aria-expanded="true"] {
  background: var(--system-background, #ffffff);
  border-color: var(--separator, rgba(60, 60, 67, 0.20));
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.hub-user-pill-caret {
  color: var(--secondary-label, #8e8e93);
  transition: transform 0.2s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  align-items: center;
}

.hub-user-pill[aria-expanded="true"] .hub-user-pill-caret {
  transform: rotate(180deg);
}

.hig-user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 292px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(36px) saturate(200%);
  -webkit-backdrop-filter: blur(36px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 18px;
  box-shadow: 0 24px 48px -8px rgba(0, 20, 50, 0.16), 0 4px 16px -2px rgba(0, 20, 50, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.06), inset 0 1px 1.5px rgba(255, 255, 255, 0.85);
  z-index: 10090;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: higMenuSpringIn 0.22s cubic-bezier(0.32, 0.72, 0, 1);
  transform-origin: top right;
}

@keyframes higMenuSpringIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(-6px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.hig-user-menu-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  margin-bottom: 4px;
}

.hig-user-menu-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--system-accent, #3b2fc9);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(59, 47, 201, 0.25);
}

.hig-user-menu-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.hig-user-menu-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 2px;
}

.hig-user-menu-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--label, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hig-user-menu-email {
  font-size: 11.5px;
  color: var(--secondary-label, #8e8e93);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hig-user-persona-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: rgba(59, 47, 201, 0.1);
  color: var(--system-accent, #3b2fc9);
  border: 1px solid rgba(59, 47, 201, 0.2);
}

.hig-user-persona-badge.creator {
  background: rgba(52, 199, 89, 0.1);
  color: var(--system-green, #34c759);
  border-color: rgba(52, 199, 89, 0.2);
}

.hig-user-persona-badge.client {
  background: rgba(88, 86, 214, 0.1);
  color: var(--system-indigo, #5856d6);
  border-color: rgba(88, 86, 214, 0.2);
}

.hig-user-menu-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hig-user-menu-divider {
  height: 1px;
  background: rgba(0, 0, 0, 0.06);
  margin: 4px 6px;
}

.hig-user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: transparent;
  border: none;
  font-family: var(--font-system);
  font-size: 13px;
  font-weight: 500;
  color: var(--label, #0f172a);
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}

.hig-user-menu-item:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--label, #0f172a);
}

.hig-user-menu-item.destructive {
  color: var(--system-red, #ff3b30);
}

.hig-user-menu-item.destructive:hover {
  background: rgba(255, 59, 48, 0.08);
  color: var(--system-red, #ff3b30);
}

.hig-user-menu-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--secondary-label, #8e8e93);
  flex-shrink: 0;
}

.hig-user-menu-item:hover .hig-user-menu-icon {
  color: currentColor;
}

.hig-user-menu-item.destructive .hig-user-menu-icon {
  color: var(--system-red, #ff3b30);
}

.hig-user-menu-section-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--secondary-label, #8e8e93);
  padding: 6px 10px 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

[data-theme="dark"] .hig-user-menu-section-label {
  color: #94a3b8;
}

.hig-user-menu a.hig-user-menu-item {
  text-decoration: none;
  box-sizing: border-box;
}

.hig-user-menu a.hig-user-menu-item.active-destination {
  background: var(--system-accent-subtle, rgba(59, 47, 201, 0.08));
}

[data-theme="dark"] .hig-user-menu a.hig-user-menu-item.active-destination {
  background: rgba(99, 102, 241, 0.16);
}

#admin-suite-popover {
  display: flex !important;
  position: static !important;
  width: 100% !important;
  box-shadow: none !important;
  border: none !important;
  padding: 0 !important;
  background: transparent !important;
}

/* ==========================================================================
   Apple HIG Two-Tier Navigation System (Option C)
   ========================================================================== */

/* Tier 1: Universal App Command Bar Mode Switcher */
.hub-header.app-header,
.hub-header {
  height: 56px;
  min-height: 56px;
}

#admin-tier1-nav {
  display: inline-flex;
  align-items: center;
  background: var(--secondary-system-background, #f2f2f7);
  padding: 3px;
  border-radius: var(--radius-full, 9999px);
  border: 1px solid var(--separator, rgba(60, 60, 67, 0.15));
  gap: 2px;
  user-select: none;
  -webkit-user-select: none;
}

#admin-tier1-nav .hig-segment-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: var(--radius-full, 9999px);
  border: 1px solid transparent;
  background: transparent;
  font-family: var(--font-system);
  font-size: 13px;
  font-weight: 500;
  color: var(--secondary-label, rgba(60, 60, 67, 0.60));
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--spring-duration-fast, 0.2s) cubic-bezier(0.32, 0.72, 0, 1);
}

#admin-tier1-nav .hig-segment-btn:hover {
  color: var(--label, #0f172a);
  background: rgba(0, 0, 0, 0.03);
}

#admin-tier1-nav .hig-segment-btn.active {
  background: var(--system-background, #ffffff);
  color: var(--label, #0f172a);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 1px rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] #admin-tier1-nav .hig-segment-btn.active {
  background: var(--tertiary-system-background, #2c2c2e);
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.08);
}

#admin-tier1-nav .hig-segment-btn svg {
  width: 14px;
  height: 14px;
  stroke-width: 2;
  flex-shrink: 0;
}

/* Tier 2: Contextual Secondary Bar */
.admin-context-bar,
#admin-tier2-campaign-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 48px;
  padding: 6px 0;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--separator, rgba(60, 60, 67, 0.15));
  background: transparent;
  flex-wrap: wrap;
}

#admin-tier2-campaign-bar .hig-campaign-selector-wrap {
  flex-shrink: 0;
}

#admin-tier2-campaign-bar .admin-os-nav-container {
  display: flex;
  align-items: center;
  flex: 1;
  justify-content: center;
}

#admin-tier2-campaign-bar .admin-os-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Top Nav Audience Persona Switcher */
.hig-audience-switcher {
  display: inline-flex;
  align-items: center;
  background: var(--tertiary-system-fill, rgba(118, 118, 128, 0.12));
  padding: 3px;
  border-radius: var(--radius-full, 9999px);
  gap: 2px;
}

.hig-audience-switcher .hig-segment-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full, 9999px);
  border: none;
  background: transparent;
  font-family: var(--font-system);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--secondary-label, rgba(60, 60, 67, 0.60));
  cursor: pointer;
  transition: all var(--spring-duration-fast, 0.2s) cubic-bezier(0.32, 0.72, 0, 1);
}

.hig-audience-switcher .hig-segment-btn:hover {
  color: var(--label, #0f172a);
}

.hig-audience-switcher .hig-segment-btn.active {
  background: var(--system-background, #ffffff);
  color: var(--label, #0f172a);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .hig-audience-switcher .hig-segment-btn.active {
  background: var(--tertiary-system-background, #2c2c2e);
  color: #ffffff;
}

.hig-audience-switcher .preview-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.hig-audience-switcher .admin-dot { background-color: var(--system-accent, #007aff); }
.hig-audience-switcher .creator-dot { background-color: var(--system-orange, #ff9500); }
.hig-audience-switcher .client-dot { background-color: var(--system-indigo, #5856d6); }

/* Responsive Layout Rules */
@media (max-width: 1024px) {
  #admin-tier1-nav .hig-segment-btn span {
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #admin-tier2-campaign-bar {
    gap: 10px;
  }

  #admin-tier2-campaign-bar .admin-os-nav-container {
    order: 3;
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 4px;
  }
}

@media (max-width: 640px) {
  #admin-tier1-nav .hig-segment-btn span {
    display: none;
  }
  #admin-tier1-nav .hig-segment-btn {
    padding: 6px 10px;
  }
}

/* ==========================================================================
   Apple HIG Cupertino Left Sidebar System
   Zero Unicode Emoji Compliance
   ========================================================================== */

/* ==========================================================================
   Apple HIG Cupertino Left Sidebar System
   Persistent Full-Width Top Navigation Architecture
   Zero Unicode Emoji Compliance
   ========================================================================== */

.hig-app-shell {
  display: flex !important;
  flex-direction: column !important;
  min-height: 100vh;
  width: 100%;
  background: var(--system-background, #ffffff);
}

/* Persistent Full-Width Top Navigation Bar */
.hub-header.hig-top-toolbar {
  width: 100%;
  height: 56px;
  min-height: 56px;
  max-height: 56px;
  position: sticky;
  top: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--material-thick, rgba(255, 255, 255, 0.92));
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border-bottom: 1px solid var(--separator, rgba(60, 60, 67, 0.12));
  box-sizing: border-box;
}

[data-theme="dark"] .hub-header.hig-top-toolbar {
  background: rgba(28, 28, 30, 0.95);
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.hig-topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  margin-right: 4px;
}

/* Workspace Layout: Row below Persistent Top Toolbar */
.hig-workspace-layout {
  display: flex !important;
  flex-direction: row !important;
  flex: 1;
  min-height: calc(100vh - 56px);
  width: 100%;
  position: relative;
}

/* Sidebar Container (Sits below persistent top navigation) */
#admin-sidebar {
  width: 260px;
  min-width: 260px;
  max-width: 260px;
  height: calc(100vh - 56px);
  position: sticky;
  top: 56px;
  display: none;
  flex-direction: column;
  background: var(--secondary-system-background, #f2f2f7);
  border-right: 1px solid var(--separator, rgba(60, 60, 67, 0.15));
  z-index: 100;
  transition: width var(--spring-duration-fast, 0.25s) cubic-bezier(0.32, 0.72, 0, 1),
              min-width var(--spring-duration-fast, 0.25s) cubic-bezier(0.32, 0.72, 0, 1);
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
}

html.role-admin #admin-sidebar {
  display: flex !important;
}

[data-theme="dark"] #admin-sidebar {
  background: var(--secondary-system-background, #1c1c1e);
  border-right-color: var(--separator, rgba(255, 255, 255, 0.1));
}

/* Collapsed Sidebar */
.sidebar-collapsed #admin-sidebar {
  width: 72px;
  min-width: 72px;
  max-width: 72px;
}

.sidebar-collapsed #admin-sidebar .hig-sidebar-scope-label,
.sidebar-collapsed #admin-sidebar .hig-campaign-trigger-text,
.sidebar-collapsed #admin-sidebar .hig-sidebar-scope-actions,
.sidebar-collapsed #admin-sidebar .hig-sidebar-group-title,
.sidebar-collapsed #admin-sidebar .hig-sidebar-item-label,
.sidebar-collapsed #admin-sidebar .hig-sidebar-role-label,
.sidebar-collapsed #admin-sidebar .hig-audience-switcher span:not(.preview-dot),
.sidebar-collapsed #admin-sidebar .status-badge,
.sidebar-collapsed #admin-sidebar .hig-tab-counter,
.sidebar-collapsed #admin-sidebar #campaign-selector-caret {
  display: none !important;
}

.sidebar-collapsed #admin-sidebar .hig-sidebar-item {
  justify-content: center;
  padding: 10px 0;
}

.sidebar-collapsed #admin-sidebar .hig-campaign-trigger {
  justify-content: center;
  padding: 8px 0;
}

.hig-sidebar-collapse-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--secondary-label, rgba(60, 60, 67, 0.6));
  cursor: pointer;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm, 6px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  padding: 0;
  margin-left: auto;
  margin-right: -4px;
}

.hig-sidebar-collapse-btn:hover {
  background: var(--tertiary-system-fill, rgba(120, 120, 128, 0.14));
  border-color: var(--separator, rgba(60, 60, 67, 0.15));
  color: var(--label, #0f172a);
}

[data-theme="dark"] .hig-sidebar-collapse-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.sidebar-collapsed #admin-sidebar .hig-sidebar-scope-card {
  padding: 8px 6px 12px 6px !important;
}

.sidebar-collapsed #admin-sidebar .hig-sidebar-scope-header {
  display: flex !important;
  width: 100% !important;
  justify-content: center !important;
  align-items: center !important;
  padding: 2px 0 0 0 !important;
  margin: 0 0 8px 0 !important;
}

.sidebar-collapsed #admin-sidebar .hig-sidebar-scope-label {
  display: none !important;
}

.sidebar-collapsed #admin-sidebar .hig-sidebar-collapse-btn {
  display: flex !important;
  margin: 0 auto !important;
  width: 36px !important;
  height: 36px !important;
  border-radius: var(--radius-md, 8px) !important;
  background: var(--tertiary-system-fill, rgba(120, 120, 128, 0.12)) !important;
  border: 1px solid var(--separator, rgba(60, 60, 67, 0.16)) !important;
  color: var(--label, #0f172a) !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

[data-theme="dark"] .sidebar-collapsed #admin-sidebar .hig-sidebar-collapse-btn {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.16) !important;
  color: #ffffff !important;
}

.sidebar-collapsed #admin-sidebar .hig-sidebar-collapse-btn:hover {
  background: var(--system-accent, #007aff) !important;
  border-color: var(--system-accent, #007aff) !important;
  color: #ffffff !important;
  transform: scale(1.05) !important;
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.35) !important;
}

/* Active Campaign Scope Card & Refined Selector */
.hig-sidebar-scope-card {
  padding: 12px 10px 14px 12px;
  border-bottom: 1px solid var(--separator, rgba(60, 60, 67, 0.12));
  background: transparent;
  box-sizing: border-box;
}

[data-theme="dark"] .hig-sidebar-scope-card {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.hig-sidebar-scope-header {
  width: 100% !important;
  flex: 1 1 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  margin-bottom: 8px !important;
  padding: 0 2px !important;
  box-sizing: border-box !important;
}

.hig-sidebar-scope-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--secondary-label, rgba(60, 60, 67, 0.5));
}

[data-theme="dark"] .hig-sidebar-scope-label {
  color: rgba(255, 255, 255, 0.45);
}

/* Prominent, Clean Interactive Campaign Trigger */
#admin-sidebar .hig-campaign-selector-wrap {
  width: 100% !important;
  max-width: 100% !important;
  display: block !important;
  box-sizing: border-box !important;
  position: relative !important;
}

#admin-sidebar .hig-campaign-trigger {
  width: 100% !important;
  max-width: 100% !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 8px 10px !important;
  background: var(--system-background, #ffffff);
  border: 1px solid var(--separator, rgba(60, 60, 67, 0.15));
  border-radius: var(--radius-md, 10px);
  cursor: pointer;
  text-align: left;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: all 0.15s ease;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

[data-theme="dark"] #admin-sidebar .hig-campaign-trigger {
  background: var(--tertiary-system-background, #2c2c2e);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

#admin-sidebar .hig-campaign-trigger:hover {
  border-color: var(--system-accent, #007aff);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] #admin-sidebar .hig-campaign-trigger:hover {
  border-color: rgba(255, 255, 255, 0.3);
}

#admin-sidebar .hig-campaign-brand-logo {
  width: 28px !important;
  height: 28px !important;
  max-width: 28px !important;
  max-height: 28px !important;
  object-fit: contain !important;
  padding: 2px !important;
  border-radius: 7px !important;
  background: rgba(0, 0, 0, 0.04) !important;
  border: 1px solid var(--separator, rgba(60, 60, 67, 0.1)) !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
}

[data-theme="dark"] #admin-sidebar .hig-campaign-brand-logo {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

#admin-sidebar .hig-campaign-trigger-text,
#admin-sidebar .hig-campaign-picker-info {
  flex: 1 1 0% !important;
  min-width: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 1px !important;
  overflow: hidden !important;
}

#admin-sidebar .hig-campaign-title-text,
#admin-sidebar .hig-campaign-picker-title {
  font-size: 12.5px !important;
  font-weight: 600 !important;
  color: var(--label, #0f172a) !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
}

[data-theme="dark"] #admin-sidebar .hig-campaign-title-text,
[data-theme="dark"] #admin-sidebar .hig-campaign-picker-title {
  color: #ffffff !important;
}

/* Status Badge inside selector */
#admin-sidebar .hig-sidebar-scope-card .status-badge {
  flex-shrink: 0 !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  letter-spacing: 0.04em !important;
  padding: 2px 7px !important;
  border-radius: 9999px !important;
  text-transform: uppercase !important;
  line-height: 1.3 !important;
  margin-left: auto !important;
  white-space: nowrap !important;
}

#admin-sidebar .hig-campaign-caret {
  flex-shrink: 0 !important;
  color: var(--secondary-label, rgba(60, 60, 67, 0.5)) !important;
  transition: transform 0.2s ease !important;
  margin-left: 2px !important;
}

#admin-sidebar .hig-campaign-trigger.open .hig-campaign-caret {
  transform: rotate(180deg) !important;
}

/* Action Buttons below selector */
.hig-sidebar-scope-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.hig-sidebar-action-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--system-background, #ffffff);
  border: 1px solid var(--separator, rgba(60, 60, 67, 0.15));
  border-radius: var(--radius-sm, 7px);
  font-size: 12px;
  font-weight: 600;
  color: var(--label, #0f172a);
  cursor: pointer;
  transition: all 0.15s ease;
}

[data-theme="dark"] .hig-sidebar-action-btn {
  background: var(--tertiary-system-background, #2c2c2e);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.1);
}

.hig-sidebar-action-btn:hover {
  background: var(--secondary-system-background, #f2f2f7);
}

[data-theme="dark"] .hig-sidebar-action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Ensure Sidebar never scrolls horizontally or obscures Active label */
#admin-sidebar {
  overflow-x: hidden !important;
}

#admin-sidebar .hig-campaign-popover {
  position: absolute !important;
  top: calc(100% + 6px) !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  z-index: 9999 !important;
  padding: 8px !important;
}

#admin-sidebar .hig-campaign-group-header {
  font-size: 10.5px !important;
  font-weight: 700 !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
  color: var(--secondary-label) !important;
  padding: 8px 10px 4px !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  white-space: nowrap !important;
}

#admin-sidebar .hig-campaign-picker-item {
  width: 100% !important;
  box-sizing: border-box !important;
  padding: 8px 10px !important;
  gap: 8px !important;
}

/* Sidebar Navigation Items */
.hig-sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#admin-sidebar .hig-sidebar-group,
#admin-sidebar #admin-segmented-nav {
  display: flex !important;
  flex-direction: column !important;
  gap: 3px !important;
  padding: 0 !important;
  width: 100% !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  margin: 0 !important;
}

#admin-sidebar #admin-tier1-nav {
  display: none !important;
}

.hig-sidebar-group-title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--secondary-label, rgba(60, 60, 67, 0.5));
  padding: 4px 8px 6px;
}

#admin-sidebar .hig-sidebar-item {
  width: 100% !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 10px !important;
  padding: 9px 12px !important;
  border-radius: var(--radius-md, 8px) !important;
  border: none !important;
  background: transparent !important;
  color: var(--secondary-label, rgba(60, 60, 67, 0.7)) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  text-align: left !important;
  transition: all 0.15s cubic-bezier(0.32, 0.72, 0, 1) !important;
  box-sizing: border-box !important;
  white-space: nowrap !important;
}

.hig-sidebar-item svg {
  flex-shrink: 0;
  color: inherit;
}

.hig-sidebar-item:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--label, #0f172a);
}

[data-theme="dark"] .hig-sidebar-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.hig-sidebar-item.active {
  background: var(--system-background, #ffffff);
  color: var(--system-accent, #007aff);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 1px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .hig-sidebar-item.active {
  background: var(--tertiary-system-background, #2c2c2e);
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.hig-sidebar-item .hig-tab-counter {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
  color: var(--secondary-label);
}

[data-theme="dark"] .hig-sidebar-item .hig-tab-counter {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.hig-sidebar-item.active .hig-tab-counter {
  background: var(--system-accent, #007aff);
  color: #ffffff;
}

/* Sidebar Footer */
.hig-sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--separator, rgba(60, 60, 67, 0.12));
  background: rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .hig-sidebar-footer {
  background: rgba(255, 255, 255, 0.02);
}

.hig-sidebar-role-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--secondary-label, rgba(60, 60, 67, 0.5));
  margin-bottom: 6px;
}

/* Main Stage & Top Toolbar */
.hig-main-stage {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 56px);
  background: var(--system-background, #ffffff);
}

[data-theme="dark"] .hig-main-stage {
  background: var(--system-background, #000000);
}

.hig-top-toolbar {
  height: 56px;
  min-height: 56px;
  max-height: 56px;
  border-bottom: 1px solid var(--separator, rgba(60, 60, 67, 0.12));
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--system-background, #ffffff);
  box-sizing: border-box;
}

[data-theme="dark"] .hig-top-toolbar {
  background: var(--secondary-system-background, #1c1c1e);
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.hig-toolbar-left {
  display: flex;
  align-items: center;
  gap: 0;
}

.hig-brand-lockup {
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(260px - 24px);
  min-width: calc(260px - 24px);
  flex-shrink: 0;
  box-sizing: border-box;
}

.hig-brand-lockup .hig-topbar-brand {
  margin-right: 0;
}

.sidebar-collapsed .hig-brand-lockup {
  width: auto;
  min-width: auto;
  margin-right: 16px;
}

.hig-mobile-sidebar-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--label);
  cursor: pointer;
}

.hig-breadcrumb-wrap {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--secondary-label);
}

.hig-breadcrumb-sep {
  color: var(--tertiary-label, rgba(60, 60, 67, 0.3));
}

.hig-breadcrumb-campaign {
  color: var(--label, #0f172a);
  font-weight: 600;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-theme="dark"] .hig-breadcrumb-campaign {
  color: #ffffff;
}

.hig-breadcrumb-section {
  color: var(--system-accent, #007aff);
  font-weight: 600;
}

/* Mobile & Tablet Overrides */
@media (max-width: 1024px) {
  .hig-brand-lockup {
    width: auto;
    min-width: auto;
    margin-right: 12px;
  }
  #admin-sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    bottom: 0;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.2);
    z-index: 1000;
  }
  .sidebar-open #admin-sidebar {
    left: 0;
  }
  .hig-mobile-sidebar-toggle {
    display: inline-flex;
  }
}






/* ==========================================================================
   8. Safe Area Insets & Mobile Viewport Tokens
   ========================================================================== */

:root {
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --app-viewport-height: 100dvh;
  --tab-bar-height-mobile: calc(64px + var(--sab));
}

/* Fluid clamping for headings */
h1 { font-size: clamp(22px, 5vw, 32px); }
h2 { font-size: clamp(18px, 4vw, 26px); }
h3 { font-size: clamp(15px, 3.5vw, 20px); }

/* Input zoom prevention for iOS */
input, textarea, select {
  font-size: max(16px, 1rem) !important;
}

/* ==========================================================================
   9. Cupertino Bottom Tab Bar (HIG)
   ========================================================================== */

.hig-bottom-tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 400;
  display: none;
  align-items: center;
  justify-content: space-around;
  height: calc(56px + var(--sab, 0px));
  padding-bottom: var(--sab, 0px);
  background: rgba(249, 249, 249, 0.94);
  backdrop-filter: blur(24px) saturate(190%);
  -webkit-backdrop-filter: blur(24px) saturate(190%);
  border-top: 0.5px solid rgba(60, 60, 67, 0.12);
  box-sizing: content-box;
}

[data-theme="dark"] .hig-bottom-tabbar {
  background: rgba(30, 30, 30, 0.94);
  border-top-color: rgba(255, 255, 255, 0.12);
}

.hig-tabbar-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 4px 8px 6px;
  gap: 3px;
  border: none;
  background: transparent;
  color: var(--secondary-label, rgba(60, 60, 67, 0.5));
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: color 0.2s ease, transform 0.15s cubic-bezier(0.32, 0.72, 0, 1);
  -webkit-tap-highlight-color: transparent;
}

.hig-tabbar-btn .hig-tabbar-icon-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 28px;
  border-radius: 14px;
  transition: background-color 0.2s ease, transform 0.15s ease;
}

.hig-tabbar-btn svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  transition: stroke 0.2s ease;
}

.hig-tabbar-btn.active,
.hig-tabbar-btn[aria-current="true"] {
  color: var(--system-accent, #007aff);
}

.hig-tabbar-btn.active svg,
.hig-tabbar-btn[aria-current="true"] svg {
  stroke: var(--system-accent, #007aff);
}

.hig-tabbar-btn.active .hig-tabbar-icon-wrap,
.hig-tabbar-btn[aria-current="true"] .hig-tabbar-icon-wrap {
  background: rgba(0, 113, 227, 0.12);
}

[data-theme="dark"] .hig-tabbar-btn.active .hig-tabbar-icon-wrap,
[data-theme="dark"] .hig-tabbar-btn[aria-current="true"] .hig-tabbar-icon-wrap {
  background: rgba(41, 151, 255, 0.18);
}

.hig-tabbar-btn .hig-tabbar-badge {
  position: absolute;
  top: -3px;
  right: -2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  border-radius: 8px;
  background: var(--system-accent, #007aff);
  color: #fff;
  text-align: center;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .hig-bottom-tabbar {
    display: flex;
  }
}

/* ==========================================================================
   10. Apple Sheet Presentation Detents
   ========================================================================== */

.sheet-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.sheet-modal-backdrop.open {
  display: flex;
}

.sheet-modal-dialog {
  position: relative;
  width: 100%;
  max-width: 600px;
  max-height: 92dvh;
  background: var(--system-background, #ffffff);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sheet-drag-pill {
  width: 36px;
  height: 5px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
  margin: 8px auto 0;
  flex-shrink: 0;
}

[data-theme="dark"] .sheet-drag-pill {
  background: rgba(255, 255, 255, 0.22);
}

.sheet-modal-dialog > * {
  overflow: auto;
  overscroll-behavior: contain;
}


/* ==========================================================================
   11. Authentication UI Components (HIG)
   ========================================================================== */

/* --- Auth Card --- */
.auth-card {
  max-width: 440px;
  margin: 6vh auto;
  padding: 32px;
  background: var(--secondary-system-grouped-background, #ffffff);
  border-radius: 20px;
  border: 0.5px solid var(--card-border, rgba(0,0,0,0.08));
  box-shadow: var(--shadow-card, 0 4px 20px rgba(0,0,0,0.05), 0 1px 3px rgba(0,0,0,0.03));
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

[data-theme="dark"] .auth-card {
  background: rgba(44, 44, 46, 0.95);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

/* --- Segmented Control (Apple sliding pill) --- */
.segmented-control {
  display: flex;
  position: relative;
  background: var(--system-grouped-background, #f2f2f7);
  border-radius: var(--radius-sm, 10px);
  padding: 2px;
  gap: 0;
  isolation: isolate;
}

[data-theme="dark"] .segmented-control {
  background: rgba(120, 120, 128, 0.18);
}

.segmented-control [role="tab"] {
  flex: 1;
  text-align: center;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  line-height: 20px;
  letter-spacing: -0.01em;
  color: var(--label, #0f172a);
  background: transparent;
  border: none;
  border-radius: var(--radius-xs, 8px);
  cursor: pointer;
  z-index: 1;
  transition: color var(--spring-duration-fast, 0.22s) ease;
  -webkit-tap-highlight-color: transparent;
  min-height: var(--touch-target-min, 44px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.segmented-control [role="tab"][aria-selected="true"] {
  color: var(--label, #0f172a);
}

.segmented-control .segment-indicator {
  position: absolute;
  height: calc(100% - 4px);
  top: 2px;
  border-radius: var(--radius-xs, 8px);
  background: var(--system-background, #ffffff);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  transition: left var(--spring-duration-normal, 0.35s) var(--spring-timing, cubic-bezier(0.32,0.72,0,1)),
              width var(--spring-duration-normal, 0.35s) var(--spring-timing, cubic-bezier(0.32,0.72,0,1));
  z-index: 0;
  pointer-events: none;
}

[data-theme="dark"] .segmented-control .segment-indicator {
  background: rgba(120, 120, 128, 0.24);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* --- Password Strength Meter --- */
.password-meter {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  margin-bottom: 4px;
}

.password-meter-bar {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--secondary-system-fill, rgba(120,120,128,0.16));
  transition: background-color 0.3s ease;
}

.password-meter-bar.weak { background-color: #e02424; }
.password-meter-bar.medium { background-color: #f59e0b; }
.password-meter-bar.strong { background-color: #10b981; }

.password-meter-label {
  font-size: 12px;
  color: var(--secondary-label, rgba(60,60,67,0.60));
  margin-top: 2px;
  min-height: 18px;
}

/* --- Password Toggle Button --- */
.password-toggle-btn {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--secondary-label, rgba(60,60,67,0.60));
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  border-radius: var(--radius-sm, 10px);
  transition: background-color 0.2s ease;
}

.password-toggle-btn:hover {
  background: var(--secondary-system-fill, rgba(120,120,128,0.16));
}

.password-toggle-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* --- Auth form inputs --- */
.auth-input-group {
  position: relative;
  margin-bottom: 16px;
}

.auth-input-group input[type="password"],
.auth-input-group input[type="text"] {
  width: 100%;
  height: 48px;
  padding: 0 48px 0 16px;
  font-size: 16px;
  border: 0.5px solid var(--separator, rgba(60,60,67,0.20));
  border-radius: var(--radius-sm, 10px);
  background: var(--system-background, #ffffff);
  color: var(--label, #0f172a);
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
}

.auth-input-group input:focus {
  border-color: var(--system-accent, #3b2fc9);
}

.auth-input-group .password-toggle-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
}

/* --- Auth submit button --- */
.auth-submit-btn {
  width: 100%;
  min-height: 48px;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm, 10px);
  background: var(--system-accent, #3b2fc9);
  color: var(--system-accent-contrast, #ffffff);
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.auth-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* --- Status & validation messages --- */
.auth-status {
  margin: 12px 0;
  font-size: 14px;
  line-height: 1.4;
  min-height: 20px;
}

.auth-status.error {
  color: var(--system-red, #ff3b30);
}

.auth-status.success {
  color: var(--system-green, #34c759);
}

.auth-status.info {
  color: var(--secondary-label, rgba(60,60,67,0.60));
}

/* --- Mobile responsiveness --- */
@media (max-width: 480px) {
  .auth-card {
    width: calc(100% - 32px);
    max-width: 440px;
    margin: 40px auto;
    padding: 24px;
    border-radius: 16px;
  }
}

/* ── Suite Switcher Popover ── */
.suite-switcher-wrap {
  position: relative;
  display: inline-block;
}
.suite-switcher-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 270px;
  background: var(--tertiary-system-background, #ffffff);
  border: 1px solid var(--separator, rgba(60, 60, 67, 0.12));
  border-radius: var(--radius-md, 14px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.04);
  padding: 8px;
  z-index: 1000;
  display: none;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: higFadeIn 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}
.suite-switcher-popover.show {
  display: block;
}
.suite-active-badge {
  font-size: 10px;
  font-weight: 700;
  background: var(--system-accent-subtle, rgba(59, 47, 201, 0.08));
  color: var(--system-accent, #3b2fc9);
  padding: 2px 6px;
  border-radius: 6px;
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  vertical-align: middle;
}
[data-theme="dark"] .suite-switcher-popover {
  background: rgba(28, 28, 30, 0.94);
  border-color: rgba(255, 255, 255, 0.12);
}
[data-theme="dark"] .suite-active-badge {
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
}

/* ==========================================================================
   Unified Suite Top Navigation Component (amplify-top-nav)
   ========================================================================== */

amplify-top-nav {
  display: block;
  width: 100%;
  position: sticky;
  top: 0;
  z-index: var(--z-nav, 200);
}

.amplify-top-nav-bar {
  position: relative;
  width: 100%;
  height: 52px;
  min-height: 52px;
  background: var(--card-frosted, rgba(255, 255, 255, 0.85));
  backdrop-filter: blur(24px) saturate(190%);
  -webkit-backdrop-filter: blur(24px) saturate(190%);
  border-bottom: 1px solid var(--separator, rgba(60, 60, 67, 0.12));
  padding: 0 20px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: background 0.3s cubic-bezier(0.32, 0.72, 0, 1), border-color 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

[data-theme="dark"] .amplify-top-nav-bar {
  background: rgba(22, 27, 38, 0.88);
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

/* Zone 1: Global Left Anchor */
.amplify-nav-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex-shrink: 0;
}

.amplify-brand-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  cursor: pointer;
  outline: none;
}

.amplify-brand-logo {
  height: 32px;
  max-height: 32px;
  width: auto;
  object-fit: contain;
  display: block;
}

.amplify-app-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: var(--radius-full, 9999px);
  background: var(--system-accent-subtle, rgba(59, 47, 201, 0.08));
  color: var(--system-accent, #3b2fc9);
  border: 1px solid rgba(59, 47, 201, 0.14);
  line-height: 1.4;
  white-space: nowrap;
}

[data-theme="dark"] .amplify-app-badge {
  background: rgba(99, 102, 241, 0.18);
  color: #a5b4fc;
  border-color: rgba(99, 102, 241, 0.28);
}

.amplify-left-context-slot {
  display: flex;
  align-items: center;
  min-width: 0;
}

/* Zone 2: Dynamic Center Zone */
.amplify-nav-center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-width: 0;
  padding: 0 12px;
}

/* Zone 3: Global Right Anchor */
.amplify-nav-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  flex-shrink: 0;
}

.amplify-actions-slot {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Responsive Collapses */
@media (max-width: 1024px) {
  .amplify-top-nav-bar {
    padding: 0 16px;
    gap: 12px;
  }
}

@media (max-width: 768px) {
  .amplify-top-nav-bar {
    height: 48px;
    min-height: 48px;
    padding: 0 12px;
    gap: 8px;
  }

  .amplify-nav-center {
    display: none;
  }

  .amplify-app-badge {
    font-size: 10px;
    padding: 2px 6px;
  }

  .amplify-brand-logo {
    height: 28px;
    max-height: 28px;
  }

  .hub-user-pill {
    padding: 2px 8px 2px 2px;
  }

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

