:root {
  color-scheme: light;
  --bg: #f6f8fc;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-solid: #ffffff;
  --line: #e3e8f2;
  --line-strong: #c6d4eb;
  --text: #101828;
  --muted: #8a94a6;
  --primary: #2b6ff6;
  --primary-dark: #1958d7;
  --primary-soft: #eef4ff;
  --shadow: 0 24px 70px rgba(34, 86, 154, 0.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; min-height: 100%; overflow: hidden; }
html { background: #f4f8ff; }
body {  min-height: 100dvh;  overscroll-behavior-y: none;  background: linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}
button, textarea, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.login-card h1 { margin: 18px 0 8px; font-size: 28px; color: #0d2c5d; }
.login-card p { margin: 0 0 22px; color: var(--muted); }
.login-card input {
  width: 100%;
  height: 48px;
  margin-bottom: 12px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  outline: none;
  background: #fff;
  color: var(--text);
}
.login-card input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(43, 111, 246, 0.12); }
.login-card button {
  width: 100%;
  height: 48px;
  border: 0;
  border-radius: 15px;
  color: #fff;
  font-weight: 800;
  background: var(--primary);
}
.login-error { min-height: 20px; margin-top: 12px; color: #c0392b; font-size: 14px; }

.app-shell {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: 280px 1fr;
}
.sidebar {
  height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  background: #fbfcff;
}
.sidebar-head { display: grid; gap: 18px; margin-bottom: 20px; }
.brand { display: inline-flex; align-items: center; gap: 12px; min-width: 0; }
.brand.compact { justify-content: flex-start; }
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
  font-size: 21px;
  background: linear-gradient(135deg, var(--primary), #65a4ff);
  box-shadow: 0 12px 24px rgba(43, 111, 246, 0.22);
}
.brand-mark.large { width: 54px; height: 54px; border-radius: 18px; font-size: 28px; }
.brand-name { font-size: 18px; font-weight: 850; color: #1d3156; }
.new-chat-btn {
  height: 44px;
  border: 0;
  border-radius: 999px;
  color: #202532;
  font-weight: 760;
  background: #fff;
  box-shadow: 0 12px 26px rgba(16, 24, 40, 0.08);
}
.model-switch-card {
  display: grid;
  gap: 10px;
  margin: 0 0 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 14px 30px rgba(32, 89, 160, 0.08);
}
.model-switch-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.model-switch-head span {
  color: #1d3156;
  font-size: 14px;
  font-weight: 850;
}
.model-switch-head small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.provider-toggle {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}
.provider-btn {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: #516070;
  font-size: 13px;
  font-weight: 800;
  background: #f7faff;
}
.provider-btn.active {
  color: #fff;
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--primary), #5d94ff);
  box-shadow: 0 10px 20px rgba(43, 111, 246, 0.18);
}
.conversation-list {
  flex: 1;
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 6px;
  overflow-y: auto;
  padding-bottom: 20px;
}
.conversation-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 13px;
  padding: 4px;
  color: #29364a;
}
.conversation-row:hover, .conversation-row.active { background: #fff; border-color: var(--line); }
.conversation-open {
  min-width: 0;
  text-align: left;
  border: 0;
  border-radius: 10px;
  padding: 8px 8px;
  background: transparent;
  color: inherit;
}
.conversation-open span {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 15px;
  font-weight: 720;
  line-height: 1.3;
}
.conversation-open small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
}
.conversation-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
}
.conversation-row:hover .conversation-actions, .conversation-row.active .conversation-actions {
  opacity: 1;
  pointer-events: auto;
}
.conversation-action {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 5px 7px;
  background: #fff;
  color: #61708a;
  font-size: 12px;
}
.conversation-action:hover { color: var(--primary); border-color: var(--line-strong); }
.conversation-action.delete:hover { color: #d64545; border-color: #ffc9c9; }
.account-btn {
  align-self: flex-start;
  min-width: 132px;
  max-width: 220px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 11px 18px;
  color: #183b6a;
  background: #fff;
  box-shadow: 0 14px 28px rgba(34, 86, 154, 0.08);
}

.main-shell {
  min-width: 0;
  height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 0%, rgba(43, 111, 246, 0.1), transparent 30%),
    #fff;
}
.topbar {
  height: 108px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px 16px 10px;
}
.auto-mode-note,
.mode-toggle[aria-label="对话模式"] {
  display: none !important;
}
.persona-stage {
  width: min(920px, calc(100vw - 330px));
  margin: 24px auto 6px;
  display: grid;
  place-items: center;
  pointer-events: none;
  position: relative;
  z-index: 1;
}
.persona-card {
  position: relative;
  width: min(360px, 56vw);
  height: 240px;
  display: grid;
  place-items: end center;
  border-radius: 32px;
  background:
    radial-gradient(circle at 50% 28%, rgba(92, 132, 255, .18), transparent 38%),
    linear-gradient(180deg, rgba(255,255,255,.88), rgba(238,244,255,.72));
  overflow: hidden;
}
.persona-image {
  max-width: 86%;
  max-height: 232px;
  object-fit: contain;
  filter: drop-shadow(0 24px 32px rgba(24, 45, 96, .18));
}
.persona-badge {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  padding: 8px 14px;
  border: 1px solid rgba(198, 212, 235, .72);
  border-radius: 999px;
  color: #193b74;
  background: rgba(255,255,255,.82);
  font-size: 13px;
  font-weight: 850;
  backdrop-filter: blur(12px);
}
.mode-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 14px 36px rgba(32, 89, 160, 0.12);
}
.mode-btn {
  border: 0;
  border-radius: 999px;
  padding: 10px 24px;
  color: #6d7890;
  font-weight: 760;
  background: transparent;
}
.mode-btn.active {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 8px 18px rgba(43, 111, 246, 0.24);
}
.chat {  width: min(920px, calc(100vw - 330px));  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  margin: 0 auto;
  padding: 0 4px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  scroll-behavior: smooth;
  position: relative;
  z-index: 2;
}
.chat::-webkit-scrollbar { display: none; }
.message { display: flex; align-items: flex-start; gap: 10px; }
.message.user { justify-content: flex-end; }
.avatar {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: -0.4px;
  background: linear-gradient(135deg, var(--primary), #65a4ff);
}
.message-bubble {
  max-width: min(690px, 84%);
  border: 1px solid var(--line);
  background: var(--surface-solid);
  border-radius: 20px;
  padding: 14px 16px;
  box-shadow: 0 14px 40px rgba(34, 86, 154, 0.08);
}
.message.assistant .message-bubble { border-top-left-radius: 8px; }
.message.user .message-bubble {
  color: #fff;
  border-color: transparent;
  border-top-right-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #2e86ff);
}
.message-body { line-height: 1.68; font-size: 16px; }
.message-body, .message-bubble { overflow-wrap: anywhere; }
.message-body p { margin: 0 0 8px; }
.message-body p:last-child { margin-bottom: 0; }
.message-body ul { margin: 6px 0 4px 20px; padding: 0; }
.message-body li { margin-bottom: 5px; }
.message-body strong { color: #0b2b5f; }
.message.user .message-body strong { color: #fff; }
.message-body code { background: rgba(43, 111, 246, 0.08); padding: 2px 6px; border-radius: 8px; }
.message-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.message-files span {
  max-width: 240px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  border-radius: 999px;
  padding: 5px 10px;
  background: rgba(43, 111, 246, 0.1);
  color: #2359b8;
  font-size: 13px;
}
.message.user .message-files span { background: rgba(255,255,255,.18); color: #fff; }
.message-tools {
  display: flex;
  justify-content: flex-start;
  margin-top: 10px;
}
.speak-btn {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  color: #2359b8;
  background: var(--primary-soft);
  font-size: 13px;
  font-weight: 780;
}
.speak-btn:hover { border-color: var(--line-strong); background: #e7f0ff; }
.speak-btn:disabled { opacity: .7; cursor: wait; }

.composer {
  width: min(980px, calc(100vw - 330px));
  margin: 0 auto 20px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 22px 60px rgba(16, 24, 40, 0.12);
  position: relative;
}
.attachment-tray { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 4px 8px; }
.attachment-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 280px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--primary-soft);
  color: #2359b8;
  font-size: 13px;
}
.attachment-pill span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.attachment-pill button { border: 0; background: transparent; color: #5171ad; font-size: 16px; }
.composer-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px 56px auto;
  align-items: center;
  gap: 8px;
}
textarea {
  width: 100%;
  min-height: 42px;
  max-height: 160px;
  resize: none;
  overflow: hidden;
  border: 0;
  outline: none;
  padding: 10px 12px;
  color: var(--text);
  background: transparent;
  line-height: 1.55;
  font-size: 17px;
}
textarea::-webkit-scrollbar { display: none; }
textarea::placeholder { color: #a5adbb; }
.file-input { display: none; }
.plus-btn, .voice-btn, #sendBtn {
  height: 44px;
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}
.plus-btn {
  width: 44px;
  border-radius: 12px;
  background: transparent;
  color: #111827;
  line-height: 1;
}
.plus-btn svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.35;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.plus-btn:hover { background: #f3f6fb; }
.voice-btn {
  width: 56px;
  border-radius: 999px;
  gap: 5px;
  background: #f4f4f5;
  color: #111827;
}
.voice-btn span {
  width: 3px;
  border-radius: 999px;
  background: currentColor;
}
.voice-btn span:nth-child(1) { height: 15px; }
.voice-btn span:nth-child(2) { height: 25px; }
.voice-btn span:nth-child(3) { height: 18px; }
.voice-btn:hover, .voice-btn.active { background: #eef4ff; color: #111827; }
.voice-btn:disabled { opacity: .45; cursor: not-allowed; }
#sendBtn {
  min-width: 82px;
  padding: 0 18px;
  border-radius: 15px;
  color: #fff;
  font-size: 15px;
  font-weight: 850;
  background: var(--primary);
  box-shadow: 0 12px 26px rgba(43, 111, 246, 0.22);
}
#sendBtn:disabled { opacity: .62; cursor: wait; }
.composer-hint {
  position: absolute;
  left: 18px;
  bottom: calc(100% + 8px);
  max-width: calc(100% - 36px);
  min-height: 0;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: #667085;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 28px rgba(15, 23, 42, .08);
  font-size: 13px;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity .16s ease, transform .16s ease;
}
.composer-hint:not(:empty) {
  opacity: 1;
  transform: translateY(0);
}

.composer-hint {
  position: fixed !important;
  top: calc(env(safe-area-inset-top) + 16px) !important;
  bottom: auto !important;
  left: 50% !important;
  z-index: 180 !important;
  width: max-content !important;
  max-width: calc(100vw - 32px) !important;
  transform: translate(-50%, -8px) !important;
  color: #175cd3 !important;
  border-color: #bfdbfe !important;
  background: rgba(239, 246, 255, .96) !important;
}

.composer-hint:not(:empty) {
  transform: translate(-50%, 0) !important;
}

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    min-width: 0;
    min-height: auto;
    max-height: none;
    padding: 12px 14px 10px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 8px 24px rgba(34, 86, 154, 0.06);
  }
  .sidebar-head {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
  }
  .brand-name { font-size: 16px; }
  .new-chat-btn { height: 40px; padding: 0 16px; }
  .model-switch-card {
    margin-bottom: 10px;
    padding: 9px;
    border-radius: 15px;
    box-shadow: none;
  }
  .model-switch-head { gap: 4px; }
  .model-switch-head small { font-size: 11px; }
  .provider-toggle { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
  .provider-btn { min-width: 0; height: 38px; padding: 0 6px; font-size: 12px; }
  .conversation-list {
    display: flex;
    gap: 7px;
    min-height: 0;
    max-height: 48px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 0 2px;
    scrollbar-width: none;
  }
  .conversation-list::-webkit-scrollbar { display: none; }
  .conversation-row {
    flex: 0 0 174px;
    min-width: 0;
    padding: 2px;
  }
  .conversation-open { padding: 7px 8px; }
  .conversation-open small { display: none; }
  .conversation-actions { opacity: 1; pointer-events: auto; }
  .conversation-action { padding: 5px 6px; }
  .account-btn { align-self: flex-end; min-width: auto; margin-top: 8px; padding: 7px 12px; font-size: 12px; box-shadow: none; }
  .topbar { min-width: 0; height: auto; min-height: 68px; padding: 12px 14px 8px; }
  .mode-toggle { width: min(100%, 360px); }
  .mode-btn { flex: 1; min-height: 42px; padding: 9px 14px; }
  .auto-mode-note .mode-toggle { width: min(100%, 260px); }
  .auto-mode-note .mode-btn { pointer-events: none; }
  .chat, .composer { width: calc(100vw - 28px); }
  .chat { padding: 12px 0 14px; gap: 14px; }
  .composer { margin-bottom: max(8px, env(safe-area-inset-bottom)); padding: 8px 9px; border-radius: 20px; }
  .composer-main { grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 4px; }
  textarea { min-height: 40px; max-height: 118px; padding: 9px 8px 9px 10px; font-size: 16px; }
  .plus-btn, .voice-btn, #sendBtn { height: 44px; }
  .plus-btn { width: 40px; font-size: 30px; }
  .voice-btn { width: 44px; }
  #sendBtn { min-width: 58px; padding: 0 12px; border-radius: 13px; }
  .composer-hint { left: 12px; bottom: calc(100% + 7px); font-size: 12px; }
}

@media (max-width: 560px) {
  .login-view { min-height: 100dvh; padding: 16px; }
  .login-card { padding: 26px 20px; border-radius: 22px; }
  .login-card h1 { font-size: 24px; }
  .brand-mark { width: 34px; height: 34px; border-radius: 11px; font-size: 19px; }
  .brand-mark.large { width: 48px; height: 48px; border-radius: 15px; font-size: 25px; }
  .message { gap: 7px; }
  .avatar { width: 28px; height: 28px; border-radius: 9px; font-size: 14px; }
  .message-bubble { max-width: calc(100% - 36px); padding: 11px 12px; border-radius: 17px; }
  .message-body { font-size: 15px; line-height: 1.62; }
  .attachment-pill { max-width: 220px; font-size: 12px; }
}
.mobile-header,
.sidebar-backdrop,
.history-title { display: none; }

.brand-mark {
  width: 44px;
  border-radius: 14px;
  color: #343190;
  background: #fff;
  border: 1px solid #e7e9ff;
  font-size: 14px;
  letter-spacing: -0.8px;
  box-shadow: 0 12px 28px rgba(52, 49, 144, 0.12);
}
.brand-mark.large { width: 64px; height: 54px; color: #343190; font-size: 18px; }

@media (max-width: 860px) {
  html, body { overflow: auto; }
  body { background: #fff; }
  .app-shell {
    display: block;
    min-height: 100dvh;
    background: #fff;
  }
  .mobile-header {
    height: 72px;
    padding: max(12px, env(safe-area-inset-top)) 18px 8px;
    display: grid;
    grid-template-columns: 48px 1fr 48px;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,.96);
  }
  .mobile-icon-btn {
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 16px;
    display: grid;
    place-items: center;
    color: #17181f;
    background: #fff;
    font-size: 32px;
    line-height: 1;
  }
  .mobile-icon-btn span {
    width: 22px;
    height: 2px;
    margin: 4px 0;
    display: block;
    border-radius: 999px;
    background: currentColor;
  }
  .mobile-icon-btn.add {
    border: 1px solid #eef0f7;
    border-radius: 999px;
    font-size: 30px;
    color: #1b1d27;
  }
  .mobile-brand {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    color: #111827;
    font-size: 19px;
    font-weight: 850;
  }
  .mobile-logo {
    min-width: 54px;
    height: 34px;
    padding: 0 9px;
    border-radius: 11px;
    display: inline-grid;
    place-items: center;
    color: #343190;
    background: #f5f6ff;
    border: 1px solid #e1e4ff;
    font-weight: 950;
    letter-spacing: -0.8px;
  }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: block;
    opacity: 0;
    pointer-events: none;
    background: rgba(15, 23, 42, .24);
    transition: opacity .2s ease;
  }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: min(82vw, 320px);
    min-width: 0;
    min-height: 100dvh;
    padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
    border: 0;
    border-right: 1px solid #edf1f8;
    background: #fff;
    box-shadow: 26px 0 60px rgba(15, 23, 42, .16);
    transform: translateX(-104%);
    transition: transform .22s ease;
  }
  .app-shell.sidebar-open .sidebar { transform: translateX(0); }
  .app-shell.sidebar-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
  .sidebar-head {
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 14px;
  }
  .sidebar .new-chat-btn { display: none; }
  .brand-name { color: #1d2268; font-size: 18px; }
  .model-switch-card {
    margin-bottom: 14px;
    padding: 12px;
    border-radius: 20px;
    box-shadow: none;
  }
  .provider-toggle { grid-template-columns: 1fr; gap: 7px; }
  .provider-btn { height: 40px; font-size: 13px; }
  .history-title {
    display: block;
    margin: 4px 4px 10px;
    color: #667085;
    font-size: 13px;
    font-weight: 800;
  }
  .conversation-list {
    display: grid;
    gap: 8px;
    max-height: none;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 0 14px;
  }
  .conversation-row {
    grid-template-columns: minmax(0,1fr) auto;
    flex: initial;
    border-color: #edf1f8;
    border-radius: 16px;
    background: #fbfcff;
  }
  .conversation-open span { font-size: 14px; }
  .conversation-open small { font-size: 12px; }
  .conversation-actions { opacity: 1; pointer-events: auto; }
  .account-btn { margin-top: auto; align-self: stretch; justify-content: center; box-shadow: none; }
  .main-shell {
    min-height: 100dvh;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    background: #fff;
  }
  .topbar {
    display: none;
  }
  .mode-toggle {
    width: min(100%, 360px);
    height: 58px;
    padding: 5px;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 14px 36px rgba(15, 23, 42, .08);
  }
  .mode-btn { flex: 1; padding: 0 14px; font-size: 17px; font-weight: 850; }
  .chat {
    width: min(100% - 30px, 720px);
    padding: 12px 0 18px;
    gap: 16px;
  }
  .persona-stage {
    width: min(100% - 24px, 720px);
    margin-top: 6px;
  }
  .persona-card {
    width: min(280px, 72vw);
    height: 210px;
    border-radius: 28px;
  }
  .persona-image {
    max-height: 205px;
    max-width: 88%;
  }
  .persona-badge {
    bottom: 10px;
    font-size: 12px;
  }
  .message-bubble { max-width: calc(100% - 36px); }
  .composer {
    width: min(100% - 30px, 720px);
    margin: 0 auto max(14px, env(safe-area-inset-bottom));
    padding: 10px 11px;
    border-radius: 24px;
    border-color: #e6e9f0;
    background: #fff;
    box-shadow: 0 18px 48px rgba(15, 23, 42, .10);
  }
  .composer-main {
    grid-template-columns: minmax(0, 1fr) 44px 44px 48px;
    align-items: center;
    gap: 6px;
  }
  textarea {
    min-height: 42px;
    max-height: 132px;
    padding: 10px 8px 10px 12px;
    font-size: 17px;
  }
  .plus-btn,
  .voice-btn,
  #sendBtn { height: 44px; }
  .plus-btn {
    width: 44px;
    border-radius: 999px;
    color: #111827;
    background: transparent;
  }
  .voice-btn { width: 48px; background: #f4f4f5; }
  #sendBtn {
    min-width: 48px;
    width: 48px;
    padding: 0;
    border-radius: 999px;
    font-size: 28px;
    background: #2b6ff6;
  }
  .composer-hint { left: 12px; bottom: calc(100% + 7px); font-size: 12px; }
}

@media (max-width: 560px) {
  .mobile-brand span:last-child { display: none; }
  .topbar { min-height: 76px; }
  .mode-toggle { height: 54px; }
  .mode-btn { font-size: 16px; }
  .chat { width: calc(100% - 24px); }
  .persona-card { height: 190px; }
  .persona-image { max-height: 188px; }
  .composer { width: calc(100% - 24px); }
}

@media (max-width: 860px) {
  .main-shell {
    min-height: 100dvh;
    display: block;
    padding-bottom: 132px;
    overflow: visible;
  }
  .chat {
    min-height: calc(100dvh - 164px);
    padding-bottom: 28px;
  }
  .composer {
    position: fixed;
    left: 50%;
    right: auto;
    bottom: max(12px, env(safe-area-inset-bottom));
    z-index: 30;
    transform: translateX(-50%);
    width: min(720px, calc(100vw - 24px));
    margin: 0;
  }
}

/* Final Leo avatar speech layout */
.persona-stage {
  top: 10px;
  z-index: 4;
  margin-bottom: -150px;
}

.persona-card {
  overflow: visible;
}

.persona-image {
  position: relative;
  z-index: 2;
}

.chat {
  z-index: 5;
  padding-top: 164px;
}

.message.assistant {
  justify-content: center;
}

.message.assistant .avatar {
  display: none;
}

.message.assistant .message-bubble {
  width: min(760px, 100%);
  max-width: min(760px, 100%);
  margin-top: 0;
  border-radius: 24px;
  border-color: rgba(175, 205, 247, .95);
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 22px 70px rgba(42, 92, 156, .13);
}

.message.assistant .message-bubble::before {
  top: -21px;
  left: min(64%, 520px);
  width: 38px;
  height: 38px;
  border-color: rgba(175, 205, 247, .95);
  background: rgba(255, 255, 255, .9);
  clip-path: polygon(0 100%, 48% 0, 100% 100%);
  transform: none;
}

.message.assistant .message-bubble::after {
  content: '';
  position: absolute;
  top: -19px;
  left: calc(min(64%, 520px) + 2px);
  width: 34px;
  height: 34px;
  background: rgba(255, 255, 255, .9);
  clip-path: polygon(0 100%, 48% 0, 100% 100%);
}

.message.assistant .message-body,
.message.assistant .message-tools {
  position: relative;
  z-index: 2;
}

.message-tools {
  align-items: center;
  gap: 8px;
}

.speak-btn,
.auto-speak-btn {
  height: 34px;
  border: 1px solid #dbe8fb;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  color: #2167c8;
  background: #f0f6ff;
  font-size: 13px;
  font-weight: 650;
}

.speak-btn svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 1.8;
}

.speak-btn[data-status="playing"] {
  color: #b42318;
  border-color: #ffd5d1;
  background: #fff4f2;
}

.auto-speak-btn span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #9aa8ba;
}

.auto-speak-btn.active span {
  background: #2f7cf6;
}

.account-btn {
  position: relative;
}

.account-menu {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 76px;
  z-index: 90;
  display: grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid #e5edf8;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 46px rgba(25, 57, 105, .15);
}

.account-menu button {
  height: 38px;
  border: 0;
  border-radius: 11px;
  padding: 0 12px;
  background: transparent;
  color: #1f2a37;
  text-align: left;
  font-size: 14px;
}

.account-menu button:hover {
  background: #eef5ff;
  color: #1a73e8;
}

.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, .22);
}

