/**
 * MASTER CODEX FINANCIAL - CSS Layer
 * Marlowe Partners UX System
 * 
 * All classes namespaced with .cdx- for isolation
 * Mobile-first with iOS/Safari optimizations
 * 
 * Features: 51-100 (Polish Layer) + CSS portions of other layers
 */

/* ==========================================================================
   PART 0: ROOT VARIABLES & RESETS
   ========================================================================== */

:root {
  /* Core spacing */
  --cdx-spacer: 1rem;
  --cdx-spacer-sm: 0.5rem;
  --cdx-spacer-lg: 1.5rem;
  --cdx-spacer-xl: 2rem;
  
  /* Typography */
  --cdx-font-size-base: 16px;
  --cdx-line-height: 1.6;
  --cdx-max-width: 75ch;
  
  /* Colors - Light Mode */
  --cdx-text: #222;
  --cdx-bg: #fff;
  --cdx-primary: #007bff;
  --cdx-success: #28a745;
  --cdx-warning: #ffc107;
  --cdx-danger: #dc3545;
  --cdx-muted: #6c757d;
  
  /* Shadows */
  --cdx-shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --cdx-shadow: 0 4px 6px rgba(0,0,0,0.1);
  --cdx-shadow-lg: 0 10px 25px rgba(0,0,0,0.15);
  
  /* Transitions */
  --cdx-transition-fast: 0.15s ease;
  --cdx-transition: 0.2s ease;
  --cdx-transition-slow: 0.3s ease;
  
  /* Z-index layers */
  --cdx-z-dropdown: 1000;
  --cdx-z-sticky: 1020;
  --cdx-z-modal: 2147483647;
  --cdx-z-toast: 2147483646;
  
  /* Safe areas for iOS */
  --cdx-safe-bottom: env(safe-area-inset-bottom, 0px);
  --cdx-safe-top: env(safe-area-inset-top, 0px);
}

/* Dark mode variables */
.cdx-dark {
  --cdx-text: #f0f0f0;
  --cdx-bg: #1a1a2e;
  --cdx-primary: #4dabf7;
}

/* #64: Contrast - Base text colors */
.cdx-base {
  color: var(--cdx-text);
  background-color: var(--cdx-bg);
}

/* #65: System Fonts */
.cdx-system-font,
.cdx-base {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* ==========================================================================
   PART 1: MOBILE-FIRST FOUNDATIONS
   ========================================================================== */

/* Remove iOS tap highlight */
.cdx-no-tap-highlight,
.cdx-interactive {
  -webkit-tap-highlight-color: transparent;
}

/* #95: Fast Tap - Prevent double-tap zoom */
.cdx-fast-tap,
.cdx-interactive {
  touch-action: manipulation;
}

/* #56: Cursor Hand - Force pointer on interactive elements */
.cdx-pointer,
button.cdx-btn,
.cdx-interactive,
[role="button"] {
  cursor: pointer;
}

/* #78: Touch Target - iOS minimum 44px */
.cdx-touch-target {
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   PART 2: INTERACTION STATES (51-56)
   ========================================================================== */

/* #51: Hover Lift */
.cdx-lift {
  transition: transform var(--cdx-transition), box-shadow var(--cdx-transition);
}
.cdx-lift:hover {
  transform: translateY(-2px);
  box-shadow: var(--cdx-shadow);
}

/* #52: Active Press */
.cdx-press {
  transition: transform var(--cdx-transition-fast);
}
.cdx-press:active {
  transform: scale(0.98);
}

/* Combined lift + press for buttons */
.cdx-btn {
  transition: transform var(--cdx-transition), box-shadow var(--cdx-transition), background-color var(--cdx-transition);
  position: relative;
}
.cdx-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--cdx-shadow);
}
.cdx-btn:active {
  transform: scale(0.98);
}

/* Keyboard shortcut hints - show on hover */
.cdx-shortcut-hint {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  font-size: 11px;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
  z-index: var(--cdx-z-toast);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.cdx-shortcut-hint::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid rgba(0, 0, 0, 0.85);
}
.cdx-btn:hover .cdx-shortcut-hint,
.cdx-has-shortcut:hover .cdx-shortcut-hint {
  opacity: 1;
  visibility: visible;
}
/* Keyboard badge styling */
.cdx-kbd {
  display: inline-block;
  background: linear-gradient(180deg, #fafafa 0%, #e8e8e8 100%);
  border: 1px solid #ccc;
  border-radius: 3px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.2), inset 0 0 0 1px #fff;
  color: #333;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', monospace;
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
  padding: 3px 5px;
  margin: 0 1px;
}

/* #53: Focus Glow */
.cdx-focus-glow:focus,
input.cdx-input:focus,
textarea.cdx-input:focus,
select.cdx-input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

/* ==========================================================================
   PART 3: LOADING STATES (54, 32-33)
   ========================================================================== */

/* #54 & #32: Skeleton Animation - Shimmer effect */
@keyframes cdx-shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.cdx-skeleton {
  background: linear-gradient(
    90deg,
    #f0f0f0 25%,
    #e0e0e0 50%,
    #f0f0f0 75%
  );
  background-size: 200% 100%;
  animation: cdx-shimmer 1.5s infinite;
  border-radius: 4px;
}

.cdx-dark .cdx-skeleton {
  background: linear-gradient(
    90deg,
    #2a2a3e 25%,
    #3a3a4e 50%,
    #2a2a3e 75%
  );
  background-size: 200% 100%;
}

/* #33: Skeleton UI - Placeholder blocks */
.cdx-skeleton-text {
  height: 1em;
  margin-bottom: 0.5em;
  border-radius: 4px;
}

.cdx-skeleton-title {
  height: 1.5em;
  width: 60%;
  margin-bottom: 1em;
}

.cdx-skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.cdx-skeleton-card {
  height: 200px;
  border-radius: 8px;
}

/* #32: Pulse Loader */
@keyframes cdx-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.cdx-pulse {
  animation: cdx-pulse 2s ease-in-out infinite;
}

/* ==========================================================================
   PART 4: MENU & DROPDOWN ANIMATIONS (55)
   ========================================================================== */

/* #55: Menu Slide */
.cdx-dropdown {
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity var(--cdx-transition), transform var(--cdx-transition);
  pointer-events: none;
}

.cdx-dropdown.cdx-open,
.cdx-dropdown-trigger:focus + .cdx-dropdown,
.cdx-dropdown-trigger:hover + .cdx-dropdown {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ==========================================================================
   PART 5: LINK STYLES (57, 68, 82)
   ========================================================================== */

/* #57: Link Fade */
.cdx-link {
  color: var(--cdx-primary);
  text-decoration: none;
  transition: color var(--cdx-transition);
}

.cdx-link:hover {
  color: color-mix(in srgb, var(--cdx-primary) 80%, black);
}

/* #68: Link Style - Underline thickness */
.cdx-link-underline {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

/* #82: Visited Links */
.cdx-link:visited {
  color: color-mix(in srgb, var(--cdx-primary) 70%, #666);
}

/* #97: External Link Icon */
.cdx-external-link::after {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 4px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'/%3E%3Cpolyline points='15,3 21,3 21,9'/%3E%3Cline x1='10' y1='14' x2='21' y2='3'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  vertical-align: middle;
  opacity: 0.7;
}

/* ==========================================================================
   PART 6: STICKY & FIXED ELEMENTS (58, 60, 86)
   ========================================================================== */

/* #58: Sticky Header */
.cdx-sticky {
  position: sticky;
  top: 0;
  z-index: var(--cdx-z-sticky);
  background: var(--cdx-bg);
}

/* #60: Progress Bar - Scroll-linked */
.cdx-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--cdx-primary), #39FF14);
  z-index: var(--cdx-z-sticky);
  transition: width 0.1s ease-out;
}

/* #86: Back to Top Button */
.cdx-back-top {
  position: fixed;
  bottom: calc(20px + var(--cdx-safe-bottom));
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--cdx-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--cdx-shadow-lg);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--cdx-transition), transform var(--cdx-transition);
  z-index: var(--cdx-z-dropdown);
  cursor: pointer;
}

.cdx-back-top.cdx-visible {
  opacity: 1;
  transform: translateY(0);
}

.cdx-back-top:hover {
  transform: translateY(-2px);
}

/* ==========================================================================
   PART 7: TYPOGRAPHY (61-63, 66-67)
   ========================================================================== */

/* #61: Line Height */
.cdx-prose {
  line-height: var(--cdx-line-height);
}

/* #62: Line Width - Max text width */
.cdx-readable {
  max-width: var(--cdx-max-width);
}

/* #63: Typography Hierarchy */
.cdx-h1, .cdx-prose h1 {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.cdx-h2, .cdx-prose h2 {
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.875rem;
}

.cdx-h3, .cdx-prose h3 {
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 0.75rem;
}

.cdx-h4, .cdx-prose h4 {
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 0.625rem;
}

/* #67: Hanging Punctuation - List styling */
.cdx-prose ul,
.cdx-prose ol {
  padding-left: 1.5em;
}

.cdx-prose li {
  margin-bottom: 0.5em;
}

.cdx-prose li::marker {
  color: var(--cdx-muted);
}

/* ==========================================================================
   PART 8: SPACING UTILITIES (69)
   ========================================================================== */

/* #69: Whitespace utilities */
.cdx-mb-1 { margin-bottom: 0.25rem; }
.cdx-mb-2 { margin-bottom: 0.5rem; }
.cdx-mb-3 { margin-bottom: 1rem; }
.cdx-mb-4 { margin-bottom: 1.5rem; }
.cdx-mb-5 { margin-bottom: 2rem; }

.cdx-mt-1 { margin-top: 0.25rem; }
.cdx-mt-2 { margin-top: 0.5rem; }
.cdx-mt-3 { margin-top: 1rem; }
.cdx-mt-4 { margin-top: 1.5rem; }
.cdx-mt-5 { margin-top: 2rem; }

.cdx-p-1 { padding: 0.25rem; }
.cdx-p-2 { padding: 0.5rem; }
.cdx-p-3 { padding: 1rem; }
.cdx-p-4 { padding: 1.5rem; }
.cdx-p-5 { padding: 2rem; }

/* ==========================================================================
   PART 9: FORM ELEMENTS (71-79)
   ========================================================================== */

/* Base input styles */
.cdx-input {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--cdx-text);
  background-color: var(--cdx-bg);
  border: 1px solid #ced4da;
  border-radius: 6px;
  transition: border-color var(--cdx-transition), box-shadow var(--cdx-transition);
}

.cdx-input:focus {
  border-color: var(--cdx-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

/* #76: Error Text */
.cdx-error-text {
  color: var(--cdx-danger);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.cdx-input.cdx-error {
  border-color: var(--cdx-danger);
}

.cdx-input.cdx-error:focus {
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.25);
}

/* #77: Button Primary */
.cdx-btn-primary {
  background-color: #1a1a2e;
  color: white;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  min-height: 44px;
}

.cdx-btn-primary:hover {
  background-color: #2a2a3e;
}

/* #79: Label Float - Floating label pattern */
.cdx-float-label {
  position: relative;
}

.cdx-float-label input,
.cdx-float-label textarea {
  padding-top: 1.5rem;
}

.cdx-float-label label {
  position: absolute;
  top: 50%;
  left: 1rem;
  transform: translateY(-50%);
  color: var(--cdx-muted);
  pointer-events: none;
  transition: all var(--cdx-transition);
}

.cdx-float-label input:focus + label,
.cdx-float-label input:not(:placeholder-shown) + label,
.cdx-float-label textarea:focus + label,
.cdx-float-label textarea:not(:placeholder-shown) + label {
  top: 0.5rem;
  transform: translateY(0);
  font-size: 0.75rem;
  color: var(--cdx-primary);
}

/* #74: Password Eye Toggle */
.cdx-pass-wrapper {
  position: relative;
}

.cdx-pass-toggle {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--cdx-muted);
  padding: 0.25rem;
}

/* ==========================================================================
   PART 10: NAVIGATION (80-81, 85)
   ========================================================================== */

/* #80: Breadcrumbs */
.cdx-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--cdx-muted);
}

.cdx-breadcrumbs a {
  color: var(--cdx-muted);
  text-decoration: none;
  transition: color var(--cdx-transition);
}

.cdx-breadcrumbs a:hover {
  color: var(--cdx-primary);
}

