/* =========================================================
   互传 · 界面样式
   纯 CSS，无外部字体 / 图片 / CDN。
   浅色为默认，html[data-theme="dark"] 覆盖为深色。
   ========================================================= */

:root {
  /* 与工具箱 --display / 主站 --sans 同一份字符串：全站标准正文字体 */
  --font-sans: "DengXian", -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-display: "DengXian", -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", "Cascadia Code", "Consolas", monospace;

  --bg: #f3f5ff;
  --bg-deep: #e9edff;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: rgba(255, 255, 255, 0.9);
  --surface-solid: #ffffff;
  --surface-soft: rgba(255, 255, 255, 0.46);
  --text: #11162a;
  --text-soft: #333b55;
  --muted: #66708a;
  --muted-2: #8b93a8;
  --line: rgba(17, 22, 42, 0.09);
  --line-strong: rgba(17, 22, 42, 0.16);
  --accent: #3a5cf0;
  --accent-strong: #2843c9;
  --accent-soft: rgba(58, 92, 240, 0.1);
  --violet: #7a5cff;
  --violet-soft: rgba(122, 92, 255, 0.12);
  --mint: #16a085;
  --mint-soft: rgba(22, 160, 133, 0.12);
  --danger: #dc3d4b;
  --danger-soft: rgba(220, 61, 75, 0.1);
  --warning: #b7791f;
  --warning-soft: rgba(183, 121, 31, 0.12);

  --shadow-sm: 0 1px 2px rgba(20, 28, 70, 0.05), 0 6px 18px -12px rgba(20, 28, 70, 0.18);
  --shadow-md: 0 12px 34px -18px rgba(24, 34, 90, 0.35), 0 2px 8px rgba(24, 34, 90, 0.04);
  --shadow-lg: 0 34px 70px -32px rgba(24, 34, 90, 0.42), 0 10px 26px -18px rgba(24, 34, 90, 0.22);
  --shadow-accent: 0 14px 26px -12px rgba(58, 92, 240, 0.55);

  /* 圆角：与主站 v2/lib/css.mjs 的 :root 同一套三档 + 药丸。
     --radius-md 是本文件历史别名（值等于 --radius），保留是因为别处引用了它；
     --radius-xl 同样保留别名身份，值收到 --radius-lg，避免这里冒出主站没有的第四档。 */
  --radius: 18px;
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --radius-xl: 26px;
  --radius-pill: 999px;

  --glass-blur: 22px;
  /* 动效令牌：与主站同一套（v2/lib/css.mjs:34-41）。历史样式里的硬写时长
     一律落到这四档，别处不再新增第五个值。 */
  --dur-1: 120ms;
  --dur-2: 220ms;
  --dur-3: 340ms;
  --dur-4: 560ms;
  --dur: var(--dur-2);
  /* 列表入场时相邻两项的错开量（主站同名同值）。 */
  --stagger: 55ms;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.3, 0.64, 1);
  --ease-bounce: cubic-bezier(0.24, 1.36, 0.4, 1);

  /* 字阶令牌：与主站 v2/lib/css.mjs 的 :root 同值同名（clamp 两端也一样），
     所以两边在同一个视口宽度下算出同一个字号。下面两组断点是跟着令牌走的，
     别在具体选择器里另写 clamp，否则又会出现两套字阶。 */
  --fs-page: clamp(26px, 3.2vw, 36px); /* 页面主标题：首页封面与内页页头共用 */
  --fs-section: clamp(19px, 2.2vw, 24px); /* 区块标题 .sec-head */
  --fs-h1: clamp(24px, 3vw, 32px); /* 次级页头：项目详情、互传 hero */
  --fs-h2: clamp(19px, 2.2vw, 24px); /* 小节标题 */
  --fs-h3: 17.5px; /* 卡片标题 */
  --fs-h4: 14.5px; /* 密集列表里的小条目标题 */
  --fs-lead: clamp(15px, 1.5vw, 16px); /* 标题下那句说明 */
}

@media (max-width: 900px) {
  :root {
    --fs-page: clamp(24px, 4.4vw, 32px);
    --fs-section: clamp(18px, 3.2vw, 22px);
    --fs-h1: clamp(22px, 4.2vw, 28px);
    --fs-h2: clamp(18px, 3.4vw, 22px);
    --fs-h3: 19px;
  }
}

@media (max-width: 480px) {
  :root {
    --fs-page: clamp(22px, 6vw, 28px);
    --fs-section: clamp(16px, 4.2vw, 19px);
    --fs-h1: clamp(21px, 6vw, 26px);
    --fs-h2: clamp(17px, 4.6vw, 21px);
    --fs-h3: 18px;
  }
}

html[data-theme="dark"] {
  --bg: #080a11;
  --bg-deep: #0d1120;
  --surface: rgba(20, 24, 38, 0.72);
  --surface-strong: rgba(24, 29, 46, 0.9);
  --surface-solid: #151a2a;
  --surface-soft: rgba(25, 30, 48, 0.5);
  --text: #eef1ff;
  --text-soft: #d3d9f2;
  --muted: #99a2be;
  --muted-2: #737c99;
  --line: rgba(235, 240, 255, 0.09);
  --line-strong: rgba(235, 240, 255, 0.17);
  --accent: #7f96ff;
  --accent-strong: #a6b5ff;
  --accent-soft: rgba(127, 150, 255, 0.14);
  --violet: #a48bff;
  --violet-soft: rgba(164, 139, 255, 0.16);
  --mint: #4cd6b4;
  --mint-soft: rgba(76, 214, 180, 0.14);
  --danger: #ff7b85;
  --danger-soft: rgba(255, 123, 133, 0.13);
  --warning: #e7b25a;
  --warning-soft: rgba(231, 178, 90, 0.14);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.32), 0 8px 20px -14px rgba(0, 0, 0, 0.7);
  --shadow-md: 0 18px 38px -20px rgba(0, 0, 0, 0.8), 0 2px 8px rgba(0, 0, 0, 0.24);
  --shadow-lg: 0 40px 80px -34px rgba(0, 0, 0, 0.86), 0 12px 28px -20px rgba(0, 0, 0, 0.6);
  --shadow-accent: 0 16px 30px -14px rgba(127, 150, 255, 0.5);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font-sans);
  /* 与主站 body（v2/lib/css.mjs:136 的 `font:16px/1.68` 一档）对齐：
     桌面 16px × 1.75 = 28px 行高。 */
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

img,
svg {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

::selection {
  background: var(--accent);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
}

.icon-sun,
.icon-moon {
  display: none;
}

html[data-theme="light"] .icon-sun,
html:not([data-theme="dark"]) .icon-sun {
  display: block;
}

html[data-theme="dark"] .icon-sun {
  display: none;
}

html[data-theme="dark"] .icon-moon {
  display: block;
}

/* ---------- 背景 ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(1100px 720px at 82% -8%, rgba(122, 92, 255, 0.18), transparent 64%),
    radial-gradient(980px 620px at -8% 22%, rgba(58, 92, 240, 0.14), transparent 60%),
    linear-gradient(160deg, var(--bg) 0%, var(--bg-deep) 100%);
}

html[data-theme="dark"] .backdrop {
  background:
    radial-gradient(1100px 760px at 82% -8%, rgba(108, 88, 255, 0.22), transparent 62%),
    radial-gradient(920px 620px at -8% 18%, rgba(58, 92, 255, 0.18), transparent 58%),
    radial-gradient(720px 520px at 50% 110%, rgba(24, 160, 133, 0.08), transparent 60%),
    linear-gradient(160deg, var(--bg) 0%, var(--bg-deep) 100%);
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(68px);
  opacity: 0.55;
  animation: float 18s var(--ease) infinite alternate;
}

.orb--a {
  width: 34vw;
  height: 34vw;
  min-width: 260px;
  min-height: 260px;
  top: -12%;
  right: 4%;
  background: rgba(122, 92, 255, 0.32);
}

.orb--b {
  width: 28vw;
  height: 28vw;
  min-width: 220px;
  min-height: 220px;
  bottom: -10%;
  left: -6%;
  background: rgba(58, 92, 240, 0.26);
  animation-delay: -7s;
}

.orb--c {
  width: 18vw;
  height: 18vw;
  min-width: 160px;
  min-height: 160px;
  top: 42%;
  left: 46%;
  background: rgba(76, 214, 180, 0.14);
  animation-delay: -12s;
}

.grid-lines {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(17, 22, 42, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(17, 22, 42, 0.045) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at 50% 36%, #000 0%, transparent 74%);
  -webkit-mask-image: radial-gradient(circle at 50% 36%, #000 0%, transparent 74%);
  opacity: 0.7;
}

html[data-theme="dark"] .grid-lines {
  background-image:
    linear-gradient(to right, rgba(235, 240, 255, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(235, 240, 255, 0.05) 1px, transparent 1px);
}

@keyframes float {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(2.5vw, 3vh, 0) scale(1.08); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- 加载屏 ---------- */

.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-content: center;
  gap: 18px;
  text-align: center;
  color: var(--muted);
  background: var(--bg);
  transition: opacity var(--dur-3) var(--ease), visibility var(--dur-3);
}

.boot-screen.is-done {
  opacity: 0;
  visibility: hidden;
}

.boot-screen p {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.14em;
}

.boot-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 44px;
}

.boot-mark span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  animation: boot 0.9s var(--ease) infinite alternate;
}

.boot-mark span:nth-child(2) { animation-delay: 0.16s; }
.boot-mark span:nth-child(3) { animation-delay: 0.32s; }

@keyframes boot {
  from { transform: translateY(4px) scale(0.8); opacity: 0.4; }
  to { transform: translateY(-6px) scale(1.08); opacity: 1; }
}

/* ---------- 通用组件 ---------- */

.glass {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: transform var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease), background var(--dur-1) var(--ease), opacity var(--dur-1);
}

.btn:active {
  transform: translateY(1px) scale(0.995);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  box-shadow: var(--shadow-accent);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 18px 34px -14px rgba(58, 92, 240, 0.7);
  filter: saturate(1.08);
}

.btn-ghost {
  color: var(--text-soft);
  background: var(--surface-soft);
  border-color: var(--line);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-strong);
}

.btn-danger {
  color: #fff;
  background: var(--danger);
  box-shadow: 0 12px 24px -14px rgba(220, 61, 75, 0.8);
}

html[data-theme="dark"] .btn-danger {
  color: #1a0b0e;
}

.btn-block {
  width: 100%;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 13px;
  color: var(--text-soft);
  background: transparent;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease), transform var(--dur-1) var(--ease);
}

.icon-btn:hover {
  color: var(--text);
  background: var(--surface-soft);
  border-color: var(--line);
}

.icon-btn:active {
  transform: scale(0.96);
}

.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 12.5px;
  font-weight: 550;
  transition: color var(--dur-1), background var(--dur-1);
}

.text-btn .icon {
  width: 16px;
  height: 16px;
}

.text-btn:hover {
  color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}

.text-btn--danger:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.field {
  display: grid;
  gap: 7px;
}

.field-label {
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface-soft);
  outline: none;
  transition: border-color var(--dur-1), background var(--dur-1), box-shadow var(--dur-1);
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--muted-2);
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--accent);
  background: var(--surface-solid);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.password-wrap {
  position: relative;
  display: block;
}

