/* Admin surface and SSO auth additions (W6 + W9). Builds on the app token layer; reuses the
   shared components (.card, .table, .btn, .badge, .pill, .field, .kv) and adds only the
   layout glue the People, Person, Invitation and auth screens need. */

/* --- shared small helpers -------------------------------------------------------------- */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.sub { display: block; font-size: var(--a-fs-12); color: var(--a-text-3); }
.link { color: var(--a-accent); }
ul.plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--a-s-1); }

/* --- people ---------------------------------------------------------------------------- */
.admin-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--a-s-3); flex-wrap: wrap;
}
.admin-search { display: flex; gap: var(--a-s-2); flex: 1 1 320px; }
.admin-search input {
  flex: 1; height: 36px; padding: 0 var(--a-s-3);
  border: 1px solid var(--a-border-strong); border-radius: var(--a-r-1);
  background: var(--a-panel); color: var(--a-text);
}
.admin-filters { display: flex; flex-wrap: wrap; gap: var(--a-s-2); }
.admin-filters .pill { cursor: pointer; }
/* The current filter uses a tonal fill, not a link colour, so it stays visible in every
   theme (the docs found a link-coloured current state invisible at night). */
.admin-filters .pill.active {
  background: var(--a-selected);
  border: 1px solid var(--a-border-strong);
  color: var(--a-text);
  font-weight: 600;
}
.admin-pending summary { cursor: pointer; font-weight: 600; }
.admin-people td { vertical-align: top; }

/* --- person ---------------------------------------------------------------------------- */
.admin-back { margin: 0; font-size: var(--a-fs-13); }
.admin-back a { display: inline-block; min-height: 24px; line-height: 24px; }
.admin-memberships { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--a-s-3); }
.admin-memberships li {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--a-s-3); flex-wrap: wrap;
  padding-bottom: var(--a-s-3); border-bottom: 1px solid var(--a-border);
}
.admin-memberships li:last-child { border-bottom: 0; padding-bottom: 0; }
.admin-membership-name { font-weight: 500; display: flex; align-items: center; gap: var(--a-s-2); }
.admin-membership-actions { display: flex; align-items: center; gap: var(--a-s-2); flex-wrap: wrap; min-width: 0; max-width: 100%; }
.admin-remove { display: flex; align-items: center; gap: var(--a-s-2); flex-wrap: wrap; min-width: 0; max-width: 100%; }
.admin-remove input {
  height: 32px; padding: 0 var(--a-s-2);
  border: 1px solid var(--a-border-strong); border-radius: var(--a-r-1);
  background: var(--a-panel); color: var(--a-text);
}
.admin-actions { display: flex; gap: var(--a-s-3); flex-wrap: wrap; }
.admin-confirm { display: flex; flex-direction: column; gap: var(--a-s-2); margin-top: var(--a-s-3); }

/* --- activity -------------------------------------------------------------------------- */
.admin-activity-filters {
  display: flex; align-items: flex-end; gap: var(--a-s-3); flex-wrap: wrap;
  margin-bottom: var(--a-s-3);
}
.admin-activity-filters select, .admin-activity-filters input {
  height: 36px; padding: 0 var(--a-s-2);
  border: 1px solid var(--a-border-strong); border-radius: var(--a-r-1);
  background: var(--a-panel); color: var(--a-text);
}
.admin-activity-table td { overflow-wrap: anywhere; }
.admin-pager { display: flex; justify-content: flex-end; gap: var(--a-s-2); margin-top: var(--a-s-3); }

/* --- invitation form and detail -------------------------------------------------------- */
.admin-form { display: flex; flex-direction: column; gap: var(--a-s-4); max-width: 560px; }
.field-row { display: flex; gap: var(--a-s-3); flex-wrap: wrap; }
.field-row .field { flex: 1 1 200px; }
.admin-form fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--a-s-2); }
.admin-form legend { font-size: var(--a-fs-13); font-weight: 500; padding: 0; margin-bottom: var(--a-s-1); }
.admin-form select, .admin-form input[type="text"], .admin-form input[type="email"] {
  height: 36px; padding: 0 var(--a-s-3);
  border: 1px solid var(--a-border-strong); border-radius: var(--a-r-1);
  background: var(--a-panel); color: var(--a-text);
}
.admin-link-input { width: 100%; height: 36px; padding: 0 var(--a-s-3);
  border: 1px solid var(--a-border-strong); border-radius: var(--a-r-1);
  background: var(--a-raised); color: var(--a-text); }
