/* ==========================================================================
   ATA app layer — extends ata-design-system.css (tokens + base components).
   Only layout/composition pieces live here; reuse design-system components
   (.ata-btn-*, .ata-card*, .ata-badge-*, .ata-choice, .ata-table ...) for the rest.
   ========================================================================== */

[hidden] { display: none !important; }
h1, h2, h3, h4 { margin-top: 0; }
p { margin: 0 0 var(--ata-space-3); }

/* ---------------------------------------------------------------- shells */
/* Parent PWA: sky header + bottom tab bar */
.ata-shell-parent { background: var(--ata-sky-tint); min-height: 100vh; }
.ata-parent-header {
  display: flex; align-items: center; justify-content: space-between; gap: var(--ata-space-3);
  background: var(--ata-sky); color: var(--ata-white);
  padding: var(--ata-space-3) var(--ata-space-4);
  padding-top: calc(var(--ata-space-3) + env(safe-area-inset-top, 0px));
  position: sticky; top: 0; z-index: 20;
}
.ata-parent-brand { display: flex; align-items: center; gap: var(--ata-space-2); color: var(--ata-white); font-family: var(--ata-font-display); font-weight: 700; font-size: var(--ata-text-lg); }
.ata-parent-brand:hover { text-decoration: none; }
.ata-parent-brand img { border-radius: 50%; background: var(--ata-white); }
.ata-parent-site-link {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  padding: 8px 12px; border: 1.5px solid rgba(255, 255, 255, .8); border-radius: var(--ata-radius-sm);
  color: var(--ata-white); font-family: var(--ata-font-display); font-size: var(--ata-text-sm); font-weight: 700;
}
.ata-parent-site-link:hover { background: var(--ata-white); color: var(--ata-sky-deep); text-decoration: none; }
.ata-parent-main { max-width: 640px; margin: 0 auto; padding: var(--ata-space-4) var(--ata-space-4) calc(96px + env(safe-area-inset-bottom, 0px)); }
.ata-tabbar { z-index: 30; }
.ata-tab:hover { text-decoration: none; color: var(--ata-sky-dark); }
@media (max-width: 420px) {
  .ata-parent-dashboard .ata-parent-brand span { display: none; }
}
@media (min-width: 720px) {
  .ata-tabbar { max-width: 640px; margin: 0 auto; border-radius: var(--ata-radius-lg) var(--ata-radius-lg) 0 0; }
}

