@font-face {
  font-family: "Alpino";
  src: url("/Alpino_Complete/Fonts/OTF/Alpino-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: "Alpino";
  src: url("/Alpino_Complete/Fonts/OTF/Alpino-Medium.otf") format("opentype");
  font-weight: 500;
  font-style: normal;
}

@font-face {
  font-family: "Alpino";
  src: url("/Alpino_Complete/Fonts/OTF/Alpino-Bold.otf") format("opentype");
  font-weight: 600;
  font-style: normal;
}

@font-face {
  font-family: "Alpino";
  src: url("/Alpino_Complete/Fonts/OTF/Alpino-Bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
}

@font-face {
  font-family: "Author";
  src: url("/Author_Complete/Fonts/OTF/Author-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: "Author";
  src: url("/Author_Complete/Fonts/OTF/Author-Italic.otf") format("opentype");
  font-weight: 400;
  font-style: italic;
}

@font-face {
  font-family: "Author";
  src: url("/Author_Complete/Fonts/OTF/Author-Medium.otf") format("opentype");
  font-weight: 500;
  font-style: normal;
}

@font-face {
  font-family: "Author";
  src: url("/Author_Complete/Fonts/OTF/Author-Semibold.otf") format("opentype");
  font-weight: 600;
  font-style: normal;
}

@font-face {
  font-family: "Author";
  src: url("/Author_Complete/Fonts/OTF/Author-Bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
}

@font-face {
  font-family: "Author";
  src: url("/Author_Complete/Fonts/OTF/Author-BoldItalic.otf") format("opentype");
  font-weight: 700;
  font-style: italic;
}

/* Dark mode is the primary design. Light mode is driven by the OS setting below. */
:root {
  --font-display: "Alpino", system-ui, sans-serif;
  --font-body: "Author", system-ui, sans-serif;
  --color-bg: #00002D;
  --color-surface: #0D0D3D;
  --color-sidebar: #212070;
  --color-accent: #06ABEB;
  --color-accent-hover: #38BDF8;
  --color-tangent: #B91F78;
  --color-text-primary: #F0F4FF;
  --color-text-muted: #8A93C4;
  --color-bubble-ai: #0D0D3D;
  --color-bubble-user: #06ABEB;
  --color-input-bg: #111144;
  --color-input-text: #F0F4FF;
  --color-border: #2A2A6A;
  --color-on-accent: #00002D;
  --color-on-sidebar: #F0F4FF;
  --color-login-card-bg: #0A0A2E;
  --color-login-title: #06ABEB;
  --color-login-label: #F0F4FF;
  --color-header-bg: #00002D;
  --color-composer-bg: #212070;
  --color-login-border: #212070;
  --color-focus-ring: rgba(6, 171, 235, 0.15);
  --color-control-bg: rgba(240, 244, 255, 0.055);
  --color-control-border: rgba(240, 244, 255, 0.14);
  --color-suggestion-bg: #0D0D3D;
  --color-suggestion-hover: rgba(6, 171, 235, 0.12);
  --color-active-bg: rgba(6, 171, 235, 0.105);
  --color-danger-bg: rgba(185, 31, 120, 0.14);
  --color-code-bg: rgba(0, 0, 45, 0.42);
  --color-code-text: #D9E2FF;
  --color-error-text: #ffd5e9;
  --color-shadow: rgba(0, 0, 0, 0.24);
  --color-bubble-shadow: rgba(0, 0, 0, 0.16);
  --color-backdrop: rgba(0, 0, 45, 0.56);
  --shadow: 0 18px 42px var(--color-shadow);
  --bubble-shadow: 0 8px 18px var(--color-bubble-shadow);
}

@media (prefers-color-scheme: light) {
  :root {
    --color-bg: #F0F4FF;
    --color-surface: #FFFFFF;
    --color-sidebar: #17166A;
    --color-accent: #06ABEB;
    --color-accent-hover: #38BDF8;
    --color-tangent: #C32484;
    --color-text-primary: #00002D;
    --color-text-muted: #5C6695;
    --color-bubble-ai: #FFFFFF;
    --color-bubble-user: #087FBE;
    --color-input-bg: #FFFFFF;
    --color-input-text: #00002D;
    --color-border: #C8D0EE;
    --color-on-accent: #00002D;
    --color-on-sidebar: #F0F4FF;
    --color-login-card-bg: #FFFFFF;
    --color-login-title: #17166A;
    --color-login-label: #00002D;
    --color-header-bg: #17166A;
    --color-composer-bg: #FFFFFF;
    --color-login-border: #C8D0EE;
    --color-focus-ring: rgba(6, 171, 235, 0.18);
    --color-control-bg: rgba(255, 255, 255, 0.12);
    --color-control-border: rgba(240, 244, 255, 0.32);
    --color-suggestion-bg: #FFFFFF;
    --color-suggestion-hover: rgba(6, 171, 235, 0.12);
    --color-active-bg: rgba(6, 171, 235, 0.11);
    --color-danger-bg: rgba(195, 36, 132, 0.10);
    --color-code-bg: #FFFFFF;
    --color-code-text: #00002D;
    --color-error-text: #9b155e;
    --color-shadow: rgba(0, 0, 45, 0.10);
    --color-bubble-shadow: rgba(0, 0, 45, 0.08);
    --color-backdrop: rgba(0, 0, 45, 0.42);
  }
}

:root[data-theme="dark"] {
  --color-bg: #00002D;
  --color-surface: #0D0D3D;
  --color-sidebar: #212070;
  --color-accent: #06ABEB;
  --color-accent-hover: #38BDF8;
  --color-tangent: #B91F78;
  --color-text-primary: #F0F4FF;
  --color-text-muted: #8A93C4;
  --color-bubble-ai: #0D0D3D;
  --color-bubble-user: #06ABEB;
  --color-input-bg: #111144;
  --color-input-text: #F0F4FF;
  --color-border: #2A2A6A;
  --color-on-accent: #00002D;
  --color-on-sidebar: #F0F4FF;
  --color-login-card-bg: #0A0A2E;
  --color-login-title: #06ABEB;
  --color-login-label: #F0F4FF;
  --color-header-bg: #00002D;
  --color-composer-bg: #212070;
  --color-login-border: #212070;
  --color-focus-ring: rgba(6, 171, 235, 0.15);
  --color-control-bg: rgba(240, 244, 255, 0.055);
  --color-control-border: rgba(240, 244, 255, 0.14);
  --color-suggestion-bg: #0D0D3D;
  --color-suggestion-hover: rgba(6, 171, 235, 0.12);
  --color-active-bg: rgba(6, 171, 235, 0.105);
  --color-danger-bg: rgba(185, 31, 120, 0.14);
  --color-code-bg: rgba(0, 0, 45, 0.42);
  --color-code-text: #D9E2FF;
  --color-error-text: #ffd5e9;
  --color-shadow: rgba(0, 0, 0, 0.24);
  --color-bubble-shadow: rgba(0, 0, 0, 0.16);
  --color-backdrop: rgba(0, 0, 45, 0.56);
}

:root[data-theme="light"] {
  --color-bg: #F0F4FF;
  --color-surface: #FFFFFF;
  --color-sidebar: #17166A;
  --color-accent: #06ABEB;
  --color-accent-hover: #38BDF8;
  --color-tangent: #C32484;
  --color-text-primary: #00002D;
  --color-text-muted: #5C6695;
  --color-bubble-ai: #FFFFFF;
  --color-bubble-user: #087FBE;
  --color-input-bg: #FFFFFF;
  --color-input-text: #00002D;
  --color-border: #C8D0EE;
  --color-on-accent: #00002D;
  --color-on-sidebar: #F0F4FF;
  --color-login-card-bg: #FFFFFF;
  --color-login-title: #17166A;
  --color-login-label: #00002D;
  --color-header-bg: #17166A;
  --color-composer-bg: #FFFFFF;
  --color-login-border: #C8D0EE;
  --color-focus-ring: rgba(6, 171, 235, 0.18);
  --color-control-bg: rgba(255, 255, 255, 0.12);
  --color-control-border: rgba(240, 244, 255, 0.32);
  --color-suggestion-bg: #FFFFFF;
  --color-suggestion-hover: rgba(6, 171, 235, 0.12);
  --color-active-bg: rgba(6, 171, 235, 0.11);
  --color-danger-bg: rgba(195, 36, 132, 0.10);
  --color-code-bg: #FFFFFF;
  --color-code-text: #00002D;
  --color-error-text: #9b155e;
  --color-shadow: rgba(0, 0, 45, 0.10);
  --color-bubble-shadow: rgba(0, 0, 45, 0.08);
  --color-backdrop: rgba(0, 0, 45, 0.42);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: auto;
  -moz-osx-font-smoothing: auto;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  background: var(--color-bg);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-weight: 400;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
  transition: all 0.15s ease;
}

button {
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
}

.history-list::-webkit-scrollbar,
.chat-window::-webkit-scrollbar {
  width: 4px;
}

.history-list::-webkit-scrollbar-track,
.chat-window::-webkit-scrollbar-track {
  background: transparent;
}

.history-list::-webkit-scrollbar-thumb,
.chat-window::-webkit-scrollbar-thumb {
  border-radius: 99px;
  background: rgba(6, 171, 235, 0.4);
}

.history-list::-webkit-scrollbar-thumb:hover,
.chat-window::-webkit-scrollbar-thumb:hover {
  background: var(--color-accent);
}

.login-page {
  display: grid;
  overflow: auto;
  place-items: center;
  padding: max(20px, 5vw);
}

.login-shell {
  width: min(100%, 440px);
}

.login-card {
  width: 100%;
  max-width: 440px;
  padding: 36px 32px;
  border: 1px solid var(--color-login-border);
  border-top: 2px solid var(--color-accent);
  border-radius: 20px;
  background: var(--color-login-card-bg);
  box-shadow:
    0 32px 64px rgba(0, 0, 45, 0.7),
    0 8px 24px rgba(0, 0, 45, 0.5),
    inset 0 1px 0 rgba(6, 171, 235, 0.1) !important;
  text-align: center;
}

.login-avatar {
  display: block;
  width: 92px;
  height: 92px;
  margin: 0 auto 20px;
  border: 3px solid var(--color-accent);
  border-radius: 50%;
  box-shadow: 0 0 0 6px rgba(6, 171, 235, 0.12), 0 0 24px rgba(6, 171, 235, 0.2);
  filter: drop-shadow(0 1px 3px var(--color-shadow));
  object-fit: cover;
  transition: all 0.15s ease;
}

.login-title {
  margin: 0 0 6px;
  color: var(--color-login-title);
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 700;
  letter-spacing: 0;
  text-align: center;
}

.login-card p {
  margin: 0 0 26px;
  color: var(--color-text-muted);
  font-size: 14px;
}

.login-card form {
  display: grid;
  gap: 13px;
  text-align: left;
}

.login-card label {
  color: var(--color-login-label);
  font-size: 13px;
  font-weight: 500;
}

.autocomplete {
  position: relative;
}

.login-card input,
.composer textarea {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-input-bg);
  color: var(--color-input-text);
  outline: none;
}

.login-input {
  min-height: 48px;
  padding: 12px 16px;
  font-family: var(--font-body);
  font-size: 15px;
}

.login-card input:focus,
.composer textarea:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

.suggestions {
  position: absolute;
  z-index: 5;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  overflow: hidden !important;
  border: 1px solid #2a2a6a !important;
  border-radius: 10px !important;
  background: #0d0d3d !important;
  padding: 0;
  box-shadow: 0 8px 24px rgba(0, 0, 45, 0.5) !important;
}

.suggestions::before {
  display: block;
  padding: 10px 16px 4px;
  color: var(--color-text-muted);
  content: "Authorized users";
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.suggestion {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(42, 42, 106, 0.6) !important;
  border-radius: 0;
  padding: 14px 16px !important;
  background: #0d0d3d !important;
  color: #F0F4FF !important;
  cursor: pointer !important;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  transition: background 0.12s ease, color 0.12s ease !important;
}

.suggestion:last-child {
  border-bottom: 0 !important;
}

.suggestion:hover,
.suggestion:focus,
.suggestion.active {
  background: rgba(6, 171, 235, 0.1);
  color: var(--color-accent);
}

.suggestion.active {
  background: rgba(6, 171, 235, 0.15) !important;
  color: #06ABEB !important;
  font-weight: 600;
}

.suggestion .fa-user {
  font-size: 15px;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.suggestion:hover .fa-user,
.suggestion.active .fa-user {
  color: var(--color-accent);
}

.suggestion-name {
  overflow: hidden;
  font-size: 15px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggestion .check-icon {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 13px;
  color: var(--color-accent);
  opacity: 0;
}

.suggestion.active .check-icon {
  opacity: 1;
}

.login-card button,
.new-chat-button,
.send-button {
  border: 0;
  border-radius: 10px;
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-size: 14px;
  font-weight: 500;
}

.login-btn {
  display: inline-flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 13px 20px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
}

.login-btn:hover,
.send-button:hover,
.new-chat-button:hover {
  background: var(--color-accent-hover);
}

.login-btn:active,
.send-button:active,
.new-chat-button:active {
  transform: scale(0.98);
}

.login-card button:disabled,
.send-button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
  transform: none;
}

.login-card .login-message {
  min-height: 17px;
  margin: 0;
  color: var(--color-text-muted);
  font-size: 13px;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 286px minmax(0, 1fr);
  background: var(--color-bg);
  transition: grid-template-columns 180ms ease;
}

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

@media (min-width: 769px) {
  .mobile-menu-button {
    display: none !important;
  }
}

#sidebar-toggle {
  display: inline-grid;
}

.sidebar {
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--color-border);
  background: var(--color-sidebar);
  color: var(--color-on-sidebar);
  box-shadow: 1px 0 10px rgba(0, 0, 45, 0.28) !important;
  transition: width 180ms ease, transform 220ms ease;
}

.sidebar-top {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 56px minmax(0, 1fr);
}

.app-shell.sidebar-collapsed .sidebar {
  width: 56px;
}

.app-shell.sidebar-collapsed .sidebar-top {
  justify-content: center;
  padding: 16px 6px;
}

.app-shell.sidebar-collapsed .new-chat-button,
.app-shell.sidebar-collapsed .sidebar h2,
.app-shell.sidebar-collapsed .history-list {
  display: none;
}

.app-shell.sidebar-collapsed #sidebar-toggle {
  border-color: rgba(6, 171, 235, 0.28);
  background: rgba(6, 171, 235, 0.1);
  color: var(--color-accent);
}

.new-chat-button {
  display: inline-flex;
  min-width: 0;
  min-height: 44px;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
}

.icon-button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  border: 1px solid var(--color-control-border);
  border-radius: 9px;
  background: var(--color-control-bg);
  color: var(--color-on-sidebar);
}

.icon-button:hover,
.new-chat-button:hover,
.send-button:hover {
  filter: brightness(1.08);
}

.sidebar h2 {
  margin: 4px 16px 10px;
  color: var(--color-text-muted);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: uppercase;
}

.history-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 8px;
}

