/* css/account.css — Phase 4 step 6: the account and performance pages (dashboard, my bookings, billing, messages,
   teams, team analysis, leaderboard, analysis, admin). There is no board for these pages, so they are built from the
   brief's rules, the System board's palette and badges, and step 5's marketplace layer (css/market.css), which they
   also load: its page heading, sections, rows, forms and dialog are used as they are. This file adds what only the
   account pages have: stat tiles, tabs, tables, the booking cards that assets/bookings-view.js writes, toggles and
   choice chips. Every colour is a token from css/theme.css; nothing here defines its own.
   Load order: theme.css -> styles.css -> buttons.css -> chrome.css -> market.css -> account.css -> the page's own rules.
   Classes are ac- prefixed; the older class names the pages' scripts and gates read (booking-card, booking-status, …)
   are styled only under .ac, so they reach nothing else. */

.ac { --mk-max: 1040px; }
.ac-narrow { --mk-max: 880px; }
.ac-wide { --mk-max: 1240px; }
.ac-main { padding-bottom: 72px; }

/* ---- Section headings: sentence case, condensed 800 (brief: section headings 800 at about 80% width) ---- */
.ac-section { margin-top: 48px; }
.ac-section:first-child { margin-top: 0; }
.ac-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin: 0 0 16px; }
.ac-h2 { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 26px; line-height: 1.15; font-weight: 800; font-stretch: 80%; color: var(--ps-text-primary); }
.ac-h2 svg { width: 20px; height: 20px; flex-shrink: 0; color: var(--ps-accent); }
.ac-h3 { margin: 0 0 12px; font-size: 18px; line-height: 1.3; font-weight: 700; color: var(--ps-text-primary); }
.ac-sub { margin: 4px 0 0; font-size: 15px; line-height: 1.5; color: var(--ps-text-secondary); }
.ac-note { font-size: 14px; line-height: 1.5; color: var(--ps-text-secondary); }
.ac-link { color: var(--ps-accent); font-weight: 600; text-decoration: none; }
.ac-link:hover { color: var(--ps-accent-hover); text-decoration: underline; }
.ac-num { font-variant-numeric: tabular-nums; }

/* A quiet outlined panel (white), and its silver sibling for a block inside it */
.ac-card { background: var(--ps-surface-0); border: 1px solid var(--ps-border); border-radius: 20px; padding: 24px; box-sizing: border-box; min-width: 0; }
.ac-card + .ac-card { margin-top: 16px; }
.ac-inset { background: var(--ps-surface-1); border: 1px solid var(--ps-border); border-radius: 14px; padding: 16px; }
.ac-split { display: flex; align-items: center; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; }
.ac-wait { padding: 32px 0; font-size: 15px; color: var(--ps-text-secondary); text-align: center; }

/* A row of links to the next thing to do (dashboard: book a space, run an analysis) */
.ac-quick { display: flex; align-items: center; gap: 16px; padding: 18px 22px; border: 1px solid var(--ps-border); border-radius: 20px; background: var(--ps-surface-0);
  text-decoration: none; color: inherit; }
.ac-quick:hover { border-color: var(--ps-border-interactive); }
.ac-quick:focus-visible { outline: 2px solid var(--ps-accent); outline-offset: 3px; }
.ac-quick-icon { width: 48px; height: 48px; flex-shrink: 0; border-radius: var(--ps-radius-pill); border: 1.5px solid var(--ps-border-accent); background: var(--ps-accent-bg);
  display: flex; align-items: center; justify-content: center; color: var(--ps-accent-on-tint); }
.ac-quick-icon svg { width: 22px; height: 22px; }
.ac-quick-title, .ac-quick-sub { display: block; }
.ac-quick-title { font-size: 17px; font-weight: 700; color: var(--ps-text-primary); }
.ac-quick-sub { margin-top: 2px; font-size: 15px; color: var(--ps-text-secondary); }
.ac-quick-go { margin-left: auto; flex-shrink: 0; color: var(--ps-accent); }
.ac-quick-go svg { width: 18px; height: 18px; transform: rotate(90deg); }