/* Staff: left sidebar (desktop) / slide-in drawer (phones) + slim top strip */
:root { --ata-sidebar-w: 248px; }
.ata-sidebar {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 50; width: var(--ata-sidebar-w);
  display: flex; flex-direction: column; background: var(--ata-surface); border-right: 1px solid var(--ata-border);
  overflow: hidden;
}
.ata-sidebar-head { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; padding: var(--ata-space-4) var(--ata-space-4) var(--ata-space-3); }
/* Only the menu scrolls; the logo above and the user card below stay put. */
.ata-sidebar-nav { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 var(--ata-space-3) var(--ata-space-4); }
.ata-sidebar-group + .ata-sidebar-group { margin-top: var(--ata-space-4); }
.ata-sidebar-label { padding: 0 12px 6px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ata-muted); }
.ata-sidebar-nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; margin-bottom: 2px;
  border-radius: var(--ata-radius-md); color: var(--ata-ink-soft); font-weight: 600; font-size: var(--ata-text-sm);
}
.ata-sidebar-nav a svg { flex-shrink: 0; color: var(--ata-muted); }
.ata-sidebar-nav a:hover { background: var(--ata-sky-tint); text-decoration: none; }
.ata-sidebar-nav a.is-active { background: var(--ata-lime-tint); color: var(--ata-lime-dark); box-shadow: inset 3px 0 0 var(--ata-lime); }
.ata-sidebar-nav a.is-active svg { color: var(--ata-lime-dark); }
.ata-sidebar-foot {
  flex-shrink: 0; display: flex; align-items: center; gap: 12px;
  margin: 0 var(--ata-space-2) calc(var(--ata-space-2) + env(safe-area-inset-bottom, 0px)); padding: var(--ata-space-3);
  background: var(--ata-sky-tint); border: 1px solid var(--ata-border); border-radius: var(--ata-radius-lg);
}
.ata-sidebar-avatar {
  flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 50%;
  background: var(--ata-sky-dark); color: var(--ata-white); font-family: var(--ata-font-display); font-weight: 700; font-size: var(--ata-text-base);
  box-shadow: 0 0 0 3px var(--ata-white);
}
.ata-sidebar-who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.ata-sidebar-who strong { color: var(--ata-ink); font-size: var(--ata-text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ata-sidebar-who small { color: var(--ata-muted); font-weight: 600; font-size: var(--ata-text-xs); }
.ata-sidebar-logout {
  flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
  border: 0; border-radius: var(--ata-radius-sm); background: none; color: var(--ata-status-danger-fg); cursor: pointer;
}
.ata-sidebar-logout:hover { background: var(--ata-status-danger-bg); }
.ata-sidebar-close, .ata-sidebar-toggle {
  display: none; align-items: center; justify-content: center; width: 40px; height: 40px;
  border: 0; border-radius: var(--ata-radius-sm); background: none; color: var(--ata-ink); cursor: pointer;
}
.ata-sidebar-close:hover, .ata-sidebar-toggle:hover { background: var(--ata-sky-tint); }
.ata-sidebar-backdrop { position: fixed; inset: 0; z-index: 45; background: rgba(22, 49, 59, .45); }

.ata-staff-body { margin-left: var(--ata-sidebar-w); min-height: 100vh; display: flex; flex-direction: column; min-width: 0; }
.ata-staff-topbar { position: sticky; top: 0; z-index: 20; gap: var(--ata-space-3); padding-top: var(--ata-space-2); padding-bottom: var(--ata-space-2); }
.ata-staff-topbar-brand { display: none; }
.ata-staff-section { flex: 1; font-size: var(--ata-text-sm); font-weight: 600; color: var(--ata-muted); }
.ata-topbar-brand img { border-radius: 50%; }
.ata-topbar-brand small { font-family: var(--ata-font-body); font-weight: 600; font-size: var(--ata-text-xs); color: var(--ata-muted); margin-left: 4px; }
.ata-topbar-brand:hover { text-decoration: none; }

@media (max-width: 960px) {
  .ata-sidebar { transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--ata-shadow-lg); width: min(85vw, 300px); }
  .ata-sidebar.is-open { transform: none; }
  .ata-sidebar-close, .ata-sidebar-toggle { display: inline-flex; }
  .ata-staff-body { margin-left: 0; }
  .ata-staff-topbar { padding-left: var(--ata-space-3); padding-right: var(--ata-space-3); }
  .ata-staff-topbar-brand { display: flex; }
  .ata-staff-section { visibility: hidden; }
  body.ata-sidebar-locked { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) { .ata-sidebar { transition: none; } }

/* Staff "My profile" dropdown */
.ata-usermenu { position: relative; }
.ata-usermenu > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.ata-usermenu > summary::-webkit-details-marker { display: none; }
.ata-usermenu > summary svg { transition: transform .15s ease; }
.ata-usermenu[open] > summary svg { transform: rotate(180deg); }
.ata-usermenu > summary.is-active { box-shadow: inset 0 0 0 1.5px var(--ata-lime); }
.ata-usermenu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; min-width: 220px;
  background: var(--ata-white); border: 1px solid var(--ata-border); border-radius: var(--ata-radius-md);
  box-shadow: var(--ata-shadow-md); padding: var(--ata-space-1);
}
.ata-usermenu-who { display: flex; flex-direction: column; padding: 10px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--ata-border); font-size: var(--ata-text-sm); }
.ata-usermenu-who span { color: var(--ata-muted); font-size: var(--ata-text-xs); word-break: break-all; }
.ata-usermenu-panel a, .ata-usermenu-panel button {
  display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; background: none; cursor: pointer;
  border-radius: var(--ata-radius-sm); color: var(--ata-ink-soft); font: inherit; font-size: var(--ata-text-sm); font-weight: 600;
}
.ata-usermenu-panel a:hover, .ata-usermenu-panel button:hover { background: var(--ata-sky-tint); text-decoration: none; }
.ata-usermenu-panel a.is-active { color: var(--ata-lime-dark); background: var(--ata-lime-tint); }
.ata-usermenu-panel button[data-action="staff-logout"] { color: var(--ata-status-danger-fg); margin-top: 4px; border-top: 1px solid var(--ata-border); border-radius: 0 0 var(--ata-radius-sm) var(--ata-radius-sm); }
.ata-account-wrap { max-width: 520px; margin: 0 auto; }
.ata-terms { max-width: 820px; line-height: 1.7; color: var(--ata-ink-soft); }
.ata-terms h2 { font-family: var(--ata-font-display); font-size: var(--ata-text-lg); color: var(--ata-ink); margin: var(--ata-space-5) 0 var(--ata-space-2); }
.ata-terms ul { padding-left: 1.2em; margin: 0; }
.ata-terms li + li { margin-top: 4px; }
.ata-staff-main { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: var(--ata-space-5) var(--ata-space-4) var(--ata-space-8); }
.ata-staff-footer {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--ata-space-2) var(--ata-space-4);
  max-width: 1280px; width: 100%; margin: 0 auto; padding: var(--ata-space-4);
  border-top: 1px solid var(--ata-border); color: var(--ata-muted); font-size: var(--ata-text-xs);
}
.ata-staff-footer a { color: var(--ata-muted); }
.ata-staff-footer a:hover { color: var(--ata-sky-dark); }
.ata-plain-main { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: var(--ata-space-4); background: var(--ata-sky-tint); }

