/* ==========================================================================
   鲸语 · Whale Talk — 珍珠与海盐主题
   典雅、温柔、带一点小鲸鱼的可爱。
   ========================================================================== */

:root {
  --bg: #f7f2ea;
  --bg-warm: #f4ece1;
  --paper: #fffdf9;
  --paper-soft: #fbf7f1;
  --paper-deep: #f5ede3;
  --ink: #2f3f46;
  --ink-soft: #5d7077;
  --muted: #86979a;
  --muted-2: #a7b4b4;
  --line: #eadfd3;
  --line-strong: #ddccbd;
  --rose: #cd8497;
  --rose-deep: #b9687e;
  --rose-soft: #f8e8ec;
  --rose-mist: #fbf1f3;
  --sage: #7f9f91;
  --sage-deep: #5f8375;
  --sage-soft: #e9f1ec;
  --gold: #c4a069;
  --gold-soft: #f6eddc;
  --blue-soft: #e9f0f2;
  --red: #bd6868;
  --red-soft: #f9e9e7;
  --shadow-sm: 0 4px 16px rgba(91, 69, 55, 0.06);
  --shadow-md: 0 18px 46px rgba(91, 69, 55, 0.1);
  --shadow-lg: 0 32px 80px rgba(91, 69, 55, 0.16);
  --radius: 18px;
  --font: "Avenir Next", "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC",
    "SimSun", serif;
  --mono: "SFMono-Regular", ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

::selection {
  background: #f2cdd6;
  color: var(--ink);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #ddcbbd;
  border: 3px solid transparent;
  border-radius: 99px;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: #c9b2a0;
  border: 3px solid transparent;
  background-clip: padding-box;
}

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

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.screen {
  position: relative;
  width: 100%;
  min-height: 100dvh;
}

/* ==========================================================================
   品牌
   ========================================================================== */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  user-select: none;
}

.brand-mark {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 54px;
  height: 54px;
  flex: none;
  border-radius: 17px;
  color: #996174;
  background:
    radial-gradient(circle at 28% 22%, rgba(255, 255, 255, 0.92), transparent 48%),
    linear-gradient(145deg, #f6d9df, #eabecb 72%, #e4afbe);
  border: 1px solid rgba(255, 255, 255, 0.82);
  box-shadow:
    0 12px 26px rgba(166, 104, 120, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
  transform: rotate(-3deg);
}

.brand-mark::after {
  content: "✦";
  position: absolute;
  top: -6px;
  right: -4px;
  font-size: 12px;
  color: var(--gold);
  transform: rotate(8deg);
}

.brand-whale {
  width: 38px;
  height: 38px;
  stroke: none;
}

.brand-words {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-words strong {
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--ink);
}

.brand-words small {
  font-size: 8px;
  letter-spacing: 0.27em;
  color: #a38990;
  font-weight: 650;
}

.brand-mark-small {
  width: 41px;
  height: 41px;
  border-radius: 13px;
}

.brand-mark-small::after {
  font-size: 9px;
  top: -5px;
  right: -4px;
}

.brand-mark-small .brand-whale {
  width: 28px;
  height: 28px;
}

.brand-small .brand-words strong {
  font-size: 18px;
}

.brand-small .brand-words small {
  font-size: 6.5px;
}

/* ==========================================================================
   登录 / 首次设置
   ========================================================================== */

.auth-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(900px 650px at 3% 4%, rgba(246, 216, 223, 0.7), transparent 62%),
    radial-gradient(800px 620px at 96% 92%, rgba(220, 235, 227, 0.7), transparent 64%),
    linear-gradient(155deg, #faf6ef, #f4ecdf 62%, #f7f1e8);
}

.auth-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.75;
}

.auth-orb-one {
  width: 48vw;
  height: 48vw;
  left: -18vw;
  top: 30vh;
  background: radial-gradient(circle, rgba(235, 188, 201, 0.35), transparent 68%);
  animation: drift 20s ease-in-out infinite alternate;
}

.auth-orb-two {
  width: 42vw;
  height: 42vw;
  right: -15vw;
  top: -17vw;
  background: radial-gradient(circle, rgba(181, 211, 197, 0.4), transparent 68%);
  animation: drift 24s ease-in-out infinite alternate-reverse;
}

.auth-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(119, 92, 76, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(119, 92, 76, 0.045) 1px, transparent 1px);
  background-size: 76px 76px;
  mask-image: radial-gradient(ellipse at 30% 42%, black 8%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse at 30% 42%, black 8%, transparent 72%);
  opacity: 0.6;
}

@keyframes drift {
  from {
    transform: translate3d(-2%, -2%, 0) scale(1);
  }
  to {
    transform: translate3d(3%, 4%, 0) scale(1.07);
  }
}

.auth-screen {
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.11fr) minmax(430px, 0.89fr);
  min-height: 100dvh;
  overflow-y: auto;
}

.auth-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding: 42px clamp(38px, 5vw, 82px) 34px;
  overflow: hidden;
}

.auth-hero::before {
  content: "little whale · gentle words";
  position: absolute;
  left: -52px;
  bottom: 118px;
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 0.22em;
  color: rgba(131, 102, 85, 0.18);
  transform: rotate(-90deg);
  transform-origin: center;
  white-space: nowrap;
}

.brand-hero {
  width: fit-content;
  position: relative;
  z-index: 2;
}

.hero-copy {
  position: relative;
  z-index: 2;
  margin: auto 0 0;
  padding-top: clamp(46px, 9vh, 110px);
  max-width: 620px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 17px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--rose-deep);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--rose);
  box-shadow: 0 0 0 0 rgba(205, 132, 151, 0.4);
  animation: pulse 2.6s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(205, 132, 151, 0.4);
  }
  65% {
    box-shadow: 0 0 0 9px rgba(205, 132, 151, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(205, 132, 151, 0);
  }
}

.hero-copy h1 {
  margin: 0;
  max-width: 580px;
  font-family: var(--serif);
  font-size: clamp(48px, 5.4vw, 80px);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.035em;
  color: var(--ink);
}

.grad-text {
  position: relative;
  background: linear-gradient(106deg, #c36f86 8%, #d998a8 52%, #c5a06b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.grad-text::after {
  content: "";
  position: absolute;
  left: 2%;
  right: 2%;
  bottom: 5px;
  height: 6px;
  border-radius: 50%;
  background: rgba(218, 158, 172, 0.22);
  filter: blur(1px);
}

.hero-lead {
  max-width: 500px;
  margin: 25px 0 0;
  font-size: 14.5px;
  line-height: 1.95;
  color: var(--ink-soft);
}

.hero-features {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 11px;
  margin-top: clamp(30px, 5.5vh, 54px);
  max-width: 700px;
}

.feature-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 15px 14px;
  border: 1px solid rgba(227, 211, 197, 0.85);
  border-radius: 16px;
  background: rgba(255, 253, 249, 0.62);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(99, 76, 61, 0.035);
}

.feature-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 10px;
  color: var(--rose-deep);
  background: var(--rose-soft);
}

.feature-card:nth-child(2) .feature-icon {
  color: var(--sage-deep);
  background: var(--sage-soft);
}

.feature-card:nth-child(3) .feature-icon {
  color: #a8864e;
  background: var(--gold-soft);
}

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

.feature-card strong {
  display: block;
  margin: 1px 0 4px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink);
}

.feature-card small {
  display: block;
  font-size: 9.5px;
  line-height: 1.6;
  color: var(--muted);
}

.hero-foot {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: clamp(27px, 4.5vh, 44px);
  padding-top: 17px;
  border-top: 1px solid rgba(202, 178, 159, 0.35);
  max-width: 650px;
  font-size: 9.5px;
  line-height: 1.65;
  color: #99857b;
}

