@import url('https://fonts.googleapis.com/css2?family=Chivo+Mono:wght@400;700;800&display=swap');

/* ============================================
   CC-Web — 和風暖色調 (Japanese Warm Theme)
   ============================================ */

:root {
  /* --- 配色 --- */
  --bg-primary: #faf6f0;           /* 象牙 ivory */
  --bg-secondary: #f2ebe2;         /* 亜麻 flax */
  --bg-tertiary: #e9e0d4;          /* 砂 sand */
  --bg-bubble-user: #c0553a;       /* 朱色 vermillion */
  --bg-bubble-assistant: #fff9f2;  /* 練色 warm white */
  --text-primary: #2d1f14;         /* 黒茶 dark brown */
  --text-secondary: #6b5a4d;       /* 栗色 chestnut */
  --text-muted: #9a8b7d;           /* 灰茶 gray-brown */
  --border-color: #ddd0c0;         /* 枯色 withered */
  --accent: #c0553a;               /* 朱色 vermillion */
  --accent-hover: #a84530;         /* 深朱 deep vermillion */
  --accent-light: #f5ddd4;         /* 薄朱 light vermillion */
  --success: #5d8a54;              /* 抹茶 matcha */
  --danger: #c0553a;
  --info: #5b7ea1;                 /* 縹色 blue-gray */
  --note-accent: #5b7ea1;
  --note-accent-hover: #486b8f;
  --note-bg: rgba(91, 126, 161, 0.1);
  --note-bg-strong: rgba(91, 126, 161, 0.16);
  --note-border: rgba(91, 126, 161, 0.24);
  --scrollbar-thumb: #c9baa9;
  --scrollbar-track: transparent;
  --sidebar-width: 280px;
  --header-height: 52px;
  --input-max-height: 200px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Noto Sans CJK SC', Roboto, sans-serif;
  --page-background: #faf6f0;
  --login-background: linear-gradient(135deg, #faf6f0 0%, #f0e8dc 50%, #e8dccf 100%);
  --surface-strong: #fff;
  --shadow-strong: 0 8px 32px rgba(45, 31, 20, 0.08);
  --theme-card-bg: rgba(255, 249, 242, 0.72);
  --theme-card-border: rgba(221, 208, 192, 0.92);
  --theme-card-hover-border: rgba(192, 85, 58, 0.32);
  --theme-card-active-ring: rgba(192, 85, 58, 0.12);
  --loading-overlay-layer-a: rgba(250, 246, 240, 0.76);
  --loading-overlay-layer-b: rgba(233, 224, 212, 0.82);
  --loading-overlay-scrim: rgba(45, 31, 20, 0.18);
  --loading-card-bg: linear-gradient(180deg, rgba(255, 250, 245, 0.98), rgba(249, 242, 233, 0.95));
  --loading-card-border: rgba(192, 85, 58, 0.16);
  --loading-card-shadow: 0 24px 60px rgba(45, 31, 20, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.75);
  --loading-badge-bg: rgba(245, 221, 212, 0.92);
  --loading-badge-text: var(--accent);
  --loading-bar-bg: rgba(221, 208, 192, 0.85);
  --loading-bar-fill: linear-gradient(90deg, #c0553a, #d98666, #c0553a);
}

html[data-theme='coolvibe'] {
  --bg-primary: #eef7f9;
  --bg-secondary: #f7fbfc;
  --bg-tertiary: #dfeef2;
  --bg-bubble-user: #0891b2;
  --bg-bubble-assistant: #ffffff;
  --text-primary: #0d1b1f;
  --text-secondary: #46606a;
  --text-muted: #6f8790;
  --border-color: #cfe0e6;
  --accent: #0891b2;
  --accent-hover: #0b7289;
  --accent-light: rgba(8, 145, 178, 0.12);
  --success: #2e8a61;
  --danger: #d65567;
  --info: #1976a4;
  --note-accent: #2e8a61;
  --note-accent-hover: #226547;
  --note-bg: rgba(46, 138, 97, 0.1);
  --note-bg-strong: rgba(46, 138, 97, 0.16);
  --note-border: rgba(46, 138, 97, 0.24);
  --scrollbar-thumb: #a7c4ce;
  --font-ui: 'Chivo Mono', ui-monospace, monospace;
  --page-background:
    radial-gradient(circle at top, rgba(8, 145, 178, 0.12), transparent 34%),
    linear-gradient(180deg, #f6fbfc, #eef7f9 46%, #e8f3f6);
  --login-background:
    radial-gradient(circle at center, rgba(8, 145, 178, 0.1), transparent 40%),
    linear-gradient(180deg, #fbfeff, #eef7f9);
  --surface-strong: #ffffff;
  --shadow-strong: 0 18px 40px rgba(9, 54, 69, 0.12);
  --theme-card-bg: rgba(255, 255, 255, 0.88);
  --theme-card-border: rgba(207, 224, 230, 0.96);
  --theme-card-hover-border: rgba(8, 145, 178, 0.32);
  --theme-card-active-ring: rgba(8, 145, 178, 0.14);
  --loading-overlay-layer-a: rgba(241, 251, 253, 0.78);
  --loading-overlay-layer-b: rgba(219, 239, 244, 0.84);
  --loading-overlay-scrim: rgba(10, 52, 67, 0.16);
  --loading-card-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(240, 249, 251, 0.96));
  --loading-card-border: rgba(8, 145, 178, 0.18);
  --loading-card-shadow: 0 24px 60px rgba(10, 52, 67, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.84);
  --loading-badge-bg: rgba(8, 145, 178, 0.12);
  --loading-badge-text: #0a6d83;
  --loading-bar-bg: rgba(191, 220, 228, 0.92);
  --loading-bar-fill: linear-gradient(90deg, #0891b2, #34c4de, #0891b2);
}

html[data-theme='coolvibe'] body {
  letter-spacing: -0.01em;
}

html[data-theme='coolvibe'] .login-box,
html[data-theme='coolvibe'] .settings-panel,
html[data-theme='coolvibe'] .modal-panel,
html[data-theme='coolvibe'] .option-picker,
html[data-theme='coolvibe'] .chat-agent-menu {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 250, 252, 0.96));
  border-color: rgba(191, 220, 228, 0.96);
  box-shadow:
    0 18px 44px rgba(11, 73, 92, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

html[data-theme='coolvibe'] .sidebar {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(242, 249, 251, 0.98));
  border-right-color: rgba(191, 220, 228, 0.98);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.8);
}

html[data-theme='coolvibe'] .sidebar-header,
html[data-theme='coolvibe'] .sidebar-footer {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(244, 250, 252, 0.8));
  border-color: rgba(191, 220, 228, 0.96);
}

html[data-theme='coolvibe'] .brand {
  color: #5f7f87;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

html[data-theme='coolvibe'] .new-chat-btn,
html[data-theme='coolvibe'] .send-btn {
  background:
    linear-gradient(135deg, #0a8fb0, #11b8d7);
  color: #f7feff;
  border: 1px solid rgba(8, 145, 178, 0.1);
  box-shadow:
    0 10px 22px rgba(8, 145, 178, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

html[data-theme='coolvibe'] .new-chat-btn:hover,
html[data-theme='coolvibe'] .send-btn:hover {
  background:
    linear-gradient(135deg, #0b7f9b, #0fa6c3);
}

html[data-theme='coolvibe'] .attach-btn,
html[data-theme='coolvibe'] .abort-btn,
html[data-theme='coolvibe'] .settings-btn,
html[data-theme='coolvibe'] .new-chat-arrow {
  background: rgba(8, 145, 178, 0.08);
  color: #0c6980;
  border: 1px solid rgba(167, 205, 216, 0.84);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

html[data-theme='coolvibe'] .attach-btn:hover,
html[data-theme='coolvibe'] .abort-btn:hover,
html[data-theme='coolvibe'] .settings-btn:hover,
html[data-theme='coolvibe'] .new-chat-arrow:hover {
  background: rgba(8, 145, 178, 0.16);
  color: #0b5060;
}

html[data-theme='coolvibe'] .session-list-empty,
html[data-theme='coolvibe'] .attachment-tray-note {
  background: rgba(249, 253, 254, 0.92);
  border-color: rgba(191, 220, 228, 0.96);
}

html[data-theme='coolvibe'] .session-search-input {
  background: rgba(249, 253, 254, 0.86);
  border-color: rgba(191, 220, 228, 0.96);
}

html[data-theme='coolvibe'] .session-search::before {
  color: #6d8d95;
}

html[data-theme='coolvibe'] .session-search-input:focus {
  border-color: rgba(8, 145, 178, 0.36);
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.1);
}

html[data-theme='coolvibe'] .session-search-clear:hover,
html[data-theme='coolvibe'] .session-search-clear:focus-visible {
  background: rgba(8, 145, 178, 0.12);
  color: #0a6d83;
}

html[data-theme='coolvibe'] .session-project-header {
  background: linear-gradient(180deg, rgba(247, 251, 252, 0.94), rgba(239, 248, 250, 0.88));
  border-color: rgba(156, 199, 211, 0.9);
  color: #335e69;
}

html[data-theme='coolvibe'] .session-project-count {
  background: rgba(8, 145, 178, 0.1);
  color: #0a6d83;
}

html[data-theme='coolvibe'] .session-item {
  border: 1px solid transparent;
  border-radius: 14px;
}

html[data-theme='coolvibe'] .session-item:hover {
  background: rgba(8, 145, 178, 0.08);
  border-color: rgba(191, 220, 228, 0.82);
}

html[data-theme='coolvibe'] .session-item.active {
  background:
    linear-gradient(135deg, rgba(8, 145, 178, 0.12), rgba(8, 145, 178, 0.04));
  border-color: rgba(8, 145, 178, 0.26);
  box-shadow: inset 3px 0 0 #08b7d6;
}

html[data-theme='coolvibe'] .session-item.active .session-item-title {
  color: #0a6d83;
}

html[data-theme='coolvibe'] .chat-main {
  background:
    radial-gradient(circle at top, rgba(8, 145, 178, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(251, 254, 255, 0.92), rgba(238, 247, 249, 0.96));
}

html[data-theme='coolvibe'] .chat-header {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(244, 250, 252, 0.88));
  border-bottom-color: rgba(191, 220, 228, 0.96);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.84);
}

html[data-theme='coolvibe'] .chat-title {
  font-weight: 800;
  letter-spacing: -0.02em;
}

html[data-theme='coolvibe'] .chat-title:hover {
  background: rgba(8, 145, 178, 0.08);
}

html[data-theme='coolvibe'] .chat-agent-btn,
html[data-theme='coolvibe'] .mode-select {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(234, 247, 251, 0.92));
  border-color: rgba(167, 205, 216, 0.92);
  color: #0c6478;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.94);
}

html[data-theme='coolvibe'] .chat-agent-btn:hover,
html[data-theme='coolvibe'] .mode-select:hover {
  background: rgba(228, 244, 248, 0.98);
}

html[data-theme='coolvibe'] .chat-runtime-state {
  background: rgba(46, 138, 97, 0.12);
  border-color: rgba(46, 138, 97, 0.22);
  color: #226547;
}

html[data-theme='coolvibe'] .chat-cwd {
  background: rgba(8, 145, 178, 0.08);
  border: 1px solid rgba(167, 205, 216, 0.78);
  color: #46606a;
}

html[data-theme='coolvibe'] .input-area {
  background:
    linear-gradient(180deg, rgba(251, 254, 255, 0.96), rgba(240, 248, 250, 0.96));
  border-top-color: rgba(191, 220, 228, 0.96);
}

html[data-theme='coolvibe'] .input-wrapper {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 251, 253, 0.96));
  border-color: rgba(167, 205, 216, 0.96);
  border-radius: 18px;
  box-shadow:
    0 10px 28px rgba(11, 73, 92, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

html[data-theme='coolvibe'] .input-wrapper:focus-within {
  border-color: rgba(8, 145, 178, 0.56);
  box-shadow:
    0 14px 30px rgba(8, 145, 178, 0.12),
    0 0 0 4px rgba(8, 145, 178, 0.08);
}

html[data-theme='coolvibe'] .msg.user .msg-bubble {
  background:
    linear-gradient(135deg, #0891b2, #11b8d7);
  box-shadow: 0 12px 22px rgba(8, 145, 178, 0.16);
}

html[data-theme='coolvibe'] .msg.assistant .msg-bubble {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 252, 253, 0.96));
  border-color: rgba(191, 220, 228, 0.96);
  box-shadow: 0 10px 24px rgba(11, 73, 92, 0.08);
}

html[data-theme='coolvibe'] .settings-actions .btn-save {
  background:
    linear-gradient(135deg, #0a8fb0, #11b8d7);
  box-shadow: 0 10px 22px rgba(8, 145, 178, 0.18);
}

html[data-theme='coolvibe'] .settings-actions .btn-test {
  background: rgba(8, 145, 178, 0.08);
  border-color: rgba(167, 205, 216, 0.9);
  color: #0c6478;
}

html[data-theme='coolvibe'] .theme-card:hover {
  border-color: rgba(8, 145, 178, 0.32);
  box-shadow: 0 10px 24px rgba(8, 145, 178, 0.1);
}

html[data-theme='coolvibe'] .theme-card.active {
  box-shadow: 0 0 0 2px rgba(8, 145, 178, 0.14);
}

html[data-theme='editorial'] .session-project-header {
  background: linear-gradient(180deg, rgba(239, 232, 220, 0.94), rgba(246, 241, 232, 0.84));
  border-color: rgba(139, 94, 60, 0.22);
  color: #4f4035;
}

html[data-theme='editorial'] .session-project-count {
  background: rgba(139, 94, 60, 0.1);
  color: #71482d;
}

html[data-theme='editorial'] {
  --bg-primary: #f6f1e8;
  --bg-secondary: #efe8dc;
  --bg-tertiary: #e2d8c7;
  --bg-bubble-user: #2f4b45;
  --bg-bubble-assistant: #fbf7f0;
  --text-primary: #201b17;
  --text-secondary: #5a5148;
  --text-muted: #8a7d71;
  --border-color: #d8ccba;
  --accent: #8b5e3c;
  --accent-hover: #71482d;
  --accent-light: rgba(139, 94, 60, 0.14);
  --success: #4d7b57;
  --danger: #c05c42;
  --info: #4f6f87;
  --note-accent: #4f6f87;
  --note-accent-hover: #3d596f;
  --note-bg: rgba(79, 111, 135, 0.1);
  --note-bg-strong: rgba(79, 111, 135, 0.16);
  --note-border: rgba(79, 111, 135, 0.24);
  --scrollbar-thumb: #bba995;
  --font-ui: 'Avenir Next', 'Segoe UI', 'PingFang SC', sans-serif;
  --page-background:
    radial-gradient(circle at top left, rgba(139, 94, 60, 0.08), transparent 38%),
    linear-gradient(180deg, #f8f3eb, #f2ebe0 48%, #f6f1e8);
  --login-background:
    linear-gradient(135deg, #f7f1e7 0%, #ede4d6 50%, #e6dbcb 100%);
  --surface-strong: #fffdf8;
  --shadow-strong: 0 14px 36px rgba(50, 32, 20, 0.1);
  --theme-card-bg: rgba(255, 252, 246, 0.88);
  --theme-card-border: rgba(216, 204, 186, 0.96);
  --theme-card-hover-border: rgba(139, 94, 60, 0.32);
  --theme-card-active-ring: rgba(139, 94, 60, 0.12);
  --loading-overlay-layer-a: rgba(247, 241, 231, 0.8);
  --loading-overlay-layer-b: rgba(230, 219, 203, 0.84);
  --loading-overlay-scrim: rgba(46, 36, 27, 0.16);
  --loading-card-bg: linear-gradient(180deg, rgba(255, 252, 247, 0.98), rgba(246, 238, 225, 0.96));
  --loading-card-border: rgba(139, 94, 60, 0.16);
  --loading-card-shadow: 0 24px 60px rgba(50, 32, 20, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  --loading-badge-bg: rgba(139, 94, 60, 0.12);
  --loading-badge-text: #8b5e3c;
  --loading-bar-bg: rgba(216, 204, 186, 0.92);
  --loading-bar-fill: linear-gradient(90deg, #8b5e3c, #c59470, #8b5e3c);
}

html[data-theme='sage'] {
  --bg-primary: #f5f8f2;
  --bg-secondary: #edf3e8;
  --bg-tertiary: #dce8d6;
  --bg-bubble-user: #2f6f64;
  --bg-bubble-assistant: #fbfdf8;
  --text-primary: #18231f;
  --text-secondary: #50635c;
  --text-muted: #7d9088;
  --border-color: #cad9ce;
  --accent: #2f6f64;
  --accent-hover: #24584f;
  --accent-light: rgba(47, 111, 100, 0.13);
  --success: #5c8a4e;
  --danger: #b65b55;
  --info: #557ba3;
  --note-accent: #557ba3;
  --note-accent-hover: #416380;
  --note-bg: rgba(85, 123, 163, 0.1);
  --note-bg-strong: rgba(85, 123, 163, 0.16);
  --note-border: rgba(85, 123, 163, 0.24);
  --scrollbar-thumb: #aec4b7;
  --page-background:
    radial-gradient(circle at top left, rgba(47, 111, 100, 0.1), transparent 38%),
    linear-gradient(180deg, #f9fbf5, #eef5ea 48%, #f5f8f2);
  --login-background:
    linear-gradient(135deg, #f9fbf5 0%, #edf4e8 52%, #dfe9d9 100%);
  --surface-strong: #fffefb;
  --shadow-strong: 0 14px 36px rgba(32, 64, 54, 0.11);
  --theme-card-bg: rgba(255, 254, 251, 0.86);
  --theme-card-border: rgba(202, 217, 206, 0.96);
  --theme-card-hover-border: rgba(47, 111, 100, 0.32);
  --theme-card-active-ring: rgba(47, 111, 100, 0.13);
  --loading-overlay-layer-a: rgba(245, 248, 242, 0.8);
  --loading-overlay-layer-b: rgba(220, 232, 214, 0.84);
  --loading-overlay-scrim: rgba(24, 35, 31, 0.16);
  --loading-card-bg: linear-gradient(180deg, rgba(255, 254, 251, 0.98), rgba(239, 246, 234, 0.96));
  --loading-card-border: rgba(47, 111, 100, 0.17);
  --loading-card-shadow: 0 24px 60px rgba(32, 64, 54, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.82);
  --loading-badge-bg: rgba(47, 111, 100, 0.12);
  --loading-badge-text: #2f6f64;
  --loading-bar-bg: rgba(202, 217, 206, 0.92);
  --loading-bar-fill: linear-gradient(90deg, #2f6f64, #6aa889, #2f6f64);
}

html[data-theme='ink'] {
  --bg-primary: #f6f7fb;
  --bg-secondary: #eef1f7;
  --bg-tertiary: #dde3ef;
  --bg-bubble-user: #3f5fb5;
  --bg-bubble-assistant: #ffffff;
  --text-primary: #171923;
  --text-secondary: #515b6d;
  --text-muted: #7b8495;
  --border-color: #d2d8e6;
  --accent: #3f5fb5;
  --accent-hover: #324d93;
  --accent-light: rgba(63, 95, 181, 0.12);
  --success: #3f8f73;
  --danger: #c35062;
  --info: #456aa6;
  --note-accent: #3f8f73;
  --note-accent-hover: #2f6e58;
  --note-bg: rgba(63, 143, 115, 0.1);
  --note-bg-strong: rgba(63, 143, 115, 0.16);
  --note-border: rgba(63, 143, 115, 0.24);
  --scrollbar-thumb: #b5bfd3;
  --page-background:
    radial-gradient(circle at top right, rgba(63, 95, 181, 0.1), transparent 36%),
    linear-gradient(180deg, #fbfcff, #eef1f7 48%, #f6f7fb);
  --login-background:
    linear-gradient(135deg, #fbfcff 0%, #eef1f7 52%, #e3e8f3 100%);
  --surface-strong: #ffffff;
  --shadow-strong: 0 16px 38px rgba(31, 42, 72, 0.11);
  --theme-card-bg: rgba(255, 255, 255, 0.88);
  --theme-card-border: rgba(210, 216, 230, 0.96);
  --theme-card-hover-border: rgba(63, 95, 181, 0.32);
  --theme-card-active-ring: rgba(63, 95, 181, 0.13);
  --loading-overlay-layer-a: rgba(246, 247, 251, 0.8);
  --loading-overlay-layer-b: rgba(221, 227, 239, 0.84);
  --loading-overlay-scrim: rgba(23, 25, 35, 0.16);
  --loading-card-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(241, 244, 250, 0.96));
  --loading-card-border: rgba(63, 95, 181, 0.17);
  --loading-card-shadow: 0 24px 60px rgba(31, 42, 72, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.84);
  --loading-badge-bg: rgba(63, 95, 181, 0.12);
  --loading-badge-text: #3f5fb5;
  --loading-bar-bg: rgba(210, 216, 230, 0.92);
  --loading-bar-fill: linear-gradient(90deg, #3f5fb5, #6e86d6, #3f5fb5);
}

html[data-theme='dawn'] {
  --bg-primary: #fff7f2;
  --bg-secondary: #f6ede7;
  --bg-tertiary: #eadbd2;
  --bg-bubble-user: #b5524d;
  --bg-bubble-assistant: #fffaf6;
  --text-primary: #2b2220;
  --text-secondary: #665753;
  --text-muted: #947f79;
  --border-color: #decac0;
  --accent: #b5524d;
  --accent-hover: #94403d;
  --accent-light: rgba(181, 82, 77, 0.13);
  --success: #4f8a6b;
  --danger: #ba4e58;
  --info: #597da5;
  --note-accent: #4f8a6b;
  --note-accent-hover: #3c6b52;
  --note-bg: rgba(79, 138, 107, 0.1);
  --note-bg-strong: rgba(79, 138, 107, 0.16);
  --note-border: rgba(79, 138, 107, 0.24);
  --scrollbar-thumb: #cdb6ad;
  --page-background:
    radial-gradient(circle at top left, rgba(181, 82, 77, 0.08), transparent 36%),
    linear-gradient(180deg, #fffaf6, #f7ede6 48%, #fff7f2);
  --login-background:
    linear-gradient(135deg, #fffaf6 0%, #f6ebe4 52%, #eadbd2 100%);
  --surface-strong: #ffffff;
  --shadow-strong: 0 14px 36px rgba(86, 47, 42, 0.11);
  --theme-card-bg: rgba(255, 250, 246, 0.88);
  --theme-card-border: rgba(222, 202, 192, 0.96);
  --theme-card-hover-border: rgba(181, 82, 77, 0.32);
  --theme-card-active-ring: rgba(181, 82, 77, 0.13);
  --loading-overlay-layer-a: rgba(255, 247, 242, 0.8);
  --loading-overlay-layer-b: rgba(234, 219, 210, 0.84);
  --loading-overlay-scrim: rgba(43, 34, 32, 0.16);
  --loading-card-bg: linear-gradient(180deg, rgba(255, 250, 246, 0.98), rgba(247, 237, 230, 0.96));
  --loading-card-border: rgba(181, 82, 77, 0.17);
  --loading-card-shadow: 0 24px 60px rgba(86, 47, 42, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.82);
  --loading-badge-bg: rgba(181, 82, 77, 0.12);
  --loading-badge-text: #b5524d;
  --loading-bar-bg: rgba(222, 202, 192, 0.92);
  --loading-bar-fill: linear-gradient(90deg, #b5524d, #de8f7a, #b5524d);
}

html[data-theme='carbon'] {
  color-scheme: dark;
  --bg-primary: #0f1314;
  --bg-secondary: #151a1b;
  --bg-tertiary: #202829;
  --bg-bubble-user: #247b66;
  --bg-bubble-assistant: #171d1e;
  --text-primary: #edf5ef;
  --text-secondary: #b7c7c0;
  --text-muted: #82938b;
  --border-color: #2b3836;
  --accent: #67d8b2;
  --accent-hover: #52c69f;
  --accent-light: rgba(103, 216, 178, 0.16);
  --success: #74c989;
  --danger: #ff7b73;
  --info: #9fb7ff;
  --note-accent: #9fb7ff;
  --note-accent-hover: #bdcbff;
  --note-bg: rgba(159, 183, 255, 0.12);
  --note-bg-strong: rgba(159, 183, 255, 0.18);
  --note-border: rgba(159, 183, 255, 0.28);
  --scrollbar-thumb: #41514f;
  --page-background:
    radial-gradient(circle at top left, rgba(103, 216, 178, 0.12), transparent 34%),
    linear-gradient(180deg, #111819, #0f1314 50%, #0b0e0f);
  --login-background:
    radial-gradient(circle at top, rgba(103, 216, 178, 0.13), transparent 38%),
    linear-gradient(135deg, #111819 0%, #0f1314 54%, #0a0c0d 100%);
  --surface-strong: #171d1e;
  --shadow-strong: 0 22px 54px rgba(0, 0, 0, 0.38);
  --theme-card-bg: rgba(23, 29, 30, 0.9);
  --theme-card-border: rgba(75, 96, 92, 0.74);
  --theme-card-hover-border: rgba(103, 216, 178, 0.38);
  --theme-card-active-ring: rgba(103, 216, 178, 0.18);
  --loading-overlay-layer-a: rgba(15, 19, 20, 0.86);
  --loading-overlay-layer-b: rgba(32, 40, 41, 0.82);
  --loading-overlay-scrim: rgba(0, 0, 0, 0.34);
  --loading-card-bg: linear-gradient(180deg, rgba(25, 32, 33, 0.98), rgba(17, 23, 24, 0.96));
  --loading-card-border: rgba(103, 216, 178, 0.2);
  --loading-card-shadow: 0 28px 70px rgba(0, 0, 0, 0.44), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --loading-badge-bg: rgba(103, 216, 178, 0.14);
  --loading-badge-text: #86e8c6;
  --loading-bar-bg: rgba(65, 81, 79, 0.92);
  --loading-bar-fill: linear-gradient(90deg, #67d8b2, #9fb7ff, #67d8b2);
  --accent-ink: #071512;
  --dark-panel-bg: rgba(23, 29, 30, 0.96);
  --dark-panel-soft: rgba(28, 36, 37, 0.92);
  --dark-shadow-soft: 0 14px 32px rgba(0, 0, 0, 0.28);
}

html[data-theme='nocturne'] {
  color-scheme: dark;
  --bg-primary: #081417;
  --bg-secondary: #0d1d22;
  --bg-tertiary: #142b31;
  --bg-bubble-user: #116f92;
  --bg-bubble-assistant: #0f2025;
  --text-primary: #edf8fa;
  --text-secondary: #b1c8cf;
  --text-muted: #76929b;
  --border-color: #263c43;
  --accent: #5ecdf5;
  --accent-hover: #45b9e4;
  --accent-light: rgba(94, 205, 245, 0.15);
  --success: #67d9a4;
  --danger: #fb7185;
  --info: #8fb9ff;
  --note-accent: #f0c36a;
  --note-accent-hover: #ffd57d;
  --note-bg: rgba(240, 195, 106, 0.12);
  --note-bg-strong: rgba(240, 195, 106, 0.18);
  --note-border: rgba(240, 195, 106, 0.28);
  --scrollbar-thumb: #39525a;
  --page-background:
    radial-gradient(circle at top right, rgba(94, 205, 245, 0.12), transparent 34%),
    linear-gradient(180deg, #0b1b20, #081417 52%, #050b0d);
  --login-background:
    radial-gradient(circle at center, rgba(94, 205, 245, 0.12), transparent 38%),
    linear-gradient(135deg, #0b1b20 0%, #081417 55%, #050b0d 100%);
  --surface-strong: #0f2025;
  --shadow-strong: 0 22px 54px rgba(0, 0, 0, 0.4);
  --theme-card-bg: rgba(15, 32, 37, 0.9);
  --theme-card-border: rgba(55, 84, 93, 0.76);
  --theme-card-hover-border: rgba(94, 205, 245, 0.38);
  --theme-card-active-ring: rgba(94, 205, 245, 0.18);
  --loading-overlay-layer-a: rgba(8, 20, 23, 0.86);
  --loading-overlay-layer-b: rgba(20, 43, 49, 0.82);
  --loading-overlay-scrim: rgba(0, 0, 0, 0.35);
  --loading-card-bg: linear-gradient(180deg, rgba(16, 34, 39, 0.98), rgba(9, 22, 26, 0.96));
  --loading-card-border: rgba(94, 205, 245, 0.2);
  --loading-card-shadow: 0 28px 70px rgba(0, 0, 0, 0.46), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --loading-badge-bg: rgba(94, 205, 245, 0.14);
  --loading-badge-text: #7ddcff;
  --loading-bar-bg: rgba(57, 82, 90, 0.92);
  --loading-bar-fill: linear-gradient(90deg, #5ecdf5, #f0c36a, #5ecdf5);
  --accent-ink: #041216;
  --dark-panel-bg: rgba(15, 32, 37, 0.96);
  --dark-panel-soft: rgba(19, 42, 48, 0.92);
  --dark-shadow-soft: 0 14px 32px rgba(0, 0, 0, 0.3);
}

html[data-theme='cinder'] {
  color-scheme: dark;
  --bg-primary: #151112;
  --bg-secondary: #1f1719;
  --bg-tertiary: #2a2022;
  --bg-bubble-user: #9f4051;
  --bg-bubble-assistant: #21191b;
  --text-primary: #f6eeee;
  --text-secondary: #cbb9bb;
  --text-muted: #927e82;
  --border-color: #3d2d31;
  --accent: #e68193;
  --accent-hover: #d36c7f;
  --accent-light: rgba(230, 129, 147, 0.16);
  --success: #67c587;
  --danger: #ff7b86;
  --info: #8eb4e8;
  --note-accent: #67c587;
  --note-accent-hover: #83d99d;
  --note-bg: rgba(103, 197, 135, 0.12);
  --note-bg-strong: rgba(103, 197, 135, 0.18);
  --note-border: rgba(103, 197, 135, 0.28);
  --scrollbar-thumb: #584148;
  --page-background:
    radial-gradient(circle at top left, rgba(230, 129, 147, 0.11), transparent 34%),
    linear-gradient(180deg, #1c1517, #151112 52%, #0d0a0b);
  --login-background:
    radial-gradient(circle at top, rgba(230, 129, 147, 0.13), transparent 38%),
    linear-gradient(135deg, #1c1517 0%, #151112 55%, #0d0a0b 100%);
  --surface-strong: #21191b;
  --shadow-strong: 0 22px 54px rgba(0, 0, 0, 0.4);
  --theme-card-bg: rgba(33, 25, 27, 0.9);
  --theme-card-border: rgba(83, 61, 67, 0.76);
  --theme-card-hover-border: rgba(230, 129, 147, 0.38);
  --theme-card-active-ring: rgba(230, 129, 147, 0.18);
  --loading-overlay-layer-a: rgba(21, 17, 18, 0.86);
  --loading-overlay-layer-b: rgba(42, 32, 34, 0.82);
  --loading-overlay-scrim: rgba(0, 0, 0, 0.35);
  --loading-card-bg: linear-gradient(180deg, rgba(35, 27, 29, 0.98), rgba(23, 18, 19, 0.96));
  --loading-card-border: rgba(230, 129, 147, 0.2);
  --loading-card-shadow: 0 28px 70px rgba(0, 0, 0, 0.46), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --loading-badge-bg: rgba(230, 129, 147, 0.14);
  --loading-badge-text: #f09aaa;
  --loading-bar-bg: rgba(88, 65, 72, 0.92);
  --loading-bar-fill: linear-gradient(90deg, #e68193, #67c587, #e68193);
  --accent-ink: #1b0f12;
  --dark-panel-bg: rgba(33, 25, 27, 0.96);
  --dark-panel-soft: rgba(41, 31, 34, 0.92);
  --dark-shadow-soft: 0 14px 32px rgba(0, 0, 0, 0.3);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .login-box,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .settings-panel,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .modal-panel,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .option-picker,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .chat-agent-menu,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .new-chat-dropdown,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .cmd-menu {
  background: var(--dark-panel-bg);
  border-color: var(--border-color);
  box-shadow: var(--shadow-strong);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .sidebar {
  background: linear-gradient(180deg, var(--bg-secondary), var(--bg-primary));
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .chat-main {
  background: var(--page-background);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .sidebar-header,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .sidebar-footer,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .chat-header,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .input-area {
  background: rgba(0, 0, 0, 0.14);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .agent-switch,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .input-wrapper,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .attachment-chip,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .msg-attachment-card,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .settings-nav-card,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .settings-toggle-row,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .modal-select,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .modal-text-input,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .settings-field input,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .settings-select,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .session-item-edit-input {
  background: var(--dark-panel-soft);
  border-color: var(--border-color);
  color: var(--text-primary);
  box-shadow: var(--dark-shadow-soft);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .agent-switch-btn:hover,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .chat-agent-btn:hover,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .attach-btn:hover {
  background: var(--accent-light);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .agent-switch-btn.active,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .login-logo,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .new-chat-btn,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .send-btn,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .settings-actions .btn-save,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .fc-submit-btn,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .modal-btn-primary {
  color: var(--accent-ink);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .chat-agent-btn {
  border-color: var(--border-color);
  color: var(--text-primary);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .msg.assistant .msg-bubble,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .tool-call-content {
  background: var(--bg-bubble-assistant);
  border-color: var(--border-color);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .msg-attachment-thumb {
  background: linear-gradient(180deg, var(--bg-tertiary), var(--bg-secondary));
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .attachment-tray-note,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .tool-call-content.reasoning,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .tool-call-content.collab-agent-content,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .tool-call-content.command,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .tool-call-content.file-change {
  background: var(--dark-panel-soft);
  color: var(--text-primary);
  border-color: var(--border-color);
}

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  height: 100%;
  height: -webkit-fill-available;
}

body {
  height: 100%;
  height: 100dvh;
  min-height: -webkit-fill-available;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--page-background);
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* 全局隐藏原生滚动条，聊天区由 custom-scrollbar 接管 */
::-webkit-scrollbar { display: none; }
* { scrollbar-width: none; }

/* === Login === */
.login-overlay {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--login-background);
  z-index: 1000;
}
.login-box {
  text-align: center;
  padding: 48px 36px;
  background: var(--surface-strong);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  width: 90%;
  max-width: 360px;
  box-shadow: var(--shadow-strong);
}
.login-logo {
  width: 64px; height: 64px;
  margin: 0 auto 16px;
  border-radius: 16px;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(0, 20, 34, 0.24));
}
.login-box h2 {
  font-size: 24px;
  margin-bottom: 4px;
  color: var(--text-primary);
  font-weight: 700;
}
.login-box p {
  color: var(--text-secondary);
  margin-bottom: 28px;
  font-size: 14px;
}
.login-box input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  margin-bottom: 12px;
  transition: border-color 0.2s;
}
.login-box input:focus { border-color: var(--accent); }
.login-box button {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.login-box button:hover { background: var(--accent-hover); }
.remember-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  cursor: pointer;
  user-select: none;
}
.remember-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}
.login-error {
  color: var(--danger);
  margin-top: 12px;
  font-size: 14px;
}

/* === App Layout === */
.app {
  display: flex;
  height: 100%;
  height: 100dvh;
  min-height: -webkit-fill-available;
  width: 100%;
  overflow: hidden;
}

body.session-loading-active {
  cursor: progress;
}

.session-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    linear-gradient(135deg, var(--loading-overlay-layer-a), var(--loading-overlay-layer-b)),
    var(--loading-overlay-scrim);
  backdrop-filter: blur(10px);
}

.session-loading-card {
  width: min(440px, 100%);
  padding: 24px 24px 20px;
  border: 1px solid var(--loading-card-border);
  border-radius: 20px;
  background: var(--loading-card-bg);
  box-shadow: var(--loading-card-shadow);
}

.session-loading-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  margin-bottom: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--loading-badge-bg);
  color: var(--loading-badge-text);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.session-loading-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--text-primary);
}

.session-loading-label {
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.7;
}

.session-loading-bar {
  margin-top: 18px;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--loading-bar-bg);
}

.session-loading-bar-fill {
  display: block;
  width: 44%;
  height: 100%;
  border-radius: inherit;
  background: var(--loading-bar-fill);
  animation: session-loading-pulse 1.2s ease-in-out infinite;
  transform-origin: left center;
}

@keyframes session-loading-pulse {
  0% {
    transform: translateX(-55%) scaleX(0.82);
    opacity: 0.72;
  }
  50% {
    transform: translateX(120%) scaleX(1.08);
    opacity: 1;
  }
  100% {
    transform: translateX(250%) scaleX(0.88);
    opacity: 0.72;
  }
}

/* === Sidebar === */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  overflow: hidden;
}
.sidebar-header {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.agent-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 10px;
  background: rgba(255, 249, 242, 0.85);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}
.agent-switch-btn {
  appearance: none;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 10px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, transform 0.18s;
}
.agent-switch-btn:hover {
  background: rgba(233, 224, 212, 0.7);
  color: var(--text-primary);
}
.agent-switch-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(192, 85, 58, 0.18);
}
.new-chat-btn {
  width: 100%;
  min-height: 48px;
  padding: 10px;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.new-chat-btn:hover { background: var(--accent-hover); }
.session-search {
  position: relative;
  margin-top: 10px;
  width: 100%;
}
.session-search::before {
  content: '⌕';
  position: absolute;
  left: 10px;
  top: 50%;
  z-index: 1;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  pointer-events: none;
}
.session-search-input {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  width: 100%;
  height: 34px;
  padding: 0 34px 0 30px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: rgba(255, 249, 242, 0.74);
  color: var(--text-primary);
  font: inherit;
  font-size: 13px;
  outline: none;
  transition: background 0.16s, border-color 0.16s, box-shadow 0.16s;
}
.session-search-input::placeholder {
  color: var(--text-muted);
}
.session-search-input::-webkit-search-decoration,
.session-search-input::-webkit-search-cancel-button,
.session-search-input::-webkit-search-results-button,
.session-search-input::-webkit-search-results-decoration {
  -webkit-appearance: none;
  appearance: none;
}
.session-search-input:focus {
  background: var(--bg-primary);
  border-color: rgba(192, 85, 58, 0.34);
  box-shadow: 0 0 0 3px rgba(192, 85, 58, 0.1);
}
.session-search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  z-index: 2;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
.session-search-clear:hover,
.session-search-clear:focus-visible {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  outline: none;
}
.session-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  -webkit-overflow-scrolling: touch;
}
.session-list-empty {
  margin: 12px 6px;
  padding: 16px 14px;
  border: 1px dashed var(--border-color);
  border-radius: 12px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
  background: rgba(255, 249, 242, 0.7);
}
.session-project-group {
  margin: 0 0 12px;
}
.session-pinned-group {
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(221, 208, 192, 0.72);
}
.session-project-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 6px 3px 6px;
  padding: 6px 8px;
  border: 1px solid rgba(134, 106, 80, 0.22);
  border-radius: 8px;
  background: rgba(255, 249, 242, 0.88);
  backdrop-filter: blur(8px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.72), 0 1px 6px rgba(45, 31, 20, 0.04);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}
.session-project-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  color: var(--text-primary);
}
.session-project-toggle {
  min-width: 0;
  flex: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  letter-spacing: inherit;
  text-align: left;
  text-transform: inherit;
}
.session-project-toggle:hover,
.session-project-toggle:focus-visible {
  color: var(--accent);
  outline: none;
}
.session-project-toggle:hover .session-project-name,
.session-project-toggle:focus-visible .session-project-name {
  color: var(--accent);
}
.session-project-toggle:focus-visible .session-project-name {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.session-project-chevron {
  width: 12px;
  flex-shrink: 0;
  color: currentColor;
  font-size: 11px;
  line-height: 1;
  text-align: center;
  transform: translateY(-0.5px);
}
.session-project-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.session-project-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 18px;
  padding: 0 7px;
  border: 1px solid rgba(134, 106, 80, 0.14);
  border-radius: 999px;
  background: rgba(45, 31, 20, 0.06);
  color: var(--text-primary);
  font-size: 10px;
  letter-spacing: 0;
}
.session-project-create {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid rgba(221, 208, 192, 0.95);
  border-radius: 999px;
  background: rgba(255, 249, 242, 0.96);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 0.16s, color 0.16s, transform 0.16s, border-color 0.16s;
}
.session-project-create:hover {
  background: var(--accent-light);
  border-color: rgba(192, 85, 58, 0.24);
  color: var(--accent);
  transform: translateY(-1px);
}
.session-project-create:focus-visible {
  outline: 2px solid rgba(192, 85, 58, 0.22);
  outline-offset: 2px;
}
.session-pinned-header {
  color: var(--accent);
}
.session-pinned-header .session-project-name {
  color: var(--accent);
}
.session-project-sessions[hidden] {
  display: none;
}
.session-project-group.collapsed {
  margin-bottom: 8px;
}
.session-project-group.collapsed .session-project-header {
  margin-bottom: 0;
}
.session-project-group.has-active-session.collapsed .session-project-header {
  color: var(--accent);
}
.session-project-group.has-active-session.collapsed .session-project-name {
  color: var(--accent);
}
.session-project-group.has-active-session.collapsed .session-project-count {
  background: var(--accent-light);
  color: var(--accent);
}
.session-project-group.has-unread-session.collapsed .session-project-count::after,
.session-project-group.has-running-session.collapsed .session-project-count::after {
  content: '';
  width: 6px;
  height: 6px;
  margin-left: 5px;
  border-radius: 50%;
  background: currentColor;
}
.session-project-group.has-running-session.collapsed .session-project-count::after {
  animation: pulse 1.1s infinite;
}
.session-project-group.has-waiting-session:not(.has-running-session).collapsed .session-project-count::after {
  content: '';
  width: 6px;
  height: 6px;
  margin-left: 5px;
  border-radius: 50%;
  background: rgba(120, 126, 140, 0.72);
}
.session-project-group.has-waiting-session:not(.has-running-session).collapsed .session-project-count::after {
  animation: none;
}
.session-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  margin-bottom: 2px;
  transition: background 0.15s;
  position: relative;
}
.session-item:hover { background: var(--bg-tertiary); }
.session-item.active { background: var(--accent-light); }
.session-item.pinned::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 999px;
  background: var(--accent);
}
.session-item.llm-created:not(.pinned)::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 7px;
  width: 9px;
  height: 9px;
  border-top: 2px solid var(--accent);
  border-left: 2px solid var(--accent);
  border-radius: 4px 0 0 0;
  opacity: 0.88;
}
.session-item-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.session-item-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  color: var(--text-primary);
}
.session-item.active .session-item-title { color: var(--accent); font-weight: 500; }
.session-item-pin-badge {
  flex-shrink: 0;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(192, 85, 58, 0.11);
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.4;
}
.session-item-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(232, 190, 92, 0.16);
  border: 1px solid rgba(212, 163, 58, 0.28);
  color: #9a6f14;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.session-item-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.1s infinite;
}
.session-item-status.waiting {
  background: rgba(120, 126, 140, 0.12);
  border-color: rgba(120, 126, 140, 0.22);
  color: #667085;
}
.session-item-status.waiting::before {
  animation: none;
}
.session-item-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 8px;
  flex-shrink: 0;
}
.session-item-actions {
  display: none;
  align-items: center;
  gap: 2px;
  margin-left: 4px;
  position: relative;
  flex-shrink: 0;
}
.session-item:hover .session-item-actions,
.session-item:focus-within .session-item-actions {
  display: flex;
}
.session-item.menu-open .session-item-actions {
  display: flex;
}
.session-item-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 13px;
  border-radius: 4px;
  line-height: 1;
}
.session-item-btn:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.session-item-btn.pin {
  font-weight: 800;
}
.session-item-btn.more {
  font-size: 16px;
  letter-spacing: 0;
}
.session-item-btn.pin.active {
  color: var(--accent);
  background: rgba(192, 85, 58, 0.1);
}
.session-item-btn.pin:hover {
  color: var(--accent);
  background: rgba(192, 85, 58, 0.12);
}
.session-item-more {
  position: relative;
  display: inline-flex;
}
.session-item-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 20;
  display: none;
  min-width: 104px;
  padding: 5px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-secondary);
  box-shadow: 0 10px 24px rgba(61, 42, 26, 0.14);
}
.session-item.menu-open .session-item-menu {
  display: grid;
  gap: 2px;
}
.session-item-menu-btn {
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  line-height: 1.2;
  text-align: left;
  white-space: nowrap;
}
.session-item-menu-btn:hover,
.session-item-menu-btn:focus-visible {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}
.session-item-menu-btn.delete:hover,
.session-item-menu-btn.delete:focus-visible {
  background: var(--accent-light);
  color: var(--danger);
}
.session-list-load-more {
  width: fit-content;
  max-width: calc(100% - 18px);
  margin: 2px 8px 6px;
  padding: 3px 7px;
  border: 1px solid rgba(134, 106, 80, 0.18);
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  text-align: left;
  transition: background 0.16s, border-color 0.16s, color 0.16s, transform 0.16s;
}
.session-list-load-more:hover {
  background: rgba(255, 249, 242, 0.58);
  border-color: rgba(192, 85, 58, 0.24);
  color: var(--accent);
  transform: translateY(-1px);
}
.session-list-load-more:focus-visible {
  outline: 2px solid rgba(192, 85, 58, 0.22);
  outline-offset: 2px;
}
.session-list-load-more-title {
  min-width: 0;
  font-size: 12px;
  font-weight: 700;
}
.session-list-load-more-meta {
  flex-shrink: 0;
  color: var(--text-muted);
  font-size: 10px;
}
/* Inline edit in sidebar */
.session-item-edit-input {
  flex: 1;
  padding: 2px 6px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: #fff;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  min-width: 0;
}
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border-color);
  text-align: center;
  flex-shrink: 0;
}
.brand { font-size: 12px; color: var(--text-muted); }

/* === Chat Main === */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
  background: var(--bg-primary);
}
.chat-header {
  height: var(--header-height);
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  gap: 8px;
  flex-shrink: 0;
  position: relative;
}
.chat-controls {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  max-width: 800px;
  margin: 0 auto 8px;
}
.menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.menu-btn:hover { background: var(--bg-tertiary); }
.chat-title {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background 0.15s;
}
.chat-title:hover { background: var(--bg-tertiary); }
.chat-session-id-btn {
  appearance: none;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
  border: 1px solid rgba(91, 126, 161, 0.22);
  border-radius: 999px;
  background: rgba(91, 126, 161, 0.1);
  color: var(--info);
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}
.chat-session-id-btn:hover {
  background: rgba(91, 126, 161, 0.16);
  border-color: rgba(91, 126, 161, 0.34);
}
.chat-session-id-btn:disabled,
.chat-agent-btn:disabled,
.chat-cwd:disabled,
.mode-select:disabled,
.user-outline-btn:disabled,
.reload-mcp-btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.chat-agent-picker {
  position: relative;
  display: none;
  flex-shrink: 0;
}
.chat-agent-btn {
  appearance: none;
  font-size: 11px;
  color: var(--text-primary);
  background: var(--accent-light);
  border: 1px solid rgba(192, 85, 58, 0.2);
  padding: 2px 22px 2px 10px;
  border-radius: 999px;
  flex-shrink: 0;
  font-weight: 700;
  cursor: pointer;
  position: relative;
}
.chat-agent-btn::after {
  content: '▾';
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-48%);
  font-size: 10px;
  color: var(--text-secondary);
}
.chat-agent-btn:hover {
  background: #f1dfd7;
}
.chat-agent-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 148px;
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background: rgba(255, 252, 248, 0.98);
  box-shadow: 0 18px 40px rgba(45, 31, 20, 0.14);
  backdrop-filter: blur(14px);
  z-index: 80;
}
.chat-agent-option {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 11px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.chat-agent-option:hover {
  background: rgba(233, 224, 212, 0.65);
}
.chat-agent-option.active {
  background: var(--accent-light);
  color: var(--accent);
}
.chat-agent-option.active::after {
  content: '当前';
  font-size: 10px;
  letter-spacing: 0.04em;
}
.chat-runtime-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(232, 190, 92, 0.16);
  border: 1px solid rgba(212, 163, 58, 0.28);
  color: #9a6f14;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.chat-runtime-state::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.1s infinite;
}
.chat-runtime-state.waiting {
  background: rgba(120, 126, 140, 0.12);
  border-color: rgba(120, 126, 140, 0.22);
  color: #667085;
}
.chat-runtime-state.waiting::before {
  animation: none;
}
.cost-display {
  display: none !important;
}
.cost-display:empty { display: none; }
.user-outline-btn,
.reload-mcp-btn {
  appearance: none;
  border: 1px solid rgba(91, 126, 161, 0.22);
  border-radius: 999px;
  background: rgba(91, 126, 161, 0.08);
  color: var(--info);
  padding: 4px 10px;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
}
.user-outline-anchor {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}
.ccweb-prompt-outline-anchor {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}
.ccweb-prompt-outline-btn {
  position: relative;
}
.ccweb-prompt-outline-btn[data-count]::after {
  content: attr(data-count);
  position: absolute;
  top: -6px;
  right: -7px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 10px;
  font-weight: 900;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--bg-primary);
}
.user-outline-btn:hover,
.reload-mcp-btn:hover:not(:disabled) {
  background: rgba(91, 126, 161, 0.16);
  border-color: rgba(91, 126, 161, 0.34);
}
.user-outline-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  width: min(360px, calc(100vw - 24px));
  max-height: min(48vh, 360px);
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background: rgba(255, 252, 248, 0.98);
  box-shadow: 0 12px 28px rgba(45, 31, 20, 0.08);
  overflow-y: auto;
  z-index: 70;
}
.user-outline-empty {
  padding: 8px 10px;
  color: var(--text-muted);
  font-size: 12px;
}
.user-outline-item {
  width: 100%;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  padding: 8px 10px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}
.user-outline-item:hover {
  background: var(--accent-light);
}
.user-outline-index {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.6;
}
.user-outline-text {
  min-width: 0;
  font-size: 13px;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Mode selector */
.mode-select {
  -webkit-appearance: none;
  appearance: none;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 4px 24px 4px 10px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  flex-shrink: 0;
  outline: none;
  transition: border-color 0.15s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b5a4d'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.mode-select:focus { border-color: var(--accent); }
.mode-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* === Messages === */
.messages-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
}
.messages {
  height: 100%;
  overflow-y: scroll;
  overflow-x: hidden;
  padding: 16px;
  padding-right: 20px;
  padding-bottom: 24px;
  scroll-padding-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.messages::-webkit-scrollbar { display: none; }
/* Custom scrollbar */
.custom-scrollbar {
  position: absolute;
  right: 2px;
  top: 0;
  bottom: 0;
  width: 6px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.messages-wrap:hover .custom-scrollbar,
.custom-scrollbar.active {
  opacity: 1;
}
/* 移动端触摸后 hover 会粘滞 — 完全禁用 hover 触发，只靠 .active（拖动时）显示 */
@media (pointer: coarse) {
  .messages-wrap:hover .custom-scrollbar {
    opacity: 0;
  }
  /* 移动端滚动时用独立的类显示滑块，不走 .active */
  .custom-scrollbar.scrolling {
    opacity: 1;
  }
}
.custom-scrollbar-thumb {
  position: absolute;
  right: 0;
  width: 6px;
  min-height: 30px;
  border-radius: 4px;
  background: var(--scrollbar-thumb);
  cursor: grab;
  transition: width 0.15s, right 0.15s, background 0.15s;
  pointer-events: all;
}
.custom-scrollbar-thumb:hover,
.custom-scrollbar-thumb.dragging {
  width: 12px;
  right: -3px;
  background: #b0a090;
  cursor: grab;
}
.custom-scrollbar-thumb.dragging { cursor: grabbing; }
/* 移动端触摸设备：加宽滑块与轨道，便于手指操作；默认隐藏，拖动时显示 */
@media (pointer: coarse) {
  .custom-scrollbar {
    width: 18px;
    right: 0;
    opacity: 0;
  }
  .custom-scrollbar.active {
    opacity: 1;
  }
  .custom-scrollbar-thumb {
    width: 8px;
    right: 5px;
    min-height: 40px;
    border-radius: 4px;
  }
  .custom-scrollbar-thumb:hover,
  .custom-scrollbar-thumb.dragging {
    width: 14px;
    right: 2px;
  }
}
.welcome-msg {
  text-align: center;
  margin: auto;
  padding: 40px 20px;
  color: var(--text-secondary);
}
.welcome-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.6;
}
.welcome-msg h3 {
  font-size: 20px;
  color: var(--text-primary);
  margin-bottom: 8px;
  font-weight: 600;
}
.welcome-msg p { font-size: 14px; }

/* Message Bubbles */
.msg {
  display: flex;
  gap: 10px;
  max-width: 85%;
  min-width: 0;
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg.assistant { align-self: flex-start; }

.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.msg.user .msg-avatar { background: var(--bg-bubble-user); color: #fff; }
.msg.assistant .msg-avatar { background: var(--success); color: #fff; }
.msg-avatar svg { display: block; flex-shrink: 0; }
/* Claude avatar: transparent bg, fixed-color pixel crab */
.msg.assistant.agent-claude .msg-avatar {
  background: transparent;
  border: none;
}
/* Codex avatar: transparent bg to match the supplied asset */
.msg.assistant.agent-codex .msg-avatar {
  background: transparent;
  border: none;
}

.msg-bubble {
  position: relative;
  padding: 12px 16px;
  border-radius: 16px;
  line-height: 1.65;
  word-break: break-word;
  min-width: 0;
  max-width: 100%;
}
.msg-attachments {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 220px));
  gap: 10px;
  margin-top: 10px;
}
.msg-attachment-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(221, 208, 192, 0.92);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(45, 31, 20, 0.05);
  transition: transform 0.16s, box-shadow 0.16s, border-color 0.16s, background 0.16s;
}
.msg-attachment-card:hover {
  transform: translateY(-1px);
  border-color: rgba(192, 85, 58, 0.22);
  box-shadow: 0 12px 24px rgba(45, 31, 20, 0.08);
}
.msg-attachment-card:focus-visible {
  outline: 2px solid rgba(192, 85, 58, 0.24);
  outline-offset: 2px;
}
.msg-attachment-card:disabled {
  cursor: default;
  opacity: 0.88;
  transform: none;
}
.msg-attachment-card.is-expired {
  background: rgba(249, 242, 233, 0.9);
}
.msg-attachment-thumb {
  position: relative;
  display: block;
  width: 100%;
  min-height: 132px;
  overflow: hidden;
  border-radius: 11px;
  background:
    linear-gradient(180deg, rgba(245, 238, 229, 0.92), rgba(232, 222, 211, 0.9));
}
.msg-attachment-thumb-placeholder,
.attachment-preview-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.msg-attachment-thumb-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.18s ease;
}
.msg-attachment-card.is-loaded .msg-attachment-thumb-image {
  opacity: 1;
}
.msg-attachment-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.msg-attachment-name,
.msg-attachment-note {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.msg-attachment-name {
  font-size: 12px;
  font-weight: 700;
}
.msg-attachment-note {
  color: var(--text-secondary);
  font-size: 11px;
}
.msg.user .msg-attachment-card {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
  box-shadow: none;
}
.msg.user .msg-attachment-card:hover {
  border-color: rgba(255, 255, 255, 0.34);
}
.msg.user .msg-attachment-thumb {
  background: rgba(255, 255, 255, 0.08);
}
.msg.user .msg-attachment-thumb-placeholder,
.msg.user .msg-attachment-note {
  color: rgba(255, 255, 255, 0.78);
}
.msg.user .msg-attachment-name {
  color: #fff;
}
.msg.user .msg-attachment-card.is-expired {
  background: rgba(255, 255, 255, 0.1);
}
.msg-attachment-card.is-error .msg-attachment-thumb-placeholder {
  color: var(--danger);
}
.msg.user .msg-bubble {
  background: var(--bg-bubble-user);
  color: #fff;
  border-bottom-right-radius: 4px;
  padding-right: 42px;
}
.msg-mentions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.msg-mention-chip {
  --mention-accent: rgba(255, 255, 255, 0.34);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  max-width: 100%;
  min-width: 0;
  padding: 7px 9px 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  color: inherit;
}
.msg-mention-chip.kind-skill {
  width: min(290px, 100%);
}
.msg-mention-chip.kind-prompt,
.msg-mention-chip.kind-file {
  background: rgba(255, 255, 255, 0.08);
}
.msg-mention-badge {
  min-width: 0;
  height: 18px;
  width: auto;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  padding: 0 7px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--mention-accent) 68%, rgba(255, 255, 255, 0.08));
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0;
  overflow: hidden;
}
.msg-mention-badge img {
  display: block;
  width: 18px;
  height: 18px;
  margin: 0 -7px;
  object-fit: cover;
}
.msg-mention-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.msg-mention-title {
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.msg-mention-desc {
  font-size: 11px;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.84);
  overflow-wrap: anywhere;
}
.msg-mention-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}
.msg-mention-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.88);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.msg-mention-pill.state-configured {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(93, 138, 84, 0.24);
}
.msg-mention-pill.state-declared {
  background: rgba(255, 255, 255, 0.06);
}
.msg.user.codex-steer-message .msg-bubble {
  padding-bottom: 10px;
}
.msg.user.codex-steer-pending .msg-avatar,
.msg.user.codex-steer-inserted .msg-avatar,
.msg.user.codex-steer-failed .msg-avatar {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}
.msg.user.codex-steer-pending .msg-bubble {
  background: var(--bg-tertiary);
  border: 1px dashed var(--border-color);
  color: var(--text-secondary);
}
.msg.user.codex-steer-inserted .msg-bubble {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  opacity: 0.94;
}
.msg.user.codex-steer-failed .msg-bubble {
  background: rgba(220, 53, 69, 0.1);
  border: 1px solid rgba(220, 53, 69, 0.32);
  color: var(--danger);
}
.codex-steer-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  opacity: 0.88;
}
.codex-steer-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.72;
}
.codex-steer-status[data-status='pending'] {
  color: var(--text-muted);
}
.codex-steer-status[data-status='inserted'] {
  color: var(--success);
}
.codex-steer-status[data-status='failed'] {
  color: var(--danger);
}
.msg.user.codex-steer-pending .msg-copy-btn {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-color);
  color: var(--text-muted);
}
.msg-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.86);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.msg.user:hover .msg-copy-btn,
.msg.user:focus-within .msg-copy-btn {
  opacity: 1;
}
.msg-copy-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.28);
}
.msg.cross-conversation .msg-avatar {
  background: var(--info);
  color: #fff;
}
.msg.cross-conversation-reply .msg-avatar {
  background: var(--success);
}
.msg.cross-conversation .msg-bubble {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.76), transparent),
    rgba(91, 126, 161, 0.1);
  border: 1px solid rgba(91, 126, 161, 0.24);
  color: var(--text-primary);
  box-shadow: 0 10px 22px rgba(45, 31, 20, 0.05);
}
.msg.cross-conversation-reply .msg-bubble {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), transparent),
    rgba(93, 138, 84, 0.12);
  border-color: rgba(93, 138, 84, 0.28);
}
.msg.cross-conversation-reply .cross-conversation-meta,
.msg.cross-conversation-reply .cross-conversation-id-btn,
.msg.cross-conversation-reply .cross-conversation-collapse-btn,
.msg.cross-conversation-reply .cross-conversation-time {
  color: var(--success);
}
.msg.cross-conversation-reply .cross-conversation-id-btn,
.msg.cross-conversation-reply .cross-conversation-collapse-btn {
  border-color: rgba(93, 138, 84, 0.28);
}
.msg.cross-conversation-reply .cross-conversation-id-btn:hover,
.msg.cross-conversation-reply .cross-conversation-collapse-btn:hover {
  background: rgba(93, 138, 84, 0.14);
}
.cross-conversation-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  row-gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 7px;
  color: var(--info);
  font-size: 11px;
  font-weight: 800;
}
.cross-conversation-label {
  flex: 1 1 180px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.cross-conversation-time {
  flex-shrink: 0;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.cross-conversation-id-btn,
.cross-conversation-collapse-btn {
  appearance: none;
  border: 1px solid rgba(91, 126, 161, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--info);
  padding: 2px 7px;
  font: inherit;
  font-size: 10px;
  cursor: pointer;
}
.cross-conversation-collapse-btn {
  min-width: 44px;
}
.cross-conversation-id-btn:hover,
.cross-conversation-collapse-btn:hover {
  background: rgba(91, 126, 161, 0.14);
}
.cross-conversation-collapse-btn:focus-visible {
  outline: 2px solid rgba(93, 138, 84, 0.28);
  outline-offset: 2px;
}
.msg.cross-conversation-collapsed .cross-conversation-meta {
  margin-bottom: 0;
}
.msg.cross-conversation-collapsed .msg-last-section-btn {
  display: none;
}
.msg.assistant .msg-bubble {
  background: var(--bg-bubble-assistant);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
  color: var(--text-primary);
}
.msg-action-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 8px;
}
.msg-action-row:empty {
  display: none;
}
.msg-last-section-btn,
.msg-branch-btn {
  appearance: none;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  opacity: 0.72;
  transition: opacity 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.msg-last-section-btn[hidden],
.msg-branch-btn[hidden] {
  display: none;
}
.msg-last-section-btn svg,
.msg-branch-btn svg {
  display: block;
  flex-shrink: 0;
}
.msg-last-section-btn:hover,
.msg-branch-btn:hover {
  opacity: 1;
  background: var(--bg-tertiary);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}
.msg-last-section-btn:focus-visible,
.msg-branch-btn:focus-visible {
  opacity: 1;
  outline: 2px solid rgba(91, 126, 161, 0.28);
  outline-offset: 2px;
}
.msg-last-section-focus {
  animation: lastSectionFocus 1.1s ease;
}
@keyframes lastSectionFocus {
  0% { background: rgba(91, 126, 161, 0.18); }
  100% { background: transparent; }
}
.msg.assistant .msg-mention-chip {
  border-color: rgba(48, 62, 82, 0.14);
  background: rgba(91, 126, 161, 0.07);
  color: var(--text-primary);
}
.msg.assistant .msg-mention-chip.kind-prompt,
.msg.assistant .msg-mention-chip.kind-file {
  background: rgba(91, 126, 161, 0.05);
}
.msg.assistant .msg-mention-badge {
  color: #fff;
}
.msg.assistant .msg-mention-desc {
  color: var(--text-secondary);
}
.msg.assistant .msg-mention-pill {
  border-color: rgba(48, 62, 82, 0.14);
  background: rgba(91, 126, 161, 0.08);
  color: var(--text-secondary);
}
.msg.assistant .msg-mention-pill.state-configured {
  background: rgba(93, 138, 84, 0.14);
  color: var(--success);
}
.note-meta {
  margin-bottom: 6px;
  color: var(--note-accent);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}
.note-text {
  white-space: pre-wrap;
}
.note-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 10px;
}
.note-action {
  appearance: none;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--note-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}
.note-action:hover {
  background: var(--note-bg-strong);
  border-color: var(--note-accent);
  color: var(--note-accent);
}
.note-action:disabled {
  opacity: 0.42;
  cursor: default;
  pointer-events: none;
}
.note-action:active {
  transform: scale(0.96);
}
.note-action.queue {
  background: var(--note-bg-strong);
  border-color: var(--note-border);
  color: var(--note-accent);
}
.note-action.queue:hover {
  background: var(--note-accent);
  border-color: transparent;
  color: #fff;
}
.note-action.send,
.note-action.save {
  background: var(--note-accent);
  border-color: transparent;
  color: #fff;
}
.note-action.send:hover,
.note-action.save:hover {
  background: var(--note-accent-hover);
  color: #fff;
}
.note-action.delete:hover {
  background: rgba(192, 85, 58, 0.1);
  border-color: rgba(192, 85, 58, 0.24);
  color: var(--danger);
}
.note-edit-input {
  width: min(460px, 100%);
  min-width: 260px;
  max-width: 100%;
  border: 1px solid var(--note-border);
  border-radius: 10px;
  outline: none;
  background: rgba(255, 255, 255, 0.76);
  color: var(--text-primary);
  font: inherit;
  line-height: 1.5;
  padding: 9px 10px;
  resize: none;
}
.note-edit-input:focus {
  border-color: var(--note-accent);
  box-shadow: 0 0 0 3px var(--note-bg);
}

/* System messages */
.msg.system {
  align-self: center;
  max-width: 90%;
}
.msg.system .msg-bubble {
  background: var(--bg-tertiary);
  border: 1px dashed var(--border-color);
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 13px;
  padding: 10px 16px;
  position: relative;
  text-align: center;
  white-space: pre-line;
}
.msg.system.transient .msg-bubble {
  border-style: solid;
  box-shadow: 0 6px 18px rgba(27, 39, 51, 0.08);
}
.msg.system .msg-bubble[data-tone='danger'] {
  border-color: rgba(220, 53, 69, 0.34);
  color: var(--danger);
}
.msg.system .msg-bubble[data-tone='info'] {
  border-color: rgba(58, 134, 255, 0.26);
  color: var(--text-secondary);
}
.msg.system.is-dismissing {
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.msg.system .system-message-text {
  display: block;
  padding-right: 26px;
}
.msg.system .system-message-close {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 16px;
  height: 24px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  position: absolute;
  right: 7px;
  top: 7px;
  width: 24px;
}
.msg.system .system-message-close:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* Markdown content */
.msg-bubble p { margin: 0 0 8px 0; }
.msg-bubble p:last-child { margin-bottom: 0; }
.msg-bubble hr {
  border: 0;
  border-top: 1px solid rgba(122, 104, 82, 0.22);
  margin: 10px 0 11px;
}
.msg-bubble .agent-message-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 11px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}
.msg-bubble .agent-message-divider::before,
.msg-bubble .agent-message-divider::after {
  content: '';
  flex: 1 1 auto;
  height: 1px;
  background: rgba(122, 104, 82, 0.22);
}
.msg-bubble .agent-message-divider span {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 11px;
}
html[data-divider-time='hide'] .msg-bubble .agent-message-divider {
  gap: 0;
}
html[data-divider-time='hide'] .msg-bubble .agent-message-divider span {
  display: none;
}
.msg-bubble ul, .msg-bubble ol { margin: 4px 0 8px 20px; }
.msg-bubble li { margin-bottom: 2px; }
.msg-bubble h1, .msg-bubble h2, .msg-bubble h3, .msg-bubble h4 {
  margin: 12px 0 6px 0;
}
.msg-bubble h1 { font-size: 1.3em; }
.msg-bubble h2 { font-size: 1.15em; }
.msg-bubble h3 { font-size: 1.05em; }
.msg-bubble a { color: var(--info); text-decoration: none; }
.msg-bubble a:hover { text-decoration: underline; }
.msg-bubble a.local-file-link {
  display: inline-flex;
  align-items: baseline;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.95em;
  color: var(--accent);
}
.msg-bubble a.local-file-link::before {
  content: 'file';
  margin-right: 4px;
  padding: 0 4px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.76em;
  line-height: 1.35;
  text-decoration: none;
}
.msg-bubble blockquote {
  border-left: 3px solid var(--border-color);
  padding-left: 12px;
  color: var(--text-secondary);
  margin: 8px 0;
}
.msg-bubble table {
  border-collapse: collapse;
  margin: 8px 0;
  font-size: 13px;
  width: 100%;
  overflow-x: auto;
  display: block;
}
.msg-bubble th, .msg-bubble td {
  border: 1px solid var(--border-color);
  padding: 6px 10px;
  text-align: left;
}
.msg-bubble th { background: var(--bg-secondary); }

/* Inline code */
.msg-bubble code:not(pre code) {
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.88em;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  color: var(--accent);
}
.msg.user .msg-bubble code:not(pre code) {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

/* Code blocks */
.code-block-wrapper {
  position: relative;
  margin: 8px 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  max-width: 100%;
}
.code-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: #2b2b2b;
  font-size: 12px;
  color: #999;
}
.code-block-header > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.code-block-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  flex: 0 0 auto;
}
.code-copy-btn, .code-preview-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 4px 10px;
  border-radius: 4px;
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.code-copy-btn:hover, .code-preview-btn:hover { color: #fff; background: #444; }
.code-copy-btn:focus-visible, .code-preview-btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.45);
  outline-offset: 2px;
}
.code-copy-btn:disabled, .code-preview-btn:disabled {
  cursor: default;
  opacity: 0.72;
}
.code-preview-btn { border: 1px solid #555; }
.code-block-wrapper pre {
  margin: 0;
  padding: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}
.code-block-wrapper pre code {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre;
}
/* HTML/SVG preview pane */
.code-preview-pane {
  display: none;
  background: #fff;
  border-top: 1px solid var(--border-color);
}
.code-preview-iframe {
  width: 100%;
  min-height: 120px;
  max-height: 600px;
  border: none;
  display: block;
}
.code-block-wrapper.preview-mode .code-preview-pane { display: block; }
.code-block-wrapper.preview-mode pre { display: none; }

.mermaid-code-block .code-block-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}
.mermaid-code-block.mermaid-diagram-mode pre {
  display: none;
}
.mermaid-code-block.mermaid-source-mode .mermaid-render-pane {
  display: none;
}
.mermaid-render-pane {
  position: relative;
  min-height: 120px;
  padding: 18px;
  overflow: auto;
  background: #fff;
  border-top: 1px solid var(--border-color);
  color: #1f2933;
  -webkit-overflow-scrolling: touch;
}
.mermaid-render-pane[data-render-state='pending']::before {
  content: '图形渲染中...';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  color: #6b7280;
  font-size: 13px;
}
.mermaid-render-pane[data-render-state='rendered']::before,
.mermaid-render-pane[data-render-state='error']::before {
  content: none;
}
.mermaid-render-target {
  min-width: min-content;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mermaid-render-target svg {
  max-width: 100%;
  height: auto;
}
.mermaid-render-error {
  padding: 12px;
  border: 1px solid rgba(220, 53, 69, 0.28);
  border-radius: 8px;
  background: rgba(220, 53, 69, 0.08);
  color: #b42318;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}

@media (pointer: coarse) {
  .code-block-header {
    padding: 8px 10px;
  }
  .code-block-actions {
    gap: 6px;
  }
  .code-copy-btn, .code-preview-btn {
    min-width: 44px;
    min-height: 36px;
    padding: 0 12px;
  }
}

/* Tool calls */
.msg-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 4px 6px;
}
.tool-call {
  margin: 8px 0;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
  width: 100%;
}
.tool-call.codex-command {
  border-color: rgba(91, 126, 161, 0.24);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.tool-call.codex-reasoning {
  border-color: rgba(192, 85, 58, 0.16);
}
.tool-call.codex-file-change {
  border-color: rgba(93, 138, 84, 0.24);
}
.tool-call.ccweb-mcp-child-agent-tool-call {
  border-color: transparent;
  background: transparent;
}
.tool-call.ccweb-mcp-child-agent-tool-call.collab-agent-inline {
  display: inline-flex;
  width: auto;
  max-width: 100%;
  margin: 0;
  overflow: visible;
  border-radius: 0;
}
.tool-call summary {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
  list-style: none;
}
.tool-call-summary-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.tool-call-label {
  display: block;
  width: 100%;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tool-call-subtitle {
  display: block;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 12px;
}
.tool-call-state {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  background: rgba(233, 224, 212, 0.85);
  color: var(--text-secondary);
}
.tool-call-state.running {
  background: rgba(232, 190, 92, 0.16);
  color: #9a6f14;
}
.tool-call-state.done {
  background: rgba(93, 138, 84, 0.14);
  color: var(--success);
}
.tool-call-state.error {
  background: rgba(192, 85, 58, 0.14);
  color: var(--danger);
}
.tool-call summary::-webkit-details-marker { display: none; }
.tool-call summary::before {
  content: '▸';
  font-size: 11px;
  transition: transform 0.2s;
}
.tool-call[open] summary::before { transform: rotate(90deg); }
.tool-call summary:hover { background: var(--bg-tertiary); }
.tool-call-icon {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.tool-call-icon.done { background: var(--success); }
.tool-call-icon.running { background: #d4a33a; animation: pulse 1s infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.tool-call-content {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-primary);
  max-height: 250px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  font-family: 'SF Mono', monospace;
}
.tool-call-content.reasoning {
  font-family: inherit;
  line-height: 1.7;
  color: var(--text-primary);
  background: linear-gradient(180deg, rgba(255, 249, 242, 0.92), rgba(245, 221, 212, 0.32));
}
.tool-call-content.todo-list-content {
  font-family: inherit;
  white-space: normal;
  word-break: normal;
}
.tool-call-content.collab-agent-content {
  font-family: inherit;
  white-space: normal;
  word-break: normal;
  max-height: none;
  overflow: visible;
  padding: 0;
  background: transparent;
  color: var(--text-primary);
}
.tool-call-content.todo-list-content .todo-list-container {
  margin: 0;
}
.tool-call-content.command,
.tool-call-content.file-change {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(250, 246, 240, 0.92));
}
.tool-call-structured {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tool-call-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tool-call-section-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.tool-call-code {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(45, 31, 20, 0.06);
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12px;
  line-height: 1.6;
}
.tool-call-empty {
  color: var(--text-muted);
  font-style: italic;
}

/* Tool group (auto-fold) */
.tool-group {
  margin: 8px 0;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
  width: 100%;
}
.tool-group-summary {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-secondary);
  list-style: none;
  user-select: none;
}
.tool-group-summary::-webkit-details-marker { display: none; }
.tool-group-summary::before {
  content: '▸ ';
  font-size: 11px;
  transition: transform 0.2s;
  display: inline-block;
}
.tool-group[open] > .tool-group-summary::before { transform: rotate(90deg); }
.tool-group-summary:hover { background: var(--bg-tertiary); }
.tool-group-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 4px 6px;
  padding: 4px 8px;
  background: var(--bg-primary);
}
.tool-group-inner .tool-call {
  margin: 4px 0;
}
.tool-group-inner .tool-call.ccweb-mcp-child-agent-tool-call.collab-agent-inline {
  margin: 0;
}

/* AskUserQuestion preview */
.ask-user-question {
  padding: 10px 12px;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ask-question-card {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: #fff;
  padding: 10px;
}
.ask-question-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
}
.ask-question-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-primary);
  margin-bottom: 8px;
}
/* 左右分栏布局 */
.ask-options-layout {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ask-options-layout.has-preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 8px;
  align-items: start;
}
.ask-question-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  grid-row: 1;
  grid-column: 1;
}
/* 右侧预览区 */
.ask-option-preview {
  grid-row: 1;
  grid-column: 2;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary);
  min-height: 60px;
  transition: background 0.15s;
  white-space: pre-wrap;
  word-break: break-word;
}
/* 确认按钮 — 仅移动端 */
.ask-confirm-btn {
  display: none;
  grid-row: 2;
  grid-column: 1 / -1;
  width: 100%;
  padding: 9px 0;
  border: 1.5px solid var(--accent);
  border-radius: 8px;
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.ask-confirm-btn:active {
  background: var(--accent);
  color: #fff;
}
@media (pointer: coarse) {
  .ask-confirm-btn { display: block; }
}
.ask-option-item {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px;
  background: var(--bg-secondary);
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.ask-option-item:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}
.ask-option-item.ask-option-selected {
  background: var(--accent-light);
  border-color: var(--accent);
}
.ask-option-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}
.ask-option-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-top: 4px;
}

