/* Submenu Styling */
.submenu-group { position: relative; }
.submenu-parent { width: 100%; text-align: left; position: relative; cursor: pointer; }
.submenu { display: none; margin-left: 16px; margin-top: 4px; }
.submenu-group.active .submenu { display: block; }
.submenu-item {
	font-size: 12px; padding: 6px 8px; margin: 2px 0; background: #0b1220; border: 1px solid #1f2937; border-radius: 6px;
	color: #9ca3af; cursor: pointer; transition: all 0.2s;
}
.submenu-item:hover { background: #1b2435; color: #e2e8f0; border-color: #3b82f6; }
.submenu-item.active { background: #1b2435; color: #e2e8f0; border-color: #3b82f6; }
/* Mobile View Styling */
.mobile-view {
    width: 100%;
    padding: 16px;
}

.mobile-timeline { 
    display: grid; 
    gap: 12px; 
    padding: 8px; 
}

.mobile-seat-card { 
    background: #0b1220; 
    border: 1px solid #1f2937; 
    border-radius: 10px; 
    padding: 12px; 
    cursor: pointer; 
    transition: all 0.2s;
    margin-bottom: 8px;
}

.mobile-seat-card:hover {
    background: #1b2435;
    border-color: #3b82f6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.mobile-seat-card.available {
    border-color: var(--color-available-border, #10b981);
    background: var(--color-available, rgba(16, 185, 129, 0.1));
}

.mobile-seat-card.confirmed {
    border-color: var(--color-confirmed-border, #ef4444);
    background: var(--color-confirmed, rgba(239, 68, 68, 0.1));
}

.mobile-seat-card.tentative {
    border-color: var(--color-tentative-border, #f59e0b);
    background: var(--color-tentative, rgba(251, 191, 36, 0.1));
}

/* Submenu Content Styling */
.submenu-content { text-align: center; padding: 40px 20px; }
.submenu-content h3 { font-size: 24px; margin-bottom: 12px; color: #e2e8f0; }
.submenu-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-top: 30px; }
.submenu-card {
	background: #0b1220; border: 2px solid #1f2937; border-left: 4px solid #10b981; border-radius: 12px; padding: 24px; cursor: pointer; transition: all 0.3s ease;
	text-align: center; position: relative; overflow: hidden; min-height: 140px; display: flex; flex-direction: column; justify-content: center;
}
.submenu-card::before { content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.1), transparent); transition: left 0.5s; }
.submenu-card:hover::before { left: 100%; }
.submenu-card:hover { border-color: #6366f1; border-left-color: #10b981; transform: translateY(-4px); box-shadow: 0 8px 25px rgba(99, 102, 241, 0.2); }
.submenu-card:active { transform: translateY(-2px); }
.submenu-card h4 { margin: 0 0 12px 0; color: #e2e8f0; font-size: 18px; font-weight: 600; }
.submenu-card p { color: #9ca3af; margin: 0; line-height: 1.5; }

/* Animation Enhancements */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
#dashCards .card, #reportCards .card { animation: fadeInUp 0.6s ease-out; }
#dashCards .card:nth-child(1) { animation-delay: 0.1s; }
#dashCards .card:nth-child(2) { animation-delay: 0.2s; }
#dashCards .card:nth-child(3) { animation-delay: 0.3s; }
#dashCards .card:nth-child(4) { animation-delay: 0.4s; }
#reportCards .card:nth-child(1) { animation-delay: 0.1s; }
#reportCards .card:nth-child(2) { animation-delay: 0.2s; }
#reportCards .card:nth-child(3) { animation-delay: 0.3s; }
#reportCards .card:nth-child(4) { animation-delay: 0.4s; }
#reportCards .card:nth-child(5) { animation-delay: 0.5s; }
.submenu { animation: slideDown 0.2s ease-out; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* Responsive behavior for smaller screens: table helpers */
@media (max-width: 768px) {
	.table-responsive { font-size: 0.75rem; }
	.table th, .table td { padding: 0.5rem 0.25rem; }
	.btn-sm { padding: 0.125rem 0.25rem; font-size: 0.6875rem; }
}
@media (max-width: 768px) {
	.list th, .list td { white-space: normal; padding: 6px 8px; font-size: 13px; }
	table.list { min-width: 600px; }
	.list th:nth-child(n), .list td:nth-child(n) { width: auto; min-width: 60px; }
}

/* Global Responsive Design - Removed conflicting !important rules */
/* These are now handled in the comprehensive mobile section below */

/* ============================================
   COMPREHENSIVE MOBILE RESPONSIVE STYLES
   ============================================
   All mobile styles are scoped to @media queries
   Desktop view remains completely unchanged
   ============================================ */

/* Prevent horizontal scrolling globally on mobile */
@media (max-width: 600px) {
  * {
    max-width: 100vw;
  }
  
  html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    position: relative;
  }
  
  .container {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }
}

/* Mobile Menu Toggle Button - Hidden on desktop */
.mobile-menu-toggle {
  display: none; /* Hidden by default, shown only on mobile */
  background: #1f2937;
  border: 1px solid #334155;
  color: #e5e7eb;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 20px;
  z-index: 100;
  position: relative;
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.mobile-menu-toggle:hover {
  background: #334155;
  border-color: #475569;
}

.mobile-menu-toggle:active {
  transform: scale(0.95);
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 997;
  animation: fadeIn 0.2s ease;
}

.mobile-menu-overlay.active {
  display: block;
}

/* ============================================
   TABLET & SMALL DESKTOP (768px and below)
   ============================================ */
@media (max-width: 768px) {
  /* Header adjustments */
  header {
    padding: 8px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .brand h1 {
    font-size: 14px;
  }
  
  /* Navigation - hide some buttons, make scrollable */
  nav {
    flex-wrap: wrap;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  
  nav::-webkit-scrollbar {
    display: none;
  }
  
  nav .tab {
    font-size: 12px;
    padding: 6px 10px;
    white-space: nowrap;
  }
  
  /* Hide some nav buttons on tablet */
  nav .btn.ghost {
    font-size: 16px;
    padding: 6px 8px;
  }
  
  /* Main layout - stack sidebar and content */
  main {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
  }
  
  /* Sidebar - make it collapsible */
  .sidebar {
    position: relative;
    top: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    margin-bottom: 0;
  }
  
  .sidebar.active {
    max-height: 1000px;
    margin-bottom: 12px;
  }
  
  /* Content adjustments */
  .content {
    padding: 12px;
    min-height: auto;
  }
  
  /* Toolbar - stack vertically */
  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  
  .toolbar input,
  .toolbar select,
  .toolbar button {
    width: 100%;
    min-width: auto;
  }
  
  /* Cards - single column */
  .cards {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .card {
    min-height: auto;
    padding: 12px;
  }
  
  /* Forms - single column */
  .grid-form {
    grid-template-columns: 1fr !important;
  }
  
  /* Modals - responsive width */
  .modal {
    min-width: auto !important;
    width: 95vw !important;
    max-width: 95vw !important;
    margin: 10px;
    max-height: 90vh;
  }
  
  /* Student modal - keep wider on tablets */
  .student-modal-wide {
    min-width: min(1250px, 95vw) !important;
  }
  
  .modal header {
    padding: 16px;
  }
  
  .modal .body {
    padding: 16px;
  }
  
  .modal footer {
    padding: 12px 16px;
    flex-direction: column;
  }
  
  .modal footer .btn {
    width: 100%;
  }
  
  /* Tables - make scrollable */
  .list,
  table.list {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }
  
  .list thead,
  .list tbody,
  .list tr {
    display: table;
    width: 100%;
    table-layout: fixed;
  }
  
  .list th,
  .list td {
    padding: 8px 6px;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  /* Row actions - stack buttons */
  .row-actions {
    flex-direction: column;
    gap: 4px;
  }
  
  .row-actions .btn {
    width: 100%;
    text-align: center;
    padding: 8px;
    font-size: 12px;
  }
  
  /* Submenu grid - single column */
  .submenu-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .submenu-card {
    padding: 16px;
  }
}

/* ============================================
   MOBILE PHONES (600px and below)
   ============================================ */
@media (max-width: 600px) {
  /* Show mobile menu toggle */
  .mobile-menu-toggle {
    display: flex !important;
    order: 1;
  }
  
  /* Header - compact, prevent overflow */
  header {
    padding: 10px 12px;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    overflow-x: visible !important; /* Allow logout button to be visible */
    overflow-y: visible;
  }
  
  .brand {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    order: 2;
    overflow: hidden;
  }
  
  .brand h1 {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
  }
  
  .logo {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
  }
  
  /* Hide nav on mobile - use sidebar instead */
  nav {
    display: none !important;
  }
  
  /* Hide logout button in nav, show separate logout button */
  nav #logoutBtn {
    display: none;
  }
  
  .btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    min-width: 40px;
    width: 40px;
    height: 40px;
    font-size: 0;
    border-radius: 8px;
    position: relative;
    order: 3;
    flex-shrink: 0;
    background: #1f2937;
    border: 1px solid #334155;
    color: #e5e7eb;
    transition: all 0.2s ease;
  }
  
  .btn-logout:hover {
    background: #334155;
    border-color: #475569;
  }
  
  .btn-logout::before {
    content: '';
    display: block;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 18px;
    height: 18px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23e5e7eb' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
  }
  
  /* Notification bell on mobile - adjust size */
  .notification-bell {
    padding: 6px 8px;
    font-size: 16px;
  }
  
  /* Hide role chip and some nav buttons on mobile */
  .role-chip {
    display: none;
  }
  
  /* Sidebar - hidden by default, show when toggle clicked - full screen on mobile */
  .sidebar {
    display: block !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100vw;
    bottom: 0;
    z-index: 998;
    max-height: 100vh;
    overflow-y: auto;
    border-radius: 0;
    margin: 0;
    padding: 20px 16px;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(10px);
    border-right: none;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.5);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    visibility: visible;
    opacity: 0;
    pointer-events: none;
  }
  
  .sidebar.active {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }
  
  /* Prevent body scroll when sidebar is open */
  body.sidebar-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
  }
  
  .sidebar h3 {
    margin-top: 0;
    padding-top: 0;
    font-size: 14px;
    color: #9ca3af;
  }
  
  .sidebar .menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  
  .sidebar .menu button {
    padding: 12px 16px;
    font-size: 14px;
    border-radius: 8px;
    text-align: left;
    width: 100%;
  }
  
  .sidebar .chips {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #334155;
  }
  
  /* Main content - full width, prevent horizontal scroll */
  main {
    padding: 8px;
    grid-template-columns: 1fr;
    gap: 0;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    box-sizing: border-box;
  }
  
  .content {
    padding: 12px;
    border-radius: 8px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0;
    overflow-x: hidden;
  }
  
  /* Toolbar - very compact, prevent overlap */
  .toolbar {
    padding: 8px;
    gap: 8px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0;
  }
  
  .toolbar > * {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    flex-shrink: 0;
  }
  
  .toolbar input,
  .toolbar select {
    font-size: 14px;
    padding: 10px 12px;
    min-height: 44px; /* Touch-friendly */
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  .toolbar button {
    min-height: 44px; /* Touch-friendly */
    padding: 10px 16px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  /* Toolbar with flex row - ensure proper wrapping */
  .toolbar:not([style*="flex-direction: column"]) {
    flex-wrap: wrap;
  }
  
  /* Cards - compact, prevent overlap */
  .cards {
    gap: 8px;
    display: grid;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }
  
  .card {
    padding: 12px;
    border-radius: 8px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0;
    overflow: hidden;
  }
  
  .card h4 {
    font-size: 14px;
    margin-bottom: 8px;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  
  /* Modals - almost full screen */
  .modal {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh;
    max-height: 100vh;
    margin: 0;
    border-radius: 0;
  }
  
  /* Student modal on mobile - revert to single column grid */
  .student-form-grid {
    grid-template-columns: 1fr !important;
  }
  
  .student-modal-wide {
    min-width: auto !important;
    width: 100vw !important;
    max-width: 100vw !important;
  }
  
  .modal header {
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 10;
  }
  
  .modal header strong {
    font-size: 18px;
  }
  
  .modal .body {
    padding: 12px;
    overflow-y: auto;
  }
  
  .modal footer {
    position: sticky;
    bottom: 0;
    padding: 12px;
    border-top: 1px solid #334155;
  }
  
  /* Forms - full width fields */
  .field {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin-bottom: 12px;
  }
  
  .field input,
  .field select,
  .field textarea {
    min-height: 44px; /* Touch-friendly */
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 12px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  /* Override for login page select - prevent truncation */
  .login-container .login .field select,
  .login-container .login .field div select {
    max-width: none !important;
    padding-right: 55px !important;
  }
  
  /* Grid forms - ensure single column */
  .grid-form {
    display: grid;
    grid-template-columns: 1fr !important;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  /* Tables - card view on mobile */
  .list {
    display: block;
  }
  
  .list thead {
    display: none;
  }
  
  .list tbody {
    display: block;
  }
  
  .list tr {
    display: block;
    background: #0b1220;
    border: 1px solid #1f2937;
    border-radius: 8px;
    margin-bottom: 8px;
    padding: 12px;
  }
  
  .list td {
    display: block;
    padding: 6px 0;
    text-align: left;
    border: none;
    white-space: normal;
  }
  
  .list td:before {
    content: attr(data-label) ": ";
    font-weight: 600;
    color: #9ca3af;
    display: inline-block;
    min-width: 100px;
  }
  
  /* Buttons - touch-friendly, prevent overlap */
  .btn {
    min-height: 44px;
    padding: 12px 16px;
    font-size: 16px;
    touch-action: manipulation;
    box-sizing: border-box;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  
  .btn-sm {
    min-height: 36px;
    padding: 8px 12px;
    font-size: 14px;
    box-sizing: border-box;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  
  /* Row actions - ensure proper spacing */
  .row-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
  }
  
  .row-actions .btn {
    width: 100%;
    max-width: 100%;
  }
  
  /* Dashboard specific */
  #dashboard {
    padding: 12px;
    margin: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }
  
  #dashboard h2,
  #students h2,
  #seatViewer h2,
  #seatConfiguration h2,
  #userManagement h2,
  #permissions h2,
  #ratePlans h2,
  #studentSubscriptions h2,
  #paymentHistory h2,
  #dueFeeTracking h2,
  #reports h2,
  #utilizationReport h2,
  #revenueReport h2 {
    font-size: 20px;
    margin: 0 0 16px 0 !important;
    padding: 0 !important;
  }
  
  #dashboard .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 12px;
    margin-bottom: 16px;
  }
  
  #dashboard .toolbar .btn {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    text-align: center;
  }
  
  #dashCards {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0;
  }
  
  #dashCards .card {
    min-height: auto;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }
  
  #dashCards .card h4 {
    font-size: 11px;
    margin-bottom: 6px;
    text-align: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
    width: 100%;
  }
  
  #dashCards .card > div {
    font-size: 18px !important;
    text-align: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
    width: 100%;
  }
  
  /* Utilization Report Cards - Mobile Responsive */
  #utilReportCards {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0;
  }
  
  #utilReportCards .card {
    min-height: auto;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }
  
  #utilReportCards .card h4 {
    font-size: 11px;
    margin-bottom: 6px;
    text-align: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
    width: 100%;
  }
  
  #utilReportCards .card .value {
    font-size: 18px !important;
    text-align: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
    width: 100%;
  }
  
  /* Widget sections on mobile */
  .widget-section {
    margin: 20px 0 16px 0;
  }
  
  .widget-section h3 {
    font-size: 14px;
    padding: 10px 12px;
    margin-bottom: 12px;
  }
  
  .widget-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 16px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0;
    display: grid;
  }
  
  .widget-section .card {
    padding: 10px 6px;
    min-height: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }
  
  .widget-section .card h4 {
    font-size: 10px;
    margin-bottom: 4px;
    text-align: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
    width: 100%;
  }
  
  .widget-section .card .value {
    font-size: 14px;
    text-align: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
    width: 100%;
  }
  
  /* Recent Activity section */
  #dashboard h3 {
    font-size: 16px;
    padding: 10px 12px;
    margin: 20px 0 12px 0;
  }
  
  #activityTable {
    font-size: 12px;
    border-radius: 8px;
    overflow: hidden;
  }
  
  #activityTable {
    display: block;
    width: 100%;
    overflow-x: hidden;
  }
  
  #activityTable thead {
    display: none;
  }
  
  #activityTable tbody {
    display: block;
    width: 100%;
  }
  
  #activityTable tr {
    display: block;
    background: #0b1220;
    border: 1px solid #1f2937;
    border-radius: 8px;
    margin-bottom: 8px;
    padding: 12px;
    width: 100%;
    box-sizing: border-box;
  }
  
  #activityTable td {
    display: block;
    padding: 6px 0;
    text-align: left;
    border: none;
    white-space: normal;
    width: 100%;
    box-sizing: border-box;
  }
  
  #activityTable td:first-child {
    font-weight: 600;
    color: #9ca3af;
    font-size: 11px;
    margin-bottom: 4px;
  }
  
  #activityTable td:nth-child(2) {
    font-weight: 600;
    color: #60a5fa;
    font-size: 13px;
    margin-bottom: 4px;
  }
  
  #activityTable td:nth-child(3) {
    color: #cbd5e1;
    font-size: 13px;
    line-height: 1.4;
  }
  
  #activityTable td:before {
    display: none;
  }
  
  /* Reports specific */
  #reports {
    padding: 12px;
    margin: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }
  
  #reportCards {
    grid-template-columns: 1fr;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0;
  }
  
  #reports .toolbar {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  /* Seat Viewer toolbar */
  #seatViewer {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }
  
  #seatViewer .toolbar {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  #seatViewer .toolbar .date-input-wrapper {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  #seatViewer .toolbar input[type="date"],
  #seatViewer .toolbar select {
    width: 100%;
    max-width: 100%;
    min-height: 44px;
    box-sizing: border-box;
  }
  
  /* Payments page */
  #payments {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }
  
  #payments .toolbar {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  /* Users page */
  #users {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }
  
  #users .toolbar {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  /* Students page */
  #students {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }
  
  #students .toolbar {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  /* Student table container - full width, prevent horizontal scroll */
  .student-table-container {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
  }
  
  /* Ensure table doesn't exceed viewport */
  #studentTable {
    max-width: 100%;
    box-sizing: border-box;
  }
  
  /* Pagination - stack on mobile */
  #studentPagination {
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }
  
  .pagination-btn {
    min-height: 44px;
    padding: 10px 16px;
  }
  
  /* Export dropdown - full width */
  .export-dropdown {
    width: 100%;
  }
  
  .export-menu {
    width: 100%;
    left: 0;
    right: 0;
  }
  
  /* Additional fixes for common overlap issues */
  
  /* Ensure all sections are properly contained */
  section,
  .section {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }
  
  /* Only add padding if section doesn't already have it */
  section:not([style*="padding"]):not(.content),
  .section:not([style*="padding"]):not(.content) {
    padding: 12px;
  }
  
  /* Fix any inline-flex or flex containers */
  .flex,
  [style*="display: flex"],
  [style*="display:inline-flex"] {
    flex-wrap: wrap;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  /* Ensure all images and media don't overflow */
  img,
  video,
  iframe {
    max-width: 100%;
    height: auto;
    box-sizing: border-box;
  }
  
  /* Fix any absolute positioned elements that might overflow */
  [style*="position: absolute"] {
    max-width: 100vw;
  }
  
  /* Ensure text doesn't cause horizontal scroll */
  h1, h2, h3, h4, h5, h6,
  p, span, div, a {
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
  }
  
  /* Fix any table containers */
  .table-container,
  .table-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
  }
}

