/* admin area: styles specific to these pages. Shared blocks live in ui-components.css. */

.admin-nav { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4) var(--space-16); }
.admin-page { display: flex; flex-direction: column; gap: var(--space-20); min-width: 0; }
.admin-detail { display: flex; flex-direction: column; gap: var(--space-24); }
.admin-detail.layout-split { display: grid; }

/* ---------- Toolbar: filters on the left, search on the right ---------- */
.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-12) var(--space-16);
}

.admin-toolbar .tabs { flex: 0 1 auto; }

.admin-search {
  display: flex;
  flex: 1 1 300px;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-8);
  max-width: 420px;
  margin: 0;
}

.admin-search .input { flex: 1 1 220px; }
.admin-search__field { position: relative; flex: 1; min-width: 0; }
.admin-search__field .input { min-height: 46px; padding-left: var(--space-40); background: var(--white); }
.admin-search__icon { position: absolute; left: 14px; top: 50%; color: var(--text-muted); transform: translateY(-50%); pointer-events: none; }
.admin-search .btn { min-height: 46px; }

@media (max-width: 719px) {
  .admin-search { max-width: none; flex-basis: 100%; }
}

/* ---------- Club list (US-9.11, US-9.12): revenue, funnel, one-row filters, money per club ---------- */
.admin-page > .tabs { align-self: flex-start; max-width: 100%; }
.tabs__count { padding: 1px var(--space-6); font-size: var(--text-xs); font-weight: 600; color: var(--text-muted); background: var(--canvas); border-radius: var(--radius-pill); }
.tabs__tab--current .tabs__count { color: var(--white); background: var(--purple); }

.clubs-stats { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--space-16); }
.clubs-revenue { grid-column: span 7; display: flex; flex-direction: column; gap: var(--space-16); }
.clubs-funnel { grid-column: span 5; display: flex; flex-direction: column; gap: var(--space-16); }
.clubs-card__label { display: inline-flex; align-items: center; gap: var(--space-6); margin: 0; font-size: var(--text-md); font-weight: 500; color: var(--text-muted); }
.clubs-card__link { font-size: var(--text-md); font-weight: 600; white-space: nowrap; }

.clubs-revenue__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-16); }
.clubs-revenue__total { display: flex; flex-direction: column; gap: var(--space-4); }
.clubs-revenue__value { font-family: var(--font-display); font-size: clamp(34px, 4vw, 48px); font-weight: 700; line-height: 1; color: var(--ink); }

.info-tip { position: relative; }
.info-tip__toggle { display: grid; place-items: center; width: 22px; height: 22px; font-size: var(--text-xs); font-weight: 700; color: var(--text-muted); list-style: none; cursor: pointer; border: 1.5px solid var(--line-lilac); border-radius: 50%; }
.info-tip__toggle::-webkit-details-marker { display: none; }
.info-tip[open] .info-tip__toggle { color: var(--white); background: var(--ink); border-color: var(--ink); }
.info-tip__panel { position: absolute; top: calc(100% + var(--space-6)); left: -10px; z-index: 5; width: min(320px, 80vw); margin: 0; padding: var(--space-12) var(--space-14); font-size: var(--text-md); line-height: var(--leading-normal); color: var(--text); background: var(--white); border: 1px solid var(--line-fine); border-radius: var(--radius-lg); box-shadow: var(--shadow-drawer); }

.clubs-months { display: flex; flex-direction: column; gap: var(--space-6); margin: 0; }
.clubs-months__plot { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--space-8); align-items: end; height: 96px; border-bottom: 1px solid var(--line-fine); }
.clubs-months__col { display: flex; align-items: flex-end; height: 100%; }
.clubs-months__bar { width: 100%; height: max(6px, calc(100% * var(--share, 0))); background: var(--chart-1); border-radius: var(--radius-2xs) var(--radius-2xs) 0 0; }
.clubs-months__bar--empty { height: 2px; background: var(--line-lilac); border-radius: 0; }
.clubs-months__labels { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--space-8); font-size: var(--text-xs); color: var(--text-muted); text-align: center; }

.clubs-figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-12); margin: auto 0 0; padding-top: var(--space-16); border-top: 1px solid var(--line-fine); }
.clubs-figures dt { font-size: var(--text-sm); color: var(--text-muted); }
.clubs-figures dd { margin: var(--space-2) 0 0; font-size: var(--text-3xl); font-weight: 700; color: var(--ink); }
.clubs-figures__meta { font-size: var(--text-sm); font-weight: 500; color: var(--text-muted); }
.clubs-figures__late { font-size: var(--text-sm); font-weight: 600; color: var(--error-field); }

