/* The admin dashboard (/admin, admin.boring-news.app), on top of /styles.css and its tokens: warm
   ink on cream paper, cream on espresso in the dark, no accent hue. A live or failed run is marked
   with weight, a rule and words, never a colour. Numbers are set in the mono role. */

/* The dashboard is wider than a page of reading, and so are its masthead and footer. (This file
   loads before /styles.css, so these selectors outweigh its .wrap.) */
.wrap.admin-wrap,
body:has(#admin-root) .masthead .wrap,
body:has(#admin-root) .site-footer .wrap {
  max-width: calc(68rem + 2 * var(--gutter));
}

.admin-account {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-bottom: 20px;
}

.admin-heading {
  margin-right: auto;
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 600;
  font-variation-settings: "opsz" 72;
  line-height: 1.1;
}

.meta.admin-account-email {
  overflow-wrap: anywhere;
  text-transform: none;
  letter-spacing: 0.02em;
}

.button.admin-small {
  min-height: 40px;
  padding: 0 14px;
  font-size: 0.875rem;
}

.admin-link-button {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.admin-link-button:hover {
  text-decoration-thickness: 2px;
}

/* Sign in */

.admin-sign-in {
  max-width: var(--measure);
  padding: 48px 0 72px;
}

.admin-form {
  margin-top: 28px;
}

.field.admin-code {
  font-family: var(--mono);
  font-size: 1.25rem;
  letter-spacing: 0.3em;
}

/* The dashboard */

#dashboard {
  padding: 24px 0 80px;
}

.admin-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr));
  gap: 12px;
}

.admin-tile {
  padding: 16px 16px 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--fill);
}

.admin-tile-value {
  margin-top: 8px;
  font-family: var(--serif);
  font-size: clamp(1.5rem, 1rem + 2.5vw, 2rem);
  font-weight: 600;
  font-variation-settings: "opsz" 72;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.admin-tile-detail {
  margin-top: 6px;
  font-family: var(--sans);
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--ink-2);
}

.admin-panel .section-title {
  margin-top: 56px;
}

.admin-lede {
  margin-top: 12px;
  max-width: var(--measure);
  font-family: var(--sans);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--ink-2);
}

.admin-panel > p:not(.admin-lede):not(.meta) {
  margin-top: 14px;
  max-width: var(--measure);
}

.admin-slot {
  margin-top: 16px;
}

.admin-quiet {
  font-family: var(--sans);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--ink-2);
}

.admin-subtitle {
  margin-top: 32px;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}

.admin-subtitle + * {
  margin-top: 10px;
}

.admin-badge {
  margin-left: 6px;
  padding: 3px 7px;
  border: 1px solid var(--ink-3);
  border-radius: 999px;
  vertical-align: 2px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  gap: 0 40px;
}

/* Rows: a list with hairlines, used by every panel */

.admin-rows {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--hairline);
}

/* Straight under a panel's title, its rule is the list's top rule. */
.section-title + .admin-slot > .admin-rows:first-child {
  border-top: 0;
}

.admin-grid > div > .admin-subtitle:first-child {
  margin-top: 8px;
}

.admin-row {
  display: grid;
  gap: 2px;
  padding: 12px 0;
  border-bottom: 1px solid var(--hairline);
}

.admin-row-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 16px;
}

.admin-row-title {
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.admin-row-detail {
  font-family: var(--sans);
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

.admin-num {
  font-family: var(--mono);
  font-size: 0.875rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.admin-big {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

/* A table of counts that scrolls inside itself on a phone, never the page */

.admin-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 0.875rem;
  line-height: 1.4;
}

.admin-table th,
.admin-table td {
  padding: 9px 12px 9px 0;
  border-bottom: 1px solid var(--hairline);
  text-align: left;
  vertical-align: baseline;
}

.admin-table th {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.admin-table td.admin-n,
.admin-table th.admin-n {
  text-align: right;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.admin-table td:last-child,
.admin-table th:last-child {
  padding-right: 0;
}

/* Sparklines: ink on paper, no fill colour */

.admin-spark {
  display: block;
  width: 120px;
  height: 28px;
  overflow: visible;
}

.admin-spark polyline {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.admin-spark line {
  stroke: var(--hairline);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.admin-metric {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 4px 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--hairline);
}

.admin-metric-name {
  font-family: var(--sans);
  font-size: 0.9375rem;
  line-height: 1.35;
}

.admin-metric-counts {
  text-align: right;
}

.admin-metric-counts .admin-row-detail {
  white-space: nowrap;
}

/* On a phone: the name and the counts on one line, the sparkline full width under them. */
@media (max-width: 479px) {
  .admin-metric {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "name counts" "spark spark";
  }

  .admin-metric-name {
    grid-area: name;
  }

  .admin-metric-counts {
    grid-area: counts;
  }

  .admin-metric .admin-spark {
    grid-area: spark;
    width: 100%;
  }
}

.admin-left {
  margin-bottom: 16px;
}

.admin .button span[aria-hidden="true"] {
  margin-left: 0.35em;
}

/* Runs: a live one stands out by a rule, a fill and its words */

.admin-workflow + .admin-workflow {
  margin-top: 8px;
}

.admin-run {
  position: relative;
}

.admin-run.is-live {
  margin: 0 calc(-1 * 12px);
  padding: 12px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--fill);
}

.admin-run.is-live + .admin-run {
  border-top: 0;
}

.admin-state {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.admin-state.is-quiet {
  font-weight: 500;
  color: var(--ink-3);
}

.admin-state.is-failed {
  text-decoration-line: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.25em;
}

.admin-now {
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.45;
}

.admin-refresh {
  margin-top: 12px;
}

.admin-refresh .admin-link-button {
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

details.admin-steps {
  margin-top: 4px;
}

details.admin-steps summary {
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--ink-2);
  cursor: pointer;
}

/* The tracking link helper */

.admin-link-maker {
  margin-top: 8px;
  max-width: var(--measure);
}

.admin-link-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  gap: 12px;
  margin: 14px 0;
}

.admin-label {
  display: block;
  margin-bottom: 6px;
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.2;
}

select.field {
  appearance: none;
  padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.field.admin-mono {
  font-family: var(--mono);
  font-size: 0.875rem;
}

.admin-planned {
  margin-top: 32px;
  padding: 16px;
  border: 1px dashed var(--ink-3);
  border-radius: var(--radius);
}

.admin-planned .admin-subtitle {
  margin-top: 0;
}

.admin-planned p {
  margin-top: 8px;
}

.admin .actions {
  margin-top: 16px;
}

.admin-error {
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.5;
}

/* A small heading inside a panel (the journalists panel's three tables). */
.admin .admin-subhead {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin: 20px 0 6px;
}