/* Typing indicator */
.typing-indicator {
  display: inline-flex;
  gap: 5px;
  padding: 8px 4px;
}
.typing-indicator span {
  width: 7px; height: 7px;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0.5;
  animation: bounce 1.4s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-7px); }
}

/* === Composer Modifier Menu === */
.cmd-menu {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(45, 31, 20, 0.12);
  padding: 6px;
  min-width: 240px;
  max-width: 320px;
  max-height: min(52vh, 360px);
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 50;
}
.cmd-menu::-webkit-scrollbar { width: 8px; }
.cmd-menu::-webkit-scrollbar-track { background: transparent; }
.cmd-menu::-webkit-scrollbar-thumb {
  background: rgba(95, 74, 58, 0.22);
  border-radius: 999px;
}
.cmd-menu::-webkit-scrollbar-thumb:hover {
  background: rgba(95, 74, 58, 0.34);
}
.cmd-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
  min-width: 0;
}
.cmd-item:hover, .cmd-item.active { background: var(--accent-light); }
.cmd-item-kind {
  flex: 0 0 auto;
  min-width: 42px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(192, 85, 58, 0.1);
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.4;
  text-align: center;
  text-transform: uppercase;
}
.cmd-item-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.cmd-item-cmd {
  font-weight: 600;
  font-size: 14px;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cmd-item-desc {
  font-size: 13px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* === Input Area === */
.input-area {
  padding: 10px 16px;
  padding-bottom: max(14px, var(--safe-bottom));
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}
.attachment-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 800px;
  margin: 0 auto 10px;
}
.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 7px 10px;
  border: 1px solid rgba(91, 126, 161, 0.2);
  border-radius: 12px;
  background: rgba(255, 252, 248, 0.96);
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.4;
}
.attachment-chip.uploading {
  border-style: dashed;
  border-color: rgba(91, 126, 161, 0.34);
  background: rgba(246, 249, 252, 0.96);
}
.attachment-chip-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.attachment-chip-name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment-chip-note {
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
}
.attachment-chip-remove {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 2px;
  border-radius: 6px;
}
.attachment-chip-remove:hover {
  color: var(--danger);
  background: rgba(192, 85, 58, 0.1);
}
.attachment-tray-note {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 246, 223, 0.95);
  border: 1px solid rgba(232, 190, 92, 0.3);
  color: #8b6420;
  font-size: 12px;
  line-height: 1.55;
}
.pending-notes-tray {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 800px;
  max-height: min(32vh, 220px);
  margin: 0 auto 10px;
  padding: 2px 3px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--note-border) transparent;
}
.pending-notes-tray[hidden] {
  display: none;
}
.pending-notes-tray::-webkit-scrollbar {
  width: 6px;
}
.pending-notes-tray::-webkit-scrollbar-thumb {
  background: var(--note-border);
  border-radius: 999px;
}
.pending-ccweb-prompt {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  padding: 6px 8px;
  border: none;
  border-radius: 10px;
  background: transparent;
  animation: fadeIn 0.2s ease;
}
.pending-ccweb-prompt:hover {
  background: var(--accent-light);
}
.pending-ccweb-prompt-badge {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(192, 85, 58, 0.12);
}
.pending-ccweb-prompt-title {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pending-ccweb-prompt-action {
  min-height: 26px;
  padding: 3px 9px;
  border: 1px solid rgba(192, 85, 58, 0.24);
  border-radius: 999px;
  background: rgba(255, 249, 242, 0.9);
  color: var(--accent);
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}
.pending-ccweb-prompt-action:hover {
  border-color: var(--accent);
  background: var(--bg-primary);
  transform: translateY(-1px);
}
.pending-ccweb-prompt-dismiss {
  min-height: 26px;
  padding: 3px 8px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}
.pending-ccweb-prompt-dismiss:hover {
  background: rgba(139, 100, 32, 0.1);
  color: var(--text-primary);
}
.pending-ccweb-prompt-dismiss:disabled {
  opacity: 0.55;
  cursor: wait;
}
.pending-note {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  animation: fadeIn 0.2s ease;
}
.pending-note .note-avatar {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--note-accent);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}
.pending-note .note-bubble {
  min-width: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), transparent),
    var(--note-bg);
  border: 1px solid var(--note-border);
  color: var(--text-primary);
  box-shadow: 0 8px 18px rgba(45, 31, 20, 0.05);
}
.queued-message .queue-avatar {
  background: var(--accent);
}
.queued-message .queue-bubble {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), transparent),
    var(--accent-light);
  border-color: rgba(192, 85, 58, 0.2);
}
.queued-message .queue-meta {
  color: var(--accent);
}
.input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 8px 12px;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input-wrapper.drag-active {
  border-color: var(--info);
  box-shadow: 0 0 0 3px rgba(91, 126, 161, 0.12);
}
.input-wrapper.note-mode-active {
  border-color: var(--note-border);
  box-shadow: 0 0 0 3px var(--note-bg);
}
.attach-btn {
  appearance: none;
  width: 40px;
  height: 40px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  border-radius: 12px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}
