* {
  box-sizing: border-box;
}

:root {
  --page: #f4f2ed;
  --panel: #fffdf8;
  --panel-muted: #f7f5ef;
  --line: #ded8cb;
  --line-soft: #ece7dc;
  --text: #1e211f;
  --muted: #6d6a62;
  --accent: #315d52;
  --accent-soft: #e6eee9;
  --warning: #8a4a10;
  --warning-soft: #fff4e4;
  --danger: #a33f2f;
  --danger-hover: #843225;
  --shadow: 0 22px 55px rgba(42, 37, 28, 0.12);
  --radius: 4px;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  color: var(--text);
  background: var(--page);
}

.public-page {
  min-height: 100dvh;
  background: var(--page);
}

.query-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.query-panel {
  width: min(100%, 520px);
  padding: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border: 7px solid var(--text);
  border-radius: 50%;
  background: transparent;
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0 0 28px;
  font-size: 34px;
  line-height: 1.16;
  letter-spacing: 0;
}

label {
  display: block;
  margin-bottom: 10px;
  font-size: 14px;
  color: var(--muted);
}

.input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

input,
button,
textarea,
select {
  font: inherit;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--text);
  outline: none;
}

input {
  height: 48px;
  padding: 0 14px;
}

select {
  height: 40px;
  padding: 0 34px 0 12px;
}

textarea {
  min-height: 220px;
  padding: 12px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(49, 93, 82, 0.15);
}

button {
  min-height: 48px;
  border: 0;
  border-radius: var(--radius);
  padding: 0 20px;
  font-weight: 700;
  color: #ffffff;
  background: #171817;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
}

button:hover {
  background: #2a2c2a;
}

button:active {
  transform: translateY(1px);
}

.result-box {
  min-height: 58px;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--panel-muted);
  color: var(--muted);
}

.result-box strong,
.result-box span {
  display: block;
}

.result-box span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.result-box.success {
  border-color: rgba(49, 93, 82, 0.22);
  background: var(--accent-soft);
  color: var(--accent);
}

.result-box.success strong {
  font-size: 30px;
  line-height: 1.2;
}

.result-box.warning {
  border-color: rgba(138, 74, 16, 0.22);
  color: var(--warning);
  background: var(--warning-soft);
}

.expiry-notice {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(49, 93, 82, 0.28);
  border-radius: var(--radius);
  background: #ffffff;
}

.expiry-notice__date {
  color: var(--accent);
  font-size: 19px;
  font-weight: 800;
  line-height: 1.35;
}

.expiry-notice__hint {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.result-box.warning .expiry-notice {
  border-color: rgba(138, 74, 16, 0.26);
}

.result-box.warning .expiry-notice__date {
  color: var(--warning);
}

.identity-hint {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(138, 74, 16, 0.2);
}

.identity-hint__copy {
  margin: 0;
  color: var(--warning);
  font-size: 13px;
  line-height: 1.5;
}

.identity-hint__mock {
  position: relative;
  display: flex;
  align-items: center;
  gap: 22px;
  min-height: 48px;
  padding: 0 16px;
  overflow: hidden;
  border: 1px solid rgba(30, 33, 31, 0.36);
  border-radius: var(--radius);
  background: #ffffff;
  color: #151a18;
}

.identity-hint__prefix,
.identity-hint__placeholder {
  position: relative;
  z-index: 1;
  font-size: 15px;
}

.identity-hint__placeholder {
  color: #2b3230;
}

.admin-page {
  min-height: 100dvh;
  background: #f7f8f6;
}

.admin-header,
.admin-layout,
.flash-list {
  width: min(1120px, calc(100% - 32px));
  margin-inline: auto;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 28px 0 18px;
}

.admin-header h1,
.admin-card h1,
.admin-card h2 {
  margin: 0 0 18px;
}

.flash-list {
  margin-bottom: 16px;
}

.admin-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 18px;
  padding-bottom: 40px;
}

.admin-card {
  border: 1px solid #dce3dd;
  border-radius: var(--radius);
  background: #ffffff;
  padding: 22px;
}

.admin-card-wide {
  grid-column: 1 / -1;
}

.admin-login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.admin-login .admin-card {
  width: min(100%, 420px);
}

.admin-card form {
  display: grid;
  gap: 12px;
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.section-title-row p,
.helper-text {
  margin: -8px 0 16px;
  color: var(--muted);
  font-size: 14px;
}

.batch-management {
  display: grid;
  gap: 18px;
}

.batch-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.batch-tool {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: #fbfcfa;
}

.batch-tool h3 {
  margin: 0 0 14px;
  font-size: 19px;
  line-height: 1.25;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.search-toolbar {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
}

.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  background: #ffffff;
}

.compact-action {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
  white-space: nowrap;
}

.expiry-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  margin-bottom: 14px;
}

.expiry-toolbar label {
  width: 100%;
  margin-bottom: 0;
}

.expiry-toolbar input[type="date"] {
  width: 180px;
}

.expiry-toolbar button {
  min-height: 40px;
}

.list-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 0 14px;
}

.list-controls p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.page-size-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-size-form label {
  margin: 0;
}

.page-size-form select {
  width: auto;
  min-width: 96px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid #edf1ef;
  text-align: left;
  font-size: 14px;
  vertical-align: middle;
}

th {
  color: #5b6d67;
  font-weight: 700;
}

td input[type="checkbox"],
th input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-note {
  margin: -8px 0 16px;
  color: var(--muted);
  font-size: 14px;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.disabled-action {
  cursor: not-allowed;
  opacity: 0.45;
}

.current-page {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.danger {
  min-height: 36px;
  background: var(--danger);
}

.danger:hover {
  background: var(--danger-hover);
}

.flash,
.invalid-list,
.import-stats {
  padding: 12px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent);
}

.invalid-list {
  color: var(--warning);
  background: var(--warning-soft);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: #f2f0ea;
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
}

.status-expired {
  background: var(--warning-soft);
  color: var(--warning);
}

.status-open {
  background: #eef1f4;
  color: #4d5962;
}

@media (max-width: 860px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .batch-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .query-shell {
    padding: 16px;
  }

  .query-panel {
    padding: 28px;
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  .search-row {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 28px;
  }

  .identity-hint__mock {
    gap: 16px;
    padding-inline: 12px;
  }

  .expiry-notice {
    padding: 11px 12px;
  }

  .expiry-notice__date {
    font-size: 17px;
  }

  .admin-header {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #191a18;
    --panel: #20221f;
    --panel-muted: #252822;
    --line: #3c4038;
    --line-soft: #33372f;
    --text: #f3f1ea;
    --muted: #bdb7aa;
    --accent: #a8c8bb;
    --accent-soft: #26362f;
    --warning: #f1bd75;
    --warning-soft: #3a2b1b;
    --shadow: 0 22px 55px rgba(0, 0, 0, 0.28);
  }

  input,
  textarea,
  select,
  .admin-card,
  .batch-tool {
    background: #20221f;
  }

  .admin-page {
    background: #191a18;
  }

  th,
  td {
    border-bottom-color: #30342d;
  }

  .status-pill {
    background: #2d302b;
    color: var(--text);
  }

  .status-open {
    background: #252d33;
    color: #b8c6d1;
  }

  .identity-hint__mock {
    border-color: #4e554b;
    background: #f7f4ea;
    color: #151a18;
  }

  .expiry-notice {
    background: #1f241f;
  }
}
