/*
 * Surf Suite — Mobile Experience System
 * ========================================
 * Extends shell-v2.css with mobile-native patterns.
 * Load AFTER shell-v2.css.
 *
 * Patterns:
 *   1. Touch targets
 *   2. Bottom navigation
 *   3. Floating action button (FAB)
 *   4. Bottom sheet
 *   5. Mobile drawer (sidebar)
 *   6. Table → card transformation
 *   7. Mobile command search
 *   8. Sticky action bar
 *   9. Mobile forms
 *  10. Mobile AI panel
 *  11. Safe area handling
 *  12. Gesture indicators
 */

/* ═══════════════════════════════════════════════════════════════════════════
   1. TOUCH TARGETS
   All interactive elements must be ≥ 44×44px on mobile.
═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

  /* Ensure minimum tap target on all interactive elements */
  button,
  a,
  [role="button"],
  input[type="checkbox"],
  input[type="radio"],
  select {
    min-height: 44px;
  }

  /* Override for elements that rely on padding compensation */
  .nav-link,
  .surf-tab,
  .inline-chip { min-height: 40px; }

  /* Touch-safe input fields */
  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea,
  .surf-input {
    min-height: 44px;
    padding: 10px 12px;
    font-size: 16px; /* prevent iOS auto-zoom */
  }

  /* Touch-safe buttons */
  button,
  .btn,
  .btn-primary,
  .surf-btn,
  .surf-btn-primary {
    min-height: 44px;
    padding: 10px 16px;
    font-size: 15px;
  }

  .surf-btn-sm {
    min-height: 36px;
    padding: 7px 12px;
    font-size: 13px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   2. BOTTOM NAVIGATION
   Primary navigation for mobile. Replaces sidebar on small screens.
═══════════════════════════════════════════════════════════════════════════ */

.surf-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}

.surf-bottom-nav-inner {
  display: flex;
  align-items: stretch;
  height: 56px;
  width: 100%;
}

.surf-bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  border: none;
  background: transparent;
  font-family: var(--font);
  cursor: pointer;
  position: relative;
  transition: color var(--t-fast);
  color: var(--c-text-4);
  min-height: 56px;
  -webkit-tap-highlight-color: transparent;
}

.surf-bottom-nav-item:hover,
.surf-bottom-nav-item:active { color: var(--c-text-3); }

.surf-bottom-nav-item.active { color: var(--app-primary); }

.surf-bottom-nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 2px;
  background: var(--app-primary);
  border-radius: 0 0 2px 2px;
}

.surf-bottom-nav-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.surf-bottom-nav-icon svg { width: 100%; height: 100%; }

.surf-bottom-nav-badge {
  position: absolute;
  top: -3px;
  right: -5px;
  min-width: 16px;
  height: 16px;
  background: var(--app-primary);
  color: white;
  font-size: 9px;
  font-weight: 700;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--c-surface);
}

.surf-bottom-nav-label {
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
}

