:root {
  color-scheme: dark;
  --bg: #03080b;
  --panel: #071116;
  --panel-2: #0b1920;
  --panel-3: #10252d;
  --line: rgba(82, 225, 255, 0.12);
  --line-strong: rgba(82, 225, 255, 0.2);
  --text: #eafbff;
  --muted: #7e98a2;
  --muted-2: #506b75;
  --accent: #18d7ff;
  --accent-2: #24f5a6;
  --accent-soft: rgba(24, 215, 255, 0.16);
  --success: #2ef2b1;
  --danger: #ff6077;
  --warning: #ffb454;
  --sidebar-width: 286px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.2, 0.9, 0.2, 1.18);
  --motion-fast: 140ms;
  --motion-medium: 220ms;
  --motion-panel: 300ms;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  overscroll-behavior: none;
}

.boot-fallback {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  padding: 28px;
  background: #090a0e;
  color: #f4f5f8;
  text-align: center;
}

.boot-fallback[hidden] {
  display: none;
}

.boot-fallback strong {
  margin-top: 8px;
  font-size: 23px;
}

.boot-fallback span,
.boot-fallback a {
  color: var(--muted);
  font-size: 13px;
}

.boot-fallback a {
  margin-top: 8px;
  color: #4deaff;
}

.boot-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 19px;
  background: linear-gradient(145deg, #18d7ff, #0b9fd6 58%, #31bcb5);
  box-shadow: 0 10px 30px rgba(24, 215, 255, 0.32);
  font-size: 28px;
  font-weight: 800;
  animation: boot-breathe 1.5s ease-in-out infinite;
}

@keyframes boot-breathe {
  50% { transform: translateY(-3px) scale(1.04); box-shadow: 0 14px 38px rgba(24, 215, 255, 0.42); }
}

button,
input,
textarea {
  font: inherit;
}

button {
  position: relative;
  overflow: hidden;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.tap-ripple {
  position: absolute;
  z-index: 0;
  border-radius: 50%;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.2);
  transform: scale(0);
  animation: tap-ripple 520ms var(--ease-out) forwards;
}

@keyframes tap-ripple {
  to { opacity: 0; transform: scale(1.8); }
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid #8ff5ff;
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.login-view {
  position: relative;
  overflow: hidden;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: calc(28px + var(--safe-top)) 22px calc(28px + var(--safe-bottom));
  background:
    radial-gradient(circle at 50% -10%, rgba(24, 215, 255, 0.25), transparent 39%),
    radial-gradient(circle at 100% 100%, rgba(39, 171, 163, 0.1), transparent 30%),
    var(--bg);
}

.login-card {
  width: min(100%, 420px);
  padding: 38px 32px 34px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(17, 19, 26, 0.88);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.46);
  backdrop-filter: blur(20px);
  text-align: center;
}

.login-card.view-entering {
  animation: login-card-in 520ms var(--ease-out) both;
}

.login-card.view-entering .brand-mark-large {
  animation: brand-arrival 620ms 90ms var(--ease-spring) both;
}

.login-card.login-error-shake .password-row {
  animation: login-shake 360ms ease both;
  border-color: rgba(255, 106, 118, 0.7);
}

@keyframes login-card-in {
  from { opacity: 0; transform: translateY(18px) scale(0.975); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes brand-arrival {
  0% { opacity: 0; transform: translateY(8px) scale(0.72) rotate(-8deg); }
  70% { transform: translateY(-2px) scale(1.06) rotate(2deg); }
  100% { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
}

@keyframes login-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 13px;
  background: linear-gradient(145deg, #18d7ff, #0b9fd6 58%, #31bcb5);
  box-shadow: 0 8px 24px rgba(24, 215, 255, 0.28), inset 0 1px rgba(255, 255, 255, 0.34);
  color: white;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.06em;
}

.brand-mark::after {
  content: "";
  position: absolute;
  top: 7px;
  right: 8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
}

.brand-mark-large {
  width: 68px;
  height: 68px;
  margin: 0 auto 22px;
  border-radius: 22px;
  font-size: 32px;
}

.brand-mark-large::after {
  top: 11px;
  right: 12px;
  width: 8px;
  height: 8px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #50e7ff;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.18em;
}

.login-card h1 {
  margin: 0;
  font-size: 34px;
  letter-spacing: -0.035em;
}

.login-subtitle {
  margin: 10px 0 30px;
  color: var(--muted);
  line-height: 1.45;
}

.login-form {
  text-align: left;
}

.login-form label,
.modal label {
  display: block;
  margin-bottom: 8px;
  color: #d4d7df;
  font-size: 13px;
  font-weight: 650;
}

.password-row {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 0 6px 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  background: #0d0f15;
  transition: border-color var(--motion-medium) ease, box-shadow var(--motion-medium) ease, transform var(--motion-fast) ease;
}

.password-row:focus-within {
  border-color: rgba(24, 215, 255, 0.72);
  box-shadow: 0 0 0 3px rgba(24, 215, 255, 0.12);
}

.password-row input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
}

.password-row input::placeholder,
textarea::placeholder {
  color: var(--muted-2);
}

.icon-button,
.tool-button,
.send-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background var(--motion-fast) ease, color var(--motion-fast) ease, transform var(--motion-fast) var(--ease-out);
}

.icon-button:hover,
.tool-button:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

.icon-button:active,
.tool-button:active,
.send-button:active {
  transform: scale(0.94);
}

.primary-button {
  width: 100%;
  min-height: 52px;
  margin-top: 5px;
  border: 0;
  border-radius: 15px;
  background: linear-gradient(135deg, #12c9dd, #0e9fd0);
  box-shadow: 0 12px 28px rgba(20, 200, 230, 0.28);
  color: white;
  font-weight: 720;
  cursor: pointer;
  transition: transform var(--motion-fast) var(--ease-out), box-shadow var(--motion-medium) ease, filter var(--motion-medium) ease;
}

.primary-button:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(20, 200, 230, 0.34);
}

.primary-button:not(:disabled):active {
  transform: translateY(1px) scale(0.985);
}

.primary-button:disabled {
  cursor: default;
  filter: saturate(0.35);
  opacity: 0.62;
}

.form-error {
  min-height: 20px;
  margin: 8px 2px 5px;
  color: #ff818c;
  font-size: 13px;
  line-height: 1.4;
}

.privacy-note {
  margin: 20px auto 0;
  max-width: 320px;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.45;
}

.app-shell {
  height: 100dvh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  overflow: hidden;
  background: var(--bg);
}

.app-shell.view-entering {
  animation: app-shell-in 360ms var(--ease-out) both;
}

@keyframes app-shell-in {
  from { opacity: 0; transform: scale(0.992); }
  to { opacity: 1; transform: scale(1); }
}

.sidebar {
  z-index: 20;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #0d0f14;
  padding: calc(17px + var(--safe-top)) 13px calc(12px + var(--safe-bottom));
}

.sidebar-top {
  padding: 0 3px;
}

.brand-row {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 11px;
  padding: 0 4px 14px;
}

.brand-row strong,
.brand-row small {
  display: block;
}

.brand-row strong {
  font-size: 15px;
  letter-spacing: -0.015em;
}

.brand-row small {
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 11px;
}

.brand-row .icon-button {
  margin-left: auto;
}

.new-chat-button {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(24, 215, 255, 0.33);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(24, 215, 255, 0.16), rgba(14, 160, 190, 0.08));
  color: #dffbff;
  font-size: 14px;
  font-weight: 680;
  cursor: pointer;
  transition: transform var(--motion-fast) var(--ease-out), border-color var(--motion-medium) ease, background var(--motion-medium) ease, box-shadow var(--motion-medium) ease;
}