.clubs-funnel__steps { display: flex; flex-direction: column; gap: var(--space-12); margin: 0; padding: 0; list-style: none; }
.clubs-funnel__step { display: flex; flex-direction: column; gap: var(--space-6); color: var(--ink); text-decoration: none; }
.clubs-funnel__step:hover .clubs-funnel__name { color: var(--purple); }
.clubs-funnel__row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-8); }
.clubs-funnel__name { font-weight: 600; }
.clubs-funnel__count { font-size: var(--text-3xl); }
.clubs-funnel__note { font-size: var(--text-sm); color: var(--text-muted); }
.clubs-funnel__track { display: block; height: 10px; background: var(--lilac); border-radius: var(--radius-pill); }
.clubs-funnel__fill { display: block; width: var(--share, 0%); height: 100%; background: var(--purple); border-radius: var(--radius-pill); }

.clubs-packages { display: flex; flex-direction: column; gap: var(--space-6); padding-top: var(--space-12); border-top: 1px solid var(--line-fine); }
.clubs-packages__bar { display: flex; gap: 2px; height: 12px; }
.clubs-packages__bar > :first-child { border-top-left-radius: var(--radius-2xs); border-bottom-left-radius: var(--radius-2xs); }
.clubs-packages__bar > :last-child { border-top-right-radius: var(--radius-2xs); border-bottom-right-radius: var(--radius-2xs); }
.clubs-packages__part { flex: 1 1 0; }
.clubs-packages__part--start { background: var(--chart-other); }
.clubs-packages__part--club { background: var(--chart-1); }
.clubs-packages__part--federation { background: var(--ink); }
.clubs-packages__legend { display: flex; flex-wrap: wrap; gap: var(--space-4) var(--space-16); margin: 0; padding: 0; font-size: var(--text-sm); list-style: none; }
.clubs-packages__legend li { display: inline-flex; align-items: center; gap: var(--space-6); }
.clubs-packages__key { width: 10px; height: 10px; border-radius: 3px; }

.clubs-alerts { display: flex; flex-wrap: wrap; gap: var(--space-8); }
.clubs-alert { display: inline-flex; align-items: center; min-height: 36px; padding: 0 var(--space-12); font-size: var(--text-sm); font-weight: 600; text-decoration: none; border-radius: var(--radius-pill); }
.clubs-alert--soon { color: var(--warning-text); background: var(--warning-bg); }
.clubs-alert--late { color: var(--error-text); background: var(--error-bg); }
.clubs-alert:hover { text-decoration: underline; }

.clubs-filters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-8); margin: 0; }
.clubs-filters__search { flex: 1 1 220px; min-width: 200px; }
.clubs-filters__search .input { min-height: 44px; font-size: var(--text-md); }
.clubs-filters__select { width: auto; max-width: 220px; min-height: 44px; padding: 0 var(--space-48) 0 var(--space-14); font-size: var(--text-md); }
.clubs-filters__select--set { color: var(--purple-deep); font-weight: 600; background-color: var(--lilac); border-color: var(--purple); }
.clubs-filters .segmented { border: 1.5px solid var(--line-input); }

.clubs-chips { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-8); margin-top: calc(-1 * var(--space-8)); }
.clubs-chip { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 32px; padding: 0 var(--space-4) 0 var(--space-12); font-size: var(--text-sm); font-weight: 600; color: var(--ink); background: var(--lilac); border-radius: var(--radius-pill); }
.clubs-chip__remove { display: grid; place-items: center; width: 28px; height: 28px; color: var(--text-muted); border-radius: 50%; }
.clubs-chip__remove:hover { color: var(--ink); background: var(--lilac-soft); }
.clubs-chips__reset { font-size: var(--text-sm); font-weight: 600; }

.club-status { display: inline-flex; align-items: center; gap: var(--space-6); }
.club-status__dot { flex: none; width: 8px; height: 8px; border-radius: 50%; }
.club-status__dot--paid { background: var(--status-paid); }
.club-status__dot--lilac { background: var(--purple-light); }
.club-status__dot--soon { background: var(--status-soon); }
.club-status__dot--muted { background: var(--status-inactive); }