.password-wrap input {
  padding-right: 64px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  min-height: 34px;
  color: var(--muted);
}

.password-toggle:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.form-error {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(220, 61, 75, 0.3);
  border-radius: 10px;
  color: var(--danger);
  background: var(--danger-soft);
  font-size: 13px;
}

.auth-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.65;
  text-align: center;
}

.btn-spinner {
  display: none;
  width: 17px;
  height: 17px;
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn.is-loading .btn-label,
.btn.is-loading > .icon {
  display: none;
}

.btn.is-loading .btn-spinner {
  display: block;
}

@keyframes spin {
  to { transform: rotate(1turn); }
}

/* ---------- 品牌 ---------- */

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: var(--text);
  text-decoration: none;
}

.brand-lockup:hover {
  text-decoration: none;
}

.brand-copy {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.brand-copy strong {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-copy em {
  font-style: normal;
  font-size: 13px;
  font-weight: 650;
  color: var(--accent);
  letter-spacing: 0.08em;
}

.brand-mark {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(58, 92, 240, 0.16), rgba(122, 92, 255, 0.18));
  box-shadow: inset 0 0 0 1px var(--line);
}

.brand-core {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  box-shadow: 0 0 18px rgba(92, 110, 255, 0.8);
}

.brand-ring {
  position: absolute;
  inset: 9px;
  border: 1.5px solid rgba(122, 92, 255, 0.6);
  border-radius: 50%;
  border-left-color: transparent;
  border-bottom-color: transparent;
  transform: rotate(-30deg);
}

.brand-mark--small {
  width: 36px;
  height: 36px;
  border-radius: 11px;
}

.brand-mark--small .brand-ring {
  inset: 7px;
}

/* ---------- 登录 / 注册 ---------- */

.auth-view {
  width: min(1180px, 100%);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: clamp(28px, 6vh, 72px) clamp(20px, 5vw, 56px);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.75fr);
  align-items: center;
  gap: clamp(32px, 6vw, 88px);
}

.auth-brand {
  position: relative;
  display: grid;
  align-content: center;
  gap: 22px;
  padding-bottom: 18px;
}

.auth-brand h1 {
  margin: 6px 0 0;
  /* 字族必须是无衬线：主站的 --serif 也已经换成无衬线了，这里别再吃衬线体。 */
  font-family: var(--font-display);
  font-size: var(--fs-page);
  line-height: 1.04;
  letter-spacing: -0.045em;
  font-weight: 900;
}

.grad {
  background: linear-gradient(100deg, var(--accent) 6%, var(--violet) 54%, #23b7a2 108%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.auth-lead {
  max-width: 33em;
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-lead);
  line-height: 1.8;
}

.feature-list {
  display: grid;
  gap: 11px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  color: var(--text-soft);
  font-size: 13.5px;
}

.feature-list li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.feature-dot {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.orbit {
  position: relative;
  width: min(420px, 100%);
  height: 250px;
  margin-top: 12px;
}

.orbit-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  border: 1px dashed var(--line-strong);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.orbit-ring--outer {
  width: 330px;
  height: 196px;
  animation: orbit-spin 34s linear infinite;
}

.orbit-ring--inner {
  width: 178px;
  height: 112px;
  border-style: solid;
  border-color: var(--line);
  animation: orbit-spin 24s linear infinite reverse;
}

@keyframes orbit-spin {
  to { transform: translate(-50%, -50%) rotate(1turn); }
}

.orbit-core {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  border-radius: 22px;
  color: #fff;
  background: linear-gradient(145deg, var(--accent), var(--violet));
  box-shadow: 0 18px 38px -14px rgba(58, 92, 240, 0.7);
  transform: translate(-50%, -50%) rotate(-6deg);
}

.orbit-core .icon {
  width: 27px;
  height: 27px;
}

.orbit-chip {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-soft);
  background: var(--surface-strong);
  box-shadow: var(--shadow-sm);
  font-size: 12px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.orbit-chip .icon {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.orbit-chip i {
  font-style: normal;
  font-weight: 600;
}

.orbit-chip--pc { left: 2%; top: 34%; animation: chip-float 7s var(--ease) infinite alternate; }
.orbit-chip--phone { right: 0; top: 22%; animation: chip-float 6s var(--ease) infinite alternate-reverse; }
.orbit-chip--tablet { right: 12%; bottom: 12%; animation: chip-float 8s var(--ease) infinite alternate; }

@keyframes chip-float {
  from { transform: translateY(-4px); }
  to { transform: translateY(6px); }
}

.orbit-spark {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--violet);
  box-shadow: 0 0 12px var(--violet);
  opacity: 0.7;
}

.orbit-spark--a { left: 26%; top: 16%; }
.orbit-spark--b { right: 24%; bottom: 20%; background: var(--mint); box-shadow: 0 0 12px var(--mint); }

.auth-card {
  width: 100%;
  max-width: 440px;
  justify-self: end;
  padding: clamp(24px, 3.2vw, 36px);
  border-radius: var(--radius-xl);
  background: var(--surface-strong);
}

.auth-card-head {
  display: grid;
  gap: 12px;
  margin-bottom: 22px;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
}

.auth-tab {
  flex: 1;
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-size: 13.5px;
  font-weight: 650;
  transition: color var(--dur-1), background var(--dur-1), box-shadow var(--dur-1);
}

.auth-tab:hover {
  color: var(--text);
}

.auth-tab.is-active {
  color: var(--text);
  background: var(--surface-solid);
  box-shadow: var(--shadow-sm);
}

.auth-subtitle {
  margin: 0;
  min-height: 2.6em;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form .btn-block {
  margin-top: 4px;
  min-height: 48px;
}

.auth-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 11.5px;
}

.auth-foot span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.auth-foot .icon {
  width: 14px;
  height: 14px;
}

/* ---------- 主界面 ---------- */

.main-view {
  display: flex;
  flex-direction: column;
  width: min(1440px, 100%);
  /* 整块正好一屏：页面本身不滚，消息区自己滚。
     用 min-height 时高度由内容撑开，消息区就长到跟内容一样高，
     它自己滚不动、又把 overscroll-behavior:contain 挡在手上，
     于是滚轮／手指怎么划页面都不动 —— 这就是「东西多了滑不动」。 */
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  margin: 0 auto;
  padding: 16px clamp(12px, 2.6vw, 32px) max(16px, env(safe-area-inset-bottom));
  gap: 14px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 8px 10px 8px 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mini {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  text-decoration: none;
  flex: none;
}

.brand-mini:hover {
  text-decoration: none;
}

.brand-mini-copy {
  display: grid;
  line-height: 1.1;
}

.brand-mini-copy strong {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.brand-mini-copy small {
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.topbar-divider {
  width: 1px;
  height: 20px;
  background: var(--line);
}

.user-avatar {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 9px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 24%, transparent);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.user-label {
  overflow: hidden;
  color: var(--muted);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-label strong {
  color: var(--text);
  font-weight: 650;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.conn-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  margin-right: 4px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.conn-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted-2);
}

.conn-pill--online {
  color: var(--mint);
  border-color: rgba(22, 160, 133, 0.28);
  background: var(--mint-soft);
}

.conn-pill--online .conn-dot {
  background: var(--mint);
  box-shadow: 0 0 0 4px rgba(22, 160, 133, 0.12);
}

.conn-pill--connecting {
  color: var(--warning);
  border-color: rgba(183, 121, 31, 0.28);
  background: var(--warning-soft);
}

.conn-pill--connecting .conn-dot {
  background: var(--warning);
  animation: pulse 1.2s ease-in-out infinite;
}

.conn-pill--offline {
  color: var(--danger);
  border-color: rgba(220, 61, 75, 0.26);
  background: var(--danger-soft);
}

.conn-pill--offline .conn-dot {
  background: var(--danger);
}

/* 顶部收纳开关：只在手机上出现（桌面侧栏一直展开）。
   右上角的数字既是「设备数」也是「连接状态」：在线绿、连接中琥珀、离线红。 */
.shelf-toggle {
  display: none;
  position: relative;
}

.shelf-count {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 999px;
  color: var(--accent-ink);
  background: var(--muted-2);
  box-shadow: 0 0 0 2px var(--surface);
  font-size: 8.5px;
  font-weight: 750;
  line-height: 14px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.shelf-toggle.is-open {
  color: var(--accent);
  background: var(--accent-soft);
}

.shelf-toggle.is-online .shelf-count {
  background: var(--mint);
}

.shelf-toggle.is-connecting .shelf-count {
  background: var(--warning);
  animation: pulse 1.2s ease-in-out infinite;
}

.shelf-toggle.is-offline .shelf-count {
  background: var(--danger);
}

@keyframes pulse {
  50% { opacity: 0.35; }
}

.workspace {
  display: grid;
  grid-template-columns: 294px minmax(0, 1fr);
  gap: 14px;
  flex: 1;
  min-height: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding-bottom: 2px;
}

.side-block {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.side-head h2 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.side-head h2 .icon {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.device-list {
  display: grid;
  gap: 6px;
}

.device-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--text);
  background: transparent;
  text-align: left;
  transition: background var(--dur-1), border-color var(--dur-1), transform var(--dur-1);
}

.device-item:hover {
  background: var(--surface-soft);
}

.device-item.is-current {
  border-color: var(--line);
  background: var(--surface-soft);
}

.device-item.is-target {
  border-color: rgba(58, 92, 240, 0.32);
  background: var(--accent-soft);
}

.device-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--accent);
  background: var(--surface-strong);
}

.device-avatar .icon {
  width: 18px;
  height: 18px;
}

.device-main {
  display: grid;
  min-width: 0;
  flex: 1;
}

.device-name {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-meta {
  overflow: hidden;
  margin-top: 1px;
  color: var(--muted-2);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-badge {
  flex: none;
  padding: 2px 7px;
  border-radius: 999px;
  color: var(--mint);
  background: var(--mint-soft);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.device-badge--target {
  color: var(--accent);
  background: var(--accent-soft);
}

.side-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.65;
}

.side-note--muted {
  color: var(--muted-2);
  font-size: 11px;
}

.storage-percent {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.storage-progress {
  display: block;
  width: 100%;
  height: 7px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: var(--line);
  appearance: none;
  -webkit-appearance: none;
}

.storage-progress::-webkit-progress-bar {
  background: var(--line);
  border-radius: 999px;
}

.storage-progress::-webkit-progress-value {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--violet));
}

.storage-progress::-moz-progress-bar {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--violet));
}

.side-tip {
  display: flex;
  gap: 10px;
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 11.5px;
  line-height: 1.6;
}

.side-tip p {
  margin: 0;
}

.side-tip strong {
  display: block;
  margin-bottom: 2px;
  color: var(--text-soft);
  font-weight: 650;
}

.side-tip-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 9px;
  color: var(--mint);
  background: var(--mint-soft);
}

.side-tip-icon .icon {
  width: 16px;
  height: 16px;
}

/* ---------- 聊天面板 ---------- */

.chat-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 20px 13px;
  border-bottom: 1px solid var(--line);
}

.chat-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.chat-subtitle {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11.5px;
}

.chat-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.count-badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border: 1px solid color-mix(in srgb, var(--accent) 16%, var(--line));
  border-radius: 999px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, var(--surface-strong));
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0;
}

