/* Igraj Ragbi · Phase 3 visual foundation.
 * Small, cacheable final cascade shared by the public site, dashboards and
 * private portals. Pure presentation: no changes to application selectors/state.
 */
:root {
  color-scheme: light;
  --ir-ui-ink: #102840;
  --ir-ui-muted: #566b82;
  --ir-ui-border: #dce5ee;
  --ir-ui-surface: #f6f9fc;
  --ir-ui-navy: #071f3f;
  --ir-ui-red: #c92539;
  --ir-ui-blue: #155fba;
  --ir-ui-focus: #176bd1;
  --ir-ui-radius: 16px;
  --ir-ui-shadow: 0 12px 36px rgba(7,31,63,.075);
}
/* Visible and consistent keyboard navigation on both light and dark surfaces. */
:where(a,button,input,select,textarea,summary,[role="button"],[tabindex]):focus-visible {
  outline: 3px solid var(--ir-ui-focus);
  outline-offset: 3px;
}
:where(input,select,textarea):disabled {
  background: #f0f3f7;
  color: #5b697a;
  cursor: not-allowed;
}
:where(button,.button,.admin-button):disabled { cursor: not-allowed; }
:where(.button,.admin-button,.trial-modal-close,.modal-close):not(:disabled):active {
  transform: translateY(0);
}
/* Retain the Phase 2 pending styling; never turn an active mutation into a click target. */
:where(.button,.admin-button):is([aria-busy="true"],.ir-action-pending,.ir-admin-pending) {
  transform: none !important;
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  :where(.button,.admin-button,.club-card,.admin-panel,.info-card,.trial-modal-close,.modal-close) {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
/* Public journeys: common readable panel, form and confirmation language. */
:where(.auth-card,.contact-card,.trial-form,.info-card,.state-card) {
  border-color: var(--ir-ui-border);
  box-shadow: var(--ir-ui-shadow);
}
:where(.auth-card,.contact-card,.trial-form) :where(label,legend) { color: var(--ir-ui-ink); }
:where(.auth-card,.contact-card,.trial-form) :where(input,select,textarea):focus-visible {
  border-color: var(--ir-ui-focus);
  box-shadow: 0 0 0 4px rgba(23,107,209,.12);
}
:where(.button,.trial-modal-close,.search-back-button,.search-filter-close) {
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.club-card:focus-within { border-color: #9fc1e8; box-shadow: 0 0 0 3px rgba(23,107,209,.11),var(--ir-ui-shadow); }
:where(.training-choice,.training-group-card,.training-row) { border-color: var(--ir-ui-border); }
:where(.training-group-card,.training-schedule-card)[open] { box-shadow: var(--ir-ui-shadow); }
:where(.inline-note,.club-share-status,.public-email-typo,.auth-form [role="status"],.contact-form [role="status"]) {
  line-height: 1.6;
  overflow-wrap: anywhere;
}
/* Admin design tokens and contrast are shared between Club and Super Admin. */
body.admin-body { background: var(--ir-ui-surface); color: var(--ir-ui-ink); }
.admin-topbar { border-color: var(--ir-ui-border); }
.admin-sidebar { background: linear-gradient(180deg,#081d3a 0%,#0c2d52 100%); }
.admin-nav a { transition: background-color .16s ease, color .16s ease; }
.admin-nav a.active { background: #fff; color: #0b2e59; box-shadow: inset 3px 0 var(--ir-ui-red); }
.admin-page-head h1 { color: var(--ir-ui-ink); line-height: 1.13; }
.admin-page-head p { color: var(--ir-ui-muted); line-height: 1.65; }
:where(.admin-panel,.stat-card,.profile-summary-card,.entity-card,.training-schedule-card) {
  border-color: var(--ir-ui-border);
  box-shadow: var(--ir-ui-shadow);
}
.admin-panel { border-radius: var(--ir-ui-radius); }
.panel-head { background: linear-gradient(180deg,#fff,#fafcff); }
:where(.panel-head h2,.panel-head h3,.profile-section-head h2) { color: var(--ir-ui-ink); line-height: 1.35; }
:where(.admin-input,.admin-select,.admin-textarea) { border-color: #b9c8d9; }
:where(.admin-input,.admin-select,.admin-textarea):focus-visible {
  outline: 3px solid rgba(23,107,209,.32);
  outline-offset: 1px;
  border-color: var(--ir-ui-focus);
}
.admin-field small { line-height: 1.5; }
.admin-button { min-height: 44px; line-height: 1.35; transition: background-color .16s ease, border-color .16s ease,box-shadow .16s ease; }
.admin-button.primary:not(:disabled):hover { background: #103c69; border-color: #103c69; }
.admin-button.danger:not(:disabled):hover,.admin-button.red:not(:disabled):hover { background: #962016; border-color: #962016; }
.admin-button.green:not(:disabled):hover { background: #087147; border-color: #087147; }
:where(.admin-button.primary,.admin-button.green,.admin-button.danger,.admin-button.red):focus-visible {
  outline: 3px solid var(--ir-ui-focus); outline-offset: 3px;
}
.admin-table th { color: #425a72; }
.admin-table tbody tr:focus-within { background: #f5faff; }
.admin-tabs a:focus-visible { outline-offset: -3px; }
:where(.status-pill,.trial-appointment-badge) { line-height: 1.35; }
:where(.empty-admin,.inline-note,.ws-notice,.toast) { line-height: 1.6; overflow-wrap: anywhere; }
/* Dialog elevation, dismissal affordance and form legibility; all three share tokens. */
:where(.action-modal,.form-modal,.admin-drawer,.ws-dialog) {
  color: var(--ir-ui-ink);
  border: 1px solid var(--ir-ui-border);
  box-shadow: 0 28px 80px rgba(3,18,39,.25);
}
:where(.action-modal-head,.admin-drawer-head,.ws-modal-head) { background: #f9fbfe; }
:where(.action-modal-head h2,.admin-drawer-head h2,.ws-modal-head h2) { line-height: 1.3; }
:where(.modal-close,.ws-modal-close) {
  min-width: 44px; min-height: 44px; flex: 0 0 44px;
  display: grid; place-items: center;
  border: 1px solid var(--ir-ui-border);
  border-radius: 12px;
  background: #fff;
  color: #183754;
  font-size: 1.35rem;
  cursor: pointer;
}
:where(.modal-close,.ws-modal-close):not(:disabled):hover { background: #eaf2fb; border-color: #b8ccdf; }
:where(.modal-close,.ws-modal-close):disabled { opacity: .58; cursor: wait; }
:where(.action-modal-body,.form-modal-body,.admin-drawer-body) { line-height: 1.6; }
:where(.action-modal-actions,.admin-drawer-footer) { background: #fff; }
.toast { max-width: min(410px,calc(100vw - 24px)); border: 1px solid rgba(255,255,255,.18); font-size: .85rem; }
.toast[data-type="error"] { background: #8b2033; }
.toast[data-type="success"] { background: #11643e; }
/* Private parents and account journeys share primary focus and action touch targets. */
:where(.ticket-ack button,.ticket-actions a,[data-auth-main] button) { min-height: 44px; }
@media (max-width: 640px) {
  :where(.admin-page-head p,.admin-field small,.auth-card p,.trial-form p) { line-height: 1.6; }
  :where(.action-modal-overlay,.form-modal-overlay) { overscroll-behavior: contain; }
}

/* Phase 4: narrow viewport hardening; final cascade shared by both admin modes. */
.admin-nav-close { display: none; }

@media (max-width: 820px) {
  .admin-sidebar { height: 100dvh; overscroll-behavior-y: contain; }
  .admin-brand > div { min-width: 0; }
  .admin-nav-close {
    display: grid; place-items: center; margin-left: auto; flex: 0 0 44px;
    min-width: 44px; min-height: 44px;
    border: 1px solid rgba(255,255,255,.24); border-radius: 12px;
    color: #fff; background: rgba(255,255,255,.09);
    font-size: 1.6rem; cursor: pointer;
  }
  .admin-nav-close:hover { background: rgba(255,255,255,.19); }

}
@media (max-width: 520px) {
  /* Older fixed 400px/460px permission matrices were clipped at phone widths. */
  .admin-panel .permission-grid {
    width: 100%; min-width: 0;
    grid-template-columns: minmax(0,1fr) repeat(2,minmax(64px,76px));
    overflow-wrap: anywhere;
  }
  .admin-panel .permission-grid > div { min-width: 0; padding: 9px 6px; }
}