.admin-link-row { display: flex; align-items: center; gap: var(--a-s-2); margin: var(--a-s-2) 0; }
/* The same rule app.css keeps for .kv: no script, no dead button. */
.admin-link-row [data-copy]:not([data-ready]) { display: none; }
.admin-message { white-space: pre-wrap; color: var(--a-text-2); }

/* --- auth additions (sign-in, no-access, notice, invite) ------------------------------- */
.auth-primary { width: 100%; justify-content: center; gap: var(--a-s-2); margin-bottom: var(--a-s-3); }
.auth-actions { display: flex; gap: var(--a-s-3); flex-wrap: wrap; margin-top: var(--a-s-4); }
.auth-trouble { margin-top: var(--a-s-4); font-size: var(--a-fs-13); color: var(--a-text-3); text-align: center; }
.checks { margin: var(--a-s-3) 0; padding-left: var(--a-s-5); display: flex; flex-direction: column; gap: var(--a-s-1); }
.eyebrow { font-size: var(--a-fs-12); color: var(--a-text-3); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 var(--a-s-1); }

/* --- connected stations ---------------------------------------------------------------- */
.admin-lede { margin: 0; color: var(--a-text-2); max-width: 62ch; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* A sticky header inside a scroll box would stick to the box, not the page: let it scroll with the table. */
.table-scroll .table thead th { position: static; }
.admin-stations td, .admin-externals td { vertical-align: top; }

/* --- mountpoint catalog ---------------------------------------------------------------- */
.admin-mounts input[type="text"],
.admin-mounts textarea {
  width: 100%; min-width: 0; height: 36px; padding: 0 var(--a-s-2);
  border: 1px solid var(--a-border-strong); border-radius: var(--a-r-1);
  background: var(--a-panel); color: var(--a-text);
}
.admin-mounts td:has(> input[type="text"], > textarea) { min-width: 130px; }
/* Catalog prose must be readable while editing; grow to the text instead of clipping one line. */
.admin-mounts textarea {
  field-sizing: content; height: auto; min-height: 6em; padding: var(--a-s-2);
  font: inherit; line-height: var(--a-lh); resize: vertical;
}
.admin-mounts-actions { display: flex; flex-direction: column; gap: var(--a-s-2); width: 112px; }
.card > .hint { margin-top: var(--a-s-3); }
/* The eight columns need 905 px with tight gutters. The sidebar gives way to the rail at 1199 px,
   so the room rises and falls as the viewport widens: the table answers to its own box, not the
   viewport. Where the columns do not fit each row is the phone's stacked card, so the row's
   actions are never behind a horizontal scroll. */
.table-scroll:has(> .admin-mounts) { container-type: inline-size; }
@container (width >= 920px) {
  .table.admin-mounts thead th { padding: 0 var(--a-s-2); }
  .table.admin-mounts tbody td { padding: var(--a-s-2); }
}
@container (width < 920px) {
  .admin-mounts, .admin-mounts tbody, .admin-mounts tr, .admin-mounts td { display: block; }
  .admin-mounts thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .admin-mounts tbody { display: flex; flex-direction: column; gap: var(--a-s-3); }
  .admin-mounts tbody tr {
    display: flex; flex-direction: column;
    padding: var(--a-s-2) var(--a-s-4);
    background: var(--a-panel); border: 1px solid var(--a-border); border-radius: var(--a-r-2);
  }
  .admin-mounts tbody td {
    display: flex; align-items: center; justify-content: space-between; gap: var(--a-s-4);
    height: auto; min-height: 36px; padding: 6px 0; border-bottom: 0; text-align: right;
  }
  .admin-mounts tbody td + td { border-top: 1px solid color-mix(in srgb, var(--a-border) 55%, transparent); }
  .admin-mounts td[data-label]::before { content: attr(data-label); flex: none; font-size: var(--a-fs-12); color: var(--a-text-2); text-align: left; }
  .admin-mounts td:has(> input[type="text"], > textarea) { flex-direction: column; align-items: stretch; gap: var(--a-s-1); text-align: left; }
  .admin-mounts-actions { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-end; width: auto; }
}

.admin-form input[type="password"], .admin-form textarea {
  padding: 0 var(--a-s-3);
  border: 1px solid var(--a-border-strong); border-radius: var(--a-r-1);
  background: var(--a-panel); color: var(--a-text);
}
.admin-form input[type="password"] { height: 36px; }
.admin-form textarea { padding: var(--a-s-2) var(--a-s-3); font: inherit; resize: vertical; }
.admin-form .field input, .admin-form .field select { width: 100%; box-sizing: border-box; }
.admin-probe { display: flex; align-items: center; gap: var(--a-s-2); flex-wrap: wrap; }

/* --- positioning report ------------------------------------------------------------------ */
.report-asof { margin: 0; color: var(--a-text-2); font-size: var(--a-fs-13); }
.report-tiles p { margin: 0; }
.report-tiles .tile-value .reason { font-size: var(--a-fs-14); }
.report-tiles .tile-sub { color: var(--a-text-2); }
/* The history link sits at the top right beside the label, so a tile is three lines, not four. */
.report-tiles .tile { padding-block: var(--a-s-3); display: grid; grid-template-columns: minmax(0, 1fr) auto; align-content: start; column-gap: var(--a-s-2); }
.report-tiles .tile > * { grid-column: 1 / -1; }
.report-tiles .tile > .tile-label { grid-column: 1; grid-row: 1; align-self: center; }
.report-tiles .tile > .tile-link { grid-column: 2; grid-row: 1; }
@media (max-width: 1199px) { .report-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 767px) { .report-tiles { grid-template-columns: minmax(0, 1fr); } }
/* Links in the small type of a tile or table still meet the 24 px target. */
.tile-link, .report-code { display: inline-block; min-height: 24px; line-height: 24px; }
.tile-link { font-size: var(--a-fs-13); }
/* One screen at 1440x900 (UX L1): the stations table takes the wide column, baselines and storage
 * the narrow one, so the page height is set by the table and not by the sum of every card. Under
 * 1280 px the columns stack and the page scrolls as any other. */
.report-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: var(--a-s-4); align-items: start; }
/* Fixed shares, so the long sentences (gap, grade) get the room and each row stays two or three
 * lines high instead of five. Each share also holds its own header's longest word
 * ("Day-to-day" of "Day-to-day change", "Independent") at 1440 px. */