.new-chat-button:not(:disabled):hover {
  transform: translateY(-1px);
  border-color: rgba(36, 224, 255, 0.54);
  box-shadow: 0 10px 24px rgba(13, 180, 200, 0.16);
}

.new-chat-button:not(:disabled):active {
  transform: translateY(1px) scale(0.98);
}

.new-chat-button:not(:disabled):hover span {
  transform: rotate(90deg) scale(1.08);
}

.new-chat-button span {
  font-size: 21px;
  font-weight: 300;
  transition: transform var(--motion-medium) var(--ease-out);
}

.sidebar-section-label {
  margin: 24px 12px 8px;
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 720;
  letter-spacing: 0.14em;
}

.chat-list {
  min-height: 0;
  flex: 1;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.chat-list-empty {
  padding: 16px 12px;
  color: var(--muted-2);
  font-size: 13px;
  line-height: 1.45;
}

.chat-item {
  width: 100%;
  min-height: 59px;
  display: block;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
  transition: background var(--motion-fast) ease, transform var(--motion-fast) var(--ease-out), box-shadow var(--motion-medium) ease;
}

.chat-item:hover {
  background: rgba(255, 255, 255, 0.045);
  transform: translateX(3px);
}

.chat-item:active {
  transform: translateX(2px) scale(0.985);
}

.chat-item.active {
  background: var(--accent-soft);
  box-shadow: inset 2px 0 #16c9e8;
  transform: translateX(2px);
}

.sidebar.open .chat-item {
  animation: sidebar-item-in 300ms var(--ease-out) both;
  animation-delay: var(--item-delay, 0ms);
}

@keyframes sidebar-item-in {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}

.chat-item strong,
.chat-item span {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.chat-item strong {
  color: #e3e5eb;
  font-size: 13px;
  font-weight: 620;
}

.chat-item span {
  margin-top: 5px;
  color: var(--muted-2);
  font-size: 11px;
}

.sidebar-footer {
  padding: 10px 4px 0;
  border-top: 1px solid var(--line);
}

.provider-pill {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  color: var(--muted);
  font-size: 12px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px rgba(56, 214, 174, 0.5);
  animation: status-breathe 2.4s ease-in-out infinite;
}

@keyframes status-breathe {
  50% { opacity: 0.72; transform: scale(0.82); box-shadow: 0 0 4px rgba(56, 214, 174, 0.35); }
}

.sidebar-action {
  width: 100%;
  min-height: 42px;
  padding: 0 11px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  transition: color var(--motion-fast) ease, background var(--motion-fast) ease, transform var(--motion-fast) var(--ease-out);
}

.sidebar-action:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  transform: translateX(2px);
}

.sidebar-action:active {
  transform: translateX(1px) scale(0.985);
}

.chat-pane {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  background:
    radial-gradient(circle at 50% -30%, rgba(15, 160, 180, 0.1), transparent 40%),
    var(--bg);
}

.chat-header {
  min-height: calc(64px + var(--safe-top));
  display: flex;
  align-items: center;
  gap: 4px;
  padding: var(--safe-top) 18px 0;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 10, 14, 0.82);
  backdrop-filter: blur(18px);
}

.chat-heading {
  min-width: 0;
  flex: 1;
  text-align: center;
}

.chat-heading h1 {
  margin: 0;
  overflow: hidden;
  color: #e8e9ee;
  font-size: 15px;
  font-weight: 650;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.chat-heading span {
  display: block;
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 10px;
}

.danger-hover:hover {
  color: var(--danger);
}

.conversation {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  padding: 30px max(22px, calc((100% - 850px) / 2));
}

.conversation .messages,
.conversation .empty-state {
  transition: opacity 160ms ease, transform 220ms var(--ease-out);
}

.conversation.switching .messages,
.conversation.switching .empty-state {
  opacity: 0;
  transform: translateY(7px);
}

.conversation.chat-entering .messages,
.conversation.chat-entering .empty-state {
  animation: chat-content-in 300ms var(--ease-out) both;
}

@keyframes chat-content-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.empty-state {
  width: min(100%, 660px);
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin: auto;
  padding: 30px 0 80px;
  text-align: center;
}

.empty-state > * {
  animation: empty-item-in 460ms var(--ease-out) both;
}

.empty-state > :nth-child(2) { animation-delay: 45ms; }
.empty-state > :nth-child(3) { animation-delay: 85ms; }
.empty-state > :nth-child(4) { animation-delay: 120ms; }
.empty-state > :nth-child(5) { animation-delay: 155ms; }

@keyframes empty-item-in {
  from { opacity: 0; transform: translateY(11px); }
  to { opacity: 1; transform: translateY(0); }
}

.empty-state h2 {
  margin: 0;
  font-size: clamp(28px, 5vw, 40px);
  letter-spacing: -0.045em;
}

.empty-state > p:not(.eyebrow) {
  margin: 12px 0 27px;
  color: var(--muted);
}

.suggestions {
  width: min(100%, 560px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.suggestion {
  min-height: 94px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 11px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.025);
  color: #cdd0d9;
  cursor: pointer;
  text-align: left;
  font-size: 12px;
  line-height: 1.3;
  transition: transform var(--motion-fast) var(--ease-out), border-color var(--motion-medium) ease, background var(--motion-medium) ease, box-shadow var(--motion-medium) ease;
}

.suggestion:hover {
  border-color: rgba(24, 215, 255, 0.4);
  background: rgba(24, 215, 255, 0.08);
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.16);
}

.suggestion:active {
  transform: translateY(0) scale(0.975);
}

.suggestion span {
  color: #42dcff;
  font-size: 19px;
  transition: transform var(--motion-medium) var(--ease-spring);
}

.suggestion:hover span {
  transform: translateY(-1px) scale(1.12) rotate(-4deg);
}

.messages {
  width: min(100%, 850px);
  margin: 0 auto;
}

.message {
  display: flex;
  gap: 12px;
  margin: 0 0 28px;
}

.message.entering {
  animation: assistant-message-in 360ms var(--ease-out) both;
  animation-delay: var(--message-delay, 0ms);
}

.message.user.entering {
  animation-name: user-message-in;
}

.message.entering .assistant-avatar {
  animation: avatar-pop 420ms var(--ease-spring) both;
  animation-delay: calc(var(--message-delay, 0ms) + 45ms);
}

.message.optimistic .message-content {
  opacity: 0.82;
  background-size: 180% 180%;
}

@keyframes assistant-message-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes user-message-in {
  from { opacity: 0; transform: translateX(9px) scale(0.985); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes avatar-pop {
  from { opacity: 0; transform: scale(0.64) rotate(-8deg); }
  to { opacity: 1; transform: scale(1) rotate(0); }
}

.message.user {
  justify-content: flex-end;
}

.assistant-avatar {
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  margin-top: 1px;
  border-radius: 10px;
  background: linear-gradient(145deg, #15c9e8, #0a789e);
  color: white;
  font-size: 13px;
  font-weight: 800;
}

.message-content {
  min-width: 0;
  max-width: min(100%, 720px);
}

.message.user .message-content {
  max-width: min(86%, 650px);
  padding: 12px 16px;
  border: 1px solid rgba(24, 215, 255, 0.18);
  border-radius: 18px 18px 5px 18px;
  background: linear-gradient(145deg, rgba(24, 215, 255, 0.24), rgba(15, 64, 78, 0.2));
}

.message-text {
  color: #e7e8ed;
  font-size: 15px;
  line-height: 1.67;
  overflow-wrap: anywhere;
}

.message-text p {
  margin: 0 0 12px;
}

.message-text p:last-child {
  margin-bottom: 0;
}

.message-text strong {
  color: white;
}

.message-text a {
  color: #4deaff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.message-text code {
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  color: #dffbff;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
}

.message-text pre {
  max-width: 100%;
  overflow-x: auto;
  margin: 13px 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #0d0f14;
}

.message-text pre code {
  padding: 0;
  background: transparent;
  color: #d8dae2;
}

.message-actions {
  display: flex;
  gap: 3px;
  margin-top: 7px;
  opacity: 0.42;
  transform: translateY(2px);
  transition: opacity var(--motion-fast) ease, transform var(--motion-fast) var(--ease-out);
}

.message:hover .message-actions,
.message:focus-within .message-actions {
  opacity: 0.9;
  transform: translateY(0);
}

.message-actions button {
  min-height: 32px;
  padding: 0 9px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  transition: color var(--motion-fast) ease, background var(--motion-fast) ease, transform var(--motion-fast) var(--ease-out);
}

.message-actions button:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  transform: translateY(-1px);
}

.message-actions button.confirmed {
  color: var(--success);
}

.message-actions button.speaking {
  background: var(--accent-soft);
  color: #72f0ff;
  animation: speaking-button 1.2s ease-in-out infinite;
}

@keyframes speaking-button {
  50% { transform: scale(0.96); }
}

.message-attachments {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 250px));
  gap: 8px;
  margin-bottom: 9px;
}

.message-attachments:empty {
  display: none;
}

.message-image {
  position: relative;
  overflow: hidden;
  display: block;
  min-height: 130px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--panel-2);
  transition: transform var(--motion-medium) var(--ease-out), border-color var(--motion-medium) ease, box-shadow var(--motion-medium) ease;
}

.message-image:hover {
  transform: translateY(-2px) scale(1.008);
  border-color: rgba(36, 224, 255, 0.35);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.22);
}

.message-image img {
  width: 100%;
  height: 100%;
  max-height: 460px;
  display: block;
  object-fit: cover;
}

.file-card {
  min-width: 200px;
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel-2);
  color: #d5d7df;
  text-decoration: none;
  transition: transform var(--motion-fast) var(--ease-out), border-color var(--motion-medium) ease, background var(--motion-medium) ease;
}

.file-card:hover {
  transform: translateY(-2px);
  border-color: rgba(36, 224, 255, 0.34);
  background: #191c25;
}

.file-card-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent-soft);
  color: #4deaff;
}

.file-card div {
  min-width: 0;
}

.file-card strong,
.file-card small {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.file-card strong {
  font-size: 12px;
}

.file-card small {
  margin-top: 4px;
  color: var(--muted-2);
  font-size: 10px;
}

.thinking {
  width: min(100%, 850px);
  display: flex;
  gap: 12px;
  margin: 0 auto 28px;
  animation: thinking-in 280ms var(--ease-out) both;
}

@keyframes thinking-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.thinking-bubble {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  position: relative;
  overflow: hidden;
  padding: 7px 11px;
  border: 1px solid rgba(255, 255, 255, 0.045);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.025);
}

