/* ═══════════════════════════════════════════════════════════════════════
   Mobinono · 手机陪伴版用户 Web（/m）
   2026-11-10 新建：与电脑客户端 CHAT_MODE 对齐（对话/记忆/角色/设备/我的）。
   设计：移动优先、白色/浅灰底 + 品牌紫主色；支持安全区；390px 宽可用。
   约束：CSP style-src 'self'，因此本文件外置、不使用内联样式属性。
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  color-scheme: light;
  --bg: #f5f6f7;
  --surface: #ffffff;
  --line: #e8eaed;
  --line-strong: #dfe3e8;
  --text: #1d2129;
  --text-soft: #4e5969;
  --muted: #86909c;
  --primary: #AA94E1;
  --primary-dark: #8065C7;
  --primary-soft: #F3EFFC;
  --danger: #e5484d;
  --danger-soft: #fff6f6;
  --warn-bg: #fff8e8;
  --warn-line: #ffe3ae;
  --warn-text: #8a5a00;
  --radius: 16px;
  --tabbar-h: 58px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: pan-x pan-y;
}

html {
  -webkit-text-size-adjust: 100%;
  background: #ffffff;
}

body {
  background: #ffffff;
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

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

button {
  cursor: pointer;
  border: none;
  background: none;
}

input,
textarea,
select {
  min-width: 0;
}

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

h1, h2, h3, h4, p {
  margin: 0;
}

.hidden {
  display: none !important;
}

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

/* ══════════ 启动遮罩 ══════════ */
.boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--surface);
}

.boot-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  margin-bottom: 2px;
}

.boot-name {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.boot-tip {
  color: var(--muted);
  font-size: 13px;
}

.spinner {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2.5px solid var(--line);
  border-top-color: var(--primary);
  animation: spin 0.75s linear infinite;
}

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

@keyframes blink {
  0%, 55% { opacity: 1; }
  56%, 100% { opacity: 0; }
}

@keyframes slideUp {
  from { transform: translateY(18px); }
  to { transform: translateY(0); }
}

/* ══════════ 登录 / 注册 ══════════ */
.auth-view {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(env(safe-area-inset-top) + 26px) 18px calc(env(safe-area-inset-bottom) + 26px);
  background:
    radial-gradient(1200px 480px at 50% -180px, #F1ECFB 0%, rgba(241, 236, 251, 0) 60%),
    linear-gradient(180deg, #f7f9fa 0%, #f1f3f5 100%);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 28px 22px 20px;
  box-shadow: 0 18px 50px rgba(18, 30, 48, 0.08);
}

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  background: #f2f3f5;
  border-radius: 12px;
  padding: 4px;
  margin: 22px 0 18px;
}

.auth-tab {
  flex: 1;
  padding: 9px 0;
  border-radius: 9px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-soft);
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.auth-tab.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(18, 30, 48, 0.1);
}

.auth-form {
  display: block;
}

.code-row {
  display: flex;
  gap: 8px;
}

.code-row input {
  flex: 1;
}

.code-btn {
  flex: 0 0 auto;
  padding: 0 14px;
  font-size: 13.5px;
  white-space: nowrap;
}

/* ══════════ 表单通用 ══════════ */
.field {
  display: block;
  margin-bottom: 13px;
}

.field > span {
  display: block;
  margin-bottom: 6px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
}

.field input,
.field textarea,
.field select,
.bind-row input,
.search-row input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f7f8fa;
  padding: 11px 12px;
  font-size: 16px;
  line-height: 1.4;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.field textarea {
  min-height: 108px;
  resize: vertical;
  line-height: 1.55;
}

.modal .field select {
  width: 100%;
  min-height: 52px;
  padding: 13px 14px;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.bind-row input:focus,
.search-row input:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(170, 148, 225, 0.22);
}

.field input::placeholder,
.field textarea::placeholder,
.bind-row input::placeholder {
  color: #a9afb8;
}

.form-error {
  color: var(--danger);
  font-size: 13px;
  line-height: 1.5;
  margin-top: 8px;
  min-height: 18px;
}

.form-error.small {
  font-size: 12.5px;
  min-height: 16px;
  margin-top: 6px;
}

.hint {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
  margin-top: 8px;
}

.footnote {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  margin: 16px 4px 8px;
}

/* ══════════ 按钮 ══════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 12px;
  background: #f2f3f5;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  padding: 12px 18px;
  transition: opacity 0.15s, transform 0.06s;
}

.btn:active {
  transform: scale(0.99);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

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

.btn-danger {
  background: var(--surface);
  border: 1px solid #ffd5d6;
  color: var(--danger);
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-small {
  padding: 7px 12px;
  font-size: 13px;
  border-radius: 10px;
}

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

.btn.loading {
  position: relative;
  color: transparent !important;
}

.btn.loading::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}

.btn-ghost.loading::after,
.btn-danger.loading::after {
  border-color: rgba(31, 35, 41, 0.18);
  border-top-color: var(--text-soft);
}

.btn-mini {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-soft);
  border-radius: 9px;
  padding: 5px 11px;
  font-size: 13px;
  font-weight: 500;
}

.btn-mini:active {
  background: #f2f3f5;
}

.btn-mini.danger {
  color: var(--danger);
  border-color: #ffd5d6;
  background: var(--danger-soft);
}

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

/* ══════════ 主框架 ══════════ */
.app-view {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  background: var(--bg);
  box-shadow: 0 0 44px rgba(18, 30, 48, 0.08);
}

.topbar {
  flex: none;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar > .icon-btn {
  justify-self: start;
}

.topbar #new-chat-btn {
  justify-self: end;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.2px;
  justify-self: center;
}

.brand img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.pages {
  flex: 1;
  min-height: 0;
  position: relative;
}

.page {
  display: none;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px 28px;
}

.page.active {
  display: block;
}

/* 对话页：固定输入框，仅消息区滚动 */
.page-chat.active {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

/* ══════════ 对话页 ══════════ */
.icon-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: var(--text);
}

.icon-btn:active {
  background: #f2f3f5;
}

.banner {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 12px 0;
  padding: 10px 12px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  border-radius: 12px;
}

.banner-text {
  flex: 1;
  font-size: 13px;
  line-height: 1.45;
  color: var(--warn-text);
}

.chat-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 14px 10px;
}

