/* ─────────────────────────────────────────────────────────────────
   Sally & Freya Luxury Mobile & iOS / iPhone Design System
   For Linok DevCRM PWA & Responsive Admin
   ───────────────────────────────────────────────────────────────── */

/* 1. iOS Viewport & Safe-Area Inset Core */
:root {
  --mobile-header-height: 54px;
  --mobile-bottom-nav-height: 58px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

/* Smooth Momentum Scrolling & Prevent iOS Double-Tap Zoom Quirks */
html, body {
  -webkit-overflow-scrolling: touch;
  -webkit-tap-highlight-color: transparent;
}

/* Default state for mobile backdrop and bottom dock on desktop */
.linok-mobile-backdrop {
  display: none;
}
.linok-mobile-bottom-nav {
  display: none;
}
.sidebar-mobile-close-btn {
  display: none;
}
.linok-mobile-menu-trigger {
  display: none;
}

/* =============================================================================
   SALLY 🎨 & FREYA ✨ LUXURY EXECUTIVE APP HEADER (Direct Reference Match)
   Unified across Desktop & Mobile - Pure Luxury Executive Cockpit Header
   ============================================================================= */

#header,
.linok-master-app-header {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  flex-wrap: nowrap !important;
  width: 100% !important;
  max-width: 100vw !important;
  box-sizing: border-box !important;
  height: 64px !important;
  min-height: 64px !important;
  max-height: 64px !important;
  padding: 0 24px !important;
  margin: 0 !important;
  background: rgba(6, 13, 23, 0.96) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border-bottom: 1px solid rgba(28, 54, 79, 0.8) !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 99999 !important;
  overflow: visible !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35) !important;
}

html[data-theme="light"] #header,
html[data-theme="light"] .linok-master-app-header {
  background: rgba(255, 255, 255, 0.96) !important;
  border-bottom: 1px solid #e2e8f0 !important;
  box-shadow: 0 2px 14px rgba(15, 23, 42, 0.05) !important;
}

/* Right Section (App Grid Menu & Brand Identity) */
#header #branding,
.linok-header-right {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 12px !important;
  flex: 0 1 auto !important;
  width: auto !important;
  float: none !important;
  margin: 0 !important;
  padding: 0 !important;
  text-align: right !important;
  min-width: 0 !important;
}

/* Modern 4-Square Menu Button (Exact match with reference design) */
.linok-header-menu-btn {
  width: 40px !important;
  height: 40px !important;
  border-radius: 11px !important;
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  color: #f1f5f9 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  padding: 0 !important;
  margin: 0 !important;
  outline: none !important;
}
html[data-theme="light"] .linok-header-menu-btn {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}
.linok-header-menu-btn:hover {
  background: rgba(56, 189, 248, 0.15) !important;
  border-color: #38bdf8 !important;
  color: #38bdf8 !important;
}
.linok-header-menu-btn:active {
  background: rgba(2, 132, 199, 0.25) !important;
  border-color: #38bdf8 !important;
  color: #38bdf8 !important;
  transform: scale(0.92) !important;
}

/* Brand Typography & Badges */
.linok-header-brand-block {
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  gap: 2px !important;
  line-height: 1.2 !important;
  min-width: 0 !important;
}

.linok-brand-row-top {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  white-space: nowrap !important;
}

.linok-brand-main-title {
  font-size: 15px !important;
  font-weight: 900 !important;
  color: #ffffff !important;
  text-decoration: none !important;
  letter-spacing: -0.3px !important;
}
html[data-theme="light"] .linok-brand-main-title {
  color: #0f172a !important;
}

/* Pro Version Pill (v3.4.2 Pro) */
.linok-pro-badge {
  background: rgba(56, 189, 248, 0.15) !important;
  border: 1px solid rgba(56, 189, 248, 0.35) !important;
  color: #38bdf8 !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  padding: 1.5px 6px !important;
  border-radius: 9999px !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  letter-spacing: 0.2px !important;
  line-height: 1.3 !important;
}
html[data-theme="light"] .linok-pro-badge {
  background: #e0f2fe !important;
  border-color: #bae6fd !important;
  color: #0284c7 !important;
}