.clubs-sort__link { display: inline-flex; align-items: center; gap: var(--space-4); color: inherit; text-decoration: none; }
.clubs-sort__link:hover, .clubs-sort__link--current { color: var(--purple-deep); }
.text-right .clubs-sort__link { justify-content: flex-end; }
.clubs-table .admin-table th,
.clubs-table .admin-table td { padding-inline: var(--space-12); }
.clubs-table .admin-table th:first-child,
.clubs-table .admin-table td:first-child { padding-left: var(--space-20); }
.clubs-table .admin-cell { min-width: 180px; }
.clubs-table__money { font-weight: 600; color: var(--ink); }
.clubs-table__late { font-weight: 600; color: var(--error-field); }
.clubs-table__stale { color: var(--warning-text); }

.clubs-cards { display: none; margin: 0; padding: 0; list-style: none; }
.clubs-card { display: flex; flex-direction: column; gap: var(--space-10); padding: var(--space-14) var(--space-16); color: var(--text); text-decoration: none; border-top: 1px solid var(--line-fine); }
.clubs-card:hover { background: var(--lilac-mist); }
.clubs-card__top { display: flex; align-items: center; gap: var(--space-12); }
.clubs-card__top .admin-cell__text { flex: 1; }
.clubs-card__paid { font-weight: 700; color: var(--ink); white-space: nowrap; }
.clubs-card__bottom { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-6) var(--space-12); font-size: var(--text-sm); }

@media (max-width: 1099px) {
  .clubs-revenue, .clubs-funnel { grid-column: 1 / -1; }
}

/* The table needs about 1000px of content; narrower screens get one card per club. */
@media (max-width: 1199px) {
  .clubs-table { display: none; }
  .clubs-cards { display: block; }
}

@media (max-width: 719px) {
  .clubs-figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .clubs-months__plot, .clubs-months__labels { gap: var(--space-4); }
  .clubs-months__labels span:nth-child(odd) { visibility: hidden; }
  .clubs-filters__select, .clubs-filters .segmented { flex: 1 1 calc(50% - var(--space-8)); max-width: none; }
}

/* ---------- Table cells (the table itself is in ui-components.css) ---------- */
.admin-table-scroll { overflow-x: auto; }

.admin-cell { display: flex; align-items: center; gap: var(--space-12); min-width: 200px; }
.admin-cell__text { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); min-width: 0; }
.admin-cell__title { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
a.admin-cell__title:hover { color: var(--purple); }
.admin-cell__meta { font-size: var(--text-sm); color: var(--text-muted); }
.admin-cell__email { overflow-wrap: anywhere; }
.admin-cell__inline { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--space-6); }
.admin-cell__inline:empty { display: none; }
.admin-cell--wide { min-width: 220px; max-width: 360px; color: var(--text-muted); }
.admin-code { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--text); background: var(--canvas); padding: var(--space-2) var(--space-6); border-radius: var(--radius-2xs); }

.admin-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-8); }
.admin-actions form { margin: 0; }
.admin-actions--end { justify-content: flex-end; flex-wrap: nowrap; }

.admin-note { font-size: var(--text-md); }
.admin-small { font-size: var(--text-md); line-height: var(--leading-normal); }

/* ---------- Page header meta (status, country, …) ---------- */
.admin-meta { display: inline-flex; align-items: center; gap: var(--space-4); font-size: var(--text-md); color: var(--text-muted); }
.admin-meta .icon { color: var(--status-inactive); }

/* ---------- Pending club callout ---------- */
.admin-callout { flex-direction: row; align-items: flex-start; gap: var(--space-14); }
.admin-callout .stat__icon { flex: none; margin: 0; }
.admin-callout__text { display: flex; flex-direction: column; gap: var(--space-12); min-width: 0; }
.admin-callout__body { font-size: var(--text-base); line-height: var(--leading-normal); color: var(--ink); }

/* ---------- Forms in cards ---------- */
.admin-form-actions { display: flex; flex-wrap: wrap; gap: var(--space-10); padding-top: var(--space-4); }
.admin-subform { padding: var(--space-20); border-top: 1px solid var(--line-fine); background: var(--hover-tint); }
.admin-flush-empty { padding: var(--space-16) var(--space-20); font-size: var(--text-base); }
.admin-surface-head { flex-direction: column; align-items: flex-start; }
.admin-file { width: 100%; padding: var(--space-12); font-size: var(--text-md); background: var(--canvas); border: 1.5px dashed var(--line-lilac); border-radius: var(--radius-md); }
.admin-file::file-selector-button { margin-right: var(--space-12); padding: var(--space-8) var(--space-14); font: inherit; font-weight: 600; color: var(--purple-deep); background: var(--white); border: 1px solid var(--line-lilac); border-radius: var(--radius-sm); cursor: pointer; }

