:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --ink: #1a2233;
  --muted: #5b6472;
  --line: #dfe3e9;
  --accent: #2557d6;
  --accent-ink: #ffffff;
  --danger: #b3261e;
  --warn-bg: #fff7e6;
  --warn-line: #e6c26e;
  --ok-bg: #e9f7ef;
  --ok-line: #7fc79a;
  --err-bg: #fdecea;
  --err-line: #e5a09a;
  --radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}
h1 {
  font-size: 1.4rem;
  margin: 0 0 0.75rem;
}
h2 {
  font-size: 1.05rem;
  margin: 0 0 0.5rem;
}
a {
  color: var(--accent);
}
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 0.6rem 1.25rem;
}
.topbar .brand {
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}
.topbar .brand span {
  color: var(--accent);
}
.topbar nav {
  display: flex;
  gap: 1rem;
  flex: 1;
}
.topbar nav a {
  color: var(--muted);
  text-decoration: none;
}
.topbar nav a:hover {
  color: var(--ink);
}

.page {
  max-width: 960px;
  margin: 1.5rem auto;
  padding: 0 1.25rem;
}
.centered {
  min-height: calc(100vh - 8rem);
  display: grid;
  place-items: center;
  padding: 1.25rem;
}
.foot {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
}
.card.narrow {
  max-width: 26rem;
  width: 100%;
}
.grid2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: 1rem;
}

label {
  display: block;
  margin: 0 0 0.9rem;
  font-weight: 600;
  font-size: 0.9rem;
}
label .muted {
  font-weight: 400;
}
input[type='text'],
input[type='email'],
input[type='password'],
select {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  background: #fff;
}
input:focus,
select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: var(--accent);
}

button,
.button {
  font: inherit;
  border-radius: 6px;
  padding: 0.55rem 1rem;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  display: inline-block;
}
button.primary,
.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
button.secondary,
.button.secondary {
  background: var(--surface);
}
button.link {
  border: none;
  background: none;
  color: var(--accent);
  padding: 0;
  cursor: pointer;
}
button.link.danger {
  color: var(--danger);
}
button:hover {
  filter: brightness(0.97);
}

.alert {
  border-radius: 6px;
  padding: 0.6rem 0.9rem;
  margin: 0 0 1rem;
  border: 1px solid;
}
.alert.error {
  background: var(--err-bg);
  border-color: var(--err-line);
}
.alert.warn {
  background: var(--warn-bg);
  border-color: var(--warn-line);
}
.alert.ok {
  background: var(--ok-bg);
  border-color: var(--ok-line);
}

.muted {
  color: var(--muted);
}
.mt {
  margin-top: 1.25rem;
}
.inline {
  display: inline;
}
.divider {
  text-align: center;
  color: var(--muted);
  margin: 1rem 0;
}
.nowrap {
  white-space: nowrap;
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.table th,
.table td {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.table th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.table tr:last-child td {
  border-bottom: none;
}
.table .detail {
  max-width: 26rem;
  overflow-wrap: anywhere;
  font-size: 0.85em;
  color: var(--muted);
}

.tag {
  display: inline-block;
  border-radius: 99px;
  padding: 0.1rem 0.6rem;
  font-size: 0.8rem;
  background: var(--bg);
  border: 1px solid var(--line);
}
.tag.ok {
  background: var(--ok-bg);
  border-color: var(--ok-line);
}
.tag.warn {
  background: var(--warn-bg);
  border-color: var(--warn-line);
}
.tag.danger {
  background: var(--err-bg);
  border-color: var(--err-line);
}

.pagehead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.filters {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.filters input {
  width: 14rem;
  margin-top: 0;
}
.actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.codes {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.5rem;
}
.codes code,
.key {
  display: block;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
}
.key.big {
  font-size: 1.1rem;
}
.qr-row {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.qr-row img {
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.list {
  list-style: none;
  padding: 0;
}
.list li {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--line);
}
.list li:last-child {
  border-bottom: none;
}