.settings-card {
  position: relative;
  width: min(380px, 100%);
  display: grid;
  gap: 12px;
  padding: 26px;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(15, 23, 42, .18);
}

.settings-card h2 {
  margin: 0;
  color: #10284f;
  font-size: 22px;
}

.settings-card p {
  margin: 0 0 4px;
  color: #667085;
  font-size: 14px;
}

.settings-card input {
  height: 44px;
  border: 1px solid #d8e3f4;
  border-radius: 14px;
  padding: 0 13px;
  outline: none;
}

.settings-card input:focus {
  border-color: #2f7cf6;
  box-shadow: 0 0 0 4px rgba(47,124,246,.12);
}

.settings-card button[type="submit"] {
  height: 44px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: #2f7cf6;
  font-weight: 700;
}

.settings-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: #f3f6fb;
  color: #44546a;
  font-size: 22px;
}

.settings-hint {
  min-height: 18px;
  color: #2f7cf6;
  font-size: 13px;
}

@media (max-width: 860px) {
  .persona-stage {
    top: 70px;
    margin-bottom: -128px;
  }

  .chat {
    padding-top: 146px !important;
  }

  .message.assistant .message-bubble {
    width: min(100%, calc(100vw - 40px));
    max-width: min(100%, calc(100vw - 40px));
  }

  .message.assistant .message-bubble::before {
    left: 56%;
  }

  .message.assistant .message-bubble::after {
    left: calc(56% + 2px);
  }

  .account-menu {
    position: fixed;
    left: 16px;
    right: auto;
    bottom: max(18px, env(safe-area-inset-bottom));
    width: min(260px, calc(100vw - 32px));
  }
}

