/* ============================================================
   CipherVault · 控制台样式
   美学方向: 蓝白简约 — 纯白底 + 海军蓝主色 + 浅灰边框 + 微阴影
   字体: Outfit (UI/标题) + JetBrains Mono (数据)
   ============================================================ */

:root {
  /* 背景 */
  --bg: #f5f7fb;
  --bg-2: #eef2f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --surface-hi: #e2e8f0;

  /* 边框 */
  --border: #e6ebf2;
  --border-2: #d8dfe9;
  --border-strong: #c3cdd9;

  /* 文字 */
  --text: #1a2233;
  --text-2: #4a5468;
  --text-3: #7a8499;
  --text-4: #a3abbb;

  /* 主色 — 海军蓝 */
  --blue: #2563eb;
  --blue-2: #3b82f6;
  --blue-3: #60a5fa;
  --blue-dim: #1d4ed8;
  --blue-soft: #eff5ff;
  --blue-glow: rgba(37, 99, 235, 0.12);

  /* 状态 */
  --green: #16a34a;
  --green-soft: #ecfdf5;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --violet: #7c3aed;
  --cyan: #0891b2;

  /* 尺寸 */
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --sidebar-w: 240px;

  /* 阴影 */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12), 0 4px 8px rgba(15, 23, 42, 0.06);

  /* 字体 */
  --f-mono: 'JetBrains Mono', 'Consolas', monospace;
  --f-body: 'Outfit', system-ui, -apple-system, sans-serif;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
.mono { font-family: var(--f-mono); }

#app { position: relative; height: 100vh; width: 100vw; overflow: hidden; }

