:root {
  --admin-bg: #f6f7f2;
  --admin-ink: #25324a;
  --admin-muted: #607085;
  --admin-line: #d9e1e4;
  --admin-panel: #fffef9;
  --admin-blue: #16728b;
  --admin-green: #27855d;
  --admin-orange: #c77718;
  --admin-red: #c95245;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  background: var(--admin-bg);
  color: var(--admin-ink);
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

.admin-shell {
  width: min(1380px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 40px;
}

.admin-topbar,
.admin-card,
.login-card {
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  background: var(--admin-panel);
  box-shadow: 0 14px 34px rgba(37, 50, 74, 0.08);
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
}

.admin-title h1,
.login-card h1 {
  margin: 4px 0 0;
  font-size: 30px;
  line-height: 1.15;
}

.eyebrow {
  color: var(--admin-blue);
  font-size: 13px;
  font-weight: 900;
}

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

.admin-button,
.admin-link,
.login-card button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 13px;
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--admin-ink);
  text-decoration: none;
  font-weight: 800;
  cursor: pointer;
}

.admin-button.primary,
.login-card button {
  border-color: var(--admin-blue);
  background: var(--admin-blue);
  color: #ffffff;
}

.admin-button.danger {
  border-color: var(--admin-red);
  background: var(--admin-red);
  color: #ffffff;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.metric-card {
  padding: 16px;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  line-height: 1;
}

.admin-card {
  padding: 18px;
  margin-top: 16px;
}

.filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

.filter-form label,
.filter-control,
.login-card label {
  display: grid;
  gap: 6px;
  color: var(--admin-muted);
  font-size: 14px;
  font-weight: 800;
}

.filter-form input,
.login-card input {
  min-height: 40px;
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #ffffff;
  color: var(--admin-ink);
}

.custom-select {
  position: relative;
  min-width: 180px;
}

.select-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
  width: 100%;
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #ffffff;
  color: var(--admin-ink);
  font-weight: 900;
  cursor: pointer;
}

.select-trigger i {
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--admin-muted);
  border-bottom: 2px solid var(--admin-muted);
  transform: translateY(-2px) rotate(45deg);
}

.select-options {
  position: absolute;
  z-index: 12;
  top: calc(100% + 6px);
  left: 0;
  width: max(100%, 240px);
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  padding: 6px;
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(37, 50, 74, 0.16);
}

.select-options button {
  display: block;
  width: 100%;
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  padding: 8px 10px;
  background: transparent;
  color: var(--admin-ink);
  text-align: left;
  font-weight: 800;
  cursor: pointer;
}

.select-options button:hover,
.select-options button.is-selected {
  background: #e8f5f8;
  color: var(--admin-blue);
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1280px;
}

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--admin-line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--admin-muted);
  font-size: 13px;
  white-space: nowrap;
}

tbody tr.row-real {
  background: #f2fbf6;
}

tbody tr.row-test {
  background: #fff9ef;
}

tbody tr.row-real:hover,
tbody tr.row-test:hover {
  background: #eef7fb;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #edf7f2;
  color: var(--admin-green);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.status-pill.warning {
  background: #fff4df;
  color: var(--admin-orange);
}

.status-pill.error {
  background: #ffece8;
  color: var(--admin-red);
}

.table-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 5px;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--admin-line);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  vertical-align: middle;
}

.table-hint:hover,
.table-hint:focus-visible {
  border-color: var(--admin-blue);
  box-shadow: 0 0 0 3px rgba(47, 110, 154, 0.14);
  transform: translateY(-1px);
}

.note-button {
  max-width: 150px;
  border: 1px solid var(--admin-line);
  border-radius: 999px;
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--admin-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.note-button.has-note {
  background: #edf7f2;
  color: var(--admin-green);
  border-color: rgba(47, 141, 108, 0.28);
}

.note-button:hover,
.note-button:focus-visible {
  border-color: var(--admin-blue);
  box-shadow: 0 0 0 3px rgba(47, 110, 154, 0.14);
}

.note-dialog {
  display: grid;
  gap: 10px;
}

.note-textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--admin-ink);
  font: inherit;
  line-height: 1.55;
}

