/* 用量额度中心 — 深色主题 */
:root {
  --bg: #0b0f1a;
  --bg-soft: #101624;
  --card: #131a2b;
  --card-border: #1f2a42;
  --text: #e6ebf5;
  --text-dim: #8a94ab;
  --accent: #4f7cff;
  --accent-2: #22d3ee;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(79, 124, 255, 0.12), transparent 60%),
    radial-gradient(900px 400px at 10% -10%, rgba(34, 211, 238, 0.08), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  min-height: 100vh;
}

.hidden { display: none !important; }
.dim { color: var(--text-dim); font-weight: 400; }

/* ---------- 登录门 ---------- */
.gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.gate-card {
  width: 400px;
  max-width: 100%;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 40px 36px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}
.gate-logo {
  width: 64px; height: 64px;
  margin: 0 auto 18px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.gate-card h1 { font-size: 22px; margin-bottom: 8px; }
.gate-sub { color: var(--text-dim); font-size: 13px; margin-bottom: 24px; }
#gate-key {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 14px;
  margin-bottom: 14px;
}
#gate-key:focus { outline: none; border-color: var(--accent); }
.gate-error {
  margin-top: 12px;
  color: var(--red);
  font-size: 13px;
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.25);
  border-radius: 8px;
  padding: 8px 10px;
}
.gate-hint { color: var(--text-dim); font-size: 12px; margin-top: 18px; line-height: 1.7; }
.gate-link { color: var(--accent-2); text-decoration: none; }
.gate-link:hover { text-decoration: underline; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--card-border);
  background: rgba(11, 15, 26, 0.7);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 42px; height: 42px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.brand h1 { font-size: 17px; font-weight: 600; }

.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.refresh-info { text-align: right; margin-right: 4px; }
.refresh-line { font-size: 12px; color: var(--text-dim); }
.refresh-line b { color: var(--text); font-weight: 500; }

.btn {
  padding: 8px 14px;
  border-radius: 9px;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.05s;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--accent), #3b5fd9); border: none; }
.btn-danger { background: linear-gradient(135deg, #ef4444, #b91c1c); border: none; }
.btn-block { width: 100%; padding: 12px; font-size: 14px; }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 7px; }
.icon { display: inline-block; }
.spin { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.select {
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--text);
  font-size: 13px;
}

/* ---------- 布局 ---------- */
.container { max-width: 1080px; margin: 0 auto; padding: 24px 28px 60px; }
.section { margin-top: 26px; }
.section-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; }

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 8px; }
.card h3 { font-size: 14px; font-weight: 600; }
.placeholder { color: var(--text-dim); font-size: 13px; padding: 12px 0; }

.banner {
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  margin-top: 16px;
}
.banner-error {
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: #fca5a5;
}

/* ---------- 额度卡片 ---------- */
.quota-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}
.quota-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 22px;
}
.ring-wrap { position: relative; width: 124px; height: 124px; flex: none; }
.ring-wrap svg { transform: rotate(-90deg); }
.ring-bg { stroke: var(--bg-soft); }
.ring-fg { transition: stroke-dashoffset 0.6s ease; stroke-linecap: round; }
.ring-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.ring-pct { font-size: 25px; font-weight: 700; }
.ring-pct small { font-size: 12px; font-weight: 400; color: var(--text-dim); }
.ring-label { font-size: 11px; color: var(--text-dim); }
.quota-meta { flex: 1; min-width: 0; }
.quota-name { font-size: 15px; font-weight: 600; margin-bottom: 10px; }
.quota-row { font-size: 13px; color: var(--text-dim); margin: 4px 0; }
.quota-row b { color: var(--text); font-weight: 600; }
.quota-reset { margin-top: 10px; font-size: 12px; color: var(--amber); }
.quota-reset b { font-size: 13px; }
.quota-reset .abs { color: var(--text-dim); display: block; margin-top: 2px; }

/* ---------- 重置管理 ---------- */
.reset-list { display: flex; flex-direction: column; gap: 8px; }
.reset-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  font-size: 13px;
}
.reset-row .type { font-weight: 600; min-width: 70px; }
.reset-row .expire { color: var(--text-dim); flex: 1; font-size: 12px; }
.reset-tip { margin-top: 12px; font-size: 12px; color: var(--text-dim); line-height: 1.6; }

.badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-ok { background: rgba(52, 211, 153, 0.12); color: var(--green); border-color: rgba(52, 211, 153, 0.3); }
.badge-off { background: var(--bg-soft); color: var(--text-dim); border-color: var(--card-border); }

/* ---------- 弹窗 / toast ---------- */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 24px;
  width: 420px;
  max-width: 100%;
}
.modal h2 { font-size: 16px; margin-bottom: 16px; }
.confirm-text { font-size: 14px; line-height: 1.7; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.toast {
  position: fixed;
  left: 50%; bottom: 36px;
  transform: translateX(-50%);
  background: #1c2740;
  border: 1px solid var(--card-border);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  z-index: 200;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  max-width: 80vw;
}
.toast-ok { border-color: rgba(52, 211, 153, 0.4); }
.toast-err { border-color: rgba(248, 113, 113, 0.4); }
