/* MML Club Management v4.0.0
   Release-candidate hardening: mobile layouts, accessibility and contrast. */
:root { color-scheme: dark; }
html { min-width: 0; overflow-x: hidden; scroll-behavior: smooth; }
body { min-width: 0; overflow-x: hidden; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; }
img, svg, video, canvas { max-width: 100%; height: auto; }
button, input, select, textarea, a { -webkit-tap-highlight-color: transparent; }
button, [role="button"], select { touch-action: manipulation; }
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid rgba(156,255,56,.72) !important;
  outline-offset: 2px !important;
}
[hidden] { display: none !important; }

/* Global contrast guard for legacy surfaces. */
.beta-content :where(h1,h2,h3,h4,h5,h6,strong,b,label,legend),
.admin-body :where(h1,h2,h3,h4,h5,h6,strong,b,label,legend) { color: var(--mml-white, #f7faf5); }
.beta-content :where(p,span,small,li,td,th),
.admin-body :where(p,span,small,li,td,th) { text-shadow: none; }
.beta-content :where(input,select,textarea),
.admin-body :where(input,select,textarea) { min-height: 42px; font-size: 16px; }
.beta-content select option, .admin-body select option { background: #101310; color: #fff; }

/* Prevent deeply nested legacy grids from forcing viewport overflow. */
.beta-main, .beta-content, .beta-content > *, .panel, .card, .table-wrap,
.admin-shell, .admin-section, .team-card, .user-card { min-width: 0; max-width: 100%; }
.beta-content :where(.dashboard-grid,.grid,.cards,.cockpit-grid,.finance-grid,.preseason-grid) { min-width: 0; }
.beta-content :where(.table-wrap,.squad-beta2-table-wrap) { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Mobile navigation and dashboard. */
@media (max-width: 820px) {
  .beta-topbar { min-height: 66px; height: auto; padding: 10px 14px; gap: 10px; position: sticky; top: 0; z-index: 30; }
  .topbar-leading { min-width: 0; }
  .topbar-leading h1 { max-width: 44vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 16px; }
  .topbar-kicker { display: none; }
  .beta-tools { margin-left: auto; gap: 7px; }
  .language-control > span { display: none; }
  .language-control select { min-width: 64px; padding: 8px 22px 8px 8px; }
  .logout-button { width: 40px; min-width: 40px; overflow: hidden; white-space: nowrap; font-size: 0 !important; }
  .logout-button::before { content: "↪"; font-size: 18px; }
  .beta-content { padding: 18px 14px calc(42px + env(safe-area-inset-bottom)); }
  .dashboard-welcome { display: grid; gap: 12px; }
  .dashboard-welcome-meta { justify-content: flex-start; }
  .dashboard-quick-stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .beta-content :where(.dashboard-grid,.cockpit-grid,.finance-grid,.preseason-grid) { grid-template-columns: 1fr !important; }
  .beta-sidebar { padding-bottom: env(safe-area-inset-bottom); }
}
@media (max-width: 520px) {
  .dashboard-quick-stats { grid-template-columns: 1fr; }
  .dashboard-quick-stats article { padding: 15px; }
  .dashboard-welcome h2 { font-size: 25px; }
  .beta-content .panel, .beta-content .card { padding: 14px !important; }
  .beta-content :where(button,.primary,.ghost) { min-height: 44px; }
}

/* Squad workspace mobile hardening. */
@media (max-width: 620px) {
  .squad-beta2-header { padding: 15px; border-radius: 12px; }
  .squad-beta2-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .squad-beta2-actions > * { width: 100%; min-width: 0; }
  .squad-filter { grid-column: 1 / -1; }
  .squad-beta2-table-wrap { border-radius: 10px !important; }
  .squad-beta2-table thead th:first-child, .squad-beta2-table tbody td:first-child { position: static !important; box-shadow: none !important; }
}

/* Landing/auth mobile tests. */
.site-nav, .landing-main, .hero-grid, .auth-card, .hero { min-width: 0; }
@media (max-width: 900px) {
  .site-header { position: sticky; top: 0; z-index: 20; }
  .site-nav { min-height: 68px; padding-inline: 16px; }
  .nav-links { display: none; }
  .brand-copy span { display: none; }
  .language-wrap label { display: none; }
  .language-wrap select { max-width: 128px; }
  .hero-grid { grid-template-columns: 1fr !important; }
  .auth-column { order: 1; }
  .hero { order: 2; }
  .landing-main { padding-inline: 14px; }
}
@media (max-width: 520px) {
  .site-nav { gap: 8px; }
  .brand img { width: 38px; }
  .brand-copy strong { font-size: 12px; }
  .language-wrap select { width: 104px; font-size: 12px; }
  .auth-card { padding: 20px 16px; border-radius: 14px; }
  .hero h1 { font-size: clamp(34px,12vw,52px); }
  .features { grid-template-columns: 1fr !important; }
  .stats { grid-template-columns: repeat(2,1fr) !important; }
}

/* Admin Center mobile and resilience. */
.admin-body { overflow-x: hidden; }
.admin-topbar { padding-left: max(14px,env(safe-area-inset-left)); padding-right: max(14px,env(safe-area-inset-right)); }
@media (max-width: 720px) {
  .admin-topbar { position: sticky; top: 0; z-index: 30; grid-template-columns: minmax(0,1fr) auto; }
  .admin-brand { min-width: 0; }
  .admin-brand span { min-width: 0; }
  .admin-brand strong { white-space: nowrap; }
  .admin-shell { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
  .admin-hero h1 { font-size: 30px; }
  .admin-tabs { scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
  .admin-tab { min-height: 44px; }
  .actions button, .inline-form button, .identity-form button { min-height: 44px; }
  .nationality-compliance-card { align-items: flex-start; flex-direction: column; }
}

/* Safe-area spacing on modern phones. */
@supports (padding: max(0px)) {
  .site-nav { padding-left: max(16px,env(safe-area-inset-left)); padding-right: max(16px,env(safe-area-inset-right)); }
}

/* Motion accessibility. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
