/*
 * The admin's own stylesheet, loaded by /admin alone, so not one byte of it
 * reaches a public page's first view. Every colour is one of the app's tokens,
 * as styles.css's are (check.mjs holds both to the same palette): the admin is
 * the site's back room and wears the same navy and Ocean accent.
 *
 * Layout: a sidebar of sections beside a scrolling panel of cards; below
 * 760px the sidebar becomes a strip of tabs across the top.
 */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/fonts/inter-latin-wght-normal.woff2') format('woff2');
}

:root {
  color-scheme: dark;
  --surface-base: #0b1119;
  --surface-panel: #0e1520;
  --surface-block: #142131;
  --surface-well: #04090f;
  --panel-top: #132d3a;
  --panel-bottom: #0a121b;
  --border-subtle: rgba(216, 210, 255, 0.12);
  --border-panel: rgba(216, 210, 255, 0.16);
  --border-menu: rgba(156, 255, 244, 0.24);
  --accent: #00e5cf;
  --accent-light: #9cfff4;
  --text-primary: #eefcfb;
  --text-muted: rgba(216, 210, 255, 0.72);
  --text-faint: rgba(216, 210, 255, 0.56);
  --grid: rgba(216, 210, 255, 0.08);
  /* Series, in the order they are assigned: the app's accent, then its
     spectrum's violet, pink, lime and yellow. Every chart also names its
     series in a legend or label, so none is told apart by colour alone. */
  --s1: #00e5cf;
  --s2: #8b5cff;
  --s3: #ff3cac;
  --s4: #b6ff4a;
  --s5: #ffe66d;
  --good: #54ff8a;
  --warn: #ffe66d;
  --bad: #ff3cac;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', Consolas, 'SF Mono', monospace;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--surface-base);
  color: var(--text-primary);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent-light);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.admin-noscript,
.admin-loading {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0;
  color: var(--text-muted);
}

.admin-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(0, 229, 207, 0.24);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: admin-spin 0.9s linear infinite;
}

@keyframes admin-spin {
  to {
    transform: rotate(360deg);
  }
}

.admin-mark {
  flex: none;
  width: 26px;
  height: 26px;
}

.admin-mark rect {
  fill: var(--surface-block);
}

.admin-mark path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
}

.admin-mark--large {
  width: 46px;
  height: 46px;
}

/* ---------------------------------------------------------------- sign-in */

.admin-signin {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 32px 16px;
  background: radial-gradient(60% 50% at 50% 0%, rgba(0, 229, 207, 0.1), transparent 70%), var(--surface-base);
}

.admin-signin__card {
  display: grid;
  justify-items: center;
  gap: 14px;
  width: min(400px, 100%);
  padding: 32px 26px;
  border: 1px solid var(--border-panel);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bottom));
  text-align: center;
}

.admin-signin__card h1 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
}

.admin-signin__card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.admin-google {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  border-radius: 999px;
  background: var(--text-primary);
  color: var(--surface-base);
  font-weight: 650;
  text-decoration: none;
}

.admin-google svg {
  width: 18px;
  height: 18px;
}

.admin-google:hover {
  background: #fff;
}

.admin-devsignin {
  font-size: 0.85rem;
}

.admin-error {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(255, 60, 172, 0.4);
  border-radius: 10px;
  background: rgba(255, 60, 172, 0.08);
  text-align: left;
}

.admin-signin__card .admin-error {
  color: var(--text-primary);
  font-size: 0.82rem;
}

.admin-error strong {
  color: var(--bad);
}

.admin-signin__card .admin-fine {
  color: var(--text-faint);
  font-size: 0.75rem;
}

/* -------------------------------------------------------------------- app */

.admin-app {
  display: grid;
  grid-template-columns: 212px minmax(0, 1fr);
  min-height: 100vh;
}

.admin-side {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  height: 100vh;
  padding: 18px 12px;
  border-right: 1px solid var(--border-subtle);
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bottom) 40%);
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 18px;
  font-weight: 700;
}