.attach-btn:hover {
  color: var(--accent);
  background: rgba(192, 85, 58, 0.08);
  border-color: rgba(192, 85, 58, 0.12);
}
.note-mode-btn {
  appearance: none;
  width: 36px;
  height: 36px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--note-accent);
  color: #fff;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
}
.note-mode-btn:hover {
  background: var(--note-accent-hover);
  color: #fff;
  border-color: transparent;
}
.note-mode-btn:active {
  transform: scale(0.92);
}
.note-mode-btn.active {
  background: var(--note-accent-hover);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 18px var(--note-bg-strong);
}
.note-mode-btn.active:hover {
  background: var(--note-accent-hover);
  color: #fff;
}
.queue-send-btn {
  appearance: none;
  width: 36px;
  height: 36px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--info);
  color: #fff;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
}
.queue-send-btn:hover {
  background: var(--accent);
  color: #fff;
}
.queue-send-btn:active {
  transform: scale(0.92);
}
.attach-btn:disabled,
.note-mode-btn:disabled,
.queue-send-btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.input-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
#msg-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  line-height: 1.5;
  resize: none;
  outline: none;
  max-height: var(--input-max-height);
  min-height: 24px;
  overflow-y: auto;
}
#msg-input::placeholder { color: var(--text-muted); }
.send-btn, .abort-btn {
  width: 36px; height: 36px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}