/* 消息区 + 「跳到最新」按钮的定位层。
   按钮必须放在滚动容器外面，否则会跟着内容一起滚走；也不能直接挂 .chat-panel，
   因为下面还有会显示/隐藏的 #pick-bar，用固定偏移算不准。
   网格位置从 .message-list 挪到这里（原来那条 grid-column/grid-row 已删）。 */
.message-scroll {
  position: relative;
  display: flex;
  grid-column: 1;
  grid-row: 3;
  min-height: 0;
  min-width: 0;
}

/* 「跳到最新」：滚上去之后才出现，点一下回到最新一条。
   底部对齐靠 absolute 定位在这个不滚动的包裹层里，所以永远贴在可视区底部。 */
/* 「回到最早」：与底部那颗对称。翻下去看新消息后，想回头看最早那几条时不用一路滚。
   同样挂在 .message-scroll 上（不滚动的那层），所以永远贴在可视区顶部。 */
.jump-top {
  position: absolute;
  left: 50%;
  top: 10px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px 6px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--text);
  font: 600 12px/1 var(--font-sans);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  z-index: 3;
  transition: opacity 160ms ease;
}

.jump-top[hidden] {
  display: none;
}

.jump-top .icon {
  width: 13px;
  height: 13px;
}

.jump-top:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.jump-top:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.jump-latest {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px 7px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--text);
  font: 600 12.5px/1 var(--font-sans);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  z-index: 3;
  transition: opacity 160ms ease, transform 160ms ease;
}

.jump-latest[hidden] {
  display: none;
}

.jump-latest .icon {
  width: 14px;
  height: 14px;
}

.jump-latest:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.jump-latest:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* 有新内容进来时轻轻动一下，提示「下面还有新的」 */
.jump-latest[data-fresh="1"] {
  animation: jump-latest-nudge 1.6s ease-in-out infinite;
}

@keyframes jump-latest-nudge {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
  .jump-latest[data-fresh="1"] { animation: none; }
}

.message-list {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 18px 20px 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.message-list::-webkit-scrollbar {
  width: 8px;
}

.message-list::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: var(--line-strong);
  background-clip: content-box;
}

.day-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 0 16px;
  color: var(--muted-2);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.day-divider::before,
.day-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.message {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 14px;
  animation: message-in var(--dur-3) var(--ease) both;
}

.message.is-mine {
  align-items: flex-end;
}

@keyframes message-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 7px;
  max-width: 100%;
  padding: 0 4px;
  color: var(--muted-2);
  font-size: 10px;
}

/* 时间精确到年月日时分（2026-11-18 14:05，16 个字符），
   不许折行也不许被压扁；等宽数字让同一列的时间对齐好看。 */
.message-meta .at {
  flex: none;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.message-meta .from {
  overflow: hidden;
  max-width: 15em;
  color: var(--muted);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-meta .to {
  color: var(--accent);
}

.message-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity var(--dur-1);
}

.message:hover .message-actions,
.message:focus-within .message-actions {
  opacity: 1;
}

.message-action {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  color: var(--muted-2);
  background: transparent;
}

.message-action .icon {
  width: 13px;
  height: 13px;
}

.message-action:hover {
  color: var(--text);
  background: var(--surface-strong);
}

.message-action--danger:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

/* 「加载更早」：贴在消息流顶上的一条窄按钮，不抢眼但随时点得到 */
.history-more {
  display: block;
  width: fit-content;
  margin: 2px auto 10px;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.5;
  cursor: pointer;
  transition: color var(--dur-1), border-color var(--dur-1), background var(--dur-1);
}

.history-more:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--accent-line, rgba(96, 165, 250, 0.45));
  background: var(--surface-strong);
}

.history-more:disabled {
  cursor: default;
  opacity: 0.6;
}

.bubble {
  position: relative;
  max-width: min(76%, 640px);
  margin-top: 3px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 6px 18px 18px 18px;
  background: var(--surface-strong);
  box-shadow: var(--shadow-sm);
  overflow-wrap: anywhere;
}

.message.is-mine .bubble {
  border-color: transparent;
  border-radius: 18px 6px 18px 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  box-shadow: 0 12px 26px -16px rgba(58, 92, 240, 0.75);
}

.bubble--file {
  padding: 9px;
  max-width: min(82%, 520px);
}

.bubble--image {
  padding: 5px;
  max-width: min(74%, 460px);
}

.message-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.message-text a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.message.is-mine .message-text a {
  color: #fff;
}

.message-image {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface-soft);
  cursor: zoom-in;
}

.message-image img {
  display: block;
  width: 100%;
  max-height: 380px;
  object-fit: cover;
  transition: transform var(--dur-3) var(--ease);
}

.message-image:hover img {
  transform: scale(1.015);
}

.message-image-caption {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 9px 3px;
  color: var(--muted);
  font-size: 10.5px;
}

.message.is-mine .message-image-caption {
  color: rgba(255, 255, 255, 0.78);
}

.file-card {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-width: 220px;
  padding: 8px 10px;
  border-radius: 13px;
  color: var(--text);
  background: var(--surface-soft);
  text-decoration: none;
}

.file-card:hover {
  background: var(--accent-soft);
  text-decoration: none;
}

.message.is-mine .file-card {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
}

.message.is-mine .file-card:hover {
  background: rgba(255, 255, 255, 0.22);
}

.file-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 10px;
  color: var(--accent);
  background: var(--surface-strong);
}

.message.is-mine .file-icon {
  color: var(--accent-strong);
}

.file-icon .icon {
  width: 20px;
  height: 20px;
}

.file-main {
  display: grid;
  min-width: 0;
  flex: 1;
}

.file-name {
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  margin-top: 1px;
  color: var(--muted-2);
  font-size: 10px;
}

.message.is-mine .file-size {
  color: rgba(255, 255, 255, 0.72);
}

.file-download {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 9px;
  color: var(--accent);
  background: var(--surface-strong);
}

.file-download .icon {
  width: 16px;
  height: 16px;
}

.message.is-mine .file-download {
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
}

.empty-state {
  grid-column: 1;
  grid-row: 3;
  z-index: 1;
  display: grid;
  place-items: center;
  align-content: center;
  justify-self: center;
  align-self: center;
  width: min(100%, 560px);
  gap: 11px;
  padding: clamp(20px, 5vh, 48px) 24px;
  text-align: center;
  pointer-events: none;
  animation: empty-in var(--dur-4) var(--ease) both;
}

@keyframes empty-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.empty-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line));
  border-radius: 999px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, var(--surface-strong));
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.empty-kicker::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--mint) 16%, transparent);
}

.empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 3px;
  pointer-events: auto;
}

.empty-actions .btn {
  min-height: 38px;
  padding: 0 15px;
  font-size: 12.5px;
}

.empty-hints {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 4px;
  pointer-events: auto;
}

.empty-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1;
}

.empty-chip .icon {
  width: 12px;
  height: 12px;
  color: var(--muted-2);
}

.empty-state h3 {
  margin: 2px 0 0;
  font-family: var(--font-display);
  font-size: clamp(19px, 2vw, 22px);
  letter-spacing: -0.025em;
}

.empty-state p {
  max-width: 33em;
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

.empty-art {
  position: relative;
  width: 220px;
  height: 78px;
  margin-bottom: 2px;
}

.empty-art::before {
  content: "";
  position: absolute;
  inset: -22px -26px;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, color-mix(in srgb, var(--accent) 13%, transparent), transparent 68%);
  filter: blur(6px);
}

.empty-line {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 126px;
  height: 1px;
  border-top: 1px dashed var(--line-strong);
  transform: translate(-50%, -50%);
}

.empty-device {
  position: absolute;
  top: 50%;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--accent);
  background: var(--surface-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-50%);
}

.empty-device .icon {
  width: 24px;
  height: 24px;
}

.empty-device--a { left: 8px; animation: empty-bob 4.2s ease-in-out infinite; }
.empty-device--b { right: 8px; color: var(--violet); animation: empty-bob 4.2s ease-in-out -2.1s infinite; }

@keyframes empty-bob {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -4px;
  }
}

.empty-route {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  gap: 9px;
  transform: translate(-50%, -50%);
}

.empty-route i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.35;
  animation: route 1.6s ease-in-out infinite;
}

.empty-route i:nth-child(2) { animation-delay: 0.18s; }
.empty-route i:nth-child(3) { animation-delay: 0.36s; }

@keyframes route {
  50% { opacity: 1; transform: translateX(4px); }
}

/* ---------- 拖放提示 ---------- */

.drop-hint {
  position: absolute;
  inset: 66px 12px 12px;
  z-index: 6;
  display: grid;
  place-items: center;
  border: 2px dashed var(--accent);
  border-radius: 20px;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
}

.drop-hint-inner {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 12px 18px;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  box-shadow: var(--shadow-accent);
  font-size: 13px;
  font-weight: 650;
}

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

.upload-queue {
  grid-row: 4;
  display: grid;
  gap: 7px;
  max-height: 172px;
  overflow: auto;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
}

.upload-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.upload-thumb {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  object-fit: cover;
  background: var(--surface-soft);
}

.upload-thumb--file {
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
}

.upload-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.upload-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.upload-name {
  overflow: hidden;
  font-size: 11.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-status {
  flex: none;
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 9.5px;
}

.upload-progress {
  display: block;
  width: 100%;
  height: 4px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: var(--line);
  appearance: none;
  -webkit-appearance: none;
}

.upload-progress::-webkit-progress-bar { background: var(--line); }
.upload-progress::-webkit-progress-value {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--violet));
}
.upload-progress::-moz-progress-bar {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--violet));
}

.upload-cancel {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
}

.upload-cancel:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.upload-cancel .icon {
  width: 15px;
  height: 15px;
}

/* 上次没传完的那一单：换个颜色标出来，并把「选同一个文件接着传」做成一条按钮 */
.upload-item--resume {
  border-color: var(--accent-line, rgba(96, 165, 250, 0.4));
  background: var(--accent-soft);
}

.upload-sub {
  margin-top: 4px;
  color: var(--muted-2);
  font-size: 10.5px;
}

.upload-resume {
  justify-self: start;
  padding: 3px 9px;
  border: 1px solid var(--accent-line, rgba(96, 165, 250, 0.4));
  border-radius: 999px;
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 600;
  background: var(--surface);
}

.upload-resume:hover {
  border-color: var(--accent);
}

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

.composer {
  grid-row: 5;
  display: grid;
  gap: 4px;
  padding: 10px 20px 13px;
  border-top: 1px solid var(--line);
  background: var(--surface-strong);
}

.composer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 0;
}

.target-picker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.target-select {
  max-width: 240px;
  min-height: 30px;
  padding: 3px 26px 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-soft);
  background: var(--surface-soft);
  font-size: 11.5px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 15px) 50%,
    calc(100% - 11px) 50%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}

.target-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.text-count {
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 10px;
  white-space: nowrap;
}

.text-count.is-near {
  color: var(--warning);
}

.composer-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.composer-field {
  display: grid;
  flex: 1;
  gap: 3px;
  min-width: 0;
}

.attach-btn {
  flex: none;
  margin-bottom: 1px;
  border-color: var(--line);
  background: var(--surface-soft);
}