.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  height: 100%;
  padding: clamp(54px, 12vh, 100px) 16px 24px;
  gap: 0;
}

.suggest-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  max-width: 440px;
}

.suggest {
  min-width: 0;
  min-height: 44px;
  padding: 8px 6px;
  border: 1px solid #e9e1f6;
  background: var(--surface);
  color: var(--primary-dark);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 5px 14px rgba(170, 148, 225, 0.14), 0 1px 2px rgba(59, 47, 83, 0.05);
  transition: background 0.14s, border-color 0.14s, box-shadow 0.14s;
}

.suggest:active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-dark);
  box-shadow: 0 2px 7px rgba(170, 148, 225, 0.16);
}

.chat-home-ip {
  flex: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  margin: 0;
  padding: 0;
  line-height: 0;
  pointer-events: none;
  position: relative;
  z-index: 1;
}

.chat-home-ip img {
  display: block;
  width: min(72vw, 360px);
  height: auto;
  margin: 0 0 -12px;
  object-fit: contain;
  object-position: center bottom;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding-bottom: 6px;
}

/* 系统旁白（已停止生成 / 生成中断）在消息列中居中 */
.chat-messages > .msg-note {
  align-self: center;
  margin-top: 0;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(134, 144, 156, 0.12);
}

.chat-messages > .msg-note.err {
  background: rgba(229, 72, 77, 0.1);
}

.chat-messages > .list-empty {
  width: 100%;
}

.time-sep {
  align-self: center;
  color: var(--muted);
  font-size: 11.5px;
  padding: 2px 0;
}

.msg-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 100%;
}

.msg-row.user {
  align-items: flex-end;
}

.bubble {
  max-width: 82%;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.58;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.msg-row.user .bubble {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 6px;
}

.msg-row.assistant .bubble {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-bottom-left-radius: 6px;
}

.bubble.streaming::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 14px;
  margin-left: 3px;
  border-radius: 2px;
  background: var(--primary);
  vertical-align: -2px;
  animation: blink 1s steps(1) infinite;
}

.msg-note {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11.5px;
  padding: 0 2px;
}

.msg-note.err {
  color: var(--danger);
}

.msg-note .link-btn {
  color: var(--primary-dark);
  font-size: 11.5px;
  text-decoration: underline;
  padding: 0;
}

.composer {
  flex: none;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 9px 12px;
}

.composer-error {
  margin-bottom: 8px;
  padding: 8px 11px;
  border-radius: 10px;
  background: var(--danger-soft);
  border: 1px solid #ffd5d6;
  color: var(--danger);
  font-size: 12.5px;
  line-height: 1.5;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.composer-error .link-btn {
  color: var(--danger);
  text-decoration: underline;
  font-weight: 600;
  padding: 0;
}

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

#chat-input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #f7f8fa;
  padding: 10px 14px;
  max-height: 120px;
  min-height: 42px;
  font-size: 16px;
  line-height: 1.4;
  resize: none;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

#chat-input:focus {
  border-color: var(--primary);
  background: var(--surface);
}

#chat-input::placeholder {
  color: #a9afb8;
}

.send-btn {
  flex: none;
  min-width: 66px;
  height: 42px;
  padding: 0 16px;
  border-radius: 21px;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  transition: background 0.15s, opacity 0.15s;
}

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

.send-btn.stop {
  background: var(--danger);
}

/* ══════════ 页面通用 ══════════ */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.page-head h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.page-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.page-head > .icon-btn {
  margin: -4px 0 0 -6px;
}

.page-head > div {
  flex: 1;
  min-width: 0;
}

.search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  margin-bottom: 12px;
  color: var(--muted);
}

.search-row input {
  border: none;
  background: transparent;
  padding: 11px 0;
  font-size: 15px;
}

.search-row input:focus {
  box-shadow: none;
  background: transparent;
}

.seg-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 14px;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.seg-tabs::-webkit-scrollbar {
  display: none;
}

.seg {
  flex: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-soft);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 13.5px;
  white-space: nowrap;
}

.seg.active {
  background: var(--primary-soft);
  border-color: rgba(170, 148, 225, 0.55);
  color: var(--primary-dark);
  font-weight: 600;
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list-title {
  margin: 18px 2px 10px;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 600;
}

.list-empty {
  padding: 24px 14px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px;
  margin-bottom: 12px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 10px;
}

.item-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
}

.item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.item-title {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.42;
  word-break: break-word;
}

.item-body {
  margin-top: 6px;
  color: var(--text-soft);
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

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

.tag {
  display: inline-block;
  flex: none;
  padding: 1px 7px;
  border-radius: 999px;
  background: #f2f3f5;
  color: #6b7280;
  font-size: 11.5px;
  font-weight: 500;
}

.tag-builtin {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.tag-active {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.tag-pending {
  background: #fff4e0;
  color: #b26a00;
}

.tag-revoked {
  background: #f2f3f5;
  color: var(--muted);
}

.tag-current {
  background: #eaf3ff;
  color: #2c6fd1;
}

.bind-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bind-row input {
  flex: 1;
}

.bind-row .btn {
  flex: none;
  padding: 11px 16px;
  font-size: 14px;
}

.bind-row > .hint {
  flex: 1;
  margin-top: 0;
  font-size: 12px;
}

.row-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px;
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 15px;
  font-weight: 500;
  text-align: left;
}

.row-btn:active {
  background: #fafbfc;
}

.row-btn .row-btn-note {
  margin-left: auto;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 400;
}

.row-btn .row-btn-arrow {
  color: #b8bcc4;
  font-size: 19px;
  line-height: 1;
  margin-left: 2px;
}

.status-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text-soft);
  font-size: 13.5px;
}


/* 会员卡 */
.membership {
  background: linear-gradient(135deg, #e9f9f0 0%, #f7fffb 100%);
  border-color: #d6f0e0;
}

.membership-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.membership-state {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-dark);
}

