@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #f3f4f6;
  --bg-grad-a: #f3f4f6;
  --bg-grad-b: #f3f4f6;
  --surface: #f3f4f6;
  --surface-strong: #f3f4f6;
  --text: #111827;
  --muted: #6b7280;
  --line: rgba(15, 23, 42, 0.04);
  --accent: #10a37f;
  --accent-2: #0f8f70;
  --danger: #b42318;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  --voice-offset: 0px;
  --top-safe: env(safe-area-inset-top, 0px);
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body.theme-ivory {
  --bg: #f0eadd;
  --bg-grad-a: #f8f3e8;
  --bg-grad-b: #ede4d3;
  --surface: rgba(255, 253, 248, 0.82);
  --surface-strong: #fffdf8;
  --text: #1f1a14;
  --muted: #746a5b;
  --line: #e3d8c7;
  --accent: #201f1d;
  --accent-2: #4f4a43;
  --shadow: 0 20px 50px rgba(45, 33, 17, 0.12);
}

body.theme-mono {
  --bg: #050505;
  --bg-grad-a: #0b0b0b;
  --bg-grad-b: #050505;
  --surface: #0b0b0b;
  --surface-strong: #0b0b0b;
  --text: #ecf2ff;
  --muted: #9fb0cb;
  --line: #242424;
  --accent: #f4f7ff;
  --accent-2: #c7d2e6;
  --danger: #ff8f8f;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

body.theme-rose {
  --bg: #f9ecf1;
  --bg-grad-a: #fef8fb;
  --bg-grad-b: #f6e3ea;
  --surface: rgba(255, 248, 252, 0.84);
  --surface-strong: #fff7fb;
  --text: #2a1e25;
  --muted: #866a79;
  --line: #ecd4e0;
  --accent: #9f2f60;
  --accent-2: #73314f;
  --shadow: 0 20px 50px rgba(139, 71, 101, 0.16);
}

* { box-sizing: border-box; }
html, body {
  height: 100%;
  background: var(--surface);
}

body {
  margin: 0;
  font-family: var(--font-main);
  color: var(--text);
  background: var(--surface);
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: env(safe-area-inset-top, 0px);
  background: var(--surface-strong);
  z-index: 30;
  pointer-events: none;
}

body.theme-light {
  --bg: #f3f4f6;
  --bg-grad-a: #f3f4f6;
  --bg-grad-b: #f3f4f6;
  --surface: #f3f4f6;
  --surface-strong: #f3f4f6;
  --text: #111827;
  --muted: #6b7280;
  --line: rgba(15, 23, 42, 0.08);
  --accent: #10a37f;
  --accent-2: #0f8f70;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.bg-grid {
  display: none;
}

.bg-orb {
  display: none;
}

.bg-orb-a {
  background: #dbe8f8;
  top: -14vh;
  left: -12vw;
  animation: driftA 9s ease-in-out infinite alternate;
}

.bg-orb-b {
  background: #dce8da;
  right: -14vw;
  bottom: -18vh;
  animation: driftB 10s ease-in-out infinite alternate;
}

@keyframes driftA {
  from { transform: translate(0, 0); }
  to { transform: translate(3vw, 3vh); }
}

@keyframes driftB {
  from { transform: translate(0, 0); }
  to { transform: translate(-4vw, -3vh); }
}

.shell {
  position: relative;
  z-index: 1;
  padding: 0;
  padding-top: var(--voice-offset);
  height: 100dvh;
  background: var(--surface);
  transition: padding-top 0.2s ease;
}

body.voice-session-active {
  --voice-offset: 58px;
}

body.summary-session-active:not(.voice-session-active),
body.tts-player-active:not(.voice-session-active):not(.summary-session-active) {
  --voice-offset: 58px;
}

body.voice-session-active.summary-session-active,
body.voice-session-active.tts-player-active:not(.summary-session-active),
body.summary-session-active.tts-player-active:not(.voice-session-active) {
  --voice-offset: 112px;
}

body.voice-session-active.summary-session-active.tts-player-active {
  --voice-offset: 166px;
}

.hidden { display: none !important; }

.login-card {
  width: min(430px, 94vw);
  margin: 11vh auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 28px;
  display: grid;
  gap: 12px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

.login-card h1 { margin: 0; font-size: 2rem; letter-spacing: -0.02em; }
.login-card p { margin: 0; color: var(--muted); }
.login-card small { color: var(--muted); }

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

button,
input,
select,
textarea,
.chip-btn,
.mini-btn,
.menu-action,
.chat-item,
.chat-item strong,
.chat-item small,
.prompt-chat-card,
.prompt-chat-input,
.panel-head h4,
.settings-title,
.settings-section label,
.msg,
.attach-menu {
  font-family: var(--font-main);
}

.material-symbols-rounded {
  font-family: "Material Symbols Rounded";
  font-style: normal;
  font-weight: normal;
  display: inline-block;
  text-transform: none;
  letter-spacing: normal;
  white-space: nowrap;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 20;
  font-size: 20px;
  line-height: 1;
  vertical-align: middle;
}

/* Force one text style across all clickable UI labels and + menu items. */
.chip-btn,
.mini-btn,
.menu-action,
.chat-item,
.chat-item strong,
.chat-item small,
.chat-item-head strong,
.chat-tier,
.chat-topic,
.msg-action-btn,
.voice-session-actions button,
.attach-menu .chip-btn,
.attach-menu .chip-btn span:not(.material-symbols-rounded) {
  font-family: var(--font-main) !important;
  font-style: normal;
  letter-spacing: 0;
  line-height: 1.3;
}

.chip-btn,
.mini-btn,
.menu-action,
.msg-action-btn,
.attach-menu .chip-btn {
  font-size: 16px;
  font-weight: 500;
}

.chat-item-head strong {
  font-size: 16px;
  font-weight: 600;
}

.chat-item small,
.chat-tier,
.chat-topic {
  font-size: 16px;
  font-weight: 500;
}

input, select, textarea {
  width: 100%;
  background: var(--surface-strong);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
}

textarea {
  resize: none;
  min-height: 46px;
  max-height: 180px;
}

button {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 9px 14px;
  color: var(--text);
  background: transparent;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

button:hover { background: rgba(15, 23, 42, 0.06); border-color: transparent; }
button:active {
  transform: translateY(1px);
  border-color: rgba(15, 23, 42, 0.16);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
}
button:focus-visible {
  outline: none;
  border-color: rgba(15, 23, 42, 0.16);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.1);
}

#loginBtn,
#sendBtn,
#videoBtn,
#imageBtn {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

#loginBtn:hover,
#sendBtn:hover,
#videoBtn:hover,
#imageBtn:hover {
  background: var(--accent-2);
  border-color: var(--accent-2);
}

#sendBtn {
  width: 34px;
  height: 34px;
  min-width: 34px;
  padding: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.app {
  height: 100%;
  width: 100%;
  background: var(--surface);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  backdrop-filter: none;
  position: relative;
}

.topbar {
  border-bottom: 1px solid transparent;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
}

.topbar h3 {
  margin: 0;
  font-size: 1.02rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.messages {
  padding: 16px;
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
  background: var(--surface);
}

.chat-search-top {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 6px;
  align-items: center;
}

.chat-search-top input {
  flex: 1;
}

.search-count {
  min-width: 44px;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.msg {
  width: fit-content;
  max-width: min(760px, 86%);
  padding: 10px 13px;
  border-radius: 14px;
  border: 1px solid transparent;
  line-height: 1.45;
  white-space: pre-wrap;
}

.msg-wrap {
  display: grid;
  gap: 4px;
}

.msg-wrap.user {
  justify-items: end;
}

.msg-wrap.assistant {
  justify-items: start;
}

.msg.user {
  margin-left: auto;
  background: rgba(15, 23, 42, 0.06);
  border-color: transparent;
}

.msg.assistant {
  margin-right: auto;
  background: transparent;
}

.msg.search-match {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
}

.msg.search-active {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}

.msg mark {
  background: #f3e8bf;
  color: #1f2937;
  border-radius: 4px;
  padding: 0 2px;
}

.msg-actions {
  display: flex;
  gap: 6px;
}

.msg-time {
  color: var(--muted);
  font-size: 0.72rem;
  margin-top: -2px;
}

.msg.typing,
.msg.status {
  color: var(--muted);
}

.msg-action-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.75rem;
  font-weight: 600;
}

.msg-action-btn.icon {
  min-width: 34px;
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 1rem;
}

.scroll-bottom-btn {
  position: absolute;
  right: 16px;
  bottom: 110px;
  z-index: 4;
  min-width: 38px;
  height: 38px;
  border-radius: 999px;
  padding: 0;
}

.voice-session-bar {
  position: fixed;
  top: calc(var(--top-safe) + 10px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  width: min(620px, calc(100vw - 24px));
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.voice-session-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.voice-session-meta > span:last-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.voice-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--muted) 40%, transparent);
}

.voice-session-bar[data-phase="listening"] .voice-pulse {
  background: #20b486;
  animation: voicePulse 1s ease-out infinite;
}

.voice-session-bar[data-phase="thinking"] .voice-pulse {
  background: #f59f0b;
  animation: voicePulse 1.3s ease-out infinite;
}

.voice-session-bar[data-phase="speaking"] .voice-pulse {
  background: #2f7df6;
  animation: voicePulse 0.7s ease-out infinite;
}

.voice-speed-actions {
  flex-wrap: wrap;
}

.voice-speed-btn {
  min-width: 46px;
  padding-left: 8px;
  padding-right: 8px;
}

@keyframes voicePulse {
  0% { box-shadow: 0 0 0 0 rgba(32, 180, 134, 0.35); }
  100% { box-shadow: 0 0 0 14px rgba(32, 180, 134, 0); }
}

.voice-session-actions {
  display: flex;
  gap: 6px;
}

.tts-player-bar {
  position: fixed;
  top: calc(var(--top-safe) + 10px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 39;
  width: min(620px, calc(100vw - 24px));
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 8px 10px;
  display: flex;
  justify-content: center;
}

.summary-session-bar {
  position: fixed;
  top: calc(var(--top-safe) + 10px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  width: min(620px, calc(100vw - 24px));
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

body.voice-session-active .summary-session-bar {
  top: calc(var(--top-safe) + 64px);
}

body.voice-session-active .tts-player-bar,
body.summary-session-active .tts-player-bar {
  top: calc(var(--top-safe) + 64px);
}

body.voice-session-active.summary-session-active .tts-player-bar {
  top: calc(var(--top-safe) + 118px);
}

.composer {
  border-top: 1px solid transparent;
  padding:
    8px calc(10px + env(safe-area-inset-right, 0px))
    calc(6px + env(safe-area-inset-bottom, 0px) + 2mm)
    calc(10px + env(safe-area-inset-left, 0px));
  display: block;
  position: relative;
  background: var(--surface);
}

.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.composer-side-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 999px;
  padding: 0;
}

.input-shell {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 22px;
  background: rgba(15, 23, 42, 0.04);
  padding: 6px 6px 6px 12px;
  transition: border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}

.input-shell:focus-within {
  border-color: rgba(15, 23, 42, 0.16);
  background: rgba(15, 23, 42, 0.02);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

.composer textarea {
  flex: 1;
  width: auto;
  min-height: 32px;
  max-height: 150px;
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 6px 0;
}

.composer textarea:focus {
  box-shadow: none;
  border-color: transparent;
  background: transparent;
}

.input-shell-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.input-icon-btn {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 999px;
  padding: 0;
}

.attach-menu {
  position: absolute;
  left: calc(10px + env(safe-area-inset-left, 0px));
  bottom: calc(100% + 8px);
  z-index: 5;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 6px;
  min-width: min(280px, calc(100vw - 24px));
  font-family: var(--font-main);
}

.mini-btn {
  padding: 6px 8px;
  min-width: 34px;
  border-radius: 10px;
  font-size: 0.85rem;
}

.chip-btn {
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 8;
  background: rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(2px);
}

.drawer {
  position: fixed;
  top: var(--voice-offset);
  bottom: 0;
  width: min(390px, 90vw);
  background: var(--surface-strong);
  border: 1px solid transparent;
  z-index: 10;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.drawer-left {
  left: 0;
  border-top-right-radius: 18px;
  border-bottom-right-radius: 18px;
}

.panel-head {
  padding: 12px;
  border-bottom: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.panel-head h4 { margin: 0; }

.drawer-body {
  padding: 12px;
  display: grid;
  gap: 10px;
  align-content: start;
  overflow-y: auto;
  min-height: 0;
}

#menuPanel .drawer-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.drawer-body h5 {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.divider {
  height: 1px;
  background: transparent;
}

.create-block,
.menu-actions,
.menu-footer,
.settings-block {
  display: grid;
  gap: 8px;
}

.settings-block {
  gap: 10px;
}

.settings-section {
  background: rgba(15, 23, 42, 0.02);
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.settings-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

.settings-section label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--muted);
}

.create-block-body {
  display: grid;
  gap: 8px;
}

.quick-create-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

#toggleCreateBlockBtn {
  width: 100%;
  justify-content: space-between;
}

.menu-search {
  margin-bottom: 2px;
}

.menu-search-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-list {
  display: grid;
  gap: 4px;
}

.chat-item {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 7px 9px;
  background: transparent;
}

.drawer-left .chat-list .chat-item {
  min-height: 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.chat-item.active {
  border-color: rgba(15, 23, 42, 0.16);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.chat-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chat-item-head strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-title-row {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.chat-title-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-tier-inline {
  color: var(--muted);
  opacity: 0.72;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.chat-item small {
  color: var(--muted);
  display: block;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-tier {
  font-weight: 700;
}

.drawer-left .chat-item-head strong {
  font-style: normal;
}

.drawer-left .chat-tier,
.drawer-left .chat-topic {
  font-style: italic;
}

.chat-item-head strong {
  flex: 1;
  min-width: 0;
}

.chat-item-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.chat-item-actions {
  position: relative;
}

.drawer-left .chat-item-actions {
  display: inline-flex !important;
  visibility: visible;
  opacity: 1;
}

.drawer-left .chat-item-actions .mini-btn {
  width: 38px;
  height: 30px;
  min-width: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
}

.chat-settings-btn {
  padding: 5px 8px;
  border-radius: 9px;
}

.chat-rename-btn {
  padding: 5px 8px;
  border-radius: 9px;
}

.chat-settings-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: 190px;
  z-index: 12;
  border: 1px solid transparent;
  background: var(--surface-strong);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 6px;
  display: grid;
  gap: 4px;
}

.menu-action {
  width: 100%;
  text-align: left;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 7px 8px;
  font-weight: 600;
}

.menu-action:hover {
  border-color: transparent;
  background: rgba(15, 23, 42, 0.06);
}

.menu-action.danger {
  color: var(--danger);
}

.archive-drawer-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.archive-main-section {
  display: grid;
  gap: 8px;
}

.memory-drawer-body {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
}

.memory-add-wrap {
  display: grid;
  gap: 8px;
}

.memory-list {
  display: grid;
  gap: 8px;
  align-content: start;
  overflow-y: auto;
  min-height: 0;
  padding-right: 2px;
}

.memory-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-strong) 84%, transparent);
  padding: 10px;
  display: grid;
  gap: 8px;
}

.memory-item-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.95rem;
}

.memory-item-actions {
  display: flex;
  gap: 6px;
}

.memory-empty {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.chat-prompts-drawer-body {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
}

.chat-prompts-list {
  display: grid;
  gap: 10px;
  align-content: start;
  overflow-y: auto;
  min-height: 0;
}

.prompt-chat-card {
  background: color-mix(in srgb, var(--surface-strong) 68%, transparent);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  display: grid;
  gap: 8px;
  backdrop-filter: blur(4px);
}

.prompt-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.prompt-chat-head strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-chat-head small {
  color: var(--muted);
}

.prompt-chat-input {
  background: color-mix(in srgb, var(--surface-strong) 58%, transparent);
}

.theme-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.theme-switch .chip-btn {
  background: rgba(15, 23, 42, 0.02);
}

.theme-switch .chip-btn.active-chip {
  background: rgba(15, 23, 42, 0.08);
  color: var(--text);
  border-color: rgba(15, 23, 42, 0.2);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.1);
}

.theme-switch .chip-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#createChatBtn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}

#createChatBtn:hover {
  background: rgba(127, 127, 127, 0.09);
  border-color: color-mix(in srgb, var(--line) 75%, var(--text));
}

.menu-bottom {
  margin-top: auto;
  display: grid;
  gap: 8px;
  padding-top: 4px;
}

.active-chip {
  border-color: rgba(15, 23, 42, 0.16);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.switch-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  background: #c9d4e5;
  border-radius: 999px;
  transition: 0.2s;
}

.slider::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}

.switch input:checked + .slider {
  background: color-mix(in srgb, var(--accent) 70%, #9ca3af);
}

.switch input:checked + .slider::before {
  transform: translateX(20px);
}

.floating-panel {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: min(520px, calc(100vw - 32px));
  background: var(--surface-strong);
  border: 1px solid transparent;
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 12px;
  z-index: 11;
  display: grid;
  gap: 10px;
}

body.theme-light .bg-grid,
body.theme-light .bg-orb {
  opacity: 0;
}

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

#videoPlayer {
  width: 100%;
  border-radius: 12px;
  border: 1px solid transparent;
}

#imagePreview {
  width: 100%;
  border-radius: 12px;
  border: 1px solid transparent;
}