/* ---------------------------------------------------------------- page structure */
.ata-page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--ata-space-4); flex-wrap: wrap; margin-bottom: var(--ata-space-5); }
.ata-page-head .ata-h2, .ata-page-head .ata-h1 { margin-bottom: 0; }
.ata-page-head p { margin: 4px 0 0; color: var(--ata-muted); }
.ata-actions { display: flex; gap: var(--ata-space-2); flex-wrap: wrap; align-items: center; }
/* Row buttons in a table's "Action" column: one line, right-aligned */
.ata-row-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; flex-wrap: nowrap; white-space: nowrap; }
.ata-table th.ata-action-col, .ata-table td.ata-action-col { text-align: right; width: 1%; white-space: nowrap; }
.ata-section { margin-bottom: var(--ata-space-6); }
.ata-section-title { font-family: var(--ata-font-display); font-weight: 700; font-size: var(--ata-text-lg); margin: 0 0 var(--ata-space-3); display: flex; align-items: center; justify-content: space-between; gap: var(--ata-space-2); }
.ata-stack > * + * { margin-top: var(--ata-space-4); }
.ata-stack-sm > * + * { margin-top: var(--ata-space-2); }
.ata-row { display: flex; gap: var(--ata-space-3); align-items: center; flex-wrap: wrap; }
.ata-spacer { flex: 1; }
.ata-right { text-align: right; }
.ata-nowrap { white-space: nowrap; }
.ata-strong { font-weight: 700; }

.ata-grid { display: grid; gap: var(--ata-space-4); }
.ata-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ata-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ata-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ata-grid-sidebar { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
/* minmax(0, 1fr), not 1fr: a plain 1fr column grows to fit a wide table and pushes the page wider
   than the phone; with 0 the column stays screen-width and the table scrolls inside its own box. */
.ata-grid > * { min-width: 0; }
@media (max-width: 960px) { .ata-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ata-grid-3, .ata-grid-sidebar { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) { .ata-grid-2, .ata-grid-4 { grid-template-columns: minmax(0, 1fr); } }
/* Summary tiles stay two-up on phones (four full-width tiles push the content off the first screen). */
@media (max-width: 560px) {
  .ata-grid-4:has(> .ata-stat) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--ata-space-2); }
  .ata-stat { padding: var(--ata-space-3); }
  .ata-stat-value { font-size: clamp(1.05rem, 5vw, 1.4rem); white-space: nowrap; }
}

/* Stat tiles (admin/finance dashboards) */
.ata-stat { background: var(--ata-surface); border: 1px solid var(--ata-border); border-radius: var(--ata-radius-md); padding: var(--ata-space-4) var(--ata-space-5); box-shadow: var(--ata-shadow-sm); }
.ata-stat-label { font-size: var(--ata-text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ata-muted); }
.ata-stat-value { font-family: var(--ata-font-display); font-weight: 700; font-size: var(--ata-text-2xl); line-height: 1.2; margin-top: 4px; }
.ata-stat-sub { font-size: var(--ata-text-xs); color: var(--ata-muted); }
.ata-stat-accent { border-top: 3px solid var(--ata-lime); }

/* Filter toolbar above admin tables */
.ata-toolbar { display: flex; gap: var(--ata-space-2); flex-wrap: wrap; align-items: flex-end; margin-bottom: var(--ata-space-4); }
.ata-toolbar .ata-field { margin: 0; min-width: 150px; flex: 0 1 200px; }
.ata-toolbar .ata-field-grow { flex: 1 1 240px; }
.ata-toolbar .ata-label { font-size: var(--ata-text-xs); margin-bottom: 4px; color: var(--ata-muted); }
.ata-toolbar .ata-input, .ata-toolbar .ata-select { padding: 8px 12px; font-size: var(--ata-text-sm); }
@media (max-width: 560px) {
  /* filters two-up on phones, search on its own full-width line */
  .ata-toolbar .ata-field { flex: 1 1 calc(50% - var(--ata-space-2)); min-width: 0; }
  .ata-toolbar .ata-field-grow { flex-basis: 100%; }
}

.ata-table td.ata-right, .ata-table th.ata-right { text-align: right; }
.ata-table a.ata-row-link { font-weight: 700; color: var(--ata-ink); }
.ata-table .ata-sub { display: block; font-size: var(--ata-text-xs); color: var(--ata-muted); }
.ata-table tfoot td { font-weight: 700; background: var(--ata-bg); border-top: 1.5px solid var(--ata-border); }
.ata-table-empty { text-align: center; color: var(--ata-muted); padding: var(--ata-space-6) !important; }

/* Definition list for profile/detail cards */
.ata-dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px var(--ata-space-4); margin: 0; font-size: var(--ata-text-sm); }
.ata-dl dt { color: var(--ata-muted); font-weight: 600; }
.ata-dl dd { margin: 0; font-weight: 600; word-break: break-word; }

/* Sub navigation (pills) inside Setup/System hubs */
.ata-subnav { display: flex; gap: var(--ata-space-2); flex-wrap: wrap; margin-bottom: var(--ata-space-5); }
.ata-subnav a, .ata-subnav button {
  padding: 8px 16px; border-radius: var(--ata-radius-pill); border: 1.5px solid var(--ata-border-strong);
  background: var(--ata-surface); color: var(--ata-ink); font-weight: 600; font-size: var(--ata-text-sm); cursor: pointer; font-family: var(--ata-font-body);
}
.ata-subnav a:hover { text-decoration: none; border-color: var(--ata-sky); }
.ata-subnav .is-active { border-color: var(--ata-lime); background: var(--ata-lime-tint); color: var(--ata-lime-dark); }

