/* One stylesheet, no framework. The panel is a dozen elements; a build step
   would cost more than it saves and would put a bundler between a typo and
   seeing it fixed. */

:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --panel: #f7f7f8;
  --line: #e4e4e7;
  --ink: #18181b;
  --muted: #71717a;
  --accent: #4f46e5;
  --good: #047857;
  --bad: #b91c1c;
  --warn-bg: #fef3c7;
  --warn-ink: #92400e;
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0e;
    --panel: #151519;
    --line: #27272a;
    --ink: #fafafa;
    --muted: #a1a1aa;
    --accent: #818cf8;
    --good: #34d399;
    --bad: #f87171;
    --warn-bg: #3f2d09;
    --warn-ink: #fcd34d;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 ui-sans-serif, -apple-system, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

.hidden {
  display: none !important;
}

.centred {
  min-height: 80vh;
  display: grid;
  place-items: center;
}

h1 {
  font-size: 20px;
  margin: 0;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 15px;
  margin: 0 0 4px;
}

h3 {
  font-size: 14px;
  margin: 0;
  font-weight: 600;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.92em;
  background: var(--panel);
  padding: 1px 5px;
  border-radius: 5px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

.login-card {
  width: min(400px, 92vw);
  text-align: center;
}

.login-card h1 {
  margin-bottom: 6px;
}

.login-card .muted {
  margin: 0 0 18px;
}

button {
  font: inherit;
  border-radius: 9px;
  border: 1px solid transparent;
  padding: 9px 16px;
  cursor: pointer;
}

button.primary {
  background: var(--accent);
  color: #fff;
  font-weight: 550;
}

button.primary:disabled {
  opacity: 0.55;
  cursor: progress;
}

button.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}

input,
select {
  font: inherit;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
}

#code {
  display: block;
  width: 100%;
  margin: 4px 0 12px;
  text-align: center;
  font-size: 26px;
  letter-spacing: 0.28em;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

#verify-code {
  width: 100%;
}

.match {
  margin: 20px 0 0;
  font-size: 14px;
}

.match strong {
  font-size: 20px;
  color: var(--accent);
}

.error {
  color: var(--bad);
  font-size: 13px;
  margin: 12px 0 0;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.bar-actions {
  display: flex;
  gap: 8px;
}

.app-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

/* The four numbers that answer "how is this app doing" without scrolling. */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.tile {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}

.tile .label {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tile .value {
  font-size: 22px;
  font-weight: 600;
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}

.tile .value.good {
  color: var(--good);
}

.tile .value.bad {
  color: var(--bad);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}

th,
td {
  text-align: right;
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
}

th {
  color: var(--muted);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tr:last-child td {
  border-bottom: none;
}

td.zero {
  color: var(--muted);
}

.scroll {
  overflow-x: auto;
  margin: 0 -4px;
  padding: 0 4px;
}

.alert {
  background: var(--warn-bg);
  color: var(--warn-ink);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 14px;
}

.alert strong {
  display: block;
  margin-bottom: 2px;
}

#lookup-form {
  display: flex;
  gap: 8px;
  margin: 12px 0;
  flex-wrap: wrap;
}

#lookup-uid {
  flex: 1 1 260px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
}

.pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.delta-pos {
  color: var(--good);
}

.delta-neg {
  color: var(--bad);
}

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

.chip {
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 9px;
  color: var(--muted);
}

@media (max-width: 560px) {
  .tile .value {
    font-size: 19px;
  }
}

/* ------------------------------------------------------------- editor */

.inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

button.small {
  padding: 5px 11px;
  font-size: 13px;
}

.editor-slot {
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 16px;
}

.editor {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 550;
}

.field-hint {
  font-size: 12px;
  color: var(--muted);
}

.field input,
.field textarea,
.field select {
  width: 100%;
}

textarea {
  font: inherit;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  resize: vertical;
  line-height: 1.5;
}

textarea.mono,
input.mono {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.section {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  background: var(--bg);
}

.section > h3 {
  margin-bottom: 8px;
}

details.section > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}

details.section[open] > summary {
  margin-bottom: 10px;
}

.prompts {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 10px;
}

/* Tables of name → number. The header row uses the same grid as the rows, so
   the columns line up without either having to know the other's widths. */
.pairs .row,
.pairs .row-head {
  display: grid;
  grid-template-columns: 1fr 110px 34px;
  gap: 8px;
  align-items: center;
  margin-bottom: 7px;
}

.pairs .row-head {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.pairs input {
  width: 100%;
}

.row-key {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
}

.row-remove {
  padding: 6px 0;
  line-height: 1;
}

.secret-out {
  margin-top: 10px;
}

code.block {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  word-break: break-all;
  font-size: 12px;
  line-height: 1.5;
  border: 1px solid var(--line);
}

.editor-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.status.good {
  color: var(--good);
}

.status.bad {
  color: var(--bad);
}

.adjust {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}

.adjust input[type='number'] {
  width: 90px;
}

.adjust input:not([type='number']) {
  flex: 1 1 160px;
}

.adjust .mono {
  width: 110px;
  text-align: center;
  letter-spacing: 0.15em;
}