.hero-foot svg {
  width: 12px;
  height: 12px;
  margin-top: 1px;
}

/* 小鲸鱼插画 */

.hero-whale-scene {
  position: absolute;
  top: 13%;
  right: clamp(20px, 4.5vw, 70px);
  z-index: 1;
  width: 192px;
  text-align: center;
  opacity: 0.96;
  pointer-events: none;
}

.whale-note {
  position: relative;
  display: inline-block;
  padding: 7px 12px;
  margin-bottom: 15px;
  border: 1px solid #ebd9cc;
  border-radius: 13px 13px 13px 4px;
  background: rgba(255, 253, 249, 0.92);
  box-shadow: var(--shadow-sm);
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: #8b6f6a;
  transform: rotate(2deg);
}

.whale-halo {
  position: relative;
  display: grid;
  place-items: center;
  width: 156px;
  height: 156px;
  margin: 0 auto;
  border-radius: 50%;
  color: #9d6476;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.9), transparent 40%),
    linear-gradient(145deg, #f8e2e6, #e8f1ec 75%);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow:
    0 24px 55px rgba(131, 101, 86, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  animation: floaty 5.5s ease-in-out infinite;
}

.whale-halo::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px dashed rgba(173, 131, 130, 0.24);
  border-radius: 50%;
}

.whale-halo svg {
  width: 108px;
  height: 108px;
  stroke: none;
}

@keyframes floaty {
  0%,
  100% {
    transform: translateY(0) rotate(-1deg);
  }
  50% {
    transform: translateY(-9px) rotate(1deg);
  }
}

.whale-bubble {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(164, 199, 186, 0.45);
  background: rgba(255, 255, 255, 0.4);
}

.wb-one {
  width: 11px;
  height: 11px;
  right: 11px;
  top: 31%;
}

.wb-two {
  width: 7px;
  height: 7px;
  right: 0;
  top: 22%;
}

.wb-three {
  width: 5px;
  height: 5px;
  left: 13px;
  bottom: 27%;
}

.whale-spark {
  position: absolute;
  color: var(--gold);
  font-family: var(--serif);
}

.wsp-one {
  top: 24%;
  left: 6px;
  font-size: 17px;
}

.wsp-two {
  right: 19px;
  bottom: 12%;
  font-size: 11px;
  opacity: 0.7;
}

/* 右侧表单 */

.auth-panel-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 15px;
  padding: 34px clamp(24px, 3.6vw, 54px);
  background: linear-gradient(180deg, rgba(255, 253, 249, 0.3), rgba(255, 253, 249, 0.64));
  border-left: 1px solid rgba(219, 201, 186, 0.35);
}