/* Leo-specific interaction refinements */
.gemini-nav-item.active,
.gemini-nav-item:hover,
.conversation-row:hover,
.conversation-row.active {
  background: #eef5ff;
}

.account-avatar {
  background: linear-gradient(135deg, #2f7cf6, #79b7ff);
}

.account-copy small {
  display: none;
}

.conversation-actions {
  position: relative;
  opacity: 1;
  pointer-events: auto;
}

.conversation-more {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #5f6368;
  background: transparent;
  font-size: 18px;
  line-height: 1;
}

.conversation-more:hover,
.conversation-actions.open .conversation-more {
  background: #dfeeff;
  color: #1a73e8;
}

.conversation-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 70;
  min-width: 112px;
  display: none;
  padding: 6px;
  border: 1px solid #e6edf7;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 14px 36px rgba(25, 57, 105, .14);
}

.conversation-actions.open .conversation-menu {
  display: grid;
  gap: 2px;
}

.conversation-action {
  height: 34px;
  border-radius: 10px;
  padding: 0 10px;
  text-align: left;
  font-size: 13px;
}

.conversation-action.delete:hover {
  color: #d64545;
  background: #fff1f1;
}

@media (min-width: 861px) {
  .app-shell.sidebar-collapsed .mobile-header {
    width: 52px;
    height: 52px;
    padding: 0;
    display: block;
    position: fixed;
    top: 18px;
    left: 18px;
    z-index: 80;
    background: transparent;
  }

  .app-shell.sidebar-collapsed .mobile-brand,
  .app-shell.sidebar-collapsed #mobileNewChatBtn {
    display: none;
  }

  .app-shell.sidebar-collapsed #menuBtn {
    display: grid;
    width: 46px;
    height: 46px;
    border: 1px solid #e5eefb;
    border-radius: 16px;
    background: rgba(255,255,255,.92);
    box-shadow: 0 10px 28px rgba(25, 57, 105, .12);
  }
}

