/* ============================================================
   NEXCORE · 控制台主题（暗色科技风）
   ============================================================ */
:root {
  --bg: #070b14;
  --bg2: rgba(13, 20, 34, .72);
  --panel: rgba(17, 26, 43, .62);
  --panel-solid: #111a2b;
  --line: rgba(90, 130, 190, .16);
  --line-strong: rgba(96, 165, 250, .35);
  --text: #e6eefb;
  --muted: #7f93b2;
  --accent: #38bdf8;
  --accent2: #8b5cf6;
  --grad: linear-gradient(120deg, #22d3ee, #818cf8 55%, #c084fc);
  --coruna: #8aa4ff;
  --ds: #34d399;
  --ios18: #fbbf24;
  --warn: #e0a14a;
  --danger: #f87171;
  --ok: #34d399;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; min-height: 100%;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(139, 92, 246, .14), transparent 60%),
    radial-gradient(800px 500px at -10% 110%, rgba(34, 211, 238, .10), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(rgba(96, 165, 250, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(96, 165, 250, .05) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 75%);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: none; filter: brightness(1.15); }

/* ---------- 骨架 ---------- */
.layout { display: flex; min-height: 100vh; position: relative; z-index: 1; }
.side {
  width: 224px; flex: 0 0 224px;
  background: var(--bg2); backdrop-filter: blur(14px);
  border-right: 1px solid var(--line);
  padding: 20px 12px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
}
.brand {
  font-size: 17px; font-weight: 800; letter-spacing: .22em;
  margin: 2px 8px 22px; color: #fff;
}
.brand span {
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.side-foot {
  margin-top: auto; padding: 14px 10px 2px; font-size: 10px; letter-spacing: .18em;
  color: var(--muted); opacity: .7;
}
.nav { overflow-y: auto; }
.nav a {
  display: block; color: var(--muted); padding: 9px 14px; margin-bottom: 3px;
  border-radius: 10px; border: 1px solid transparent;
  transition: all .18s ease; font-size: 13.5px;
}
.nav a:hover { color: var(--text); background: rgba(96, 165, 250, .07); }
.nav a.on {
  color: #fff; border-color: var(--line-strong);
  background: linear-gradient(120deg, rgba(34, 211, 238, .16), rgba(139, 92, 246, .16));
  box-shadow: 0 0 18px rgba(56, 189, 248, .12) inset, 0 2px 14px rgba(34, 211, 238, .10);
}
.main { flex: 1; min-width: 0; padding: 26px 30px 56px; }
.top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; gap: 12px; }
.top h1 {
  font-size: 21px; margin: 0; font-weight: 700; letter-spacing: .04em;
  background: linear-gradient(90deg, #fff, #a5c4ee);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.top-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.btn-mnemonic-reveal { font-size: 13px; padding: 6px 12px; }
.muted { color: var(--muted); }
.user { color: var(--muted); font-size: 13px; }
.user a { margin-left: 12px; }

/* ---------- 卡片 / 表单 ---------- */
.card {
  background: var(--panel); backdrop-filter: blur(12px);
  border: 1px solid var(--line); border-radius: 14px;
  padding: 18px 20px; margin-bottom: 16px; max-width: 100%;
  box-shadow: 0 8px 28px rgba(2, 6, 16, .45);
}
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
input, select, textarea, button { font: inherit; }
input[type=text], input[type=password], select, textarea {
  background: rgba(7, 11, 20, .75); color: var(--text);
  border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 11px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, .14);
}
button, .btn {
  background: var(--grad); color: #061018; border: 0; border-radius: 9px;
  padding: 8px 16px; font-weight: 700; letter-spacing: .03em; cursor: pointer;
  display: inline-block; transition: filter .15s, transform .1s;
}
button:hover, .btn:hover { filter: brightness(1.12); }
button:active, .btn:active { transform: translateY(1px); }
button.ghost, .btn.ghost {
  background: rgba(96, 165, 250, .06); color: var(--text);
  border: 1px solid var(--line-strong);
}
button.danger, .btn.danger { background: linear-gradient(120deg, #f87171, #fb7185); color: #1a0b0b; }
.table .btn.danger { padding: 4px 10px; font-size: 12px; }
.grow { flex: 1; }

/* ---------- 数据看板 ---------- */
.stat-grid {
  display: grid; gap: 12px; margin-bottom: 18px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.stat-card {
  position: relative; overflow: hidden;
  background: var(--panel); backdrop-filter: blur(12px);
  border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px;
  transition: transform .18s ease, border-color .18s ease;
}
.stat-card:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.stat-card::after {
  content: ""; position: absolute; inset: auto -30% -60% -30%; height: 120%;
  background: radial-gradient(closest-side, rgba(56, 189, 248, .10), transparent);
  pointer-events: none;
}
.stat-card.glow-cyan::after   { background: radial-gradient(closest-side, rgba(34, 211, 238, .18), transparent); }
.stat-card.glow-violet::after { background: radial-gradient(closest-side, rgba(139, 92, 246, .20), transparent); }
.stat-card.glow-blue::after   { background: radial-gradient(closest-side, rgba(96, 165, 250, .18), transparent); }
.stat-card.glow-green::after  { background: radial-gradient(closest-side, rgba(52, 211, 153, .16), transparent); }
.stat-label { color: var(--muted); font-size: 12.5px; letter-spacing: .06em; }
.stat-sub { font-size: 11px; opacity: .75; margin-left: 4px; }
.stat-num {
  font-size: 34px; font-weight: 800; line-height: 1.25; margin-top: 2px;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #fff, #9fc1ef);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat-foot { color: var(--muted); font-size: 12px; margin-top: 2px; }

.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.dash-panel { margin-bottom: 0; }
.dash-title {
  margin: 0 0 16px; font-size: 13px; font-weight: 700; letter-spacing: .12em;
  color: var(--muted); text-transform: uppercase;
}
.trend { display: flex; align-items: flex-end; gap: 10px; height: 190px; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.trend-bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.trend-bar {
  width: 62%; min-width: 18px; border-radius: 7px 7px 3px 3px;
  background: linear-gradient(180deg, #22d3ee, #6366f1);
  box-shadow: 0 0 16px rgba(34, 211, 238, .25);
  transition: height .5s ease;
}
.trend-col:hover .trend-bar { filter: brightness(1.25); }
.trend-num { font-size: 12px; color: var(--text); font-variant-numeric: tabular-nums; }
.trend-day { font-size: 11px; color: var(--muted); }

.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 11px; }
.bar-name { flex: 0 0 108px; color: var(--text); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track {
  flex: 1; height: 9px; border-radius: 99px;
  background: rgba(96, 165, 250, .08); border: 1px solid var(--line); overflow: hidden;
}
.bar-fill {
  height: 100%; border-radius: 99px;
  background: var(--grad); box-shadow: 0 0 10px rgba(56, 189, 248, .35);
  transition: width .5s ease;
}
.bar-fill.bar-violet { background: linear-gradient(90deg, #818cf8, #c084fc); }
.bar-fill.bar-cyan { background: linear-gradient(90deg, #22d3ee, #38bdf8); }
.bar-fill.fam-coruna { background: linear-gradient(90deg, #8aa4ff, #818cf8); }
.bar-fill.fam-darksword { background: linear-gradient(90deg, #34d399, #6ee7b7); }
.bar-fill.fam-ios18 { background: linear-gradient(90deg, #fbbf24, #fcd34d); }
.bar-num { flex: 0 0 44px; text-align: right; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* ---------- 表格 / 徽章 / 杂项 ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: 12px; letter-spacing: .05em; }
.table tr:hover td { background: rgba(96, 165, 250, .045); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.coruna { background: rgba(138,164,255,.15); color: var(--coruna); }
.badge.darksword { background: rgba(52,211,153,.15); color: var(--ds); }
.badge.ios18 { background: rgba(251,191,36,.16); color: var(--ios18); }
.badge.on { background: rgba(52,211,153,.15); color: var(--ds); }
.badge.off { background: rgba(127,147,178,.12); color: var(--muted); }
.badge.pending { background: rgba(224,161,74,.15); color: var(--warn); }
.badge.sent { background: rgba(56,189,248,.15); color: var(--accent); }
.badge.done { background: rgba(52,211,153,.15); color: var(--ds); }
.badge.likely { background: rgba(248,113,113,.18); color: #ff8a8a; }
.photo-scan-badge.likely { font-size: 10px; max-width: 92%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a { padding: 7px 12px; border-radius: 9px; color: var(--muted); background: rgba(96,165,250,.05); border: 1px solid var(--line); }
.tabs a.on { color: #061018; background: var(--grad); font-weight: 700; border-color: transparent; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; }
.kv b { color: var(--muted); font-weight: 500; }
.pager { margin-top: 14px; color: var(--muted); }
.pager a { margin-right: 8px; }
.promo-link-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.promo-iframe-wrap { margin-top: 10px; max-width: 520px; }
.promo-iframe-snippet { display: block; font-size: 11px; line-height: 1.45; word-break: break-all; white-space: pre-wrap; padding: 8px 10px; background: rgba(7,11,20,.75); border-radius: 8px; border: 1px solid var(--line); color: #c9d6e5; }
button.btn-toggle-iframe.on,
button.btn-toggle-js.on { border-color: var(--accent); color: var(--accent); }
.err { color: var(--danger); margin: 0 0 10px; }
.ok { color: var(--ok); }

/* ---------- 相册 / 备忘 / 密钥 ---------- */
.photo-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.photo-item { background: rgba(7,11,20,.75); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.photo-thumb { position: relative; display: block; }
.photo-scan-badge { position: absolute; top: 6px; right: 6px; z-index: 2; font-size: 11px; padding: 2px 7px; box-shadow: 0 1px 4px rgba(0,0,0,.35); pointer-events: none; }
.photo-item img { width: 100%; height: 160px; object-fit: cover; display: block; }
.photo-meta { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 4px; }
.photo-meta code { font-size: 11px; word-break: break-all; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.photos a { display: block; background: rgba(7,11,20,.75); border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.photos .photo-thumb { position: relative; }
.photos img { width: 100%; height: 140px; object-fit: cover; display: block; }
.note-list-tg { display: flex; flex-direction: column; gap: 2px; }
.note-row-tg { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: inherit; border: 1px solid var(--line); background: rgba(7,11,20,.75); margin-bottom: 6px; }
.note-row-tg:hover { background: rgba(96,165,250,.06); }
.note-row-device a { text-decoration: none; }
.note-row-device a:hover code { color: var(--accent); }
.note-row-meta .btn.ghost { padding: 4px 10px; font-size: 12px; white-space: nowrap; }
.note-detail-block p { margin: 0 0 10px; text-align: left; }
.note-detail-body { max-height: 420px; text-align: left; margin: 0; }
.note-row-device { flex: 0 0 auto; max-width: 28%; }
.note-row-device code { font-size: 11px; word-break: break-all; }
.note-row-main { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.note-row-meta { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
.note-item { background: rgba(7,11,20,.75); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.note-item h3 { margin: 6px 0 8px; font-size: 15px; font-weight: 600; }
.pre { white-space: pre-wrap; word-break: break-all; background: rgba(7,11,20,.75); padding: 10px; border-radius: 8px; font-size: 12px; color: #c9d6e5; max-height: 280px; overflow: auto; }
.secret { background: rgba(248,113,113,.06); border: 1px solid rgba(248,113,113,.25); padding: 10px 12px; border-radius: 8px; margin-bottom: 8px; }
.secret code { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-all; }
.secret-cell { min-width: 280px; max-width: 560px; }
.wallet-group h3 { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.wallet-pair { border: 1px solid rgba(248,113,113,.18); border-radius: 10px; padding: 10px 12px 4px; margin-bottom: 14px; background: rgba(0,0,0,.16); }
.wallet-pair .secret { margin-bottom: 8px; }
.wallet-pair .wallet-fold { margin-top: 0; }
.wallet-fold { border: 1px solid var(--line); border-radius: 8px; margin: 10px 0; background: rgba(7,11,20,.75); }
.wallet-fold summary { cursor: pointer; padding: 10px 12px; color: var(--text); list-style: none; display: flex; gap: 8px; align-items: center; }
.wallet-fold summary::-webkit-details-marker { display: none; }
.wallet-fold summary::before { content: "▸"; color: var(--muted); }
.wallet-fold[open] summary::before { content: "▾"; }
.wallet-fold .table { margin: 0 10px 10px; width: calc(100% - 20px); }
.cmd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.apps-all { display: none; margin-top: 12px; }
.apps-all.show { display: block; }
.kc-wrap { width: 100%; max-width: 100%; overflow: auto; }
.kc-table { table-layout: fixed; width: 100%; max-width: 100%; }
.kc-table th, .kc-table td { overflow: hidden; }
.kc-table th:nth-child(1), .kc-table td:nth-child(1) { width: 14%; }
.kc-table th:nth-child(2), .kc-table td:nth-child(2) { width: 16%; }
.kc-table th:nth-child(3), .kc-table td:nth-child(3) { width: 28%; }
.kc-table th:nth-child(4), .kc-table td:nth-child(4) { width: 42%; }
.kc-cell, .kc-val { overflow-wrap: anywhere; word-break: break-all; white-space: normal; }
.kc-val-box { max-height: 72px; overflow: auto; overflow-wrap: anywhere; word-break: break-all; }
.kc-val-box code, .kc-cell code { display: block; font-size: 12px; white-space: pre-wrap; word-break: break-all; overflow-wrap: anywhere; }
.pagination { display: flex; gap: 6px; list-style: none; padding: 0; margin: 12px 0 0; }
.pagination li a, .pagination li span { display: inline-block; padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); }
.pagination li.active span { background: var(--grad); color: #061018; border-color: transparent; }

/* ---------- SweetAlert 适配 ---------- */
.swal2-popup.adm-swal { background: var(--panel-solid); color: var(--text); border: 1px solid var(--line-strong); border-radius: 14px; }
.swal2-popup.adm-swal .swal2-title { color: var(--text); font-size: 18px; }
.swal2-popup.adm-swal .swal2-html-container { color: var(--muted); }
.swal2-popup.adm-swal .swal2-actions { gap: 10px; }
.swal-json {
  max-height: 70vh; overflow: auto; text-align: left;
  white-space: pre-wrap; word-break: break-word;
  font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: rgba(7,11,20,.85); border: 1px solid var(--line); border-radius: 8px;
  padding: 14px 16px; margin: 0;
}
.swal-json .jk { color: #7dd3fc; }
.swal-json .js { color: #86efac; }
.swal-json .jn { color: #fcd34d; }
.swal-json .jl { color: #f472b6; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.login-wrap::before {
  content: ""; position: absolute; inset: -40%;
  background:
    radial-gradient(circle at 30% 30%, rgba(34, 211, 238, .13), transparent 38%),
    radial-gradient(circle at 70% 65%, rgba(139, 92, 246, .16), transparent 42%);
  animation: login-drift 16s ease-in-out infinite alternate;
}
@keyframes login-drift {
  from { transform: translate3d(-3%, -2%, 0) scale(1); }
  to   { transform: translate3d(3%, 3%, 0) scale(1.06); }
}
.login-box {
  position: relative; width: 380px;
  background: rgba(13, 20, 34, .78); backdrop-filter: blur(18px);
  border: 1px solid var(--line-strong); border-radius: 18px;
  padding: 36px 34px 30px;
  box-shadow: 0 0 0 1px rgba(34, 211, 238, .06), 0 24px 80px rgba(2, 6, 16, .7), 0 0 60px rgba(56, 189, 248, .07);
}
.login-brand {
  text-align: center; font-size: 22px; font-weight: 800; letter-spacing: .3em;
  margin-bottom: 4px; color: #fff;
}
.login-brand span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-sub { text-align: center; color: var(--muted); font-size: 11px; letter-spacing: .28em; margin-bottom: 26px; }
.login-box h1 { margin: 0 0 6px; font-size: 20px; }
.login-box p { margin: 0 0 20px; color: var(--muted); }
.login-box label { display: block; margin: 14px 0 6px; color: var(--muted); font-size: 12.5px; letter-spacing: .08em; }
.login-box input { width: 100%; padding: 10px 12px; }
.login-box button { width: 100%; margin-top: 22px; padding: 11px; font-size: 15px; }
.login-box .err { text-align: center; margin-top: 4px; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .layout { display: block; }
  .side { width: auto; height: auto; position: relative; }
  .cmd-grid { grid-template-columns: 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
}
