/* Styles of the administrator dashboard. The page is a dense work tool for one operator. */
:root {
  color-scheme: light dark;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --font-code: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --page: light-dark(oklch(0.985 0.004 262), oklch(0.17 0.022 262));
  --surface: light-dark(#ffffff, oklch(0.215 0.028 262));
  --text: light-dark(oklch(0.2 0.03 262), oklch(0.95 0.008 262));
  --muted: light-dark(oklch(0.44 0.03 262), oklch(0.77 0.025 262));
  --line: light-dark(oklch(0.89 0.014 262), oklch(0.32 0.03 262));
  --accent: light-dark(#1d5fd1, #8db5ff);
  --danger: light-dark(#b3261e, #ffb4ab);
  --danger-fill: light-dark(#b3261e, #93000a);
  --bad: light-dark(#fde7e4, #4a1512);
  --warn: light-dark(#fff4d6, #3a3115);
  --good: light-dark(oklch(0.95 0.05 155), oklch(0.3 0.06 155));
}

:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 15px/1.5 var(--font-body);
}

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

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px clamp(14px, 3vw, 32px);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

h1 {
  margin: 0 auto 0 0;
  font-size: 1.15rem;
}

h2 {
  margin: 0 0 6px;
  font-size: 1.1rem;
}

h3 {
  margin: 0 0 6px;
  font-size: 0.95rem;
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px clamp(14px, 3vw, 32px) 56px;
}

section {
  margin-bottom: 36px;
}

p {
  margin: 0 0 10px;
}

#local-key {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

input[type="password"] {
  min-height: 34px;
  padding: 4px 8px;
  border: 1px solid color-mix(in oklch, var(--text) 40%, var(--page));
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

code,
.mono {
  font-family: var(--font-code);
  font-size: 0.88em;
  overflow-wrap: anywhere;
}

.tag,
.badge {
  display: inline-block;
  padding: 1px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge.bad {
  border-color: transparent;
  background: var(--bad);
  color: var(--danger);
}

.badge.good {
  border-color: transparent;
  background: var(--good);
}

.badge.warn {
  border-color: transparent;
  background: var(--warn);
}

.count {
  color: var(--muted);
  font-weight: 400;
}

.alert,
.done {
  padding: 10px 14px;
  border-radius: 6px;
  background: var(--bad);
  color: var(--danger);
  font-weight: 600;
}

.done {
  background: var(--good);
  color: var(--text);
}

button {
  min-height: 34px;
  padding: 4px 12px;
  border: 1px solid color-mix(in oklch, var(--text) 40%, var(--page));
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: 600 0.9rem var(--font-body);
  cursor: pointer;
}

button:hover:not(:disabled) {
  background: color-mix(in oklch, currentColor 10%, transparent);
}

button:disabled {
  cursor: default;
  opacity: 0.55;
}

button.danger {
  border-color: transparent;
  background: var(--danger-fill);
  color: #ffffff;
}

.theme {
  display: grid;
  place-items: center;
  width: 34px;
  padding: 0;
  border-radius: 50%;
}

.theme .sun {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme .moon {
    display: none;
  }

  :root:not([data-theme="light"]) .theme .sun {
    display: block;
  }
}

:root[data-theme="dark"] .theme .moon {
  display: none;
}

:root[data-theme="dark"] .theme .sun {
  display: block;
}

/* Two regions next to each other, and one below the other on a narrow screen. */
.pair {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px 28px;
}

.region {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.region h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  padding: 5px 12px 5px 0;
  border-bottom: 1px solid var(--line);
  text-align: start;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

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

.bar {
  display: inline-block;
  height: 8px;
  min-width: 1px;
  margin-right: 6px;
  border-radius: 2px;
  background: var(--accent);
  vertical-align: middle;
}

.report {
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.report header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-bottom: 6px;
}

.report .details {
  max-width: 80ch;
  margin: 6px 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.report dl,
.counts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
  margin: 6px 0 10px;
}

.report dl div,
.counts div {
  display: flex;
  gap: 6px;
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
  font-weight: 600;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.check {
  display: flex;
  gap: 8px;
  margin: 10px 0;
}

dialog {
  max-width: min(30rem, calc(100vw - 32px));
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}

dialog::backdrop {
  background: rgb(0 0 0 / 0.45);
}
