:root {
  --bg: #ffffff;
  --fg: #1d1d1f;
  --muted: #6e6e73;
  --line: #d9d9de;
  --field: #ffffff;
  --button: #f0f0f3;
  --accent: #2458c6;
  --error: #b3261e;
  --head: #ececf0;
  --stripe: #f6f6f8;
  --hover: #e3ebfb;
  --box: #fafafb;
  --ok: #1a7f37;
  --bad: #b3261e;
  --warn: #9a6700;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1c1e;
    --fg: #ececf0;
    --muted: #9a9aa2;
    --line: #3a3a3f;
    --field: #2a2a2d;
    --button: #333337;
    --accent: #7aa2ff;
    --error: #ff8a80;
    --head: #2c2c30;
    --stripe: #232326;
    --hover: #2b3550;
    --box: #222225;
    --ok: #57c77a;
    --bad: #ff8a80;
    --warn: #e3b341;
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.4;
}

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

main.login { max-width: 360px; padding-top: 80px; }

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

.bar {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.bar .brand { font-weight: 600; }
.bar nav a { margin-left: 16px; padding: 4px 8px; border-radius: 4px; text-decoration: none; }
.bar nav a.current { background: var(--head); color: var(--fg); font-weight: 600; }

.error { color: var(--error); margin: 0 0 12px; }

form, .block { margin: 16px 0; }

label { display: block; margin: 8px 0; }
label.inline { display: inline-block; margin-right: 16px; }

input, select, textarea, button {
  font: inherit;
  color: var(--fg);
}

input[type=text], input[type=email], input[type=number], input[type=date],
input[type=password], input[type=search], input:not([type]), select, textarea {
  display: block;
  width: 100%;
  max-width: 420px;
  margin-top: 4px;
  padding: 6px 8px;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 4px;
}

input[type=checkbox], input[type=radio] { margin-right: 6px; }

button {
  padding: 6px 12px;
  background: var(--button);
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
}

table { width: 100%; border-collapse: collapse; margin: 12px 0; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
thead th { background: var(--head); color: var(--fg); font-weight: 600; border-bottom: 2px solid var(--line); }
tbody tr:nth-child(even) { background: var(--stripe); }
tbody tr:hover { background: var(--hover); }
tr.link { cursor: pointer; }

.key-text { font-size: 26px; font-family: ui-monospace, Consolas, monospace; margin-right: 12px; }

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

h1 { font-size: 22px; font-weight: 600; margin: 8px 0 16px; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 8px; }

.box { background: var(--box); border: 1px solid var(--line); border-radius: 6px; padding: 12px 16px; margin: 16px 0; }
.box > form, .box > .block, .box > table { margin-top: 8px; margin-bottom: 0; }

.toolbar { display: flex; align-items: flex-end; gap: 12px; margin: 16px 0; }
.toolbar label { flex: 1; margin: 0; }
.toolbar label input { max-width: 420px; }

table.info { width: auto; margin: 0; }
table.info th, table.info td { border-bottom: none; padding: 4px 24px 4px 0; }
table.info th { color: var(--muted); font-weight: normal; white-space: nowrap; }
table.info tbody tr:nth-child(even), table.info tbody tr:hover { background: none; }

.mono { font-family: ui-monospace, Consolas, monospace; white-space: nowrap; }

.state-on { color: var(--ok); font-weight: 600; }
.state-off { color: var(--bad); font-weight: 600; }
.state-expired { color: var(--warn); font-weight: 600; }

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

.empty { color: var(--muted); margin: 12px 0; }
