
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    body {
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      min-height: 100vh;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 20px;
    }

    .container {
      width: 100%;
      max-width: 1200px;
    }

    /* Login Form */
    .login-card {
      background: white;
      border-radius: 12px;
      box-shadow: 0 10px 40px rgba(0,0,0,0.2);
      padding: 40px;
      max-width: 400px;
      margin: 0 auto;
    }

    .login-card h1 {
      text-align: center;
      color: #333;
      margin-bottom: 10px;
      font-size: 28px;
    }

    .login-card .subtitle {
      text-align: center;
      color: #666;
      margin-bottom: 30px;
      font-size: 14px;
    }

    .form-group {
      margin-bottom: 20px;
    }

    .form-group label {
      display: block;
      margin-bottom: 8px;
      color: #333;
      font-weight: 500;
      font-size: 14px;
    }

    .form-group input {
      width: 100%;
      padding: 12px 16px;
      border: 2px solid #e0e0e0;
      border-radius: 8px;
      font-size: 14px;
      transition: border-color 0.3s;
    }

    .form-group input:focus {
      outline: none;
      border-color: #667eea;
    }

    .btn {
      padding: 12px 24px;
      border: none;
      border-radius: 8px;
      font-size: 14px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.3s;
      display: inline-flex;
      align-items: center;
      gap: 8px;
    }

    .btn-primary {
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      color: white;
      justify-content: center;
    }

    .btn-primary:hover {
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    }

    .btn-secondary {
      background: white;
      color: #667eea;
      border: 2px solid #667eea;
    }

    .btn-secondary:hover {
      background: #f5f7ff;
    }

    .btn-danger {
      background: #ef4444;
      color: white;
    }

    .btn-danger:hover {
      background: #dc2626;
    }

    /* Modal and form action buttons container */
    .modal-actions,
    .form-actions {
      display: flex;
      gap: 12px;
      margin-top: 24px;
      padding-top: 20px;
      border-top: 2px solid #e5e7eb;
    }

    /* Full-width buttons in action containers */
    .modal-actions > .btn,
    .form-actions > .btn {
      flex: 1;
    }

    .error-message {
      background: #fee;
      color: #c33;
      padding: 12px;
      border-radius: 8px;
      margin-bottom: 20px;
      font-size: 14px;
      display: none;
    }

    .error-message.show {
      display: block;
    }

    /* Admin Console */
    .admin-console {
      background: white;
      border-radius: 12px;
      box-shadow: 0 10px 40px rgba(0,0,0,0.2);
      overflow: hidden;
      display: none;
      flex-direction: column;
    }

    .admin-console.show {
      display: flex;
    }

    .admin-header {
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      color: white;
      padding: 24px 32px;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .admin-header h1 {
      font-size: 24px;
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .user-info {
      display: flex;
      align-items: center;
      gap: 16px;
    }

    .user-badge {
      background: rgba(255,255,255,0.2);
      padding: 6px 12px;
      border-radius: 20px;
      font-size: 13px;
      font-weight: 600;
    }

    .user-badge.superadmin {
      background: #fbbf24;
      color: #78350f;
    }

    .user-badge.admin {
      background: #60a5fa;
      color: #1e3a8a;
    }

    /* Main Content Wrapper: Sidebar + Body */
    .admin-main {
      display: flex;
      flex: 1;
      overflow: hidden;
    }

    /* Sidebar Navigation (Desktop only) */
    .admin-sidebar {
      width: 250px;
      background: #f9fafb;
      border-right: 1px solid #e5e7eb;
      display: flex;
      flex-direction: column;
      transition: width 0.3s ease;
      overflow: hidden;
      flex-shrink: 0;
    }

    .admin-sidebar.collapsed {
      width: 70px;
    }

    .sidebar-toggle {
      padding: 16px;
      background: none;
      border: none;
      border-bottom: 1px solid #e5e7eb;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      color: #6b7280;
      transition: all 0.3s;
    }

    .sidebar-toggle:hover {
      background: #f3f4f6;
      color: #667eea;
    }

    .sidebar-toggle .material-icons {
      font-size: 24px;
    }

    .sidebar-nav {
      display: flex;
      flex-direction: column;
      padding: 8px 0;
      overflow-y: auto;
    }

    .sidebar-item {
      display: flex;
      align-items: center;
      gap: 16px;
      padding: 14px 20px;
      background: none;
      border: none;
      border-left: 3px solid transparent;
      color: #6b7280;
      font-size: 15px;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.2s;
      text-align: left;
      white-space: nowrap;
    }

    .sidebar-item:hover {
      background: #f3f4f6;
      color: #667eea;
    }

    .sidebar-item.active {
      background: #eff6ff;
      border-left-color: #667eea;
      color: #667eea;
    }

    .sidebar-item .material-icons {
      font-size: 22px;
      flex-shrink: 0;
    }

    .sidebar-label {
      transition: opacity 0.3s ease;
    }

    .admin-sidebar.collapsed .sidebar-label {
      opacity: 0;
      width: 0;
      overflow: hidden;
    }

    .admin-sidebar.collapsed .sidebar-item {
      padding: 14px;
      justify-content: center;
    }

    /* RTL support for sidebar */
    [dir="rtl"] .admin-sidebar {
      border-right: none;
      border-left: 1px solid #e5e7eb;
    }

    [dir="rtl"] .sidebar-nav {
      direction: rtl;
    }

    [dir="rtl"] .sidebar-item {
      flex-direction: row-reverse;
      text-align: right;
      border-left: none;
      border-right: 3px solid transparent;
    }

    [dir="rtl"] .sidebar-item.active {
      border-right-color: #667eea;
    }

    .admin-body {
      flex: 1;
      padding: 32px;
      overflow-y: auto;
    }

    .permission-notice {
      background: #eff6ff;
      border-left: 4px solid #3b82f6;
      padding: 16px;
      margin-bottom: 24px;
      border-radius: 4px;
    }

    .permission-notice h3 {
      color: #1e40af;
      margin-bottom: 8px;
      font-size: 16px;
    }

    .permission-notice p {
      color: #1e40af;
      font-size: 14px;
    }

    .dev-banner {
      background: #fef3c7;
      border: 2px solid #f59e0b;
      border-radius: 8px;
      padding: 16px;
      margin-bottom: 20px;
      display: none;
    }

    .dev-banner.visible {
      display: block;
    }

    .dev-banner h4 {
      color: #92400e;
      margin-bottom: 8px;
      font-size: 14px;
      font-weight: 600;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .dev-banner p {
      color: #78350f;
      font-size: 13px;
      margin: 4px 0;
    }

    .dev-banner code {
      background: #fde68a;
      padding: 2px 6px;
      border-radius: 4px;
      font-size: 12px;
      font-family: monospace;
    }

    /* Old horizontal tabs - hidden, replaced by sidebar */
    .tabs {
      display: none;
    }

    .tab {
      display: none;
    }

    .tab-content {
      display: none;
    }

    .tab-content.active {
      display: block;
    }

    /* Filter tabs for products */
    .filter-tabs {
      display: flex;
      gap: 8px;
      margin-bottom: 20px;
    }

    .filter-tab {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 8px 16px;
      background: #f3f4f6;
      border: 2px solid #e5e7eb;
      border-radius: 8px;
      color: #6b7280;
      font-size: 14px;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.2s;
    }

    .filter-tab:hover {
      background: #e5e7eb;
      border-color: #d1d5db;
      color: #374151;
    }

    .filter-tab.active {
      background: #667eea;
      border-color: #667eea;
      color: white;
      box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    }

    .filter-tab.active:hover {
      background: #5a67d8;
      border-color: #5a67d8;
    }

    .section-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 20px;
    }

    .section-header h2 {
      font-size: 20px;
      color: #333;
    }

    .restaurant-selector {
      margin-bottom: 24px;
      padding: 16px;
      background: #f9fafb;
      border-radius: 8px;
    }

    .restaurant-selector label {
      display: block;
      margin-bottom: 8px;
      font-weight: 600;
      color: #333;
    }

    .restaurant-selector select {
      width: 100%;
      padding: 10px 16px;
      border: 2px solid #e5e7eb;
      border-radius: 8px;
      font-size: 14px;
      background: white;
    }

    .card {
      background: white;
      border: 1px solid #e5e7eb;
      border-radius: 8px;
      padding: 20px;
      margin-bottom: 16px;
    }

    .card h3 {
      font-size: 18px;
      color: #333;
      margin-bottom: 12px;
    }

    .card-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
      gap: 16px;
    }

    .stat-card {
      background: white;
      border: 2px solid #e5e7eb;
      border-radius: 8px;
      padding: 20px;
      text-align: center;
    }

    .stat-card .value {
      font-size: 32px;
      font-weight: 700;
      color: #667eea;
      margin-bottom: 8px;
    }

    .stat-card .label {
      color: #6b7280;
      font-size: 14px;
    }

    .stat-card .trend {
      margin-top: 8px;
      font-size: 13px;
      font-weight: 600;
    }

    .stat-card .trend.up {
      color: #10b981;
    }

    .stat-card .trend.down {
      color: #ef4444;
    }

    .stat-card .trend.neutral {
      color: #6b7280;
    }

    /* Recent Activity Styles */
    .activity-item {
      display: flex;
      align-items: flex-start;
      gap: 12px;
      padding: 12px;
      border-radius: 6px;
      margin-bottom: 8px;
      background: #f9fafb;
      transition: background 0.2s;
    }

    .activity-item:hover {
      background: #f3f4f6;
    }

    .activity-icon {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }

    .activity-icon.create {
      background: #dbeafe;
      color: #1d4ed8;
    }

    .activity-icon.update {
      background: #fef3c7;
      color: #d97706;
    }

    .activity-icon.delete {
      background: #fee2e2;
      color: #dc2626;
    }

    .activity-content {
      flex: 1;
    }

    .activity-title {
      font-size: 14px;
      color: #374151;
      margin-bottom: 4px;
    }

    .activity-meta {
      font-size: 12px;
      color: #9ca3af;
    }

    /* Alert Styles */
    .alert {
      padding: 16px;
      border-radius: 8px;
      margin-top: 24px;
      display: flex;
      align-items: flex-start;
      gap: 12px;
    }

    .alert-warning {
      background: #fef3c7;
      border-left: 4px solid #f59e0b;
    }

    .alert-info {
      background: #dbeafe;
      border-left: 4px solid #3b82f6;
    }

    .alert-success {
      background: #d1fae5;
      border-left: 4px solid #10b981;
    }

    .alert-icon {
      font-size: 24px;
    }

    .alert-content {
      flex: 1;
    }

    .alert-title {
      font-weight: 600;
      color: #374151;
      margin-bottom: 4px;
    }

    .alert-list {
      list-style: none;
      margin: 8px 0 0 0;
      padding: 0;
    }

    .alert-list li {
      padding: 4px 0;
      color: #6b7280;
      font-size: 14px;
    }

    table {
      width: 100%;
      border-collapse: collapse;
    }

    table th,
    table td {
      padding: 12px;
      text-align: left;
      border-bottom: 1px solid #e5e7eb;
    }

    table th {
      background: #f9fafb;
      font-weight: 600;
      color: #374151;
      font-size: 13px;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    table td {
      color: #6b7280;
    }

    table tr:hover {
      background: #f9fafb;
    }

    /* Sortable table headers */
    th.sortable {
      cursor: pointer;
      user-select: none;
      position: relative;
      padding-right: 24px;
      transition: background-color 0.2s, color 0.2s;
    }

    th.sortable:hover {
      background-color: #f5f5f5;
      color: #667eea;
    }

    th.sortable.active {
      color: #667eea;
      font-weight: 600;
    }

    /* Sort indicator */
    .sort-indicator {
      position: absolute;
      right: 8px;
      top: 50%;
      transform: translateY(-50%);
      font-size: 12px;
      color: #667eea;
    }

    th.sortable:hover .sort-indicator {
      opacity: 0.5;
    }

    th.sortable.active .sort-indicator {
      opacity: 1;
      font-weight: bold;
    }

    .badge {
      display: inline-block;
      padding: 4px 12px;
      border-radius: 12px;
      font-size: 12px;
      font-weight: 600;
    }

    .badge-success {
      background: #d1fae5;
      color: #065f46;
    }

    .badge-warning {
      background: #fef3c7;
      color: #78350f;
    }

    .badge-danger {
      background: #fee2e2;
      color: #991b1b;
    }

    .badge-info {
      background: #dbeafe;
      color: #1e40af;
    }

    .hidden {
      display: none !important;
    }

    .loading {
      text-align: center;
      padding: 40px;
      color: #6b7280;
    }

    .empty-state {
      text-align: center;
      padding: 60px 20px;
      color: #6b7280;
    }

    .empty-state .material-icons {
      font-size: 64px;
      color: #d1d5db;
      margin-bottom: 16px;
    }

    /* Enhanced Empty States */
    .empty-state-enhanced {
      text-align: center;
      padding: 80px 40px;
      max-width: 500px;
      margin: 0 auto;
    }

    .empty-state-icon {
      width: 120px;
      height: 120px;
      margin: 0 auto 24px;
      background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      animation: emptyStateFloat 3s ease-in-out infinite;
    }

    @keyframes emptyStateFloat {
      0%, 100% {
        transform: translateY(0px);
      }
      50% {
        transform: translateY(-10px);
      }
    }

    .empty-state-icon .material-icons {
      font-size: 64px;
      color: #9ca3af;
    }

    .empty-state-message {
      font-size: 16px;
      color: #6b7280;
      line-height: 1.6;
      margin-bottom: 24px;
    }

    .empty-state-enhanced .btn {
      margin-top: 8px;
    }

    .error-state {
      text-align: center;
      padding: 60px 20px;
      color: #dc2626;
    }

    .error-state .material-icons {
      font-size: 64px;
      color: #fee2e2;
      margin-bottom: 16px;
    }

    /* Audit Log */
    .audit-filters-grid {
      display: grid;
      gap: 16px;
      grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
      align-items: end;
    }

    .audit-filter {
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    .audit-filter span {
      font-weight: 600;
      color: #374151;
      font-size: 14px;
    }

    .audit-filter input,
    .audit-filter select {
      padding: 10px 12px;
      border: 2px solid #e5e7eb;
      border-radius: 8px;
      font-size: 14px;
      transition: border-color 0.2s ease, box-shadow 0.2s ease;
    }

    .audit-filter input:focus,
    .audit-filter select:focus {
      outline: none;
      border-color: #6366f1;
      box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    }

    .audit-summary {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
      margin-bottom: 12px;
      flex-wrap: wrap;
    }

    .audit-count {
      color: #111827;
      font-size: 16px;
    }

    .audit-pagination-info {
      color: #6b7280;
      font-size: 14px;
    }

    .audit-loading {
      display: flex;
      align-items: center;
      gap: 10px;
      color: #4b5563;
      font-size: 15px;
      padding: 18px 0;
    }

    .audit-loading.hidden {
      display: none !important;
    }

    .audit-empty {
      text-align: center;
      padding: 48px 16px;
      color: #6b7280;
    }

    .audit-empty.hidden {
      display: none !important;
    }

    .audit-empty .material-icons {
      font-size: 40px;
      display: block;
      margin: 0 auto 12px;
      color: #9ca3af;
    }

    .audit-pagination {
      display: flex;
      justify-content: center;
      align-items: center;
      gap: 12px;
      margin-top: 20px;
      flex-wrap: wrap;
    }

    .audit-pagination .btn[disabled] {
      opacity: 0.6;
      cursor: not-allowed;
    }

    .audit-page-status {
      font-size: 14px;
      color: #374151;
    }

    .table-wrapper {
      overflow-x: auto;
    }

    .audit-change-item {
      font-size: 13px;
      background: #f9fafb;
      border: 1px solid #e5e7eb;
      border-radius: 6px;
      padding: 6px 8px;
      margin-bottom: 4px;
    }

    .audit-resource-meta {
      margin-top: 2px;
      font-size: 12px;
      color: #6b7280;
    }

    .audit-badge {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 4px 8px;
      border-radius: 9999px;
      font-size: 12px;
      font-weight: 600;
      text-transform: capitalize;
    }

    .audit-badge.create {
      background: #ecfdf5;
      color: #047857;
    }

    .audit-badge.update {
      background: #eff6ff;
      color: #1d4ed8;
    }

    .audit-badge.delete {
      background: #fef2f2;
      color: #b91c1c;
    }

    .audit-badge.bulk {
      background: #f5f3ff;
      color: #6b21a8;
    }

    .material-icons.rotating {
      animation: audit-spin 1s linear infinite;
    }

    @keyframes audit-spin {
      from {
        transform: rotate(0deg);
      }
      to {
        transform: rotate(360deg);
      }
    }

    /* Skeleton Loading Screens */
    .skeleton-table {
      display: flex;
      flex-direction: column;
      gap: 12px;
      padding: 20px;
    }

    .skeleton-row {
      display: flex;
      gap: 12px;
      padding: 16px;
      background: #f9fafb;
      border-radius: 8px;
    }

    .skeleton-cell {
      height: 20px;
      background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
      background-size: 200% 100%;
      animation: shimmer 1.5s ease-in-out infinite;
      border-radius: 4px;
    }

    .skeleton-cards {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
      gap: 20px;
      padding: 20px;
    }

    .skeleton-card {
      background: #fff;
      border: 1px solid #e5e7eb;
      border-radius: 12px;
      padding: 16px;
      display: flex;
      flex-direction: column;
      gap: 12px;
    }

    .skeleton-image {
      width: 100%;
      height: 180px;
      background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
      background-size: 200% 100%;
      animation: shimmer 1.5s ease-in-out infinite;
      border-radius: 8px;
    }

    .skeleton-text {
      background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
      background-size: 200% 100%;
      animation: shimmer 1.5s ease-in-out infinite;
      border-radius: 4px;
      margin-bottom: 8px;
    }

    .skeleton-stats {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
      gap: 20px;
      padding: 20px;
    }

    .skeleton-stat-card {
      background: #fff;
      border: 1px solid #e5e7eb;
      border-radius: 12px;
      padding: 24px;
      display: flex;
      flex-direction: column;
      gap: 12px;
    }

    .skeleton-value {
      width: 60%;
      height: 32px;
      background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
      background-size: 200% 100%;
      animation: shimmer 1.5s ease-in-out infinite;
      border-radius: 6px;
    }

    .skeleton-label {
      width: 80%;
      height: 16px;
      background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
      background-size: 200% 100%;
      animation: shimmer 1.5s ease-in-out infinite;
      border-radius: 4px;
    }

    @keyframes shimmer {
      0% {
        background-position: -200% 0;
      }
      100% {
        background-position: 200% 0;
      }
    }

    /* Toast Notifications */
    .toast-container {
      position: fixed;
      top: 20px;
      right: 20px;
      z-index: 10000;
      display: flex;
      flex-direction: column;
      gap: 12px;
    }

    .toast {
      background: white;
      border-radius: 8px;
      padding: 16px 20px;
      box-shadow: 0 4px 12px rgba(0,0,0,0.15);
      display: flex;
      align-items: center;
      gap: 12px;
      min-width: 300px;
      max-width: 400px;
      animation: slideIn 0.3s ease-out;
    }

    @keyframes slideIn {
      from {
        transform: translateX(400px);
        opacity: 0;
      }
      to {
        transform: translateX(0);
        opacity: 1;
      }
    }

    .toast-success {
      border-left: 4px solid #10b981;
    }

    .toast-error {
      border-left: 4px solid #ef4444;
    }

    .toast-warning {
      border-left: 4px solid #f59e0b;
    }

    .toast .material-icons {
      font-size: 24px;
    }

    .toast-success .material-icons {
      color: #10b981;
    }

    .toast-error .material-icons {
      color: #ef4444;
    }

    .toast-warning .material-icons {
      color: #f59e0b;
    }

    .toast-content {
      flex: 1;
    }

    .toast-title {
      font-weight: 600;
      margin-bottom: 4px;
      color: #111827;
    }

    .toast-message {
      font-size: 14px;
      color: #6b7280;
    }

    /* Mobile-only utility class - hide on desktop by default */
    .mobile-only {
      display: none !important;
    }

    /* Responsive */
    @media (max-width: 768px) {
      /* Prevent horizontal scrolling */
      body, html {
        overflow-x: hidden !important;
        max-width: 100vw !important;
      }

      .admin-console, .container {
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
      }

      .admin-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
      }

      .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
      }

      .card-grid {
        grid-template-columns: 1fr;
      }

      table {
        font-size: 13px;
      }

      /* (Legacy Modals Removed - Replaced by .modal-backdrop mobile overrides) */

      /* Modal header - sticky at top (multiple selector patterns) */
      .modal-content-regular > .modal-header,
      .modal-content-regular > header,
      .modal-content-regular > h3:first-child,
      .modal-content-regular > h2:first-child,
      .modal-content-regular form > h3:first-child,
      .modal-content-regular form > h2:first-child {
        position: sticky !important;
        top: 0 !important;
        z-index: 10 !important;
        background: white !important;
        border-bottom: 1px solid #e5e7eb !important;
        padding: 16px 20px !important;
        margin: 0 !important;
        flex-shrink: 0 !important;
      }

      /* Modal body - scrollable content (improved selectors) */
      .modal-content-regular > .modal-body,
      .modal-content-regular > .form-sections,
      .modal-content-regular > form:not(.inline-edit-form),
      .modal-content-regular form:not(.inline-edit-form),
      .modal-content-regular > div:not(.modal-header):not(.modal-actions):not(header):not(footer):not(.modal-tabs):not(.modal-tab-content):not(.form-actions) {
        flex: 1 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding: 20px !important;
        -webkit-overflow-scrolling: touch !important;
        min-height: 0 !important;
      }

      /* Special handling for modals with tabbed content */
      .modal-content-regular > .modal-tabs,
      .modal-content-regular form > .modal-tabs {
        position: sticky !important;
        top: 0 !important;
        z-index: 9 !important;
        background: white !important;
        border-bottom: 1px solid #e5e7eb !important;
        margin: 0 !important;
        padding: 0 20px !important;
        flex-shrink: 0 !important;
      }

      .modal-content-regular > .modal-tab-content,
      .modal-content-regular form > .modal-tab-content {
        flex: 1 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding: 20px !important;
        -webkit-overflow-scrolling: touch !important;
        min-height: 0 !important;
      }

      /* Modal footer/actions - sticky at bottom (improved selectors) */
      .modal-content-regular > .modal-actions,
      .modal-content-regular > .form-actions,
      .modal-content-regular > footer,
      .modal-content-regular > .btn-group:last-child,
      .modal-content-regular form > .form-actions:last-child,
      .modal-content-regular form > div:last-child:has(button[type="submit"]),
      .modal-content-regular form > div:last-child:has(button.btn-primary) {
        position: sticky !important;
        bottom: 0 !important;
        z-index: 10 !important;
        background: white !important;
        border-top: 1px solid #e5e7eb !important;
        padding: 16px 20px !important;
        margin: 0 !important;
        flex-shrink: 0 !important;
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1) !important;
      }

      /* Ensure form children are properly structured */
      .modal-content-regular form {
        display: flex !important;
        flex-direction: column !important;
        height: 100% !important;
        overflow: hidden !important;
      }

      /* Make tab content scrollable within form */
      .modal-content-regular form .modal-tab-content {
        flex: 1 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        min-height: 0 !important;
      }

      /* Ensure fullscreen modal overlay also stretches and doesn't scroll */
      .modal-overlay-fullscreen {
        padding: 0 !important;
        align-items: stretch !important;
        overflow: hidden !important;
      }

      .user-edit-modal,
      .modal-overlay-fullscreen > div {
        width: 100% !important;
        max-width: 100vw !important;
        height: 100vh !important;
        max-height: 100vh !important;
        margin: 0 !important;
        border-radius: 0 !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
      }

      /* Ensure all form inputs fit within viewport */
      .modal-content-regular input,
      .modal-content-regular select,
      .modal-content-regular textarea,
      .modal-content-regular .form-group {
        max-width: 100% !important;
        box-sizing: border-box !important;
      }

      /* Prevent body scroll when modal is open on mobile */
      body.modal-open {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
        height: 100% !important;
      }

      /* NOTE: .modal-card styles moved to responsive media queries below:
         - Desktop (≥769px): Lines ~2330-2381
         - Mobile (≤768px): Lines ~2420-2469
         This ensures proper centered behavior on desktop and fullscreen on mobile.
      */
    }

    /* ============================================================================
       MOBILE RESPONSIVE STYLES
       ============================================================================ */
    
    @media (max-width: 768px) {
      /* Body and Container */
      body {
        padding: 10px;
        align-items: flex-start;
        padding-top: 20px;
      }
      
      .container {
        max-width: 100%;
      }
      
      /* Login Form Mobile */
      .login-card {
        padding: 24px 20px;
        margin: 0;
        border-radius: 8px;
      }
      
      .login-card h1 {
        font-size: 24px;
      }
      
      /* Admin Console Mobile */
      .admin-console {
        border-radius: 8px;
        margin: 0;
      }
      
      .admin-header {
        padding: 16px 20px;
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
      }
      
      .admin-header h1 {
        font-size: 20px;
        width: 100%;
        text-align: center;
      }
      
      .user-info {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 8px;
      }
      
      .user-info .user-badge {
        font-size: 12px;
        padding: 4px 8px;
      }
      
      .user-info button {
        font-size: 14px;
        padding: 8px 12px;
        min-height: 36px;
      }
      
      .admin-body {
        padding: 20px;
      }

      /* Hide Sidebar on Mobile */
      .admin-sidebar {
        display: none;
      }

      /* Tabs Mobile */
      .tabs {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        gap: 8px;
        margin-bottom: 20px;
        padding-bottom: 8px;
      }
      
      .tabs::-webkit-scrollbar {
        display: none;
      }
      
      .tab {
        padding: 12px 16px;
        font-size: 13px;
        flex-shrink: 0;
        white-space: nowrap;
        text-align: center;
        min-width: 80px;
        border-radius: 6px;
        background: #f8f9fa;
        border: 1px solid #e9ecef;
      }
      
      .tab.active {
        background: #667eea;
        color: white;
        border-color: #667eea;
      }
      
      /* Section Headers Mobile */
      .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
      }
      
      .section-header h2 {
        font-size: 18px;
      }
      
      /* Forms Mobile */
      .form-group {
        margin-bottom: 16px;
      }
      
      .form-group label {
        font-size: 14px;
        margin-bottom: 6px;
      }
      
      .form-group input,
      .form-group select,
      .form-group textarea {
        padding: 12px;
        font-size: 16px; /* Prevents zoom on iOS */
        border-radius: 6px;
      }
      
      /* Buttons Mobile */
      .btn {
        padding: 12px 16px;
        font-size: 14px;
        border-radius: 6px;
        min-height: 44px; /* Touch target size */
      }
      
      .btn-sm {
        padding: 8px 12px;
        font-size: 12px;
        min-height: 36px;
      }
      
      /* Tables Mobile - Responsive Card Layout */
      .table-container {
        overflow: visible;
        border-radius: 6px;
      }
      
      /* Hide table headers on mobile */
      table thead {
        display: none;
      }
      
      /* Convert table rows to cards on mobile */
      table tbody tr {
        display: block;
        margin-bottom: 16px;
        padding: 16px;
        background: white;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
      }
      
      /* Stack table cells vertically */
      table tbody td {
        display: block;
        padding: 8px 0;
        border: none;
        white-space: normal;
        word-wrap: break-word;
      }
      
      /* Add labels for each cell */
      table tbody td:before {
        content: attr(data-label) ": ";
        font-weight: 600;
        color: #374151;
        display: inline-block;
        min-width: 120px;
        margin-right: 8px;
      }
      
      /* Special handling for action buttons */
      table tbody td:last-child:before {
        content: "";
        display: none;
      }
      
      table tbody td:last-child {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
        justify-content: flex-start;
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid #e5e7eb;
      }
      
      /* Adjust button sizes for mobile */
      table tbody td:last-child .btn {
        font-size: 12px;
        padding: 6px 10px;
        min-height: 32px;
      }

      /* Bulk Actions Mobile */
      #bulkActionsToolbar {
        flex-direction: column !important;
        gap: 16px !important;
        padding: 16px !important;
        margin-bottom: 16px !important;
      }

      #bulkActionsToolbar > div:first-child {
        width: 100%;
        justify-content: center;
      }

      #bulkActionsToolbar > div:last-child {
        flex-direction: column !important;
        width: 100%;
        gap: 8px !important;
      }

      #bulkActionsToolbar .btn {
        width: 100% !important;
        justify-content: center !important;
        min-height: 48px !important;
        font-size: 15px !important;
        padding: 12px 16px !important;
      }

      #bulkActionsToolbar .material-icons {
        font-size: 20px !important;
      }

      /* Hide checkbox column label on mobile (first td with Select label) */
      table tbody td[data-label="Select"]:before {
        display: none !important;
      }

      /* Fixed checkbox positioning - top-left with 28px size */
      table tbody td[data-label="Select"] {
        position: absolute;
        top: 12px;
        left: 12px;
        padding: 0 !important;
        margin: 0 !important;
        z-index: 5;
      }

      table tbody td[data-label="Select"] input[type="checkbox"] {
        width: 28px !important;
        height: 28px !important;
        cursor: pointer;
        accent-color: #667eea;
      }

      /* Adjust card padding for checkbox on left side */
      table tbody tr {
        position: relative;
        padding-left: 52px !important;
        padding-top: 8px !important;
      }

      /* Mobile-only utility - show on mobile */
      .mobile-only {
        display: block !important;
      }

      /* Collapsible Search Filters on Mobile */
      .search-filters-container {
        position: relative;
      }

      .search-filters-header {
        display: none;
      }

      .search-filters-content {
        display: block !important;
        max-height: none !important;
        overflow: visible !important;
      }

      @media (max-width: 768px) {
        .search-filters-header {
          display: flex;
          justify-content: space-between;
          align-items: center;
          padding: 12px 16px;
          background: white;
          border: 1px solid #e0e0e0;
          border-radius: 8px;
          margin-bottom: 12px;
          cursor: pointer;
          transition: background-color 0.2s;
        }

        .search-filters-header:hover {
          background: #f9fafb;
        }

        .search-filters-header-text {
          display: flex;
          align-items: center;
          gap: 8px;
          font-weight: 600;
          color: #374151;
          font-size: 15px;
        }

        .search-filters-header-icon {
          transition: transform 0.3s ease;
          color: #667eea;
        }

        .search-filters-header-icon.expanded {
          transform: rotate(180deg);
        }

        .search-filters-content {
          max-height: 0 !important;
          overflow: hidden !important;
          transition: max-height 0.3s ease, padding 0.3s ease, margin 0.3s ease, border 0.3s ease;
          padding: 0 20px !important;
          margin: 0 !important;
          background: white;
          border: 1px solid #e0e0e0;
          border-top: none;
          border-radius: 0 0 8px 8px;
        }

        .search-filters-content.expanded {
          max-height: 500px !important;
          padding: 20px !important;
          margin-bottom: 20px !important;
          border-top: 1px solid #e0e0e0 !important;
        }

        .search-filters-content.collapsed {
          max-height: 0 !important;
          padding: 0 20px !important;
          margin: 0 !important;
          border: none !important;
        }
      }

      /* Edit Product Content Mobile */
      .product-edit-content {
        padding: 16px !important;
        background: white;
        border-radius: 8px;
        border: 1px solid #e0e0e0;
        margin: 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
      }

      /* Make edit form single column on mobile */
      .product-edit-form-grid {
        display: block !important;
        grid-template-columns: none !important;
        gap: 0 !important;
        width: 100% !important;
      }
      
      .product-edit-form-grid > div {
        margin-bottom: 16px !important;
      }
      
      .product-edit-content h4 {
        font-size: 16px !important;
        margin-top: 0 !important;
        margin-bottom: 16px !important;
        padding-bottom: 8px !important;
        border-bottom: 2px solid #007bff !important;
      }
      
      .product-edit-content .form-group {
        margin-bottom: 16px !important;
      }
      
      .product-edit-content label {
        font-size: 14px !important;
        margin-bottom: 6px !important;
        font-weight: 600 !important;
        color: #374151 !important;
      }
      
      .product-edit-content input,
      .product-edit-content select,
      .product-edit-content textarea {
        width: 100% !important;
        padding: 12px !important;
        border: 2px solid #e5e7eb !important;
        border-radius: 6px !important;
        font-size: 16px !important; /* Prevents zoom on iOS */
        background: white !important;
      }
      
      .product-edit-content input:focus,
      .product-edit-content select:focus,
      .product-edit-content textarea:focus {
        border-color: #007bff !important;
        outline: none !important;
        box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1) !important;
      }
      
      .product-edit-content textarea {
        min-height: 80px !important;
        resize: vertical !important;
      }
      
      .product-edit-content .btn {
        padding: 12px 16px !important;
        font-size: 14px !important;
        border-radius: 6px !important;
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 8px !important;
      }
      
      .product-edit-content .btn-primary {
        background: #007bff !important;
        color: white !important;
        border: none !important;
      }
      
      .product-edit-content .btn-secondary {
        background: #6c757d !important;
        color: white !important;
        border: none !important;
      }
      
      .product-edit-content .btn-group {
        display: flex !important;
        gap: 12px !important;
        flex-direction: column !important;
      }
      
      .product-edit-content .btn-group .btn {
        flex: 1 !important;
      }
      
      /* Checkbox styling */
      .product-edit-content input[type="checkbox"] {
        width: 18px !important;
        height: 18px !important;
        margin-right: 8px !important;
      }
      
      .product-edit-content label[for*="editProductActive"] {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        font-size: 14px !important;
        color: #374151 !important;
      }
      
      /* Image Management Section Mobile */
      .product-edit-form-grid > div:last-child {
        background: white !important;
        padding: 16px !important;
        border-radius: 8px !important;
        border: 1px solid #e0e0e0 !important;
        margin: 0 !important;
      }
      
      .product-edit-form-grid > div:last-child h4 {
        font-size: 16px !important;
        margin-top: 0 !important;
        margin-bottom: 16px !important;
        padding-bottom: 8px !important;
        border-bottom: 2px solid #28a745 !important;
      }
      
      .product-edit-form-grid > div:last-child .form-group {
        margin-bottom: 16px !important;
      }
      
      .product-edit-form-grid > div:last-child label {
        font-size: 14px !important;
        margin-bottom: 6px !important;
        font-weight: 600 !important;
        color: #374151 !important;
      }
      
      .product-edit-form-grid > div:last-child input,
      .product-edit-form-grid > div:last-child select {
        width: 100% !important;
        padding: 12px !important;
        border: 2px solid #e5e7eb !important;
        border-radius: 6px !important;
        font-size: 16px !important;
        background: white !important;
      }
      
      .product-edit-form-grid > div:last-child input:focus,
      .product-edit-form-grid > div:last-child select:focus {
        border-color: #28a745 !important;
        outline: none !important;
        box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1) !important;
      }
      
      .product-edit-form-grid > div:last-child .btn {
        padding: 12px 16px !important;
        font-size: 14px !important;
        border-radius: 6px !important;
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 8px !important;
        width: 100% !important;
        margin-bottom: 8px !important;
      }
      
      .product-edit-form-grid > div:last-child .btn-success {
        background: #28a745 !important;
        color: white !important;
        border: none !important;
      }
      
      .product-edit-form-grid > div:last-child .btn-danger {
        background: #dc3545 !important;
        color: white !important;
        border: none !important;
      }
      
      /* Restaurant Assignment Mobile */
      #restaurant-assignments {
        max-height: 300px !important;
        overflow-y: auto !important;
        border: 1px solid #e5e7eb !important;
        padding: 12px !important;
        border-radius: 6px !important;
        background: #f9f9f9 !important;
      }
      
      #restaurant-assignments > div {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
        margin-bottom: 12px !important;
        padding: 12px !important;
        background: white !important;
        border-radius: 6px !important;
        border: 1px solid #e5e7eb !important;
      }
      
      #restaurant-assignments label {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        margin: 0 !important;
        font-weight: normal !important;
        font-size: 14px !important;
      }
      
      #restaurant-assignments input[type="checkbox"] {
        width: 18px !important;
        height: 18px !important;
        margin: 0 !important;
      }
      
      /* User Edit Modal Redesign - Full Screen */
      .user-edit-modal {
        width: 100%;
        max-width: 900px;
        max-height: 90vh;
        margin: 0;
        overflow: hidden;
        background: white;
        border-radius: 12px;
        box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        position: relative;
        display: flex;
        flex-direction: column;
        height: 90vh;
      }

      /* Modal Header */
      .modal-header {
        display: flex;
        align-items: center;
        gap: 16px;
        padding: 24px 24px 16px;
        border-bottom: 1px solid #e5e7eb;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        border-radius: 12px 12px 0 0;
        flex-shrink: 0;
      }

      .user-avatar {
        width: 48px;
        height: 48px;
        background: rgba(255, 255, 255, 0.2);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        backdrop-filter: blur(10px);
      }

      .user-avatar .material-icons {
        font-size: 24px;
        color: white;
      }

      .user-info h3 {
        margin: 0;
        font-size: 20px;
        font-weight: 600;
      }

      .user-email {
        margin: 4px 0 0;
        opacity: 0.9;
        font-size: 14px;
      }

      /* Form Sections */
      .form-sections {
        padding: 24px;
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        min-height: 0;
        -webkit-overflow-scrolling: touch;
      }

      .form-section {
        margin-bottom: 32px;
      }

      .form-section:last-child {
        margin-bottom: 0;
      }

      .section-header {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-bottom: 20px;
        padding-bottom: 12px;
        border-bottom: 2px solid #f3f4f6;
        min-width: 0;
      }

      .section-header .material-icons {
        color: #6366f1;
        font-size: 20px;
        flex-shrink: 0;
      }

      .section-header h4 {
        margin: 0;
        font-size: 16px;
        font-weight: 600;
        color: #374151;
        flex: 1;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .section-badge {
        margin-left: auto;
        background: #e0e7ff;
        color: #3730a3;
        padding: 4px 12px;
        border-radius: 20px;
        font-size: 12px;
        font-weight: 500;
        white-space: nowrap;
        flex-shrink: 0;
        min-width: fit-content;
      }

      /* Form Grid */
      .form-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
      }

      .form-group {
        display: flex;
        flex-direction: column;
      }

      .form-group label {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 8px;
        font-weight: 500;
        color: #374151;
        font-size: 14px;
      }

      .form-group label .material-icons {
        font-size: 16px;
        color: #6b7280;
      }

      .form-group input,
      .form-group select {
        padding: 12px 16px;
        border: 2px solid #e5e7eb;
        border-radius: 8px;
        font-size: 14px;
        transition: all 0.2s ease;
        background: white;
      }

      .form-group input:focus,
      .form-group select:focus {
        outline: none;
        border-color: #6366f1;
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
      }

      .form-help {
        margin-top: 6px;
        color: #6b7280;
        font-size: 12px;
      }

      /* Restaurant Assignments */
      .restaurant-assignments-container {
        background: #f8fafc;
        border-radius: 8px;
        padding: 20px;
        border: 1px solid #e2e8f0;
      }

      .restaurant-assignments-header {
        margin-bottom: 16px;
      }

      .restaurant-assignments-header p {
        margin: 0;
        color: #64748b;
        font-size: 14px;
      }

      .restaurant-assignments {
        max-height: 300px;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        gap: 12px;
      }

      .restaurant-item {
        display: flex;
        align-items: center;
        gap: 16px;
        padding: 16px;
        background: white;
        border: 2px solid #e5e7eb;
        border-radius: 8px;
        transition: all 0.2s ease;
        cursor: pointer;
      }

      .restaurant-item:hover {
        border-color: #d1d5db;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
      }

      .restaurant-item.assigned {
        border-color: #10b981;
        background: #f0fdf4;
      }

      .restaurant-checkbox {
        position: relative;
      }

      .restaurant-checkbox input[type="checkbox"] {
        width: 20px;
        height: 20px;
        margin: 0;
        cursor: pointer;
      }

      .restaurant-checkbox label {
        position: absolute;
        top: 0;
        left: 0;
        width: 20px;
        height: 20px;
        cursor: pointer;
        margin: 0;
      }

      .restaurant-info {
        flex: 1;
      }

      .restaurant-name {
        font-weight: 600;
        color: #111827;
        font-size: 14px;
      }

      .restaurant-slug {
        color: #6b7280;
        font-size: 12px;
        margin-top: 2px;
      }

      .restaurant-badge {
        display: flex;
        align-items: center;
        gap: 6px;
        background: #dbeafe;
        color: #1e40af;
        padding: 6px 12px;
        border-radius: 20px;
        font-size: 12px;
        font-weight: 500;
      }

      .restaurant-badge .material-icons {
        font-size: 14px;
      }

      /* Modal Body - scrollable content area */
      .user-edit-modal .modal-body {
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        min-height: 0;
        -webkit-overflow-scrolling: touch;
      }

      /* NOTE: Modal styles (.modal-backdrop, .modal-container, .modal-card)
         have been moved outside the mobile media query to line ~3710+
         to ensure they apply correctly on both desktop and mobile. */

      /* Compatibility Adapters for Legacy Classes inside .modal-container */
      .modal-container .user-edit-modal,
      .modal-container .restaurant-edit-modal,
      .modal-container .modal-content,
      .modal-container .modal-card {
        /* Reset legacy fixed/absolute positioning if any */
        position: static !important;
        width: 100% !important;
        max-width: none !important;
        height: auto !important; /* Let content determine height, but flex can expand it */
        min-height: 0;
        max-height: none !important;
        margin: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        /* Ensure flex column persists */
        display: flex;
        flex-direction: column;
        flex: 1; /* Occupy available space */
        background: transparent !important; /* Let container handle bg */
      }

      /* Drag and Drop Styles */
      .category-card[draggable="true"],
      .category-row[draggable="true"] {
        cursor: move;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
      }

      .category-card.dragging,
      .admin-card.category-card.dragging,
      .category-row.dragging {
        opacity: 0.8;
        transform: scale(0.85);
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
        transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.15s ease, box-shadow 0.15s ease;
        z-index: 1000;
        position: relative;
      }

      .category-card[draggable="true"],
      .admin-card.category-card[draggable="true"],
      .category-row[draggable="true"] {
        transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;
      }

      .category-card[draggable="true"]:active,
      .admin-card.category-card[draggable="true"]:active,
      .category-row[draggable="true"]:active {
        transform: scale(0.92);
        transition: transform 0.1s ease;
      }

      .category-card.drag-over-top,
      .admin-card.category-card.drag-over-top,
      .category-row.drag-over-top {
        border-top: 3px solid #667eea;
        padding-top: 16px;
        transition: border-top 0.2s ease, padding-top 0.2s ease;
      }

      .category-card.drag-over-bottom,
      .admin-card.category-card.drag-over-bottom,
      .category-row.drag-over-bottom {
        border-bottom: 3px solid #667eea;
        padding-bottom: 16px;
        transition: border-bottom 0.2s ease, padding-bottom 0.2s ease;
      }

      .category-card.drag-over,
      .admin-card.category-card.drag-over,
      .category-row.drag-over {
        background-color: #f0f4ff;
        transition: background-color 0.2s ease;
      }

      .category-drag-handle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        border-radius: 6px;
        cursor: move;
        color: #9ca3af;
        transition: background-color 0.2s ease;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
        touch-action: none;
      }

      .category-drag-handle:hover {
        background-color: #f3f4f6;
        color: #667eea;
      }

      .category-drag-handle .material-icons {
        font-size: 20px;
        pointer-events: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
      }

      .category-card-header-right {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 8px;
      }

      .drag-handle-cell {
        cursor: move;
        user-select: none;
      }

      .drag-handle-cell:hover {
        background-color: #f9fafb;
      }

      .drag-handle-cell .material-icons {
        transition: color 0.2s ease;
      }

      .drag-handle-cell:hover .material-icons {
        color: #667eea;
      }

      /* Order control buttons */
      .btn-order {
        padding: 4px 8px;
        min-height: auto;
        border: 1px solid #d1d5db;
        background: white;
        border-radius: 4px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s ease;
      }

      .btn-order:hover {
        background: #f3f4f6;
        border-color: #667eea;
        color: #667eea;
      }

      .btn-order:active {
        background: #e5e7eb;
        transform: scale(0.95);
      }

      .btn-order .material-icons {
        font-size: 16px;
        color: inherit;
      }

      /* Shared Admin Card Layout (used by both categories and products) */
      .admin-card-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 0;
      }

      .admin-card {
        background: white;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        overflow: hidden;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
      }

      .admin-card:active {
        transform: scale(0.98);
      }

      .admin-card-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        padding: 16px;
        background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
        border-bottom: 1px solid #e5e7eb;
      }

      .admin-card-header-right {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 8px;
      }

      .admin-card-icon-large {
        width: 64px;
        height: 64px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: white;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        flex-shrink: 0;
        overflow: hidden;
      }

      .admin-card-icon-display {
        font-size: 32px;
        line-height: 1;
      }

      .admin-card-icon-large .material-icons {
        font-size: 32px;
        color: #667eea;
      }

      .admin-card-icon-large img {
        width: 100%;
        height: 100%;
        object-fit: cover;
      }

      .admin-status-badge {
        display: flex;
        align-items: center;
        gap: 4px;
        padding: 6px 12px;
        border-radius: 20px;
        font-size: 12px;
        font-weight: 600;
        white-space: nowrap;
      }

      .admin-status-badge.active {
        background: #d1fae5;
        color: #065f46;
      }

      .admin-status-badge.inactive {
        background: #fee2e2;
        color: #991b1b;
      }

      .admin-card-body {
        padding: 16px;
      }

      .admin-card-name {
        margin: 0 0 8px 0;
        font-size: 18px;
        font-weight: 600;
        color: #111827;
      }

      .admin-card-name-secondary {
        margin: 0 0 12px 0;
        font-size: 14px;
        color: #6b7280;
      }

      .admin-card-name-secondary[dir="rtl"] {
        direction: rtl;
        text-align: right;
      }

      .admin-card-info {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin-top: 12px;
      }

      .admin-card-info-item {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 14px;
        color: #6b7280;
      }

      .admin-card-info-item .material-icons {
        color: #667eea;
      }

      .admin-card-actions {
        display: flex;
        gap: 8px;
        padding: 12px 16px;
        border-top: 1px solid #e5e7eb;
        background: #f9fafb;
      }

      .admin-card-actions .btn {
        flex: 1;
        min-height: 44px;
        padding: 10px 16px;
        font-size: 14px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        border-radius: 8px;
        font-weight: 600;
      }

      .admin-card-actions .btn .material-icons {
        font-size: 18px;
      }

      .admin-card-actions .btn-secondary {
        background: white;
        color: #374151;
        border: 1px solid #d1d5db;
      }

      .admin-card-actions .btn-secondary:active {
        background: #f3f4f6;
      }

      .admin-card-actions .btn-danger {
        background: #dc2626;
        color: white;
        border: none;
      }

      .admin-card-actions .btn-danger:active {
        background: #b91c1c;
      }

      /* Category-specific card styles */
      .category-card-header-right {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 8px;
      }

      .category-status-badge {
        display: flex;
        align-items: center;
        gap: 4px;
        padding: 6px 12px;
        border-radius: 20px;
        font-size: 12px;
        font-weight: 600;
        white-space: nowrap;
      }

      .category-status-badge.active {
        background: #d1fae5;
        color: #065f46;
      }

      .category-status-badge.inactive {
        background: #fee2e2;
        color: #991b1b;
      }

      /* Product-specific card styles */
      .product-card .admin-card-header {
        position: relative;
      }

      .product-featured-badge {
        position: absolute;
        top: 8px;
        left: 8px;
        background: #fef3c7;
        color: #78350f;
        padding: 4px 8px;
        border-radius: 12px;
        font-size: 11px;
        font-weight: 600;
        display: flex;
        align-items: center;
        gap: 4px;
        z-index: 2;
      }

      .product-status-badge {
        display: flex;
        align-items: center;
        gap: 4px;
        padding: 6px 12px;
        border-radius: 20px;
        font-size: 12px;
        font-weight: 600;
        white-space: nowrap;
      }

      .product-status-badge.active {
        background: #d1fae5;
        color: #065f46;
      }

      .product-status-badge.inactive {
        background: #fee2e2;
        color: #991b1b;
      }

      .product-card[draggable="true"],
      .admin-card.product-card[draggable="true"],
      .product-row[draggable="true"] {
        cursor: move;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
        transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;
      }

      .product-card.dragging,
      .admin-card.product-card.dragging,
      .product-row.dragging {
        opacity: 0.8;
        transform: scale(0.85);
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
        transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.15s ease, box-shadow 0.15s ease;
        z-index: 1000;
        position: relative;
      }

      .product-card[draggable="true"]:active,
      .admin-card.product-card[draggable="true"]:active,
      .product-row[draggable="true"]:active {
        transform: scale(0.92);
        transition: transform 0.1s ease;
      }

      .product-card.drag-over-top,
      .admin-card.product-card.drag-over-top,
      .product-row.drag-over-top {
        border-top: 3px solid #667eea;
        padding-top: 16px;
        transition: border-top 0.2s ease, padding-top 0.2s ease;
      }

      .product-card.drag-over-bottom,
      .admin-card.product-card.drag-over-bottom,
      .product-row.drag-over-bottom {
        border-bottom: 3px solid #667eea;
        padding-bottom: 16px;
        transition: border-bottom 0.2s ease, padding-bottom 0.2s ease;
      }

      .product-card.drag-over,
      .admin-card.product-card.drag-over,
      .product-row.drag-over {
        background-color: #f0f4ff;
        transition: background-color 0.2s ease;
      }

      .product-drag-handle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        border-radius: 6px;
        cursor: move;
        color: #9ca3af;
        transition: background-color 0.2s ease;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
        touch-action: none;
      }

      .product-drag-handle:hover {
        background-color: #f3f4f6;
        color: #667eea;
      }

      .product-drag-handle .material-icons {
        font-size: 20px;
        pointer-events: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
      }

      /* Desktop: Hide card grid, show table */
      @media (min-width: 769px) {
        .admin-card-grid {
          display: none;
        }
      }

      /* Mobile: Hide table, show cards */
      @media (max-width: 768px) {
        #categoriesContent table,
        #productsContent table {
          display: none;
        }
      }

      /* Table Styles */
      .table-force-visible {
        width: 100% !important;
        border-collapse: collapse !important;
        margin-top: 20px !important;
        background: white !important;
        border: 1px solid #ddd !important;
        display: table !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
        z-index: 1 !important;
      }

      .table-content-container {
        padding: 20px;
        background: white;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        margin: 20px 0;
      }

      .product-image-responsive {
        width: 100%;
        height: 100%;
        object-fit: cover;
      }

      .product-image-fallback {
        display: none;
        align-items: center;
        justify-content: center;
        background: #f8f9fa;
        color: #6c757d;
        font-size: 12px;
        text-align: center;
        padding: 10px;
      }

      .password-visible {
        color: #28a745 !important;
        font-weight: bold !important;
      }

      .password-hidden {
        color: #495057 !important;
        font-weight: normal !important;
      }

      .modal-password-display {
        display: flex;
      }

      .mobile-close-button {
        position: fixed;
        top: 20px;
        right: 20px;
        background: rgba(0, 0, 0, 0.7);
        color: white;
        border: none;
        border-radius: 50%;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        z-index: 1001;
        cursor: pointer;
      }

      .mobile-close-button:hover {
        background: rgba(0, 0, 0, 0.9);
      }

      .pull-to-refresh-container {
        position: relative;
        overflow: hidden;
      }

      .pull-to-refresh-indicator {
        position: absolute;
        top: -50px;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(0, 0, 0, 0.1);
        padding: 10px 20px;
        border-radius: 20px;
        font-size: 14px;
        color: #666;
        transition: top 0.3s ease;
      }

      .pull-to-refresh-active {
        top: 20px;
      }

      .touch-feedback-input {
        font-size: 16px;
      }

      .touch-feedback-input:active {
        transform: scale(0.98);
      }

      .touch-feedback-input:not(:active) {
        transform: scale(1);
      }

      .touch-feedback-button {
        transform: scale(0.95);
        transition: transform 0.1s ease;
      }

      .touch-feedback-button:not(:active) {
        transform: scale(1);
      }

      .table-container-mobile {
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
      }

      /* User Edit Modal Mobile - Already handled by fullscreen modal styles above */
      @media (max-width: 768px) {
        /* Fix modal overlay padding for mobile - already handled above */
        /* Additional specific styles for user-edit-modal if needed */
        .user-edit-modal {
          display: flex !important;
          flex-direction: column !important;
          overflow: hidden !important;
          height: 100vh !important;
          max-height: 100vh !important;
          border-radius: 0 !important;
        }

        /* Ensure modal-body scrolls, not the modal itself */
        .user-edit-modal .modal-body {
          flex: 1 !important;
          overflow-y: auto !important;
          overflow-x: hidden !important;
          min-height: 0 !important;
          -webkit-overflow-scrolling: touch !important;
        }

        /* Fix form grid - single column on mobile */
        .form-grid {
          grid-template-columns: 1fr !important;
          gap: 16px !important;
        }

        .form-sections {
          padding: 16px !important;
        }

        .form-group {
          width: 100% !important;
        }

        .form-group input,
        .form-group select {
          padding: 12px !important;
          font-size: 16px !important; /* Prevents zoom on iOS */
          width: 100% !important;
          box-sizing: border-box !important;
        }

        /* Fix modal header on mobile */
        .modal-header {
          padding: 16px !important;
          border-radius: 0 !important;
        }

        .modal-header h3 {
          font-size: 18px !important;
        }

        /* Fix restaurant assignments on mobile */
        .restaurant-assignments-container {
          padding: 16px !important;
        }

        .restaurant-item {
          padding: 12px !important;
          gap: 12px !important;
        }

        .restaurant-name {
          font-size: 13px !important;
        }

        .restaurant-slug {
          font-size: 11px !important;
        }

        /* Fix section headers */
        .section-header {
          flex-wrap: wrap !important;
        }

        .section-header h4 {
          font-size: 14px !important;
          white-space: normal !important;
        }

        .section-badge {
          margin-left: 0 !important;
          margin-top: 8px !important;
        }

        /* Fix modal actions */
        .modal-actions {
          flex-direction: row !important;
          gap: 12px !important;
          padding: 16px !important;
          border-radius: 0 !important;
        }

        .modal-actions .btn {
          flex: 1 !important;
          justify-content: center !important;
          padding: 12px 16px !important;
          font-size: 14px !important;
        }
      }
      
      .modal-content {
        margin: 0;
        border-radius: 8px;
        max-height: 90vh;
        overflow-y: auto;
      }
      
      .modal-content h3 {
        font-size: 18px;
        margin-bottom: 16px;
      }

      /* Product Edit Form Mobile Styling */
      .product-edit-form {
        display: flex !important;
        flex-direction: column !important;
        height: 100% !important;
        overflow: hidden !important;
      }

      /* Product Edit Form Header */
      .product-edit-form > h3 {
        margin: 0 !important;
        padding: 16px 20px !important;
        background: white !important;
        border-bottom: 1px solid #e5e7eb !important;
        font-size: 18px !important;
        flex-shrink: 0 !important;
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
      }

      .product-edit-form > h3 .material-icons {
        font-size: 20px !important;
      }

      /* Modal tabs horizontal scroll on mobile */
      .product-edit-form > .modal-tabs {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        display: flex !important;
        gap: 4px !important;
        padding: 0 20px !important;
        margin: 0 !important;
        border-bottom: 2px solid #e5e7eb !important;
        flex-shrink: 0 !important;
        background: white !important;
      }

      .product-edit-form > .modal-tabs::-webkit-scrollbar {
        display: none !important;
      }

      .product-edit-form .modal-tab {
        padding: 10px 12px !important;
        font-size: 13px !important;
        white-space: nowrap !important;
        min-width: auto !important;
        border-bottom: 2px solid transparent !important;
        margin-bottom: -2px !important;
      }

      .product-edit-form .modal-tab.active {
        border-bottom-color: #667eea !important;
        color: #667eea !important;
      }

      .product-edit-form .modal-tab .material-icons {
        font-size: 16px !important;
        vertical-align: middle !important;
        margin-right: 4px !important;
      }

      /* Tab Content Styling */
      .product-edit-form .modal-tab-content {
        flex: 1 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding: 20px !important;
        -webkit-overflow-scrolling: touch !important;
        min-height: 0 !important;
      }

      /* Form Groups */
      .product-edit-form .form-group {
        margin-bottom: 20px !important;
      }

      .product-edit-form .form-group label {
        display: block !important;
        margin-bottom: 8px !important;
        font-size: 14px !important;
        font-weight: 600 !important;
        color: #374151 !important;
      }

      .product-edit-form .form-group input,
      .product-edit-form .form-group select,
      .product-edit-form .form-group textarea {
        width: 100% !important;
        padding: 12px !important;
        font-size: 16px !important; /* Prevents zoom on iOS */
        border: 2px solid #e5e7eb !important;
        border-radius: 8px !important;
        box-sizing: border-box !important;
        background: white !important;
      }

      .product-edit-form .form-group input:focus,
      .product-edit-form .form-group select:focus,
      .product-edit-form .form-group textarea:focus {
        border-color: #667eea !important;
        outline: none !important;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
      }

      .product-edit-form .form-group textarea {
        min-height: 100px !important;
        resize: vertical !important;
      }

      .product-edit-form .form-group small {
        display: block !important;
        margin-top: 6px !important;
        font-size: 12px !important;
        color: #6b7280 !important;
      }

      /* Price Input with Dollar Sign */
      .product-edit-form .form-group > div[style*="position: relative"] {
        position: relative !important;
      }

      .product-edit-form .form-group > div[style*="position: relative"] > span {
        position: absolute !important;
        left: 12px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        color: #6b7280 !important;
        font-weight: 600 !important;
        z-index: 1 !important;
      }

      .product-edit-form .form-group > div[style*="position: relative"] > input {
        padding-left: 32px !important;
      }

      /* Checkbox Labels */
      .product-edit-form label[style*="display: flex"] {
        display: flex !important;
        align-items: center !important;
        gap: 12px !important;
        padding: 12px !important;
        border-radius: 8px !important;
        cursor: pointer !important;
        margin-bottom: 0 !important;
      }

      .product-edit-form label[style*="display: flex"] input[type="checkbox"] {
        width: 20px !important;
        height: 20px !important;
        margin: 0 !important;
        flex-shrink: 0 !important;
      }

      .product-edit-form label[style*="display: flex"] > div {
        flex: 1 !important;
      }

      .product-edit-form label[style*="display: flex"] > div > div:first-child {
        font-weight: 600 !important;
        margin-bottom: 2px !important;
      }

      .product-edit-form label[style*="display: flex"] > div > small {
        font-size: 12px !important;
        color: #6b7280 !important;
      }

      /* Image Preview */
      .product-edit-form #editProductImagePreview {
        width: 100% !important;
        max-width: 300px !important;
        height: 200px !important;
        margin: 0 auto 16px !important;
      }

      .product-edit-form #editProductImageText {
        text-align: center !important;
        font-size: 13px !important;
        word-break: break-word !important;
      }

      /* Dietary Flags Grid - Single Column on Mobile */
      .product-edit-form .form-group > div[style*="grid-template-columns"] {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 12px !important;
      }

      /* Hebrew Translations Section */
      .product-edit-form .modal-tab-content > div[style*="border-top"] {
        border-top: 2px solid #e5e7eb !important;
        padding-top: 20px !important;
        margin-top: 20px !important;
      }

      .product-edit-form .modal-tab-content > div[style*="border-top"] > h4 {
        font-size: 14px !important;
        font-weight: 600 !important;
        color: #6b7280 !important;
        margin-bottom: 16px !important;
      }

      /* History Container */
      .product-edit-form #productHistoryContainer {
        max-height: none !important;
        overflow-y: visible !important;
      }

      /* Form Actions - Sticky Footer */
      /* Product Edit Form Mobile Styling */
      .product-edit-form {
        display: flex;
        flex-direction: column;
        height: 100%;
        max-height: 100vh;
        overflow: hidden;
      }

      .product-edit-form > h3 {
        flex-shrink: 0;
        padding: 20px 20px 16px;
        margin: 0;
        border-bottom: 1px solid #e5e7eb;
        background: white;
      }

      .product-edit-form .modal-tabs {
        flex-shrink: 0;
        padding: 0 20px;
        background: white;
      }

      .product-edit-form .modal-tab-content {
        flex: 1;
        overflow-y: auto;
        padding: 20px;
        -webkit-overflow-scrolling: touch;
      }

      .product-edit-form .product-edit-form-actions {
        display: flex !important;
        gap: 12px !important;
        margin-top: 0 !important;
        padding: 16px 20px !important;
        border-top: 2px solid #e5e7eb !important;
        background: white !important;
        flex-shrink: 0 !important;
        position: sticky !important;
        bottom: 0 !important;
        z-index: 10 !important;
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1) !important;
      }

      .product-edit-form .product-edit-form-actions button {
        flex: 1 !important;
        padding: 12px 16px !important;
        font-size: 14px !important;
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 6px !important;
        border-radius: 8px !important;
        font-weight: 600 !important;
      }

      .product-edit-form .product-edit-form-actions button.btn-primary {
        background: #667eea !important;
        color: white !important;
        border: none !important;
      }

      .product-edit-form .product-edit-form-actions button.btn-secondary {
        background: #6c757d !important;
        color: white !important;
        border: none !important;
      }

      .product-edit-form .product-edit-form-actions button .material-icons {
        font-size: 18px !important;
      }

      /* Category Form Actions - Same styling as product modals */
      /* Category Edit Form Mobile Styling */
      .category-edit-form {
        display: flex;
        flex-direction: column;
        height: 100%;
        max-height: 100vh;
        overflow: hidden;
      }

      .category-edit-form > h3 {
        flex-shrink: 0;
        padding: 20px 20px 16px;
        margin: 0;
        border-bottom: 1px solid #e5e7eb;
        background: white;
      }

      /* Scrollable form content wrapper */
      .category-edit-form-content {
        flex: 1;
        overflow-y: auto;
        padding: 20px;
        -webkit-overflow-scrolling: touch;
        min-height: 0;
      }

      .category-edit-form .form-group {
        margin-bottom: 16px;
      }

      .category-edit-form .category-form-actions {
        display: flex !important;
        gap: 12px !important;
        margin-top: 0 !important;
        padding: 16px 20px !important;
        border-top: 2px solid #e5e7eb !important;
        background: white !important;
        flex-shrink: 0 !important;
        position: sticky !important;
        bottom: 0 !important;
        z-index: 10 !important;
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1) !important;
      }

      .category-edit-form .category-form-actions button {
        flex: 1 !important;
        padding: 12px 16px !important;
        font-size: 14px !important;
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 6px !important;
        border-radius: 8px !important;
        font-weight: 600 !important;
      }

      .category-edit-form .category-form-actions button.btn-primary {
        background: #667eea !important;
        color: white !important;
        border: none !important;
      }

      .category-edit-form .category-form-actions button.btn-secondary {
        background: #6c757d !important;
        color: white !important;
        border: none !important;
      }

      .category-edit-form .category-form-actions button .material-icons {
        font-size: 18px !important;
      }

      /* Modal Tabs */
      .modal-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
      }

      .modal-tabs::-webkit-scrollbar {
        display: none;
      }

      .modal-tab .material-icons {
        display: inline !important;
      }

      /* Inline Edit Form Mobile Styles */
      .product-inline-edit td {
        display: block !important;
        padding: 0 !important;
        border: none !important;
      }

      .inline-edit-form {
        padding: 16px !important;
      }

      .inline-edit-form h3 {
        font-size: 18px !important;
      }

      /* Mobile: Stack tabs vertically on very small screens */
      @media (max-width: 480px) {
        .modal-tabs {
          flex-direction: column !important;
          gap: 0 !important;
          border-bottom: none !important;
        }

        .modal-tab {
          border-bottom: 1px solid #e5e7eb !important;
          border-left: 3px solid transparent !important;
          padding: 12px 16px !important;
          justify-content: flex-start !important;
          text-align: left !important;
          margin-bottom: 0 !important;
        }

        .modal-tab.active {
          background: #eff6ff !important;
          border-left-color: #667eea !important;
          border-bottom-color: #e5e7eb !important;
        }

        .modal-tab .material-icons {
          margin-right: 8px;
        }
      }

      /* Permission Notice Mobile */
      .permission-notice {
        padding: 12px;
        margin-bottom: 16px;
      }
      
      .permission-notice h3 {
        font-size: 14px;
      }
      
      .permission-notice p {
        font-size: 13px;
      }
      
      /* Dev Banner Mobile */
      .dev-banner {
        padding: 12px;
        margin-bottom: 16px;
      }
      
      .dev-banner h4 {
        font-size: 13px;
      }
      
      .dev-banner p {
        font-size: 12px;
      }
      
      /* Image Upload Mobile */
      .image-upload-form {
        padding: 16px;
      }
      
      .image-upload-form h4 {
        font-size: 16px;
        margin-bottom: 12px;
      }
      
      /* Toast Mobile */
      .toast {
        margin: 8px;
        padding: 12px 16px;
        font-size: 14px;
        border-radius: 6px;
      }
      
      /* Loading States Mobile */
      .loading {
        padding: 20px;
        font-size: 14px;
      }
      
      /* Error States Mobile */
      .error-state {
        padding: 20px;
        text-align: center;
      }
      
      .error-state h3 {
        font-size: 16px;
        margin-bottom: 8px;
      }
      
      .error-state p {
        font-size: 14px;
      }
      
      /* Account Settings Mobile */
      .account-settings {
        display: flex;
        flex-direction: column;
        gap: 20px;
      }
      
      .profile-info {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
      }
      
      .profile-field {
        display: flex;
        flex-direction: column;
        gap: 4px;
      }
      
      .profile-field label {
        font-size: 12px;
        color: #666;
        font-weight: 600;
      }
      
      .profile-field .value {
        font-size: 14px;
        color: #333;
        padding: 8px 0;
      }
      
      .status-badge {
        display: inline-block;
        padding: 4px 8px;
        border-radius: 12px;
        font-size: 12px;
        font-weight: 600;
        text-align: center;
        min-width: 60px;
      }
      
      .status-badge.active {
        background: #dcfce7;
        color: #166534;
      }
      
      .status-badge.inactive {
        background: #fee2e2;
        color: #991b1b;
      }
    }

    /* ============================================================================
       DESKTOP MODAL STANDARD (GLOBAL - APPLIES TO ALL SCREEN SIZES)
       ============================================================================ */

    /*
       Overlay / Backdrop
       - Fixed position covering the entire viewport
       - Flex container for perfect centering on desktop
       - High z-index to sit on top of everything
    */
    .modal-backdrop {
      position: fixed;
      inset: 0; /* Modern replacement for top/left/right/bottom: 0 */
      background-color: rgba(0, 0, 0, 0.5);
      z-index: 10001;
      display: flex;
      justify-content: center;
      align-items: center; /* Center vertically on desktop */
      padding: 24px; /* Gutter for desktop to prevent touching edges */
      backdrop-filter: blur(2px);
      opacity: 0;
      animation: backdropFadeIn 0.2s forwards;
    }

    /* Fallback for browsers not supporting inset */
    @supports not (inset: 0) {
      .modal-backdrop {
        top: 0; left: 0; right: 0; bottom: 0;
      }
    }

    @keyframes backdropFadeIn {
      to { opacity: 1; }
    }

    /*
       Modal Container (Desktop Default)
       - Relative positioning context
       - Maximum dimensions for desktop
       - Flex column for internal layout (header/body/footer)
    */
    .modal-container {
      position: relative;
      background: white;
      border-radius: 12px;
      box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

      /* Sizing */
      width: 100%;
      max-width: 500px; /* Default (Medium) */
      max-height: 90vh; /* Never exceed 90% of viewport height on desktop */

      /* Layout */
      display: flex;
      flex-direction: column;

      /* Centering fallback (though flex parent handles it) */
      margin: auto;

      /* Animation */
      transform: scale(0.95);
      opacity: 0;
      animation: modalPopIn 0.2s 0.1s forwards cubic-bezier(0.16, 1, 0.3, 1);
      overflow: hidden; /* contain children */
    }

    @keyframes modalPopIn {
      to { transform: scale(1); opacity: 1; }
    }

    /*
       Standard Modal Sizes (Desktop)
       - Controlled via .modal-sm, .modal-lg, etc. classes
    */
    .modal-container.modal-sm { max-width: 400px; }
    .modal-container.modal-md { max-width: 500px; }
    .modal-container.modal-lg { max-width: 800px; }
    .modal-container.modal-xl { max-width: 1100px; }
    .modal-container.modal-full { max-width: 95vw; height: 90vh; }

    /* Wrapper for raw content injected without structure */
    .modal-body-wrapper {
      padding: 24px;
      overflow-y: auto;
      flex: 1;
      min-height: 0; /* Flexbox scroll fix */
    }

    /* Desktop-specific .modal-card layout */
    @media (min-width: 769px) {
      /* Modal card inherits size from container, provides internal structure */
      .modal-card {
        width: 100%;
        height: auto;
        max-width: none; /* Size controlled by .modal-container */
        border-radius: inherit; /* Inherit from container (12px) */
        background: white;
        display: flex;
        flex-direction: column;
        overflow: hidden;
      }

      /* Modal header - sticky at top */
      .modal-card > .modal-header {
        flex-shrink: 0;
        padding: 20px 24px;
        border-bottom: 1px solid #e5e7eb;
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: white;
        position: sticky;
        top: 0;
        z-index: 10;
      }

      /* Modal body - scrollable content */
      .modal-card > .modal-body {
        flex: 1;
        padding: 24px;
        overflow-y: auto;
        overflow-x: hidden;
        min-height: 0; /* Flexbox scroll fix */
        -webkit-overflow-scrolling: touch;
      }

      /* Modal actions/footer - sticky at bottom */
      .modal-card > .modal-actions,
      .modal-card > .form-actions {
        flex-shrink: 0;
        padding: 16px 24px;
        border-top: 1px solid #e5e7eb;
        display: flex;
        justify-content: flex-end;
        gap: 12px;
        background: white;
        position: sticky;
        bottom: 0;
        z-index: 10;
      }
    }

    /* Mobile modal overrides */
    @media (max-width: 768px) {
      .modal-backdrop {
        padding: 0;
        align-items: flex-end; /* Align to bottom for sheet effect */
        background-color: rgba(0, 0, 0, 0.6);
      }

      /* Reset all size constraints for mobile to full screen */
      .modal-container,
      .modal-container.modal-sm,
      .modal-container.modal-md,
      .modal-container.modal-lg,
      .modal-container.modal-xl,
      .modal-container.modal-full {
        width: 100%;
        max-width: 100%;
        height: 100%; /* Full screen */
        max-height: 100%;
        border-radius: 0; /* Remove corners */
        margin: 0;

        /* Slide up animation */
        animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
        transform: translateY(100%);
        opacity: 1;
      }

      @keyframes modalSlideUp {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
      }

      /* Modal card - fullscreen on mobile */
      .modal-card {
        width: 100% !important;
        max-width: 100vw !important;
        height: 100vh !important;
        max-height: 100vh !important;
        margin: 0 !important;
        border-radius: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
      }

      /* Modal card header - sticky at top */
      .modal-card > .modal-header {
        position: sticky !important;
        top: 0 !important;
        z-index: 10 !important;
        background: white !important;
        border-bottom: 1px solid #e5e7eb !important;
        padding: 16px 20px !important;
        margin: 0 !important;
        flex-shrink: 0 !important;
      }

      /* Modal card body - scrollable */
      .modal-card > .modal-body {
        flex: 1 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding: 20px !important;
        -webkit-overflow-scrolling: touch !important;
        min-height: 0 !important;
      }

      /* Modal card actions - sticky at bottom */
      .modal-card > .modal-actions,
      .modal-card > .form-actions {
        position: sticky !important;
        bottom: 0 !important;
        z-index: 10 !important;
        background: white !important;
        border-top: 1px solid #e5e7eb !important;
        padding: 16px 20px !important;
        margin: 0 !important;
        flex-shrink: 0 !important;
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1) !important;
      }
    }

    /* Small Mobile Devices */
    @media (max-width: 480px) {
      body {
        padding: 5px;
        padding-top: 15px;
      }
      
      .login-card {
        padding: 20px 16px;
      }
      
      .login-card h1 {
        font-size: 22px;
      }
      
      .admin-header {
        padding: 12px 16px;
      }
      
      .admin-header h1 {
        font-size: 18px;
      }
      
      .admin-body {
        padding: 16px;
      }
      
      .tabs {
        margin-bottom: 16px;
      }
      
      .tab {
        padding: 10px 14px;
        font-size: 12px;
        min-width: 70px;
      }
      
      .section-header h2 {
        font-size: 16px;
      }
      
      .btn {
        padding: 10px 14px;
        font-size: 13px;
      }
      
      .form-group input,
      .form-group select,
      .form-group textarea {
        padding: 10px;
        font-size: 16px;
      }
      
      table {
        font-size: 11px;
      }
      
      th, td {
        padding: 6px 4px;
      }
      
      .modal-content {
        padding: 16px;
      }
      
      .modal-content h3 {
        font-size: 16px;
      }
    }
    
    /* Modal Content - Desktop Styles */
    .modal-content {
      background: white;
      padding: 24px;
      width: 100%;
      box-sizing: border-box;
    }

    .modal-content h3 {
      margin: 0 0 20px 0;
      font-size: 20px;
      font-weight: 600;
      color: #333;
    }

    /* Inline Edit Form Styles */
    .product-inline-edit {
      animation: slideDown 0.3s ease-out;
    }

    @keyframes slideDown {
      from {
        opacity: 0;
        transform: translateY(-10px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    .inline-edit-form {
      padding: 24px;
      background: white;
      width: 100%;
      box-sizing: border-box;
    }

    .inline-edit-form h3 {
      margin: 0 0 20px 0;
      font-size: 20px;
      font-weight: 600;
      color: #333;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    /* Landscape Mobile */
    @media (max-width: 768px) and (orientation: landscape) {
      body {
        padding: 5px;
        padding-top: 10px;
      }
      
      .admin-header {
        padding: 12px 16px;
        flex-direction: row;
        justify-content: space-between;
      }
      
      .admin-header h1 {
        font-size: 18px;
      }
      
      .admin-body {
        padding: 16px;
      }
      
      .tabs {
        margin-bottom: 16px;
      }
      
      .tab {
        padding: 8px 16px;
        font-size: 13px;
      }
    }
    
    /* Touch-friendly improvements */
    @media (hover: none) and (pointer: coarse) {
      .btn:hover {
        transform: none;
        box-shadow: none;
      }
      
      .tab:hover {
        color: inherit;
      }
      
      .tab.active:hover {
        color: #667eea;
      }
      
      /* Increase touch targets */
      .btn {
        min-height: 44px;
        min-width: 44px;
      }
      
      .tab {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
      }
      
      /* Remove hover effects on mobile */
      .btn-primary:hover {
        transform: none;
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
      }
      
      .btn-secondary:hover {
        background: white;
      }
      
      .btn-danger:hover {
        background: #ef4444;
      }

      /* Mobile Bottom Navigation */
      .mobile-bottom-nav {
        display: none; /* Hidden by default (login screen) */
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        background: white;
        border-top: 1px solid #e5e7eb;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        z-index: 9999 !important;
        padding: 8px 0;
        justify-content: space-around;
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
      }

      /* Show mobile nav only when admin console is visible */
      .admin-console.show ~ .mobile-bottom-nav {
        display: flex;
      }

      .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        background: none;
        border: none;
        color: #6b7280;
        cursor: pointer;
        padding: 8px 12px;
        transition: all 0.2s;
        flex: 1;
        max-width: 80px;
      }

      .mobile-nav-item .material-icons {
        font-size: 24px;
        margin-bottom: 4px;
      }

      .mobile-nav-label {
        font-size: 11px;
        font-weight: 500;
      }

      .mobile-nav-item.active {
        color: #667eea;
      }

      /* Add padding to admin-body to account for bottom nav */
      .admin-body {
        padding-bottom: 80px;
      }

      /* Hide desktop tabs on mobile */
      .tabs {
        display: none !important;
      }

      /* Mobile Menu Overlay */
      .mobile-menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        /* Above bottom nav (z-index 9999) so menu fully covers it */
        z-index: 10000;
        display: flex;
        align-items: flex-end;
        transition: opacity 0.3s ease;
      }

      .mobile-menu-overlay.hidden {
        display: none;
      }

      .mobile-menu-content {
        background: white;
        border-radius: 16px 16px 0 0;
        width: 100%;
        /* Leave room for safe area / nav; body is fully covered by overlay */
        max-height: 85vh;
        overflow-y: auto;
        animation: slideUp 0.3s ease;
      }

      @keyframes slideUp {
        from {
          transform: translateY(100%);
        }
        to {
          transform: translateY(0);
        }
      }

      .mobile-menu-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 20px;
        border-bottom: 1px solid #e5e7eb;
      }

      .mobile-menu-header h3 {
        margin: 0;
        font-size: 20px;
        font-weight: 600;
      }

      .btn-close {
        background: #f3f4f6;
        border: none;
        border-radius: 50%;
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        color: #374151;
      }

      .mobile-menu-items {
        padding: 12px 0;
      }

      .mobile-menu-item {
        display: flex;
        align-items: center;
        gap: 16px;
        width: 100%;
        padding: 16px 20px;
        background: none;
        border: none;
        color: #374151;
        font-size: 16px;
        font-weight: 500;
        cursor: pointer;
        transition: background 0.2s;
      }

      .mobile-menu-item:active {
        background: #f3f4f6;
      }

      .mobile-menu-item .material-icons {
        font-size: 24px;
        color: #6b7280;
      }
    }

    /* Drag & Drop Upload Zone Styles */
    .upload-zone {
      border: 3px dashed #d1d5db;
      border-radius: 12px;
      padding: 40px 20px;
      text-align: center;
      background: #f9fafb;
      transition: all 0.3s ease;
      cursor: pointer;
      margin-bottom: 20px;
    }

    .upload-zone.drag-over {
      border-color: #667eea;
      background: #f0f4ff;
      transform: scale(1.02);
    }

    .upload-zone-content {
      pointer-events: none;
    }

    .upload-icon {
      font-size: 48px;
      color: #9ca3af;
      margin-bottom: 16px;
    }

    .upload-text {
      font-size: 16px;
      color: #374151;
      margin-bottom: 8px;
    }

    .upload-hint {
      font-size: 14px;
      color: #6b7280;
    }

    .browse-btn {
      background: none;
      border: none;
      color: #667eea;
      text-decoration: underline;
      cursor: pointer;
      font-size: 16px;
      pointer-events: auto;
    }

    .browse-btn:hover {
      color: #5568d3;
    }

    /* Image Preview Section Styles */
    .image-preview-section {
      margin-top: 20px;
      padding: 20px;
      background: white;
      border-radius: 8px;
      border: 1px solid #e5e7eb;
    }

    .preview-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 16px;
    }

    .preview-header h3 {
      margin: 0;
      font-size: 18px;
      font-weight: 600;
      color: #333;
    }

    .preview-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
      gap: 16px;
    }

    .preview-item {
      position: relative;
      border: 2px solid #e5e7eb;
      border-radius: 8px;
      overflow: hidden;
      background: #f9fafb;
    }

    .preview-item.uploading {
      border-color: #667eea;
    }

    .preview-item.success {
      border-color: #10b981;
    }

    .preview-item.error {
      border-color: #ef4444;
    }

    .preview-thumbnail {
      width: 100%;
      height: 150px;
      object-fit: cover;
      background: #e5e7eb;
    }

    .preview-info {
      padding: 8px;
    }

    .preview-filename {
      font-size: 12px;
      font-weight: 600;
      color: #333;
      margin-bottom: 4px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .preview-size {
      font-size: 11px;
      color: #6b7280;
      margin-bottom: 8px;
    }

    .preview-remove {
      position: absolute;
      top: 4px;
      right: 4px;
      background: rgba(239, 68, 68, 0.9);
      color: white;
      border: none;
      border-radius: 50%;
      width: 24px;
      height: 24px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 16px;
      line-height: 1;
    }

    .preview-remove:hover {
      background: rgba(239, 68, 68, 1);
    }

    .progress-bar {
      height: 4px;
      background: #e5e7eb;
      border-radius: 2px;
      overflow: hidden;
      margin-top: 8px;
    }

    .progress-fill {
      height: 100%;
      background: linear-gradient(90deg, #667eea, #764ba2);
      transition: width 0.3s ease;
      width: 0%;
    }

    .upload-status {
      font-size: 11px;
      margin-top: 4px;
      text-align: center;
    }

    .upload-status.uploading {
      color: #667eea;
    }

    .upload-status.success {
      color: #10b981;
    }

    .upload-status.error {
      color: #ef4444;
    }

    /* Hide mobile navigation on desktop */
    @media (min-width: 769px) {
      .mobile-bottom-nav,
      .mobile-menu-overlay {
        display: none !important;
      }
    }

    /* Hide navigation bars when fullscreen modal is open */
    body.modal-fullscreen-open .mobile-bottom-nav,
    body.modal-fullscreen-open .admin-sidebar,
    body.modal-fullscreen-open #mobileBottomNav,
    body.modal-fullscreen-open #adminSidebar {
      display: none !important;
    }

/* ========================================================================
   KEYBOARD SHORTCUTS (Phase 1)
   ======================================================================== */

/* Keyboard Shortcuts Help Modal */
.shortcuts-help-modal {
  max-width: 600px;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.shortcuts-help-modal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 2px solid #e5e7eb;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.shortcuts-help-modal .modal-header h2 {
  font-size: 20px;
  font-weight: 600;
}

.shortcuts-help-modal .btn-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease;
}

