:root {
  color-scheme: light;
  --ink: #231d36;
  --muted: #625972;
  --line: #e8e3ee;
  --shell: #f7f6fa;
  --tint: #f3effe;
  --brand: #5847c8;
  --green: #136647;
  --orange: #925017;
  --red: #a53044;
  font: 14px/1.5 "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--shell);
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0 0 .7rem; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }
button, input, select, textarea { font: inherit; }
button, .button { min-height: 2.65rem; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink); padding: .45rem .8rem; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
button:hover, .button:hover { border-color: var(--brand); }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
button:disabled { opacity: .55; cursor: wait; }
.primary { color: white; background: var(--brand); border-color: var(--brand); }
.danger { color: var(--red); border-color: #efd8de; }
.ghost { border-color: transparent; }
.brand { display: flex; align-items: center; gap: .65rem; font-size: 1.1rem; font-weight: 700; }
.brand img { width: 56px; height: 56px; object-fit: contain; }
.brand small { color: var(--muted); display: block; font-weight: normal; }
.card { background: white; border: 1px solid var(--line); border-radius: 14px; padding: 20px; min-width: 0; }
.login { display: grid; min-block-size: 100dvh; place-items: center; padding: 18px; background: linear-gradient(135deg, #f8f6fc, #eeebfa); }
.login .card { width: min(100%, 400px); padding: 28px; }
.login .brand { margin-bottom: 1.3rem; }
.login .primary { width: 100%; }
.shell { display: grid; grid-template-columns: 196px 1fr; min-height: 100dvh; }
.sidebar { display: flex; flex-direction: column; align-items: stretch; background: white; border-right: 1px solid var(--line); padding: 24px 16px; }
.sidebar nav { display: grid; gap: .35rem; margin: 2rem 0 1.5rem; }
.sidebar nav button { text-align: left; justify-content: space-between; border: 0; }
.sidebar nav button[aria-current="page"] { color: var(--brand); background: var(--tint); font-weight: bold; }
.sidebar .ghost { margin-top: auto; }
.work { padding: 24px; min-width: 0; }
.page-head, .dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; }
.eyebrow { color: var(--muted); font-size: .86rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.workspace { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px; }
.workspace > #page { flex: 2 1 530px; }
.workspace > .detail { flex: 1 1 320px; }
.search { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.search input { flex: 1 1 220px; }
.search select { flex: 0 1 auto; width: auto; max-width: 100%; }
.scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { border-bottom: 1px solid var(--line); padding: .7rem .5rem; vertical-align: top; }
th { color: var(--muted); background: #faf9fc; font-size: .90rem; font-weight: 600; }
.record { background: transparent; min-height: 2.2rem; color: var(--brand); justify-content: flex-start; border: 0; padding-inline: 0; font-weight: 650; }
.active-row { background: #f7f4ff; }
.status { display: inline-block; border-radius: 20px; padding: .2rem .55rem; font-size: .85rem; background: var(--tint); color: var(--brand); }
.status.active { background: #e9f7ef; color: var(--green); }
.status.pending, .status.expired { background: #fff1e0; color: var(--orange); }
.status.revoked, .status.rejected { background: #fcecef; color: var(--red); }
.muted, .empty { color: var(--muted); }
.error { color: var(--red); }
.error:empty, #notice:empty, #pendingCount:empty { display: none; }
#notice { margin-block: .25rem .8rem; }
.short-code, .code { font-family: Consolas, ui-monospace, monospace; color: var(--muted); }
.code, dd { overflow-wrap: anywhere; }
dl { display: grid; grid-template-columns: minmax(5rem, auto) 1fr; gap: .4rem 1rem; margin: .75rem 0; }
dt { color: var(--muted); }
dd { margin: 0; }
.detail section { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .9rem; }
.statistics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.statistics > div { background: var(--shell); border-radius: 8px; padding: .65rem; }
.statistics strong { display: block; font-size: 1.15rem; }
.records { margin: 0; padding-left: 1.35rem; }
.records li { margin-bottom: .65rem; }
.mobile-list { display: none; }
dialog { max-height: calc(100dvh - 2rem); width: min(540px, calc(100% - 2rem)); padding: 22px; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); }
dialog::backdrop { background: #211b39a6; }
.dialog-head button { min-height: 2.25rem; padding: .25rem .7rem; }
.expiry { min-inline-size: 0; padding: .5rem .75rem .75rem; margin: 0; border: 1px solid var(--line); border-radius: 8px; }
.expiry legend { padding: 0 .3rem; }
.expiry-clock { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
label { display: grid; gap: .35rem; margin-bottom: .85rem; }
input, textarea, select { min-height: 2.65rem; padding: .47rem .65rem; border: 1px solid #d7cfdf; border-radius: 8px; background: white; color: var(--ink); width: 100%; }
textarea { min-height: 5rem; resize: vertical; }
.checkbox { display: flex; gap: .55rem; align-items: center; }
.checkbox input { width: auto; min-height: 0; }
.security-title { margin-top: 1rem; }
#publishForm, #minimumForm { margin-block: 1rem; }
@media (max-width: 720px) {
  .page-head { flex-wrap: wrap; }
}
footer.actions { justify-content: flex-end; margin-top: 1rem; }
@media (max-width: 720px) {
  .shell { display: block; padding-bottom: 64px; }
  .sidebar { display: flex; flex-direction: row; align-items: center; justify-content: space-between; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 12px; }
  .sidebar .brand img { width: 44px; height: 44px; }
  .sidebar .brand small { display: inline; margin-left: .4rem; }
  .sidebar nav { position: fixed; z-index: 2; inset: auto 0 0; margin: 0; background: white; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; padding: 5px 4px max(5px, env(safe-area-inset-bottom)); }
  .sidebar nav button { justify-content: center; gap: .2rem; white-space: nowrap; padding-inline: .15rem; }
  .work { padding: 12px; }
  .page-head { align-items: center; }
  .page-head .eyebrow { display: none; }
  h1 { font-size: 1.35rem; margin-bottom: .3rem; }
  .card { padding: 12px; }
  .workspace { display: block; }
  .workspace > section { margin-bottom: 12px; }
  .workspace.show-detail #page { display: none; }
  .device-table { display: none; }
  .mobile-list { display: grid; gap: .45rem; }
  .mobile-list .row { display: grid; grid-template-columns: 1fr auto; align-items: center; text-align: left; justify-content: stretch; gap: .2rem .5rem; min-width: 0; }
  .row strong { overflow-wrap: anywhere; }
  .row .short-code { grid-column: 1/-1; }
}
