/* ============ Duck Auth · 开发者后台 · 蓝绿主题 ============ */
:root {
  --bg: #051418;
  --bg-2: #071e24;
  --panel: rgba(255, 255, 255, 0.038);
  --panel-2: rgba(255, 255, 255, 0.06);
  --line: rgba(125, 232, 220, 0.13);
  --line-soft: rgba(255, 255, 255, 0.06);
  --cyan: #22d3ee;
  --emerald: #34d399;
  --mint: #a7f3d0;
  --text: #e8f6f4;
  --muted: #7ea3a5;
  --danger: #f87171;
  --warn: #fbbf24;
  --grad: linear-gradient(135deg, #22d3ee 0%, #34d399 100%);
  --grad-soft: linear-gradient(135deg, rgba(34, 211, 238, 0.16), rgba(52, 211, 153, 0.16));
  --shadow: 0 18px 50px -18px rgba(0, 0, 0, 0.8);
  --radius: 16px;
  --font: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

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

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(720px 420px at 8% -6%, rgba(34, 211, 238, 0.16), transparent 62%),
    radial-gradient(680px 480px at 96% 4%, rgba(52, 211, 153, 0.14), transparent 64%),
    radial-gradient(900px 600px at 60% 110%, rgba(16, 185, 129, 0.08), transparent 70%),
    linear-gradient(180deg, #051418, #04100f 60%, #051418);
  z-index: -2;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(125, 232, 220, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(125, 232, 220, 0.045) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 0%, #000 10%, transparent 75%);
  z-index: -1;
  pointer-events: none;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, select, textarea { font-family: inherit; }

/* ------------------------------- 登录页 ------------------------------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025));
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 38px 34px 30px;
  box-shadow: var(--shadow), 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
  backdrop-filter: blur(22px);
  position: relative;
  overflow: hidden;
  animation: rise 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.login-card::before {
  content: "";
  position: absolute;
  top: -60%;
  left: -20%;
  width: 140%;
  height: 120%;
  background: radial-gradient(circle at 50% 0%, rgba(52, 211, 153, 0.18), transparent 55%);
  pointer-events: none;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; position: relative; }
.brand-logo {
  width: 44px; height: 44px; border-radius: 13px;
  background: var(--grad);
  display: grid; place-items: center;
  box-shadow: 0 10px 26px -8px rgba(34, 211, 238, 0.75);
  flex: 0 0 auto;
}
.brand-logo svg { width: 24px; height: 24px; }
.brand-name { font-size: 17px; font-weight: 700; letter-spacing: 0.2px; }
.brand-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }

.field { margin-bottom: 16px; position: relative; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.input {
  width: 100%;
  height: 46px;
  border-radius: 12px;
  background: rgba(4, 18, 20, 0.55);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 0 14px;
  font-size: 14px;
  outline: none;
  transition: 0.2s;
}
.input::placeholder { color: #56777a; }
.input:focus {
  border-color: rgba(52, 211, 153, 0.65);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.12);
  background: rgba(4, 18, 20, 0.75);
}
textarea.input { height: auto; padding: 12px 14px; line-height: 1.6; resize: vertical; }
select.input { appearance: none; cursor: pointer; }

.btn {
  height: 46px;
  border-radius: 12px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: 0.2s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--grad);
  color: #04191a;
  box-shadow: 0 12px 28px -12px rgba(34, 211, 238, 0.9);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 16px 34px -12px rgba(52, 211, 153, 0.95); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-ghost {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
  color: var(--text);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.09); border-color: rgba(52, 211, 153, 0.4); }
.btn-block { width: 100%; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; font-weight: 500; }
.btn-danger { background: rgba(248, 113, 113, 0.14); color: #fca5a5; border: 1px solid rgba(248, 113, 113, 0.3); }
.btn-danger:hover { background: rgba(248, 113, 113, 0.24); }

.hint { font-size: 12px; color: var(--muted); text-align: center; margin-top: 18px; line-height: 1.7; }
.hint b { color: var(--mint); font-weight: 600; }

/* ------------------------------- 主框架 ------------------------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex: 0 0 232px;
  padding: 22px 14px;
  border-right: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(7, 30, 36, 0.9), rgba(4, 16, 18, 0.6));
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; }
.side-brand .brand-logo { width: 36px; height: 36px; border-radius: 11px; }
.side-brand .brand-logo svg { width: 20px; height: 20px; }
.side-brand .brand-name { font-size: 14.5px; }
.nav-label { font-size: 11px; color: #4f6f72; letter-spacing: 1.4px; padding: 10px 12px 6px; text-transform: uppercase; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  height: 42px; padding: 0 12px; border-radius: 11px;
  color: #a9c6c6; font-size: 13.5px;
  transition: 0.18s;
  position: relative;
}
.nav-item svg { width: 17px; height: 17px; opacity: 0.85; }
.nav-item:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.nav-item.active {
  background: var(--grad-soft);
  color: var(--mint);
  border: 1px solid rgba(52, 211, 153, 0.28);
}
.nav-item.active::before {
  content: ""; position: absolute; left: -14px; top: 11px;
  width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: var(--grad);
}
.side-foot { margin-top: auto; padding: 12px 8px; font-size: 11.5px; color: #4f6f72; line-height: 1.8; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 66px;
  display: flex; align-items: center; gap: 14px;
  padding: 0 26px;
  border-bottom: 1px solid var(--line-soft);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 20;
  background: rgba(4, 16, 18, 0.72);
}
.page-title { font-size: 16px; font-weight: 650; letter-spacing: 0.2px; }
.page-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-chip {
  display: flex; align-items: center; gap: 9px;
  height: 36px; padding: 0 13px 0 6px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line);
  font-size: 12.5px;
}
.avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--grad); color: #04191a;
  display: grid; place-items: center; font-weight: 700; font-size: 12px;
}
.dot-live { width: 7px; height: 7px; border-radius: 50%; background: var(--emerald); box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(52, 211, 153, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); } }

.content { padding: 24px 26px 40px; }
.page { display: none; animation: fade 0.28s ease; }
.page.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }

/* ------------------------------- 卡片 ------------------------------- */
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3-1 { grid-template-columns: 1.65fr 1fr; }
@media (max-width: 1180px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3-1, .grid-2 { grid-template-columns: 1fr; } }
/* ---------------- 移动端适配：手机浏览器也能登录并操作后台 ---------------- */
@media (max-width: 720px) {
  .app { flex-direction: column; }

  /* 侧栏不再隐藏，改为可横向滑动的顶部导航条，保留全部页面入口 */
  .sidebar {
    position: static;
    width: 100%; height: auto;
    flex: 0 0 auto;
    flex-direction: row; flex-wrap: nowrap; align-items: center;
    gap: 6px; padding: 9px 10px;
    border-right: 0; border-bottom: 1px solid var(--line-soft);
    overflow-x: auto; overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .sidebar::-webkit-scrollbar { display: none; }
  .side-brand, .nav-label, .side-foot { display: none; }
  .nav-item {
    flex: 0 0 auto; height: 36px; padding: 0 13px;
    font-size: 13px; white-space: nowrap; border-radius: 9px;
  }
  .nav-item.active::before { display: none; }

  .topbar {
    height: auto; min-height: 56px;
    padding: 8px 14px; gap: 10px; flex-wrap: wrap;
  }
  .page-title { font-size: 15px; }
  .page-sub { font-size: 11.5px; }
  .topbar-right { gap: 6px; }
  .user-chip { height: 32px; font-size: 11.5px; padding: 0 10px 0 5px; }

  .content { padding: 14px 12px 32px; }
  .grid-4, .grid-2, .grid-3-1 { grid-template-columns: 1fr; }
  .card { padding: 16px; overflow-x: auto; }
  .card-head { flex-wrap: wrap; gap: 10px; }
  .stat-num { font-size: 26px; }

  .toolbar { gap: 8px; }
  .toolbar .input, .toolbar select.input { width: 100%; }
  .toolbar .spacer { display: none; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 720px; }

  /* iOS Safari 输入框字号 >=16px 时聚焦才不会自动放大整页 */
  .input, select.input, textarea.input { font-size: 16px; }
  .modal { padding: 18px; max-height: 90vh; }
  .modal .row-2 { grid-template-columns: 1fr; }
  .modal-foot { flex-wrap: wrap; }
  .toast-box { top: 12px; left: 12px; right: 12px; }
  .toast { min-width: 0; width: 100%; }
  .kv { grid-template-columns: 96px 1fr; gap: 8px 10px; }
  .chart { gap: 5px; }
  .login-wrap { padding: 16px; }
  .login-card { padding: 28px 20px 24px; }
  .pager { flex-wrap: wrap; justify-content: center; }
}

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-size: 14px; font-weight: 620; }
.card-title small { color: var(--muted); font-weight: 400; font-size: 11.5px; margin-left: 8px; }

.stat { display: flex; flex-direction: column; gap: 10px; }
.stat-top { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; }
.stat-icon { width: 32px; height: 32px; border-radius: 10px; background: var(--grad-soft); border: 1px solid var(--line); display: grid; place-items: center; }
.stat-icon svg { width: 16px; height: 16px; stroke: var(--mint); }
.stat-num { font-size: 30px; font-weight: 700; letter-spacing: -0.6px; line-height: 1; background: linear-gradient(135deg, #eafff9, #7ff0d0); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-foot { font-size: 11.5px; color: var(--muted); }
.stat-foot b { color: var(--mint); }

/* ------------------------------- 表格 ------------------------------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar .input { height: 38px; width: 210px; border-radius: 10px; font-size: 13px; }
.toolbar select.input { width: 132px; }
.toolbar .spacer { flex: 1; }

.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--line-soft); }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 860px; }
thead th {
  text-align: left; font-weight: 500; font-size: 11.5px; color: var(--muted);
  padding: 12px 14px; background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--line-soft); white-space: nowrap;
  letter-spacing: 0.4px;
}
tbody td { padding: 13px 14px; border-bottom: 1px solid rgba(255, 255, 255, 0.04); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background 0.15s; }
tbody tr:hover { background: rgba(52, 211, 153, 0.045); }
.mono { font-family: "JetBrains Mono", "Consolas", monospace; font-size: 12.5px; letter-spacing: 0.4px; }
.muted { color: var(--muted); }
.t-right { text-align: right; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 23px; padding: 0 9px; border-radius: 7px;
  font-size: 11.5px; font-weight: 500; white-space: nowrap;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge-unused { background: rgba(148, 163, 184, 0.13); color: #a9bcc8; }
.badge-active { background: rgba(52, 211, 153, 0.14); color: #6ee7b7; }
.badge-disabled { background: rgba(248, 113, 113, 0.14); color: #fca5a5; }
.badge-expired { background: rgba(251, 191, 36, 0.14); color: #fcd34d; }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.045); border: 1px solid var(--line-soft);
  transition: 0.16s; color: #a9c6c6;
}
.icon-btn:hover { background: rgba(52, 211, 153, 0.16); color: var(--mint); border-color: rgba(52, 211, 153, 0.3); }
.icon-btn.danger:hover { background: rgba(248, 113, 113, 0.16); color: #fca5a5; border-color: rgba(248, 113, 113, 0.32); }
.icon-btn svg { width: 14px; height: 14px; }

.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: 14px; font-size: 12.5px; color: var(--muted); }

/* ------------------------------- 弹窗 / 提示 ------------------------------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(2, 10, 11, 0.72);
  backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-mask.show { display: flex; }
.modal {
  width: 100%; max-width: 520px;
  background: linear-gradient(180deg, #0a252b, #071b20);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
  animation: rise 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  max-height: 88vh; overflow: auto;
}
.modal h3 { font-size: 16px; margin-bottom: 6px; }
.modal .sub { font-size: 12.5px; color: var(--muted); margin-bottom: 20px; }
.modal .row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

.toast-box { position: fixed; top: 22px; right: 22px; z-index: 300; display: flex; flex-direction: column; gap: 10px; }
.toast {
  min-width: 240px; padding: 13px 16px; border-radius: 12px;
  background: rgba(8, 32, 36, 0.96);
  border: 1px solid var(--line);
  font-size: 13px;
  box-shadow: 0 14px 34px -14px #000;
  animation: slidein 0.25s ease;
  display: flex; align-items: center; gap: 9px;
}
.toast.ok { border-color: rgba(52, 211, 153, 0.45); }
.toast.err { border-color: rgba(248, 113, 113, 0.45); }
.toast::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--emerald); }
.toast.err::before { background: var(--danger); }
@keyframes slidein { from { opacity: 0; transform: translateX(18px); } }

/* 密钥展示 */
.key-list {
  margin-top: 16px; padding: 14px; border-radius: 12px;
  background: rgba(2, 12, 14, 0.6); border: 1px solid var(--line-soft);
  max-height: 240px; overflow: auto;
  font-family: "JetBrains Mono", Consolas, monospace; font-size: 12.5px;
  line-height: 2; color: var(--mint); white-space: pre;
}
.empty { padding: 44px 0; text-align: center; color: var(--muted); font-size: 13px; }

/* 简易柱状图 */
.chart { display: flex; align-items: flex-end; gap: 10px; height: 148px; padding-top: 8px; }
.chart .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.chart .bar {
  width: 100%; max-width: 40px; border-radius: 7px 7px 3px 3px;
  background: var(--grad); opacity: 0.85;
  min-height: 4px; transition: height 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
}
.chart .bar:hover { opacity: 1; }
.chart .bar-lbl { font-size: 10.5px; color: var(--muted); }
.chart .bar-val { font-size: 10.5px; color: var(--mint); }

.log-line { display: flex; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px dashed rgba(255, 255, 255, 0.055); font-size: 12.5px; }
.log-line:last-child { border: 0; }
.log-line .t { color: var(--muted); font-family: "JetBrains Mono", monospace; font-size: 11.5px; flex: 0 0 auto; }

.kv { display: grid; grid-template-columns: 120px 1fr; gap: 10px 14px; font-size: 13px; align-items: center; }
.kv .k { color: var(--muted); font-size: 12.5px; }

.code-block {
  background: rgba(2, 12, 14, 0.72); border: 1px solid var(--line-soft);
  border-radius: 12px; padding: 16px; font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 12px; line-height: 1.85; color: #a7e8d6; overflow-x: auto; white-space: pre;
}