.auth-panel {
  width: min(430px, 100%);
  padding: 34px;
  border-radius: 28px;
  border: 1px solid rgba(227, 211, 197, 0.85);
  background: rgba(255, 253, 249, 0.96);
  box-shadow:
    0 36px 90px rgba(101, 75, 59, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
}

.auth-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 78px 0;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.auth-loading > svg {
  width: 27px;
  height: 27px;
  color: var(--gold);
}

.auth-heading {
  margin-bottom: 23px;
}

.auth-heading .eyebrow {
  margin-bottom: 12px;
  font-size: 9px;
}

.auth-heading h2 {
  margin: 0 0 9px;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.auth-heading p {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.8;
  color: var(--muted);
}

.auth-heading-compact {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 20px;
}

.auth-heading-compact h2 {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 600;
}

.auth-heading-compact p {
  font-size: 10.5px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.auth-tab {
  position: relative;
  padding: 10px 4px 11px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  transition: color 0.18s;
}

.auth-tab::after {
  content: "";
  position: absolute;
  left: 30%;
  right: 30%;
  bottom: -1px;
  height: 2px;
  border-radius: 99px;
  background: transparent;
  transition: 0.2s;
}

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

.auth-tab.is-active {
  color: var(--rose-deep);
}

.auth-tab.is-active::after {
  left: 20%;
  right: 20%;
  background: var(--rose);
}

.auth-tab:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

.field-control {
  position: relative;
  display: flex;
  align-items: center;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbf7f1;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}

.field-control:focus-within {
  border-color: rgba(205, 132, 151, 0.62);
  background: #fffdf9;
  box-shadow: 0 0 0 4px rgba(205, 132, 151, 0.1);
}

.field-control.is-invalid {
  border-color: rgba(189, 104, 104, 0.6);
}

.field-control input {
  width: 100%;
  height: 100%;
  padding: 0 13px;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13px;
  color: var(--ink);
}

.field-control input::placeholder {
  color: #b1a79f;
}

.field-icon {
  width: 16px;
  height: 16px;
  margin-left: 14px;
  color: #b2948d;
}

.field-prefix {
  margin-left: 15px;
  color: #b2948d;
  font-size: 13px;
  font-weight: 600;
}

.field-control input:not(:first-child) {
  padding-left: 9px;
}

.field-action {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #b29d97;
}

.field-action:hover {
  color: var(--rose-deep);
}

.field-action svg {
  width: 16px;
  height: 16px;
}

.field-hint {
  margin: 0;
  font-size: 9.5px;
  line-height: 1.55;
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 13px;
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
  transition: transform 0.16s, background 0.18s, border-color 0.18s, opacity 0.18s,
    box-shadow 0.18s;
}

.btn svg {
  width: 15px;
  height: 15px;
}

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

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

.btn-primary {
  color: #fffdfb;
  background: linear-gradient(135deg, #d796a6, #c4778c);
  box-shadow:
    0 10px 24px rgba(185, 104, 126, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #dfa4b2, #ca8195);
  box-shadow: 0 13px 28px rgba(185, 104, 126, 0.27);
}

.btn-block {
  width: 100%;
  min-height: 48px;
  margin-top: 3px;
  font-size: 12.5px;
}

.btn-block svg {
  transform: rotate(180deg);
}

.btn-ghost {
  color: var(--ink-soft);
  border-color: var(--line);
  background: rgba(255, 253, 249, 0.7);
}

.btn-ghost:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: #fffdf9;
}

.btn-danger {
  color: #a95757;
  border-color: rgba(189, 104, 104, 0.28);
  background: var(--red-soft);
}

.btn-danger:hover {
  background: #f6ddda;
}

.btn-sm {
  min-height: 35px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 10.5px;
}

.btn .btn-loader {
  width: 14px;
  height: 14px;
  border-width: 1.5px;
}

.auth-message {
  margin: 0;
  padding: 9px 11px;
  border-radius: 10px;
  font-size: 10.5px;
  line-height: 1.55;
  color: #a95858;
  border: 1px solid rgba(189, 104, 104, 0.2);
  background: rgba(249, 233, 231, 0.8);
}

.auth-message.is-success {
  color: var(--sage-deep);
  border-color: rgba(127, 159, 145, 0.22);
  background: rgba(233, 241, 236, 0.8);
}

.form-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 1px 0 0;
  font-size: 9px;
  line-height: 1.6;
  color: var(--muted);
}

.form-note svg {
  width: 11px;
  height: 11px;
  margin-top: 1px;
}

.form-note-muted {
  justify-content: center;
  text-align: center;
  padding-top: 3px;
}

.auth-closed {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 26px 18px;
  margin-top: 17px;
  border-radius: 14px;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
}

.auth-closed svg {
  width: 23px;
  height: 23px;
  margin-bottom: 9px;
  color: var(--gold);
}

.auth-closed strong {
  font-size: 11.5px;
  color: var(--ink-soft);
}

.auth-closed p {
  margin: 5px 0 0;
  font-size: 10px;
  line-height: 1.6;
}

.auth-panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 8.5px;
  color: var(--muted-2);
  letter-spacing: 0.02em;
}

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

.auth-panel-foot svg {
  width: 10px;
  height: 10px;
}

.version-tag {
  font-family: var(--mono);
  opacity: 0.7;
}

.auth-copyright {
  margin: 0;
  font-size: 9px;
  letter-spacing: 0.08em;
  color: #a28d82;
}

/* ==========================================================================
   应用骨架
   ========================================================================== */

.app-screen {
  display: grid;
  grid-template-columns: 306px minmax(0, 1fr);
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}

.app-screen.context-open {
  grid-template-columns: 306px minmax(0, 1fr) 290px;
}

.sidebar {
  position: relative;
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: linear-gradient(180deg, #fcf9f4, #f8f2ea);
  border-right: 1px solid var(--line);
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 78px;
  flex: none;
  padding: 0 17px 0 20px;
  border-bottom: 1px solid rgba(234, 223, 211, 0.7);
}

.sidebar-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 12px 10px;
}

.sidebar-section {
  margin-bottom: 18px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  margin-bottom: 7px;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: #a39189;
}

.mini-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #a08e86;
  transition: 0.18s;
}

.mini-icon:hover {
  color: var(--rose-deep);
  background: var(--rose-soft);
}

.mini-icon svg {
  width: 14px;
  height: 14px;
}

.room-row {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  text-align: left;
  transition: background 0.18s, border-color 0.18s, box-shadow 0.18s;
}

.room-row:hover {
  background: rgba(255, 253, 249, 0.75);
}

.room-row.is-active {
  border-color: rgba(205, 132, 151, 0.2);
  background: linear-gradient(100deg, rgba(248, 232, 236, 0.9), rgba(255, 253, 249, 0.7));
  box-shadow: 0 5px 14px rgba(130, 98, 83, 0.045);
}

.room-icon {
  display: grid;
  place-items: center;
  width: 39px;
  height: 39px;
  flex: none;
  border-radius: 12px;
  color: var(--sage-deep);
  background: var(--sage-soft);
  border: 1px solid rgba(127, 159, 145, 0.14);
}

.room-icon svg {
  width: 18px;
  height: 18px;
}

.room-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.room-copy strong {
  font-size: 12px;
  font-weight: 650;
  color: var(--ink);
}

.room-copy small {
  overflow: hidden;
  font-size: 9px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dm-section {
  min-height: 92px;
}

.direct-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dm-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: transparent;
  text-align: left;
  transition: 0.16s;
}

.dm-row:hover {
  background: rgba(255, 253, 249, 0.8);
}

.dm-row.is-active {
  border-color: rgba(205, 132, 151, 0.16);
  background: linear-gradient(100deg, rgba(248, 232, 236, 0.82), rgba(255, 253, 249, 0.6));
}

.dm-copy {
  flex: 1;
  min-width: 0;
}

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

.dm-copy strong {
  overflow: hidden;
  font-size: 11px;
  font-weight: 650;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dm-copy time {
  flex: none;
  font-size: 8px;
  color: var(--muted-2);
}

.dm-copy small {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  font-size: 9px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unread-badge {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  font-size: 8.5px;
  font-weight: 700;
  color: #fffdfb;
  background: var(--rose);
  box-shadow: 0 3px 9px rgba(185, 104, 126, 0.25);
}

.unread-badge.is-dot {
  width: 8px;
  min-width: 8px;
  height: 8px;
  padding: 0;
}

.dm-row .unread-badge,
.room-row .unread-badge {
  margin-left: auto;
}

.side-empty {
  margin: 10px 12px;
  font-size: 9.5px;
  line-height: 1.8;
  text-align: center;
  color: var(--muted-2);
}

.side-empty span {
  display: block;
  margin-bottom: 3px;
  font-size: 16px;
  opacity: 0.8;
}

.people-search {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 37px;
  margin: 2px 3px 7px;
  padding: 0 8px 0 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fffdf9;
  box-shadow: var(--shadow-sm);
}

.people-search > svg {
  width: 13px;
  height: 13px;
  color: #b09a92;
}

.people-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 10px;
}

.people-search input::placeholder {
  color: #b1a59d;
}

.people-results {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 240px;
  margin-bottom: 7px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdf9;
  box-shadow: var(--shadow-sm);
}

.person-row {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  text-align: left;
}

.person-row:hover {
  background: var(--rose-mist);
}

.person-row .avatar {
  width: 29px;
  height: 29px;
  border-radius: 9px;
  font-size: 9px;
}

.person-row-copy {
  min-width: 0;
  flex: 1;
}

.person-row-copy strong {
  display: block;
  overflow: hidden;
  font-size: 10px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-row-copy small {
  display: block;
  overflow: hidden;
  margin-top: 1px;
  font-size: 8px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-row > svg {
  width: 12px;
  height: 12px;
  color: var(--gold);
}

.people-empty {
  padding: 12px 8px;
  font-size: 9.5px;
  text-align: center;
  color: var(--muted);
}

.nav-action {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid rgba(196, 160, 105, 0.22);
  border-radius: 12px;
  background: rgba(246, 237, 220, 0.55);
  color: #8c713f;
  font-size: 10.5px;
  font-weight: 600;
  text-align: left;
  transition: 0.18s;
}

.nav-action:hover {
  background: rgba(246, 237, 220, 0.9);
  border-color: rgba(196, 160, 105, 0.35);
}

.nav-action svg {
  width: 15px;
  height: 15px;
}

.nav-badge {
  margin-left: auto;
  padding: 3px 5px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: 0.08em;
  color: #9c7a42;
  background: rgba(196, 160, 105, 0.14);
}

.sidebar-backdrop {
  display: none;
}

.account-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - 20px);
  flex: none;
  margin: 0 10px 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 253, 249, 0.85);
  box-shadow: var(--shadow-sm);
  text-align: left;
  transition: 0.18s;
}

.account-card:hover {
  border-color: var(--line-strong);
  background: #fffdf9;
  transform: translateY(-1px);
}

.account-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.account-copy strong {
  overflow: hidden;
  font-size: 10.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-copy small {
  overflow: hidden;
  font-size: 8.5px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-more {
  display: grid;
  place-items: center;
  color: #b3a097;
}

.account-more svg {
  width: 15px;
  height: 15px;
}

/* ==========================================================================
   头像
   ========================================================================== */

.avatar {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  overflow: hidden;
  border-radius: 50%;
  color: #fffdfb;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: linear-gradient(145deg, hsl(var(--hue, 176) 30% 64%), hsl(var(--hue2, 210) 27% 46%));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
  border: 2px solid rgba(255, 253, 249, 0.9);
}

.avatar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 18%, rgba(255, 255, 255, 0.3), transparent 52%);
  pointer-events: none;
}

.avatar-md {
  width: 38px;
  height: 38px;
}

.avatar-sm {
  width: 31px;
  height: 31px;
  font-size: 9px;
}

.avatar-xs {
  width: 26px;
  height: 26px;
  border-radius: 9px;
  font-size: 8px;
  border-width: 1px;
}

.avatar-lg {
  width: 72px;
  height: 72px;
  border-radius: 23px;
  font-size: 23px;
  border-width: 3px;
}

.avatar-wrap {
  position: relative;
  flex: none;
}

.online-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 9px;
  height: 9px;
  border: 2px solid #fbf7f1;
  border-radius: 50%;
  background: #70a98e;
  box-shadow: 0 0 0 2px rgba(112, 169, 142, 0.12);
}

.avatar-wrap.small .online-dot {
  width: 8px;
  height: 8px;
}

.avatar-wrap.large .online-dot {
  width: 14px;
  height: 14px;
  border-width: 3px;
}

