:root {
    --bg: #FAF6F0; --bg-card: #FDFBF6; --bg-card-2: #F5EFE4;
    --ink: #2B2420; --ink-soft: #6B5E54; --ink-faint: #A89886;
    --line: rgba(43,36,32,0.08); --line-soft: rgba(43,36,32,0.04);
    --accent: #C97B5E; --accent-deep: #A85F45; --accent-soft: #F2DFD4;
    --moss: #6B8E6F; --moss-soft: #D8E4D9;
    --blush: #E8A896; --gold: #C9A35E;
    --danger: #C9635E;
    --mono: 'JetBrains Mono', ui-monospace, monospace;
    --serif: 'Noto Serif SC', serif;
    --display: 'Fraunces', 'Noto Serif SC', serif;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  html, body {
    height: 100%; background: var(--bg); color: var(--ink);
    font-family: var(--serif); font-size: 15px; line-height: 1.6;
    -webkit-font-smoothing: antialiased; overflow: hidden;
    overscroll-behavior: none;
  }
  body {
    background-image:
      radial-gradient(circle at 10% 20%, rgba(201,123,94,0.04) 0%, transparent 40%),
      radial-gradient(circle at 90% 80%, rgba(107,142,111,0.03) 0%, transparent 40%);
  }
  button { font-family: inherit; cursor: pointer; }
  input, textarea, select { font-family: inherit; }

  .app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

  /* ═══ 顶栏 ═══ */
  .topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; border-bottom: 1px solid var(--line);
    background: rgba(253,251,246,0.9); backdrop-filter: blur(12px);
    flex-shrink: 0; height: 64px;
  }
  .top-left { display: flex; align-items: center; gap: 12px; }
  .paw-btn {
    width: 38px; height: 38px; border-radius: 11px;
    border: 1px solid var(--line); background: var(--bg-card);
    display: grid; place-items: center; font-size: 17px;
    color: var(--accent); transition: all 0.2s ease;
  }
  .paw-btn:hover { background: var(--accent-soft); border-color: var(--accent); }
  .paw-btn:active { transform: scale(0.95); }
  .paw-btn.active { background: var(--accent-soft); border-color: var(--accent); transform: rotate(5deg); }

  .brand h1 {
    font-family: var(--display); font-size: 16px; font-weight: 600;
    letter-spacing: -0.01em; line-height: 1.1;
  }
  .brand .zh {
    font-family: var(--serif); font-size: 10px; color: var(--ink-soft);
    letter-spacing: 0.15em; margin-top: 1px;
  }

  .status {
    display: flex; align-items: center; gap: 7px;
    font-family: var(--mono); font-size: 9px;
    letter-spacing: 0.08em; color: var(--ink-soft);
    text-transform: uppercase;
  }
  .dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--moss); box-shadow: 0 0 0 3px var(--moss-soft);
    animation: pulse 2.4s ease-in-out infinite;
  }
  @keyframes pulse {
    0%,100% { box-shadow: 0 0 0 3px var(--moss-soft); }
    50% { box-shadow: 0 0 0 6px rgba(107,142,111,0.2); }
  }
  .dot.offline { background: var(--ink-faint); box-shadow: 0 0 0 3px rgba(168,152,134,0.2); animation: none; }
  .dot.warn { background: var(--gold); box-shadow: 0 0 0 3px rgba(201,163,94,0.2); }
  .dot.error { background: var(--danger); box-shadow: 0 0 0 3px rgba(201,99,94,0.2); }

  /* ═══ 抽屉 ═══ */
  .drawer-mask {
    position: fixed; inset: 0;
    background: rgba(43,36,32,0.35); backdrop-filter: blur(4px);
    z-index: 150; opacity: 0; pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .drawer-mask.open { opacity: 1; pointer-events: auto; }

  .drawer {
    position: fixed; left: 0; top: 0; bottom: 0; width: 280px;
    background: var(--bg-card); border-right: 1px solid var(--line);
    box-shadow: 8px 0 32px rgba(43,36,32,0.08);
    z-index: 200; transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
    display: flex; flex-direction: column;
    padding-top: var(--safe-top);
  }
  .drawer.open { transform: translateX(0); }

  .drawer-head { padding: 24px 22px 18px; border-bottom: 1px solid var(--line); }
  .drawer-brand { display: flex; align-items: center; gap: 11px; }
  .drawer-logo {
    width: 40px; height: 40px; border-radius: 12px;
    background: linear-gradient(135deg, var(--accent-soft), var(--blush));
    display: grid; place-items: center; font-size: 19px;
    box-shadow: inset 0 0 0 1px rgba(201,123,94,0.2);
  }
  .drawer-brand h2 {
    font-family: var(--display); font-size: 17px; font-weight: 600;
    letter-spacing: -0.01em;
  }
  .drawer-brand .zh {
    font-family: var(--serif); font-size: 10px; color: var(--ink-soft);
    letter-spacing: 0.15em; margin-top: 1px;
  }
  .drawer-body { flex: 1; overflow-y: auto; padding: 16px 12px; }
  .drawer-section { margin-bottom: 20px; }
  .drawer-label {
    font-family: var(--mono); font-size: 9px; letter-spacing: 0.2em;
    color: var(--accent); text-transform: uppercase;
    margin-bottom: 8px; padding: 0 10px;
    display: flex; align-items: center; gap: 7px;
  }
  .drawer-label::before {
    content: ''; width: 3px; height: 3px; border-radius: 50%;
    background: var(--accent);
  }
  .drawer-item {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 12px; border-radius: 9px;
    font-size: 14px; color: var(--ink); transition: all 0.15s ease;
    border: 1px solid transparent;
  }
  .drawer-item:hover { background: var(--bg-card-2); }
  .drawer-item.active {
    background: var(--accent-soft); border-color: rgba(201,123,94,0.2);
    color: var(--accent-deep); font-weight: 500;
  }
  .drawer-item .i {
    width: 28px; height: 28px; border-radius: 7px;
    background: var(--bg-card-2); display: grid; place-items: center;
    font-size: 13px; color: var(--ink-soft);
  }
  .drawer-item.active .i {
    background: white; color: var(--accent);
    box-shadow: 0 2px 6px rgba(201,123,94,0.15);
  }
  .drawer-divider { height: 1px; background: var(--line); margin: 12px 10px; }
  .drawer-foot {
    padding: 14px 22px calc(14px + var(--safe-bottom));
    border-top: 1px solid var(--line);
    font-family: var(--mono); font-size: 9px;
    letter-spacing: 0.15em; color: var(--ink-faint);
    text-transform: uppercase;
    display: flex; justify-content: space-between;
  }

  /* ═══ 页面切换 ═══ */
  .stage { flex: 1; overflow: hidden; position: relative; }
  .page {
    position: absolute; inset: 0; overflow-y: auto;
    opacity: 0; pointer-events: none;
    transition: opacity 0.25s ease;
  }
  .page.active { opacity: 1; pointer-events: auto; }

  /* ═══ 主页：角色列表 ═══ */
  .home { padding: 36px 24px 60px; max-width: 960px; margin: 0 auto; }
  .home-hero { margin-bottom: 32px; padding-bottom: 26px; border-bottom: 1px solid var(--line); }
  .hero-label {
    font-family: var(--mono); font-size: 10px; letter-spacing: 0.25em;
    color: var(--accent); text-transform: uppercase;
    margin-bottom: 10px;
    display: flex; align-items: center; gap: 10px;
  }
  .hero-label::before {
    content: ''; width: 18px; height: 1px; background: var(--accent);
  }
  .hero-title {
    font-family: var(--display); font-size: 30px; font-weight: 600;
    letter-spacing: -0.02em; line-height: 1.2; margin-bottom: 6px;
  }
  .hero-title em {
    font-style: italic; color: var(--accent); font-family: var(--display);
  }
  .hero-sub {
    font-size: 14px; color: var(--ink-soft); max-width: 500px;
    line-height: 1.7;
  }

  .persona-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .persona {
    position: relative;
    display: flex; align-items: center; gap: 14px;
    padding: 14px 18px;
    border-radius: 14px;
    background: var(--bg-card); border: 1px solid var(--line);
    cursor: pointer; transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
    width: 100%; font-family: var(--serif); color: var(--ink);
    text-align: left;
  }
  .persona::before {
    content: ''; position: absolute; left: 0; top: 10px; bottom: 10px;
    width: 3px; border-radius: 2px;
    background: var(--p-color, var(--accent)); opacity: 0.85;
  }
  .persona:hover {
    transform: translateX(2px);
    box-shadow: 0 4px 14px rgba(43,36,32,0.06);
    border-color: var(--p-color, var(--accent));
  }

  .p-avatar {
    flex: 0 0 auto;
    width: 44px; height: 44px; border-radius: 50%;
    display: grid; place-items: center; font-size: 24px;
    background: var(--p-bg, var(--accent-soft));
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
  }
  .p-info {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; gap: 2px;
  }
  .p-name {
    font-family: var(--display); font-size: 17px; font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .p-sub {
    font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em;
    color: var(--ink-faint); text-transform: uppercase;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .p-state {
    flex: 0 0 auto;
    display: flex; align-items: center; gap: 5px;
    font-family: var(--mono); font-size: 9px; letter-spacing: 0.15em;
    color: var(--moss); text-transform: uppercase;
  }
  .p-state .d {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--moss); box-shadow: 0 0 0 2px var(--moss-soft);
  }

  .persona.add-new {
    border: 1px dashed var(--line); background: transparent;
    justify-content: center; gap: 10px;
    padding: 14px; min-height: auto;
  }
  .persona.add-new::before { display: none; }
  .persona.add-new:hover {
    background: var(--bg-card); border-style: solid; border-color: var(--accent);
    transform: none;
  }
  .add-icon {
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--bg-card-2); display: grid; place-items: center;
    font-size: 16px; color: var(--accent);
    transition: all 0.2s ease;
  }
  .persona.add-new:hover .add-icon {
    background: var(--accent-soft); transform: scale(1.1);
  }
  .add-label {
    font-family: var(--mono); font-size: 10px; letter-spacing: 0.2em;
    color: var(--ink-soft); text-transform: uppercase;
  }

  /* ═══ 对话页 ═══ */
  .chat-layout {
    display: grid; grid-template-columns: 260px 1fr;
    height: 100%;
  }

  /* 会话侧边栏 */
  .sessions-sidebar {
    border-right: 1px solid var(--line);
    background: var(--bg-card); overflow-y: auto;
    display: flex; flex-direction: column;
  }
  .sessions-head {
    padding: 20px 18px 14px; border-bottom: 1px solid var(--line);
  }
  .sess-back {
    display: flex; align-items: center; gap: 7px;
    font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em;
    color: var(--ink-soft); text-transform: uppercase;
    padding: 6px 8px; border-radius: 6px;
    transition: all 0.15s ease; width: fit-content;
    margin-bottom: 14px; background: none; border: 0;
  }
  .sess-back:hover { color: var(--accent); background: var(--accent-soft); }

  .sess-persona {
    display: flex; align-items: center; gap: 12px;
    padding: 12px; border-radius: 12px;
    background: var(--p-bg, var(--accent-soft));
    border: 1px solid rgba(0,0,0,0.05);
  }
  .sess-persona .sp-avatar {
    width: 38px; height: 38px; border-radius: 10px;
    background: white; display: grid; place-items: center;
    font-size: 18px; box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  }
  .sess-persona .sp-name {
    font-weight: 600; font-size: 13px; color: var(--ink);
  }
  .sess-persona .sp-sub {
    font-family: var(--mono); font-size: 9px; letter-spacing: 0.08em;
    color: var(--ink-soft); text-transform: uppercase; margin-top: 2px;
  }

  .new-session-btn {
    margin: 14px 18px 10px;
    padding: 10px 14px; border-radius: 10px;
    background: var(--bg); border: 1px solid var(--line);
    color: var(--ink); font-size: 13px;
    display: flex; align-items: center; justify-content: center; gap: 7px;
    transition: all 0.15s ease;
  }
  .new-session-btn:hover {
    border-color: var(--accent); color: var(--accent); background: var(--accent-soft);
  }

  .sessions-list {
    flex: 1; overflow-y: auto; padding: 4px 12px 16px;
  }
  .sess-group {
    font-family: var(--mono); font-size: 9px; letter-spacing: 0.2em;
    color: var(--ink-faint); text-transform: uppercase;
    padding: 14px 8px 6px;
  }
  .sess-item {
    display: flex; flex-direction: column; gap: 2px;
    padding: 9px 12px; border-radius: 9px;
    cursor: pointer; font-size: 13px; color: var(--ink-soft);
    transition: all 0.15s ease; margin-bottom: 2px;
    border-left: 2px solid transparent;
    position: relative;
  }
  .sess-item:hover { background: var(--bg-card-2); color: var(--ink); }
  .sess-item.active {
    background: var(--bg-card-2); color: var(--ink);
    border-left-color: var(--accent);
  }
  .sess-item .t {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    padding-right: 20px;
  }
  .sess-item .m {
    font-family: var(--mono); font-size: 9px; color: var(--ink-faint);
    letter-spacing: 0.05em;
  }
  .sess-del {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    width: 20px; height: 20px; border-radius: 5px; border: 0;
    background: transparent; color: var(--ink-faint);
    font-size: 13px; opacity: 0; transition: all 0.15s ease;
    display: grid; place-items: center;
  }
  .sess-item:hover .sess-del { opacity: 0.7; }
  .sess-del:hover { background: rgba(201,99,94,0.15); color: var(--danger); opacity: 1 !important; }

  /* 对话主区 */
  .chat-main {
    display: flex; flex-direction: column; background: var(--bg);
    overflow: hidden; height: 100%;
  }
  .chat-header {
    padding: 16px 24px; border-bottom: 1px solid var(--line);
    display: flex; align-items: center; justify-content: space-between;
    background: var(--bg-card); flex-shrink: 0;
  }
  .chat-title {
    display: flex; align-items: center; gap: 10px;
    min-width: 0;
  }
  .chat-title h2 {
    font-family: var(--display); font-size: 16px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .model-pill {
    font-family: var(--mono); font-size: 9px;
    padding: 3px 8px; border-radius: 100px;
    background: var(--moss-soft); color: #3F5C42;
    letter-spacing: 0.08em; flex-shrink: 0;
  }
  .mobile-sess-btn {
    display: none; width: 32px; height: 32px; border-radius: 8px;
    border: 1px solid var(--line); background: var(--bg-card);
    color: var(--ink-soft); font-size: 16px;
  }

  .messages {
    flex: 1; overflow-y: auto; padding: 24px 20px;
    scroll-behavior: smooth;
  }
  .messages-inner { max-width: 720px; margin: 0 auto; }

  .welcome { text-align: center; padding: 40px 20px; color: var(--ink-soft); }
  .welcome .em { font-size: 42px; margin-bottom: 12px; }
  .welcome h2 {
    font-family: var(--display); font-size: 22px; font-weight: 600;
    color: var(--ink); margin-bottom: 8px; letter-spacing: -0.01em;
  }
  .welcome h2 em { font-style: italic; color: var(--accent); }
  .welcome p { font-size: 13px; line-height: 1.7; max-width: 320px; margin: 0 auto; }

  .msg { margin-bottom: 20px; animation: slideUp 0.3s ease; }
  @keyframes slideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

  .msg-head { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; }
  .msg-avatar {
    width: 26px; height: 26px; border-radius: 8px;
    display: grid; place-items: center; font-size: 13px; flex-shrink: 0;
  }
  .msg.user .msg-avatar {
    background: linear-gradient(135deg, #2B2420, #4A3E37); color: #FAF6F0;
  }
  .msg.assistant .msg-avatar {
    background: var(--p-bg, var(--accent-soft));
  }
  .msg-name {
    font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em;
    color: var(--ink-soft); text-transform: uppercase;
  }
  .msg-time {
    font-family: var(--mono); font-size: 9px; color: var(--ink-faint);
    margin-left: auto;
  }
  .msg-body {
    padding: 13px 16px; border-radius: 14px;
    font-size: 14px; line-height: 1.72;
    background: var(--bg-card); border: 1px solid var(--line);
    white-space: pre-wrap; word-wrap: break-word;
  }
  .msg.assistant .msg-body { border-left: 2px solid var(--p-color, var(--accent)); }
  .msg-body.error { border-left-color: var(--danger); color: #7A3E36; background: rgba(201,99,94,0.05); }

  .typing { display: inline-flex; gap: 4px; padding: 4px 0; }
  .typing span {
    width: 6px; height: 6px; border-radius: 50%; background: var(--ink-faint);
    animation: bounce 1.2s infinite;
  }
  .typing span:nth-child(2) { animation-delay: 0.15s; }
  .typing span:nth-child(3) { animation-delay: 0.3s; }
  @keyframes bounce {
    0%,60%,100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-5px); opacity: 1; }
  }

  .composer {
    padding: 12px 16px calc(14px + var(--safe-bottom));
    border-top: 1px solid var(--line);
    background: var(--bg-card); flex-shrink: 0;
    position: relative;
  }
  .composer-inner {
    max-width: 720px; margin: 0 auto;
    border: 1px solid var(--line); border-radius: 16px;
    background: var(--bg); padding: 10px 12px;
    transition: all 0.2s ease;
  }
  .composer-inner:focus-within {
    border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
  }
  .composer textarea {
    width: 100%; border: 0; outline: 0; background: transparent;
    resize: none; font-size: 15px; line-height: 1.5; color: var(--ink);
    min-height: 22px; max-height: 140px;
  }
  .composer textarea::placeholder {
    color: var(--ink-faint); font-style: italic;
  }
  .composer-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 8px; padding-top: 8px;
    border-top: 1px dashed var(--line);
  }
  .model-label {
    font-family: var(--mono); font-size: 9px; color: var(--ink-faint);
    letter-spacing: 0.1em; text-transform: uppercase;
  }
  .send-btn {
    padding: 7px 16px; border-radius: 100px; border: 0;
    background: linear-gradient(135deg, var(--accent), var(--accent-deep));
    color: #FAF6F0; font-family: var(--mono); font-size: 10px;
    font-weight: 600; letter-spacing: 0.12em;
    display: flex; align-items: center; gap: 6px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(201,123,94,0.25);
  }
  .send-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(201,123,94,0.35);
  }
  .send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

  /* ═══ 设置页 ═══ */
  .settings {
    padding: 36px 24px 60px; max-width: 720px; margin: 0 auto;
  }
  .settings h1 {
    font-family: var(--display); font-size: 28px; font-weight: 600;
    letter-spacing: -0.02em; margin-bottom: 6px;
  }
  .settings-sub {
    font-size: 14px; color: var(--ink-soft); margin-bottom: 28px;
  }
  .settings-card {
    background: var(--bg-card); border: 1px solid var(--line);
    border-radius: 16px; padding: 22px; margin-bottom: 16px;
  }
  .settings-card h3 {
    font-family: var(--display); font-size: 16px; font-weight: 600;
    margin-bottom: 4px;
    display: flex; align-items: center; gap: 8px;
  }
  .settings-hint {
    font-family: var(--mono); font-size: 10px; color: var(--ink-faint);
    letter-spacing: 0.05em; margin-bottom: 14px;
  }
  .field { margin-bottom: 14px; }
  .field:last-child { margin-bottom: 0; }
  .field label {
    display: block; font-family: var(--mono); font-size: 10px;
    letter-spacing: 0.15em; color: var(--ink-soft);
    text-transform: uppercase; margin-bottom: 6px;
  }
  .field input, .field select, .field textarea {
    width: 100%; padding: 10px 12px; border-radius: 9px;
    border: 1px solid var(--line); background: var(--bg);
    font-size: 13px; color: var(--ink); outline: 0;
    transition: border-color 0.15s ease;
    font-family: var(--serif);
  }
  .field input[type="password"], .field input[type="text"].mono {
    font-family: var(--mono); font-size: 12px;
  }
  .field textarea { min-height: 180px; resize: vertical; line-height: 1.7; }
  .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }

  .field-row {
    display: flex; gap: 10px; align-items: center;
  }
  .field-row input { flex: 1; }

  .status-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 100px;
    font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em;
    text-transform: uppercase;
  }
  .status-badge.on {
    background: var(--moss-soft); color: #3F5C42;
  }
  .status-badge.off {
    background: rgba(168,152,134,0.15); color: var(--ink-faint);
  }

  .provider-toggle {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px;
    padding: 4px; background: var(--bg); border: 1px solid var(--line);
    border-radius: 12px;
  }
  .provider-toggle button {
    padding: 10px 6px; border-radius: 9px; border: 0;
    background: transparent; color: var(--ink-soft);
    font-family: var(--mono); font-size: 10px; letter-spacing: 0.05em;
    text-transform: uppercase; transition: all 0.15s ease;
    white-space: nowrap;
  }
  .provider-toggle button.active {
    background: var(--accent); color: white;
    box-shadow: 0 2px 6px rgba(201,123,94,0.25);
  }

  .btn-primary {
    padding: 10px 20px; border-radius: 100px; border: 0;
    background: linear-gradient(135deg, var(--accent), var(--accent-deep));
    color: #FAF6F0; font-family: var(--mono); font-size: 11px;
    font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(201,123,94,0.25);
    transition: all 0.2s ease;
  }
  .btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(201,123,94,0.35); }
  .btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
  .btn-secondary {
    padding: 10px 20px; border-radius: 100px;
    border: 1px solid var(--line); background: var(--bg);
    color: var(--ink-soft); font-family: var(--mono); font-size: 11px;
    letter-spacing: 0.1em; text-transform: uppercase;
    transition: all 0.15s ease;
  }
  .btn-secondary:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
  .btn-danger {
    padding: 10px 20px; border-radius: 100px;
    border: 1px solid rgba(201,99,94,0.3); background: rgba(201,99,94,0.08);
    color: var(--danger); font-family: var(--mono); font-size: 11px;
    letter-spacing: 0.1em; text-transform: uppercase;
    transition: all 0.15s ease;
  }
  .btn-danger:hover { background: rgba(201,99,94,0.15); }

  /* ═══ 角色编辑页 ═══ */
  .personas-list {
    display: flex; flex-direction: column; gap: 12px;
    margin-bottom: 16px;
  }
  .persona-row {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 16px; background: var(--bg);
    border: 1px solid var(--line); border-radius: 12px;
  }
  .persona-row .pr-avatar {
    width: 40px; height: 40px; border-radius: 11px;
    display: grid; place-items: center; font-size: 19px;
    background: var(--pr-bg, var(--accent-soft));
    flex-shrink: 0;
  }
  .persona-row .pr-info { flex: 1; min-width: 0; }
  .persona-row .pr-name {
    font-weight: 600; font-size: 14px; margin-bottom: 2px;
  }
  .persona-row .pr-sub {
    font-family: var(--mono); font-size: 10px; color: var(--ink-faint);
    letter-spacing: 0.08em; text-transform: uppercase;
  }
  .persona-row .pr-actions { display: flex; gap: 6px; }
  .pr-btn {
    padding: 6px 10px; border-radius: 7px;
    border: 1px solid var(--line); background: var(--bg-card);
    font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em;
    color: var(--ink-soft); text-transform: uppercase;
    transition: all 0.15s ease;
  }
  .pr-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
  .pr-btn.danger:hover { border-color: var(--danger); color: var(--danger); background: rgba(201,99,94,0.08); }

  /* ═══ 模态框 ═══ */
  .modal-mask {
    position: fixed; inset: 0;
    background: rgba(43,36,32,0.45); backdrop-filter: blur(6px);
    z-index: 300; display: none;
    align-items: center; justify-content: center; padding: 20px;
  }
  .modal-mask.open { display: flex; }
  .modal {
    background: var(--bg-card); border-radius: 18px;
    max-width: 560px; width: 100%; max-height: 90vh;
    overflow-y: auto; padding: 28px;
    box-shadow: 0 16px 48px rgba(43,36,32,0.18);
    animation: modalIn 0.25s ease;
  }
  @keyframes modalIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
  .modal h2 {
    font-family: var(--display); font-size: 20px; font-weight: 600;
    margin-bottom: 4px; letter-spacing: -0.01em;
  }
  .modal-sub {
    font-size: 13px; color: var(--ink-soft); margin-bottom: 20px;
  }
  .modal-actions {
    display: flex; gap: 10px; justify-content: flex-end;
    margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line);
  }

  .color-picker {
    display: flex; gap: 8px; flex-wrap: wrap;
  }
  .color-chip {
    width: 32px; height: 32px; border-radius: 9px;
    cursor: pointer; border: 2px solid transparent;
    transition: all 0.15s ease;
  }
  .color-chip.selected { border-color: var(--ink); transform: scale(1.1); }

  .emoji-picker {
    display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px;
    padding: 8px; background: var(--bg); border: 1px solid var(--line);
    border-radius: 10px; max-height: 180px; overflow-y: auto;
  }
  .emoji-chip {
    padding: 6px; font-size: 20px; border-radius: 6px; border: 0;
    background: transparent; cursor: pointer; transition: all 0.1s ease;
  }
  .emoji-chip:hover { background: var(--accent-soft); }
  .emoji-chip.selected { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }

  /* ═══ 通用 ═══ */
  .placeholder {
    padding: 60px 24px; max-width: 640px; margin: 0 auto; text-align: center;
  }
  .placeholder-em { font-size: 48px; margin-bottom: 14px; opacity: 0.7; }
  .placeholder h1 {
    font-family: var(--display); font-size: 24px; font-weight: 600;
    margin-bottom: 8px;
  }
  .placeholder p { color: var(--ink-soft); font-size: 14px; line-height: 1.7; }

  ::-webkit-scrollbar { width: 6px; height: 6px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--line); border-radius: 100px; }
  ::-webkit-scrollbar-thumb:hover { background: var(--ink-faint); }

  /* ═══ 响应式 ═══ */
  @media (max-width: 860px) {
    .hero-title { font-size: 24px; }
    .home { padding: 28px 18px 40px; }
    .chat-layout { grid-template-columns: 1fr; }
    .sessions-sidebar {
      position: fixed; left: 0; top: 48px; bottom: calc(62px + var(--safe-bottom)); width: 280px;
      z-index: 180; transform: translateX(-100%);
      transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
      box-shadow: 8px 0 32px rgba(43,36,32,0.12);
      background: var(--bg-card);
    }
    .sessions-sidebar.open { transform: translateX(0); }
    .sess-overlay {
      display: none; position: fixed; inset: 0; z-index: 179;
      background: transparent;
    }
    .sess-overlay.show { display: block; }
    .mobile-sess-btn { display: grid; place-items: center; }
    .chat-header { padding: 14px 16px; }
    .messages { padding: 20px 16px; }
    .composer { padding: 10px 14px calc(12px + var(--safe-bottom)); }
    .drawer { width: min(280px, 85vw); }
    .settings { padding: 24px 18px 60px; }
  }

  /* 小屏手机微调 */
  @media (max-width: 380px) {
    .brand h1 { font-size: 15px; }
    .brand .zh { display: none; }
    .status span:last-child { display: none; }
  }

  .link-btn {
    background: none; border: none; color: var(--accent);
    font-size: 11px; padding: 2px 6px; margin-left: 8px;
    cursor: pointer; font-family: var(--mono);
    letter-spacing: 0.05em;
  }
  .link-btn:hover { color: var(--accent-deep); text-decoration: underline; }
  .toast {
    position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
    background: var(--ink); color: var(--bg-card);
    padding: 10px 18px; border-radius: 10px;
    font-size: 13px; z-index: 9999;
    box-shadow: 0 8px 24px rgba(43,36,32,0.25);
    opacity: 0; transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
  }
  .toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
  .toast.error { background: var(--danger); color: #fff; }
  /* ═══ v0.5 新增：composer 工具按钮 ═══ */
  .composer-tools {
    display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0;
  }
  .tool-btn {
    width: 30px; height: 30px; border-radius: 8px;
    border: 1px solid var(--line); background: var(--bg-card);
    color: var(--ink-soft); font-size: 15px;
    display: grid; place-items: center;
    cursor: pointer; transition: all 0.15s ease; flex-shrink: 0;
  }
  .tool-btn:hover {
    background: var(--accent-soft); border-color: var(--accent); color: var(--accent);
    transform: translateY(-1px);
  }
  .tool-btn:active { transform: scale(0.95); }

  /* ═══ v0.5 新增：思考链小标签 💭 已思考 X 秒 ▸ ═══ */
  .thinking-bar {
    display: inline-flex; align-items: center; gap: 6px;
    margin-bottom: 6px; padding: 3px 10px; border-radius: 100px;
    background: transparent; border: 1px solid var(--line);
    font-family: var(--mono); font-size: 10px;
    color: var(--ink-faint); letter-spacing: 0.05em;
    transition: all 0.15s ease;
    max-width: 100%;
  }
  .thinking-bar.empty {
    opacity: 0.55; cursor: default;
  }
  .thinking-bar.has-content {
    cursor: pointer; color: var(--ink-soft);
    list-style: none;
  }
  .thinking-bar.has-content:hover {
    border-color: var(--accent); color: var(--accent);
    background: var(--accent-soft);
  }
  .thinking-bar.has-content summary {
    display: inline-flex; align-items: center; gap: 6px;
    list-style: none; cursor: pointer;
  }
  .thinking-bar.has-content summary::-webkit-details-marker { display: none; }
  .thinking-bar .t-emoji { font-size: 11px; }
  .thinking-bar .t-text { font-weight: 500; }
  .thinking-bar .t-arrow {
    font-size: 9px; transition: transform 0.2s ease;
    color: var(--ink-faint);
  }
  .thinking-bar[open] .t-arrow { transform: rotate(90deg); }
  .thinking-bar[open] {
    display: block; border-radius: 10px; padding: 6px 12px 10px;
  }
  .thinking-bar .t-body {
    margin-top: 8px; padding-top: 8px;
    border-top: 1px dashed var(--line);
    font-size: 12px; line-height: 1.65;
    color: var(--ink-soft); font-family: var(--serif);
    white-space: pre-wrap; word-wrap: break-word;
    letter-spacing: normal; text-transform: none;
  }

  /* ═══ 思考链模式三档选择器 ═══ */
  .thinking-mode-picker {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px;
    padding: 4px; background: var(--bg); border: 1px solid var(--line);
    border-radius: 12px;
  }
  .thinking-mode-picker button {
    padding: 8px 6px; border-radius: 8px; border: 0;
    background: transparent; color: var(--ink-soft);
    font-family: var(--mono); font-size: 10px; letter-spacing: 0.05em;
    text-transform: uppercase; transition: all 0.15s ease;
    white-space: nowrap; cursor: pointer;
  }
  .thinking-mode-picker button.active {
    background: var(--accent); color: white;
    box-shadow: 0 2px 6px rgba(201,123,94,0.25);
  }
  .field-hint {
    font-size: 11px; color: var(--ink-faint); margin-top: 6px;
    line-height: 1.5;
  }

  /* ═══ v0.5.1 新增：个人档案页 ═══ */
  .profile-page {
    padding: 36px 24px 60px; max-width: 720px; margin: 0 auto;
  }
  .profile-hero {
    margin-bottom: 28px; padding-bottom: 24px;
    border-bottom: 1px solid var(--line);
  }
  .field-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  }
  .field-grid .field { margin-bottom: 0; }

  /* 档案页的大 textarea 更大一些 */
  #profBio { min-height: 220px; }

  @media (max-width: 860px) {
    .profile-page { padding: 24px 18px 60px; }
    .field-grid { grid-template-columns: 1fr; }
  }

