:root {
  --bg: #eef1f6;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --border: #dfe4ec;
  --border-strong: #c8d1de;
  --text: #1f2937;
  --text-2: #5b6675;
  --text-3: #8b95a5;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #e8f0fe;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --success: #16a34a;
  --warning: #d97706;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow: 0 4px 16px rgba(16, 24, 40, .10);
  --shadow-lg: 0 18px 48px rgba(16, 24, 40, .18);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

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

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

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

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 500;
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-danger { color: var(--danger); border-color: #f0b5b5; background: #fff; }
.btn-danger:hover { background: var(--danger-soft); }

.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: rgba(37, 99, 235, .08); }

.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn-icon { width: 34px; padding: 0; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--text-2); font-weight: 500; }

.input, .select, .textarea {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 120px; padding: 10px 11px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data th, table.data td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data th {
  background: var(--surface-2);
  font-weight: 600;
  color: var(--text-2);
  font-size: 12px;
  letter-spacing: .02em;
  white-space: nowrap;
}
table.data tr:hover td { background: #fafbfe; }

.badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--primary-soft);
  color: var(--primary-dark);
}
.badge.grey { background: #eef1f6; color: var(--text-2); }
.badge.green { background: #dcfce7; color: #15803d; }
.badge.red { background: var(--danger-soft); color: #b91c1c; }
.badge.orange { background: #fef3c7; color: #b45309; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.on { background: var(--success); }
.dot.off { background: #c9d0da; }

.muted { color: var(--text-2); }
.tiny { font-size: 12px; }
.mono { font-family: var(--mono); }
.hidden { display: none !important; }

.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  color: #fff; font-size: 12.5px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  flex: none;
}

.quota-bar { height: 6px; border-radius: 4px; background: #dde3ed; overflow: hidden; }
.quota-bar i { display: block; height: 100%; width: 0; border-radius: 4px;
  background: linear-gradient(90deg, #2563eb, #60a5fa); transition: width .3s; }

/* 开关 */
.switch-row { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; user-select: none; }
.switch { position: relative; width: 40px; height: 22px; flex: none; margin-top: 1px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px; transition: background .15s; }
.switch i::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgba(16, 24, 40, .25);
}
.switch input:checked + i { background: var(--primary); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { box-shadow: 0 0 0 3px rgba(37, 99, 235, .25); }
.switch-row b { display: block; font-size: 13.5px; font-weight: 600; }
.switch-row em { display: block; font-style: normal; margin-top: 3px; line-height: 1.6; }

.toast-wrap {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}
.toast {
  padding: 10px 14px;
  border-radius: var(--radius);
  background: #1f2937;
  color: #fff;
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: toast-in .18s ease-out;
  max-width: 360px;
}
.toast.error { background: #b91c1c; }
.toast.success { background: #15803d; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  padding: 24px;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal.wide { max-width: 760px; }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.modal-body { padding: 18px; overflow: auto; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 100%;
  color: var(--text-3);
  font-size: 13px;
  padding: 40px;
  text-align: center;
}
.empty svg { opacity: .45; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cfd6e2; border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #b4bfcf; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }
