/* ============================================================
   DynadotBackorder · UI v2
   深色现代风: 靛紫渐变主色 + 玻璃质感面板 + 精致间距
   ============================================================ */
:root {
  --bg: #0a0e18;
  --bg-2: #0e1424;
  --bg-soft: #141b2e;
  --panel: #131a2b;
  --panel-2: #1b2438;
  --border: rgba(148, 163, 184, .14);
  --border-strong: rgba(148, 163, 184, .28);
  --text: #e7ecf7;
  --text-dim: #8d9bb8;
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --teal: #14b8a6;
  --gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 55%, #a855f7 100%);
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
  --purple: #a855f7;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 40px rgba(2, 6, 20, .55);
  --ring: 0 0 0 4px rgba(99, 102, 241, .18);
  --topbar-h: 58px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Noto Sans CJK SC", "WenQuanYi Micro Hei", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(1100px 480px at 82% -12%, rgba(139,92,246,.16), transparent 60%),
    radial-gradient(900px 440px at -8% 110%, rgba(20,184,166,.10), transparent 55%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.3; }
code, .mono { font-family: var(--mono); font-variant-ligatures: none; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(148,163,184,.4); }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.topbar { display: none; }

/* 侧边栏 */
.sidebar {
  width: 244px; flex-shrink: 0;
  background: rgba(14, 20, 36, .72);
  backdrop-filter: blur(10px);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  display: flex; flex-direction: column; gap: 3px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-size: 16px; font-weight: 800; letter-spacing: .2px;
  padding: 6px 8px 20px;
}
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  background: var(--gradient);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; color: #fff; box-shadow: 0 6px 16px rgba(139,92,246,.4);
}
.brand em { font-style: normal; color: var(--accent-2); }
.brand .dot { color: var(--teal); }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-dim); font-weight: 500; font-size: 13.5px;
  transition: background .16s ease, color .16s ease, transform .08s ease;
  position: relative;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .9; }
.nav-item:hover { background: rgba(99,102,241,.08); color: var(--text); text-decoration: none; }
.nav-item.active {
  background: var(--gradient); color: #fff;
  box-shadow: 0 8px 20px rgba(139,92,246,.35);
}
.nav-item.active svg { opacity: 1; }
.nav-item.logout { margin-top: auto; color: var(--red); }
.nav-item.logout:hover { background: rgba(239,68,68,.1); color: #fca5a5; }
.sidebar-backdrop { display: none; }

.main { flex: 1; padding: 30px 34px 70px; width: 100%; max-width: 1360px; }

/* 顶部标题 */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; }
.page-head h1 { font-size: 22px; font-weight: 800; letter-spacing: .2px; }
.page-head h1::before { content: ""; display: inline-block; width: 5px; height: 20px; border-radius: 3px; background: var(--gradient); margin-right: 12px; vertical-align: -3px; }
.page-head .sub { color: var(--text-dim); font-size: 13px; margin-top: 3px; }

/* 统计卡片 */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 14px; margin-bottom: 22px; }
.card {
  background: linear-gradient(160deg, rgba(27,36,56,.9), rgba(19,26,43,.9));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; position: relative; overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .16s ease, border-color .16s ease;
}
.card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--gradient); }
.card.green::before, .card.success::before { background: var(--green); }
.card.amber::before, .card.warn::before { background: var(--amber); }
.card.red::before, .card.danger::before { background: var(--red); }
.card .k { color: var(--text-dim); font-size: 12px; margin-bottom: 7px; opacity: .9; }
.card .v { font-size: 27px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.card .v small { font-size: 13px; color: var(--text-dim); font-weight: 400; }
.card .hint { font-size: 12px; color: var(--text-dim); margin-top: 6px; }

/* 面板 */
.panel {
  background: linear-gradient(160deg, rgba(27,36,56,.8), rgba(19,26,43,.85));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 24px; margin-bottom: 20px; box-shadow: var(--shadow);
}
.panel h2 { font-size: 15px; font-weight: 700; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.panel h2 .ic { color: var(--accent-2); }
.panel .desc { color: var(--text-dim); font-size: 13px; margin-bottom: 16px; }
.panel .page-head { margin-bottom: 10px; }

/* 表单 */
label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; font-weight: 500; }
input[type=text], input[type=password], input[type=number], input[type=email], input[type=url], textarea, select {
  width: 100%; background: rgba(10,14,24,.6); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius-sm); padding: 11px 13px; font-size: 14px;
  font-family: inherit; transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); background: rgba(10,14,24,.85); }
