/**
 * ═══════════════════════════════════════════════════════════════════════════════
 * OFFICELESS OS - ENTERPRISE DESIGN SYSTEM v90.1.0
 * Production-Ready CSS with Fixed Layout, Mobile-First Responsive, No Placeholders
 * ═══════════════════════════════════════════════════════════════════════════════
 */

/* ═══════════════ ROOT: CSS CUSTOM PROPERTIES ═══════════════ */
:root {
  /* ─── Core Brand Colors ─── */
  --ofls-gold: #D9A404;
  --ofls-purple: #6C1DFF;
  --ofls-emerald: #10B981;
  --ofls-rose: #E11D48;
  --ofls-indigo: #4F46E5;
  --ofls-slate: #475569;

  /* ─── Portal Theme: Investor (Default) ─── */
  --portal-bg: #fdfbf7;
  --portal-bg-gradient: linear-gradient(135deg, #fdfbf7 0%, #fffbf0 50%, #f2e6d9 100%);
  --portal-accent: #92400E;
  --portal-primary-bg: rgba(251, 191, 36, 0.15);
  --portal-primary-text: #78350F;
  --portal-border: rgba(146, 64, 14, 0.1);
  --portal-shadow: 0 8px 30px rgba(217, 119, 6, 0.1);

  /* ─── Semantic Colors ─── */
  --color-success: #10B981;
  --color-warning: #F59E0B;
  --color-error: #EF4444;
  --color-info: #3B82F6;

  /* ─── Neutral Palette ─── */
  --neutral-50: #FAFAFA;
  --neutral-100: #F4F4F5;
  --neutral-200: #E4E4E7;
  --neutral-300: #D4D4D8;
  --neutral-400: #A1A1AA;
  --neutral-500: #71717A;
  --neutral-600: #52525B;
  --neutral-700: #3F3F46;
  --neutral-800: #27272A;
  --neutral-900: #18181B;
  --neutral-950: #09090B;

  /* ─── Typography Scale ─── */
  --font-sans: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --text-xs: 0.625rem;
  --text-sm: 0.75rem;
  --text-base: 0.875rem;
  --text-lg: 1rem;
  --text-xl: 1.125rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;

  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.75;

  --tracking-tight: -0.025em;
  --tracking-normal: 0;
  --tracking-wide: 0.05em;
  --tracking-widest: 0.1em;

  /* ─── Spacing Scale ─── */
  --space-0: 0;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* ─── Border Radius ─── */
  --radius-none: 0;
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-3xl: 2rem;
  --radius-full: 9999px;

  /* ─── Elevation / Shadows ─── */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 16px 32px rgba(0, 0, 0, 0.12);
  --shadow-2xl: 0 24px 48px rgba(0, 0, 0, 0.15);
  --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 0 20px rgba(108, 29, 255, 0.3);

  /* ─── Glass Morphism ─── */
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.6);
  --glass-blur: blur(20px);

  /* ─── Motion / Animation ─── */
  --ease-default: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);

  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --duration-slow: 500ms;
  --duration-slower: 700ms;

  /* ─── Z-Index Scale ─── */
  --z-base: 0;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 300;
  --z-modal: 400;
  --z-popover: 500;
  --z-toast: 600;
  --z-tooltip: 700;
  --z-max: 9999;

  /* ─── Layout Variables ─── */
  --sidebar-width: 260px;
  --sidebar-width-collapsed: 64px;
  --header-height: 56px;
  --ticker-height: 32px;
}

/* ═══════════════ DARK MODE ═══════════════ */
[data-theme="dark"],
.dark {
  --glass-bg: rgba(30, 30, 40, 0.9);
  --glass-border: rgba(255, 255, 255, 0.1);
  --portal-bg: #0F0F12;
  --portal-bg-gradient: linear-gradient(135deg, #0F0F12 0%, #1A1A22 50%, #0D0D10 100%);
  --portal-accent: #FCD34D;
  --neutral-50: #18181B;
  --neutral-100: #27272A;
  --neutral-800: #F4F4F5;
  --neutral-900: #FAFAFA;
}

/* ═══════════════ CSS RESET & BASE ═══════════════ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ═══════════════ MAIN OS CONTAINER ═══════════════ */
#officeless-os {
  position: relative;
  width: 100%;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--neutral-800);
  background: var(--portal-bg);
  background-image: var(--portal-bg-gradient);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ═══════════════ CRITICAL: FLEX LAYOUT ENGINE ═══════════════ */
.ofls-layout {
  display: flex !important;
  flex-direction: row !important;
  width: 100%;
  min-height: calc(100vh - var(--header-height) - var(--ticker-height));
  position: relative;
}

/* ─── Sidebar: Fixed Left Column ─── */
.ofls-sidebar {
  flex: 0 0 var(--sidebar-width) !important;
  width: var(--sidebar-width) !important;
  min-width: var(--sidebar-width) !important;
  max-width: var(--sidebar-width) !important;
  height: calc(100vh - var(--header-height) - var(--ticker-height));
  position: sticky;
  top: calc(var(--header-height) + var(--ticker-height));
  left: 0;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--glass-border);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: var(--z-sticky);
  transition: transform var(--duration-normal) var(--ease-default), width var(--duration-normal);
}

