.admin-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.admin-header {
  padding: 2rem 1.5rem 0.5rem;
  text-align: center;
}

.admin-header h1 {
  margin: 0.2rem 0 0;
}

.admin-main {
  flex: 1;
  /* Was 46rem -- on any laptop-or-wider screen that left most of the
     window empty on both sides while the participant list, the very
     thing an admin scans most, was squeezed into a narrow column and
     wrapped onto extra lines. 72rem still reads fine as a centered
     column, just a much less wasteful one. */
  max-width: 72rem;
  margin: 0 auto;
  padding: 1rem 1.5rem 3rem;
  width: 100%;
}

.admin-session-line {
  color: var(--muted);
  margin-bottom: 1.25rem;
}

.admin-summary,
.admin-results,
.admin-visits {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  box-shadow: var(--shadow);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.admin-visits h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.admin-visits > p {
  margin: 0 0 0.9rem;
}

.admin-visit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(6rem, 1fr));
  gap: 0.75rem;
}

.admin-visit-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.6rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  background: var(--canvas);
  text-align: center;
}

.admin-visit-window {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.admin-visit-stat strong {
  font-size: 1.4rem;
  color: var(--ink);
}

.admin-visit-fineprint {
  margin-top: 0.1rem;
}

.admin-daily-chart {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  box-shadow: var(--shadow);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.admin-daily-chart h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.admin-daily-chart > p {
  margin: 0 0 0.9rem;
}

.admin-chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 0.1rem;
}

.admin-chart-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  flex: 1 1 2.2rem;
  min-width: 2.2rem;
}

.admin-chart-bar-value {
  font-size: 0.75rem;
  color: var(--muted);
  min-height: 1.1em;
}

.admin-chart-bar-track {
  width: 100%;
  height: 6rem;
  display: flex;
  align-items: flex-end;
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: 0.3rem;
  overflow: hidden;
}

.admin-chart-bar-fill {
  width: 100%;
  background: var(--purple);
  border-radius: 0.2rem 0.2rem 0 0;
}

.admin-chart-bar-label {
  font-size: 0.65rem;
  color: var(--muted);
  white-space: nowrap;
}

.admin-results {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.admin-results-header h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.admin-results-header p {
  margin: 0;
}

.admin-results-action {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.admin-summary-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.admin-summary-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.admin-filter-tabs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.admin-filter-tab,
.admin-metric-tab {
  border: 1px solid var(--border);
  background: var(--canvas);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.admin-filter-tab[aria-pressed="true"],
.admin-metric-tab[aria-pressed="true"] {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
}

.admin-copy-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: flex-start;
}

.admin-copy-row textarea {
  flex: 1 1 16rem;
  min-width: 0;
  resize: vertical;
  font: inherit;
  font-size: 0.85rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  background: var(--canvas);
  color: var(--ink);
}

.admin-copy-status {
  font-size: 0.85rem;
  color: var(--direct-strong);
  align-self: center;
  min-width: 5rem;
}

.admin-participant-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  /* Was 0.6rem -- with dozens of entries this is the one gap that repeats
     once per row, so it is the highest-leverage place to trim vertical
     space without the list turning into an illegible wall of text. */
  gap: 0.35rem;
}

.admin-participant-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  /* Was 0.8rem 1rem -- less top/bottom padding per card, same reasoning
     as the list gap above. */
  padding: 0.5rem 1rem;
  /* Always a fixed two-row stack (info, then actions) rather than a
     wrapping flex row. That used to let short info lines share a row
     with the buttons (flush right) while longer ones -- e.g. with the
     "endret N ganger" note appended -- pushed the buttons onto their
     own line starting flush left, so the button column jumped left and
     right from card to card. A fixed stack plus flex-end below (see
     .admin-participant-actions) keeps the buttons in the same place on
     every card regardless of how long any one line of info is. */
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* Was a column (name / email / delivered-at stacked on three lines) --
   name and email now share one line, with delivered-at (and, when it
   applies, the "endret N ganger" note folded into that same string by
   admin.js) following on the same line too whenever there's room. Only
   wraps onto more lines on a narrow viewport, where there is no room. */
.admin-participant-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 0.6rem;
  row-gap: 0.15rem;
  min-width: 0;
}

.admin-participant-main > :not(:first-child) {
  padding-left: 0.6rem;
  border-left: 1px solid var(--border);
}

.admin-email-link {
  color: var(--focus);
  font-size: 0.9rem;
  word-break: break-all;
}

.admin-muted {
  color: var(--muted);
  font-size: 0.82rem;
}

.admin-participant-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  /* Right-aligned so the button column lines up the same way on every
     card -- see the comment on .admin-participant-card above. */
  justify-content: flex-end;
}

.admin-payment-badge {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
}

.admin-payment-badge[data-status="confirmed"] {
  background: var(--direct);
  color: var(--direct-strong);
}

.admin-payment-badge[data-status="none"],
.admin-payment-badge[data-status="pending"] {
  background: var(--playoff);
  color: var(--playoff-strong);
}

.admin-payment-badge[data-status="rejected"] {
  background: var(--eliminated);
  color: var(--eliminated-strong);
}

.admin-empty-note {
  color: var(--muted);
  text-align: center;
  padding: 1.5rem 0;
}

.admin-change-badge {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--playoff);
  color: var(--playoff-strong);
  white-space: nowrap;
}