.shortcuts-help-modal .btn-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.shortcuts-help-modal .modal-body {
  max-height: 70vh;
  overflow-y: auto;
}

/* Shortcuts Help Section */
.shortcuts-help-section {
  margin-bottom: 24px;
}

.shortcuts-help-section:last-child {
  margin-bottom: 0;
}

.shortcuts-help-section h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: 600;
  color: #333;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Shortcuts Help Item */
.shortcuts-help-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f3f4f6;
}

.shortcuts-help-item:last-child {
  border-bottom: none;
}

.shortcuts-help-item span {
  color: #374151;
  font-size: 14px;
}

/* Keyboard Key Styling */
kbd {
  background: linear-gradient(180deg, #f9fafb 0%, #f3f4f6 100%);
  border: 1px solid #d1d5db;
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 4px 10px;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Mono', 'Droid Sans Mono', 'Source Code Pro', monospace;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  display: inline-block;
  min-width: 28px;
  text-align: center;
}

/* Optional Shortcut Hints on Buttons */
.shortcut-hint {
  margin-left: 8px;
  opacity: 0.6;
  font-size: 0.75em;
}

/* Hide shortcuts on mobile devices */
@media (max-width: 768px) {
  .shortcut-hint {
    display: none !important;
  }

  .shortcuts-help-modal {
    display: none !important;
  }
}

/* ========================================================================
   THEME SYSTEM (Custom Theming)
   ======================================================================== */

/* Theme Picker Container */
.theme-picker {
  width: 100%;
}

.theme-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
}

