/* ============================================================
   龟仙流短信箱 · style.css
   零构建静态样式：龟仙流橙 #f97316 / 藏青 #1e3a8a / 龙珠红 #dc2626
   ============================================================ */

:root {
  --pink: #f97316;
  --pink-2: #ea580c;
  --pink-soft: #ffedd5;
  --lav: #1e3a8a;
  --lav-2: #1e40af;
  --lav-soft: #dbeafe;
  --mint: #2563eb;
  --mint-soft: #dbeafe;
  --ink: #1f2937;
  --ink-2: #57534e;
  --line: #e7e5e4;
  --card: rgba(255, 255, 255, .78);
  --radius: 20px;
  --shadow: 0 8px 30px rgba(249, 115, 22, .14), 0 2px 6px rgba(30, 41, 59, .05);
  --font: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: linear-gradient(165deg, #fffaf3 0%, #ffedd5 40%, #fed7aa 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
::selection { background: #fed7aa; color: var(--ink); }
a { color: var(--lav-2); }
button, input, select, textarea { font-family: inherit; }
:focus-visible { outline: 2.5px solid rgba(249, 115, 22, .85); outline-offset: 2px; }
[hidden] { display: none !important; }
* { scrollbar-width: thin; scrollbar-color: rgba(249, 115, 22, .3) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: rgba(249, 115, 22, .28); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.i { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: -3px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- 背景装饰（速度线 / 气 / 四星珠） ---------- */
.bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .5; }
.b1 { width: 520px; height: 520px; background: #ffd9ac; top: -190px; left: -150px; opacity: .45; }
.b2 { width: 560px; height: 560px; background: #fdba74; top: -150px; right: -190px; opacity: .3; }
.b3 { width: 480px; height: 480px; background: #bfdbfe; bottom: -220px; left: 26%; opacity: .22; }
.speedlines { position: absolute; inset: 0; }
.speedlines::before, .speedlines::after { content: ""; position: absolute; border-radius: 50%; }
.speedlines::before {
  top: -32%; right: -26%; width: 78vmax; height: 78vmax;
  background: repeating-conic-gradient(from 198deg at 100% 0%, rgba(234, 88, 12, .2) 0deg 1deg, transparent 1deg 4.6deg);
  -webkit-mask-image: radial-gradient(circle at 100% 0%, #000 0 18%, transparent 60%);
  mask-image: radial-gradient(circle at 100% 0%, #000 0 18%, transparent 60%);
  opacity: .5;
}
.speedlines::after {
  bottom: -36%; left: -30%; width: 66vmax; height: 66vmax;
  background: repeating-conic-gradient(from 20deg at 0% 100%, rgba(30, 58, 138, .12) 0deg 1deg, transparent 1deg 5.2deg);
  -webkit-mask-image: radial-gradient(circle at 0% 100%, #000 0 16%, transparent 58%);
  mask-image: radial-gradient(circle at 0% 100%, #000 0 16%, transparent 58%);
  opacity: .4;
}
.dball { position: absolute; animation: drift 26s ease-in-out infinite alternate; }
.dball-1 { width: 92px; height: 92px; top: 7%; right: 5%; opacity: .3; animation-delay: -4s; }
.dball-2 { width: 62px; height: 62px; bottom: 10%; left: 3.5%; opacity: .24; animation-delay: -13s; }
.dball-3 { width: 42px; height: 42px; top: 64%; right: 12%; opacity: .16; }

@keyframes drift {
  from { transform: translateY(-10px) rotate(-7deg); }
  to   { transform: translateY(12px) rotate(9deg); }
}
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slideIn { from { opacity: 0; transform: translateY(-14px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateX(22px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(22px); } }
@keyframes dlgIn { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes pulseWarn { 0%, 100% { box-shadow: 0 0 0 0 rgba(234, 88, 12, .22); } 50% { box-shadow: 0 0 0 6px rgba(234, 88, 12, 0); } }
@keyframes dotPulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

/* ---------- 启动骨架 ---------- */
.boot {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
}
.boot-logo { width: 138px; height: 138px; animation: float 4.5s ease-in-out infinite; filter: drop-shadow(0 14px 28px rgba(234, 88, 12, .3)); }
.boot-name { font-size: 18px; font-weight: 900; letter-spacing: 2px; margin: 6px 0 0; }
.boot-tip { font-size: 12.5px; color: var(--ink-2); margin: 0; animation: blink 1.5s ease-in-out infinite; }
.noscript {
  position: fixed; inset: auto 16px 16px; z-index: 200;
  padding: 14px 18px; border-radius: 14px; background: #fff7ed; color: #b91c1c;
  border: 1px solid #fdba74; text-align: center;
}

/* ---------- 布局骨架 ---------- */
.shell { position: relative; z-index: 1; display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; align-items: start; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 18px 0 18px 18px; display: flex; }
.side-card {
  flex: 1; display: flex; flex-direction: column; gap: 14px;
  padding: 20px 15px 16px;
  background: rgba(255, 255, 255, .66);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, .88);
  border-radius: 26px;
  box-shadow: var(--shadow);
  min-height: 0;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 2px 4px; text-decoration: none; color: inherit; }
.logo { display: block; flex: none; }
.brand .logo { width: 44px; height: 44px; filter: drop-shadow(0 5px 12px rgba(234, 88, 12, .32)); animation: float 4.6s ease-in-out infinite; }
.brand-name { font-size: 14.5px; font-weight: 900; letter-spacing: 0; line-height: 1.3; word-break: break-word; }
.brand-sub { font-size: 10px; color: var(--ink-2); letter-spacing: 1.6px; margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
.nav-label { font-size: 10.5px; color: #78716c; letter-spacing: 1.6px; margin: 10px 10px 3px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  min-height: 44px; padding: 9px 12px;
  border-radius: 14px;
  color: var(--ink-2); text-decoration: none;
  font-size: 14.5px; font-weight: 650;
  transition: background .18s, color .18s, box-shadow .18s, transform .12s;
}
.nav-item .i { width: 20px; height: 20px; }
.nav-item:hover { background: rgba(255, 255, 255, .9); color: var(--ink); }
.nav-item:active { transform: scale(.985); }
.nav-item[aria-current="page"] {
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #fff;
  box-shadow: 0 8px 20px rgba(234, 88, 12, .32);
}
.nav-item[aria-current="page"] .i { filter: drop-shadow(0 1px 2px rgba(30, 41, 59, .18)); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 9px; }
.side-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: 16px;
  background: rgba(255, 255, 255, .72);
  border: 1px solid rgba(249, 115, 22, .14);
}
.user-meta { min-width: 0; }
.user-name { font-size: 13.5px; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--ink-2); }

.main { min-width: 0; width: 100%; max-width: 1260px; margin: 0 auto; padding: 0 34px 64px; }
.view { position: relative; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 15px 0 12px;
  background: linear-gradient(180deg, rgba(255, 247, 237, .95) 0%, rgba(255, 247, 237, .82) 62%, rgba(255, 247, 237, 0) 100%);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.topbar-title { min-width: 0; }
.topbar-title h1 {
  margin: 0; font-size: 22px; font-weight: 900; letter-spacing: .5px; line-height: 1.22;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .8);
}
.topbar-title h1::after {
  content: ""; display: block; width: 34px; height: 4px; margin-top: 5px;
  border-radius: 3px; background: linear-gradient(90deg, #f97316, #dc2626);
  transform: skewX(-18deg);
}
.topbar-title p { margin: 2px 0 0; font-size: 12px; color: var(--ink-2); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.brand-mobile { display: none; align-items: center; gap: 7px; min-width: 0; }
.brand-mobile .logo { width: 36px; height: 36px; }
.brand-mobile .brand-name { font-size: 14.5px; }

.live {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 34px; padding: 6px 11px;
  border-radius: 999px; font-size: 11.5px; color: var(--ink-2);
  background: rgba(255, 255, 255, .74);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.live .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 3px rgba(37, 99, 235, .18); transition: background .2s; }
.live.connecting .dot { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .2); animation: dotPulse 1.1s infinite; }
.live.polling .dot { background: var(--lav); box-shadow: 0 0 0 3px rgba(249, 115, 22, .2); }
.live.off .dot { background: #a8a29e; box-shadow: none; }

.clock-chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 34px; padding: 6px 11px;
  border-radius: 999px;
  font-size: 12px; font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  background: rgba(255, 255, 255, .74);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.clock-chip .i { width: 14px; height: 14px; }
.clock-chip.warn { color: #b91c1c; background: #fee2e2; border-color: #fdba74; animation: pulseWarn 1.7s infinite; }
.clock-chip.expired { color: #b91c1c; background: #fee2e2; border-color: #fdba74; }

.user-menu-wrap { position: relative; }
.avatar-btn {
  width: 38px; height: 38px; padding: 0;
  border-radius: 50%; border: 2px solid rgba(255, 255, 255, .92);
  background: linear-gradient(135deg, #fb923c, #dc2626);
  color: #fff; font-size: 15px; font-weight: 800; text-transform: uppercase;
  display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 4px 12px rgba(249, 115, 22, .28);
}
.avatar-btn:hover { filter: brightness(1.04); }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
  min-width: 184px; padding: 6px;
  background: rgba(255, 255, 255, .97);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 16px 44px rgba(30, 41, 59, .17);
}
.menu-head { padding: 7px 10px 9px; border-bottom: 1px dashed var(--line); margin-bottom: 4px; }
.menu-head .user-name { font-size: 13.5px; }
.menu-head .user-role { font-size: 11px; }
.menu-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; min-height: 40px; padding: 8px 10px;
  border: none; border-radius: 11px; background: none;
  font: inherit; font-size: 13.5px; color: var(--ink); text-align: left;
  cursor: pointer;
}
.menu-item:hover { background: var(--lav-soft); }
.menu-item.danger { color: #b91c1c; }
.menu-item.danger:hover { background: #fee2e2; }
.menu-item .i { width: 17px; height: 17px; }

/* ---------- 移动端顶部导航 / 底部 tabbar ---------- */
.topnav { display: none; }
.nav-pill {
  display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 7px 13px;
  border-radius: 12px; text-decoration: none;
  color: var(--ink-2); font-size: 13.5px; font-weight: 650;
  white-space: nowrap;
}
.nav-pill .i { width: 18px; height: 18px; }
.nav-pill[aria-current="page"] {
  color: #1e3a8a;
  background: linear-gradient(135deg, rgba(249, 115, 22, .18), rgba(249, 115, 22, .2));
}
.nav-pill:active { background: rgba(249, 115, 22, .16); }

/* ---------- 通用控件 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 9px 16px;
  border-radius: 13px;
  border: 1.5px solid var(--line);
  background: rgba(255, 255, 255, .75);
  color: var(--ink);
  font: inherit; font-size: 14px; font-weight: 650;
  text-decoration: none; cursor: pointer;
  transition: transform .12s, box-shadow .18s, background .18s, color .18s, border-color .18s;
}
.btn:hover { transform: translateY(-1px); background: #fff; box-shadow: 0 6px 16px rgba(249, 115, 22, .14); }
.btn:active { transform: translateY(0) scale(.99); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn .i { width: 18px; height: 18px; }
.btn-primary {
  background: linear-gradient(135deg, #f97316, #dc2626);
  border-color: transparent; color: #fff;
  box-shadow: 0 8px 20px rgba(249, 115, 22, .32);
}
.btn-primary:hover { background: linear-gradient(135deg, #ea580c, #b91c1c); box-shadow: 0 10px 24px rgba(249, 115, 22, .36); }
.btn-ghost { background: rgba(255, 255, 255, .6); }
.btn-danger { color: #b91c1c; background: #fff7ed; border-color: #fdba74; }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: 12.5px; border-radius: 11px; }
.btn-block { width: 100%; }
.btn-soft { background: linear-gradient(135deg, rgba(255, 237, 213, .9), rgba(219, 234, 254, .9)); border-color: rgba(251, 146, 60, .5); color: #c2410c; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; min-height: 40px; padding: 0;
  border-radius: 12px; border: 1.5px solid var(--line);
  background: rgba(255, 255, 255, .74);
  color: var(--ink-2); cursor: pointer;
  transition: background .16s, color .16s, border-color .16s, transform .12s;
}
.icon-btn:hover { color: var(--pink-2); border-color: #fdba74; background: #fff7ed; }
.icon-btn:active { transform: scale(.96); }
.icon-btn.sm { width: 34px; height: 34px; min-height: 34px; border-radius: 10px; }
.icon-btn.danger:hover { color: #b91c1c; border-color: #fdba74; background: #fef2f2; }
.icon-btn .i { width: 18px; height: 18px; }
.icon-btn.sm .i { width: 16px; height: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 650; color: var(--ink); }
.input {
  width: 100%; min-height: 44px;
  padding: 10px 13px;
  border-radius: 13px;
  border: 1.5px solid rgba(249, 115, 22, .22);
  background: rgba(255, 255, 255, .84);
  color: var(--ink);
  font: inherit; font-size: 14.5px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input::placeholder { color: #a8a29e; }
.input:hover { border-color: rgba(249, 115, 22, .38); }
.input:focus { border-color: var(--pink); background: #fff; box-shadow: 0 0 0 4px rgba(249, 115, 22, .15); }
.input[aria-invalid="true"] { border-color: #f87171; box-shadow: 0 0 0 4px rgba(248, 113, 113, .13); }
textarea.input { min-height: 104px; resize: vertical; line-height: 1.65; }
select.input {
  appearance: none; -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2357534e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}
.input-group { position: relative; display: flex; align-items: center; }
.input-group > .i { position: absolute; left: 12px; width: 18px; height: 18px; color: var(--ink-2); pointer-events: none; }
.input-group > .input { padding-left: 38px; }
.input-group > .icon-btn { position: absolute; right: 4px; width: 36px; height: 36px; min-height: 36px; border: none; background: none; }
.input-group > .icon-btn:hover { background: rgba(249, 115, 22, .12); }
.input-group > .input.has-trail { padding-right: 46px; }
.hint { font-size: 12px; color: var(--ink-2); }
.hint.warn { color: #b45309; }
.err { display: flex; align-items: flex-start; gap: 6px; font-size: 12.5px; color: #b91c1c; }
.err .i { width: 15px; height: 15px; margin-top: 1px; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch .track { position: relative; width: 42px; height: 24px; flex: none; border-radius: 999px; background: #d6d3d1; transition: background .2s; }
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(30, 41, 59, .28);
  transition: transform .2s;
}
.switch input:checked + .track { background: linear-gradient(135deg, #f97316, #dc2626); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 4px rgba(249, 115, 22, .22); }
.switch input:disabled + .track { opacity: .45; cursor: not-allowed; }
.switch-label { font-size: 13px; color: var(--ink-2); }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 650; line-height: 1.5;
  background: var(--lav-soft); color: #1e3a8a; white-space: nowrap;
}
.chip .i { width: 12px; height: 12px; }
.chip.pink { background: var(--pink-soft); color: #b91c1c; }
.chip.mint { background: var(--mint-soft); color: #1d4ed8; }
.chip.warn { background: #ffedd5; color: #b45309; }
.chip.danger { background: #fee2e2; color: #b91c1c; }
.chip.ghost { background: rgba(255, 255, 255, .75); border: 1px solid var(--line); color: var(--ink-2); }
.chip.role-admin { background: linear-gradient(135deg, #ffedd5, #fee2e2); color: #c2410c; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 5px;
  min-height: 34px; padding: 6px 13px;
  border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--line);
  background: rgba(255, 255, 255, .7);
  color: var(--ink-2); font: inherit; font-size: 12.5px; font-weight: 650;
  transition: background .16s, color .16s, border-color .16s;
}
.chip-btn:hover { background: #fff; color: var(--ink); }
.chip-btn[aria-pressed="true"] { background: linear-gradient(135deg, #f97316, #dc2626); border-color: transparent; color: #fff; box-shadow: 0 5px 14px rgba(249, 115, 22, .3); }

.card {
  background: var(--card);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel { padding: 18px; border-radius: var(--radius); }
.panel h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; font-size: 15.5px; font-weight: 900; }
.panel h2 .i { width: 19px; height: 19px; color: var(--pink-2); }
.muted { color: var(--ink-2); font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.spacer { margin-left: auto; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.divider { height: 1px; background: var(--line); border: none; margin: 2px 0; }

.avatar {
  width: 38px; height: 38px; flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #fb923c, #dc2626);
  color: #fff; font-size: 15px; font-weight: 800; text-transform: uppercase;
  box-shadow: 0 3px 9px rgba(249, 115, 22, .3);
}

/* ---------- 页面通用头 ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin: 6px 0 15px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 17.5px; font-weight: 900; letter-spacing: .2px; }
.page-head p { margin: 3px 0 0; font-size: 12.5px; color: var(--ink-2); }
.head-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.limit { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); }
.limit .bar { width: 74px; height: 6px; border-radius: 999px; background: #dbeafe; overflow: hidden; }
.limit .bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #f97316, #ea580c); transition: width .3s; }

/* ---------- 登录页 ---------- */
.login-wrap {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 30px 18px;
}
.login-card {
  position: relative;
  width: 100%; max-width: 404px;
  padding: 26px 28px 22px;
  text-align: center;
  background: rgba(255, 255, 255, .84);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, .95);
  border-radius: 26px;
  box-shadow: 0 22px 60px rgba(234, 88, 12, .18), 0 4px 16px rgba(30, 41, 59, .06);
}
.login-card::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 5px;
  border-radius: 26px 26px 0 0;
  background: linear-gradient(90deg, #f97316, #dc2626);
  opacity: .9;
}
.login-logo { display: block; width: 126px; height: 126px; margin: 4px auto 2px; filter: drop-shadow(0 12px 26px rgba(234, 88, 12, .3)); animation: float 4.5s ease-in-out infinite; }
.login-title {
  margin: 2px 0 3px; font-size: 24px; font-weight: 900; letter-spacing: 1px;
  background: linear-gradient(120deg, #ea580c, #dc2626);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.login-sub { margin: 0 0 18px; font-size: 12.5px; color: var(--ink-2); }
.login-form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.login-form .btn-primary { min-height: 46px; font-size: 15px; margin-top: 2px; }
.login-foot { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 15px; font-size: 11.5px; color: #78716c; }
.login-foot .dot-sep { width: 3px; height: 3px; border-radius: 50%; background: #d6d3d1; }
.login-note { display: flex; align-items: center; gap: 6px; justify-content: center; color: #78716c; font-size: 11.5px; }
.login-note .i { width: 14px; height: 14px; }

/* ---------- 收件箱 ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; padding: 11px 12px; margin-bottom: 13px; border-radius: 18px; }
.toolbar .search { flex: 1 1 220px; min-width: 170px; }
.toolbar .search .input { min-height: 40px; }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: rgba(219, 234, 254, .75); }
.seg button {
  min-height: 34px; padding: 6px 12px; border: none; border-radius: 9px;
  background: none; color: var(--ink-2); font: inherit; font-size: 12.5px; font-weight: 650;
  cursor: pointer; transition: background .16s, color .16s, box-shadow .16s;
}
.seg button:hover { color: var(--ink); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(249, 115, 22, .18); }
.chips-row { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; width: 100%; }
.toolbar-meta { margin-left: auto; font-size: 11.5px; color: var(--ink-2); display: flex; align-items: center; gap: 5px; }
.toolbar-meta .i { width: 13px; height: 13px; }

.msg-list { display: flex; flex-direction: column; gap: 10px; }
.msg {
  position: relative; display: flex; gap: 12px;
  padding: 13px 15px 13px 17px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .8);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, .92);
  box-shadow: 0 4px 16px rgba(249, 115, 22, .1);
  overflow: hidden;
  transition: box-shadow .18s, transform .18s;
}
.msg:hover { box-shadow: 0 8px 24px rgba(249, 115, 22, .16); }
.msg::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: linear-gradient(180deg, #f97316, #fdba74); }
.msg.out::before { background: linear-gradient(180deg, #1e3a8a, #60a5fa); }
.msg.new { animation: slideIn .42s cubic-bezier(.2, .8, .2, 1); }
.msg-main { flex: 1; min-width: 0; }
.msg-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 4px; }
.msg-peer { font-size: 14.5px; font-weight: 750; letter-spacing: .2px; word-break: break-all; }
.msg-time { margin-left: auto; font-size: 11.5px; color: #78716c; font-variant-numeric: tabular-nums; white-space: nowrap; }
.msg-content { margin: 0; font-size: 14.5px; line-height: 1.7; color: #292524; white-space: pre-wrap; word-break: break-word; }
.msg-actions { flex: none; display: flex; flex-direction: column; gap: 6px; }
.new-badge {
  display: inline-flex; align-items: center;
  padding: 1px 7px; border-radius: 999px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .5px;
  color: #fff; background: linear-gradient(135deg, #f97316, #dc2626);
  box-shadow: 0 3px 8px rgba(234, 88, 12, .3);
}
.code {
  display: inline-block; margin: 0 2px; padding: 0 6px;
  border-radius: 8px;
  border: 1px dashed #fb923c;
  background: linear-gradient(135deg, #ffedd5, #fee2e2);
  color: #b91c1c;
  font-family: var(--mono); font-size: 14.5px; font-weight: 800; letter-spacing: 1px;
  cursor: pointer; transition: background .16s, transform .12s;
}
.code:hover { background: #ffedd5; }
.code:active { transform: scale(.97); }
.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 54px 20px 48px; text-align: center; color: var(--ink-2); }
.empty .logo { width: 112px; height: 112px; opacity: .95; animation: float 5s ease-in-out infinite; }
.empty h3 { margin: 2px 0 0; font-size: 16px; font-weight: 800; color: var(--ink); }
.empty p { margin: 0; font-size: 13px; max-width: 340px; line-height: 1.7; }
.empty .btn { margin-top: 8px; }
.load-more { display: flex; justify-content: center; margin: 18px 0 4px; }
.notice {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 15px 17px; margin-bottom: 13px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 237, 213, .85), rgba(219, 234, 254, .75));
  border: 1px solid rgba(251, 146, 60, .55);
  color: #9a3412;
}
.notice .i { width: 22px; height: 22px; flex: none; color: var(--pink-2); margin-top: 1px; }
.notice h3 { margin: 0 0 2px; font-size: 14.5px; color: var(--ink); }
.notice p { margin: 0; font-size: 12.5px; line-height: 1.65; }
.new-pill {
  position: fixed; left: 50%; top: 72px; z-index: 40;
  transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border: none; border-radius: 999px;
  background: linear-gradient(135deg, #f97316, #dc2626);
  color: #fff; font: inherit; font-size: 13px; font-weight: 700;
  box-shadow: 0 10px 26px rgba(249, 115, 22, .42);
  cursor: pointer; animation: slideIn .3s ease;
}
.new-pill .i { width: 15px; height: 15px; transform: rotate(-90deg); }
.skeleton { display: flex; flex-direction: column; gap: 10px; }
.sk-card { height: 88px; border-radius: 18px; background: linear-gradient(100deg, rgba(255, 255, 255, .55) 30%, rgba(255, 255, 255, .9) 50%, rgba(255, 255, 255, .55) 70%); background-size: 220% 100%; animation: shimmer 1.4s infinite linear; border: 1px solid rgba(255, 255, 255, .8); }
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -80% 0; } }

/* ---------- 发送页 ---------- */
.send-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, .9fr); gap: 16px; align-items: start; }
.send-grid > * { min-width: 0; }
.send-form { display: flex; flex-direction: column; gap: 14px; }
.content-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--ink-2); }
.content-meta .over { color: #b91c1c; font-weight: 700; }
.send-actions { display: flex; align-items: center; gap: 10px; margin-top: 2px; }
.send-actions .btn-primary { flex: 1; min-height: 46px; font-size: 15px; }
.recent-list { display: flex; flex-direction: column; gap: 9px; }
.recent-item { display: flex; gap: 10px; padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, .65); border: 1px solid var(--line); }
.recent-item .grow { min-width: 0; }
.recent-peer { font-size: 13px; font-weight: 700; }
.recent-content { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-item .time { font-size: 11px; color: #78716c; white-space: nowrap; }
.recent-item.failed { border-color: #fdba74; background: #fff7ed; }
.result-card { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; font-size: 13px; line-height: 1.6; }
.result-card.ok { background: var(--mint-soft); border: 1px solid #bfdbfe; color: #1d4ed8; }
.result-card.bad { background: #fef2f2; border: 1px solid #fdba74; color: #b91c1c; }
.result-card .i { width: 19px; height: 19px; flex: none; margin-top: 1px; }

/* ---------- 管理 · 用户 ---------- */
.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(305px, 1fr)); gap: 14px; }
.user-grid > * { min-width: 0; }
.user-card { padding: 16px; }
.user-card-top { display: flex; align-items: center; gap: 11px; margin-bottom: 10px; }
.user-card .avatar { width: 44px; height: 44px; font-size: 17px; }
.user-card-name { font-size: 15px; font-weight: 750; line-height: 1.3; word-break: break-all; }
.user-card-sub { font-size: 11.5px; color: var(--ink-2); margin-top: 2px; }
.user-card .chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
.toggle-row, .scope-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px dashed var(--line); }
.t-label { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); }
.t-label .i { width: 15px; height: 15px; }
.scope-row select { width: auto; min-height: 34px; padding: 5px 28px 5px 10px; font-size: 12.5px; border-radius: 10px; }
.card-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 11px; padding-top: 11px; border-top: 1px dashed var(--line); }
.card-actions .btn { flex: 1 1 auto; }
.user-card.disabled-user { opacity: .72; }
.user-card.disabled-user .avatar { filter: grayscale(.55); }

/* ---------- 管理 · 设备 ---------- */
.device-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(345px, 1fr)); gap: 14px; }
.device-grid > * { min-width: 0; }
.device-card { padding: 16px; }
.device-top { display: flex; align-items: center; gap: 9px; margin-bottom: 4px; }
.device-name { font-size: 15.5px; font-weight: 750; word-break: break-all; }
.status { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--ink-2); white-space: nowrap; }
.status .dot { width: 7px; height: 7px; border-radius: 50%; background: #a8a29e; }
.status.online { color: #1d4ed8; }
.status.online .dot { background: var(--mint); box-shadow: 0 0 0 3px rgba(37, 99, 235, .18); }
.device-meta { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0 6px; }
.hook-box { display: flex; align-items: center; gap: 5px; padding: 6px 7px 6px 11px; margin: 7px 0; border-radius: 12px; background: rgba(255, 255, 255, .72); border: 1px solid var(--line); }
.hook-box code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 11.5px; color: #334155; }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 0; font-size: 12.5px; color: var(--ink-2); }
.field-row .val { max-width: 62%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-weight: 600; }
.field-row .val.mono { font-family: var(--mono); font-size: 11.5px; letter-spacing: .4px; }
.device-card .card-actions .btn { flex: 1 1 44%; font-size: 12.5px; padding: 7px 10px; }
.sim-list { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 2px; }
.sim-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 11px; background: rgba(219, 234, 254, .5); font-size: 12.5px; }
.sim-item .num { font-family: var(--mono); }

/* ---------- 我的 ---------- */
.me-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.profile-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.profile-head .avatar { width: 58px; height: 58px; font-size: 22px; }
.profile-name { font-size: 18px; font-weight: 800; word-break: break-all; }
.profile-sub { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.kv-list { display: flex; flex-direction: column; }
.kv { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--ink-2); flex: none; }
.kv .v { font-weight: 650; text-align: right; font-variant-numeric: tabular-nums; }
.kv .v.small { font-size: 12.5px; font-weight: 500; }
.me-form { display: flex; flex-direction: column; gap: 12px; }
.logout-zone { margin-top: 16px; }
.clock-big { display: inline-flex; align-items: center; gap: 7px; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .5px; color: var(--ink); }
.clock-big.warn { color: #b91c1c; }
.clock-big .i { width: 20px; height: 20px; }

/* ---------- 对话框 ---------- */
.dlg {
  width: min(560px, calc(100vw - 28px));
  max-height: min(86vh, 780px);
  padding: 0; border: none; border-radius: 24px;
  background: rgba(255, 251, 245, .97);
  backdrop-filter: blur(20px);
  box-shadow: 0 30px 80px rgba(30, 41, 59, .3);
  color: var(--ink);
  overflow: auto;
}
.dlg::backdrop { background: rgba(30, 41, 59, .36); backdrop-filter: blur(4px); }
.dlg[open] { animation: dlgIn .24s cubic-bezier(.2, .8, .2, 1); }
.dlg-form { display: flex; flex-direction: column; min-height: 0; }
.dlg-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 10px;
  padding: 17px 20px 12px;
  background: rgba(255, 251, 245, .97);
  border-bottom: 1px solid rgba(249, 115, 22, .12);
}
.dlg-head h2 { flex: 1; margin: 0; font-size: 16.5px; font-weight: 800; }
.dlg-body { display: flex; flex-direction: column; gap: 13px; padding: 16px 20px; }
.dlg-foot {
  position: sticky; bottom: 0; z-index: 2;
  display: flex; justify-content: flex-end; gap: 9px;
  padding: 13px 20px calc(15px + env(safe-area-inset-bottom));
  background: rgba(255, 251, 245, .97);
  border-top: 1px solid rgba(249, 115, 22, .12);
}
.dlg-foot .btn { min-width: 84px; }
.dlg-note { font-size: 12.5px; color: var(--ink-2); line-height: 1.65; }
.dlg-list { margin: 6px 0 10px; padding-left: 20px; font-size: 12.5px; color: var(--ink-2); line-height: 1.8; }
.dlg-list li { margin: 2px 0; }
.dlg-note.warn { color: #b45309; background: #fffbeb; border: 1px solid #fed7aa; border-radius: 11px; padding: 9px 11px; }
.dlg-note.danger { color: #b91c1c; background: #fef2f2; border: 1px solid #fdba74; border-radius: 11px; padding: 9px 11px; }
.sim-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.sim-table th, .sim-table td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--line); }
.sim-table th { color: var(--ink-2); font-weight: 650; white-space: nowrap; }
.test-ok { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--mint-soft); border: 1px solid #bfdbfe; color: #1d4ed8; font-size: 13px; }
.test-bad { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: 12px; background: #fef2f2; border: 1px solid #fdba74; color: #b91c1c; font-size: 13px; line-height: 1.6; }
.test-ok .i, .test-bad .i { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.confirm-text { font-size: 14px; line-height: 1.7; margin: 0; }
.confirm-text strong { color: #b91c1c; }

/* ---------- Toast ---------- */
.toasts {
  position: fixed; top: 18px; right: 20px; z-index: 200;
  display: flex; flex-direction: column; gap: 9px;
  max-width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 9px;
  padding: 11px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .98);
  border: 1px solid var(--line);
  box-shadow: 0 14px 36px rgba(30, 41, 59, .17);
  font-size: 13.5px; line-height: 1.55; color: var(--ink);
  animation: toastIn .28s cubic-bezier(.2, .8, .2, 1);
}
.toast .i { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.toast.success .i { color: #1d4ed8; }
.toast.error .i { color: #b91c1c; }
.toast.info .i { color: var(--lav-2); }
.toast.out { animation: toastOut .22s forwards; }
.spinner { width: 18px; height: 18px; flex: none; border-radius: 50%; border: 2.2px solid rgba(255, 255, 255, .45); border-top-color: #fff; animation: spin .7s linear infinite; }
.spinner.dark { border-color: rgba(249, 115, 22, .22); border-top-color: var(--lav); }
.loading-line { display: flex; align-items: center; justify-content: center; gap: 9px; padding: 26px; color: var(--ink-2); font-size: 13px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  .main { padding: 0 24px 56px; }
  .topbar-title h1 { font-size: 19px; }
}
@media (max-width: 1023px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 0 22px 60px; }
  .topbar { gap: 10px; }
  .brand-mobile { display: flex; }
  .brand-mobile .brand-name { display: none; }
  .topbar-title { display: block; }
  .topbar-title h1 { font-size: 18.5px; }
  .topbar-title p { display: none; }
  .topnav {
    display: flex; gap: 5px;
    overflow-x: auto; padding: 2px 18px 11px;
    margin: 0 -22px 2px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .topnav::-webkit-scrollbar { display: none; }
  .send-grid { grid-template-columns: minmax(0, 1fr); }
  .me-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767px) {
  .main { padding: 0 14px calc(88px + env(safe-area-inset-bottom)); }
  .topbar { padding: 10px 0 9px; }
  .topbar-title h1 { font-size: 18px; }
  .topnav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    display: grid; grid-template-columns: repeat(var(--nav-count, 3), minmax(0, 1fr));
    gap: 3px;
    margin: 0;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    overflow: visible;
    background: rgba(255, 255, 255, .93);
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    border-top: 1px solid rgba(249, 115, 22, .16);
    box-shadow: 0 -8px 28px rgba(249, 115, 22, .12);
  }
  .nav-pill { flex-direction: column; gap: 2px; min-height: 52px; padding: 5px 2px; font-size: 10.5px; border-radius: 14px; }
  .nav-pill .i { width: 21px; height: 21px; }
  .side-user { display: none; }
  .page-head { margin-top: 2px; }
  .page-head h2 { font-size: 16px; }
  .toolbar { padding: 9px; gap: 7px; }
  .msg { padding: 12px 13px 12px 15px; border-radius: 16px; }
  .msg-content { font-size: 14px; }
  .msg-time { font-size: 11px; }
  .msg-actions .icon-btn { width: 36px; height: 36px; min-height: 36px; }
  .toasts { top: auto; bottom: calc(84px + env(safe-area-inset-bottom)); left: 14px; right: 14px; max-width: none; }
  .toast { animation: slideIn .28s ease; }
  .toast.out { animation: toastOut .22s forwards; }
  .dlg { width: calc(100vw - 20px); max-height: 88vh; border-radius: 22px; }
  .dlg-body { padding: 14px 16px; gap: 11px; }
  .dlg-head { padding: 14px 16px 10px; }
  .dlg-foot { padding: 11px 16px calc(13px + env(safe-area-inset-bottom)); }
  .user-grid, .device-grid { grid-template-columns: minmax(0, 1fr); }
  .new-pill { top: auto; bottom: calc(88px + env(safe-area-inset-bottom)); }
  .login-card { padding: 22px 20px 18px; border-radius: 26px; }
  .login-logo { width: 106px; height: 106px; }
  .login-title { font-size: 21px; }
  .login-wrap { padding: 22px 14px; }
  .clock-chip .clock-label { display: none; }
  .live .live-txt { display: none; }
  .live { padding: 6px 9px; }
  .clock-chip { padding: 6px 9px; }
  .send-actions { flex-direction: column-reverse; align-items: stretch; }
  .send-actions .btn { width: 100%; }
  .kv { font-size: 12.5px; }
  .card-actions .btn { flex: 1 1 46%; }
}
@media (max-width: 420px) {
  .topbar-right { gap: 6px; }
  .brand-mobile .logo { width: 32px; height: 32px; }
  .avatar-btn { width: 34px; height: 34px; font-size: 13.5px; }
  .seg button { padding: 6px 9px; }
  .chip-btn { padding: 6px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .speedlines, .dball { display: none; }
  .brand .logo, .login-logo, .empty .logo, .boot-logo { animation: none !important; }
  .msg.new { animation: none; }
}
