/* 无 data-theme（noscript）或变量尚未匹配时，避免 background: var(--bg) 无效透出浏览器白底 */
:root {
  --bg: #f4f6f9;
  --text: #0f1115;
}

:root[data-theme="light"] {
  --bg: #f4f6f9;
  --sidebar: #eceef2;
  --panel: #ffffff;
  --text: #0f1115;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #3b5bdb;
  --accent-hover: #2d4bc4;
  --bubble-user: #e8edff;
  --bubble-ai: #ffffff;
  --shadow: 0 1px 3px rgba(15, 17, 21, 0.06);
}

:root[data-theme="dark"] {
  --bg: #0d0d0f;
  --sidebar: #161618;
  --panel: #1a1a1e;
  --text: #ececf1;
  --muted: #9ca3af;
  --border: #2a2a30;
  --accent: #5b7cfa;
  --accent-hover: #7c94fc;
  --bubble-user: #252532;
  --bubble-ai: #1e1e24;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app {
  display: flex;
  height: 100%;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  margin-bottom: 12px;
  padding: 0 8px;
}

/* 透明底锁标；侧栏底色由 --sidebar 提供，避免再垫不透明 PNG */
.brand-lockup-wrap {
  width: 100%;
  max-width: 148px;
  display: block;
}

.brand-lockup-wrap .brand-lockup {
  width: 100%;
  height: auto;
  display: block;
}

:root[data-theme="dark"] .brand-lockup-wrap .brand-lockup {
  filter: brightness(1.05);
}

.brand small {
  display: block;
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 16px;
}

.nav button {
  text-align: left;
  padding: 12px 14px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s;
}

.nav button:hover {
  background: rgba(91, 124, 250, 0.12);
}

.nav button.active {
  background: rgba(91, 124, 250, 0.2);
  font-weight: 600;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
  padding-left: 8px;
  display: flex;
  flex-direction: column;
  gap: 0;
  flex-shrink: 0;
}

.sidebar-footer .sidebar-logout-row {
  margin-top: 6px;
  margin-bottom: 0;
}

.theme-btn {
  margin-top: 10px;
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
  padding: 20px 24px 28px;
}

.chat-main {
  min-height: 0;
}

.sidebar-hint,
.sidebar-note {
  font-size: 0.78rem;
  color: var(--muted);
  padding: 0 8px;
  line-height: 1.5;
  margin: 12px 0 0;
}