/* ═══════════════════════════════════════════════════════════
   v0.7：档案库 · 身份 pill · 身份菜单
   ═══════════════════════════════════════════════════════════ */

/* ── 档案网格（档案页内） ── */
.profile-grid {
  display: flex; flex-direction: column; gap: 10px;
  margin-top: 8px;
}
.profile-card {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--bg-card); border: 1px solid var(--line);
  cursor: pointer; transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
  width: 100%; font-family: var(--serif); color: var(--ink);
  text-align: left;
}
.profile-card::before {
  content: ''; position: absolute; left: 0; top: 10px; bottom: 10px;
  width: 3px; border-radius: 2px;
  background: var(--pf-color, var(--accent)); opacity: 0.85;
}
.profile-card:hover {
  transform: translateX(2px);
  box-shadow: 0 4px 14px rgba(43,36,32,0.06);
  border-color: var(--pf-color, var(--accent));
}
.profile-card.active {
  border-color: var(--pf-color, var(--accent));
  background: linear-gradient(to right, var(--pf-bg, var(--accent-soft)) 0%, var(--bg-card) 35%);
}
.pf-avatar {
  flex: 0 0 auto;
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; font-size: 24px;
  background: var(--pf-bg, var(--accent-soft));
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
}
.pf-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pf-name {
  font-family: var(--display); font-size: 17px; font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pf-meta {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em;
  color: var(--ink-faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pf-state {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 8px;
}
.pf-current {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.15em;
  color: var(--moss); text-transform: uppercase;
  padding: 3px 7px; border-radius: 6px;
  background: var(--moss-soft);
}
.pf-edit {
  width: 28px; height: 28px; border-radius: 8px;
  background: transparent; border: 1px solid var(--line);
  color: var(--ink-soft); font-size: 13px;
  cursor: pointer; transition: all 0.15s ease;
  display: grid; place-items: center;
}
.pf-edit:hover {
  background: var(--bg-card-2); color: var(--ink); border-color: var(--ink-soft);
}
.profile-card.add-new {
  border: 1px dashed var(--line); background: transparent;
  justify-content: center; gap: 10px; padding: 14px;
}
.profile-card.add-new::before { display: none; }
.profile-card.add-new:hover {
  background: var(--bg-card); border-style: solid; border-color: var(--accent);
  transform: none;
}

/* ── 色板（档案编辑器里） ── */
.color-picker {
  display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 0;
}
.color-swatch {
  width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid transparent; cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
}
.color-swatch:hover { transform: scale(1.08); }
.color-swatch.active {
  border-color: var(--ink);
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(43,36,32,0.2);
}

/* ── 对话页顶部：身份 pill ── */
.identity-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px 5px 6px;
  border-radius: 999px;
  background: var(--bg-card-2);
  border: 1px solid var(--line);
  cursor: pointer;
  font-family: var(--mono); font-size: 11px;
  color: var(--ink); letter-spacing: 0.02em;
  transition: all 0.15s ease;
  margin-left: 6px;
}
.identity-pill:hover {
  background: var(--bg-card); border-color: var(--ink-soft);
}
.identity-pill .ip-emoji { font-size: 15px; line-height: 1; }
.identity-pill .ip-name {
  font-family: var(--serif); font-size: 12px; font-weight: 500;
  max-width: 80px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.identity-pill .ip-arrow {
  font-size: 10px; color: var(--ink-faint); margin-left: 2px;
}

/* ── 身份切换菜单（悬浮下拉） ── */
.identity-menu-mask {
  position: fixed; inset: 0; z-index: 90;
  background: transparent;
  display: none;
}
.identity-menu-mask.open { display: block; }
.identity-menu {
  position: fixed; z-index: 100;
  top: 62px; right: 16px;
  width: min(320px, calc(100vw - 32px));
  max-height: 70vh; overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(43,36,32,0.18);
  padding: 10px;
  opacity: 0; transform: translateY(-8px); pointer-events: none;
  transition: all 0.18s cubic-bezier(0.4,0,0.2,1);
}
.identity-menu.open {
  opacity: 1; transform: translateY(0); pointer-events: auto;
}
.idm-head {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.18em;
  color: var(--ink-faint); text-transform: uppercase;
  padding: 6px 10px 10px;
}
.idm-list { display: flex; flex-direction: column; gap: 4px; }
.idm-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  background: transparent; border: 1px solid transparent;
  cursor: pointer; width: 100%; text-align: left;
  transition: all 0.12s ease;
}
.idm-item:hover {
  background: var(--bg-card-2);
  border-color: var(--line);
}
.idm-item.active {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.idm-avatar {
  flex: 0 0 auto;
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; font-size: 20px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
}
.idm-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.idm-name {
  font-family: var(--serif); font-size: 14px; font-weight: 500;
  color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.idm-meta {
  font-family: var(--mono); font-size: 10px; color: var(--ink-faint);
  letter-spacing: 0.05em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.idm-check {
  font-size: 14px; color: var(--accent); font-weight: 600;
  margin-left: 4px;
}
.idm-manage {
  margin-top: 6px;
  padding: 10px 12px; border-radius: 10px;
  background: transparent; border: 1px dashed var(--line);
  color: var(--ink-soft);
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em;
  cursor: pointer; width: 100%;
  transition: all 0.12s ease;
}
.idm-manage:hover {
  border-style: solid; border-color: var(--accent);
  color: var(--accent); background: var(--accent-soft);
}

@media (max-width: 860px) {
  .identity-pill .ip-name { max-width: 60px; }
  .identity-menu {
    top: 58px; right: 10px; left: 10px; width: auto;
  }
}

/* ═══════════════════════════════════════════════════════════
   v0.7：语音 TTS 相关样式
   ═══════════════════════════════════════════════════════════ */

/* ── 顶栏自动朗读开关 ── */
.auto-read-btn {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px; border-radius: 999px;
  background: var(--bg-card-2); border: 1px solid var(--line);
  cursor: pointer; transition: all 0.15s ease;
  margin-left: 6px; font-size: 14px; padding: 0;
}
.auto-read-btn:hover {
  background: var(--bg-card); border-color: var(--ink-soft);
}
.auto-read-btn.active {
  background: var(--accent-soft); border-color: var(--accent);
}
.auto-read-btn.active .ar-icon { filter: none; }

/* ── 消息右上角的朗读按钮 ── */
.msg-speak-btn {
  margin-left: 4px;
  width: 24px; height: 24px; border-radius: 6px;
  background: transparent; border: 1px solid transparent;
  color: var(--ink-faint); font-size: 12px;
  cursor: pointer; opacity: 0.5;
  transition: all 0.15s ease;
  display: grid; place-items: center;
  padding: 0;
}
.msg:hover .msg-speak-btn { opacity: 1; }
.msg-speak-btn:hover {
  background: var(--bg-card-2); border-color: var(--line);
  color: var(--ink);
}
.msg-speak-btn.speaking {
  opacity: 1;
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  animation: speakPulse 1.2s infinite;
}
@keyframes speakPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201,123,94,0.3); }
  50% { box-shadow: 0 0 0 4px rgba(201,123,94,0); }
}

/* ── 角色编辑器：语速/音调滑块 ── */
.voice-sliders {
  display: flex; gap: 12px; margin-top: 4px;
}
.vs-item {
  flex: 1; display: flex; flex-direction: column; gap: 4px;
}
.vs-item label {
  font-size: 11px; color: var(--ink-soft);
  display: flex; justify-content: space-between; align-items: center;
}
.vs-item label span {
  font-family: var(--mono); color: var(--accent); font-size: 10px;
}
.vs-item input[type="range"] {
  width: 100%; accent-color: var(--accent);
  height: 4px;
}

  /* ═══ MCP 连接器页 ═══ */
  .mcp-page {
    padding: 28px 18px 60px; max-width: 640px; margin: 0 auto;
    overflow-y: auto; height: 100%;
  }
  .mcp-hero { text-align: center; margin-bottom: 24px; }
  .mcp-hero .hero-label {
    font-family: var(--mono); font-size: 9px; letter-spacing: 0.2em;
    text-transform: uppercase; color: var(--ink-faint); margin-bottom: 8px;
  }
  .mcp-hero .hero-title {
    font-family: var(--display); font-size: 28px; font-weight: 600;
    letter-spacing: -0.02em; margin-bottom: 6px;
  }
  .mcp-hero .hero-title em { font-style: italic; color: var(--accent); }
  .mcp-hero .hero-sub {
    font-size: 14px; color: var(--ink-soft); line-height: 1.7;
  }

  .mcp-actions { margin-bottom: 18px; text-align: center; }

  .mcp-list { display: flex; flex-direction: column; gap: 12px; }

  .mcp-card {
    background: var(--bg-card); border: 1px solid var(--line);
    border-radius: 16px; overflow: hidden;
    transition: border-color 0.15s ease;
  }
  .mcp-card:hover { border-color: rgba(43,36,32,0.15); }

  .mcp-card-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 18px 10px;
  }
  .mcp-card-info { flex: 1; min-width: 0; }
  .mcp-card-name {
    font-family: var(--display); font-size: 15px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    display: flex; align-items: center; gap: 6px;
  }
  .mcp-status-dot {
    display: inline-block; flex-shrink: 0;
    width: 8px; height: 8px; border-radius: 50%;
    background: #aaa; transition: background 0.3s;
    cursor: default;
  }
  .mcp-status-dot.online  { background: #4caf50; box-shadow: 0 0 5px #4caf5088; }
  .mcp-status-dot.offline { background: #e57373; box-shadow: 0 0 5px #e5737388; }
  .mcp-status-dot.testing { background: #ffb74d; animation: mcp-dot-pulse 0.8s ease-in-out infinite; }
  @keyframes mcp-dot-pulse { 0%,100%{opacity:1} 50%{opacity:0.3} }
  .mcp-card-id {
    font-family: var(--mono); font-size: 10px; color: var(--ink-faint);
    letter-spacing: 0.05em; margin-top: 2px;
  }

  .mcp-card-actions { display: flex; gap: 6px; flex-shrink: 0; }
  .mcp-icon-btn {
    width: 32px; height: 32px; border-radius: 8px;
    border: 1px solid var(--line); background: var(--bg);
    display: grid; place-items: center; font-size: 13px;
    color: var(--ink-soft); transition: all 0.15s ease;
  }
  .mcp-icon-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
  .mcp-icon-btn.danger:hover { border-color: var(--danger); color: var(--danger); background: rgba(201,99,94,0.08); }

  .mcp-card-body { padding: 0 18px 16px; }
  .mcp-field-row {
    display: flex; align-items: baseline; gap: 8px;
    padding: 4px 0; font-size: 13px;
  }
  .mcp-label {
    font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em;
    text-transform: uppercase; color: var(--ink-faint);
    flex-shrink: 0; width: 48px;
  }
  .mcp-value {
    color: var(--ink-soft); word-break: break-all; line-height: 1.4;
  }
  .mcp-value.mono { font-family: var(--mono); font-size: 11px; }

  .mcp-empty {
    text-align: center; padding: 48px 20px; color: var(--ink-faint);
  }
  .mcp-empty-icon { font-size: 36px; opacity: 0.5; margin-bottom: 10px; }
  .mcp-empty p { font-size: 14px; margin-bottom: 4px; }
  .mcp-empty-hint { font-size: 12px; }

  .mcp-editor-head {
    display: flex; align-items: center; gap: 14px; margin-bottom: 20px;
  }
  .mcp-editor-head h2 {
    font-family: var(--display); font-size: 20px; font-weight: 600;
  }
  .mcp-back-btn {
    border: 0; background: 0; color: var(--accent); font-family: var(--serif);
    font-size: 14px; padding: 4px 0; cursor: pointer;
  }
  .mcp-back-btn:hover { text-decoration: underline; }

  .mcp-editor-btns { display: flex; gap: 10px; margin-top: 18px; }

  /* ═══ 连接器勾选 ═══ */
  .connector-checks { display: flex; flex-wrap: wrap; gap: 8px; }
  .connector-check {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 14px; border-radius: 10px;
    border: 1px solid var(--line); background: var(--bg);
    cursor: pointer; font-size: 13px; transition: all 0.15s ease;
    user-select: none;
  }
  .connector-check:hover { border-color: var(--accent); }
  .connector-check.checked {
    border-color: var(--accent); background: var(--accent-soft);
  }
  .connector-check input { display: none; }
  .connector-check .cc-dot {
    width: 14px; height: 14px; border-radius: 4px;
    border: 1.5px solid var(--ink-faint); display: grid; place-items: center;
    font-size: 10px; transition: all 0.15s ease;
  }
  .connector-check.checked .cc-dot {
    border-color: var(--accent); background: var(--accent); color: #fff;
  }
  .connector-checks-empty {
    font-size: 12px; color: var(--ink-faint); padding: 6px 0;
  }

/* ═══ 底部导航栏 ═══ */
.bottom-nav {
  display: flex; align-items: stretch;
  height: calc(62px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(253,251,246,0.95);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  flex-shrink: 0; z-index: 100;
}
.bn-tab {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; background: none; border: 0;
  color: #b8a898; transition: color 0.2s ease;
  padding: 0 0 2px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.bn-tab:active { opacity: 0.7; }

/* 每个 tab 各自的激活色 */
#bnDashboard.active { color: #E07A3E; }
#bnHome.active      { color: #E07A3E; }
#bnChat.active      { color: #E07A3E; }
#bnSettings.active  { color: #E07A3E; }

/* 激活时顶部小彩点 */
.bn-tab.active::before {
  content: '';
  position: absolute; top: 5px;
  width: 20px; height: 3px;
  border-radius: 2px;
  background: currentColor;
  opacity: 0.7;
}

.bn-icon {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  transition: transform 0.22s cubic-bezier(0.34,1.56,0.64,1);
}
.bn-tab.active .bn-icon { transform: translateY(-1px) scale(1.15); }
.bn-label {
  font-size: 10px;
  letter-spacing: 0.02em;
  line-height: 1;
  font-family: var(--sans, system-ui), sans-serif;
}

/* stage 底部留白给 nav */
.stage { padding-bottom: 0; }

/* ═══ 角色手风琴侧边栏 ═══ */
.psa-list { display: flex; flex-direction: column; gap: 2px; padding: 10px 8px; overflow-y: auto; flex: 1; }

.psa-item { border-radius: 12px; overflow: hidden; background: var(--bg-card); border: 1px solid var(--line); }
.psa-item.open .psa-sessions { display: flex; }
.psa-item.active-persona { border-color: var(--line); }

.psa-head {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}
.psa-head:active { background: var(--line-soft); }
.psa-emoji { font-size: 22px; width: 32px; text-align: center; flex-shrink: 0; }
.psa-info { flex: 1; min-width: 0; }
.psa-name { font-size: 14px; font-weight: 600; color: var(--ink); line-height: 1.2; }
.psa-sub { font-size: 10px; color: var(--ink-faint); font-family: var(--mono); letter-spacing: 0.04em; margin-top: 1px; }
.psa-count {
  font-family: var(--mono); font-size: 10px; color: var(--ink-faint);
  background: var(--bg-card-2); border-radius: 8px;
  padding: 2px 7px; flex-shrink: 0;
}
.psa-arrow {
  font-size: 11px; color: var(--ink-faint); flex-shrink: 0;
  transition: transform 0.2s ease; transform: rotate(-90deg);
}
.psa-item.open .psa-arrow { transform: rotate(0deg); }

.psa-sessions {
  display: none; flex-direction: column;
  border-top: 1px solid var(--line);
  padding: 6px;
}
.psa-new-btn {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 12px; border-radius: 8px; border: 0;
  background: none; color: var(--accent);
  font-size: 13px; font-family: inherit; cursor: pointer;
  transition: background 0.15s; width: 100%; text-align: left;
}
.psa-new-btn:active { background: var(--accent-soft); }

.psa-sess-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: 8px; border: 0;
  background: none; cursor: pointer; width: 100%;
  text-align: left; transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.psa-sess-item:active { background: var(--line-soft); }
.psa-sess-item.active { background: var(--accent-soft); }
.psa-sess-title { flex: 1; min-width: 0; font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.psa-sess-time { font-family: var(--mono); font-size: 9px; color: var(--ink-faint); flex-shrink: 0; }

/* 侧边栏收起按钮 */
.psa-close-btn {
  display: block; width: calc(100% - 16px); margin: 6px 8px 10px;
  padding: 11px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg-card-2); color: var(--ink-soft);
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em;
  cursor: pointer; transition: all 0.15s; flex-shrink: 0;
}
.psa-close-btn:active { background: var(--accent-soft); color: var(--accent); }

/* ═══ Studio 页 ═══ */
.studio-page {
  padding: 0 16px 24px;
  overflow-y: auto; height: 100%;
}

.studio-top {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 20px 2px 16px;
}
.studio-date {
  font-family: var(--serif); font-size: 13px; color: var(--ink-soft);
}
.studio-day {
  font-family: var(--display); font-size: 28px; font-weight: 600;
  color: var(--accent); letter-spacing: -0.02em; font-style: italic;
}

.studio-section { margin-bottom: 22px; }
.studio-label {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em;
  color: var(--ink-faint); text-transform: uppercase; margin-bottom: 10px;
  display: block;
}
.studio-label-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
}
.studio-label-hint {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.08em;
  color: var(--ink-faint); text-transform: uppercase;
}

/* 服务卡片网格 */
.studio-services {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.svc-card {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 8px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  cursor: default; transition: all 0.15s;
}
.svc-card.online { border-color: transparent; }
.svc-card.offline { opacity: 0.45; }
.svc-emoji { font-size: 22px; line-height: 1; }
.svc-name {
  font-family: var(--mono); font-size: 8px; color: var(--ink-soft);
  text-align: center; letter-spacing: 0.02em; line-height: 1.2;
}
.svc-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--moss); margin-top: 1px;
}
.svc-card.offline .svc-dot { background: var(--ink-faint); }

/* 记忆卡片 */
.studio-memories { display: flex; flex-direction: column; gap: 8px; }
.mem-card {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 16px;
}
.mem-meta {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.mem-tag {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.06em;
  padding: 2px 8px; border-radius: 20px;
  background: var(--accent-soft); color: var(--accent);
}
.mem-time { font-family: var(--mono); font-size: 9px; color: var(--ink-faint); margin-left: auto; }
.mem-content {
  font-size: 13px; color: var(--ink); line-height: 1.7;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}

.svc-loading { color: var(--ink-faint); font-size: 12px; padding: 8px 0; }

/* ═══ 手機狀態條 ═══ */
.phone-status-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 16px; margin-bottom: 10px;
}
.psb-left { display: flex; align-items: center; gap: 10px; }
.psb-label { font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; color: var(--ink-faint); text-transform: uppercase; }
.psb-battery-text { font-family: var(--mono); font-size: 18px; font-weight: 600; color: var(--ink); }

/* 手機圖示 */
.psb-phone-body {
  width: 28px; height: 46px; border: 2px solid var(--ink-soft);
  border-radius: 5px; position: relative; overflow: hidden;
}
.psb-phone-body::before {
  content: ''; position: absolute; top: -4px; left: 50%; transform: translateX(-50%);
  width: 8px; height: 3px; background: var(--ink-soft); border-radius: 2px;
}
.psb-phone-fill {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: var(--moss); transition: height 0.5s ease;
  height: 70%;
}
.psb-phone-fill.low { background: var(--danger); }
.psb-phone-fill.mid { background: var(--gold); }

/* App 使用時長列表 */
.phone-apps { display: flex; flex-direction: column; gap: 6px; }
.app-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; background: var(--bg-card);
  border: 1px solid var(--line); border-radius: 10px;
}
.app-name { font-size: 12px; color: var(--ink); width: 72px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-bar-wrap { flex: 1; height: 4px; background: var(--bg-card-2); border-radius: 2px; overflow: hidden; }
.app-bar-fill { height: 100%; border-radius: 2px; transition: width 0.4s ease; }
.app-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.app-time { font-family: var(--mono); font-size: 10px; color: var(--ink-soft); width: 36px; text-align: right; flex-shrink: 0; }

/* ═══ 手機狀態 mini 橫條 ═══ */
.psb-mini-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
}
.psb-mini-label {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em;
  color: var(--ink-faint); text-transform: uppercase; flex-shrink: 0; width: 46px;
}
.psb-mini-bar-wrap {
  flex: 1; height: 5px; background: var(--bg-card-2);
  border-radius: 3px; overflow: hidden;
}
.psb-mini-fill {
  height: 100%; border-radius: 3px; background: var(--moss);
  transition: width 0.5s ease; width: 0%;
}
.psb-mini-fill.low { background: var(--danger); }
.psb-mini-fill.mid { background: var(--gold); }
.psb-mini-pct {
  font-family: var(--mono); font-size: 11px; color: var(--ink-soft);
  flex-shrink: 0; width: 36px; text-align: right;
}

/* ═══ 互動卡片 ═══ */
.icard-grid { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }

.icard {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 16px; overflow: hidden;
  transition: border-color 0.2s;
}
.icard.open { border-color: var(--accent); }

.icard-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.icard-head:active { opacity: 0.8; }
.icard-emoji { font-size: 20px; flex-shrink: 0; }
.icard-name { flex: 1; font-size: 14px; font-weight: 600; color: var(--ink); }
.icard-badge {
  font-family: var(--mono); font-size: 10px; color: var(--ink-faint);
  background: var(--bg-card-2); border-radius: 8px; padding: 2px 8px;
}
.icard.open .icard-badge { color: var(--accent); }

.icard-body {
  display: none; border-top: 1px solid var(--line);
  padding: 12px 14px; flex-direction: column; gap: 8px;
}
.icard.open .icard-body { display: flex; }

/* 記憶條目 */
.im-item { padding: 10px 12px; background: var(--bg-card-2); border-radius: 10px; cursor: default; }
.im-meta { display: flex; gap: 8px; align-items: center; margin-bottom: 5px; }
.im-tag { font-family: var(--mono); font-size: 9px; padding: 1px 7px; border-radius: 20px; background: var(--accent-soft); color: var(--accent); }
.im-date { font-family: var(--mono); font-size: 9px; color: var(--ink-faint); margin-left: auto; }
.im-text { font-size: 12px; color: var(--ink); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* 郵件條目 */
.email-item { padding: 10px 12px; background: var(--bg-card-2); border-radius: 10px; }
.email-from { font-size: 11px; color: var(--ink-faint); font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.email-subject { font-size: 13px; font-weight: 600; color: var(--ink); margin: 3px 0; }
.email-snippet { font-size: 12px; color: var(--ink-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* 音樂搜索 */
.music-search-row { display: flex; gap: 8px; }
.music-input {
  flex: 1; background: var(--bg-card-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 12px; font-size: 13px;
  color: var(--ink); font-family: inherit; outline: none;
}
.music-input:focus { border-color: var(--accent); }
.music-search-btn {
  background: var(--accent); color: white; border: 0;
  border-radius: 10px; padding: 9px 14px; font-size: 13px;
  cursor: pointer; font-family: inherit; flex-shrink: 0;
}
.music-result {
  padding: 9px 12px; background: var(--bg-card-2); border-radius: 10px;
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  transition: background 0.15s;
}
.music-result:active { background: var(--accent-soft); }
.music-result-info { flex: 1; min-width: 0; }
.music-result-name { font-size: 13px; font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.music-result-artist { font-size: 11px; color: var(--ink-faint); margin-top: 1px; }
.music-play-btn { font-size: 18px; flex-shrink: 0; }
.music-vip { font-family: var(--mono); font-size: 9px; color: var(--gold); background: rgba(201,163,94,0.15); padding: 1px 5px; border-radius: 4px; flex-shrink: 0; }

/* ═══ 全屏子頁面 ═══ */
.subpage-overlay {
  display: none; position: fixed;
  inset: 0; z-index: 200;
  flex-direction: column;
  background: var(--bg);
}
.subpage-overlay.show { display: flex; }
.subpage-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  background: var(--bg-card); flex-shrink: 0;
  padding-top: calc(12px + var(--safe-top));
}
.subpage-back {
  background: none; border: 0; color: var(--accent);
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em;
  cursor: pointer; padding: 6px 8px; border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
}
.subpage-back:active { background: var(--accent-soft); }
.subpage-title {
  font-size: 15px; font-weight: 600; color: var(--ink);
}
.subpage-iframe {
  flex: 1; border: 0; width: 100%;
}

/* ═══ Telegram Bots ═══ */
.tg-list { display: flex; flex-direction: column; gap: 8px; }
.tg-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; background: var(--bg-card);
  border: 1px solid var(--line); border-radius: 12px;
}
.tg-emoji { font-size: 20px; flex-shrink: 0; }
.tg-info { flex: 1; min-width: 0; }
.tg-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.tg-handle { font-family: var(--mono); font-size: 10px; color: var(--ink-faint); margin-top: 2px; }
.tg-link {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.04em;
  color: var(--accent); background: var(--accent-soft);
  padding: 5px 12px; border-radius: 8px; text-decoration: none;
  flex-shrink: 0;
}

/* ═══ 系統狀態列表 ═══ */
.sys-list { display: flex; flex-direction: column; gap: 6px; }
.sys-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; background: var(--bg-card);
  border: 1px solid var(--line); border-radius: 10px;
}
.sys-emoji { font-size: 16px; flex-shrink: 0; width: 22px; text-align: center; }
.sys-name { flex: 1; font-size: 13px; color: var(--ink); }
.sys-port { font-family: var(--mono); font-size: 10px; color: var(--ink-faint); }
.sys-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-faint); flex-shrink: 0; }
.sys-dot.online { background: var(--moss); }

/* drawer badge */
.drawer-badge {
  margin-left: auto; font-family: var(--mono); font-size: 9px;
  color: var(--ink-faint); background: var(--bg-card-2);
  padding: 2px 7px; border-radius: 8px; flex-shrink: 0;
}

/* ═══ 終端面板 ═══ */
.term-overlay {
  display: none; position: fixed; inset: 0; z-index: 209;
  background: rgba(43,36,32,0.25);
}
.term-overlay.show { display: block; }

.terminal-panel {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 210;
  height: 60vh; background: #FAF6F0;
  border-radius: 18px 18px 0 0;
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 0 -8px 40px rgba(43,36,32,0.12);
}
.terminal-panel.show { transform: translateY(0); }

.term-handle {
  width: 36px; height: 4px; background: rgba(58,32,16,0.15);
  border-radius: 2px; margin: 10px auto 0; flex-shrink: 0;
}
.term-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; flex-shrink: 0;
  border-bottom: 1px solid rgba(58,32,16,0.1);
}
.term-title { font-family: var(--mono); font-size: 12px; color: rgba(58,32,16,0.4); flex-shrink: 0; }
.term-mode-switch { display: flex; gap: 4px; flex: 1; justify-content: center; }
.term-mode-btn {
  font-family: var(--mono); font-size: 11px; padding: 4px 12px;
  border-radius: 6px; border: 1px solid rgba(58,32,16,0.15);
  background: none; color: rgba(58,32,16,0.4); cursor: pointer;
  transition: all 0.15s;
}
.term-mode-btn.active { background: rgba(201,125,46,0.12); color: #c47a3a; border-color: rgba(201,125,46,0.35); font-weight: 600; }
.term-close {
  background: none; border: 0; color: rgba(58,32,16,0.3);
  font-size: 14px; cursor: pointer; padding: 4px; flex-shrink: 0;
}

.term-output {
  flex: 1; overflow-y: auto; padding: 12px 16px;
  font-family: var(--mono); font-size: 12px; line-height: 1.7;
  display: flex; flex-direction: column; gap: 8px;
}
.term-welcome { color: rgba(58,32,16,0.35); }
.term-dim { color: rgba(58,32,16,0.25); }

.term-entry { display: flex; flex-direction: column; gap: 3px; }
.term-cmd { color: #a0620a; }
.term-cmd::before { content: '$ '; color: rgba(160,98,10,0.45); }
.term-cc-q { color: #7060b0; }
.term-cc-q::before { content: '✦ '; color: rgba(112,96,176,0.45); }
.term-out { color: rgba(42,24,8,0.8); white-space: pre-wrap; word-break: break-all; }
.term-err { color: #c04040; white-space: pre-wrap; }
.term-cc-r { color: #2a1808; white-space: pre-wrap; line-height: 1.8; }
.term-tool { color: rgba(58,32,16,0.35); font-size: 11px; font-style: italic; }
.term-tool::before { content: '⟳ '; }

.term-input-row {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px calc(10px + var(--safe-bottom));
  border-top: 1px solid rgba(58,32,16,0.1); flex-shrink: 0;
}
.term-prompt { font-family: var(--mono); font-size: 13px; color: #a0620a; flex-shrink: 0; }
.term-prompt.cc { color: #7060b0; }
.term-input {
  flex: 1; background: rgba(58,32,16,0.04); border: 1px solid rgba(58,32,16,0.12);
  border-radius: 8px; padding: 8px 12px; color: #2a1808;
  font-family: var(--mono); font-size: 13px; outline: none;
}
.term-input:focus { border-color: rgba(201,125,46,0.4); }
.term-send {
  width: 34px; height: 34px; border-radius: 8px; border: 0;
  background: rgba(201,125,46,0.12); color: #c47a3a;
  font-size: 15px; cursor: pointer; flex-shrink: 0;
  display: grid; place-items: center; transition: background 0.15s;
}
.term-send:active { background: rgba(201,125,46,0.22); }

/* ═══ 工具小卡四格 ═══ */
.tool-cards {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 8px; margin-bottom: 20px;
}
.tool-card {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 16px; padding: 14px 8px 12px;
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; cursor: pointer;
  transition: all 0.18s cubic-bezier(0.34,1.56,0.64,1);
  -webkit-tap-highlight-color: transparent;
}
.tool-card:active { transform: scale(0.94); background: var(--accent-soft); border-color: var(--accent); }
.tool-card-emoji { font-size: 24px; line-height: 1; }
.tool-card-name {
  font-size: 11px; font-weight: 600; color: var(--ink);
  letter-spacing: 0.01em; text-align: center;
}
.tool-card-badge {
  font-family: var(--mono); font-size: 9px; color: var(--ink-faint);
  letter-spacing: 0.04em;
}

/* ═══ 側欄頂部主題卡 ═══ */
.psa-header-card {
  margin: 0;
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 0 0 16px 16px; padding: 16px 18px 14px;
}
.psa-day {
  font-family: var(--display); font-size: 26px; font-weight: 700;
  color: var(--accent); letter-spacing: -0.02em; font-style: italic;
  line-height: 1; margin-bottom: 10px;
}
.psa-menu-title {
  font-size: 12px; font-weight: 600; color: var(--ink-soft);
  margin-bottom: 8px;
}
.psa-menu-list { display: flex; flex-direction: column; gap: 4px; }
.psa-menu-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--ink);
}
.psa-menu-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0;
}

/* 刪除按鈕 */
.psa-sess-del {
  width: 20px; height: 20px; border-radius: 6px; border: 0;
  background: none; color: var(--ink-faint); font-size: 13px;
  cursor: pointer; flex-shrink: 0; display: grid; place-items: center;
  transition: all 0.15s; margin-left: 2px;
}
.psa-sess-del:active { background: rgba(201,99,94,0.12); color: var(--danger); }

/* ── CC 模式切换按钮 ── */
.cc-mode-btn {
  display: inline-flex; align-items: center;
  height: 22px; padding: 0 8px; border-radius: 999px;
  background: var(--bg-card-2); border: 1px solid var(--line);
  cursor: pointer; transition: all 0.15s ease;
  font-size: 11px; font-weight: 600;
  color: var(--ink-soft); opacity: 0.5; white-space: nowrap; flex-shrink: 0;
}
.cc-mode-btn:hover {
  background: var(--bg-card); border-color: var(--ink-soft); opacity: 0.8;
}
.cc-mode-btn.active {
  background: #fff3ec; border-color: #e07a3e; color: #e07a3e; opacity: 1;
}

/* ── CC 终端实时流 ── */
.term-cc-body { display: flex; flex-direction: column; gap: 4px; padding: 4px 0; }
.term-cc-tools { display: flex; flex-direction: column; gap: 2px; }
.term-cc-tool {
  font-size: 11px; color: #e07a3e; opacity: 0.7;
  font-family: monospace; padding: 1px 4px;
  border-left: 2px solid #e07a3e44;
}
.term-cc-r {
  white-space: pre-wrap; word-break: break-word;
  font-size: 13px; line-height: 1.6; color: var(--ink);
  padding: 2px 0;
}
.term-cc-q {
  color: #e07a3e; font-weight: 600; font-size: 13px;
  font-family: monospace; padding: 2px 0;
}

/* ════════════════════════════════════════
   狐说新主题 v3 · 覆盖首页样式
   ════════════════════════════════════════ */

/* 字体引入 */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;1,300;1,400&display=swap');

/* 明暗主题变量 */
:root {
  --hx-orange:      #E07A3E;
  --hx-orange-pale: #FEF2E8;
  --hx-amber:       #C4873A;
  --hx-yolk:        #F5D87A;
  --hx-yolk-pale:   #FFFAED;
  --hx-black:       #1C1408;
  --hx-black-2:     #2E2010;
  --hx-cream:       #FAF7F0;
  --hx-cream-2:     #F3EDE0;
  --hx-line:        #E8DDCA;
  --hx-ink:         #4A3520;
  --hx-ink-soft:    #7A6248;
  --hx-ink-muted:   #A89070;

  --hx-bg:          var(--hx-cream);
  --hx-card-bg:     rgba(255,255,255,0.72);
  --hx-card-border: var(--hx-line);
  --hx-text:        var(--hx-ink);
  --hx-text-soft:   var(--hx-ink-soft);
  --hx-text-muted:  var(--hx-ink-muted);
}
[data-theme="dark"] {
  --hx-bg:          #120D06;
  --hx-card-bg:     rgba(38,26,12,0.88);
  --hx-card-border: #3A2A18;
  --hx-text:        #F0E8D8;
  --hx-text-soft:   #8A7058;
  --hx-text-muted:  #5A4030;
}

body { background: var(--hx-bg) !important; transition: background 0.3s ease; }
body::before {
  content: ''; position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 10% 5%, #F5D87A20 0%, transparent 55%),
    radial-gradient(ellipse 50% 70% at 92% 85%, #E07A3E16 0%, transparent 55%);
  pointer-events: none; z-index: 0;
  transition: opacity 0.3s;
}
[data-theme="dark"] body::before { opacity: 0.35; }

/* ── 顶栏 ── */
.topbar {
  background: var(--hx-card-bg) !important;
  border-bottom: 1px solid var(--hx-card-border) !important;
  backdrop-filter: blur(12px);
  transition: background 0.3s, border-color 0.3s;
}
.topbar h1 { font-family: 'Cormorant Garamond', serif !important; font-weight: 300 !important; color: var(--hx-text) !important; }
.topbar .zh { color: var(--hx-text-muted) !important; }

/* 主题切换按钮（加在顶栏里） */
.theme-toggle-btn {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--hx-card-bg); border: 1px solid var(--hx-card-border);
  cursor: pointer; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all 0.2s;
}
.theme-toggle-btn:hover { transform: scale(1.08); }

/* ── 首页 studio 重写 ── */
.studio-page {
  padding: 16px 16px 80px !important;
  background: transparent !important;
}

/* 小组件行：日历 + 右侧 */
.hx-widget-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-bottom: 12px;
}
.hx-card {
  background: var(--hx-card-bg);
  border: 1px solid var(--hx-card-border);
  border-radius: 18px; padding: 16px;
  backdrop-filter: blur(12px);
  transition: background 0.3s, border-color 0.3s;
}
.hx-card-label {
  font-size: 9px; letter-spacing: 0.28em; text-transform: uppercase;
  color: var(--hx-text-muted); margin-bottom: 10px;
  font-family: 'Cormorant Garamond', serif;
}

/* 日历小方块 */
.hx-cal-num {
  font-family: 'Cormorant Garamond', serif;
  font-size: 24px; font-weight: 300; line-height: 1;
  color: var(--hx-orange);
}
.hx-cal-sub { font-size: 10px; color: var(--hx-text-muted); margin-top: 2px; }
.hx-cal-month { font-size: 12px; color: var(--hx-text-soft); margin-bottom: 6px; }
.hx-mini-cal { display: grid; grid-template-columns: repeat(7,1fr); gap: 1px; margin-top: 8px;
  padding-top: 8px; border-top: 1px solid var(--hx-card-border, #E8DDCA); }
.hx-mini-wd { text-align: center; font-size: 7px; color: var(--hx-text-muted); padding: 2px 0; }
.hx-mini-d {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: 8px; border-radius: 50%; color: var(--hx-text-soft);
}
.hx-mini-d.today { background: var(--hx-orange); color: white; font-weight: 500; }
.hx-together { font-size: 9px; color: var(--hx-text-muted); margin-top: 6px; }
.hx-together b { font-family: 'Cormorant Garamond', serif; font-size: 15px; color: var(--hx-orange); font-weight: 300; }

/* 右侧：昼夜 + 天数 */
.hx-right-col { display: flex; flex-direction: column; gap: 12px; }
.hx-theme-card {
  background: var(--hx-card-bg); border: 1px solid var(--hx-card-border);
  border-radius: 18px; padding: 14px 16px;
  cursor: pointer; flex: 1;
  display: flex; flex-direction: column; gap: 8px;
  transition: background 0.3s, border-color 0.3s;
}
.hx-theme-body { display: flex; align-items: center; justify-content: space-between; }
.hx-theme-icon { font-size: 26px; transition: transform 0.4s ease; }
.hx-switch {
  width: 42px; height: 22px; border-radius: 11px;
  background: var(--hx-black-2); border: 1px solid #3A2A18;
  position: relative; transition: background 0.3s;
  flex-shrink: 0;
}
[data-theme="dark"] .hx-switch { background: var(--hx-orange); border-color: var(--hx-amber); }
.hx-switch::after {
  content: ''; position: absolute;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--hx-yolk); top: 2px; left: 3px;
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
[data-theme="dark"] .hx-switch::after { transform: translateX(20px); }

.hx-day-card {
  background: var(--hx-black); border: 1px solid #3A2A18;
  border-radius: 18px; padding: 14px 16px;
  flex: 1; display: flex; flex-direction: column; gap: 3px;
}
.hx-day-num {
  font-family: 'Cormorant Garamond', serif;
  font-size: 34px; font-weight: 300; color: var(--hx-yolk); line-height: 1;
}
.hx-day-sub { font-size: 9px; color: #5A4030; }

/* ── 两列区域（设备+服务）── */
.hx-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }

/* 设备 */
.hx-batt-pct {
  font-family: 'Cormorant Garamond', serif;
  font-size: 30px; font-weight: 300; color: var(--hx-text); line-height: 1; margin-bottom: 7px;
}
.hx-batt-pct small { font-size: 12px; color: var(--hx-text-soft); }
.hx-bar-wrap { height: 5px; background: var(--hx-cream-2); border-radius: 3px; overflow: hidden; }
.hx-bar { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--hx-amber), var(--hx-yolk)); transition: width 0.5s ease; }
.hx-batt-status { font-size: 10px; color: var(--hx-text-muted); margin-top: 4px; }
.hx-app-rows { margin-top: 10px; display: flex; flex-direction: column; gap: 5px; }
.hx-app-row { display: flex; align-items: center; gap: 5px; }
.hx-app-nm { font-size: 9px; color: var(--hx-text-soft); width: 38px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hx-app-bw { flex: 1; height: 3px; background: var(--hx-cream-2); border-radius: 2px; overflow: hidden; }
.hx-app-bf { height: 100%; border-radius: 2px; }
.hx-app-t { font-size: 9px; color: var(--hx-text-muted); flex-shrink: 0; }

/* 服务 */
.hx-svc-list { display: flex; flex-direction: column; gap: 6px; }
.hx-svc-row { display: flex; align-items: center; gap: 5px; }
.hx-svc-dot { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.hx-svc-dot.on { background: #4CAF50; } .hx-svc-dot.off { background: #FF5252; }
.hx-svc-nm { font-size: 10px; color: var(--hx-text-soft); }

/* ── 记忆库 ── */
.hx-mem-section { background: var(--hx-card-bg); border: 1px solid var(--hx-card-border); border-radius: 18px; padding: 16px; margin-bottom: 12px; transition: background 0.3s, border-color 0.3s; }
.studio-memories .memory-card-item {
  padding: 10px 12px;
  background: var(--hx-orange-pale, #FEF2E8) !important;
  border-left: 3px solid var(--hx-orange) !important;
  border-radius: 0 10px 10px 0 !important;
  font-size: 12px !important; line-height: 1.6 !important; margin-bottom: 8px;
}

/* ── 留言板 ── */
.hx-msg-section { background: var(--hx-card-bg); border: 1px solid var(--hx-card-border); border-radius: 18px; padding: 16px; margin-bottom: 12px; transition: background 0.3s, border-color 0.3s; }

/* ── 工具小卡重写 ── */
.tool-cards {
  display: grid !important; grid-template-columns: repeat(4,1fr) !important;
  gap: 10px !important; margin-bottom: 12px !important;
}
.tool-card {
  background: var(--hx-card-bg) !important;
  border: 1px solid var(--hx-card-border) !important;
  border-radius: 14px !important; padding: 14px 6px !important;
  display: flex !important; flex-direction: column !important;
  align-items: center !important; gap: 5px !important;
  transition: all 0.18s, background 0.3s !important;
}
.tool-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(224,122,62,0.1); }
.tool-card-emoji { font-size: 22px !important; }
.tool-card-name { font-size: 9px !important; color: var(--hx-text-soft) !important; }
.tool-card-badge { font-size: 9px !important; color: var(--hx-orange) !important; background: var(--hx-orange-pale, #FEF2E8) !important; border-radius: 8px !important; padding: 1px 6px !important; }

/* ── 底部导航重写 ── */
.bottom-tab-bar, .tab-bar {
  background: var(--hx-black) !important;
  border-top: 1px solid #2A1A08 !important;
}
.tab-item, .bottom-tab-item {
  color: #5A4030 !important;
}
.tab-item.active, .bottom-tab-item.active {
  color: var(--hx-orange) !important;
}

/* studio section标题 */
.studio-label { font-size: 9px !important; letter-spacing: 0.28em !important; text-transform: uppercase !important; color: var(--hx-text-muted) !important; font-family: 'Cormorant Garamond', serif !important; }
.studio-label-hint { font-size: 9px !important; color: var(--hx-text-muted) !important; }
.studio-section { background: var(--hx-card-bg) !important; border: 1px solid var(--hx-card-border) !important; border-radius: 18px !important; padding: 16px !important; margin-bottom: 12px !important; backdrop-filter: blur(12px); transition: background 0.3s, border-color 0.3s; }

/* 入场动画 */
@keyframes hx-fadeUp { from{opacity:0;transform:translateY(12px)} to{opacity:1;transform:translateY(0)} }
.hx-widget-row { animation: hx-fadeUp 0.4s ease both; }
.hx-two-col { animation: hx-fadeUp 0.4s 0.08s ease both; }
.studio-section { animation: hx-fadeUp 0.4s 0.14s ease both; }

/* ── 右侧小条 ── */
.hx-right-col { display: flex; flex-direction: column; gap: 10px; }
.hx-strip-card {
  background: var(--hx-card-bg); border: 1px solid var(--hx-card-border);
  border-radius: 14px; padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
  flex: 1; transition: background 0.3s, border-color 0.3s;
  cursor: pointer;
}
.hx-day-strip { background: #F5C4A0 !important; border-color: var(--hx-yolk, #F5D87A) !important; border-width: 2px !important; cursor: default; }
[data-theme="dark"] .hx-day-strip { background: rgba(200,110,50,0.35) !important; border-color: var(--hx-yolk, #F5D87A) !important; }
.hx-strip-icon { font-size: 20px; flex-shrink: 0; }
.hx-strip-label { font-size: 10px; color: var(--hx-text-muted); flex: 1; letter-spacing: 0.1em; }
.hx-switch-sm {
  width: 36px !important; height: 20px !important; border-radius: 10px !important; flex-shrink: 0;
}
.hx-switch-sm::after { width: 14px !important; height: 14px !important; }
[data-theme="dark"] .hx-switch-sm::after { transform: translateX(16px) !important; }
.hx-strip-center { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.hx-strip-num { font-family: 'Cormorant Garamond', serif; font-size: 22px; font-weight: 300; color: #2A1408; line-height: 1; }
.hx-strip-sub { font-size: 9px; color: #2A1408; letter-spacing: 0.08em; opacity: 0.75; }

/* ── 留言板气泡 ── */
.hx-msg-bubble {
  background: var(--hx-yolk-pale, #FFFAED);
  border: 1px solid #EDE5C8;
  border-radius: 0 14px 14px 14px;
  padding: 12px 14px;
  font-family: 'Noto Serif SC', serif;
  font-style: normal; font-weight: 600; font-size: 13px; line-height: 1.8;
  color: var(--hx-ink, #4A3520);
  margin-top: 4px;
}

/* ── 日历缩小版 ── */
.hx-card { padding: 12px !important; }
.hx-cal-num { font-size: 24px !important; }
.hx-cal-month { font-size: 11px !important; margin-bottom: 4px !important; }
.hx-cal-sub { font-size: 9px !important; }
.hx-mini-cal { gap: 0px !important; margin-top: 6px !important; }
.hx-mini-wd { font-size: 6px !important; padding: 1px 0 !important; }
.hx-mini-d { font-size: 6.5px !important; }

/* ── 右侧小条缩小 ── */
.hx-strip-card { padding: 10px 12px !important; border-radius: 12px !important; }
.hx-strip-icon { font-size: 17px !important; }
.hx-strip-label { font-size: 9px !important; }
.hx-strip-num { font-size: 18px !important; }
.hx-strip-sub { font-size: 8px !important; }
.hx-switch-sm { width: 32px !important; height: 18px !important; }
.hx-switch-sm::after { width: 12px !important; height: 12px !important; }
[data-theme="dark"] .hx-switch-sm::after { transform: translateX(14px) !important; }

/* ── 强制压缩组件行高度 ── */
.hx-widget-row { align-items: start !important; }
.hx-card { max-height: none !important; overflow: visible !important; }
.hx-right-col { max-height: none !important; overflow: hidden !important; }
.hx-strip-card { min-height: 0 !important; }
.hx-right-col { justify-content: space-between !important; }

/* ════════════════════════════════
   深色模式 Chat 烫金风格
   ════════════════════════════════ */
[data-theme="dark"] .messages {
  background: #160C04 !important;
}
[data-theme="dark"] .messages::before {
  content: '';
  position: fixed; inset: 0;
  background: radial-gradient(ellipse 60% 40% at 80% 20%, #C4873A0A 0%, transparent 60%);
  pointer-events: none; z-index: 0;
}

/* 用户气泡 */
[data-theme="dark"] .msg.user .msg-body {
  background: #3D1F08 !important;
  border: 1px solid #C4873A88 !important;
  color: #F5D87A !important;
  box-shadow: 0 2px 12px rgba(196,135,58,0.15) !important;
}

/* CC气泡 */
[data-theme="dark"] .msg.assistant .msg-body {
  background: #220E03 !important;
  border: 1px solid #3A1F0A !important;
  color: #E8D5B0 !important;
}

/* 时间戳 */
[data-theme="dark"] .msg-time {
  color: #6A4020 !important;
}

/* 思考标签 */
[data-theme="dark"] .msg-thinking-label {
  color: #6A4020 !important;
}
[data-theme="dark"] .msg-thinking-body {
  background: #1E0D03 !important;
  border-color: #3A1F0A !important;
  color: #7A5530 !important;
}

/* 输入框 */
[data-theme="dark"] .input-row {
  background: #1E0D03 !important;
  border-top: 1px solid #3A1F0A !important;
}
[data-theme="dark"] #input {
  background: #2A1206 !important;
  border: 1px solid #3A1F0A !important;
  color: #E8D5B0 !important;
}
[data-theme="dark"] .composer-input-wrap {
  border: 1px solid transparent !important;
  background: rgba(42,18,6,0.6) !important;
}
[data-theme="dark"] .composer-input-wrap:focus-within {
  border-color: #5A3018 !important;
}
[data-theme="dark"] #input::placeholder {
  color: #6A4020 !important;
}
[data-theme="dark"] #sendBtn {
  background: #C4873A !important;
}

/* ══════════════════════════════════════
   Chat 页 · 隐藏顶栏 / 极简顶部控制栏
══════════════════════════════════════ */
body.in-chat header.topbar,
body.in-chat .topbar {
  display: none !important;
  height: 0 !important;
  overflow: hidden !important;
  border: none !important;
}

/* chat-header 贴到最顶部，紧凑布局 */
body.in-chat .chat-header {
  position: sticky !important;
  top: 0 !important;
  z-index: 120 !important;
  height: 64px !important;
  padding: 0 16px !important;
  border-bottom: 1px solid var(--line) !important;
  background: var(--bg-card) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  box-shadow: 0 1px 0 var(--line) !important;
  display: flex !important;
  align-items: center !important;
}

/* chat-title 横排贴满 */
body.in-chat .chat-title {
  width: 100% !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

/* 会话标题 h2：chat 页里隐藏，不需要 */
body.in-chat .chat-title h2 {
  display: none !important;
}

/* 🐾 按钮常显，paw-btn 风格 */
body.in-chat .mobile-sess-btn {
  display: grid !important;
  place-items: center !important;
  flex-shrink: 0 !important;
  width: 38px !important;
  height: 38px !important;
  border-radius: 11px !important;
  border: 1px solid var(--line) !important;
  background: var(--bg-card) !important;
  font-size: 17px !important;
  color: var(--accent) !important;
  transition: all 0.2s ease !important;
}
body.in-chat .mobile-sess-btn:hover {
  background: var(--accent-soft) !important;
  border-color: var(--accent) !important;
}
body.in-chat .mobile-sess-btn:active {
  transform: scale(0.95) !important;
}

/* model pill 可以稍微宽一些 */
body.in-chat .model-pill {
  flex: 1 !important;
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  font-size: 10px !important;
  max-width: none !important;
}

/* dark 模式 */
[data-theme="dark"] body.in-chat .chat-header,
body.in-chat [data-theme="dark"] .chat-header {
  background: #0E0602 !important;
  border-bottom-color: #2A1408 !important;
}

/* ══════════════════════════════════════════════════════
   🌙 暗金护眼模式 · 侧边栏 + 会话卡片
   调色板：
   - 背景:      #0A0503 / #120804
   - 卡片底:    rgba(28,14,4,.95)
   - 卡片边:    #2E1808
   - 主文字:    #C4873A  (亮琥珀金)
   - 副文字:    #8A6040  (中等琥珀)
   - 弱文字:    #5A3E24  (深琥珀)
   - 激活底:    rgba(48,24,6,.85)
   - 图标块:    rgba(38,18,4,.9) + #3A2010 border
══════════════════════════════════════════════════════ */

/* ── 抽屉主体 ── */
[data-theme="dark"] .drawer,
[data-theme="dark"] #drawer {
  background: #0A0503 !important;
  border-right: 1px solid #2A1408 !important;
}
[data-theme="dark"] .drawer-head {
  border-bottom-color: #2A1408 !important;
}
[data-theme="dark"] .drawer-brand h2,
[data-theme="dark"] .drawer-logo-name {
  color: #D4956A !important;
}
[data-theme="dark"] .drawer-brand .zh,
[data-theme="dark"] .drawer-logo-sub {
  color: #5A3E24 !important;
}
[data-theme="dark"] .drawer-logo {
  background: rgba(38,18,4,.9) !important;
  border: 1px solid #3A2010 !important;
}

/* ── 抽屉分组标签 ── */
[data-theme="dark"] .drawer-section,
[data-theme="dark"] .drawer-label,
[data-theme="dark"] .nav-section {
  color: #4A2E18 !important;
}
[data-theme="dark"] .drawer-divider {
  background: #1E0E04 !important;
}

/* ── 抽屉菜单项 ── */
[data-theme="dark"] .drawer-item {
  color: #7A5530 !important;
  border-color: transparent !important;
}
[data-theme="dark"] .drawer-item:hover {
  background: rgba(40,20,5,.7) !important;
  color: #C4873A !important;
  border-color: #3A2010 !important;
}
[data-theme="dark"] .drawer-item.active {
  background: rgba(50,25,6,.85) !important;
  border-color: rgba(196,135,58,.3) !important;
  color: #C4873A !important;
}

/* ── 图标小方块（核心：白底 → 暗金底） ── */
[data-theme="dark"] .drawer-item .i {
  background: rgba(38,18,4,.9) !important;
  border: 1px solid #3A2010 !important;
  color: #8A6040 !important;
}
[data-theme="dark"] .drawer-item:hover .i {
  border-color: #C4873A66 !important;
  color: #C4873A !important;
}
[data-theme="dark"] .drawer-item.active .i {
  background: rgba(60,30,8,.9) !important;
  border-color: #C4873A88 !important;
  color: #F5D87A !important;
  box-shadow: 0 2px 8px rgba(196,135,58,.2) !important;
}

/* ── 侧边 badge ── */
[data-theme="dark"] .drawer-badge {
  background: rgba(196,135,58,.15) !important;
  color: #C4873A !important;
  border-color: rgba(196,135,58,.25) !important;
}

/* ── 抽屉底栏 ── */
[data-theme="dark"] .drawer-foot,
[data-theme="dark"] .drawer-footer {
  color: #3A2010 !important;
  border-top-color: #1E0E04 !important;
}

/* ══ 会话侧边栏 ══ */
[data-theme="dark"] .sessions-sidebar,
[data-theme="dark"] #sessSidebar {
  background: #0A0503 !important;
  border-right: 1px solid #2A1408 !important;
}
[data-theme="dark"] .sessions-head {
  border-bottom-color: #2A1408 !important;
}

/* psa-header-card (DAY xx) */
[data-theme="dark"] .psa-header-card {
  background: rgba(28,14,4,.95) !important;
  border-color: #2E1808 !important;
}
[data-theme="dark"] .psa-day { color: #E07A3E !important; }
[data-theme="dark"] .psa-menu-title { color: #8A6040 !important; }
[data-theme="dark"] .psa-menu-item { color: #7A5530 !important; }
[data-theme="dark"] .psa-menu-dot { background: #C4873A !important; }

/* ── persona 分组卡片（图2中的白底大卡 → 暗金底） ── */
[data-theme="dark"] .psa-item,
[data-theme="dark"] .psa-head {
  background: rgba(28,14,4,.95) !important;
  border-color: #2E1808 !important;
}
[data-theme="dark"] .psa-item {
  border: 1px solid #2E1808 !important;
  border-radius: 14px !important;
  overflow: hidden !important;
}
[data-theme="dark"] .psa-head:active {
  background: rgba(42,20,5,.9) !important;
}

/* persona 名 + 副标 + 计数 */
[data-theme="dark"] .psa-name { color: #C4873A !important; }
[data-theme="dark"] .psa-sub  { color: #5A3E24 !important; }
[data-theme="dark"] .psa-count {
  background: rgba(196,135,58,.12) !important;
  color: #8A6040 !important;
  border: 1px solid rgba(196,135,58,.2) !important;
}
[data-theme="dark"] .psa-arrow { color: #5A3E24 !important; }
[data-theme="dark"] .psa-sessions { border-top-color: #2A1408 !important; }

/* ── + 新建会话 ── */
[data-theme="dark"] .psa-new-btn { color: #C4873A !important; }
[data-theme="dark"] .psa-new-btn:active { background: rgba(196,135,58,.1) !important; }

/* ── 会话条目 ── */
[data-theme="dark"] .psa-sess-item { background: transparent !important; }
[data-theme="dark"] .psa-sess-item:active { background: rgba(48,24,6,.8) !important; }
[data-theme="dark"] .psa-sess-item.active { background: rgba(58,28,8,.85) !important; }
[data-theme="dark"] .psa-sess-title { color: #A07848 !important; }
[data-theme="dark"] .psa-sess-item.active .psa-sess-title { color: #D4956A !important; }
[data-theme="dark"] .psa-sess-time { color: #4A2E18 !important; }
[data-theme="dark"] .psa-sess-del { color: #4A2E18 !important; }

/* ── 收起按钮 ── */
[data-theme="dark"] .psa-close-btn {
  background: rgba(28,14,4,.9) !important;
  border-color: #2E1808 !important;
  color: #7A5530 !important;
}
[data-theme="dark"] .psa-close-btn:active {
  background: rgba(48,24,6,.9) !important;
  color: #C4873A !important;
}


/* ── 标题编辑铅笔按钮 ── */
.title-edit-btn {
  background: none; border: none; cursor: pointer;
  font-size: 13px; padding: 2px 4px; border-radius: 6px;
  opacity: 0.35; transition: opacity 0.15s, background 0.15s;
  flex-shrink: 0; line-height: 1;
}
.title-edit-btn:hover { opacity: 0.85; background: var(--accent-soft); }

#chatTitle.editing {
  background: var(--bg-card-2);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 2px 8px;
  outline: none;
  min-width: 80px;
  cursor: text;
}

/* ── 会话条目重命名铅笔 ── */
.psa-sess-rename {
  background: none; border: none; cursor: pointer;
  font-size: 11px; padding: 2px 3px; border-radius: 4px;
  opacity: 0; transition: opacity 0.15s;
  flex-shrink: 0; line-height: 1; margin-left: auto;
}
.psa-sess-item:hover .psa-sess-rename { opacity: 0.5; }
.psa-sess-rename:hover { opacity: 1 !important; background: var(--accent-soft); }

.psa-sess-title[contenteditable="true"] {
  outline: none;
  background: var(--bg-card-2);
  border-radius: 4px;
  padding: 0 4px;
  border-bottom: 1px solid var(--accent);
  cursor: text;
  min-width: 60px;
  color: var(--ink);
}

/* ── 消息删除按钮 ── */
.msg-delete-btn {
  background: none; border: none; cursor: pointer;
  font-size: 14px; font-weight: 500;
  padding: 2px 5px; border-radius: 4px;
  opacity: 0; transition: opacity 0.15s, background 0.15s;
  color: var(--ink-soft);
}
.msg:hover .msg-delete-btn { opacity: 0.4; }
.msg-delete-btn:hover { opacity: 1 !important; background: #fee2e2; color: #ef4444; }

/* ── 日历便签 ── */
.hx-mini-d.has-note::after {
  content: '';
  display: block;
  width: 3px; height: 3px;
  background: var(--hx-amber, #C4873A);
  border-radius: 50%;
  position: absolute;
  bottom: 1px; left: 50%; transform: translateX(-50%);
}
.hx-mini-d { position: relative; cursor: pointer; transition: background 0.15s; }
.hx-mini-d:not(.today):hover { background: var(--hx-cream-2, #F3EDE0); }

/* 便签弹层 */
.note-modal-mask {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(30,18,6,0.35);
  backdrop-filter: blur(4px);
  display: none; align-items: flex-end; justify-content: center;
}
.note-modal-mask.open { display: flex; }
.note-modal {
  width: 100%; max-width: 480px;
  background: var(--hx-cream, #FAF7F0);
  border-radius: 20px 20px 0 0;
  padding: 20px 20px 36px;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.23,1,0.32,1);
  border-top: 1px solid var(--hx-card-border, #E8DDCA);
}
.note-modal-mask.open .note-modal { transform: translateY(0); }
.note-modal-drag { width: 36px; height: 4px; background: var(--hx-cream-2,#E8DDD0); border-radius: 2px; margin: 0 auto 18px; }
.note-modal-date {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px; font-weight: 300;
  color: var(--hx-amber, #C4873A);
  margin-bottom: 14px; letter-spacing: 0.04em;
}
.note-input-title {
  width: 100%; border: none; border-bottom: 1px solid var(--hx-card-border,#E8DDCA);
  background: transparent; font-family: 'Noto Serif SC', serif;
  font-size: 15px; color: var(--hx-text,#3A2010);
  padding: 4px 0 8px; margin-bottom: 12px; outline: none;
}
.note-input-title::placeholder { color: var(--hx-text-muted,#B09878); }
.note-input-body {
  width: 100%; border: none;
  background: transparent; font-family: 'Noto Serif SC', serif;
  font-size: 13px; color: var(--hx-text,#3A2010);
  resize: none; outline: none; line-height: 1.8;
  min-height: 64px;
}
.note-input-body::placeholder { color: var(--hx-text-muted,#B09878); }
.note-char-count {
  text-align: right; font-size: 10px;
  color: var(--hx-text-muted,#B09878);
  font-family: 'JetBrains Mono', monospace;
  margin-top: 4px; margin-bottom: 14px;
}
.note-char-count.warn { color: var(--hx-orange,#E07A3E); }
.note-modal-btns { display: flex; gap: 10px; }
.note-btn-save {
  flex: 1; padding: 10px; border-radius: 12px; border: none;
  background: var(--hx-amber,#C4873A); color: white;
  font-family: 'Noto Serif SC', serif; font-size: 14px; cursor: pointer;
  transition: opacity 0.2s;
}
.note-btn-save:active { opacity: 0.75; }
.note-btn-del {
  padding: 10px 16px; border-radius: 12px;
  border: 1px solid var(--hx-card-border,#E8DDCA);
  background: transparent; color: var(--hx-text-muted,#B09878);
  font-family: 'Noto Serif SC', serif; font-size: 13px; cursor: pointer;
}
[data-theme="dark"] .note-modal {
  background: #1C1206;
  border-color: #3A2A14;
}
[data-theme="dark"] .note-input-title,
[data-theme="dark"] .note-input-body { color: #D4B896; }
[data-theme="dark"] .note-modal-drag { background: #3A2A14; }

/* ══════════════════════════════
   首页 Dashboard 重设计
══════════════════════════════ */
#dashboardPage {
  padding: 56px 16px 80px !important;
  display: flex; flex-direction: column; gap: 0;
}

/* 头像区 */
.dash-avatar-wrap {
  display: flex; flex-direction: column;
  align-items: center; position: relative;
  margin-bottom: 16px;
}
.dash-avatar-ring {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  width: 120px; height: 120px; border-radius: 50%;
  background: var(--hx-cream-2, #F3EDE0);
  border: 2px solid var(--hx-card-border, #E8DDCA);
  overflow: hidden; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.18s, box-shadow 0.18s;
  position: relative;
}
.dash-avatar-ring:active { transform: scale(0.94); }
.dash-avatar-ring.speaking {
  box-shadow: 0 0 0 4px var(--hx-amber,#C4873A), 0 0 18px rgba(196,135,58,0.3);
  animation: avatarPulse 1.4s ease-in-out infinite;
}
@keyframes avatarPulse {
  0%,100% { box-shadow: 0 0 0 3px var(--hx-amber,#C4873A), 0 0 12px rgba(196,135,58,0.2); }
  50%      { box-shadow: 0 0 0 6px var(--hx-amber,#C4873A), 0 0 24px rgba(196,135,58,0.4); }
}
.dash-avatar-ring img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
  position: absolute; inset: 0;
}
.dash-avatar-placeholder {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px; font-size: 36px; line-height: 1;
}
.dash-plus-hint {
  font-size: 11px; color: var(--hx-text-muted,#B09878);
  font-family: 'Noto Serif SC', serif;
  letter-spacing: 0.05em; line-height: 1;
}

/* 气泡：右上角飘出 */
.dash-bubble {
  position: absolute;
  top: -8px;
  left: calc(50% + 36px);
  min-width: 120px; max-width: 200px;
  background: var(--hx-card-bg, rgba(255,255,255,0.92));
  border: 1px solid var(--hx-card-border,#E8DDCA);
  border-radius: 12px 12px 12px 4px;
  padding: 9px 12px;
  font-size: 12px;
  font-family: 'Noto Serif SC', serif;
  color: var(--hx-text, #3A2010);
  line-height: 1.7;
  box-shadow: 0 3px 16px rgba(60,30,8,0.10);
  animation: bubbleIn 0.25s cubic-bezier(0.23,1,0.32,1);
  z-index: 10;
}
@keyframes bubbleIn {
  from { opacity: 0; transform: scale(0.85) translateY(6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.dash-bubble-cursor {
  display: inline-block; width: 1.5px; height: 12px;
  background: var(--hx-amber,#C4873A);
  margin-left: 2px; vertical-align: middle;
  animation: blink 0.9s step-end infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }
.dash-bubble-cursor.done { display: none; }

/* 紧凑时钟 */
#dashClock {
  text-align: center;
  padding: 8px 0 18px;
}
#dashTimeHM {
  font-size: 72px; font-weight: 300; letter-spacing: -2px; line-height: 1;
  color: var(--hx-text, #3A2010);
  font-family: 'JetBrains Mono', monospace;
}
#dashTimeSec {
  font-size: 22px; font-weight: 300; letter-spacing: 3px;
  color: var(--hx-text-muted, #A89070);
  font-family: 'JetBrains Mono', monospace;
  margin-top: 2px;
}
#dashDateStr {
  font-size: 12px; color: var(--hx-text-muted, #A89070);
  font-family: 'Noto Serif SC', serif;
  margin-top: 6px; letter-spacing: 0.1em;
}

/* 深色适配 */
[data-theme="dark"] .dash-avatar-ring { background: #2A1A08; border-color: #3A2A14; }
[data-theme="dark"] .dash-bubble { background: rgba(38,26,12,0.92); border-color: #3A2A14; color: #D4B896; }
[data-theme="dark"] #dashTimeHM { color: #E8D5B0; }

/* 长按完成后的换图按钮 */
.dash-change-btn {
  margin-top: 8px;
  padding: 7px 22px;
  background: var(--hx-amber, #C4873A);
  color: white;
  border-radius: 20px;
  font-size: 13px;
  font-family: 'Noto Serif SC', serif;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 10px rgba(196,135,58,0.3);
  animation: bubbleIn 0.2s ease;
  letter-spacing: 0.05em;
}

/* ── 主题卡：emoji / 文字 / 开关放大 ── */
.hx-theme-strip .hx-strip-icon  { font-size: 26px !important; }
.hx-theme-strip .hx-strip-label { font-size: 13px !important; color: var(--hx-text-soft) !important; letter-spacing: 0.05em !important; }
.hx-theme-strip .hx-switch-sm   { width: 46px !important; height: 26px !important; border-radius: 13px !important; }
.hx-theme-strip .hx-switch-sm::after { width: 20px !important; height: 20px !important; }
[data-theme="dark"] .hx-theme-strip .hx-switch-sm::after { transform: translateX(20px) !important; }

/* ══════════════════════════════
   可拖拽小组件
══════════════════════════════ */
.sw-item {
  position: relative;
  touch-action: pan-y;
  transition: transform 0.2s, opacity 0.2s;
}
.sw-item.edit-mode {
  animation: swWiggle 0.4s ease-in-out infinite alternate;
  cursor: grab;
}
.sw-item.sortable-chosen { opacity: 0.85; transform: scale(1.02); }
.sw-item.sortable-ghost  { opacity: 0.3; }

@keyframes swWiggle {
  0%   { transform: rotate(-1deg); }
  100% { transform: rotate(1deg); }
}

/* 拖动手柄小点：编辑模式时才显示 */
.sw-item::before {
  content: '⠿';
  position: absolute; top: 6px; right: 10px; z-index: 20;
  font-size: 14px; color: var(--hx-amber,#C4873A);
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
  line-height: 1;
}
.sw-item.edit-mode::before { opacity: 0.6; }

/* 退出编辑的悬浮按钮 */
.sw-edit-done {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: var(--hx-amber,#C4873A); color: white;
  border: none; border-radius: 20px; padding: 9px 28px;
  font-family: 'Noto Serif SC', serif; font-size: 14px;
  box-shadow: 0 4px 16px rgba(196,135,58,0.4);
  z-index: 300; cursor: pointer; display: none;
  animation: bubbleIn 0.25s ease;
}
.sw-edit-done.show { display: block; }

/* 空槽：透明占位，有虚线边框提示可放置 */
.sw-empty-slot {
  min-height: 60px;
  border: 2px dashed transparent;
  border-radius: 14px;
  transition: border-color 0.2s;
  pointer-events: none;
}
.sw-empty-slot.edit-mode {
  border-color: var(--hx-amber, #C4873A);
  opacity: 0.4;
  pointer-events: auto;
  animation: none !important;
}
.sw-empty-slot::before { display: none !important; }

/* APP WebView 滑动修复：防止 SwipeRefreshLayout 拦截页面内部滚动 */
.page,
.page * {
  touch-action: pan-y;
}

/* 背景图透出效果 */
body.has-bg {
  background-attachment: fixed;
  background-size: cover;
  background-position: center;
}
body.has-bg .app { background-color: transparent; }
body.has-bg .page { background-color: transparent; }
body.has-bg .nav-bar { background: rgba(253,251,246,0.75) !important; backdrop-filter: blur(16px); }
body.has-bg .chat-header,
body.has-bg .chat-input-wrap { background: rgba(253,251,246,0.75) !important; backdrop-filter: blur(12px); }
body.has-bg .hx-card,
body.has-bg .hx-strip-card,
body.has-bg .hx-right-col > * { background: rgba(253,251,246,0.7) !important; backdrop-filter: blur(8px); }
body.has-bg .message-bubble { backdrop-filter: blur(4px); }
[data-theme="dark"] body.has-bg .nav-bar,
[data-theme="dark"] body.has-bg .chat-header,
[data-theme="dark"] body.has-bg .chat-input-wrap { background: rgba(30,22,18,0.75) !important; }
[data-theme="dark"] body.has-bg .hx-card,
[data-theme="dark"] body.has-bg .hx-strip-card { background: rgba(30,22,18,0.7) !important; }

/* ═══ 统一抽屉 · 双tab · 2026-05 ═══ */

/* chat-header 新标题按钮 */
.chat-console-title {
  display: flex; align-items: center; gap: 5px;
  background: none; border: none; cursor: pointer;
  padding: 5px 8px; border-radius: 10px;
  transition: background 0.15s;
  flex: 1; min-width: 0;
}
.chat-console-title:hover { background: rgba(0,0,0,0.05); }
.cct-main {
  font-family: 'Fraunces', 'Noto Serif SC', serif;
  font-size: 15px; font-weight: 600;
  color: var(--text-primary, #2C1F0E);
  white-space: nowrap;
}
.cct-model {
  font-size: 10px;
  color: var(--color-muted, #9A8070);
  background: var(--accent-bg, #F0E0C8);
  padding: 2px 7px; border-radius: 10px;
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
}
.cct-caret {
  font-size: 10px; color: var(--color-muted, #9A8070);
  transition: transform 0.25s;
  flex-shrink: 0;
}
.cct-caret.open { transform: rotate(180deg); }

/* drawer head - 加 day badge */
.drawer-head {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
}
.drawer-day-badge {
  font-family: 'Fraunces', serif;
  font-size: 12px; font-weight: 600;
  color: var(--p-color, #C97D2E);
  background: var(--accent-bg, #F0E0C8);
  padding: 4px 10px; border-radius: 20px;
  white-space: nowrap;
}

/* 双tab */
.drawer-tabs {
  display: flex;
  padding: 8px 10px 0;
  gap: 6px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-color, rgba(180,140,90,0.15));
  padding-bottom: 8px;
}
.drawer-tab {
  flex: 1;
  padding: 7px 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--color-muted, #9A8070);
  background: var(--bg-soft, #FAF6F0);
  border: 1px solid var(--border-color, rgba(180,140,90,0.15));
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.2s;
}
.drawer-tab.active {
  background: var(--p-color, #C97D2E);
  color: white;
  border-color: var(--p-color, #C97D2E);
}

/* panes */
.drawer-pane { display: none; flex: 1; overflow-y: auto; }
.drawer-pane.active { display: block; }
.drawer-pane::-webkit-scrollbar { display: none; }

/* drawer body 不再需要自己滚动 */
.drawer-body { display: none !important; }

/* drawer footer 模型全名 */
.drawer-model-full {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--color-muted, #9A8070);
  max-width: 60%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-align: right;
}

/* 修复drawer flex布局 */
.drawer {
  display: flex !important;
  flex-direction: column !important;
}
.drawer-foot { flex-shrink: 0; }

/* ═══ 色环 · 颜色自定义 · 2026-05 ═══ */

/* 右列调整：三项 */
.hx-right-col { justify-content: space-between !important; }

/* 色环容器 */
.hx-color-rings {
  display: flex; gap: 10px;
  justify-content: center; align-items: center;
  padding: 2px 0;
}

/* 单个色圆 */
.hx-color-ring {
  width: 42px; height: 42px; border-radius: 50%;
  position: relative; overflow: hidden; cursor: pointer;
  border: 2.5px solid white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.13);
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.hx-color-ring:active { transform: scale(0.9); }

/* 四色扇形预览 */
.hx-ring-preview {
  position: absolute; inset: 0;
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr;
  border-radius: 50%; overflow: hidden;
}
.hx-rq { transition: background 0.25s; }

/* 中心文字 */
.hx-ring-label {
  position: relative; z-index: 1;
  font-family: 'Fraunces', serif; font-size: 13px; font-weight: 600;
  color: white; text-shadow: 0 1px 4px rgba(0,0,0,0.5);
  pointer-events: none;
}

/* ── 弹窗 ── */
.color-modal-mask {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0); pointer-events: none;
  display: flex; align-items: flex-end; justify-content: center;
  transition: background 0.3s;
}
.color-modal-mask.show { background: rgba(0,0,0,0.35); pointer-events: auto; }

.color-modal {
  background: var(--bg-card, #fff); border-radius: 22px 22px 0 0;
  width: 100%; max-width: 480px;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
}
.color-modal-mask.show .color-modal { transform: translateY(0); }

.color-modal-handle {
  width: 36px; height: 4px; border-radius: 2px;
  background: var(--line, rgba(180,140,90,0.2));
  margin: 12px auto 0;
}
.color-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px 8px;
}
.color-modal-title {
  font-family: 'Fraunces', serif; font-size: 17px;
  color: var(--ink, #2C1F0E);
}
.color-reset-btn {
  background: none;
  border: 1px solid rgba(201,125,46,0.3);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 12px;
  color: #c47a3a;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.color-reset-btn:hover { background: rgba(201,125,46,0.1); }

.color-modal-close {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg-soft, #F5EFE6); border: none; cursor: pointer;
  font-size: 13px; color: var(--ink-soft, #9A8070);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.color-modal-close:active { background: var(--line, rgba(180,140,90,0.2)); }

.color-modal-body { padding: 0 20px 4px; }

.color-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--line, rgba(180,140,90,0.15));
}
.color-row:last-child { border: none; }
.color-row-left { display: flex; align-items: center; gap: 10px; }
.cr-icon { font-size: 16px; width: 22px; text-align: center; }
.cr-label { font-size: 13px; color: var(--ink, #2C1F0E); }

.cr-swatch {
  width: 34px; height: 34px; border-radius: 10px;
  border: 2px solid var(--line, rgba(180,140,90,0.2));
  cursor: pointer; position: relative; overflow: hidden;
  transition: transform 0.15s, border-color 0.2s;
}
.cr-swatch:active { transform: scale(0.9); }
.cr-swatch input[type="color"] {
  position: absolute; inset: -6px;
  width: calc(100% + 12px); height: calc(100% + 12px);
  opacity: 0; cursor: pointer; border: none;
}

/* 预览区 */
.color-preview-wrap {
  margin: 6px 20px 8px;
  border-radius: 14px; overflow: hidden;
  border: 1px solid var(--line, rgba(180,140,90,0.15));
}
.color-preview-chat {
  padding: 10px 12px; display: flex; flex-direction: column; gap: 6px;
  background: var(--custom-chat-bg, var(--bg, #FAF6F0));
  transition: background 0.25s;
}
.cpv-msg { display: flex; }
.cpv-me { justify-content: flex-end; }
.cpv-bubble {
  padding: 7px 12px; border-radius: 14px;
  font-size: 13px; line-height: 1.5;
  transition: background 0.25s, color 0.25s;
}
.cpv-other {
  background: var(--custom-bubble-other, #fff);
  color: var(--custom-font-chat, var(--ink, #2C1F0E));
  border-bottom-left-radius: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.cpv-mine {
  background: var(--custom-bubble-me, #F0E0C8);
  color: var(--custom-font-chat, var(--ink, #2C1F0E));
  border-bottom-right-radius: 3px;
}
/* 色环预览气泡绑定真实变量 */
.cpv-other { background: var(--bg-card, #f9f8f6) !important; color: var(--ink, #1a1715) !important; }
.cpv-mine  { background: var(--user-bubble, #f0ede8) !important; color: var(--ink, #1a1715) !important; }
.color-preview-chat { background: var(--bg, #ffffff) !important; }

/* ═══════════════════════════════════════
   模型快切按钮
════════════════════════════════════════ */
.model-quick-btn {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 20px;
  border: 1px solid rgba(201,125,46,0.35);
  background: rgba(201,125,46,0.08);
  color: #c47a3a;
  cursor: pointer;
  white-space: nowrap;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
  height: 30px;
}
.model-quick-btn:hover, .model-quick-btn:active {
  background: rgba(201,125,46,0.16);
  border-color: rgba(201,125,46,0.55);
}
[data-theme="dark"] .model-quick-btn {
  border-color: rgba(201,125,46,0.3);
  background: rgba(201,125,46,0.1);
  color: #d4936a;
}

/* ═══════════════════════════════════════
   模型选择底部弹层
════════════════════════════════════════ */
.mps-sheet {
  position: fixed;
  inset: 0;
  z-index: 9700;
  display: none;
  align-items: flex-end;
}
.mps-mask {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.35);
  opacity: 0;
  transition: opacity 0.26s;
}
.mps-sheet.open .mps-mask { opacity: 1; }

.mps-panel {
  position: relative;
  width: 100%;
  background: var(--bg, #FAF6F0);
  border-radius: 20px 20px 0 0;
  max-height: 72vh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.26s cubic-bezier(0.4,0,0.2,1);
  overflow: hidden;
}
.mps-sheet.open .mps-panel { transform: translateY(0); }
[data-theme="dark"] .mps-panel { background: #1e0e05; }

.mps-header {
  display: flex;
  align-items: center;
  padding: 16px 20px 12px;
  border-bottom: 1px solid rgba(201,125,46,0.15);
  flex-shrink: 0;
}
.mps-title { font-size: 15px; font-weight: 700; flex: 1; }
.mps-close {
  background: none; border: none; font-size: 18px;
  color: #c47a3a; cursor: pointer; padding: 4px 8px; border-radius: 8px;
}
.mps-close:hover { background: rgba(201,125,46,0.1); }

.mps-body {
  overflow-y: auto;
  padding: 16px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.mps-loading {
  text-align: center;
  padding: 24px;
  opacity: 0.5;
  font-size: 13px;
}
.mps-family {}
.mps-fam-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  opacity: 0.55;
  margin-bottom: 8px;
  text-transform: uppercase;
}
.mps-fam-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.mps-model-btn {
  padding: 8px 14px;
  border-radius: 20px;
  border: 1px solid rgba(201,125,46,0.3);
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text, #3A2010);
  transition: all 0.15s;
  font-family: 'JetBrains Mono', monospace;
}
.mps-model-btn:hover { background: rgba(201,125,46,0.1); border-color: rgba(201,125,46,0.5); }
.mps-model-btn.active {
  background: #c47a3a;
  border-color: #c47a3a;
  color: #fff;
  font-weight: 700;
}
[data-theme="dark"] .mps-model-btn { color: #C8A880; border-color: rgba(201,125,46,0.25); }
[data-theme="dark"] .mps-model-btn.active { color: #fff; }

/* ── 背景图模式：Settings 卡片毛玻璃 ── */
body.has-bg .settings-card {
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* ════ 克克主动消息弹窗 ════ */
#kekePopup {
  position: fixed;
  top: -200px;
  left: 12px; right: 12px;
  z-index: 9500;
  background: var(--bg-card);
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: 0 8px 32px rgba(43,36,32,0.18);
  padding: 16px 18px;
  transition: top 0.4s cubic-bezier(0.34,1.56,0.64,1);
  display: flex; flex-direction: column; gap: 10px;
}
#kekePopup.show { top: calc(70px + env(safe-area-inset-top, 0px)); }
.keke-popup-header {
  display: flex; align-items: center; gap: 10px;
}
.keke-popup-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--accent-soft);
  display: grid; place-items: center;
  font-size: 20px; flex-shrink: 0;
}
.keke-popup-name {
  font-size: 13px; font-weight: 700; color: var(--ink);
}
.keke-popup-time {
  font-size: 11px; color: var(--ink-faint);
  margin-left: auto;
}
.keke-popup-msg {
  font-size: 14px; color: var(--ink);
  line-height: 1.6; padding: 0 2px;
}
.keke-popup-btns {
  display: flex; gap: 8px;
}
.keke-popup-btns button {
  flex: 1; padding: 8px;
  border-radius: 10px; border: 1px solid var(--line);
  font-size: 13px; cursor: pointer;
  background: none; color: var(--ink-soft);
  transition: background 0.15s;
}
.keke-popup-btns .keke-popup-go {
  background: var(--accent); color: #fff;
  border-color: var(--accent); font-weight: 600;
}
.keke-popup-close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: none;
  color: var(--ink-faint); font-size: 16px; cursor: pointer;
}

/* ════════════════════════════════════════════════
   克克 · 底栏导航统一暖橙 (2026-05-25)
   原本四个tab各亮各色(橙/紫/红/绿)，统一为狐说暖橙。
   —— 追加覆盖，删本段即还原 ——
   ════════════════════════════════════════════════ */
#bnDashboard.active,
#bnHome.active,
#bnChat.active,
#bnSettings.active {
  color: var(--hx-orange, #E07A3E) !important;
}
/* 激活小彩点也统一暖橙 */
.bn-tab.active::before {
  background: var(--hx-orange, #E07A3E) !important;
  opacity: 0.85 !important;
}

/* ── ✦ 风格注入面板 ── */
.style-panel {
  display: none; flex-direction: column; gap: 10px;
  position: absolute; bottom: calc(100% + 8px); left: 8px; right: 8px;
  background: var(--surface, #fff); border: 1px solid var(--border, rgba(0,0,0,.1));
  border-radius: 16px; padding: 14px 16px; box-shadow: 0 4px 24px rgba(0,0,0,.12);
  z-index: 200;
}
.style-panel.open { display: flex; }
.style-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 600; color: var(--ink, #333);
}
.style-panel textarea {
  width: 100%; border: 1px solid var(--border, rgba(0,0,0,.12));
  border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.6;
  resize: vertical; min-height: 90px; background: var(--bg, #fafafa);
  color: var(--ink, #333); font-family: inherit; box-sizing: border-box;
}
.style-panel-foot {
  display: flex; align-items: center; justify-content: space-between;
}
.style-hint { font-size: 12px; color: var(--ink-faint, #999); }
.style-save-btn {
  padding: 6px 16px; border-radius: 8px; border: none; cursor: pointer;
  background: var(--accent, #c86b3a); color: #fff; font-size: 13px; font-weight: 600;
}
.style-toggle { display: flex; align-items: center; cursor: pointer; }
.style-toggle input { display: none; }
.style-toggle-track {
  width: 36px; height: 20px; border-radius: 10px; background: #ccc;
  position: relative; transition: background .2s;
}
.style-toggle input:checked + .style-toggle-track { background: var(--accent, #c86b3a); }
.style-toggle-thumb {
  position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.style-toggle input:checked + .style-toggle-track .style-toggle-thumb { left: 18px; }

/* ── ✦ 风格面板 v2 多预设 ── */
.style-chips {
  display: flex; flex-wrap: wrap; gap: 7px; padding: 2px 0 4px;
}
.style-chip {
  padding: 5px 13px; border-radius: 20px; border: 1.5px solid var(--border, rgba(0,0,0,.12));
  background: var(--bg, #fafafa); color: var(--ink, #333);
  font-size: 13px; cursor: pointer; transition: all .15s;
  white-space: nowrap;
}
.style-chip:hover { border-color: var(--accent, #c86b3a); color: var(--accent, #c86b3a); }
.style-chip.active {
  background: var(--accent, #c86b3a); color: #fff; border-color: var(--accent, #c86b3a);
}
.style-chip-add {
  font-size: 18px; padding: 2px 12px; opacity: .5;
}
.style-chip-add:hover { opacity: 1; }
.style-editor {
  display: flex; flex-direction: column; gap: 8px; margin-top: 4px;
}
.style-editor input[type=text] {
  border: 1px solid var(--border, rgba(0,0,0,.12)); border-radius: 8px;
  padding: 7px 10px; font-size: 13px; background: var(--bg, #fafafa);
  color: var(--ink, #333); font-family: inherit;
}
.style-editor textarea {
  width: 100%; border: 1px solid var(--border, rgba(0,0,0,.12));
  border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.6;
  resize: vertical; min-height: 80px; background: var(--bg, #fafafa);
  color: var(--ink, #333); font-family: inherit; box-sizing: border-box;
}
.style-editor-foot { display: flex; justify-content: space-between; align-items: center; }
.style-del-btn {
  padding: 6px 12px; border-radius: 8px; border: 1px solid var(--red,#e57373);
  color: var(--red,#e57373); background: transparent; font-size: 12px; cursor: pointer;
}