.mobile-icon-btn span {
  width: 24px;
  margin: 2px 0;
}

.composer-provider-btn {
  color: #0f3768;
  background: #eef5ff;
}

.provider-dot {
  background: #2f7cf6;
}

.voice-btn svg {
  stroke-width: 2.2;
}

.persona-stage {
  position: sticky;
  top: 18px;
  z-index: 1;
  margin-bottom: -112px;
}

.persona-card {
  box-shadow: 0 26px 90px rgba(43, 111, 246, .10);
}

.chat {
  z-index: 3;
  padding-top: 126px;
}

.message.assistant .message-bubble {
  position: relative;
  border-color: rgba(191, 210, 239, .92);
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(12px);
}

.message.assistant .message-bubble::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 34px;
  width: 22px;
  height: 22px;
  border-left: 1px solid rgba(191, 210, 239, .92);
  border-top: 1px solid rgba(191, 210, 239, .92);
  background: rgba(255,255,255,.88);
  transform: rotate(45deg);
}

.message.assistant .message-body,
.message.assistant .message-tools {
  position: relative;
  z-index: 1;
}

@media (max-width: 860px) {
  .mobile-header {
    grid-template-columns: 44px 1fr 44px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .mobile-icon-btn {
    width: 44px;
    height: 44px;
  }

  .mobile-icon-btn span {
    width: 22px;
    margin: 2px 0;
  }

  .persona-stage {
    position: sticky;
    top: 72px;
    z-index: 1;
    margin: 8px auto -104px;
  }

  .persona-card {
    width: min(300px, 76vw);
    height: 230px;
  }

  .persona-image {
    max-height: 228px;
  }

  .chat {
    position: relative;
    z-index: 3;
    padding-top: 132px !important;
  }

  .message.assistant .message-bubble {
    border-width: 1.5px;
    border-radius: 18px;
    background: rgba(255,255,255,.9);
  }

  .conversation-menu {
    right: 2px;
  }
}
.message.thinking .message-bubble {
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}
.thinking-progress {
  min-width: min(520px, 70vw);
}
.thinking-label {
  margin-bottom: 6px;
  color: #6b7a90;
  font-size: 13px;
  font-weight: 800;
}
.thinking-title {
  color: #10284f;
  font-size: 17px;
  font-weight: 850;
}
.thinking-detail {
  margin-top: 8px;
  color: #526174;
  font-size: 15px;
  line-height: 1.6;
}
.thinking-dots::after {
  content: '';
  display: inline-block;
  width: 1.2em;
  animation: thinkingDots 1.2s steps(4, end) infinite;
}
@keyframes thinkingDots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75%, 100% { content: '...'; }
}

