/* ================================================================
   PBR × 한우리 OMS — 모바일 최적화 스타일시트
   Mobile-First Responsive Design Overrides
================================================================ */

/* ── Mobile CSS Variables ── */
:root {
  --mobile-topbar-h: 56px;
  --mobile-bottom-nav-h: 64px;
  --mobile-sidebar-w: 280px;
}

/* ================================================================
   MOBILE OVERLAY (Sidebar backdrop)
================================================================ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 280;  /* 사이드바(300) 바로 아래 */
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* ================================================================
   BOTTOM NAV (Mobile Only)
================================================================ */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--mobile-bottom-nav-h);
  background: #fff;
  border-top: 1px solid #e5e7eb;
  z-index: 90;
  box-shadow: 0 -4px 16px rgba(0,0,0,.06);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 100%;
  padding: 0 4px;
}
.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 12px;
  border-radius: 12px;
  cursor: pointer;
  border: none;
  background: none;
  transition: all .2s;
  color: #9ca3af;
  min-width: 52px;
  position: relative;
}
.bottom-nav-item.active {
  color: #4f46e5;
}
.bottom-nav-item.active::before {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 32px; height: 3px;
  background: #4f46e5;
  border-radius: 0 0 4px 4px;
}
.bottom-nav-item i {
  font-size: 20px;
  transition: transform .2s;
}
.bottom-nav-item.active i {
  transform: scale(1.1);
}
.bottom-nav-item span {
  font-size: 10px;
  font-weight: 600;
  font-family: 'Noto Sans KR', sans-serif;
}
.bottom-nav-badge {
  position: absolute;
  top: 2px; right: 6px;
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
}

/* ================================================================
   MOBILE TOP BAR
================================================================ */
@media (max-width: 768px) {
  .topbar {
    height: var(--mobile-topbar-h);
    padding: 0 16px;
    gap: 10px;
  }
  .mobile-menu-btn {
    display: flex !important;
    width: 36px; height: 36px;
    background: #f3f4f6;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
  }
  .page-title { font-size: 15px; }
  .breadcrumb { display: none; }

  /* Compact right side */
  .topbar-right {
    gap: 6px;
  }
  .search-wrap {
    display: none;
  }
  .search-wrap.expanded {
    display: flex;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 200;
    height: var(--mobile-topbar-h);
    padding: 0 16px;
    border-radius: 0;
    background: #fff;
    border: none;
    border-bottom: 2px solid #4f46e5;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
  }
  .search-wrap.expanded input {
    width: 100%;
    font-size: 15px;
  }
  .search-toggle-btn {
    display: flex !important;
  }
  .topbar-btn {
    width: 34px; height: 34px;
    font-size: 13px;
  }
  .quickAddBtn-text { display: none; }
  #quickAddBtn {
    width: 34px; height: 34px;
    padding: 0;
    border-radius: 8px;
  }
  #topUserInfo { display: none !important; }
}

/* ================================================================
   MOBILE SIDEBAR
================================================================ */
@media (max-width: 768px) {
  .sidebar {
    transition: transform .3s ease, box-shadow .3s ease !important;
    box-shadow: none;
    /* position/width/transform은 style.css에서 설정 */
  }
  .sidebar.mobile-open {
    box-shadow: 8px 0 32px rgba(0,0,0,.35) !important;
  }
}

/* ================================================================
   MOBILE MAIN CONTENT
================================================================ */
@media (max-width: 768px) {
  .page-container {
    padding-bottom: calc(var(--mobile-bottom-nav-h) + 16px) !important;
    overflow-x: hidden;
  }
  .bottom-nav {
    display: flex !important;
  }
}

/* ================================================================
   MOBILE KPI GRID
================================================================ */
@media (max-width: 768px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .kpi-card {
    padding: 14px;
    gap: 10px;
  }
  .kpi-icon {
    width: 38px; height: 38px;
    font-size: 16px;
    border-radius: 10px;
  }
  .kpi-value { font-size: 20px; }
  .kpi-label { font-size: 10px; }
}