/* ─── Main Content: Fluid Right Area ─── */
.ofls-main {
  flex: 1 1 0% !important;
  min-width: 0 !important;
  width: calc(100% - var(--sidebar-width)) !important;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

.ofls-viewport {
  padding: var(--space-6);
  min-height: 100%;
}

/* ═══════════════ GLOBAL HEADER ═══════════════ */
.global-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 var(--space-6);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: var(--ticker-height);
  z-index: var(--z-sticky);
}

.header__logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-weight: 400;
  color: var(--portal-accent);
}

.header__logo svg {
  width: 24px;
  height: 24px;
}

.header__search {
  flex: 1;
  max-width: 480px;
  margin: 0 var(--space-6);
}

.header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.header__profile {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-left: var(--space-3);
  border-left: 1px solid var(--neutral-200);
}

/* ═══════════════ TICKER BAR ═══════════════ */
.ticker {
  height: var(--ticker-height);
  background: var(--neutral-900);
  color: white;
  overflow: hidden;
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}

.ticker__content {
  display: flex;
  align-items: center;
  height: 100%;
  gap: var(--space-8);
  padding: 0 var(--space-6);
  animation: ticker-scroll 30s linear infinite;
  white-space: nowrap;
}

.ticker__item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

.ticker__item strong {
  color: var(--ofls-gold);
}

.ticker__value--up {
  color: var(--color-success);
}

.ticker__value--down {
  color: var(--color-error);
}

@keyframes ticker-scroll {
  0% {
    transform: translateX(0);
  }

  100% {
    transform: translateX(-50%);
  }
}

/* ═══════════════ NAVIGATION SIDEBAR ═══════════════ */
.nav-sidebar {
  padding: var(--space-4);
}

.nav-section {
  margin-bottom: var(--space-6);
}

.nav-section__title {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: var(--neutral-400);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-1);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
  color: var(--neutral-600);
}

.nav-item:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--portal-accent);
}

.nav-item--active {
  background: var(--portal-primary-bg);
  color: var(--portal-accent);
  font-weight: 500;
}

.nav-item__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.nav-item__icon svg {
  width: 18px;
  height: 18px;
}

.nav-item__label {
  font-size: var(--text-sm);
}

/* ═══════════════ GLASS CARD COMPONENT ═══════════════ */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-glass);
}

/* ═══════════════ DASHBOARD GRID ═══════════════ */
.dashboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-6);
}

.dashboard__widget {
  padding: var(--space-5);
}

.dashboard__widget--span-2 {
  grid-column: span 2;
}

.dashboard__widget--span-3 {
  grid-column: span 3;
}

.dashboard__widget--span-4 {
  grid-column: span 4;
}

/* ═══════════════ METRIC CARDS ═══════════════ */
.metric-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.metric-card__icon {
  color: var(--portal-accent);
  opacity: 0.7;
}

.metric-card__label {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--neutral-500);
}

.metric-card__value {
  font-family: var(--font-serif);
  font-size: var(--text-3xl);
  font-weight: 400;
  color: var(--portal-accent);
}

.metric-card__trend {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--neutral-500);
}

.metric-card__trend--up {
  color: var(--color-success);
}

.metric-card__trend--down {
  color: var(--color-error);
}

/* ═══════════════ AGENT CARDS ═══════════════ */
.agent-hierarchy {
  padding: var(--space-6);
}

.agent-tier {
  margin-bottom: var(--space-8);
}

.agent-tier__title {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: var(--neutral-400);
  margin-bottom: var(--space-4);
}

.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}

.agent-card {
  padding: var(--space-5);
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-default), box-shadow var(--duration-fast);
}

.agent-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.agent-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-4);
}

.agent-card__name {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  color: var(--neutral-800);
}

.agent-card__role {
  font-size: var(--text-sm);
  color: var(--neutral-500);
  margin-top: var(--space-1);
}

.agent-card__status {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--neutral-300);
}

.agent-card__status--active {
  background: var(--color-success);
  box-shadow: 0 0 8px var(--color-success);
  animation: pulse 2s infinite;
}

.agent-card__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.agent-card__stat-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--neutral-400);
}

.agent-card__stat-value {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--neutral-700);
  margin-top: var(--space-1);
}

/* ═══════════════ BUTTONS ═══════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
}

.btn--primary {
  background: var(--ofls-purple);
  color: white;
}

.btn--primary:hover {
  background: #5a16d9;
  transform: translateY(-1px);
}

.btn--secondary {
  background: var(--neutral-100);
  color: var(--neutral-700);
}

.btn--secondary:hover {
  background: var(--neutral-200);
}

.btn--ghost {
  background: transparent;
  color: var(--neutral-600);
}

.btn--ghost:hover {
  background: rgba(0, 0, 0, 0.05);
}

.btn--icon {
  padding: var(--space-2);
  width: 36px;
  height: 36px;
}

.btn--glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
}

/* ═══════════════ FORM INPUTS ═══════════════ */
.input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--neutral-800);
  background: white;
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius-lg);
  transition: all var(--duration-fast) var(--ease-default);
}