@media (max-width: 768px) {
  .surf-bottom-nav { display: block; }

  /* Push main content above bottom nav */
  .surf-main,
  .surf-mobile-content {
    padding-bottom: calc(56px + env(safe-area-inset-bottom));
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   3. FLOATING ACTION BUTTON (FAB)
   Primary action shortcut. Thumb-accessible bottom-right.
═══════════════════════════════════════════════════════════════════════════ */

.surf-fab {
  display: none;
  position: fixed;
  bottom: calc(72px + env(safe-area-inset-bottom));
  right: 16px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--app-primary);
  color: white;
  border: none;
  box-shadow: 0 4px 16px rgba(0,0,0,.18), 0 1px 4px rgba(0,0,0,.12);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 90;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
  -webkit-tap-highlight-color: transparent;
  font-family: var(--font);
}

.surf-fab:hover { background: var(--app-primary-hover); }

.surf-fab:active {
  transform: scale(.94);
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}

.surf-fab svg { width: 22px; height: 22px; }

/* Extended FAB (label + icon) */
.surf-fab-extended {
  width: auto;
  border-radius: var(--r-full);
  padding: 0 18px;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

/* FAB with bottom nav: shift up */
.surf-fab.has-bottom-nav {
  bottom: calc(68px + env(safe-area-inset-bottom));
}

@media (max-width: 768px) {
  .surf-fab { display: flex; }
}

/* Hide FAB on desktop if explicitly mobile-only */
.surf-fab-mobile-only { display: none; }
@media (max-width: 768px) {
  .surf-fab-mobile-only { display: flex; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   4. BOTTOM SHEET
   Replaces modals/dropdowns on mobile. Slides up from bottom.
═══════════════════════════════════════════════════════════════════════════ */

.surf-bottom-sheet-overlay {
  position: fixed;
  inset: 0;
  background: var(--c-overlay);
  z-index: 199;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-slow);
}

.surf-bottom-sheet-overlay.is-open {
  opacity: 1;
  pointer-events: all;
}

.surf-bottom-sheet {
  position: fixed;
  inset-x: 0;
  bottom: 0;
  background: var(--c-surface);
  border-radius: var(--r-2xl) var(--r-2xl) 0 0;
  box-shadow: 0 -4px 32px rgba(0,0,0,.12), 0 -1px 8px rgba(0,0,0,.06);
  z-index: 200;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
  transform: translateY(100%);
  transition: transform var(--t-slow) cubic-bezier(0.32, 0.72, 0, 1);
  will-change: transform;
}

.surf-bottom-sheet.is-open {
  transform: translateY(0);
}

/* Drag handle */
.surf-bottom-sheet-handle {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  padding: 10px 0 6px;
  cursor: grab;
}

.surf-bottom-sheet-handle::before {
  content: '';
  width: 36px;
  height: 4px;
  background: var(--c-border-strong);
  border-radius: var(--r-full);
}

.surf-bottom-sheet-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 18px 14px;
}

.surf-bottom-sheet-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--c-text);
}

.surf-bottom-sheet-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--c-bg);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-text-3);
  cursor: pointer;
  font-family: var(--font);
  transition: background var(--t-fast);
}

.surf-bottom-sheet-close:active { background: var(--c-border); }

.surf-bottom-sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 18px 18px;
  -webkit-overflow-scrolling: touch;
}

.surf-bottom-sheet-footer {
  flex-shrink: 0;
  padding: 12px 18px;
  border-top: 1px solid var(--c-border-2);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.surf-bottom-sheet-footer .surf-btn,
.surf-bottom-sheet-footer button {
  width: 100%;
  justify-content: center;
}

/* Short bottom sheet variant (confirmation) */
.surf-bottom-sheet-sm { max-height: 44vh; }

/* Full bottom sheet variant */
.surf-bottom-sheet-full { max-height: 96vh; border-radius: var(--r-xl) var(--r-xl) 0 0; }

/* ═══════════════════════════════════════════════════════════════════════════
   5. TABLE → CARD TRANSFORMATION
   Desktop tables become scannable entity cards on mobile.
═══════════════════════════════════════════════════════════════════════════ */

/* Desktop: show table, hide mobile cards */
.surf-table-wrap { display: block; }
.surf-mobile-cards { display: none; }

@media (max-width: 768px) {
  /* Hide the full table wrapper */
  .surf-table-wrap,
  .surf-table-desktop { display: none !important; }

  /* Show mobile card list */
  .surf-mobile-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
}

/* Entity card — the mobile table row replacement */
.surf-entity-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--sh-xs);
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  text-decoration: none;
  color: inherit;
}

.surf-entity-card:active {
  border-color: var(--app-primary-border);
  box-shadow: var(--sh-md);
}

.surf-entity-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.surf-entity-card-identity { flex: 1; min-width: 0; }

.surf-entity-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--c-text);
  line-height: 1.3;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.surf-entity-card-meta {
  font-size: 12px;
  color: var(--c-text-4);
  line-height: 1.4;
}

.surf-entity-card-status { flex-shrink: 0; }

.surf-entity-card-fields {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.surf-entity-card-field { display: flex; flex-direction: column; gap: 2px; }

.surf-entity-card-field-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--c-text-4);
}

.surf-entity-card-field-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.surf-entity-card-actions {
  display: flex;
  gap: 8px;
  padding-top: 2px;
  border-top: 1px solid var(--c-border-2);
}

.surf-entity-card-actions .surf-btn {
  flex: 1;
  justify-content: center;
}

/* Overdue/urgent visual signal */
.surf-entity-card.is-urgent {
  border-left: 3px solid var(--status-error-text);
  padding-left: 13px;
}

