:root {
  --bg: #f6f4f9;
  --surface: #ffffff;
  --line: #e4dfec;
  --text: #1f1a29;
  --muted: #6d6578;
  --amethyst: #6b4fbb;
  --amethyst-soft: #efeaf9;
  --amber: #b7791f;
  --amber-soft: #fbf1df;
  --verdigris: #2f8f7a;
  --verdigris-soft: #e2f3ee;
  --garnet: #a3324a;
  --garnet-soft: #f8e4e8;
  --radius: 12px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141118;
    --surface: #1e1a24;
    --line: #322b3b;
    --text: #efeaf5;
    --muted: #a59cb2;
    --amethyst: #a58cf0;
    --amethyst-soft: #2b2340;
    --amber: #e3a84e;
    --amber-soft: #352816;
    --verdigris: #5cc4ab;
    --verdigris-soft: #17302a;
    --garnet: #ec7d93;
    --garnet-soft: #3a1b23;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 22px; margin: 0 0 6px; }
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.error { color: var(--garnet); min-height: 1.4em; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

.bar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 2;
}
.brand { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.mark { width: 18px; height: 18px; border-radius: 6px; background: var(--amethyst); display: inline-block; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { border: 0; background: none; padding: 6px 10px; border-radius: 8px; cursor: pointer; color: var(--muted); }
.tab[aria-current="page"] { background: var(--amethyst-soft); color: var(--amethyst); font-weight: 600; }
.who { margin-left: auto; display: flex; gap: 8px; align-items: center; color: var(--muted); }

main { max-width: 1180px; margin: 0 auto; padding: 20px 16px 60px; }
.status { color: var(--muted); }

button.primary, button.ghost, button.danger, button.small {
  border-radius: 8px; padding: 7px 12px; cursor: pointer; border: 1px solid transparent;
}
button.primary { background: var(--amethyst); color: #fff; }
button.ghost { background: transparent; border-color: var(--line); }
button.danger { background: var(--garnet); color: #fff; }
button.small { padding: 4px 8px; font-size: 12px; background: transparent; border-color: var(--line); }
button.small.danger { background: transparent; color: var(--garnet); border-color: var(--garnet); }
button:disabled { opacity: .5; cursor: default; }

input, select {
  border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 7px 10px; min-width: 0;
}
label { display: block; font-weight: 600; margin: 12px 0 4px; }

.signin { max-width: 380px; margin: 40px auto; background: var(--surface); padding: 24px; border-radius: var(--radius); border: 1px solid var(--line); }
.signin input { width: 100%; }
.signin button { margin-top: 12px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.tile .label { color: var(--muted); font-size: 12px; }
.tile .value { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; margin-top: 16px; }
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar input[type="search"] { flex: 1 1 260px; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--surface); }
tr:last-child td { border-bottom: 0; }
tbody tr.link { cursor: pointer; }
tbody tr.link:hover { background: var(--amethyst-soft); }
td.wrap { white-space: normal; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.trial { background: var(--amber-soft); color: var(--amber); }
.badge.active, .badge.complimentary { background: var(--verdigris-soft); color: var(--verdigris); }
.badge.grace { background: var(--amber-soft); color: var(--amber); }
.badge.expired, .badge.none, .badge.disabled { background: var(--garnet-soft); color: var(--garnet); }
.badge.neutral { background: var(--amethyst-soft); color: var(--amethyst); }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }

.back { margin-bottom: 12px; }
.events { list-style: none; padding: 0; margin: 8px 0 0; max-height: 260px; overflow: auto; }
.events li { padding: 6px 0; border-top: 1px solid var(--line); }
.events time { color: var(--muted); font-size: 12px; display: block; }

dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); max-width: 440px; width: calc(100% - 32px); }
dialog::backdrop { background: rgb(0 0 0 / .35); }
dialog input { width: 100%; }

@media (max-width: 640px) {
  .bar { padding: 10px 16px; }
  .who { margin-left: 0; width: 100%; }
}
.narrow { width: 80px; }
.spaced { margin-top: 10px; }
pre.mono { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.error-text { color: var(--garnet); }
.qr { display: block; width: 220px; height: 220px; margin: 12px auto; background: #fff; border-radius: 8px; padding: 6px; }
.key { word-break: break-all; }
.codes { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; column-count: 2; }
.steps { padding-left: 18px; }