.membership-state.off {
  color: var(--muted);
}

.membership-days {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.membership-days:empty {
  display: none;
}

.membership-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 9px;
  color: #3f6b54;
  font-size: 13px;
}

.membership-row b {
  color: #1d4634;
  font-weight: 600;
}

/* 接入码 / 提示词展示 */
.sub-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.sub-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: #f7f8fa;
  border-radius: 10px;
  font-size: 13.5px;
}

.sub-row-main {
  flex: 1;
  min-width: 0;
}

.sub-row-title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sub-row-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.key-box,
.prompt-box {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7f8fa;
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
  word-break: break-all;
  overflow-wrap: anywhere;
}

.key-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  user-select: all;
  margin-bottom: 10px;
}

.prompt-box {
  white-space: pre-wrap;
  max-height: 200px;
  overflow-y: auto;
}


/* ══════════ 底部标签栏 ══════════ */
.tabbar {
  flex: none;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 5px 4px calc(5px + env(safe-area-inset-bottom));
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 3px 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.2;
}

.tab span {
  font-size: 11.5px;
}

.tab.active {
  color: var(--primary-dark);
  font-weight: 600;
}

.tab:active {
  opacity: 0.7;
}

/* ══════════ 抽屉（对话历史）══════════ */
.mask {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(17, 24, 34, 0.35);
}

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 51;
  width: min(84vw, 340px);
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: calc(env(safe-area-inset-top) + 14px) 14px calc(14px + env(safe-area-inset-bottom));
  background: var(--surface);
  box-shadow: 8px 0 30px rgba(18, 30, 48, 0.16);
  transform: translateX(-102%);
  transition: transform 0.22s ease;
  visibility: hidden;
}

.drawer.open {
  transform: translateX(0);
  visibility: visible;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
  font-size: 17px;
  font-weight: 700;
}

.history-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin: 2px -4px 0;
  padding: 0 4px;
}

.history-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 6px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.history-row:active {
  background: #f7f8fa;
}

.history-row.sel {
  background: var(--primary-soft);
  border-radius: 10px;
}

.history-row-main {
  flex: 1;
  min-width: 0;
}

.history-row-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14.5px;
}

.history-row-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.history-del {
  flex: none;
  padding: 4px 8px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  border-radius: 8px;
}

.history-del:active {
  background: #eef0f2;
  color: var(--danger);
}

/* ══════════ 弹窗 ══════════ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(17, 24, 34, 0.42);
}

.modal-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  max-height: 90dvh;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  animation: slideUp 0.2s ease;
}

.modal-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 16px;
  margin-bottom: 4px;
}

.modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 0 4px;
}

.modal-actions {
  flex: none;
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

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

.modal-actions .btn.previewing:disabled {
  opacity: 1;
  color: #9aa1aa;
  background: #eef0f3;
  border-color: #e5e7eb;
  cursor: wait;
}

.modal-text {
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.modal-label {
  display: block;
  margin: 12px 0 6px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
}

.modal-label:first-child {
  margin-top: 0;
}

/* ══════════ Toast ══════════ */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(78px + env(safe-area-inset-bottom));
  z-index: 70;
  max-width: calc(100vw - 44px);
  transform: translateX(-50%);
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(29, 33, 41, 0.93);
  color: #fff;
  font-size: 13.5px;
  line-height: 1.5;
  text-align: center;
  box-shadow: 0 8px 24px rgba(18, 30, 48, 0.22);
  word-break: break-word;
}

/* ══════════ 桌面预览（>=640px 也保持手机形态居中）══════════ */
@media (min-width: 640px) {
  body {
    padding: 22px 0;
  }

  .app-view {
    height: calc(100vh - 44px);
    height: calc(100dvh - 44px);
    border-radius: 26px;
    overflow: hidden;
    border: 1px solid var(--line);
  }

  .auth-view {
    padding: 30px;
  }

  .modal {
    align-items: center;
    padding: 24px;
  }

  .modal-card {
    border-radius: 20px;
    max-height: 84dvh;
    padding-bottom: 16px;
  }
}

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

/* ══════════ 手机设备管理（2026-11-10 恢复：检测/隧道/编辑/添加向导）══════════ */
.tag-warn {
  background: #fff4e0;
  color: #b26a00;
}

.item-title .tag {
  margin-left: 6px;
  vertical-align: 1px;
}

.wizard-modal,
.tunnel-modal,
.device-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wizard-hint {
  white-space: pre-line;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: #f7f8fa;
  border-radius: 12px;
  padding: 12px;
}

.wizard-cands {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wizard-pick-title {
  color: var(--muted);
  font-size: 12.5px;
}

.item-actions .hint {
  margin: 0;
  align-self: center;
}

#pc-status-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#pc-switch-row {
  flex-wrap: wrap;
  margin-top: 8px;
}

#pc-switch-row .btn-mini.active {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: var(--primary-soft);
}

/* ══════════ 2026-11-10 反馈修复：角色两行截断 / 已选择按钮 / 设备间距 ══════════ */
.item-body.role-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
  line-height: 1.55;
}

.btn-mini.chosen,
.btn-mini.chosen:disabled {
  opacity: 1;
  color: var(--primary-dark);
  background: var(--primary-soft);
  border-color: rgba(170, 148, 225, 0.55);
  font-weight: 600;
}

#phone-device-list .item-actions {
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

#page-devices .card > .item-actions {
  gap: 10px;
  margin: 10px 0 14px;
}

#page-devices .item-actions .btn-mini {
  min-height: 34px;
  padding: 0 14px;
}

#relay-hint {
  margin: 12px 0 4px;
  line-height: 1.65;
}

#phone-device-list {
  margin-top: 12px;
}

#wearable-list .wearable-actions {
  justify-content: flex-start;
}

#pc-devices-card {
  margin-top: 24px;
}

/* ══════════ 2026-11-10 反馈：模型 API 表单（提供商/模型选择）══════════ */
.model-mode-row {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin: 2px 0 8px;
}

