:root {
  --bg: #0E1316;
  --surface: #141A1E;
  --raised: #1A2227;
  --hover: #202A30;
  --border: #232D33;
  --border-strong: #33424A;
  --text: #C3D8E0;
  --strong: #E7EEF4;
  --muted: #7E96A1;
  --disabled: #4E5D63;
  --accent: #43A697;
  --accent-hover: #52B8A8;
  --accent-muted: #1B3A36;
  --error: #D46A67;
  --error-muted: #3A1F1F;
  --warning: #C9A45C;
  --font-head: "Brandon Grotesque", "Outfit", "Jost", system-ui, sans-serif;
  --font-body: "FF Tisa Sans Pro", "Inter", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", monospace;
  --ease: cubic-bezier(0.2, 0, 0, 1);
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  color: var(--text);
  font: 400 14px/22px var(--font-body);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color 120ms var(--ease); }
a:hover { color: var(--accent-hover); }

:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }

h1, h2, h3 { font-family: var(--font-head); font-weight: 400; color: var(--strong); margin: 0; }

.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }

/* Public pages */

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px 40px;
}

.column { width: 100%; max-width: 440px; }

.brand {
  font-size: 32px;
  line-height: 38px;
  letter-spacing: -0.36px;
  margin-bottom: 12px;
}

.lede { color: var(--muted); font-size: 16px; line-height: 26px; margin: 0 0 40px; }

.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 8px; }
.row > input { flex: 1; min-width: 0; }

label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; line-height: 16px; }

input, textarea, select {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 7px 12px;
  min-height: 36px;
  transition: border-color 120ms var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--disabled); }
input:focus, textarea:focus, select:focus { outline: 1px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
label .hint { color: var(--disabled); }
textarea { resize: vertical; min-height: 88px; }
input.code { font-family: var(--font-mono); letter-spacing: 0.02em; text-transform: uppercase; }
input.code::placeholder { text-transform: none; letter-spacing: 0; }

button, .button {
  font: 500 14px/20px var(--font-body);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 16px;
  border-radius: 4px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 120ms var(--ease), color 120ms var(--ease), border-color 120ms var(--ease);
}

.primary { background: var(--accent); color: var(--bg); }
.primary:hover { background: var(--accent-hover); color: var(--bg); }

.secondary { background: transparent; color: var(--text); border-color: var(--border-strong); }
.secondary:hover { background: var(--hover); color: var(--strong); }

.ghost { background: transparent; color: var(--muted); min-height: 28px; padding: 4px 8px; font-size: 13px; }
.ghost:hover { background: var(--hover); color: var(--text); }

.danger { background: transparent; color: var(--error); border-color: transparent; min-height: 28px; padding: 4px 8px; font-size: 13px; }
.danger:hover { background: var(--error-muted); }

.error { color: var(--error); font-size: 13px; line-height: 20px; margin: 0; }
.note { color: var(--muted); font-size: 13px; line-height: 20px; margin: 0; }

.aside { margin-top: 24px; font-size: 14px; }

.footer {
  margin-top: 64px;
  color: var(--disabled);
  font-size: 12px;
  line-height: 16px;
  text-align: center;
}
.footer a { color: var(--muted); }
.footer a:hover { color: var(--text); }

.trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.panel {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 16px 20px;
}

.download { display: flex; justify-content: space-between; align-items: center; gap: 16px; }

/* Admin */

.admin { max-width: 1200px; margin: 0 auto; padding: 24px 24px 64px; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}
.topbar h1 { font-size: 20px; line-height: 26px; }

.stats { display: flex; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 40px; }
.stat { flex: 1; padding: 16px 20px; border-left: 1px solid var(--border); }
.stat:first-child { border-left: 0; }
.stat span { display: block; color: var(--muted); font-size: 12px; line-height: 16px; }
.stat strong { display: block; font: 600 20px/24px var(--font-mono); color: var(--strong); margin-top: 4px; }

section { margin-bottom: 40px; }
section > h2 { font-size: 17px; line-height: 22px; margin-bottom: 12px; }

.inline { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.inline input[type="number"] { width: 88px; }
.inline .grow { flex: 1; min-width: 180px; }

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-weight: 400;
  font-size: 12px;
  line-height: 16px;
  color: var(--muted);
  padding: 0 12px 8px;
  border-bottom: 1px solid var(--border);
}
td { padding: 8px 12px; border-bottom: 1px solid var(--border); height: 44px; vertical-align: middle; }
tr:hover td { background: var(--surface); }
td.num { font-family: var(--font-mono); font-size: 13px; }
td.actions { text-align: right; white-space: nowrap; }
td.actions form { display: inline; }
td .sub { display: block; color: var(--muted); font-size: 12px; line-height: 16px; }

.chip {
  display: inline-block;
  font: 400 12px/16px var(--font-mono);
  padding: 2px 10px;
  border-radius: 9999px;
  border: 1px solid var(--border-strong);
  color: var(--muted);
}
.chip.active { background: var(--accent-muted); border-color: var(--accent); color: var(--accent); }
.chip.expired { color: var(--warning); border-color: #4a3f2a; }
.chip.revoked { color: var(--error); border-color: #4a2a2a; }

.created { border-color: var(--accent); margin-bottom: 40px; }
.created h2 { font-size: 17px; margin-bottom: 4px; }
.keylist { display: flex; flex-direction: column; gap: 8px; margin: 16px 0 12px; }
.keyline { display: flex; align-items: center; gap: 12px; }
.keyline code { font: 400 16px/22px var(--font-mono); color: var(--strong); user-select: all; }

.empty { color: var(--muted); padding: 16px 0; }
.error.spaced { margin-bottom: 24px; }

td.actions form.approve { display: inline-flex; gap: 8px; align-items: center; margin-right: 8px; }
form.approve input[type="number"] { width: 72px; }

details.extend { display: inline-block; position: relative; }
details.extend form {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 2;
  margin-top: 4px;
  padding: 12px;
  background: var(--raised);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
details.extend input[type="number"] { width: 72px; }

details summary { cursor: pointer; color: var(--muted); list-style: none; }
details summary::-webkit-details-marker { display: none; }
details[open] summary { margin-bottom: 12px; }

@media (max-width: 720px) {
  .stats { flex-wrap: wrap; }
  .stat { flex-basis: 50%; }
  .table-wrap { overflow-x: auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