.report-stations .table { table-layout: fixed; }
.report-stations th:nth-child(1) { width: 14%; }
.report-stations th:nth-child(2) { width: 19%; }
.report-stations th:nth-child(3) { width: 12%; }
.report-stations th:nth-child(4) { width: 20%; }
.report-stations th:nth-child(5) { width: 11%; }
.report-stations th:nth-child(6) { width: 24%; }
.report-stations thead th { white-space: normal; }
/* A status badge may wrap between its words in a narrow column, never inside one. */
.report-stations .badge { white-space: normal; overflow-wrap: normal; word-break: keep-all; height: auto; max-width: 100%; line-height: 1.3; padding-block: 2px; }
.report-side { display: flex; flex-direction: column; gap: var(--a-s-3); min-width: 0; }
@media (max-width: 1279px) { .report-grid { grid-template-columns: minmax(0, 1fr); } }
.report-card { padding: var(--a-s-3) var(--a-s-4); }
.report-card .card-head { margin-bottom: var(--a-s-2); }
.report-card .card-head .hint { text-align: right; }
.report-sub { margin: 0 0 var(--a-s-2); font-size: var(--a-fs-13); font-weight: 600; }
.report-card .report-sub { margin: var(--a-s-2) 0 2px; }
.report-line { margin: 0; font-size: var(--a-fs-13); }
.report-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: var(--a-s-2); }
.report-note { display: block; font-size: var(--a-fs-12); color: var(--a-text-2); }
/* Heading, count and disclosure share lines; an opened list takes the full width below them. */
.report-used { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: var(--a-s-2); margin-top: var(--a-s-2); }
.report-card .report-used > .report-sub { margin: 0; }
.report-used > .report-more { margin-top: 0; }
.report-used > .report-more[open] { flex-basis: 100%; }
.report-stability { font-size: var(--a-fs-13); }
.report-stability th[scope="row"] { padding: 0 6px; font-weight: 500; text-align: left; }
.report-stability thead th, .report-stability td { padding: 0 6px; }
.report-stability thead th { height: 28px; }
.report-stability tbody td { height: 30px; }
/* A millimetre figure never breaks between number and unit. */
.report-stability .value { white-space: nowrap; }
.report-stations[data-long] { max-height: 320px; overflow-y: auto; }
.report-stations td, .audit-services td { padding-block: var(--a-s-2); vertical-align: top; }
.report-stations td { font-size: var(--a-fs-13); line-height: 1.35; padding-block: 6px; }
.report-stations thead th, .report-stations td { padding-inline: var(--a-s-2); }
/* Counts on the first line, the bar and how many days it covers on the second. */
.report-grade { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 2px var(--a-s-2); }
.report-grade > .value, .report-grade > .reason { grid-column: 1 / -1; }
.report-grade .grade-bar { margin-block: 0; min-width: 48px; width: 48px; }
/* Sentences wrap inside their own cell between words; a word longer than the cell (a long
 * identifier) breaks rather than run into the next column. Only a number and its unit stay whole. */