/* ---- Stat tiles: the number in tabular figures (constitution §2.3), the label below in sentence case ---- */
.ac-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.ac-stat { background: var(--ps-surface-0); border: 1px solid var(--ps-border); border-radius: 16px; padding: 20px; min-width: 0; }
.ac .ac-stat-num { display: block; font-size: 36px; line-height: 1.05; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; color: var(--ps-text-primary);
  background: none; -webkit-text-fill-color: currentColor; overflow-wrap: anywhere; }
.ac .ac-stat-word { font-size: 24px; line-height: 1.5; }
.ac .ac-stat-label { display: block; margin-top: 8px; font-size: 14px; font-weight: 500; line-height: 1.4; color: var(--ps-text-secondary); text-transform: none; letter-spacing: normal; }

/* ---- Tabs: pills, the selected one tinted with its word (never colour alone) ---- */
.ac-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.ac-tab { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; box-sizing: border-box; border: 1px solid var(--ps-border-interactive);
  border-radius: var(--ps-radius-pill); background: var(--ps-surface-0); color: var(--ps-text-primary); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
  text-decoration: none; white-space: nowrap; }
.ac-tab:hover { border-color: var(--ps-accent); color: var(--ps-accent); }
.ac-tab[aria-selected="true"], .ac-tab.active, .ac-tab.is-selected { background: var(--ps-accent-bg); border-color: var(--ps-accent); color: var(--ps-accent-on-tint); }
.ac-tab:focus-visible { outline: 2px solid var(--ps-accent); outline-offset: 2px; }
.ac-tab svg { width: 16px; height: 16px; flex-shrink: 0; }
.ac-count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 7px; box-sizing: border-box; border-radius: var(--ps-radius-pill);
  background: var(--ps-surface-1); border: 1px solid var(--ps-border); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ps-text-primary); }

/* ---- Tables (admin, team roster): sentence-case headers, hairline rows, a sideways scroll on phones ---- */
.ac-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ac-table { width: 100%; border-collapse: collapse; font-size: 15px; color: var(--ps-text-primary); }
.ac-table th { padding: 10px 12px; text-align: left; font-size: 14px; font-weight: 600; line-height: 1.3; color: var(--ps-text-secondary); white-space: nowrap;
  text-transform: none; letter-spacing: normal; border-bottom: 1px solid var(--ps-border); background: none; }
.ac-table td { padding: 14px 12px; vertical-align: middle; border-bottom: 1px solid var(--ps-border); line-height: 1.4; }
.ac-table tbody tr:last-child td { border-bottom: 0; }
.ac-table td.ac-muted, .ac-table .ac-muted { color: var(--ps-text-secondary); }
.ac-table .ac-num { text-align: right; }

/* ---- Toggle switch (coach and referee availability): the word beside it says On or Off ---- */
.ac .toggle { position: relative; display: inline-block; width: 48px; height: 28px; flex-shrink: 0; }
.ac .toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.ac .toggle-slider { position: absolute; inset: 0; border-radius: var(--ps-radius-pill); background: var(--ps-surface-0); border: 1.5px solid var(--ps-border-interactive); cursor: pointer; }
.ac .toggle-slider::before { content: ''; position: absolute; left: 3px; top: 3px; width: 19px; height: 19px; border-radius: 50%; background: var(--ps-border-interactive); transition: transform var(--ps-motion-fast); }
.ac .toggle input:checked + .toggle-slider { background: var(--ps-accent-fill); border-color: var(--ps-accent-fill); }
.ac .toggle input:checked + .toggle-slider::before { transform: translateX(20px); background: var(--ps-on-accent); }
.ac .toggle input:focus-visible + .toggle-slider { outline: 2px solid var(--ps-accent); outline-offset: 2px; }

/* ---- Choice chips (sports, specialties, levels on the coach and referee forms) ---- */
.ac .chip { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; box-sizing: border-box; border: 1px solid var(--ps-border-interactive); border-radius: var(--ps-radius-pill);
  background: var(--ps-surface-0); color: var(--ps-text-primary); font-size: 14px; font-weight: 500; cursor: pointer; user-select: none; }