.send-btn:active, .abort-btn:active { transform: scale(0.92); }
.send-btn {
  background: var(--accent);
  color: #fff;
}
.send-btn:hover { background: var(--accent-hover); }
.send-btn.note-send {
  background: var(--note-accent);
  color: #fff;
}
.send-btn.note-send:hover {
  background: var(--note-accent-hover);
}
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.abort-btn {
  background: var(--danger);
  color: #fff;
}
.abort-btn:hover { background: var(--accent-hover); }

/* === Option Picker === */
.option-picker {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(45, 31, 20, 0.15);
  padding: 16px;
  min-width: 280px;
  max-width: 380px;
  z-index: 50;
  animation: fadeIn 0.2s ease;
}
.option-picker-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  padding: 0 4px;
}
.option-picker-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.12s;
  margin-bottom: 4px;
}
.option-picker-item:last-child { margin-bottom: 0; }
.option-picker-item:hover { background: var(--accent-light); }
.option-picker-item.active {
  background: var(--accent-light);
  outline: 1px solid var(--accent);
}
.option-picker-item-info { flex: 1; min-width: 0; }
.option-picker-item-label {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
}
.option-picker-item-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.option-picker-item-check {
  color: var(--accent);
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

/* === Mobile === */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 100;
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    position: fixed; inset: 0;
    background: rgba(45, 31, 20, 0.3);
    z-index: 99;
  }
  .menu-btn { display: block; }
  .msg { max-width: 95%; }
  .input-area { padding: 8px 10px; padding-bottom: max(10px, var(--safe-bottom)); }
  .messages {
    padding: 12px 8px 24px;
    scroll-padding-bottom: 24px;
    gap: 10px;
  }
  .session-item-actions { display: flex; }
  .cmd-menu { left: 10px; right: 10px; transform: none; min-width: auto; bottom: 72px; }
  .option-picker { left: 10px; right: 10px; transform: none; min-width: auto; bottom: 72px; }
  .chat-header {
    padding: 0 10px;
    gap: 5px;
  }
  .chat-title {
    font-size: 13px;
  }
  .chat-controls {
    gap: 6px;
    margin-bottom: 6px;
  }
  .chat-session-id-btn {
    max-width: 92px;
    padding-left: 7px;
    padding-right: 7px;
    font-size: 10px;
  }
  .theme-grid {
    grid-template-columns: 1fr;
  }
  .chat-agent-menu {
    left: 0;
    min-width: 138px;
  }
  .chat-runtime-state {
    padding: 2px 8px;
    font-size: 10px;
  }
  .chat-cwd {
    max-width: 98px;
    flex-shrink: 1;
  }
  .mode-select {
    padding: 4px 20px 4px 8px;
    font-size: 11px;
  }
  .user-outline-btn,
  .ccweb-prompt-outline-btn,
  .reload-mcp-btn {
    padding: 4px 8px;
    font-size: 10px;
  }
  .user-outline-text {
    font-size: 12px;
  }
  .user-outline-panel {
    right: 0;
    width: min(320px, calc(100vw - 20px));
  }
}