/* ================================================================
   MOBILE DASHBOARD
================================================================ */
@media (max-width: 768px) {
  .dash-row {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .card-lg, .card-sm { margin-bottom: 0; }

  /* Timeline items on mobile */
  .timeline-item {
    padding: 8px 10px;
  }
  .timeline-bar-wrap {
    display: none;
  }
  .timeline-name { font-size: 12px; }
  .timeline-sub { font-size: 10px; }
  .timeline-dday {
    min-width: 48px;
    font-size: 11px;
    padding: 2px 6px;
  }
}

/* ================================================================
   MOBILE PAGE TOOLBAR
================================================================ */
@media (max-width: 768px) {
  .page-toolbar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 0;
  }
  .page-toolbar input,
  .page-toolbar select {
    font-size: 13px;
    padding: 8px 10px;
    height: 36px;
  }
  .toolbar-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
    min-width: 0;
  }
  .toolbar-filters input[type="text"],
  .toolbar-filters input[type="search"] {
    flex: 1;
    min-width: 140px;
  }
  .toolbar-filters select {
    flex: 1;
    min-width: 100px;
  }
  .toolbar-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
  }
  .view-toggle { flex-shrink: 0; }
}

/* ================================================================
   MOBILE TABLES
================================================================ */
@media (max-width: 768px) {
  /* Mobile table scrolling */
  .table-wrap,
  .data-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  }
  .data-table {
    min-width: 580px;
    font-size: 12px;
  }
  .data-table th,
  .data-table td {
    padding: 8px 10px;
    white-space: nowrap;
  }
  .data-table .col-hide-mobile { display: none; }

  /* Smaller thumbnail on mobile */
  .thumb-img { width: 32px; height: 32px; border-radius: 4px; }

  /* Action buttons spacing */
  .action-btns { gap: 4px; }
  .btn-xs { padding: 3px 6px; font-size: 10px; }
}

/* ================================================================
   MOBILE ORDER CARDS
================================================================ */
@media (max-width: 768px) {
  .order-card-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }
  .order-card-img { height: 160px; }
  .order-card-body { padding: 12px; }
  .order-card-footer { padding: 10px 12px; }
}

/* ================================================================
   MOBILE MODALS
================================================================ */
@media (max-width: 768px) {
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .modal {
    border-radius: 20px 20px 0 0;
    max-height: 92vh;
    width: 100%;
    animation: modalInMobile .3s ease;
  }
  @keyframes modalInMobile {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }
  .modal-sm, .modal-md, .modal-lg, .modal-xl {
    max-width: 100%;
    border-radius: 20px 20px 0 0;
  }
  .modal-header {
    padding: 16px 18px;
  }
  .modal-header h2 { font-size: 15px; }
  .modal-body {
    padding: 16px 18px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
  .modal-footer {
    padding: 12px 18px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  /* Drag handle */
  .modal::before {
    content: '';
    display: block;
    width: 40px; height: 4px;
    background: #d1d5db;
    border-radius: 2px;
    margin: 10px auto -4px;
    flex-shrink: 0;
  }

  /* Modal tabs - scrollable */
  .modal-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
    -ms-overflow-style: none;
    gap: 0;
  }
  .modal-tabs::-webkit-scrollbar { display: none; }
  .modal-tab {
    padding: 8px 12px;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
  }
}

/* ================================================================
   MOBILE FORMS
================================================================ */
@media (max-width: 768px) {
  .form-grid-2,
  .form-grid-3 {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 16px; /* Prevents iOS zoom */
    padding: 10px 12px;
  }
  .photo-upload-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
  .photo-preview { height: 120px; }
  .photo-placeholder { padding: 20px 8px; }
  .photo-placeholder i { font-size: 22px; }
  .photo-placeholder span { font-size: 11px; }
}

/* ================================================================
   MOBILE SAMPLE BOARD
================================================================ */
@media (max-width: 768px) {
  .sample-board {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px;
  }
  .kanban-col-header { padding: 10px 12px; }
  .kanban-col-title { font-size: 12px; }
  .kanban-card { padding: 10px 12px; }
  .kanban-card-no { font-size: 12px; }
}

@media (max-width: 480px) {
  .sample-board {
    grid-template-columns: 1fr !important;
  }
}

/* ================================================================
   MOBILE PRODUCTION / GANTT
================================================================ */
@media (max-width: 768px) {
  .gantt-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .gantt-chart { min-width: 700px; }

  .prod-order-header {
    flex-wrap: wrap;
    gap: 6px;
  }
  .stage-boxes {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    padding-bottom: 4px;
  }
  .stage-box {
    min-width: 80px;
    padding: 8px 6px;
    font-size: 11px;
  }
  .stage-icon { font-size: 18px; }
}

/* ================================================================
   MOBILE DELIVERY PAGE
================================================================ */
@media (max-width: 768px) {
  .delivery-grid {
    grid-template-columns: 1fr !important;
  }
  .risk-order-item {
    padding: 10px 12px;
  }
  .risk-order-name { font-size: 12px; }
}

/* ================================================================
   MOBILE REPORTS
================================================================ */
@media (max-width: 768px) {
  .report-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    gap: 6px;
  }
  .report-tabs::-webkit-scrollbar { display: none; }
  .report-tab {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 7px 14px;
    font-size: 12px;
  }

  /* Chart containers */
  .chart-row {
    grid-template-columns: 1fr !important;
    gap: 14px;
  }
  .report-summary-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px;
  }
  canvas { max-height: 260px !important; }
}

