/* ============================================
     INSIGHT CLIENT PORTAL DESIGN SYSTEM
     Branded by UDS - Navy Blue Professional
  ============================================ */
  
  :root {
    /* Insight Brand Colors - Light Theme */
    --insight-navy: #001F3F;
    --insight-blue: #3A6D9E;
    --insight-bg: #F8FAFC;
    --insight-bg-gradient: linear-gradient(to bottom, #F8FAFC 0%, #E2E8F0 100%);
    --insight-card: rgba(255, 255, 255, 0.8);
    --insight-text-primary: #001F3F;
    --insight-text-secondary: #4A5568;
    --insight-text-white: #FFFFFF;
    --insight-success: #38A169;
    --insight-error: #E53E3E;
    --insight-warning: #FFD700;
    --insight-border: rgba(0, 31, 63, 0.1);
    --insight-shadow: 0 4px 6px -1px rgba(0, 31, 63, 0.1), 0 2px 4px -1px rgba(0, 31, 63, 0.06);
    --insight-shadow-hover: 0 10px 15px -3px rgba(0, 31, 63, 0.15), 0 4px 6px -2px rgba(0, 31, 63, 0.1);
    --insight-gradient: linear-gradient(135deg, #001F3F 0%, #3A6D9E 100%);
    --insight-glass-blur: blur(10px);
    --logistics-green: #38A169;
    
    /* Current Theme Variables */
    --bg-primary: var(--insight-bg);
    --bg-gradient: var(--insight-bg-gradient);
    --bg-card: var(--insight-card);
    --text-primary: var(--insight-text-primary);
    --text-secondary: var(--insight-text-secondary);
    --border: var(--insight-border);
    --shadow: var(--insight-shadow);
    --shadow-hover: var(--insight-shadow-hover);
    
    /* Transitions */
    --transition-fast: 0.2s ease-in-out;
    --transition-base: 0.3s ease-in-out;
    --transition-slow: 0.5s ease-in-out;
  }

  [data-theme="dark"] {
    --bg-primary: #1A202C;
    --bg-gradient: linear-gradient(to bottom, #1A202C 0%, #2D3748 100%);
    --bg-card: rgba(26, 32, 44, 0.8);
    --text-primary: #E2E8F0;
    --text-secondary: #A0AEC0;
    --border: rgba(255, 255, 255, 0.1);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
  }

  [data-contrast="high"] {
    --insight-navy: #000000;
    --insight-blue: #0056B3;
    --text-primary: #000000;
    --bg-card: #FFFFFF;
  }

  [data-theme="dark"][data-contrast="high"] {
    --text-primary: #FFFFFF;
    --bg-card: #000000;
  }

  /* Base Styles */
  * {
    box-sizing: border-box;
  }

  body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    transition: background var(--transition-base), color var(--transition-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  /* 80% matches a browser zoom-out. zoom does not make position:fixed relative to html
     the way transform:scale did, so the receipt dialog stays above the gray backdrop. */
  html {
    overflow-x: hidden;
  }
  @media (min-width: 768px) {
    html {
      zoom: 0.8;
    }
  }
  .modal-backdrop {
    z-index: 1050;
  }
  .modal {
    z-index: 1055;
  }

  /* Glassmorphism Components */
  .glass-panel {
    background: var(--bg-card);
    backdrop-filter: var(--insight-glass-blur);
    -webkit-backdrop-filter: var(--insight-glass-blur);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    transition: all var(--transition-base);
  }

  .glass-panel:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
  }

  /* Control Panel (Theme, Contrast, Accessibility) */
  .control-panel {
    position: fixed;
    top: 5rem;
    right: 1.5rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .control-btn {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: var(--bg-card);
    backdrop-filter: var(--insight-glass-blur);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow);
    color: var(--text-primary);
    font-size: 1.125rem;
  }

  .control-btn:hover {
    transform: scale(1.1) rotate(180deg);
    box-shadow: var(--shadow-hover);
    background: var(--insight-gradient);
    color: var(--insight-text-white);
  }

  /* Page Headers */
  .page-header {
    background: var(--bg-card);
    backdrop-filter: var(--insight-glass-blur);
    border: 1px solid var(--border);
    border-left: 4px solid var(--insight-navy);
    padding: 2rem;
    margin-bottom: 2rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
  }

  .page-header::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(58, 109, 158, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(30%, -30%);
  }

  .page-header h1 {
    font-weight: 800;
    font-size: 2rem;
    margin: 0;
    color: var(--insight-navy);
    position: relative;
    z-index: 1;
  }

  [data-theme="dark"] .page-header h1 {
    color: var(--insight-text-white);
  }

  /* Forms */
  .form-label {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--insight-navy);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  [data-theme="dark"] .form-label {
    color: var(--insight-text-white);
  }

  .form-control,
  .form-select {
    background: var(--bg-card);
    backdrop-filter: var(--insight-glass-blur);
    border: 1px solid #CBD5E0;
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    transition: all var(--transition-base);
  }

  .form-control:focus,
  .form-select:focus {
    background: rgba(58, 109, 158, 0.05);
    border-color: var(--insight-blue);
    box-shadow: 0 0 0 3px rgba(58, 109, 158, 0.3);
    outline: none;
    transform: scale(1.02);
  }

  /* Buttons */
  .btn {
    border-radius: 0.75rem;
    font-weight: 700;
    padding: 0.75rem 1.5rem;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    border: none;
  }

  .btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
  }

  .btn:active::before {
    width: 300px;
    height: 300px;
  }

  .btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: var(--shadow-hover);
  }

  .btn-primary {
    background: var(--insight-gradient);
    color: var(--insight-text-white);
  }

  .btn-primary:hover {
    background: linear-gradient(135deg, #3A6D9E 0%, #0056B3 100%);
  }

  .btn-outline-primary {
    border: 2px solid var(--insight-navy);
    color: var(--insight-navy);
    background: transparent;
  }

  .btn-outline-primary:hover {
    background: var(--insight-navy);
    color: var(--insight-text-white);
  }

  /* Tables */
  .table-modern {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
  }

  .table-modern thead {
    background: var(--insight-navy);
    border-bottom: 2px solid var(--insight-blue);
  }

  .table-modern thead th {
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--insight-text-white);
    padding: 1rem;
    text-align: left;
  }

  .table-modern tbody tr {
    border-bottom: 1px solid var(--border);
    transition: all var(--transition-base);
    background: var(--bg-primary);
  }

  .table-modern tbody tr:nth-child(even) {
    background: var(--bg-card);
  }

  .table-modern tbody tr:hover {
    background: rgba(58, 109, 158, 0.1);
    transform: scale(1.01);
  }

  .table-modern tbody td {
    padding: 1rem;
    color: var(--text-secondary);
  }

  /* Voice Input Button */
  .input-with-voice {
    position: relative;
  }

  .voice-input-btn {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: var(--insight-gradient);
    border: none;
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-base);
    color: white;
    z-index: 10;
  }

  .voice-input-btn:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 16px rgba(0, 31, 63, 0.3);
  }

  .voice-input-btn.recording {
    animation: pulse 1.5s ease-in-out infinite;
    background: var(--insight-error);
  }

  @keyframes pulse {
    0%, 100% { opacity: 1; transform: translateY(-50%) scale(1); }
    50% { opacity: 0.7; transform: translateY(-50%) scale(1.1); }
  }

  /* Animations */
  @keyframes fadeInUp {
    from {
      opacity: 0;
      transform: translateY(20px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .fade-in-up {
    animation: fadeInUp 0.6s ease-out;
  }

  /* ============================================
     MOBILE RESPONSIVE DESIGN - Centralized
     Ensures all Insight pages work on mobile
     without affecting desktop presentation
  ============================================ */
  
  /* Mobile Devices (phones) - max-width: 767px */
  @media (max-width: 767px) {
    /* Disable global scale on mobile - breaks viewport */
    html {
      transform: none !important;
      width: 100% !important;
      height: 100% !important;
    }

    body {
      width: 100vw !important;
      min-height: 100vh !important;
      overflow-x: hidden !important;
    }

    /* Control Panel - Smaller, below header to avoid overlap with top buttons */
    .control-panel {
      flex-direction: row;
      top: 4.5rem;
      right: 1rem;
      gap: 0.75rem;
      z-index: 1050;
    }

    .control-btn {
      width: 2.5rem;
      height: 2.5rem;
      font-size: 0.875rem;
      padding: 0;
    }

    /* Page Headers - Reduced padding and font size */
    .page-header,
    .page-header-enhanced {
      padding: 1rem !important;
      margin-bottom: 1rem !important;
    }

    .page-header h1,
    .page-header-enhanced h1 {
      font-size: 1.25rem !important;
      line-height: 1.3;
    }

    .page-header p,
    .page-header-enhanced p {
      font-size: 0.75rem !important;
    }

    /* Containers - Full width, reduced padding */
    .container,
    .container-fluid {
      padding-left: 0.75rem !important;
      padding-right: 0.75rem !important;
      padding-top: 0.75rem !important;
      width: 100% !important;
      max-width: 100% !important;
    }

    .content > .container,
    .content > .container-fluid,
    .content.amdtc-adjust > .container-fluid {
      padding-left: 0.75rem !important;
      padding-right: 0.75rem !important;
      padding-top: 0.75rem !important;
    }

    /* Buttons - Larger touch targets, stack vertically when needed */
    .btn {
      min-height: 44px;
      padding: 0.75rem 1rem;
      font-size: 0.875rem;
      width: 100%;
      margin-bottom: 0.5rem;
    }

    .btn-group,
    .d-flex.gap-2 {
      flex-direction: column;
      width: 100%;
    }

    .btn-group .btn,
    .d-flex.gap-2 .btn {
      margin-right: 0 !important;
      margin-bottom: 0.5rem;
    }

    /* Forms - Full width, proper spacing */
    .form-card,
    .form-card-enhanced,
    .filter-form {
      padding: 1rem !important;
      margin-bottom: 1rem !important;
    }

    .form-label {
      font-size: 0.75rem;
      margin-bottom: 0.5rem;
    }

    .form-control,
    .form-select,
    input[type="text"],
    input[type="date"],
    input[type="number"],
    select {
      min-height: 44px;
      font-size: 16px !important; /* Prevents zoom on iOS */
      padding: 0.75rem;
      width: 100%;
    }

    .input-group {
      flex-direction: column;
    }

    .input-group-text {
      width: 100%;
      text-align: left;
      border-radius: 0.5rem 0.5rem 0 0;
    }

    .input-group .form-control {
      border-radius: 0 0 0.5rem 0.5rem;
    }

    /* Tables - Horizontal scroll wrapper */
    .table-responsive,
    .table-container {
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      width: 100%;
      display: block;
    }

    .table-modern,
    .table-modern-enhanced,
    table {
      font-size: 0.75rem;
      min-width: 600px; /* Forces horizontal scroll on small screens */
    }

    .table-modern thead th,
    .table-modern-enhanced thead th,
    table thead th {
      padding: 0.75rem 0.5rem;
      font-size: 0.7rem;
      white-space: nowrap;
    }

    .table-modern tbody td,
    .table-modern-enhanced tbody td,
    table tbody td {
      padding: 0.75rem 0.5rem;
      white-space: nowrap;
    }

    /* Cards and Panels */
    .glass-panel,
    .visitors-card,
    .stat-card,
    .results-card,
    .results-card-enhanced {
      padding: 1rem !important;
      margin-bottom: 1rem !important;
    }

    /* Stat Cards - Stack vertically */
    .row.g-4 > div,
    .row.g-4 [class*="col-"] {
      margin-bottom: 1rem;
    }

    .stat-card-value {
      font-size: 1.75rem !important;
    }

    /* Navigation/Sidebar adjustments */
    .sidebar {
      transform: translateX(-100%);
      position: fixed;
      z-index: 1000;
      transition: transform 0.3s ease;
    }

    .content {
      margin-left: 0 !important;
      width: 100% !important;
      padding: 0 !important;
    }

    /* Tab Navigation - Scrollable */
    .recent-activity-tabs,
    .activity-tabs {
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      flex-wrap: nowrap;
      white-space: nowrap;
      padding-bottom: 0.5rem;
    }

    .activity-tab {
      min-width: auto;
      white-space: nowrap;
      padding: 0.5rem 0.75rem;
      font-size: 0.75rem;
    }

    /* Grid layouts - Single column */
    .row {
      margin-left: -0.375rem;
      margin-right: -0.375rem;
    }

    .row > [class*="col-"] {
      padding-left: 0.375rem;
      padding-right: 0.375rem;
      width: 100%;
      margin-bottom: 1rem;
    }

    /* Hide decorative elements on mobile */
    .page-header::before,
    .page-header-enhanced::before {
      display: none;
    }

    /* Badge adjustments */
    .badge {
      font-size: 0.7rem;
      padding: 0.25rem 0.5rem;
    }

    /* Utility classes for mobile */
    .d-flex {
      flex-wrap: wrap;
    }

    .text-end,
    .text-right {
      text-align: left !important;
    }
  }

  /* Tablet Devices - 768px to 991px */
  @media (min-width: 768px) and (max-width: 991px) {
    /* Control Panel - positioned below header to avoid overlap */
    .control-panel {
      top: 5rem;
      right: 1.25rem;
      gap: 0.85rem;
    }

    .page-header,
    .page-header-enhanced {
      padding: 1.5rem;
    }

    .page-header h1,
    .page-header-enhanced h1 {
      font-size: 1.75rem;
    }

    /* Forms - 2 column layout possible */
    .form-card,
    .form-card-enhanced {
      padding: 1.5rem;
    }

    /* Buttons - Better spacing */
    .btn {
      min-height: 44px;
    }
  }

  /* Print Styles */
  @media print {
    html {
      transform: none !important;
      width: 100% !important;
      height: 100% !important;
    }
    body {
      width: 100% !important;
      min-height: 100vh !important;
      background: white;
      color: black;
    }

    .glass-panel,
    .page-header {
      background: white;
      backdrop-filter: none;
      border: 1px solid #000;
      box-shadow: none;
    }

    .control-panel,
    .btn,
    .voice-input-btn {
      display: none;
    }

    .table-modern thead {
      background: #001F3F !important;
      color: white !important;
    }

    .table-modern tbody tr {
      border-bottom: 1px solid #000;
    }
  }

  /* Accessibility */
  [data-contrast="high"] .glass-panel {
    background: var(--bg-card);
    border: 2px solid var(--insight-navy);
  }

  .btn:focus,
  .form-control:focus,
  .form-select:focus {
    outline: 3px solid var(--insight-blue);
    outline-offset: 2px;
  }

  /* ============================================
     VISITOR MANAGEMENT SHARED COMPONENTS
  ============================================ */

  /* Disable global scale on iPad portrait to fix viewport issues */
  @media (max-width: 1024px) {
    html {
      transform: none !important;
      width: 100% !important;
      height: auto !important;
    }
    body {
      width: 100% !important;
      min-height: 100vh !important;
    }
  }

  /* ─── Toast Container ─── */
  #vms-toast-container {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
    max-width: 380px;
    width: calc(100% - 2rem);
  }
  @media (max-width: 430px) {
    #vms-toast-container {
      top: auto;
      bottom: 1rem;
      right: 0.75rem;
      left: 0.75rem;
      max-width: 100%;
      width: auto;
    }
  }
  .vms-toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.22,1,0.36,1), opacity 0.35s ease;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  .vms-toast--visible { transform: translateX(0); opacity: 1; }
  .vms-toast--exit { transform: translateX(120%); opacity: 0; }
  @media (max-width: 430px) {
    .vms-toast { transform: translateY(100%); }
    .vms-toast--visible { transform: translateY(0); }
    .vms-toast--exit { transform: translateY(100%); }
  }
  .vms-toast__icon { font-size: 1.25rem; flex-shrink: 0; }
  .vms-toast__msg { flex: 1; line-height: 1.35; }
  .vms-toast__close {
    background: none; border: none; font-size: 1.125rem; cursor: pointer;
    opacity: 0.5; padding: 0; line-height: 1; color: inherit;
  }
  .vms-toast__close:hover { opacity: 1; }
  .vms-toast--success { border-left: 4px solid var(--insight-success, #38A169); }
  .vms-toast--success .vms-toast__icon { color: var(--insight-success, #38A169); }
  .vms-toast--error { border-left: 4px solid var(--insight-error, #E53E3E); }
  .vms-toast--error .vms-toast__icon { color: var(--insight-error, #E53E3E); }
  .vms-toast--info { border-left: 4px solid var(--insight-blue, #3A6D9E); }
  .vms-toast--info .vms-toast__icon { color: var(--insight-blue, #3A6D9E); }
  .vms-toast--warning { border-left: 4px solid var(--insight-warning, #FFD700); }
  .vms-toast--warning .vms-toast__icon { color: var(--insight-warning, #FFD700); }

  /* ─── Confirm Modal ─── */
  .vms-confirm-overlay {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.25s ease;
  }
  .vms-confirm--visible { opacity: 1; pointer-events: auto; }
  .vms-confirm-box {
    background: var(--bg-card, #fff);
    border: 1px solid var(--border);
    border-radius: 1rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    padding: 1.75rem;
    max-width: 420px;
    width: calc(100% - 2rem);
    transform: scale(0.92);
    transition: transform 0.3s cubic-bezier(0.22,1,0.36,1);
  }
  .vms-confirm--visible .vms-confirm-box { transform: scale(1); }
  .vms-confirm-box--exit { transform: scale(0.92) !important; }
  .vms-confirm-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
  .vms-confirm-icon { font-size: 1.5rem; color: var(--insight-blue); }
  .vms-confirm-title { font-size: 1.125rem; font-weight: 800; margin: 0; color: var(--text-primary); }
  .vms-confirm-body { font-size: 0.9375rem; color: var(--text-secondary); margin: 0 0 1.5rem; line-height: 1.5; }
  .vms-confirm-actions { display: flex; gap: 0.75rem; justify-content: flex-end; }
  .vms-confirm-cancel {
    padding: 0.625rem 1.25rem; border-radius: 0.625rem; font-weight: 700;
    background: transparent; border: 1px solid var(--border); color: var(--text-secondary);
    cursor: pointer; font-size: 0.875rem; transition: all 0.2s ease;
  }
  .vms-confirm-cancel:hover { background: var(--border); }
  .vms-confirm-ok, [class*="vms-confirm-btn--"] {
    padding: 0.625rem 1.25rem; border-radius: 0.625rem; font-weight: 700;
    border: none; color: #fff; cursor: pointer; font-size: 0.875rem; transition: all 0.2s ease;
  }
  .vms-confirm-btn--primary { background: var(--insight-gradient, linear-gradient(135deg,#001F3F,#3A6D9E)); }
  .vms-confirm-btn--danger { background: #B91C1C; }
  .vms-confirm-btn--danger:hover { background: #991B1B; }
  .vms-confirm-btn--warning { background: #D97706; }

  /* ─── Top Progress Bar ─── */
  .vms-progress-bar {
    position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 10001;
    background: transparent; display: none;
  }
  .vms-progress--active::after {
    content: '';
    position: absolute; top: 0; left: 0; height: 100%;
    background: var(--insight-gradient, linear-gradient(90deg,#001F3F,#3A6D9E));
    animation: vmsProgress 1.8s ease-in-out infinite;
  }
  .vms-progress--done::after {
    width: 100%;
    transition: width 0.2s ease;
  }
  @keyframes vmsProgress {
    0% { left: -30%; width: 30%; }
    50% { left: 40%; width: 40%; }
    100% { left: 100%; width: 30%; }
  }

  /* ─── Pull to Refresh ─── */
  .vms-ptr-indicator {
    position: fixed; top: 0; left: 50%; z-index: 9998;
    transform: translate(-50%, -60px);
    width: 42px; height: 42px; border-radius: 50%;
    background: var(--bg-card, #fff);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem; color: var(--insight-blue);
    opacity: 0; transition: transform 0.2s ease, opacity 0.2s ease;
  }
  .vms-ptr--ready { color: var(--insight-success); }
  .vms-ptr--refreshing i { animation: spin 0.8s linear infinite; }
  @keyframes spin { to { transform: rotate(360deg); } }

  /* ─── Time-on-site Colors ─── */
  .tos-green { color: var(--insight-success, #38A169); }
  .tos-amber { color: #D97706; }
  .tos-red { color: var(--insight-error, #E53E3E); font-weight: 800; }

  /* ─── Skeleton Loading ─── */
  .vms-skeleton {
    background: linear-gradient(90deg, var(--border) 25%, transparent 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: vmsShimmer 1.5s ease-in-out infinite;
    border-radius: 0.5rem;
    min-height: 1rem;
  }
  @keyframes vmsShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
  }

  /* ─── Floating Action Button ─── */
  .vms-fab {
    position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 1000;
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--insight-gradient); color: #fff; border: none;
    box-shadow: 0 6px 20px rgba(0,31,63,0.35);
    display: none; align-items: center; justify-content: center;
    font-size: 1.5rem; cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.22,1,0.36,1), box-shadow 0.3s ease;
    -webkit-tap-highlight-color: transparent;
  }
  .vms-fab:active { transform: scale(0.92); }
  @media (max-width: 1024px) {
    .vms-fab { display: flex; }
  }
  .vms-fab-menu {
    position: fixed; bottom: 6rem; right: 1.5rem; z-index: 999;
    display: flex; flex-direction: column-reverse; gap: 0.625rem;
    opacity: 0; pointer-events: none; transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.22,1,0.36,1);
  }
  .vms-fab-menu--open { opacity: 1; pointer-events: auto; transform: translateY(0); }
  .vms-fab-item {
    display: flex; align-items: center; gap: 0.5rem;
    text-decoration: none; white-space: nowrap;
  }
  .vms-fab-item-label {
    background: var(--bg-card, #fff); color: var(--text-primary);
    padding: 0.5rem 0.875rem; border-radius: 0.5rem; font-size: 0.8125rem;
    font-weight: 700; box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    border: 1px solid var(--border);
  }
  .vms-fab-item-btn {
    width: 42px; height: 42px; border-radius: 50%;
    background: var(--insight-gradient); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; border: none; box-shadow: 0 4px 12px rgba(0,31,63,0.25);
    flex-shrink: 0;
  }

  /* ─── Mobile/Tablet Card Layout for Visitors ─── */
  .vms-card-list { display: none; flex-direction: column; gap: 0.75rem; }
  @media (max-width: 1024px) {
    .vms-card-list { display: flex; }
    .vms-table-wrap { display: none !important; }
  }
  @media (min-width: 600px) and (max-width: 1024px) {
    .vms-card-list {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 0.75rem;
    }
  }
  .vms-visitor-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 0.875rem; padding: 1rem; position: relative;
    overflow: hidden; cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    -webkit-tap-highlight-color: transparent;
  }
  .vms-visitor-card:active { transform: scale(0.98); }
  .vms-visitor-card__top { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
  .vms-visitor-card__name { font-weight: 800; font-size: 1rem; flex: 1; color: var(--text-primary); }
  .vms-visitor-card__time { font-weight: 700; font-size: 0.8125rem; }
  .vms-visitor-card__mid { display: flex; flex-wrap: wrap; gap: 0.375rem; margin-bottom: 0.5rem; }
  .vms-visitor-card__bottom {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 0.8125rem; color: var(--text-secondary);
  }
  .vms-visitor-card__container { font-weight: 700; color: var(--insight-navy); font-variant-numeric: tabular-nums; }
  .vms-swipe-action {
    position: absolute; right: 0; top: 0; bottom: 0; width: 80px;
    background: #B91C1C; color: #fff; display: flex; align-items: center;
    justify-content: center; font-weight: 700; font-size: 0.75rem;
    opacity: 0; border-radius: 0 0.875rem 0.875rem 0;
  }

  /* ─── Mobile Bottom Action Bar ─── */
  .vms-bottom-bar {
    display: none; position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--bg-card, #fff);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
    z-index: 1001; gap: 0.5rem;
  }
  @media (max-width: 1024px) {
    .vms-bottom-bar { display: flex; }
    body { padding-bottom: 5rem; }
  }
  .vms-bottom-bar .btn { flex: 1; margin-bottom: 0; }

  /* ─── Step Wizard (Mobile New Visit) ─── */
  .vms-wizard { display: none; }
  @media (max-width: 1024px) {
    .vms-wizard { display: block; }
    .vms-wizard-desktop { display: none !important; }
  }
  .vms-wizard-progress {
    display: flex; gap: 0.25rem; margin-bottom: 1.25rem; padding: 0 0.25rem;
  }
  .vms-wizard-step-bar {
    flex: 1; height: 4px; border-radius: 2px;
    background: var(--border); transition: background 0.3s ease;
  }
  .vms-wizard-step-bar.active { background: var(--insight-gradient); }
  .vms-wizard-step-bar.done { background: var(--insight-success); }
  .vms-wizard-panel {
    display: none; animation: fadeInUp 0.35s ease-out;
  }
  .vms-wizard-panel.active { display: block; }
  .vms-wizard-nav {
    display: flex; gap: 0.75rem; margin-top: 1.5rem;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .vms-wizard-nav .btn { flex: 1; }

  /* ─── CTPAT Photo Grid (enhanced) ─── */
  .vms-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
  }
  @media (max-width: 430px) {
    .vms-photo-grid { grid-template-columns: repeat(2, 1fr); }
  }
  .vms-photo-slot {
    aspect-ratio: 4/3; border: 2px dashed var(--border);
    border-radius: 0.75rem; display: flex; flex-direction: column;
    align-items: center; justify-content: center; cursor: pointer;
    position: relative; overflow: hidden; background: var(--bg-card);
    transition: border-color 0.2s ease, background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
  }
  .vms-photo-slot:active { background: rgba(58,109,158,0.05); }
  .vms-photo-slot.required { border-color: rgba(185,28,28,0.4); }
  .vms-photo-slot.captured { border-style: solid; border-color: var(--insight-success); }
  .vms-photo-slot.captured::after {
    content: '\2713'; position: absolute; top: 0.375rem; right: 0.375rem;
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--insight-success); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 800;
  }
  .vms-photo-slot img {
    position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
    border-radius: 0.625rem;
  }
  .vms-photo-slot__label {
    font-size: 0.6875rem; font-weight: 700; text-align: center;
    color: var(--text-secondary); margin-top: 0.25rem; padding: 0 0.25rem;
  }
  .vms-photo-slot__icon { font-size: 1.5rem; color: var(--insight-blue); opacity: 0.5; }

  /* ─── Swipeable Gallery ─── */
  .vms-gallery-scroll {
    display: flex; gap: 0.75rem; overflow-x: auto;
    scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
    padding: 0.25rem 0 1rem;
    scrollbar-width: none;
  }
  .vms-gallery-scroll::-webkit-scrollbar { display: none; }
  .vms-gallery-scroll .vms-gallery-item {
    flex: 0 0 auto; width: 200px; scroll-snap-align: start;
    border-radius: 0.75rem; overflow: hidden; cursor: pointer;
    border: 2px solid var(--border); transition: border-color 0.2s ease;
  }
  @media (max-width: 430px) {
    .vms-gallery-scroll .vms-gallery-item { width: 160px; }
  }
  .vms-gallery-scroll .vms-gallery-item img {
    width: 100%; height: 140px; object-fit: cover; display: block;
  }

  /* ─── iPhone Safe Area ─── */
  @supports (padding: env(safe-area-inset-bottom)) {
    .vms-bottom-bar { padding-bottom: calc(0.75rem + env(safe-area-inset-bottom)); }
    .vms-fab { bottom: calc(1.5rem + env(safe-area-inset-bottom)); }
    .vms-fab-menu { bottom: calc(6rem + env(safe-area-inset-bottom)); }
  }