.message-input {
  width: 100%;
  min-height: 44px;
  max-height: 168px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--text);
  background: var(--surface-soft);
  font-size: 14px;
  line-height: 1.55;
  resize: none;
  outline: none;
  field-sizing: content;
  transition: border-color var(--dur-1), box-shadow var(--dur-1), background var(--dur-1);
}

.message-input::placeholder {
  color: var(--muted-2);
}

.message-input:focus {
  border-color: var(--accent);
  background: var(--surface-solid);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.send-btn {
  flex: none;
  min-height: 44px;
  padding: 0 19px;
}

.send-btn .icon {
  width: 17px;
  height: 17px;
}

.send-btn:disabled {
  opacity: 0.45;
}

/* ---------- 提示 ---------- */

.toast-host {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 80;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--text-soft);
  background: var(--surface-strong);
  box-shadow: var(--shadow-md);
  font-size: 12.5px;
  line-height: 1.55;
  animation: toast-in var(--dur-3) var(--ease-bounce) both;
  pointer-events: auto;
}

.toast::before {
  content: "";
  width: 4px;
  align-self: stretch;
  flex: none;
  border-radius: 999px;
  background: var(--accent);
}

.toast--error::before { background: var(--danger); }
.toast--success::before { background: var(--mint); }
.toast--warning::before { background: var(--warning); }

.toast.is-leaving {
  animation: toast-out var(--dur-2) var(--ease) both;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateY(8px) scale(0.98); }
}

/* ---------- 弹窗 ---------- */

