/* ==========================================================================
   SANDTON INDEX - Dashboard & Application Layout Specifications
   Fixed Sidebar, Fixed Topbar, Marketplace, Wizards, Chat & Responsive
   ========================================================================== */

/* Base Defaults for Mobile Popups & Drawers (Fail-safe layout protection) */
.mobile-profile-dropdown {
  display: none;
}
.mobile-menu-drawer-overlay {
  display: none;
}
.mobile-bottom-nav {
  display: none;
}
.mobile-profile-link-btn svg,
.mobile-profile-action-btn svg,
.mobile-bottom-nav svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* App Shell Layout */
.app-shell {
  display: flex;
  min-height: 100vh;
  background-color: var(--bg-primary);
}

/* Fixed Collapsible Sidebar */
.app-sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  background-color: var(--bg-card);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

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

.sidebar-header {
  height: var(--topbar-height);
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  overflow: hidden;
  max-width: 190px;
}

.sidebar-logo {
  height: 38px;
  max-width: 185px;
  width: auto;
  object-fit: contain;
  display: block;
}

.sidebar-toggle-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

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

.sidebar-nav-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 12px 12px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.2s;
}

.app-sidebar.collapsed .nav-section-title {
  opacity: 0;
}

.sidebar-nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-btn);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  white-space: nowrap;
  position: relative;
}

.sidebar-nav-item:hover {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

.sidebar-nav-item.active {
  background-color: var(--bg-secondary);
  color: var(--accent-primary);
  font-weight: 600;
}

[data-theme="dark"] .sidebar-nav-item.active {
  background-color: rgba(79, 140, 255, 0.12);
  color: #4F8CFF;
}

.sidebar-nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-nav-item .nav-badge {
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--accent-primary);
  color: #fff;
}

.app-sidebar.collapsed .sidebar-nav-item span:not(.nav-icon-only),
.app-sidebar.collapsed .sidebar-brand,
.app-sidebar.collapsed .sidebar-footer-content {
  display: none;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-color);
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* App Main Section */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 0;
  position: relative;
}

.app-shell.sidebar-collapsed .app-main {
  margin-left: var(--sidebar-collapsed-width);
}

/* Fixed / Sticky Top Navigation Bar */
.app-topbar {
  height: var(--topbar-height);
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  z-index: 999;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.topbar-search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-input);
  padding: 8px 14px;
  width: 320px;
  color: var(--text-muted);
  font-size: 0.88rem;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.topbar-search-box:hover {
  border-color: var(--text-muted);
}

.topbar-search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  width: 100%;
  font-size: 0.88rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.action-pill-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-btn);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
}

.action-pill-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.action-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-danger);
  border: 1.5px solid var(--bg-card);
}

/* User Profile Menu Pill */
.topbar-user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.topbar-user-pill:hover {
  background: var(--bg-card-hover);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-primary) 0%, #E5C358 100%);
  color: #0F172A;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  object-fit: cover;
  flex-shrink: 0;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}

.user-meta-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.user-meta-role {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Workspace Canvas */
.workspace-container {
  padding: 32px;
  flex: 1;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

.page-header {
  margin-bottom: 28px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-title svg {
  width: 28px;
  height: 28px;
  color: var(--gold-primary);
  flex-shrink: 0;
}

.page-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Stats Metric Cards Grid */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
  width: 100%;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-primary);
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-number {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.stat-trend {
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}

/* Financial Marketplace Layout */
.marketplace-search-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 12px 18px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.marketplace-search-box:focus-within {
  border-color: var(--gold-primary);
  box-shadow: 0 0 0 3px rgba(200, 160, 89, 0.15);
}

.marketplace-search-box svg {
  color: var(--gold-primary);
  flex-shrink: 0;
}

.marketplace-search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  width: 100%;
  font-size: 0.95rem;
  font-family: inherit;
}

.marketplace-search-box input::placeholder {
  color: var(--text-muted);
}

.marketplace-layout {
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 24px;
  align-items: flex-start;
}

.filters-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 22px;
  position: sticky;
  top: calc(var(--topbar-height) + 24px);
}

.filter-section {
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border-color);
}

.filter-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.filter-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

/* Project Cards Grid */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* 2-Column Dashboard Main Layout */
.dashboard-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 24px;
  width: 100%;
  align-items: start;
}

.dashboard-main-grid > div {
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 1100px) {
  .dashboard-main-grid {
    grid-template-columns: 1fr;
  }
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.project-card:hover {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.project-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.project-sector-tag {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 3px 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-secondary);
}

.project-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1.3;
}

.project-company-name {
  font-size: 0.85rem;
  color: var(--gold-primary);
  font-weight: 600;
  margin-bottom: 12px;
}

.project-card-summary {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 18px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-financials-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.financial-metric-title {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.financial-metric-val {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.project-card-actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
}

/* 5-Step Project Wizard */
.wizard-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 30px;
  position: relative;
}

.wizard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  z-index: 2;
  cursor: pointer;
}