.admin-brand small {
  display: block;
  color: var(--text-faint);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.admin-nav {
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text-muted);
  font: 500 0.9rem var(--font);
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.admin-nav:hover {
  background: rgba(156, 255, 244, 0.06);
  color: var(--text-primary);
}

.admin-nav[aria-current='page'] {
  background: rgba(0, 229, 207, 0.12);
  color: var(--accent-light);
  box-shadow: inset 2px 0 0 var(--accent);
}

.admin-side__grow {
  flex: 1;
}

.admin-who {
  display: grid;
  gap: 2px;
  padding: 10px;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-faint);
  font-size: 0.78rem;
}

.admin-who strong {
  color: var(--text-muted);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.admin-link {
  justify-self: start;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-light);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.admin-main {
  display: grid;
  align-content: start;
  gap: 18px;
  min-width: 0;
  padding: 24px clamp(14px, 3vw, 32px) 40px;
}

/* --------------------------------------------------------------- top bar */

.admin-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-top h1 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
}

.admin-hint {
  display: block;
  color: var(--text-faint);
  font-size: 0.8rem;
}

.admin-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.admin-seg {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: var(--surface-well);
}

.admin-seg button {
  padding: 5px 12px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--text-muted);
  font: 600 0.78rem var(--font);
  cursor: pointer;
}

.admin-seg button[aria-pressed='true'] {
  background: var(--surface-block);
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px var(--border-menu);
}

.admin-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 2px;
  border: 0;
  background: none;
  color: var(--text-muted);
  font: 600 0.78rem var(--font);
  cursor: pointer;
}

.admin-switch__track {
  position: relative;
  flex: none;
  width: 30px;
  height: 18px;
  border: 1px solid var(--border-panel);
  border-radius: 999px;
  background: var(--surface-well);
}

.admin-switch__track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-faint);
  transition: transform 160ms, background 160ms;
}

.admin-switch[aria-checked='true'] .admin-switch__track {
  border-color: var(--border-menu);
  background: rgba(0, 229, 207, 0.22);
}

.admin-switch[aria-checked='true'] .admin-switch__track::after {
  transform: translateX(12px);
  background: var(--accent);
}

.admin-banner {
  padding: 9px 12px;
  border: 1px solid rgba(255, 230, 109, 0.3);
  border-radius: 10px;
  background: rgba(255, 230, 109, 0.06);
  color: var(--text-muted);
  font-size: 0.82rem;
}

.admin-banner strong {
  color: var(--warn);
}

.admin-banner--error {
  border-color: rgba(255, 60, 172, 0.4);
  background: rgba(255, 60, 172, 0.08);
}

.admin-banner--error strong {
  color: var(--bad);
}

/* ------------------------------------------------------------------ tiles */

.admin-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.admin-kpi {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 14px 14px 12px;
  border: 1px solid var(--border-panel);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bottom));
}