.modal {
  width: min(540px, calc(100vw - 28px));
  max-height: min(720px, calc(100dvh - 40px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 22px;
  color: var(--text);
  background: var(--surface-solid);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal::backdrop {
  background: rgba(8, 10, 18, 0.42);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.modal--small {
  width: min(420px, calc(100vw - 28px));
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: -0.01em;
}

.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.modal-body {
  max-height: calc(100dvh - 150px);
  overflow: auto;
  padding: 16px 18px 20px;
}

.modal-section {
  display: grid;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.modal-section:first-child {
  padding-top: 2px;
}

.modal-section:last-child {
  padding-bottom: 2px;
  border-bottom: 0;
}

.modal-section h3 {
  margin: 0;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.modal-section--muted p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.75;
}

.stack-form {
  display: grid;
  gap: 10px;
}

.stack-form .btn {
  justify-self: end;
  margin-top: 2px;
}

.meta-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.meta-list > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
}

.meta-list > div:last-child {
  border-bottom: 0;
}

.meta-list dt {
  color: var(--muted);
  font-size: 11.5px;
}

.meta-list dd {
  margin: 0;
  overflow: hidden;
  max-width: 68%;
  font-size: 11.5px;
  font-weight: 600;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.confirm-message {
  margin: 0 0 18px;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.7;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.lightbox {
  width: auto;
  max-width: min(1080px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: transparent;
  overflow: visible;
}

.lightbox::backdrop {
  background: rgba(5, 7, 14, 0.86);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.lightbox-figure {
  display: grid;
  gap: 0;
  margin: 0;
  border-radius: 16px;
  overflow: hidden;
  background: #0d0f18;
  box-shadow: 0 30px 90px -20px rgba(0, 0, 0, 0.9);
}

.lightbox-figure img {
  display: block;
  max-width: min(1080px, calc(100vw - 24px));
  max-height: calc(100dvh - 120px);
  margin: 0 auto;
  object-fit: contain;
}

.lightbox-figure figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px;
  color: #d7dcf2;
  background: rgba(18, 21, 34, 0.94);
  font-size: 12px;
}

.lightbox-figure figcaption span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lightbox-figure .text-btn {
  flex: none;
  color: #c7d2ff;
}

.lightbox-figure .text-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.lightbox-close {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 2;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.14);
}

.lightbox-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.24);
}

/* ---------- 嵌入模式 ---------- */

html[data-embed="1"] body {
  background: transparent;
}

html[data-embed="1"] .backdrop {
  display: none;
}

html[data-embed="1"] .auth-view {
  min-height: 100dvh;
  grid-template-columns: 1fr;
  width: min(520px, 100%);
  padding: 22px 16px;
}

html[data-embed="1"] .auth-brand {
  display: none;
}

html[data-embed="1"] .auth-card {
  justify-self: center;
  max-width: 440px;
}

html[data-embed="1"] .main-view {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  padding: 10px;
}

html[data-embed="1"] .topbar {
  min-height: 48px;
  padding: 5px 8px;
  border-radius: 15px;
}

html[data-embed="1"] .workspace {
  grid-template-columns: 240px minmax(0, 1fr);
}

html[data-embed="1"] .side-tip {
  display: none;
}

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

@media (max-width: 1080px) {
  .auth-view {
    grid-template-columns: minmax(0, 1fr) minmax(340px, 0.8fr);
    gap: 36px;
  }

  .orbit {
    display: none;
  }

  .workspace {
    grid-template-columns: 258px minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .auth-view {
    grid-template-columns: 1fr;
    justify-items: center;
    align-content: center;
    gap: 26px;
    padding: 28px 18px;
  }

  .auth-brand {
    justify-items: center;
    gap: 12px;
    padding-bottom: 0;
    text-align: center;
  }

  .auth-brand h1 {
    /* 字号交给 :root 的 --fs-page 断点，这里不再另写一套 clamp。 */
    font-size: var(--fs-page);
  }

  .auth-lead {
    max-width: 30em;
    font-size: 13.5px;
  }

  .feature-list,
  .auth-brand .brand-lockup {
    display: none;
  }

  .auth-card {
    justify-self: center;
    max-width: 460px;
  }

  .workspace {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .sidebar {
    display: block;
    flex: none;
    overflow: visible;
    padding-bottom: 0;
  }

  .side-block {
    padding: 12px 14px;
  }

  .side-block.storage-card,
  .side-tip,
  .side-note {
    display: none;
  }

  .side-head {
    margin-bottom: 8px;
  }

  .device-list {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    padding-bottom: 3px;
    scrollbar-width: none;
  }

  .device-list::-webkit-scrollbar {
    display: none;
  }

  .device-item {
    width: auto;
    min-width: 164px;
    flex: none;
    border-color: var(--line);
    background: var(--surface-soft);
  }

  .device-item.is-current {
    min-width: 142px;
  }

  .side-note {
    margin-top: 6px;
  }

  .chat-panel {
    flex: 1;
    /* 一屏已经定死，这里不能再给 420px 的下限，
       否则矮屏上输入框会被挤出可视区（页面又不会滚）。 */
    min-height: 0;
  }

  .message-list {
    padding: 14px 14px 6px;
  }

  .chat-head {
    padding: 12px 14px 10px;
  }

  .composer {
    padding: 8px 14px 10px;
  }

  .bubble {
    max-width: 88%;
  }

  .bubble--file {
    max-width: 92%;
  }

  .bubble--image {
    max-width: 84%;
  }

  .topbar {
    min-height: 52px;
    padding: 6px 8px 6px 10px;
  }

  .topbar-divider,
  .user-label {
    display: none;
  }

  .conn-pill {
    padding: 0 9px;
    font-size: 10.5px;
  }

  .icon-btn {
    width: 38px;
    height: 38px;
  }

  .main-view {
    padding: 10px 10px max(10px, env(safe-area-inset-bottom));
    gap: 10px;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 14px;
  }

  .auth-view {
    padding: 20px 14px;
    align-content: start;
    gap: 18px;
  }

  .auth-brand h1 {
    font-size: var(--fs-page);
  }

  .auth-lead {
    font-size: 12.5px;
    line-height: 1.7;
  }

  .auth-card {
    padding: 20px 16px;
    border-radius: 24px;
  }

  .auth-foot {
    font-size: 10.5px;
  }

  .brand-mini-copy small {
    display: none;
  }

  .brand-mini-copy strong {
    font-size: 13.5px;
  }

  .topbar-actions .icon-btn {
    width: 36px;
    height: 36px;
  }

  .conn-pill {
    gap: 5px;
    padding: 0 8px;
  }

  .conn-pill #conn-text {
    display: none;
  }

  .chat-head h2 {
    font-size: 15px;
  }

  .chat-actions .text-btn {
    font-size: 0;
    gap: 0;
    padding: 7px;
  }

  .chat-actions .text-btn .icon {
    width: 18px;
    height: 18px;
  }

  .bubble {
    max-width: 92%;
    padding: 9px 12px;
  }

  .message-text {
    font-size: 13.5px;
  }

  .file-card {
    min-width: 190px;
  }

  .message-image img {
    max-height: 300px;
  }

  .send-btn {
    padding: 0 14px;
  }

  .send-btn .btn-label {
    display: none;
  }

  .message-actions {
    opacity: 1;
  }

  .toast-host {
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    width: calc(100vw - 20px);
  }

  .modal-body {
    padding: 14px 14px 18px;
  }

  .modal-head {
    padding: 14px 14px 10px;
  }

  .modal-actions .btn {
    flex: 1;
  }

  .stack-form .btn {
    justify-self: stretch;
    width: 100%;
  }

  .auth-foot {
    justify-content: center;
    text-align: center;
  }

  .target-select {
    max-width: 180px;
  }
}

@media (max-width: 380px) {
  .brand-mini-copy {
    display: none;
  }

  .composer-meta {
    gap: 6px;
  }

  .target-picker > span {
    display: none;
  }

  .target-select {
    max-width: 150px;
  }
}

/* ---------- 打印 / 无 JS ---------- */

@media print {
  .backdrop,
  .boot-screen,
  .topbar-actions,
  .sidebar,
  .composer,
  .upload-queue,
  .message-actions {
    display: none !important;
  }

  .main-view,
  .chat-panel {
    box-shadow: none;
    border: 0;
  }

  body {
    background: #fff;
  }
}

/* ---------- 恢复码 / 配对 / 通知 ---------- */
.auth-row {
  display: flex;
  justify-content: flex-end;
  margin-top: -6px;
}

.auth-row .text-btn {
  font-size: 0.82rem;
  color: var(--muted);
}

.auth-row .text-btn:hover {
  color: var(--accent);
}

.notify-btn.is-active {
  color: var(--accent);
  background: rgba(58, 92, 240, 0.12);
}

.modal-note {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.6;
}

.modal-section h3 + .modal-note {
  margin-top: -2px;
}

.danger-zone {
  border: 1px solid rgba(214, 69, 69, 0.28);
  border-radius: var(--radius-md, 14px);
  padding: 14px;
  background: rgba(214, 69, 69, 0.04);
}

.danger-zone h3 {
  color: var(--danger);
}

.pair-body {
  display: grid;
  gap: 12px;
}

.pair-qr-wrap {
  display: flex;
  justify-content: center;
  padding: 10px;
}

.pair-qr {
  width: min(220px, 100%);
  height: auto;
  aspect-ratio: 1;
  border-radius: 14px;
  background: #fff;
  padding: 10px;
  box-shadow: 0 8px 30px rgba(20, 30, 80, 0.14);
}

.pair-qr[hidden] {
  display: none;
}

#pair-link {
  font-size: 0.78rem;
  color: var(--muted);
}

#pair-expire {
  margin: 0;
}

.recovery-code-wrap {
  display: grid;
  gap: 10px;
  justify-items: center;
  margin: 14px 0;
}

.recovery-code {
  display: block;
  width: 100%;
  padding: 16px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  text-align: center;
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
  font-size: clamp(1rem, 4.6vw, 1.3rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text);
  background: var(--surface-soft);
  word-break: break-all;
  user-select: all;
}

@media (max-width: 560px) {
  .danger-zone {
    padding: 12px;
  }

  .pair-qr {
    width: min(190px, 100%);
  }
}

/* ---------- 管理员：成员与容量 ---------- */

.modal-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.badge-soft {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}

.admin-list {
  display: grid;
  gap: 8px;
}

.admin-user {
  display: grid;
  gap: 9px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.admin-user-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  min-width: 0;
}

.admin-name {
  overflow: hidden;
  max-width: 100%;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-role {
  padding: 1px 6px;
  border-radius: 5px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.admin-role.is-admin {
  color: var(--violet);
  background: color-mix(in srgb, var(--violet) 12%, transparent);
}

.admin-usage {
  margin-left: auto;
  color: var(--muted);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.admin-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(92px, 0.8fr) auto auto;
  align-items: end;
  gap: 6px;
}

.admin-field {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.admin-field > span {
  color: var(--muted-2);
  font-size: 9.5px;
  letter-spacing: 0.02em;
}

.admin-field input,
.admin-field select {
  width: 100%;
  min-width: 0;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
  font: inherit;
  font-size: 11px;
  outline: none;
}

.admin-field input:focus,
.admin-field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

.btn-small {
  height: 30px;
  padding: 0 10px;
  font-size: 11px;
  white-space: nowrap;
}

.admin-empty {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
  text-align: center;
  font-size: 11.5px;
}

.admin-error {
  color: var(--danger);
  font-size: 11px;
}

@media (max-width: 620px) {
  .admin-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-controls {
    gap: 8px;
  }

  .admin-controls .admin-role-field {
    grid-column: 1 / -1;
  }

  .admin-controls .btn-small {
    width: 100%;
  }

  .admin-usage {
    width: 100%;
    margin-left: 0;
  }
}

.user-role {
  padding: 1px 6px;
  border: 1px solid color-mix(in srgb, var(--violet) 24%, var(--line));
  border-radius: 999px;
  color: var(--violet);
  background: color-mix(in srgb, var(--violet) 8%, transparent);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .user-role {
    display: none;
  }
}

/* 高一点的手机把登录内容垂直居中；矮屏仍从顶部开始，避免被裁切。 */
@media (max-width: 560px) and (min-height: 780px) {
  .auth-view {
    align-content: center;
  }
}

/* 矮屏（手机横屏/小屏）先保住输入区，把空状态插画和快捷键收起来。 */
@media (max-width: 900px) and (max-height: 680px), (max-height: 480px) {
  .empty-art,
  .empty-hints {
    display: none;
  }

  .empty-state {
    gap: 7px;
    padding: 16px;
  }
}

/* 再矮（手机横屏，390 高）就只剩标题和两个按钮，别把空状态撑出消息区。 */
@media (max-height: 480px) {
  .empty-state {
    gap: 6px;
    padding: 8px 14px;
  }

  .empty-kicker,
  .empty-state p {
    display: none;
  }

  .empty-state h3 {
    font-size: 17px;
  }
}

/* =========================================================
   返回 HalfDone 主页
   互传是独立子站（/transfer/），原本没有任何回到主站的出口。
   ========================================================= */

.back-home {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 20px;
  padding: 8px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--muted);
  text-decoration: none;
  transition: color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
}

.back-home:hover,
.back-home:focus-visible {
  color: var(--text);
  border-color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}

.back-home--mini {
  margin-bottom: 0;
  padding: 6px 12px;
  font-size: 13px;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .back-home--mini {
    padding: 6px 10px;
    font-size: 12.5px;
  }
}

/* ==========================================================================
   发布管理页（admin.html）：只在 /transfer/admin.html 用到
   ========================================================================== */
.admin-body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

.admin-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 780px;
  margin: 0 auto;
  padding: 22px 24px 0;
}

.admin-main {
  max-width: 780px;
  margin: 0 auto;
  padding: 26px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.admin-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.admin-title--sm { font-size: 21px; }

.admin-lead {
  margin: 0;
  color: var(--text-soft);
  font-size: 14.5px;
  line-height: 1.75;
}

.admin-lead code,
.admin-versions code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.admin-gate,
.admin-card,
.admin-result-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  box-shadow: var(--shadow-sm);
  padding: 22px;
}

.admin-gate {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  justify-content: space-between;
}

.admin-gate p {
  margin: 0;
  color: var(--text-soft);
  font-size: 14.5px;
}

.admin-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.admin-hint {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.admin-hint code {
  font-family: var(--font-mono);
  font-size: 0.94em;
}

.admin-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  overflow: hidden;
}

.admin-progress-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
  transition: width var(--dur-2) var(--ease);
}

.admin-status {
  margin: 0;
  min-height: 20px;
  font-size: 13.5px;
  color: var(--muted);
}

.admin-status[data-kind="error"] { color: var(--danger); }
.admin-status[data-kind="ok"] { color: var(--mint); }
.admin-status[data-kind="warn"] { color: var(--warning); }

.admin-result-card h2 {
  margin: 0 0 10px;
  font-size: 18px;
  line-height: 1.3;
}

.admin-result-card.is-ok { border-color: var(--mint); }
.admin-result-card.is-warn { border-color: var(--warning); }

.admin-result-card ul {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 14px;
  color: var(--text-soft);
}

.admin-error {
  margin: 12px 0 0;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.admin-inventory {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-project {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  padding: 14px 16px;
}

.admin-project header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 14.5px;
}

.admin-tag {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--violet-soft);
  color: var(--violet);
  font-size: 11.5px;
}

.admin-versions {
  margin: 9px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  font-size: 12.5px;
}

.admin-muted {
  color: var(--muted);
  font-size: 12.5px;
}

@media (max-width: 620px) {
  .admin-row { grid-template-columns: 1fr; }
  .admin-title { font-size: 25px; }
  .admin-main { padding: 20px 16px 64px; }
}
/* 找回密码：登录页的次要按钮 */
.auth-forgot {
  display: block;
  margin: 10px auto 0;
  padding: 4px 10px;
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  background: none;
  border: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-forgot:hover,
.auth-forgot:focus-visible {
  color: var(--accent);
}

.auth-forgot[hidden] {
  display: none;
}
/* 版本清单里的删除按钮 */
.admin-ver{display:inline-flex;align-items:center;gap:1px}
.admin-del{margin-left:1px;width:16px;height:16px;line-height:1;border:0;border-radius:50%;background:transparent;color:var(--muted);font-size:14px;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;transition:background var(--dur-1),color var(--dur-1)}
.admin-del:hover:not(:disabled){background:#fdecec;color:#c93b3b}
.admin-del:disabled{opacity:.45;cursor:default}

/* 版本旁边的「编辑 / 删除」两个显式按钮：把后台本来能做的事摆到明面，不藏 */
.admin-ver-acts{display:inline-flex;align-items:center;gap:4px;margin-left:3px}
.admin-ver-acts .ax-btn{padding:3px 8px;border-radius:7px;font-size:12px}
.admin-ver-acts .ax-btn svg{width:12px;height:12px}
.admin-ver-acts .ax-btn.is-danger{border-color:transparent;background:transparent;color:var(--muted)}
.admin-ver-acts .ax-btn.is-danger:hover{background:#fdecec;color:#c93b3b;border-color:transparent}
.admin-ver-acts .ax-btn.is-danger:hover svg{color:#c93b3b}

/* 后台撤下的版本（含 GitHub 来源）排成一行，点一下能放回来 */
.admin-hidden{display:flex;align-items:center;gap:5px;margin:6px 0 0;flex-wrap:wrap}
.admin-hidden-label{font-size:11px;font-weight:600;letter-spacing:.02em;color:var(--muted)}
.admin-hidden-chip{display:inline-flex}
.admin-hidden-chip button{border:1px dashed var(--line-strong);background:var(--surface-soft);color:var(--muted);font:inherit;font-size:12px;padding:2px 7px;border-radius:7px;cursor:pointer;transition:all var(--dur-1) var(--ease)}
.admin-hidden-chip button:hover{border-color:var(--accent);color:var(--accent-strong);background:var(--surface-strong)}

/* ==========================================================================
   发布管理台（admin.html）的骨架：左侧导航 + 右侧面板
   只在这一页用到，类名统一 ax- 前缀，和互传主应用的 admin-* 互不干扰
   ========================================================================== */

/* hidden 属性的优先级别被 .ax-pane / .ax-toast 这类 display 规则盖掉 */
.ax-pane[hidden],
.ax-gate[hidden],
.ax-toast[hidden],
.ax-confirm[hidden],
#release-form[hidden],
#newproj-form[hidden],
#editproj-form[hidden],
.ax-mode-pane[hidden],
#result[hidden],
.ax-suggest[hidden],
.ax-draft[hidden],
.ax-badge[hidden],
#progress[hidden] { display: none !important; }

/* ---------- 外壳 ---------- */

.ax-shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  align-items: start;
  min-height: 100vh;
}

.ax-side {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 18px 14px 16px;
  border-right: 1px solid var(--line);
  background: var(--surface-soft);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
}

.ax-main {
  width: 100%;
  max-width: 980px;
  padding: 30px 28px 90px;
  justify-self: center;
}

/* ---------- 品牌 ---------- */

.ax-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 5px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
}

.ax-brand--center { justify-content: center; padding: 0; }

.ax-logo {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font: 700 15px/1 var(--font-display);
  box-shadow: var(--shadow-accent);
}

.ax-brand-txt { display: grid; gap: 1px; min-width: 0; }

.ax-brand-txt b {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.ax-brand-txt small { color: var(--muted-2); font-size: 11px; }

/* ---------- 导航 ---------- */

.ax-nav { display: grid; gap: 2px; margin-top: 8px; }

.ax-nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border-radius: 10px;
  color: var(--text-soft);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}

.ax-nav a svg { width: 16px; height: 16px; flex: none; color: var(--muted); }
.ax-nav a:hover { background: var(--surface-strong); color: var(--text); }

.ax-nav a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.ax-nav a[aria-current="page"] svg { color: var(--accent); }

.ax-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin-left: auto;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 10.5px;
  font-style: normal;
  font-weight: 700;
}

/* ---------- 侧栏底部 ---------- */

.ax-side-foot {
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.ax-who { display: flex; align-items: center; gap: 9px; min-width: 0; }

.ax-avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font: 700 12px/1 var(--font-display);
}

.ax-who-txt { display: grid; gap: 1px; min-width: 0; }

.ax-who-txt b {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ax-who-txt small { color: var(--muted-2); font-size: 11px; }

.ax-side-acts { display: flex; gap: 6px; }

.ax-icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--muted);
  cursor: pointer;
  transition: all var(--dur-1) var(--ease);
}

.ax-icon-btn svg { width: 15px; height: 15px; }

.ax-icon-btn:hover {
  border-color: var(--line-strong);
  background: var(--surface-strong);
  color: var(--text);
}

/* ---------- 面板通用 ---------- */

.ax-pane { display: grid; gap: 0; }

.ax-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

/* 只给读屏和标题大纲看的文本：视觉上不占位。 */
.ax-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.ax-head h1,
.ax-head .ax-h {
  margin: 0 0 5px;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.ax-head p {
  max-width: 64ch;
  margin: 0;
  color: var(--text-soft);
  font-size: 13.5px;
  line-height: 1.72;
}

.ax-head code,
.ax-hint code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 0.92em;
}

.ax-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface-strong);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--dur-1) var(--ease);
}