/* Live Online Status Indicator */
.linok-online-pill {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  color: #34d399 !important;
  background: rgba(16, 185, 129, 0.12) !important;
  border: 1px solid rgba(16, 185, 129, 0.28) !important;
  border-radius: 9999px !important;
  padding: 1.5px 7px !important;
  line-height: 1.3 !important;
}
html[data-theme="light"] .linok-online-pill {
  background: #ecfdf5 !important;
  border-color: #a7f3d0 !important;
  color: #059669 !important;
}
.online-dot {
  width: 5px !important;
  height: 5px !important;
  border-radius: 50% !important;
  background: #10b981 !important;
  box-shadow: 0 0 6px #10b981 !important;
  display: inline-block !important;
  animation: pulse-dot 2s infinite ease-in-out !important;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.linok-brand-row-sub {
  font-size: 10.5px !important;
  font-weight: 500 !important;
  color: #64748b !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  letter-spacing: 0.4px !important;
}
html[data-theme="light"] .linok-brand-row-sub {
  color: #94a3b8 !important;
}

/* Left Section (Actions: Bell, Theme, User, Logout) */
#header #user-tools,
.linok-header-left {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 8px !important;
  flex: 0 0 auto !important;
  width: auto !important;
  float: none !important;
  margin: 0 !important;
  padding: 0 !important;
  text-align: left !important;
  white-space: nowrap !important;
}

/* Luxury Action Button Elements */
.linok-icon-action-btn {
  width: 38px !important;
  height: 38px !important;
  border-radius: 11px !important;
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #f1f5f9 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
  position: relative !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  text-decoration: none !important;
  padding: 0 !important;
  margin: 0 !important;
  outline: none !important;
}
html[data-theme="light"] .linok-icon-action-btn {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #334155 !important;
}
.linok-icon-action-btn:hover {
  background: rgba(56, 189, 248, 0.14) !important;
  border-color: #38bdf8 !important;
  color: #38bdf8 !important;
}
.linok-icon-action-btn:active {
  background: rgba(56, 189, 248, 0.22) !important;
  border-color: #38bdf8 !important;
  color: #38bdf8 !important;
  transform: scale(0.92) !important;
}

/* Notification Bell Ping Dot */
.bell-ping-dot {
  position: absolute !important;
  top: 7px !important;
  right: 8px !important;
  width: 6px !important;
  height: 6px !important;
  background: #ef4444 !important;
  border-radius: 50% !important;
  box-shadow: 0 0 6px #ef4444 !important;
}

/* Theme Icon & Button Styling */
.linok-icon-action-btn .theme-icon {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  width: 100% !important;
  height: 100% !important;
}
.linok-icon-action-btn .theme-icon svg {
  display: block !important;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), stroke 0.2s ease !important;
}
.linok-theme-action {
  color: #f59e0b !important;
}
.linok-theme-action:hover {
  background: rgba(245, 158, 11, 0.16) !important;
  border-color: #f59e0b !important;
  color: #fbbf24 !important;
}
.linok-theme-action:hover .theme-icon svg {
  transform: rotate(25deg) scale(1.12) !important;
}
html[data-theme="light"] .linok-theme-action {
  color: #6366f1 !important;
}
html[data-theme="light"] .linok-theme-action:hover {
  background: rgba(99, 102, 241, 0.12) !important;
  border-color: #6366f1 !important;
  color: #4f46e5 !important;
}

/* Logout Button */
.linok-header-logout-form {
  display: inline-flex !important;
  margin: 0 !important;
  padding: 0 !important;
}
.linok-logout-action {
  color: #fb7185 !important;
}
.linok-logout-action:hover {
  background: rgba(244, 63, 94, 0.16) !important;
  border-color: #f43f5e !important;
  color: #f43f5e !important;
}
.linok-logout-action:active {
  background: rgba(244, 63, 94, 0.25) !important;
  border-color: #f43f5e !important;
  color: #ffffff !important;
}

/* Hide raw bulky text links in header */
#header #user-tools > a:not(.linok-icon-action-btn),
#header #user-tools > strong,
#header #user-tools .language-form {
  display: none !important;
}

