:root {
  --bg: #f3f8f7;
  --bg-soft: #e8f2f0;
  --panel: #ffffff;
  --ink: #10231f;
  --ink-soft: #3f5a55;
  --muted: #6b817c;
  --line: #dee9e6;
  --line-strong: #cfdedb;
  --brand: #0f9b8e;
  --brand-dark: #0a7a70;
  --brand-soft: #e1f5f1;
  --danger: #bc4a1f;
  --danger-soft: #fdeee7;
  --ok: #12795c;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 35, 31, 0.06), 0 10px 28px rgba(16, 35, 31, 0.05);
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.01em;
}

h1 {
  font-size: 20px;
}

h2 {
  font-size: 19px;
}

h3 {
  font-size: 15px;
}

p {
  margin: 0;
}

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

.hint {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

/* ---------- 登录 ---------- */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1200px 420px at 50% -10%, #d8efe9 0%, rgba(243, 248, 247, 0) 70%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 430px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 4px;
}

.login-head .muted {
  margin-top: 6px;
  font-size: 13px;
}

.logo {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #12b3a2 0%, #0a7a70 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.logo::after {
  content: "";
  display: block;
  width: 10px;
  height: 10px;
  margin: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
}

.form-error {
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid #f7d6c6;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
}

/* ---------- 顶部导航 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 24px;
  height: 60px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.brand .logo {
  width: 26px;
  height: 26px;
  border-radius: 8px;
}

.brand .logo::after {
  width: 8px;
  height: 8px;
  margin: 9px;
}

.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}

.tab:hover {
  background: var(--bg-soft);
}

.tab.is-active {
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 600;
}

.account {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.account-name {
  font-weight: 600;
}

.account-quota {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- 布局 ---------- */
.layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 24px 56px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.view {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.view-head .muted {
  margin-top: 4px;
  font-size: 13px;
}

.view-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.split {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

/* ---------- 面板 ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel > .hint {
  padding: 0 16px 14px;
  margin-top: 10px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.stat strong {
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

/* ---------- 表格 ---------- */
.table-wrap {
  overflow-x: auto;
  max-width: 100%;
}

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

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

.table thead th {
  background: #fbfdfc;
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.03em;
  position: sticky;
  top: 0;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr:hover {
  background: #f8fbfa;
}

.table tbody tr.is-selected {
  background: var(--brand-soft);
}

.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.col-check,
.col-rank {
  width: 44px;
}

.col-action {
  width: 88px;
  text-align: right;
}

.cell-name {
  font-weight: 600;
}

.cell-sub {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.amount {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--ink-soft);
  font-size: 12px;
}

.tag-admin {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.empty {
  padding: 34px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

/* ---------- 控件 ---------- */
.btn {
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:hover:not(:disabled) {
  border-color: var(--brand);
  color: var(--brand-dark);
}

.btn:focus-visible,
.input:focus-visible,
.select:focus-visible,
.tab:focus-visible {
  outline: 2px solid rgba(15, 155, 142, 0.4);
  outline-offset: 1px;
}

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

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-soft);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-soft);
  border-color: transparent;
}

.btn-block {
  width: 100%;
  padding: 10px 14px;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.input,
.select {
  font: inherit;
  font-size: 13px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  min-width: 0;
}

.select {
  padding-right: 6px;
  cursor: pointer;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > span {
  font-size: 13px;
  color: var(--ink-soft);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px 16px;
  padding: 14px 16px;
  align-items: end;
}

/* 勾选项与同排输入框底部对齐 */
.form-grid > .checkbox {
  height: 36px;
  padding-bottom: 0;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
}

.checkbox input {
  width: 15px;
  height: 15px;
  accent-color: var(--brand);
  cursor: pointer;
}

.search {
  display: flex;
  gap: 8px;
}

.search-input {
  width: 240px;
}

.g-min,
.g-max {
  width: 108px;
  height: 32px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

/* ---------- 签到 ---------- */
.checkin-card {
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.checkin-reward {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #effaf7 0%, #e3f4ef 100%);
  border: 1px solid #d5ece6;
}

.checkin-reward-value {
  font-size: 26px;
  font-weight: 600;
  color: var(--brand-dark);
  font-variant-numeric: tabular-nums;
}

.checkin-reward-label {
  font-size: 12px;
  color: var(--muted);
}

.mini-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 4px 0 0;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.mini-stats dt {
  font-size: 12px;
  color: var(--muted);
}

.mini-stats dd {
  margin: 2px 0 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---------- 提示与弹窗 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(8px);
  background: #14322c;
  color: #f2fbf8;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: 0 10px 24px rgba(16, 35, 31, 0.24);
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 60;
  max-width: min(90vw, 520px);
  text-align: center;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.is-error {
  background: #7c2d12;
}

.dialog {
  border: 0;
  border-radius: 14px;
  padding: 20px;
  max-width: 400px;
  width: calc(100% - 32px);
  box-shadow: 0 20px 50px rgba(16, 35, 31, 0.26);
  color: var(--ink);
}

.dialog::backdrop {
  background: rgba(16, 35, 31, 0.32);
  backdrop-filter: blur(2px);
}

.dialog p {
  margin: 8px 0 18px;
  font-size: 13px;
  line-height: 1.6;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 960px) {
  .split {
    grid-template-columns: minmax(0, 1fr);
  }

  .topbar {
    height: auto;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 16px;
  }

  .account {
    width: 100%;
    justify-content: flex-end;
  }

  .layout {
    padding: 16px 16px 48px;
  }

  .stats {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
}

@media (max-width: 640px) {
  .brand span:last-child {
    display: none;
  }

  .view-head {
    align-items: flex-start;
  }

  .search-input {
    width: 100%;
  }

  .search {
    width: 100%;
  }

  .table {
    min-width: 560px;
  }
}