.thinking-bubble i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #35d7ff;
  animation: dot 1.1s infinite ease-in-out;
}

.thinking-bubble i:nth-child(2) { animation-delay: 0.14s; }
.thinking-bubble i:nth-child(3) { animation-delay: 0.28s; }
.thinking-bubble span {
  margin-left: 5px;
  transition: opacity 140ms ease, transform 140ms var(--ease-out);
}

.thinking-bubble span.changing {
  opacity: 0;
  transform: translateY(3px);
}

@keyframes dot {
  0%, 70%, 100% { opacity: 0.3; transform: translateY(0); }
  35% { opacity: 1; transform: translateY(-3px); }
}

.attachment-tray {
  width: min(calc(100% - 36px), 850px);
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 0 auto 8px;
  scroll-snap-type: x proximity;
}

.pending-attachment {
  position: relative;
  min-width: 160px;
  max-width: 220px;
  height: 57px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 44px 8px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: var(--panel-2);
  scroll-snap-align: start;
  animation: attachment-in 260ms var(--ease-out) both;
}

.pending-attachment.removing {
  animation: attachment-out 220ms ease forwards;
}

@keyframes attachment-in {
  from { opacity: 0; transform: translateY(7px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes attachment-out {
  to { opacity: 0; transform: translateY(4px) scale(0.94); }
}

.pending-attachment img {
  width: 39px;
  height: 39px;
  flex: 0 0 auto;
  border-radius: 9px;
  object-fit: cover;
}

.pending-file-icon {
  width: 39px;
  height: 39px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--accent-soft);
  color: #4deaff;
}

.pending-attachment strong,
.pending-attachment small {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.pending-attachment strong {
  font-size: 11px;
}

.pending-attachment small {
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 9px;
}

.remove-attachment {
  position: absolute;
  top: 8px;
  right: 3px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  color: #d8dae2;
  cursor: pointer;
  transition: background var(--motion-fast) ease, color var(--motion-fast) ease, transform var(--motion-fast) var(--ease-out);
}

.remove-attachment:active {
  transform: scale(0.9);
}

.composer {
  position: relative;
  overflow: hidden;
  width: min(calc(100% - 36px), 850px);
  min-height: 58px;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  margin: 0 auto;
  padding: 7px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: rgba(22, 24, 32, 0.96);
  box-shadow: 0 12px 42px rgba(0, 0, 0, 0.28);
  transition: transform var(--motion-medium) var(--ease-out), border-color var(--motion-medium) ease, box-shadow var(--motion-medium) ease;
}

.composer:focus-within {
  border-color: rgba(24, 215, 255, 0.48);
  box-shadow: 0 0 0 3px rgba(24, 215, 255, 0.08), 0 12px 42px rgba(0, 0, 0, 0.28);
  transform: translateY(-2px);
}

.composer.is-busy::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(100deg, transparent 20%, rgba(24, 215, 255, 0.1) 48%, transparent 76%);
  transform: translateX(-120%);
  animation: composer-scan 1.8s ease-in-out infinite;
}

@keyframes composer-scan {
  to { transform: translateX(120%); }
}

.composer-tools {
  display: flex;
}

.composer .tool-button {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 12px;
  font-size: 19px;
}

.composer textarea {
  min-width: 0;
  min-height: 42px;
  max-height: 170px;
  flex: 1;
  resize: none;
  overflow-y: auto;
  padding: 10px 8px 8px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  line-height: 1.4;
}

.mic-button.listening {
  background: rgba(255, 87, 104, 0.16);
  color: #ff7d89;
  animation: mic-pulse 1.2s infinite;
}

@keyframes mic-pulse {
  50% { box-shadow: 0 0 0 6px rgba(255, 87, 104, 0.07); }
}

.send-button {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 13px;
  background: linear-gradient(145deg, #12d2e3, #0ea8c7);
  color: white;
  font-size: 22px;
  font-weight: 650;
  transition: transform var(--motion-fast) var(--ease-spring), box-shadow var(--motion-medium) ease, background var(--motion-medium) ease, color var(--motion-medium) ease;
}

.composer.has-content .send-button:not(:disabled) {
  animation: send-ready 330ms var(--ease-spring) both;
  box-shadow: 0 7px 20px rgba(36, 245, 166, 0.3);
}

@keyframes send-ready {
  0% { transform: scale(0.84) rotate(-8deg); }
  70% { transform: scale(1.07) rotate(2deg); }
  100% { transform: scale(1) rotate(0); }
}

.send-button:disabled {
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted-2);
  cursor: default;
}

.composer-note {
  margin: 7px 18px calc(8px + var(--safe-bottom));
  color: var(--muted-2);
  font-size: 9px;
  text-align: center;
}

.modal {
  width: min(calc(100% - 32px), 520px);
  padding: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  background: #141720;
  color: var(--text);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.6);
}

.modal[open] {
  animation: modal-in 300ms var(--ease-out) both;
}

.modal::backdrop {
  background: rgba(3, 4, 7, 0.72);
  backdrop-filter: blur(8px);
}

.modal[open]::backdrop {
  animation: modal-backdrop-in 220ms ease both;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px) scale(0.975); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes modal-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 22px;
}

.modal-header > div {
  flex: 1;
}

.modal h2 {
  margin: 0;
  font-size: 23px;
  letter-spacing: -0.03em;
}

.modal textarea {
  width: 100%;
  resize: vertical;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  outline: 0;
  background: #0d0f15;
  color: var(--text);
  font-size: 16px;
  line-height: 1.45;
}

.modal textarea:focus {
  border-color: rgba(24, 215, 255, 0.72);
  box-shadow: 0 0 0 3px rgba(24, 215, 255, 0.12);
}

.install-modal ol {
  margin: 0;
  padding-left: 23px;
  color: #d9dbe2;
  line-height: 1.65;
}