/* ===== 背景层 ===== */
.bg-grid {
  position: fixed; inset: 0;
  background-image:
    linear-gradient(rgba(37, 99, 235, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 99, 235, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
  mask-image: radial-gradient(ellipse 120% 90% at 50% 30%, #000 30%, transparent 80%);
}
.bg-glow {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse 60% 50% at 15% 0%, rgba(37, 99, 235, 0.07), transparent 60%),
    radial-gradient(ellipse 50% 45% at 100% 100%, rgba(96, 165, 250, 0.06), transparent 60%);
}
.bg-noise { display: none; }

.view { position: relative; z-index: 1; height: 100vh; }

/* 关键: [hidden] 属性必须始终生效, 防止 display 规则覆盖导致视图不隐藏 */
[hidden] { display: none !important; }

/* ============================================================
   登录视图
   ============================================================ */
.view-login {
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-wrap {
  position: relative;
  width: 100%; max-width: 420px;
  animation: rise 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.scanlines { display: none; }

.login-brand {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 24px;
  padding-left: 2px;
}
.vault-mark { color: var(--blue); }
.vault-mark.sm { color: var(--blue); }
.brand-name {
  font-weight: 600; font-size: 20px;
  letter-spacing: -0.01em;
  color: var(--text);
}
.brand-name.sm { font-size: 15px; }
.brand-tag {
  font-family: var(--f-mono);
  font-size: 9px; letter-spacing: 0.22em;
  color: var(--text-3);
  margin-top: 2px;
}
.brand-tag.sm { font-size: 8px; }

.login-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 30px 26px;
  box-shadow: var(--shadow-lg);
}
.card-corner { display: none; }

.login-title {
  font-weight: 600; font-size: 22px;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.login-sub {
  color: var(--text-3); font-size: 13px;
  margin-bottom: 24px;
}

.login-form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-family: var(--f-mono);
  font-size: 10.5px; letter-spacing: 0.12em;
  color: var(--text-3); text-transform: uppercase;
}
.field input, .field select, .field textarea {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.field input::placeholder { color: var(--text-4); }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-glow);
}

/* ===== 按钮 ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500;
  transition: all 0.15s;
  white-space: nowrap;
  border: 1px solid transparent;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-primary {
  background: var(--blue);
  color: #fff;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover:not(:disabled) {
  background: var(--blue-dim);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-2);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface-3);
  border-color: var(--border-strong);
}
.btn-danger {
  background: var(--surface);
  color: var(--red);
  border-color: rgba(220, 38, 38, 0.25);
}
.btn-danger:hover:not(:disabled) {
  background: var(--red-soft);
  border-color: rgba(220, 38, 38, 0.4);
}
.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 12.5px;
  transition: all 0.15s;
}
.btn-ghost:hover { color: var(--text); background: var(--surface-3); }
.btn-sm { padding: 6px 11px; font-size: 12px; }

.login-error {
  margin-top: 4px;
  padding: 9px 12px;
  background: var(--red-soft);
  border: 1px solid rgba(220, 38, 38, 0.2);
  border-radius: var(--radius-sm);
  color: var(--red);
  font-size: 12.5px;
}

.setup-success {
  margin-top: 4px;
  padding: 12px;
  background: var(--green-soft);
  border: 1px solid rgba(22, 163, 74, 0.25);
  border-radius: var(--radius-sm);
  color: var(--green);
  font-size: 12.5px;
  line-height: 1.6;
}
.setup-success .cred-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 4px;
  font-family: var(--f-mono);
  font-size: 12px;
}
.setup-success .cred-row .label { color: var(--text-3); }
.setup-success .cred-row .val { color: var(--text); font-weight: 600; }

.login-foot {
  margin-top: 22px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 10px; letter-spacing: 0.18em;
  color: var(--text-4);
}
.login-foot .dot { color: var(--text-4); }

/* ============================================================
   主控台布局
   ============================================================ */
.view-app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
}

/* ===== 侧边栏 ===== */
.sidebar {
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 10;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 20px 18px 18px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand .vault-mark { color: var(--blue); }

.nav {
  flex: 1;
  padding: 14px 10px;
  display: flex; flex-direction: column; gap: 3px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13.5px; font-weight: 500;
  position: relative;
  transition: all 0.15s;
}
.nav-item svg { color: var(--text-3); transition: color 0.15s; flex-shrink: 0; }
.nav-item:hover { color: var(--text); background: var(--surface-3); }
.nav-item:hover svg { color: var(--text-2); }
.nav-item.active {
  color: var(--blue);
  background: var(--blue-soft);
}
.nav-item.active svg { color: var(--blue); }

.sidebar-foot {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 8px;
}
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
}
.user-avatar {
  width: 30px; height: 30px;
  border-radius: 7px;
  background: var(--blue);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
  flex-shrink: 0;
}
.user-meta { min-width: 0; }
.user-name { font-size: 13px; font-weight: 500; color: var(--text); }
.user-role {
  font-family: var(--f-mono);
  font-size: 9px; letter-spacing: 0.1em;
  color: var(--text-3); text-transform: uppercase;
}
.sidebar-foot .btn-ghost { justify-content: flex-start; width: 100%; color: var(--text-3); }
.sidebar-foot .btn-ghost:hover { color: var(--red); background: var(--red-soft); }

/* ===== 主内容 ===== */
.main {
  display: flex; flex-direction: column;
  min-width: 0; height: 100vh;
  overflow: hidden;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.crumb { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
.crumb-sub { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.2em; color: var(--text-3); margin-top: 2px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.server-time { font-family: var(--f-mono); font-size: 12px; color: var(--text-2); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.status-dot.live { box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.18); animation: pulse 2s infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.status-text { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.15em; color: var(--green); }

.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  background: var(--bg);
}
.content::-webkit-scrollbar { width: 10px; }
.content::-webkit-scrollbar-track { background: transparent; }
.content::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; border: 2px solid var(--bg); }
.content::-webkit-scrollbar-thumb:hover { background: var(--text-4); }

/* ===== 通用卡片 ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  position: relative;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 14px; font-weight: 600; letter-spacing: -0.005em; color: var(--text); }
.card-title-row { display: flex; align-items: center; gap: 10px; }
.card-title-sub { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.15em; color: var(--text-3); text-transform: uppercase; }
.card-body { padding: 18px; }

/* ============================================================
   概览视图
   ============================================================ */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 17px 18px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  box-shadow: var(--shadow-sm);
}
.stat-card:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--accent, var(--blue));
  opacity: 0.85;
}
.stat-label {
  font-family: var(--f-mono);
  font-size: 10px; letter-spacing: 0.16em;
  color: var(--text-3); text-transform: uppercase;
  margin-bottom: 10px;
}
.stat-value {
  font-weight: 600; font-size: 30px;
  line-height: 1; letter-spacing: -0.02em;
  color: var(--text);
}
.stat-value .unit { font-size: 13px; color: var(--text-3); margin-left: 4px; font-weight: 400; }
.stat-foot {
  margin-top: 9px;
  font-size: 11.5px; color: var(--text-3);
  display: flex; align-items: center; gap: 6px;
}
.stat-card.accent-blue { --accent: var(--blue); }
.stat-card.accent-blue .stat-value { color: var(--blue); }
.stat-card.accent-cyan { --accent: var(--cyan); }
.stat-card.accent-cyan .stat-value { color: var(--cyan); }
.stat-card.accent-green { --accent: var(--green); }
.stat-card.accent-green .stat-value { color: var(--green); }
.stat-card.accent-violet { --accent: var(--violet); }
.stat-card.accent-violet .stat-value { color: var(--violet); }
.stat-card.accent-amber { --accent: var(--amber); }
.stat-card.accent-amber .stat-value { color: var(--amber); }

