/* ============================================================
   connect · 暗色玻璃拟态
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

/* 遮罩层自己声明了 display，会盖掉浏览器默认的 [hidden]{display:none}，这里强制兜回来 */
[hidden] { display: none !important; }

:root {
  --bg-0: #05070d;
  --bg-1: #080c16;
  --glass: rgba(255, 255, 255, .045);
  --glass-2: rgba(255, 255, 255, .07);
  --glass-inset: rgba(255, 255, 255, .028);
  --stroke: rgba(255, 255, 255, .085);
  --stroke-2: rgba(255, 255, 255, .16);
  --t0: #eef2ff;
  --t1: #b6c1da;
  --t2: #78849f;
  --acc-1: #22d3ee;
  --acc-2: #a78bfa;
  --acc-3: #f472b6;
  --grad: linear-gradient(120deg, var(--acc-1), var(--acc-2) 55%, var(--acc-3));
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #fb7185;
  --r-xl: 26px;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --topbar: 62px;
  --tabbar: 62px;
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, .8);
  --spring: cubic-bezier(.22, 1.2, .36, 1);
  --ease: cubic-bezier(.4, 0, .2, 1);
}

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg-0);
  color: var(--t0);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}

.sprite { display: none; }

.ic { width: 18px; height: 18px; fill: currentColor; flex: none; display: block; }

code, kbd, .num { font-family: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace; }
kbd {
  background: var(--glass-2); border: 1px solid var(--stroke); border-bottom-width: 2px;
  border-radius: 5px; padding: 0 5px; font-size: 11px;
}

/* ---------- 背景极光 ---------- */