.history-item {
  display: flex !important;
  height: auto !important;
  min-height: unset !important;
  align-items: center !important;
  gap: 8px !important;
  box-sizing: border-box !important;
  margin-bottom: 2px !important;
  border: 0 !important;
  border-left: none !important;
  border-radius: 6px !important;
  padding: 8px 10px !important;
  background: transparent !important;
  color: rgba(240, 244, 255, 0.55) !important;
  cursor: pointer !important;
  font-family: var(--font-body) !important;
  font-size: 15px !important;
  font-weight: 500 !important;
  text-align: left;
  transition: background 0.12s ease, color 0.12s ease !important;
}

.history-item:hover {
  background: rgba(6, 171, 235, 0.07) !important;
  color: rgba(240, 244, 255, 0.85) !important;
}

.history-item.active {
  border-left: none !important;
  background: rgba(6, 171, 235, 0.1) !important;
  color: #F0F4FF !important;
  font-weight: 600 !important;
}

.history-main {
  flex: 1;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.history-title {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  border-bottom: 1.5px solid transparent !important;
  padding-bottom: 1px !important;
  font-size: 15px !important;
  line-height: 1.35 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  transition: border-color 0.15s ease !important;
}

.history-item.active .history-title {
  border-bottom-color: #06ABEB !important;
}

.history-item:hover .history-title {
  border-bottom-color: rgba(6, 171, 235, 0.4);
}

.history-date {
  margin-top: 1px !important;
  color: rgba(240, 244, 255, 0.48) !important;
  font-size: 12px !important;
  font-style: normal !important;
  font-weight: 400 !important;
  line-height: 1.2 !important;
  white-space: nowrap !important;
}

.history-item.active .history-date {
  color: rgba(240, 244, 255, 0.64);
}

.sidebar-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 40px 16px;
  color: rgba(240, 244, 255, 0.3);
  font-family: var(--font-body);
  font-size: 13px;
  font-style: italic;
}