.admin-kpi__label {
  overflow: hidden;
  color: var(--text-faint);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.admin-kpi__value {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 1.6rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.admin-kpi__meta {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-delta {
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0;
}

.admin-delta--up {
  background: rgba(84, 255, 138, 0.1);
  color: var(--good);
}

.admin-delta--down {
  background: rgba(255, 60, 172, 0.1);
  color: var(--bad);
}

.admin-spark {
  display: block;
  width: 100%;
  height: 26px;
  margin-top: 4px;
}

/* ----------------------------------------------------------------- panels */

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 14px;
}

.admin-grid--even {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-grid--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-panel {
  position: relative;
  min-width: 0;
  padding: 16px 16px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--surface-panel);
}

.admin-panel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 10px;
}

.admin-panel__head--sub {
  margin-top: 20px;
}

.admin-panel__head h2 {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 650;
}

.admin-panel__head span {
  color: var(--text-faint);
  font-size: 0.72rem;
}

.admin-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.admin-legend i,
.admin-tip i {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 3px;
  vertical-align: -1px;
}

.admin-empty {
  margin: 0;
  padding: 18px 0;
  color: var(--text-faint);
  font-size: 0.82rem;
}

.admin-note {
  margin: 12px 0 0;
  color: var(--text-faint);
  font-size: 0.78rem;
}

/* Funnel and bar lists */

.admin-funnel {
  display: grid;
  gap: 10px;
}

/* The label column is a share of the panel, so a narrow panel still leaves
   the bar most of its width. */
.admin-funnel__row {
  display: grid;
  grid-template-columns: minmax(64px, 32%) minmax(0, 1fr) minmax(40px, auto);
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
}

.admin-funnel__row > span:first-child {
  color: var(--text-muted);
}

.admin-funnel__row b {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.admin-bar {
  height: 24px;
  overflow: hidden;
  border-radius: 6px;
  background: var(--surface-well);
}

.admin-bar i {
  display: block;
  height: 100%;
  border-radius: 0 4px 4px 0;
  background: var(--s1);
}

.admin-funnel__drop {
  margin-top: -6px;
  padding-left: calc(32% + 10px);
  color: var(--text-faint);
  font-size: 0.72rem;
}

/* Inside a screen, loading takes a short block rather than the whole window. */
.admin-main .admin-loading {
  min-height: 40vh;
}

.admin-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.admin-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 10px;
  font-size: 0.82rem;
}

.admin-list__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-list__name small {
  margin-left: 6px;
  color: var(--text-faint);
}

.admin-list__value {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.admin-list__track {
  grid-column: 1 / -1;
  height: 5px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--surface-well);
}

.admin-list__track i {
  display: block;
  height: 100%;
  border-radius: 3px;
}

.admin-drill {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.admin-drill:hover {
  color: var(--accent-light);
}

.admin-sublist {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
  margin: 2px 0 6px 4px;
  padding: 0 0 0 14px;
  border-left: 1px solid var(--border-subtle);
  list-style: none;
}

/* Tables */

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

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.admin-table th {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-faint);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.admin-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}

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

.admin-table .num {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.admin-table .mono {
  font-family: var(--mono);
  font-size: 0.76rem;
}

.admin-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-block);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 650;
  white-space: nowrap;
}

.admin-pill--download {
  background: rgba(84, 255, 138, 0.1);
  color: var(--good);
}

.admin-pill--open {
  background: rgba(0, 229, 207, 0.1);
  color: var(--accent-light);
}

.admin-pill--film {
  background: rgba(139, 92, 255, 0.16);
  color: #d8d2ff;
}

.admin-pill--bot {
  background: rgba(255, 230, 109, 0.1);
  color: var(--warn);
}

/* Charts */

.admin-chart {
  position: relative;
}

.admin-chart svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.admin-chart text {
  fill: var(--text-faint);
  font: 10.5px var(--font);
  font-variant-numeric: tabular-nums;
}

.admin-tip {
  position: absolute;
  z-index: 3;
  min-width: 150px;
  padding: 8px 10px;
  border: 1px solid var(--border-menu);
  border-radius: 8px;
  background: var(--surface-block);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  font-size: 0.75rem;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 12px));
}

.admin-tip b {
  display: block;
  margin-bottom: 4px;
  color: var(--text-faint);
  font-weight: 600;
}

.admin-tip div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-variant-numeric: tabular-nums;
}

/* Films */

.admin-films {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.admin-film {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--surface-panel);
}

.admin-film__video,
.admin-film__gone {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--surface-well);
  object-fit: contain;
}

.admin-film__media {
  position: relative;
}

.admin-film__play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  width: 100%;
  padding: 0;
  border: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(4, 9, 15, 0.55));
  cursor: pointer;
}

.admin-film__play svg {
  width: 52px;
  height: 52px;
  padding: 13px 11px 13px 15px;
  border: 1px solid var(--border-menu);
  border-radius: 50%;
  background: rgba(4, 9, 15, 0.72);
  fill: var(--text-primary);
  transition: transform 160ms, background 160ms;
}

.admin-film__play:hover svg,
.admin-film__play:focus-visible svg {
  transform: scale(1.08);
  background: var(--surface-block);
}

.admin-film__play:focus-visible {
  outline: 2px solid var(--s1);
  outline-offset: -2px;
}

