/* ---------- 布局骨架 ---------- */
#app { min-height: 100vh; }

.shell {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line-soft);
  background: rgba(12, 18, 20, 0.72);
  backdrop-filter: blur(8px);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 12px;
}
.brand-logo {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(150deg, var(--brand), #0aa0d8);
  display: grid; place-items: center;
  font-weight: 800; color: #04120a; font-size: 15px;
  box-shadow: 0 4px 14px rgba(7,193,96,.3);
}
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: .2px; }
.brand-sub { font-size: 11px; color: var(--text-faint); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: var(--radius-sm);
  color: var(--text-dim); cursor: pointer; user-select: none;
  font-size: 13.5px; border: 1px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.active {
  background: var(--brand-soft); color: #d8ffe9; border-color: rgba(7,193,96,.25);
}
.nav-item .ico { width: 18px; text-align: center; opacity: .9; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.user-card {
  display: flex; align-items: center; gap: 9px;
  padding: 9px; border-radius: var(--radius-sm);
  background: var(--panel); border: 1px solid var(--line-soft);
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(140deg, #1f7a4d, #0b3d6b);
  display: grid; place-items: center; font-weight: 700; font-size: 12px; color: #d6f7e6;
}
.user-meta { min-width: 0; }
.user-email { font-size: 12px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 10.5px; color: var(--text-faint); }

.main { padding: 22px 26px 60px; max-width: 1280px; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-title { font-size: 21px; }
.page-desc { color: var(--text-dim); font-size: 13px; margin-top: 3px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 卡片 ---------- */
.card {
  background: linear-gradient(180deg, var(--panel), #131a1e);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 16px;
}
.card + .card { margin-top: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-title { font-size: 14.5px; font-weight: 650; }
.card-sub { font-size: 12px; color: var(--text-faint); }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.stat { padding: 14px 16px; }
.stat-label { font-size: 12px; color: var(--text-faint); }
.stat-value { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; }
.stat-hint { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }

/* ---------- 按钮 ---------- */
.btn {
  appearance: none; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text);
  padding: 8px 14px; border-radius: var(--radius-sm);
  font-size: 13px; font-family: inherit; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  transition: background .15s, border-color .15s, transform .06s;
  white-space: nowrap;
}
.btn:hover { background: #202c33; border-color: #2d3d47; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #04170d; font-weight: 650; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--danger); border-color: rgba(255,92,92,.35); background: var(--danger-soft); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 13px; }
.label { font-size: 12.5px; color: var(--text-dim); font-weight: 550; }
.hint { font-size: 11.5px; color: var(--text-faint); }
input[type="text"], input[type="password"], input[type="email"], input[type="number"], select, textarea {
  width: 100%; background: #0e1417; color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 9px 11px; font-size: 13px; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: rgba(7,193,96,.55);
  box-shadow: 0 0 0 3px rgba(7,193,96,.12);
}
textarea { resize: vertical; min-height: 76px; line-height: 1.55; }
input::placeholder, textarea::placeholder { color: #4d5d66; }

.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- 徽标 / 状态 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; border: 1px solid transparent;
  white-space: nowrap;
}
.badge-ok { background: var(--brand-soft); color: #5fe39a; border-color: rgba(7,193,96,.3); }
.badge-err { background: var(--danger-soft); color: #ff8f8f; border-color: rgba(255,92,92,.3); }
.badge-warn { background: rgba(240,169,59,.12); color: #f5c070; border-color: rgba(240,169,59,.3); }
.badge-mute { background: #1b2429; color: var(--text-faint); border-color: var(--line); }
.badge-info { background: rgba(74,168,255,.12); color: #8cc9ff; border-color: rgba(74,168,255,.3); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px rgba(7,193,96,.15); }
.dot-err { background: var(--danger); box-shadow: 0 0 0 3px rgba(255,92,92,.15); }
.dot-warn { background: var(--warn); box-shadow: 0 0 0 3px rgba(240,169,59,.15); }
.dot-mute { background: #4d5d66; box-shadow: none; }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-weight: 600; color: var(--text-faint);
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  padding: 8px 10px; border-bottom: 1px solid var(--line-soft);
}
.table td { padding: 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tr:hover td { background: rgba(255,255,255,.018); }
.table tr:last-child td { border-bottom: none; }

/* ---------- 代码块 ---------- */
pre.code {
  background: #0a1013; border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 12px 13px;
  overflow: auto; font-size: 12.2px; line-height: 1.6; margin: 0;
  color: #c8d6dc; max-height: 380px;
}
.code-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; }

/* ---------- 空状态 / 加载 ---------- */
.empty {
  text-align: center; padding: 34px 18px; color: var(--text-faint);
  border: 1px dashed var(--line); border-radius: var(--radius); font-size: 13px;
}
.spinner {
  width: 15px; height: 15px; border: 2px solid rgba(7,193,96,.25);
  border-top-color: var(--brand); border-radius: 50%;
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 提示条 ---------- */
.toast-wrap {
  position: fixed; right: 18px; bottom: 18px; z-index: 1000;
  display: flex; flex-direction: column; gap: 9px; max-width: 380px;
}
.toast {
  background: #16232a; border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius-sm); padding: 11px 14px;
  font-size: 13px; box-shadow: var(--shadow);
  animation: slideIn .18s ease-out;
}
.toast-err { border-left-color: var(--danger); }
@keyframes slideIn { from { opacity: 0; transform: translateY(8px); } }

.banner {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: rgba(74,168,255,.08); border: 1px solid rgba(74,168,255,.22);
  font-size: 12.8px; color: #b9dcff; margin-bottom: 14px;
}
.banner-warn { background: rgba(240,169,59,.08); border-color: rgba(240,169,59,.25); color: #ffdba8; }

/* ---------- 登录页 ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card {
  width: 100%; max-width: 400px; background: linear-gradient(180deg, var(--panel), #121a1e);
  border: 1px solid var(--line-soft); border-radius: 16px;
  padding: 26px; box-shadow: var(--shadow);
}
.auth-head { text-align: center; margin-bottom: 20px; }
.auth-head .brand-logo { margin: 0 auto 12px; width: 42px; height: 42px; font-size: 18px; border-radius: 12px; }
.auth-title { font-size: 19px; }
.auth-sub { font-size: 12.5px; color: var(--text-dim); margin-top: 4px; }
.auth-switch { text-align: center; margin-top: 14px; font-size: 12.5px; color: var(--text-dim); }

/* ---------- 二维码 ---------- */
.qr-box {
  background: #fff; padding: 12px; border-radius: 12px;
  display: inline-block; line-height: 0;
  box-shadow: 0 8px 26px rgba(0,0,0,.4);
}
.qr-box img { width: 240px; height: 240px; image-rendering: pixelated; }

/* ---------- 对话气泡 ---------- */
.chat-list { display: flex; flex-direction: column; gap: 10px; }
.bubble {
  max-width: 76%; padding: 9px 13px; border-radius: 14px;
  font-size: 13.4px; line-height: 1.6; white-space: pre-wrap; word-break: break-word;
}
.bubble-user { align-self: flex-end; background: var(--brand-soft); border: 1px solid rgba(7,193,96,.25); border-bottom-right-radius: 4px; }
.bubble-assistant { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--line-soft); border-bottom-left-radius: 4px; }
.bubble-time { font-size: 10.5px; color: var(--text-faint); margin-top: 4px; }

/* ---------- 步骤条 ---------- */
.steps { display: flex; flex-direction: column; gap: 0; counter-reset: step; }
.step { display: flex; gap: 13px; padding-bottom: 20px; position: relative; }
.step:not(:last-child)::before {
  content: ""; position: absolute; left: 13px; top: 30px; bottom: 0;
  width: 1px; background: var(--line);
}
.step-num {
  width: 27px; height: 27px; border-radius: 50%; flex: 0 0 27px;
  background: var(--panel-2); border: 1px solid var(--line);
  display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--text-dim);
  position: relative; z-index: 1;
}
.step.done .step-num { background: var(--brand); border-color: var(--brand); color: #04170d; }
.step.active .step-num { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 3px rgba(7,193,96,.14); }
.step-body { flex: 1; min-width: 0; padding-top: 3px; }
.step-title { font-size: 13.5px; font-weight: 600; }
.step-desc { font-size: 12.5px; color: var(--text-dim); margin: 3px 0 9px; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto; flex-direction: row; align-items: center;
    overflow-x: auto; padding: 10px 12px; gap: 12px;
  }
  .brand { padding: 0; }
  .brand-sub { display: none; }
  .nav { flex-direction: row; }
  .nav-item span:not(.ico) { display: none; }
  .sidebar-foot { margin: 0; flex-direction: row; }
  .user-card { display: none; }
  .main { padding: 16px 14px 50px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .row { flex-direction: column; }
}