.sidebar-empty i {
  font-size: 24px;
}

.sidebar-empty p {
  margin: 0;
}

.delete-chat {
  width: auto !important;
  height: auto !important;
  min-width: 0;
  min-height: 0;
  flex-shrink: 0 !important;
  margin-left: auto !important;
  opacity: 0 !important;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: rgba(220, 41, 141, 0.6) !important;
  font-size: 12px !important;
  transition: opacity 0.12s ease, color 0.12s ease !important;
}

.history-item:hover .delete-chat {
  opacity: 1 !important;
  color: rgba(220, 41, 141, 0.7) !important;
}

.delete-chat:hover {
  background: transparent;
  color: #DC298D !important;
}

.chat-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--color-bg);
  background-image: radial-gradient(
    ellipse at 60% 0%,
    rgba(33, 32, 112, 0.16) 0%,
    transparent 60%
  ) !important;
}

.chat-header {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  border-top: 2px solid var(--color-tangent);
  border-bottom: 1px solid var(--color-border);
  padding: 0 22px;
  background: var(--color-header-bg);
  color: var(--color-on-sidebar);
  box-shadow: 0 1px 0 rgba(195, 36, 132, 0.14), 0 2px 8px rgba(0, 0, 45, 0.22) !important;
}

.brand-lockup,
.user-controls {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.brand-lockup img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  filter: drop-shadow(0 1px 3px var(--color-shadow));
  object-fit: cover;
}

