/* 登录页 / 管理后台共用样式（和主应用同一套视觉语言） */

:root {
  --paper: #f4f1ea;
  --panel: #ffffff;
  --ink: #1b1610;
  --ink-2: #5b5245;
  --ink-3: #938a7d;
  --line: #e8e1d4;
  --line-strong: #d8cfbe;
  --brand: #c8452f;
  --brand-dark: #a8361f;
  --brand-soft: #fbeae5;
  --green: #2f7d5b;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(27, 22, 16, 0.05), 0 2px 8px rgba(27, 22, 16, 0.04);
  --shadow-md: 0 2px 6px rgba(27, 22, 16, 0.06), 0 12px 32px rgba(27, 22, 16, 0.08);
  --font: "PingFang SC", "HarmonyOS Sans SC", "Source Han Sans SC", "Microsoft YaHei", "Noto Sans CJK SC",
    -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}

a {
  color: var(--brand);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* ------------------------------------------------------------- 按钮 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  user-select: none;
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.btn.primary {
  background: linear-gradient(155deg, #d1553a, var(--brand-dark));
  color: #fff;
  box-shadow: 0 2px 10px rgba(200, 69, 47, 0.28);
}
.btn.primary:hover:not(:disabled) {
  box-shadow: 0 4px 16px rgba(200, 69, 47, 0.36);
}
.btn.ghost {
  background: #fff;
  border-color: var(--line-strong);
  color: var(--ink-2);
}
.btn.ghost:hover:not(:disabled) {
  border-color: #bdb2a0;
  color: var(--ink);
}
.btn.tiny {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 8px;
  background: #f7f4ee;
  border-color: var(--line);
  color: var(--ink-2);
  font-weight: 500;
}
.btn.tiny:hover:not(:disabled) {
  background: #efe9df;
  color: var(--ink);
}
.btn.tiny.danger {
  color: #a8361f;
  border-color: #f0d5cc;
  background: var(--brand-soft);
}
.btn.tiny.danger:hover:not(:disabled) {
  background: #f8ddd5;
}
.btn.block {
  width: 100%;
}

/* ------------------------------------------------------------- 表单 */

.field {
  display: block;
  margin-bottom: 14px;
}
.field > span {
  display: block;
  font-size: 12.5px;
  color: var(--ink-2);
  margin-bottom: 6px;
  font-weight: 500;
}
input[type="text"],
input[type="password"],
input[type="number"],
select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: #fbfaf7;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  appearance: none;
}
input:hover,
select:hover {
  border-color: #c9bfae;
}
input:focus,
select:focus {
  outline: none;
  background: #fff;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(200, 69, 47, 0.12);
}
input::placeholder {
  color: #b6ada0;
}

/* ------------------------------------------------------------- 登录页 */

.login-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 0%, #faf7f1 0%, var(--paper) 60%);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  padding: 32px 28px 26px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: linear-gradient(150deg, #d9563c, #a8361f);
  color: #fff;
  font-weight: 800;
  font-size: 22px;
  box-shadow: 0 6px 16px rgba(200, 69, 47, 0.3);
  flex: 0 0 auto;
}
.brand-text strong {
  display: block;
  font-size: 17px;
  letter-spacing: 0.5px;
}
.brand-text span {
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: 1.2px;
}

.form-error {
  display: none;
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: #fdeceb;
  border: 1px solid #f5cfcb;
  color: #a8361f;
  font-size: 12.5px;
}
.form-error.show {
  display: block;
}

.login-foot {
  margin-top: 18px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-3);
}

/* ----------------------------------------------------------- 管理后台 */

.admin-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
  margin-bottom: 16px;
}

.panel h2 {
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--ink-3);
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.stat b {
  display: block;
  font-size: 24px;
  letter-spacing: -0.5px;
  line-height: 1.2;
}
.stat span {
  font-size: 11.5px;
  color: var(--ink-3);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-3);
  padding: 0 10px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td {
  padding: 10px;
  border-bottom: 1px solid #f2ede4;
  vertical-align: middle;
}
tr:last-child td {
  border-bottom: 0;
}
td.actions {
  text-align: right;
  white-space: nowrap;
}
td.actions .btn {
  margin-left: 4px;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: #f2ede4;
  color: var(--ink-2);
}
.tag.admin {
  background: #eef1fb;
  color: #3b4a86;
}
.tag.off {
  background: #fdeceb;
  color: #a8361f;
}
.tag.on {
  background: #e8f4ee;
  color: var(--green);
}

.quota-bar {
  display: block;
  height: 5px;
  border-radius: 3px;
  background: #eee8dd;
  overflow: hidden;
  margin-top: 5px;
  width: 90px;
}
.quota-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #d1553a, #e8a05f);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--ink-2);
}

.form-row {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 0.7fr 1fr auto;
  gap: 10px;
  align-items: end;
}
.form-row .field {
  margin-bottom: 0;
}

.logs {
  max-height: 260px;
  overflow: auto;
  font-size: 12.5px;
}
.logs div {
  padding: 5px 0;
  border-bottom: 1px dashed #f0eae0;
  display: flex;
  gap: 10px;
  color: var(--ink-2);
}
.logs div:last-child {
  border-bottom: 0;
}
.logs .t {
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  padding: 10px 18px;
  background: rgba(27, 22, 16, 0.92);
  color: #fff;
  font-size: 13px;
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s, transform 0.22s;
  z-index: 100;
  max-width: 80vw;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.toast.err {
  background: rgba(160, 40, 26, 0.95);
}

.empty {
  padding: 26px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
}

@media (max-width: 760px) {
  .stat-row {
    grid-template-columns: 1fr 1fr;
  }
  .form-row {
    grid-template-columns: 1fr 1fr;
  }
  .form-row .btn {
    grid-column: 1 / -1;
  }
  table {
    font-size: 12px;
  }
  th:nth-child(6),
  td:nth-child(6) {
    display: none;
  }
}