/* ============================================
   VERY SMALL MOBILE (480px and below)
   ============================================ */
@media (max-width: 480px) {
  /* Even more compact */
  header {
    padding: 6px 8px;
  }
  
  .brand h1 {
    font-size: 11px;
  }
  
  nav .tab {
    font-size: 11px;
    padding: 5px 8px;
  }
  
  main {
    padding: 6px;
  }
  
  .content {
    padding: 6px;
  }
  
  .card {
    padding: 10px;
  }
  
  .card h4 {
    font-size: 13px;
  }
  
  /* Login page */
  .login {
    padding: 24px 16px;
    margin: 12px;
  }
  
  .login h2 {
    font-size: 24px;
  }
  
  /* Hide some decorative elements */
  .legend {
    font-size: 11px;
  }
  
  .badge {
    font-size: 11px;
    padding: 3px 6px;
  }
}

/* ============================================
   LANDSCAPE MOBILE ORIENTATION
   ============================================ */
@media (max-width: 900px) and (orientation: landscape) {
  .modal {
    max-height: 95vh;
  }
  
  .modal .body {
    max-height: calc(95vh - 120px);
    overflow-y: auto;
  }
  
  .sidebar {
    max-height: calc(100vh - 80px);
    overflow-y: auto;
  }
}

/* ============================================
   TOUCH-FRIENDLY IMPROVEMENTS
   ============================================ */
@media (hover: none) and (pointer: coarse) {
  /* Touch devices */
  .btn,
  .tab,
  .submenu-item,
  .submenu-card {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Increase tap targets */
  .row-actions .btn {
    min-height: 40px;
  }
  
  /* Remove hover effects on touch devices */
  .btn:hover,
  .tab:hover {
    transform: none;
  }
  
  /* Better focus states for touch */
  .btn:active,
  .tab:active {
    opacity: 0.8;
    transform: scale(0.98);
  }
}