.brand-lockup span {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
}

#current-user {
  overflow: hidden;
  color: rgba(240, 244, 255, 0.82);
  font-size: 17px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-toggle {
  border-color: rgba(195, 36, 132, 0.26);
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  border-color: var(--color-tangent);
  color: var(--color-tangent);
  filter: none;
}

.chat-window {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  gap: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 30px min(5vw, 58px);
  scroll-behavior: smooth;
}

.hero-greeting {
  margin: auto;
  max-width: 720px;
  color: var(--color-text-primary);
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  animation: fadeIn 0.6s ease;
}

.hero-greeting .username {
  color: var(--color-accent);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 18px;
}

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

.message-stack {
  display: flex;
  max-width: min(760px, 72%);
  flex-direction: column;
  align-items: flex-start;
}

.message-row.user .message-stack {
  max-width: min(720px, 70%);
  align-items: flex-end;
}

.message-avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  align-self: flex-start;
  margin-top: 2px;
  border: 2px solid var(--color-accent);
  border-radius: 50%;
  filter: drop-shadow(0 1px 3px var(--color-shadow));
  object-fit: cover;
}

.bubble {
  position: relative;
  max-width: 100%;
  border-radius: 14px;
  box-shadow: var(--bubble-shadow);
  line-height: 1.65;
}

