:root {
  --paper: #f3efe5;
  --paper-light: #fbf9f3;
  --paper-deep: #e6dfd0;
  --ink: #18201d;
  --muted: #5c645f;
  --line: #c9c0af;
  --red: #b73d2a;
  --green: #376451;
  --amber: #9a6c1f;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", Georgia, serif;
  --sans: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: linear-gradient(90deg, transparent calc(100% - 1px), rgba(24,32,29,.04) 0) 0 0 / 82px 100%, var(--paper);
  font-family: var(--sans);
  font-size: 14px;
}
button, input, select { font: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid rgba(183,61,42,.25); outline-offset: 2px; }
.is-hidden { display: none !important; }

.admin-header {
  width: min(1240px, calc(100% - 40px));
  height: 82px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.admin-brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.admin-brand > span:last-child { display: grid; }
.admin-brand strong { font-family: var(--serif); font-size: 16px; letter-spacing: .06em; }
.admin-brand small { color: var(--muted); font-size: 8px; letter-spacing: .17em; }
.admin-seal { width: 38px; height: 44px; display: grid; place-items: center; color: #fff; background: var(--red); font-family: var(--serif); font-weight: 700; line-height: 1.05; }
.back-link { color: var(--muted); text-decoration: none; font-size: 12px; }
.back-link:hover { color: var(--red); }
.admin-nav { display: flex; align-items: center; gap: 18px; }

.admin-main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 52px 0 80px; }
.token-gate { width: min(560px, 100%); margin: 8vh auto 0; padding: 42px; border: 1px solid var(--line); border-top: 5px solid var(--red); background: var(--paper-light); box-shadow: 18px 18px 0 rgba(58,48,30,.07); }
.token-gate h1, .page-title h1 { margin: 3px 0 8px; font: 600 34px/1.2 var(--serif); }
.token-gate > p:not(.kicker), .page-title p:last-child { margin: 0; color: var(--muted); }
.token-gate form { margin-top: 28px; }
.token-gate label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 11px; font-weight: 700; }
.token-row { display: grid; grid-template-columns: 1fr auto; }
.token-row input, .roster-controls input, .roster-controls select { height: 46px; border: 1px solid var(--line); background: #fffdf8; padding: 0 13px; color: var(--ink); }
.token-row button { padding: 0 20px; border: 0; background: var(--ink); color: white; cursor: pointer; }

.kicker { margin: 0; color: var(--red); font-size: 9px; font-weight: 800; letter-spacing: .18em; }
.form-message { min-height: 20px; margin: 9px 0 0; color: var(--red); font-size: 11px; }
.page-title { display: flex; align-items: end; justify-content: space-between; margin-bottom: 28px; }
.quiet-button { padding: 9px 13px; border: 1px solid var(--line); background: transparent; cursor: pointer; color: var(--muted); }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); background: rgba(251,249,243,.65); }
.stat { min-height: 104px; padding: 18px 20px; border-left: 1px solid var(--line); }
.stat:first-child { border-left: 0; }
.stat span { color: var(--muted); font-size: 10px; }
.stat strong { display: block; margin-top: 4px; font: 500 30px var(--serif); }
.stat small { color: #8a8377; font-size: 9px; }
.stat.is-warning strong { color: var(--amber); }

.upload-card, .roster-card, .conference-admin-card { margin-top: 22px; padding: 28px; border: 1px solid var(--line); background: rgba(251,249,243,.8); }
.section-heading { display: flex; justify-content: space-between; align-items: end; padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.section-heading h2 { margin: 3px 0 0; font: 600 23px var(--serif); }
.section-heading > span { color: var(--red); border: 1px solid rgba(183,61,42,.3); padding: 3px 8px; font-size: 9px; }
.format-note { color: var(--muted); font-size: 11px; }
.drop-zone { min-height: 170px; margin-top: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px dashed #9d9484; background: rgba(230,223,208,.4); cursor: pointer; transition: 160ms ease; }
.drop-zone:hover, .drop-zone.is-dragging { border-color: var(--red); background: rgba(183,61,42,.05); }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-mark { padding: 4px 8px; color: var(--red); border: 1px solid var(--red); font: 700 9px Georgia, serif; letter-spacing: .1em; }
.drop-zone strong { margin-top: 12px; font-family: var(--serif); font-size: 16px; }
.drop-zone small { margin-top: 4px; color: var(--muted); }
.upload-actions { display: flex; align-items: center; gap: 15px; margin-top: 14px; }
.primary-button { padding: 11px 18px; border: 0; background: var(--ink); color: #fff; cursor: pointer; }
.primary-button:disabled { opacity: .35; cursor: not-allowed; }

.roster-heading { align-items: center; }
.roster-controls { display: flex; gap: 8px; }
.roster-add-button { padding: 0 14px; color: #fff; background: #660874; border: 1px solid #660874; cursor: pointer; font-size: 10px; font-weight: 800; white-space: nowrap; }
.roster-add-button:hover { background: #4a0754; }
.roster-controls input { width: 230px; }
.roster-controls select { min-width: 120px; }
.table-count { color: var(--muted); font-size: 10px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 760px; border-collapse: collapse; }
th { padding: 11px 10px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: #80786b; text-align: left; font-size: 9px; }
td { padding: 13px 10px; border-bottom: 1px solid rgba(201,192,175,.68); font-size: 11px; }
td:first-child { font: 600 13px var(--serif); }
.reviewer-actions { display: flex; gap: 6px; }
.reviewer-actions button { padding: 5px 8px; color: #660874; background: transparent; border: 1px solid #bca5c3; cursor: pointer; font-size: 8px; font-weight: 800; text-transform: uppercase; }
.reviewer-actions button:hover { color: #fff; background: #660874; }
.reviewer-actions .danger { color: #9a2f4c; border-color: #d4aebb; }
.reviewer-actions .danger:hover { background: #8b2442; border-color: #8b2442; }
.status { display: inline-block; padding: 3px 7px; border: 1px solid; font-size: 9px; }
.status.matched { color: var(--green); border-color: rgba(55,100,81,.35); }
.status.ambiguous { color: var(--amber); border-color: rgba(154,108,31,.35); }
.status.unmatched { color: var(--red); border-color: rgba(183,61,42,.32); }
.empty-state { padding: 45px; text-align: center; color: var(--muted); font-family: var(--serif); }

.reviewer-editor { width: min(650px, calc(100% - 28px)); padding: 0; color: var(--ink); background: #fffdfd; border: 1px solid #bca5c3; box-shadow: 18px 18px 0 rgba(58,20,68,.22); }
.reviewer-editor::backdrop { background: rgba(31,15,36,.68); }
.reviewer-editor form { padding: 28px 30px 30px; border-top: 6px solid #660874; }
.reviewer-editor-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.reviewer-editor h2 { margin: 3px 0 0; font: 600 27px var(--serif); }
.dialog-close { width: 34px; height: 34px; color: #660874; background: transparent; border: 1px solid #bca5c3; cursor: pointer; font-size: 21px; }
.reviewer-editor label { display: grid; gap: 6px; margin-top: 14px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .04em; }
.reviewer-editor label span { font-weight: 500; letter-spacing: 0; }
.reviewer-editor input { width: 100%; height: 46px; padding: 0 13px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 0; }
.reviewer-editor input:focus { border-color: #660874; outline: 0; box-shadow: 0 0 0 3px rgba(102,8,116,.08); }
.reviewer-name-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.editor-hint { margin: 10px 0 0; color: var(--muted); font-size: 9px; line-height: 1.55; }
.reviewer-editor-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 14px; }

@media (max-width: 760px) {
  .admin-header, .admin-main { width: calc(100% - 24px); }
  .admin-main { padding-top: 30px; }
  .token-gate, .upload-card, .roster-card, .conference-admin-card { padding: 22px; }
  .page-title, .section-heading, .roster-heading { align-items: flex-start; flex-direction: column; gap: 14px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(odd) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .roster-controls { width: 100%; flex-direction: column; }
  .roster-controls input, .roster-controls select { width: 100%; }
  .upload-actions { align-items: flex-start; flex-direction: column; }
  .roster-add-button { min-height: 42px; }
  .reviewer-name-grid { grid-template-columns: 1fr; gap: 0; }
  .reviewer-editor form { padding: 22px 20px 24px; }
}

/* Tsinghua purple administration theme */
:root {
  --paper: #f6f3f8;
  --paper-light: #fffdfd;
  --paper-deep: #e8e0ec;
  --ink: #211326;
  --muted: #695b70;
  --line: #d7ccdc;
  --red: #660874;
  --green: #3f675b;
  --amber: #98711b;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --sans: "Avenir Next", "Gill Sans", "Trebuchet MS", sans-serif;
}
body {
  background:
    linear-gradient(90deg, transparent calc(100% - 1px), rgba(102, 8, 116, 0.045) 0) 0 0 / 82px 100%,
    var(--paper);
}
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline-color: rgba(102, 8, 116, 0.3); }
.admin-header {
  width: 100%;
  padding-inline: max(20px, calc((100vw - 1200px) / 2));
  color: #fff;
  background: #660874;
  border-bottom: 4px solid #b893c1;
}
.admin-seal { width: 44px; height: 48px; color: #660874; background: #fff; font: 800 10px/1.05 var(--sans); letter-spacing: .05em; }
.admin-brand small, .back-link { color: rgba(255,255,255,.72); }
.back-link:hover { color: #fff; }
.token-gate { border-top-color: #660874; background: #fffdfd; box-shadow: 18px 18px 0 #ddd0e2; }
.kicker { color: #660874; }
.token-row input:focus, .roster-controls input:focus, .roster-controls select:focus { border-color: #660874; }
.token-row button, .primary-button { background: #660874; }
.token-row button:hover, .primary-button:hover { background: #4a0754; }
.quiet-button:hover { color: #660874; border-color: #9e75a9; }
.stats-grid, .upload-card, .roster-card, .conference-admin-card { background: rgba(255,253,255,.9); }
.stat.is-warning strong { color: #98711b; }
.section-heading > span { color: #660874; border-color: #c7acd0; background: #f3eaf5; }
.drop-zone { border-color: #a991b0; background: rgba(232,224,236,.52); }
.drop-zone:hover, .drop-zone.is-dragging { border-color: #660874; background: rgba(102,8,116,.055); }
.drop-mark { color: #660874; border-color: #660874; }
.status.matched { color: #356557; }
.status.ambiguous { color: #8b681a; }
.status.unmatched { color: #660874; border-color: rgba(102,8,116,.3); }
.token-gate form > select,
.system-key-row input,
.conference-form input,
.conference-form select {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0;
}
.token-gate form > select { margin-bottom: 17px; }
.token-gate form > select:focus,
.system-key-row input:focus,
.conference-form input:focus,
.conference-form select:focus { border-color: #660874; outline: 0; box-shadow: 0 0 0 3px rgba(102,8,116,.08); }
.system-key-row { max-width: 560px; margin-top: 20px; }
.system-key-row label,
.conference-form label { display: block; margin: 12px 0 6px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .05em; }
.conference-admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 18px; }
.conference-form { padding: 22px; border: 1px solid var(--line); background: #fbf8fc; }
.conference-form h3 { margin: 0 0 12px; font: 600 18px var(--serif); }
.conference-form .primary-button { width: 100%; margin-top: 18px; }
.admin-footer {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: #74677a;
  border-top: 1px solid var(--line);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.admin-footer strong { color: #660874; font: 700 12px var(--serif); letter-spacing: .04em; text-transform: none; }
@media (max-width: 760px) {
  .admin-header { padding-inline: 12px; }
  .admin-brand small { display: none; }
  .admin-footer { width: calc(100% - 24px); align-items: flex-start; flex-direction: column; gap: 5px; }
  .conference-admin-grid { grid-template-columns: 1fr; }
}
