:root {
  color-scheme: light;
  font-family: system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #14283a;
  background: #f2f5f7;
  --surface: #fff;
  --text: #14283a;
  --muted: #526575;
  --line: #d6e0e6;
  --primary: #125b55;
  --primary-hover: #0b4944;
  --primary-soft: #deeee8;
  --danger: #9d2a34;
  --nav: #122534;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-inline-size: 0; line-height: 1.5; }
h1, h2, p, dl, dd { margin: 0; }
h1 { font-size: clamp(1.65rem, 4vw, 2.25rem); line-height: 1.2; letter-spacing: -.035em; }
h2 { font-size: 1rem; }
button, input, select, textarea { font: inherit; }
button, summary { cursor: pointer; }
button {
  min-block-size: 2.75rem; padding: .45rem .85rem; border: 1px solid var(--line);
  border-radius: .4rem; background: var(--surface); color: var(--text);
}
button:hover { background: #edf3f5; }
button:disabled { cursor: default; opacity: .55; }
button.primary { border-color: var(--primary); background: var(--primary); color: #fff; }
button.primary:hover { background: var(--primary-hover); }
button.danger { color: var(--danger); }
button.danger:hover { background: #fff0ef; }
:focus-visible { outline: 3px solid #16847a; outline-offset: 2px; }
label { display: grid; gap: .35rem; color: var(--muted); font-size: .875rem; min-inline-size: 0; }
input, select, textarea {
  width: 100%; min-block-size: 2.75rem; padding: .55rem .65rem;
  color: var(--text); background: var(--surface); border: 1px solid #b9c8d2; border-radius: .35rem;
}
textarea { resize: vertical; }
code, pre, .identifier { font-family: ui-monospace, monospace; overflow-wrap: anywhere; }
.login-layout { display: grid; min-height: 100vh; place-items: center; padding: 1.25rem; }
.login-card {
  width: min(100%, 27rem); border: 1px solid var(--line); border-radius: .8rem;
  padding: clamp(1.4rem, 6vw, 2.5rem); background: var(--surface); box-shadow: 0 12px 40px #152f4010;
}
.login-card h1 { margin: 1.7rem 0 1.3rem; }
.login-card form { display: grid; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .65rem; font-weight: 700; }
.brand-mark {
  display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: .4rem;
  background: #b6e3d0; color: #143a33; font-weight: 750;
}
.shell { min-height: 100vh; display: grid; grid-template-columns: 13rem minmax(0, 1fr); }
.sidebar { padding: 1.4rem 1rem; background: var(--nav); color: #fff; }
.sidebar .brand { padding: 0 .4rem; margin-bottom: 2rem; white-space: nowrap; }
.sidebar nav { display: grid; gap: .3rem; }
.sidebar button {
  background: transparent; color: #d9e6ed; text-align: left; border: 1px solid transparent; white-space: nowrap;
}
.sidebar button:hover { background: #243c4d; }
.sidebar button[aria-current] { background: #284550; color: #fff; border-color: #537d82; }
.sidebar :focus-visible { outline-color: #b6e3d0; }
.main { min-width: 0; }
.topbar {
  min-height: 4.5rem; display: flex; justify-content: space-between; flex-wrap: wrap; align-items: center;
  gap: .75rem; padding: .65rem clamp(1rem, 4vw, 2.5rem); border-bottom: 1px solid var(--line);
  background: var(--surface); color: var(--muted); font-size: .875rem;
}
.content { width: min(100%, 88rem); margin-inline: auto; padding: 1.75rem clamp(1rem, 4vw, 2.5rem) 3rem; }
[data-panel] { display: grid; align-content: start; gap: 1.15rem; }
.section-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.message { color: var(--primary); overflow-wrap: anywhere; }
.message:empty { display: none; }
.message:not(:empty) { margin-block: .5rem 1rem; }
.message[data-error] { color: var(--danger); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); gap: .75rem; }
.stats > div, .card, .table-wrap {
  background: var(--surface); border: 1px solid var(--line); border-radius: .6rem;
}
.stats > div, .card { padding: 1rem 1.2rem; }
.stats dt, .policy dt { font-size: .875rem; color: var(--muted); }
.stats dd { margin-top: .35rem; font-size: 1.8rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.policy { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: .75rem; margin-top: .85rem; }
.policy dd { margin-top: .2rem; overflow-wrap: anywhere; }
summary { font-weight: 650; min-block-size: 2.75rem; padding-block: .6rem; }
details.card { padding-block: .25rem; }
details[open].card { padding-bottom: 1rem; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: .85rem 1rem; margin-top: .65rem; }
.wide { grid-column: 1 / -1; }
.table-wrap { overflow: auto; max-block-size: min(65vh, 42rem); }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .875rem; }
thead { position: sticky; inset-block-start: 0; z-index: 2; }
th, td { padding: .7rem .8rem; vertical-align: top; text-align: left; border-bottom: 1px solid var(--line); }
thead th { color: var(--muted); background: #eaf0f3; white-space: nowrap; }
tbody th { position: sticky; inset-inline-start: 0; z-index: 1; background: var(--surface); min-width: 7rem; max-width: 17rem; overflow-wrap: anywhere; }
tbody td { min-width: 7rem; max-width: 20rem; overflow-wrap: anywhere; }
tbody tr:last-child > * { border-bottom: 0; }
.empty { padding: 1rem; color: var(--muted); }
.pagination { margin-block-start: .7rem; justify-content: end; }
.pill { display: inline-block; padding: .11rem .55rem; border-radius: 1rem; background: #e7eef1; color: #435a6a; white-space: nowrap; }
.pill[data-status="active"] { background: var(--primary-soft); color: #18584d; }
.pill[data-status="grace"] { background: #f7edcf; color: #674c0d; }
.pill[data-status="revoked"], .pill[data-status="invalid"] { background: #ffe9e7; color: #8d2b32; }
.result { margin-top: .55rem; padding: .8rem; background: #edf4f3; border-radius: .35rem; overflow-wrap: anywhere; }
.result pre, td pre { margin-block: .5rem; white-space: pre-wrap; }
.result pre { max-block-size: 18rem; overflow: auto; }
@media (max-width: 50rem) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { padding: .85rem 1rem; }
  .sidebar .brand { margin-bottom: .7rem; }
  .sidebar nav { display: flex; flex-wrap: wrap; }
  .topbar { min-height: 3.5rem; }
}
@media (max-width: 30rem) {
  tbody th { position: static; }
  .content { padding-block-start: 1.2rem; }
}
dialog {
  width: min(calc(100% - 2rem), 33rem); border: 1px solid var(--line);
  border-radius: .6rem; background: var(--surface); color: var(--text); padding: 1rem;
}
dialog textarea { margin-block: .75rem; }
dialog::backdrop { background: #12253488; }