/* ================================================================
   MOBILE QUALITY ISSUES
================================================================ */
@media (max-width: 768px) {
  .quality-kpi-row {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .quality-kpi-row .kpi-mini {
    flex: unset;
  }
}

/* ================================================================
   MOBILE CONTACTS
================================================================ */
@media (max-width: 768px) {
  .contact-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .contact-card { padding: 12px; }
  .contact-avatar {
    width: 40px; height: 40px;
    font-size: 16px;
  }
  .contact-name { font-size: 13px; }
}
@media (max-width: 480px) {
  .contact-grid { grid-template-columns: 1fr; }
}

/* ================================================================
   MOBILE COSTS
================================================================ */
@media (max-width: 768px) {
  .cost-summary-row {
    flex-direction: column;
    gap: 10px;
  }
  .cost-summary-card {
    padding: 14px;
  }
  .cost-value { font-size: 18px; }
}

/* ================================================================
   MOBILE DAILY REPORTS
================================================================ */
@media (max-width: 768px) {
  .daily-report-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }
}

/* ================================================================
   MOBILE NOTIFICATION PANEL
================================================================ */
@media (max-width: 768px) {
  .notif-panel {
    position: fixed;
    top: 0; left: 0; right: 0;
    width: 100%;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    max-height: 70vh;
  }
  .notif-list { max-height: 50vh; }
}

/* ================================================================
   MOBILE CARD ADJUSTMENTS
================================================================ */
@media (max-width: 768px) {
  .card { border-radius: 12px; }
  .card-header { padding: 12px 16px; }
  .card-body { padding: 14px 16px; }
  .card-header h3 { font-size: 13px; }

  /* Delivery timeline */
  .delivery-timeline { padding: 8px 14px 12px; }
  .delivery-timeline-full { padding: 8px 14px; }
}

/* ================================================================
   MOBILE PAGINATION
================================================================ */
@media (max-width: 768px) {
  .pagination { gap: 3px; padding: 12px 0; }
  .page-btn { width: 30px; height: 30px; font-size: 11px; }
  .pagination-info { font-size: 11px; }
}

/* ================================================================
   MOBILE TOAST
================================================================ */
@media (max-width: 768px) {
  .toast-container {
    bottom: calc(var(--mobile-bottom-nav-h) + 16px);
    left: 16px;
    right: 16px;
  }
  .toast {
    min-width: unset;
    width: 100%;
    max-width: 100%;
    font-size: 12px;
    padding: 10px 14px;
  }
}