.room-avatar {
  width: 41px;
  height: 41px;
  border-radius: 14px;
  color: var(--sage-deep);
  background: linear-gradient(145deg, #e9f1ec, #d9e8e0);
  border: 2px solid rgba(255, 253, 249, 0.9);
}

.room-avatar::after {
  display: none;
}

.room-avatar svg {
  width: 19px;
  height: 19px;
}

/* ==========================================================================
   聊天区
   ========================================================================== */

.chat-main {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background:
    radial-gradient(900px 500px at 55% -12%, rgba(235, 218, 208, 0.36), transparent 64%),
    linear-gradient(180deg, #fbf7f1, #f8f2ea 80%);
}

.chat-main::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(rgba(156, 128, 111, 0.12) 0.7px, transparent 0.7px),
    radial-gradient(rgba(255, 255, 255, 0.7) 0.7px, transparent 0.7px);
  background-position: 0 0, 13px 13px;
  background-size: 26px 26px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.25), transparent 70%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.25), transparent 70%);
  opacity: 0.55;
}

.chat-header {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 78px;
  flex: none;
  padding: 0 23px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 249, 0.72);
  backdrop-filter: blur(18px);
}

.chat-title {
  min-width: 0;
  flex: 1;
}

.chat-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-title h2 {
  overflow: hidden;
  margin: 0;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-title p {
  overflow: hidden;
  margin: 4px 0 0;
  font-size: 9px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 37px;
  height: 37px;
  flex: none;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: #998a84;
  transition: 0.18s;
}

.icon-btn:hover {
  color: var(--ink);
  border-color: var(--line);
  background: rgba(255, 253, 249, 0.9);
}

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

.icon-btn.is-active {
  color: var(--rose-deep);
  border-color: rgba(205, 132, 151, 0.2);
  background: var(--rose-mist);
}

.conn-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 99px;
  font-size: 8px;
  color: var(--sage-deep);
  background: rgba(233, 241, 236, 0.75);
  border: 1px solid rgba(127, 159, 145, 0.16);
}

.conn-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #70a98e;
  box-shadow: 0 0 0 3px rgba(112, 169, 142, 0.1);
}

.conn-status.is-offline {
  color: #a4834c;
  background: var(--gold-soft);
  border-color: rgba(196, 160, 105, 0.18);
}

.conn-status.is-offline .conn-dot {
  background: var(--gold);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #96703a;
  background: var(--gold-soft);
  border: 1px solid rgba(196, 160, 105, 0.2);
}

.chat-banner {
  position: relative;
  z-index: 2;
  margin: 12px 22px 0;
  padding: 10px 13px;
  border: 1px solid rgba(196, 160, 105, 0.25);
  border-radius: 11px;
  background: rgba(246, 237, 220, 0.7);
  color: #8c713f;
  font-size: 10.5px;
  line-height: 1.55;
}

.messages {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px clamp(18px, 3.5vw, 48px) 8px;
  scroll-behavior: smooth;
}

.messages-inner {
  width: min(880px, 100%);
  margin: 0 auto;
  padding-bottom: 8px;
}

.messages-loading,
.messages-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 50vh;
  color: var(--muted);
  font-size: 10.5px;
  text-align: center;
}

.messages-empty .empty-art {
  display: grid;
  place-items: center;
  width: 82px;
  height: 82px;
  margin-bottom: 3px;
  border-radius: 27px;
  font-size: 32px;
  background:
    radial-gradient(circle at 30% 22%, #fffdf9, transparent 55%),
    linear-gradient(145deg, #f7e2e6, #e9f1ec);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 16px 35px rgba(118, 88, 73, 0.1);
}

.messages-empty strong {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-soft);
}

.messages-empty p {
  max-width: 270px;
  margin: 0;
  font-size: 9.5px;
  line-height: 1.8;
  color: var(--muted);
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 4px 0 14px;
}

.load-more {
  padding: 6px 13px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: rgba(255, 253, 249, 0.72);
  color: var(--muted);
  font-size: 8.5px;
}

.load-more:hover {
  color: var(--ink-soft);
  border-color: var(--line-strong);
  background: #fffdf9;
}

.date-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 19px 0 16px;
  font-family: var(--serif);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.11em;
  color: #b09a8e;
}

.date-divider::before,
.date-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, transparent, rgba(190, 164, 144, 0.3));
}

.date-divider::after {
  background: linear-gradient(90deg, rgba(190, 164, 144, 0.3), transparent);
}

.msg {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
  animation: msgIn 0.22s ease both;
}

.msg.is-grouped {
  margin-top: 4px;
}

@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.msg-avatar-slot {
  width: 31px;
  flex: none;
  padding-top: 2px;
}

.msg-avatar-slot .avatar {
  width: 31px;
  height: 31px;
  border-radius: 10px;
  font-size: 9px;
}

.msg.is-grouped .msg-avatar-slot {
  visibility: hidden;
  height: 0;
}

.msg-body {
  min-width: 0;
  max-width: min(75%, 620px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.msg-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 3px 5px;
  font-size: 8.5px;
  color: #b09a8e;
}

.msg-meta strong {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--ink-soft);
}

.msg-meta svg {
  width: 9px;
  height: 9px;
  color: var(--gold);
}

.msg-meta time {
  font-family: var(--mono);
  font-size: 7.5px;
  color: #b6a49a;
}

.msg.is-grouped .msg-meta {
  display: none;
}

.bubble-line {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
}

.bubble {
  position: relative;
  padding: 9px 13px;
  border: 1px solid #ebdfd4;
  border-radius: 6px 16px 16px 16px;
  background: #fffdf9;
  color: var(--ink);
  font-size: 12.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: 0 3px 10px rgba(102, 76, 60, 0.055);
}

.bubble a {
  color: #9a6b7a;
  text-underline-offset: 2px;
}

.bubble .emoji-text {
  font-size: 15px;
  line-height: 1.5;
}

.msg.is-emoji .bubble {
  padding: 2px 5px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  font-size: 34px;
  line-height: 1.25;
}

.msg.is-emoji .bubble .emoji-text {
  font-size: inherit;
}

.msg.is-deleted .bubble {
  color: var(--muted);
  font-style: italic;
  background: rgba(255, 253, 249, 0.55);
  border-style: dashed;
}

.msg-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transform: translateX(-3px);
  transition: 0.16s;
}

.msg:hover .msg-actions,
.msg:focus-within .msg-actions {
  opacity: 1;
  transform: translateX(0);
}

.msg-action {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #b3a097;
}

.msg-action:hover {
  color: var(--red);
  border-color: rgba(189, 104, 104, 0.15);
  background: var(--red-soft);
}

.msg-action svg {
  width: 12px;
  height: 12px;
}

.msg.is-own {
  flex-direction: row-reverse;
}

.msg.is-own .msg-avatar-slot {
  display: none;
}

.msg.is-own .msg-body {
  align-items: flex-end;
}

.msg.is-own .msg-meta {
  flex-direction: row-reverse;
  margin-right: 3px;
}

.msg.is-own .msg-meta strong {
  color: #a4697b;
}

.msg.is-own .bubble-line {
  flex-direction: row-reverse;
}

.msg.is-own .bubble {
  border-radius: 16px 6px 16px 16px;
  border-color: rgba(184, 105, 127, 0.22);
  background: linear-gradient(145deg, #d08b9d, #bc6d82);
  color: #fffdfb;
  box-shadow: 0 5px 16px rgba(157, 86, 105, 0.14);
}

.msg.is-own .bubble a {
  color: #fff4e2;
}

.msg.is-own .msg-actions {
  transform: translateX(3px);
}

.message-text {
  white-space: pre-wrap;
}

.typing-bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 26px;
  padding: 0 clamp(24px, 4vw, 60px);
  font-size: 9px;
  color: var(--muted);
}

.typing-dots {
  display: inline-flex;
  gap: 2px;
}

