/* AAF mobil UI/UX layer — bütün rollar üçün (PWA + mobil brauzer).
   Additiv qatdır: mövcud style.css-in üstünə yalnız mobil təkmilləşdirmələr əlavə edir. */

/* Double-tap zoom-u söndürür, scroll və pinch-to-zoom-u saxlayır. */
html,
body {
  touch-action: manipulation;
}

/* ---------- Quraşdırma banneri ---------- */
.pwa-install-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
  animation: pwa-banner-in 0.3s ease-out;
}
@keyframes pwa-banner-in {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.pwa-banner-icon { width: 44px; height: 44px; border-radius: 10px; flex: 0 0 auto; }
.pwa-banner-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.pwa-banner-text strong { font-size: 14px; color: var(--text, #0f172a); }
.pwa-banner-text span { font-size: 12.5px; color: var(--text-muted, #64748b); line-height: 1.35; }
.pwa-banner-install {
  flex: 0 0 auto;
  background: var(--primary, #2563eb);
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
  min-height: 44px;
  cursor: pointer;
}
.pwa-banner-close {
  flex: 0 0 auto;
  background: transparent;
  border: 0;
  color: var(--text-muted, #64748b);
  font-size: 16px;
  padding: 10px;
  min-width: 40px;
  min-height: 40px;
  cursor: pointer;
}
body.has-bottom-nav .pwa-install-banner {
  bottom: calc(76px + env(safe-area-inset-bottom, 0px));
}

/* ---------- Alt naviqasiya (mobil) ---------- */
.pwa-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9990;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border, #e2e8f0);
  padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.08);
}
.pwa-bottom-nav-item {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
  padding: 6px 2px;
  border: 0;
  background: transparent;
  border-radius: 12px;
  color: var(--text-muted, #64748b);
  text-decoration: none;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pwa-bottom-nav-item:active { background: var(--primary-lighter, #eff6ff); }
.pwa-bottom-nav-item.is-active { color: var(--primary, #2563eb); }
.pwa-bottom-nav-item.is-active .pwa-bn-icon { transform: scale(1.12); }
.pwa-bn-icon { position: relative; font-size: 20px; line-height: 1; transition: transform 0.15s ease; }
.pwa-bn-badge {
  position: absolute;
  top: -4px;
  right: -10px;
  background: var(--danger, #dc2626);
  color: #fff;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  padding: 3px 5px;
  min-width: 15px;
  text-align: center;
}
.pwa-bn-label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}
body.has-bottom-nav { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important; }
body.has-bottom-nav main:last-child,
body.has-bottom-nav .container:last-child,
body.has-bottom-nav .page-container:last-child {
  margin-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
}

/* ---------- Menyu vərəqi (bottom sheet) ---------- */
.pwa-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 9994;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.pwa-sheet-overlay.is-open { opacity: 1; pointer-events: auto; }
.pwa-menu-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9995;
  background: #fff;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.25);
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  transform: translateY(105%);
  transition: transform 0.26s cubic-bezier(0.32, 0.72, 0, 1);
}
.pwa-menu-sheet.is-open { transform: translateY(0); }
body.pwa-sheet-lock { overflow: hidden; }
.pwa-sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: var(--border-strong, #cbd5e1);
  margin: 4px auto 6px;
  flex: 0 0 auto;
}
.pwa-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 2px 10px;
  flex: 0 0 auto;
}
.pwa-sheet-header strong { font-size: 16px; color: var(--text, #0f172a); }
.pwa-sheet-close {
  background: var(--bg-secondary, #f1f5f9);
  border: 0;
  border-radius: 999px;
  width: 34px;
  height: 34px;
  font-size: 14px;
  color: var(--text-muted, #64748b);
  cursor: pointer;
}
.pwa-sheet-list {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: grid;
  gap: 4px;
  flex: 1 1 auto;
}
.pwa-sheet-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  min-height: 48px;
  border-radius: 12px;
  color: var(--text, #0f172a);
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
}
.pwa-sheet-item:active { background: var(--bg-secondary, #f1f5f9); }
.pwa-sheet-item.is-active { background: var(--primary-lighter, #eff6ff); color: var(--primary, #2563eb); }
.pwa-sheet-icon { font-size: 20px; width: 28px; text-align: center; flex: 0 0 auto; }
.pwa-sheet-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pwa-sheet-badge {
  flex: 0 0 auto;
  background: var(--danger, #dc2626);
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  min-width: 20px;
  text-align: center;
}
.pwa-sheet-footer {
  flex: 0 0 auto;
  border-top: 1px solid var(--border-light, #f1f5f9);
  margin-top: 8px;
  padding-top: 10px;
  display: grid;
  gap: 10px;
}
.pwa-sheet-lang {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted, #64748b);
}
.pwa-sheet-lang span { flex: 1 1 auto; }
.pwa-lang-btn {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 8px 16px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--text, #0f172a);
  text-decoration: none;
}
.pwa-lang-btn.is-active {
  border-color: var(--primary, #2563eb);
  color: var(--primary, #2563eb);
  background: var(--primary-lighter, #eff6ff);
}
.pwa-sheet-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  border-radius: 12px;
  background: var(--danger-lighter, #fef2f2);
  color: var(--danger, #dc2626);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
}
.pwa-sheet-logout:active { background: var(--danger-light, #fecaca); }

/* ---------- Mobil UI/UX təkmilləşdirmələri ---------- */
@media (max-width: 768px) {
  /* Alt naviqasiya aktivdirsə üst menyu gizlədilir — yalnız bir menyu qalır */
  body.pwa-mobile-nav .app-navbar { display: none !important; }

  /* iOS zoom-un qarşısı: input font-size >= 16px */
  input[type="text"], input[type="email"], input[type="password"], input[type="number"],
  input[type="tel"], input[type="date"], input[type="datetime-local"], input[type="time"],
  input[type="search"], select, textarea {
    font-size: 16px !important;
    min-height: 44px;
  }

  /* Toxunma hədəfləri */
  button, .btn, a.btn, input[type="submit"], input[type="button"] {
    min-height: 44px;
  }

  /* === "1 hərf alt-alta" düzəlişi ===
     word-break:break-word / break-all cədvəl sütunlarının min-content enini
     1 simvola endirir → uzun ad/email şaquli yazılır. Mobil ekranda bunları
     ləğv edirik; uzun sözlər yalnız sətrə sığmayanda qırılır, cədvəllər isə
     sıxılmaq əvəzinə üfüqi sürüşür. */
  table td, table th,
  .table td, .table th {
    word-break: normal !important;
    overflow-wrap: break-word;
  }
  td, th { white-space: normal; }

  /* pwa.js geniş cədvəlləri bu konteynerə bükür */
  .pwa-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    scrollbar-width: thin;
  }
  .pwa-table-scroll > table { min-width: max-content; max-width: none; }

  .table-wrap, .table-responsive, .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  table { font-size: 14px; }
  th, td { padding: 8px 10px; }

  /* Uzun email/ad dəyərləri üçün: yalnız daşanda qır, min-content-i sıxma */
  .card, .btn, dd, p, li { overflow-wrap: break-word; }

  /* Modallar tam enə yaxın */
  .modal, [class*="modal-dialog"], [class*="modal-content"] { max-width: calc(100vw - 24px); }

  /* Konteyner boşluqları */
  .container, .page-container, main { padding-left: 12px; padding-right: 12px; }

  h1 { font-size: 1.45rem; }
  h2 { font-size: 1.2rem; }
}

@media (min-width: 769px) {
  .pwa-bottom-nav, .pwa-menu-sheet, .pwa-sheet-overlay { display: none; }
  body.has-bottom-nav { padding-bottom: 0 !important; }
  body.has-bottom-nav main:last-child,
  body.has-bottom-nav .container:last-child,
  body.has-bottom-nav .page-container:last-child { margin-bottom: 0; }
}

/* ---------- Standalone (quraşdırılmış app) rejimi ---------- */
html.pwa-standalone {
  overscroll-behavior-y: none;
}
html.pwa-standalone .app-navbar {
  padding-top: env(safe-area-inset-top, 0px);
}

/* ---------- break-all neytrallaşdırması (mobil) ----------
   İnline style və view-daxili siniflərdə word-break:break-all uzun ad/email-i
   1 hərflik sütuna çevirir. Mobil ekranda: yalnız sığmayanda qır. */
@media (max-width: 768px) {
  [style*="break-all"],
  .si-row .v,
  .pv-hero .file,
  .pv-table .mono,
  .shot-details code,
  .review-link span,
  code, kbd {
    word-break: normal !important;
    overflow-wrap: anywhere;
  }
  /* Flex sətirlərdə dəyər hissəsi sıxıla bilsin (min-width:auto tələsi) */
  .si-row .v { min-width: 0; }
}

/* ---------- Coach mobile app shell ---------- */
@media (max-width: 768px) {
  body.coach-mobile-scope {
    background: var(--bg, #f8fafc);
    color: var(--text, #0f172a);
    min-height: 100vh;
  }

  body.pwa-mobile-nav.coach-mobile-scope {
    padding-top: 0 !important;
  }

  body.coach-mobile-scope .container,
  body.coach-mobile-scope .dashboard-shell,
  body.coach-mobile-scope .am-shell {
    width: 100%;
    max-width: none !important;
    margin: 0 !important;
    padding: 12px 12px calc(16px + env(safe-area-inset-bottom, 0px)) !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  body.coach-mobile-scope .container:hover {
    box-shadow: none !important;
  }

  body.coach-mobile-scope .app-footer {
    display: none !important;
  }

  body.coach-mobile-scope h1,
  body.coach-mobile-scope h2,
  body.coach-mobile-scope h3 {
    letter-spacing: 0 !important;
  }

  body.coach-mobile-scope h1 {
    font-size: 1.34rem !important;
    line-height: 1.18 !important;
  }

  body.coach-mobile-scope h2 {
    font-size: 1.08rem !important;
  }

  body.coach-mobile-scope p,
  body.coach-mobile-scope .subtext,
  body.coach-mobile-scope .entry-subtitle,
  body.coach-mobile-scope .prepare-note,
  body.coach-mobile-scope .matrix-subtitle,
  body.coach-mobile-scope .orders-subtitle,
  body.coach-mobile-scope .approval-subtitle,
  body.coach-mobile-scope .cp-section-note {
    font-size: 0.9rem;
    line-height: 1.45;
  }

  body.coach-mobile-scope .coach-hero,
  body.coach-mobile-scope .entry-hero,
  body.coach-mobile-scope .prepare-hero,
  body.coach-mobile-scope .matrix-hero,
  body.coach-mobile-scope .orders-hero,
  body.coach-mobile-scope .approval-hero,
  body.coach-mobile-scope .order-hero,
  body.coach-mobile-scope .am-hero {
    border-radius: 8px !important;
    padding: 14px !important;
    margin-bottom: 12px !important;
    border: 1px solid var(--primary-light, #dbeafe) !important;
    background: linear-gradient(135deg, #eff6ff 0%, #ffffff 100%) !important;
    color: var(--text, #0f172a) !important;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.07) !important;
  }

  body.coach-mobile-scope .am-hero .text-blue-100,
  body.coach-mobile-scope .am-hero .am-stat-label {
    color: var(--text-secondary, #475569) !important;
  }

  body.coach-mobile-scope .am-hero .am-grid.stats > div {
    background: #fff !important;
    border-color: var(--border, #e2e8f0) !important;
    border-radius: 8px !important;
  }

  body.coach-mobile-scope .coach-alert,
  body.coach-mobile-scope .entry-flash,
  body.coach-mobile-scope .prepare-flash,
  body.coach-mobile-scope .matrix-flash,
  body.coach-mobile-scope .orders-flash,
  body.coach-mobile-scope .approval-flash,
  body.coach-mobile-scope .flash-msg,
  body.coach-mobile-scope .msg,
  body.coach-mobile-scope .am-alert,
  body.coach-mobile-scope .am-note {
    border-radius: 8px !important;
    margin-bottom: 10px !important;
    box-shadow: none !important;
  }

  body.coach-mobile-scope .coach-card,
  body.coach-mobile-scope .coach-extra-section,
  body.coach-mobile-scope .coach-extra-card,
  body.coach-mobile-scope .entry-card,
  body.coach-mobile-scope .entry-empty,
  body.coach-mobile-scope .prepare-card,
  body.coach-mobile-scope .matrix-card,
  body.coach-mobile-scope .orders-card,
  body.coach-mobile-scope .approval-card,
  body.coach-mobile-scope .page-card,
  body.coach-mobile-scope .info-card,
  body.coach-mobile-scope .section-card,
  body.coach-mobile-scope .cp-card,
  body.coach-mobile-scope .cp-order,
  body.coach-mobile-scope .cp-action,
  body.coach-mobile-scope .am-card,
  body.coach-mobile-scope details {
    border-radius: 8px !important;
    border-color: var(--border, #e2e8f0) !important;
    box-shadow: 0 5px 14px rgba(15, 23, 42, 0.05) !important;
  }

  body.coach-mobile-scope .coach-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  body.coach-mobile-scope .coach-card {
    min-height: 128px !important;
    padding: 12px !important;
    gap: 8px !important;
  }

  body.coach-mobile-scope .coach-card__icon {
    width: 34px !important;
    height: 34px !important;
    border-radius: 8px !important;
    font-size: 17px !important;
  }

  body.coach-mobile-scope .coach-card__title-row h2,
  body.coach-mobile-scope .coach-extra-card strong {
    font-size: 0.94rem !important;
    line-height: 1.2 !important;
  }

  body.coach-mobile-scope .coach-card p {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.78rem !important;
    line-height: 1.35 !important;
  }

  body.coach-mobile-scope .coach-card__cta {
    font-size: 0.78rem !important;
  }

  body.coach-mobile-scope .coach-card__badge,
  body.coach-mobile-scope .pwa-bn-badge,
  body.coach-mobile-scope .pwa-sheet-badge {
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    font-size: 10px;
  }

  body.coach-mobile-scope .coach-extra-grid,
  body.coach-mobile-scope .entry-grid,
  body.coach-mobile-scope .info-grid,
  body.coach-mobile-scope .cp-grid,
  body.coach-mobile-scope .am-grid.cols-2 {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  body.coach-mobile-scope .entry-card,
  body.coach-mobile-scope .prepare-card,
  body.coach-mobile-scope .matrix-card,
  body.coach-mobile-scope .orders-card,
  body.coach-mobile-scope .approval-card,
  body.coach-mobile-scope .page-card,
  body.coach-mobile-scope .section-card,
  body.coach-mobile-scope .cp-card,
  body.coach-mobile-scope .am-card {
    padding: 12px !important;
  }

  body.coach-mobile-scope .btn,
  body.coach-mobile-scope button,
  body.coach-mobile-scope .am-btn,
  body.coach-mobile-scope .btn-link {
    min-height: 44px;
    border-radius: 8px !important;
  }

  body.coach-mobile-scope input,
  body.coach-mobile-scope select,
  body.coach-mobile-scope textarea,
  body.coach-mobile-scope .am-input,
  body.coach-mobile-scope .am-select,
  body.coach-mobile-scope .am-textarea {
    border-radius: 8px !important;
  }

  body.coach-mobile-scope .pwa-bottom-nav {
    padding-top: 5px;
    border-top-color: var(--border, #e2e8f0);
  }

  body.coach-mobile-scope .pwa-bottom-nav-item {
    min-height: 54px;
    border-radius: 8px;
  }

  body.coach-mobile-scope .pwa-bottom-nav-item.is-active {
    background: var(--primary-lighter, #eff6ff);
  }

  body.coach-mobile-scope .pwa-bn-icon {
    font-size: 19px;
  }

  body.coach-mobile-scope .pwa-bn-label {
    font-size: 10px;
    font-weight: 800;
  }

  body.coach-mobile-scope .pwa-menu-sheet {
    border-radius: 8px 8px 0 0;
  }

  body.coach-mobile-scope .pwa-sheet-item,
  body.coach-mobile-scope .pwa-lang-btn,
  body.coach-mobile-scope .pwa-sheet-logout,
  body.coach-mobile-scope .pwa-sheet-close {
    border-radius: 8px;
  }

  body.coach-mobile-scope .pwa-coach-card-table {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    border: 0 !important;
    background: transparent !important;
  }

  body.coach-mobile-scope .pwa-coach-card-table thead {
    display: none !important;
  }

  body.coach-mobile-scope .pwa-coach-card-table tbody {
    display: grid;
    gap: 10px;
  }

  body.coach-mobile-scope .pwa-coach-card-table tr {
    display: block !important;
    border: 1px solid var(--border, #e2e8f0) !important;
    border-radius: 8px !important;
    background: #fff !important;
    padding: 8px 10px !important;
    box-shadow: 0 5px 14px rgba(15, 23, 42, 0.05);
  }

  body.coach-mobile-scope .pwa-coach-card-table td {
    display: block !important;
    width: auto !important;
    min-width: 0 !important;
    border: 0 !important;
    border-bottom: 1px dashed var(--border-light, #f1f5f9) !important;
    padding: 8px 0 !important;
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: anywhere;
  }

  body.coach-mobile-scope .pwa-coach-card-table td:last-child {
    border-bottom: 0 !important;
  }

  body.coach-mobile-scope .pwa-coach-card-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    color: var(--text-muted, #64748b);
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }

  body.coach-mobile-scope .pwa-coach-card-table td:empty {
    display: none !important;
  }

  body.coach-mobile-scope .table-wrap:has(.pwa-coach-card-table) {
    overflow: visible !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
  }

  body.coach-mobile-scope .matrix label,
  body.coach-mobile-scope .grid-table tr,
  body.coach-mobile-scope .am-request-row {
    border-radius: 8px !important;
  }

  body.coach-mobile-scope .cp-stats,
  body.coach-mobile-scope .coach-mobile-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  body.coach-mobile-scope .cp-stat,
  body.coach-mobile-scope .coach-mobile-stat {
    border-radius: 8px !important;
    padding: 10px 6px !important;
  }

  body.coach-mobile-scope .cp-stat strong,
  body.coach-mobile-scope .coach-mobile-stat strong {
    font-size: 1.24rem !important;
  }

  body.coach-mobile-scope .cp-actions {
    grid-template-columns: 1fr 1fr !important;
  }
}

@media (max-width: 420px) {
  body.coach-mobile-scope .coach-card-grid,
  body.coach-mobile-scope .cp-actions {
    grid-template-columns: 1fr !important;
  }
}

/* ---------- Athlete and organizer mobile app shell ---------- */
@media (max-width: 768px) {
  body.athlete-mobile-scope,
  body.organizer-mobile-scope {
    background: var(--bg, #f8fafc);
    color: var(--text, #0f172a);
    min-height: 100vh;
  }

  body.athlete-mobile-scope .app-footer,
  body.organizer-mobile-scope .app-footer {
    display: none !important;
  }

  body.athlete-mobile-scope .athlete-shell,
  body.organizer-mobile-scope .container,
  body.organizer-mobile-scope .page-container,
  body.organizer-mobile-scope .admin-main,
  body.organizer-mobile-scope main {
    width: 100%;
    max-width: none !important;
    margin: 0 !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  body.organizer-mobile-scope .admin-main {
    margin-left: 0 !important;
    padding-top: 10px !important;
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body.organizer-mobile-scope .admin-sidebar,
  body.organizer-mobile-scope #adminSidebar,
  body.organizer-mobile-scope #sidebarToggle,
  body.organizer-mobile-scope #sidebarOverlay {
    display: none !important;
  }

  body.organizer-mobile-scope .max-w-7xl,
  body.organizer-mobile-scope .max-w-6xl,
  body.organizer-mobile-scope .max-w-5xl,
  body.organizer-mobile-scope .max-w-4xl,
  body.organizer-mobile-scope .mx-auto {
    max-width: none !important;
    width: 100% !important;
  }

  body.athlete-mobile-scope h1,
  body.organizer-mobile-scope h1 {
    font-size: 1.35rem !important;
    line-height: 1.18 !important;
    letter-spacing: 0 !important;
  }

  body.athlete-mobile-scope h2,
  body.organizer-mobile-scope h2 {
    font-size: 1.08rem !important;
    letter-spacing: 0 !important;
  }

  body.athlete-mobile-scope .athlete-dashboard {
    grid-template-columns: 84px minmax(0, 1fr) !important;
    gap: 12px !important;
    align-items: center !important;
    text-align: left !important;
    padding: 14px !important;
    border-radius: 8px !important;
  }

  body.athlete-mobile-scope .athlete-photo {
    width: 78px !important;
    height: 78px !important;
    border-width: 3px !important;
  }

  body.athlete-mobile-scope .athlete-photo-fallback {
    font-size: 25px !important;
  }

  body.athlete-mobile-scope .athlete-id-line {
    justify-content: flex-start !important;
    margin-bottom: 10px !important;
  }

  body.athlete-mobile-scope .athlete-metric-grid,
  body.athlete-mobile-scope .athlete-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  body.athlete-mobile-scope .athlete-metric,
  body.athlete-mobile-scope .athlete-stat {
    min-height: 72px !important;
    padding: 10px !important;
    border-radius: 8px !important;
  }

  body.athlete-mobile-scope .athlete-metric strong,
  body.athlete-mobile-scope .athlete-stat strong {
    font-size: 1rem !important;
  }

  body.athlete-mobile-scope .athlete-page-hero,
  body.athlete-mobile-scope .athlete-hero,
  body.athlete-mobile-scope .athlete-section,
  body.athlete-mobile-scope .next-start-card,
  body.organizer-mobile-scope .oc-hero,
  body.organizer-mobile-scope .oc-toolbar,
  body.organizer-mobile-scope .oc-card,
  body.organizer-mobile-scope .oc-stat,
  body.organizer-mobile-scope .oc-mini,
  body.organizer-mobile-scope .adm-card,
  body.organizer-mobile-scope .adm-quick-card,
  body.organizer-mobile-scope .card,
  body.organizer-mobile-scope details {
    border-radius: 8px !important;
    box-shadow: 0 5px 14px rgba(15, 23, 42, 0.05) !important;
  }

  body.athlete-mobile-scope .athlete-page-hero,
  body.athlete-mobile-scope .athlete-hero,
  body.organizer-mobile-scope .oc-hero {
    padding: 14px !important;
    border: 1px solid var(--primary-light, #dbeafe) !important;
    background: linear-gradient(135deg, #eff6ff 0%, #ffffff 100%) !important;
    color: var(--text, #0f172a) !important;
  }

  body.organizer-mobile-scope .oc-hero .btn-ghost-on-dark,
  body.organizer-mobile-scope .oc-hero .btn-white {
    border-radius: 8px !important;
    min-height: 44px;
  }

  body.athlete-mobile-scope .athlete-section,
  body.organizer-mobile-scope .oc-card,
  body.organizer-mobile-scope .adm-card,
  body.organizer-mobile-scope .card {
    padding: 12px !important;
  }

  body.organizer-mobile-scope .oc-stats,
  body.organizer-mobile-scope .oc-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  body.organizer-mobile-scope .oc-stat,
  body.organizer-mobile-scope .oc-mini {
    padding: 10px !important;
  }

  body.organizer-mobile-scope .oc-card-head,
  body.organizer-mobile-scope .oc-toolbar,
  body.organizer-mobile-scope .oc-win-add,
  body.organizer-mobile-scope .flex.items-start,
  body.organizer-mobile-scope .flex.items-end,
  body.organizer-mobile-scope .flex.items-center {
    gap: 10px !important;
  }

  body.organizer-mobile-scope .oc-actions,
  body.organizer-mobile-scope .oc-hero-actions,
  body.organizer-mobile-scope .adm-btn,
  body.organizer-mobile-scope .btn {
    width: 100%;
  }

  body.organizer-mobile-scope .oc-actions,
  body.organizer-mobile-scope .oc-hero-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.organizer-mobile-scope .oc-actions form,
  body.organizer-mobile-scope .oc-actions .btn,
  body.organizer-mobile-scope .oc-actions button,
  body.organizer-mobile-scope .oc-hero-actions .btn,
  body.athlete-mobile-scope .athlete-action-button,
  body.athlete-mobile-scope .athlete-actions button,
  body.athlete-mobile-scope .athlete-actions .btn,
  body.athlete-mobile-scope .btn-link {
    width: 100% !important;
    justify-content: center !important;
    border-radius: 8px !important;
  }

  body.organizer-mobile-scope .oc-toolbar {
    display: grid !important;
    grid-template-columns: 1fr !important;
  }

  body.organizer-mobile-scope .oc-toolbar .oc-search {
    min-width: 0 !important;
    width: 100% !important;
  }

  body.organizer-mobile-scope .oc-filter-chips,
  body.athlete-mobile-scope .result-filter-chips,
  body.coach-mobile-scope .am-nav,
  body.organizer-mobile-scope .am-nav {
    display: flex !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  body.athlete-mobile-scope .result-toolbar {
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  body.organizer-mobile-scope .oc-chip,
  body.athlete-mobile-scope .result-filter-chip,
  body.coach-mobile-scope .am-nav a,
  body.organizer-mobile-scope .am-nav a {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: max-content !important;
    max-width: none !important;
    white-space: nowrap !important;
  }

  body.coach-mobile-scope .am-nav,
  body.organizer-mobile-scope .am-nav {
    position: sticky;
    top: 0;
    z-index: 30;
    margin-left: -2px !important;
    margin-right: -2px !important;
    padding: 4px 2px 6px !important;
    background: rgba(255, 255, 255, 0.94);
    border-radius: 8px;
  }

  body.coach-mobile-scope .am-row-builder,
  body.organizer-mobile-scope .am-row-builder {
    padding: 8px !important;
    border-radius: 8px !important;
  }

  body.coach-mobile-scope .am-request-row,
  body.organizer-mobile-scope .am-request-row {
    position: relative;
    padding-top: 34px !important;
  }

  body.coach-mobile-scope .am-request-row::before,
  body.organizer-mobile-scope .am-request-row::before {
    content: "Sorğu sətri";
    position: absolute;
    top: 8px;
    left: 10px;
    color: var(--primary, #2563eb);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
  }

  body.coach-mobile-scope .am-highlight,
  body.organizer-mobile-scope .am-highlight,
  body.coach-mobile-scope .am-note,
  body.organizer-mobile-scope .am-note {
    border-radius: 8px !important;
  }

  body.athlete-mobile-scope input,
  body.athlete-mobile-scope select,
  body.athlete-mobile-scope textarea,
  body.organizer-mobile-scope input,
  body.organizer-mobile-scope select,
  body.organizer-mobile-scope textarea {
    border-radius: 8px !important;
  }

  body.athlete-mobile-scope .target-modal-card {
    width: calc(100vw - 16px) !important;
    max-height: calc(100vh - 20px) !important;
    border-radius: 8px !important;
  }

  body.athlete-mobile-scope .target-modal-layout {
    grid-template-columns: 1fr !important;
  }

  body.athlete-mobile-scope .trend-chart-wrap {
    max-width: 100% !important;
    overflow: hidden !important;
  }

  body.athlete-mobile-scope .trend-chart-wrap svg {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  body.athlete-mobile-scope .target-canvas-frame {
    max-width: 100% !important;
  }

  body.athlete-mobile-scope .pwa-bottom-nav-item.is-active,
  body.organizer-mobile-scope .pwa-bottom-nav-item.is-active {
    background: var(--primary-lighter, #eff6ff);
  }

  body.athlete-mobile-scope .pwa-menu-sheet,
  body.organizer-mobile-scope .pwa-menu-sheet {
    border-radius: 8px 8px 0 0;
  }

  body.athlete-mobile-scope .pwa-sheet-item,
  body.athlete-mobile-scope .pwa-lang-btn,
  body.athlete-mobile-scope .pwa-sheet-logout,
  body.athlete-mobile-scope .pwa-sheet-close,
  body.organizer-mobile-scope .pwa-sheet-item,
  body.organizer-mobile-scope .pwa-lang-btn,
  body.organizer-mobile-scope .pwa-sheet-logout,
  body.organizer-mobile-scope .pwa-sheet-close {
    border-radius: 8px;
  }

  body.athlete-mobile-scope .pwa-coach-card-table,
  body.organizer-mobile-scope .pwa-coach-card-table {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    border: 0 !important;
    background: transparent !important;
  }

  body.athlete-mobile-scope .pwa-coach-card-table thead,
  body.organizer-mobile-scope .pwa-coach-card-table thead {
    display: none !important;
  }

  body.athlete-mobile-scope .pwa-coach-card-table tbody,
  body.organizer-mobile-scope .pwa-coach-card-table tbody {
    display: grid;
    gap: 10px;
  }

  body.athlete-mobile-scope .pwa-coach-card-table tr,
  body.organizer-mobile-scope .pwa-coach-card-table tr {
    display: block !important;
    border: 1px solid var(--border, #e2e8f0) !important;
    border-radius: 8px !important;
    background: #fff !important;
    padding: 8px 10px !important;
    box-shadow: 0 5px 14px rgba(15, 23, 42, 0.05);
  }

  body.athlete-mobile-scope .pwa-coach-card-table td,
  body.organizer-mobile-scope .pwa-coach-card-table td {
    display: block !important;
    width: auto !important;
    min-width: 0 !important;
    border: 0 !important;
    border-bottom: 1px dashed var(--border-light, #f1f5f9) !important;
    padding: 8px 0 !important;
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: anywhere;
  }

  body.athlete-mobile-scope .pwa-coach-card-table td:last-child,
  body.organizer-mobile-scope .pwa-coach-card-table td:last-child {
    border-bottom: 0 !important;
  }

  body.athlete-mobile-scope .pwa-coach-card-table td[data-label]::before,
  body.organizer-mobile-scope .pwa-coach-card-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    color: var(--text-muted, #64748b);
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }

  body.athlete-mobile-scope .athlete-table-wrap:has(.pwa-coach-card-table),
  body.organizer-mobile-scope .table-wrap:has(.pwa-coach-card-table),
  body.organizer-mobile-scope .overflow-x-auto:has(.pwa-coach-card-table) {
    overflow: visible !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
  }
}

@media (max-width: 420px) {
  body.athlete-mobile-scope .athlete-dashboard {
    grid-template-columns: 1fr !important;
  }

  body.athlete-mobile-scope .athlete-photo-wrap {
    justify-content: flex-start !important;
  }

  body.athlete-mobile-scope .athlete-metric-grid,
  body.athlete-mobile-scope .athlete-stat-grid,
  body.organizer-mobile-scope .oc-stats,
  body.organizer-mobile-scope .oc-stat-grid,
  body.organizer-mobile-scope .oc-actions,
  body.organizer-mobile-scope .oc-hero-actions {
    grid-template-columns: 1fr !important;
  }
}

/* ---------- Mobile login only ---------- */
@media (max-width: 560px) {
  body.login-page {
    align-items: stretch !important;
    justify-content: flex-start !important;
    padding: max(16px, env(safe-area-inset-top, 0px)) 12px 12px !important;
    background:
      linear-gradient(180deg, #eff6ff 0%, #f8fafc 42%, #ffffff 100%) !important;
  }

  .login-shell {
    min-height: calc(100vh - 28px);
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .login-page .logo-card,
  .login-page .login-card {
    border-radius: 8px !important;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08) !important;
  }

  .login-page .logo-card {
    padding: 12px !important;
    margin-bottom: 10px !important;
  }

  .login-page .login-card {
    padding: 20px 16px !important;
  }

  .login-page .login-title {
    font-size: 1.55rem !important;
    letter-spacing: 0 !important;
  }

  .login-page .login-submit,
  .login-page input {
    min-height: 48px;
    border-radius: 8px !important;
  }
}