/* Individual Theme Option Card */
.theme-option {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px 16px;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-option:hover {
  border-color: #d1d5db;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.theme-option.active {
  border-color: #667eea;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

/* Theme Color Swatches */
.theme-colors {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-height: 48px;
}

.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.theme-colors .material-icons {
  font-size: 32px;
  color: #667eea;
}

/* Theme Label */
.theme-label {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  text-align: center;
}

/* Active Theme Check Icon */
.theme-option .check {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 20px;
  color: #667eea;
}

/* Toggle Switch for Dark Mode */
.toggle-switch {
  display: inline-block;
}

.toggle-switch input[type="checkbox"] {
  display: none;
}

.toggle-slider {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
  background-color: #e5e7eb;
  border-radius: 34px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  top: 3px;
  background-color: white;
  border-radius: 50%;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input[type="checkbox"]:checked + label .toggle-slider {
  background-color: #667eea;
}

.toggle-switch input[type="checkbox"]:checked + label .toggle-slider::before {
  transform: translateX(24px);
}

.toggle-label {
  font-size: 14px;
  color: #374151;
  font-weight: 500;
}

/* Dark Theme Overrides */
body.dark-theme {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

.dark-theme .admin-console {
  background: #1e293b;
}

.dark-theme .admin-body {
  background: #1e293b;
  color: #e2e8f0;
}

.dark-theme .card,
.dark-theme .stat-card {
  background: #334155;
  border-color: #475569;
  color: #e2e8f0;
}

.dark-theme .card h3,
.dark-theme .stat-card .label {
  color: #f1f5f9;
}

.dark-theme .admin-sidebar {
  background: #0f172a;
  border-right-color: #334155;
}

.dark-theme .sidebar-item {
  color: #94a3b8;
}

.dark-theme .sidebar-item:hover {
  background: #1e293b;
  color: #e2e8f0;
}

.dark-theme .sidebar-item.active {
  background: rgba(102, 126, 234, 0.15);
  color: #a5b4fc;
}

.dark-theme .form-group label {
  color: #e2e8f0;
}

.dark-theme .form-group input,
.dark-theme .form-group select,
.dark-theme .form-group textarea {
  background: #334155;
  border-color: #475569;
  color: #e2e8f0;
}

.dark-theme .form-group input:focus,
.dark-theme .form-group select:focus,
.dark-theme .form-group textarea:focus {
  border-color: #667eea;
  background: #3f4f66;
}

.dark-theme table th {
  background: #1e293b;
  color: #cbd5e1;
}

.dark-theme table td {
  color: #94a3b8;
  border-bottom-color: #334155;
}

.dark-theme table tr:hover {
  background: #2d3d52;
}

.dark-theme .theme-option {
  background: #334155;
  border-color: #475569;
}

.dark-theme .theme-option:hover {
  border-color: #64748b;
  background: #3f4f66;
}

.dark-theme .theme-option.active {
  border-color: #818cf8;
  background: rgba(129, 140, 248, 0.15);
}

.dark-theme .theme-label {
  color: #e2e8f0;
}

.dark-theme .toggle-label {
  color: #e2e8f0;
}

.dark-theme .section-header h2 {
  color: #f1f5f9;
}

.dark-theme .modal-content-regular {
  background: #1e293b;
  color: #e2e8f0;
}

.dark-theme .modal-content-regular h3 {
  color: #f1f5f9;
}

.dark-theme .activity-item {
  background: #334155;
  border-color: #475569;
}

.dark-theme .activity-item:hover {
  background: #3f4f66;
}

.dark-theme .activity-title {
  color: #e2e8f0;
}

.dark-theme .empty-state,
.dark-theme .error-state,
.dark-theme .loading {
  color: #94a3b8;
}

/* Mobile Responsive Adjustments for Theme Picker */
@media (max-width: 768px) {
  .theme-options {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
  }

  .theme-option {
    padding: 16px 12px;
    gap: 8px;
  }

  .theme-colors {
    min-height: 36px;
  }

  .color-swatch {
    width: 24px;
    height: 24px;
  }

  .theme-colors .material-icons {
    font-size: 24px;
  }

  .theme-label {
    font-size: 12px;
  }

  .toggle-slider {
    width: 44px;
    height: 24px;
  }

  .toggle-slider::before {
    height: 18px;
    width: 18px;
  }

  .toggle-switch input[type="checkbox"]:checked + label .toggle-slider::before {
    transform: translateX(20px);
  }
}

/* Profile Info Rows */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

.info-row:last-child {
  border-bottom: none;
}

.info-row strong {
  font-weight: 500;
  color: var(--text-primary);
  min-width: 160px;
}

.info-row span {
  color: var(--text-secondary);
  text-align: right;
}

/* ============================================================================
   TMS - Table Management tab
   ========================================================================== */
.tms-meta {
  margin-bottom: 24px;
}

.tms-refreshing {
  position: relative;
}

.tms-refreshing::after {
  content: 'Updating…';
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(15, 23, 42, 0.8);
  color: #fff;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.05em;
}

.tms-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.tms-summary-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tms-summary-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tms-summary-label .material-icons {
  font-size: 18px;
}

.tms-summary-value {
  font-size: 26px;
  font-weight: 700;
  color: #111827;
}

.tms-meta-bar {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  font-size: 14px;
  color: #475569;
  align-items: center;
}

.tms-meta-top {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 14px;
  background: #fff;
  margin-bottom: 16px;
}

.tms-stream-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid #cbd5f5;
  background: #eef2ff;
  color: #4338ca;
}

.tms-stream-pill[data-status="open"] {
  border-color: #bbf7d0;
  background: #ecfdf5;
  color: #047857;
}

.tms-stream-pill[data-status="connecting"],
.tms-stream-pill[data-status="reconnecting"] {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.tms-stream-pill[data-status="error"],
.tms-stream-pill[data-status="timeout"] {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.tms-stream-pill .tms-stream-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  display: inline-block;
  animation: pulse 1.2s infinite;
}

.tms-stream-pill[data-status="open"] .tms-stream-dot {
  animation: pulse-green 1.2s infinite;
}

.tms-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tms-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tms-columns {
  display: grid;
  grid-template-columns: 3fr 1.2fr;
  gap: 20px;
}

.tms-floor-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tms-admin-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tms-admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.tms-admin-toolbar-spacer {
  flex: 1 1 auto;
}

.tms-admin-bulk-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 16px;
  background: rgba(59, 130, 246, 0.08);
}

.tms-admin-bulk-bar.visible {
  display: flex;
}

.tms-admin-bulk-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
}

.tms-admin-bulk-info span {
  font-size: 18px;
}

.tms-admin-bulk-info .btn {
  padding: 4px 8px;
}

.tms-admin-bulk-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Floor editor modal wrapper - makes the modal wider to accommodate the editor */
.tms-floor-editor-modal-wrapper {
  width: 95vw !important;
  max-width: 1400px !important;
  max-height: 90vh !important;
}

/* Override modal-content-regular width for floor editor */
.modal-content-regular:has(.tms-floor-editor-modal-wrapper) {
  max-width: 95vw !important;
  width: 95vw !important;
}

.tms-floor-editor-modal-wrapper .modal-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid #e5e7eb;
  background: white;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
}

.tms-floor-editor-modal-wrapper .modal-actions .btn {
  flex: 1 1 0;
  justify-content: center;
}

.tms-floor-editor-modal {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tms-floor-editor-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 14px;
}

.tms-floor-editor-details {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
}

.tms-floor-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.tms-floor-editor-toolbar .btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tms-floor-editor-toolbar-spacer {
  flex: 1 1 auto;
}

.tms-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

.tms-switch input {
  accent-color: var(--accent-color);
}

.tms-floor-editor-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tms-floor-editor-canvas {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  border: 1px dashed var(--border-color);
  border-radius: 16px;
  background-color: #f8fafc;
  background-image:
    linear-gradient(0deg, rgba(99, 102, 241, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99, 102, 241, 0.08) 1px, transparent 1px);
  background-size: 2.5% 2.5%;
  overflow: hidden;
  touch-action: none;
}

.tms-floor-node {
  position: absolute;
  min-width: 80px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 2px solid rgba(59, 130, 246, 0.4);
  background: #fff;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: grab;
  user-select: none;
  font-size: 13px;
  text-align: center;
}

.tms-floor-node.selected {
  border-color: var(--accent-color);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.25);
}