.typing-dots i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--rose);
  animation: typing 1.2s infinite;
}

.typing-dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-dots i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typing {
  0%,
  60%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

/* ==========================================================================
   输入区
   ========================================================================== */

.composer-wrap {
  position: relative;
  z-index: 4;
  flex: none;
  padding: 6px clamp(18px, 3.5vw, 48px) 15px;
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  width: min(880px, 100%);
  min-height: 54px;
  margin: 0 auto;
  padding: 7px 8px 7px 9px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 253, 249, 0.95);
  box-shadow:
    0 15px 38px rgba(101, 75, 59, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.composer:focus-within {
  border-color: rgba(205, 132, 151, 0.45);
  box-shadow:
    0 15px 38px rgba(101, 75, 59, 0.1),
    0 0 0 4px rgba(205, 132, 151, 0.08);
}

.composer-btn {
  display: grid;
  place-items: center;
  width: 39px;
  height: 39px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #a3948c;
  transition: 0.18s;
}

.composer-btn:hover,
.composer-btn.is-active {
  color: var(--rose-deep);
  background: var(--rose-mist);
}

.composer-btn svg {
  width: 20px;
  height: 20px;
}

.composer textarea {
  flex: 1;
  min-width: 0;
  min-height: 38px;
  max-height: 138px;
  padding: 9px 2px 7px;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink);
}

.composer textarea::placeholder {
  color: #b1a59d;
}

.composer-side {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: none;
}

.composer-count {
  min-width: 54px;
  text-align: right;
  font-family: var(--mono);
  font-size: 7.5px;
  color: var(--muted);
}

.composer-count.is-warning {
  color: var(--gold);
}

.send-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  padding: 0;
  border: 1px solid rgba(185, 104, 126, 0.16);
  border-radius: 13px;
  background: linear-gradient(145deg, #d99aaa, #c2768a);
  color: #fffdfb;
  box-shadow: 0 7px 16px rgba(185, 104, 126, 0.2);
  transition: 0.18s;
}

.send-btn:hover:not(:disabled) {
  filter: brightness(1.04);
  transform: translateY(-1px);
}

.send-btn:active:not(:disabled) {
  transform: translateY(0);
}

.send-btn:disabled {
  border-color: var(--line);
  background: #f1e9df;
  color: #c4b6aa;
  box-shadow: none;
  cursor: not-allowed;
}

.send-btn svg {
  width: 18px;
  height: 18px;
  margin-left: -1px;
}

.composer-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(880px, 100%);
  margin: 7px auto 0;
  padding: 0 5px;
  font-size: 8px;
  color: #b09f94;
}

.hint-secure {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.hint-secure svg {
  width: 9px;
  height: 9px;
}

/* 表情面板 */

.emoji-picker {
  position: absolute;
  left: clamp(18px, 3.5vw, 48px);
  bottom: calc(100% + 2px);
  width: 354px;
  max-width: calc(100vw - 36px);
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 253, 249, 0.98);
  box-shadow: 0 26px 70px rgba(91, 69, 55, 0.2);
  backdrop-filter: blur(20px);
  animation: popIn 0.16s ease both;
  z-index: 20;
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.emoji-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 3px 9px;
}

.emoji-head strong {
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 600;
}

.emoji-head > span {
  flex: 1;
  font-size: 8px;
  color: var(--muted);
}

.emoji-tabs {
  display: flex;
  gap: 2px;
  padding: 4px;
  margin-bottom: 8px;
  border-radius: 10px;
  background: var(--paper-soft);
  border: 1px solid var(--line);
}

.emoji-tab {
  flex: 1;
  padding: 5px 2px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font-size: 13px;
  line-height: 1.2;
  opacity: 0.68;
  transition: 0.15s;
}

.emoji-tab:hover {
  opacity: 0.95;
}

.emoji-tab.is-active {
  background: #fffdf9;
  box-shadow: 0 2px 7px rgba(101, 75, 59, 0.09);
  opacity: 1;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  max-height: 226px;
  overflow-y: auto;
  padding-right: 2px;
}

.emoji-item {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  transition: background 0.12s, transform 0.12s;
}

.emoji-item:hover {
  background: var(--rose-mist);
  transform: scale(1.08);
}

.emoji-empty {
  grid-column: 1 / -1;
  padding: 20px 0;
  text-align: center;
  font-size: 9.5px;
  color: var(--muted);
}

/* ==========================================================================
   右侧信息面板
   ========================================================================== */

.context-panel {
  display: none;
  flex-direction: column;
  min-height: 0;
  border-left: 1px solid var(--line);
  background: linear-gradient(180deg, #fdfaf5, #f8f2ea);
}

.context-open .context-panel {
  display: flex;
}

.context-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 78px;
  flex: none;
  padding: 0 14px 0 21px;
  border-bottom: 1px solid var(--line);
}

.context-head h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
}

.context-head .icon-btn {
  width: 31px;
  height: 31px;
}

.context-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 18px 26px;
}

.context-section + .context-section {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.context-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 11px;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #a18d84;
}

.context-label span:last-child {
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: 0;
  color: #b1a197;
}

.member-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.member-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 6px 5px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
}

.member-item:hover {
  background: rgba(255, 253, 249, 0.8);
}

.member-item .avatar {
  width: 29px;
  height: 29px;
  border-radius: 9px;
  font-size: 8.5px;
}

.member-info {
  min-width: 0;
  flex: 1;
}

.member-info strong {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  font-size: 10px;
  font-weight: 600;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-info small {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  font-size: 8px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-info .crown {
  width: 9px;
  height: 9px;
  color: var(--gold);
}

.member-status {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: #d7cbc1;
}

.member-status.is-online {
  background: #70a98e;
  box-shadow: 0 0 0 3px rgba(112, 169, 142, 0.1);
}

.member-empty {
  margin: 4px 2px;
  font-size: 9px;
  line-height: 1.7;
  color: var(--muted);
}

.context-profile {
  text-align: center;
}

.context-profile .avatar {
  margin: 4px auto 12px;
}

.context-profile h4 {
  margin: 0;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
}

.context-profile .handle {
  margin: 3px 0 0;
  font-family: var(--mono);
  font-size: 8.5px;
  color: var(--muted);
}

.context-profile .bio {
  margin: 13px 0 0;
  font-size: 9.5px;
  line-height: 1.7;
  color: var(--ink-soft);
}

.profile-tags {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 11px;
}

.profile-tag {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 7.5px;
  color: var(--muted);
  background: rgba(255, 253, 249, 0.7);
}

.profile-tag.is-admin {
  color: #96703a;
  border-color: rgba(196, 160, 105, 0.2);
  background: var(--gold-soft);
}

.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 16px;
}

.profile-actions .btn {
  width: 100%;
}

.info-card {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 253, 249, 0.75);
  box-shadow: var(--shadow-sm);
}

.info-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--ink-soft);
}

.info-card-head svg {
  width: 13px;
  height: 13px;
  color: var(--sage-deep);
}

.info-card p {
  margin: 0;
  font-size: 8.5px;
  line-height: 1.75;
  color: var(--muted);
}

.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 0;
  font-size: 8.5px;
  color: var(--muted);
}

.info-row strong {
  font-weight: 500;
  color: var(--ink-soft);
}

.encryption-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 10px;
  margin-top: 12px;
  border-radius: 9px;
  border: 1px solid rgba(127, 159, 145, 0.18);
  background: var(--sage-soft);
  font-size: 8px;
  color: var(--sage-deep);
}

.encryption-badge svg {
  width: 11px;
  height: 11px;
}

/* ==========================================================================
   管理后台
   ========================================================================== */

.admin-screen {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(900px 500px at 80% -10%, rgba(232, 216, 205, 0.45), transparent 64%),
    var(--bg);
}

