:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --line: #e5e8ee;
  --line-strong: #d3d9e3;
  --text: #1f2328;
  --muted: #6b7280;
  --faint: #9aa4b2;
  --primary: #2f6fed;
  --primary-ink: #1d4ed8;
  --primary-soft: #eff4ff;
  --ok: #16a34a;
  --ok-soft: #eafaf0;
  --busy: #d97706;
  --busy-soft: #fff5e8;
  --err: #dc2626;
  --err-soft: #fdeeee;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 8px 24px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
}

/* 顶部导航 */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 22px;
  height: 56px;
  background: linear-gradient(180deg, #f2f6ff 0%, #ffffff 100%);
  border-bottom: 1px solid var(--line);
}

.topbar .mark {
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(140deg, #2f6fed, #7c3aed);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.topbar .name {
  font-size: 14px;
  font-weight: 600;
}

.topbar nav {
  display: flex;
  gap: 4px;
  margin-left: 14px;
}

.topbar nav a {
  padding: 5px 11px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
}

.topbar nav a:hover {
  background: var(--primary-soft);
  color: var(--primary);
  text-decoration: none;
}

.topbar nav a.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.topbar .spacer {
  flex: 1;
}

.topbar .who {
  color: var(--muted);
  font-size: 12.5px;
}

/* 布局 */
.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 22px;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid.cols-2 {
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 720px) {
  .grid.cols-3,
  .grid.cols-2 {
    grid-template-columns: 1fr;
  }
}

/* 卡片 */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-top: 14px;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  font-size: 13.5px;
}

.card-head .spacer {
  flex: 1;
}

.card-body {
  padding: 16px;
}

/* 统计块 */
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.stat .label {
  color: var(--faint);
  font-size: 12px;
}

.stat .value {
  margin-top: 4px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.stat .sub {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.stat.accent {
  border-color: #c7d8fa;
  background: linear-gradient(180deg, var(--primary-soft), #ffffff);
}

.stat.accent .value {
  color: var(--primary-ink);
}

/* 表单 */
.field {
  display: block;
  margin-bottom: 12px;
}

.field span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12.5px;
}

input,
select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.14);
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}

.btn:hover:not(:disabled) {
  border-color: #b9c3d1;
  background: #fbfcfd;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  border-color: transparent;
  background: linear-gradient(140deg, #2f6fed, #1d4ed8);
  color: #fff;
  font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(140deg, #3b7bf5, #2456de);
  border-color: transparent;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12.5px;
  border-radius: 8px;
}

.btn-danger {
  color: var(--err);
  border-color: #f2c4c4;
  background: var(--err-soft);
}

.btn-danger:hover:not(:disabled) {
  background: #fbe0e0;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* 徽章 */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}

.badge-idle {
  color: var(--muted);
  background: #f1f3f6;
  border-color: var(--line);
}

.badge-ok {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: #b7e6c9;
}

.badge-err {
  color: var(--err);
  background: var(--err-soft);
  border-color: #f5c2c2;
}

/* 表格 */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  color: var(--faint);
  font-size: 12px;
  font-weight: 600;
  background: #fbfcfd;
}

tbody tr:hover {
  background: #fbfcfd;
}

td.num {
  font-variant-numeric: tabular-nums;
}

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

/* 登录 / 注册 */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(900px 380px at 50% -140px, #e8f0ff 0%, var(--bg) 62%);
}

.auth-card {
  width: 100%;
  max-width: 380px;
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
}

.auth-card .brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 20px;
}

.auth-card .brand .mark {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(140deg, #2f6fed, #7c3aed);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
}

.auth-card .brand h1 {
  font-size: 17px;
}

.auth-card .brand p {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.hint {
  margin: 14px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
}

.form-error {
  margin: 10px 0 0;
  padding: 9px 11px;
  border: 1px solid #f2c4c4;
  border-radius: 9px;
  background: var(--err-soft);
  color: #b91c1c;
  font-size: 12.5px;
}

/* 提示条 */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: 10px;
  background: #1f2328;
  color: #fff;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  z-index: 99;
}

.toast.ok {
  background: #14804a;
}

.toast.err {
  background: #b42318;
}

.mono {
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 12.5px;
}

.muted {
  color: var(--muted);
}

.nowrap {
  white-space: nowrap;
}

/* 使用教程强调块 */
.tutorial {
  margin-top: 14px;
  padding: 13px 15px;
  border: 1px solid #f3d9ab;
  border-left: 3px solid #d97706;
  border-radius: 10px;
  background: linear-gradient(180deg, #fff8ec, #fffdf9);
}

.tutorial h4 {
  margin: 0 0 9px;
  color: #b45309;
  font-size: 13.5px;
  font-weight: 600;
}

.tutorial ol {
  margin: 0;
  padding-left: 19px;
  color: #7c4a03;
  font-size: 13px;
  line-height: 1.75;
}

.tutorial li {
  margin-bottom: 5px;
}

.tutorial li:last-child {
  margin-bottom: 0;
}

.tutorial b {
  color: #b45309;
}

/* 通用提示块（同色系，用于「暂无次数」这类提醒） */
.callout {
  margin-top: 14px;
  padding: 12px 15px;
  border: 1px solid #f3d9ab;
  border-left: 3px solid #d97706;
  border-radius: 10px;
  background: linear-gradient(180deg, #fff8ec, #fffdf9);
  color: #7c4a03;
  font-size: 13px;
  line-height: 1.7;
}

.callout h4 {
  margin: 0 0 6px;
  color: #b45309;
  font-size: 13.5px;
  font-weight: 600;
}