.cdx-breadcrumbs-separator {
  color: #ced4da;
}

.cdx-breadcrumbs-current {
  color: var(--cdx-text);
  font-weight: 500;
}

/* #85: Search Position */
.cdx-search-pos {
  position: absolute;
  top: 1rem;
  right: 1rem;
}

/* ==========================================================================
   PART 11: EMPTY STATES & ERRORS (83-84)
   ========================================================================== */

/* #83: Empty State */
.cdx-empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--cdx-muted);
}

.cdx-empty-state svg {
  width: 120px;
  height: 120px;
  margin-bottom: 1.5rem;
  opacity: 0.5;
}

.cdx-empty-state h3 {
  font-size: 1.25rem;
  color: var(--cdx-text);
  margin-bottom: 0.5rem;
}

/* #84: Custom 404 */
.cdx-404 {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--cdx-bg);
  z-index: var(--cdx-z-modal);
}

.cdx-404 h1 {
  font-size: 6rem;
  font-weight: 700;
  color: var(--cdx-muted);
  margin-bottom: 1rem;
}

/* ==========================================================================
   PART 12: TOAST NOTIFICATIONS (59)
   ========================================================================== */

/* #59: Toast Pop Animation */
@keyframes cdx-toast-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cdx-toast-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}

.cdx-toast-container {
  position: fixed;
  bottom: calc(20px + var(--cdx-safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--cdx-z-toast);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.cdx-toast {
  background: #1a1a2e;
  color: white;
  padding: 0.875rem 1.25rem;
  border-radius: 8px;
  box-shadow: var(--cdx-shadow-lg);
  animation: cdx-toast-in var(--cdx-transition-slow) ease-out;
  pointer-events: auto;
  max-width: 90vw;
}

.cdx-toast.cdx-toast-exit {
  animation: cdx-toast-out var(--cdx-transition) ease-in forwards;
}

.cdx-toast-success {
  background: var(--cdx-success);
}

.cdx-toast-warning {
  background: var(--cdx-warning);
  color: #1a1a2e;
}

.cdx-toast-error {
  background: var(--cdx-danger);
}

/* ==========================================================================
   PART 13: MODALS (89, 34)
   ========================================================================== */

/* #89: Modal Close - Backdrop */
.cdx-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: var(--cdx-z-modal);
  opacity: 0;
  transition: opacity var(--cdx-transition);
  pointer-events: none;
}

.cdx-modal-backdrop.cdx-open {
  opacity: 1;
  pointer-events: auto;
}

.cdx-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  background: var(--cdx-bg);
  border-radius: 12px;
  box-shadow: var(--cdx-shadow-lg);
  z-index: var(--cdx-z-modal);
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
  opacity: 0;
  transition: opacity var(--cdx-transition), transform var(--cdx-transition);
  pointer-events: none;
}

.cdx-modal.cdx-open {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}

/* ==========================================================================
   PART 14: IMAGES & MEDIA (91-93)
   ========================================================================== */

/* #91: Lazy Load Blur-up */
.cdx-lazy {
  filter: blur(10px);
  transition: filter var(--cdx-transition-slow);
}

.cdx-lazy.cdx-loaded {
  filter: blur(0);
}