.bubble-content {
  padding: 13px 16px;
}

.message-row.assistant .bubble {
  border: 1px solid #1e1e5a !important;
  border-left: 1px solid #1e1e5a !important;
  border-radius: 6px 20px 20px 20px !important;
  background: #0d0d3d !important;
  color: #F0F4FF !important;
  box-shadow:
    0 1px 5px rgba(0, 0, 45, 0.28),
    0 1px 1px rgba(0, 0, 45, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.04) !important;
  font-family: var(--font-body) !important;
  font-size: 19px !important;
  font-weight: 500;
  line-height: 1.7 !important;
}

.message-row.assistant .bubble::before {
  position: absolute;
  top: 17px;
  left: -8px;
  width: 16px;
  height: 16px;
  background: #0d0d3d;
  border-bottom: 1px solid #1e1e5a;
  border-left: 1px solid #1e1e5a;
  border-bottom-left-radius: 4px;
  content: "";
  transform: rotate(45deg);
}

.message-row.user .bubble {
  border-radius: 20px 6px 20px 20px;
  background: #06ABEB !important;
  color: #00002D !important;
  box-shadow:
    0 2px 12px rgba(6, 171, 235, 0.25),
    0 1px 3px rgba(0, 0, 45, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
  font-size: 19px;
  font-weight: 600;
}

.message-row.user .bubble::before {
  position: absolute;
  top: 16px;
  right: -7px;
  width: 15px;
  height: 15px;
  background: #06ABEB;
  border-top-right-radius: 4px;
  content: "";
  transform: rotate(45deg);
}

.message-row.tangent .bubble {
  border-radius: 20px 20px 20px 6px;
  background: var(--color-tangent);
  color: var(--color-on-accent);
  font-size: 17px;
  font-style: italic !important;
}

.message-row.tangent .bubble::before {
  position: absolute;
  top: 16px;
  left: -7px;
  width: 15px;
  height: 15px;
  background: var(--color-tangent);
  border-bottom-left-radius: 4px;
  content: "";
  transform: rotate(45deg);
}

.message-row.tangent .emoji {
  font-style: normal !important;
}

.bubble p {
  margin: 0 0 10px;
}

.bubble p:last-child,
.bubble ul:last-child,
.bubble ol:last-child,
.bubble pre:last-child {
  margin-bottom: 0;
}

.bubble pre {
  overflow: auto;
  border-radius: 10px;
  position: relative;
  margin: 12px 0;
  border: 1px solid var(--color-border);
  padding: 36px 16px 14px;
  background: var(--color-code-bg);
  box-shadow:
    0 2px 8px rgba(0, 0, 45, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.04) !important;
  font-size: 14px;
  line-height: 1.65;
}

.bubble code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95em;
}