.ax-btn svg { width: 14px; height: 14px; color: var(--muted); }

.ax-btn:hover {
  border-color: var(--accent);
  background: var(--surface-solid);
  color: var(--accent-strong);
}

.ax-btn:hover svg { color: var(--accent); }

.ax-btn-sm { padding: 5px 10px; border-radius: 8px; font-size: 12px; }

.ax-link {
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
}

.ax-link:hover { text-decoration: underline; text-underline-offset: 2px; }

.ax-push { margin-left: auto; }

/* ---------- 统计卡 ---------- */

.ax-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.ax-stat {
  display: grid;
  gap: 4px;
  padding: 16px 16px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  box-shadow: var(--shadow-sm);
}

.ax-stat small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.ax-stat b {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.ax-stat span { color: var(--muted-2); font-size: 12px; line-height: 1.5; }

/* ---------- 卡片与表格 ---------- */

.ax-split {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.ax-card {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  box-shadow: var(--shadow-sm);
}

.ax-card > h2 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.ax-card-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
}

.ax-form { display: grid; gap: 16px; }

.ax-table { display: grid; }

.ax-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 2px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
}

.ax-row:first-child { border-top: 0; }

.ax-row-name {
  display: grid;
  gap: 1px;
  min-width: 0;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ax-row-name small {
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 400;
}

.ax-row-ver {
  padding: 1px 8px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 11.5px;
  white-space: nowrap;
}

.ax-row-num { color: var(--muted); font-size: 12px; white-space: nowrap; }

.ax-kv { display: grid; margin: 0; }

.ax-kv > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.ax-kv > div:first-child { border-top: 0; }
.ax-kv dt { margin: 0; color: var(--muted); }
.ax-kv dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- 表单 ---------- */

.ax-field { display: grid; gap: 7px; }
.ax-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
/* 发布管理的版本号/日期两列等宽：输入框撑满列、不撑破；建议条不溢出 */
.ax-grid2 > .field input { width: 100%; box-sizing: border-box; min-width: 0; }
.ax-grid2 > .field .ax-suggest { max-width: 100%; overflow-wrap: anywhere; }
/* 改枪码扫码卡里的二维码：限宽自适应，hidden 时由全局 [hidden] 规则收起 */
.gm-qr { max-width: 220px; width: 100%; align-self: start; }
/* 改枪码栏目：原先这些是内联 style，会撞 CSP 的 style-src 'self'，统一放这里 */
.gm-title { margin: 20px 0 10px; }
.gm-form { gap: 10px; }
.gm-src-card { margin-top: 20px; }
.gm-sources { margin: 12px 0 18px; }

.ax-label {
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 600;
}

.ax-suggest {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: max-content;
  margin-top: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.ax-suggest b { text-decoration: underline; text-underline-offset: 2px; }

.ax-hint { color: var(--muted-2); font-size: 12px; line-height: 1.6; }
.ax-hint[data-kind="warn"] { color: var(--warning); }

.ax-form-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.ax-draft { color: var(--muted-2); font-size: 11.5px; }
.ax-draft[data-kind="ok"] { color: var(--mint); }
.ax-draft[data-kind="warn"] { color: var(--warning); }
.ax-draft[data-kind="error"] { color: var(--danger); }

/* ---------- 项目芯片 ---------- */

.ax-picker { display: flex; flex-wrap: wrap; gap: 8px; }

.ax-chip {
  display: grid;
  gap: 1px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: all var(--dur-1) var(--ease);
}

.ax-chip b { font-size: 13.5px; font-weight: 650; }
.ax-chip small { color: var(--muted-2); font-size: 11px; font-variant-numeric: tabular-nums; }

.ax-chip:hover { border-color: var(--line-strong); background: var(--surface-strong); }

.ax-chip.is-on {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

.ax-chip.is-on small { color: var(--accent-strong); }

/* ---------- 拖拽上传 ---------- */

.ax-drop {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 26px 20px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  text-align: center;
  cursor: pointer;
  transition: all var(--dur-1) var(--ease);
}

.ax-drop input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.ax-drop svg { width: 26px; height: 26px; color: var(--muted); }
.ax-drop b { font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.ax-drop small { color: var(--muted-2); font-size: 12px; line-height: 1.6; }

.ax-drop:hover,
.ax-drop.is-over {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.ax-drop:hover svg,
.ax-drop.is-over svg { color: var(--accent); }

/* ---------- 工具条 ---------- */

.ax-toolbar { display: flex; align-items: center; gap: 12px; margin: 16px 0 12px; }

.ax-search { position: relative; display: flex; align-items: center; flex: 1; min-width: 0; }

.ax-search svg {
  position: absolute;
  left: 12px;
  width: 14px;
  height: 14px;
  color: var(--muted-2);
  pointer-events: none;
}

.ax-search input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.ax-search input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-strong);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.ax-count { color: var(--muted-2); font-size: 12px; white-space: nowrap; }

/* ---------- 结果与留言 ---------- */

.ax-result { display: grid; gap: 12px; }

.ax-thanks-body {
  margin: 6px 0 0;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.admin-project-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
}

/* 深色主题下 .admin-del 原来用的是硬编码浅色底 */
.admin-del:hover:not(:disabled) { background: var(--danger-soft); color: var(--danger); }

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

.ax-toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 60;
  padding: 11px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-strong);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 600;
  transform: translateX(-50%);
  animation: axToastIn var(--dur-3) var(--ease);
}

.ax-toast[data-kind="ok"] { border-color: var(--mint); color: var(--mint); }
.ax-toast[data-kind="warn"] { border-color: var(--warning); color: var(--warning); }
.ax-toast[data-kind="error"] { border-color: var(--danger); color: var(--danger); }

@keyframes axToastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
}

/* ---------- 确认层 ---------- */

.ax-confirm {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(6, 8, 16, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: axFadeIn var(--dur-1) var(--ease);
}

.ax-confirm-card {
  width: min(430px, 100%);
  padding: 22px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  box-shadow: var(--shadow-lg);
}

.ax-confirm-card h2 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
}

.ax-confirm-card p {
  margin: 0 0 16px;
  color: var(--text-soft);
  font-size: 13.5px;
  line-height: 1.7;
}

.ax-confirm-acts { display: flex; justify-content: flex-end; gap: 10px; }

.ax-snapshots-card {
  width: min(560px, 100%);
  max-height: 72vh;
  display: flex;
  flex-direction: column;
}
.ax-snapshots-list {
  margin: 4px 0 16px;
  overflow: auto;
  min-height: 40px;
}
.ax-snapshots-list .ax-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
}
.ax-snapshots-list .ax-btn {
  font-size: 12.5px;
  padding: 6px 10px;
}

@keyframes axFadeIn { from { opacity: 0; } }

/* ---------- 登录门 ---------- */

.ax-gate { display: grid; place-items: center; min-height: 100vh; padding: 24px; }

.ax-gate-card {
  display: grid;
  gap: 16px;
  width: min(400px, 100%);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  box-shadow: var(--shadow-md);
}

.ax-gate-form { display: grid; gap: 12px; }

.ax-gate-note { margin: 0; color: var(--text-soft); font-size: 13.5px; text-align: center; }

.ax-gate-back {
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
  text-decoration: none;
}

.ax-gate-back:hover { color: var(--text); }

/* ---------- 窄屏 ---------- */

@media (max-width: 940px) {
  .ax-shell { grid-template-columns: minmax(0, 1fr); }

  .ax-side {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    overflow-x: auto;
    padding: 10px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .ax-brand { flex: none; padding: 0; }
  .ax-brand-txt small { display: none; }
  .ax-nav { display: flex; gap: 4px; margin-top: 0; }
  .ax-nav a { padding: 7px 11px; white-space: nowrap; }
  .ax-side-foot { margin-top: 0; margin-left: auto; padding-top: 0; border-top: 0; }
  .ax-who { display: none; }
  .ax-main { padding: 22px 16px 76px; }
  .ax-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ax-split { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px) {
  .ax-stats { grid-template-columns: minmax(0, 1fr); }
  .ax-grid2 { grid-template-columns: minmax(0, 1fr); }
  .ax-head h1,
  .ax-head .ax-h { font-size: 22px; }
  .ax-row { grid-template-columns: minmax(0, 1fr) auto; }
  .ax-row-num { display: none; }
}
/* ==========================================================================
   HalfDone 视觉统一层 —— 把互传（index / admin）对齐到静态站的设计语言：
   单色强调色 + 胶囊控件 + 18px 卡面 + 细发丝线 + 轻量入场动效。
   全部是追加覆盖，靠层叠生效；要回滚就删掉本段。
   ========================================================================== */

/* ---------- 1. 设计变量：与静态站 site.css 的 toolknit 值一致 ---------- */
:root {
  --font-sans: "DengXian", -apple-system, BlinkMacSystemFont,
    "Segoe UI Variable Display", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-display: "DengXian", -apple-system, BlinkMacSystemFont,
    "Segoe UI Variable Display", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;

  --bg: #fafafa;
  --bg-deep: #f1f1f2;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: rgba(255, 255, 255, 0.92);
  --surface-solid: #ffffff;
  --surface-soft: rgba(255, 255, 255, 0.5);

  --text: #0b0b0d;
  --text-soft: #3c3c43;
  --muted: #5e5e67;
  --muted-2: #8a8a92;

  --line: rgba(0, 0, 0, 0.12);
  --line-strong: rgba(0, 0, 0, 0.2);

  --accent: #0b0b0d;
  --accent-strong: #2a2a31;
  --accent-soft: rgba(0, 0, 0, 0.06);
  --accent-ink: #ffffff;
  --violet: var(--accent);
  --violet-soft: var(--accent-soft);

  /* 圆角与动效令牌只在文件顶部 :root 定义一次（与主站 v2/lib/css.mjs 对齐），
     这一层只准引用、不准重定义 —— 以前这里把 --radius-lg/--radius-xl 改成
     22px/28px，成了主站没有的档位，已经删掉。 */

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 18px 40px -28px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 40px 80px -34px rgba(0, 0, 0, 0.36);
  --shadow-accent: none;

  --glass-blur: 18px;
}

html[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-deep: #0f0f10;
  --surface: rgba(24, 24, 28, 0.72);
  --surface-strong: rgba(24, 24, 28, 0.92);
  --surface-solid: #18181c;
  --surface-soft: rgba(24, 24, 28, 0.5);

  --text: #ffffff;
  --text-soft: #d2d2da;
  --muted: #909099;
  --muted-2: #6f6f78;

  --line: rgba(255, 255, 255, 0.11);
  --line-strong: rgba(255, 255, 255, 0.2);

  --accent: #ffffff;
  --accent-strong: #e6e6ec;
  --accent-soft: rgba(255, 255, 255, 0.08);
  --accent-ink: #0a0a0a;
  --violet: var(--accent);
  --violet-soft: var(--accent-soft);

  --mint: #5ce08c;
  --mint-soft: rgba(92, 224, 140, 0.14);
  --danger: #ff8f8f;
  --danger-soft: rgba(255, 143, 143, 0.13);
  --warning: #e8c15c;
  --warning-soft: rgba(232, 193, 92, 0.14);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 18px 40px -24px rgba(0, 0, 0, 0.9);
  --shadow-lg: 0 40px 80px -34px rgba(0, 0, 0, 0.92);
  --shadow-accent: none;
}

/* ---------- 2. 强调色块：从紫蓝渐变改为单色，保证文字对比度 ---------- */
.btn-primary,
.orbit-core,
.user-avatar,
.message.is-mine .bubble,
.drop-hint-inner,
.brand-core,
.boot-mark span {
  color: var(--accent-ink);
  background: var(--accent);
  box-shadow: none;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-strong);
  box-shadow: none;
  filter: none;
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0) scale(0.99);
}

