:root {
  --cloud-50: #fffdf8;
  --cloud-100: #f7f1e5;
  --cloud-200: #eadfca;
  --white: #fffefa;
  --ink-950: #191816;
  --ink-900: #23211e;
  --ink-800: #2c2925;
  --ink-700: #37342f;
  --ink-600: #56514b;
  --ink-500: #716d66;
  --gold-900: #4c3719;
  --gold-800: #302719;
  --gold-700: #80622f;
  --gold-600: #9c7735;
  --gold-500: #b58a3d;
  --gold-300: #dfc387;
  --gold-200: #ead49f;
  --gold-100: #ead49f;
  --gold-50: #fbf4e3;
  --line: #e5dccb;
  /* Compatibility aliases for existing component selectors. */
  --paper-50: var(--cloud-50);
  --paper-100: var(--cloud-100);
  --paper-200: var(--cloud-200);
  --moss-800: var(--ink-950);
  --moss-700: var(--gold-800);
  --moss-600: var(--gold-700);
  --moss-100: var(--gold-100);
  --moss-50: var(--gold-50);
  --danger-700: #a53d3d;
  --danger-100: #f8e5e2;
  --warning-700: #886122;
  --warning-100: #f7ebcd;
  --color-background: var(--paper-50);
  --color-surface: var(--white);
  --color-text: var(--ink-950);
  --color-text-muted: var(--ink-500);
  --color-primary: var(--gold-800);
  --color-primary-hover: var(--ink-950);
  --color-accent: var(--gold-700);
  --color-selected: var(--gold-50);
  --color-border: var(--line);
  --color-danger: var(--danger-700);
  --header-height: 64px;
  --reading-width: 760px;
  --workspace-width: 1040px;
  --drawer-width: 336px;
  --control-height: 44px;
  --mobile-control-height: 48px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-card: 0 8px 24px rgb(76 55 22 / 7%);
  --shadow-sheet: 0 22px 70px rgb(76 55 22 / 10%);
  --shadow-modal: 0 24px 90px rgb(25 24 22 / 22%);
  --duration-fast: 160ms;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --ease-drawer: cubic-bezier(.32, .72, 0, 1);
  color-scheme: light;
  font-family: "Noto Sans SC", "PingFang SC", DengXian, "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

/* ============================================================
   聊天页蓝白科技风 tokens（自测试项目 vant-chat-demo 迁移）
   仅供聊天页使用；文案中心/抽屉/弹窗等二级页面沿用下方旧变量。
   ============================================================ */
:root {
  --brand-600: #2563eb;
  --brand-500: #3b82f6;
  --brand-400: #60a5fa;
  --brand-300: #93c5fd;
  --brand-200: #bfdbfe;
  --brand-100: #dbeafe;
  --brand-50:  #eff6ff;

  /* 用户气泡（我方）渐变色：更亮的天蓝 */
  --user-gradient: linear-gradient(135deg, #2b8cff 0%, #4fa5ff 55%, #74bdff 100%);

  --text-strong: #16233d;
  --text-main:   #24324e;
  --text-sub:    #5c6b8a;
  --text-weak:   #98a4bd;

  --bg-page:   #eef4fc;
  --bg-card:   #ffffff;
  --bg-soft:   #f4f8fe;
  --bg-soft-2: #e9f1fc;

  --chat-border:    #dbe7f7;
  --chat-divider:   #e8f0fb;

  --shadow-xs: 0 1px 2px rgba(37, 99, 235, 0.05);
  --shadow-sm: 0 2px 8px rgba(37, 99, 235, 0.07);
  --shadow-md: 0 8px 24px rgba(37, 99, 235, 0.10);
  --shadow-lg: 0 12px 32px rgba(37, 99, 235, 0.14);

  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 20px;
  --r-xl: 24px;

  --glow-brand: 0 6px 18px rgba(59, 130, 246, 0.28);
  --glow-soft:  0 8px 22px rgba(59, 130, 246, 0.16);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body { height: 100%; }
html { min-width: 0; background: var(--bg-page); }

body,
button, input, textarea, select, a {
  touch-action: manipulation;
  -webkit-touch-callout: none;
}
body {
  margin: 0;
  height: 100%;
  color: var(--color-text);
  background:
    radial-gradient(120% 42% at 50% -8%, rgba(96, 165, 250, 0.16), transparent 60%),
    linear-gradient(rgba(59, 130, 246, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 130, 246, 0.022) 1px, transparent 1px),
    var(--bg-page);
  background-size: auto, 28px 28px, 28px 28px, auto;
  background-attachment: fixed;
  font-size: 16px;
  line-height: 1.5;
}
body.has-overlay { overflow: hidden; }

button, input, textarea, select { font: inherit; }
button, input, textarea, select, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }

:focus-visible {
  outline: 3px solid rgb(128 98 47 / 34%);
  outline-offset: 3px;
}

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

.skip-link {
  position: fixed;
  z-index: 200;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  color: white;
  background: var(--moss-800);
  border-radius: var(--radius-sm);
  transform: translateY(-140%);
}
.skip-link:focus { transform: translateY(0); }

.app-shell { display: flex; height: 100vh; height: 100dvh; min-height: 0; flex-direction: column; }
main { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }

.icon-button { display: inline-grid; place-items: center; width: var(--control-height); height: var(--control-height); padding: 0; color: var(--ink-700); background: transparent; border: 1px solid transparent; border-radius: 50%; transition: background 160ms ease, border-color 160ms ease, transform 100ms var(--ease-out); }
.icon-button:hover { background: var(--paper-100); border-color: var(--line); }
.icon-button svg, button svg, .search-field svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.view { display: none; }
.view:not(.is-active) { display: none !important; }
.view.is-active { display: flex; flex-direction: column; min-height: 0; }

h1, h2, h3, p { overflow-wrap: anywhere; }
h1, h2 { font-family: inherit; letter-spacing: -.025em; }
.page-heading h1 { margin: 0; font-size: clamp(21px, 3vw, 26px); line-height: 1.3; font-weight: 600; }

/* 聊天页样式由 chat.css 提供（迁移自参考项目），此处不再重复定义 */
/* 聊天页 .assistant-thinking / .typing-dots / 动画 由 chat.css 统一负责 */

/* 输入区样式由 chat.css 提供；此处仅保留弹窗/搜索框共享的文本框规则 */
.modal textarea, .modal input, .modal select, .search-field input { width: 100%; color: var(--color-text); background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-md); }
.modal textarea:focus, .modal input:focus, .modal select:focus, .search-field input:focus { outline: none; border-color: var(--brand-300); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12); }
.mode-switch { display: flex; margin: 0; padding: 2px; border: 1px solid var(--line); border-radius: 999px; }
.mode-switch label { cursor: pointer; }
.mode-switch input { position: absolute; opacity: 0; pointer-events: none; }
.mode-switch span { display: grid; place-items: center; min-width: 60px; min-height: 40px; padding: 4px 12px; color: var(--color-text-muted); border-radius: 999px; font-size: 13px; transition: background 160ms ease, color 160ms ease; }
.mode-switch input:checked + span { color: var(--ink-950); background: var(--paper-100); font-weight: 600; }
  .mode-switch input:focus-visible + span { outline: 3px solid rgb(128 98 47 / 34%); outline-offset: 2px; }