@media (max-width: 480px) {
  .msg-avatar { width: 28px; height: 28px; font-size: 12px; border-radius: 8px; }
  .msg-bubble { padding: 10px 12px; font-size: 14px; border-radius: 14px; }
  .msg.user .msg-bubble { border-bottom-right-radius: 4px; }
  .msg.assistant .msg-bubble { border-bottom-left-radius: 4px; }
  .code-block-wrapper pre code { font-size: 12px; }
  .input-wrapper { padding: 6px 10px; border-radius: 12px; }
  .attach-btn { width: 34px; height: 34px; border-radius: 10px; }
  .note-mode-btn,
  .queue-send-btn { width: 34px; height: 34px; border-radius: 10px; }
  .send-btn, .abort-btn { width: 34px; height: 34px; }
  .pending-notes-tray { max-height: 34vh; margin-bottom: 8px; }
  .pending-note { grid-template-columns: 26px minmax(0, 1fr); gap: 7px; }
  .pending-note .note-avatar { width: 26px; height: 26px; border-radius: 8px; font-size: 11px; }
  .note-actions { gap: 5px; }
  .note-action { min-height: 28px; padding: 0 8px; }
  .note-edit-input { min-width: 0; }
  .new-chat-btn,
  .new-chat-arrow { min-height: 44px; }
  .new-chat-arrow { width: 48px; }
  .chat-cwd {
    max-width: 76px;
    padding-left: 6px;
    padding-right: 6px;
  }
  .chat-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }
  .ccweb-prompt-outline-anchor {
    width: 100%;
  }
  .chat-cwd,
  .mode-select,
  .user-outline-btn,
  .ccweb-prompt-outline-btn,
  .reload-mcp-btn,
  .chat-runtime-state {
    width: 100%;
    max-width: none;
    justify-content: center;
  }
  .chat-header {
    gap: 4px;
  }
  .chat-title {
    min-width: 0;
  }
  .chat-session-id-btn {
    max-width: 72px;
    padding-left: 6px;
    padding-right: 6px;
  }
  .chat-agent-btn {
    max-width: 96px;
    padding-left: 8px;
    padding-right: 20px;
  }
  .chat-agent-menu {
    left: 0;
    right: auto;
  }
  .user-outline-panel {
    left: 0;
    right: 0;
    width: auto;
    max-height: min(44vh, 300px);
    bottom: calc(100% + 6px);
  }
  .msg-copy-btn {
    opacity: 1;
    width: 24px;
    height: 24px;
  }
}