.grad {
  background: linear-gradient(100deg, var(--text), var(--text));
}

/* ---------- 3. 卡面 / 控件形状 ---------- */
.auth-card,
.chat-panel,
.device-item,
.composer,
.empty-state {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  box-shadow: var(--shadow-sm);
}

.device-item {
  transition: transform var(--ease) 0s, border-color 0s, box-shadow 0s;
  transition-duration: var(--dur-2);
}

@media (hover: hover) and (pointer: fine) {
  .device-item:hover {
    transform: translateY(-2px);
    border-color: var(--line-strong);
    box-shadow: var(--shadow-md);
  }
}

.icon-btn {
  border-radius: 999px;
}

.user-avatar {
  border-radius: 12px;
}

.auth-tab[aria-selected="true"],
.auth-tab.is-active {
  border-radius: 999px;
}

.badge-soft,
.pill,
.tag,
.device-badge,
.device-badge--target {
  border-radius: 999px;
}

/* 焦点环统一成柔和外扩，替掉原来的硬描边 */
.field input:focus,
.field textarea:focus,
.message-input:focus,
.composer-field:focus-within,
select:focus,
.search-input:focus {
  outline: none;
  border-color: var(--line-strong);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

/* ---------- 4. 入场动效：与静态站 tkIn 同一曲线与节奏 ---------- */
@keyframes hdIn {
  from {
    opacity: 0;
    translate: 0 12px;
  }
  to {
    opacity: 1;
    translate: 0 0;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .auth-card,
  .chat-panel {
    animation: hdIn var(--dur-4) var(--ease) both;
  }

  .device-item,
  .message {
    animation: hdIn var(--dur-3) var(--ease) both;
    animation-delay: calc(var(--hd-i, 0) * var(--stagger));
  }

  .device-item:nth-child(1) {
    --hd-i: 0;
  }
  .device-item:nth-child(2) {
    --hd-i: 1;
  }
  .device-item:nth-child(3) {
    --hd-i: 2;
  }
  .device-item:nth-child(4) {
    --hd-i: 3;
  }
  .device-item:nth-child(5) {
    --hd-i: 4;
  }
  .device-item:nth-child(n + 6) {
    --hd-i: 5;
  }

  .toast {
    animation-duration: var(--dur-2);
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-card,
  .chat-panel,
  .device-item,
  .message,
  .shelf-count {
    animation: none !important;
    translate: none !important;
  }
  .device-item:hover {
    transform: none;
  }
}

/* ---------- 5. 设置弹窗：修「滚动到底部看不到最后一块」 ----------
   原因：.modal 用 max-height 限制高度 + overflow:hidden，而 .modal-body 的
   max-height 是按 100dvh 算的，比弹窗实际可用高度更大。两者不一致时，
   正文底部被弹窗裁掉，且滚不到——滚动容器自己以为还有空间。
   改法：弹窗变纵向 flex，标题区固定、正文独占剩余高度并在内部滚动。 */
.modal:not([open]) {
  display: none;
}

.modal {
  display: flex;
  flex-direction: column;
  max-height: min(720px, calc(100dvh - 32px));
  overflow: hidden;
}

.modal-head {
  flex: 0 0 auto;
}

.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  scroll-padding-bottom: 24px;
}

.modal-body::-webkit-scrollbar {
  width: 8px;
}

.modal-body::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--line-strong);
}

.modal-body::-webkit-scrollbar-track {
  background: transparent;
}

/* 最后一块留出呼吸位，避免贴着圆角 */
.modal-section:last-child {
  padding-bottom: 6px;
}

@media (max-width: 560px) {
  .modal {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 24px);
    border-radius: 20px;
  }
  .modal-body {
    padding-left: 16px;
    padding-right: 16px;
  }
}
/* ---------- 6. 后台页（/admin）对齐 ----------
   ax-* 本来就用同一套变量，改完上面的 token 就已经同色同阴影；
   这里只补线条宽度、圆角、入场节奏这几处硬编码差异。 */
.ax-btn,
.ax-icon-btn {
  border-radius: 999px;
  border-width: 1px;
}

.ax-nav a {
  border-radius: 999px;
}

.ax-search input {
  border-radius: 999px;
  padding-left: 36px;
}

.ax-drop {
  border-width: 1px;
  border-radius: var(--radius-md);
}

.ax-toast {
  border-width: 1px;
}

.ax-table th {
  font-weight: 700;
}

@media (prefers-reduced-motion: no-preference) {
  .ax-card,
  .ax-stat,
  .ax-gate-card {
    animation: hdIn var(--dur-4) var(--ease) both;
  }

  .ax-stat:nth-child(1) {
    --hd-i: 0;
  }
  .ax-stat:nth-child(2) {
    --hd-i: 1;
  }
  .ax-stat:nth-child(3) {
    --hd-i: 2;
  }
  .ax-stat:nth-child(4) {
    --hd-i: 3;
  }

  .ax-stat {
    animation-delay: calc(var(--hd-i, 0) * var(--stagger));
  }
}

@media (prefers-reduced-motion: reduce) {
  .ax-card,
  .ax-stat,
  .ax-gate-card {
    animation: none !important;
  }
}

/* 后台「访问」页头部右侧的一组控件（范围选择 + 刷新）。
   放在文件末尾是因为它只服务这一个面板，靠层叠盖住通用的头部布局。 */
.ax-head-acts {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ax-head-acts .ax-input {
  height: 34px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.ax-head-acts .ax-input:hover {
  border-color: var(--line-strong);
}

/* 「每天」与榜单一栏：数字用等宽，扫起来不跳 */
.ax-row-num.ax-num-strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ---------- 阅后即焚开关（收发区的小复选框） ---------- */
.burn-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  transition: border-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}

.burn-toggle:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.burn-toggle input {
  width: 12px;
  height: 12px;
  margin: 0;
  accent-color: var(--accent);
}

.burn-toggle:has(input:checked) {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- 音效开关（顶栏 / 后台侧栏，与主站 #sfx-toggle 同名同义） ----------
   js/sfx.js 只在两个 <span id="i-sound"> / <span id="i-mute"> 之间切 hidden，
   这里保证「显示态」不被 [hidden] 的 UA 默认值覆盖掉。 */
.sfx-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sfx-ico[hidden] {
  display: none;
}

@keyframes sfxPing {
  from {
    transform: scale(0.86);
    opacity: 0.6;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: no-preference) {
  #sfx-toggle.on svg {
    animation: sfxPing var(--dur-3) var(--ease);
  }
}

/* ---------- 无障碍：减少动态偏好 ----------
   与主站 v2/lib/cinematic.mjs:616 同一口径：这个偏好下动画与过渡一律关掉。
   文件上方 262 行那一段只压了 animation-duration，覆盖不到 transition，
   所以在这里补齐；放在末尾靠层叠压住前面所有分段的动效声明。 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   发布面板：填链接 / 上传安装包 双模式 + 项目卡片上的操作行
   只服务 admin.html 的「发布」与「项目」两个面板；
   放文件末尾，靠层叠压住上面通用的 .ax-card / .ax-btn / .admin-* 声明。
   ========================================================================== */

/* ---------- 发布方式切换（分段控件） ---------- */

.ax-modes {
  justify-self: start;
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface-soft);
}

.ax-mode {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease),
    box-shadow var(--dur-1) var(--ease);
}

/* 图标必须定尺寸：不定就按 SVG 默认的 300×150 撑开，把按钮顶成一大块 */
.ax-mode svg { width: 14px; height: 14px; flex: none; color: currentColor; }

.ax-mode:hover { color: var(--text); }

.ax-mode.is-on {
  background: var(--surface-solid);
  color: var(--accent-strong);
  box-shadow: var(--shadow-sm);
}

.ax-mode:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* 两个面板本身不占位：靠 [hidden] 切换，display 由这里给 */
.ax-mode-pane { display: grid; gap: 14px; }

/* ---------- 面板抬头右下的状态行 ---------- */

.ax-status {
  margin: 6px 0 0;
  color: var(--muted-2);
  font-size: 12.5px;
  line-height: 1.6;
}

.ax-status:empty { display: none; }
.ax-status[data-kind="ok"] { color: var(--mint); }
.ax-status[data-kind="warn"] { color: var(--warning); }
.ax-status[data-kind="error"] { color: var(--danger); }

/* ---------- 「编辑软件」表单抬头的标识 ---------- */

.ax-card-id {
  margin-left: 8px;
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0;
}

/* ---------- 项目卡片底部的操作行 ---------- */

.ax-row-acts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 11px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

.ax-btn.is-danger {
  border-color: color-mix(in srgb, var(--danger) 32%, transparent);
  color: var(--danger);
}

.ax-btn.is-danger svg { color: var(--danger); }

.ax-btn.is-danger:hover {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.ax-btn.is-danger:hover svg { color: var(--danger); }

.ax-btn:disabled,
.ax-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.ax-btn:disabled:hover,
.ax-btn[disabled]:hover {
  border-color: var(--line-strong);
  background: var(--surface-strong);
  color: var(--text);
}

.ax-btn:disabled:hover svg,
.ax-btn[disabled]:hover svg { color: var(--muted); }

/* ---------- 项目卡片里的状态标签 / 副标题 / 版本条 ---------- */

.admin-tag.is-soft {
  background: var(--mint-soft);
  color: var(--mint);
}

.admin-sub {
  margin: 6px 0 0;
  line-height: 1.65;
}

.admin-ver small {
  margin: 0 2px 0 0;
  color: var(--muted-2);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

/* 外链版本（站内没有副本）与站内版本区分开：换色不换形状，扫一眼就知道它跳出去 */
.admin-ver.is-link code {
  background: var(--violet-soft);
  color: var(--violet);
}

/* 从 GitHub 同步来的版本（projects.json 里没有这一条）：用另一种底色，
   并让右边那个 × 明显是禁用的，免得点半天没反应 */
.admin-ver.is-repo code {
  background: var(--accent-soft);
  color: var(--accent);
}

.admin-ver.is-repo .admin-del {
  opacity: 0.3;
}

/* 站内 / 外链版本的版本号能点开改这一版：做成按钮，但看起来还是一条 chip */
.admin-ver-body {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  border-radius: 7px;
}

.admin-ver-body:hover code { border-color: var(--line-strong); }
.admin-ver-body:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- 维护三卡：站点状态 / 下载目录 / 操作记录 ---------- */

.ax-maint { margin-top: 14px; }

.ax-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin: 10px 0 0;
}

.ax-fact {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
}

.ax-fact span {
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.02em;
}

.ax-fact b {
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}

.ax-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.ax-pill.is-ok { border-color: var(--mint-soft); background: var(--mint-soft); color: var(--mint); }
.ax-pill.is-warn { border-color: var(--warning-soft, var(--line)); background: var(--warning-soft, var(--surface-strong)); color: var(--warning); }
.ax-pill.is-bad { border-color: var(--danger-soft, var(--line)); background: var(--danger-soft, var(--surface-strong)); color: var(--danger); }

.ax-orphans,
.ax-audit {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.ax-orphans li,
.ax-audit li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  font-size: 12.5px;
  line-height: 1.6;
}

.ax-orphans li code,
.ax-audit li code {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--surface-strong);
  color: var(--text);
  font-size: 12px;
}

