/* Crispy Crust Enterprise CRM Mobile Adapter */
/* Viewport <= 768px Strict Zero-Horizontal-Overflow standard (scrollWidth <= 390px) */

@media (max-width: 768px) {
  :root {
    --header-height: 50px;
  }

  body {
    width: 100vw;
    max-width: 100vw;
    overflow-x: hidden !important;
  }

  .crm-navbar {
    padding: 0 10px;
    height: var(--header-height);
  }

  .brand-logo {
    height: 28px;
  }

  .facility-badge-locked span {
    display: none;
  }

  .facility-badge-locked {
    padding: 4px;
    border-radius: 50%;
  }

  /* Hide Desktop Horizontal Navigation */
  .desktop-nav-tabs {
    display: none !important;
  }

  /* Show Mobile Screen Switcher */
  .mobile-screens-dropdown-wrap {
    display: inline-flex !important;
    position: relative;
  }

  .mobile-screens-trigger {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 32px;
    padding: 0 10px;
    background: rgba(13, 148, 136, 0.15);
    border: 1px solid rgba(13, 148, 136, 0.4);
    border-radius: 6px;
    color: #2dd4bf;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
  }

  .mobile-screens-popover {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 175px;
    background: #0f172a;
    border: 1px solid rgba(51, 65, 85, 0.95);
    border-radius: 10px;
    padding: 6px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.8);
    z-index: 99999;
    display: none;
    flex-direction: column;
    gap: 2px;
  }

  .mobile-screens-popover.show {
    display: flex;
  }

  .mobile-screen-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 700;
    text-align: right;
    width: 100%;
    cursor: pointer;
  }

  .mobile-screen-item.active {
    background: rgba(13, 148, 136, 0.2);
    color: #2dd4bf;
  }

  /* Compact Header Status Panel */
  .header-status-panel {
    gap: 6px;
  }

  .status-capsule span:not(.pulse-dot):not(#crm-header-clock) {
    display: none;
  }

  .status-capsule {
    padding: 4px 6px;
  }

  /* Container & Grids */
  .main-view-container {
    padding: 10px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .kpi-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .kpi-card {
    padding: 10px;
  }

  .kpi-value {
    font-size: 16px;
  }

  .kpi-icon-box {
    width: 32px;
    height: 32px;
  }

  /* Toolbar */
  .action-toolbar {
    flex-direction: column;
    align-items: stretch;
    padding: 10px;
    gap: 8px;
  }

  .toolbar-group {
    width: 100%;
    justify-content: stretch;
  }

  .search-input-wrap {
    width: 100%;
    min-width: 0;
  }

  .filter-select {
    flex: 1;
    min-width: 0;
  }

  .btn {
    flex: 1;
    justify-content: center;
  }

  /* Cadence Banner */
  .cadence-steps {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  /* Kanban Board Mobile Stack */
  .kanban-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    min-height: auto;
  }

  /* Omnichannel Split */
  .omnichannel-split {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* Odoo Stat Bar */
  .odoo-stat-bar {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  /* Modals */
  .modal-card {
    max-width: 95vw;
    margin: 10px;
  }

  .composer-inputs-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .customers-split-layout {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .automation-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .panel-card {
    min-width: 0;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  .reports-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  #customer-360-card {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
  }

  .data-table th,
  .data-table td {
    padding: 6px 8px;
    font-size: 11.5px;
  }
}