.admin-film__media.is-playing .admin-film__play {
  display: none;
}

.admin-film__none {
  margin: 0;
  color: var(--text-faint);
  font-size: 0.8rem;
}

.admin-film__gone {
  display: grid;
  place-items: center;
  color: var(--text-faint);
  font-size: 0.8rem;
}

.admin-film__body {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 14px 16px 16px;
}

.admin-film header h3 {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.3;
}

.admin-film header p {
  margin: 3px 0 0;
  color: var(--text-faint);
  font-size: 0.76rem;
}

.admin-film__plays {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 2px 8px;
}

.admin-film__plays b {
  font-size: 1.9rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.admin-film__plays > span:not(.admin-bar) {
  color: var(--text-faint);
  font-size: 0.8rem;
}

.admin-film__plays .admin-bar {
  grid-column: 1 / -1;
  margin-top: 6px;
}

.admin-film__stats {
  display: grid;
  gap: 9px;
  margin: 0;
  font-size: 0.78rem;
}

.admin-film__stat {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
}

.admin-film__stat dt {
  color: var(--text-faint);
}

.admin-film__stat dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.admin-film__stat .admin-bar {
  grid-column: 1 / -1;
}

.admin-film .admin-bar {
  height: 5px;
  border-radius: 3px;
}

.admin-film .admin-bar i {
  border-radius: 3px;
}

.admin-film.is-unplayed .admin-film__plays b,
.admin-film.is-unplayed .admin-film__stat dd {
  color: var(--text-faint);
}

/* Bots */

.admin-rules {
  display: grid;
  gap: 8px;
}

.admin-rule {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--surface-well);
  font-size: 0.82rem;
}

.admin-rule__kind {
  color: var(--text-faint);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.admin-rule__pattern {
  color: var(--accent-light);
  font-family: var(--mono);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.admin-rule__hits {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.admin-rule__remove {
  padding: 2px 6px;
  border: 0;
  background: none;
  color: var(--text-faint);
  font-size: 0.9rem;
  cursor: pointer;
}

.admin-rule__remove:hover {
  color: var(--bad);
}

.admin-form {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 10px;
}

.admin-form select,
.admin-form input {
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--border-panel);
  border-radius: 8px;
  background: var(--surface-well);
  color: var(--text-primary);
  font: 0.82rem var(--font);
}

.admin-button {
  padding: 7px 13px;
  border: 1px solid var(--border-menu);
  border-radius: 8px;
  background: var(--surface-block);
  color: var(--text-primary);
  font: 600 0.8rem var(--font);
  cursor: pointer;
}

.admin-button:hover {
  border-color: var(--accent);
}

.admin-self {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--surface-well);
  font-size: 0.82rem;
}

.admin-self small {
  display: block;
  color: var(--text-faint);
  font-size: 0.75rem;
}

.admin-live-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* -------------------------------------------- the app's Admin (admin-app.js) */

/* The side bar's two groups: the site's own numbers, then the app's. */
.admin-nav-group {
  padding: 14px 12px 4px;
  color: var(--text-faint);
  font-size: 0.66rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.admin-brand + .admin-nav-group {
  padding-top: 0;
}

/* A name in a table that opens its account: text, until it is pointed at. */
.admin-rowlink {
  display: block;
  max-width: 100%;
  overflow: hidden;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-primary);
  font: 600 0.82rem var(--font);
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.admin-rowlink:hover,
.admin-rowlink:focus-visible {
  color: var(--accent-light);
  text-decoration: underline;
}
.admin-table td small {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--text-faint);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-table td:first-child {
  max-width: 260px;
}
.admin-table tr[aria-selected='true'] td {
  background: rgba(0, 229, 207, 0.07);
}
.admin-table tr[aria-selected='true'] td:first-child {
  box-shadow: inset 2px 0 0 var(--accent);
}
.admin-table__bar {
  width: 22%;
  min-width: 70px;
  vertical-align: middle !important;
}
.admin-bar--thin {
  display: block;
  height: 6px;
  border-radius: 999px;
}
.admin-bar--thin i {
  border-radius: 999px;
}
.admin-pill--bad {
  background: rgba(255, 60, 172, 0.12);
  color: var(--bad);
}
.admin-pill--warn {
  background: rgba(255, 230, 109, 0.1);
  color: var(--warn);
}
.admin-table td.mono {
  white-space: nowrap;
}
.admin-list__name.mono {
  font-family: var(--mono);
  font-size: 0.76rem;
}

.admin-search {
  display: flex;
  gap: 6px;
  min-width: 0;
}
.admin-search input {
  width: 230px;
  min-width: 0;
  padding: 7px 11px;
  border: 1px solid var(--border-panel);
  border-radius: 8px;
  background: var(--surface-well);
  color: var(--text-primary);
  font: 0.82rem var(--font);
}
.admin-search input:focus-visible {
  border-color: var(--accent);
  outline: none;
}

/* The account list beside the account it opened, which stays in view while
   the list scrolls. */
.admin-split {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr);
  align-items: start;
  gap: 14px;
}
.admin-account {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}
.admin-account--empty {
  display: grid;
  place-items: center;
  min-height: 180px;
  text-align: center;
}
.admin-account__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.admin-account__head h2 {
  margin: 0;
  font-size: 1.1rem;
  overflow-wrap: anywhere;
}
.admin-account__head p {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 0;
}
.admin-account__facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  margin: 14px 0 0;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--surface-well);
}
.admin-account__facts div {
  min-width: 0;
}
.admin-account__facts dt {
  color: var(--text-faint);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.admin-account__facts dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}