.surf-entity-card.is-warning {
  border-left: 3px solid var(--status-warning-text);
  padding-left: 13px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   6. MOBILE COMMAND SEARCH
   Full-screen search overlay optimized for touch.
═══════════════════════════════════════════════════════════════════════════ */

.surf-mobile-search-overlay {
  position: fixed;
  inset: 0;
  background: var(--c-surface);
  z-index: 400;
  display: flex;
  flex-direction: column;
  transform: translateY(-100%);
  transition: transform var(--t-slow) cubic-bezier(0.32, 0.72, 0, 1);
}

.surf-mobile-search-overlay.is-open {
  transform: translateY(0);
}

.surf-mobile-search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
  padding-top: calc(12px + env(safe-area-inset-top));
}

.surf-mobile-search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 17px;
  font-family: var(--font);
  color: var(--c-text);
  min-height: 44px;
  padding: 0;
}

.surf-mobile-search-bar input::placeholder { color: var(--c-text-4); }

.surf-mobile-search-cancel {
  font-size: 15px;
  font-weight: 600;
  color: var(--app-primary);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  padding: 8px 0 8px 8px;
  min-height: 44px;
  white-space: nowrap;
}

.surf-mobile-search-results {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 0;
}

.surf-mobile-search-section {
  padding: 10px 16px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--c-text-4);
}

.surf-mobile-search-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  text-decoration: none;
  color: var(--c-text);
  transition: background var(--t-fast);
  min-height: 56px;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: var(--font);
}

.surf-mobile-search-item:active { background: var(--c-hover); }

.surf-mobile-search-item-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--c-bg);
}

.surf-mobile-search-item-text { flex: 1; min-width: 0; }

