/* The signer's admin page. One small sheet, no script, nothing loaded from
   anywhere else (the page's content policy would refuse it anyway). */

:root {
  color-scheme: light dark;
  --paper: #f7f6f3;
  --card: #ffffff;
  --ink: #1d1f23;
  --soft: #5c6068;
  --line: #d9d6cf;
  --accent: #1c4f8f;
  --on-accent: #ffffff;
  --problem: #9b2c1c;
  --problem-paper: #fbeeeb;
  --on-problem: #ffffff;
  --note-paper: #eef3f9;
  --good: #1f6b3a;
  --good-paper: #e9f5ec;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #16181c;
    --card: #1f2227;
    --ink: #e8e6e1;
    --soft: #a3a7ae;
    --line: #363a41;
    --accent: #8fb8ee;
    --on-accent: #10141a;
    --problem: #f0a091;
    --problem-paper: #3a1f1b;
    --on-problem: #1d1210;
    --note-paper: #1d2733;
    --good: #8fd3a4;
    --good-paper: #1b2e22;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}

.top .name {
  color: var(--ink);
  font-weight: 650;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.top form {
  margin: 0;
}

main {
  max-width: 60rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

h1 {
  margin: 0 0 1rem;
  font-size: 1.4rem;
  line-height: 1.25;
}

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

.message {
  max-width: 34rem;
  margin: 0 0 1.25rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 4px;
  background: var(--note-paper);
}

.message.problem {
  border-left-color: var(--problem);
  background: var(--problem-paper);
  color: var(--problem);
}

.stack {
  display: grid;
  gap: 0.35rem;
  max-width: 22rem;
}

.stack label {
  margin-top: 0.6rem;
  color: var(--soft);
  font-size: 0.9rem;
}

.stack button {
  justify-self: start;
  margin-top: 1rem;
}

input[type="text"],
input[type="password"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
}

button {
  padding: 0.5rem 1.1rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

button.quiet {
  padding: 0.3rem 0.8rem;
  border-color: var(--line);
  background: transparent;
  color: var(--ink);
  font-weight: 500;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --- the pages behind the sign-in --- */

.pages {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5rem;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}

.pages a {
  padding: 0.6rem 0 0.5rem;
  border-bottom: 2px solid transparent;
  color: var(--soft);
  font-weight: 550;
  text-decoration: none;
}

.pages a[aria-current="page"] {
  border-bottom-color: var(--accent);
  color: var(--ink);
}

h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
  line-height: 1.3;
}

p {
  margin: 0 0 0.75rem;
}

.card {
  margin: 1.25rem 0 0;
  padding: 1rem 1.1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
}

.card > :last-child,
.card form > :last-child {
  margin-bottom: 0;
}

.soft,
.hint {
  color: var(--soft);
}

.hint {
  margin: 0;
  font-size: 0.875rem;
}

h1 + .under-title {
  margin-top: -0.6rem;
}

.more {
  margin: 0.9rem 0 0;
}

.id,
code,
.licence-key {
  font-family: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
  font-size: 0.92em;
}

.id {
  margin-right: 0.4rem;
  color: var(--soft);
}

.badge {
  display: inline-block;
  margin-right: 0.35rem;
  padding: 0.05rem 0.6rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 650;
}

.badge.allowed {
  background: var(--good-paper);
  color: var(--good);
}

.badge.denied {
  background: var(--problem-paper);
  color: var(--problem);
}

.ended {
  color: var(--problem);
}

/* A form. `.stack` came with the sign-in page; the wide one holds the
   messages. */

.stack.wide {
  max-width: 40rem;
}

.stack.wide label {
  margin-top: 1.1rem;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 600;
}

.stack .hint + textarea,
.stack .hint + input {
  margin-top: 0.15rem;
}

textarea {
  min-height: 6rem;
  resize: vertical;
}

.stack .check {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin-top: 0.4rem;
  color: var(--ink);
  font-size: 1rem;
}

.check input {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0.15rem 0 0;
  accent-color: var(--accent);
}

button.danger {
  border-color: var(--problem);
  background: var(--problem);
  color: var(--on-problem);
}

.filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin: 0 0 1rem;
}

.filter label {
  color: var(--soft);
  font-size: 0.9rem;
}

.filter select {
  flex: 1 1 12rem;
  width: auto;
  max-width: 24rem;
}

.filter button {
  padding: 0.5rem 1.1rem;
}

/* A message as the WMS shows it: plain text with its line breaks kept. A
   text without a single space still stays inside the page. */

.wms-text {
  margin: 0;
  padding: 0.6rem 0.75rem;
  border-left: 3px solid var(--line);
  border-radius: 0 4px 4px 0;
  background: var(--paper);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* A licence key, on the one page that shows it. One tap takes all of it. */

.licence-key {
  padding: 0.75rem 0.85rem;
  border: 1px dashed var(--accent);
  border-radius: 4px;
  background: var(--note-paper);
  font-size: 1rem;
  word-break: break-all;
  -webkit-user-select: all;
  user-select: all;
}

/* A list: a table on a wide screen, one block for each row on a phone. What
   a stranger sent (a version, an address) can be long and have no space. */

.rows {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
}

.rows th,
.rows td {
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.rows th {
  color: var(--soft);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

/* A time, a status, an install id: short, and whole on a wide screen. */

.rows .short {
  white-space: nowrap;
}

.rows .detail {
  white-space: pre-wrap;
}

.rows + .hint {
  margin-top: 0.75rem;
}

@media (max-width: 44rem) {
  main {
    padding: 1.25rem 1rem 2.5rem;
  }

  .top,
  .pages {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .stack,
  .stack.wide {
    max-width: none;
  }

  .rows thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .rows,
  .rows tbody,
  .rows tr,
  .rows td {
    display: block;
  }

  .rows tr {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--line);
  }

  .rows td {
    position: relative;
    min-height: 1.8rem;
    padding: 0.15rem 0 0.15rem 7.5rem;
    border: 0;
  }

  .rows .short {
    white-space: normal;
  }

  .rows td::before {
    content: attr(data-label);
    position: absolute;
    top: 0.25rem;
    left: 0;
    width: 7rem;
    color: var(--soft);
    font-size: 0.85rem;
  }
}

/* A finger needs more to press than a pointer does. */

@media (pointer: coarse) {
  button,
  select,
  input[type="text"],
  input[type="password"] {
    min-height: 2.75rem;
  }

  .pages a {
    padding-top: 0.8rem;
    padding-bottom: 0.7rem;
  }
}