.install-modal li + li {
  margin-top: 8px;
}

.toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: calc(92px + var(--safe-bottom));
  max-width: min(calc(100% - 36px), 480px);
  transform: translateX(-50%);
  padding: 11px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(29, 32, 42, 0.96);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.38);
  color: #e7e8ed;
  font-size: 13px;
  text-align: center;
}

.toast.entering {
  animation: toast-in 220ms var(--ease-out) both;
}

.toast.leaving {
  animation: toast-out 180ms ease forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 6px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translate(-50%, 5px) scale(0.98); }
}

.scroll-latest {
  position: absolute;
  z-index: 8;
  right: 22px;
  bottom: calc(92px + var(--safe-bottom));
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 13px 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: rgba(24, 27, 36, 0.94);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.34);
  color: #e7fcff;
  cursor: pointer;
  animation: latest-in 240ms var(--ease-spring) both;
}

.scroll-latest > span {
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: #65eaff;
}

.scroll-latest > strong {
  font-size: 11px;
  font-weight: 680;
}

.scroll-latest:active {
  transform: scale(0.95);
}

@keyframes latest-in {
  from { opacity: 0; transform: translateY(8px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.sidebar-backdrop,
.mobile-only {
  display: none;
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .mobile-only {
    display: grid;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(88vw, 330px);
    transform: translateX(-102%);
    transition: transform var(--motion-panel) var(--ease-out);
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.45);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    z-index: 15;
    inset: 0;
    display: block;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 260ms ease;
  }

  .sidebar-backdrop.visible {
    opacity: 1;
  }

  .chat-pane {
    height: 100dvh;
  }

  .chat-header {
    min-height: calc(57px + var(--safe-top));
    padding-inline: 8px;
  }

  .chat-header > .icon-button {
    width: 42px;
    height: 42px;
  }

  .conversation {
    padding: 22px 14px 16px;
  }

  .empty-state {
    padding-bottom: 40px;
  }

  .empty-state .brand-mark-large {
    width: 58px;
    height: 58px;
    border-radius: 19px;
    font-size: 28px;
    margin-bottom: 18px;
  }

  .suggestions {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .suggestion {
    min-height: 56px;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
  }

  .message {
    gap: 9px;
    margin-bottom: 22px;
  }

  .message.user .message-content {
    max-width: 91%;
  }

  .message-text {
    font-size: 15px;
    line-height: 1.6;
  }

  .assistant-avatar {
    width: 29px;
    height: 29px;
    border-radius: 9px;
    font-size: 12px;
  }

  .message-attachments {
    grid-template-columns: minmax(0, 1fr);
  }

  .attachment-tray,
  .composer {
    width: calc(100% - 20px);
  }

  .composer {
    min-height: 94px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-rows: auto auto;
    border-radius: 18px;
  }

  .composer-tools {
    grid-column: 1;
    grid-row: 2;
    display: flex;
  }

  .composer textarea {
    width: 100%;
    grid-column: 1 / -1;
    grid-row: 1;
    padding: 7px 8px 5px;
  }

  .composer .mic-button {
    grid-column: 2;
    grid-row: 2;
  }

  .composer .send-button {
    grid-column: 3;
    grid-row: 2;
  }

  .composer-note {
    margin-bottom: calc(6px + var(--safe-bottom));
  }

  .modal {
    padding: 22px 19px;
    border-radius: 22px;
  }

  .modal[open] {
    animation-name: modal-sheet-in;
  }

  @keyframes modal-sheet-in {
    from { opacity: 0; transform: translateY(24px) scale(0.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }

  .scroll-latest {
    right: 12px;
    bottom: calc(89px + var(--safe-bottom));
  }
}

@media (hover: none) {
  .message-actions {
    opacity: 0.68;
    transform: none;
  }
}

@media (max-width: 390px) {
  .scroll-latest > strong {
    display: none;
  }

  .scroll-latest {
    width: 44px;
    padding: 0;
    justify-content: center;
  }

  .composer textarea {
    padding-inline: 5px;
  }

  .chat-header #deleteChatButton {
    display: none;
  }
}

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

/* GatewayMobile · Obsidian Gateway */
body {
  position: relative;
  background:
    radial-gradient(circle at 72% -20%, rgba(24, 215, 255, 0.12), transparent 38%),
    radial-gradient(circle at -12% 112%, rgba(36, 245, 166, 0.07), transparent 34%),
    var(--bg);
}

body::before {
  content: "";
  position: fixed;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(82, 225, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(82, 225, 255, 0.035) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, black, transparent 74%);
}

.boot-fallback {
  background:
    radial-gradient(circle at 50% 45%, rgba(24, 215, 255, 0.13), transparent 26%),
    #03080b;
}

.boot-mark,
.brand-mark {
  overflow: visible;
  border: 1px solid rgba(82, 225, 255, 0.2);
  background: rgba(5, 20, 26, 0.75);
  box-shadow: 0 0 28px rgba(24, 215, 255, 0.18), inset 0 0 22px rgba(24, 215, 255, 0.06);
}

.boot-mark img,
.brand-mark img,
.assistant-avatar img {
  width: 126%;
  height: 126%;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(24, 215, 255, 0.3));
}

.brand-mark::before {
  content: "";
  position: absolute;
  inset: -5px;
  border: 1px solid rgba(36, 245, 166, 0.2);
  border-left-color: transparent;
  border-bottom-color: transparent;
  border-radius: inherit;
  animation: gateway-orbit 8s linear infinite;
}

.brand-mark::after {
  top: auto;
  right: -3px;
  bottom: 4px;
  width: 6px;
  height: 6px;
  background: var(--accent-2);
  box-shadow: 0 0 12px var(--accent-2);
}

@keyframes gateway-orbit {
  to { transform: rotate(360deg); }
}

.login-view {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    linear-gradient(135deg, transparent 0 49.7%, rgba(82, 225, 255, 0.04) 50%, transparent 50.3%),
    radial-gradient(circle at 50% 18%, rgba(24, 215, 255, 0.18), transparent 36%),
    radial-gradient(circle at 92% 92%, rgba(36, 245, 166, 0.08), transparent 28%),
    var(--bg);
}

.login-card {
  position: relative;
  border-color: rgba(82, 225, 255, 0.19);
  background: linear-gradient(150deg, rgba(8, 24, 31, 0.94), rgba(4, 12, 17, 0.9));
  box-shadow: 0 34px 110px rgba(0, 0, 0, 0.62), 0 0 55px rgba(24, 215, 255, 0.07);
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0.08), transparent 22% 72%, rgba(36, 245, 166, 0.04));
}

.password-row,
.futuristic-input {
  border-color: rgba(82, 225, 255, 0.16);
  background: rgba(2, 10, 14, 0.78);
}

.password-row:focus-within,
.futuristic-input:focus {
  border-color: rgba(24, 215, 255, 0.72);
  box-shadow: 0 0 0 3px rgba(24, 215, 255, 0.09), 0 0 26px rgba(24, 215, 255, 0.1);
}

.primary-button {
  background: linear-gradient(120deg, #0da8c7, #18d7ff 54%, #24f5a6);
  box-shadow: 0 14px 34px rgba(24, 215, 255, 0.19);
  color: #001014;
}

.app-shell {
  height: 100vh;
  height: 100dvh;
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(12, 33, 41, 0.72), transparent 26%),
    rgba(3, 10, 14, 0.97);
  box-shadow: inset -1px 0 rgba(82, 225, 255, 0.04);
}

.new-chat-button {
  min-height: 58px;
  display: grid;
  grid-template-columns: 34px 1fr;
  grid-template-rows: auto auto;
  justify-items: start;
  gap: 1px 8px;
  padding: 9px 12px;
  background: linear-gradient(115deg, rgba(24, 215, 255, 0.13), rgba(36, 245, 166, 0.055));
}

.new-chat-button > span {
  grid-row: 1 / 3;
  align-self: center;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: rgba(24, 215, 255, 0.12);
  color: var(--accent);
}

.new-chat-button strong {
  align-self: end;
  font-size: 13px;
}

.new-chat-button small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 520;
}