.aurora { position: fixed; inset: 0; z-index: -2; overflow: hidden; background: radial-gradient(120% 100% at 50% 0%, var(--bg-1), var(--bg-0) 70%); }
.blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .5; will-change: transform; }
.b1 { width: 46vw; height: 46vw; left: -8vw; top: -12vw; background: radial-gradient(circle, #0e7490, transparent 68%); animation: drift1 34s var(--ease) infinite alternate; }
.b2 { width: 42vw; height: 42vw; right: -6vw; top: 4vh; background: radial-gradient(circle, #6d28d9, transparent 68%); animation: drift2 41s var(--ease) infinite alternate; }
.b3 { width: 38vw; height: 38vw; left: 28vw; bottom: -16vw; background: radial-gradient(circle, #9d174d, transparent 70%); animation: drift3 47s var(--ease) infinite alternate; }

@keyframes drift1 { to { transform: translate3d(14vw, 10vh, 0) scale(1.18); } }
@keyframes drift2 { to { transform: translate3d(-12vw, 16vh, 0) scale(1.1); } }
@keyframes drift3 { to { transform: translate3d(10vw, -12vh, 0) scale(1.22); } }

/* ---------- 玻璃 ---------- */

.glass {
  background: var(--glass);
  backdrop-filter: blur(26px) saturate(150%);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .07);
}
.glass-inset { background: var(--glass-inset); border: 1px solid var(--stroke); border-radius: var(--r-md); }

/* ---------- 顶栏 ---------- */

.topbar {
  position: relative; z-index: 20;
  height: var(--topbar);
  display: flex; align-items: center; gap: 14px;
  padding: 0 16px;
  border-radius: 0; border-left: 0; border-right: 0; border-top: 0;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
  background: var(--grad); color: #06080f; box-shadow: 0 6px 20px -6px var(--acc-2);
  animation: markPulse 5s var(--ease) infinite;
}
.brand-mark .ic { width: 21px; height: 21px; }
@keyframes markPulse { 50% { box-shadow: 0 6px 28px -4px var(--acc-1); } }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text b { font-size: 15px; letter-spacing: .04em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-text small { font-size: 11px; color: var(--t2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.devices { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.dev {
  display: flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px;
  border-radius: 999px; background: var(--glass-2); border: 1px solid var(--stroke);
  font-size: 11.5px; color: var(--t1); max-width: 150px;
  animation: pop .4s var(--spring) backwards;
}
.dev .ic { width: 13px; height: 13px; color: var(--acc-1); }
.dev span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dev.me { border-color: rgba(167, 139, 250, .4); background: rgba(167, 139, 250, .12); color: #ddd6fe; }

.topbar-actions { display: flex; gap: 8px; }
.ibtn {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  background: var(--glass-2); border: 1px solid var(--stroke); color: var(--t1);
  cursor: pointer; transition: .22s var(--ease);
}
.ibtn:hover { color: var(--t0); border-color: var(--stroke-2); background: rgba(255, 255, 255, .12); transform: translateY(-1px); }
.ibtn:active { transform: scale(.93); }

/* ---------- 主舞台 ---------- */

.stage {
  position: relative; z-index: 10;
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 16px; padding: 16px;
  height: calc(100dvh - var(--topbar));
}

.panel {
  border-radius: var(--r-xl); display: flex; flex-direction: column;
  min-height: 0; min-width: 0; overflow: hidden; position: relative;
}
.panel::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent);
  opacity: .6; pointer-events: none;
}

.panel-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px 10px; flex: none;
}
.panel-head h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14.5px; font-weight: 650; letter-spacing: .02em; }
.panel-head h2 .ic { color: var(--acc-1); }
.panel-head-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.hint { font-size: 11.5px; color: var(--t2); }

.conn { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--t2); }
.conn i { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 3px rgba(251, 191, 36, .16); }
.conn em { font-style: normal; }
.conn.on i { background: var(--ok); box-shadow: 0 0 0 3px rgba(52, 211, 153, .16); animation: breathe 2.6s var(--ease) infinite; }
.conn.off i { background: var(--err); box-shadow: 0 0 0 3px rgba(251, 113, 133, .18); }
@keyframes breathe { 50% { box-shadow: 0 0 0 6px rgba(52, 211, 153, .06); } }

/* ---------- 芯片按钮 ---------- */

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px;
  border-radius: 999px; background: var(--glass-2); border: 1px solid var(--stroke);
  color: var(--t1); font-size: 12px; font-family: inherit; cursor: pointer;
  transition: .2s var(--ease); white-space: nowrap; text-decoration: none;
}
.chip .ic { width: 14px; height: 14px; }
.chip:hover { color: var(--t0); border-color: var(--stroke-2); background: rgba(255, 255, 255, .12); }
.chip:active { transform: scale(.95); }
.chip.accent { background: linear-gradient(120deg, rgba(34, 211, 238, .18), rgba(167, 139, 250, .18)); border-color: rgba(167, 139, 250, .35); color: #ddd6fe; }
.chip.accent:hover { background: linear-gradient(120deg, rgba(34, 211, 238, .3), rgba(167, 139, 250, .3)); }
.chip.danger { color: #fecdd3; border-color: rgba(251, 113, 133, .35); background: rgba(251, 113, 133, .14); }
.chip.danger:hover { background: rgba(251, 113, 133, .26); }
.chip:disabled { opacity: .4; cursor: not-allowed; }

.btn-primary {
  height: 38px; padding: 0 20px; border-radius: 12px; border: 0; cursor: pointer;
  background: var(--grad); color: #06080f; font-weight: 700; font-size: 13.5px; font-family: inherit;
  box-shadow: 0 10px 26px -10px var(--acc-2); transition: .2s var(--ease);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 14px 30px -10px var(--acc-1); }
.btn-primary:active { transform: scale(.97); }

/* ---------- 消息流 ---------- */

.msg-search { display: flex; align-items: center; gap: 8px; margin: 0 16px 8px; padding: 0 12px; height: 36px; border-radius: 999px; background: var(--glass-inset); border: 1px solid var(--stroke); }
.msg-search .ic { width: 15px; height: 15px; color: var(--t2); }
.msg-search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--t0); font-family: inherit; font-size: 13px; }

.stream {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
  padding: 6px 16px 14px; display: flex; flex-direction: column; gap: 9px;
  scroll-behavior: smooth;
}

.dayline { display: flex; align-items: center; gap: 10px; margin: 12px 0 4px; color: var(--t2); font-size: 11px; }
.dayline::before, .dayline::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--stroke), transparent); }

.msg {
  max-width: 78%; padding: 9px 13px; border-radius: var(--r-md); position: relative;
  background: var(--glass-2); border: 1px solid var(--stroke);
  animation: msgIn .42s var(--spring) backwards; word-break: break-word;
}
@keyframes msgIn { from { opacity: 0; transform: translateY(12px) scale(.96); } }
.msg.mine { align-self: flex-end; background: linear-gradient(125deg, rgba(34, 211, 238, .17), rgba(167, 139, 250, .2)); border-color: rgba(167, 139, 250, .3); border-bottom-right-radius: 5px; }
.msg.theirs { align-self: flex-start; border-bottom-left-radius: 5px; }
.msg.sys { align-self: center; background: none; border: 1px dashed var(--stroke); color: var(--t2); font-size: 11.5px; padding: 5px 12px; }
.msg.hit { border-color: var(--warn); box-shadow: 0 0 0 2px rgba(251, 191, 36, .2); }
.msg-meta { display: flex; align-items: baseline; gap: 7px; font-size: 10.5px; color: var(--t2); margin-bottom: 3px; }
.msg-meta b { font-weight: 600; color: var(--t1); font-size: 11px; }
.msg-text { white-space: pre-wrap; font-size: 13.5px; color: var(--t0); }
.msg-text a { color: var(--acc-1); text-decoration: none; border-bottom: 1px dashed rgba(34, 211, 238, .45); }
.msg-text a:hover { border-bottom-style: solid; }
.msg mark { background: rgba(251, 191, 36, .3); color: #fef3c7; border-radius: 3px; padding: 0 1px; }
.msg-acts {
  position: absolute; top: -9px; display: none; gap: 4px;
  background: rgba(10, 14, 24, .92); border: 1px solid var(--stroke-2); border-radius: 999px; padding: 2px;
  backdrop-filter: blur(10px); box-shadow: 0 8px 20px -8px #000;
}
.msg.mine .msg-acts { left: -4px; }
.msg.theirs .msg-acts { right: -4px; }
.msg:hover .msg-acts { display: flex; animation: pop .22s var(--spring); }
.msg-acts button { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: none; border: 0; color: var(--t2); cursor: pointer; }
.msg-acts button:hover { color: var(--t0); background: var(--glass-2); }
.msg-acts .ic { width: 13px; height: 13px; }
@keyframes pop { from { opacity: 0; transform: scale(.7); } }

.empty { margin: auto; text-align: center; color: var(--t2); padding: 30px 20px; }
.empty .ic { width: 40px; height: 40px; margin: 0 auto 10px; opacity: .35; }
.empty b { display: block; color: var(--t1); font-size: 13.5px; margin-bottom: 4px; }
.empty small { font-size: 12px; }

/* ---------- 输入区 ---------- */

.composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 14px 14px; flex: none; }
.composer textarea {
  flex: 1; min-width: 0; resize: none; max-height: 140px;
  background: var(--glass-inset); border: 1px solid var(--stroke); border-radius: var(--r-md);
  color: var(--t0); font-family: inherit; font-size: 13.5px; line-height: 1.5;
  padding: 10px 13px; outline: 0; transition: .2s var(--ease);
}
.composer textarea:focus { border-color: rgba(167, 139, 250, .55); background: rgba(255, 255, 255, .05); box-shadow: 0 0 0 3px rgba(167, 139, 250, .13); }
.composer textarea::placeholder { color: var(--t2); }
.send {
  width: 40px; height: 40px; border-radius: 13px; border: 0; cursor: pointer; flex: none;
  background: var(--grad); color: #06080f; display: grid; place-items: center;
  box-shadow: 0 8px 22px -8px var(--acc-2); transition: .2s var(--ease);
}
.send:hover { transform: translateY(-1px) scale(1.03); }
.send:active { transform: scale(.92); }
.send:disabled { opacity: .35; cursor: not-allowed; box-shadow: none; transform: none; }

/* ---------- 拖拽区 ---------- */

.dropzone {
  margin: 0 16px 12px; flex: none; cursor: pointer; outline: 0;
  border-radius: var(--r-lg); border: 1.5px dashed rgba(167, 139, 250, .32);
  background: linear-gradient(140deg, rgba(34, 211, 238, .05), rgba(167, 139, 250, .07));
  padding: 18px 16px; text-align: center; transition: .25s var(--ease);
}
.dropzone:hover, .dropzone:focus-visible { border-color: rgba(34, 211, 238, .6); background: linear-gradient(140deg, rgba(34, 211, 238, .1), rgba(167, 139, 250, .12)); }
.dropzone.hot { border-color: var(--acc-1); border-style: solid; background: linear-gradient(140deg, rgba(34, 211, 238, .2), rgba(167, 139, 250, .22)); transform: scale(1.012); }
.dz-inner { display: flex; flex-direction: column; align-items: center; gap: 5px; pointer-events: none; }
.dz-inner b { font-size: 13.5px; font-weight: 600; }
.dz-inner small { font-size: 11.5px; color: var(--t2); }
.dz-ring {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 3px;
  background: var(--grad); color: #06080f; box-shadow: 0 8px 22px -8px var(--acc-1);
  transition: .3s var(--spring);
}
.dropzone:hover .dz-ring { transform: rotate(90deg) scale(1.08); }

body.dragging .dropzone { border-color: var(--acc-1); border-style: solid; }

/* ---------- 上传队列 ---------- */

.uploads { padding: 0 16px 10px; display: flex; flex-direction: column; gap: 7px; flex: none; }
.upl {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px;
  border-radius: var(--r-md); background: var(--glass-inset); border: 1px solid var(--stroke);
  animation: msgIn .35s var(--spring);
}
.upl.done { border-color: rgba(52, 211, 153, .35); }
.upl.err { border-color: rgba(251, 113, 133, .45); background: rgba(251, 113, 133, .08); }
.ring { width: 32px; height: 32px; flex: none; position: relative; }
.ring svg { transform: rotate(-90deg); width: 32px; height: 32px; }
.ring circle { fill: none; stroke-width: 3; }
.ring .bg { stroke: rgba(255, 255, 255, .1); }
.ring .fg { stroke: url(#g-ring); stroke-linecap: round; transition: stroke-dashoffset .25s var(--ease); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 9px; font-weight: 600; color: var(--t1); }
.upl-info { flex: 1; min-width: 0; }
.upl-info b { display: block; font-size: 12.5px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upl-info small { font-size: 11px; color: var(--t2); }
.upl.err .upl-info small { color: var(--err); }

/* ---------- 文件列表 ---------- */

.filelist { flex: 1; min-height: 0; overflow-y: auto; padding: 0 16px 16px; display: flex; flex-direction: column; gap: 8px; }

.fcard {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; cursor: pointer;
  border-radius: var(--r-md); background: var(--glass-inset); border: 1px solid var(--stroke);
  transition: .2s var(--ease); animation: msgIn .4s var(--spring) backwards; position: relative;
}
.fcard:hover { background: var(--glass-2); border-color: var(--stroke-2); transform: translateX(3px); }
.fcard:active { transform: scale(.985); }
.fthumb {
  width: 42px; height: 42px; border-radius: 11px; flex: none; overflow: hidden;
  display: grid; place-items: center; background: rgba(255, 255, 255, .05); border: 1px solid var(--stroke);
  color: var(--t2); position: relative;
}
.fthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fthumb.k-image { color: var(--acc-3); } .fthumb.k-video { color: var(--acc-2); }
.fthumb.k-audio { color: var(--ok); } .fthumb.k-archive { color: var(--warn); }
.fthumb.k-text, .fthumb.k-pdf, .fthumb.k-office { color: var(--acc-1); }
.fthumb .ic { width: 20px; height: 20px; }
.finfo { flex: 1; min-width: 0; }
.fname { font-size: 13px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 5px; }
.fname .lockbadge { color: var(--warn); flex: none; }
.fname .lockbadge .ic { width: 12px; height: 12px; }
.fmeta { font-size: 11px; color: var(--t2); display: flex; gap: 7px; flex-wrap: wrap; margin-top: 2px; }
.fmeta .num { font-variant-numeric: tabular-nums; }
.fmeta .miss { color: var(--err); }
.facts { display: flex; gap: 4px; opacity: 0; transition: .2s var(--ease); }
.fcard:hover .facts, .fcard:focus-within .facts { opacity: 1; }
.facts button, .facts a {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: var(--glass-2); border: 1px solid var(--stroke); color: var(--t1); cursor: pointer;
  text-decoration: none; transition: .18s var(--ease);
}
.facts button:hover, .facts a:hover { color: var(--t0); border-color: var(--stroke-2); }
.facts .ic { width: 15px; height: 15px; }
.facts .on { color: var(--warn); border-color: rgba(251, 191, 36, .4); background: rgba(251, 191, 36, .12); }

/* ---------- 底部标签栏（移动端）---------- */

.tabbar {
  display: none; position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom));
  height: var(--tabbar); z-index: 30; border-radius: var(--r-lg);
  padding: 6px; gap: 4px; align-items: center;
}
.tab {
  flex: 1; height: 100%; border: 0; background: none; border-radius: var(--r-md);
  color: var(--t2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-family: inherit; font-size: 10.5px; cursor: pointer; transition: .22s var(--ease);
}
.tab .ic { width: 19px; height: 19px; }
.tab.active { color: #06080f; background: var(--grad); box-shadow: 0 8px 20px -8px var(--acc-2); }

/* ---------- 抽屉 / 弹层 ---------- */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 40; background: rgba(3, 5, 10, .68);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: fade .25s var(--ease);
}
@keyframes fade { from { opacity: 0; } }

.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; pointer-events: none; }
.modal > .modal-card { pointer-events: auto; }
.modal-card {
  width: min(420px, 100%); border-radius: var(--r-xl); padding: 24px;
  position: relative; animation: sheetIn .4s var(--spring); max-height: 90dvh; overflow-y: auto;
}
.modal-card.wide { width: min(560px, 100%); }
@keyframes sheetIn { from { opacity: 0; transform: translateY(24px) scale(.94); } }
.modal-card h2 { margin: 0 0 4px; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.modal-sub { margin: 0 0 18px; color: var(--t2); font-size: 12.5px; }
.modal-x { position: absolute; top: 14px; right: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.lock-ic { color: var(--warn); }

.field { margin-bottom: 16px; }
.field > label { display: block; font-size: 12px; color: var(--t1); margin-bottom: 6px; font-weight: 600; }
.field small { display: block; font-size: 11px; color: var(--t2); margin-top: 5px; }
.field small b { color: var(--warn); }
.field input[type=text], .field input[type=number], .field input[type=password], .field input[type=search] {
  width: 100%; height: 40px; padding: 0 13px; border-radius: var(--r-md);
  background: var(--glass-inset); border: 1px solid var(--stroke); color: var(--t0);
  font-family: inherit; font-size: 13.5px; outline: 0; transition: .2s var(--ease);
}
.field input:focus { border-color: rgba(167, 139, 250, .55); box-shadow: 0 0 0 3px rgba(167, 139, 250, .13); }
.field .row { display: flex; align-items: center; gap: 9px; }
.field .row input { flex: 1; }
.unit { font-size: 12px; color: var(--t2); white-space: nowrap; }
.server-info { font-size: 12px; color: var(--t1); background: var(--glass-inset); border: 1px solid var(--stroke); border-radius: var(--r-md); padding: 11px 13px; line-height: 1.7; }
.server-info code { background: rgba(255, 255, 255, .08); padding: 1px 6px; border-radius: 5px; font-size: 11.5px; color: var(--acc-1); }
.pin-err { color: var(--err); font-size: 12px; margin: -8px 0 12px; display: flex; align-items: center; gap: 5px; }

.qr-frame {
  background: #fff; border-radius: var(--r-lg); padding: 14px; display: grid; place-items: center;
  box-shadow: 0 20px 50px -18px rgba(34, 211, 238, .4); position: relative; overflow: hidden;
}
.qr-frame::after {
  content: ""; position: absolute; left: 0; right: 0; height: 42%;
  background: linear-gradient(180deg, transparent, rgba(34, 211, 238, .22), transparent);
  animation: scanline 2.8s var(--ease) infinite;
}
@keyframes scanline { 0% { transform: translateY(-120%); } 100% { transform: translateY(320%); } }
.qr-frame svg, .qr-frame img { width: min(260px, 62vw); height: auto; display: block; }
.url-row { display: flex; align-items: center; gap: 9px; margin-top: 16px; }
.url-row code {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: var(--glass-inset); border: 1px solid var(--stroke); border-radius: var(--r-sm);
  padding: 9px 11px; font-size: 12px; color: var(--acc-1);
}
.qr-warn { margin-top: 12px; font-size: 11.5px; color: var(--warn); background: rgba(251, 191, 36, .1); border: 1px solid rgba(251, 191, 36, .3); border-radius: var(--r-sm); padding: 9px 11px; }

/* ---------- 详情抽屉 ---------- */

.sheet { position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; padding: 0; }
.sheet-card {
  width: 100%; height: 100%; border-radius: 0; border: 0; display: flex; flex-direction: column;
  animation: sheetIn .38s var(--spring);
}
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; flex: none; border-bottom: 1px solid var(--stroke); }
.sheet-head h2 { margin: 0; font-size: 15.5px; flex: 1; }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; }

.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { border-radius: var(--r-md); padding: 13px 14px; background: var(--glass-inset); border: 1px solid var(--stroke); position: relative; overflow: hidden; animation: msgIn .45s var(--spring) backwards; }
.stat::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2.5px; background: var(--grad); opacity: .85; }
.stat b { display: block; font-size: 21px; font-weight: 680; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 11px; color: var(--t2); }

.chart-box { padding: 13px 14px; margin-bottom: 12px; }
.chart-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.chart-head h3 { margin: 0; font-size: 12.5px; font-weight: 600; color: var(--t1); }
.chart-head span { margin-left: auto; font-size: 11px; color: var(--t2); }
.chart { display: flex; align-items: flex-end; gap: 4px; height: 108px; }
.bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; height: 100%; min-width: 0; }
.bar .stack { width: 100%; display: flex; flex-direction: column; justify-content: flex-end; border-radius: 5px 5px 2px 2px; overflow: hidden; min-height: 2px; transition: .5s var(--spring); background: rgba(255, 255, 255, .05); }
.bar .fill { width: 100%; background: var(--grad); border-radius: 5px 5px 2px 2px; transition: height .6s var(--spring); }
.bar:hover .stack { background: rgba(255, 255, 255, .1); }
.bar em { font-style: normal; font-size: 9.5px; color: var(--t2); white-space: nowrap; }
.bar.today em { color: var(--acc-1); font-weight: 600; }
.bar.zero .fill { height: 2px !important; opacity: .25; }