/* 2. Breakpoint: Tablet & Mobile (<= 992px) */
@media (max-width: 992px) {
  /* Prevent horizontal screen spill */
  html, body, #container {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    width: 100vw !important;
  }

  /* Main Flex: Stack Content vertically, NEVER side-by-side on mobile! */
  #main, #main.shifted {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    min-height: auto !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* Content area takes FULL 100% width */
  #main > #content,
  #main.shifted > #content,
  #content,
  .dashboard #content {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    flex: 1 1 100% !important;
    padding: 12px 14px calc(var(--mobile-bottom-nav-height) + var(--sab) + 30px) 14px !important;
    box-sizing: border-box !important;
  }

  /* Hide Desktop Sticky Toggle tab on mobile */
  .toggle-nav-sidebar,
  #toggle-nav-sidebar {
    display: none !important;
  }

  /* Off-canvas Nav Sidebar Drawer */
  #nav-sidebar {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: auto !important;
    width: min(320px, 86vw) !important;
    min-width: min(320px, 86vw) !important;
    max-width: min(320px, 86vw) !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    z-index: 100005 !important;
    background: rgba(9, 22, 36, 0.98) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.8) !important;
    border-left: 1px solid rgba(56, 189, 248, 0.3) !important;
    border-right: none !important;
    border-top: none !important;
    border-bottom: none !important;
    transform: translateX(105%) !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease !important;
    display: flex !important;
    flex-direction: column !important;
    padding-top: max(10px, var(--sat)) !important;
    padding-bottom: max(16px, var(--sab)) !important;
  }

  /* When Mobile Nav is Activated */
  body.linok-mobile-nav-active #nav-sidebar {
    transform: translateX(0%) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  /* Backdrop Dimmer */
  .linok-mobile-backdrop {
    display: block !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(4, 10, 18, 0.72) !important;
    backdrop-filter: blur(6px) !important;
    -webkit-backdrop-filter: blur(6px) !important;
    z-index: 100000 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.3s ease !important;
  }

  body.linok-mobile-nav-active .linok-mobile-backdrop {
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  /* Mobile Drawer Close Button */
  .sidebar-mobile-close-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 34px !important;
    height: 34px !important;
    border-radius: 9px !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: #f1f5f9 !important;
    font-size: 16px !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    margin-right: auto !important;
    margin-left: 4px !important;
  }

  /* Mobile Header Precision Refinements (<= 992px) */
  #header,
  .linok-master-app-header {
    height: 60px !important;
    min-height: 60px !important;
    max-height: 60px !important;
    padding: max(4px, var(--sat, 0px)) 12px 4px 12px !important;
  }
  #header #branding,
  .linok-header-right {
    gap: 8px !important;
  }
  .linok-header-menu-btn {
    width: 38px !important;
    height: 38px !important;
  }
  .linok-brand-main-title {
    font-size: 14px !important;
  }
  .linok-pro-badge,
  .linok-online-pill {
    font-size: 9px !important;
    padding: 1px 5px !important;
  }
  .linok-brand-row-sub {
    font-size: 9.5px !important;
  }
  #header #user-tools,
  .linok-header-left {
    gap: 5px !important;
  }
  .linok-icon-action-btn {
    width: 35px !important;
    height: 35px !important;
  }

  /* Compact screens (<= 400px) */
  @media (max-width: 400px) {
    #header,
    .linok-master-app-header {
      padding: max(4px, var(--sat, 0px)) 8px 4px 8px !important;
    }
    .linok-header-menu-btn {
      width: 34px !important;
      height: 34px !important;
    }
    .linok-brand-main-title {
      font-size: 13px !important;
    }
    .linok-pro-badge {
      font-size: 8.5px !important;
      padding: 1px 4px !important;
    }
    .linok-online-pill {
      font-size: 8.5px !important;
      padding: 1px 4px !important;
    }
    .linok-icon-action-btn {
      width: 33px !important;
      height: 33px !important;
    }
  }

  /* Narrow mobile screens (<= 360px) */
  @media (max-width: 360px) {
    .linok-logout-action {
      display: none !important;
    }
    .linok-brand-row-sub {
      display: none !important;
    }
  }

  /* Horizontal Subsystem Navbar on mobile: smooth chip strip */
  .linok-global-navbar {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    padding: 6px 10px !important;
    background: rgba(8, 18, 30, 0.85) !important;
    border-bottom: 1px solid rgba(20, 42, 66, 0.6) !important;
  }
  .linok-global-navbar::-webkit-scrollbar {
    display: none !important;
  }
  .linok-navbar-inner {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 6px !important;
    min-width: max-content !important;
  }
  .subsystem-nav-link {
    padding: 5px 10px !important;
    font-size: 12px !important;
    border-radius: 8px !important;
    white-space: nowrap !important;
  }

  /* 4. Native iOS App Bottom Navigation Dock */
  .linok-mobile-bottom-nav {
    display: flex !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: calc(var(--mobile-bottom-nav-height) + var(--sab)) !important;
    padding-bottom: var(--sab) !important;
    background: rgba(7, 19, 34, 0.96) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
    border-top: 1px solid rgba(28, 54, 79, 0.85) !important;
    z-index: 99990 !important;
    align-items: center !important;
    justify-content: space-around !important;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4) !important;
  }

  .bottom-nav-tab {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-decoration: none !important;
    color: #94a3b8 !important;
    font-size: 10.5px !important;
    font-weight: 700 !important;
    padding: 4px 8px !important;
    border-radius: 10px !important;
    transition: all 0.2s ease !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    user-select: none !important;
    flex: 1 !important;
  }
  .bottom-nav-tab.active,
  .bottom-nav-tab:hover {
    color: #38bdf8 !important;
  }
  .bottom-nav-tab.active .tab-icon {
    transform: scale(1.15) !important;
  }
  .bottom-nav-tab .tab-icon {
    font-size: 19px !important;
    line-height: 1 !important;
    margin-bottom: 3px !important;
    transition: transform 0.2s ease !important;
  }

  /* 5. Floating AI Assistant Widget FAB on mobile: Hidden (Dock tab handles invocation) */
  .linok-agent-widget-container,
  .linok-agent-launcher {
    display: none !important;
  }

  /* Drawer on mobile: bottom sheet modal */
  #linok-agent-drawer {
    width: 100vw !important;
    height: calc(100vh - 44px) !important;
    height: calc(100dvh - 44px) !important;
    max-height: calc(100dvh - 44px) !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    border-radius: 20px 20px 0 0 !important;
    border-bottom: none !important;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.7) !important;
  }

  /* 6. Dashboard / Cockpit Responsiveness */
  .cockpit-hero-banner {
    flex-direction: column !important;
    align-items: flex-start !important;
    padding: 16px !important;
    gap: 14px !important;
  }
  .hero-brand-group {
    flex-direction: row !important;
    align-items: flex-start !important;
    gap: 12px !important;
  }
  .hero-logo-box {
    width: 48px !important;
    height: 48px !important;
    flex-shrink: 0 !important;
  }
  .hero-badge-strip {
    flex-wrap: wrap !important;
    gap: 4px !important;
  }
  .hero-main-title {
    font-size: 18px !important;
    line-height: 1.4 !important;
  }
  .hero-subtitle {
    font-size: 12px !important;
  }
  .hero-quick-meta {
    width: 100% !important;
    flex-direction: column !important;
    gap: 8px !important;
  }
  .meta-card {
    width: 100% !important;
  }

  /* KPI Grid: 2 columns on mobile instead of 1 narrow squished column */
  .cockpit-kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  .kpi-card {
    padding: 12px !important;
  }
  .kpi-card-icon {
    font-size: 24px !important;
  }
  .kpi-number {
    font-size: 20px !important;
  }

  /* 7. Modules and Tables on Mobile */
  .dashboard #content-main {
    display: grid !important;
    grid-template-columns: 1fr !important;
    width: 100% !important;
    gap: 14px !important;
  }
  .module, .app-portal {
    width: 100% !important;
    margin-bottom: 12px !important;
    border-radius: 12px !important;
  }
  .module table {
    width: 100% !important;
  }

  /* Changelist & Filter Drawer on Mobile */
  #changelist {
    flex-direction: column !important;
    width: 100% !important;
  }
  #changelist-form {
    width: 100% !important;
    max-width: 100% !important;
  }
  #changelist .results {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 10px !important;
  }

  /* Compact breadcrumbs on mobile */
  .breadcrumbs {
    font-size: 11px !important;
    padding: 6px 10px !important;
    white-space: nowrap !important;
    overflow-x: auto !important;
    scrollbar-width: none !important;
  }
  .breadcrumbs::-webkit-scrollbar {
    display: none !important;
  }
}