.overview-row {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 14px;
}
.trend-chart { height: 240px; display: flex; flex-direction: column; }
.chart-area { flex: 1; position: relative; padding: 8px 0; }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl thead th {
  text-align: left;
  padding: 11px 14px;
  font-family: var(--f-mono);
  font-size: 10px; letter-spacing: 0.14em;
  color: var(--text-3); text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
  white-space: nowrap;
  background: var(--surface-2);
}
table.tbl tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  vertical-align: middle;
}
table.tbl tbody tr { transition: background 0.12s; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl .cell-strong { color: var(--text); font-weight: 500; }
table.tbl .cell-mono { font-family: var(--f-mono); font-size: 12px; }
table.tbl .cell-num { font-family: var(--f-mono); font-weight: 500; color: var(--text); text-align: right; }

/* ===== 徽章 / 状态 ===== */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: var(--f-mono);
  font-size: 10px; font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid;
}
.badge::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%;
  background: currentColor;
}
.badge-unused { color: var(--text-3); border-color: var(--border-2); background: var(--surface-3); }
.badge-active { color: var(--green); border-color: rgba(22, 163, 74, 0.25); background: var(--green-soft); }
.badge-expired { color: var(--text-3); border-color: var(--border-2); background: var(--surface-3); }
.badge-banned { color: var(--red); border-color: rgba(220, 38, 38, 0.25); background: var(--red-soft); }
.badge-perm { color: var(--violet); border-color: rgba(124, 58, 237, 0.25); background: #f5f3ff; }
.badge-timed { color: var(--cyan); border-color: rgba(8, 145, 178, 0.25); background: #ecfeff; }
.badge-count { color: var(--amber); border-color: rgba(217, 119, 6, 0.25); background: var(--amber-soft); }
.badge-ct { color: var(--blue, #2563eb); border-color: rgba(37, 99, 235, 0.25); background: #eff6ff; }

/* ===== 工具栏 ===== */
.toolbar {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.toolbar .spacer { flex: 1; }
.input-search {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: 8px 12px 8px 32px;
  font-size: 13px;
  width: 240px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%237a8499' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.3-4.3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 11px center;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input-search:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-glow); }
.input-search::placeholder { color: var(--text-4); }

.select {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: 8px 28px 8px 12px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%237a8499' stroke-width='2'%3E%3Cpath d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-glow); }

/* ===== 分页 ===== */
.pager {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 4px 0;
  font-size: 12px;
  color: var(--text-3);
}
.pager-info { font-family: var(--f-mono); }
.pager-btns { display: flex; gap: 6px; }
.pager-btn {
  padding: 6px 11px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12px;
  transition: all 0.15s;
}
.pager-btn:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
.pager-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================================
   模态框
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  animation: fadein 0.18s ease;
  padding: 24px;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalin 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes modalin {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal.lg { max-width: 720px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 17px 22px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 15px; font-weight: 600; color: var(--text); }
.modal-title-row { display: flex; align-items: center; gap: 10px; }
.modal-close {
  width: 28px; height: 28px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
  transition: all 0.15s;
}
.modal-close:hover { color: var(--text); background: var(--surface-3); }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 15px 22px;
  border-top: 1px solid var(--border);
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.form-field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.form-field .field-label { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.12em; color: var(--text-3); text-transform: uppercase; }
.form-field input, .form-field select, .form-field textarea {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13.5px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-glow);
}
.form-field .hint { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.form-field textarea { resize: vertical; min-height: 70px; font-family: var(--f-mono); }

/* 卡密生成结果展示 */
.gen-result {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  max-height: 320px;
  overflow-y: auto;
}
.gen-result .key-line {
  font-family: var(--f-mono);
  font-size: 12.5px;
  color: var(--blue);
  padding: 4px 0;
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--border);
}
.gen-result .key-line:last-child { border-bottom: none; }
.gen-result .key-line .idx { color: var(--text-4); width: 32px; flex-shrink: 0; }
.gen-result .key-line .copy-btn {
  margin-left: auto;
  color: var(--text-3);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  transition: color 0.15s;
}
.gen-result .key-line .copy-btn:hover { color: var(--blue); }

/* 应用密钥展示 */
.secret-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  display: flex; align-items: center; gap: 10px;
}
.secret-box .val { font-family: var(--f-mono); font-size: 12px; color: var(--cyan); flex: 1; word-break: break-all; }
.secret-box .label { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.12em; color: var(--text-3); text-transform: uppercase; }
.icon-btn {
  padding: 5px 8px;
  border-radius: 5px;
  color: var(--text-3);
  font-size: 11px;
  display: inline-flex; align-items: center; gap: 5px;
  transition: all 0.15s;
}
.icon-btn:hover { color: var(--blue); background: var(--blue-soft); }
.icon-btn.danger { color: var(--red); }
.icon-btn.danger:hover { background: var(--red-soft); }

/* ===== Toast ===== */
.toast-host {
  position: fixed; top: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 200;
  pointer-events: none;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  font-size: 13px;
  color: var(--text);
  min-width: 240px;
  max-width: 360px;
  box-shadow: var(--shadow-lg);
  animation: toastin 0.25s cubic-bezier(0.2,0.8,0.2,1);
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--amber); }
@keyframes toastin {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
.toast.leaving { animation: toastout 0.2s ease forwards; }
@keyframes toastout {
  to { opacity: 0; transform: translateX(20px); }
}

/* ===== 空状态 ===== */
.empty {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-3);
}
.empty .empty-icon {
  width: 48px; height: 48px;
  margin: 0 auto 14px;
  color: var(--text-4);
  opacity: 0.6;
}
.empty .empty-title { font-size: 14px; color: var(--text-2); margin-bottom: 4px; }
.empty .empty-sub { font-size: 12px; color: var(--text-3); }

/* ===== 加载 ===== */
.loading-row { display: flex; align-items: center; justify-content: center; padding: 40px; color: var(--text-3); gap: 10px; }
.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--surface-hi);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 抽屉 (卡密/文件详情) ===== */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 90;
  animation: fadein 0.18s ease;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 460px; max-width: 90vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 91;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: drawerin 0.25s cubic-bezier(0.2,0.8,0.2,1);
}
@keyframes drawerin {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
.drawer-head {
  padding: 17px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px; }
.detail-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.detail-row:last-child { border-bottom: none; }
.detail-row .k { color: var(--text-3); font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.detail-row .v { color: var(--text); font-weight: 500; text-align: right; word-break: break-all; }
.detail-row .v.mono { font-family: var(--f-mono); font-size: 12px; font-weight: 400; }
.detail-section { margin-top: 22px; }
.detail-section-title {
  font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.16em;
  color: var(--text-3); text-transform: uppercase;
  margin-bottom: 8px;
}
.device-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
  font-size: 12px;
}
.device-item .hwid { font-family: var(--f-mono); color: var(--cyan); word-break: break-all; }
.device-item .meta { color: var(--text-3); font-size: 11px; margin-top: 4px; }
.device-item.online { border-color: rgba(22, 163, 74, 0.3); background: var(--green-soft); }
.device-item.online .hwid { color: var(--green); }

/* ===== 接口文档 / 错误码 ===== */
.doc-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.doc-tab {
  padding: 8px 16px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-3); font-size: 13px; cursor: pointer; transition: all 0.15s;
}
.doc-tab:hover { color: var(--text); border-color: var(--blue); }
.doc-tab.active { background: var(--blue-soft); color: var(--blue); border-color: var(--blue); }
.doc-panel { display: none; }
.doc-panel.active { display: block; }

.doc-section { margin-bottom: 24px; }
.doc-section-title {
  font-size: 13px; font-weight: 600; color: var(--text);
  margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.doc-section-subtitle { font-size: 11px; color: var(--text-3); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.08em; }
.doc-baseurl {
  font-family: var(--f-mono); font-size: 13px; color: var(--cyan);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 14px;
}
.doc-list { display: flex; flex-direction: column; gap: 14px; }
.doc-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.doc-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.doc-method {
  font-family: var(--f-mono); font-size: 11px; font-weight: 700;
  padding: 3px 7px; border-radius: 4px; text-transform: uppercase;
}
.doc-method.get { background: var(--green-soft); color: var(--green); }
.doc-method.post { background: var(--blue-soft); color: var(--blue); }
.doc-method.put { background: var(--amber-soft); color: var(--amber); }
.doc-method.delete { background: var(--red-soft); color: var(--red); }
.doc-path {
  font-family: var(--f-mono); font-size: 13px; color: var(--text);
  background: var(--surface-2); padding: 4px 8px; border-radius: 4px;
}
.doc-auth {
  font-size: 11px; color: var(--violet); background: rgba(124, 58, 237, 0.08);
  padding: 3px 8px; border-radius: 4px; border: 1px solid rgba(124, 58, 237, 0.18);
}
.doc-auth.public { color: var(--text-3); background: var(--surface-2); border-color: var(--border); }
.doc-desc { font-size: 13px; color: var(--text-2); margin-bottom: 10px; }
.doc-note {
  font-size: 12px; color: var(--amber); background: var(--amber-soft);
  border: 1px solid rgba(245, 179, 66, 0.2); border-radius: var(--radius-sm);
  padding: 8px 12px; margin-bottom: 12px;
}
.doc-block { margin-top: 10px; }
.doc-label {
  display: inline-block; font-size: 10px; font-weight: 600;
  color: var(--text-3); text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 6px;
}
.doc-block pre {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px;
  font-family: var(--f-mono); font-size: 12px; color: var(--text-2);
  overflow-x: auto; white-space: pre-wrap; word-break: break-all;
  margin: 0;
}

/* ===== 标签页 ===== */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tab {
  padding: 9px 14px;
  font-size: 13px;
  color: var(--text-3);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s;
  font-weight: 500;
}
.tab:hover { color: var(--text-2); }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); }

/* ===== 文件相关 ===== */
.file-icon {
  width: 30px; height: 30px;
  border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.file-icon.blue { background: var(--blue-soft); color: var(--blue); }
.file-icon.green { background: var(--green-soft); color: var(--green); }
.file-icon.amber { background: var(--amber-soft); color: var(--amber); }
.file-icon.violet { background: #f5f3ff; color: var(--violet); }
.file-icon.cyan { background: #ecfeff; color: var(--cyan); }
.file-name { font-weight: 500; color: var(--text); }
.file-meta { font-size: 11px; color: var(--text-3); margin-top: 2px; }

.upload-zone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  transition: all 0.2s;
  background: var(--surface-2);
  cursor: pointer;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--blue);
  background: var(--blue-soft);
}
.upload-zone .up-icon {
  width: 40px; height: 40px;
  margin: 0 auto 10px;
  color: var(--text-3);
}
.upload-zone:hover .up-icon, .upload-zone.dragover .up-icon { color: var(--blue); }
.upload-zone .up-title { font-size: 13.5px; color: var(--text); font-weight: 500; margin-bottom: 4px; }
.upload-zone .up-sub { font-size: 11.5px; color: var(--text-3); }
.upload-zone input[type=file] { display: none; }

.upload-progress {
  height: 6px;
  background: var(--surface-hi);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 10px;
}
.upload-progress-bar {
  height: 100%;
  background: var(--blue);
  border-radius: 3px;
  transition: width 0.2s;
}

/* ===== 响应式 ===== */
@media (max-width: 1100px) {
  .overview-grid { grid-template-columns: repeat(2, 1fr); }
  .overview-row { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .view-app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .content { padding: 18px; }
  .overview-grid { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .input-search { width: 100%; }
}

/* 入场动画 */
.fade-in { animation: fadein 0.3s ease; }
.stagger > * { animation: rise 0.4s cubic-bezier(0.2,0.8,0.2,1) both; }
.stagger > *:nth-child(1) { animation-delay: 0.02s; }
.stagger > *:nth-child(2) { animation-delay: 0.06s; }
.stagger > *:nth-child(3) { animation-delay: 0.10s; }
.stagger > *:nth-child(4) { animation-delay: 0.14s; }
.stagger > *:nth-child(5) { animation-delay: 0.18s; }
.stagger > *:nth-child(6) { animation-delay: 0.22s; }

/* 切换开关 */
.switch { position: relative; display: inline-block; width: 38px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--surface-hi);
  border-radius: 22px;
  transition: 0.2s;
}
.switch .slider::before {
  content: ''; position: absolute;
  height: 16px; width: 16px; left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.switch input:checked + .slider { background: var(--blue); }
.switch input:checked + .slider::before { transform: translateX(16px); }