/* ================================================================
   MOBILE DETAIL MODAL
================================================================ */
@media (max-width: 768px) {
  .detail-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .detail-section-title { font-size: 12px; }
  .detail-item label { font-size: 9px; }
  .detail-item .detail-value { font-size: 12px; }
  .detail-photos { flex-wrap: wrap; }
  .detail-photo {
    width: 90px; height: 90px;
  }
  .process-steps { gap: 5px; }
  .process-step {
    min-width: 72px;
    padding: 8px 6px;
  }
  .process-step-name { font-size: 9px; }
  .process-step-pct { font-size: 11px; }
}

@media (max-width: 480px) {
  .detail-grid { grid-template-columns: 1fr 1fr; }
}

/* ================================================================
   MOBILE SEARCH OVERLAY
================================================================ */
.mobile-search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 190;
}
.mobile-search-overlay.active { display: block; }

/* ================================================================
   PULL-TO-REFRESH INDICATOR
================================================================ */
.ptr-indicator {
  display: none;
  position: fixed;
  top: var(--mobile-topbar-h);
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border-radius: 99px;
  padding: 8px 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
  font-size: 12px;
  color: #4f46e5;
  font-weight: 600;
  z-index: 100;
  align-items: center;
  gap: 6px;
}
.ptr-indicator.visible { display: flex; }
.ptr-spinner {
  width: 14px; height: 14px;
  border: 2px solid #e5e7eb;
  border-top-color: #4f46e5;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* ================================================================
   MISC MOBILE HELPERS
================================================================ */
@media (max-width: 768px) {
  /* Larger tap targets */
  .nav-item { min-height: 44px; }
  .btn { min-height: 40px; }
  .btn-sm { min-height: 36px; }
  .btn-xs { min-height: 28px; }

  /* Full-width select on mobile */
  select { max-width: 100%; }

  /* Smooth scrolling on iOS */
  * { -webkit-tap-highlight-color: transparent; }
  .page-container,
  .modal-body,
  .notif-list,
  .sidebar-nav,
  .data-table-wrap { -webkit-overflow-scrolling: touch; }

  /* Prevent content from being covered by notch */
  .page-container { padding-top: 14px; }
  body { padding-bottom: env(safe-area-inset-bottom); }

  /* Hide collapse toggle on mobile */
  .sidebar-toggle { display: none; }
}

/* ================================================================
   FLOATING ACTION BUTTON (Mobile quick-add)
================================================================ */
.fab {
  display: none;
  position: fixed;
  right: 20px;
  bottom: calc(var(--mobile-bottom-nav-h) + 20px);
  width: 52px; height: 52px;
  background: #4f46e5;
  border-radius: 50%;
  box-shadow: 0 4px 20px rgba(79,70,229,.5);
  border: none;
  cursor: pointer;
  color: #fff;
  font-size: 20px;
  align-items: center;
  justify-content: center;
  z-index: 80;
  transition: all .2s;
}
.fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(79,70,229,.6);
}
.fab:active { transform: scale(.95); }

@media (max-width: 768px) {
  .fab { display: flex; }
  #quickAddBtn { display: none !important; }
}

/* ================================================================
   SWIPE ACTION (Order cards)
================================================================ */
.swipe-item {
  overflow: hidden;
  position: relative;
  border-radius: 12px;
  touch-action: pan-y;
}

/* ================================================================
   RESPONSIVE TABLE SCROLL INDICATOR
================================================================ */
.table-scroll-hint {
  display: none;
  text-align: center;
  font-size: 11px;
  color: #9ca3af;
  padding: 4px;
  gap: 4px;
  align-items: center;
  justify-content: center;
  margin-top: -8px;
  margin-bottom: 8px;
}
@media (max-width: 768px) {
  .table-scroll-hint { display: flex; }
}