.admin-header {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 70px;
  flex: none;
  padding: 0 clamp(16px, 3vw, 34px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 249, 0.78);
  backdrop-filter: blur(16px);
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-brand strong {
  display: block;
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 600;
}

.admin-brand small {
  display: block;
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.admin-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.admin-secure {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: 99px;
  font-size: 8px;
  color: var(--sage-deep);
  border: 1px solid rgba(127, 159, 145, 0.18);
  background: var(--sage-soft);
}

.admin-secure svg {
  width: 10px;
  height: 10px;
}

.admin-shell {
  display: flex;
  flex: 1;
  min-height: 0;
}

.admin-nav {
  width: 218px;
  flex: none;
  padding: 25px 12px;
  border-right: 1px solid var(--line);
  background: rgba(252, 248, 242, 0.7);
}

.admin-nav-label {
  padding: 0 11px;
  margin: 0 0 10px;
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: #a18d84;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 11px;
  margin-bottom: 3px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 10.5px;
  text-align: left;
  transition: 0.17s;
}

.admin-nav-item svg {
  width: 15px;
  height: 15px;
}

.admin-nav-item:hover {
  color: var(--ink);
  background: rgba(255, 253, 249, 0.8);
}

.admin-nav-item.is-active {
  color: var(--rose-deep);
  border-color: rgba(205, 132, 151, 0.18);
  background: linear-gradient(100deg, rgba(248, 232, 236, 0.9), rgba(255, 253, 249, 0.55));
}

.admin-nav-note {
  display: flex;
  gap: 8px;
  margin-top: 30px;
  padding: 12px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 249, 0.6);
  color: var(--muted);
}

.admin-nav-note svg {
  width: 12px;
  height: 12px;
  margin-top: 1px;
  flex: none;
  color: var(--sage);
}

.admin-nav-note p {
  margin: 0;
  font-size: 8px;
  line-height: 1.6;
}

.admin-main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 30px clamp(18px, 3.4vw, 44px) 48px;
}

.admin-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto 22px;
}

.admin-heading .eyebrow {
  margin-bottom: 7px;
  font-size: 8px;
  color: var(--rose-deep);
}

.admin-heading h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.admin-panel {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
}

.admin-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 13px;
  padding: 100px 0;
  color: var(--muted);
  font-size: 10px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 17px;
  background: linear-gradient(150deg, #fbf0f3, #fdf9f4);
  box-shadow: 0 10px 26px rgba(101, 75, 59, 0.06);
}

.stat-card:nth-child(2) {
  background: linear-gradient(150deg, #eaf2ed, #fbf9f4);
}

.stat-card:nth-child(3) {
  background: linear-gradient(150deg, #f7efdf, #fdf9f4);
}

.stat-card:nth-child(4) {
  background: linear-gradient(150deg, #eaf0f2, #fbf9f4);
}

.stat-card::after {
  content: "";
  position: absolute;
  width: 100px;
  height: 100px;
  right: -38px;
  top: -38px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.7), transparent 70%);
}

.stat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 13px;
}

.stat-label {
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 9px;
  color: var(--rose-deep);
  background: rgba(255, 253, 249, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.stat-icon svg {
  width: 13px;
  height: 13px;
}

.stat-value {
  margin: 0;
  font-family: var(--serif);
  font-size: 29px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.stat-sub {
  margin: 8px 0 0;
  font-size: 8px;
  color: #96837a;
}

.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.panel-card {
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255, 253, 249, 0.8);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.panel-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-card-head h2 {
  margin: 0;
  flex: 1;
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.panel-card-head small {
  font-size: 8px;
  color: var(--muted);
}

.panel-card-body {
  padding: 16px 18px;
}

.trend {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 138px;
  padding-top: 8px;
}

.trend-col {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  height: 100%;
}

.trend-bar {
  width: 100%;
  max-width: 26px;
  min-height: 4px;
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, #a8c7b8, rgba(127, 159, 145, 0.35));
  box-shadow: 0 0 14px rgba(127, 159, 145, 0.12);
}

.trend-col span {
  font-family: var(--mono);
  font-size: 7px;
  color: var(--muted);
}

.trend-col strong {
  font-family: var(--mono);
  font-size: 7.5px;
  font-weight: 500;
  color: var(--ink-soft);
}

.recent-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.recent-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 0;
}

.recent-user + .recent-user {
  border-top: 1px solid rgba(234, 223, 211, 0.7);
}

.recent-user .avatar {
  width: 29px;
  height: 29px;
  border-radius: 9px;
  font-size: 8.5px;
}

.recent-user-copy {
  flex: 1;
  min-width: 0;
}

.recent-user-copy strong {
  display: block;
  overflow: hidden;
  font-size: 9.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-user-copy small {
  display: block;
  margin-top: 2px;
  font-size: 7.5px;
  color: var(--muted);
}

.recent-user time {
  font-size: 7.5px;
  color: var(--muted);
}

.audit-mini {
  display: flex;
  flex-direction: column;
}

.audit-mini-row {
  display: flex;
  gap: 9px;
  padding: 8px 0;
  font-size: 8.5px;
}

.audit-mini-row + .audit-mini-row {
  border-top: 1px solid rgba(234, 223, 211, 0.7);
}

.audit-mini-dot {
  width: 5px;
  height: 5px;
  margin-top: 4px;
  flex: none;
  border-radius: 50%;
  background: var(--rose);
}

.audit-mini-copy {
  flex: 1;
  min-width: 0;
  line-height: 1.55;
  color: var(--muted);
}

.audit-mini-copy strong {
  color: var(--ink-soft);
  font-weight: 600;
}

.audit-mini-copy small {
  display: block;
  margin-top: 2px;
  font-size: 7px;
  color: var(--muted-2);
}

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

.encryption-item {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(251, 247, 241, 0.7);
}

.encryption-item svg {
  width: 13px;
  height: 13px;
  margin-top: 1px;
  color: var(--sage-deep);
}

.encryption-item strong {
  display: block;
  font-size: 8.5px;
  font-weight: 600;
  color: var(--ink-soft);
}

.encryption-item small {
  display: block;
  margin-top: 3px;
  font-size: 7.5px;
  line-height: 1.5;
  color: var(--muted);
}

/* 管理表格 */

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 13px;
}

.toolbar-search {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 230px;
  flex: 1;
  max-width: 360px;
  height: 37px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 253, 249, 0.8);
}

.toolbar-search svg {
  width: 13px;
  height: 13px;
  margin-right: 7px;
  color: #ae9b91;
}

.toolbar-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 9.5px;
}

.toolbar-search input::placeholder {
  color: #b1a59d;
}

.toolbar select {
  height: 37px;
  padding: 0 27px 0 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
  appearance: none;
  background:
    linear-gradient(45deg, transparent 50%, #a18e85 50%) calc(100% - 14px) 16px / 4px 4px no-repeat,
    linear-gradient(135deg, #a18e85 50%, transparent 50%) calc(100% - 10px) 16px / 4px 4px no-repeat,
    #fffdf9;
  font-size: 9.5px;
  color: var(--ink-soft);
}

.toolbar-meta {
  margin-left: auto;
  font-size: 8.5px;
  color: var(--muted);
}

.table-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 253, 249, 0.82);
  box-shadow: var(--shadow-sm);
  overflow: visible;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
  color: #a08c82;
  background: rgba(251, 247, 241, 0.8);
}

.data-table th:first-child {
  border-radius: 16px 0 0 0;
}

.data-table th:last-child {
  border-radius: 0 16px 0 0;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(234, 223, 211, 0.65);
  font-size: 9.5px;
  color: var(--ink-soft);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover {
  background: rgba(251, 247, 241, 0.55);
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 140px;
}

.user-cell .avatar {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  font-size: 8.5px;
}

.user-cell-copy {
  min-width: 0;
}

.user-cell-copy strong {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  max-width: 170px;
  font-size: 10px;
  font-weight: 600;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-cell-copy strong svg {
  width: 9px;
  height: 9px;
  color: var(--gold);
}

.user-cell-copy small {
  display: block;
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 7.5px;
  color: var(--muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 99px;
  font-size: 7.5px;
  white-space: nowrap;
  color: var(--sage-deep);
  background: var(--sage-soft);
  border: 1px solid rgba(127, 159, 145, 0.18);
}

.status-pill::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}

.status-pill.is-muted {
  color: #92723d;
  background: var(--gold-soft);
  border-color: rgba(196, 160, 105, 0.22);
}

.status-pill.is-banned {
  color: #a95858;
  background: var(--red-soft);
  border-color: rgba(189, 104, 104, 0.18);
}

.role-pill {
  display: inline-flex;
  padding: 3px 6px;
  border-radius: 5px;
  font-size: 7.5px;
  color: var(--muted);
  background: rgba(251, 247, 241, 0.8);
  border: 1px solid var(--line);
  white-space: nowrap;
}

.role-pill.is-admin {
  color: #96703a;
  background: var(--gold-soft);
  border-color: rgba(196, 160, 105, 0.2);
}

.online-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 7.5px;
  color: var(--muted);
}

.online-label::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #d7cbc1;
}

.online-label.is-online {
  color: var(--sage-deep);
}

.online-label.is-online::before {
  background: #70a98e;
  box-shadow: 0 0 0 2px rgba(112, 169, 142, 0.12);
}

.row-actions {
  display: flex;
  justify-content: flex-end;
}

.row-menu {
  position: relative;
}

.row-menu summary {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-left: auto;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #a18e85;
  cursor: pointer;
  list-style: none;
}

.row-menu summary::-webkit-details-marker {
  display: none;
}

.row-menu summary:hover,
.row-menu[open] summary {
  border-color: var(--line);
  background: var(--paper-soft);
  color: var(--ink-soft);
}

.row-menu summary svg {
  width: 15px;
  height: 15px;
}

.row-menu-pop {
  position: absolute;
  right: 0;
  top: 34px;
  z-index: 30;
  width: 150px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdf9;
  box-shadow: 0 16px 40px rgba(91, 69, 55, 0.16);
}

.row-menu-pop button {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 9px;
  text-align: left;
}

.row-menu-pop button:hover {
  background: var(--rose-mist);
  color: var(--ink);
}

.row-menu-pop button.is-danger {
  color: var(--red);
}

.row-menu-pop button.is-danger:hover {
  background: var(--red-soft);
}

.row-menu-pop hr {
  height: 1px;
  margin: 4px 3px;
  border: 0;
  background: var(--line);
}

.msg-audit-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(234, 223, 211, 0.65);
}