.surf-mobile-search-item-label {
  font-size: 15px;
  font-weight: 500;
  color: var(--c-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.surf-mobile-search-item-sub {
  font-size: 12px;
  color: var(--c-text-4);
}

.surf-mobile-search-item-arrow {
  width: 16px;
  height: 16px;
  color: var(--c-text-4);
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   7. STICKY ACTION BAR
   For form pages: submit/cancel at bottom, always accessible.
═══════════════════════════════════════════════════════════════════════════ */

.surf-sticky-actions {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  display: flex;
  gap: 10px;
  z-index: 50;
  box-shadow: 0 -4px 16px rgba(0,0,0,.06);
}

.surf-sticky-actions .surf-btn {
  flex: 1;
  justify-content: center;
  min-height: 46px;
}

.surf-sticky-actions .surf-btn-primary { flex: 2; }

/* Desktop: sticky actions are inline (not fixed bottom) */
@media (min-width: 769px) {
  .surf-sticky-actions {
    position: static;
    border-top: none;
    padding: 16px 0 0;
    box-shadow: none;
    background: transparent;
  }

  .surf-sticky-actions .surf-btn { flex: 0 1 auto; }
  .surf-sticky-actions .surf-btn-primary { flex: 0 1 auto; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   8. MOBILE TOPBAR
   Simplified topbar for mobile screens.
═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .surf-topbar {
    padding: 0 12px;
    height: 52px;
  }

  /* Logo zone loses sidebar-width constraint */
  .surf-tb-logo {
    width: auto;
    border-right: none;
    padding: 0 8px 0 0;
    gap: 7px;
  }

  .surf-tb-logo-mark { width: 24px; height: 24px; }

  .surf-tb-logo-text { font-size: 13px; }

  .surf-tb-workspace { display: none; }
  .surf-tb-sep { display: none; }
  .surf-tb-apps { display: none; }
  .global-sales-kpi { display: none; }
  .surf-tb-user-info { display: none; }

  /* Show search icon trigger instead of full search bar */
  .surf-tb-search { display: none; }
  .surf-tb-search-trigger {
    display: flex !important;
    width: 36px;
    height: 36px;
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    background: var(--c-hover);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--c-text-3);
  }

  .surf-tb-avatar { width: 30px; height: 30px; }

  /* Push topbar content */
  .surf-tb-right { gap: 4px; }
}

/* Search trigger (hidden on desktop, shown on mobile) */
.surf-tb-search-trigger {
  display: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   9. MOBILE CONTENT LAYOUT
═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

  .surf-content,
  .content { padding: 14px 16px 80px; }

  /* Page header mobile layout */
  .section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
  }

  .section-head > *:last-child {
    margin-left: 0 !important;
  }

  /* Hide desktop-only actions in section head */
  .section-head-desktop-actions { display: none; }

  /* Page meta */
  .page-meta { font-size: 13px; margin-bottom: 14px; }

  /* Panel */
  .panel {
    padding: 14px 16px;
    margin-bottom: 10px;
  }

  /* Grids */
  .grid-2,
  .grid-3,
  .grid-4 { grid-template-columns: repeat(2, 1fr); gap: 8px; }

  /* Single column for narrow grids */
  .grid-3.mobile-single,
  .grid-4.mobile-single { grid-template-columns: 1fr; }

  /* KPI stat cards on mobile: 2 per row */
  .surf-stat-card {
    padding: 12px 14px;
  }

  .surf-stat-value { font-size: 20px; }

  /* Form inline becomes stacked */
  .form-inline {
    flex-direction: column;
    gap: 12px;
  }

  .form-inline > div { min-width: 0; width: 100%; }

  /* Filters: hide on mobile, show in bottom sheet */
  .surf-filters-desktop { display: none; }
  .surf-filters-mobile-trigger { display: flex !important; }

  /* ATS widget grid: 2 col on mobile */
  .ats-widget-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
}

/* Mobile-only filter trigger (hidden on desktop) */
.surf-filters-mobile-trigger {
  display: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   10. MOBILE AI PANEL
   Compact AI assistant optimized for mobile interaction.
═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

  /* AI panel becomes a bottom sheet on mobile */
  .surf-ai-panel-mobile {
    position: fixed;
    inset-x: 0;
    bottom: calc(56px + env(safe-area-inset-bottom));
    background: var(--c-surface);
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    border: 1px solid var(--c-border);
    box-shadow: 0 -4px 32px rgba(0,0,0,.10);
    z-index: 150;
    transform: translateY(100%);
    transition: transform var(--t-slow) cubic-bezier(0.32, 0.72, 0, 1);
    max-height: 70vh;
    display: flex;
    flex-direction: column;
  }

  .surf-ai-panel-mobile.is-open { transform: translateY(0); }

  /* AI quick suggestion chips for mobile */
  .surf-ai-suggestions-mobile {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 10px 16px;
    scrollbar-width: none;
    flex-shrink: 0;
    border-bottom: 1px solid var(--c-border-2);
  }

  .surf-ai-suggestions-mobile::-webkit-scrollbar { display: none; }

  .surf-ai-suggestion-chip {
    white-space: nowrap;
    padding: 7px 12px;
    border-radius: var(--r-full);
    font-size: 12px;
    font-weight: 500;
    color: var(--app-primary-text);
    background: var(--app-primary-soft);
    border: 1px solid var(--app-primary-border);
    cursor: pointer;
    flex-shrink: 0;
    min-height: 34px;
    display: flex;
    align-items: center;
    transition: opacity var(--t-fast);
    font-family: var(--font);
  }

  .surf-ai-suggestion-chip:active { opacity: .75; }

  /* AI chat input on mobile */
  .surf-ai-input-mobile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--c-border-2);
    flex-shrink: 0;
  }

  .surf-ai-input-mobile input {
    flex: 1;
    border: 1px solid var(--c-border);
    border-radius: var(--r-full);
    padding: 9px 14px;
    font-size: 15px;
    background: var(--c-bg);
    outline: none;
    min-height: 42px;
  }

  .surf-ai-input-mobile input:focus {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 3px var(--app-focus-ring);
  }

  .surf-ai-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--app-primary);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--t-fast), transform 80ms;
    color: white;
  }

  .surf-ai-send-btn:active { transform: scale(.9); }
  .surf-ai-send-btn:disabled { background: var(--c-border); }
  .surf-ai-send-btn svg { width: 18px; height: 18px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   11. SAFE AREA HANDLING
   iPhone notch / home indicator compatibility.
═══════════════════════════════════════════════════════════════════════════ */

@supports (padding: env(safe-area-inset-bottom)) {
  .surf-bottom-nav {
    padding-bottom: env(safe-area-inset-bottom);
    height: calc(56px + env(safe-area-inset-bottom));
  }

  .surf-bottom-nav-inner { height: 56px; }

  .surf-fab { bottom: calc(72px + env(safe-area-inset-bottom)); }

  .surf-bottom-sheet { padding-bottom: env(safe-area-inset-bottom); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   12. MOBILE DRAWER (enhanced sidebar)
═══════════════════════════════════════════════════════════════════════════ */

/* Mobile drawer — full sidebar version */
.surf-mobile-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  box-shadow: var(--sh-xl);
  z-index: 300;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform var(--t-slow) cubic-bezier(0.32, 0.72, 0, 1);
  will-change: transform;
  -webkit-overflow-scrolling: touch;
}

.surf-mobile-drawer.is-open { transform: translateX(0); }

.surf-mobile-overlay {
  position: fixed;
  inset: 0;
  background: var(--c-overlay);
  z-index: 299;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-slow);
}

.surf-mobile-overlay.is-open {
  opacity: 1;
  pointer-events: all;
}

/* Drawer header with close button */
.surf-mobile-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--c-border-2);
  flex-shrink: 0;
  padding-top: calc(16px + env(safe-area-inset-top));
}