/* Form layout */
.ata-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--ata-space-4); }
.ata-form-grid .ata-span-2 { grid-column: 1 / -1; }
@media (max-width: 560px) { .ata-form-grid { grid-template-columns: 1fr; } }
.ata-check { display: flex; gap: var(--ata-space-2); align-items: flex-start; font-size: var(--ata-text-sm); cursor: pointer; }
.ata-check input { accent-color: var(--ata-sky); width: 18px; height: 18px; margin-top: 2px; flex-shrink: 0; }
.ata-form-actions { display: flex; gap: var(--ata-space-2); justify-content: flex-end; flex-wrap: wrap; margin-top: var(--ata-space-4); }
.ata-fieldset { border: none; padding: 0; margin: 0 0 var(--ata-space-5); }
.ata-fieldset legend { font-family: var(--ata-font-display); font-weight: 700; font-size: var(--ata-text-lg); margin-bottom: var(--ata-space-3); padding: 0; }

/* Loading */
.ata-loading { display: flex; align-items: center; gap: var(--ata-space-2); justify-content: center; padding: var(--ata-space-6); color: var(--ata-muted); font-size: var(--ata-text-sm); }
.ata-spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--ata-sky-tint-2); border-top-color: var(--ata-sky); animation: ata-spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes ata-spin { to { transform: rotate(360deg); } }

/* Capacity meter */
.ata-meter { height: 8px; background: var(--ata-border); border-radius: var(--ata-radius-pill); overflow: hidden; min-width: 80px; }
.ata-meter > span { display: block; height: 100%; background: var(--ata-lime); border-radius: inherit; }
.ata-meter.is-high > span { background: var(--ata-status-warning-fg); }
.ata-meter.is-full > span { background: var(--ata-status-danger-fg); }

/* ---------------------------------------------------------------- parent-facing pieces */
.ata-hero {
  background: linear-gradient(135deg, var(--ata-sky), var(--ata-sky-dark));
  color: var(--ata-white); border-radius: var(--ata-radius-xl); padding: var(--ata-space-6) var(--ata-space-5);
  display: flex; align-items: center; gap: var(--ata-space-4); box-shadow: var(--ata-shadow-md); margin-bottom: var(--ata-space-5);
}
.ata-hero h1 { font-family: var(--ata-font-display); font-size: var(--ata-text-2xl); line-height: 1.15; margin: 0 0 var(--ata-space-2); }
.ata-hero p { margin: 0 0 var(--ata-space-4); opacity: .95; }
.ata-hero-mascot { width: 120px; aspect-ratio: 1; object-fit: cover; flex-shrink: 0; border-radius: 50%; background: var(--ata-white); }
@media (max-width: 480px) { .ata-hero { flex-direction: column-reverse; text-align: center; } .ata-hero-mascot { width: 96px; } }

.ata-greeting { font-family: var(--ata-font-display); font-weight: 700; font-size: var(--ata-text-2xl); margin: 0 0 var(--ata-space-1); }
.ata-card-parent + .ata-card-parent { margin-top: var(--ata-space-4); }
.ata-card-parent .ata-card-parent-header h3 { color: var(--ata-white); margin: 0; font-family: var(--ata-font-display); }
.ata-card-parent-header .ata-text-sm { opacity: .9; }
.ata-info-row { display: flex; justify-content: space-between; gap: var(--ata-space-3); padding: 10px 0; border-bottom: 1px dashed var(--ata-border); font-size: var(--ata-text-sm); }
.ata-info-row:last-child { border-bottom: none; }
.ata-info-row span:first-child { color: var(--ata-muted); }
.ata-info-row span:last-child { font-weight: 700; text-align: right; }
.ata-chips { display: flex; gap: var(--ata-space-2); flex-wrap: wrap; }
.ata-chip:hover { text-decoration: none; background: var(--ata-sky-tint-2); }
.ata-link-card { display: block; color: inherit; }
.ata-link-card:hover { text-decoration: none; }
.ata-child-card { display: flex; align-items: center; gap: var(--ata-space-3); }
.ata-child-card .ata-chip-avatar { width: 48px; height: 48px; font-size: var(--ata-text-base); flex-shrink: 0; }
.ata-child-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ata-child-card-body strong { font-family: var(--ata-font-display); font-size: var(--ata-text-lg); line-height: 1.25; }
.ata-child-card-chevron { color: var(--ata-sky-dark); flex-shrink: 0; }
.ata-child-card:hover { box-shadow: var(--ata-shadow-lg); }