.sidebar-hint code {
  font-size: 0.85em;
  background: var(--panel);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.sidebar-note {
  margin-top: 10px;
  opacity: 0.92;
}

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

.sidebar-doc a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.icp-footer {
  margin-top: 10px;
  margin-bottom: 0;
  text-align: center;
}

.icp-footer a {
  font-size: 0.72rem;
  color: var(--muted);
  text-decoration: none;
}

.icp-footer a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.scene-label {
  font-size: 0.75rem;
  color: var(--muted);
  padding: 0 8px;
  margin-top: 14px;
  display: block;
}

.scene-select {
  width: calc(100% - 16px);
  margin: 6px 8px 0;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 0.85rem;
}

.composer-bar {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

/* 输入区：缩略图在灰色输入框「上方」独立一条 */
.composer-main-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.attach-thumbs {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
  align-content: flex-start;
  max-height: 104px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 0;
  flex: 0 0 auto;
  width: 100%;
}

.attach-thumbs.has-files {
  display: flex;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px dashed var(--border);
  background: rgba(91, 124, 250, 0.06);
}

:root[data-theme="dark"] .attach-thumbs.has-files {
  background: rgba(91, 124, 250, 0.12);
}

.attach-thumb-wrap {
  position: relative;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.attach-thumb-wrap img.attach-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.attach-thumb-wrap.attach-thumb-wrap--file {
  width: auto;
  min-width: 112px;
  max-width: min(220px, 46vw);
  height: 64px;
  padding: 4px 28px 4px 8px;
  display: flex;
  align-items: center;
}

.attach-file-chip {
  font-size: 0.72rem;
  line-height: 1.25;
  color: var(--muted);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-all;
}

.attach-thumb-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  padding: 0;
  line-height: 20px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #fff;
  background: rgba(0, 0, 0, 0.6);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.attach-thumb-remove:hover {
  background: rgba(200, 50, 50, 0.95);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.btn-attach {
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 2px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
}

.btn-attach:hover {
  background: rgba(91, 124, 250, 0.1);
}

.site-icp-bar {
  text-align: center;
  margin: 12px 0 0;
  padding: 10px 8px 0;
  font-size: 0.72rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.site-icp-bar a {
  color: var(--muted);
  text-decoration: none;
}

.site-icp-bar a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.attach-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 6px;
  padding-left: 4px;
}

.ai-result-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.ai-text-block {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.65;
  font-size: 0.95rem;
}

.ai-text-block .ai-copy-inline-img {
  display: block;
  max-width: min(100%, 480px);
  height: auto;
  margin: 10px 0;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.ai-copy-ref-cap {
  margin-top: 14px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.ai-copy-ref-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.ai-copy-ref-img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.btn-mini {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 8px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.3;
}

.btn-mini-ico {
  display: inline-flex;
  flex-shrink: 0;
  line-height: 0;
  opacity: 0.92;
}

.btn-mini-ico svg {
  display: block;
}

.result-img-inline,
.result-video-inline {
  max-width: min(100%, 520px);
  border-radius: 10px;
  margin-top: 8px;
  border: 1px solid var(--border);
}

.panel {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.panel.active {
  display: flex;
}

.panel h1 {
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0 0 6px;
}

.panel .hint {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 20px;
}

.chat-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0 4px 0 0;
  margin-bottom: 16px;
}

#chat-messages {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: stretch;
}

/* 共用排版；AI 像 DeepSeek 一样铺在背景上，不用独立灰底块圈住整段 */
.msg {
  line-height: 1.6;
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-break: break-word;
  box-sizing: border-box;
}

.msg.user {
  align-self: flex-end;
  margin-left: auto;
  margin-right: 0;
  max-width: min(92%, 720px);
  width: -moz-fit-content;
  width: fit-content;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--bubble-user);
  border: 1px solid var(--border);
}

.msg.user .user-attach-preview-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  max-width: 100%;
}

.msg.user .user-attach-preview {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
}

.msg.user .user-attach-file-chip {
  display: inline-block;
  max-width: 240px;
  padding: 6px 10px;
  font-size: 0.78rem;
  line-height: 1.3;
  color: var(--text);
  background: rgba(91, 124, 250, 0.1);
  border: 1px solid var(--border);
  border-radius: 8px;
  word-break: break-word;
}

.msg.user .user-attach-file-link {
  text-decoration: none;
}

.msg.user .user-attach-file-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.msg.ai {
  align-self: stretch;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 6px 0 18px;
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  color: var(--text);
}

.msg.ai[data-ai-loading='1'] {
  padding: 4px 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.ai-loading-row {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.ai-loading-text {
  line-height: 1.5;
}

.ai-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ai-spin 0.75s linear infinite;
}

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

.composer-panel {
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.composer-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 10px;
  width: 100%;
}

.composer-panel .composer-row textarea,
.field textarea {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 52px;
  max-height: 180px;
  resize: vertical;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.45;
  font-family: inherit;
  outline: none;
}

.btn {
  padding: 10px 20px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
}

/* 发送：固定小块，不被 flex 拉成整行高度 */
.btn-send {
  flex: 0 0 auto;
  align-self: flex-end;
  padding: 8px 16px;
  font-size: 0.85rem;
  border-radius: 10px;
  line-height: 1.25;
}

.btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

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

.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
  cursor: pointer;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input[type="text"],
.field input[type="file"],
.field select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 0.9rem;
}

.result-img {
  margin-top: 20px;
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.result-video {
  margin-top: 20px;
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.err {
  color: #dc2626;
  font-size: 0.88rem;
  margin-top: 8px;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.mode-context-hint {
  margin: 8px 0 4px;
  padding: 0 8px;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
}

.mode-context-hint:empty {
  display: none !important;
}

.link-context-wrap {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 6px 0 10px;
  padding: 0 8px;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
  cursor: pointer;
}

.link-context-wrap input {
  margin-top: 2px;
  flex-shrink: 0;
}

.animate-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 4px 0 6px 2px;
}

.animate-chips-label {
  font-size: 0.78rem;
  color: var(--muted);
  margin-right: 2px;
}

.animate-chip {
  font-size: 0.76rem;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}

.animate-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

@media (max-width: 720px) {
  .app {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 12px;
  }
  .nav {
    flex-direction: row;
    flex-wrap: wrap;
    margin-top: 0;
    flex: 1;
  }
  .sidebar-footer {
    border: none;
    border-top: 1px solid var(--border);
    margin: 0;
    padding: 10px 0 0;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
  }
  .sidebar-footer .sidebar-logout-row,
  .sidebar-footer .icp-footer {
    width: 100%;
    text-align: center;
    margin-top: 4px;
  }
  .sidebar-footer .icp-footer {
    order: 10;
  }
}

/* 整页登录：未登录时不显示背后主应用（独立品牌全屏页，非主界面弹窗） */
html.login-gate,
html.login-gate body {
  min-height: 100%;
  background: #0f1117;
}

html.login-gate .app {
  display: none !important;
}

html.login-gate #login-overlay.login-overlay {
  display: flex !important;
}

/* copseed 登录页 · 深色双栏（与锁标亮蓝同一气质） */
.login-overlay {
  --login-ds-bg: #0c0f14;
  --login-ds-panel: #141a24;
  --login-ds-border: #2a3348;
  --login-ds-accent: #38bdf8;
  --login-ds-accent-hover: #7dd3fc;
  --login-ds-accent-soft: rgba(56, 189, 248, 0.2);
  --login-ds-muted: #9aa8bf;
  --login-ds-text: #f1f5fb;

  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: max(28px, 5dvh) 16px 56px;
  overflow-y: auto;
  min-height: 100dvh;
  box-sizing: border-box;
  background:
    radial-gradient(100% 70% at 50% -10%, rgba(56, 189, 248, 0.12) 0%, transparent 55%),
    radial-gradient(120% 80% at 50% 0%, #151b28 0%, var(--login-ds-bg) 58%);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.login-overlay[hidden] {
  display: none !important;
}

.login-ds-shell {
  width: 100%;
  max-width: 880px;
  margin-top: max(0px, env(safe-area-inset-top, 0px));
}

.login-ds-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 28px;
}

.login-ds-lockup {
  width: min(280px, 86vw);
  max-width: 100%;
  height: auto;
  display: block;
  /* 透明底锁标叠在渐变上；轻微提亮以免发灰 */
  filter: brightness(1.08) saturate(1.12) contrast(1.03);
}

.login-ds-logo-sub {
  margin: 0;
  text-align: center;
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: #b8e7ff;
  text-shadow: 0 0 24px rgba(56, 189, 248, 0.25);
}

.login-ds-grid {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: center;
  gap: 40px;
}

.login-ds-col {
  min-width: 0;
}

.login-ds-form {
  flex: 1 1 320px;
  max-width: 400px;
}

.login-ds-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;
}

.login-ds-micro-hint {
  margin: 0 0 20px;
  font-size: 0.8rem;
  line-height: 1.58;
  color: #aab8d0;
}

.login-field-block {
  margin-bottom: 14px;
}

.login-field-block .login-ds-field {
  margin-bottom: 0;
}

.login-ds-field {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  width: 100%;
  margin-bottom: 14px;
  padding: 4px 4px 4px 18px;
  min-height: 52px;
  border-radius: 14px;
  border: 1px solid var(--login-ds-border);
  background: var(--login-ds-panel);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-ds-field:focus-within {
  border-color: var(--login-ds-accent);
  box-shadow: 0 0 0 2px var(--login-ds-accent-soft);
}

.login-ds-field.has-error,
.login-ds-field.has-error:focus-within {
  border-color: #ef4444;
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.35);
}

.login-field-err {
  margin: 6px 0 0 4px;
  font-size: 0.74rem;
  line-height: 1.35;
  color: #f87171;
}

.login-field-err:empty {
  display: none;
}

.login-cc {
  flex-shrink: 0;
  margin-right: 10px;
  font-size: 0.95rem;
  color: var(--login-ds-muted);
}

.login-phone-field,
.login-code-field {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--login-ds-text);
  font-size: 0.95rem;
  outline: none;
  padding: 10px 12px 10px 0;
}

.login-phone-field::placeholder,
.login-code-field::placeholder {
  color: #6b7a92;
}

.login-ds-code-wrap {
  padding-right: 6px;
}

.login-code-divider {
  flex-shrink: 0;
  width: 1px;
  align-self: stretch;
  min-height: 28px;
  margin: 8px 4px 8px 0;
  background: var(--login-ds-border);
}

.login-send-link {
  flex-shrink: 0;
  padding: 10px 14px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--login-ds-accent);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}

.login-send-link:hover:not(:disabled) {
  color: var(--login-ds-accent-hover);
}

.login-send-link:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.login-terms {
  margin: 4px 0 12px;
  font-size: 0.74rem;
  line-height: 1.55;
  color: #9babca;
}

.login-terms-link {
  color: var(--login-ds-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.login-terms-link:hover {
  color: var(--login-ds-accent-hover);
}

.login-overlay .login-msg {
  min-height: 1.25em;
  font-size: 0.82rem;
  color: #9eb1cc;
  margin: 0 0 14px;
}

.login-msg:empty {
  display: none;
}

.login-ds-submit {
  width: 100%;
  margin-top: 4px;
  padding: 14px 20px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #0ea5e9 0%, #38bdf8 42%, #2563eb 100%);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 8px 28px rgba(14, 165, 233, 0.28);
  transition: opacity 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

.login-ds-submit:hover {
  filter: brightness(1.05);
  box-shadow: 0 10px 32px rgba(14, 165, 233, 0.38);
}

.login-ds-alt-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 22px;
  margin-bottom: 8px;
}

.login-ds-alt-line {
  flex: 1;
  max-width: 120px;
  height: 1px;
  background: var(--login-ds-border);
}

.login-ds-alt-ico {
  flex-shrink: 0;
  opacity: 0.55;
  color: #7dd3fc;
}

.login-ds-qr {
  flex: 0 0 280px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-qr-panel {
  width: 100%;
  max-width: 280px;
  padding: 26px 22px 22px;
  border-radius: 18px;
  background: linear-gradient(165deg, #162030 0%, var(--login-ds-panel) 100%);
  border: 1px solid rgba(56, 189, 248, 0.12);
  box-sizing: border-box;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.38);
}

.login-qr-box {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.login-wx-qr-wrap {
  width: 100%;
  max-width: 280px;
}

/* 否则 .login-wx-qr-frame{display:block} 会盖掉 [hidden]，未加载 iframe 时仍占 300px 白底 */
.login-wx-qr-frame[hidden] {
  display: none !important;
}

.login-wx-qr-frame {
  display: block;
  width: 100%;
  height: 300px;
  border: none;
  border-radius: 12px;
  background: #f8fafc;
}

.login-wx-err {
  margin: 10px 0 0;
  font-size: 0.74rem;
  line-height: 1.45;
  color: #fca5a5;
  text-align: center;
}

.login-wx-err:empty {
  display: none;
}

.login-qr-placeholder {
  width: min(220px, 100%);
  min-height: 200px;
  aspect-ratio: 1;
  max-width: 220px;
  margin: 0 auto;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px dashed rgba(125, 211, 252, 0.28);
  color: #cbd5e1;
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 14px;
  text-align: center;
  box-sizing: border-box;
}

.login-qr-ph-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #e0f2fe;
}

.login-qr-ph-sub {
  font-size: 0.72rem;
  line-height: 1.45;
  color: #94a3b8;
}

.login-qr-caption {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  font-size: 0.88rem;
  color: var(--login-ds-text);
}

.login-wechat-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #07c160;
  flex-shrink: 0;
}

@media (max-width: 720px) {
  .login-ds-grid {
    flex-direction: column;
    align-items: center;
    gap: 28px;
  }

  .login-ds-form {
    width: 100%;
    max-width: 400px;
  }

  .login-ds-qr {
    flex: 0 0 auto;
    width: 100%;
    max-width: 320px;
  }
}

@media (max-width: 480px) {
  .login-ds-qr {
    display: none;
  }

  .login-ds-grid {
    gap: 0;
  }
}

.btn-secondary {
  background: var(--sidebar);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border);
}

.btn-text {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
}

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

.gate-panel {
  margin-top: 12px;
  padding: 10px 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
}

.gate-panel .scene-label {
  margin-top: 0;
}

.gate-input {
  width: 100%;
  box-sizing: border-box;
  margin-top: 8px;
  padding: 8px 10px;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--sidebar);
  color: var(--text);
}

.gate-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.gate-save {
  font-size: 0.82rem;
  padding: 8px 12px;
}