.summary-export-card {
  display: grid;
  gap: 10px;
}

.admin-summary-textarea {
  width: 100%;
  min-height: 260px;
  resize: vertical;
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  padding: 12px;
  background: #f8faf7;
  color: var(--admin-ink);
  font: 13px/1.65 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.copy-status {
  min-height: 20px;
  color: var(--admin-green);
  font-size: 13px;
  font-weight: 900;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 16px;
}

.detail-grid aside > .admin-card:first-child {
  margin-top: 0;
}

.kv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.kv-grid div,
.timeline-row,
.choice-row {
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  padding: 11px;
  background: #ffffff;
}

.kv-grid span,
.timeline-row span,
.choice-row span {
  display: block;
  color: var(--admin-muted);
  font-size: 13px;
  font-weight: 800;
}

.timeline,
.choices-list {
  display: grid;
  gap: 8px;
}

.scores {
  display: grid;
  gap: 8px;
}

.score-line {
  display: grid;
  gap: 5px;
}

.score-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef0;
}

.score-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--admin-blue);
}

.notice {
  margin: 12px 0 0;
  padding: 11px 12px;
  border: 1px solid #ffd9a6;
  border-radius: 8px;
  background: #fff8ea;
  color: #7a4c10;
}

.notice-card {
  border-color: #b9dccb;
  background: #f1faf5;
  color: #1f6c4b;
  font-weight: 900;
}

.utility-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.utility-card h2,
.utility-card p {
  margin: 0;
}

.utility-card p {
  margin-top: 6px;
  color: var(--admin-muted);
  font-weight: 800;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

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

.bulk-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  padding: 12px;
  border: 1px solid #ffd0c8;
  border-radius: 8px;
  background: #fff7f5;
  color: #7b2d24;
  font-weight: 800;
}

.is-hidden {
  display: none !important;
}

.bulk-actions > span {
  display: flex;
  align-items: center;
  min-height: 40px;
  flex: 1 1 320px;
}

.check-control {
  position: relative;
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  cursor: pointer;
}

.check-control input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.check-control span {
  width: 18px;
  height: 18px;
  border: 2px solid #b9c5ca;
  border-radius: 5px;
  background: #ffffff;
  box-shadow: inset 0 0 0 2px #ffffff;
}

.check-control input:checked + span {
  border-color: var(--admin-blue);
  background: var(--admin-blue);
}

.check-control input:checked + span::after {
  content: "";
  display: block;
  width: 8px;
  height: 4px;
  margin: 4px auto 0;
  border-left: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  transform: rotate(-45deg);
}

.check-control input:focus-visible + span {
  outline: 3px solid rgba(22, 114, 139, 0.22);
  outline-offset: 2px;
}

.dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(37, 50, 74, 0.36);
}

.confirm-dialog {
  width: min(420px, 100%);
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  padding: 20px;
  background: var(--admin-panel);
  box-shadow: 0 22px 60px rgba(37, 50, 74, 0.22);
}

.confirm-dialog h3 {
  margin: 0 0 10px;
}

.confirm-dialog p {
  margin: 0;
  color: var(--admin-muted);
  font-weight: 800;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

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

.admin-link.is-current {
  border-color: var(--admin-blue);
  background: #e8f5f8;
  color: var(--admin-blue);
}

.admin-link.is-disabled {
  pointer-events: none;
  opacity: 0.45;
}

.no-wrap {
  white-space: nowrap;
}

.action-col {
  width: 86px;
  min-width: 86px;
  white-space: nowrap;
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 18px;
}

.login-card {
  width: min(460px, 100%);
  padding: 24px;
}

.login-card form {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.login-actions {
  display: flex;
  margin-top: 12px;
}

.login-actions .admin-link {
  width: 100%;
}

.login-error {
  margin: 10px 0 0;
  color: var(--admin-red);
  font-weight: 800;
}

@media (max-width: 900px) {
  .summary-grid,
  .detail-grid,
  .kv-grid {
    grid-template-columns: 1fr;
  }

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