.web-toggle { display: flex; align-items: center; gap: 7px; min-height: 44px; cursor: pointer; color: var(--ink-700); font-size: 13px; }
.web-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track { position: relative; width: 34px; height: 20px; background: #b8bdb9; border-radius: 999px; transition: background 160ms ease; }
.toggle-track span { position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; background: white; border-radius: 50%; transition: transform 160ms ease; }
.web-toggle input:checked + .toggle-track { background: var(--moss-700); }
.web-toggle input:checked + .toggle-track span { transform: translateX(14px); }
  .web-toggle input:focus-visible + .toggle-track { outline: 3px solid rgb(128 98 47 / 34%); outline-offset: 2px; }
.character-count, .keyboard-hint { color: var(--color-text-muted); font-size: 12px; }

.primary-button, .secondary-button, .danger-button, .new-conversation-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--control-height); padding: 9px 16px; border-radius: var(--radius-sm); font-weight: 600; transition: background 160ms ease, border-color 160ms ease, transform 100ms ease; }
.primary-button { color: white; background: var(--color-primary); border: 1px solid var(--color-primary); }
.primary-button:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); }
.secondary-button { color: var(--ink-700); background: var(--white); border: 1px solid var(--line); }
.secondary-button:hover { color: var(--ink-950); background: var(--paper-50); border-color: #c8c2b6; }
.danger-button { color: white; background: var(--danger-700); border: 1px solid var(--danger-700); }
.danger-button:hover { background: #873131; }
.primary-button:active, .secondary-button:active, .danger-button:active { transform: translateY(1px); }
.icon-button:active:not(:disabled), .nav-tab:active:not(:disabled), .text-button:active:not(:disabled), .conversation-item__menu button:active:not(:disabled) { transform: scale(.97); }

.rules-view { padding: 36px 24px 64px; }
.rules-page { width: min(100%, 1040px); margin: 0 auto; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 32px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.page-heading p:last-child { max-width: 620px; margin: 8px 0 0; color: var(--color-text-muted); }
.rules-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 24px 0 16px; }
.search-field { position: relative; display: block; width: min(100%, 520px); }
.search-field svg { position: absolute; top: 12px; left: 13px; color: var(--color-text-muted); }
.search-field input { min-height: var(--control-height); padding: 9px 14px 9px 42px; }
.rules-toolbar > span { color: var(--color-text-muted); font-size: 13px; white-space: nowrap; }
.rule-list { display: grid; gap: 10px; }
.rule-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; padding: 18px 20px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-md); }
.rule-card.is-disabled { background: var(--paper-50); }
.rule-card__content { margin: 0 0 10px; line-height: 1.65; }
.rule-card.is-disabled .rule-card__content { color: var(--color-text-muted); text-decoration: line-through; text-decoration-color: rgb(105 113 108 / 45%); }
.rule-card__meta { display: flex; flex-wrap: wrap; gap: 7px; }
.meta-chip { padding: 4px 8px; color: var(--ink-700); background: var(--paper-100); border-radius: 999px; font-size: 11px; }
.meta-chip--active { color: var(--moss-800); background: var(--moss-100); }
.rule-card__actions { display: flex; align-items: flex-start; gap: 4px; }
.text-button { min-height: 44px; padding: 7px 10px; color: var(--moss-700); background: transparent; border: 0; border-radius: var(--radius-sm); font-size: 13px; }
.text-button:hover { background: var(--moss-50); }
.text-button--danger { color: var(--danger-700); }
.text-button--danger:hover { background: var(--danger-100); }
.rules-empty { padding: 64px 24px; color: var(--color-text-muted); text-align: center; border: 1px dashed var(--line); border-radius: var(--radius-md); }
.rules-empty h2 { margin: 0 0 8px; color: var(--ink-950); font-size: 20px; }
.rules-empty p { margin: 0; }

