:root {
  font-family: Georgia, 'Microsoft YaHei', serif;
  color: #24231f;
  background: #ecece7;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { min-width: 320px; min-height: 100vh; margin: 0; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.admin-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(rgba(31, 31, 28, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 31, 28, .04) 1px, transparent 1px),
    #ecece7;
  background-size: 30px 30px;
}

.login-panel {
  width: min(100%, 390px);
  padding: 36px;
  border: 1px solid #bbb9ae;
  border-radius: 6px;
  background: #fafaf6;
  box-shadow: 0 22px 60px rgba(39, 37, 30, .14);
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: inline-grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 23px;
}

.eyebrow { margin: 20px 0 5px; color: #77746a; font-size: 10px; letter-spacing: 2px; }
.login-panel h1 { margin: 0; font-size: 30px; font-weight: 400; }
.login-panel > p:not(.eyebrow, .error) { color: #77746a; font: 13px/1.7 'Microsoft YaHei', sans-serif; }
.login-panel label { display: grid; gap: 8px; margin: 26px 0 15px; font: 13px 'Microsoft YaHei', sans-serif; }
.login-panel input { min-height: 46px; border: 1px solid #bbb9ae; border-radius: 4px; padding: 0 12px; background: #fff; }
.login-panel button { width: 100%; min-height: 46px; border: 0; border-radius: 4px; color: #fff; background: #292823; }
.error { min-height: 18px; color: #a33530; font: 12px 'Microsoft YaHei', sans-serif; }

.console { min-height: 100vh; display: grid; grid-template-columns: 220px minmax(0, 1fr); }
aside { min-height: 100vh; display: flex; flex-direction: column; padding: 25px 18px; color: #f5f4ee; background: #272722; }
.aside-brand { display: flex; align-items: center; gap: 12px; padding: 0 7px 30px; }
.aside-brand strong { font-weight: 400; letter-spacing: 1px; }
nav { display: grid; gap: 6px; }
nav button, .lock-button { min-height: 43px; border: 0; border-radius: 4px; padding: 0 14px; color: #aaa89f; text-align: left; background: transparent; }
nav button.active { color: #25241f; background: #f2f1eb; }
.lock-button { margin-top: auto; border: 1px solid #55544d; text-align: center; }

.console main { min-width: 0; padding: 34px clamp(22px, 5vw, 70px); }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.topbar .eyebrow { margin: 0 0 4px; }
.topbar h1 { margin: 0; font-size: 29px; font-weight: 400; }
.icon-button { width: 42px; height: 42px; border: 1px solid #bdbbb2; border-radius: 50%; font-size: 22px; background: transparent; }
.notice { min-height: 22px; margin: -15px 0 12px; color: #34705a; font: 12px 'Microsoft YaHei', sans-serif; }

.summary-row { display: grid; grid-template-columns: repeat(2, minmax(160px, 230px)); gap: 14px; margin-bottom: 22px; }
.summary-row article { padding: 18px; border-left: 3px solid #36352f; background: #f7f7f3; }
.summary-row span { display: block; color: #77746a; font: 12px 'Microsoft YaHei', sans-serif; }
.summary-row strong { display: block; margin-top: 8px; font-size: 28px; font-weight: 400; }
.table-wrap { overflow-x: auto; border: 1px solid #cbc9c0; background: #f9f9f5; }
table { width: 100%; border-collapse: collapse; font: 13px 'Microsoft YaHei', sans-serif; }
th, td { min-width: 120px; padding: 15px 17px; border-bottom: 1px solid #dedcd3; text-align: left; }
th { color: #77746a; font-size: 11px; font-weight: 400; background: #efeee8; }
.actions-heading { text-align: right; }
.row-actions { display: flex; justify-content: flex-end; gap: 8px; }
.row-actions button, .code-toolbar button, .new-codes button { min-height: 34px; border: 1px solid #bdbbb2; border-radius: 4px; padding: 0 11px; background: #fff; }
.row-actions button:disabled { cursor: default; opacity: .4; }
.row-actions .danger-text { color: #a33530; border-color: #d6aaa7; }
.empty { margin: 0; padding: 35px; color: #858178; text-align: center; font: 13px 'Microsoft YaHei', sans-serif; }
.status { display: inline-block; padding: 4px 7px; border-radius: 3px; font-size: 11px; }
.status.available { color: #276b50; background: #dfede5; }
.status.used { color: #77746a; background: #e8e7e1; }

.code-toolbar { display: flex; align-items: end; gap: 12px; margin-bottom: 18px; }
.code-toolbar label { display: grid; gap: 7px; color: #77746a; font: 12px 'Microsoft YaHei', sans-serif; }
.code-toolbar input { width: 100px; min-height: 39px; border: 1px solid #bdbbb2; border-radius: 4px; padding: 0 10px; background: #fff; }
.code-toolbar button { min-height: 39px; color: #fff; background: #292823; }
.new-codes { margin-bottom: 18px; padding: 17px; border: 1px solid #bdbbb2; background: #f7f7f3; }
.new-codes > div { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.new-codes textarea { width: 100%; height: 150px; resize: vertical; border: 1px solid #d0cec5; padding: 12px; font-family: Consolas, monospace; background: #fff; }

dialog { width: min(calc(100% - 32px), 430px); border: 1px solid #aaa89f; border-radius: 6px; padding: 0; color: #24231f; background: #fafaf6; }
dialog::backdrop { background: rgba(20, 20, 18, .48); }
dialog form { padding: 25px; }
dialog h2 { margin: 0; font-size: 22px; font-weight: 400; }
dialog p { color: #68665e; font: 13px/1.7 'Microsoft YaHei', sans-serif; }
dialog form > div { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }
dialog button { min-height: 38px; border: 1px solid #bbb9ae; border-radius: 4px; padding: 0 15px; background: #fff; }
dialog button.danger { color: #fff; border-color: #922f2b; background: #922f2b; }

@media (max-width: 700px) {
  .console { grid-template-columns: 1fr; }
  aside { min-height: auto; flex-direction: row; align-items: center; padding: 10px 14px; }
  .aside-brand { padding: 0; }
  .aside-brand strong { display: none; }
  .aside-brand .brand-mark { width: 36px; height: 36px; font-size: 18px; }
  nav { display: flex; margin-left: 12px; }
  nav button { padding: 0 11px; }
  .lock-button { width: auto; margin: 0 0 0 auto; }
  .console main { padding: 24px 16px; }
  .summary-row { grid-template-columns: 1fr 1fr; }
  .row-actions { min-width: 190px; }
}