/* ==========================================================================
   通用账号管理后台 · 白色 iOS 26 液态玻璃风格
   设计令牌：颜色 / 字阶 / 间距 / 圆角 / 阴影 / 动效
   ========================================================================== */
:root {
  --bg: #f5f6f8;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --faint: #a1a1a6;
  --accent: #0a84ff;
  --accent-deep: #0060df;
  --accent-soft: rgba(10, 132, 255, 0.1);
  --ok: #34c759;
  --ok-soft: rgba(52, 199, 89, 0.14);
  --warn: #ff9500;
  --warn-soft: rgba(255, 149, 0, 0.15);
  --danger: #ff3b30;
  --danger-soft: rgba(255, 59, 48, 0.12);
  --gray-tag: rgba(120, 120, 128, 0.14);

  --glass: rgba(255, 255, 255, 0.62);
  --glass-strong: rgba(255, 255, 255, 0.78);
  --glass-border: rgba(255, 255, 255, 0.85);
  --hairline: rgba(0, 0, 0, 0.06);

  --font-display: 'Outfit', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-body: 'IBM Plex Sans', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;

  --fs-xs: 12px; --fs-sm: 13px; --fs-md: 14px; --fs-lg: 16px;
  --fs-xl: 20px; --fs-2xl: 28px; --fs-hero: 34px;

  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px;

  --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-xl: 26px; --r-pill: 999px;

  --shadow-1: 0 2px 8px rgba(31, 35, 46, 0.06);
  --shadow-2: 0 8px 28px rgba(31, 35, 46, 0.1);
  --shadow-3: 0 24px 64px rgba(31, 35, 46, 0.16);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 170ms; --dur-base: 340ms; --dur-slow: 640ms;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-body);
  font-size: var(--fs-md);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
  overflow: hidden;
}
::selection { background: rgba(10, 132, 255, 0.22); }

/* ---------- 氛围层：彩色光斑 + 细颗粒 ---------- */
.atmosphere {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background:
    radial-gradient(58rem 40rem at 8% -12%, rgba(10, 132, 255, 0.16), transparent 62%),
    radial-gradient(46rem 34rem at 96% 4%, rgba(255, 105, 180, 0.12), transparent 58%),
    radial-gradient(50rem 40rem at 78% 100%, rgba(52, 199, 89, 0.1), transparent 60%),
    radial-gradient(40rem 30rem at 18% 96%, rgba(255, 149, 0, 0.09), transparent 55%);
}
.atmosphere::after { /* 细颗粒噪点，让光斑不发塑料 */
  content: ''; position: absolute; inset: 0; opacity: 0.035; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.5; animation: drift 26s var(--ease-out) infinite alternate; }
.orb.o1 { width: 420px; height: 420px; left: -120px; top: 8%; background: rgba(10, 132, 255, 0.2); }
.orb.o2 { width: 360px; height: 360px; right: -100px; top: 30%; background: rgba(255, 105, 180, 0.16); animation-delay: -8s; }
.orb.o3 { width: 300px; height: 300px; left: 34%; bottom: -140px; background: rgba(255, 149, 0, 0.13); animation-delay: -16s; }
@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(40px, -30px, 0) scale(1.12); }
}

/* ---------- 玻璃卡片 ---------- */
.glass {
  background: var(--glass);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
}