.admin-quote {
  margin: 0;
  padding: var(--space-14) var(--space-16);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--ink);
  background: var(--lilac);
  border-left: 3px solid var(--purple);
  border-radius: var(--radius-sm);
}

/* ---------- Lead contact log ---------- */
.admin-timeline {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: var(--space-4) 0 0;
  list-style: none;
}

.admin-timeline__item { position: relative; display: flex; gap: var(--space-14); padding-bottom: var(--space-16); }
.admin-timeline__item:not(:last-child)::before { content: ""; position: absolute; left: 15px; top: 34px; bottom: 0; width: 2px; background: var(--line-lilac); }

.admin-timeline__dot {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--purple);
  background: var(--white);
  border: 1.5px solid var(--line-lilac);
  border-radius: 50%;
}

.admin-timeline__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  min-width: 0;
  padding: var(--space-12) var(--space-16);
  background: var(--white);
  border: 1px solid var(--line-fine);
  border-radius: var(--radius-md);
}

.admin-timeline__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-8); }
.admin-timeline__time { font-size: var(--text-md); font-weight: 600; color: var(--ink); }
.admin-timeline__note { font-size: var(--text-base); line-height: var(--leading-normal); color: var(--text); white-space: pre-line; overflow-wrap: anywhere; }

.admin-contact { display: flex; flex-direction: column; gap: var(--space-10); margin: 0; padding: 0; list-style: none; }
.admin-contact li { display: flex; align-items: center; gap: var(--space-10); font-size: var(--text-base); overflow-wrap: anywhere; }
.admin-contact .icon { flex: none; color: var(--purple); }

.page-header__meta:has(.admin-meta) { column-gap: var(--space-14); }

/* ---------- Markets (US-9.4) ---------- */
.market-card { gap: var(--space-12); }
.market-card--current { border-color: var(--purple); box-shadow: var(--shadow-focus); }
.market-card .admin-actions { margin-top: auto; }

.market-categories,
.market-category__children { margin: 0; padding: 0; list-style: none; }
.market-category { border-bottom: 1px solid var(--line-fine); }
.market-category:last-child { border-bottom: 0; }
.market-category__row { display: flex; align-items: center; gap: var(--space-10); min-height: 48px; padding: var(--space-2) var(--space-8) var(--space-2) var(--space-20); }
.market-category__row--child { padding-left: var(--space-40); }
.market-category__name { flex: 1; min-width: 0; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.market-category__row--child .market-category__name { font-weight: 400; color: var(--text); }
.market-category__count { font-size: var(--text-md); color: var(--text-muted); white-space: nowrap; }

/* ---------- Packages (US-9.6): members against the limit ---------- */
.package-usage { display: flex; flex-direction: column; gap: var(--space-6); min-width: 150px; }

/* ---------- Bar chart of counts (US-9.7 to US-9.9): one series, every bar with its number ---------- */
.admin-bars { display: flex; flex-direction: column; gap: var(--space-6); margin: 0; }
.admin-bars__plot { position: relative; display: flex; align-items: flex-end; gap: var(--space-2); height: 190px; border-bottom: 1px solid var(--line-lilac); }
.admin-bars__col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: var(--space-2); min-width: 0; height: 100%; }
.admin-bars__value { font-size: var(--text-xs); font-weight: 600; line-height: var(--leading-none); color: var(--ink); }
/* The number sits on top of the bar, so the bar gets the height that is left. */
.admin-bars__bar { flex: none; width: 56%; max-width: 40px; height: calc((100% - var(--space-16)) * var(--share, 0)); background: var(--chart-1); border-radius: var(--radius-2xs) var(--radius-2xs) 0 0; }
.admin-bars__limit { position: absolute; inset: auto 0 calc((100% - var(--space-16)) * var(--at, 1)) 0; border-top: 2px dashed var(--text-muted); pointer-events: none; }
.admin-bars__limit span { position: absolute; right: 0; top: var(--space-4); padding: 0 var(--space-4); font-size: var(--text-xs); font-weight: 600; color: var(--text); background: var(--white); }
.admin-bars__labels { display: flex; gap: var(--space-2); }
.admin-bars__labels span { flex: 1; min-width: 0; font-size: var(--text-xs); color: var(--text-muted); text-align: center; white-space: nowrap; overflow: hidden; }