.kinds { display: flex; flex-wrap: wrap; gap: 7px; }
.kind { display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: var(--glass-2); border: 1px solid var(--stroke); font-size: 11.5px; color: var(--t1); }
.kind b { color: var(--t0); font-variant-numeric: tabular-nums; }
.kind .dot { width: 7px; height: 7px; border-radius: 50%; }

.toolbar { display: flex; gap: 9px; align-items: center; margin-bottom: 11px; flex-wrap: wrap; }
.search-box { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 13px; flex: 1; min-width: 190px; border-radius: 999px; background: var(--glass-inset); border: 1px solid var(--stroke); }
.search-box .ic { width: 15px; height: 15px; color: var(--t2); }
.search-box input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--t0); font-family: inherit; font-size: 13px; }
.seg { display: flex; gap: 3px; padding: 3px; border-radius: 999px; background: var(--glass-inset); border: 1px solid var(--stroke); overflow-x: auto; }
.seg-btn { height: 30px; padding: 0 12px; border-radius: 999px; border: 0; background: none; color: var(--t2); font-family: inherit; font-size: 12px; cursor: pointer; white-space: nowrap; transition: .2s var(--ease); }
.seg-btn:hover { color: var(--t1); }
.seg-btn.active { background: var(--grad); color: #06080f; font-weight: 650; }

.batchbar { display: flex; align-items: center; gap: 9px; padding: 8px 12px; margin-bottom: 11px; border-radius: var(--r-md); background: rgba(167, 139, 250, .1); border: 1px solid rgba(167, 139, 250, .3); animation: msgIn .3s var(--spring); flex-wrap: wrap; }
.batchbar span { font-size: 12px; color: var(--t1); }
.cbox { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--t1); cursor: pointer; }
.cbox input { position: absolute; opacity: 0; pointer-events: none; }
.cbox i { width: 17px; height: 17px; border-radius: 5px; border: 1px solid var(--stroke-2); background: var(--glass-inset); display: grid; place-items: center; transition: .18s var(--ease); }
.cbox i::after { content: ""; width: 9px; height: 9px; background: var(--grad); border-radius: 2px; transform: scale(0); transition: .2s var(--spring); }
.cbox input:checked + i { border-color: transparent; }
.cbox input:checked + i::after { transform: scale(1); }