/* === Utility === */
[hidden] { display: none !important; }

/* === Toast Notification === */
.toast-notification {
  position: fixed;
  top: 16px;
  right: 16px;
  background: var(--success);
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  z-index: 200;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s, transform 0.3s;
}
.toast-notification.show {
  opacity: 1;
  transform: translateY(0);
}

/* === Session Unread Dot === */
.session-unread-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
  margin-left: 4px;
}

/* === Settings Button (sidebar) === */
.settings-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  vertical-align: middle;
  margin-right: 8px;
}
.settings-btn:hover { color: var(--text-primary); background: var(--bg-tertiary); }

/* === Settings Overlay & Panel === */
.settings-overlay {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(45, 31, 20, 0.4);
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}
.settings-panel {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  width: 90%;
  max-width: 420px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(45, 31, 20, 0.12);
  padding: 32px 28px;
  animation: fadeIn 0.25s ease;
}
.settings-panel h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.settings-panel h3 .settings-close {
  margin-left: auto;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 6px;
}
.settings-panel h3 .settings-close:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.settings-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}
.settings-back {
  appearance: none;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.settings-back:hover {
  background: var(--bg-tertiary);
}
.settings-header h3 {
  margin-bottom: 0;
  flex: 1;
}
.settings-subpage-header {
  align-items: flex-start;
}
.settings-subpage-copy {
  flex: 1;
  min-width: 0;
}
.settings-subpage-copy h3 {
  margin-bottom: 0;
}
.settings-subpage-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin-bottom: 4px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.settings-header .settings-close {
  margin-left: auto;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 6px;
}
.settings-header .settings-close:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.settings-field {
  margin-bottom: 16px;
}
.agent-context-card {
  margin: -6px 0 18px;
  padding: 14px 16px 15px;
  border: 1px solid rgba(192, 85, 58, 0.14);
  border-radius: 14px;
  background:
    radial-gradient(circle at top right, rgba(192, 85, 58, 0.12), transparent 45%),
    linear-gradient(135deg, rgba(245, 221, 212, 0.65), rgba(255, 249, 242, 0.96));
}
.agent-context-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.agent-context-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.agent-context-copy {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.65;
}
.settings-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.settings-inline-note {
  margin: -4px 0 16px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.65;
  color: var(--text-secondary);
  background: rgba(255, 249, 242, 0.9);
  border: 1px solid rgba(221, 208, 192, 0.9);
}
.settings-inline-note.warning {
  color: #8b6420;
  background: rgba(255, 246, 223, 0.95);
  border-color: rgba(232, 190, 92, 0.3);
}
.settings-inline-note code {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 6px;
  background: rgba(45, 31, 20, 0.08);
  color: var(--text-primary);
}
.settings-nav-card {
  appearance: none;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 249, 242, 0.92));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.settings-nav-card:hover {
  transform: translateY(-1px);
  border-color: rgba(192, 85, 58, 0.24);
  box-shadow: 0 12px 24px rgba(45, 31, 20, 0.06);
}
.settings-nav-card-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.settings-nav-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}
.settings-nav-card-meta {
  font-size: 12px;
  color: var(--text-secondary);
}
.settings-nav-card-arrow {
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}
.settings-toggle-row {
  width: 100%;
  margin-top: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background: var(--theme-card-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  cursor: pointer;
}
.settings-toggle-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.settings-toggle-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}
.settings-toggle-meta {
  font-size: 12px;
  color: var(--text-secondary);
}
.settings-switch {
  position: relative;
  flex: 0 0 auto;
  width: 42px;
  height: 24px;
}
.settings-switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.settings-switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  transition: background 0.18s ease, border-color 0.18s ease;
}
.settings-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface-strong);
  box-shadow: 0 2px 6px rgba(45, 31, 20, 0.18);
  transition: transform 0.18s ease, background 0.18s ease;
}
.settings-switch input:checked + .settings-switch-track {
  background: var(--accent);
  border-color: var(--accent);
}
.settings-switch input:checked + .settings-switch-track .settings-switch-thumb {
  transform: translateX(18px);
  background: var(--accent-ink, #fff);
}
.settings-switch input:focus-visible + .settings-switch-track {
  outline: 2px solid var(--accent-light);
  outline-offset: 2px;
}
.settings-subpage-panel {
  max-width: 460px;
}
.theme-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.theme-card {
  appearance: none;
  border: 1px solid var(--theme-card-border);
  border-radius: 16px;
  background: var(--theme-card-bg);
  padding: 12px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.theme-card:hover {
  transform: translateY(-2px);
  border-color: var(--theme-card-hover-border);
}
.theme-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--theme-card-active-ring);
}
.theme-card-preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 10px;
}
.theme-card-swatch {
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}
.theme-card-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.theme-card-desc {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.45;
}
.settings-field input,
.settings-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.settings-field input:focus,
.settings-select:focus { border-color: var(--accent); }
.settings-field input:disabled,
.settings-select:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
.settings-field-disabled {
  opacity: 0.65;
}
.settings-retry-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}
.settings-select {
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b5a4d'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.settings-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}
.settings-actions button {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}
.settings-actions .btn-test {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}
.settings-actions .btn-test:hover { background: var(--bg-secondary); }
.settings-actions .btn-save {
  background: var(--accent);
  color: #fff;
}
.settings-actions .btn-save:hover { background: var(--accent-hover); }
.settings-status {
  margin-top: 12px;
  font-size: 13px;
  text-align: center;
  min-height: 20px;
}
.settings-status.success { color: var(--success); }
.settings-status.error { color: var(--danger); }

@media (max-width: 768px) {
  .settings-panel { padding: 24px 20px; border-radius: 16px; }
}
@media (max-width: 480px) {
  .settings-panel { width: 95%; padding: 20px 16px; }
  .settings-nav-card { padding: 13px 14px; }
  .settings-back { width: 32px; height: 32px; }
  .settings-retry-grid { grid-template-columns: 1fr; }
}

/* === Force Change Password Overlay === */
.force-change-overlay {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(45, 31, 20, 0.6);
  z-index: 2000;
  animation: fadeIn 0.25s ease;
}
.force-change-panel {
  text-align: center;
  padding: 48px 36px;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 8px 32px rgba(45, 31, 20, 0.15);
  animation: fadeIn 0.25s ease;
}
.force-change-panel .login-logo {
  width: 56px; height: 56px;
  margin: 0 auto 12px;
  border-radius: 14px;
  display: block;
  object-fit: contain;
}
.force-change-panel h2 {
  font-size: 22px;
  margin-bottom: 4px;
  color: var(--text-primary);
  font-weight: 700;
}
.force-change-panel p {
  color: var(--text-secondary);
  margin-bottom: 24px;
  font-size: 14px;
}
.force-change-form input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  margin-bottom: 10px;
  transition: border-color 0.2s;
}
.force-change-form input:focus { border-color: var(--accent); }
.fc-submit-btn {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
  margin-top: 6px;
}
.fc-submit-btn:hover:not(:disabled) { background: var(--accent-hover); }
.fc-submit-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.fc-status {
  margin-top: 10px;
  font-size: 13px;
  min-height: 18px;
  color: var(--text-secondary);
}
.fc-status.error { color: var(--danger); }
.fc-status.success { color: var(--success); }