/* Booking wizard */
.ata-stepper { display: flex; gap: 6px; margin-bottom: var(--ata-space-4); }
.ata-stepper span { flex: 1; height: 6px; border-radius: var(--ata-radius-pill); background: var(--ata-sky-tint-2); }
.ata-stepper span.is-done { background: var(--ata-lime); }
.ata-step-title { font-family: var(--ata-font-display); font-weight: 700; font-size: var(--ata-text-xl); margin: 0 0 var(--ata-space-1); }
.ata-choice-list { display: grid; gap: var(--ata-space-2); }
.ata-choice { background: var(--ata-white); }
.ata-choice-body { flex: 1; min-width: 0; }
.ata-choice-title { display: block; font-weight: 700; line-height: 1.3; }
.ata-choice-sub { display: block; font-size: var(--ata-text-sm); color: var(--ata-muted); margin-top: 2px; }
.ata-choice-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--ata-space-2); }
.ata-choice-title .ata-tag { margin-left: 6px; vertical-align: 2px; }

/* Programme-type tags — identity labels (not status), so they use brand tints, never the status colours */
.ata-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--ata-font-body); font-size: var(--ata-text-xs); font-weight: 700;
  padding: 3px 10px; border-radius: var(--ata-radius-pill); white-space: nowrap; line-height: 1.5;
}
.ata-tag svg { width: 12px; height: 12px; flex-shrink: 0; }
.ata-tag-single { background: var(--ata-sky-tint-2); color: #1A7FA3; }
.ata-tag-double { background: var(--ata-lime-tint); color: var(--ata-lime-dark); box-shadow: inset 0 0 0 1px rgba(124, 184, 63, 0.35); }
.ata-tag.is-unavailable { background: var(--ata-status-neutral-bg); color: var(--ata-muted); box-shadow: none; }
.ata-choice-aside { text-align: right; font-size: var(--ata-text-sm); white-space: nowrap; }
.ata-choice.is-full .ata-choice-aside { color: var(--ata-status-danger-fg); font-weight: 700; }
.ata-choice.is-disabled { opacity: .55; cursor: not-allowed; }
.ata-draft-banner { align-items: center; }
.ata-draft-banner .ata-btn { flex-shrink: 0; }
.ata-wizard-nav { display: flex; gap: var(--ata-space-2); margin-top: var(--ata-space-5); }
.ata-wizard-nav .ata-btn-primary { flex: 1; }
.ata-summary-total { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--ata-font-display); font-weight: 700; font-size: var(--ata-text-xl); padding-top: var(--ata-space-3); }

/* OTP code input */
.ata-code-input { font-family: var(--ata-font-display); font-size: var(--ata-text-2xl); letter-spacing: .5em; text-align: center; font-weight: 700; }

/* ---------------------------------------------------------------- coach attendance (few taps) */
.ata-roster { display: grid; gap: var(--ata-space-2); }
.ata-roster-row { display: flex; align-items: center; gap: var(--ata-space-3); background: var(--ata-surface); border: 1px solid var(--ata-border); border-radius: var(--ata-radius-md); padding: var(--ata-space-3); }
.ata-roster-name { flex: 1; min-width: 0; }
.ata-roster-name:hover { text-decoration: none; }
.ata-roster-name:hover strong { color: var(--ata-sky-dark); } /* hover cue without underline */
.ata-roster-name strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ata-roster-flag { color: var(--ata-status-danger-fg); font-size: var(--ata-text-xs); font-weight: 700; }
.ata-seg { display: inline-flex; border: 1.5px solid var(--ata-border-strong); border-radius: var(--ata-radius-sm); overflow: hidden; flex-shrink: 0; }
.ata-seg button {
  border: none; background: var(--ata-surface); min-width: 44px; min-height: 44px; font-family: var(--ata-font-display);
  font-weight: 700; font-size: var(--ata-text-base); color: var(--ata-ink-soft); cursor: pointer;
}
.ata-seg button + button { border-left: 1.5px solid var(--ata-border-strong); }
/* Attendance: word labels, compact enough for phones */
.ata-seg-attn button { min-width: 0; padding: 0 12px; font-size: var(--ata-text-sm); }
.ata-attn-head { display: flex; align-items: center; justify-content: space-between; gap: var(--ata-space-3); flex-wrap: wrap; margin-bottom: var(--ata-space-3); }
.ata-attn-progress { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 260px; }
.ata-roster-state { display: block; font-size: var(--ata-text-xs); font-weight: 600; min-height: 1em; color: var(--ata-ink-soft); }
.ata-roster-state.is-unmarked { color: var(--ata-status-warning-fg); }
.ata-roster-state.is-saved { color: var(--ata-status-success-fg); }
@media (max-width: 560px) {
  .ata-roster-row { flex-wrap: wrap; }
  .ata-roster-name { flex: 1 1 calc(100% - 110px); }
  .ata-seg-attn { width: 100%; }
  .ata-seg-attn button { flex: 1; }
}
.ata-seg button[data-status="present"].is-on { background: var(--ata-status-success-bg); color: var(--ata-status-success-fg); }
.ata-seg button[data-status="late"].is-on { background: var(--ata-status-warning-bg); color: var(--ata-status-warning-fg); }
.ata-seg button[data-status="absent"].is-on { background: var(--ata-status-danger-bg); color: var(--ata-status-danger-fg); }
.ata-icon-btn { border: none; background: transparent; width: 40px; height: 40px; border-radius: var(--ata-radius-sm); display: inline-flex; align-items: center; justify-content: center; color: var(--ata-ink-soft); cursor: pointer; }
.ata-icon-btn:hover { background: var(--ata-sky-tint); }

