/* TrueScore: the owner's dashboard (/admin, 2026-09-28). Same tokens, cards and chips as the app. Breakpoints 1180, 1023, 640. */

.adm { min-height: 100vh; }
.adm-top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 16px 32px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.adm-badge { margin-left: 2px; }
.adm-tools { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.adm-av { background: none; border: 0; padding: 0; cursor: pointer; border-radius: 50%; }
.adm-av:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.adm-main { padding: 28px 32px 48px; }
.adm-body { max-width: 1376px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }

.adm-head h1 { margin: 0; font-size: 28px; line-height: 1.2; font-weight: 500; letter-spacing: -.02em; color: var(--ink); }
.adm-head p { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.adm-note { margin: 0; }
.adm-note-line { display: block; margin-top: 4px; }
.adm-ip { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }   /* an IPv6 address must wrap on a phone */

/* the four headline numbers */
.adm-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.adm-kpi { padding: 20px 22px; gap: 10px; }
.adm-kpi .v { font-size: 32px; }

/* rows of cards, equal heights in a row */
.adm-row { display: grid; gap: 16px; align-items: stretch; }
.adm-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.adm-row.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.adm-card { display: flex; flex-direction: column; gap: 18px; }
.adm-small { margin: auto 0 0; font-size: 12px; line-height: 1.5; color: var(--muted); }

/* horizontal bars: packages, cancel reasons */
.adm-bars { display: flex; flex-direction: column; gap: 14px; }
.adm-bar { display: grid; grid-template-columns: minmax(0, 132px) minmax(0, 1fr) 36px; align-items: center; gap: 12px; }
.adm-bar-l { display: flex; flex-direction: column; min-width: 0; }
.adm-bar-l b { font-size: 14px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adm-bar-l span { font-size: 12px; color: var(--muted); }
.adm-bar-track { height: 10px; border-radius: 999px; background: var(--neutral-soft); overflow: hidden; }
.adm-bar-track i { display: block; height: 100%; min-width: 0; border-radius: 999px; background: var(--accent); }
.adm-bar-track.warn i { background: var(--warn); }
.adm-bar-n { font-size: 18px; font-weight: 600; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }

/* label and count lists: subscriptions, sign-ups */
.adm-list { display: flex; flex-direction: column; }
.adm-li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 14px; color: var(--text); }
.adm-li:last-child { border-bottom: 0; }
.adm-li b { min-width: 32px; text-align: right; font-size: 16px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.adm-count { min-width: 34px; justify-content: center; font-variant-numeric: tabular-nums; }
.adm-pct { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* revenue by month */
.adm-chart { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; align-items: end; height: 220px; padding-top: 6px; }
.adm-col { display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; min-width: 0; }
.adm-amt { font-size: 12px; font-weight: 600; color: var(--ink); white-space: nowrap; min-height: 16px; font-variant-numeric: tabular-nums; }
.adm-stack { position: relative; flex: 1 1 auto; width: min(56px, 100%); border-radius: 10px; background: var(--neutral-soft); overflow: hidden; }
.adm-stack i { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 10px 10px 0 0; }
.adm-stack i.c { background: var(--accent); }
.adm-stack i.r { background: var(--danger); opacity: .85; border-radius: 0; }
.adm-m { font-size: 12px; color: var(--muted); }
.adm-legend { display: flex; gap: 18px; font-size: 12px; color: var(--muted); }
.adm-legend span { display: inline-flex; align-items: center; gap: 7px; }
.adm-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.adm-legend i.c { background: var(--accent); }
.adm-legend i.r { background: var(--danger); }
.adm-totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding-top: 16px; border-top: 1px solid var(--border); }
.adm-totals div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.adm-totals span { font-size: 12px; color: var(--muted); }
.adm-totals b { font-size: 16px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* tables */
.adm-table-card { padding: 0; }
.adm-th { padding: 22px 24px 16px; flex-wrap: wrap; }
.adm-search { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 10px; background: var(--input-bg); border: 1px solid var(--input-border); color: var(--muted); }
.adm-search input { border: 0; background: transparent; outline: none; color: var(--ink); font: inherit; font-size: 13px; width: 200px; }
.adm-table { display: flex; flex-direction: column; }
.adm-tr { display: grid; align-items: center; gap: 12px; padding: 13px 24px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text); }
.adm-tr[hidden] { display: none; }
.adm-thead { padding-top: 10px; padding-bottom: 10px; font-size: 12px; color: var(--muted); background: var(--neutral-soft); }
.adm-table.cust .adm-tr { grid-template-columns: minmax(0, 2.2fr) minmax(0, .9fr) minmax(0, 1.3fr) minmax(0, 1.3fr) minmax(0, 1.1fr) minmax(0, .9fr); }
.adm-table.pays .adm-tr { grid-template-columns: minmax(0, 2fr) minmax(0, .8fr) minmax(0, .9fr) minmax(0, .9fr) minmax(0, 1.1fr); }
.adm-table.refs .adm-tr { grid-template-columns: minmax(0, 2fr) minmax(0, .8fr) minmax(0, 1.4fr) minmax(0, 1.2fr); }
.adm-table.attn .adm-tr { grid-template-columns: minmax(0, 1.6fr) minmax(0, .7fr) minmax(0, 1fr) minmax(0, 2.4fr); }   /* Needs attention */
.adm-attn .adm-small { padding: 0 24px 18px; margin: 0; }
.adm-table.recov .adm-tr { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.3fr) minmax(0, 1.3fr) minmax(0, .8fr); }   /* Recovered purchases */
.adm-table.recov .adm-direct { background: var(--neutral-soft); }
.adm-table.recov .adm-direct .adm-who b { font-weight: 500; color: var(--text); }
.adm-recov .adm-small { padding: 14px 24px 18px; margin: 0; border-top: 1px solid var(--border); }
.adm-recov .empty-state { padding-bottom: 26px; }
.adm-who { display: flex; flex-direction: column; min-width: 0; }
.adm-who b { font-size: 14px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adm-who small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adm-num { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.adm-num small { font-weight: 400; color: var(--muted); }
.adm-tr .chip { justify-self: start; white-space: nowrap; }
.adm-table-card .empty-state { padding: 34px 24px 38px; }
.adm-table-card .empty-state[hidden] { display: none; }   /* .empty-state sets display: flex, which would beat the hidden attribute */
.adm-foot { margin: 4px 0 0; font-size: 12px; line-height: 1.6; color: var(--muted); max-width: 980px; }
.adm-empty-page { max-width: 620px; }

@media (max-width: 1180px) {
  .adm-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adm-row.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adm-row.three > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 1023px) {
  .adm-top { padding: 14px 20px; }
  .adm-main { padding: 22px 20px 40px; }
  .adm-row.two { grid-template-columns: minmax(0, 1fr); }
  .adm-table.cust .adm-thead { display: none; }
  .adm-table.cust .adm-tr { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); row-gap: 10px; }
  .adm-table.cust .adm-tr > .adm-who { grid-column: 1 / -1; }
  .adm-table.cust .adm-tr > span[data-l]::before { content: attr(data-l); display: block; font-size: 11px; color: var(--muted); margin-bottom: 3px; }
}
@media (max-width: 640px) {
  .adm-top { padding: 12px 16px; gap: 10px; }
  .adm-top .lockup b { font-size: 16px; }
  .adm-tools .btn span { display: none; }
  .adm-tools .btn { width: 38px; padding: 0; }
  .adm-main { padding: 18px 16px 32px; }
  .adm-body { gap: 14px; }
  .adm-head h1 { font-size: 24px; }
  .adm-kpis { gap: 10px; }
  .adm-kpi { padding: 16px; }
  .adm-kpi .v { font-size: 24px; }
  .adm-kpi .s { font-size: 11px; }
  .adm-kpi .l span { white-space: normal; }   /* "Collected in September" wraps instead of cutting off */
  .adm-row.three { grid-template-columns: minmax(0, 1fr); }
  .adm-card { padding: 20px; }
  .adm-bar { grid-template-columns: minmax(0, 104px) minmax(0, 1fr) 28px; gap: 10px; }
  .adm-chart { gap: 8px; height: 190px; }
  .adm-amt { font-size: 10px; }
  .adm-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adm-th { padding: 18px 18px 14px; }
  .adm-search { width: 100%; }
  .adm-search input { width: 100%; }
  .adm-tr { padding: 12px 18px; }
  .adm-table.pays .adm-tr, .adm-table.refs .adm-tr { grid-template-columns: minmax(0, 1fr) auto; row-gap: 6px; }
  .adm-table.pays .adm-tr > .adm-who, .adm-table.refs .adm-tr > .adm-who { grid-column: 1 / -1; }
  .adm-table.pays .adm-tr > span[data-l="Package"] { display: none; }
  .adm-table.attn .adm-tr { grid-template-columns: minmax(0, 1fr) auto; row-gap: 6px; }
  .adm-table.attn .adm-tr > .adm-who, .adm-table.attn .adm-tr > span[data-l="Detail"] { grid-column: 1 / -1; }
  .adm-attn .adm-small { padding: 0 18px 16px; }
  .adm-table.recov .adm-thead { display: none; }
  .adm-table.recov .adm-tr { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); row-gap: 8px; }
  .adm-table.recov .adm-tr > .adm-who { grid-column: 1 / -1; }
  .adm-table.recov .adm-tr > span[data-l]::before { content: attr(data-l); display: block; font-size: 11px; font-weight: 400; color: var(--muted); margin-bottom: 3px; }
  .adm-recov .adm-small { padding: 12px 18px 16px; }
}