.tms-floor-node strong {
  font-size: 14px;
  color: var(--text-primary);
}

.tms-floor-node span {
  color: var(--text-secondary);
  font-size: 12px;
}

.tms-floor-node.dragging {
  cursor: grabbing;
  border-color: var(--accent-color);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.25);
}

.tms-floor-node-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}

.tms-floor-node.dirty::after {
  content: '●';
  position: absolute;
  top: -6px;
  right: -6px;
  font-size: 16px;
  color: #f59e0b;
  background: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tms-floor-inspector {
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 12px;
  background: var(--card-background);
  min-height: 360px;
}

.tms-floor-inspector-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
}

.tms-floor-inspector-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
}

.tms-floor-inspector-table {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 6px 8px;
  font-size: 13px;
  background: #fff;
  cursor: pointer;
}

.tms-floor-inspector-table.active {
  border-color: var(--accent-color);
  background: rgba(37, 99, 235, 0.08);
}

.tms-floor-inspector-controls {
  border-top: 1px dashed var(--border-color);
  padding-top: 12px;
}

.tms-floor-inspector-form-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.tms-floor-inspector-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}

.tms-floor-inspector-field input {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 13px;
}

.tms-floor-inspector-empty {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 12px 0;
  text-align: center;
}

.btn-icon {
  border: none;
  background: #f1f5f9;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #475569;
}

