:root {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans CJK SC", sans-serif;
  color: #142b29;
  background: #f3f7f6;
  line-height: 1.55;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html:has(#claim-entry[hidden]) { background: #fff; }
body { margin: 0; }
h1, h2, p, dl, dd { margin: 0; }
h1 { font-size: clamp(1.75rem, 5vw, 2.25rem); line-height: 1.25; letter-spacing: -.025em; }
h2 { font-size: 1.2rem; }
a { color: #155c51; text-underline-offset: .22em; }

:focus-visible { outline: 3px solid #228e7d; outline-offset: 4px; }

.panel {
  background: #fff;
  border: 1px solid #d8e5e1;
  border-radius: 1rem;
  box-shadow: 0 4px 16px #1e4b3d08;
}

.entry {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: radial-gradient(ellipse at 50% 0%, #dbece7, #f3f7f6 64%);
}

.entry-card {
  width: min(100%, 28rem);
  padding: clamp(1.5rem, 7vw, 2.75rem);
}

.entry-card p { color: #48645e; margin-top: .9rem; }
.entry-card form { margin: 1.75rem 0 0; }
.entry-card > .button { margin-top: 1.75rem; }

.button {
  display: block;
  width: 100%;
  padding: .85rem 1rem;
  text-align: center;
  background: #155c51;
  color: #fff;
  border: 0;
  border-radius: .6rem;
  text-decoration: none;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.button:hover { background: #10473f; }

.shell { width: min(100% - 2rem, 66rem); margin-inline: auto; }
.topbar { background: #fff; border-bottom: 1px solid #d8e5e1; }
.topbar-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; min-height: 4rem; gap: .75rem; padding-block: .5rem; }
.brand { font-weight: 750; letter-spacing: -.02em; }
.topbar a, .metric dt, .section-header p, .link-button { font-size: .9rem; }
.topbar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .95rem; }
.logout-form { margin: 0; }
.link-button {
  background: none;
  border: 0;
  padding: 0;
  color: #155c51;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: .22em;
  cursor: pointer;
}
.link-button:hover { color: #10473f; }

.eyebrow { color: #155c51; font-size: .85rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.login-card { width: min(100%, 26rem); }
.login-card h1 { margin-top: .35rem; }
.login-form, .password-form { display: grid; gap: 1rem; margin-top: 1.5rem; }
.field { display: grid; gap: .4rem; }
.field label { font-size: .92rem; font-weight: 650; }
.field input {
  width: 100%;
  border: 1px solid #c6d8d2;
  border-radius: .55rem;
  padding: .68rem .8rem;
  font: inherit;
  color: inherit;
  background: #fbfdfc;
}
.field input:focus { border-color: #155c51; background: #fff; }
.password-input { position: relative; display: flex; align-items: center; }
.password-input input { padding-right: 3.75rem; }
.toggle-password {
  position: absolute;
  right: .45rem;
  border: 0;
  border-radius: .4rem;
  background: #e4f1ec;
  color: #155c51;
  padding: .3rem .55rem;
  font: inherit;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
}
.toggle-password:hover { background: #d7eae2; }

.admin { padding-block: clamp(1.5rem, 6vw, 3rem); }
.dashboard-heading { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem .85rem; }
.demo-label { background: #e3efe9; color: #285750; border-radius: 2rem; padding: .2rem .65rem; font-size: .9rem; }
.status-pill { border-radius: 2rem; padding: .22rem .7rem; font-size: .86rem; font-weight: 650; }
.status-pill.is-open { background: #e1f3ec; color: #12584c; }
.status-pill.is-paused { background: #f4efe4; color: #7a581c; }

.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem; margin-block: 1.35rem; }
.metric { padding: clamp(.75rem, 3.5vw, 1.35rem); }
.metric dt, .section-header p, th, .empty { color: #48645e; }
.metric dd { margin-top: .25rem; font-size: clamp(1.35rem, 5vw, 2.25rem); font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric .available { color: #155c51; }
.metric-note { margin-top: .35rem; font-size: .82rem; color: #56736c; }

.operations { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.operation { padding: clamp(1rem, 4vw, 1.5rem); }
.operation h2 { margin-bottom: .5rem; }
.support { color: #48645e; font-size: .92rem; }
.import-form { display: grid; gap: .65rem; margin-top: 1rem; }
.operation label { font-size: .94rem; font-weight: 650; display: block; }
.operation .button { width: auto; justify-self: start; padding: .65rem .9rem; }
.operation .secondary { color: #155c51; background: #e4f1ec; }
.operation .secondary:hover { background: #d7eae2; }
.operation .button:disabled { color: #48645e; background: #e6eeeb; cursor: default; }
.import-form input[type="file"], .entry-url {
  width: 100%;
  border: 1px solid #c6d8d2;
  border-radius: .5rem;
  padding: .55rem;
  color: inherit;
  background: #fbfdfc;
  font: inherit;
}
.import-form input[type="file"]::file-selector-button {
  border: 0;
  border-radius: .3rem;
  color: #155c51;
  background: #e4f1ec;
  font: inherit;
  margin-inline-end: .5rem;
  padding: .25rem .45rem;
  cursor: pointer;
}
.dropzone {
  border: 1.5px dashed #b4cdc5;
  border-radius: .75rem;
  padding: 1rem;
  background: #f8fbfa;
  display: grid;
  gap: .55rem;
  transition: border-color .15s ease, background-color .15s ease;
}
.dropzone.is-dragover { border-color: #155c51; background: #eaf4f0; }
.dropzone-title { font-weight: 650; font-size: .95rem; }
.dropzone.is-enhanced .native-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.picker-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .25rem; }
.upload-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-top: .25rem;
  padding: .5rem .7rem;
  border-radius: .5rem;
  background: #eaf4f0;
  font-size: .88rem;
}

.password-panel { margin-bottom: 1.25rem; padding: clamp(1rem, 3.5vw, 1.35rem); }
.password-panel summary { font-weight: 700; cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; }
.password-panel summary::-webkit-details-marker { display: none; }
.password-panel summary::after { content: "展开"; font-size: .85rem; color: #155c51; font-weight: 600; }
.password-panel[open] summary::after { content: "收起"; }
.password-body { margin-top: .85rem; padding-top: .85rem; border-top: 1px solid #e3ebe8; }
.password-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.password-form .button { width: auto; justify-self: start; padding: .65rem 1.1rem; }

@media (max-width: 48rem) {
  .password-grid { grid-template-columns: minmax(0, 1fr); }
}
.registration { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .65rem; }
.registration-state { font-weight: 700; }
.qr-block { display: grid; grid-template-columns: 132px minmax(0, 1fr); align-items: center; gap: .8rem; }
.qr-block, .qr-unavailable { border-top: 1px solid #e3ebe8; margin-top: 1.25rem; padding-top: 1rem; }
.qr-block img { display: block; border: 1px solid #e3ebe8; border-radius: .6rem; }
.entry-url { margin-top: .35rem; font-size: .9rem; }
.download-link { display: inline-block; margin-top: .55rem; }
.notice { margin-top: 1rem; padding: .75rem .9rem; border-radius: .6rem; background: #edf6f2; }
.notice-error { color: #7c301d; background: #fbece6; }
.import-result ul { margin: .5rem 0 0; padding-left: 1.25rem; }

.time-field { margin-top: .25rem; }
.field-header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem; }
.expiry-preview { margin-top: .15rem; font-size: .86rem; }

.inventory-panel { margin-bottom: 1.25rem; overflow: hidden; }
.inventory-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .85rem; padding: clamp(1rem, 3.5vw, 1.35rem); }
.inventory-header p { margin-top: .3rem; }
.inline-form { margin: 0; }
.button.danger { width: auto; background: #fbece9; color: #9c2b21; padding: .6rem .95rem; font-size: .92rem; }
.button.danger:hover { background: #f6dcd6; }
.button.small-button { width: auto; padding: .4rem .75rem; font-size: .86rem; }
.inventory-empty { padding: 0 clamp(1rem, 3.5vw, 1.35rem) 1.2rem; }

.batch-list { display: grid; gap: .8rem; padding: 0 clamp(1rem, 3.5vw, 1.35rem) 1.15rem; }
.batch-card {
  border: 1px solid #d8e5e1;
  border-radius: .8rem;
  padding: .95rem 1.05rem;
  background: #fbfdfc;
  display: grid;
  gap: .75rem;
}
.batch-card-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; }
.batch-title-group { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.batch-name { font-size: 1.02rem; }
.batch-badge { border-radius: 2rem; padding: .15rem .55rem; font-size: .78rem; font-weight: 650; }
.batch-badge.is-priority { background: #dff2eb; color: #12584c; }
.batch-badge.is-queued { background: #edf2f0; color: #48645e; }
.batch-meta { font-size: .84rem; color: #56736c; font-variant-numeric: tabular-nums; }

.batch-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .55rem; }
.batch-stat { background: #fff; border: 1px solid #e3ebe8; border-radius: .55rem; padding: .5rem .7rem; display: grid; gap: .15rem; }
.batch-stat span { font-size: .8rem; color: #56736c; }
.batch-stat strong { font-size: 1.08rem; font-variant-numeric: tabular-nums; }
.batch-stat .stat-available { color: #155c51; }
.batch-stat .stat-allocated { color: #1d4ed8; }

.batch-progress { width: 100%; height: .45rem; border: 0; border-radius: 999px; overflow: hidden; background: #e3ebe8; appearance: none; }
.batch-progress::-webkit-progress-bar { background: #e3ebe8; border-radius: 999px; }
.batch-progress::-webkit-progress-value { background: #155c51; border-radius: 999px; }
.batch-progress::-moz-progress-bar { background: #155c51; border-radius: 999px; }
.batch-footer { font-size: .84rem; font-variant-numeric: tabular-nums; }

.specific-clear, .history-batches { border-top: 1px solid #e3ebe8; padding: .95rem clamp(1rem, 3.5vw, 1.35rem); }
.specific-clear summary, .history-batches summary { font-weight: 650; color: #155c51; cursor: pointer; font-size: .94rem; }
.history-batches .table-scroll { margin-top: .85rem; border: 1px solid #e3ebe8; border-radius: .6rem; }
.specific-form { display: grid; gap: .85rem; margin-top: .9rem; }
.specific-form .button { justify-self: start; }
.code-chips { display: flex; flex-wrap: wrap; gap: .45rem; max-height: 12rem; overflow-y: auto; padding: .25rem 0; }
.code-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  border: 1px solid #c6d8d2;
  border-radius: 2rem;
  padding: .25rem .65rem;
  font-size: .84rem;
  background: #f8fbfa;
  cursor: pointer;
}
.code-chip input { width: auto; margin: 0; accent-color: #155c51; }

.event-row-allocated td:nth-child(2) { color: #155c51; font-weight: 600; }
.event-row-imported td:nth-child(2) { color: #1d4ed8; font-weight: 600; }
.event-row-expired td:nth-child(2),
.event-row-cleared td:nth-child(2) { color: #9c2b21; font-weight: 600; }

@media (max-width: 38rem) {
  .batch-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 44rem) {
  .operations { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 23rem) {
  .qr-block { grid-template-columns: minmax(0, 1fr); }
}

.section-header, .pagination { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem 1rem; padding: 1rem; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; font-size: .9rem; }
th, td { padding: .8rem 1rem; border-top: 1px solid #e3ebe8; }
th { background: #f4f8f7; font-weight: 650; }
td:first-child { font-variant-numeric: tabular-nums; }
.empty { padding: 0 1rem 1rem; }
.pagination { justify-content: flex-end; border-top: 1px solid #e3ebe8; }