.drawer-backdrop { position: fixed; z-index: 60; inset: 0; background: rgba(37, 99, 235, 0.18); opacity: 0; transition: opacity 200ms ease; }
.drawer-backdrop.is-open { opacity: 1; }
.history-drawer { position: fixed; z-index: 70; inset: 0 auto 0 0; display: flex; flex-direction: column; width: min(90vw, var(--drawer-width)); padding: 22px 18px 18px; background: var(--bg-card); border-right: 1px solid var(--border); box-shadow: var(--shadow-lg); transform: translateX(-102%); transition: transform 220ms var(--ease-drawer); }
.history-drawer.is-open { transform: translateX(0); }
.drawer-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.drawer-header__title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.drawer-header__mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  color: #fff;
  background: linear-gradient(135deg, #3b82f6 0%, #4f8bf7 55%, #7c5cf2 100%);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .05em;
  box-shadow: var(--glow-brand);
  position: relative;
  overflow: hidden;
}
.drawer-header__mark::after { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 50%; background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent); pointer-events: none; }
.drawer-header h2 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: .01em; color: var(--text-strong); }
.new-conversation-button {
  width: 100%;
  margin: 20px 0 14px;
  color: #fff;
  background: linear-gradient(135deg, #3b82f6 0%, #4f8bf7 55%, #7c5cf2 100%);
  border: 0;
  box-shadow: var(--glow-brand);
  transition: filter 160ms ease, transform 100ms ease;
}
.new-conversation-button:hover { filter: brightness(1.08); }
.conversation-profile-button { width: 100%; margin: 0 0 14px; color: var(--brand-600); background: var(--bg-soft); border: 1px solid var(--border); }
.conversation-profile-button:hover { color: var(--brand-600); background: var(--brand-50); border-color: var(--brand-200); }
#manage-memory { margin-top: -8px; }
.conversation-list { flex: 1; overflow-y: auto; padding-right: 3px; }
.conversation-list__empty { margin: 24px 8px; color: var(--text-sub); font-size: 13px; text-align: center; line-height: 1.6; }
.conversation-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 50px;
  margin: 4px 0;
  padding: 8px 8px 8px 14px;
  color: var(--text-main);
  background: var(--bg-card);
  border: 1px solid var(--chat-border);
  border-radius: 12px;
  text-align: left;
  box-shadow: none;
  transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}
.conversation-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: transparent;
  transition: background 150ms ease;
}
.conversation-item:hover {
  background: var(--bg-soft);
  border-color: var(--brand-100);
}
.conversation-item.is-active {
  color: var(--text-strong);
  background: var(--brand-50);
  border-color: var(--brand-200);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
}
.conversation-item.is-active::before { background: linear-gradient(180deg, var(--brand-500), var(--brand-200)); }
.conversation-item__main { display: grid; gap: 2px; min-width: 0; }
.conversation-item__title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: .01em;
  color: var(--text-strong);
}
.conversation-item__preview {
  min-width: 0;
  overflow: hidden;
  color: var(--text-sub);
  font-size: 11.5px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  word-break: break-all;
  white-space: normal;
}
.conversation-item__side { display: grid; grid-template-rows: auto auto; justify-items: end; gap: 5px; min-width: 0; align-content: center; }
.conversation-item__time { color: var(--text-weak); font-size: 10px; white-space: nowrap; letter-spacing: .02em; }
.conversation-item__menu { display: inline-flex; gap: 1px; opacity: 0; transition: opacity 150ms ease; }
.conversation-item:hover .conversation-item__menu, .conversation-item:focus-within .conversation-item__menu, .conversation-item.is-active .conversation-item__menu { opacity: 1; }
.conversation-item__menu button { display: grid; place-items: center; width: 26px; height: 26px; padding: 0; color: var(--text-weak); background: transparent; border: 1px solid transparent; border-radius: 8px; transition: color 150ms ease, background 150ms ease, border-color 150ms ease; }
.conversation-item__menu button:hover { color: var(--brand-600); background: var(--brand-50); border-color: var(--brand-100); }
.conversation-item__menu button:last-child:hover { color: var(--danger-700); background: var(--danger-100); border-color: var(--danger-100); }
.conversation-item__menu svg { width: 13px; height: 13px; }
.drawer-note { margin: 12px 0 0; color: var(--text-weak); font-size: 11px; text-align: center; }

/* 侧边栏底部账号信息区：只展示 昵称 + 脱敏手机号 */
.drawer-account {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 0;
  padding: 10px 12px 10px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.drawer-account.is-hidden { display: none; }
.drawer-account__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #2b8cff, #7c5cf2);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.28);
}
.drawer-account__info { display: grid; gap: 2px; min-width: 0; flex: 1; }
.drawer-account__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-strong);
}
.drawer-account__sub {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--text-weak);
  font-variant-numeric: tabular-nums;
}
.drawer-account__logout {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sub);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}
.drawer-account__logout svg { width: 14px; height: 14px; }
.drawer-account__logout:hover {
  color: var(--danger-700);
  border-color: var(--danger-100);
  background: var(--danger-100);
}