.btn-icon:hover {
  background: #e2e8f0;
}

.btn-icon .material-icons {
  font-size: 20px;
}

.btn-icon.danger {
  color: #dc2626;
}

.btn-icon.danger:hover {
  background: #fee2e2;
}

.tms-admin-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.tms-admin-summary-card {
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  background: var(--card-background);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tms-admin-summary-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tms-admin-summary-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
}

.tms-admin-area-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tms-admin-area-card {
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.tms-admin-area-card.collapsed .tms-admin-area-body {
  display: none;
}

.tms-admin-area-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.tms-admin-area-header h3 {
  margin: 0;
  font-size: 20px;
}

.tms-admin-area-header p {
  margin: 2px 0 0;
  color: var(--text-secondary);
}

.tms-admin-area-actions {
  display: flex;
  gap: 8px;
}

.tms-admin-area-body {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tms-admin-area-meta {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 14px;
}

.tms-admin-area-meta .meta-icon {
  font-size: 20px;
  color: var(--text-tertiary);
}

.tms-admin-section-card {
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px;
  background: var(--surface-1);
}

.tms-admin-section-card ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tms-admin-section-card li {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}

.tms-admin-section-card li:last-child {
  border-bottom: none;
}

.tms-admin-section-header {
  display: flex;
  gap: 6px;
  align-items: center;
  font-weight: 600;
  margin-bottom: 8px;
}

.tms-admin-section-tables {
  color: var(--text-secondary);
  font-size: 13px;
}

.tms-admin-table-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tms-admin-table-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 10px 14px;
  background: var(--surface-1);
  gap: 16px;
}

.tms-admin-table-row.selected {
  border-color: var(--accent-color);
  background: rgba(59, 130, 246, 0.08);
}

.tms-admin-table-select {
  display: flex;
  align-items: center;
}

.tms-admin-table-select input {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.tms-admin-table-actions {
  display: inline-flex;
  gap: 6px;
}

.tms-position-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(80px, 1fr));
  gap: 12px;
}