.model-mode-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  color: var(--text-soft);
}

.model-mode-item input[type="radio"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}

.model-picker-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 52vh;
  overflow-y: auto;
}

.model-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: 10px;
  font-size: 14px;
  color: var(--text);
}

.model-picker-row:active {
  background: #f2f3f5;
}

.model-picker-row input[type="radio"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}

/* 手机动作进行中的本地占位气泡（服务端旁白轮询到后会被替换） */
.typing-bubble {
  color: var(--muted);
  font-size: 13.5px;
}


/* ═══════════════ 记忆管理面板（2026-11-11 改版） ═══════════════ */
.mem-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 0 14px;
}
.mem-hero-text h2 {
  margin: 2px 0 2px;
  font-size: 26px;
  letter-spacing: -0.02em;
}
.mem-hero-text p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}
.mem-eyebrow {
  color: var(--primary-dark);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
}
.mem-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.mem-stat {
  min-height: 68px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 10px 9px;
  min-width: 0;
}
.mem-stat .n {
  font-size: 22px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.mem-stat .l {
  color: var(--muted);
  font-size: 11px;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mem-stat.primary .n { color: var(--primary-dark); }
.mem-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.mem-search { flex: 1; min-width: 0; margin: 0; height: 42px; }
.mem-search input { padding: 0; height: 100%; border: 0; background: transparent; }
.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-soft);
  font-size: 18px;
  cursor: pointer;
}
.icon-btn:active { background: var(--primary-soft); }
.mem-tabs { margin-bottom: 8px; }
.mem-filter-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 12px;
}
.mem-select {
  min-width: 0;
  flex: 1;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 12px;
  padding: 0 8px;
}
.mem-view-toggle {
  display: flex;
  height: 42px;
  align-items: center;
  background: #e9ecef;
  border-radius: 10px;
  padding: 3px;
  flex: 0 0 auto;
}
.mem-view-toggle button {
  border: 0;
  height: 36px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  padding: 0 9px;
  border-radius: 8px;
  cursor: pointer;
}
.mem-view-toggle button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.mem-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.mem-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 13px 14px;
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease;
}
.mem-card:active { transform: scale(.995); border-color: var(--primary); }
.mem-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.mem-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  white-space: nowrap;
}
.mem-badge.personal { background: #edf3ff; color: #2f62d8; }
.mem-badge.emotion { background: #fff1f6; color: #b9416f; }
.mem-badge.finance { background: #fff8e9; color: #a86a12; }
.mem-badge.work { background: #f4f0ff; color: #6d4aff; }
.mem-date { color: var(--muted); font-size: 11px; white-space: nowrap; }
.mem-card h3 {
  margin: 0 0 4px;
  font-size: 15px;
  line-height: 1.35;
  font-weight: 700;
  word-break: break-word;
}
.mem-card p {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.mem-card-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 11px;
  flex-wrap: wrap;
}
.mem-tag {
  background: #f3f4f6;
  color: var(--text-soft);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 10px;
}
.mem-timeline { display: flex; flex-direction: column; gap: 0; }
.mem-month {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  margin: 10px 2px 8px;
}
.mem-timeline-row {
  display: flex;
  gap: 10px;
  padding: 0 0 12px;
}
.mem-dot-col { width: 12px; display: flex; flex-direction: column; align-items: center; }
.mem-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 7px; flex: 0 0 auto; }
.mem-line { width: 1px; flex: 1; background: var(--line); }
.mem-timeline .mem-card { flex: 1; }
.mem-empty {
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  padding: 28px 18px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.mem-detail-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.mem-detail-content {
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  font-size: 14px;
  line-height: 1.7;
}
.mem-detail-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
  margin-top: 10px;
}
.mem-detail-actions { display: flex; gap: 10px; margin-top: 18px; }
.mem-detail-actions button { flex: 0 0 calc(50% - 5px); width: calc(50% - 5px); min-height: 46px; font-size: 14px; }
.mem-detail-actions .btn { flex: 1; }
@media (min-width: 560px) {
  .mem-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


/* ═══════════════ 目标与任务（独立功能，2026-11-11） ═══════════════ */
.plans-mobile-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 2px 0 14px; }
.plans-mobile-hero h2 { margin: 2px 0 2px; font-size: 26px; letter-spacing: -.02em; }
.plans-mobile-hero p { margin: 0; color: var(--muted); font-size: 12px; }
.plans-mobile-eyebrow { color: #7c5cff; font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.plans-mobile-stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; margin-bottom: 12px; }
.plans-mobile-stat { min-height: 68px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 9px; min-width: 0; }
.plans-mobile-stat .n { font-size: 21px; line-height: 1.1; font-weight: 800; letter-spacing: -.03em; }
.plans-mobile-stat .l { color: var(--muted); font-size: 10.5px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plans-mobile-stat.primary { background: linear-gradient(135deg,#f5f2ff,#fff); border-color: #ddd5ff; }
.plans-mobile-stat.primary .n { color: #6d4aff; }
.plans-mobile-stat.overdue { background: #fff7f7; border-color: #ffd9d9; }
.plans-mobile-stat.overdue .n { color: #d94848; }
.plans-mobile-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.plans-mobile-search { flex: 1; min-width: 0; margin: 0; height: 42px; }
.plans-mobile-search input { padding: 0; height: 100%; border: 0; background: transparent; }
.plans-mobile-filter-row { display: flex; align-items: center; gap: 6px; margin: 0 0 12px; }
.plans-mobile-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.plan-mobile-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 15px; padding: 13px 14px 12px; cursor: pointer; overflow: hidden; }
.plan-mobile-card::before { content:""; position:absolute; left:0; top:0; bottom:0; width:3px; background:#b8a8ff; border-radius:15px 0 0 15px; }
.plan-mobile-card.status-active::before { background:#2f62d8; }
.plan-mobile-card.status-completed::before { background:#178a52; }
.plan-mobile-card.status-dropped::before { background:#c3c7ce; }
.plan-mobile-top { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:7px; }
.plan-mobile-kind { font-size:10px; font-weight:700; color:#6d4aff; background:#f1edff; padding:3px 8px; border-radius:999px; }
.plan-mobile-status { font-size:10px; font-weight:700; padding:3px 8px; border-radius:999px; white-space:nowrap; }
.plan-mobile-status.active { color:#2f62d8; background:#edf3ff; }
.plan-mobile-status.completed { color:#178a52; background:#eefaf3; }
.plan-mobile-status.dropped { color:#7b8490; background:#f1f2f4; }
.plan-mobile-status.unfinished { color:#b04444; background:#fff0f0; }
.plan-mobile-card h3 { margin:0 0 4px; font-size:15px; line-height:1.4; font-weight:700; word-break:break-word; }
.plan-mobile-desc { margin:0; color:var(--text-soft); font-size:13px; line-height:1.5; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; word-break:break-word; }
.plan-mobile-progress { margin-top:9px; }
.plan-mobile-progress-head { display:flex; justify-content:space-between; color:var(--muted); font-size:10.5px; margin-bottom:4px; }
.plan-mobile-bar { height:5px; border-radius:999px; background:#f0f1f3; overflow:hidden; }
.plan-mobile-bar span { display:block; height:100%; border-radius:999px; background:linear-gradient(90deg,#8b6dff,#6d4aff); }
.plan-mobile-foot { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-top:9px; color:var(--muted); font-size:11px; }
.plan-mobile-due.overdue { color:var(--danger); font-weight:600; }
.plan-mobile-domain { background:#f4f5f7; border-radius:6px; padding:2px 6px; font-size:10px; }
.plans-mobile-board { display:flex; gap:8px; overflow-x:auto; padding-bottom:4px; }
.plans-mobile-col { flex:0 0 78%; background:#f7f8fa; border-radius:14px; padding:9px; }
.plans-mobile-col-head { display:flex; justify-content:space-between; font-size:12px; font-weight:700; color:var(--text-soft); padding:1px 2px 8px; }
.plan-mobile-time-label { color:var(--muted); font-size:11px; font-weight:700; margin:8px 2px; }
.plan-mobile-none { background:var(--surface); border:1px dashed var(--line-strong); border-radius:16px; padding:28px 18px; text-align:center; color:var(--muted); font-size:13px; }

/* 详情弹窗复用桌面 plan-* 类时的手机样式 */
.plan-chip-row { display:flex; gap:6px; flex-wrap:wrap; margin-bottom:8px; }
.plan-kind-badge { font-size:10px; font-weight:700; color:#6d4aff; background:#f1edff; padding:3px 8px; border-radius:999px; }
.plan-domain { font-size:10px; color:#7b8490; background:#f4f5f7; padding:3px 7px; border-radius:6px; }
.plan-status { font-size:10px; font-weight:700; padding:3px 8px; border-radius:999px; white-space:nowrap; }
.plan-status.active { color:#2f62d8; background:#edf3ff; }
.plan-status.completed { color:#178a52; background:#e8f7ef; }
.plan-status.dropped { color:#7b8490; background:#f1f2f4; }
.plan-progress { margin-top:10px; }
.plan-progress-head { display:flex; justify-content:space-between; color:var(--muted); font-size:10.5px; margin-bottom:4px; }
.plan-progress-bar { height:5px; border-radius:999px; background:#f0f1f3; overflow:hidden; }
.plan-progress-bar span { display:block; height:100%; border-radius:999px; background:linear-gradient(90deg,#8b6dff,#6d4aff); }
.sub { color:var(--muted); font-size:12px; margin:2px 0 8px; }


/* 周期任务 occurrence 历史 */
.plan-occ-box { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.plan-occ-head { display: flex; align-items: center; justify-content: space-between; color: var(--text-soft); font-size: 12px; font-weight: 700; margin-bottom: 8px; }
.plan-occ-head span { color: var(--muted); font-weight: 600; }
.plan-occ-empty { color: var(--muted); font-size: 12px; padding: 6px 0; }
.plan-occ-list { display: flex; flex-direction: column; gap: 6px; }
.plan-occ-row { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-soft); min-height: 24px; }
.plan-occ-status { flex: none; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px; }
.plan-occ-status.done { color: #178a52; background: #e8f7ef; }
.plan-occ-status.unfinished { color: #b04444; background: #fff0f0; }
.plan-occ-status.missed { color: #b04444; background: #fff0f0; }
.plan-occ-status.skipped { color: #7b8490; background: #f1f2f4; }
.plan-occ-date { flex: none; color: var(--muted); }
.plan-occ-note { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 完成情况文字 & 表单提示 */
.plan-mobile-completion { margin-top:8px; color:var(--text-soft); font-size:12px; line-height:1.5; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.plan-completion-box { margin-top:14px; padding-top:12px; border-top:1px solid var(--line); }
.plan-completion-box > span { display:block; color:var(--muted); font-size:11px; font-weight:600; margin-bottom:4px; }
.plan-hint { color:var(--muted); font-size:11px; line-height:1.5; margin:-2px 0 10px; }
#modal-actions .btn { flex: 0 0 calc(50% - 5px); width: calc(50% - 5px); min-height: 42px; }
#modal-actions .btn:only-child { flex-basis: 100%; width: 100%; }

/* 统计/内容卡片统一配色与对齐 */
.mem-stat.tone-green, .plans-mobile-stat.tone-green { background:#eefaf3; border-color:#ccebd8; }
.mem-stat.tone-green .n, .plans-mobile-stat.tone-green .n { color:#178a52; }
.mem-stat.tone-blue, .plans-mobile-stat.tone-blue { background:#edf3ff; border-color:#cfdcff; }
.mem-stat.tone-blue .n, .plans-mobile-stat.tone-blue .n { color:#2f62d8; }
.mem-stat.tone-pink { background:#fff1f6; border-color:#f7cfdf; }
.mem-stat.tone-pink .n { color:#b9416f; }
.mem-stat.tone-purple { background:#f4f0ff; border-color:#ddd2ff; }
.mem-stat.tone-purple .n { color:#6d4aff; }
.plans-mobile-stat.tone-amber { background:#fffaf0; border-color:#f0d8a8; }
.plans-mobile-stat.tone-amber .n { color:#9a6700; }
.plans-mobile-stat.tone-gray { background:#f7f8fa; border-color:#e2e5e9; }
.plans-mobile-stat.tone-gray .n { color:#6b7280; }

.mem-card { display:flex; flex-direction:column; }
.mem-card.cat-personal { box-shadow: inset 3px 0 0 #2f62d8; background:linear-gradient(100deg,#f5f8ff,#fff 55%); }
.mem-card.cat-emotion { box-shadow: inset 3px 0 0 #b9416f; background:linear-gradient(100deg,#fff7fa,#fff 55%); }
.mem-card.cat-finance { box-shadow: inset 3px 0 0 #a86a12; background:linear-gradient(100deg,#fffbf3,#fff 55%); }
.mem-card.cat-work { box-shadow: inset 3px 0 0 #6d4aff; background:linear-gradient(100deg,#faf8ff,#fff 55%); }
.mem-card.cat-other { box-shadow: inset 3px 0 0 #178a52; }
.mem-card-foot { margin-top:auto; padding-top:9px; }

.plan-mobile-card { display:flex; flex-direction:column; }
.plan-mobile-card.status-active { background:linear-gradient(135deg,#f5f8ff,#fff 65%); }
.plan-mobile-card.status-completed { background:linear-gradient(135deg,#f5fcf8,#fff 65%); }
.plan-mobile-card.status-unfinished { background:linear-gradient(135deg,#fff5f5,#fff 65%); }
.plan-mobile-card.status-dropped { background:linear-gradient(135deg,#f8f9fa,#fff 65%); }
.plan-mobile-card.status-unfinished::before { background:#b04444; }
.plan-mobile-card.status-unrecorded { background:linear-gradient(135deg,#fffaf0,#fff 65%); }
.plan-mobile-card.status-unrecorded::before { background:#b7791f; }
.plan-mobile-status.unrecorded,
.plan-status.unrecorded,
.plan-mobile-kind.status-unrecorded,
.plan-kind-badge.status-unrecorded { color:#9a6700; background:#fff4d6; }
.plan-occ-status.unrecorded { color:#9a6700; background:#fff4d6; }
.plan-unrecorded-card { cursor:pointer; }
.plan-mobile-foot { margin-top:auto; padding-top:9px; }
#plans-mobile-tabs { flex-wrap: wrap; overflow-x: visible; row-gap: 8px; }

/* 角色页：固定三个内置形象，双列单选卡片。 */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.role-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 14px;
}
.role-card {
  min-width: 0;
  min-height: 210px;
  padding: 20px 12px 18px;
  border: 0;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(31, 35, 41, 0.045);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}
.role-card-portrait {
  width: 68%;
  max-width: 128px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}
.role-card-portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
}
.role-card-name {
  max-width: 100%;
  margin: 10px 0 13px;
  color: #15171a;
  font-size: clamp(17px, 5.2vw, 21px);
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.role-card .role-card-action {
  width: 74px;
  min-height: 36px;
  margin-top: auto;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  line-height: 36px;
  box-shadow: none;
}
.role-card .role-card-action:hover,
.role-card .role-card-action:active {
  background: var(--primary-dark);
}
.role-card .role-card-action:disabled {
  opacity: 0.7;
}
/* 2026-11-11 用户反馈：编辑弹窗能被左右拖动。弹窗只允许纵向滚动，控件换行不溢出。 */
.modal { touch-action: pan-y; overflow: hidden; }
.modal-card { max-width: min(520px, 100vw); overflow-x: hidden; }
.modal-body { overflow-x: hidden; touch-action: pan-y; }
.seg-tabs.plan-type-tabs,
.seg-tabs.plan-freq-tabs,
.seg-tabs.plan-day-tabs { flex-wrap: wrap; overflow-x: hidden; }
.seg-tabs.plan-day-tabs .seg { min-width: 40px; flex: 1 1 auto; text-align: center; }
.plan-field-row { display: flex; flex-direction: column; gap: 8px; }

/* 2026-11-11 目标/任务：每月多选网格、详情标题/信息行、未完成记录卡 */
.seg-tabs.plan-month-tabs { display:grid; grid-template-columns:repeat(7,1fr); gap:4px; overflow-x:hidden; }
.seg-tabs.plan-month-tabs .seg { min-width:0; padding:6px 0; text-align:center; font-size:13px; }
.plan-detail-title { margin:2px 0 10px; font-size:18px; line-height:1.35; word-break:break-word; }
.plan-detail-row { display:flex; gap:10px; padding:6px 0; border-bottom:1px dashed #eef0f2; font-size:13px; color:#5b636e; }
.plan-detail-row b { color:#1f2329; font-weight:600; margin-left:auto; text-align:right; }
.plan-detail-actions {
  display:flex;
  flex-wrap:nowrap;
  gap:8px;
  margin-top:12px;
  overflow-x:auto;
  padding-bottom:2px;
  scrollbar-width:none;
  -ms-overflow-style:none;
}
.plan-detail-actions::-webkit-scrollbar { display:none; width:0; height:0; }

/* 目标/任务统计卡：5 个状态可点击 */
.plans-mobile-stats { display:flex; gap:8px; overflow-x:auto; padding-bottom:2px; }
.plans-mobile-stat { cursor:pointer; flex:0 0 calc((100% - 24px) / 4); min-width:calc((100% - 24px) / 4); }
#plans-mobile-tabs { flex-wrap:nowrap; overflow-x:auto; row-gap:0; }
#plans-mobile-tabs .seg { flex:0 0 auto; }
.plans-mobile-stat.tone-red { background:#fff0f0; border-color:#f5c6c6; }
.plans-mobile-stat.tone-red .n { color:#b04444; }

/* 2026-11-12 手机计划页：横滑去掉进度条；详情弹窗留白 */
.plans-mobile-stats, #plans-mobile-tabs { scrollbar-width: none; -ms-overflow-style: none; }
.plans-mobile-stats::-webkit-scrollbar, #plans-mobile-tabs::-webkit-scrollbar { display: none; width: 0; height: 0; }
.modal-body { padding: 10px 0 6px; }
.plan-detail-title { margin: 4px 0 14px; font-size: 19px; }
.plan-chip-row { gap: 8px; margin-bottom: 12px; }
.plan-status { padding: 4px 10px; font-size: 11px; }
.sub { margin: 4px 0 14px; font-size: 12.5px; }
.plan-detail-row { padding: 9px 0; font-size: 13.5px; }
.mem-detail-content { margin: 10px 0; line-height: 1.7; }
.plan-completion-box { margin: 10px 0 12px; padding: 10px 12px; }
.plan-detail-actions { gap: 10px; margin-top: 16px; }
.plan-detail-actions .btn {
  flex: 0 0 auto;
  min-width: max-content;
  min-height: 40px;
  padding-left: 16px;
  padding-right: 16px;
  white-space: nowrap;
}
.plan-occ-box { margin-top: 20px; padding-top: 16px; }
.plan-occ-list { gap: 8px; }
.plan-occ-row { min-height: 30px; padding: 6px 8px; border-radius: 8px; background: #f8f9fb; }
.modal-actions { gap: 10px; margin-top: 16px; }
.modal-actions .btn { min-height: 44px; }

.plan-occ-add { margin-top: 14px; }

/* 2026-11-12 统一记忆/目标/角色页头：标题与右侧按钮同一行 */
.page-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-width: 0;
}
.page-title-row h2 { margin: 0; min-width: 0; }
.page-title-row .btn { flex: none; }
.page-title-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex: none;
}
.page-head-stack { display: block; }
.page-head-stack > p { margin-top: 3px; }
.mem-hero-text { flex: 1; min-width: 0; }
.plans-mobile-hero-text { flex: 1; min-width: 0; }
.page-head-stack .page-title-row h2 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* 2026-11-12 页头按钮统一尺寸（记忆/目标/角色） */
.page-title-row .btn {
  padding: 9px 16px;
  font-size: 14px;
  border-radius: 12px;
  min-height: 40px;
}

/* 详情状态徽标与列表状态色一致：未完成=红色气泡 */
.plan-status.unfinished { color:#b04444; background:#fff0f0; }

/* 类型徽标跟随状态色板，避免类型紫色与状态色冲突 */
.plan-mobile-kind.status-active, .plan-kind-badge.status-active { color:#2f62d8; background:#edf3ff; }
.plan-mobile-kind.status-unfinished, .plan-kind-badge.status-unfinished { color:#b04444; background:#fff0f0; }
.plan-mobile-kind.status-completed, .plan-kind-badge.status-completed { color:#178a52; background:#e8f7ef; }
.plan-mobile-kind.status-dropped, .plan-kind-badge.status-dropped { color:#7b8490; background:#f1f2f4; }
.plan-kind-badge.shape-badge { color:#5f6670; background:#f1f2f4; }

/* 记忆统计卡与计划页同尺寸；5 张超出可横向滑动 */
.mem-stats {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.mem-stats::-webkit-scrollbar { display: none; width: 0; height: 0; }
.mem-stat {
  flex: 0 0 calc((100% - 24px) / 4);
  min-width: calc((100% - 24px) / 4);
  padding: 10px 9px;
}
.mem-stat .n { font-size: 21px; }
.mem-stat .l { font-size: 10.5px; }

/* 用户级分层记忆：所有角色共享；自动记忆为默认。 */
.memory-layer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.memory-policy-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
}
.memory-policy-field .mem-select { width: auto; min-width: 112px; }
.memory-proposals,
.memory-summary-view {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}
.memory-layer-card {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
}
.memory-proposals .memory-layer-card {
  border-color: #f0dfb7;
  background: linear-gradient(110deg, #fffbf2, #fff 62%);
  box-shadow: inset 3px 0 0 #d5992e;
}
.memory-summary-view .memory-layer-card {
  border-color: #d8ecdf;
  background: linear-gradient(110deg, #f5fcf8, #fff 62%);
  box-shadow: inset 3px 0 0 #3ba66b;
}
.memory-summary-view .memory-layer-card + .memory-layer-card {
  border-color: #eee1c7;
  background: linear-gradient(110deg, #fffaf1, #fff 62%);
  box-shadow: inset 3px 0 0 #d89a32;
}
.memory-layer-card h4 {
  margin: 0 0 5px;
  font-size: 13px;
}
.memory-layer-card p {
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.memory-layer-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.memory-settings-options {
  display: grid;
  gap: 9px;
}
.memory-setting-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 66px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.memory-setting-option.selected {
  border-color: #D8CDF3;
  background: #F8F5FE;
  box-shadow: inset 3px 0 0 var(--primary);
}
.memory-setting-option:disabled {
  cursor: wait;
  opacity: .7;
}
.memory-setting-copy {
  display: grid;
  flex: 1;
  gap: 3px;
  min-width: 0;
}
.memory-setting-copy strong { font-size: 14px; }
.memory-setting-copy small {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.45;
}
.memory-setting-check {
  display: grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}
.memory-setting-option:not(.selected) .memory-setting-check {
  background: transparent;
  border: 1px solid var(--line);
}
.memory-card-source {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.memory-settings-hero {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}
.memory-settings-hero > .icon-btn { flex: none; margin: -3px 0 0 -5px; }
.memory-settings-hero > div { min-width: 0; }
.memory-settings-hero h2 {
  margin: 2px 0 3px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.02em;
}
.memory-settings-hero p {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}
.memory-settings-intro {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 14px 15px;
  border: 1px solid #D8CDF3;
  border-radius: 16px;
  background: linear-gradient(135deg, #F3EFFC, #FCFBFF);
}
.memory-settings-intro > div { flex: 1; min-width: 0; }
.memory-settings-intro-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: var(--primary);
  color: #fff;
  font-size: 19px;
  font-weight: 800;
  box-shadow: 0 5px 14px rgba(128, 101, 199, .18);
}
.memory-policy-change {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  min-width: 58px;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff !important;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}
.memory-policy-change > span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  line-height: 1;
}
.memory-policy-change select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.memory-settings-intro[data-mode="review"] {
  border-color: #efdfb8;
  background: linear-gradient(135deg, #fff9ec, #fff);
}
.memory-settings-intro[data-mode="review"] .memory-settings-intro-mark,
.memory-settings-intro[data-mode="review"] .memory-policy-change { background: #d79627; }
.memory-settings-intro[data-mode="off"] {
  border-color: #e1e4e8;
  background: linear-gradient(135deg, #f5f6f8, #fff);
}
.memory-settings-intro[data-mode="off"] .memory-settings-intro-mark,
.memory-settings-intro[data-mode="off"] .memory-policy-change { background: #8b929c; }
.memory-settings-intro button.memory-refresh-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  min-width: 58px;
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
  cursor: pointer;
}
.memory-settings-intro strong {
  display: block;
  color: var(--text);
  font-size: 14px;
}
.memory-settings-intro p {
  margin-top: 3px;
  color: var(--text-soft);
  font-size: 11.5px;
  line-height: 1.5;
}
.memory-settings-card { margin-bottom: 12px; }
.memory-settings-card-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.memory-settings-card-head > div { min-width: 0; }
.memory-settings-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 15px;
}
.memory-settings-icon.summary {
  background: #fff5df;
  color: #b47413;
}
.memory-settings-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 10px;
  color: var(--text-soft);
  font-size: 13px;
}
.memory-settings-field .mem-select {
  min-width: 148px;
  max-width: 58%;
}
.memory-settings-help {
  margin: 10px 0 0;
  line-height: 1.55;
}
.memory-settings-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.memory-settings-title-row .memory-settings-card-head { flex: 1; }
.memory-settings-title-row .memory-settings-help {
  margin-top: 5px;
}
.memory-settings-title-row .btn { flex: none; }

/* 左侧状态色改用 border-left，才能完整跟随 15px 圆角 */
.plan-mobile-card::before { content: none; }
.plan-mobile-card { border-left: 3px solid #b8a8ff; }
.plan-mobile-card.status-active { border-left-color: #2f62d8; }
.plan-mobile-card.status-unfinished { border-left-color: #b04444; }
.plan-mobile-card.status-completed { border-left-color: #178a52; }
.plan-mobile-card.status-dropped { border-left-color: #c3c7ce; }
.plan-mobile-card.status-unrecorded { border-left-color: #b7791f; }

/* 我的设备：添加/刷新按钮左对齐，并留出上下安全间距 */
#page-devices .card > .item-actions {
  justify-content: flex-start;
  margin: 12px 0 16px;
}

/* 模型 API：添加按钮与上方模型卡片留安全间距 */
#provider-add-btn { margin: 16px 0 8px; }
#model-provider-list .item-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

/* 2026-11-17 我的页：毛绒玩偶主视觉 + 紧凑账号卡 + 六个表情图标。 */
.page-me {
  background: #f5f5f5;
}

.page-me.active {
  display: flex;
  flex-direction: column;
  padding: 0;
}

.me-hero {
  position: relative;
  flex: none;
  width: 100%;
  height: clamp(196px, 53vw, 258px);
  overflow: hidden;
  background: #f7f7f7;
}

.me-hero-image {
  position: absolute;
  top: 0;
  bottom: 0;
  left: clamp(10px, 3vw, 20px);
  right: clamp(10px, 3vw, 20px);
  width: auto;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
}

.me-panel {
  position: relative;
  z-index: 1;
  width: calc(100% - 32px);
  max-width: 528px;
  margin: -38px auto 0;
  padding: 24px 20px;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(37, 39, 43, 0.1);
}

.me-account-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.me-avatar {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #f0efec;
  color: #22262c;
}

.me-email,
.me-logout {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
}

.me-email {
  min-width: 0;
  overflow: hidden;
  color: #4a4a4d;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.me-logout {
  display: inline-flex;
  align-items: center;
  justify-self: end;
  gap: 7px;
  min-height: 28px;
  padding: 0;
  color: var(--primary-dark);
  white-space: nowrap;
}

#logout-btn.me-logout {
  margin: 0;
}

.me-logout:active {
  opacity: 0.72;
}

.me-logout:disabled {
  cursor: wait;
  opacity: 0.56;
}

.me-logout-dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
}

.me-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-top: 20px;
  overflow: hidden;
  border: 1px solid #ebe5f6;
  border-radius: 16px;
  background: #fcfbff;
}

.me-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
  width: 100%;
  min-height: 96px;
  padding: 14px 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #37323f;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
  box-shadow: none;
  transition: background 0.14s, color 0.14s;
}

.me-action-btn + .me-action-btn {
  border-left: 1px solid #ebe5f6;
}

.me-action-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  transition: background 0.14s, color 0.14s;
}

.me-action-label {
  max-width: 100%;
  white-space: nowrap;
}

.me-action-btn:hover,
.me-action-btn:active {
  background: #f3eefc;
  color: var(--primary-dark);
}

.me-action-btn:hover .me-action-icon,
.me-action-btn:active .me-action-icon {
  background: #e9e0fb;
  color: var(--primary-dark);
}

.me-emoji-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: center;
  gap: clamp(7px, 2.5vw, 15px);
  width: calc(100% - 40px);
  max-width: 472px;
  margin: 34px auto 38px;
}

.me-emoji-row img {
  width: 100%;
  max-width: 52px;
  height: auto;
  aspect-ratio: 1;
  margin: 0 auto;
  object-fit: contain;
}

@media (max-width: 360px) {
  .me-panel {
    width: calc(100% - 24px);
    padding: 21px 15px;
  }

  .me-account-row {
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 10px;
  }

  .me-avatar {
    width: 44px;
    height: 44px;
  }

  .me-email,
  .me-logout {
    font-size: 13px;
  }

  .me-action-btn {
    min-height: 88px;
    gap: 9px;
    padding: 12px 5px;
    font-size: 14px;
  }

  .me-action-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }
}