textarea { resize: vertical; min-height: 110px; font-family: var(--mono); }
.field { margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hint { color: var(--text-dim); font-size: 12px; margin-top: 5px; }
.hint code, .desc code { background: rgba(99,102,241,.12); padding: 1px 6px; border-radius: 5px; font-size: 12px; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--gradient); color: #fff; border: none; cursor: pointer;
  padding: 11px 20px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600;
  font-family: inherit; text-decoration: none;
  box-shadow: 0 8px 18px rgba(139,92,246,.28);
  transition: transform .06s ease, box-shadow .15s ease, filter .15s ease, background .15s ease;
}
.btn:hover { filter: brightness(1.08); box-shadow: 0 10px 24px rgba(139,92,246,.4); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); box-shadow: none; }
.btn.secondary:hover { background: var(--border-strong); filter: none; box-shadow: none; }
.btn.danger { background: linear-gradient(135deg,#dc2626,#ef4444); box-shadow: 0 8px 18px rgba(239,68,68,.28); }
.btn.danger:hover { box-shadow: 0 10px 24px rgba(239,68,68,.38); }
.btn.success { background: linear-gradient(135deg,#16a34a,#22c55e); }
.btn.sm { padding: 6px 12px; font-size: 12px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn svg { width: 15px; height: 15px; }

/* 表格 */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: var(--radius-sm); background: rgba(10,14,24,.35); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 11px 13px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--text-dim); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; background: rgba(27,36,56,.5); }
tbody tr { transition: background .12s ease; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(99,102,241,.06); }
tbody tr:nth-child(even) { background: rgba(255,255,255,.014); }
tbody tr:nth-child(even):hover { background: rgba(99,102,241,.06); }

/* 状态徽章 */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.5; white-space: nowrap; }
.st-pending { background: rgba(148,163,184,.18); color: #cbd5e1; }
.st-submitted { background: rgba(99,102,241,.18); color: #a5b4fc; }
.st-auction { background: rgba(168,85,247,.2); color: #c084fc; }
.st-caught { background: rgba(34,197,94,.18); color: #4ade80; }
.st-failed { background: rgba(239,68,68,.18); color: #f87171; }
.st-cancelled { background: rgba(148,163,184,.12); color: #94a3b8; }
.md-backorder { background: rgba(168,85,247,.18); color: #c084fc; }
.md-register { background: rgba(99,102,241,.15); color: #a5b4fc; }

/* 提示 */
.flash { margin-bottom: 16px; }
.alert { padding: 13px 16px; border-radius: var(--radius-sm); margin-bottom: 9px; font-size: 13.5px; border-left: 3px solid transparent; background: rgba(27,36,56,.7); }
.alert.success { border-color: rgba(34,197,94,.35); border-left-color: var(--green); color: #86efac; }
.alert.error { border-color: rgba(239,68,68,.35); border-left-color: var(--red); color: #fca5a5; }
.alert.info { border-color: rgba(99,102,241,.4); border-left-color: var(--accent); color: #c7d2fe; }
.alert.warn { border-color: rgba(250,204,21,.4); border-left-color: var(--amber); color: #fde047; }

/* 空态 */
.empty { text-align: center; color: var(--text-dim); padding: 48px 12px; }
.empty .mark { font-size: 30px; opacity: .5; line-height: 1; margin-bottom: 8px; }

/* 设置页 Tab 导航 */
.settings-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.settings-tabs .tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--panel); color: var(--text-dim);
  font-size: 13px; font-weight: 600; transition: all .16s ease;
}
.settings-tabs .tab:hover { color: var(--text); border-color: var(--border-strong); }
.settings-tabs .tab.active { background: var(--gradient); color: #fff; border-color: transparent; box-shadow: 0 6px 16px rgba(139,92,246,.3); }
.settings-tabs .tab small { opacity: .75; font-weight: 500; }
.settings-pane { display: none; }
.settings-pane.active { display: block; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* 登录页 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box { width: 408px; max-width: 100%; background: linear-gradient(165deg, rgba(27,36,56,.95), rgba(19,26,43,.98)); border: 1px solid var(--border); border-radius: 20px; padding: 34px 32px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.login-box::before { content: ""; position: absolute; top: -60%; left: -20%; width: 140%; height: 220px; background: radial-gradient(closest-side, rgba(139,92,246,.28), transparent); }
.login-box .brand { text-align: center; padding: 0 0 20px; font-size: 21px; justify-content: center; }
.login-box .hint { text-align: center; color: var(--text-dim); font-size: 12.5px; margin-top: 16px; }
.qr-box { text-align: center; margin: 12px 0 16px; }
.qr-box canvas, .qr-box img { background: #fff; padding: 8px; border-radius: 10px; max-width: 100%; }
.secret-box {
  background: rgba(10,14,24,.6); border: 1px dashed var(--border); border-radius: var(--radius-sm);
  padding: 11px 13px; font-family: var(--mono); font-size: 13px; word-break: break-all; margin-bottom: 8px;
}
.copy-btn { background: none; border: 1px solid var(--border); color: var(--text-dim); border-radius: 6px; padding: 3px 10px; cursor: pointer; font-size: 12px; }
.copy-btn:hover { color: var(--text); border-color: var(--accent); }

/* 页脚状态 */
.cron-note {
  background: rgba(10,14,24,.6); border: 1px dashed var(--border); border-radius: var(--radius-sm);
  padding: 11px 15px; font-family: var(--mono); font-size: 12.5px; color: var(--text-dim);
  margin-top: 18px; word-break: break-all;
}

/* 桌面端隐藏顶栏 */
@media (min-width: 901px) { .topbar { display: none; } }

@media (max-width: 1100px) {
  .sidebar { width: 216px; }
  .main { padding: 26px 22px 60px; }
}

/* 平板/移动 */
@media (max-width: 900px) {
  .layout { display: block; }
  .topbar {
    position: sticky; top: 0; z-index: 60;
    display: flex; align-items: center; gap: 10px;
    height: var(--topbar-h); padding: 0 14px;
    background: rgba(14,20,36,.85); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
  }
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; flex-shrink: 0;
    background: var(--bg-soft); color: var(--text); border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: 20px; line-height: 1; cursor: pointer;
  }
  .nav-toggle:hover { border-color: var(--accent); color: var(--accent-2); }
  .topbar-brand { padding: 0; font-size: 16px; flex: 1; font-weight: 700; display:flex; align-items:center; gap:8px; }
  .topbar-username { color: var(--text-dim); font-size: 13px; white-space: nowrap; }

  .sidebar {
    position: fixed; top: 0; left: 0; height: 100dvh; width: min(280px, 82vw);
    transform: translateX(-106%); transition: transform .26s cubic-bezier(.4,0,.2,1);
    z-index: 70; box-shadow: 14px 0 34px rgba(0,0,0,.5); padding-top: 18px;
  }
  .sidebar.open { transform: none; }
  .sidebar .brand { display: none; }

  .sidebar-backdrop {
    display: block; position: fixed; inset: 0; z-index: 65;
    background: rgba(2,6,16,.55); backdrop-filter: blur(2px);
    opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility .25s ease;
  }
  .sidebar-backdrop.show { opacity: 1; visibility: visible; }

  .main { padding: 22px 16px 56px; }
  .page-head h1 { font-size: 20px; }
}

/* 手机窄屏 */
@media (max-width: 560px) {
  .main { padding: 18px 12px 50px; }
  .cards { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
  .card { padding: 15px; }
  .card .v { font-size: 22px; }
  .panel { padding: 17px 16px; }
  .field-row { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head .btn-row, .page-head form { width: 100%; }
  .page-head .btn { width: 100%; }
  .login-box { padding: 26px 18px; }
  .alert { padding: 11px 12px; }
  .settings-tabs .tab { flex: 1; justify-content: center; }
}