/* Staff login card */
.ata-auth-card { width: 100%; max-width: 420px; }
.ata-auth-card .ata-auth-logo { width: 88px; margin: 0 auto var(--ata-space-3); border-radius: 50%; }

.ata-chart-box { position: relative; height: 280px; }
.ata-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--ata-text-xs); }
.ata-pre { white-space: pre-wrap; word-break: break-word; max-height: 360px; overflow: auto; background: var(--ata-bg); padding: var(--ata-space-3); border-radius: var(--ata-radius-sm); }

@media print {
  .ata-topbar, .ata-tabbar, .ata-sidebar, .ata-sidebar-backdrop, .ata-staff-footer, .ata-toolbar, .ata-actions, .ata-btn { display: none !important; }
  .ata-staff-main { padding: 0; }
  .ata-staff-body { margin-left: 0; }
}

/* ---------------------------------------------------------------- staff new-booking wizard */
.ata-wizard-wrap { max-width: 760px; margin: 0 auto; }
.ata-steps { display: flex; gap: var(--ata-space-2); list-style: none; padding: 0; margin: 0 0 var(--ata-space-4); counter-reset: none; }
.ata-steps li { flex: 1; display: flex; align-items: center; gap: 8px; padding-top: 10px; border-top: 4px solid var(--ata-sky-tint-2); font-size: var(--ata-text-sm); font-weight: 600; color: var(--ata-muted); }
.ata-steps li span { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--ata-sky-tint-2); color: var(--ata-ink-soft); font-size: var(--ata-text-xs); font-weight: 700; flex-shrink: 0; }
.ata-steps li.is-done { border-top-color: var(--ata-lime); color: var(--ata-ink-soft); }
.ata-steps li.is-done span { background: var(--ata-lime); color: var(--ata-white); }
.ata-steps li.is-current { border-top-color: var(--ata-sky); color: var(--ata-ink); }
.ata-steps li.is-current span { background: var(--ata-sky); color: var(--ata-white); }
@media (max-width: 560px) { .ata-steps li:not(.is-current) { font-size: 0; gap: 0; } }

.ata-recap { background: var(--ata-bg); border-radius: var(--ata-radius-md); padding: 4px var(--ata-space-3); margin-bottom: var(--ata-space-5); }
.ata-recap-row { display: flex; align-items: baseline; gap: var(--ata-space-3); padding: 8px 0; font-size: var(--ata-text-sm); }
.ata-recap-row + .ata-recap-row { border-top: 1px solid var(--ata-border); }
.ata-recap-label { width: 64px; flex-shrink: 0; color: var(--ata-muted); font-weight: 600; }
.ata-recap-val { flex: 1; min-width: 0; font-weight: 600; color: var(--ata-ink); }
.ata-link-btn { border: 0; background: none; padding: 0; color: var(--ata-sky-dark); font: inherit; font-size: var(--ata-text-sm); font-weight: 600; cursor: pointer; }
.ata-link-btn:hover { text-decoration: none; color: var(--ata-ink); } /* colour change instead of underline */

.ata-found-card { display: flex; align-items: center; gap: var(--ata-space-3); padding: var(--ata-space-3) var(--ata-space-4); border: 1.5px solid var(--ata-lime); background: var(--ata-lime-tint); border-radius: var(--ata-radius-md); }
.ata-choice-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.ata-choice .ata-choice-title + .ata-choice-title { margin-top: 2px; }

.ata-more { margin: var(--ata-space-2) 0; }
.ata-more > summary { cursor: pointer; font-size: var(--ata-text-sm); font-weight: 600; color: var(--ata-sky-dark); padding: 6px 0; margin-bottom: var(--ata-space-2); }

.ata-segmented { display: flex; flex-wrap: wrap; gap: var(--ata-space-2); }
.ata-segmented label { position: relative; padding: 8px 14px; border: 1.5px solid var(--ata-border-strong); border-radius: var(--ata-radius-pill); font-size: var(--ata-text-sm); font-weight: 600; cursor: pointer; background: var(--ata-white); }
.ata-segmented label:hover { border-color: var(--ata-sky); }
.ata-segmented label.is-selected { border-color: var(--ata-sky); background: var(--ata-sky-tint); color: var(--ata-ink); }
.ata-segmented input { position: absolute; opacity: 0; pointer-events: none; }
.ata-segmented label:has(input:focus-visible) { box-shadow: var(--ata-shadow-focus); }

.ata-pay-summary { background: var(--ata-bg); border-radius: var(--ata-radius-md); padding: 4px var(--ata-space-3); margin-top: var(--ata-space-3); }

/* Setup → staff form: classes already held by another coach */
.ata-class-picks { gap: 6px; }
.ata-class-picks .ata-check.is-taken { cursor: not-allowed; color: var(--ata-muted); }
.ata-class-owner { display: block; font-size: var(--ata-text-xs); font-weight: 600; color: var(--ata-status-warning-fg); }