/* #92: Image Aspect Ratio Boxes */
.cdx-aspect-16-9 {
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.cdx-aspect-4-3 {
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.cdx-aspect-1-1 {
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

/* #93: Alt Warning (Dev Mode) */
.cdx-dev img:not([alt]),
.cdx-dev img[alt=""] {
  outline: 3px solid var(--cdx-danger);
  outline-offset: 2px;
}

/* ==========================================================================
   PART 15: RESPONSIVE BREAKPOINTS (94)
   ========================================================================== */

/* #94: Tablet breakpoint */
@media (min-width: 768px) {
  :root {
    --cdx-spacer: 1.25rem;
  }
  
  .cdx-hide-tablet {
    display: none;
  }
  
  .cdx-show-tablet {
    display: block;
  }
}

@media (max-width: 767px) {
  .cdx-hide-mobile {
    display: none;
  }
  
  .cdx-show-mobile {
    display: block;
  }
}

/* ==========================================================================
   PART 16: SELECTION & CODE (99-100)
   ========================================================================== */

/* #100: Selection Highlight */
::selection {
  background: rgba(0, 123, 255, 0.3);
  color: inherit;
}

.cdx-dark ::selection {
  background: rgba(77, 171, 247, 0.4);
}

/* #99: Code Copy Button */
.cdx-code-wrapper {
  position: relative;
}

.cdx-code-copy {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: inherit;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--cdx-transition);
}

.cdx-code-wrapper:hover .cdx-code-copy {
  opacity: 1;
}

/* ==========================================================================
   PART 17: PRINT STYLES (42)
   ========================================================================== */

/* #42: Print Styles */
@media print {
  .cdx-no-print,
  nav,
  footer,
  .cdx-fab,
  .cdx-toast-container,
  .cdx-back-top {
    display: none !important;
  }
  
  .cdx-print-only {
    display: block !important;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.5;
    color: black;
    background: white;
  }
  
  a {
    color: black;
    text-decoration: underline;
  }
  
  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }
}

/* ==========================================================================
   PART 18: FLOATING ACTION BUTTON (2)
   ========================================================================== */

/* #2: Quick Actions FAB */
.cdx-fab {
  position: fixed;
  bottom: calc(80px + var(--cdx-safe-bottom));
  left: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--cdx-shadow-lg);
  cursor: pointer;
  z-index: var(--cdx-z-dropdown);
  transition: transform var(--cdx-transition), box-shadow var(--cdx-transition);
  border: none;
}

.cdx-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 30px rgba(102, 126, 234, 0.4);
}

.cdx-fab:active {
  transform: scale(0.95);
}

.cdx-fab-menu {
  position: fixed;
  bottom: calc(150px + var(--cdx-safe-bottom));
  left: 20px;
  background: var(--cdx-bg);
  border-radius: 12px;
  box-shadow: var(--cdx-shadow-lg);
  padding: 0.5rem;
  z-index: var(--cdx-z-dropdown);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity var(--cdx-transition), transform var(--cdx-transition);
  pointer-events: none;
}

.cdx-fab-menu.cdx-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.cdx-fab-menu-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--cdx-transition);
  white-space: nowrap;
}

.cdx-fab-menu-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

.cdx-dark .cdx-fab-menu-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   PART 19: COMMAND PALETTE (3)
   ========================================================================== */

/* #3: Command Palette */
.cdx-command-palette {
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translateX(-50%) scale(0.95);
  width: 90%;
  max-width: 600px;
  background: var(--cdx-bg);
  border-radius: 16px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  z-index: var(--cdx-z-modal);
  opacity: 0;
  transition: opacity var(--cdx-transition), transform var(--cdx-transition);
  pointer-events: none;
  overflow: hidden;
}

.cdx-command-palette.cdx-open {
  opacity: 1;
  transform: translateX(-50%) scale(1);
  pointer-events: auto;
}

.cdx-command-input {
  width: 100%;
  padding: 1.25rem 1.5rem;
  font-size: 1.125rem;
  border: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  background: transparent;
  color: var(--cdx-text);
}

.cdx-command-input:focus {
  outline: none;
}

.cdx-command-results {
  max-height: 400px;
  overflow-y: auto;
  padding: 0.5rem;
}

.cdx-command-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--cdx-transition);
}

.cdx-command-item:hover,
.cdx-command-item.cdx-active {
  background: rgba(0, 123, 255, 0.1);
}

.cdx-command-item-icon {
  width: 20px;
  height: 20px;
  opacity: 0.6;
}

.cdx-command-item-title {
  flex: 1;
  font-weight: 500;
}

