/* The admin, on top of application.css. Chart colors follow the validated dark data-viz palette. */

.admin {
  --surface: #131318;
  --series-1: #3987e5;
  --series-1-hover: #6da7ec;
  --grid: #2c2c2a;
  --axis: #383835;

  font-size: 0.9375rem;
}

.admin-header {
  border-bottom: 1px solid var(--line);
  background: var(--bg-raised);
}

.admin-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 60px;
}

.admin-header__nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.admin-header__nav a {
  color: var(--text-2);
  text-decoration: none;
}

.admin-header__form {
  display: flex;
}

/* Signing out is a form's button that looks like the links next to it. */
.admin-header__sign-out {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-2);
  font: inherit;
  cursor: pointer;
}

.admin-header__nav a:hover,
.admin-header__sign-out:hover {
  color: var(--text);
}

.admin-main {
  padding-block: 2rem 4rem;
}

.admin-notice {
  margin-bottom: 1.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid rgb(61 220 151 / 0.3);
  border-radius: 10px;
  background: var(--green-soft);
}

.admin-section + .admin-section,
.admin-columns {
  margin-top: 2.75rem;
}

.admin-section__head {
  margin-bottom: 1.25rem;
}

.admin-section__head--row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.admin-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.admin-subtitle {
  margin-bottom: 1rem;
  font-size: 1.125rem;
  font-weight: 650;
}

.admin-section__head .admin-subtitle {
  margin-bottom: 0;
}

.admin-count {
  margin-left: 0.35rem;
  color: var(--text-3);
  font-weight: 500;
}

.admin-muted {
  color: var(--text-3);
}

.admin-section__head .admin-muted {
  margin-top: 0.35rem;
}

.admin-empty {
  padding: 1.25rem;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  color: var(--text-3);
  text-align: center;
}

/* Stat tiles */

.tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.tile {
  padding: 1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.tile dt {
  color: var(--text-2);
  font-size: 0.875rem;
}

.tile dd {
  margin-top: 0.3rem;
  font-size: 2rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

/* Daily charts: small multiples, one measure each */

.charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.chart-card {
  padding: 1rem 1.15rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.chart-card figcaption {
  margin-bottom: 0.5rem;
  color: var(--text-2);
  font-size: 0.875rem;
}

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

.chart__grid {
  stroke: var(--grid);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.chart__axis {
  stroke: var(--axis);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.chart__bar {
  fill: var(--series-1);
}

.chart__hit {
  fill: transparent;
}

.chart__column:hover .chart__bar {
  fill: var(--series-1-hover);
}

.chart__column:hover .chart__hit {
  fill: rgb(255 255 255 / 0.03);
}

.chart__tick,
.chart__date,
.chart__value {
  fill: var(--text-3);
  font-family: var(--font);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.chart__tick {
  text-anchor: end;
}

.chart__date,
.chart__value {
  text-anchor: middle;
}

.chart__value {
  fill: var(--text-2);
  font-weight: 600;
}

/* Tables */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

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

.admin-columns .admin-table,
.admin-section > .admin-table {
  border: 1px solid var(--line);
  border-radius: 12px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
}

.admin-table th,
.admin-table td {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

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

.admin-table th {
  background: var(--surface);
  color: var(--text-3);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.admin-table a {
  color: var(--text);
}

.admin-table--numbers td:not(:first-child),
.admin-table--numbers th:not(:first-child) {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.admin-table tr.is-empty td {
  color: var(--text-3);
}

.admin-table__nowrap {
  white-space: nowrap;
}

.admin-table__text {
  min-width: 16rem;
  max-width: 28rem;
  color: var(--text-2);
}

.admin-answer + .admin-answer {
  margin-top: 0.25rem;
}

.admin-delete {
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--red-line);
  border-radius: 8px;
  background: transparent;
  color: var(--red);
  font: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
}

.admin-delete:hover {
  background: var(--red-soft);
}

.admin-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2rem;
  align-items: start;
}

.admin-columns .admin-section + .admin-section {
  margin-top: 0;
}

/* The sign-in page: the logo, a card with the password field, a line under it. */

.sign-in {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: 3rem var(--gutter);
  isolation: isolate;
}

/* Behind the card, as behind the landing page's closing form: a hairline grid that fades out, a faint light. */
.sign-in::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(to right, rgb(255 255 255 / 0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgb(255 255 255 / 0.035) 1px, transparent 1px);
  background-position: center center;
  background-size: 72px 72px;
  -webkit-mask-image: radial-gradient(ellipse 50% 55% at 50% 45%, #000 10%, transparent 70%);
  mask-image: radial-gradient(ellipse 50% 55% at 50% 45%, #000 10%, transparent 70%);
}

.sign-in::after {
  content: "";
  position: fixed;
  top: 42%;
  left: 50%;
  z-index: -1;
  width: min(48rem, 120vw);
  height: 26rem;
  background: radial-gradient(closest-side, rgb(255 210 63 / 0.07), transparent);
  transform: translate(-50%, -50%);
}

.sign-in__main {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(100%, 24rem);
}

.sign-in__logo {
  margin-bottom: 1.75rem;
  font-size: 1.125rem;
}

.sign-in__card {
  width: 100%;
  padding: 1.75rem 1.5rem 1.5rem;
  border-radius: var(--radius);
  background: var(--panel), var(--bg-raised);
  box-shadow: var(--panel-edge), 0 24px 64px -28px rgb(0 0 0 / 0.9);
}

.sign-in__title {
  font-size: 1.5rem;
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.sign-in__lede {
  margin-top: 0.35rem;
  color: var(--text-2);
}

.sign-in__status {
  margin-top: 1.25rem;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  background: rgb(255 255 255 / 0.04);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  color: var(--text-2);
  font-size: 0.875rem;
}

.sign-in__form {
  display: grid;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.sign-in__label {
  color: var(--text-2);
  font-size: 0.875rem;
  font-weight: 500;
}

/* Like the landing page's email field: its text at least 16px, or an iPhone zooms in when it's tapped. */
.sign-in__field {
  width: 100%;
  height: 2.875rem;
  padding: 0 1.1rem;
  border: 0;
  border-radius: 999px;
  background: var(--field);
  box-shadow: inset 0 0 0 1px var(--field-edge);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  -webkit-appearance: none;
  appearance: none;
  transition: box-shadow 0.15s;
}

@media (hover: hover) {
  .sign-in__field:hover {
    box-shadow: inset 0 0 0 1px var(--field-edge-hover);
  }
}

.sign-in__field:focus {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--yellow-line), 0 0 0 4px rgb(255 210 63 / 0.12);
}

.sign-in__field[aria-invalid="true"] {
  box-shadow: inset 0 0 0 1px var(--red);
}

.sign-in__field[aria-invalid="true"]:focus {
  box-shadow: inset 0 0 0 1px var(--red), 0 0 0 4px rgb(255 107 107 / 0.14);
}

/* A password manager's fill keeps the field dark. */
.sign-in__field:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  transition: background-color 100000s 0s;
}

.sign-in__error {
  color: var(--red-text);
  font-size: 0.875rem;
}

.sign-in__form .button {
  margin-top: 0.5rem;
}

.sign-in__note {
  margin-top: 1.25rem;
  color: var(--text-3);
  font-size: 0.8125rem;
  text-align: center;
}

.sign-in .page-back {
  margin-top: 0.75rem;
  font-size: 0.875rem;
}

@media (max-width: 860px) {
  .tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

/* On a phone the links go under the logo. */
@media (max-width: 600px) {
  .admin-header__inner {
    flex-wrap: wrap;
    row-gap: 0.4rem;
    height: auto;
    padding-block: 0.8rem;
  }

  .admin-header__nav {
    gap: 1rem;
    font-size: 0.875rem;
  }
}