input, select, textarea {
  border-color: transparent;
  background: rgba(15, 23, 42, 0.03);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(15, 23, 42, 0.16);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
  background: rgba(15, 23, 42, 0.02);
}

@media (max-width: 820px) {
  .shell { padding: 0; }
  .shell { padding-top: var(--voice-offset); }
  .app { border-radius: 0; }
  .messages { padding: 12px; }
  .msg { max-width: 92%; }
  .composer {
    padding:
      6px calc(8px + env(safe-area-inset-right, 0px))
      calc(8px + env(safe-area-inset-bottom, 0px) + 6px)
      calc(8px + env(safe-area-inset-left, 0px));
  }
  .chat-input-row { gap: 6px; }
  .composer-side-btn { width: 34px; height: 34px; min-width: 34px; }
  .input-shell { min-height: 44px; padding: 5px 5px 5px 10px; }
  .input-icon-btn,
  #sendBtn { width: 32px; height: 32px; min-width: 32px; }
  .attach-menu {
    left: calc(8px + env(safe-area-inset-left, 0px));
    min-width: min(270px, calc(100vw - 16px));
  }
  .video-row { flex-direction: column; }
  .drawer-left {
    width: min(96vw, 390px);
    border-top-right-radius: 14px;
    border-bottom-right-radius: 14px;
  }
}