.admin-login-badge {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--surface-muted, #eceaf6);
  color: var(--ink, #1d1b3a);
  white-space: nowrap;
}

.admin-administrators {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  box-shadow: var(--shadow);
  padding: 1.1rem 1.25rem;
  margin-top: 1.25rem;
}

.admin-administrators h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.admin-administrators > p {
  margin: 0 0 0.9rem;
}

.admin-administrator-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.admin-administrator-row {
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.5rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.admin-administrator-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  min-width: 0;
}

.admin-administrator-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.9rem;
  font-size: 0.82rem;
}

.admin-inactive-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--eliminated);
  color: var(--eliminated-strong);
  white-space: nowrap;
}

/* This dialog is meant to show all 36 clubs at a glance -- a single
   scrolling column only fit ~33 before the administrator had to scroll,
   which defeats "see the whole bong at once". Two columns roughly halves
   the height needed, and #view-entry-dialog below gives it the extra width
   that needs. max-height/overflow stay as a fallback for a short viewport
   (a small laptop window, a phone in landscape), not the normal case. */
.admin-view-ranking {
  margin: 0.75rem 0 0;
  padding-left: 1.5rem;
  columns: 2;
  column-gap: 1.5rem;
  max-height: 80vh;
  overflow-y: auto;
}

.admin-view-ranking li {
  break-inside: avoid;
  padding: 0.15rem 0.4rem;
  margin: 0.05rem 0;
  border-radius: 0.4rem;
}

/* Same subtle tier backgrounds as .club-row on the ranking page itself
   (var(--direct)/--playoff/--eliminated, defined in ranking.css, which this
   page already loads) -- so an admin scanning a submitted bong can tell the
   three groups apart at a glance instead of counting down to position 9 and
   25 each time. */
.admin-view-ranking li.zone-direct {
  background: var(--direct);
  color: var(--direct-strong);
}

.admin-view-ranking li.zone-playoff {
  background: var(--playoff);
  color: var(--playoff-strong);
}

.admin-view-ranking li.zone-eliminated {
  background: var(--eliminated);
  color: var(--eliminated-strong);
}

#view-entry-dialog {
  width: min(calc(100% - 2rem), 640px);
}


/* --- Rangering (after the deadline) ------------------------------------ */
.admin-standing {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  box-shadow: var(--shadow);
  padding: 1.1rem 1.25rem;
}

.admin-standing-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.admin-standing-header h2 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}

.admin-standing-header p {
  margin: 0;
}

.admin-standing-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.admin-standing-scroll {
  overflow-x: auto;
}

.admin-standing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}

.admin-standing-table th {
  text-align: right;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.3rem 0.6rem 0.5rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.admin-standing-table th:nth-child(2),
.admin-standing-table th:last-child,
.admin-standing-table td:nth-child(2),
.admin-standing-table td:last-child {
  text-align: left;
}

.admin-standing-table td {
  text-align: right;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.admin-standing-table tbody tr:last-child td {
  border-bottom: 0;
}

.admin-standing-table .admin-standing-rank {
  width: 2.2rem;
  text-align: center;
  font-weight: 800;
}

.admin-standing-table td.admin-standing-rank {
  color: var(--muted);
}

.admin-standing-table tr[data-podium] td.admin-standing-rank {
  color: var(--ink, #1d1b3a);
}

.admin-standing-table tr[data-podium="1"] { background: color-mix(in srgb, #f6c744 18%, transparent); }
.admin-standing-table tr[data-podium="2"] { background: color-mix(in srgb, #b6bcc8 20%, transparent); }
.admin-standing-table tr[data-podium="3"] { background: color-mix(in srgb, #d99a64 18%, transparent); }

.admin-standing-name {
  font-weight: 600;
}

.admin-standing-points {
  min-width: 8rem;
}

.admin-standing-points-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
}

.admin-standing-bar {
  flex: 1 1 4rem;
  max-width: 6rem;
  height: 0.4rem;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.admin-standing-bar > span {
  display: block;
  height: 100%;
  background: var(--direct-strong, #1f7a3d);
}

.admin-standing-total {
  font-weight: 800;
  font-size: 1rem;
  min-width: 2.2rem;
}

.admin-standing-table td.is-zero {
  color: var(--muted);
}

/* ---- activity chart header + metric switch ---- */

.admin-activity-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem 1rem;
  margin-bottom: 0.9rem;
}

.admin-activity-head p {
  margin: 0;
}

.admin-chart-bar-fill.is-empty {
  background: transparent;
}

/* ---- results status ---- */

.admin-results-status {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.admin-results-status p {
  margin: 0;
}

.admin-results-count strong {
  font-size: 1.05rem;
}

.admin-results-rounds {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.admin-results-rounds li {
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--canvas);
  color: var(--muted);
  font-size: 0.8rem;
}

.admin-results-rounds li.is-done {
  border-color: transparent;
  background: #dff3e4;
  color: #1f6b35;
  font-weight: 700;
}

.admin-results-rounds li.is-partial {
  border-color: #e6c76a;
  background: #fdf4d6;
  color: #7a5a00;
  font-weight: 700;
}

.admin-results-hint {
  font-size: 0.92rem;
}

.admin-results-hint.is-action {
  color: #7a5a00;
  font-weight: 700;
}

.admin-results-hint.is-done {
  color: #1f6b35;
  font-weight: 700;
}

.admin-activity-summary {
  margin: 0 0 0.25rem;
  font-weight: 700;
}

.admin-activity-summary:empty {
  display: none;
}