/* ---------------------------------------------------------------- financial statement */
.ata-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--ata-space-3); flex-wrap: wrap; margin-bottom: var(--ata-space-3); }
.ata-card-head .ata-section-title { margin: 0; }
.ata-legend { display: flex; gap: var(--ata-space-4); font-size: var(--ata-text-sm); color: var(--ata-ink-soft); }
.ata-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ata-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.ata-chart-tall { height: 320px; }
.ata-neg { color: var(--ata-status-danger-fg); }

.ata-statement { width: 100%; border-collapse: collapse; font-size: var(--ata-text-sm); font-variant-numeric: tabular-nums; }
.ata-statement td, .ata-statement th { padding: 7px 0; text-align: left; }
.ata-statement td:last-child { text-align: right; white-space: nowrap; padding-left: var(--ata-space-3); }
.ata-statement td:first-child { padding-left: var(--ata-space-3); color: var(--ata-ink-soft); }
.ata-statement tr.is-group th { padding-top: var(--ata-space-4); font-size: var(--ata-text-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--ata-muted); }
.ata-statement tr.is-group:first-child th { padding-top: 0; }
.ata-statement tr.is-sub td { border-top: 1px solid var(--ata-border); }
.ata-statement tr.is-total td { border-top: 1px solid var(--ata-border); font-weight: 700; color: var(--ata-ink); }
.ata-statement tr.is-total td:first-child, .ata-statement tr.is-grand td:first-child { padding-left: 0; }
.ata-statement tr.is-grand td { border-top: 2px solid var(--ata-ink); border-bottom: 2px solid var(--ata-ink); padding: 10px 0; font-family: var(--ata-font-display); font-size: var(--ata-text-lg); font-weight: 700; color: var(--ata-ink); }
.ata-statement tr.is-grand.is-loss td:last-child { color: var(--ata-status-danger-fg); }

.ata-barlist { display: grid; gap: var(--ata-space-3); }
.ata-barlist-head { display: flex; justify-content: space-between; gap: var(--ata-space-3); font-size: var(--ata-text-sm); margin-bottom: 4px; }
.ata-barlist-head > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ata-ink-soft); }
.ata-barlist-head > span:last-child { white-space: nowrap; font-variant-numeric: tabular-nums; }
.ata-barlist-track { height: 8px; border-radius: 4px; background: var(--ata-bg); overflow: hidden; }
.ata-barlist-track span { display: block; height: 100%; border-radius: 4px; }