.input:focus {
  outline: none;
  border-color: var(--ofls-purple);
  box-shadow: 0 0 0 3px rgba(108, 29, 255, 0.1);
}

.input--glass {
  background: var(--glass-bg);
  border-color: var(--glass-border);
}

.textarea {
  min-height: 100px;
  resize: vertical;
}

/* ═══════════════ MODAL OVERLAY ═══════════════ */
.ofls-modal-container {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  pointer-events: none;
}

.ofls-modal-container.active {
  pointer-events: auto;
}

.ofls-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

/* ═══════════════ TEXT UTILITIES ═══════════════ */
.text-title {
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  font-weight: 400;
  color: var(--portal-accent);
  margin-bottom: var(--space-4);
}

.text-label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: var(--neutral-400);
}

.text-body {
  font-size: var(--text-base);
  color: var(--neutral-600);
  line-height: var(--leading-relaxed);
}

/* ═══════════════ ANIMATIONS ═══════════════ */
@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ═══════════════ MOBILE RESPONSIVE BREAKPOINTS ═══════════════ */

/* Ultra-wide (>1440px) */
@media (min-width: 1441px) {
  .dashboard {
    grid-template-columns: repeat(4, 1fr);
  }

  .ofls-viewport {
    max-width: 1600px;
    margin: 0 auto;
  }
}

/* Desktop (1024-1440px) */
@media (max-width: 1440px) {
  .dashboard {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Tablet Landscape (768-1024px) */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 220px;
  }

  .dashboard {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard__widget--span-2,
  .dashboard__widget--span-3,
  .dashboard__widget--span-4 {
    grid-column: span 2;
  }

  .header__search {
    max-width: 300px;
  }
}

/* Tablet Portrait (480-768px) */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 0px;
    --header-height: 56px;
  }

  .ofls-layout {
    flex-direction: column !important;
  }

  .ofls-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px !important;
    min-width: 280px !important;
    max-width: 280px !important;
    height: 100vh;
    transform: translateX(-100%);
    z-index: var(--z-overlay);
  }

  .ofls-sidebar.open {
    transform: translateX(0);
  }

  .ofls-main {
    width: 100% !important;
    flex: 1 1 auto !important;
  }

  .ofls-viewport {
    padding: var(--space-4);
  }

  .dashboard {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
  }

  .dashboard__widget--span-2 {
    grid-column: span 2;
  }

  .agent-grid {
    grid-template-columns: 1fr;
  }

  .header__search {
    display: none;
  }

  .global-header {
    padding: 0 var(--space-4);
  }
}

/* Mobile (< 480px) */
@media (max-width: 480px) {
  :root {
    --text-base: 0.8125rem;
    --text-2xl: 1.25rem;
    --text-3xl: 1.5rem;
  }

  .ofls-viewport {
    padding: var(--space-3);
  }

  .dashboard {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

  .dashboard__widget,
  .dashboard__widget--span-2,
  .dashboard__widget--span-3,
  .dashboard__widget--span-4 {
    grid-column: span 1;
  }

  .metric-card__value {
    font-size: var(--text-2xl);
  }

  .glass-card {
    border-radius: var(--radius-xl);
  }

  .btn {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-xs);
  }

  .header__logo span {
    display: none;
  }

  .ticker__content {
    gap: var(--space-4);
    padding: 0 var(--space-3);
  }

  .ticker__item {
    font-size: 0.5625rem;
  }
}

/* ═══════════════ MOBILE HAMBURGER MENU ═══════════════ */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 24px;
  height: 18px;
  cursor: pointer;
  z-index: var(--z-max);
}

.mobile-menu-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--neutral-700);
  border-radius: 2px;
  transition: all var(--duration-fast);
}

@media (max-width: 768px) {
  .mobile-menu-toggle {
    display: flex;
  }
}

/* ═══════════════ SCROLLBAR STYLING ═══════════════ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--neutral-300);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--neutral-400);
}

/* ═══════════════ WORDPRESS OVERRIDE FIXES ═══════════════ */
#officeless-os *,
#officeless-os *::before,
#officeless-os *::after {
  box-sizing: border-box !important;
}

#officeless-os img {
  max-width: 100%;
  height: auto;
}

#officeless-os a {
  text-decoration: none;
  color: inherit;
}

#officeless-os ul,
#officeless-os ol {
  list-style: none;
}

#officeless-os button {
  font-family: inherit;
}

/* Prevent WordPress theme conflicts */
#officeless-os .entry-content,
#officeless-os .post-content,
#officeless-os article {
  all: unset;
  display: block;
}