/* Shared layout constraints keep wide tables inside their own scroll region. */
.app-shell { grid-template-columns: 250px minmax(0, 1fr); }
.main-content, .panel, .field, .toolbar, .page-header > *, .topbar-actions { min-width: 0; }
.field input, .field select, .field textarea { max-width: 100%; min-width: 0; width: 100%; }
.mobile-tools-toggle, .mobile-bottom-nav, .mobile-nav-close, .mobile-context, .mobile-calendar-date { display: none; }
.mobile-overlay[hidden] { display: none; }
.mobile-overlay { position: fixed; inset: 0; border: 0; background: rgb(0 25 55 / 45%); z-index: 39; }
.brand picture { display: flex; align-items: center; }

@media (max-width: 1100px) {
  .topbar { height: calc(68px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left)); gap: 10px; z-index: 42; }
  .mobile-menu, .mobile-tools-toggle { display: grid; place-items: center; flex: 0 0 auto; width: 44px; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--navy); }
  .mobile-tools-toggle { width: 66px; margin-left: auto; font-size: 12px; font-weight: 700; }
  .brand { min-width: 0; flex: 1; gap: 9px; }
  .brand img { width: 50px; height: 46px; object-fit: contain; border: 0; padding: 0; }
  .brand span { font-size: 14px; white-space: normal; letter-spacing: .02em; }
  .mobile-context { display: block; color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: 0; margin-top: 3px; }
  .topbar-actions { display: none; }
  .topbar-actions.mobile-tools-open { position: absolute; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); top: 100%; right: 12px; width: min(440px, calc(100vw - 24px)); max-height: calc(100dvh - 90px - env(safe-area-inset-top)); overflow-y: auto; gap: 12px; padding: 18px; background: white; border: 1px solid var(--line); border-radius: 0 0 16px 16px; box-shadow: var(--shadow); }
  .topbar-actions .season-picker { display: grid !important; grid-column: span 2; width: 100%; font-size: 12px; }
  .topbar-actions .season-picker select { width: 100%; max-width: 100%; min-width: 0; min-height: 46px; font-size: 16px; }
  .topbar-actions .basin-picker { order: -2; }
  .topbar-actions .season-picker:not(.basin-picker) { order: -1; }
  .topbar-actions .icon-button { display: flex; align-items: center; gap: 8px; width: 100%; height: auto; min-height: 54px; padding: 10px; }
  .topbar-actions .icon-button::after { content: attr(aria-label); font-size: 12px; font-weight: 600; text-align: left; }
  .topbar-actions .avatar { display: none; }
  .app-shell { display: block; min-height: calc(100dvh - 68px); }
  .sidebar { position: fixed; top: calc(68px + env(safe-area-inset-top)); bottom: 0; left: 0; width: min(320px, 88vw); transform: translateX(-105%); z-index: 41; padding: 16px 16px max(24px, env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .mobile-nav-close { display: block; align-self: end; min-height: 44px; margin-bottom: 10px; border: 1px solid #7897b5; border-radius: 8px; background: transparent; color: white; padding: 8px 14px; }
  .sidebar .nav-item { flex-shrink: 0; min-height: 48px; }
  .sidebar .profile-block { padding-bottom: 16px; }
  body.mobile-panel-open { overflow: hidden; }
  .main-content { padding: 24px; }
  .page-header { flex-wrap: wrap; }
}

@media (max-width: 760px) {
  :root { --mobile-bottom-height: calc(66px + env(safe-area-inset-bottom)); }
  .main-content { padding: 20px max(12px, env(safe-area-inset-right)) calc(var(--mobile-bottom-height) + 24px) max(12px, env(safe-area-inset-left)); }
  h1 { font-size: 26px; line-height: 1.16; overflow-wrap: anywhere; }
  h2 { font-size: 20px; line-height: 1.25; }
  .lede { font-size: 14px; line-height: 1.55; }
  .panel { padding: 16px; border-radius: 14px; }
  .panel-heading { flex-wrap: wrap; align-items: flex-start; gap: 8px; }
  .panel-heading > *, .page-title-row > div { min-width: 0; }
  .panel-heading .muted { font-size: 13px; }
  .btn, .btn.small, .file-button, .club-section-tab, .icon-button { min-height: 44px; border-radius: 9px; }
  .btn, .file-button { padding: 10px 14px; white-space: normal; line-height: 1.35; text-align: center; }
  .btn.small { font-size: 13px; }
  .page-actions, .form-actions, .form-actions-buttons { gap: 8px; flex-wrap: wrap; }
  .page-actions .btn, .form-actions .btn, .form-actions-buttons .btn { flex: 1 1 140px; }
  .field input, .field select, .field textarea, .ctc-login-card input, .portal-admin-form input { font-size: 16px; min-height: 46px; }
  .field textarea { min-height: 130px; line-height: 1.5; }
  .toolbar { flex-wrap: wrap; gap: 12px; }
  .toolbar .field { flex: 1 1 100%; min-width: 0; }
  .stat-card { border-radius: 12px; padding: 14px 12px; }
  .stat-label { font-size: 12px; line-height: 1.35; }
  .stat-note { font-size: 12px; }
  .club-mini { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .club-mini button { min-height: 104px; font-size: 12px; border-radius: 10px; }
  .club-mini img { height: 46px; }
  .club-card { border-radius: 12px; }
  .club-banner { align-items: flex-start; gap: 12px; }
  .club-banner h1 { font-size: 23px; }
  .club-banner > div { min-width: 0; }
  .club-logo-frame { flex-shrink: 0; }
  .club-section-tabs { max-width: 100%; gap: 8px; padding-bottom: 10px; scroll-padding: 8px; }
  .club-section-tab { padding: 10px 13px; font-size: 14px; }
  .club-page-tools { margin-top: 18px; }
  .club-reminders { border-radius: 12px; }
  .club-reminder-actions { flex-direction: column; }
  .club-reminders button.reminder-add, .club-reminder-actions button { width: 44px; height: 44px; min-height: 44px; }
  .role-row { grid-template-columns: minmax(0, 1fr); }
  .resource-role { border-bottom: 1px solid var(--line); padding-bottom: 12px; }
  .resource-contact strong, .resource-contact a, .resource-person { font-size: 14px; }
  .senior-passport-grid, .category-settings-grid, .category-sheets, .staff-form-grid, .outlook-import-fields { grid-template-columns: minmax(0, 1fr); }
  .table-wrap { max-width: 100%; -webkit-overflow-scrolling: touch; border-radius: 10px; }
  .table-wrap table { font-size: 13px; }
  .table-wrap th, .table-wrap td { padding: 12px 10px; }
  .reporting-missions-panel table, .reporting-missions-panel tbody { display: block; width: 100%; min-width: 0; }
  .reporting-missions-panel thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .reporting-missions-panel tr { display: grid; padding: 12px; gap: 10px; border-bottom: 1px solid var(--line); }
  .reporting-missions-panel td { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px; border: 0; padding: 0; white-space: normal; overflow-wrap: anywhere; }
  .reporting-missions-panel td::before { content: attr(data-mobile-label); color: var(--muted); font-weight: 600; font-size: 12px; }
  .reporting-missions-panel td > p { grid-column: 2; margin: 0; }
  .calendar { overflow: visible; border: 0; }
  .calendar-weekdays { display: none; }
  .calendar-grid { min-width: 0; grid-template-columns: minmax(0, 1fr); gap: 10px; max-height: 580px; overflow-y: auto; padding: 2px; overscroll-behavior: contain; }
  .calendar-day { min-height: 64px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
  .calendar-day:nth-child(7n) { border-right: 1px solid var(--line); }
  .calendar-day.muted-day { display: none; }
  .calendar-day-head > strong { display: none; }
  .mobile-calendar-date { display: inline; font-size: 14px; font-weight: 700; color: var(--navy); }
  .calendar-day-head { gap: 8px; flex-wrap: wrap; }
  .calendar-forecast-select { width: 102px; min-height: 44px; font-size: 16px; }
  .calendar-add-button, .calendar-edit-button, .calendar-validate-button { width: 44px; min-height: 44px; }
  .calendar-entry { font-size: 14px; padding: 10px; line-height: 1.4; }
  .calendar-entry p, .calendar-entry small { font-size: 13px; }
  .calendar-entry-head > span { white-space: normal; }
  .calendar-source-legend { gap: 10px; font-size: 12px; }
  .outlook-import-panel .file-button { max-width: 100%; }
  .mobile-bottom-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; min-height: var(--mobile-bottom-height); padding: 5px max(8px, env(safe-area-inset-right)) calc(5px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 20px rgb(0 43 92 / 7%); }
  .mobile-bottom-nav button { display: grid; place-content: center; gap: 3px; min-height: 56px; border: 0; border-radius: 10px; color: #526b83; background: white; font-size: 11px; font-weight: 700; }
  .mobile-bottom-nav button.active { background: #e9f1fb; color: var(--navy); }
  .mobile-bottom-nav svg { width: 23px; height: 23px; margin: auto; }
  .modal-backdrop, .portal-modal-backdrop { padding: 12px; z-index: 60; }
  .modal, .portal-modal { max-height: calc(100dvh - 24px); overflow-y: auto; padding: 20px; border-radius: 14px; }
  .portal-admin-panel { padding: 16px; }
  .portal-admin-user-row, .visit-item header { flex-wrap: wrap; gap: 10px; }
  .portal-role-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toast { bottom: calc(var(--mobile-bottom-height) + 12px); max-width: calc(100% - 24px); }
  .planning-entry-panel { scroll-margin-top: 88px; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }
.file-button, .club-logo-upload { position: relative; }
.file-button input, .club-logo-upload input { width: 1px; max-width: 1px; min-width: 0; height: 1px; min-height: 0; padding: 0; border: 0; }