.chat-item.active {
  border: 1px solid rgba(24, 215, 255, 0.13);
  background: linear-gradient(90deg, rgba(24, 215, 255, 0.13), rgba(36, 245, 166, 0.035));
  box-shadow: inset 2px 0 var(--accent), 0 8px 24px rgba(0, 0, 0, 0.15);
}

.provider-pill {
  margin-bottom: 8px;
  border: 1px solid rgba(46, 242, 177, 0.1);
  border-radius: 12px;
  background: rgba(46, 242, 177, 0.035);
}

.logout-card {
  width: 100%;
  min-height: 58px;
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 96, 119, 0.16);
  border-radius: 14px;
  background: linear-gradient(100deg, rgba(255, 96, 119, 0.07), rgba(255, 255, 255, 0.012));
  color: #ffd7dd;
  cursor: pointer;
  text-align: left;
  transition: transform var(--motion-fast) var(--ease-out), border-color var(--motion-medium) ease, background var(--motion-medium) ease;
}

.logout-card:hover {
  border-color: rgba(255, 96, 119, 0.36);
  background: rgba(255, 96, 119, 0.1);
  transform: translateY(-1px);
}

.logout-card:active { transform: scale(0.975); }
.logout-card > span:nth-child(2) { min-width: 0; }
.logout-card strong, .logout-card small { display: block; }
.logout-card strong { font-size: 12px; }
.logout-card small { margin-top: 3px; color: #9f737c; font-size: 9px; }
.logout-arrow { color: #a96a76; font-size: 21px; }

.logout-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: rgba(255, 96, 119, 0.1);
}

.logout-icon svg,
.icon-button svg,
.tool-icon svg,
.send-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-pane {
  background:
    linear-gradient(rgba(82, 225, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(82, 225, 255, 0.025) 1px, transparent 1px),
    radial-gradient(circle at 50% -22%, rgba(24, 215, 255, 0.09), transparent 42%),
    var(--bg);
  background-size: 38px 38px, 38px 38px, auto, auto;
}

.chat-header {
  border-color: rgba(82, 225, 255, 0.1);
  background: rgba(3, 9, 13, 0.8);
}

.chat-header .icon-button {
  border: 1px solid transparent;
}

.chat-header .icon-button:hover {
  border-color: rgba(82, 225, 255, 0.16);
  background: rgba(24, 215, 255, 0.07);
  color: var(--accent);
  box-shadow: 0 0 20px rgba(24, 215, 255, 0.08);
}

.empty-state h2 {
  color: #f1fdff;
  text-shadow: 0 0 34px rgba(24, 215, 255, 0.12);
}

.suggestion {
  position: relative;
  overflow: hidden;
  border-color: rgba(82, 225, 255, 0.12);
  background: linear-gradient(145deg, rgba(10, 29, 36, 0.72), rgba(5, 14, 19, 0.72));
}

.suggestion::after {
  content: "";
  position: absolute;
  inset: -80% auto -80% -35%;
  width: 40%;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.09), transparent);
  transform: rotate(15deg) translateX(-180%);
  transition: transform 480ms var(--ease-out);
}

.suggestion:hover::after { transform: rotate(15deg) translateX(420%); }
.suggestion strong { display: block; color: var(--text); font-size: 12px; }
.suggestion small { display: block; color: var(--muted); font-size: 9px; line-height: 1.35; }
.suggestion > span { color: var(--accent); text-shadow: 0 0 14px rgba(24, 215, 255, 0.34); }

.assistant-avatar {
  overflow: visible;
  border: 1px solid rgba(82, 225, 255, 0.18);
  background: rgba(8, 27, 34, 0.9);
  box-shadow: 0 0 18px rgba(24, 215, 255, 0.1);
}

.assistant-avatar img { width: 138%; height: 138%; }

.message.user .message-content {
  border-color: rgba(24, 215, 255, 0.19);
  background: linear-gradient(140deg, rgba(17, 90, 105, 0.25), rgba(7, 38, 48, 0.5));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.035), 0 12px 32px rgba(0, 0, 0, 0.12);
}