.admin-more {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}
.admin-button:disabled {
  opacity: 0.6;
  cursor: progress;
}

/* A limit's tile: how full, coloured by how close to it. */
.admin-meter .admin-bar--thin {
  margin: 8px 0 4px;
}
.admin-meter--good .admin-bar i {
  background: var(--good);
}
.admin-meter--warn .admin-bar i {
  background: var(--warn);
}
.admin-meter--bad .admin-bar i {
  background: var(--bad);
}

/* --------------------------------------------------------------- narrower */

@media (max-width: 1100px) {
  .admin-split {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-account {
    order: -1;
    position: static;
    max-height: none;
  }

  /* Stacked, the empty card would only push the list down. */
  .admin-account--empty {
    display: none;
  }

  .admin-grid--three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .admin-app {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-side {
    position: sticky;
    z-index: 5;
    flex-direction: row;
    align-items: center;
    height: auto;
    padding: 8px 10px;
    overflow-x: auto;
    /* A swipe row: Windows draws a full classic scrollbar under it otherwise,
       taller than the gap it sits in. */
    scrollbar-width: none;
    border-right: 0;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--surface-panel);
  }

  .admin-brand {
    padding: 0 8px 0 2px;
  }

  .admin-brand small,
  .admin-side__grow {
    display: none;
  }

  /* In the swipe row a group's name becomes the rule between groups. */
  .admin-nav-group,
  .admin-brand + .admin-nav-group {
    flex: none;
    width: 1px;
    height: 20px;
    margin: 0 6px;
    padding: 0;
    overflow: hidden;
    background: var(--border-panel);
    color: transparent;
  }

  .admin-search {
    flex: 1 1 100%;
  }

  .admin-search input {
    flex: 1;
    width: auto;
  }

  .admin-who {
    flex: none;
    border-top: 0;
    padding: 0 0 0 8px;
  }

  .admin-who span,
  .admin-who strong {
    display: none;
  }

  .admin-nav {
    width: auto;
  }

  .admin-nav[aria-current='page'] {
    box-shadow: inset 0 -2px 0 var(--accent);
  }

  .admin-grid,
  .admin-grid--even,
  .admin-grid--three {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* An odd last tile spans the row rather than standing alone in half of it. */
  .admin-kpi:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

@media (max-width: 460px) {
  .admin-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-rule {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .admin-rule__kind {
    grid-column: 1 / -1;
  }

  .admin-kpi__value {
    font-size: 1.35rem;
  }

  .admin-account__facts {
    grid-template-columns: minmax(0, 1fr);
  }
}