.ac .chip:hover { border-color: var(--ps-accent); color: var(--ps-accent); }
.ac .chip.on { background: var(--ps-accent-bg); border-color: var(--ps-accent); color: var(--ps-accent-on-tint); font-weight: 600; }

/* ---- Form fields the account pages already have (form-group inputs, coach-input, …): the 48px field of market.css ---- */
.ac .form-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ac .form-group > label, .ac .ac-label { font-size: 15px; font-weight: 600; color: var(--ps-text-primary); text-transform: none; letter-spacing: normal; }
.ac .form-group input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), .ac .form-group select, .ac .form-group textarea,
.ac .coach-input, .ac .coach-textarea, .ac .coach-select, .ac .ac-input {
  width: 100%; min-height: 48px; box-sizing: border-box; padding: 11px 14px; background-color: var(--ps-surface-0); border: 1px solid var(--ps-border-interactive);
  border-radius: var(--ps-radius); font: inherit; font-size: 16px; color: var(--ps-text-primary); color-scheme: light; outline: none; box-shadow: none; }
.ac .form-group textarea, .ac .coach-textarea, .ac textarea.ac-input { min-height: 96px; line-height: 1.5; resize: vertical; }
.ac .form-group input::placeholder, .ac .form-group textarea::placeholder, .ac .coach-input::placeholder, .ac .coach-textarea::placeholder, .ac .ac-input::placeholder { color: var(--ps-text-secondary); opacity: 1; }
.ac .form-group input:focus, .ac .form-group select:focus, .ac .form-group textarea:focus, .ac .coach-input:focus, .ac .coach-textarea:focus, .ac .coach-select:focus, .ac .ac-input:focus {
  border-color: var(--ps-accent); box-shadow: 0 0 0 3px var(--ps-accent-bg); }
.ac .form-group input:disabled { background-color: var(--ps-surface-1); color: var(--ps-text-secondary); opacity: 1; cursor: not-allowed; }
.ac .coach-hint { display: block; margin-top: 6px; font-size: 14px; line-height: 1.5; color: var(--ps-text-secondary); }
.ac .saved-msg { align-items: center; gap: 6px; font-size: 15px; font-weight: 600; color: var(--ps-success); }
.ac .saved-msg svg { width: 16px; height: 16px; }

/* ---- Status badges the pages build themselves: the System board's colours, with the word ---- */
.ac .badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border: 1px solid; border-radius: var(--ps-radius-pill); font-size: 14px; font-weight: 600; line-height: 1.3;
  text-transform: none; letter-spacing: normal; }
.ac .badge svg { width: 14px; height: 14px; flex-shrink: 0; }
.ac .badge-active, .ac .badge-verified { color: var(--ps-status-verified); background: var(--ps-status-verified-bg); border-color: var(--ps-status-verified-border); }
.ac .badge-pending, .ac .badge-submitted { color: var(--ps-status-pending); background: var(--ps-status-pending-bg); border-color: var(--ps-status-pending-border); }
.ac .badge-removed { color: var(--ps-danger); background: var(--ps-surface-0); border-color: var(--ps-danger); }
.ac .badge-not-submitted { color: var(--ps-text-secondary); background: var(--ps-surface-1); border-color: var(--ps-border); }

/* ---- Booking cards: the markup assets/bookings-view.js writes for the dashboard, My bookings and admin ---- */
.ac .booking-card { background: var(--ps-surface-0); border: 1px solid var(--ps-border); border-radius: 20px; margin: 0 0 16px; overflow: hidden; }
.ac .booking-card:last-child { margin-bottom: 0; }
.ac .booking-card:hover { border-color: var(--ps-border-interactive); }
.ac .booking-card-body { display: flex; align-items: flex-start; gap: 16px; padding: 20px 20px 0; }
.ac .booking-sport-icon { width: 48px; height: 48px; flex-shrink: 0; border-radius: var(--ps-radius-pill); border: 1.5px solid var(--ps-border-accent); background: var(--ps-accent-bg);
  display: flex; align-items: center; justify-content: center; color: var(--ps-accent-on-tint); font-size: 22px; }
