/*
 * Cohort Desk (owner only): /admin/ and /admin/members.html.
 * On top of /css/tokens.css and /css/site.css; colours and fonts come from the tokens only.
 * Mobile first: one column, the release bar sticks to the bottom of the screen.
 */

.page.admin { max-width: 980px; padding-bottom: 96px; }
.admin [hidden] { display: none !important; }

/* Header and navigation */
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 14px 20px; flex-wrap: wrap; margin-bottom: 36px; }
.admin-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-nav a {
  font-size: 14px; color: var(--muted); text-decoration: none;
  padding: 7px 12px; border-radius: 20px; border: 1px solid transparent;
}
.admin-nav a:hover { color: var(--ink); background: var(--tint); }
.admin-nav a[aria-current="page"] { color: var(--ink); font-weight: 500; border-color: var(--field-border); background: var(--card); }

.admin h1 { font-family: var(--serif); font-weight: 500; font-size: 32px; line-height: 1.2; color: var(--ink); margin: 0 0 8px; }
.admin h1:focus { outline: none; }
.admin h2 { font-family: var(--serif); font-weight: 500; font-size: 22px; line-height: 1.3; color: var(--ink); margin: 44px 0 6px; }
.admin h3 { font-size: 15px; font-weight: 600; margin: 0 0 6px; color: var(--text); }
.admin .eyebrow { margin-bottom: 10px; }
.lede { font-size: 15.5px; color: var(--muted); margin: 0 0 22px; max-width: 62ch; }
.section-note { font-size: 14px; color: var(--muted); margin: 0 0 16px; max-width: 70ch; }
.section-note strong { color: var(--text); font-weight: 500; }

/* Notices: sign in, not the owner, errors, results */
.notice {
  margin: 0 0 24px; padding: 14px 18px; font-size: 15px; line-height: 1.6;
  background: var(--card); border: 1px solid var(--hairline); border-left: 3px solid var(--gold); border-radius: 8px;
}
.notice p { margin: 0 0 8px; }
.notice p:last-child { margin-bottom: 0; }
.notice.error { border-left-color: var(--danger); background: var(--danger-bg); border-color: var(--danger-line); }
.notice:focus { outline: none; }
.notice:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.notice[hidden] { display: none; }

/* Buttons that sit in a line */
.btn.inline { display: inline-flex; align-items: center; justify-content: center; width: auto; height: 44px; padding: 0 18px; margin: 0; font-size: 15px; }
.btn.inline.small { height: 38px; padding: 0 14px; font-size: 14px; }
.btn:disabled { cursor: not-allowed; }
.actions-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 12px; }

input[type="number"] {
  display: block; width: 100%; height: 48px; padding: 0 14px;
  font-family: var(--sans); font-size: 16px; color: var(--text);
  background-color: var(--card); border: 1px solid var(--field-border); border-radius: 8px;
}
input[type="number"]:hover { border-color: var(--ink); }
input[type="number"]:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; border-color: var(--ink); }
input[type="checkbox"] { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--ink); cursor: pointer; }
input[type="checkbox"]:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.field .hint { font-size: 13px; color: var(--muted); margin: 5px 0 0; line-height: 1.45; }

/* Numbers: tiles */
.status-line { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin: 0 0 18px; }
.status-line p { margin: 0; font-size: 14px; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin: 0; }
.tile { background: var(--card); border: 1px solid var(--hairline); border-radius: 12px; padding: 14px 16px 16px; margin: 0; }
.tile dt { font-size: 13px; color: var(--muted); line-height: 1.4; margin: 0 0 6px; }
.tile dd { margin: 0; }
.tile .value { display: block; font-family: var(--serif); font-size: 32px; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.tile .sub { display: block; font-size: 12.5px; color: var(--muted); margin-top: 6px; line-height: 1.45; }

/* Numbers: tables */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--hairline); border-radius: 12px; margin: 10px 0 8px; }
.table-wrap:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
table.counts { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
table.counts caption { text-align: left; font-size: 13px; color: var(--muted); padding: 12px 14px 4px; caption-side: top; }
table.counts th, table.counts td { padding: 9px 12px; border-top: 1px solid var(--hairline); white-space: nowrap; }
table.counts thead th { border-top: none; font-size: 12.5px; font-weight: 500; color: var(--muted); text-align: right; }
table.counts thead th:first-child, table.counts tbody th { text-align: left; }
table.counts tbody th { font-weight: 500; color: var(--text); white-space: normal; min-width: 9em; max-width: 16em; overflow-wrap: anywhere; }
table.counts td { text-align: right; }
table.counts tr.total th, table.counts tr.total td { font-weight: 600; }
/* The row labels stay in view while the weeks scroll sideways. */
table.counts thead th:first-child, table.counts tbody th { position: sticky; left: 0; z-index: 1; background: var(--card); }
table.counts .small { color: var(--muted); }
table.counts td.note-cell { text-align: left; white-space: normal; color: var(--muted); font-size: 13px; }

/* Members: the queue */
.toolbar { display: grid; gap: 12px; margin: 0 0 14px; }
.toolbar form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin: 0; }
.toolbar .field { margin: 0; width: 120px; }
.toolbar .count-line { font-size: 14px; color: var(--muted); margin: 0; }
.toolbar .count-line strong { color: var(--text); font-weight: 600; }