.msg-audit-row:last-child {
  border-bottom: 0;
}

.msg-audit-row .avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 8px;
  margin-top: 2px;
}

.msg-audit-copy {
  flex: 1;
  min-width: 0;
}

.msg-audit-head {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  font-size: 8.5px;
  color: var(--muted);
}

.msg-audit-head strong {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--ink);
}

.msg-audit-head .conv-tag {
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--paper-soft);
  border: 1px solid var(--line);
  font-size: 7px;
  color: var(--muted);
}

.msg-audit-head time {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 7px;
}

.msg-audit-text {
  margin: 5px 0 0;
  font-size: 9.5px;
  line-height: 1.65;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.msg-audit-text.is-deleted {
  color: var(--muted);
  font-style: italic;
}

.msg-audit-delete {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  flex: none;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #b3a097;
}

.msg-audit-delete:hover {
  color: var(--red);
  border-color: rgba(189, 104, 104, 0.15);
  background: var(--red-soft);
}

.msg-audit-delete svg {
  width: 13px;
  height: 13px;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 16px;
}

.settings-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255, 253, 249, 0.82);
  box-shadow: var(--shadow-sm);
}

.settings-card h2 {
  margin: 0 0 5px;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
}

.settings-card > p {
  margin: 0 0 20px;
  font-size: 9px;
  line-height: 1.65;
  color: var(--muted);
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.settings-field label {
  font-size: 9px;
  font-weight: 600;
  color: var(--ink-soft);
}

.settings-field input {
  height: 41px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
  background: #fbf7f1;
  font-size: 10.5px;
  color: var(--ink);
  transition: 0.18s;
}

.settings-field input:focus {
  border-color: rgba(205, 132, 151, 0.5);
  background: #fffdf9;
  box-shadow: 0 0 0 3px rgba(205, 132, 151, 0.08);
}

.settings-field small {
  font-size: 8px;
  line-height: 1.6;
  color: var(--muted-2);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.toggle-copy strong {
  display: block;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--ink-soft);
}

.toggle-copy small {
  display: block;
  margin-top: 4px;
  font-size: 8px;
  line-height: 1.5;
  color: var(--muted);
}

.switch {
  position: relative;
  width: 38px;
  height: 22px;
  flex: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}

.switch-track {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 99px;
  background: #e9ded2;
  border: 1px solid rgba(201, 180, 163, 0.4);
  transition: 0.2s;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fffdf9;
  box-shadow: 0 1px 3px rgba(91, 69, 55, 0.18);
  transition: 0.2s;
}

.switch input:checked + .switch-track {
  background: #b7d0c3;
  border-color: rgba(127, 159, 145, 0.4);
}

.switch input:checked + .switch-track::after {
  left: 19px;
}

.audit-list {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 253, 249, 0.82);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.audit-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 17px;
  border-bottom: 1px solid rgba(234, 223, 211, 0.65);
}

.audit-row:last-child {
  border-bottom: 0;
}

.audit-icon {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  flex: none;
  margin-top: 1px;
  border-radius: 8px;
  color: var(--sage-deep);
  background: var(--sage-soft);
}

.audit-icon svg {
  width: 12px;
  height: 12px;
}

.audit-copy {
  flex: 1;
  min-width: 0;
}

.audit-copy p {
  margin: 0;
  font-size: 9.5px;
  line-height: 1.55;
  color: var(--ink-soft);
}

.audit-copy p strong {
  color: var(--ink);
  font-weight: 600;
}

.audit-copy small {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
  font-size: 7.5px;
  color: var(--muted);
}

.audit-copy small code {
  font-family: var(--mono);
  font-size: 7px;
  color: var(--muted-2);
}

.audit-empty {
  padding: 50px 20px;
  text-align: center;
  font-size: 9.5px;
  color: var(--muted);
}

.admin-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 80px 20px;
  color: var(--ink-soft);
  font-size: 10px;
}

.admin-error svg {
  width: 23px;
  height: 23px;
  color: var(--gold);
}

.modal-note {
  margin: 0 0 14px;
  padding: 9px 11px;
  border-radius: 9px;
  font-size: 8.5px;
  line-height: 1.65;
  color: #8c713f;
  border: 1px solid rgba(196, 160, 105, 0.22);
  background: var(--gold-soft);
}

/* ==========================================================================
   弹窗 / toast
   ========================================================================== */

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(47, 63, 70, 0.32);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.18s ease both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-card {
  position: relative;
  width: min(470px, 100%);
  max-height: min(86dvh, 760px);
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 23px;
  background: #fffdf9;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  overflow: hidden;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

.modal-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
}

