/* APT Member Account — the plugin's own styling (custom CSS approved for this plugin, Matt 2026-11-07).
   Colours and sizes read the site's design tokens, with fallbacks so it also renders off the site.
   Layout is a first pass (Matt: "once we look at it we will have to break down the layout"). */
.apt-ma { --ma-navy: var(--apt-navy, #001F4D); --ma-red: var(--apt-red, #e8000b); --ma-blue: var(--apt-blue, #3c99dc);
  --ma-grey: var(--apt-grey, #d9dde2); --ma-light: var(--apt-grey-light, #f4f5f6); --ma-text: var(--apt-text, #1a1a1a);
  --ma-muted: var(--apt-text-muted, #5b6573);
  color: var(--ma-text); font-size: var(--apt-text-s, 16px); line-height: 1.45; width: 100%; }
.apt-ma *, .apt-ma *::before, .apt-ma *::after { box-sizing: border-box; }
.apt-ma h2 { margin: 0 0 6px; color: var(--ma-navy); font-size: var(--apt-text-xl, 28px); line-height: 1.15; }
.apt-ma h3 { margin: 0 0 12px; color: var(--ma-navy); font-size: var(--apt-text-l, 20px); }
.apt-ma h4 { margin: 0 0 6px; color: var(--ma-navy); font-size: var(--apt-text-s, 16px); }
.apt-ma p { margin: 0 0 10px; }
.apt-ma a { color: var(--ma-blue); }
.apt-ma button { font: inherit; cursor: pointer; }

/* sign in */
.apt-ma-signin { max-width: 460px; margin: 0 auto; padding: 28px; background: #fff; border: 1px solid var(--ma-grey); border-radius: var(--apt-radius-m, 10px); }
.apt-ma-form { display: flex; flex-direction: column; gap: 8px; margin: 14px 0 8px; }
.apt-ma-form label { font-weight: 600; color: var(--ma-navy); font-size: var(--apt-text-xs, 14px); }
.apt-ma-form input { font: inherit; font-size: 18px; padding: 12px 14px; border: 1.5px solid var(--ma-grey); border-radius: 8px; width: 100%; }
.apt-ma-form input[name="code"] { letter-spacing: .3em; font-variant-numeric: tabular-nums; }
.apt-ma-form input:focus { outline: 2px solid var(--ma-blue); outline-offset: 1px; border-color: var(--ma-blue); }
.apt-ma-tabs { display: flex; gap: 6px; margin-top: 10px; }
.apt-ma-tabs button, .apt-ma-picker button { border: 1.5px solid var(--ma-grey); background: #fff; color: var(--ma-navy); border-radius: 999px; padding: 6px 14px; font-weight: 600; }
.apt-ma-tabs button.on, .apt-ma-picker button.on { background: var(--ma-navy); border-color: var(--ma-navy); color: #fff; }
.apt-ma-err { color: var(--ma-red); font-weight: 600; }
.apt-ma-small, .apt-ma-asof { color: var(--ma-muted); font-size: var(--apt-text-xs, 13px); }
.apt-ma-muted, .apt-ma-meta { color: var(--ma-muted); }
.apt-ma-meta { display: block; font-size: var(--apt-text-xs, 14px); }
.apt-ma-link { background: none; border: 0; padding: 0; color: var(--ma-blue); text-decoration: underline; }

.apt-ma-btn { display: inline-block; padding: 11px 18px; border-radius: 8px; border: 1.5px solid var(--ma-navy); background: #fff; color: var(--ma-navy) !important;
  font-weight: 700; text-decoration: none; text-align: center; margin: 4px 0 8px; }
.apt-ma-btn.primary { background: var(--ma-red); border-color: var(--ma-red); color: #fff !important; }
.apt-ma-btn[disabled] { opacity: .6; cursor: default; }

/* signed in */
.apt-ma-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.apt-ma-out { display: flex; gap: 10px 14px; flex-wrap: wrap; align-items: center; font-size: var(--apt-text-xs, 14px); }
.apt-ma-btn-sm { padding: 7px 14px; margin: 0; font-size: var(--apt-text-xs, 14px); }
.apt-ma-picker { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; padding: 10px 14px; background: var(--ma-light); border-radius: 8px; }
.apt-ma-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 18px; align-items: start; }
/* 0.8.2: packed into columns (packCards) — each card drops into the shortest column, no holes under short cards.
   Before the script runs (and on a phone) it is the plain grid above. */
.apt-ma-grid.measuring { grid-template-columns: repeat(var(--apt-ma-cols, 2), minmax(0, 1fr)); }
.apt-ma-grid.packed { display: flex; gap: 18px; align-items: flex-start; }
.apt-ma-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.apt-ma-card { background: #fff; border: 1px solid var(--ma-grey); border-radius: var(--apt-radius-m, 10px); padding: 20px; min-width: 0; }
.apt-ma-sub { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--ma-grey); }
.apt-ma-big { font-size: 34px; font-weight: 800; color: var(--ma-navy); margin: 0 0 2px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.apt-ma-split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 420px) { .apt-ma-split { grid-template-columns: 1fr; } }
.apt-ma-dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 8px 0 12px; }
.apt-ma-dl dt { color: var(--ma-muted); }
.apt-ma-dl dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.apt-ma-pill { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: var(--apt-text-xs, 12px); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; background: var(--ma-light); color: var(--ma-navy); }
.apt-ma-pill.warn { background: #ffd400; }
.apt-ma-pill.bad { background: var(--ma-red); color: #fff; }
.apt-ma-pill.good { background: #1f7a3a; color: #fff; }
.apt-ma-callout { margin-top: 14px; padding: 12px 14px; border-left: 4px solid var(--ma-red); background: #fff5f5; border-radius: 4px; }
.apt-ma-callout.calm { border-left-color: var(--ma-blue); background: var(--ma-light); }
.apt-ma-list, .apt-ma-links, .apt-ma-benefits { list-style: none; margin: 0; padding: 0; }
.apt-ma-list li { padding: 10px 0; border-bottom: 1px solid var(--ma-grey); }
.apt-ma-list li:last-child { border-bottom: 0; }
.apt-ma-list a { text-decoration: none; color: var(--ma-navy); }
/* Upcoming tournaments (0.7.2): name + meta on the left, Tournament info on the right; stacks on a phone. */
.apt-ma-events li { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.apt-ma-ev { min-width: 0; flex: 1 1 200px; }
.apt-ma-events .apt-ma-info { margin: 0; padding: 7px 12px; font-size: var(--apt-text-xs, 14px); white-space: nowrap; }
.apt-ma-events li.cancelled strong { color: var(--ma-muted); text-decoration: line-through; }
.apt-ma-events .apt-ma-pill { vertical-align: 2px; margin-left: 4px; }
.apt-ma-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.apt-ma-links li { padding: 6px 0; }
.apt-ma-links a { font-weight: 600; text-decoration: none; }
.apt-ma-tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* Recent rounds past 10: scroll inside the card (Matt 2026-11-07). JS sets the exact height; this is the fallback. */
.apt-ma-scroll { position: relative; max-height: 400px; overflow-y: auto; overscroll-behavior: contain; border-bottom: 1px solid var(--ma-grey); }
.apt-ma-scroll .apt-ma-list li:last-child { border-bottom: 0; }
.apt-ma-scroll thead th { position: sticky; top: 0; background: #fff; z-index: 1; }
.apt-ma-more { margin-top: 6px; }
.apt-ma-table { width: 100%; border-collapse: collapse; font-size: var(--apt-text-xs, 14px); }
.apt-ma-table th, .apt-ma-table td { padding: 7px 6px; border-bottom: 1px solid var(--ma-grey); text-align: left; white-space: nowrap; }
.apt-ma-table td:nth-child(2) { white-space: normal; }
.apt-ma-table th { color: var(--ma-muted); font-weight: 600; }
.apt-ma-table .n { text-align: right; font-variant-numeric: tabular-nums; }
.apt-ma-owner { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; }
.apt-ma-owner img, .apt-ma-avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex: 0 0 56px; }
.apt-ma-avatar { display: flex; align-items: center; justify-content: center; background: var(--ma-navy); color: #fff; font-weight: 800; font-size: 22px; }
.apt-ma-owner div { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.apt-ma-benefits li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--ma-grey); }
.apt-ma-benefits li:last-child { border-bottom: 0; }
.apt-ma-benefits img { width: 64px; height: 64px; object-fit: contain; flex: 0 0 64px; }
.apt-ma-code code { background: var(--ma-light); padding: 2px 8px; border-radius: 4px; font-weight: 700; color: var(--ma-navy); font-size: 15px; }
.apt-ma-code.locked { color: var(--ma-muted); font-style: italic; }

/* Pro Shop picks (0.7.4, picks-r1): 2 across in the credit card, 4 on a wide card. */
.apt-ma-pickgrid { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.apt-ma-pickgrid a { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--ma-text); }
.apt-ma-pickgrid img, .apt-ma-pickimg { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 8px; background: var(--ma-light); }
.apt-ma-pickname { font-weight: 600; color: var(--ma-navy); line-height: 1.25; font-size: var(--apt-text-xs, 14px); }
.apt-ma-pickgrid a:hover .apt-ma-pickname { text-decoration: underline; }
.apt-ma-price { font-weight: 700; font-variant-numeric: tabular-nums; font-size: var(--apt-text-xs, 14px); }
.apt-ma-price s { color: var(--ma-muted); font-weight: 400; margin-left: 4px; }
.apt-ma-picknote { color: var(--ma-red); font-size: var(--apt-text-xs, 13px); font-weight: 600; }

/* Owed to you · Prizes · Your emails (0.8.0, worker mbrmail-r1) */
.apt-ma-admin { background: var(--ma-light); padding: 1px 6px; border-radius: 4px; font-weight: 700; color: var(--ma-navy); }
.apt-ma-mailbtn { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 0; color: inherit; }
.apt-ma-mailbtn strong { color: var(--ma-navy); }
.apt-ma-mailbtn:hover strong { text-decoration: underline; }
.apt-ma-mailbtn[aria-expanded="true"] strong { color: var(--ma-blue); }
.apt-ma-mailbody { margin-top: 8px; padding: 12px; background: var(--ma-light); border-radius: 8px; }
.apt-ma-mailtext { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: var(--apt-text-xs, 14px); }

/* Contact Support (0.8.1, worker mbrsupport-r1) */
.apt-ma-supform select, .apt-ma-supform textarea { font: inherit; font-size: 16px; padding: 10px 12px; border: 1.5px solid var(--ma-grey); border-radius: 8px; width: 100%; background: #fff; }
.apt-ma-supform textarea { resize: vertical; min-height: 110px; }
.apt-ma-supform select:focus, .apt-ma-supform textarea:focus { outline: 2px solid var(--ma-blue); outline-offset: 1px; border-color: var(--ma-blue); }
.apt-ma-sent { margin: 0 0 8px; padding: 12px 14px; border-left: 4px solid #1f7a3a; background: #f1f8f3; border-radius: 4px; }
.apt-ma-counts { margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--ma-grey); }
.apt-ma-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.apt-ma-tags .apt-ma-pill { cursor: help; }

/* 0.9.0: recommended event cards, cancellation line */
.apt-ma-evcards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 12px; }
.apt-ma-evcards li { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--ma-grey); border-left: 4px solid var(--ma-navy); border-radius: 8px; }
.apt-ma-evcards li.played { border-left-color: var(--ma-blue); }
.apt-ma-evcards strong { color: var(--ma-navy); line-height: 1.25; }
.apt-ma-evch { font-size: var(--apt-text-xs, 12px); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ma-red); }
.apt-ma-evcards li.played .apt-ma-evch { color: var(--ma-blue); }
.apt-ma-evbtns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.apt-ma-cancel { margin-top: 2px; }
.apt-ma-cancel .apt-ma-link { font-size: inherit; }
.apt-ma-bgid { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .02em; }