.surf-mobile-drawer-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--c-bg);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-text-3);
  cursor: pointer;
  font-family: var(--font);
}

.surf-mobile-drawer-close:active { background: var(--c-border); }

/* Mobile nav links — larger touch targets */
@media (max-width: 768px) {
  .surf-mobile-drawer .nav-link {
    padding: 10px 12px;
    font-size: 15px;
    min-height: 44px;
  }

  .surf-mobile-drawer .nav-icon {
    width: 18px;
    height: 18px;
  }

  .surf-mobile-drawer .sidebar-section-toggle {
    padding: 14px 14px 5px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   13. MOBILE PAGE PATTERNS
═══════════════════════════════════════════════════════════════════════════ */

/* Mobile section with pull-to-refresh visual indicator */
.surf-mobile-pull-indicator {
  display: none;
  align-items: center;
  justify-content: center;
  height: 40px;
  color: var(--c-text-4);
  font-size: 12px;
  gap: 6px;
}

/* Swipe action hint on cards */
.surf-entity-card.swipe-hint::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--r-lg);
  border: 1.5px solid var(--app-primary-border);
  opacity: 0;
  transition: opacity var(--t-fast);
  pointer-events: none;
}

/* Context menu on long-press (JS controlled) */
.surf-context-menu {
  position: absolute;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-xl);
  z-index: 200;
  overflow: hidden;
  min-width: 180px;
  animation: a-scale-in .12s ease;
}

.surf-context-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 500;
  color: var(--c-text-2);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: var(--font);
  transition: background var(--t-fast);
  min-height: 48px;
}

.surf-context-menu-item:active { background: var(--c-hover); }
.surf-context-menu-item.danger { color: var(--status-error-text); }
.surf-context-menu-item.danger:active { background: var(--status-error-bg); }
.surf-context-menu-sep { height: 1px; background: var(--c-border-2); }

/* ═══════════════════════════════════════════════════════════════════════════
   14. REDUCED MOTION
═══════════════════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  .surf-bottom-sheet,
  .surf-mobile-drawer,
  .surf-mobile-search-overlay,
  .surf-bottom-sheet-overlay,
  .surf-mobile-overlay {
    transition: none;
  }

  .surf-fab { transition: background var(--t-fast); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   15. TABLET (768–1024px) — Hybrid layouts
═══════════════════════════════════════════════════════════════════════════ */

@media (min-width: 769px) and (max-width: 1024px) {
  .surf-sidebar { width: 56px; }
  .surf-sidebar .sidebar-section-heading span:not(.nav-icon),
  .surf-sidebar .nav-link > span:not(.nav-icon),
  .surf-sidebar .surf-nav-badge,
  .surf-sidebar .sidebar-section-caret { display: none; }
  .surf-sidebar .nav-link { justify-content: center; padding: 8px; }
  .surf-sidebar .sidebar-section-toggle { justify-content: center; padding: 10px 0 4px; }

  .surf-tb-apps { display: flex; }
  .surf-bottom-nav { display: none; }
  .surf-fab { display: none; }

  .grid-4 { grid-template-columns: repeat(2, 1fr); }

  .surf-content,
  .content { padding: 16px 20px; }
}
