/* ===========================================================
   APEX 控制台 · 视觉系统
   深空玻璃拟态 + 双色渐变（靛紫 → 青蓝）+ 细密发光边
   =========================================================== */
:root {
  --bg: #06080f;
  --bg-2: #0a0e1a;
  --panel: var(--w26);
  --panel-2: var(--w38);
  --line: var(--w42);
  --line-strong: var(--w64);
  --txt: #eef1f9;
  --dim: #8d96b2;
  --dim-2: #5f6884;
  --a1: #6d5efc;
  --a2: #22d3ee;
  --a3: #f472b6;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #fb7185;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --shadow: 0 30px 80px -34px rgba(0, 0, 0, 0.9);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--txt);
  background:
    radial-gradient(1100px 620px at 12% -8%, rgba(109, 94, 252, 0.22), transparent 60%),
    radial-gradient(900px 560px at 92% 4%, rgba(34, 211, 238, 0.15), transparent 62%),
    radial-gradient(700px 500px at 50% 110%, rgba(244, 114, 182, 0.08), transparent 65%),
    linear-gradient(180deg, var(--bg-2), var(--bg) 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}
.hidden { display: none !important; }
a { color: inherit; text-decoration: none; }
.muted { color: var(--dim); }
.tiny { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* ---------------- 通用材质 ---------------- */
.glass {
  position: relative;
  background: linear-gradient(180deg, var(--w30), var(--w12));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  backdrop-filter: blur(18px) saturate(140%);
  box-shadow: var(--shadow), inset 0 1px 0 var(--w32);
}
.glass::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, var(--w80), transparent 35%, transparent 70%, rgba(109, 94, 252, 0.35));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.5;
}

/* ---------------- 登录 ---------------- */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.orb {
  position: absolute;
  width: 520px; height: 520px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.45;
  animation: float 18s ease-in-out infinite alternate;
}
.orb-a { background: #6d5efc; top: -160px; left: -120px; }
.orb-b { background: #22d3ee; bottom: -200px; right: -140px; animation-delay: -6s; }
@keyframes float {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(40px, 50px, 0) scale(1.12); }
}
.login-card {
  width: min(400px, 100%);
  padding: 34px 30px 26px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 1;
}
.login-card h1 { margin: 6px 0 0; font-size: 22px; letter-spacing: 0.4px; }
.login-card p { margin: 0; }
.brand-mark {
  width: 54px; height: 54px;
  border-radius: 17px;
  display: grid; place-items: center;
  font-size: 26px; font-weight: 700;
  background: linear-gradient(140deg, var(--a1), var(--a2));
  box-shadow: 0 18px 40px -14px rgba(109, 94, 252, 0.9), inset 0 1px 0 var(--w90);
  color: #fff;
}
.brand-mark.sm { width: 38px; height: 38px; border-radius: 12px; font-size: 18px; }

/* ---------------- 表单 ---------------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.field > span { font-size: 12px; color: var(--dim); letter-spacing: 0.3px; }
input, textarea, select {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--txt);
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
input:focus, textarea:focus, select:focus {
  border-color: rgba(109, 94, 252, 0.7);
  box-shadow: 0 0 0 3px rgba(109, 94, 252, 0.16);
  background: var(--input-bg-focus);
}
textarea { resize: vertical; min-height: 96px; line-height: 1.6; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%), linear-gradient(135deg, var(--dim) 50%, transparent 50%); background-position: calc(100% - 18px) 18px, calc(100% - 13px) 18px; background-size: 5px 5px; background-repeat: no-repeat; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--w28);
  color: var(--txt);
  font-family: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: transform 0.12s, background 0.18s, border-color 0.18s, box-shadow 0.18s;
  white-space: nowrap;
}
.btn:hover { background: var(--w50); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(135deg, var(--a1), #4f46e5 55%, var(--a2));
  border: none;
  color: #fff;
  box-shadow: 0 14px 30px -14px rgba(109, 94, 252, 0.9);
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: #ffd9df; border-color: rgba(251, 113, 133, 0.35); background: rgba(251, 113, 133, 0.12); }
.btn.danger:hover { background: rgba(251, 113, 133, 0.2); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 11px; font-size: 12px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--w24);
  color: var(--dim); cursor: pointer; font-size: 13px; line-height: 1;
}
.icon-btn:hover { color: var(--txt); border-color: var(--line-strong); }

/* ---------------- 布局 ---------------- */
.shell { display: grid; grid-template-columns: 246px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 18px;
  padding: 22px 16px 18px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, var(--w22), var(--w06));
  backdrop-filter: blur(14px);
}
.logo { display: flex; align-items: center; gap: 11px; padding: 4px 6px 2px; }
.logo strong { display: block; font-size: 15px; letter-spacing: 3px; }
.logo small { color: var(--dim-2); font-size: 10.5px; letter-spacing: 2px; }

#nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  border-radius: 11px;
  color: var(--dim);
  font-size: 13.2px;
  cursor: pointer;
  transition: color 0.16s, background 0.16s;
  position: relative;
}
.nav-item i { font-style: normal; font-size: 13px; width: 16px; text-align: center; opacity: 0.9; }
.nav-item:hover { color: var(--txt); background: var(--w26); }
.nav-item.active {
  color: #fff;
  background: linear-gradient(100deg, rgba(109, 94, 252, 0.26), rgba(34, 211, 238, 0.08));
  box-shadow: inset 0 0 0 1px rgba(109, 94, 252, 0.32);
}
.nav-item.active::before {
  content: ""; position: absolute; left: -16px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 3px;
  background: linear-gradient(180deg, var(--a1), var(--a2));
}
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.status-line { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--dim); padding: 0 4px; }
.pulse {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6);
  animation: pulse 2.4s infinite;
}
.pulse.off { background: var(--bad); animation: none; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5); }
  70% { box-shadow: 0 0 0 9px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 26px;
  border-bottom: 1px solid var(--line);
  background: var(--topbar-bg);
  backdrop-filter: blur(16px);
}
.topbar h2 { margin: 0 0 2px; font-size: 17px; letter-spacing: 0.3px; }
.topbar p { margin: 0; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.search { display: flex; gap: 8px; }
.search input { width: 230px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600; letter-spacing: 0.5px;
  background: linear-gradient(140deg, rgba(109, 94, 252, 0.9), rgba(34, 211, 238, 0.75));
  color: #fff;
}

.view { padding: 22px 26px 60px; display: flex; flex-direction: column; gap: 18px; }

/* ---------------- 卡片 / 网格 ---------------- */
.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.main-side { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }

.card { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h3 { margin: 0; font-size: 14px; letter-spacing: 0.4px; font-weight: 600; }
.card-head .sub { color: var(--dim-2); font-size: 12px; }

.stat { padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
.stat .label { color: var(--dim); font-size: 12px; letter-spacing: 0.6px; display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 26px; font-weight: 650; letter-spacing: -0.4px; font-variant-numeric: tabular-nums; }
.stat .delta { font-size: 12px; color: var(--dim-2); }
.stat .spark { position: absolute; right: 0; bottom: 0; width: 100%; height: 58px; opacity: 0.5; pointer-events: none; }
.stat.hero {
  background: linear-gradient(135deg, rgba(109, 94, 252, 0.28), rgba(34, 211, 238, 0.1) 70%, var(--w18));
}
.stat.hero .value { background: linear-gradient(120deg, #fff, #b9c7ff); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; border-radius: var(--r-md); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; padding: 10px 12px;
  color: var(--dim-2); font-weight: 500; font-size: 11.5px;
  letter-spacing: 0.7px; text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td { padding: 12px; border-bottom: 1px solid var(--w26); vertical-align: middle; }
tbody tr { transition: background 0.14s; }
tbody tr:hover { background: var(--w22); }
tbody tr:last-child td { border-bottom: none; }
td .title { font-weight: 550; }
td .sub { color: var(--dim-2); font-size: 11.5px; margin-top: 2px; }
td.right, th.right { text-align: right; }
.actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------------- 标记 ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 500; letter-spacing: 0.2px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge.ok { color: #a7f3d0; background: rgba(52, 211, 153, 0.14); border-color: rgba(52, 211, 153, 0.28); }
.badge.warn { color: #fde68a; background: rgba(251, 191, 36, 0.14); border-color: rgba(251, 191, 36, 0.3); }
.badge.bad { color: #fecdd3; background: rgba(251, 113, 133, 0.14); border-color: rgba(251, 113, 133, 0.3); }
.badge.info { color: #bae6fd; background: rgba(34, 211, 238, 0.12); border-color: rgba(34, 211, 238, 0.28); }
.badge.mute { color: var(--dim); background: var(--w32); border-color: var(--line); }
.badge.violet { color: #ddd6fe; background: rgba(109, 94, 252, 0.18); border-color: rgba(109, 94, 252, 0.35); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--w24);
  color: var(--dim); font-size: 12.5px; cursor: pointer;
  transition: all 0.16s;
}
.chip:hover { color: var(--txt); border-color: var(--line-strong); }
.chip.active { color: #fff; background: rgba(109, 94, 252, 0.24); border-color: rgba(109, 94, 252, 0.55); }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar .grow { flex: 1; min-width: 160px; }

/* ---------------- 列表 ---------------- */
.list { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 2px;
  border-bottom: 1px solid var(--w26);
}
.list-row:last-child { border-bottom: none; }
.list-row .idx {
  width: 24px; height: 24px; border-radius: 8px; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 11px; color: var(--dim);
  background: var(--w32);
}
.list-row .grow { flex: 1; min-width: 0; }
.list-row .grow .title { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .grow .sub { font-size: 11.5px; color: var(--dim-2); margin-top: 2px; }
.list-row .amount { font-variant-numeric: tabular-nums; font-weight: 600; }

.progress { height: 6px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--a1), var(--a2)); }

.empty { padding: 38px 10px; text-align: center; color: var(--dim-2); font-size: 13px; }

/* ---------------- 弹窗 ---------------- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px; }
.modal-backdrop { position: absolute; inset: 0; background: var(--overlay); backdrop-filter: blur(6px); }
.modal-card {
  position: relative; width: min(680px, 100%); max-height: 86vh;
  display: flex; flex-direction: column;
  padding: 0;
}
.modal-card header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--line);
}
.modal-card header h3 { margin: 0; font-size: 15px; }
.modal-body { padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }

/* ---------------- Toast ---------------- */
.toasts { position: fixed; right: 22px; bottom: 22px; z-index: 90; display: flex; flex-direction: column; gap: 10px; }
.toast {
  min-width: 220px; max-width: 360px;
  padding: 12px 16px; border-radius: 12px;
  background: var(--toast-bg);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  font-size: 13px;
  animation: slide-in 0.24s ease;
}
.toast.ok { border-left: 3px solid var(--ok); }
.toast.err { border-left: 3px solid var(--bad); }
@keyframes slide-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1180px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.main-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 72px minmax(0, 1fr); }
  .logo div:last-child, .nav-item span, .side-foot .status-line span:last-child { display: none; }
  .nav-item { justify-content: center; padding: 12px 8px; }
  .nav-item.active::before { display: none; }
  .search input { width: 130px; }
  .grid.cols-3, .grid.cols-2 { grid-template-columns: minmax(0, 1fr); }
  .view { padding: 16px; }
  .topbar { padding: 14px 16px; }
}
@media (max-width: 620px) {
  .grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .search { display: none; }
}
/* ==================== 菜单模拟器 ==================== */
.phone {
  width: 320px;
  margin: 0 auto;
  border-radius: 30px;
  padding: 12px;
  background: linear-gradient(180deg, #0d1320, #06080f);
  border: 1px solid var(--w56);
  box-shadow: 0 30px 60px -30px #000, inset 0 0 0 1px var(--w24);
}
.phone-top {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px 12px; border-bottom: 1px solid var(--w36);
}
.phone-top .dot { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(140deg, #6d5efc, #22d3ee); display: grid; place-items: center; font-size: 14px; }
.phone-top .t1 { font-size: 12.5px; font-weight: 600; }
.phone-top .t2 { font-size: 10.5px; color: var(--dim-2); }
.phone-body { min-height: 300px; padding: 12px 6px; display: flex; flex-direction: column; gap: 10px; }
.bubble {
  align-self: flex-start; max-width: 92%;
  padding: 10px 12px; border-radius: 14px 14px 14px 4px;
  background: var(--w36);
  font-size: 11.5px; line-height: 1.55; color: #dfe5f5;
  white-space: pre-wrap;
}
.bubble .hl { color: #fff; font-weight: 600; }
.kbd-preview { display: flex; flex-direction: column; gap: 6px; margin-top: auto; }
.kbd-row { display: flex; gap: 6px; }
.kbtn {
  flex: 1; text-align: center; padding: 9px 6px;
  font-size: 11px; color: #cfe0ff;
  background: rgba(109, 94, 252, 0.16);
  border: 1px solid rgba(109, 94, 252, 0.35);
  border-radius: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kbtn.reply { background: var(--w36); border-color: var(--w60); color: #dfe5f5; }
.phone-input {
  display: flex; align-items: center; gap: 8px;
  margin-top: 10px; padding: 7px 10px;
  border-radius: 18px; background: var(--w28);
  font-size: 11px; color: var(--dim-2);
}
.phone-input .send { margin-left: auto; color: #8b7cff; }

.m-row {
  border: 1px dashed var(--w56);
  border-radius: 12px; padding: 10px 12px; margin-bottom: 10px;
  background: var(--w12);
}
.m-row-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.m-row-head span { font-size: 11.5px; color: var(--dim-2); letter-spacing: 0.5px; }
.m-btn { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.m-icon {
  width: 38px; height: 34px; flex: 0 0 auto;
  border-radius: 9px; border: 1px solid var(--line);
  background: var(--w28); font-size: 16px; cursor: pointer;
}
.m-label, .m-url { padding: 7px 10px; font-size: 12.5px; }
.m-label { flex: 1 1 120px; min-width: 90px; }
.m-url { flex: 1 1 100px; }
.m-btn select { width: 132px; padding: 7px 8px; font-size: 12px; }

.icon-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; }
.icon-cell {
  aspect-ratio: 1; display: grid; place-items: center;
  border-radius: 9px; border: 1px solid var(--line);
  background: var(--w24); font-size: 17px; cursor: pointer;
}
.icon-cell:hover { background: rgba(109, 94, 252, 0.22); border-color: rgba(109, 94, 252, 0.5); }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.cat-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.cat-row:last-child { border-bottom: none; }
.cat-row input { flex: 1; }
.drop-zone {
  border: 1.5px dashed rgba(109, 94, 252, 0.45);
  border-radius: 14px; padding: 22px 16px; text-align: center;
  background: rgba(109, 94, 252, 0.06); cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
}
.drop-zone.hover { background: rgba(109, 94, 252, 0.16); border-color: rgba(109, 94, 252, 0.8); }
.drop-zone strong { display: block; font-size: 13px; margin-bottom: 4px; }
.stat-line { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--dim); }
.stat-line b { color: var(--txt); }

/* ==================== 模拟器：真实手机预览 v2 ==================== */
.phone { width: 360px; max-width: 100%; padding: 10px; border-radius: 32px; }
.phone-body {
  min-height: 300px; max-height: 470px; overflow-y: auto;
  padding: 12px 8px 6px; display: flex; flex-direction: column; gap: 8px;
  scrollbar-width: thin;
}
.phone-body::-webkit-scrollbar { width: 4px; }
.phone-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 4px; }

.bubble {
  align-self: flex-start; max-width: 96%;
  padding: 11px 13px; border-radius: 14px 14px 14px 4px;
  background: var(--w38);
  font-size: 12px; line-height: 1.62; color: #e3e8f7;
  word-break: break-word;
}
.bubble b, .bubble strong { color: #fff; font-weight: 650; }
.bubble s { color: var(--dim); }
.bubble code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; padding: 1px 5px; border-radius: 5px;
  background: var(--code-bg); color: #b9c7ff;
}
.bubble pre {
  margin: 6px 0; padding: 8px 10px; border-radius: 8px;
  background: var(--code-bg); font-size: 11px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-all; color: #cfe0ff;
}
.bubble blockquote {
  margin: 8px 0 0; padding: 7px 10px; border-left: 3px solid rgba(109, 94, 252, 0.75);
  border-radius: 0 8px 8px 0; background: rgba(109, 94, 252, 0.14);
  color: #cfd6ea; font-size: 11.5px;
}
.kbd-preview { margin-top: 6px; }
.kbtn { cursor: default; }

.reply-area {
  padding: 6px 4px 4px; border-top: 1px solid rgba(255,255,255,.06);
  display: flex; flex-direction: column; gap: 5px;
}
.rk-row { display: flex; gap: 5px; }
.rk-btn {
  flex: 1; text-align: center; padding: 8px 6px;
  font-size: 11px; color: #e8ecf8;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.reply-empty { font-size: 10.5px; color: var(--dim2); text-align: center; padding: 6px 0; }

.phone-input {
  display: flex; align-items: center; gap: 7px;
  margin-top: 6px; padding: 7px 9px;
  border-radius: 18px; background: rgba(255,255,255,.055);
  font-size: 10.5px; color: var(--dim2);
}
.phone-input .menu-pill {
  padding: 4px 11px; border-radius: 999px;
  background: #3a95d5; color: #fff; font-size: 10.5px; font-weight: 600;
}
.phone-input .clip, .phone-input .grid-btn, .phone-input .emoji { font-size: 13px; opacity: .8; }
.phone-input .ph { flex: 1; }
.phone-input .grid-btn { margin-left: auto; }

/* 模拟器：预览不截断，整屏所见即所得 */
.phone-body { max-height: none !important; overflow: visible !important; }
.phone { width: 372px; }

/* 模拟器输入条：还原 Telegram 原生 ⌄ 收起键盘按钮 */
.phone-input .grid-btn {
  width: 22px; height: 22px; border-radius: 6px;
  border: 1.5px solid rgba(255,255,255,.28);
  display: grid; place-items: center;
  font-size: 12px; line-height: 1; color: rgba(255,255,255,.55);
  margin-left: auto; opacity: 1;
}

/* 模拟器：可下钻的子菜单按钮 */
.kbtn.nav { cursor: pointer; border-color: rgba(34, 211, 238, 0.55); color: #bdeaff; }
.kbtn.nav:hover { background: rgba(34, 211, 238, 0.22); }
.kbtn.nav::after { content: " ›"; opacity: .7; }
.m-btn select[data-mact="target"] { width: 150px; padding: 7px 8px; font-size: 12px; }

/* ==================== 主题令牌 ==================== */
:root,
html[data-theme="dark"] {
  --w06: rgba(255,255,255,.008); --w12: rgba(255,255,255,.02);
  --w18: rgba(255,255,255,.03);  --w22: rgba(255,255,255,.035);
  --w24: rgba(255,255,255,.04);  --w26: rgba(255,255,255,.045);
  --w28: rgba(255,255,255,.05);  --w30: rgba(255,255,255,.055);
  --w32: rgba(255,255,255,.06);  --w36: rgba(255,255,255,.07);
  --w38: rgba(255,255,255,.075); --w42: rgba(255,255,255,.085);
  --w50: rgba(255,255,255,.10);  --w56: rgba(255,255,255,.12);
  --w60: rgba(255,255,255,.14);  --w64: rgba(255,255,255,.16);
  --w80: rgba(255,255,255,.35);  --w90: rgba(255,255,255,.5);
  --input-bg: rgba(8,11,20,.72);
  --input-bg-focus: rgba(10,14,26,.9);
  --topbar-bg: rgba(6,8,15,.72);
  --overlay: rgba(3,5,10,.66);
  --toast-bg: rgba(16,20,33,.96);
  --code-bg: rgba(0,0,0,.35);
  --page-bg:
    radial-gradient(1100px 620px at 12% -8%, rgba(109,94,252,.22), transparent 60%),
    radial-gradient(900px 560px at 92% 4%, rgba(34,211,238,.15), transparent 62%),
    radial-gradient(700px 500px at 50% 110%, rgba(244,114,182,.08), transparent 65%),
    linear-gradient(180deg, #0a0e1a, #06080f 60%);
}

html[data-theme="light"] {
  --bg: #eef2f9;
  --bg-2: #f7f9fd;
  --txt: #0f172a;
  --dim: #475569;
  --dim-2: #64748b;
  --line: rgba(15,23,42,.10);
  --line-strong: rgba(15,23,42,.18);
  --w06: rgba(15,23,42,.015); --w12: rgba(15,23,42,.02);
  --w18: rgba(15,23,42,.03);  --w22: rgba(15,23,42,.035);
  --w24: rgba(15,23,42,.04);  --w26: rgba(15,23,42,.045);
  --w28: rgba(15,23,42,.05);  --w30: rgba(15,23,42,.055);
  --w32: rgba(15,23,42,.06);  --w36: rgba(15,23,42,.07);
  --w38: rgba(15,23,42,.075); --w42: rgba(15,23,42,.085);
  --w50: rgba(15,23,42,.10);  --w56: rgba(15,23,42,.12);
  --w60: rgba(15,23,42,.14);  --w64: rgba(15,23,42,.16);
  --w80: rgba(15,23,42,.35);  --w90: rgba(15,23,42,.5);
  --input-bg: #ffffff;
  --input-bg-focus: #ffffff;
  --topbar-bg: rgba(255,255,255,.86);
  --overlay: rgba(15,23,42,.32);
  --toast-bg: #ffffff;
  --code-bg: rgba(15,23,42,.06);
  --shadow: 0 24px 60px -34px rgba(15,23,42,.45);
  --page-bg:
    radial-gradient(900px 520px at 10% -10%, rgba(109,94,252,.14), transparent 62%),
    radial-gradient(760px 460px at 96% 0%, rgba(34,211,238,.12), transparent 65%),
    linear-gradient(180deg, #f7f9fd, #eef2f9 60%);
}

body { background: var(--page-bg); background-attachment: fixed; }

/* 亮色下的细节修正 */
html[data-theme="light"] .glass {
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,.72));
  border-color: rgba(15,23,42,.08);
  box-shadow: 0 20px 50px -34px rgba(15,23,42,.4), inset 0 1px 0 #fff;
}
html[data-theme="light"] .glass::after { opacity: .25; }
html[data-theme="light"] .sidebar {
  background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(255,255,255,.7));
}
html[data-theme="light"] .nav-item.active {
  background: linear-gradient(100deg, rgba(109,94,252,.18), rgba(34,211,238,.08));
  box-shadow: inset 0 0 0 1px rgba(109,94,252,.28);
  color: #1e1b4b;
}
html[data-theme="light"] .topbar { border-bottom-color: rgba(15,23,42,.08); }
html[data-theme="light"] .badge.mute { color: #475569; }
html[data-theme="light"] .btn { color: #0f172a; }
html[data-theme="light"] .btn.primary { color: #fff; }
html[data-theme="light"] .btn.danger { color: #b91c1c; background: rgba(251,113,133,.12); }
html[data-theme="light"] input,
html[data-theme="light"] textarea,
html[data-theme="light"] select { color: #0f172a; }
html[data-theme="light"] .chip { color: #475569; }
html[data-theme="light"] .chip.active { color: #1e1b4b; }
html[data-theme="light"] .avatar { color: #fff; }
html[data-theme="light"] .m-icon { background: #fff; }
html[data-theme="light"] .toast { color: #0f172a; border-color: rgba(15,23,42,.12); }
html[data-theme="light"] .modal-backdrop { background: rgba(15,23,42,.3); }

/* 手机预览保持深色（模拟真实 Telegram 深色聊天） */
html[data-theme="light"] .phone,
html[data-theme="light"] .phone-top,
html[data-theme="light"] .phone-body,
html[data-theme="light"] .bubble,
html[data-theme="light"] .kbtn,
html[data-theme="light"] .rk-btn { color: #e8ecf8; }

/* 主题切换按钮 */
.theme-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--w28);
  color: var(--txt); font-size: 12.5px; cursor: pointer;
}
.theme-btn:hover { background: var(--w50); }
.theme-btn .ico { font-size: 14px; }

/* 亮色：统计卡与徽章对比度修正 */
html[data-theme="light"] .stat.hero {
  background: linear-gradient(135deg, rgba(109,92,252,.16), rgba(34,211,238,.10) 70%, #fff);
}
html[data-theme="light"] .stat.hero .value {
  background: linear-gradient(120deg, #312e81, #4f46e5 55%, #0891b2);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
html[data-theme="light"] .badge.ok { color: #047857; background: rgba(16,185,129,.14); border-color: rgba(16,185,129,.3); }
html[data-theme="light"] .badge.warn { color: #b45309; background: rgba(245,158,11,.14); border-color: rgba(245,158,11,.3); }
html[data-theme="light"] .badge.bad { color: #be123c; background: rgba(244,63,94,.12); border-color: rgba(244,63,94,.28); }
html[data-theme="light"] .badge.info { color: #0e7490; background: rgba(6,182,212,.12); border-color: rgba(6,182,212,.28); }
html[data-theme="light"] .badge.violet { color: #5b21b6; background: rgba(109,92,252,.14); border-color: rgba(109,92,252,.3); }
html[data-theme="light"] .badge.mute { color: #475569; background: rgba(15,23,42,.07); }
html[data-theme="light"] .stat .delta,
html[data-theme="light"] .sub { color: #64748b; }
html[data-theme="light"] .card-head .sub { color: #64748b; }