.tms-admin-section-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.tms-admin-server-card {
  margin-top: 24px;
}

.tms-server-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tms-server-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

.tms-server-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.tms-server-meta {
  font-size: 13px;
  color: var(--text-secondary);
}

.tms-server-actions {
  display: inline-flex;
  gap: 6px;
}

.tms-shift-card {
  margin-top: 24px;
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tms-shift-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.tms-shift-header h3 {
  margin: 0;
}

.tms-shift-header small {
  color: var(--text-secondary);
}

.tms-shift-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.tms-shift-controls label {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  color: var(--text-secondary);
  gap: 4px;
}

.tms-shift-controls input[type="date"] {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px 8px;
  min-width: 160px;
}

.tms-shift-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tms-shift-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 10px 14px;
  background: var(--surface-1);
}

.tms-shift-meta {
  font-size: 13px;
  color: var(--text-secondary);
}

.tms-shift-actions {
  display: inline-flex;
  gap: 6px;
}

.tms-admin-table-name {
  font-weight: 600;
  font-size: 16px;
}

.tms-admin-table-meta {
  color: var(--text-secondary);
  font-size: 13px;
}

.tms-admin-table-status {
  text-align: right;
}

.tms-table-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.tms-table-actions .btn {
  padding: 6px 12px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tms-table-actions .material-icons {
  font-size: 16px;
}

.tms-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tms-status-badge.status-available {
  background: #dcfce7;
  color: #15803d;
}

.tms-status-badge.status-held {
  background: #fef9c3;
  color: #854d0e;
}

.tms-status-badge.status-reserved {
  background: #e0e7ff;
  color: #4338ca;
}

.tms-status-badge.status-seated {
  background: #dbeafe;
  color: #1d4ed8;
}

.tms-status-badge.status-dirty {
  background: #ffedd5;
  color: #9a3412;
}

.tms-status-badge.status-clean {
  background: #f1f5f9;
  color: #475569;
}

.tms-status-badge.status-locked,
.tms-status-badge.status-closing {
  background: #fee2e2;
  color: #b91c1c;
}

@keyframes pulse {
  0% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1); }
  100% { opacity: 0.4; transform: scale(0.9); }
}