.ac .booking-info { flex: 1; min-width: 0; }
.ac .booking-venue { margin-bottom: 4px; font-size: 17px; line-height: 1.3; font-weight: 700; color: var(--ps-text-primary); overflow-wrap: anywhere; }
.ac .booking-sport { margin: 0 0 6px; font-size: 14px; color: var(--ps-text-secondary); }
.ac .booking-meta { display: flex; align-items: center; gap: 4px 12px; flex-wrap: wrap; margin-bottom: 10px; font-size: 15px; line-height: 1.45; color: var(--ps-text-secondary); font-variant-numeric: tabular-nums; }
.ac .booking-ref { display: inline-block; padding: 3px 10px; border: 1px solid var(--ps-border); border-radius: var(--ps-radius-pill); background: var(--ps-surface-1);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; font-weight: 700; letter-spacing: .04em; color: var(--ps-text-primary); vertical-align: middle; }
.ac .booking-status { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border: 1px solid; border-radius: var(--ps-radius-pill); font-size: 13px; font-weight: 600;
  line-height: 1.4; vertical-align: middle; }
.ac .booking-status svg { width: 13px; height: 13px; flex-shrink: 0; }
.ac .status-confirmed { color: var(--ps-status-verified); background: var(--ps-status-verified-bg); border-color: var(--ps-status-verified-border); }
.ac .status-pending { color: var(--ps-status-pending); background: var(--ps-status-pending-bg); border-color: var(--ps-status-pending-border); }
.ac .status-cancelled { color: var(--ps-danger); background: var(--ps-surface-0); border-color: var(--ps-danger); }
.ac .status-completed { color: var(--ps-text-secondary); background: var(--ps-surface-1); border-color: var(--ps-border); }
.ac .booking-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 16px 20px 20px; }
.ac .booking-combined-head { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; padding: 20px 20px 0; }
.ac .booking-combo-badge { padding: 4px 12px; border: 1px solid var(--ps-border-accent); border-radius: var(--ps-radius-pill); background: var(--ps-accent-bg); font-size: 14px; font-weight: 600;
  letter-spacing: normal; text-transform: none; color: var(--ps-accent-on-tint); }
.ac .booking-combo-when { font-size: 15px; color: var(--ps-text-secondary); font-variant-numeric: tabular-nums; }
.ac .booking-combined-subs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 12px; padding: 16px 20px 20px; }
.ac .booking-sub { min-width: 0; padding: 16px; border: 1px solid var(--ps-border); border-radius: 16px; background: var(--ps-surface-1); }
.ac .booking-sub .booking-actions { padding: 6px 0 0; }
.ac .booking-sub-label { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 14px; font-weight: 600; text-transform: none; letter-spacing: normal; color: var(--ps-text-secondary); }
.ac .booking-sub-label svg { width: 15px; height: 15px; color: var(--ps-accent); }

@media (max-width: 768px) {
  .ac-section { margin-top: 40px; }
  .ac-h2 { font-size: 24px; }
  .ac-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .ac-stat { padding: 16px; }
  .ac .ac-stat-num { font-size: 30px; }
  .ac .ac-stat-word { font-size: 20px; }
  .ac-card { padding: 20px; }
  .ac-quick { padding: 16px; gap: 14px; }
  .ac .booking-card-body { padding: 16px 16px 0; gap: 14px; }
  .ac .booking-sport-icon { width: 40px; height: 40px; font-size: 18px; }
  .ac .booking-actions { padding: 14px 16px 16px; }
  .ac .booking-combined-head { padding: 16px 16px 0; }
  .ac .booking-combined-subs { padding: 14px 16px 16px; }
}

/* Selects on the account pages draw the same chevron as the account form fields (market.css leaves the native arrow). */
select.mk-input { appearance: none; padding-right: 40px; color-scheme: light; background-repeat: no-repeat; background-position: right 14px center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%235b6270' stroke-width='1.5' stroke-linecap='round' fill='none'/%3E%3C/svg%3E"); }
/* A badge sitting in a condensed heading keeps its own width and size. */
.mk-title .ps-badge, .ac-h2 .ps-badge { font-stretch: 100%; vertical-align: middle; }