.message.entering {
  filter: blur(0);
}

@keyframes assistant-message-in {
  from { opacity: 0; transform: translateY(10px) scale(0.992); filter: blur(4px); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

@keyframes user-message-in {
  from { opacity: 0; transform: translateX(12px) scale(0.98); filter: blur(3px); }
  to { opacity: 1; transform: translateX(0) scale(1); filter: blur(0); }
}

.message-text {
  color: #dff5f8;
}

.message-text h2,
.message-text h3,
.message-text h4,
.message-text h5 {
  margin: 20px 0 9px;
  color: #f1fdff;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.message-text h2:first-child,
.message-text h3:first-child { margin-top: 0; }
.message-text h2 { font-size: 20px; }
.message-text h3 { font-size: 17px; }
.message-text h4, .message-text h5 { font-size: 15px; }
.message-text em { color: #c4dce1; }

.message-text ul,
.message-text ol {
  margin: 10px 0 14px;
  padding-left: 24px;
}

.message-text li { margin: 6px 0; padding-left: 3px; }
.message-text li::marker { color: var(--accent); font-weight: 700; }

.message-text blockquote {
  margin: 14px 0;
  padding: 11px 13px;
  border-left: 3px solid var(--accent-2);
  border-radius: 0 12px 12px 0;
  background: rgba(36, 245, 166, 0.045);
  color: #bcd4d9;
}

.message-text hr {
  height: 1px;
  margin: 18px 0;
  border: 0;
  background: linear-gradient(90deg, transparent, rgba(82, 225, 255, 0.25), transparent);
}

.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  margin: 14px 0;
  border: 1px solid rgba(82, 225, 255, 0.13);
  border-radius: 13px;
}

.message-text table {
  width: 100%;
  min-width: 360px;
  border-collapse: collapse;
  background: rgba(3, 15, 20, 0.62);
  font-size: 13px;
}

.message-text th,
.message-text td { padding: 10px 12px; border-bottom: 1px solid rgba(82, 225, 255, 0.09); text-align: left; }
.message-text th { background: rgba(24, 215, 255, 0.07); color: #8ff5ff; font-weight: 720; }
.message-text tr:last-child td { border-bottom: 0; }

.math-render {
  color: #edfeff;
  font-family: "Times New Roman", STIX Two Math, serif;
}

.math-inline {
  display: inline-flex;
  max-width: 100%;
  margin: 0 0.12em;
  color: #8ff5ff;
  vertical-align: -0.12em;
}

.math-display {
  position: relative;
  max-width: 100%;
  overflow-x: auto;
  margin: 14px 0;
  padding: 15px 17px;
  border: 1px solid rgba(24, 215, 255, 0.18);
  border-radius: 14px;
  background: linear-gradient(125deg, rgba(24, 215, 255, 0.065), rgba(36, 245, 166, 0.025));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.025);
  text-align: center;
  animation: formula-reveal 360ms var(--ease-out) both;
}

.math-display::before {
  content: "ƒx";
  position: sticky;
  left: 0;
  float: left;
  margin-right: 12px;
  color: rgba(36, 245, 166, 0.6);
  font: 700 10px/1 ui-sans-serif, sans-serif;
  letter-spacing: 0.06em;
}

.math-render math { font-size: 1.08em; }
.math-display math { font-size: 1.18em; }
.math-fallback { color: var(--warning); font-family: ui-monospace, monospace; white-space: pre-wrap; }

@keyframes formula-reveal {
  from { opacity: 0; transform: translateY(5px); clip-path: inset(0 100% 0 0); }
  to { opacity: 1; transform: translateY(0); clip-path: inset(0); }
}

.message-attachments {
  grid-template-columns: repeat(auto-fit, minmax(118px, 176px));
  justify-content: start;
}

.message.user .message-attachments { justify-content: end; }

.message-image {
  width: clamp(118px, 24vw, 176px);
  min-height: 0;
  aspect-ratio: 4 / 3;
  padding: 0;
  border-color: rgba(82, 225, 255, 0.15);
  cursor: zoom-in;
}

.message-image::after {
  content: "↗";
  position: absolute;
  right: 7px;
  bottom: 7px;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(2, 9, 13, 0.74);
  color: #dffbff;
  font-size: 11px;
  opacity: 0;
  transition: opacity var(--motion-fast) ease, transform var(--motion-fast) var(--ease-out);
}

.message-image:hover::after { opacity: 1; transform: translateY(-1px); }
.message-image img { width: 100%; height: 100%; max-height: 220px; object-fit: cover; }

.image-lightbox {
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  padding: 54px 18px 20px;
  border: 0;
  background: rgba(1, 6, 9, 0.94);
  color: var(--text);
  text-align: center;
}

.image-lightbox[open] { display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 14px; animation: lightbox-in 260ms var(--ease-out) both; }
.image-lightbox::backdrop { background: rgba(0, 0, 0, 0.8); backdrop-filter: blur(12px); }
.image-lightbox img { min-width: 0; max-width: min(100%, 1000px); max-height: 100%; align-self: center; justify-self: center; border-radius: 18px; object-fit: contain; box-shadow: 0 28px 90px rgba(0, 0, 0, 0.5), 0 0 45px rgba(24, 215, 255, 0.08); }
.image-lightbox a { color: var(--accent); font-size: 12px; text-decoration: none; }
.lightbox-close { position: fixed; z-index: 2; top: calc(10px + var(--safe-top)); right: 12px; width: 42px; height: 42px; border: 1px solid var(--line-strong); border-radius: 14px; background: rgba(7, 22, 28, 0.86); color: var(--text); font-size: 22px; cursor: pointer; }
@keyframes lightbox-in { from { opacity: 0; transform: scale(0.985); } to { opacity: 1; transform: scale(1); } }

.composer {
  border-color: rgba(82, 225, 255, 0.16);
  background: linear-gradient(145deg, rgba(9, 28, 35, 0.97), rgba(4, 14, 19, 0.98));
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.34), inset 0 1px rgba(255, 255, 255, 0.025);
}

.composer::before {
  content: "";
  position: absolute;
  z-index: 0;
  left: 12%;
  right: 12%;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent);
  opacity: 0.28;
  transition: opacity var(--motion-medium) ease, transform var(--motion-panel) var(--ease-out);
  transform: scaleX(0.45);
}

.composer:focus-within::before { opacity: 0.9; transform: scaleX(1); }
.composer:focus-within { border-color: rgba(24, 215, 255, 0.42); box-shadow: 0 0 0 3px rgba(24, 215, 255, 0.055), 0 20px 60px rgba(0, 0, 0, 0.38), 0 0 34px rgba(24, 215, 255, 0.055); }

.composer > * { position: relative; z-index: 1; }

.composer .tool-button {
  width: 47px;
  height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border-radius: 13px;
  color: #77939c;
}

.composer .tool-button:hover { background: rgba(24, 215, 255, 0.07); color: var(--accent); }
.composer .tool-button small { font-size: 8px; font-weight: 650; line-height: 1; letter-spacing: 0.01em; }
.tool-icon { width: 22px; height: 22px; display: grid; place-items: center; }
.tool-icon svg { width: 20px; height: 20px; }

.mic-button.listening {
  background: rgba(255, 96, 119, 0.12);
  color: #ff8192;
  animation: mic-future-pulse 1.2s ease-in-out infinite;
}

@keyframes mic-future-pulse {
  50% { transform: translateY(-1px); box-shadow: 0 0 0 6px rgba(255, 96, 119, 0.035), 0 0 22px rgba(255, 96, 119, 0.13); }
}

.send-button {
  background: linear-gradient(145deg, #18d7ff, #24f5a6);
  color: #001115;
  box-shadow: 0 8px 22px rgba(24, 215, 255, 0.2);
}

.send-button svg { width: 22px; height: 22px; stroke-width: 2.2; }
.send-button:disabled { background: rgba(126, 152, 162, 0.09); box-shadow: none; color: #49636d; }
.composer.has-content .send-button:not(:disabled) { box-shadow: 0 9px 26px rgba(24, 215, 255, 0.27); }

.modal {
  border-color: rgba(82, 225, 255, 0.18);
  background: linear-gradient(145deg, rgba(9, 29, 36, 0.98), rgba(3, 12, 17, 0.99));
  box-shadow: 0 34px 110px rgba(0, 0, 0, 0.68), 0 0 48px rgba(24, 215, 255, 0.06);
}

.modal-title-row { display: flex; align-items: center; gap: 11px; }
.modal-glyph { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid rgba(24, 215, 255, 0.17); border-radius: 13px; background: rgba(24, 215, 255, 0.07); color: var(--accent); font-size: 18px; }

.futuristic-input {
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  outline: 0;
  color: var(--text);
  font-size: 16px;
  transition: border-color var(--motion-medium) ease, box-shadow var(--motion-medium) ease;
}

.field-meta { display: flex; justify-content: space-between; margin: 7px 2px 12px; color: var(--muted-2); font-size: 9px; }
.field-meta b { color: var(--accent); }

.rename-preview {
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  border: 1px solid rgba(36, 245, 166, 0.11);
  border-radius: 13px;
  background: rgba(36, 245, 166, 0.035);
}

.rename-preview strong { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 13px; }

.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 18px; }
.modal-actions .primary-button { margin: 0; min-height: 48px; }

.secondary-button,
.danger-button {
  min-height: 48px;
  padding: 0 14px;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 680;
}

.secondary-button { border: 1px solid var(--line-strong); background: rgba(255, 255, 255, 0.025); color: var(--muted); }
.danger-button { border: 1px solid rgba(255, 96, 119, 0.2); background: rgba(255, 96, 119, 0.1); color: #ffc8d1; }
.secondary-button:active, .danger-button:active { transform: scale(0.98); }

.confirm-modal { text-align: center; }
.confirm-modal > p:not(.eyebrow) { color: var(--muted); line-height: 1.55; }
.confirm-orbit { width: 68px; height: 68px; display: grid; place-items: center; margin: 0 auto 17px; border: 1px solid rgba(255, 96, 119, 0.2); border-radius: 50%; background: rgba(255, 96, 119, 0.07); box-shadow: 0 0 30px rgba(255, 96, 119, 0.08); color: #ff8091; font-size: 25px; animation: confirm-float 2.2s ease-in-out infinite; }
@keyframes confirm-float { 50% { transform: translateY(-3px) rotate(4deg); } }

.toast {
  overflow: hidden;
  border-color: rgba(82, 225, 255, 0.17);
  background: rgba(5, 21, 27, 0.96);
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.45), 0 0 28px rgba(24, 215, 255, 0.055);
}

.toast::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform-origin: left;
  animation: toast-progress 3.2s linear both;
}

@keyframes toast-progress { to { transform: scaleX(0); } }

@media (max-width: 760px) {
  .chat-pane { height: 100vh; height: 100dvh; }
  .conversation { padding-inline: 14px; }
  .suggestion { min-height: 64px; display: grid; grid-template-columns: 38px 1fr; grid-template-rows: auto auto; gap: 1px 9px; padding: 10px 12px; }
  .suggestion > span { grid-row: 1 / 3; align-self: center; }
  .suggestion strong { align-self: end; }
  .message.user .message-content { max-width: 92%; }
  .message-attachments { grid-template-columns: repeat(2, minmax(0, 152px)); }
  .message-image { width: min(39vw, 152px); }
  .composer { min-height: 104px; }
  .composer-tools { gap: 1px; }
  .composer .tool-button { width: 48px; height: 46px; }
  .composer textarea { padding: 6px 8px 3px; }
  .image-lightbox { height: 100vh; height: 100dvh; }
  .modal-actions { grid-template-columns: 1fr; }
  .modal-actions .primary-button, .modal-actions .danger-button { grid-row: 1; }
}

@media (max-width: 390px) {
  .composer .tool-button { width: 45px; }
  .message-image { width: min(40vw, 148px); }
}