@keyframes pulse-green {
  0% { opacity: 0.6; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1); }
  100% { opacity: 0.6; transform: scale(0.8); }
}

.tms-area-card {
  padding: 18px;
}

.tms-area-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.tms-area-header h3 {
  font-size: 18px;
  margin-bottom: 4px;
  color: #111827;
}

.tms-area-header p {
  font-size: 13px;
  color: #64748b;
}

.tms-table-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.tms-table-chip {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 120px;
}

.tms-table-chip-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  color: #111827;
}

.tms-table-name {
  font-size: 14px;
}

.tms-table-chip .status-icon {
  font-size: 18px;
  color: #475569;
}

.tms-table-chip-body {
  font-size: 13px;
  color: #111827;
}

.tms-table-subtext {
  font-size: 12px;
  color: #64748b;
}

.tms-table-footer {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #475569;
}

.tms-table-chip.status-open {
  border-color: #10b981;
  background: #ecfdf5;
}

.tms-table-chip.status-seated {
  border-color: #2563eb;
  background: #eff6ff;
}

.tms-table-chip.status-reserved {
  border-color: #c084fc;
  background: #f5f3ff;
}

.tms-table-chip.status-dirty {
  border-color: #f97316;
  background: #fff7ed;
}

.tms-table-chip.status-held {
  border-color: #facc15;
  background: #fefce8;
}