.bubble pre code {
  background: transparent;
  color: var(--color-code-text);
  padding: 0;
}

.copy-btn {
  position: absolute;
  z-index: 1;
  top: 8px;
  right: 8px;
  display: flex;
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: rgba(42, 42, 106, 0.8);
  color: rgba(240, 244, 255, 0.6);
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.copy-btn:hover,
.copy-btn:focus {
  border-color: var(--color-accent);
  background: rgba(6, 171, 235, 0.15);
  color: var(--color-accent);
}

.copy-btn.copied {
  border-color: var(--color-accent);
  background: rgba(6, 171, 235, 0.2);
  color: var(--color-accent);
}

.message-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
  padding: 0 4px;
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

.message-row.user .message-meta {
  text-align: right;
}

.attached-image {
  display: block;
  width: min(360px, 100%);
  max-height: 260px;
  border-radius: 12px 12px 8px 8px;
  object-fit: cover;
}

.image-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 10px 0 0;
  font-size: 12px;
}

.new-chat-link {
  color: var(--color-accent);
  text-decoration: underline;
}

.composer {
  flex-shrink: 0;
  border-top: 1px solid var(--color-border);
  padding: 12px 16px;
  background: var(--color-composer-bg);
  box-shadow: 0 -2px 10px rgba(0, 0, 45, 0.28), 0 -1px 0 rgba(6, 171, 235, 0.06) !important;
}