/* 8. iPhone & Standalone PWA Dedicated Polishing */
@media all and (display-mode: standalone), (display-mode: fullscreen) {
  #header {
    padding-top: max(10px, env(safe-area-inset-top, 0px)) !important;
  }
  .linok-mobile-bottom-nav {
    padding-bottom: max(8px, env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* 9. Global Header User Tools (Sally & Freya Master Style) */
.linok-header-user-tools {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.linok-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 9999px;
  padding: 4px 12px;
  font-size: 12px;
  color: #f1f5f9;
  font-weight: 700;
  text-decoration: none;
}
.linok-user-pill .user-avatar-circle {
  font-size: 13px;
  line-height: 1;
}
.linok-theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 9px;
  padding: 5px 12px;
  color: #f1f5f9;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}
.linok-theme-toggle-btn:hover {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}
.linok-logout-form {
  display: inline-flex;
  margin: 0;
  padding: 0;
}
.linok-header-logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: #fb7185;
  border-radius: 9px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}
.linok-header-logout-btn:hover {
  background: rgba(244, 63, 94, 0.25);
  color: #ffffff;
}

/* Light Mode Overrides for Header User Tools */
html[data-theme="light"] .linok-user-pill {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}
html[data-theme="light"] .linok-theme-toggle-btn {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}
html[data-theme="light"] .linok-theme-toggle-btn:hover {
  background: #e0f2fe !important;
  border-color: #38bdf8 !important;
  color: #0284c7 !important;
}
html[data-theme="light"] .linok-header-logout-btn {
  background: #ffe4e6 !important;
  border-color: #fecdd3 !important;
  color: #e11d48 !important;
}

/* =============================================================================
   SYSTEM-WIDE LUXURY RESPONSIVE ENGINE (SALLY & FREYA DESIGN SYSTEM)
   Full RTL Mobile & Tablet Optimization across all Django Admin views & Apps
   ============================================================================= */

@media (max-width: 992px) {
  /* Container & Content Padding */
  #container {
    min-width: 0 !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }
  #content {
    padding: 14px 16px 85px !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .dashboard #content {
    padding-bottom: 95px !important;
  }

  /* Header Compact */
  #header, .linok-master-app-header {
    padding: 0 14px !important;
    height: 56px !important;
    min-height: 56px !important;
  }
  .linok-brand-row-sub, .linok-pro-badge, .linok-online-pill {
    display: none !important;
  }
  .linok-brand-main-title {
    font-size: 15px !important;
  }
  .linok-user-pill-text {
    display: none !important;
  }
  .linok-user-pill {
    padding: 6px !important;
  }
}