.tms-table-chip.status-closing {
  border-color: #f87171;
  background: #fef2f2;
}

.tms-empty-row {
  padding: 16px;
  border: 1px dashed #cbd5f5;
  border-radius: 12px;
  font-size: 13px;
  color: #94a3b8;
  text-align: center;
}

.tms-side-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tms-side-card {
  padding: 16px;
}

.tms-side-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.tms-side-header-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tms-side-actions-header {
  display: flex;
  gap: 8px;
}

.tms-side-header h3 {
  font-size: 16px;
  color: #111827;
}

.tms-count {
  background: #e2e8f0;
  color: #475569;
  padding: 2px 10px;
  border-radius: 9999px;
  font-size: 13px;
}

.tms-side-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tms-side-item {
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 12px;
}

.tms-side-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.tms-side-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: #111827;
  margin-bottom: 4px;
}

.tms-side-meta {
  font-size: 13px;
  color: #64748b;
}

.tms-side-empty {
  font-size: 14px;
  color: #94a3b8;
}

.tms-side-actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.btn-small {
  padding: 4px 8px;
  font-size: 12px;
}

.btn-small .material-icons {
  font-size: 16px;
}

.tms-inline-alert {
  padding: 10px 12px;
  border-radius: 10px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  font-size: 13px;
  margin-bottom: 12px;
}

.tms-state-badge {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 9999px;
  background: #e2e8f0;
  color: #475569;
}

.tms-state-badge.state-waiting {
  background: #fef3c7;
  color: #92400e;
}

.tms-state-badge.state-paged {
  background: #e0f2fe;
  color: #0369a1;
}

.tms-state-badge.state-seated,
.tms-state-badge.state-confirmed {
  background: #dbeafe;
  color: #1d4ed8;
}

.tms-state-badge.state-reserved,
.tms-state-badge.state-pending {
  background: #ede9fe;
  color: #6d28d9;
}

.tms-state-badge.state-no_show,
.tms-state-badge.state-canceled {
  background: #fee2e2;
  color: #b91c1c;
}

.tms-tag-row {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tms-tag {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 6px;
  background: #e0e7ff;
  color: #3730a3;
}

.tms-floor-map {
  margin-bottom: 16px;
}

.tms-decision-bar {
  margin-bottom: 20px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  background: #ffffff;
}

.tms-decision-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.tms-decision-card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #f8fafc;
}

.tms-decision-card span {
  font-size: 12px;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.tms-decision-card strong {
  font-size: 20px;
  color: #0f172a;
}

.tms-pacing {
  border-width: 2px;
}

.tms-pacing-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tms-pacing-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tms-pacing.pacing-normal {
  border-color: #10b981;
  background: #ecfdf5;
}

.tms-pacing.pacing-busy {
  border-color: #f59e0b;
  background: #fffbeb;
}

.tms-pacing.pacing-critical {
  border-color: #f87171;
  background: #fef2f2;
}

.tms-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.tms-filter-select {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tms-filter-select label {
  font-size: 12px;
  color: #475569;
}

.tms-filter-select select {
  padding: 6px 12px;
  border-radius: 9999px;
  border: 1px solid #cbd5f5;
  background: #fff;
}

.tms-filter-search {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 180px;
}

.tms-filter-search label {
  font-size: 12px;
  color: #475569;
}

.tms-filter-search input {
  padding: 6px 12px;
  border-radius: 9999px;
  border: 1px solid #cbd5f5;
  background: #fff;
}

.tms-filter-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tms-filter-chip {
  border: 1px solid #cbd5f5;
  border-radius: 9999px;
  padding: 6px 14px;
  background: #ffffff;
  color: #0f172a;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.tms-filter-chip:hover {
  border-color: #64748b;
}

.tms-filter-chip.active {
  background: #6366f1;
  color: #ffffff;
  border-color: #4f46e5;
}

.tms-floor-canvas {
  position: relative;
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  overflow: hidden;
}

.tms-floor-canvas::before {
  content: '';
  display: block;
  padding-top: var(--tms-floor-ratio, 70%);
}

.tms-floor-inner {
  position: absolute;
  inset: 0;
  padding: 12px;
}

.tms-table-node {
  position: absolute;
  border-radius: 14px;
  border: 1px solid #cbd5f5;
  background: #ffffff;
  color: #0f172a;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 4px;
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  min-width: 28px;
  min-height: 28px;
  pointer-events: auto;
  touch-action: manipulation;
  font-size: 12px;
  text-align: center;
}

.tms-table-node:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

.tms-table-node:hover {
  box-shadow: 0 12px 20px rgba(15, 23, 42, 0.14);
}

.tms-table-label {
  font-weight: 600;
  font-size: 12px;
}

.tms-table-meta {
  font-size: 10px;
  color: #475569;
}

.tms-table-server {
  margin-top: 2px;
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 9999px;
  background: #e0e7ff;
  color: #312e81;
}

.tms-status-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 14px;
  color: #475569;
}

.tms-table-node.status-open {
  border-color: #10b981;
  background: #ecfdf5;
}

.tms-table-node.status-seated {
  border-color: #2563eb;
  background: #eff6ff;
}

.tms-table-node.status-reserved {
  border-color: #c084fc;
  background: #f5f3ff;
}

.tms-table-node.status-dirty {
  border-color: #f97316;
  background: #fff7ed;
}

.tms-table-node.status-held {
  border-color: #f59e0b;
  background: #fffbeb;
}

.tms-table-node.status-closing {
  border-color: #f87171;
  background: #fef2f2;
}

.tms-table-node.has-reservation {
  border-width: 2px;
}

.tms-table-node.has-conflict {
  border-color: #f97316;
  box-shadow: 0 12px 20px rgba(249, 115, 22, 0.3);
}

.tms-table-node.is-dimmed {
  opacity: 0.3;
}

.tms-table-node.is-highlighted {
  box-shadow: 0 14px 22px rgba(99, 102, 241, 0.45);
  border-color: #6366f1;
  z-index: 2;
}

.tms-res-badge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
  justify-content: center;
}

.tms-res-badge {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 9999px;
  background: #ede9fe;
  color: #4c1d95;
  border: 1px solid #c4b5fd;
}

.tms-res-badge.is-warning {
  background: #fef9c3;
  color: #92400e;
  border-color: #facc15;
}

.tms-res-conflict {
  margin-top: 4px;
  font-size: 9px;
  color: #b45309;
  font-weight: 600;
}

.tms-floor-map .empty-state {
  margin-bottom: 0;
}

.tms-pressure-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.tms-pressure-card {
  flex: 1 1 160px;
  border: 1px dashed #facc15;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fffbeb;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.tms-pressure-card span {
  font-size: 12px;
  color: #92400e;
}

.tms-pressure-card strong {
  font-size: 18px;
  color: #b45309;
}

.tms-clickable-item {
  cursor: pointer;
}

.tms-clickable-item:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

.inline-code {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #0f172a;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 13px;
}

.empty-state.small {
  padding: 28px;
}

.empty-state.small h3 {
  font-size: 18px;
}

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

  .tms-side-column {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .tms-side-card {
    flex: 1 1 320px;
  }
}

@media (max-width: 640px) {
  .tms-table-grid {
    grid-template-columns: 1fr;
  }

  .tms-summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }

  /* Floor editor modal responsive */
  .tms-floor-editor-modal-wrapper {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
  }

  .modal-content-regular:has(.tms-floor-editor-modal-wrapper) {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
  }

  .tms-floor-editor-layout {
    gap: 12px;
  }

  .tms-floor-editor-canvas {
    aspect-ratio: 1 / 1;
  }

  .tms-floor-inspector {
    min-height: 200px;
  }
}

/* ============================================================================
   MODAL INTERNAL LAYOUT UTILITIES
   ============================================================================ */

/* Ensure internal parts scroll correctly within the fixed modal container */
.modal-container .modal-body,
.modal-container .form-sections,
.modal-container .modal-tab-content {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  /* Add padding if it was removed from the container */
  /* padding: 24px; - existing classes likely have padding or it's handled by wrapper */
}

/* Ensure headers/footers stay fixed and don't shrink */
.modal-container .modal-header,
.modal-container .modal-actions,
.modal-container .form-actions,
.modal-container .modal-tabs {
  flex-shrink: 0;
  z-index: 1; /* Keep above scrolling content if needed */
  background: white; /* Ensure opaque background */
}

/* Fix for modal-actions border/spacing in this new layout context */
.modal-container .modal-actions,
.modal-container .form-actions {
  margin-top: 0; /* Remove margin as we rely on flex spacing/padding */
}