/* Gemini-style shell refinement */
.sidebar {
  width: 280px;
  padding: 14px 10px 12px;
  border-right: 1px solid #f0f0f0;
  background: #fff;
}
.sidebar-head {
  grid-template-columns: minmax(0, 1fr) 38px;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 0 8px;
}
.brand.compact { gap: 10px; }
.brand-logo-img {
  width: 58px;
  height: 28px;
  object-fit: contain;
  object-position: left center;
  display: block;
}
.brand-name {
  color: #1f1f1f;
  font-size: 17px;
  font-weight: 650;
  white-space: nowrap;
}
.sidebar-fold-btn {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #1f1f1f;
  background: transparent;
}
.sidebar-fold-btn:hover { background: #f1f3f4; }
.sidebar-fold-btn svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.gemini-nav {
  display: grid;
  gap: 2px;
  margin: 0 0 18px;
}
.gemini-nav-item {
  height: 38px;
  border: 0;
  border-radius: 999px;
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: #1f1f1f;
  background: transparent;
  text-align: left;
  font-size: 14px;
  font-weight: 520;
}
.gemini-nav-item.active,
.gemini-nav-item:hover { background: #f1eeee; }
.gemini-nav-item svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.history-title {
  display: block;
  margin: 0 8px 10px;
  color: #777;
  font-size: 13px;
  font-weight: 500;
}
.conversation-list {
  gap: 1px;
  padding: 0 2px 12px;
}
.conversation-row {
  border: 0;
  border-radius: 999px;
  padding: 0 4px;
  background: transparent;
}
.conversation-row:hover,
.conversation-row.active {
  border-color: transparent;
  background: #f1eeee;
}
.conversation-open {
  min-height: 36px;
  padding: 7px 10px;
}
.conversation-open span {
  color: #1f1f1f;
  font-size: 14px;
  font-weight: 500;
}
.conversation-open small {
  display: none;
}
.conversation-actions {
  gap: 2px;
  padding-right: 4px;
}
.conversation-action {
  border: 0;
  border-radius: 999px;
  padding: 5px 7px;
  background: transparent;
  color: #5f6368;
  font-size: 12px;
}
.conversation-action:hover { background: #e8eaed; }
.account-btn {
  width: 100%;
  min-width: 0;
  max-width: none;
  min-height: 64px;
  margin-top: 8px;
  border: 0;
  border-top: 1px solid #eee;
  border-radius: 0;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 10px;
  padding: 10px 8px 0;
  color: #1f1f1f;
  background: #fff;
  box-shadow: none;
  text-align: left;
}
.account-avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #fff;
  background: #7e57c2;
  font-size: 16px;
  font-weight: 650;
}
.account-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.account-copy > span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 14px;
  font-weight: 520;
}
.account-copy small {
  color: #777;
  font-size: 13px;
}
.account-btn > svg {
  width: 18px;
  height: 18px;
  padding: 7px;
  border: 1px solid #dbe8fb;
  border-radius: 999px;
  color: #2f7cf6;
  background: #f0f6ff;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
  justify-self: end;
}
.app-shell.sidebar-collapsed {
  grid-template-columns: 1fr;
}
.app-shell.sidebar-collapsed .sidebar {
  display: none;
}
.app-shell.sidebar-collapsed .mobile-header {
  display: grid;
}
.app-shell.sidebar-collapsed .persona-stage,
.app-shell.sidebar-collapsed .chat,
.app-shell.sidebar-collapsed .composer {
  width: min(920px, calc(100vw - 44px));
}
.app-shell.sidebar-collapsed .composer {
  width: min(880px, calc(100vw - 44px));
}
.composer {
  width: min(880px, calc(100vw - 360px));
  min-height: 76px;
  margin-bottom: 28px;
  padding: 8px 12px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(60, 64, 67, .16);
}
.composer-main {
  grid-template-columns: 44px minmax(0, 1fr) auto 40px 52px;
  align-items: center;
  gap: 8px;
}
textarea {
  min-height: 44px;
  max-height: 92px;
  padding: 9px 2px 8px;
  color: #1f1f1f;
  font-size: 18px;
  font-weight: 430;
  line-height: 1.35;
}
textarea::placeholder { color: #303134; opacity: .72; font-weight: 430; }
.plus-btn,
.voice-btn,
#sendBtn,
.composer-provider-btn {
  height: 44px;
  border: 0;
  border-radius: 999px;
}
.plus-btn {
  width: 44px;
  color: #1f1f1f;
  background: transparent;
}
.plus-btn svg {
  width: 31px;
  height: 31px;
  stroke-width: 1.7;
}
.plus-btn:hover { background: #f1f3f4; }
.composer-provider {
  position: relative;
  display: inline-flex;
}
.composer-provider-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  color: #1f1f1f;
  background: #f1f3f4;
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
}
.provider-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #2f7cf6;
}
.composer-provider-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.composer-provider-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  z-index: 40;
  min-width: 168px;
  display: none;
  padding: 8px;
  border: 1px solid #eceff3;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(60, 64, 67, .18);
}
.composer-provider-menu.open {
  display: grid;
  gap: 4px;
}
.provider-btn {
  height: 38px;
  border: 0;
  border-radius: 12px;
  padding: 0 12px;
  color: #1f1f1f;
  background: transparent;
  text-align: left;
  font-size: 14px;
  font-weight: 520;
}
.provider-btn.active,
.provider-btn:hover {
  color: #1f1f1f;
  background: #f1f3f4;
  box-shadow: none;
}
.voice-btn {
  width: 40px;
  color: #2f7cf6;
  background: #f0f6ff;
  border: 1px solid #dbe8fb;
}
.voice-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.05;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.voice-btn span { display: none; }
.voice-btn:hover,
.voice-btn.active {
  background: #e7f0ff;
  color: #185adb;
}
#sendBtn {
  min-width: 52px;
  width: 52px;
  padding: 0;
  color: #0b1b2c;
  background: #9bd2ff;
  box-shadow: none;
}
#sendBtn svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#sendBtn:hover { background: #86c6fb; }
#sendBtn.busy svg { animation: thinkingDots 1.2s steps(4, end) infinite; }

