:root {
  font-family:
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
  color: #30202c;
  background: #f8f5f0;
  --bg: #f8f5f0;
  --card: #fffdfa;
  --ink: #30202c;
  --muted: #746976;
  --line: #e6ded8;
  --accent: #b43913;
  --tint: #fff0e5;
  --danger: #a72836;
  --shadow: 0 12px 48px #30202c0a;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  touch-action: manipulation;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: wait;
  opacity: 0.55;
}
a {
  color: var(--accent);
}
:focus-visible {
  outline: 3px solid #f28b52;
  outline-offset: 3px;
}
button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.65rem 1rem;
  background: var(--card);
  color: var(--ink);
  font-weight: 650;
  min-height: 42px;
}
button:hover {
  border-color: var(--accent);
  background: var(--tint);
}
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
button.danger {
  color: var(--danger);
  border-color: var(--danger);
}
button.small {
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
  min-height: 34px;
}
.environment {
  position: relative;
  text-align: center;
  padding: 0.6rem 1rem;
  font-size: 0.78rem;
  background: #ffe3a9;
  color: #66420b;
  font-weight: 750;
  letter-spacing: 0.02em;
}
.environment.production {
  background: #30202c;
  color: #fff1d8;
}
.layout {
  display: grid;
  grid-template-columns: 218px minmax(0, 1fr);
  min-height: calc(100svh - 36px);
}
.sidebar {
  padding: 2rem 1.3rem;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2rem;
  background: var(--card);
}
.brand {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.065em;
}
.brand span {
  color: #f45a1e;
}
.brand small {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.13em;
  margin-top: 0.4rem;
}
.sidebar nav {
  display: grid;
  gap: 0.35rem;
}
.sidebar nav button {
  background: transparent;
  border: 0;
  text-align: start;
  border-radius: 10px;
  padding: 0.8rem 1rem;
  font-size: 0.9rem;
}
.sidebar nav button.active {
  background: var(--tint);
  color: var(--accent);
}
.identity {
  margin-top: auto;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.8;
  overflow-wrap: anywhere;
}
.identity button {
  margin-top: 0.7rem;
}
.content {
  padding: clamp(1.3rem, 3.4vw, 3.5rem);
  max-width: 1500px;
  width: 100%;
  margin: auto;
  margin-top: 0;
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.8rem;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 750;
  margin: 0 0 0.55rem;
}
h1 {
  font-size: clamp(1.65rem, 2.7vw, 2.3rem);
  letter-spacing: -0.045em;
  margin: 0 0 0.55rem;
  font-weight: 750;
}
h2 {
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
}
h3 {
  font-size: 0.94rem;
  margin: 0 0 0.75rem;
}
p {
  line-height: 1.75;
  margin: 0.6rem 0;
}
.muted,
.sub {
  color: var(--muted);
}
.sub {
  font-size: 0.87rem;
  margin: 0;
}
.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.4rem;
  box-shadow: var(--shadow);
  min-width: 0;
}
.metric-label {
  color: var(--muted);
  font-size: 0.78rem;
}
.metric {
  font-size: 2.4rem;
  font-weight: 650;
  letter-spacing: -0.07em;
  margin: 0.7rem 0 0.3rem;
  line-height: 1;
}
.metric-note {
  font-size: 0.72rem;
  color: var(--muted);
}
.section {
  margin-top: 1.3rem;
}
.grid-two {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(250px, 0.8fr);
  gap: 1.2rem;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.84rem;
  min-width: 0;
}
.field.full {
  grid-column: 1/-1;
}
.field label {
  font-weight: 650;
}
.field small {
  font-size: 0.73rem;
  color: var(--muted);
  line-height: 1.65;
}
input,
select,
textarea {
  width: 100%;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  min-height: 44px;
}
textarea {
  min-height: 85px;
  resize: vertical;
}
input::placeholder {
  color: var(--muted);
  opacity: 0.8;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin-top: 1.4rem;
}
.alert {
  padding: 1rem 1.2rem;
  border-radius: 12px;
  background: var(--tint);
  font-size: 0.82rem;
  line-height: 1.8;
  border: 1px solid #eaa87c66;
}
.alert.error {
  color: var(--danger);
  background: #ffebe8;
}
.rule-list {
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.9;
}
.rule-list li + li {
  margin-top: 0.6rem;
}
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}
table {
  border-collapse: collapse;
  width: 100%;
  text-align: start;
  font-size: 0.8rem;
  white-space: nowrap;
}
th {
  text-align: start;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 550;
  padding: 0.9rem 1.1rem;
  background: var(--bg);
}
td {
  padding: 0.9rem 1.1rem;
  border-top: 1px solid var(--line);
}
td.wrap {
  white-space: normal;
  min-width: 180px;
  max-width: 340px;
  overflow-wrap: anywhere;
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}
.pill {
  display: inline-block;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  background: var(--tint);
  color: var(--accent);
  font-size: 0.7rem;
}
.pill.revoked,
.pill.void {
  background: #ffebe8;
  color: #a72836;
}
.pill.redeemed {
  background: #e3f0e5;
  color: #226739;
}
.empty {
  text-align: center;
  padding: 3.5rem 1.5rem;
  color: var(--muted);
  font-size: 0.86rem;
}
.empty b {
  display: block;
  color: var(--ink);
  font-size: 1rem;
  margin-bottom: 0.6rem;
}
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.78rem;
}
.pagination > div {
  display: flex;
  gap: 0.5rem;
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: end;
  margin-bottom: 1.2rem;
}
.filters .field {
  flex: 1;
  min-width: 140px;
}
.filters button {
  flex: none;
}
.key-values {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem;
}
.key-values dt {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.key-values dd {
  margin: 0;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}
.notice {
  position: fixed;
  bottom: 1.3rem;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100vw - 2rem);
  background: var(--ink);
  color: var(--card);
  padding: 0.9rem 1.3rem;
  border-radius: 12px;
  box-shadow: 0 6px 28px #0003;
  z-index: 100;
  font-size: 0.84rem;
}
.loading {
  padding: 5rem 2rem;
  text-align: center;
  color: var(--muted);
}
.login {
  min-height: calc(100svh - 40px);
  display: grid;
  place-content: center;
  padding: 2rem 1rem;
}
.login-box {
  width: min(420px, calc(100vw - 2rem));
  padding: 2.2rem;
}
.login-brand {
  margin-bottom: 2rem;
}
.login .form-grid {
  grid-template-columns: 1fr;
}
.login .primary {
  width: 100%;
  margin-top: 0.5rem;
}
.login-footer {
  margin-top: 1.4rem;
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.8;
}
dialog {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1.8rem;
  width: min(560px, calc(100vw - 2rem));
  max-height: calc(100svh - 2rem);
  box-shadow: 0 30px 100px #0003;
}
dialog::backdrop {
  background: #20162088;
  backdrop-filter: blur(3px);
}
dialog .actions {
  justify-content: end;
}
dialog h2 {
  font-size: 1.3rem;
}
.code-list {
  display: grid;
  gap: 0.5rem;
  margin-top: 1rem;
  max-height: 300px;
  overflow: auto;
}
.code-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.code-row code {
  flex: 1;
  min-width: 0;
  font-size: 0.76rem;
  overflow-wrap: anywhere;
}
.timeline {
  display: grid;
  gap: 0.8rem;
}
.event {
  border-left: 2px solid var(--line);
  padding: 0.2rem 0 0.3rem 1rem;
  font-size: 0.78rem;
}
.event time {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  margin-top: 0.3rem;
}
.event pre,
.audit-json {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.7rem;
  margin: 0.5rem 0;
  max-width: 700px;
}
.detail-tabs {
  margin: 1.2rem 0;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.back {
  margin-bottom: 1rem;
  background: transparent;
}
.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #19171b;
    --card: #242126;
    --ink: #f5e9db;
    --muted: #b5aab6;
    --line: #3c363f;
    --accent: #ff9a6b;
    --tint: #452a23;
    --danger: #ff98a1;
    --shadow: none;
    color: var(--ink);
    background: var(--bg);
  }
  button.primary {
    color: #271a18;
    background: #f78b53;
    border-color: #f78b53;
  }
  .pill.revoked,
  .pill.void,
  .alert.error {
    background: #49242d;
    color: #ffacb6;
  }
  .pill.redeemed {
    background: #233d31;
    color: #b3dec0;
  }
  .environment {
    background: #563e13;
    color: #ffe0a1;
  }
  .notice {
    background: #f5e9db;
    color: #30202c;
  }
}
@media (max-width: 900px) {
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .layout {
    grid-template-columns: 180px minmax(0, 1fr);
  }
  .sidebar {
    padding: 1.5rem 1rem;
  }
  .grid-two {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 620px) {
  .layout {
    display: block;
  }
  .sidebar {
    padding: 1rem 1.2rem;
    gap: 1rem;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .brand {
    font-size: 1.4rem;
  }
  .brand small {
    display: inline;
    margin-left: 0.7rem;
    font-size: 0.63rem;
  }
  .sidebar nav {
    display: flex;
    overflow: auto;
    gap: 0.2rem;
    padding: 0.1rem 0 0.3rem;
  }
  .sidebar nav button {
    white-space: nowrap;
    padding: 0.6rem 0.8rem;
    font-size: 0.78rem;
    flex: 0 0 auto;
  }
  .identity {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: space-between;
    font-size: 0.7rem;
  }
  .identity button {
    margin: 0;
    min-height: 32px;
    padding: 0.3rem 0.6rem;
  }
  .content {
    padding: 1.5rem 1rem;
  }
  .page-head {
    margin-bottom: 1.3rem;
  }
  .page-head button {
    font-size: 0.76rem;
    padding: 0.6rem 0.7rem;
  }
  .cards {
    gap: 0.7rem;
  }
  .card {
    padding: 1.1rem;
    border-radius: 14px;
  }
  .metric {
    font-size: 2rem;
  }
  .form-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .key-values {
    gap: 1rem;
  }
  .pagination {
    flex-wrap: wrap;
  }
  .environment {
    font-size: 0.7rem;
  }
  .login-box {
    padding: 1.5rem;
  }
  .filters .field {
    min-width: 130px;
  }
  .status-row {
    align-items: flex-start;
  }
  .actions button {
    font-size: 0.8rem;
  }
  .code-row code {
    font-size: 0.68rem;
  }
  dialog {
    padding: 1.3rem;
  }
  .eyebrow {
    font-size: 0.62rem;
  }
  h1 {
    font-size: 1.7rem;
  }
}

.percent {
  font-size: 1rem;
}
.recovery-codes {
  font:
    0.9rem/1.9 ui-monospace,
    monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 330px;
  overflow: auto;
  padding: 1rem;
  background: var(--bg);
  border-radius: 12px;
  user-select: text;
}
.check {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  font-size: 0.8rem;
  line-height: 1.7;
}
.check input {
  width: 20px;
  min-height: 20px;
  margin-top: 3px;
}
.event button:disabled {
  cursor: not-allowed;
}