.composer-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: end;
  gap: 11px;
}

.composer textarea {
  min-height: 44px;
  max-height: min(150px, 40vh);
  resize: none;
  padding: 12px 15px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 45, 0.4) !important;
  font-size: 16px;
  font-weight: 500;
}

.attach-button {
  border-color: var(--color-border);
  background: var(--color-input-bg);
  color: var(--color-text-muted);
  box-shadow: 0 1px 3px var(--color-shadow);
}

.attach-button:hover,
.attach-button:focus-visible {
  border-color: var(--color-accent);
  color: var(--color-accent);
  filter: none;
}

.send-button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  place-items: center;
}

.image-preview {
  display: inline-grid;
  grid-template-columns: 64px minmax(0, auto) 44px;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px 54px;
  color: var(--color-text-muted);
  font-size: 12px;
}

.image-preview img {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  object-fit: cover;
}

.image-preview button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: transparent;
  color: var(--color-text-primary);
}

.composer-error {
  margin: 0 0 10px 54px;
  color: var(--color-error-text);
  font-size: 13px;
}

.typing {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

@media (max-width: 768px) {
  body {
    overflow: hidden;
  }

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

  .mobile-menu-button {
    display: inline-grid;
  }

  .mobile-sidebar-backdrop {
    position: fixed;
    z-index: 20;
    inset: 0;
    display: block;
    pointer-events: none;
    background: var(--color-backdrop);
    opacity: 0;
    transition: opacity 180ms ease;
  }

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

  .sidebar {
    position: fixed;
    z-index: 30;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(84vw, 320px);
    max-width: 320px;
    transform: translateX(-100%);
    box-shadow: 0 18px 42px rgba(0, 0, 45, 0.38) !important;
  }

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

  .new-chat-button span {
    display: inline;
  }

  #sidebar-toggle {
    display: inline-grid;
  }

  .chat-main {
    height: 100vh;
  }

  .chat-header {
    gap: 8px;
    padding: 0 12px;
  }

  .brand-lockup {
    gap: 8px;
  }

  .brand-lockup img {
    width: 28px;
    height: 28px;
  }

  .brand-lockup span {
    font-size: 18px;
  }

  .user-controls {
    min-width: 0;
    gap: 8px;
  }

  #current-user {
    max-width: 34vw;
    font-size: 15px;
  }

  .chat-window {
    gap: 0;
    padding: 18px 12px;
  }

  .hero-greeting {
    max-width: 92%;
    font-size: 18px;
  }

  .message-stack,
  .message-row.user .message-stack,
  .bubble {
    max-width: 92%;
  }

  .message-row.assistant .bubble {
    font-size: 18px !important;
  }

  .message-row.user .bubble {
    max-width: 92%;
    font-size: 18px;
  }

  .message-row.tangent .bubble {
    font-size: 16px;
  }

  .message-avatar {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
  }

  .composer {
    padding: 8px 10px 10px;
  }

  .composer-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
  }

  .composer textarea {
    flex: 0 0 100%;
    order: 1;
    width: 100%;
    max-height: 40vh;
  }

  .attach-button {
    order: 2;
  }

  .send-button {
    order: 3;
  }

  .image-preview,
  .composer-error {
    margin-left: 0;
  }
}

@media (max-width: 430px) {
  .login-card h1 {
    font-size: 32px;
  }

  .brand-lockup span {
    display: none;
  }

  #current-user {
    max-width: 42vw;
  }

  .message-row {
    gap: 8px;
  }
}

@media (hover: none) {
  .icon-button:hover,
  .new-chat-button:hover,
  .send-button:hover,
  .suggestion:hover,
  .delete-chat:hover {
    filter: none;
  }
}