.day-groups { display: flex; flex-direction: column; gap: 14px; }
.day-group > h4 { margin: 0 0 8px; font-size: 12px; color: var(--t2); font-weight: 600; display: flex; align-items: center; gap: 9px; }
.day-group > h4 .num { color: var(--t1); }
.day-group > h4::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--stroke), transparent); }
.day-group .rows { display: flex; flex-direction: column; gap: 6px; }
.drow { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r-sm); background: var(--glass-inset); border: 1px solid transparent; transition: .18s var(--ease); }
.drow:hover { border-color: var(--stroke); background: var(--glass-2); }
.drow .sel { flex: none; }
.drow .nm { flex: 1; min-width: 0; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drow .nm mark { background: rgba(251, 191, 36, .3); color: #fef3c7; border-radius: 3px; }
.drow .sz { font-size: 11px; color: var(--t2); font-variant-numeric: tabular-nums; flex: none; }
.drow .who { font-size: 11px; color: var(--t2); flex: none; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cleanup-note { margin-top: 16px; font-size: 11.5px; color: var(--t2); background: var(--glass-inset); border: 1px solid var(--stroke); border-radius: var(--r-md); padding: 11px 13px; line-height: 1.7; }
.cleanup-note b { color: var(--warn); }
.cleanup-note .ok { color: var(--ok); }

/* ---------- 会话（新开 / 历史） ---------- */

.panel-head h2 { min-width: 0; }
.panel-head h2 .ic { flex: none; }
#chatTitle { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--t1); }
.chip.sq { padding: 0; width: 30px; justify-content: center; position: relative; }
.chip .badge {
  position: absolute; top: -4px; right: -4px; min-width: 15px; height: 15px; padding: 0 4px;
  border-radius: 999px; background: var(--grad); color: #06080f;
  font-size: 9.5px; font-weight: 700; line-height: 15px; text-align: center; font-style: normal;
}

.hist-banner {
  display: flex; align-items: center; gap: 9px; flex: none;
  margin: 0 14px 4px; padding: 8px 11px; border-radius: var(--r-md);
  background: rgba(251, 191, 36, .1); border: 1px solid rgba(251, 191, 36, .3);
  font-size: 11.5px; color: var(--warn); line-height: 1.5;
  animation: msgIn .3s var(--spring);
}
.hist-banner .ic { width: 15px; height: 15px; flex: none; }
.hist-banner span { flex: 1; min-width: 0; }
.hist-banner b { color: #fef3c7; }
.hist-banner .chip { flex: none; height: 26px; font-size: 11px; }

.hist-tip {
  margin-bottom: 12px; padding: 10px 12px; border-radius: var(--r-md);
  background: var(--glass-inset); border: 1px solid var(--stroke);
  font-size: 11.5px; line-height: 1.7; color: var(--t2);
}
.hist-tip b { color: var(--t1); }

.conv-list { display: flex; flex-direction: column; gap: 7px; }
.conv {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px;
  border-radius: var(--r-md); background: var(--glass-inset);
  border: 1px solid transparent; cursor: pointer; text-align: left;
  font-family: inherit; color: inherit; width: 100%;
  transition: .18s var(--ease); animation: msgIn .35s var(--spring) backwards;
}
.conv:hover { border-color: var(--stroke-2); background: var(--glass-2); }
.conv:active { transform: scale(.995); }
.conv.cur { border-color: rgba(167, 139, 250, .45); background: linear-gradient(120deg, rgba(34, 211, 238, .1), rgba(167, 139, 250, .12)); }
.conv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.conv-top { display: flex; align-items: center; gap: 8px; }
.conv-title { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; color: var(--t0); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv.cur .conv-title { color: #ddd6fe; }
.conv-when { flex: none; font-size: 10.5px; color: var(--t2); font-variant-numeric: tabular-nums; }
.conv-sub { display: flex; align-items: center; gap: 8px; }
.conv-prev { flex: 1; min-width: 0; font-size: 11.5px; color: var(--t2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-count { flex: none; font-size: 10.5px; color: var(--t2); font-variant-numeric: tabular-nums; }
.conv-tag {
  flex: none; font-size: 9.5px; font-weight: 700; padding: 1px 6px; border-radius: 999px;
  background: var(--grad); color: #06080f;
}
.conv-acts { flex: none; display: flex; gap: 5px; opacity: 0; transition: .18s var(--ease); }
.conv:hover .conv-acts, .conv:focus-within .conv-acts { opacity: 1; }
.conv-acts button {
  width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px;
  border: 1px solid var(--stroke); background: var(--glass-2); color: var(--t2); cursor: pointer;
  transition: .18s var(--ease);
}
.conv-acts button:hover { color: var(--t0); border-color: var(--stroke-2); }
.conv-acts button.danger:hover { color: #fecdd3; border-color: rgba(251, 113, 133, .4); background: rgba(251, 113, 133, .16); }
.conv-acts .ic { width: 14px; height: 14px; }
@media (max-width: 900px) {
  .conv-acts { opacity: 1; }
  .hist-banner { margin: 0 10px 4px; }
}

/* ---------- 灯箱 ---------- */

.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(3, 5, 10, .93); backdrop-filter: blur(12px); display: flex; flex-direction: column; animation: fade .25s var(--ease); }
.lb-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; flex: none; border-bottom: 1px solid var(--stroke); }
.lb-title { flex: 1; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-head > div { display: flex; align-items: center; gap: 8px; }
.lb-body { flex: 1; min-height: 0; display: grid; place-items: center; padding: 16px; overflow: auto; }
.lb-body img, .lb-body video { max-width: 100%; max-height: 100%; border-radius: var(--r-md); box-shadow: 0 30px 80px -30px #000; }
.lb-body pre { margin: 0; max-width: 100%; max-height: 100%; overflow: auto; background: var(--glass-inset); border: 1px solid var(--stroke); border-radius: var(--r-md); padding: 16px; font-size: 12.5px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.lb-body iframe { width: 100%; height: 100%; border: 0; border-radius: var(--r-md); background: #fff; }
.lb-note { color: var(--t2); font-size: 13px; text-align: center; }

/* ---------- Toast ---------- */

.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: flex; flex-direction: column; gap: 9px; align-items: flex-end; pointer-events: none; max-width: min(360px, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; cursor: pointer;
  border-radius: var(--r-md); background: rgba(12, 17, 29, .92); border: 1px solid var(--stroke-2);
  backdrop-filter: blur(18px); box-shadow: 0 18px 40px -16px #000;
  animation: toastIn .42s var(--spring); pointer-events: auto;
}
.toast.out { animation: toastOut .3s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px) scale(.9); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px) scale(.9); } }
.toast .ic { width: 17px; height: 17px; margin-top: 1px; }
.toast.ok .ic { color: var(--ok); } .toast.err .ic { color: var(--err); }
.toast.info .ic { color: var(--acc-1); } .toast.warn .ic { color: var(--warn); }
.toast div { min-width: 0; }
.toast b { display: block; font-size: 12.5px; font-weight: 600; }
.toast small { font-size: 11.5px; color: var(--t2); word-break: break-word; }

/* ---------- 拖拽遮罩 ---------- */

.dropveil {
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: center;
  background: rgba(5, 8, 16, .8); backdrop-filter: blur(8px); animation: fade .2s var(--ease);
}
.dv-inner { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 44px 60px; border-radius: var(--r-xl); border: 2px dashed var(--acc-1); background: rgba(34, 211, 238, .08); animation: pop .3s var(--spring); }
.dv-inner .ic { width: 44px; height: 44px; color: var(--acc-1); }
.dv-inner b { font-size: 17px; }

/* ---------- 滚动条 ---------- */

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .13); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .25); background-clip: content-box; }
input[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; }

/* ---------- 响应式 ---------- */

@media (max-width: 900px) {
  :root { --topbar: 56px; }
  .tabbar { display: flex; }
  .stage { grid-template-columns: 1fr; gap: 0; padding: 10px 10px calc(var(--tabbar) + 20px); height: calc(100dvh - var(--topbar)); }
  .panel { display: none; border-radius: var(--r-lg); }
  body[data-active="chat"] #panelChat, body[data-active="files"] #panelFiles { display: flex; animation: viewIn .32s var(--spring); }
  @keyframes viewIn { from { opacity: 0; transform: translateY(10px) scale(.99); } }
  .brand-text small { display: none; }
  .devices .dev span { display: none; }
  .devices .dev { width: 28px; padding: 0; justify-content: center; }
  .topbar-actions .ibtn { display: none; }
  .msg { max-width: 88%; }
  .facts { opacity: 1; }
  .toasts { left: 12px; right: 12px; bottom: calc(var(--tabbar) + 22px); max-width: none; align-items: stretch; }
  .sheet-body { padding: 12px; }
  .modal-card { padding: 20px; }
}

@media (max-width: 900px) and (orientation: landscape) {
  .qr-frame svg, .qr-frame img { width: min(200px, 40vh); }
}

@media (min-width: 901px) {
  .fcard .facts { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .blob { animation: none; }
}