.cdx-command-item-shortcut {
  font-size: 0.75rem;
  color: var(--cdx-muted);
  background: rgba(0, 0, 0, 0.05);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

/* ==========================================================================
   PART 20: NIGHT SHIFT & CIRCADIAN (31, 106)
   ========================================================================== */

/* #31: Night Shift - Sepia filter */
.cdx-night-shift {
  filter: sepia(0.2) brightness(0.95);
}

/* #106: Circadian Background */
.cdx-circadian {
  transition: background-color 1s ease;
}

/* ==========================================================================
   PART 21: ZEN MODE (22)
   ========================================================================== */

/* #22: Zen Mode */
.cdx-zen-mode *:not(main):not(article):not(main *):not(article *):not(.cdx-zen-exit) {
  opacity: 0;
  pointer-events: none;
}

.cdx-zen-mode main,
.cdx-zen-mode article {
  position: fixed;
  inset: 0;
  padding: 2rem;
  overflow-y: auto;
  background: var(--cdx-bg);
  z-index: var(--cdx-z-modal);
}

.cdx-zen-exit {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: calc(var(--cdx-z-modal) + 1);
  background: var(--cdx-bg);
  border: 1px solid var(--cdx-muted);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  cursor: pointer;
}

/* ==========================================================================
   PART 22: FOCUS TUNNEL (107)
   ========================================================================== */

/* #107: Focus Tunnel */
.cdx-focus-tunnel *:not(:focus):not(:focus-within) {
  opacity: 0.3;
  transition: opacity var(--cdx-transition);
}

.cdx-focus-tunnel *:focus,
.cdx-focus-tunnel *:focus-within {
  opacity: 1;
}

/* ==========================================================================
   PART 23: MARLOWE PSYCHOLOGICAL FEATURES (121-140)
   ========================================================================== */

/* #128: Silent Badge */
.cdx-badge-silent {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b5b3d;
  background: linear-gradient(135deg, #f5f0e6 0%, #ebe4d4 100%);
  border: 1px solid #d4c9b5;
  border-radius: 100px;
}

.cdx-badge-silent::before {
  content: '★';
  font-size: 0.625rem;
}

/* #129: Peer Notes - Handwritten annotations */
.cdx-peer-note {
  font-family: 'Caveat', 'Segoe Script', cursive;
  font-size: 1.125rem;
  color: #4a5568;
  background: #fffef0;
  padding: 0.75rem 1rem;
  border-left: 3px solid #e2b93b;
  margin: 1rem 0;
  transform: rotate(-0.5deg);
}

/* #131: Quiet Room */
.cdx-quiet-room {
  position: fixed;
  inset: 0;
  background: #f5f0e6;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--cdx-z-modal);
  padding: 2rem;
}

.cdx-quiet-room-content {
  max-width: 65ch;
  font-family: 'Crimson Text', Georgia, serif;
  font-size: 1.25rem;
  line-height: 1.8;
  color: #2d3748;
  text-align: center;
}

.cdx-quiet-room-exit {
  position: fixed;
  top: 2rem;
  right: 2rem;
  background: transparent;
  border: 1px solid #d4c9b5;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  color: #6b5b3d;
}

/* #134: Underwriting Mode */
.cdx-underwriting table,
.cdx-underwriting .highcharts-container,
.cdx-underwriting .recharts-wrapper,
.cdx-underwriting svg:not(.cdx-icon) {
  filter: grayscale(1);
  font-family: 'IBM Plex Mono', 'Consolas', monospace;
}

/* #135: Legacy Font */
.cdx-legacy-font {
  font-family: 'Crimson Text', Georgia, 'Times New Roman', serif;
}

/* #137: Privacy Banner */
.cdx-privacy-banner {
  background: #1a1a2e;
  color: #a0aec0;
  text-align: center;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
}

.cdx-privacy-banner strong {
  color: #e2e8f0;
}

/* #140: Patient Tag */
.cdx-patient-tag {
  display: inline-block;
  font-size: 0.75rem;
  color: #6b5b3d;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ==========================================================================
   PART 24: ONBOARDING CHECKLIST (18)
   ========================================================================== */

/* #18: Onboarding Checklist */
.cdx-onboarding {
  position: fixed;
  bottom: calc(20px + var(--cdx-safe-bottom));
  left: 20px;
  background: var(--cdx-bg);
  border-radius: 12px;
  box-shadow: var(--cdx-shadow-lg);
  padding: 1rem;
  max-width: 300px;
  z-index: var(--cdx-z-dropdown);
}

.cdx-onboarding-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.cdx-onboarding-title {
  font-weight: 600;
  color: var(--cdx-text);
}

.cdx-onboarding-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--cdx-muted);
  padding: 0.25rem;
}

.cdx-onboarding-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  color: var(--cdx-text);
  cursor: pointer;
}