/* ---------- 通用控件 ---------- */
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
a:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}
input, select, textarea {
  font: inherit; color: var(--text);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--r-sm);
  padding: 9px 12px; width: 100%;
  transition: border-color var(--dur-fast) ease-out, box-shadow var(--dur-fast) ease-out;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: rgba(0, 0, 0, 0.16); }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3.5px rgba(10, 132, 255, 0.18);
  background: #fff;
}
label { display: block; font-size: var(--fs-sm); color: var(--muted); margin-bottom: 6px; font-weight: 500; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 0 18px;
  border-radius: var(--r-pill); font-weight: 600; font-size: var(--fs-md);
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast), background var(--dur-fast), opacity var(--dur-fast);
  user-select: none; white-space: nowrap;
}
.btn:active { transform: scale(0.96); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary {
  color: #fff; background: linear-gradient(180deg, #2e9bff, var(--accent));
  box-shadow: 0 6px 18px rgba(10, 132, 255, 0.35);
}
.btn-primary:hover:not([disabled]) { box-shadow: 0 10px 26px rgba(10, 132, 255, 0.42); transform: translateY(-1px); }
.btn-ghost { background: rgba(255, 255, 255, 0.65); border: 1px solid rgba(0, 0, 0, 0.08); color: var(--text); }
.btn-ghost:hover:not([disabled]) { background: #fff; }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover:not([disabled]) { background: rgba(255, 59, 48, 0.2); }
.btn-sm { min-height: 30px; padding: 0 13px; font-size: var(--fs-sm); }

/* iOS 分段控件 */
.seg { display: inline-flex; padding: 2px; background: rgba(120, 120, 128, 0.12); border-radius: var(--r-pill); }
.seg button {
  border-radius: var(--r-pill); padding: 5px 14px; font-size: var(--fs-sm); font-weight: 500;
  color: var(--muted); transition: all var(--dur-fast) var(--ease-out); min-height: 30px;
}
.seg button.on { background: #fff; color: var(--text); box-shadow: var(--shadow-1); }

/* iOS 开关 */
.switch { position: relative; width: 44px; height: 26px; flex: none; display: inline-block; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch i {
  position: absolute; inset: 0; border-radius: var(--r-pill);
  background: rgba(120, 120, 128, 0.24); transition: background var(--dur-base) var(--ease-out);
}
.switch i::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px;
  border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
  transition: transform var(--dur-base) var(--ease-out);
}
.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 标签 / 徽章 */
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2.5px 10px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; }
.tag .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag-ok { background: var(--ok-soft); color: #1e8e3e; }
.tag-warn { background: var(--warn-soft); color: #b26200; }
.tag-danger { background: var(--danger-soft); color: #d70015; }
.tag-gray { background: var(--gray-tag); color: var(--muted); }
.tag-accent { background: var(--accent-soft); color: var(--accent-deep); }

.mono { font-family: var(--font-mono); font-size: 0.92em; letter-spacing: -0.02em; }
.num { font-family: var(--font-display); font-variant-numeric: tabular-nums; }

/* ---------- 登录页 ---------- */
#loginView {
  position: relative; z-index: 1; height: 100%;
  display: flex; align-items: center; justify-content: center; padding: var(--sp-4);
}
.login-card { width: 400px; max-width: 100%; padding: var(--sp-7) var(--sp-6) var(--sp-6); border-radius: var(--r-xl); text-align: center; }
.login-logo {
  width: 68px; height: 68px; margin: 0 auto var(--sp-4); border-radius: 22px;
  background: linear-gradient(145deg, #64b5ff, #0a84ff 60%, #0059d6);
  box-shadow: 0 12px 30px rgba(10, 132, 255, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 32px;
}
.login-card h1 { font-family: var(--font-display); font-size: var(--fs-xl); letter-spacing: -0.02em; }
.login-card .sub { color: var(--muted); font-size: var(--fs-sm); margin: 4px 0 var(--sp-5); }
.login-card input { text-align: center; padding: 12px; font-size: var(--fs-lg); border-radius: var(--r-md); }
.login-card .btn { width: 100%; margin-top: var(--sp-4); min-height: 44px; }
.login-err { color: var(--danger); font-size: var(--fs-sm); min-height: 20px; margin-top: var(--sp-3); }
.login-tip { margin-top: var(--sp-5); color: var(--faint); font-size: var(--fs-xs); }

/* ---------- 应用外壳 ---------- */
#appView { position: relative; z-index: 1; height: 100%; display: none; }
#appView.show { display: flex; }

.sidebar {
  width: 224px; flex: none; margin: var(--sp-3) 0 var(--sp-3) var(--sp-3);
  padding: var(--sp-4) 12px; display: flex; flex-direction: column; gap: var(--sp-1);
  border-radius: var(--r-xl);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px var(--sp-4); }
.brand .logo {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  background: linear-gradient(145deg, #64b5ff, #0a84ff);
  box-shadow: 0 6px 14px rgba(10, 132, 255, 0.35);
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 15px;
  font-family: var(--font-display);
}
.brand b { font-family: var(--font-display); font-size: var(--fs-lg); letter-spacing: -0.01em; display: block; line-height: 1.25; }
.brand span { font-size: 10.5px; color: var(--faint); display: block; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--r-md);
  color: var(--muted); font-weight: 500; font-size: var(--fs-md);
  transition: background var(--dur-fast), color var(--dur-fast); min-height: 40px;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.7); color: var(--text); }
.nav-item.on { background: #fff; color: var(--accent-deep); box-shadow: var(--shadow-1); }
.nav-item svg { width: 19px; height: 19px; flex: none; }
.sidebar .spacer { flex: 1; }
.me-box { padding: 10px; border-top: 1px solid var(--hairline); font-size: var(--fs-xs); color: var(--faint); display: flex; align-items: center; justify-content: space-between; }
.me-box .btn { min-height: 30px; padding: 0 10px; font-size: var(--fs-xs); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: var(--sp-3); gap: var(--sp-3); }
.topbar { display: flex; align-items: center; gap: var(--sp-4); padding: 14px var(--sp-5); }
.topbar h2 { font-family: var(--font-display); font-size: var(--fs-xl); letter-spacing: -0.02em; }
.topbar .desc { color: var(--muted); font-size: var(--fs-sm); margin-top: 1px; }
.topbar .right { margin-left: auto; display: flex; gap: var(--sp-2); align-items: center; }

.content { flex: 1; overflow-y: auto; padding: 4px var(--sp-2) var(--sp-4); scroll-behavior: smooth; }
.content::-webkit-scrollbar, .modal-body::-webkit-scrollbar { width: 8px; }
.content::-webkit-scrollbar-thumb, .modal-body::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.14); border-radius: 4px; }
.view { display: none; }
.view.on { display: block; }

/* ---------- 仪表盘 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-3); }
.stat-card { padding: var(--sp-4) var(--sp-5); border-radius: var(--r-lg); position: relative; overflow: hidden; }
.stat-card .k { font-size: var(--fs-sm); color: var(--muted); font-weight: 500; }
.stat-card .v { font-family: var(--font-display); font-size: 40px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.15; margin-top: 2px; }
.stat-card .ico { position: absolute; right: 14px; top: 14px; width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.stat-card .ico svg { width: 20px; height: 20px; }
.ico-blue { background: var(--accent-soft); color: var(--accent); }
.ico-green { background: var(--ok-soft); color: #1e8e3e; }
.ico-orange { background: var(--warn-soft); color: #b26200; }
.ico-purple { background: rgba(175, 82, 222, 0.14); color: #9333ea; }
.stat-card .sub { font-size: var(--fs-xs); color: var(--faint); margin-top: 2px; }

.panel { padding: var(--sp-5); border-radius: var(--r-lg); }
.panel-head { display: flex; align-items: center; margin-bottom: var(--sp-4); }
.panel-head h3 { font-family: var(--font-display); font-size: var(--fs-lg); letter-spacing: -0.01em; }
.panel-head .more { margin-left: auto; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
@media (max-width: 1100px) { .two-col { grid-template-columns: 1fr; } }

.list-row { display: flex; align-items: center; gap: var(--sp-3); padding: 10px 2px; border-top: 1px solid var(--hairline); font-size: var(--fs-sm); }
.list-row:first-of-type { border-top: none; }
.list-row .t { color: var(--faint); font-size: var(--fs-xs); flex: none; width: 118px; }
.list-row .u { font-weight: 600; }
.list-row .m { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 表格 ---------- */
.table-wrap { padding: var(--sp-2) var(--sp-5) var(--sp-4); border-radius: var(--r-lg); }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
th {
  text-align: left; font-size: var(--fs-xs); color: var(--faint); font-weight: 600;
  padding: 10px 12px; border-bottom: 1px solid var(--hairline); white-space: nowrap; letter-spacing: 0.02em;
}
td { padding: 11px 12px; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--dur-fast); }
tbody tr:hover { background: rgba(255, 255, 255, 0.55); }
td .sub { display: block; font-size: var(--fs-xs); color: var(--faint); margin-top: 1px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.empty { text-align: center; color: var(--faint); padding: var(--sp-7) var(--sp-4); font-size: var(--fs-sm); }
.empty .big { font-size: 34px; margin-bottom: var(--sp-2); opacity: 0.5; }

/* ---------- 工具栏 ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; margin-bottom: var(--sp-3); }
.toolbar .grow { flex: 1; min-width: 150px; max-width: 320px; }
.toolbar select { width: auto; min-width: 130px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 50; display: none;
  align-items: flex-start; justify-content: center; overflow-y: auto; padding: 8vh var(--sp-4) var(--sp-5);
  background: rgba(245, 246, 248, 0.55); backdrop-filter: blur(6px);
}
.modal-mask.show { display: flex; }
.modal {
  width: 560px; max-width: 100%; border-radius: var(--r-xl);
  background: var(--glass-strong); backdrop-filter: blur(36px) saturate(180%);
  border: 1px solid var(--glass-border); box-shadow: var(--shadow-3);
  animation: pop var(--dur-base) var(--ease-out);
}
@keyframes pop { from { opacity: 0; transform: translateY(26px) scale(0.97); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; padding: var(--sp-5) var(--sp-5) 0; }
.modal-head h3 { font-family: var(--font-display); font-size: var(--fs-lg); letter-spacing: -0.01em; }
.modal-close { margin-left: auto; width: 32px; height: 32px; border-radius: 50%; background: var(--gray-tag); color: var(--muted); font-size: 15px; display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: rgba(0, 0, 0, 0.1); }
.modal-body { padding: var(--sp-4) var(--sp-5) var(--sp-3); max-height: 64vh; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: var(--sp-2); padding: var(--sp-4) var(--sp-5) var(--sp-5); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3) var(--sp-4); }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
.fieldset { border: 1px solid var(--hairline); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); margin-top: var(--sp-2); }
.fieldset legend { font-size: var(--fs-xs); color: var(--faint); padding: 0 6px; }
.check-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: 7px 0; }
.check-row .txt { font-size: var(--fs-sm); }
.check-row .txt small { display: block; color: var(--faint); font-size: var(--fs-xs); }
.hint { font-size: var(--fs-xs); color: var(--faint); margin-top: 4px; }
.secret-box { display: flex; gap: var(--sp-2); align-items: center; background: rgba(255, 255, 255, 0.6); border: 1px dashed rgba(0, 0, 0, 0.16); border-radius: var(--r-md); padding: 10px 14px; }
.secret-box code { flex: 1; word-break: break-all; }

/* ---------- Toast ---------- */
#toasts { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 99; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 8px; padding: 10px 20px; border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.82); backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass-border); box-shadow: var(--shadow-2);
  font-size: var(--fs-sm); font-weight: 500; animation: toastIn var(--dur-base) var(--ease-out);
}
.toast.ok svg { color: #1e8e3e; } .toast.err svg { color: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px) scale(0.95); } to { opacity: 1; transform: none; } }

/* ---------- 接入文档页 ---------- */
.doc-layout { display: grid; grid-template-columns: 230px 1fr; gap: var(--sp-3); align-items: start; }
.doc-nav { position: sticky; top: 0; padding: var(--sp-3) 10px; border-radius: var(--r-lg); }
.doc-nav a { display: block; padding: 7px 12px; border-radius: var(--r-sm); color: var(--muted); font-size: var(--fs-sm); text-decoration: none; min-height: 32px; }
.doc-nav a:hover { background: rgba(255, 255, 255, 0.7); color: var(--text); }
.doc-body { min-width: 0; }
.doc-section { margin-bottom: var(--sp-3); border-radius: var(--r-lg); padding: var(--sp-5); }
.doc-section h3 { font-family: var(--font-display); font-size: var(--fs-xl); letter-spacing: -0.02em; margin-bottom: var(--sp-2); scroll-margin-top: var(--sp-3); }
.doc-section h4 { font-size: var(--fs-md); margin: var(--sp-4) 0 6px; }
.doc-section p { color: var(--muted); font-size: var(--fs-sm); margin-bottom: var(--sp-2); }
.doc-section p b, .doc-section li b { color: var(--text); }
.doc-section ul { padding-left: 20px; color: var(--muted); font-size: var(--fs-sm); margin: 6px 0 var(--sp-3); }
.doc-section li { margin-bottom: 4px; }
pre {
  background: rgba(255, 255, 255, 0.68); border: 1px solid var(--hairline); border-radius: var(--r-md);
  padding: 14px 16px; overflow-x: auto; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.65;
  color: #273240; margin: 8px 0 var(--sp-3);
}
pre .cm { color: #8a94a6; } /* 注释 */
code.inline { background: var(--gray-tag); border-radius: 5px; padding: 1px 7px; font-family: var(--font-mono); font-size: 0.88em; color: var(--accent-deep); }
.copy-btn { flex: none; }

/* ---------- 演示客户端 ---------- */
#appView.demo-mode .sidebar { display: none; }

/* ---------- 入场编排 ---------- */
.reveal { opacity: 0; transform: translateY(18px); }
.reveal.in { opacity: 1; transform: none; transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out); }
.reveal:nth-child(2) { transition-delay: 70ms; } .reveal:nth-child(3) { transition-delay: 140ms; } .reveal:nth-child(4) { transition-delay: 210ms; }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  body { overflow: auto; }
  #appView.show { flex-direction: column; }
  .sidebar { width: auto; margin: var(--sp-2); flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sidebar .spacer, .brand span { display: none; }
  .brand { padding: 2px 8px; }
  .nav-item { padding: 7px 10px; }
  .nav-item .txt { display: none; }
  .me-box { border-top: none; padding: 2px 8px; }
  .main { padding: var(--sp-2); }
  .stat-card .v { font-size: 32px; }
  .doc-layout { grid-template-columns: 1fr; }
  .doc-nav { position: static; display: flex; flex-wrap: wrap; gap: 4px; }
}

/* ---------- 降级动效 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  .orb { animation: none; }
}