@media (max-width: 768px) {
  /* Forms & Changeform Fields */
  .change-form #content-main {
    width: 100% !important;
  }
  .form-row:not(tr) {
    padding: 10px 0 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
  }
  table tr.form-row,
  .tabular tr.form-row,
  .inline-related tr.form-row {
    display: table-row !important;
    flex-direction: row !important;
  }
  table tr.form-row > td,
  .tabular tr.form-row > td,
  .inline-related tr.form-row > td {
    display: table-cell !important;
  }
  .form-row label {
    width: 100% !important;
    float: none !important;
    margin-bottom: 6px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    text-align: right !important;
  }
  .form-row input[type="text"],
  .form-row input[type="password"],
  .form-row input[type="email"],
  .form-row input[type="url"],
  .form-row input[type="number"],
  .form-row input[type="tel"],
  .form-row textarea,
  .form-row select {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    font-size: 14px !important;
    border-radius: 10px !important;
    padding: 10px 12px !important;
  }
  .form-row .help {
    margin-top: 5px !important;
    font-size: 11.5px !important;
  }

  /* Django Admin Submit Row Sticky on Mobile */
  .submit-row {
    position: sticky !important;
    bottom: calc(var(--mobile-bottom-nav-height, 58px) + env(safe-area-inset-bottom, 0px) + 6px) !important;
    z-index: 999 !important;
    background: rgba(15, 23, 42, 0.95) !important;
    backdrop-filter: blur(14px) !important;
    -webkit-backdrop-filter: blur(14px) !important;
    border: 1px solid rgba(56, 189, 248, 0.3) !important;
    border-radius: 16px !important;
    padding: 12px !important;
    margin: 20px 0 10px 0 !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
  }
  .submit-row input,
  .submit-row input[type="submit"],
  .submit-row button,
  .submit-row .deletelink-box,
  .submit-row a {
    flex: 1 1 auto !important;
    margin: 0 !important;
    text-align: center !important;
    justify-content: center !important;
    min-height: 42px !important;
    display: inline-flex !important;
    align-items: center !important;
    font-size: 13px !important;
    border-radius: 10px !important;
  }

  /* Changelist & Data Tables System-wide */
  #changelist {
    width: 100% !important;
    overflow: hidden !important;
  }
  #changelist .results {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    margin-bottom: 20px !important;
    border-radius: 12px !important;
    border: 1px solid #1e293b !important;
    scrollbar-width: thin !important;
  }
  #changelist-form .actions {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    padding: 10px !important;
    background: rgba(15, 23, 42, 0.9) !important;
    border-radius: 12px !important;
    margin-bottom: 12px !important;
  }
  #changelist-form .actions label {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
  }
  #changelist-form .actions select {
    flex: 1 !important;
    border-radius: 8px !important;
    padding: 8px !important;
  }
  #changelist-form .actions button {
    border-radius: 8px !important;
    padding: 8px 16px !important;
  }

  /* Breadcrumbs */
  div.breadcrumbs {
    padding: 10px 14px !important;
    font-size: 12px !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    align-items: center !important;
    border-radius: 10px !important;
    margin-bottom: 14px !important;
    line-height: 1.5 !important;
  }

  /* Pagination */
  .paginator {
    padding: 12px !important;
    border-radius: 12px !important;
    font-size: 12px !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* Touch targets minimum size */
  button, a.button, input[type="button"], input[type="submit"] {
    min-height: 38px;
  }
}



