@media (max-width: 1180px) {
  .app-shell,
  .sidebar-collapsed {
    grid-template-columns: 1fr;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  .sidebar {
    display: none;
  }

  .workspace {
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: none;
  }

  .page {
    padding: 16px 16px 110px;
  }

  .topbar {
    padding: 16px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 50;
  }

  .mobile-tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    min-height: 84px; /* Increased for mobile app safe area */
    padding-bottom: env(safe-area-inset-bottom, 20px);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.04);
  }

  .mobile-tab {
    min-width: 0;
    height: 60px;
    justify-content: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-400);
    border-radius: 0;
    font-size: 10px;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
  }

  .mobile-tab svg, .mobile-tab i {
    width: 24px;
    height: 24px;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .mobile-tab.is-active {
    color: var(--navy-900);
  }

  .mobile-tab.is-active svg, .mobile-tab.is-active i {
    transform: translateY(-2px);
  }

  .mobile-tab-fab {
    transform: translateY(-12px);
  }

  .mobile-tab-fab .icon {
    width: 48px;
    height: 48px;
    padding: 12px;
    border-radius: 24px;
    color: #fff;
    background: var(--navy-900);
    box-shadow: 0 8px 16px rgba(23, 32, 51, 0.2);
  }

  .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hero-strip,
  .page-grid.two,
  .page-split,
  .settings-tabs-layout {
    grid-template-columns: 1fr;
  }

  .hero-strip {
    gap: 14px;
  }

  .job-board {
    grid-template-columns: repeat(4, 280px);
  }
}

@media (max-width: 760px) {
  body {
    font-size: 14px;
  }

  .login-card {
    padding: 18px;
  }

  .login-header {
    grid-template-columns: 1fr;
  }

  .login-role-grid,
  .quick-create-grid,
  .form-grid,
  .page-grid.three,
  .metric-grid,
  .tour-step-grid,
  .tour-button-grid {
    grid-template-columns: 1fr;
  }

  .login-role-actions {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: center;
    flex-direction: row;
    gap: 12px;
    padding: 12px 16px;
  }

  .topbar h1 {
    font-size: 1.25rem;
    font-weight: 700;
  }

  .topbar-actions {
    width: auto;
    justify-content: flex-end;
  }

  .role-switcher {
    flex: none;
    min-width: 0;
    background: transparent;
    border: none;
    padding: 0;
  }

  .role-switcher span {
    display: none;
  }

  .role-switcher select {
    width: 100%;
  }

  .tour-button {
    width: 44px;
    min-width: 44px;
    padding: 0;
  }

  .tour-button span {
    display: none;
  }

  .page {
    padding: 16px 12px 96px;
  }

  .hero-copy {
    padding: 18px;
  }

  .toolbar {
    align-items: stretch;
  }

  .toolbar > *,
  .search-wrap,
  .button,
  .select-field {
    width: 100%;
  }

  .topbar-actions .tour-button {
    width: 44px;
    min-width: 44px;
    flex: 0 0 44px;
  }

  .section-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .modal-overlay {
    padding: 0;
    align-items: end;
  }

  .modal {
    width: 100%;
    max-height: 92vh;
    border-radius: 8px 8px 0 0;
  }

  .modal-actions,
  .inline-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .tour-hero {
    grid-template-columns: 1fr;
  }

  .card, .metric-card, .line-item-row, .room-row {
    border-radius: 16px;
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03), 0 1px 2px rgba(0,0,0,0.02);
    background: #ffffff;
    margin-bottom: 12px;
  }

  .line-item-row,
  .room-row {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .section-header {
    padding: 8px 0;
  }

  .status-steps {
    grid-template-columns: repeat(8, 120px);
  }

  .pdf-header {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .pdf-header .inline-actions {
    grid-column: 1 / -1;
  }

  .audit-item {
    grid-template-columns: 1fr;
  }

  .toast-stack {
    left: 12px;
    right: 12px;
    bottom: 86px;
  }

  .toast {
    width: 100%;
  }
}

@media print {
  .sidebar,
  .topbar,
  .mobile-tabs,
  .button,
  .icon-button,
  .notification-drawer {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .page {
    padding: 0;
  }

  .pdf-preview {
    box-shadow: none;
    border: 0;
  }
}