.modal { width: min(calc(100% - 32px), 560px); padding: 0; color: var(--color-text); background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-modal); }
.modal::backdrop { background: rgb(31 36 33 / 34%); backdrop-filter: blur(2px); }
.modal form { padding: 24px; }
.modal--compact { width: min(calc(100% - 32px), 460px); }
.modal__heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.modal h2 { margin: 0; font-size: 23px; }
.modal > form > p:not(.eyebrow) { color: var(--color-text-muted); }
.modal__hint { margin: 4px 0 0; color: var(--ink-500); font-size: 13px; line-height: 1.6; }
.field-label { display: block; margin: 14px 0 7px; color: var(--ink-700); font-size: 13px; font-weight: 600; }
.modal textarea { min-height: 112px; padding: 11px 12px; resize: vertical; line-height: 1.55; }
.modal input, .modal select { min-height: var(--control-height); padding: 9px 11px; }
.field-grid { display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 14px; }
.check-row { display: flex; align-items: center; gap: 9px; min-height: var(--control-height); margin-top: 12px; cursor: pointer; }
.check-row input { width: 18px; height: 18px; accent-color: var(--moss-700); }
.modal__actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 24px; }
.conflict-comparison { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.conflict-comparison section { padding: 14px; background: var(--paper-50); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.conflict-comparison h3 { margin: 0 0 8px; font-size: 13px; }
.conflict-comparison p { margin: 0; color: var(--ink-700); line-height: 1.6; }
.conflict-comparison p + p { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }

.toast-region { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: grid; gap: 8px; width: min(calc(100% - 40px), 380px); pointer-events: none; }
.toast { padding: 12px 14px; color: white; background: var(--ink-950); border-radius: var(--radius-sm); box-shadow: var(--shadow-modal); opacity: 1; transform: translateY(0); transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out); }
.toast.is-error { background: var(--danger-700); }
@starting-style { .toast { opacity: 0; transform: translateY(8px); } }

@media (max-width: 767px) {
  /* 移动端：html/body 不锁死全局，高度用 --vh(iOS real可视区)；聊天页 Hero 由聊天视图自隔离 */
  html, body { width: 100%; height: 100%; overscroll-behavior-y: contain; }
  body { background: var(--bg-page); }
  .app-shell { display: flex; width: 100%; height: 100vh; height: 100dvh; min-height: 0; flex-direction: column; }

  main { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  .view.is-active { display: flex; }
  /* 聊天页移动端样式由 chat.css 提供 */
  .character-count, .keyboard-hint { display: none; }

  .page-heading { align-items: stretch; flex-direction: column; gap: 16px; padding-bottom: 18px; }
  .page-heading h1 { font-size: 24px; }
  .page-heading p:last-child { margin-top: 6px; font-size: 14px; line-height: 1.65; }
  .page-heading .primary-button { width: 100%; min-height: var(--mobile-control-height); }
  .rules-toolbar { align-items: stretch; flex-direction: column; gap: 8px; margin: 18px 0 12px; }
  .search-field { width: 100%; }
  .search-field input { min-height: var(--mobile-control-height); }
  .rules-toolbar > span { align-self: flex-end; }
  .rule-list { gap: 12px; }
  .rule-card { grid-template-columns: 1fr; gap: 12px; padding: 16px; border: 0; border-radius: 16px; box-shadow: 0 5px 20px rgb(23 32 51 / 4%); }
  .rule-card__actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding-top: 10px; border-top: 1px solid var(--cloud-100); }
  .text-button { min-height: var(--mobile-control-height); padding-inline: 6px; background: var(--cloud-50); }
  .history-drawer { width: min(92vw, 360px); padding-top: max(18px, env(safe-area-inset-top)); padding-bottom: max(18px, env(safe-area-inset-bottom)); border-radius: 0 20px 20px 0; }
  .conversation-item__menu { opacity: 1; }
  .field-grid, .conflict-comparison { grid-template-columns: 1fr; }
  .modal { max-height: calc(100dvh - 24px); overflow-y: auto; border-radius: 20px; }
  .modal form { padding: 20px; }
  .modal__actions--stack-mobile { align-items: stretch; flex-direction: column-reverse; }
  .modal__actions--stack-mobile button { width: 100%; min-height: var(--mobile-control-height); }
  .toast-region { right: 12px; bottom: calc(env(safe-area-inset-bottom) + 12px); width: calc(100% - 24px); }
}

@media (max-width: 430px) {
  .mode-switch span { min-width: 44px; padding-inline: 7px; }
  .web-toggle { gap: 5px; }
  .toggle-track { width: 32px; }
  .modal { width: calc(100% - 20px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .typing-dots i { animation: none; opacity: .65; }
}

/* ---------- 记忆管理弹窗 ---------- */
.modal--memory { max-width: 560px; }
.modal--memory .modal__hint { margin-top: 6px; font-size: 13px; line-height: 1.6; }
.memory-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 4px 0 8px;
  max-height: 46vh;
  overflow-y: auto;
  padding-right: 4px;
}
.memory-empty { margin: 20px 0; color: var(--color-text-muted); font-size: 13.5px; text-align: center; }
.memory-summary {
  margin: 6px 0 10px;
  padding: 16px 18px;
  font-size: 14px;
  line-height: 1.85;
  color: var(--color-text-primary, #24324e);
  background: var(--color-bg-soft, #f4f8fe);
  border: 1px solid var(--color-border, #dbe7f7);
  border-left: 3px solid var(--moss-700, #3b82f6);
  border-radius: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}
.memory-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md, 12px);
  background: var(--paper-50);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.memory-item:focus-within { border-color: var(--moss-700, #5a6b46); box-shadow: 0 0 0 3px rgb(90 107 70 / 10%); }
.memory-item__body { min-width: 0; flex: 1; }
.memory-item__label { display: block; font-size: 12px; color: var(--ink-600, #6b665c); font-weight: 600; letter-spacing: .02em; margin-bottom: 7px; }
.memory-item__input {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  font-size: 14px;
  color: var(--ink-900);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm, 10px);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.memory-item__input:focus { border-color: var(--moss-700, #5a6b46); box-shadow: 0 0 0 3px rgb(90 107 70 / 10%); }
.memory-item__actions { flex: none; display: flex; flex-direction: column; gap: 6px; }
.memory-item__save {
  flex: none;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink-700);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 14px;
  border-radius: var(--radius-sm, 10px);
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}
.memory-item__save:hover { color: var(--ink-950); background: var(--paper-50); border-color: var(--moss-700, #5a6b46); }
.memory-item__delete {
  flex: none;
  border: 0;
  background: none;
  color: var(--danger, #b04a3a);
  font-size: 12.5px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  transition: background 160ms ease;
}
.memory-item__delete:hover { background: rgb(176 74 58 / 9%); }


/* ===================== 文案中心与创作工作台 ===================== */
#copywriting-view,
#copywriting-mode-view {
  flex: 1;
  min-height: 0;
  padding: 28px 20px 40px;
}
#copywriting-view.is-active,
#copywriting-mode-view.is-active { display: flex; }

.cw {
  width: min(100%, var(--workspace-width));
  min-height: calc(100dvh - var(--header-height) - 84px);
  margin: 0 auto;
  overflow: hidden;
  color: var(--color-text);
  background: rgb(255 254 250 / 96%);
  border: 1px solid rgb(128 98 47 / 15%);
  border-radius: 24px;
  box-shadow: var(--shadow-sheet);
}
.cw--center { width: min(100%, var(--reading-width)); padding: 0 28px 40px; overflow-y: auto; }
.cw--mode { display: flex; flex-direction: column; }

.cw-topbar {
  display: grid;
  grid-template-columns: minmax(132px, 1fr) minmax(0, auto) minmax(132px, 1fr);
  align-items: center;
  gap: var(--space-4);
  min-height: 68px;
  padding: 10px 18px;
  background: rgb(255 254 250 / 96%);
  border-bottom: 1px solid var(--paper-100);
}
.cw--center .cw-topbar { margin-inline: -28px; padding-inline: 28px; }
.cw-topbar__left { display: flex; justify-content: flex-start; min-width: 0; }
.cw-topbar__right { display: flex; justify-content: flex-end; min-width: 0; }
.cw-topbar__title {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-width: 0;
  margin: 0;
  color: var(--ink-950);
  font-size: clamp(18px, 2vw, 22px);
  font-weight: 650;
  letter-spacing: -.025em;
  text-align: center;
}
.cw-back,
.cw-profile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--control-height);
  padding: 8px 12px;
  color: var(--ink-700);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  transition: color var(--duration-fast) ease, background var(--duration-fast) ease, border-color var(--duration-fast) ease, transform 100ms var(--ease-out);
}
.cw-back:hover,
.cw-profile:hover { color: var(--ink-950); background: var(--paper-100); border-color: var(--line); }
.cw-back:active,
.cw-profile:active { transform: scale(.98); }
.cw-back svg { width: 18px; height: 18px; }
.cw-profile svg { width: 17px; height: 17px; }
.cw-badge { display: none; }

.cw-center-hero { padding: 48px 12px 30px; text-align: center; }
.cw-center-hero__rule {
  display: block;
  width: 52px;
  height: 3px;
  margin: 0 auto 18px;
  background: linear-gradient(90deg, var(--gold-700), var(--gold-100));
  border-radius: 999px;
}
.cw-center-hero h2 { margin: 0; color: var(--ink-950); font-size: clamp(22px, 3vw, 26px); font-weight: 650; letter-spacing: -.025em; }
.cw-center-hero p { max-width: 560px; margin: 12px auto 0; color: var(--color-text-muted); font-size: 14px; line-height: 1.75; }

.cw-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); }
.cw-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 196px;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  padding: 20px;
  color: var(--color-text);
  text-align: left;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 10px rgb(76 55 22 / 4%);
  transition: border-color var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out);
}
.cw-card:hover { border-color: var(--gold-300); box-shadow: var(--shadow-card); transform: translateY(-2px); }
.cw-card:focus-visible { border-color: var(--gold-700); outline: 3px solid rgb(128 98 47 / 28%); outline-offset: 2px; }
.cw-card:active { transform: translateY(0); }
.cw-card__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--gold-800);
  background: var(--gold-50);
  border: 1px solid var(--gold-100);
  border-radius: var(--radius-md);
}
.cw-card__icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.cw-card__body { display: flex; min-width: 0; flex: 1; flex-direction: column; }
.cw-card__body strong { display: block; margin-bottom: 5px; color: var(--ink-950); font-size: 16px; font-weight: 700; }
.cw-card__body p { margin: 0; color: var(--color-text-muted); font-size: 13px; line-height: 1.6; }
.cw-card__hint { display: block; margin-top: auto; padding-top: 12px; color: var(--gold-700); font-size: 12px; line-height: 1.55; }
.cw-card__go { position: absolute; top: 28px; right: 18px; color: var(--gold-700); font-size: 18px; transition: transform var(--duration-fast) var(--ease-out); }
.cw-card:hover .cw-card__go { transform: translateX(2px); }

.cw-workspace { display: grid; grid-template-columns: 240px minmax(0, 1fr); flex: 1; min-height: 0; }
.cw-sidebar {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  background: var(--paper-50);
  border-right: 1px solid var(--line);
}
.cw-sidebar__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: 16px 14px 12px; }
.cw-sidebar__head strong { color: var(--ink-800); font-size: 14px; font-weight: 700; }
.cw-new {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: var(--control-height);
  padding: 8px 11px;
  color: var(--gold-900);
  background: var(--white);
  border: 1px solid var(--gold-300);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  transition: background var(--duration-fast) ease, border-color var(--duration-fast) ease, transform 100ms var(--ease-out);
}
.cw-new:hover { background: var(--gold-50); border-color: var(--gold-500); }
.cw-new:active { transform: scale(.98); }
.cw-new svg { width: 16px; height: 16px; }
.cw-sidebar__list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 10px 14px; }
.cw-session-item {
  display: block;
  width: 100%;
  min-height: 58px;
  margin-bottom: 4px;
  padding: 10px 12px;
  color: var(--ink-700);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  transition: color var(--duration-fast) ease, background var(--duration-fast) ease, border-color var(--duration-fast) ease;
}
.cw-session-item:hover { color: var(--ink-950); background: var(--white); border-color: var(--line); }
.cw-session-item.is-active { color: var(--ink-950); background: var(--color-selected); border-color: var(--gold-100); box-shadow: inset 3px 0 0 var(--gold-700); }
.cw-session-item__title { display: block; overflow: hidden; font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.cw-session-item__time { display: block; margin-top: 4px; color: var(--color-text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.cw-session-empty { margin: 20px 10px; color: var(--color-text-muted); font-size: 12px; line-height: 1.6; text-align: center; }

.cw-main { display: flex; min-width: 0; min-height: 0; flex-direction: column; background: var(--white); }

.cw-template-picker { padding: 18px 24px 16px; background: var(--paper-50); border-bottom: 1px solid var(--paper-100); }
.cw-template-picker[hidden] { display: none; }
.cw-template-picker__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); margin-bottom: 12px; }
.cw-template-picker__head h2 { margin: 0; color: var(--ink-950); font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.cw-template-picker__head p { margin: 4px 0 0; color: var(--color-text-muted); font-size: 12px; line-height: 1.55; }
.cw-template-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.cw-template-option {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 84px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 5px;
  padding: 14px 42px 14px 15px;
  color: var(--color-text);
  text-align: left;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  transition: border-color var(--duration-fast) ease, background var(--duration-fast) ease, box-shadow var(--duration-fast) ease, transform 100ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .cw-template-option:hover { border-color: var(--gold-300); box-shadow: var(--shadow-card); }
}
.cw-template-option:active { transform: scale(.97); }
.cw-template-option:focus-visible { outline: 3px solid rgb(128 98 47 / 28%); outline-offset: 2px; }
.cw-template-option.is-selected { background: var(--color-selected); border-color: var(--gold-500); box-shadow: inset 0 0 0 1px var(--gold-100); }
.cw-template-option__title { color: var(--ink-950); font-size: 14px; font-weight: 700; line-height: 1.4; }
.cw-template-option__summary { color: var(--color-text-muted); font-size: 12px; line-height: 1.5; }
.cw-template-option__check {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: var(--white);
  background: var(--gold-700);
  border-radius: 50%;
  font-size: 13px;
  font-weight: 800;
  opacity: 0;
  transform: scale(.75);
  transition: opacity var(--duration-fast) ease, transform var(--duration-fast) var(--ease-out);
}
.cw-template-option.is-selected .cw-template-option__check { opacity: 1; transform: scale(1); }
.cw-template-status { min-height: 18px; margin: 9px 0 0; color: var(--color-text-muted); font-size: 12px; line-height: 1.5; }
.cw-template-status:empty { min-height: 0; margin: 0; }
.cw-template-retry { min-height: 44px; margin-top: 8px; padding: 8px 12px; color: var(--gold-900); background: var(--white); border: 1px solid var(--gold-300); border-radius: var(--radius-sm); font-size: 13px; font-weight: 700; }
.copywriting-template-fields { display: grid; gap: 16px; }
.copywriting-template-field { display: grid; gap: 7px; }
.copywriting-template-field label { color: var(--ink-800); font-size: 14px; font-weight: 650; }
.copywriting-template-field input { width: 100%; min-height: var(--control-height); padding: 10px 12px; color: var(--color-text); background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-md); font-size: 16px; line-height: 1.5; }
.copywriting-template-field input:focus { border-color: var(--gold-700); outline: 2px solid var(--gold-700); outline-offset: 1px; }
.copywriting-template-field input[aria-invalid="true"] { border-color: var(--color-danger); outline-color: var(--color-danger); }
.copywriting-template-field__message { min-height: 20px; margin: 0; color: var(--color-danger); font-size: 13px; line-height: 1.5; }
.copywriting-template-field__message:empty { min-height: 0; }
.cw-prompt { padding: 20px 24px 16px; background: var(--white); border-bottom: 1px solid var(--paper-100); }
.cw-prompt__label { display: block; margin-bottom: 8px; color: var(--ink-700); font-size: 13px; font-weight: 650; }
.cw-prompt__row textarea {
  display: block;
  width: 100%;
  min-height: 96px;
  max-height: 220px;
  padding: 12px 14px;
  resize: vertical;
  color: var(--color-text);
  background: var(--cloud-50);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  font-size: 15px;
  line-height: 1.6;
  transition: background var(--duration-fast) ease, border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}
.cw-prompt__row textarea:hover { border-color: var(--gold-300); }
.cw-prompt__row textarea:focus { background: var(--white); border-color: var(--gold-700); outline: 2px solid var(--gold-700); outline-offset: 1px; box-shadow: none; }
.cw-prompt__row textarea:disabled { background: var(--paper-100); }
.cw-prompt__meta { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); margin-top: 10px; }
.cw-prompt__meta .character-count { color: var(--color-text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.cw-generate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: var(--control-height);
  padding: 9px 16px;
  color: var(--white);
  background: var(--color-primary);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 5px 14px rgb(76 55 22 / 15%);
  transition: background var(--duration-fast) ease, border-color var(--duration-fast) ease, transform 100ms var(--ease-out), opacity var(--duration-fast) ease;
}
.cw-generate:hover:not(:disabled) { background: var(--color-primary-hover); border-color: var(--color-primary-hover); }
.cw-generate:active:not(:disabled) { transform: translateY(1px); }
.cw-generate:disabled { opacity: .55; }
.cw-generate svg { width: 17px; height: 17px; }

.cw-result { flex: 1; min-height: 0; overflow-y: auto; padding: 28px 32px 40px; background: linear-gradient(180deg, var(--paper-50), var(--white) 84px); }
.cw-result__empty { display: flex; width: min(100%, 520px); min-height: 300px; margin: 0 auto; flex-direction: column; align-items: center; justify-content: center; color: var(--color-text-muted); text-align: center; }
.cw-result__empty-icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 14px; color: var(--gold-700); background: var(--gold-50); border: 1px solid var(--gold-100); border-radius: 50%; }
.cw-result__empty-icon svg { width: 22px; height: 22px; }
.cw-result__empty p { margin: 0; font-size: 14px; line-height: 1.7; }
.cw-result__body { width: min(100%, 720px); margin: 0 auto; color: var(--color-text); font-size: 16px; line-height: 1.75; }
.cw-result__body > :first-child { margin-top: 0; }
.cw-result__body > :last-child { margin-bottom: 0; }
.cw-result__body h2,
.cw-result__body h3 { margin: 1.35em 0 .55em; color: var(--ink-950); line-height: 1.4; letter-spacing: -.015em; }
.cw-result__body h2 { font-size: 21px; }
.cw-result__body h3 { font-size: 18px; }
.cw-result__body p { margin: 0 0 1em; }
.cw-result__body ul,
.cw-result__body ol { padding-left: 1.5em; }
.cw-result__body li { margin: .35em 0; }
.cw-result__body a { color: var(--gold-700); text-underline-offset: 3px; }
.cw-result__body code { padding: .15em .35em; background: var(--paper-100); border-radius: 4px; font-family: "Cascadia Mono", Consolas, monospace; font-size: .9em; }
.cw-result__body pre { overflow-x: auto; padding: 16px; color: #e9eee9; background: #202723; border-radius: var(--radius-md); }
.cw-result__body .message,
.cw-result__body .message--assistant { position: static; display: block; margin: 0; }

@media (max-width: 900px) and (min-width: 768px) {
  .cw-workspace { grid-template-columns: 220px minmax(0, 1fr); }
  .cw-prompt { padding-inline: 20px; }
  .cw-result { padding-inline: 24px; }
}

@media (max-width: 767px) {
  #copywriting-view,
  #copywriting-mode-view { min-height: 0; padding: 0; }
  .cw { width: 100%; min-height: 0; flex: 1; margin: 0; border: 0; border-radius: 0; box-shadow: none; }
  .cw--center { padding: 0 16px calc(28px + env(safe-area-inset-bottom)); }
  .cw--mode { overflow: visible; }
  .cw-topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 58px;
    gap: 6px;
    padding: 7px 12px;
    background: rgb(255 253 248 / 96%);
  }
  .cw--center .cw-topbar { margin-inline: -16px; padding-inline: 12px; }
  .cw-topbar__title { justify-content: flex-start; padding-inline: 4px; font-size: 17px; text-align: left; }
  .cw-back,
  .cw-profile { min-width: 44px; min-height: 44px; padding: 8px 10px; }

  .cw-center-hero { padding: 32px 8px 24px; }
  .cw-center-hero__rule { margin-bottom: 16px; }
  .cw-center-hero h2 { font-size: 22px; }
  .cw-center-hero p { font-size: 14px; line-height: 1.7; }
  .cw-cards { grid-template-columns: 1fr; gap: 10px; }
  .cw-card { min-height: 0; padding: 16px 54px 16px 16px; flex-direction: row; align-items: flex-start; border-radius: var(--radius-md); }
  .cw-card__body strong { font-size: 16px; }
  .cw-card__body p { font-size: 13px; }
  .cw-card__hint { padding-top: 8px; }
  .cw-card__go { top: 50%; right: 18px; transform: translateY(-50%); }
  .cw-card:hover .cw-card__go { transform: translate(2px, -50%); }

  .cw-workspace { display: flex; min-height: 0; flex-direction: column; }
  .cw-sidebar { flex: none; min-height: 0; background: var(--paper-50); border-right: 0; border-bottom: 1px solid var(--line); }
  .cw-sidebar__head { padding: 12px 12px 8px; }
  .cw-sidebar__head strong { font-size: 13px; }
  .cw-new { min-height: 44px; }
  .cw-sidebar__list {
    display: flex;
    flex: none;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 12px 12px;
    scrollbar-width: thin;
    scroll-snap-type: x proximity;
  }
  .cw-session-item { width: 188px; min-height: 58px; margin: 0; flex: 0 0 auto; background: var(--white); border-color: var(--line); scroll-snap-align: start; }
  .cw-session-item.is-active { box-shadow: inset 0 3px 0 var(--gold-700); }
  .cw-session-empty { width: 100%; margin: 8px 0; }
  .cw-main { flex: none; min-height: 0; }
  .cw-template-picker { padding: 14px; }
  .cw-template-picker__head { margin-bottom: 10px; }
  .cw-template-options { grid-template-columns: 1fr; }
  .cw-template-option { min-height: 76px; padding-block: 12px; }
  .cw-prompt { padding: 16px 14px 14px; }
  .cw-prompt__row textarea { min-height: 112px; max-height: 200px; font-size: 16px; }
  .cw-prompt__meta { gap: 10px; }
  .cw-generate { min-height: var(--mobile-control-height); padding-inline: 18px; }
  .cw-result { min-height: 360px; overflow: visible; padding: 24px 16px calc(36px + env(safe-area-inset-bottom)); }
  .cw-result__empty { min-height: 280px; }
  .cw-result__body { font-size: 15px; line-height: 1.72; }
}

@media (max-width: 430px) {
  .cw-profile span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .cw-profile { width: 44px; padding: 0; border-radius: 50%; }
  .cw-back { padding-inline: 8px; }
  .cw-topbar__title { font-size: 16px; }
  .cw-card__icon { width: 40px; height: 40px; }
  .cw-card { padding-left: 14px; }
  .cw-prompt__meta .character-count { font-size: 11px; }
}


/* ============================================================
   登录层（益康智能体蓝白科技风）
   ============================================================ */
.login-view {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(124, 92, 242, 0.16), transparent 60%),
    radial-gradient(900px 500px at 10% 110%, rgba(59, 130, 246, 0.14), transparent 55%),
    linear-gradient(180deg, #0f1c34 0%, #16233d 60%, #1a2c4e 100%);
}
.login-view.is-active { display: flex; }

.login-shell {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 20px;
}

.login-hero { text-align: center; color: #fff; }
.login-hero__logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #fff;
  background: linear-gradient(135deg, #3b82f6 0%, #4f8bf7 55%, #7c5cf2 100%);
  box-shadow: 0 10px 30px rgba(59, 130, 246, 0.45);
  margin-bottom: 14px;
}
.login-hero__title { font-size: 22px; font-weight: 700; margin: 0 0 6px; letter-spacing: .5px; }
.login-hero__sub { font-size: 13px; color: rgba(255, 255, 255, 0.72); margin: 0; }

.login-card {
  background: #ffffff;
  border-radius: var(--r-lg);
  padding: 28px 26px 22px;
  box-shadow: 0 24px 70px rgba(10, 20, 40, 0.35);
  display: flex;
  flex-direction: column;
}
.login-card__head h2 { margin: 0 0 6px; font-size: 19px; font-weight: 700; color: var(--text-strong); }
.login-card__head p { margin: 0 0 18px; font-size: 13px; color: var(--text-sub); line-height: 1.5; }

.login-card .field-label {
  display: block;
  font-size: 13px;
  color: var(--text-sub);
  margin: 0 0 6px;
}
.login-input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  margin-bottom: 16px;
  font-size: 15px;
  color: var(--text-main);
  background: var(--bg-soft);
  border: 1px solid var(--chat-border);
  border-radius: var(--r-sm);
  outline: none;
  transition: border-color .16s, box-shadow .16s;
}
.login-input:focus {
  border-color: var(--brand-400);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}
.login-error {
  display: none;
  font-size: 13px;
  color: var(--danger-700);
  margin: -6px 0 12px;
  line-height: 1.4;
}
.login-error.is-visible { display: block; }
.login-submit {
  width: 100%;
  height: 48px;
  margin-top: 4px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #2b8cff 0%, #4fa5ff 55%, #7c5cf2 100%);
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  box-shadow: var(--glow-brand);
  transition: transform .12s, box-shadow .16s, opacity .16s;
}
.login-submit:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(59, 130, 246, 0.34); }
.login-submit:active { transform: translateY(0); }
.login-submit:disabled { opacity: 0.55; cursor: not-allowed; }
.login-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  text-align: center;
  font-size: 12px;
  color: var(--text-weak);
  margin: 16px 0 0;
  width: 100%;
}
.login-status__dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.16);
}
.login-status.is-idle { color: var(--text-sub); }
.login-status.is-idle .login-status__dot {
  background: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16);
  animation: login-status-pulse 1.4s ease-in-out infinite;
}
.login-status.is-online { color: #15803d; }
.login-status.is-online .login-status__dot {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.16);
}
.login-status.is-offline { color: #b45309; }
.login-status.is-offline .login-status__dot {
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.16);
}
@keyframes login-status-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.82); }
}

/* 输入框左侧图标 */
.login-field {
  position: relative;
  margin-bottom: 16px;
}
.login-field .login-input {
  margin-bottom: 0;
  padding-left: 44px;
}
.login-field__icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9aa7c2;
  pointer-events: none;
}
.login-field:focus-within .login-field__icon { color: var(--brand-500); }

.login-footer {
  text-align: center;
  font-size: 11px;
  letter-spacing: .5px;
  color: rgba(255, 255, 255, 0.5);
}