/* ---------- System (US-9.7): failed jobs ---------- */
.system-failed { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-10); }
.system-failed__title { margin: 0; font-size: var(--text-lg); font-weight: 600; }
.system-failed__list { display: flex; flex-direction: column; gap: var(--space-4); margin: 0; padding: 0; list-style: none; font-size: var(--text-md); overflow-wrap: anywhere; }

/* Stacked bars (US-9.8): the lower part square, a 2px gap, the rounded part on top. */
.admin-bars__bar--base { border-radius: 0; }

/* Horizontal bars of counts, one hue. */
.admin-hbars { display: flex; flex-direction: column; gap: var(--space-12); margin: 0; padding: 0; list-style: none; }
.admin-hbars__row { display: flex; flex-direction: column; gap: var(--space-4); }
.admin-hbars__head { display: flex; justify-content: space-between; gap: var(--space-12); font-size: var(--text-md); color: var(--text); }
.admin-hbars__head b { font-weight: 600; color: var(--ink); }
.admin-hbars__bar { display: block; width: calc(100% * var(--share, 0)); min-width: 2px; height: 10px; background: var(--chart-1); border-radius: 0 var(--radius-2xs) var(--radius-2xs) 0; }
.admin-hbars__bar--muted { background: var(--chart-other); }

/* ---------- Growth (US-9.8) ---------- */
.growth-legend { display: inline-flex; flex-wrap: wrap; gap: var(--space-6) var(--space-16); font-size: var(--text-sm); color: var(--text); }
.growth-legend > span { display: inline-flex; align-items: center; gap: var(--space-6); }
.growth-legend__swatch { flex: none; width: 10px; height: 10px; border-radius: 3px; } /* ds-keep: a swatch, smaller than any radius token */
.growth-months { display: grid; gap: var(--space-24); grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); align-items: start; }
.growth-table th[scope="row"] { font-weight: 500; color: var(--text); text-align: left; }
.growth-grid { display: grid; gap: var(--space-20); grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); align-items: start; }
.growth-states { display: flex; gap: var(--space-2); height: 14px; }
.growth-states span { min-width: 3px; }
.growth-states span:first-child { border-radius: var(--radius-2xs) 0 0 var(--radius-2xs); }
.growth-states span:last-child { border-radius: 0 var(--radius-2xs) var(--radius-2xs) 0; }

/* ---------- Overview (US-9.9) ---------- */
.overview-split { display: grid; gap: var(--space-20); grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); align-items: start; }
.overview-statuses { display: flex; flex-direction: column; gap: var(--space-10); padding: var(--space-14) var(--space-16); background: var(--lilac-mist); border-radius: var(--radius-lg); }
.overview-statuses__title { margin: 0; font-size: var(--text-xs); font-weight: 600; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--text-muted); }
.overview-events { display: flex; flex-direction: column; gap: var(--space-14); margin: 0; padding: 0; list-style: none; }
.overview-event { display: flex; gap: var(--space-12); }
.overview-event__dot { flex: none; width: 8px; height: 8px; margin-top: 8px; background: var(--purple); border-radius: 50%; }
.overview-event__text { display: flex; flex-direction: column; min-width: 0; }
.overview-event__title { font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
a.overview-event__title:hover { color: var(--purple); }
.overview-event__meta { font-size: var(--text-sm); color: var(--text-muted); }

/* ---------- Shared fixes for the Epic 9 pages ---------- */
/* Stat tiles are a <dl>: no browser indent on their values. */
.admin-page .stat-grid dd { margin: 0; }
/* Buttons in a row of actions keep their label on one line. */
.admin-actions .btn { white-space: nowrap; }
/* A row header reads like a cell, not like a column heading. */
.admin-table tbody th[scope="row"] { font-size: var(--text-md); font-weight: 500; letter-spacing: normal; text-transform: none; color: var(--ink); background: none; }
/* Bars that carry a series colour keep it over the default fill. */
.admin-bars__bar.chart-slot-1 { background: var(--chart-1); }
.admin-bars__bar.chart-slot-2 { background: var(--chart-2); }
.admin-bars__bar.chart-slot-3 { background: var(--chart-3); }
.admin-actions--stack { flex-direction: column; align-items: stretch; }
.admin-actions--stack .btn { padding-inline: var(--space-10); }