/* === Password Hint === */
.password-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: -4px 0 10px 2px;
  text-align: left;
}
.password-hint.error { color: var(--danger); }
.password-hint.success { color: var(--success); }

/* === Settings Divider === */
.settings-divider {
  height: 1px;
  background: var(--border-color);
  margin: 24px 0;
}

/* === Settings Section Title === */
.settings-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

/* === New Chat Split Button === */
.new-chat-split {
  display: flex;
  align-items: stretch;
  gap: 6px;
}
.new-chat-split.single .new-chat-btn {
  border-radius: 10px;
}
.new-chat-split.single .new-chat-arrow {
  display: none;
}
.new-chat-split .new-chat-btn {
  flex: 1;
  min-height: 48px;
  border-radius: 10px 0 0 10px;
}
.new-chat-arrow {
  width: 52px;
  min-height: 48px;
  padding: 0;
  background: var(--accent);
  border: none;
  border-radius: 0 10px 10px 0;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.new-chat-arrow:hover { background: var(--accent-hover); }
.new-chat-dropdown {
  position: absolute;
  top: 54px;
  left: 12px;
  right: 12px;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(45,31,20,0.12);
  z-index: 200;
  overflow: hidden;
}
.new-chat-dropdown button {
  display: block;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  text-align: left;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.12s;
}
.new-chat-dropdown button:hover { background: var(--accent-light); }

html[data-theme='coolvibe'] .settings-nav-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(243, 250, 252, 0.94));
  border-color: rgba(191, 220, 228, 0.96);
}

html[data-theme='coolvibe'] .settings-nav-card:hover {
  border-color: rgba(8, 145, 178, 0.28);
  box-shadow: 0 12px 24px rgba(8, 145, 178, 0.08);
}

html[data-theme='coolvibe'] .settings-back {
  background: rgba(8, 145, 178, 0.08);
  border-color: rgba(167, 205, 216, 0.84);
  color: #0c6478;
}

html[data-theme='coolvibe'] .settings-back:hover {
  background: rgba(8, 145, 178, 0.16);
}
.sidebar-header { position: relative; }

/* === Chat CWD label === */
.chat-cwd {
  appearance: none;
  border: none;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 2px 8px;
  border-radius: 6px;
  flex-shrink: 0;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: inherit;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.chat-cwd:hover { background: var(--accent-light); color: var(--accent); }
.chat-cwd:focus-visible {
  outline: 2px solid rgba(192, 85, 58, 0.24);
  outline-offset: 2px;
}
.chat-cwd:disabled { cursor: default; opacity: 0.7; }

/* === Modal Overlay === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(45,31,20,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 16px;
}
.modal-panel {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(45,31,20,0.15);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}
.modal-panel-wide {
  max-width: 600px;
}
.attachment-preview-panel {
  width: min(92vw, 1040px);
  max-width: min(92vw, 1040px);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.modal-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
}
.modal-close-btn {
  background: none;
  border: none;
  font-size: 16px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  line-height: 1;
}
.modal-close-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.attachment-preview-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 20px 20px;
}
.attachment-preview-stage {
  position: relative;
  min-height: 320px;
  max-height: 72vh;
  border-radius: 16px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(245, 238, 229, 0.96), rgba(232, 222, 211, 0.92));
  border: 1px solid rgba(221, 208, 192, 0.92);
}
.attachment-preview-stage.is-ready {
  background: #111;
}
.attachment-preview-stage.is-error {
  border-color: rgba(192, 85, 58, 0.24);
}
.attachment-preview-image {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 72vh;
  object-fit: contain;
  background: #111;
}
.attachment-preview-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.attachment-preview-name {
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 700;
}
.attachment-preview-desc {
  color: var(--text-secondary);
  font-size: 12px;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}
.modal-field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.modal-field-row {
  display: flex;
  gap: 8px;
}
.modal-select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.modal-select:focus { border-color: var(--accent); }
.modal-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-text-input {
  flex: 1;
  padding: 10px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.modal-text-input:focus { border-color: var(--accent); }
.modal-btn-primary {
  padding: 9px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.modal-btn-primary:hover { background: var(--accent-hover); }
.modal-btn-secondary {
  padding: 9px 20px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}
.modal-btn-secondary:hover { background: var(--bg-secondary); }
.modal-btn-inline {
  flex: 0 0 auto;
  white-space: nowrap;
}
.modal-field-hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  word-break: break-all;
}
.codex-user-input-panel {
  max-width: 520px;
}
.codex-user-input-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.codex-user-input-question {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.codex-user-input-kicker {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}
.codex-user-input-prompt {
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.5;
}
.codex-user-input-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.codex-user-input-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-primary);
  cursor: pointer;
}
.codex-user-input-option:hover {
  border-color: rgba(192, 85, 58, 0.36);
}
.codex-user-input-option input[type='radio'] {
  margin-top: 3px;
}
.codex-user-input-option-copy {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.codex-user-input-option-label {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 14px;
}
.codex-user-input-option-desc {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}
.codex-user-input-text {
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font: inherit;
  outline: none;
}
.codex-user-input-text:focus {
  border-color: var(--accent);
}
.ccweb-prompt-card {
  width: min(100%, 720px);
  margin-top: 14px;
  padding: 0;
  border: 1px solid rgba(192, 85, 58, 0.18);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 249, 242, 0.98), rgba(250, 246, 240, 0.94));
  color: var(--text-primary);
  box-shadow: 0 14px 34px rgba(45, 31, 20, 0.08);
  overflow: hidden;
}
.ccweb-prompt-card.ccweb-prompt-focus {
  animation: ccwebPromptFocus 1.4s ease;
}
@keyframes ccwebPromptFocus {
  0% {
    box-shadow: 0 0 0 0 rgba(192, 85, 58, 0.34), 0 14px 34px rgba(45, 31, 20, 0.08);
  }
  45% {
    box-shadow: 0 0 0 5px rgba(192, 85, 58, 0.18), 0 18px 38px rgba(45, 31, 20, 0.12);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(192, 85, 58, 0), 0 14px 34px rgba(45, 31, 20, 0.08);
  }
}
.ccweb-prompt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 46px;
  padding: 9px 12px;
  border-bottom: 1px solid rgba(221, 208, 192, 0.72);
}
.ccweb-prompt-title-wrap {
  flex: 1 1 auto;
  min-width: 0;
}
.ccweb-prompt-kicker {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.ccweb-prompt-title {
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ccweb-prompt-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
}
.ccweb-prompt-status {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid rgba(192, 85, 58, 0.18);
  border-radius: 999px;
  background: rgba(245, 221, 212, 0.6);
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
}
.ccweb-prompt-card[data-status='submitted'] .ccweb-prompt-status {
  width: auto;
  padding: 0 7px;
  border-color: rgba(93, 138, 84, 0.28);
  background: rgba(93, 138, 84, 0.12);
  color: var(--success);
  font-size: 11px;
}
.ccweb-prompt-desc {
  margin: 0;
  padding: 10px 12px 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.ccweb-prompt-view-controls {
  padding: 8px 12px 0;
}
.ccweb-prompt-view-switcher {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  padding: 1px;
  border: 1px solid rgba(221, 208, 192, 0.94);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.48);
}
.ccweb-prompt-view-btn {
  width: 26px;
  height: 26px;
  min-height: 26px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}
.ccweb-prompt-view-btn.is-active {
  background: var(--accent);
  color: var(--accent-ink);
}
.ccweb-prompt-tabs {
  display: none;
  min-width: 0;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.ccweb-prompt-tab {
  flex: 0 0 auto;
  max-width: 168px;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid rgba(221, 208, 192, 0.94);
  border-radius: 8px;
  background: rgba(255, 249, 242, 0.72);
  color: var(--text-secondary);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ccweb-prompt-tab.is-active {
  border-color: var(--accent);
  background: rgba(245, 221, 212, 0.72);
  color: var(--accent);
}
.ccweb-prompt-tab-nav {
  display: none;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-width: 0;
}
.ccweb-prompt-tab-nav-btn {
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid rgba(221, 208, 192, 0.98);
  border-radius: 8px;
  background: rgba(255, 249, 242, 0.75);
  color: var(--text-primary);
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}
.ccweb-prompt-tab-nav-btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.ccweb-prompt-tab-counter {
  min-width: 64px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}
.ccweb-prompt-card[data-view-mode='tabs'] .ccweb-prompt-tabs {
  display: flex;
}
.ccweb-prompt-card[data-view-mode='cards'] .ccweb-prompt-view-controls {
  display: none;
}
.ccweb-prompt-card[data-view-mode='tabs'] .ccweb-prompt-tab-nav {
  display: flex;
}
.ccweb-prompt-card[data-view-mode='tabs'] .ccweb-prompt-question:not(.is-active) {
  display: none;
}
.ccweb-prompt-questions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 0;
  padding: 10px 12px 4px;
}
.ccweb-prompt-question {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 13px 14px;
  border: 1px solid rgba(221, 208, 192, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.46);
}
.ccweb-prompt-question-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.ccweb-prompt-question-title {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.ccweb-prompt-required {
  flex: 0 0 auto;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(192, 85, 58, 0.1);
  color: var(--danger);
  font-size: 12px;
  font-weight: 800;
}
.ccweb-prompt-question-body {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.ccweb-prompt-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
}
.ccweb-prompt-option {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  column-gap: 9px;
  row-gap: 4px;
  min-width: 0;
  align-items: start;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid rgba(221, 208, 192, 0.96);
  border-radius: 8px;
  background: rgba(255, 249, 242, 0.82);
  color: var(--text-primary);
  font: inherit;
  font-size: 13px;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}
.ccweb-prompt-option::before {
  content: '';
  width: 15px;
  height: 15px;
  margin-top: 1px;
  border: 1.5px solid var(--border-color);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.75);
  box-sizing: border-box;
}
.ccweb-prompt-option:hover {
  border-color: var(--accent);
  background: rgba(255, 249, 242, 0.98);
  box-shadow: 0 8px 18px rgba(45, 31, 20, 0.06);
  transform: translateY(-1px);
}
.ccweb-prompt-option.is-selected {
  border-color: var(--accent);
  background: rgba(245, 221, 212, 0.72);
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px rgba(192, 85, 58, 0.16);
}
.ccweb-prompt-option.is-selected::before {
  content: '✓';
  display: grid;
  place-items: center;
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 10px;
  font-weight: 900;
}
.ccweb-prompt-clear-choice {
  grid-column: 1 / -1;
  justify-self: start;
  border: 1px solid rgba(221, 208, 192, 0.9);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.56);
  color: var(--text-muted);
  font: inherit;
  font-size: 12px;
  line-height: 1.25;
  padding: 4px 8px;
  cursor: pointer;
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}
.ccweb-prompt-clear-choice:hover {
  border-color: var(--accent);
  background: rgba(255, 249, 242, 0.96);
  color: var(--accent);
}
.ccweb-prompt-option-label {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}
.ccweb-prompt-option-badge {
  flex: 0 0 auto;
  align-self: start;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(192, 85, 58, 0.12);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
}
.ccweb-prompt-option-desc {
  grid-column: 2 / -1;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
  text-align: left;
}
.ccweb-prompt-answer {
  width: 100%;
  min-height: 84px;
  resize: vertical;
  padding: 10px 11px;
  border: 1px solid rgba(221, 208, 192, 0.98);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--text-primary);
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}
.ccweb-prompt-answer:focus {
  border-color: var(--accent);
  background: var(--bg-primary);
  box-shadow: 0 0 0 3px rgba(192, 85, 58, 0.1);
}
.ccweb-prompt-selected-readonly,
.ccweb-prompt-answer-readonly {
  padding: 10px 11px;
  border: 1px solid rgba(221, 208, 192, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.ccweb-prompt-selected-readonly {
  color: var(--text-secondary);
}
.ccweb-prompt-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 0;
  padding: 9px 12px 11px;
  border-top: 1px solid rgba(221, 208, 192, 0.72);
  background: rgba(242, 235, 226, 0.38);
}
.ccweb-prompt-footer-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}
.ccweb-prompt-submit,
.ccweb-prompt-secondary {
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}
.ccweb-prompt-submit {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}
.ccweb-prompt-submit:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 8px 18px rgba(192, 85, 58, 0.18);
  transform: translateY(-1px);
}
.ccweb-prompt-submit:disabled {
  opacity: 0.65;
  cursor: wait;
}
.ccweb-prompt-secondary {
  border: 1px solid rgba(221, 208, 192, 0.98);
  background: rgba(255, 249, 242, 0.75);
  color: var(--text-primary);
}
.ccweb-prompt-secondary:hover {
  border-color: var(--accent);
  background: var(--bg-primary);
}
.ccweb-prompt-error {
  margin: 2px 18px 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 800;
}
@media (max-width: 640px) {
  .pending-ccweb-prompt {
    grid-template-columns: 10px minmax(72px, 1fr) auto auto;
  }
  .pending-ccweb-prompt-title {
    max-width: none;
  }
  .ccweb-prompt-card {
    width: 100%;
  }
  .ccweb-prompt-header {
    padding: 9px 10px;
  }
  .ccweb-prompt-header-actions {
    gap: 5px;
  }
  .ccweb-prompt-desc {
    padding: 9px 10px 0;
  }
  .ccweb-prompt-view-controls {
    padding: 8px 10px 0;
  }
  .ccweb-prompt-view-switcher {
    width: auto;
  }
  .ccweb-prompt-question-head {
    align-items: flex-start;
  }
  .ccweb-prompt-tab-nav {
    flex: 0 1 auto;
  }
  .ccweb-prompt-tab-nav-btn {
    flex: 0 0 auto;
  }
  .ccweb-prompt-questions {
    padding: 10px 10px 4px;
  }
  .ccweb-prompt-footer {
    flex-wrap: wrap;
    padding: 9px 10px 10px;
  }
  .ccweb-prompt-footer-actions {
    flex: 1 1 auto;
    margin-left: 0;
  }
  .ccweb-prompt-error {
    margin-right: 10px;
    margin-left: 10px;
  }
  .ccweb-prompt-submit,
  .ccweb-prompt-secondary {
    width: auto;
  }
}
.codex-approval-panel {
  max-width: 560px;
}
.codex-approval-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.codex-approval-summary {
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
  word-break: break-word;
}
.codex-approval-reason {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}
.codex-approval-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.codex-approval-meta span {
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: var(--bg-primary);
  color: var(--text-muted);
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
}
.codex-approval-payload {
  max-height: 260px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.codex-approval-footer {
  flex-wrap: wrap;
}
.codex-approval-deny-btn {
  color: var(--danger);
}
.modal-quick-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.modal-quick-pick {
  max-width: 100%;
  padding: 7px 10px;
  border: 1px solid rgba(192, 85, 58, 0.14);
  border-radius: 999px;
  background: rgba(255, 252, 248, 0.96);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.4;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  word-break: break-all;
}
.modal-quick-pick:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: rgba(192, 85, 58, 0.24);
}
.modal-loading, .modal-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 0;
  font-size: 14px;
}

/* === Import Session List === */
.import-filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-secondary);
  cursor: pointer;
}
.import-filter-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.import-filter-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}
.import-filter-meta {
  font-size: 12px;
  color: var(--text-muted);
}
.import-group {
  margin-bottom: 20px;
}
.import-group:last-child { margin-bottom: 0; }
.import-group-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 4px 0 8px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 8px;
  word-break: break-all;
}
.import-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--bg-tertiary);
}
.import-item:last-child { border-bottom: none; }
.import-item-info {
  flex: 1;
  min-width: 0;
}
.import-item-title {
  font-size: 14px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 2px;
}
.import-item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.import-item-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--accent);
  background: rgba(245, 221, 212, 0.9);
  border: 1px solid rgba(192, 85, 58, 0.14);
  border-radius: 999px;
  padding: 2px 7px;
}
.import-item-meta {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.import-item-btn {
  flex-shrink: 0;
  padding: 6px 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.collab-agent-stack {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.collab-agent-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  min-width: 0;
}
.collab-agent-title-wrap {
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 4px;
  overflow: hidden;
}
.collab-agent-kicker {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--info);
}
.collab-agent-title {
  min-width: 0;
  max-width: 56px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.collab-agent-meta {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-muted);
}
.collab-agent-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.collab-agent-overall-status,
.collab-agent-item-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}
.collab-agent-overall-status.running,
.collab-agent-item-status.running {
  background: rgba(232, 190, 92, 0.16);
  color: #9a6f14;
}
.collab-agent-overall-status.done,
.collab-agent-item-status.done {
  background: rgba(93, 138, 84, 0.14);
  color: var(--success);
}
.collab-agent-overall-status.error,
.collab-agent-item-status.error {
  background: rgba(192, 85, 58, 0.14);
  color: var(--danger);
}
.collab-agent-overall-status.closed,
.collab-agent-item-status.closed {
  background: rgba(122, 110, 100, 0.12);
  color: var(--text-muted);
}
.collab-agent-overall-status.pending,
.collab-agent-item-status.pending {
  background: rgba(91, 126, 161, 0.12);
  color: var(--info);
}
.collab-agent-prompt {
  padding: 10px 12px;
  border: 1px solid rgba(91, 126, 161, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.6;
}
.collab-agent-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.collab-agent-item {
  appearance: none;
  max-width: 100%;
  min-height: 40px;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border: 1px solid rgba(91, 126, 161, 0.16);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.58);
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.collab-agent-item-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.collab-agent-item-label {
  min-width: 0;
  max-width: 150px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.collab-agent-item-role {
  font-size: 11px;
  color: var(--info);
  font-weight: 700;
}
.collab-agent-item-detail {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.55;
}
.collab-agent-item-footer {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.1;
  display: none;
}
.collab-agent-item-footer:hover {
  color: var(--info);
}
.collab-agent-close-btn {
  appearance: none;
  flex-shrink: 0;
  border: 1px solid rgba(122, 110, 100, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text-secondary);
  min-height: 22px;
  padding: 0 8px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.collab-agent-close-btn:hover {
  color: var(--danger);
  border-color: rgba(192, 85, 58, 0.22);
  background: rgba(192, 85, 58, 0.08);
}
.collab-agent-close-btn:disabled {
  cursor: default;
  opacity: 0.6;
}
.collab-agent-threads {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.collab-agent-thread-chip {
  appearance: none;
  border: 1px solid rgba(91, 126, 161, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--info);
  padding: 4px 10px;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.collab-agent-thread-chip:hover {
  background: rgba(91, 126, 161, 0.1);
}

/* Todo List */
.todo-list-container {
  margin: 12px 0;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--bg-tertiary);
}
.todo-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.todo-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--bg-tertiary);
}
.todo-item:last-child {
  border-bottom: none;
}
.todo-checkbox {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  cursor: pointer;
}
.todo-text {
  flex: 1;
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.5;
}
.todo-item.completed .todo-text {
  text-decoration: line-through;
  color: var(--text-muted);
  opacity: 0.6;
}
@media (max-width: 640px) {
  .collab-agent-header {
    align-items: flex-start;
  }
  .collab-agent-title-wrap {
    flex-wrap: wrap;
  }
  .collab-agent-actions {
    margin-left: auto;
  }
  .collab-agent-item-label {
    max-width: 96px;
  }
}
.import-item-btn:hover { background: var(--accent-hover); }

/* === File Browser === */
.directory-picker-panel,
.file-browser-panel {
  max-width: 980px;
  height: min(82vh, 760px);
}
.file-browser-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}
.file-browser-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.file-browser-toolbar-btn {
  appearance: none;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.file-browser-toolbar-btn:hover:not(:disabled) {
  background: var(--accent-light);
  color: var(--accent);
}
.file-browser-toolbar-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.file-browser-path {
  min-width: 0;
  flex: 1;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
  word-break: break-all;
}
.file-browser-status {
  min-height: 18px;
  font-size: 12px;
  color: var(--text-muted);
}
.file-browser-status[data-state='error'] {
  color: var(--danger);
}
.file-browser-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 12px;
}
.file-browser-pane {
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-primary);
}
.file-browser-pane-title {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}
.file-browser-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.file-browser-item {
  appearance: none;
  width: 100%;
  border: none;
  background: transparent;
  border-radius: 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}