@media print {
  .ata-toolbar, .ata-staff-topbar { display: none !important; }
  .ata-more { display: none; }
  .ata-card, .ata-stat { box-shadow: none; break-inside: avoid; }
  .ata-barlist-track span { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.ata-profit-table td { font-variant-numeric: tabular-nums; }
.ata-profit-table td, .ata-profit-table th, .ata-statement td { white-space: nowrap; } /* amounts on one line; the table scrolls on phones */
.ata-profit-table tr.is-shared td { color: var(--ata-ink-soft); background: var(--ata-bg); }

/* ---------------------------------------------------------------- outstanding ageing */
.ata-ageing { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--ata-space-3); margin-bottom: var(--ata-space-3); }
@media (max-width: 860px) { .ata-ageing { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ata-ageing-card {
  display: flex; flex-direction: column; gap: 2px; padding: var(--ata-space-3) var(--ata-space-4);
  background: var(--ata-surface); border: 1px solid var(--ata-border); border-left: 4px solid var(--tone); border-radius: var(--ata-radius-md);
  color: var(--ata-ink); text-decoration: none; transition: box-shadow var(--ata-duration) var(--ata-ease);
}
.ata-ageing-card:hover { text-decoration: none; box-shadow: var(--ata-shadow-md); }
.ata-ageing-card.is-active { background: var(--tone-bg); box-shadow: inset 0 0 0 1.5px var(--tone); }
.ata-ageing-card strong { font-family: var(--ata-font-display); font-size: var(--ata-text-xl); line-height: 1.2; }
.ata-ageing-label { font-size: var(--ata-text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ata-muted); }
.ata-ageing-count { font-size: var(--ata-text-xs); color: var(--ata-muted); }
.ata-age-neutral { --tone: var(--ata-status-neutral-fg); --tone-bg: var(--ata-status-neutral-bg); }
.ata-age-warning { --tone: var(--ata-status-warning-fg); --tone-bg: var(--ata-status-warning-bg); }
.ata-age-danger  { --tone: var(--ata-status-danger-fg);  --tone-bg: var(--ata-status-danger-bg); }
.ata-ageing-bar { display: flex; gap: 2px; height: 10px; border-radius: 5px; overflow: hidden; margin-bottom: var(--ata-space-5); }
.ata-ageing-bar span { background: var(--tone); min-width: 4px; }
/* 31–60 and 60+ share the danger hue; 60+ adds a diagonal texture so it never relies on colour alone */
.ata-ageing-bar span.is-severe { background: repeating-linear-gradient(135deg, var(--tone) 0 4px, var(--tone-bg) 4px 6px); }
.ata-ageing-card.is-severe { border-left-style: double; border-left-width: 6px; }
.ata-section .ata-ageing-bar { margin-bottom: 0; }

/* ---------------------------------------------------------------- daily cash-up */
.ata-toolbar .ata-field.ata-field-auto { flex: 0 0 auto; min-width: 0; }
.ata-date-stepper { display: flex; gap: 6px; align-items: center; }
.ata-date-stepper .ata-input { width: 170px; }
.ata-date-stepper .ata-btn { flex-shrink: 0; min-width: 38px; padding-left: 0; padding-right: 0; justify-content: center; }
.ata-signoff span { font-size: var(--ata-text-sm); color: var(--ata-muted); }
.ata-signoff-line { border-bottom: 1.5px solid var(--ata-ink-soft); height: 36px; margin-top: 4px; font-size: var(--ata-text-sm); color: var(--ata-muted); display: flex; align-items: flex-end; padding-bottom: 4px; }
@media screen { .ata-signoff { display: none; } }
@media print { .ata-ageing-bar span { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }

/* "‹ Back to …" on detail pages (includes/layout.php back_link) */
.ata-back { margin: 0 0 var(--ata-space-3, 12px); }
.ata-back .ata-btn { gap: 4px; padding-left: 10px; }
.ata-parent-main > .ata-back { margin-top: 4px; }

/* ---------------------------------------------------------------- tables → cards on phones
   ATA.table output (.ata-table-cards) stacks each row as a card with labelled values, so nobody
   has to scroll sideways on a phone. Hand-built tables (e.g. the financial statement) keep scrolling. */
@media (max-width: 640px) {
  .ata-table-cards { border: 0; overflow: visible; }
  .ata-table-cards .ata-table { background: transparent; }
  .ata-table-cards thead { display: none; }
  .ata-table-cards table, .ata-table-cards tbody, .ata-table-cards tfoot, .ata-table-cards tr { display: block; width: 100%; }
  .ata-table-cards tbody tr, .ata-table-cards tfoot tr {
    background: var(--ata-surface); border: 1px solid var(--ata-border); border-radius: var(--ata-radius-md);
    padding: var(--ata-space-2) var(--ata-space-3); margin-bottom: var(--ata-space-2);
  }
  .ata-table-cards tr:hover td { background: transparent; }
  /* label on the left; the value (and any smaller line under it) stacked on the right */
  .ata-table-cards td, .ata-table-cards tfoot td {
    display: grid; grid-template-columns: minmax(0, 40%) minmax(0, 1fr); column-gap: var(--ata-space-3); align-items: baseline;
    padding: 6px 0; border: 0; text-align: right; background: transparent; width: auto;
  }
  .ata-table-cards td > * { grid-column: 2; min-width: 0; justify-self: end; }
  .ata-table-cards td::before {
    content: attr(data-label); grid-column: 1; grid-row: 1 / span 6; text-align: left;
    font-size: var(--ata-text-xs); font-weight: 600; color: var(--ata-muted); text-transform: none;
  }
  .ata-table-cards td[data-label=""], .ata-table-cards td:not([data-label]), .ata-table-cards td.ata-action-col { display: flex; justify-content: flex-end; }
  .ata-table-cards td[data-label=""]::before, .ata-table-cards td:not([data-label])::before, .ata-table-cards td.ata-action-col::before { content: none; }
  .ata-table-cards tfoot td[colspan] { display: block; text-align: left; }
  /* beat the desktop "action column is 1% wide" rule; unlabeled cells (meters etc.) span the card */
  .ata-table-cards .ata-table td.ata-action-col { width: auto; white-space: normal; padding-top: 10px; }
  .ata-table-cards .ata-table td[data-label=""]:not(.ata-action-col) { display: block; }
  .ata-table-cards .ata-table td[data-label=""]:not(.ata-action-col) > * { width: 100%; }
  .ata-table-cards tfoot td[colspan]::before { content: none; }
  /* the first column is the row's title: full width, left-aligned, no label */
  .ata-table-cards tbody td:first-child { display: block; text-align: left; font-size: var(--ata-text-base); padding-top: 4px; }
  .ata-table-cards tbody td:first-child > * { justify-self: start; }
  .ata-table-cards tbody td:first-child::before { content: none; }
  .ata-table-cards td + td { border-top: 1px dashed var(--ata-border); }
  .ata-table-cards .ata-sub { text-align: inherit; }
  .ata-table-cards .ata-row-actions { flex-wrap: wrap; justify-content: flex-end; }
  .ata-table-cards td.ata-table-empty { display: block; text-align: center; }
  .ata-table-cards tbody tr:has(.ata-table-empty) { border-style: dashed; }
  .ata-table-cards tfoot tr { background: var(--ata-bg); }
  .ata-table-cards tfoot td:first-child { display: block; text-align: left; }
  .ata-table-cards tfoot td:first-child::before { content: none; }
  .ata-table-cards tfoot td { font-weight: 700; }
}