.ax-audit li b { color: var(--text); font-weight: 600; }
.ax-audit li em { flex-basis: 100%; color: var(--danger); font-style: normal; font-size: 12px; }
.ax-audit li.is-bad { border-color: var(--danger-soft, var(--line)); }

/* 两个维护卡的状态行沿用 .ax-draft 的位置，但要点色 */
.ax-draft[data-kind="ok"] { color: var(--mint); }

/* 项目面板里的结果卡：同步 / 重建 / 改版本都写这儿，跟发布面板的 #result 分开 */
#proj-result:not([hidden]) { margin: 12px 0 4px; }

.admin-log { margin-top: 10px; }

.admin-log summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12.5px;
}

.admin-log pre {
  margin: 8px 0 0;
  max-height: 320px;
  overflow: auto;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 11.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------- 版本折叠 / 换安装包 ---------- */

/* 「还有 N 版，展开」：贴着版本 chip 的一粒小按钮，比 chip 更轻。 */
.admin-ver-more {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border: 1px dashed var(--line-strong);
  border-radius: 7px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
  transition: color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}

.admin-ver-more:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.admin-ver-more:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* 换包那一条：虚线框，跟「改这一版」的普通字段分开，一眼看出是动字节的。 */
.ax-replace {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.ax-replace[hidden] { display: none; }

.ax-replace > div {
  flex: 1 1 320px;
  color: var(--text-soft);
  font-size: 12.5px;
  line-height: 1.6;
}

.ax-replace b {
  color: var(--text);
  font-weight: 600;
  margin-right: 4px;
}

.ax-replace .ax-hint { margin: 0; }

.ax-replace .ax-draft { flex-basis: 100%; }

/* ---------- 多选打包 ---------- */

/* 气泡外面多一层壳，勾选钮钉在右上角；壳本身不改变原有排布。 */
.file-row {
  position: relative;
  display: block;
}

.file-pick {
  position: absolute;
  top: -7px;
  right: -7px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted-2);
  background: var(--surface);
  opacity: 0;
  transition: opacity var(--dur-1), background var(--dur-1), color var(--dur-1);
}

.file-pick .icon {
  width: 12px;
  height: 12px;
}

.file-row:hover .file-pick,
.file-row:focus-within .file-pick,
.file-pick:focus-visible {
  opacity: 1;
}

.file-pick[aria-pressed="true"] {
  border-color: transparent;
  color: #fff;
  background: var(--accent);
  opacity: 1;
}

.file-row.is-picked .file-card,
.file-row.is-picked .message-image {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* 手指点的地方没有 hover，勾选钮得一直看得见。 */
@media (hover: none) {
  .file-pick {
    opacity: 1;
  }
}

.pick-bar {
  position: sticky;
  bottom: 8px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 8px 0;
  padding: 8px 10px 8px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: var(--surface-strong);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
  font-size: 12px;
}

.pick-count b {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.pick-actions {
  display: flex;
  gap: 6px;
}

/* ---------- 生成链接的表单 ---------- */

.share-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.share-field {
  display: grid;
  gap: 5px;
}

.share-field--wide {
  grid-column: 1 / -1;
}

.share-field > span {
  color: var(--muted);
  font-size: 11px;
}

.input,
.select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  background: var(--surface-soft);
  font: inherit;
  font-size: 12.5px;
}

.input:focus,
.select:focus {
  outline: 2px solid var(--accent-soft);
  outline-offset: 1px;
}

@media (max-width: 480px) {
  .share-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- 手机顶部：三条压成三条细的，把正文还给消息区 ---------- */

/*
   手机上真正吃掉正文的是三块：顶栏（约 50px）、在线设备卡片（约 133px）、
   「传输记录」标题（约 71px）—— 加起来 250 多，消息区只剩半屏。
   这里把它们各收成一条：顶栏 44、设备带 36、标题约 40，剩下全给消息列表。

   设备带不再是一个带标题的大卡片，而是一条可横滑的胶囊条：
   「在线设备」标题收进读屏（列表自己带 aria-label），刷新按钮排在右端；
   窄屏也没必要每条设备再写一遍平台（名字里已经有），把副标题藏掉。
   顶栏则把「← 主页」收成一个圆形返回键，站标缩到 28，按钮缩小一档。
   默认还整块收起来：这一段媒体查询里设备带和传输记录标题根本不占位，
   顶栏上的设备按钮（设备数 + 连接状态小圆点）点一下给 html 挂 data-shelf="open"
   才把它们放出来；桌面不在这段媒体查询里，侧栏一直展开，不参与。
   断点取 640 而不是 560：561–620 这一段原来顶着桌面版顶栏，管理员徽标会压到
   连接状态上（左组被压到 0 宽后子项照样往外溢），收成紧凑版后这一段也干净了。
   横屏手机（宽到 900、高度不到 560）也走这套：不然两栏变一栏时，
   522 高的顶部会把 390 高的屏幕挤得只剩 20px 消息区。
*/
@media (max-width: 640px), (max-width: 900px) and (max-height: 560px) {
  .main-view {
    padding: max(6px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
    gap: 8px;
  }

  /* 顶栏 */
  .topbar {
    min-height: 44px;
    padding: 3px 6px 3px 8px;
    border-radius: 16px;
  }

  .topbar-left {
    gap: 6px;
  }

  .back-home--mini {
    width: 32px;
    height: 32px;
    padding: 0;
    justify-content: center;
    gap: 0;
    font-size: 0;
  }

  .back-home--mini::before {
    content: "←";
    font-size: 15px;
    line-height: 1;
  }

  .brand-mark--small {
    width: 28px;
    height: 28px;
    border-radius: 9px;
  }

  .brand-mark--small .brand-ring {
    inset: 5px;
  }

  .brand-mark--small .brand-core {
    width: 8px;
    height: 8px;
  }

  .topbar-actions {
    gap: 2px;
  }

  .topbar-actions .icon-btn {
    width: 32px;
    height: 32px;
  }

  /* 收纳：手机默认只留顶栏；点设备按钮才把设备带和传输记录标题放出来 */
  .shelf-toggle {
    display: inline-grid;
  }

  .sidebar,
  .chat-head {
    display: none;
  }

  html[data-shelf="open"] .sidebar {
    display: block;
  }

  html[data-shelf="open"] .chat-head {
    display: flex;
  }

  .drop-hint {
    inset: 12px;
  }

  html[data-shelf="open"] .drop-hint {
    inset: 66px 12px 12px;
  }

  /* 设备带：没有卡片外壳，只有一条胶囊和右端一个刷新键 */
  .sidebar {
    gap: 0;
  }

  .side-block {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  /* 刷新键排在胶囊条右边（不是浮在上面），横滑的设备不会被按钮压住 */
  .side-head {
    order: 2;
    position: static;
    flex: none;
    margin: 0;
    transform: none;
  }

  .side-head h2 {
    display: none;
  }

  .side-head .text-btn {
    gap: 0;
    padding: 7px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-solid);
    box-shadow: var(--shadow-sm);
    font-size: 0;
  }

  .side-head .text-btn .icon {
    width: 15px;
    height: 15px;
  }

  .device-list {
    flex: 1 1 auto;
    min-width: 0;
    gap: 6px;
    padding: 0;
  }

  .device-item {
    width: auto;
    min-width: 0;
    max-width: 72%;
    flex: 0 0 auto;
    gap: 7px;
    padding: 5px 9px 5px 7px;
    border-radius: 999px;
  }

  .device-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
  }

  .device-avatar .icon {
    width: 14px;
    height: 14px;
  }

  .device-name {
    font-size: 12px;
  }

  .device-meta {
    display: none;
  }

  .device-badge {
    padding: 1px 5px;
    font-size: 9px;
  }

  /* 「传输记录」标题：一行说完，目标说明接在后面 */
  .chat-head {
    gap: 8px;
    padding: 7px 10px 7px 12px;
  }

  .chat-head > div:first-child {
    display: flex;
    align-items: baseline;
    gap: 7px;
    min-width: 0;
  }

  .chat-head h2 {
    font-size: 13.5px;
    line-height: 1.15;
    white-space: nowrap;
  }

  .chat-subtitle {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    overflow: hidden;
    font-size: 11px;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .chat-actions .text-btn {
    padding: 3px;
  }

  .message-list {
    padding: 10px 12px 4px;
  }
}

/* ---------- 窄屏顶栏：一行放下，别折成两行占地方 ---------- */

/*
  顶栏是 flex + space-between：左边是「主页 / 互传 / 头像」，右边是一串图标按钮。
  窄屏时左边那组带 min-width:0，会被压缩到 0 宽，而里面的子项都是 flex:none，
  于是从 0 宽里溢出来，跟右边那串按钮压在一起 —— 这就是手机上看到的「按钮叠在一起」。
  一开始的修法是折成两行，但两行要吃掉 94px 高，手机上太占地方；
  ≤640 已经把「主页」收成圆形返回键、站标缩到 28，这里接着把行内元素再紧一档：
  站名只留标记不留字、按钮 32、间距 6→2、头像缩到 24；380 以下收掉站标、按钮 30，
  340 以下连连接状态那颗也收掉，保证 320 宽也装得进一行。
*/
@media (max-width: 430px) {
  .topbar {
    flex-wrap: nowrap;
    gap: 6px;
    min-height: 44px;
    padding: 3px 6px 3px 8px;
  }

  .topbar-left {
    flex: 0 1 auto;
    gap: 6px;
  }

  .brand-mini {
    gap: 0;
  }

  .brand-mini-copy {
    display: none;
  }

  .topbar-actions {
    flex: none;
    gap: 2px;
  }

  .topbar-actions .icon-btn {
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
  }

  /* 状态收进设备按钮右上角的小圆点（数量 + 绿/琥珀/红），这里不再单占一颗胶囊 */
  .conn-pill {
    display: none;
  }

  .user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 8px;
  }
}

@media (max-width: 380px) {
  .topbar {
    gap: 6px;
  }

  .topbar .brand-mini {
    display: none;
  }

  .topbar-actions {
    gap: 1px;
  }

  .topbar-actions .icon-btn {
    width: 30px;
    height: 30px;
  }
}