:root {
  color-scheme: light dark;
  --bg: #f7f4ef;
  --surface: #ffffff;
  --ink: #1e1b24;
  --muted: #6b6676;
  --line: #e6e2ec;
  --accent: #6c5cd6;
  --accent-soft: #e2dbf8;
  --danger: #b3261e;
  --ok: #1f7a4d;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17141f;
    --surface: #201c2b;
    --ink: #ece8f2;
    --muted: #a49fb3;
    --line: #322c42;
    --accent: #c5b8f5;
    --accent-soft: #453a78;
    --danger: #f2b8b5;
    --ok: #7ad6a6;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.topbar h1 { font-size: 18px; margin: 0; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

main { max-width: 1000px; margin: 24px auto; padding: 0 16px; }

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

.card.narrow { max-width: 420px; margin-inline: auto; }

h2 { margin-top: 0; font-size: 18px; }
h3 { font-size: 15px; margin-bottom: 8px; }
.muted { color: var(--muted); font-size: 13px; }

form label {
  display: block;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--muted);
}

input, select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
}

.row { display: flex; gap: 12px; align-items: flex-end; }
.row.wrap { flex-wrap: wrap; }
.row .grow { flex: 1 1 240px; }
.row input[type="search"] { flex: 1; }

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

button.primary { background: var(--ink); color: var(--bg); }
button.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
button.link { background: none; border: none; color: var(--accent); padding: 4px; }
button.danger { background: none; border: none; color: var(--danger); padding: 4px; }
button:disabled { opacity: 0.5; cursor: default; }

table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
}

.error { color: var(--danger); font-size: 13px; }
.status-active { color: var(--ok); }
.status-inactive { color: var(--muted); }

dl.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
dl.facts dt { color: var(--muted); font-size: 12px; }
dl.facts dd { margin: 2px 0 0; }

/* Overview counters: the shape of the operation at a glance. */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  border: 1px solid var(--line, #e3e6eb);
  border-radius: 12px;
}

.stat strong {
  font-size: 26px;
  line-height: 1.1;
}