ol.queue { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--hairline); border-radius: 12px; }
ol.queue li { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; padding: 14px 16px; border-top: 1px solid var(--hairline); }
ol.queue li:first-child { border-top: none; border-radius: 12px 12px 0 0; }
ol.queue li:last-child { border-radius: 0 0 12px 12px; }
ol.queue li.selected { background: var(--tint); }
ol.queue li > input { grid-column: 1; grid-row: 1; }
ol.queue li > :not(input) { grid-column: 2; min-width: 0; }
ol.queue label.who { font-weight: 600; font-size: 15.5px; cursor: pointer; line-height: 1.4; overflow-wrap: anywhere; }
ol.queue .meta { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.5; }
ol.queue .work { margin: 2px 0 0; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
ol.queue .addr { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.badge { display: inline-block; font-size: 12px; line-height: 1.4; padding: 1px 8px; margin-left: 6px; border-radius: 10px; border: 1px solid var(--field-border); color: var(--text); background: var(--paper); font-weight: 500; vertical-align: 1px; }
.badge.warn { border-color: var(--danger-line); color: var(--danger); background: var(--danger-bg); }
.empty { padding: 18px; margin: 0; color: var(--muted); font-size: 15px; }

/* Members: the selection strip (sticks to the bottom while the list scrolls), the release panel
   and the confirmation */
a.btn { text-decoration: none; }
.selection-strip {
  position: sticky; bottom: 12px; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 14px 0 0; padding: 8px 10px 8px 16px; min-height: 56px;
  background: var(--card); border: 1px solid var(--field-border); border-radius: 12px;
  box-shadow: 0 6px 24px rgba(34, 39, 31, 0.10);
}
.selection-strip .selected-line { margin: 0; font-size: 15px; }
.release-panel { margin: 18px 0 0; padding: 16px 18px 18px; background: var(--card); border: 1px solid var(--hairline); border-radius: 12px; scroll-margin-top: 16px; }
.release-panel form { display: grid; gap: 12px; margin: 0; }
.release-panel .field { margin: 0; }
.confirm-panel { margin: 16px 0 0; padding: 16px 18px; background: var(--paper); border: 1px solid var(--field-border); border-left: 3px solid var(--gold); border-radius: 10px; }
.confirm-panel p { margin: 0 0 10px; font-size: 15px; }
.confirm-panel .field { max-width: 220px; }
.confirm-panel[hidden] { display: none; }

/* Members: recent releases */
.releases { display: grid; gap: 12px; }
.release-card { background: var(--card); border: 1px solid var(--hairline); border-radius: 12px; padding: 16px 18px; }
.release-card p { margin: 0 0 8px; font-size: 14.5px; }
.release-card .muted { color: var(--muted); font-size: 13.5px; }
.release-card .part { border-top: 1px solid var(--hairline); margin-top: 12px; padding-top: 12px; }
.release-card form { margin: 10px 0 0; }
.release-card form .field { max-width: 220px; }

@media (min-width: 720px) {
  .toolbar { grid-template-columns: 1fr auto; align-items: end; }
  .release-panel #release-form { grid-template-columns: minmax(220px, 340px) auto; align-items: start; }
  .release-panel #release-form .btn { margin-top: 23px; }
  ol.queue li { grid-template-columns: auto 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .admin * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Undo: one step per release, a yes-or-no question under the button */
.undo-batch + .undo-batch { margin-top: 14px; }
.confirm-step { margin: 10px 0 0; }
.confirm-step p { margin: 0 0 4px; }

/* Access email: sends to settle, and lists of addresses opened on demand */
.release-card .settle { margin: 12px 0; padding: 12px 14px; background: var(--paper); border: 1px solid var(--field-border); border-left: 3px solid var(--gold); border-radius: 10px; }
.release-card .settle .actions-row { margin-top: 4px; }
.release-card details.addresses { margin: 0 0 10px; font-size: 14px; }
.release-card details.addresses summary { cursor: pointer; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; width: fit-content; }
.release-card details.addresses summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 2px; }
.release-card details.addresses ul { margin: 8px 0 0; padding-left: 20px; color: var(--muted); overflow-wrap: anywhere; }
.release-card details.addresses li { margin: 2px 0; }

/* On short screens (a phone held sideways) the selection strip scrolls with the page. */
@media (max-height: 480px) {
  .selection-strip { position: static; }
}