.wizard-step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.wizard-step.active .wizard-step-circle {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(79, 140, 255, 0.2);
}

.wizard-step.completed .wizard-step-circle {
  background: var(--accent-success);
  border-color: var(--accent-success);
  color: #fff;
}

.wizard-step-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.wizard-step.active .wizard-step-title {
  color: var(--text-primary);
}

/* Verification Timeline */
.verification-timeline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 30px 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  margin-bottom: 24px;
}

.timeline-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  flex: 1;
  position: relative;
}

.timeline-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.timeline-node.done .timeline-dot {
  background: var(--accent-success);
  border-color: var(--accent-success);
  color: #fff;
}

.timeline-node.current .timeline-dot {
  background: var(--accent-warning);
  border-color: var(--accent-warning);
  color: #fff;
}

/* Modern Messaging Experience */
.chat-shell {
  display: grid;
  grid-template-columns: 320px 1fr;
  height: calc(100vh - var(--topbar-height) - 100px);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  overflow: hidden;
}

.chat-channel-list {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.chat-channel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
  font-weight: 700;
}

.chat-channel-item {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.chat-channel-item:hover, .chat-channel-item.active {
  background-color: var(--bg-card);
}

.chat-view-main {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
}

.chat-top-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-message-stream {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.msg-bubble {
  max-width: 65%;
  padding: 12px 16px;
  border-radius: var(--radius-card);
  font-size: 0.9rem;
  line-height: 1.45;
}

.msg-bubble.sent {
  align-self: flex-end;
  background-color: var(--accent-primary);
  color: #FFFFFF;
  border-bottom-right-radius: 4px;
}

.msg-bubble.received {
  align-self: flex-start;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
}

.msg-bubble.system {
  align-self: center;
  max-width: 85%;
  background: var(--gold-subtle);
  border: 1px dashed var(--gold-primary);
  color: var(--text-primary);
  font-size: 0.82rem;
  text-align: center;
}

.chat-compose-bar {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
}

/* Responsive Mobile Layout */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(60px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  z-index: 99;
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.mobile-nav-btn {
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 8px;
  transition: all 0.15s ease;
  touch-action: manipulation;
}

.mobile-nav-btn span {
  font-size: 1.15rem;
  line-height: 1;
}

.mobile-nav-btn.active {
  color: var(--gold-primary);
  font-weight: 700;
}

@media (max-width: 1024px) {
  .marketplace-layout {
    grid-template-columns: 1fr;
  }
  .filters-panel {
    position: static;
  }
  .chat-shell {
    grid-template-columns: 1fr;
}
}

@media (max-width: 768px) {
  .app-sidebar {
    transform: translateX(-100%);
    width: 270px !important;
  }
  .app-sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .app-topbar {
    padding: 0 16px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .app-mobile-topbar-brand {
    display: flex !important;
  }
  .app-main {
    margin-left: 0 !important;
    padding-bottom: calc(74px + env(safe-area-inset-bottom, 0px));
  }
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(64px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    z-index: 99;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  .mobile-nav-btn {
    flex: 1;
    background: transparent;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px 4px;
    border-radius: 8px;
    transition: all 0.15s ease;
    touch-action: manipulation;
  }
  .mobile-nav-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    transition: transform 0.15s ease, stroke 0.15s ease;
  }
  .mobile-nav-btn.active {
    color: var(--gold-primary);
    font-weight: 700;
  }
  .mobile-nav-btn.active svg {
    stroke: var(--gold-primary);
  }
  .mobile-nav-btn-center {
    position: relative;
    top: -8px;
  }
  .mobile-nav-btn-center .mobile-nav-center-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #C59A27 0%, #D4AF37 100%);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(212, 175, 55, 0.45);
    border: 2px solid var(--bg-card);
  }
  .mobile-nav-btn-center .mobile-nav-center-icon svg {
    width: 22px;
    height: 22px;
    stroke: #FFFFFF;
  }

  /* Mobile Topbar Actions: Clean single profile pill */
  .topbar-desktop-action {
    display: none !important;
  }

  /* Circular user pill on mobile maintaining circle design */
  .topbar-user-pill {
    padding: 3px !important;
    border-radius: 50% !important;
    background: transparent !important;
    border: 2px solid var(--border-color) !important;
    transition: all 0.2s ease;
  }
  .topbar-user-pill:hover,
  .topbar-user-pill:active {
    border-color: var(--gold-primary) !important;
  }
  .topbar-user-pill .user-avatar {
    width: 38px !important;
    height: 38px !important;
    font-size: 1rem !important;
    border-radius: 50% !important;
    flex-shrink: 0;
  }
  .topbar-user-pill .user-meta-info {
    display: none !important;
  }

  /* Profile Dropdown Popup on Mobile */
  .mobile-profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 12px;
    width: 270px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    z-index: 1000;
    padding: 16px;
    display: none;
    flex-direction: column;
    gap: 12px;
    animation: fadeInScale 0.2s ease-out forwards;
  }
  .mobile-profile-dropdown.open {
    display: flex;
  }
  .mobile-profile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
  }
  .mobile-profile-quick-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 4px 0;
  }
  .mobile-profile-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 6px;
    color: var(--text-primary);
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
  }
  .mobile-profile-action-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
  }
  .mobile-profile-action-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--gold-primary);
  }
  .mobile-profile-menu-links {
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
  }
  .mobile-profile-link-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    background: transparent;
    border: none;
    padding: 9px 10px;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: background 0.15s ease;
  }
  .mobile-profile-link-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
  }
  .mobile-profile-link-btn:hover {
    background: var(--bg-secondary);
  }

  /* Mobile All-in-One Menu Bottom Drawer */
  .mobile-menu-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
  }
  .mobile-menu-drawer-overlay.active {
    opacity: 1;
    visibility: visible;
  }
  .mobile-menu-drawer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: -100%;
    max-height: 82vh;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.4);
    z-index: 10001;
    display: flex;
    flex-direction: column;
    transition: bottom 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 0 0 calc(20px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
  }
  .mobile-menu-drawer.open {
    bottom: 0;
  }
  .mobile-menu-drawer-handle {
    width: 44px;
    height: 4px;
    border-radius: 4px;
    background: var(--border-color);
    margin: 10px auto 4px;
  }
  .mobile-menu-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px 14px;
    border-bottom: 1px solid var(--border-color);
  }
  .mobile-menu-drawer-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .mobile-menu-drawer-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
  }
  .mobile-menu-drawer-section-title {
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--gold-primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
    padding-left: 4px;
  }
  .mobile-menu-drawer-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .mobile-menu-drawer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 14px;
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
  }
  .mobile-menu-drawer-item svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    flex-shrink: 0;
  }
  .mobile-menu-drawer-item:hover,
  .mobile-menu-drawer-item.active {
    border-color: var(--gold-primary);
    color: var(--gold-primary);
    background: var(--bg-card-hover);
  }

  .topbar-search-box {
    display: none;
  }
  .workspace-container {
    padding: 16px;
    max-width: 100vw;
    overflow-x: hidden;
    box-sizing: border-box;
  }
  .stats-row {
    grid-template-columns: 1fr !important;
  }
  .projects-grid {
    grid-template-columns: 1fr !important;
  }

  /* Prevent content leaking to the right on mobile */
  .dashboard-main-grid,
  .marketplace-layout,
  .form-grid-two,
  div[style*="grid-template-columns: 2fr 1fr"],
  div[style*="grid-template-columns: 1fr 1fr"],
  div[style*="grid-template-columns: 1fr 2fr"],
  div[style*="grid-template-columns: repeat(3, 1fr)"],
  div[style*="grid-template-columns: repeat(4, 1fr)"] {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  /* Ensure cards and forms do not overflow container boundaries */
  .card, .card-subtle, form, .form-group {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .form-control, input, select, textarea {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .mobile-menu-trigger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1.2rem;
    color: var(--text-primary);
    cursor: pointer;
  }
  .mobile-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99;
  }
  .mobile-sidebar-overlay.active {
    display: block;
  }
}