/* ================================================================
   ADMIN PAGE MOBILE
================================================================ */
@media (max-width: 768px) {
  .admin-user-grid {
    grid-template-columns: 1fr !important;
  }
  .admin-user-card {
    padding: 14px;
  }
  .admin-stats-row {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .admin-table-wrap,
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .admin-table { min-width: 600px; }
}

/* ================================================================
   SHIPMENTS MOBILE
================================================================ */
@media (max-width: 768px) {
  .shipment-status-flow {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    gap: 4px;
  }
  .shipment-status-step {
    min-width: 70px;
    font-size: 10px;
    flex-shrink: 0;
  }
}

/* ================================================================
   STAGE PIPELINE MOBILE
================================================================ */
@media (max-width: 768px) {
  .prod-pipeline-section {
    margin-bottom: 12px;
  }
  .prod-order-wrap {
    padding: 14px;
  }
  .prod-order-title {
    font-size: 13px;
  }
  .stage-progress-bar { height: 5px; }
}

/* ================================================================
   SMOOTH TRANSITIONS ON MOBILE
================================================================ */
@media (max-width: 768px) {
  .page { transition: opacity .2s ease; }
  .page.active { animation: pageFadeIn .2s ease; }
  @keyframes pageFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

/* ================================================================
   IPHONE X / SAFE AREA SUPPORT
================================================================ */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .bottom-nav {
    padding-bottom: env(safe-area-inset-bottom);
    height: calc(var(--mobile-bottom-nav-h) + env(safe-area-inset-bottom));
  }
  .fab {
    bottom: calc(var(--mobile-bottom-nav-h) + env(safe-area-inset-bottom) + 20px);
  }
  @media (max-width: 768px) {
    .main-content {
      padding-bottom: calc(var(--mobile-bottom-nav-h) + env(safe-area-inset-bottom));
    }
  }
}

/* ================================================================
   DARK MODE SUPPORT (System Preference)
================================================================ */
@media (prefers-color-scheme: dark) {
  /* Optional: Can be expanded for dark mode support */
}

/* ================================================================
   PRINT
================================================================ */
@media print {
  .sidebar, .topbar, .bottom-nav, .fab, .toast-container { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .page-container { padding: 0 !important; }
}

/* ================================================================
   ADDITIONAL MOBILE REFINEMENTS
================================================================ */

/* Filter inputs on mobile — compact layout */
@media (max-width: 768px) {
  .filters {
    gap: 6px;
    width: 100%;
  }
  .filter-input {
    min-width: 0 !important;
    flex: 1;
    font-size: 13px;
  }
  .filters select {
    flex: 1;
    min-width: 90px;
    font-size: 13px;
  }
  .toolbar-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .toolbar-actions .btn {
    flex: 1;
    justify-content: center;
  }
  .toolbar-actions .btn-sm {
    flex: unset;
  }
}

/* KPI mini cards (quality page) */
@media (max-width: 768px) {
  .kpi-mini {
    padding: 12px 14px;
    border-radius: 10px;
  }
  .kpi-mini-value { font-size: 20px; }
  .kpi-mini-label { font-size: 10px; }
}

/* Detail modal photos wrap */
@media (max-width: 480px) {
  .detail-photos {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .detail-photo {
    width: 100%;
    height: 80px;
  }
}

/* Dashboard recent orders table — scroll */
@media (max-width: 768px) {
  #dashOrderTable { min-width: 540px; }
}

/* Alert list compact on mobile */
@media (max-width: 768px) {
  .alert-list { max-height: 200px; }
  .alert-item { padding: 8px 14px; }
  .alert-text { font-size: 11px; }
}

/* Stage pipeline compact */
@media (max-width: 768px) {
  .pipeline-stage { gap: 8px; padding: 8px 10px; }
  .pipeline-name { width: 70px; font-size: 11px; }
  .pipeline-seq { width: 20px; height: 20px; font-size: 9px; }
  .pipeline-bar-bg { height: 6px; }
}

/* Notification panel full width on small screens */
@media (max-width: 480px) {
  .notif-panel {
    left: 0; right: 0;
    width: 100% !important;
  }
}

/* Card header compact on mobile */
@media (max-width: 480px) {
  .card-header {
    padding: 10px 14px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .card-actions {
    flex-wrap: wrap;
  }
}

/* Form group labels */
@media (max-width: 480px) {
  .form-group label { font-size: 11px; }
}

/* Buttons in toolbar compact */
@media (max-width: 480px) {
  .btn {
    padding: 8px 14px;
    font-size: 12px;
  }
  .btn-sm {
    padding: 6px 10px;
    font-size: 11px;
  }
}

/* Toast container safe position */
@media (max-width: 768px) {
  .toast-container {
    right: 12px;
    left: 12px;
    bottom: calc(var(--mobile-bottom-nav-h) + 12px);
  }
}

/* Report summary cards */
@media (max-width: 768px) {
  .report-summary-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
}

/* Gantt chart horizontal scroll indicator */
@media (max-width: 768px) {
  .gantt-wrap::after {
    content: '← 좌우 스크롤 가능 →';
    display: block;
    text-align: center;
    font-size: 10px;
    color: #9ca3af;
    padding: 4px;
  }
}

/* Role switcher on mobile sidebar */
@media (max-width: 768px) {
  .role-switcher { display: block; }
  .role-btns { display: flex !important; }
}

/* User info row in topbar if shown */
@media (max-width: 480px) {
  .topbar-right > * { flex-shrink: 0; }
}

/* ================================================================
   CRITICAL MOBILE FIX — 터치 이벤트 & z-index 보정
================================================================ */

/* 사이드바 오버레이: 사이드바(z:300)보다 낮고 콘텐츠(z:1)보다 높게 */
.sidebar-overlay {
  z-index: 299 !important;
}

/* 사이드바: 최상위 레이어 */
.sidebar {
  z-index: 300 !important;
}

/* 하단 네비게이션: topbar보다 낮게, content보다 높게 */
.bottom-nav {
  z-index: 90 !important;
}

/* FAB: 하단바 위에 */
.fab {
  z-index: 91 !important;
}

/* 모달: 사이드바보다 높게 */
.modal-overlay {
  z-index: 400 !important;
}
.modal {
  z-index: 401 !important;
}

/* ─── 모바일 네비게이션 버튼: 터치 영역 최소 44px 보장 ─── */
@media (max-width: 768px) {
  .nav-item {
    min-height: 44px;
    -webkit-tap-highlight-color: rgba(79,70,229,.15);
    cursor: pointer;
  }
  .nav-item:active {
    background: rgba(79,70,229,.18) !important;
  }
  .bottom-nav-item {
    min-width: 44px;
    min-height: 44px;
    -webkit-tap-highlight-color: rgba(79,70,229,.12);
    cursor: pointer;
    touch-action: manipulation;
  }
  .btn {
    -webkit-tap-highlight-color: rgba(0,0,0,.08);
    touch-action: manipulation;
  }
  .mobile-menu-btn {
    -webkit-tap-highlight-color: rgba(0,0,0,.08);
    touch-action: manipulation;
    min-width: 44px;
    min-height: 44px;
  }
  /* 사이드바 내 nav-item 클릭 가능 영역 확장 */
  .sidebar-nav .nav-item {
    position: relative;
    z-index: 1;
  }
  /* 모바일에서 페이지 컨텐츠가 클릭을 가로채지 않도록 */
  .page-container {
    position: relative;
    z-index: 1;
  }
  /* topbar z-index */
  .topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: #fff;
  }
}

/* ─── iOS 터치 딜레이 제거 ─── */
* {
  touch-action: manipulation;
}
/* 스크롤 가능한 요소만 복원 */
.page-container,
.sidebar-nav,
.modal,
.table-wrap,
.delivery-timeline-full,
.order-card-grid {
  touch-action: pan-y;
}