.modal-head .icon-btn {
  width: 31px;
  height: 31px;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.modal-copy {
  margin: 0;
  font-size: 10.5px;
  line-height: 1.85;
  color: var(--ink-soft);
  white-space: pre-wrap;
}

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

.profile-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.profile-hero h3 {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
}

.profile-hero p {
  margin: 0;
  font-family: var(--mono);
  font-size: 8.5px;
  color: var(--muted);
}

.profile-hero .profile-tags {
  justify-content: flex-start;
  margin-top: 7px;
}

.modal-section {
  margin-top: 22px;
  padding-top: 19px;
  border-top: 1px solid var(--line);
}

.modal-section h3 {
  margin: 0 0 13px;
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-form .field label {
  font-size: 9px;
}

.modal-form .field-control {
  height: 43px;
  background: #fbf7f1;
}

.modal-form .btn {
  align-self: flex-end;
}

.modal-danger {
  color: #a95757;
  border-color: rgba(189, 104, 104, 0.3);
  background: var(--red-soft);
}

.modal-danger:hover {
  background: #f6ddda;
}

.toast-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(330px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 253, 249, 0.98);
  box-shadow: 0 16px 40px rgba(91, 69, 55, 0.16);
  backdrop-filter: blur(16px);
  font-size: 10px;
  line-height: 1.55;
  color: var(--ink-soft);
  animation: toastIn 0.24s ease both;
  pointer-events: auto;
}

.toast.is-leaving {
  animation: toastOut 0.2s ease both;
}

.toast svg {
  width: 15px;
  height: 15px;
  margin-top: 1px;
  flex: none;
  color: var(--sage-deep);
}

.toast.is-error {
  border-color: rgba(189, 104, 104, 0.25);
}

.toast.is-error svg {
  color: var(--red);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(5px);
  }
}

.loader-ring {
  display: inline-block;
  width: 19px;
  height: 19px;
  border: 2px solid rgba(205, 132, 151, 0.18);
  border-top-color: var(--rose);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   响应式
   ========================================================================== */

.mobile-only {
  display: none !important;
}

@media (max-width: 1240px) {
  .app-screen,
  .app-screen.context-open {
    grid-template-columns: 286px minmax(0, 1fr);
  }

  .context-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    width: min(310px, 88vw);
    display: flex;
    transform: translateX(102%);
    transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: -25px 0 70px rgba(91, 69, 55, 0.16);
  }

  .context-open .context-panel {
    transform: translateX(0);
  }
}

@media (max-height: 700px) {
  .hero-whale-scene {
    display: none;
  }
}

@media (max-width: 1180px) {
  .hero-whale-scene {
    display: none;
  }

  .hero-copy h1 {
    max-width: 540px;
  }
}

@media (max-width: 1080px) {
  .auth-screen {
    grid-template-columns: minmax(0, 1fr) minmax(390px, 0.9fr);
  }

  .auth-hero {
    padding: 34px 36px;
  }

  .hero-features {
    grid-template-columns: 1fr;
    gap: 8px;
    max-width: 330px;
  }

  .feature-card {
    padding: 12px 13px;
  }

  .hero-copy h1 {
    font-size: clamp(44px, 6.4vw, 64px);
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dash-grid {
    grid-template-columns: 1fr;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  body {
    overflow: auto;
  }

  .auth-screen {
    display: block;
    min-height: 100dvh;
    overflow-y: auto;
  }

  .auth-hero {
    min-height: auto;
    padding: 28px 24px 4px;
  }

  .brand-hero .brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 15px;
  }

  .brand-hero .brand-whale {
    width: 32px;
    height: 32px;
  }

  .brand-hero .brand-words strong {
    font-size: 19px;
  }

  .hero-copy {
    padding-top: 44px;
  }

  .hero-copy h1 {
    font-size: clamp(40px, 10vw, 58px);
  }

  .hero-lead {
    margin-top: 17px;
    font-size: 12.5px;
  }

  .hero-features {
    display: none;
  }

  .hero-foot {
    margin-top: 23px;
    padding-top: 14px;
    font-size: 9px;
  }

  .auth-hero::before {
    display: none;
  }

  .auth-panel-wrap {
    padding: 23px 16px 40px;
    border-left: 0;
  }

  .auth-panel {
    padding: 26px 22px;
    border-radius: 23px;
  }

  .auth-copyright {
    display: none;
  }

  .app-screen {
    display: block;
    height: 100dvh;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 60;
    width: min(320px, 88vw);
    transform: translateX(-102%);
    transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 25px 0 70px rgba(91, 69, 55, 0.18);
  }

  .sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-open .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(47, 63, 70, 0.24);
    backdrop-filter: blur(3px);
  }

  .mobile-only {
    display: inline-grid !important;
  }

  .chat-main {
    height: 100dvh;
  }

  .context-panel {
    z-index: 70;
  }

  .chat-header {
    height: 66px;
    padding: 0 13px;
    gap: 9px;
  }

  .chat-title h2 {
    font-size: 16px;
  }

  .chat-header .room-avatar {
    width: 35px;
    height: 35px;
    border-radius: 12px;
  }

  .conn-status {
    display: none;
  }

  .messages {
    padding: 12px 14px 4px;
  }

  .composer-wrap {
    padding: 6px 12px max(12px, env(safe-area-inset-bottom));
  }

  .emoji-picker {
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
    bottom: calc(100% + 1px);
  }

  .msg-body {
    max-width: 84%;
  }

  .bubble {
    font-size: 12.5px;
  }

  .msg-actions {
    opacity: 0.55;
    transform: none;
  }

  .msg.is-own .msg-actions {
    transform: none;
  }

  /* 避免 iOS 聚焦输入框时自动放大页面 */
  .field-control input,
  .composer textarea,
  .settings-field input {
    font-size: 16px;
  }

  .composer-hint {
    display: none;
  }

  .admin-nav {
    width: 66px;
    padding: 18px 7px;
  }

  .admin-nav-label {
    display: none;
  }

  .admin-nav-item {
    justify-content: center;
    padding: 12px 0;
  }

  .admin-nav-item span {
    display: none;
  }

  .admin-nav-note {
    display: none;
  }

  .admin-main {
    padding: 20px 14px 36px;
  }

  .admin-heading h1 {
    font-size: 22px;
  }

  .admin-secure {
    display: none;
  }

  .data-table {
    min-width: 720px;
  }

  .table-card {
    overflow-x: auto;
  }

  .encryption-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .hero-copy {
    padding-top: 38px;
  }

  .hero-copy h1 {
    font-size: 39px;
  }

  .hero-lead {
    font-size: 12px;
    line-height: 1.85;
  }

  .auth-panel {
    padding: 22px 17px;
    border-radius: 20px;
  }

  .auth-heading h2 {
    font-size: 24px;
  }

  .auth-heading-compact h2 {
    font-size: 20px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-value {
    font-size: 24px;
  }

  .admin-header {
    height: 61px;
    padding: 0 12px;
    gap: 10px;
  }

  .admin-brand strong {
    font-size: 10.5px;
  }

  .admin-brand small {
    display: none;
  }

  .admin-header-right .avatar {
    display: none;
  }

  .admin-heading {
    margin-bottom: 15px;
  }

  .admin-heading .btn {
    padding: 0 9px;
  }

  .toolbar {
    gap: 6px;
  }

  .toolbar-search {
    min-width: 100%;
    max-width: none;
  }

  .toolbar select {
    flex: 1;
  }

  .emoji-grid {
    grid-template-columns: repeat(7, 1fr);
    max-height: 200px;
  }

  .emoji-picker {
    padding: 10px;
  }

  .composer {
    border-radius: 16px;
  }

  .messages {
    padding-left: 12px;
    padding-right: 12px;
  }

  .msg-body {
    max-width: 87%;
  }

  .msg-avatar-slot {
    width: 27px;
  }

  .msg-avatar-slot .avatar {
    width: 27px;
    height: 27px;
  }

  .toast-root {
    right: 12px;
    bottom: 12px;
  }
}

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