/* Shared phone/tablet layout. Desktop layout remains owned by the panel styles. */
.mobile-table-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.mobile-table-scroll:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
@media (max-width: 900px) {
  html { scroll-padding-top: var(--mobile-topbar-height, 120px); }
  body:has(#topbar) { padding-top: var(--mobile-topbar-height, 120px); }
  body.mobile-nav-open { overflow: hidden; }
  #topbar { height: auto !important; min-height: 112px; padding: 10px 12px !important; display: flex; flex-wrap: wrap; align-content: center; gap: 8px; }
  #topbar .topbar-left { display: flex; flex: 1 1 100% !important; flex-wrap: wrap !important; gap: 6px 10px; padding-left: 48px; min-height: 40px; min-width: 0; }
  #topbar #pageTitle { margin: 0 !important; font-size: 15px; line-height: 1.4; max-width: 100% !important; overflow-wrap: anywhere; flex: 1 1 100%; }
  #topbar #hotelSwitcher, #topbar #panelBackLink { margin-left: 0 !important; max-width: 100%; }
  #topbar #hotelSwitcher select { width: 100%; max-width: 100% !important; min-height: 40px; }
  #topbar #hotelSwitcher { flex: 1 1 150px; }
  #topbar #panelBackLink { white-space: normal; }
  #topbar #webUiClock { display: none !important; }
  #topbar .topbar-right { flex: 1 1 100%; max-width: none !important; width: 100%; justify-content: flex-end; flex-wrap: wrap !important; gap: 4px; overflow: visible !important; }
  #topbar .language-selector { margin-right: auto; padding: 0; gap: 0; }
  #topbar .lang-btn { min-height: 44px; padding: 8px; gap: 4px; }
  #topbar .lang-btn img { width: 16px; }
  #topbar .theme-switcher button, #topbar .notification-bell, #topbar .user-menu-btn,
  #topbar #publishBtn, #topbar .topbar-help-btn { min-width: 40px; min-height: 44px; padding: 8px !important; margin: 0; }
  #topbar .topbar-help-btn { font-size: 0; }
  #topbar .topbar-help-btn i { font-size: 17px; }
  #topbar .user-menu { margin: 0 !important; padding: 0 !important; }
  #topbar .user-name { display: none; }
  #topbar .user-dropdown { max-width: calc(100vw - 24px); }
  #topbar .notification-panel { position: fixed; top: var(--mobile-topbar-height, 120px); right: 12px; left: 12px; width: auto; max-width: none; max-height: calc(100dvh - var(--mobile-topbar-height, 120px) - 16px); overflow-y: auto; }
  body .hamburger { display: block !important; position: fixed; top: 10px; left: 12px; width: 44px; height: 44px; line-height: 40px; z-index: 1102 !important; touch-action: manipulation; }
  body #sidebar { position: fixed !important; inset: 0 auto 0 0 !important; width: min(320px, calc(100vw - 52px)) !important; height: 100vh !important; height: 100dvh !important; padding-top: 64px; padding-bottom: max(24px, env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior-y: contain; transform: translateX(-100%) !important; transition: transform .2s ease; z-index: 1101 !important; }
  body #sidebar.open { transform: translateX(0) !important; }
  body #sidebar button { min-height: 44px; white-space: normal; }
  body #sidebar-overlay { z-index: 1100 !important; }
  body #sidebar-overlay.open { display: block !important; }
  body #main-wrapper { margin-left: 0 !important; width: 100%; min-width: 0; padding: 16px 12px 32px !important; overflow-x: visible; }
  #content, #overview-view, .settings-panel, #devices-container { min-width: 0; max-width: 100%; box-sizing: border-box; }
  #main-wrapper .settings-panel, #main-wrapper .channel-card { padding: 16px !important; }
  #main-wrapper .form-grid, #main-wrapper .grid2,
  #main-wrapper [style*="grid-template-columns"] { grid-template-columns: minmax(0, 1fr) !important; }
  #main-wrapper [style*="display:flex"], #main-wrapper [style*="display: flex"],
  #main-wrapper .toolbar, #main-wrapper .action-buttons, #main-wrapper .channel-page-head,
  #main-wrapper .channel-filter-bar { flex-wrap: wrap !important; gap: 8px; min-width: 0; }
  #main-wrapper input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]),
  #main-wrapper select, #main-wrapper textarea { max-width: 100% !important; min-width: 0; box-sizing: border-box; font-size: 16px; }
  #main-wrapper input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]),
  #main-wrapper select { min-height: 44px; }
  #main-wrapper button, #main-wrapper .btn { min-height: 40px; white-space: normal; touch-action: manipulation; }
  #main-wrapper img, #main-wrapper video, #main-wrapper canvas { max-width: 100%; }
  #main-wrapper pre, #main-wrapper code { white-space: pre-wrap; overflow-wrap: anywhere; }
  .mobile-table-scroll { width: 100%; border-radius: 8px; }
  .mobile-table-scroll table { display: table !important; width: 100% !important; max-width: none !important; table-layout: auto !important; }
  .mobile-table-scroll table.mobile-wide-table { min-width: 720px; }
  .mobile-table-scroll table thead { display: table-header-group !important; position: static !important; }
  .mobile-table-scroll table tbody { display: table-row-group !important; max-height: none !important; overflow: visible !important; }
  .mobile-table-scroll table tr { display: table-row !important; width: auto !important; box-shadow: none !important; border-radius: 0 !important; }
  .mobile-table-scroll table td, .mobile-table-scroll table th { display: table-cell !important; width: auto !important; padding: 10px !important; vertical-align: middle; text-align: start; }
  .mobile-table-scroll table td::before { content: none !important; }
  .modal-dialog { margin: 12px; max-width: calc(100vw - 24px) !important; }
  .modal-content, .modal-box { box-sizing: border-box; max-width: calc(100vw - 24px) !important; max-height: calc(100dvh - 24px) !important; overflow-y: auto; }
  .modal-box { width: calc(100vw - 24px) !important; padding: 16px !important; }
  .modal-box input, .modal-box select, .modal-box textarea { max-width: 100%; min-width: 0; font-size: 16px; }
  .modal-box .form-grid, .modal-box [style*="grid-template-columns"] { grid-template-columns: minmax(0, 1fr) !important; }
  .modal-box [style*="display:flex"], .modal-box [style*="display: flex"] { flex-wrap: wrap; }
  #videoManager { width: calc(100vw - 24px) !important; max-height: calc(100dvh - 24px); overflow-y: auto; box-sizing: border-box; }
  /* Management and dealer shells share panel.css, and must also fit small phones. */
  .shell .topbar { height: auto; min-height: var(--top-h); flex-wrap: wrap; padding-block: 8px; }
  .shell .topbar .search { flex: 1 1 160px; }
  .shell .toolbar > .input, .shell .toolbar > .select { min-width: 0; flex: 1 1 160px; max-width: 100%; }
  .shell .pager { flex-wrap: wrap; }
  .shell input, .shell select, .shell textarea { font-size: 16px; }
  .shell .drawer, .shell .modal { max-width: 100%; }
}
@media (max-width: 480px) {
  .login-container { padding: 24px 20px !important; }
  .login-container input, .login-container select { font-size: 16px; min-height: 44px; }
  .auth-card { padding: 24px 20px; }
  .shell .crumb { max-width: calc(100vw - 120px); }
  .shell .toolbar > .input, .shell .toolbar > .select { flex-basis: 100%; }
  .shell .modal-f, .shell .drawer-f { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  body #sidebar { transition: none; }
}