.mobile-menu-trigger-btn {
  display: none;
}
.mobile-sidebar-overlay {
  display: none;
}

/* Modern iOS/Dashboard Switch Toggle Component */
.switch-toggle-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.switch-toggle-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-toggle-track {
  width: 58px;
  height: 30px;
  background-color: var(--border-color);
  border-radius: 30px;
  position: relative;
  transition: background-color 0.25s ease, border-color 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  box-sizing: border-box;
}

.switch-toggle-track::before {
  content: "Off";
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  position: absolute;
  right: 8px;
  transition: opacity 0.2s ease;
}

.switch-toggle-track::after {
  content: "On";
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  position: absolute;
  left: 8px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.switch-toggle-thumb {
  width: 24px;
  height: 24px;
  background-color: #ffffff;
  border-radius: 50%;
  position: absolute;
  left: 3px;
  top: 3px;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  z-index: 2;
}

.switch-toggle-input:checked + .switch-toggle-track {
  background-color: #0d9488;
}

.switch-toggle-input:checked + .switch-toggle-track::before {
  opacity: 0;
}

.switch-toggle-input:checked + .switch-toggle-track::after {
  opacity: 1;
}

.switch-toggle-input:checked + .switch-toggle-track .switch-toggle-thumb {
  transform: translateX(28px);
}

.gateway-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.gateway-card:hover {
  border-color: var(--border-hover, var(--gold-primary));
}

.gateway-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 14px;
}

.gateway-card-title {
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