.file-browser-item:hover {
  background: var(--bg-tertiary);
}
.file-browser-item.active {
  background: var(--accent-light);
}
.file-browser-item-icon {
  min-width: 42px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(192, 85, 58, 0.12);
  border: 1px solid rgba(192, 85, 58, 0.16);
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.file-browser-item.directory .file-browser-item-icon {
  background: rgba(93, 138, 84, 0.12);
  border-color: rgba(93, 138, 84, 0.18);
  color: #4e7f46;
}
.file-browser-item-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.file-browser-item-name {
  font-size: 14px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-browser-item-meta {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-browser-preview-pane {
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.file-browser-preview-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
}
.file-browser-preview-copy {
  flex: 1;
  min-width: 0;
}
.file-browser-preview-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-browser-preview-meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}
.file-browser-mobile-back {
  display: none;
  appearance: none;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  flex-shrink: 0;
}
.file-browser-preview-empty {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}
.file-browser-preview-content {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 14px 16px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-primary);
  background: var(--bg-primary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (max-width: 768px) {
  .modal-field-row {
    flex-wrap: wrap;
  }
  .modal-btn-inline {
    width: 100%;
  }
  .file-browser-panel {
    max-width: none;
    width: 100%;
    height: calc(100vh - 20px);
  }
  .directory-picker-panel {
    max-width: none;
    width: 100%;
    height: calc(100vh - 20px);
  }
  .file-browser-body {
    padding: 14px;
  }
  .file-browser-toolbar {
    align-items: stretch;
  }
  .file-browser-path {
    width: 100%;
    order: 3;
  }
  .file-browser-layout {
    display: block;
  }
  .file-browser-panel:not(.preview-active) .file-browser-preview-pane {
    display: none;
  }
  .file-browser-panel.preview-active .file-browser-list-pane {
    display: none;
  }
  .file-browser-mobile-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .file-browser-preview-header {
    flex-direction: column;
  }
}

/* === Dark Theme Completion Layer === */
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) body {
  background: var(--page-background);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .login-overlay {
  background: var(--login-background);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .settings-overlay,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .force-change-overlay,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .modal-overlay,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .sidebar-overlay {
  background: rgba(0, 0, 0, 0.58);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .login-box,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .force-change-panel,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .settings-panel,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .modal-panel,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .option-picker,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .chat-agent-menu,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .cmd-menu,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .new-chat-dropdown,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .user-outline-panel {
  background: var(--dark-panel-bg);
  border-color: var(--border-color);
  box-shadow: var(--shadow-strong);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .sidebar {
  background: linear-gradient(180deg, var(--bg-secondary), var(--bg-primary));
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .chat-main {
  background: var(--page-background);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .sidebar-header,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .sidebar-footer,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .chat-header,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .input-area,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .modal-header,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .modal-footer {
  background: rgba(0, 0, 0, 0.16);
  border-color: var(--border-color);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .agent-switch,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .session-search-input,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .session-search-clear,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .session-list-empty,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .session-project-header,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .session-project-create,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .session-list-load-more,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .chat-agent-btn,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .mode-select,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .chat-cwd,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .user-outline-btn,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-outline-btn,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .reload-mcp-btn,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .user-outline-item,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .pending-ccweb-prompt,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .settings-back,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .settings-nav-card,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .settings-toggle-row,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .theme-card,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .settings-field input,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .settings-select,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .force-change-form input,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .modal-select,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .modal-text-input,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .codex-user-input-text,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .input-wrapper,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .attachment-chip,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .attachment-chip.uploading,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .msg-attachment-card,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ask-question-card,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ask-option-preview,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ask-option-item,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .codex-user-input-option,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .modal-quick-pick,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .file-browser-toolbar-btn,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .file-browser-mobile-back,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .file-browser-path,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .file-browser-pane,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .file-browser-preview-content,
  :is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .collab-agent-prompt,
  :is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .collab-agent-item,
  :is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .collab-agent-thread-chip,
  :is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .collab-agent-close-btn,
  :is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .todo-list-container {
  background: var(--dark-panel-soft);
  border-color: var(--border-color);
  color: var(--text-primary);
  box-shadow: none;
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .settings-select,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .mode-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23b7c7c0'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 10px 6px;
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .settings-select {
  background-position: right 12px center;
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .mode-select {
  background-position: right 8px center;
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .session-project-count,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .session-item-pin-badge,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .cmd-item-kind,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .import-item-tag,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .file-browser-item-icon {
  background: var(--accent-light);
  border-color: var(--theme-card-hover-border);
  color: var(--accent);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .session-search::before {
  color: var(--text-muted);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .session-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(94, 205, 245, 0.12);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .file-browser-item.directory .file-browser-item-icon {
  background: var(--note-bg);
  border-color: var(--note-border);
  color: var(--note-accent);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .session-item:hover,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .session-item-btn:hover,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .session-search-clear:hover,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .session-search-clear:focus-visible,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .session-project-toggle:hover,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .session-project-toggle:focus-visible,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .chat-title:hover,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .menu-btn:hover,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .settings-btn:hover,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .modal-close-btn:hover,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .option-picker-item:hover,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .cmd-item:hover,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .cmd-item.active,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .file-browser-item:hover,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .user-outline-item:hover,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .pending-ccweb-prompt:hover {
  background: var(--accent-light);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .session-item.active,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .option-picker-item.active,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ask-option-item.ask-option-selected,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .file-browser-item.active {
  background: var(--accent-light);
  border-color: var(--accent);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .new-chat-btn,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .new-chat-arrow,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .send-btn,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .settings-actions .btn-save,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .fc-submit-btn,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .modal-btn-primary,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .import-item-btn,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .agent-switch-btn.active {
  color: var(--accent-ink);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .note-mode-btn,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .queue-send-btn,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .send-btn.note-send {
  color: var(--bg-primary);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .msg.assistant .msg-bubble,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .msg.cross-conversation .msg-bubble,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .msg.cross-conversation-reply .msg-bubble {
  background: var(--bg-bubble-assistant);
  border-color: var(--border-color);
  color: var(--text-primary);
  box-shadow: var(--dark-shadow-soft);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .cross-conversation-id-btn,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .cross-conversation-collapse-btn {
  background: var(--dark-panel-soft);
  border-color: var(--border-color);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .msg-attachment-card.is-expired,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .msg-attachment-thumb,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .attachment-preview-stage,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .code-preview-pane {
  background: linear-gradient(180deg, var(--bg-tertiary), var(--bg-secondary));
  border-color: var(--border-color);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .attachment-preview-stage.is-ready,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .attachment-preview-image {
  background: #050708;
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .pending-note .note-bubble,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .attachment-tray-note,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .settings-inline-note,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .settings-inline-note.warning,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .agent-context-card {
  background: var(--note-bg);
  border-color: var(--note-border);
  color: var(--text-secondary);
  box-shadow: none;
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .queued-message .queue-bubble {
  background: var(--accent-light);
  border-color: var(--border-color);
  color: var(--text-primary);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .settings-inline-note code,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .tool-call-code {
  background: rgba(0, 0, 0, 0.22);
  color: var(--text-primary);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .tool-call,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .tool-group {
  background: var(--dark-panel-bg);
  border-color: var(--border-color);
  box-shadow: none;
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .tool-call.codex-command,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .tool-call.ccweb-mcp-child-agent-tool-call {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .tool-call summary,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .tool-group-summary {
  background: var(--dark-panel-soft);
  color: var(--text-secondary);
  border-color: var(--border-color);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .tool-call summary:hover,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .tool-group-summary:hover {
  background: var(--accent-light);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .tool-call-content,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .tool-call-content.reasoning,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .tool-call-content.collab-agent-content,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .tool-call-content.command,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .tool-call-content.file-change,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .tool-group-inner,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ask-user-question {
  background: var(--bg-bubble-assistant);
  color: var(--text-primary);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .tool-call-content.collab-agent-content {
  background: transparent;
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .tool-call-state,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .session-item-status,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .collab-agent-overall-status,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .collab-agent-item-status {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .theme-card-swatch {
  border-color: rgba(255, 255, 255, 0.16);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-card {
  background: linear-gradient(180deg, var(--dark-panel-bg), var(--bg-bubble-assistant));
  border-color: var(--border-color);
  border-left-color: var(--accent);
  color: var(--text-primary);
  box-shadow: var(--shadow-strong);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-card.ccweb-prompt-focus {
  animation: ccwebPromptFocusDark 1.4s ease;
}

@keyframes ccwebPromptFocusDark {
  0% {
    box-shadow: 0 0 0 0 var(--accent-light), var(--shadow-strong);
  }
  45% {
    box-shadow: 0 0 0 5px var(--accent-light), var(--shadow-strong);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 0, 0, 0), var(--shadow-strong);
  }
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-header,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-footer {
  background: rgba(0, 0, 0, 0.12);
  border-color: var(--border-color);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-status,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-required,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-option-badge {
  background: var(--accent-light);
  border-color: var(--theme-card-hover-border);
  color: var(--accent);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-card[data-status='submitted'] .ccweb-prompt-status {
  background: rgba(103, 201, 135, 0.14);
  border-color: rgba(103, 201, 135, 0.32);
  color: var(--success);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-view-switcher,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-tab,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-tab-nav-btn,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-question,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-option,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-answer,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-selected-readonly,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-answer-readonly,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-secondary,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .pending-ccweb-prompt-action {
  background: var(--dark-panel-soft);
  border-color: var(--border-color);
  color: var(--text-primary);
  box-shadow: none;
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-question {
  background: rgba(255, 255, 255, 0.035);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-option::before {
  background: rgba(0, 0, 0, 0.18);
  border-color: var(--text-muted);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-clear-choice {
  background: rgba(0, 0, 0, 0.16);
  border-color: var(--theme-card-hover-border);
  color: var(--text-muted);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-option:hover,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-clear-choice:hover,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-tab-nav-btn:hover,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-secondary:hover,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .pending-ccweb-prompt-action:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--text-primary);
  box-shadow: none;
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-tab.is-active,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-option.is-selected {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px var(--theme-card-hover-border);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-option.is-selected::before {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-answer {
  background: rgba(0, 0, 0, 0.18);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-answer::placeholder {
  color: var(--text-muted);
  opacity: 0.86;
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-answer:focus {
  background: var(--bg-bubble-assistant);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-submit:hover:not(:disabled) {
  box-shadow: 0 8px 18px var(--accent-light);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-submit:disabled,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-secondary:disabled {
  opacity: 0.56;
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .pending-ccweb-prompt-badge {
  box-shadow: 0 0 0 3px var(--accent-light);
}

:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .pending-ccweb-prompt-dismiss:hover {
  background: var(--accent-light);
}