.report-stations td > * { min-width: 0; overflow-wrap: break-word; }
/* The badge keeps at least its longest word, so it never shrinks to a letter per line. */
.report-stations .report-coord { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: min-content; }
.report-coord > .badge { min-width: min-content; flex: none; }
.report-coord > .report-needs { margin-top: 0; }
.report-coord > .report-needs > summary { min-height: 24px; line-height: 24px; font-size: var(--a-fs-12); white-space: nowrap; }
.report-coord > .report-needs > .report-note { margin: 0 0 var(--a-s-1); }
.report-stations .nobr { white-space: nowrap; }
/* Six short label-value pairs in two columns, each label over its value. */
.report-effect { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px var(--a-s-3); }
.report-effect > .report-wide { grid-column: 1 / -1; }
.report-effect > div { display: flex; flex-direction: column; min-width: 0; }
.report-effect dt { font-size: var(--a-fs-12); color: var(--a-text-2); }
.report-effect dd { margin: 0; font-size: var(--a-fs-13); min-width: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
/* Depth the owner opens on purpose: closed by default, and its summary is a full 24 px target. */
.report-more { margin-top: var(--a-s-2); }
.report-more > summary { min-height: 24px; line-height: 24px; cursor: pointer; font-size: var(--a-fs-13); color: var(--a-text-2); }
.report-more > .report-list { margin-top: var(--a-s-2); }
/* The hosts value is its own summary line: it reads as the figure under its label, with each host one click away. */
.report-effect .report-hosts { margin-top: 0; }
.report-effect .report-hosts > summary { color: var(--a-text); }
#storage { scroll-margin-top: calc(var(--a-topbar-h) + var(--a-s-4)); }

/* --- independent checks ------------------------------------------------------------------ */
.audit-next, .audit-state, .audit-mark { display: flex; align-items: center; gap: var(--a-s-3); flex-wrap: wrap; }
.audit-next { justify-content: space-between; }
.audit-next p, .audit-state { margin: 0; }
.audit-mark { margin: 0 0 var(--a-s-3); }
.audit-permission { gap: var(--a-s-2); min-width: 220px; }
.audit-package dd { flex-wrap: wrap; gap: var(--a-s-2); }
.audit-package .btn { height: auto; min-height: 24px; white-space: normal; overflow-wrap: anywhere; }
.audit-howto { margin: 0 0 var(--a-s-3); padding-inline-start: 1.5em; }
.audit-howto li + li { margin-top: var(--a-s-1); }
.audit-point + .audit-point { margin-top: var(--a-s-4); padding-top: var(--a-s-4); border-top: 1px solid var(--a-border); }
.audit-steps summary { min-height: 24px; line-height: 24px; cursor: pointer; }
.audit-steps ol { margin: var(--a-s-2) 0 0; padding-inline-start: 1.5em; }

/* Support requests (0.62): the person's own words keep their line breaks. */
.admin-support-body { margin: var(--a-s-3) 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.admin-support-notes { list-style: none; margin: 0 0 var(--a-s-4); padding: 0; display: flex; flex-direction: column; gap: var(--a-s-3); }
.admin-support-notes .admin-support-body { margin: var(--a-s-1) 0 0; }