.cdx-onboarding-item.cdx-done {
  color: var(--cdx-muted);
  text-decoration: line-through;
}

.cdx-onboarding-check {
  width: 20px;
  height: 20px;
  border: 2px solid var(--cdx-muted);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cdx-onboarding-item.cdx-done .cdx-onboarding-check {
  background: var(--cdx-success);
  border-color: var(--cdx-success);
  color: white;
}

/* ==========================================================================
   PART 25: FEEDBACK WIDGET (44)
   ========================================================================== */

/* #44: Feedback Widget */
.cdx-feedback {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 8px;
}

.cdx-feedback-label {
  font-size: 0.875rem;
  color: var(--cdx-muted);
}

.cdx-feedback-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  transition: background var(--cdx-transition), transform var(--cdx-transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cdx-feedback-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  transform: scale(1.1);
}

.cdx-feedback-btn.cdx-selected {
  background: var(--cdx-primary);
  color: white;
}

/* ==========================================================================
   PART 26: READ TIME BADGE (23)
   ========================================================================== */

/* #23: Read Time */
.cdx-read-time {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  color: var(--cdx-muted);
}

.cdx-read-time::before {
  content: '📖';
  font-size: 0.75rem;
}

/* ==========================================================================
   PART 27: RECENT VIEWS WIDGET (17)
   ========================================================================== */

/* #17: Recent Views */
.cdx-recent-views {
  background: var(--cdx-bg);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 0.75rem;
}

.cdx-recent-views-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--cdx-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.cdx-recent-views-item {
  display: block;
  padding: 0.5rem;
  border-radius: 4px;
  color: var(--cdx-text);
  text-decoration: none;
  font-size: 0.875rem;
  transition: background var(--cdx-transition);
}

.cdx-recent-views-item:hover {
  background: rgba(0, 0, 0, 0.03);
}

/* ==========================================================================
   PART 28: CHANGELOG BADGE (117)
   ========================================================================== */

/* #117: Changelog "New" Badge */
.cdx-new-badge {
  display: inline-block;
  padding: 0.125rem 0.375rem;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: white;
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
  border-radius: 4px;
  margin-left: 0.5rem;
  animation: cdx-pulse 2s ease-in-out infinite;
}

/* ==========================================================================
   PART 29: WAIT CURSOR (113)
   ========================================================================== */

/* #113: Wait Cursor */
.cdx-loading {
  cursor: progress;
  pointer-events: none;
  opacity: 0.7;
}

/* ==========================================================================
   PART 30: DENSITY MODE (110)
   ========================================================================== */

/* #110: Compact Density */
.cdx-compact {
  --cdx-spacer: 0.5rem;
  --cdx-spacer-sm: 0.25rem;
  --cdx-spacer-lg: 0.75rem;
}

.cdx-compact .cdx-input {
  padding: 0.5rem 0.75rem;
}

.cdx-compact .cdx-btn {
  padding: 0.5rem 1rem;
  min-height: 36px;
}

/* ==========================================================================
   PART 31: PATINA EFFECT (111)
   ========================================================================== */

/* #111: Patina - Frequently used buttons darken */
.cdx-patina-1 { filter: brightness(0.98); }
.cdx-patina-2 { filter: brightness(0.96); }
.cdx-patina-3 { filter: brightness(0.94); }
.cdx-patina-4 { filter: brightness(0.92); }
.cdx-patina-5 { filter: brightness(0.90); }

/* ==========================================================================
   PART 32: TRAJECTORY GLOW (102)
   ========================================================================== */

/* #102: Trajectory Glow */
.cdx-trajectory-glow {
  box-shadow: 0 0 20px rgba(0, 123, 255, 0.4);
  transition: box-shadow var(--cdx-transition);
}

/* ==========================================================================
   PART 33: MAGNET CURSOR (103)
   ========================================================================== */

/* #103: Magnet Cursor */
.cdx-magnet {
  transition: transform 0.1s ease-out;
}

/* ==========================================================================
   PART 34: CONFETTI CANVAS (45)
   ========================================================================== */

/* #45: Confetti */
.cdx-confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: var(--cdx-z-modal);
}
