@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url("fonts/plex-sans-400.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url("fonts/plex-sans-500.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url("fonts/plex-sans-600.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url("fonts/plex-mono-500.woff2") format("woff2"); }

:root {
  color-scheme: dark;
  --ground: #0f1419;
  --panel: #151b22;
  --raised: #1b232c;
  --line: #27303a;
  --content: #e6eaef;
  --muted: #9aa6b3;
  --accent: #4fd1bf;
  --accent-soft: #16262a;
  --on-accent: #062420;
  --ok: #7fd69a;
  --warn: #f0c36a;
  --bad: #ff9c8c;
  --bad-line: #5a2c26;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--content);
  font: 15px/1.45 "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

h1 { margin: 0; font-size: 28px; font-weight: 600; }
h2 { margin: 0; font-size: 17px; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.error { color: var(--bad); }
.error:empty { display: none; }
.hint { font-size: 13px; }
.mono { font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace; font-weight: 500; }
.spacer { flex: 1; }
.grow { flex: 1 1 220px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }

label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }

input, select, textarea, button {
  font: inherit;
  color: var(--content);
  background: var(--ground);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  min-height: 44px;
}
input, textarea { font-size: 15px; width: 100%; }
textarea { padding: 10px 12px; resize: vertical; font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace; }
button { cursor: pointer; white-space: nowrap; background: transparent; }
button:hover:not(:disabled) { border-color: var(--muted); }
button:disabled { opacity: 0.45; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; padding: 0 20px; }
button.primary:hover:not(:disabled) { background: #6fdccc; border-color: #6fdccc; }
button.danger { color: var(--bad); border-color: var(--bad-line); }
button.small { min-height: 36px; padding: 0 10px; font-size: 13px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.brand { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 600; color: var(--content); }
.brand svg { color: var(--accent); flex: none; }
.brand .glyph { fill: none; stroke: var(--on-accent); stroke-width: 1.8; stroke-linejoin: round; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: min(360px, 100%); padding: 24px; display: flex; flex-direction: column; gap: 16px; }

.empty { padding: 28px; text-align: center; }

.badge { display: inline-block; padding: 2px 12px; border-radius: 999px; font-size: 13px; font-weight: 500; background: var(--raised); color: #b9c2cc; }
.badge.active { background: #17301f; color: var(--ok); }
.badge.expired, .badge.revoked { background: #3a1f1a; color: var(--bad); }

dialog {
  width: min(520px, calc(100% - 32px));
  background: var(--panel); color: var(--content);
  border: 1px solid var(--line); border-radius: 14px; padding: 24px;
}
dialog::backdrop { background: rgb(0 0 0 / 0.65); }
dialog[open], dialog[open] > form:only-child { display: flex; flex-direction: column; gap: 14px; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

.items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow-y: auto; }
.items li { display: flex; align-items: center; gap: 10px; background: var(--ground); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.items .info { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.items .info small { display: block; color: var(--muted); }

.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; padding: 14px 16px; background: var(--ground); border: 1px solid var(--line); border-radius: 10px; }
.notice { padding: 12px 14px; border-radius: 10px; background: #2b2412; color: var(--warn); font-size: 14px; }