@media (max-width: 860px) {
  html, body {
    height: auto;
    min-height: 100%;
    overflow: auto;
    overflow-x: hidden;
  }
  .app-shell {
    min-height: 100dvh;
    height: auto;
    overflow: visible;
  }
  .sidebar {
    width: min(82vw, 320px);
    padding: max(14px, env(safe-area-inset-top)) 10px max(14px, env(safe-area-inset-bottom));
  }
  .sidebar-head {
    grid-template-columns: minmax(0, 1fr) 38px;
    padding: 0 8px;
  }
  .brand-name { font-size: 17px; }
  .gemini-nav { margin-bottom: 22px; }
  .conversation-row {
    border-color: transparent;
    border-radius: 999px;
    background: transparent;
  }
  .conversation-open span { font-size: 14px; }
  .account-btn {
    align-self: stretch;
    border-radius: 0;
    justify-content: initial;
    padding: 10px 8px 0;
  }
  .composer {
    width: min(720px, calc(100vw - 24px));
    min-height: 64px;
    padding: 8px 9px;
    border-radius: 999px;
    margin: 0;
  }
  .composer-main {
    grid-template-columns: 38px minmax(0, 1fr) auto 36px 44px;
    gap: 5px;
  }
  textarea {
    min-height: 38px;
    max-height: 86px;
    padding: 8px 0 7px;
    font-size: 16px;
    line-height: 1.32;
  }
  .plus-btn,
  .voice-btn,
  #sendBtn,
  .composer-provider-btn { height: 38px; }
  .plus-btn { width: 38px; }
  .plus-btn svg { width: 28px; height: 28px; }
  .composer-provider-btn {
    max-width: 86px;
    gap: 6px;
    padding: 0 10px;
    font-size: 14px;
  }
  .provider-dot { width: 7px; height: 7px; }
  .composer-provider-btn svg { width: 16px; height: 16px; }
  .voice-btn { width: 36px; }
  .voice-btn svg { width: 24px; height: 24px; }
  #sendBtn {
    min-width: 44px;
    width: 44px;
  }
  #sendBtn svg { width: 25px; height: 25px; }
}

@media (max-width: 860px) {
  html,
  body {
    width: 100%;
    height: auto !important;
    min-height: 100%;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior-y: auto;
    touch-action: pan-y;
  }

  .app-shell {
    display: block;
    height: auto !important;
    min-height: 100svh;
    overflow: visible !important;
  }

  .main-shell {
    display: block !important;
    height: auto !important;
    min-height: 100svh;
    overflow: visible !important;
    padding-bottom: calc(108px + env(safe-area-inset-bottom));
  }

  .mobile-header {
    position: sticky;
    top: 0;
    z-index: 25;
  }

  .persona-stage {
    margin: 22px auto -38px;
    position: relative;
    z-index: 1;
  }

  .chat {
    width: min(720px, calc(100vw - 24px));
    min-height: calc(100svh - 176px);
    overflow: visible !important;
    padding: 54px 0 28px !important;
    touch-action: pan-y;
  }

  .composer {
    position: fixed;
    left: 50%;
    right: auto;
    bottom: max(12px, env(safe-area-inset-bottom));
    z-index: 35;
    transform: translateX(-50%);
  }
}

/* Final overrides: keep Leo portrait as the speaker */
.sidebar { position: relative; }
.account-avatar {
  background: linear-gradient(135deg, #2f7cf6, #79b7ff) !important;
}
.app-shell.sidebar-collapsed .mobile-header {
  display: block !important;
  width: 52px !important;
  height: 52px !important;
  padding: 0 !important;
  position: fixed !important;
  top: 18px !important;
  left: 18px !important;
  z-index: 90 !important;
  background: transparent !important;
}
.app-shell.sidebar-collapsed .mobile-brand,
.app-shell.sidebar-collapsed #mobileNewChatBtn {
  display: none !important;
}
.app-shell.sidebar-collapsed #menuBtn {
  display: grid !important;
  width: 46px !important;
  height: 46px !important;
  border: 1px solid #dceaff !important;
  border-radius: 16px !important;
  color: #1f2937 !important;
  background: rgba(255,255,255,.96) !important;
  box-shadow: 0 12px 30px rgba(25, 57, 105, .12) !important;
}
.app-shell.sidebar-collapsed #menuBtn span {
  display: block !important;
  width: 22px !important;
  height: 2px !important;
  margin: 3px 0 !important;
  border-radius: 999px !important;
  background: currentColor !important;
}
.persona-stage {
  position: sticky !important;
  top: 10px !important;
  z-index: 4 !important;
  margin-bottom: -150px !important;
}
.persona-card { overflow: visible !important; }
.persona-image {
  position: relative !important;
  z-index: 2 !important;
}
.chat {
  position: relative !important;
  z-index: 5 !important;
  padding-top: 164px !important;
}
.message.assistant {
  justify-content: center !important;
  gap: 0 !important;
}
.message.assistant .avatar { display: none !important; }
.message.assistant .message-bubble {
  width: min(760px, 100%) !important;
  max-width: min(760px, 100%) !important;
  border-radius: 24px !important;
  border-color: rgba(175, 205, 247, .95) !important;
  background: rgba(255,255,255,.91) !important;
  backdrop-filter: blur(12px);
  box-shadow: 0 22px 70px rgba(42, 92, 156, .13) !important;
}
.message.assistant .message-bubble::before {
  content: '' !important;
  position: absolute !important;
  top: -13px !important;
  left: 50% !important;
  width: 24px !important;
  height: 24px !important;
  border: 1px solid rgba(175, 205, 247, .95) !important;
  border-bottom: 0 !important;
  border-right: 0 !important;
  background: rgba(255,255,255,.91) !important;
  clip-path: polygon(0 100%, 50% 0, 100% 100%) !important;
  border-radius: 3px !important;
  transform: translateX(-50%) !important;
}
.message.assistant .message-bubble::after {
  content: '' !important;
  position: absolute !important;
  top: -10px !important;
  left: 50% !important;
  width: 20px !important;
  height: 20px !important;
  background: rgba(255,255,255,.91) !important;
  clip-path: polygon(0 100%, 50% 0, 100% 100%) !important;
  border-radius: 2px !important;
  transform: translateX(-50%) !important;
}
.message.assistant .message-body,
.message.assistant .message-tools {
  position: relative !important;
  z-index: 2 !important;
}
.message-tools {
  align-items: center !important;
  gap: 8px !important;
}
.speak-btn,
.auto-speak-btn {
  height: 34px !important;
  border: 1px solid #dbe8fb !important;
  border-radius: 999px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 7px !important;
  padding: 0 12px !important;
  color: #2167c8 !important;
  background: #f0f6ff !important;
  font-size: 13px !important;
  font-weight: 650 !important;
}
.speak-btn svg {
  width: 17px !important;
  height: 17px !important;
  fill: currentColor !important;
  stroke: currentColor !important;
  stroke-width: 1.8 !important;
}
.speak-btn[data-status="playing"] {
  color: #b42318 !important;
  border-color: #ffd5d1 !important;
  background: #fff4f2 !important;
}
.auto-speak-btn span {
  width: 8px !important;
  height: 8px !important;
  border-radius: 999px !important;
  background: #9aa8ba !important;
}
.auto-speak-btn.active span { background: #2f7cf6 !important; }

@media (max-width: 860px) {
  .persona-stage {
    top: 70px !important;
    margin-bottom: -128px !important;
  }
  .chat {
    padding-top: 146px !important;
  }
  .message.assistant .message-bubble {
    width: min(100%, calc(100vw - 40px)) !important;
    max-width: min(100%, calc(100vw - 40px)) !important;
  }
  .message.assistant .message-bubble::before {
    top: -11px !important;
    left: 50% !important;
    width: 18px !important;
    height: 18px !important;
  }
  .message.assistant .message-bubble::after {
    top: -8px !important;
    left: 50% !important;
    width: 16px !important;
    height: 16px !important;
  }
}

/* Mobile audit overrides */
@media (max-width: 860px) {
  .app-shell,
  .app-shell.sidebar-collapsed {
    display: block !important;
    min-height: 100dvh !important;
    overflow: visible !important;
    background: linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%) !important;
  }

  .sidebar {
    position: fixed !important;
    inset: 0 auto 0 0 !important;
    z-index: 120 !important;
    display: flex !important;
    flex-direction: column !important;
    width: min(84vw, 320px) !important;
    height: 100dvh !important;
    padding: max(14px, env(safe-area-inset-top)) 10px max(14px, env(safe-area-inset-bottom)) !important;
    background: #fff !important;
    border-right: 1px solid #edf1f8 !important;
    box-shadow: 24px 0 70px rgba(15, 23, 42, .18) !important;
    transform: translateX(-105%) !important;
    transition: transform .22s ease !important;
    overflow: hidden !important;
  }

  .app-shell.sidebar-open .sidebar {
    transform: translateX(0) !important;
  }

  .app-shell.sidebar-collapsed .sidebar {
    display: flex !important;
    transform: translateX(-105%) !important;
  }

  .sidebar-backdrop {
    position: fixed !important;
    inset: 0 !important;
    z-index: 110 !important;
    display: block !important;
    opacity: 0 !important;
    pointer-events: none !important;
    background: rgba(15, 23, 42, .26) !important;
    transition: opacity .2s ease !important;
  }

  .app-shell.sidebar-open .sidebar-backdrop {
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .app-shell.sidebar-collapsed .mobile-header,
  .mobile-header {
    position: sticky !important;
    top: 0 !important;
    left: auto !important;
    z-index: 70 !important;
    display: grid !important;
    grid-template-columns: 42px minmax(0, 1fr) 42px !important;
    align-items: center !important;
    width: 100% !important;
    height: auto !important;
    min-height: 60px !important;
    padding: max(8px, env(safe-area-inset-top)) 14px 6px !important;
    background: rgba(255, 255, 255, .9) !important;
    backdrop-filter: blur(14px) !important;
  }

  .app-shell.sidebar-collapsed .mobile-brand,
  .app-shell.sidebar-collapsed #mobileNewChatBtn,
  .mobile-brand,
  #mobileNewChatBtn {
    display: inline-flex !important;
  }

  .mobile-icon-btn,
  .app-shell.sidebar-collapsed #menuBtn {
    width: 42px !important;
    height: 42px !important;
    border: 0 !important;
    border-radius: 999px !important;
    color: #182230 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .mobile-icon-btn.add {
    display: grid !important;
    place-items: center !important;
    border: 1px solid #dbe8fb !important;
    background: rgba(255,255,255,.78) !important;
    font-size: 29px !important;
  }

  .main-shell {
    min-height: 100dvh !important;
    padding-bottom: calc(106px + env(safe-area-inset-bottom)) !important;
  }

  .persona-stage {
    position: sticky !important;
    top: 62px !important;
    z-index: 3 !important;
    width: min(100% - 24px, 720px) !important;
    margin: 10px auto -120px !important;
  }

  .persona-card {
    width: min(300px, 76vw) !important;
    height: 220px !important;
  }

  .chat {
    width: min(100% - 24px, 720px) !important;
    min-height: calc(100dvh - 168px) !important;
    padding: 138px 0 28px !important;
    overflow: visible !important;
  }

  .message.assistant .message-bubble {
    width: 100% !important;
    max-width: 100% !important;
    padding: 18px 18px 16px !important;
    border-radius: 22px !important;
  }

  .message.user .message-bubble {
    max-width: 86% !important;
  }

  .composer {
    position: fixed !important;
    left: 12px !important;
    right: 12px !important;
    bottom: max(12px, env(safe-area-inset-bottom)) !important;
    z-index: 80 !important;
    width: auto !important;
    transform: none !important;
  }

  .composer-hint {
    position: fixed !important;
    top: calc(env(safe-area-inset-top) + 14px) !important;
    bottom: auto !important;
    left: 50% !important;
    z-index: 180 !important;
    width: max-content !important;
    max-width: calc(100vw - 32px) !important;
    transform: translate(-50%, -8px) !important;
    color: #175cd3 !important;
    border-color: #bfdbfe !important;
    background: rgba(239, 246, 255, .96) !important;
  }

  .composer-hint:not(:empty) {
    transform: translate(-50%, 0) !important;
  }
}
