:root {
  --app-height: 100dvh;
  --bg: #f1f4f7;
  --bg-2: #eaf0f7;
  --sidebar: rgba(252, 254, 255, 0.76);
  --panel: rgba(255, 255, 255, 0.82);
  --line: rgba(94, 120, 162, 0.2);
  --line-soft: rgba(94, 120, 162, 0.12);
  --ink: #0f172a;
  --ink-soft: #5f6f89;
  --accent: #174a86;
  --accent-2: #2e6fb4;
  --accent-soft: #e8f1ff;
  --user-a: #0f315c;
  --user-b: #1d4f8a;
  --ok: #1f5f3f;
  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --shadow-lg: 0 28px 80px rgba(20, 38, 65, 0.14);
  --shadow-md: 0 12px 30px rgba(20, 38, 65, 0.1);
}

:root[data-theme="dark"] {
  --bg: #07111f;
  --bg-2: #0d1c31;
  --sidebar: rgba(11, 24, 42, 0.9);
  --panel: rgba(13, 28, 48, 0.88);
  --line: rgba(149, 178, 218, 0.2);
  --line-soft: rgba(149, 178, 218, 0.12);
  --ink: #eaf2ff;
  --ink-soft: #9fb0c8;
  --accent: #75b7ff;
  --accent-2: #2e7dd3;
  --accent-soft: rgba(117, 183, 255, 0.14);
  --user-a: #164f91;
  --user-b: #0f3868;
  --ok: #78d29f;
  --shadow-lg: 0 28px 90px rgba(0, 0, 0, 0.42);
  --shadow-md: 0 14px 36px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  min-height: 100%;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

:root[data-theme="dark"] body {
  color-scheme: dark;
  background:
    radial-gradient(circle at 10% 8%, rgba(47, 104, 176, 0.26) 0%, var(--bg) 36%, #040914 100%),
    linear-gradient(130deg, #081423, #0c1a2d);
}

:root[data-theme="dark"] .grain {
  opacity: 0.1;
  background-image: radial-gradient(rgba(215, 229, 255, 0.2) 0.55px, transparent 0.55px);
}

:root[data-theme="dark"] .ambient--a {
  background: rgba(44, 112, 205, 0.38);
}

:root[data-theme="dark"] .ambient--b {
  background: rgba(27, 91, 143, 0.26);
}

body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 8%, #ffffff 0%, var(--bg) 35%, var(--bg-2) 100%),
    linear-gradient(130deg, #f7fbff, #eaf0f7);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

:root.is-telegram-webapp,
:root.is-telegram-webapp body {
  height: var(--app-height);
  min-height: var(--app-height);
  overflow: hidden;
  overscroll-behavior: none;
}

:root.is-telegram-webapp .app,
:root.is-telegram-webapp .chat-layout {
  height: var(--app-height);
  min-height: 0;
}

:root.is-telegram-webapp .composer-wrap {
  padding-bottom: max(10px, env(safe-area-inset-bottom));
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

h1,
.brand,
.history-title {
  font-family: "Fraunces", Georgia, serif;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image: radial-gradient(rgba(14, 24, 40, 0.18) 0.55px, transparent 0.55px);
  background-size: 4px 4px;
}

.ambient {
  position: fixed;
  border-radius: 999px;
  filter: blur(46px);
  pointer-events: none;
  z-index: 0;
}

.ambient--a {
  width: 320px;
  height: 320px;
  top: -130px;
  right: 16%;
  background: rgba(149, 182, 242, 0.54);
}

.ambient--b {
  width: 280px;
  height: 280px;
  bottom: -100px;
  left: 22%;
  background: rgba(243, 213, 165, 0.36);
}

.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
  height: var(--app-height);
  width: 100vw;
  max-width: 100vw;
  overflow: hidden;
  padding: 16px;
}

.sidebar-backdrop {
  display: none;
}

.sidebar {
  min-width: 0;
  min-height: 0;
  backdrop-filter: blur(16px);
  background: linear-gradient(160deg, var(--sidebar), rgba(245, 250, 255, 0.6));
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 14px;
  padding: 14px;
}

.sidebar.sidebar--settings-open {
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
}

.account-card {
  border: 1px solid rgba(176, 197, 228, 0.62);
  border-radius: 16px;
  background: linear-gradient(145deg, #ffffff, #edf5ff);
  padding: 11px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.account-card:hover {
  transform: translateY(-1px);
  border-color: rgba(119, 158, 216, 0.82);
  box-shadow: 0 10px 24px rgba(31, 73, 124, 0.1);
}

.settings-popover {
  min-width: 0;
  animation: rise 0.18s ease;
}

.settings-popover[hidden] {
  display: none;
}

.account-login,
.account-credits {
  margin: 0;
}

.account-login {
  color: #15335c;
  font-size: 14px;
  font-weight: 900;
}

.account-credits {
  color: #61738f;
  font-size: 12px;
  margin-top: 2px;
}

.settings-btn {
  position: relative;
  width: 34px;
  height: 34px;
  border: 1px solid #c9d8ef;
  border-radius: 11px;
  background: #f8fbff;
  cursor: pointer;
  color: #173f70;
  display: inline-grid;
  place-items: center;
  padding: 0;
  flex: 0 0 auto;
}

.settings-btn::after {
  content: "";
  width: 17px;
  height: 17px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M19.43 12.98c.04-.32.07-.65.07-.98s-.02-.66-.07-.98l2.11-1.65c.19-.15.24-.42.12-.64l-2-3.46c-.12-.22-.37-.31-.6-.22l-2.49 1a7.28 7.28 0 0 0-1.69-.98L14.5 2.42A.49.49 0 0 0 14.02 2h-4c-.24 0-.44.17-.48.42L9.16 5.07c-.6.23-1.17.56-1.69.98l-2.49-1a.49.49 0 0 0-.6.22l-2 3.46c-.12.22-.07.49.12.64l2.11 1.65a7.93 7.93 0 0 0 0 1.96L2.5 14.63a.49.49 0 0 0-.12.64l2 3.46c.12.22.37.31.6.22l2.49-1c.52.4 1.08.73 1.69.98l.38 2.65c.04.25.24.42.48.42h4c.24 0 .44-.17.48-.42l.38-2.65c.6-.24 1.17-.56 1.69-.98l2.49 1c.23.08.48 0 .6-.22l2-3.46a.49.49 0 0 0-.12-.64l-2.11-1.65ZM12 15.5A3.5 3.5 0 1 1 12 8a3.5 3.5 0 0 1 0 7.5Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M19.43 12.98c.04-.32.07-.65.07-.98s-.02-.66-.07-.98l2.11-1.65c.19-.15.24-.42.12-.64l-2-3.46c-.12-.22-.37-.31-.6-.22l-2.49 1a7.28 7.28 0 0 0-1.69-.98L14.5 2.42A.49.49 0 0 0 14.02 2h-4c-.24 0-.44.17-.48.42L9.16 5.07c-.6.23-1.17.56-1.69.98l-2.49-1a.49.49 0 0 0-.6.22l-2 3.46c-.12.22-.07.49.12.64l2.11 1.65a7.93 7.93 0 0 0 0 1.96L2.5 14.63a.49.49 0 0 0-.12.64l2 3.46c.12.22.37.31.6.22l2.49-1c.52.4 1.08.73 1.69.98l.38 2.65c.04.25.24.42.48.42h4c.24 0 .44-.17.48-.42l.38-2.65c.6-.24 1.17-.56 1.69-.98l2.49 1c.23.08.48 0 .6-.22l2-3.46a.49.49 0 0 0-.12-.64l-2.11-1.65ZM12 15.5A3.5 3.5 0 1 1 12 8a3.5 3.5 0 0 1 0 7.5Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.settings-btn--login::after {
  -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10 17v-3H3v-4h7V7l5 5-5 5Zm2-15h7c1.1 0 2 .9 2 2v16c0 1.1-.9 2-2 2h-7v-2h7V4h-7V2Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10 17v-3H3v-4h7V7l5 5-5 5Zm2-15h7c1.1 0 2 .9 2 2v16c0 1.1-.9 2-2 2h-7v-2h7V4h-7V2Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.sidebar-head {
  display: grid;
  gap: 8px;
}

.sidebar-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.sidebar-title {
  margin: 0;
  color: #142e50;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.new-chat,
.search-chat,
.history-item,
.send-btn,
.model-btn,
.suggest {
  font-family: inherit;
}

.new-chat {
  position: relative;
  width: 36px;
  height: 36px;
  border: 1px solid #b6c9e9;
  color: #0e315b;
  background: linear-gradient(150deg, #f8fcff, #e9f2ff);
  border-radius: 13px;
  padding: 0;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.new-chat::after {
  content: "";
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M19 11h-6V5h-2v6H5v2h6v6h2v-6h6v-2Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M19 11h-6V5h-2v6H5v2h6v6h2v-6h6v-2Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.search-chat {
  width: 100%;
  border: 1px solid rgba(150, 173, 207, 0.32);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.78);
  color: #344763;
  padding: 10px 12px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.new-chat:hover,
.history-item:hover,
.model-btn:hover,
.send-btn:hover,
.suggest:hover {
  transform: translateY(-1px);
}

.search-chat:focus {
  border-color: #9fc0ea;
}

.sidebar-section {
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 10px;
  padding-right: 2px;
}

.sidebar-label {
  margin: 0;
  padding-left: 4px;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6f7d95;
}

.history {
  display: grid;
  gap: 8px;
}

.history-item {
  border: 1px solid transparent;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.58);
  text-align: left;
  padding: 10px;
  cursor: pointer;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.history-main {
  min-width: 0;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0;
  cursor: pointer;
  display: grid;
  gap: 2px;
}

.history-actions {
  display: inline-flex;
  gap: 4px;
  opacity: 0.35;
  align-items: center;
}

.history-item:hover .history-actions {
  opacity: 1;
}

.chat-action {
  position: relative;
  border: 1px solid #d3dfef;
  border-radius: 8px;
  background: #fff;
  color: #335275;
  width: 26px;
  height: 26px;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  padding: 0;
}

.chat-action::after {
  content: "";
  width: 14px;
  height: 14px;
  background: currentColor;
}

.chat-action--rename::after {
  -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 17.25V21h3.75L17.8 9.95l-3.75-3.75L3 17.25Zm17.7-10.2c.4-.4.4-1.03 0-1.42l-2.34-2.34a.99.99 0 0 0-1.41 0l-1.84 1.84 3.75 3.75 1.84-1.83Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 17.25V21h3.75L17.8 9.95l-3.75-3.75L3 17.25Zm17.7-10.2c.4-.4.4-1.03 0-1.42l-2.34-2.34a.99.99 0 0 0-1.41 0l-1.84 1.84 3.75 3.75 1.84-1.83Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.chat-action--delete::after {
  -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12ZM8 9h8v10H8V9Zm7.5-5-1-1h-5l-1 1H5v2h14V4h-3.5Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12ZM8 9h8v10H8V9Zm7.5-5-1-1h-5l-1 1H5v2h14V4h-3.5Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.history-item--active {
  border-color: #b6caea;
  background: linear-gradient(145deg, #f8fbff, #eef4ff);
}

.history-title {
  font-size: 16px;
  color: #1a3356;
}

.history-sub {
  font-size: 12px;
  color: #6a7891;
}

.empty-history {
  font-size: 13px;
  color: #6f7d95;
  padding: 6px;
}

.sidebar-foot {
  border-top: 1px solid var(--line-soft);
  padding-top: 12px;
  display: grid;
  gap: 10px;
}

.my-documents-btn {
  width: 100%;
  border: 1px solid rgba(176, 197, 228, 0.72);
  border-radius: 15px;
  background:
    radial-gradient(circle at 10% 0%, rgba(255, 255, 255, 0.95), transparent 38%),
    linear-gradient(145deg, #f8fcff, #e8f2ff);
  color: #17375f;
  min-height: 42px;
  padding: 8px 10px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(31, 73, 124, 0.08);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.my-documents-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(43, 106, 167, 0.34);
  box-shadow: 0 14px 28px rgba(31, 73, 124, 0.13);
}

.my-documents-icon {
  width: 20px;
  height: 20px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 2h9l5 5v15H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2Zm8 1.8V8h4.2L14 3.8ZM8 12h8v1.8H8V12Zm0 4h8v1.8H8V16Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 2h9l5 5v15H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2Zm8 1.8V8h4.2L14 3.8ZM8 12h8v1.8H8V12Zm0 4h8v1.8H8V16Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.brand {
  margin: 0;
  font-size: 23px;
  color: #15335c;
}

.brand-sub {
  margin: 4px 0 0;
  color: #6b7991;
  font-size: 13px;
}

.chat-layout {
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  overflow: hidden;
  backdrop-filter: blur(14px);
  background: linear-gradient(160deg, var(--panel), rgba(255, 255, 255, 0.58));
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 12;
  border-bottom: 1px solid var(--line-soft);
  padding: 16px 22px;
  background: rgba(251, 253, 255, 0.96);
  backdrop-filter: blur(18px);
  transition: padding 0.2s ease, border-color 0.2s ease;
}

.topbar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.topbar-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.menu-btn {
  border: 1px solid #c9d8ef;
  border-radius: 10px;
  background: linear-gradient(145deg, #f8fcff, #edf4ff);
  color: #1c426f;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  padding: 8px 11px;
  cursor: pointer;
}

.quick-new-chat-btn {
  border: 1px solid #c9d8ef;
  border-radius: 10px;
  background: linear-gradient(145deg, #f8fcff, #edf4ff);
  color: #1c426f;
  font-family: inherit;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  width: 38px;
  height: 34px;
  cursor: pointer;
}

.topbar-title h1 {
  margin: 0;
  font-size: 24px;
  color: #12315c;
  line-height: 1.16;
  transition: font-size 0.2s ease;
}

.topbar-title p {
  margin: 5px 0 0;
  color: #697892;
  font-size: 13px;
  transition: font-size 0.2s ease, margin-top 0.2s ease;
}

.chat-layout.chat-layout--active .topbar {
  padding: 12px 18px;
}

.chat-layout.chat-layout--active .topbar-title h1 {
  font-size: 20px;
}

.chat-layout.chat-layout--active .topbar-title p {
  font-size: 12px;
  margin-top: 3px;
}

.chat-feed {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  padding: 20px 0 8px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.chat-stream {
  width: min(940px, calc(100% - 36px));
  margin: 0 auto;
}

.chat-intro.hidden {
  display: none;
}

.chat-intro {
  min-height: 100%;
  display: grid;
  align-content: center;
  gap: 12px;
  padding: 24px 0;
}

.start-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(174, 194, 225, 0.42);
  border-radius: 28px;
  background:
    radial-gradient(circle at 20% 10%, rgba(255, 255, 255, 0.95), transparent 34%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(237, 245, 255, 0.78));
  box-shadow: 0 24px 70px rgba(36, 70, 116, 0.12);
  padding: clamp(22px, 4vw, 46px);
  text-align: center;
}

.start-card::before {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  right: -80px;
  top: -90px;
  border-radius: 999px;
  background: rgba(23, 74, 134, 0.1);
  filter: blur(3px);
}

.start-eyebrow {
  margin: 0 0 10px;
  color: #557195;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.start-card h2 {
  position: relative;
  margin: 0;
  color: #102d52;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(34px, 5.4vw, 54px);
  line-height: 0.98;
  letter-spacing: -0.035em;
}

.start-subtitle {
  position: relative;
  max-width: 620px;
  margin: 14px auto 0;
  color: #60718d;
  font-size: 15px;
  line-height: 1.55;
}

.message {
  margin-bottom: 14px;
  max-width: min(880px, 100%);
  border-radius: 16px;
  border: 1px solid var(--line-soft);
  background: linear-gradient(160deg, #ffffff, #f8fbff);
  padding: 13px 15px;
  line-height: 1.55;
  font-size: 15px;
  white-space: pre-wrap;
  animation: rise 0.24s ease;
}

.message h3,
.message h4 {
  margin: 0 0 8px;
  font-family: "Fraunces", Georgia, serif;
  color: inherit;
}

.message p {
  margin: 0 0 8px;
}

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

.message ul {
  margin: 0 0 8px 18px;
  padding: 0;
}

.message li {
  margin: 0 0 4px;
}

.message strong {
  font-weight: 800;
}

.message a {
  color: #1a5fb4;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px solid rgba(26, 95, 180, 0.35);
}

.message a:hover {
  border-bottom-color: rgba(26, 95, 180, 0.8);
}

.message code {
  font-family: ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  background: rgba(20, 30, 48, 0.08);
  border-radius: 6px;
  padding: 1px 5px;
}

.template-preview-img {
  display: block;
  width: min(420px, 100%);
  max-height: 520px;
  object-fit: cover;
  object-position: top left;
  margin: 10px 0 12px;
  border: 1px solid rgba(151, 164, 183, 0.32);
  border-radius: 16px;
  background: #fbfbf8;
  box-shadow: 0 14px 34px rgba(20, 38, 65, 0.12);
}

.message-attachments {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.attachment-card {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: min(360px, 100%);
  border: 1px solid rgba(201, 218, 238, 0.72);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  padding: 8px;
}

.message--user .attachment-card {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.12);
}

.attachment-preview {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(145deg, #e9f2ff, #ffffff);
  color: #174a86;
  font-size: 11px;
  font-weight: 900;
}

.message--user .attachment-preview {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.attachment-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-body {
  min-width: 0;
}

.attachment-title,
.attachment-meta {
  margin: 0;
}

.attachment-title {
  overflow: hidden;
  color: inherit;
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-meta {
  margin-top: 3px;
  color: rgba(95, 111, 137, 0.92);
  font-size: 11px;
  font-weight: 700;
}

.message--user .attachment-meta {
  color: rgba(255, 255, 255, 0.78);
}

.message--assistant {
  color: #13233a;
}

.message--document {
  position: relative;
  border-color: rgba(32, 91, 160, 0.24);
  background:
    radial-gradient(circle at 8% 0%, rgba(255, 255, 255, 0.98), transparent 34%),
    linear-gradient(135deg, #ffffff 0%, #f8fbff 54%, #eef6ff 100%);
  box-shadow:
    0 22px 55px rgba(28, 68, 116, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  padding: 18px 18px 16px 24px;
  overflow: hidden;
}

.message--document::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  border-radius: 999px;
  background: linear-gradient(180deg, #173f70, #2d76bd 48%, #9bc7f4);
}

.message--document::after {
  content: "Материал";
  position: absolute;
  top: 12px;
  right: 14px;
  border: 1px solid rgba(34, 91, 157, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #55708d;
  padding: 4px 9px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.document-save-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  padding: 12px;
  border: 1px solid rgba(157, 184, 219, 0.58);
  border-radius: 20px;
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 255, 255, 1), transparent 42%),
    linear-gradient(145deg, rgba(250, 253, 255, 0.96), rgba(226, 239, 255, 0.88));
  box-shadow:
    0 14px 34px rgba(29, 68, 116, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

.document-message-context {
  margin: 0 0 12px;
  padding-right: 92px;
}

.document-message-context h3,
.document-message-context h4 {
  margin-top: 0;
}

.document-message-notes {
  margin-top: 12px;
  color: #4d617b;
  font-size: 13px;
}

.document-body-card {
  position: relative;
  margin: 12px 0 4px;
  border: 1px solid rgba(36, 85, 142, 0.18);
  border-radius: 24px;
  background:
    radial-gradient(circle at 8% 0%, rgba(255, 255, 255, 0.98), transparent 36%),
    linear-gradient(145deg, #ffffff 0%, #f7fbff 62%, #edf5ff 100%);
  box-shadow:
    0 22px 44px rgba(31, 75, 130, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
  overflow: hidden;
}

.document-body-head {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px 12px;
  border-bottom: 1px solid rgba(49, 95, 149, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(242, 248, 255, 0.84));
}

.document-body-title {
  display: grid;
  min-width: 0;
  gap: 4px;
  color: #17375f;
}

.document-body-title b {
  overflow: hidden;
  font-size: 15px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-body-title small {
  max-width: 520px;
  color: #617790;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
}

.document-body-badge {
  width: fit-content;
  border: 1px solid rgba(31, 82, 143, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: #60748d;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.document-body-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.document-body-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  border: 1px solid rgba(31, 82, 143, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: #17375f;
  padding: 0 11px;
  font-size: 11px;
  font-weight: 950;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(31, 79, 139, 0.1);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.document-body-action--primary {
  border-color: rgba(31, 82, 143, 0.24);
  background: linear-gradient(145deg, #17375f, #2b6aa7);
  color: #ffffff;
}

.document-body-action:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 82, 143, 0.34);
  box-shadow: 0 13px 24px rgba(31, 79, 139, 0.16);
}

.document-body-paper {
  margin: 12px;
  padding: 28px min(34px, 5vw);
  border: 1px solid rgba(174, 190, 210, 0.48);
  border-radius: 18px;
  background:
    linear-gradient(90deg, rgba(208, 67, 67, 0.22) 0 1px, transparent 1px 100%) 30px 0 / 1px 100% no-repeat,
    #fffefb;
  color: #151515;
  font-family: "Times New Roman", Times, serif;
  font-size: 14px;
  line-height: 1.55;
  box-shadow:
    0 18px 36px rgba(44, 65, 91, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

.document-body-paper p {
  margin: 0 0 8px;
}

.document-body-paper h3,
.document-body-paper h4 {
  margin: 10px 0 10px;
  color: #111;
  font-family: "Times New Roman", Times, serif;
  text-align: center;
  letter-spacing: 0.01em;
}

.document-save-preview,
.my-document-thumb {
  width: 52px;
  height: 66px;
  border: 1px solid rgba(45, 91, 145, 0.2);
  border-radius: 11px;
  background:
    linear-gradient(90deg, rgba(222, 68, 68, 0.23) 0 1px, transparent 1px 100%) 12px 0 / 1px 100% no-repeat,
    linear-gradient(180deg, #ffffff 0%, #f9fbff 58%, #edf5ff 100%);
  box-shadow:
    0 12px 22px rgba(31, 73, 124, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
  padding: 15px 9px 8px 18px;
  display: grid;
  gap: 5px;
  align-content: start;
  transform: rotate(-1deg);
}

.document-save-preview span,
.my-document-thumb span {
  display: block;
  height: 2px;
  border-radius: 999px;
  background: rgba(23, 74, 134, 0.28);
}

.document-save-label {
  display: grid;
  gap: 4px;
  color: #183d69;
  font-size: 14px;
  min-width: 0;
}

.document-save-label b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-save-label small {
  color: #65768f;
  font-size: 11px;
  font-weight: 800;
}

.document-save-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.document-save-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid rgba(31, 82, 143, 0.18);
  border-radius: 14px;
  background:
    linear-gradient(145deg, #17375f, #2b6aa7);
  color: #fff;
  min-height: 38px;
  padding: 9px 11px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(31, 79, 139, 0.17);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.document-save-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  background: currentColor;
}

.document-save-icon--download {
  -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 3h2v9.2l3.3-3.3 1.4 1.4L12 16l-5.7-5.7 1.4-1.4 3.3 3.3V3Zm-6 15h14v2H5v-2Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 3h2v9.2l3.3-3.3 1.4 1.4L12 16l-5.7-5.7 1.4-1.4 3.3 3.3V3Zm-6 15h14v2H5v-2Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.document-save-icon--edit {
  -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 17.2V20h2.8L17.1 9.7l-2.8-2.8L4 17.2ZM19.3 7.5c.4-.4.4-1 0-1.4l-1.4-1.4a1 1 0 0 0-1.4 0l-1.1 1.1 2.8 2.8 1.1-1.1Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 17.2V20h2.8L17.1 9.7l-2.8-2.8L4 17.2ZM19.3 7.5c.4-.4.4-1 0-1.4l-1.4-1.4a1 1 0 0 0-1.4 0l-1.1 1.1 2.8 2.8 1.1-1.1Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.document-save-icon--check {
  -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m9.2 16.6-4-4 1.5-1.5 2.5 2.5 8.1-8.1 1.5 1.5-9.6 9.6ZM5 19h14v2H5v-2Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m9.2 16.6-4-4 1.5-1.5 2.5 2.5 8.1-8.1 1.5 1.5-9.6 9.6ZM5 19h14v2H5v-2Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.document-save-btn--docx {
  background: linear-gradient(145deg, #f7fbff, #e5f0ff);
  color: #17375f;
}

.document-save-btn--soft {
  background: rgba(255, 255, 255, 0.78);
  color: #48627f;
  border-color: rgba(102, 131, 168, 0.22);
}

.document-save-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 82, 143, 0.32);
  box-shadow: 0 15px 28px rgba(31, 79, 139, 0.22);
}

.message--assistant p,
.message--assistant li,
.message--assistant h3,
.message--assistant h4,
.message--assistant code {
  color: inherit;
}

.message--streaming {
  animation: none;
  color: #13233a !important;
  transform: none;
  will-change: contents;
}

.message--streaming::after {
  content: none;
}

.message--user {
  margin-left: auto;
  border-color: rgba(44, 95, 164, 0.48);
  background: linear-gradient(145deg, var(--user-a), var(--user-b));
  color: #fff;
  box-shadow: var(--shadow-md);
}

.message--typing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
}

.message--typing span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #5d7092;
  animation: blink 1s infinite ease-in-out;
}

.message--typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.message--typing span:nth-child(3) {
  animation-delay: 0.3s;
}

.followup-row {
  margin: -4px 0 14px;
  max-width: min(880px, 100%);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.followup-chip {
  border: 1px solid #d4e1f6;
  background: linear-gradient(145deg, #f7fbff, #edf3ff);
  color: #1f4471;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.followup-chip:hover {
  transform: translateY(-1px);
  border-color: #b8cdef;
  box-shadow: 0 8px 16px rgba(45, 89, 151, 0.12);
}

.retry-btn {
  margin-top: 12px;
  border: 1px solid #c9daef;
  border-radius: 999px;
  background: linear-gradient(145deg, #f8fcff, #eaf3ff);
  color: #1d4777;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(36, 83, 146, 0.1);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.retry-btn:hover {
  transform: translateY(-1px);
  border-color: #abc5eb;
  box-shadow: 0 14px 28px rgba(36, 83, 146, 0.16);
}

.retry-btn span {
  font-size: 15px;
  line-height: 1;
}

.suggest-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: min(760px, 100%);
  margin: 0 auto 6px;
}

.suggest {
  min-height: 54px;
  border: 1px solid #d7e4fa;
  border-radius: 13px;
  background: linear-gradient(145deg, #f8fcff, #edf4ff);
  color: #21416b;
  text-align: left;
  padding: 12px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.suggest:hover {
  border-color: #adc7f1;
  box-shadow: 0 10px 20px rgba(76, 116, 176, 0.15);
}

.composer-wrap {
  border-top: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(248, 252, 255, 0.95));
  padding: 12px 16px 16px;
  z-index: 11;
  backdrop-filter: blur(18px);
}

.composer {
  width: min(940px, 100%);
  margin: 0 auto;
  border: 1px solid #cfddef;
  border-radius: 18px;
  background: linear-gradient(150deg, #ffffff, #f7fbff);
  box-shadow: 0 12px 30px rgba(44, 82, 135, 0.12);
  padding: 11px 12px;
  display: grid;
  gap: 10px;
}

.composer textarea {
  width: 100%;
  min-height: 30px;
  max-height: 220px;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.45;
  color: #1a2941;
}

.composer textarea::placeholder {
  color: #8090ad;
}

.tools-row {
  display: grid;
  grid-template-columns: auto minmax(190px, 1fr) auto auto auto;
  gap: 8px;
  align-items: center;
}

.model-switch {
  border: 1px solid #d2ddf0;
  border-radius: 11px;
  padding: 2px;
  display: inline-flex;
  gap: 3px;
  background: #f3f8ff;
}

.attach-btn {
  position: relative;
  border: 1px solid rgba(163, 184, 215, 0.72);
  border-radius: 13px;
  width: 38px;
  height: 38px;
  background:
    radial-gradient(circle at 35% 20%, rgba(255, 255, 255, 0.96), transparent 42%),
    linear-gradient(145deg, #ffffff, #edf5ff);
  color: #173f70;
  padding: 0;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 8px 18px rgba(38, 80, 136, 0.1);
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease,
    box-shadow 0.16s ease,
    color 0.16s ease;
}

.attach-btn::after {
  content: "";
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6Zm-1 7V3.5L18.5 9H13Zm-5 4h8v2H8v-2Zm0 4h8v2H8v-2Zm0-8h3v2H8V9Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6Zm-1 7V3.5L18.5 9H13Zm-5 4h8v2H8v-2Zm0 4h8v2H8v-2Zm0-8h3v2H8V9Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.attach-btn:hover {
  transform: translateY(-1px);
  border-color: #aac5ea;
  box-shadow: 0 12px 24px rgba(38, 80, 136, 0.16);
}

.attach-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.model-btn {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #3d4f6c;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: 0.18s ease;
}

.model-btn--active {
  background: #fff;
  color: #153964;
  box-shadow: 0 1px 2px rgba(17, 33, 56, 0.1);
}

.topic-select {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  border: 1px solid #d4dfef;
  border-radius: 11px;
  background: #f9fbff;
  padding: 7px 10px;
  color: #4b5c79;
}

.topic-select span {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.topic-select select {
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: #203e67;
}

.send-btn {
  border: 0;
  border-radius: 11px;
  padding: 9px 14px;
  min-height: 38px;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 10px 20px rgba(31, 79, 139, 0.26);
}

.voice-btn {
  position: relative;
  border: 1px solid rgba(163, 184, 215, 0.72);
  border-radius: 13px;
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  line-height: 0;
  background:
    radial-gradient(circle at 35% 20%, rgba(255, 255, 255, 0.96), transparent 42%),
    linear-gradient(145deg, #ffffff, #edf5ff);
  color: #173f70;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 8px 18px rgba(38, 80, 136, 0.1);
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease,
    box-shadow 0.16s ease,
    color 0.16s ease;
}

.voice-btn:hover {
  transform: translateY(-1px);
  border-color: #aac5ea;
  box-shadow: 0 12px 24px rgba(38, 80, 136, 0.16);
}

.voice-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.voice-btn-icon {
  display: none;
}

.voice-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 18px;
  height: 18px;
  margin: auto;
  background: currentColor;
  pointer-events: none;
  transform: none;
  -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3Zm5.3-3c0 3-2.54 5.1-5.3 5.1S6.7 14 6.7 11H5c0 3.41 2.72 6.23 6 6.72V21h2v-3.28c3.28-.49 6-3.31 6-6.72h-1.7Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3Zm5.3-3c0 3-2.54 5.1-5.3 5.1S6.7 14 6.7 11H5c0 3.41 2.72 6.23 6 6.72V21h2v-3.28c3.28-.49 6-3.31 6-6.72h-1.7Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.voice-btn--active {
  color: #ffffff;
  border-color: rgba(197, 77, 67, 0.42);
  background:
    radial-gradient(circle at 35% 20%, rgba(255, 255, 255, 0.25), transparent 44%),
    linear-gradient(145deg, #a93f38, #de7655);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 12px 28px rgba(185, 56, 56, 0.24);
}

.voice-btn--active::before {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 16px;
  border: 1px solid rgba(185, 56, 56, 0.34);
  animation: voicePulse 1.2s ease-out infinite;
}

.pending-uploads {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.upload-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #d4dfef;
  background: #f7faff;
  border-radius: 999px;
  padding: 4px 8px;
}

.upload-chip-title {
  border: 0;
  background: transparent;
  color: #29486f;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-chip-remove {
  border: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #dce9fb;
  color: #24456d;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.send-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.composer-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.status {
  color: var(--ok);
  font-size: 12px;
  font-weight: 800;
}

.tip {
  color: #6f7e98;
  font-size: 12px;
}

.sources {
  display: none !important;
}

.message-sources {
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  margin-top: 12px;
  overflow-x: auto;
  padding: 2px 1px 4px;
  scrollbar-width: none;
}

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

.message-sources::-webkit-scrollbar {
  display: none;
}

.inline-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: min(100%, 360px);
  margin: 0 3px;
  padding: 3px 9px;
  border: 1px solid rgba(42, 92, 146, 0.16);
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(236, 245, 255, 0.92));
  color: #245f98;
  font-size: 0.93em;
  font-weight: 800;
  line-height: 1.35;
  text-decoration: none;
  vertical-align: baseline;
  box-shadow:
    0 8px 20px rgba(31, 76, 128, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inline-link-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(34, 95, 161, 0.34);
  background: #fff;
}

.inline-link-btn span {
  flex: 0 0 auto;
  font-size: 10px;
  line-height: 1;
}

.citation-chip {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  margin: 0 2px;
  padding: 0 6px;
  border-radius: 999px;
  background: linear-gradient(135deg, #1f6fb9, #183d70);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
  vertical-align: middle;
  box-shadow: 0 7px 16px rgba(31, 76, 128, 0.18);
  transition: transform 0.16s ease, filter 0.16s ease;
}

.citation-chip:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.source-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-height: 25px;
  border: 1px solid rgba(42, 92, 146, 0.14);
  background: rgba(255, 255, 255, 0.82);
  border-radius: 999px;
  padding: 4px 9px 4px 5px;
  font-size: 11px;
  font-weight: 750;
  color: #315d8d;
  text-decoration: none;
  box-shadow: 0 8px 22px rgba(27, 58, 96, 0.08);
  backdrop-filter: blur(14px);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.source-pill:hover {
  transform: translateY(-1px);
  border-color: rgba(34, 95, 161, 0.3);
  background: #fff;
}

.source-pill-index {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, #1f6fb9, #183d70);
  color: #fff;
  font-size: 10px;
  line-height: 1;
}

.source-pill-host {
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.install-banner {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 40;
  width: min(560px, calc(100vw - 28px));
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(166, 187, 219, 0.58);
  border-radius: 18px;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.96), transparent 38%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(235, 244, 255, 0.94));
  box-shadow: 0 22px 54px rgba(19, 45, 78, 0.22);
  padding: 10px 10px 10px 12px;
  transform: translateX(-50%);
  backdrop-filter: blur(18px);
}

.install-banner[hidden] {
  display: none;
}

.install-banner-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 18px rgba(29, 66, 110, 0.18);
}

.install-banner-icon img {
  display: block;
  width: 100%;
  height: 100%;
}

.install-banner-copy {
  min-width: 0;
}

.install-banner-title {
  margin: 0;
  color: #12315c;
  font-size: 13px;
  font-weight: 900;
}

.install-banner-text {
  margin: 2px 0 0;
  color: #65758f;
  font-size: 12px;
  line-height: 1.25;
}

.install-banner-action,
.install-banner-close {
  font-family: inherit;
  cursor: pointer;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(12, 24, 42, 0.42);
  backdrop-filter: blur(8px);
}

.modal[hidden] {
  display: none;
}

.modal-card {
  position: relative;
  width: min(920px, 100%);
  max-height: min(760px, calc(100dvh - 36px));
  overflow: auto;
  border: 1px solid rgba(177, 197, 225, 0.64);
  border-radius: 24px;
  background: linear-gradient(145deg, #ffffff, #f3f8ff);
  box-shadow: 0 32px 90px rgba(18, 43, 78, 0.25);
  padding: 22px;
}

.modal-card--narrow {
  width: min(430px, 100%);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 1px solid #d0dcec;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  font-size: 22px;
  color: #526985;
}

.modal-kicker {
  margin: 0 0 6px;
  color: #61738f;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.modal-card h2 {
  margin: 0 38px 8px 0;
  color: #102d52;
  font-family: "Fraunces", Georgia, serif;
  font-size: 34px;
  line-height: 1;
}

.modal-card h3 {
  margin: 0 0 10px;
  color: #17375f;
}

.modal-note,
.modal-status {
  color: #63738d;
  font-size: 13px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 14px 0;
  padding: 3px;
  border-radius: 13px;
  background: #edf4ff;
}

.auth-tab {
  border: 0;
  border-radius: 10px;
  padding: 9px;
  background: transparent;
  font-weight: 900;
  color: #536984;
  cursor: pointer;
}

.auth-tab--active {
  background: #fff;
  color: #17375f;
  box-shadow: 0 1px 3px rgba(23, 53, 88, 0.1);
}

.modal-form {
  display: grid;
  gap: 9px;
}

.modal-form input {
  border: 1px solid #cfdaea;
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
}

.modal-form button,
.settings-actions button,
.buy-btn {
  border: 0;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  color: #fff;
  padding: 10px 12px;
  font-weight: 900;
  cursor: pointer;
}

.document-link-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 4px 0;
  padding: 4px;
  border: 1px solid rgba(181, 199, 224, 0.62);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 22px rgba(26, 62, 105, 0.08);
}

.document-download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 74px;
  min-height: 32px;
  margin: 2px 4px 2px 0;
  padding: 0 12px;
  border: 1px solid rgba(31, 82, 143, 0.18);
  border-radius: 999px;
  background:
    linear-gradient(145deg, #17375f, #2c6da7);
  color: #fff !important;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.03em;
  line-height: 1;
  text-decoration: none;
  vertical-align: middle;
  box-shadow:
    0 9px 18px rgba(31, 79, 139, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.document-download-link--doc {
  background:
    linear-gradient(145deg, #ffffff, #edf5ff);
  color: #17375f !important;
}

.document-download-link:hover {
  transform: translateY(-1px);
  box-shadow:
    0 13px 24px rgba(31, 79, 139, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  filter: brightness(1.03);
}

.document-inline-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  border: 1px solid rgba(43, 106, 167, 0.16);
  border-radius: 999px;
  background: linear-gradient(145deg, #f7fbff, #e8f2ff);
  color: #16406d;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.document-inline-btn:hover {
  border-color: rgba(43, 106, 167, 0.34);
  box-shadow: 0 8px 18px rgba(36, 82, 134, 0.12);
  transform: translateY(-1px);
}

.document-inline-btn--ghost {
  background: rgba(255, 255, 255, 0.72);
  color: #536984;
}

.document-inline-icon {
  width: 13px;
  height: 13px;
  background: currentColor;
}

.document-inline-icon--edit {
  -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 17.2V20h2.8L17.1 9.7l-2.8-2.8L4 17.2ZM19.3 7.5c.4-.4.4-1 0-1.4l-1.4-1.4a1 1 0 0 0-1.4 0l-1.1 1.1 2.8 2.8 1.1-1.1Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 17.2V20h2.8L17.1 9.7l-2.8-2.8L4 17.2ZM19.3 7.5c.4-.4.4-1 0-1.4l-1.4-1.4a1 1 0 0 0-1.4 0l-1.1 1.1 2.8 2.8 1.1-1.1Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.document-inline-icon--check {
  -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m9.2 16.6-4-4 1.5-1.5 2.5 2.5 8.1-8.1 1.5 1.5-9.6 9.6ZM5 19h14v2H5v-2Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m9.2 16.6-4-4 1.5-1.5 2.5 2.5 8.1-8.1 1.5 1.5-9.6 9.6ZM5 19h14v2H5v-2Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.document-editor-card {
  width: min(1120px, 100%);
  display: grid;
  gap: 14px;
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 255, 255, 0.98), transparent 34%),
    radial-gradient(circle at 90% 10%, rgba(203, 225, 255, 0.72), transparent 34%),
    linear-gradient(145deg, #ffffff, #edf5ff);
  border-color: rgba(162, 186, 219, 0.7);
}

.document-editor-grid {
  display: grid;
  gap: 8px;
}

.document-editor-label {
  color: #58708e;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.document-editor-title,
.document-editor-text {
  width: 100%;
  border: 1px solid #c6d6ea;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  color: #17375f;
  outline: none;
}

.document-editor-title {
  padding: 13px 14px;
  font: 900 15px/1.3 "Manrope", sans-serif;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.document-editor-paper {
  position: relative;
  border: 1px solid rgba(174, 194, 221, 0.82);
  border-radius: 22px;
  background:
    linear-gradient(90deg, rgba(220, 68, 68, 0.18) 0 1px, transparent 1px 100%) 42px 0 / 1px 100% no-repeat,
    linear-gradient(180deg, #ffffff, #fbfdff);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 24px 60px rgba(24, 58, 101, 0.14);
  padding: 14px 14px 14px 32px;
  overflow: hidden;
}

.document-editor-paper::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(23, 74, 134, 0.045) 1px, transparent 1px);
  background-size: 100% 30px;
  opacity: 0.5;
}

.document-editor-text {
  position: relative;
  z-index: 1;
  min-height: min(58vh, 620px);
  resize: vertical;
  border: 0;
  border-radius: 12px;
  background: transparent;
  padding: 16px 18px;
  font: 15px/1.68 "Times New Roman", Times, serif;
  white-space: pre-wrap;
  box-shadow: none;
}

.document-editor-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  padding: 9px;
  border: 1px solid rgba(166, 190, 222, 0.66);
  border-radius: 18px;
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 255, 255, 0.98), transparent 42%),
    rgba(240, 247, 255, 0.78);
}

.document-editor-actions button,
.document-editor-downloads a {
  border: 0;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  color: #fff;
  min-height: 42px;
  padding: 11px 13px;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
  text-align: center;
  box-shadow: 0 12px 22px rgba(31, 79, 139, 0.15);
}

.document-editor-actions button:disabled {
  opacity: 0.6;
  cursor: progress;
}

.document-editor-actions .document-editor-secondary {
  background: linear-gradient(145deg, #eef5ff, #dfeeff);
  color: #17375f;
  border: 1px solid #cddcf0;
}

.document-editor-downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 0;
}

.document-editor-downloads a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(145deg, #f7fbff, #e5f0ff);
  color: #17375f;
  border: 1px solid #cddcf0;
  box-shadow: 0 10px 20px rgba(31, 79, 139, 0.1);
}

.document-editor-downloads a::before {
  content: "";
  width: 16px;
  height: 16px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 20h14v-2H5v2ZM19 9h-4V3H9v6H5l7 7 7-7Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 20h14v-2H5v2ZM19 9h-4V3H9v6H5l7 7 7-7Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.my-documents-card {
  width: min(1060px, 100%);
  display: grid;
  gap: 14px;
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 255, 255, 0.96), transparent 36%),
    linear-gradient(145deg, #ffffff, #edf5ff);
}

.my-documents-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.85fr);
  gap: 14px;
}

.my-documents-layout h3 {
  margin: 0 0 8px;
  color: #17375f;
  font-size: 16px;
}

.my-documents-list {
  display: grid;
  gap: 9px;
  max-height: min(54vh, 520px);
  overflow: auto;
  padding-right: 3px;
}

.my-documents-empty {
  margin: 0;
  border: 1px dashed rgba(126, 151, 184, 0.5);
  border-radius: 16px;
  padding: 18px;
  color: #65768f;
  background: rgba(255, 255, 255, 0.56);
}

.my-document-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  border: 1px solid rgba(186, 204, 229, 0.76);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.74);
  padding: 10px;
  box-shadow: 0 12px 28px rgba(31, 73, 124, 0.08);
}

.my-document-info {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.my-document-info b {
  color: #17375f;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.my-document-info small {
  color: #65768f;
  line-height: 1.45;
}

.my-document-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.my-document-actions button,
.my-documents-form button {
  border: 1px solid rgba(31, 82, 143, 0.16);
  border-radius: 999px;
  background: linear-gradient(145deg, #17375f, #2b6aa7);
  color: #fff;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.my-document-actions button:nth-child(2) {
  background: linear-gradient(145deg, #f7fbff, #e5f0ff);
  color: #17375f;
}

.my-document-actions button:nth-child(3) {
  background: rgba(255, 255, 255, 0.76);
  color: #8a3c3c;
}

.my-documents-form {
  display: grid;
  gap: 9px;
  border: 1px solid rgba(186, 204, 229, 0.76);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  padding: 12px;
  align-content: start;
}

.my-documents-form input,
.my-documents-form textarea {
  width: 100%;
  border: 1px solid #cfdaea;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.9);
  color: #17375f;
  outline: none;
  padding: 11px 12px;
}

.my-documents-form textarea {
  resize: vertical;
  min-height: 190px;
  font: 14px/1.55 "Times New Roman", Times, serif;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.settings-panel {
  border: 1px solid #d8e3f1;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  padding: 14px;
}

.settings-panel--wide {
  grid-column: 1 / -1;
}

.settings-big {
  margin: 0 0 4px;
  color: #102d52;
  font-size: 24px;
  font-weight: 900;
}

.settings-actions,
.buy-grid {
  display: grid;
  gap: 8px;
}

.buy-btn {
  text-align: left;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  background: linear-gradient(145deg, #f7fbff, #e8f2ff);
  color: #17375f;
  border: 1px solid #cddcf0;
}

.buy-btn--pro {
  background: linear-gradient(145deg, #17375f, #2b6aa7);
  color: #fff;
}

.buy-btn--max {
  background: linear-gradient(145deg, #1a273c, #815f2d);
  color: #fff;
}

.login-history {
  display: grid;
  gap: 6px;
  color: #566982;
  font-size: 13px;
}

.settings-menu-card {
  position: relative;
  width: 100%;
  max-height: min(68vh, 620px);
  overflow: auto;
  border: 1px solid rgba(176, 197, 228, 0.72);
  border-radius: 18px;
  background:
    radial-gradient(circle at 15% 0%, rgba(255, 255, 255, 0.96), transparent 34%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(237, 245, 255, 0.86));
  color: #15335c;
  box-shadow: 0 16px 42px rgba(31, 73, 124, 0.14);
  padding: 12px;
}

.settings-menu-card .modal-close {
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(173, 195, 226, 0.78);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.82);
  color: #526985;
  font-size: 20px;
  line-height: 1;
}

.settings-menu-head {
  border-bottom: 1px solid rgba(94, 120, 162, 0.14);
  padding: 4px 38px 10px 2px;
  margin-bottom: 8px;
}

.settings-account-name {
  margin: 0;
  color: #15335c;
  font-size: 15px;
  font-weight: 900;
}

.settings-account-meta {
  margin: 3px 0 0;
  color: #61738f;
  font-size: 12px;
  line-height: 1.35;
}

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

.settings-menu-row {
  position: relative;
  width: 100%;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: #1c426f;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px;
  text-align: left;
  font-size: 13px;
  font-weight: 850;
  letter-spacing: -0.01em;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.settings-menu-row[hidden] {
  display: none !important;
}

.settings-menu-row:hover,
.settings-menu-row--active {
  border-color: rgba(174, 197, 231, 0.74);
  background: rgba(255, 255, 255, 0.72);
  color: #123964;
}

.settings-menu-row--arrow::after {
  content: "";
  width: 8px;
  height: 14px;
  margin-right: 2px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 14 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.2 2 0 4.2 7.8 12 0 19.8 2.2 22 12.2 12 2.2 2Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 14 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.2 2 0 4.2 7.8 12 0 19.8 2.2 22 12.2 12 2.2 2Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.settings-menu-icon {
  width: 21px;
  height: 21px;
  background: currentColor;
}

.settings-menu-icon--sparkle {
  -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M16 2.5 19.9 12l9.6 4-9.6 4L16 29.5 12.1 20l-9.6-4 9.6-4L16 2.5Zm0 6.3-2.2 5.4-5.3 1.8 5.3 1.8L16 23.2l2.2-5.4 5.3-1.8-5.3-1.8L16 8.8Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M16 2.5 19.9 12l9.6 4-9.6 4L16 29.5 12.1 20l-9.6-4 9.6-4L16 2.5Zm0 6.3-2.2 5.4-5.3 1.8 5.3 1.8L16 23.2l2.2-5.4 5.3-1.8-5.3-1.8L16 8.8Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.settings-menu-icon--personal {
  -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M16 3a13 13 0 1 0 0 26 13 13 0 0 0 0-26Zm0 2.4a10.6 10.6 0 1 1 0 21.2 10.6 10.6 0 0 1 0-21.2Zm1.2 3.4h-2.4v8.1l6.1 3.7 1.2-2-4.9-2.9V8.8Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M16 3a13 13 0 1 0 0 26 13 13 0 0 0 0-26Zm0 2.4a10.6 10.6 0 1 1 0 21.2 10.6 10.6 0 0 1 0-21.2Zm1.2 3.4h-2.4v8.1l6.1 3.7 1.2-2-4.9-2.9V8.8Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.settings-menu-icon--profile {
  -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M16 3a13 13 0 1 0 0 26 13 13 0 0 0 0-26Zm0 2.5a10.5 10.5 0 0 1 8.2 17.1c-1.7-3-4.6-4.6-8.2-4.6s-6.5 1.6-8.2 4.6A10.5 10.5 0 0 1 16 5.5Zm0 4a4.2 4.2 0 1 0 0 8.4 4.2 4.2 0 0 0 0-8.4Zm0 2.3a1.9 1.9 0 1 1 0 3.8 1.9 1.9 0 0 1 0-3.8Zm0 8.5c2.8 0 5 .95 6.2 3.1a10.44 10.44 0 0 1-12.4 0c1.2-2.15 3.4-3.1 6.2-3.1Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M16 3a13 13 0 1 0 0 26 13 13 0 0 0 0-26Zm0 2.5a10.5 10.5 0 0 1 8.2 17.1c-1.7-3-4.6-4.6-8.2-4.6s-6.5 1.6-8.2 4.6A10.5 10.5 0 0 1 16 5.5Zm0 4a4.2 4.2 0 1 0 0 8.4 4.2 4.2 0 0 0 0-8.4Zm0 2.3a1.9 1.9 0 1 1 0 3.8 1.9 1.9 0 0 1 0-3.8Zm0 8.5c2.8 0 5 .95 6.2 3.1a10.44 10.44 0 0 1-12.4 0c1.2-2.15 3.4-3.1 6.2-3.1Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.settings-menu-icon--gear {
  -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m27.2 18.2-2.3 1.8.8 2.8-2.9 2.9-2.8-.8-1.8 2.3h-4.4L12 24.9l-2.8.8-2.9-2.9.8-2.8-2.3-1.8v-4.4L7.1 12l-.8-2.8 2.9-2.9 2.8.8 1.8-2.3h4.4L20 7.1l2.8-.8 2.9 2.9-.8 2.8 2.3 1.8v4.4ZM16 11a5 5 0 1 0 0 10 5 5 0 0 0 0-10Zm0 2.3a2.7 2.7 0 1 1 0 5.4 2.7 2.7 0 0 1 0-5.4Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m27.2 18.2-2.3 1.8.8 2.8-2.9 2.9-2.8-.8-1.8 2.3h-4.4L12 24.9l-2.8.8-2.9-2.9.8-2.8-2.3-1.8v-4.4L7.1 12l-.8-2.8 2.9-2.9 2.8.8 1.8-2.3h4.4L20 7.1l2.8-.8 2.9 2.9-.8 2.8 2.3 1.8v4.4ZM16 11a5 5 0 1 0 0 10 5 5 0 0 0 0-10Zm0 2.3a2.7 2.7 0 1 1 0 5.4 2.7 2.7 0 0 1 0-5.4Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.settings-menu-icon--help {
  -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M16 3a13 13 0 1 0 0 26 13 13 0 0 0 0-26Zm0 2.4a10.6 10.6 0 1 1 0 21.2 10.6 10.6 0 0 1 0-21.2Zm-1.2 16.4h2.5v-2.5h-2.5v2.5Zm1.25-12.1c-2.6 0-4.35 1.5-4.45 3.8h2.35c.1-1.05.82-1.75 2.03-1.75 1.2 0 1.98.7 1.98 1.8 0 .9-.4 1.4-1.45 2.05-1.6.97-2.02 1.82-1.92 3.12h2.18c0-.88.35-1.32 1.48-2.02 1.45-.9 2.15-1.85 2.15-3.25 0-2.18-1.75-3.75-4.35-3.75Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M16 3a13 13 0 1 0 0 26 13 13 0 0 0 0-26Zm0 2.4a10.6 10.6 0 1 1 0 21.2 10.6 10.6 0 0 1 0-21.2Zm-1.2 16.4h2.5v-2.5h-2.5v2.5Zm1.25-12.1c-2.6 0-4.35 1.5-4.45 3.8h2.35c.1-1.05.82-1.75 2.03-1.75 1.2 0 1.98.7 1.98 1.8 0 .9-.4 1.4-1.45 2.05-1.6.97-2.02 1.82-1.92 3.12h2.18c0-.88.35-1.32 1.48-2.02 1.45-.9 2.15-1.85 2.15-3.25 0-2.18-1.75-3.75-4.35-3.75Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.settings-menu-icon--bell {
  -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M16 29a3.4 3.4 0 0 0 3.2-2.2h-6.4A3.4 3.4 0 0 0 16 29Zm10.4-7.2-2.3-3.1V13a8.1 8.1 0 0 0-6.2-7.9V3h-3.8v2.1A8.1 8.1 0 0 0 7.9 13v5.7l-2.3 3.1V24h20.8v-2.2ZM10.7 21.1l.9-1.2V13a4.4 4.4 0 1 1 8.8 0v6.9l.9 1.2H10.7Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M16 29a3.4 3.4 0 0 0 3.2-2.2h-6.4A3.4 3.4 0 0 0 16 29Zm10.4-7.2-2.3-3.1V13a8.1 8.1 0 0 0-6.2-7.9V3h-3.8v2.1A8.1 8.1 0 0 0 7.9 13v5.7l-2.3 3.1V24h20.8v-2.2ZM10.7 21.1l.9-1.2V13a4.4 4.4 0 1 1 8.8 0v6.9l.9 1.2H10.7Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.settings-menu-icon--logout,
.settings-menu-icon--login {
  -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 5h11v3H9v16h8v3H6V5Zm16.2 7.2 5 5-5 5-2.1-2.1 1.4-1.4H13v-3h8.5l-1.4-1.4 2.1-2.1Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 5h11v3H9v16h8v3H6V5Zm16.2 7.2 5 5-5 5-2.1-2.1 1.4-1.4H13v-3h8.5l-1.4-1.4 2.1-2.1Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.settings-menu-separator {
  display: block;
  height: 1px;
  margin: 6px 0;
  background: rgba(94, 120, 162, 0.14);
}

.settings-details {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(94, 120, 162, 0.14);
}

.settings-detail-panel {
  border: 1px solid rgba(176, 197, 228, 0.5);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.62);
  padding: 10px;
}

.settings-detail-panel h3 {
  margin: 0 0 8px;
  color: #17375f;
  font-size: 14px;
}

.settings-detail-note {
  margin: 0;
  color: #60718d;
  line-height: 1.45;
  font-size: 12px;
}

.settings-profile-form {
  margin-top: 10px;
}

.theme-setting-card {
  margin-top: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(176, 197, 228, 0.62);
  border-radius: 16px;
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 255, 255, 0.98), transparent 42%),
    linear-gradient(145deg, rgba(248, 252, 255, 0.92), rgba(232, 242, 255, 0.78));
  padding: 11px;
}

.theme-setting-card b,
.theme-setting-card span {
  display: block;
}

.theme-setting-card b {
  color: #17375f;
  font-size: 13px;
  font-weight: 900;
}

.theme-setting-card span {
  margin-top: 2px;
  color: #65768f;
  font-size: 12px;
  font-weight: 800;
}

.theme-toggle-btn {
  border: 1px solid rgba(31, 82, 143, 0.16);
  border-radius: 999px;
  background: linear-gradient(145deg, #17375f, #2b6aa7);
  color: #fff;
  min-height: 36px;
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(31, 79, 139, 0.15);
}

.theme-toggle-btn[aria-pressed="true"] {
  background: linear-gradient(145deg, #f8fbff, #dfecff);
  color: #17375f;
}

.theme-toggle-icon {
  width: 15px;
  height: 15px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21 14.4A8.6 8.6 0 0 1 9.6 3 9 9 0 1 0 21 14.4Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21 14.4A8.6 8.6 0 0 1 9.6 3 9 9 0 1 0 21 14.4Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.settings-subtitle {
  margin-top: 14px !important;
  padding-top: 12px;
  border-top: 1px solid rgba(94, 120, 162, 0.14);
}

.settings-menu-card .modal-form input {
  background: rgba(255, 255, 255, 0.84);
  border-color: rgba(176, 197, 228, 0.72);
  color: #17375f;
}

.settings-menu-card .modal-form input::placeholder {
  color: #7b8aa3;
}

:root[data-theme="dark"] .sidebar,
:root[data-theme="dark"] .chat-layout,
:root[data-theme="dark"] .settings-menu-card,
:root[data-theme="dark"] .modal-card,
:root[data-theme="dark"] .support-panel {
  background:
    radial-gradient(circle at 12% 0%, rgba(40, 92, 156, 0.24), transparent 36%),
    linear-gradient(160deg, rgba(13, 28, 48, 0.94), rgba(8, 18, 32, 0.94));
  border-color: rgba(149, 178, 218, 0.18);
  box-shadow: var(--shadow-lg);
}

:root[data-theme="dark"] .account-card,
:root[data-theme="dark"] .history-item,
:root[data-theme="dark"] .settings-detail-panel,
:root[data-theme="dark"] .theme-setting-card,
:root[data-theme="dark"] .composer,
:root[data-theme="dark"] .start-card,
:root[data-theme="dark"] .suggest,
:root[data-theme="dark"] .message--assistant,
:root[data-theme="dark"] .document-save-panel,
:root[data-theme="dark"] .document-body-card,
:root[data-theme="dark"] .my-document-card,
:root[data-theme="dark"] .my-documents-form,
:root[data-theme="dark"] .attachment-card {
  background:
    radial-gradient(circle at 0% 0%, rgba(41, 92, 155, 0.18), transparent 42%),
    linear-gradient(145deg, rgba(15, 32, 54, 0.94), rgba(10, 22, 38, 0.9));
  border-color: rgba(149, 178, 218, 0.18);
  color: var(--ink);
}

:root[data-theme="dark"] .message--document,
:root[data-theme="dark"] .document-editor-card,
:root[data-theme="dark"] .my-documents-card {
  background:
    radial-gradient(circle at 8% 0%, rgba(62, 132, 218, 0.2), transparent 34%),
    linear-gradient(135deg, rgba(16, 35, 59, 0.98), rgba(9, 20, 35, 0.96));
  border-color: rgba(149, 178, 218, 0.2);
  color: var(--ink);
}

:root[data-theme="dark"] .document-editor-paper {
  background:
    linear-gradient(90deg, rgba(255, 104, 104, 0.16) 0 1px, transparent 1px 100%) 42px 0 / 1px 100% no-repeat,
    linear-gradient(180deg, #101f35, #0b1728);
  border-color: rgba(149, 178, 218, 0.2);
}

:root[data-theme="dark"] .document-body-head {
  background: linear-gradient(180deg, rgba(21, 45, 75, 0.92), rgba(12, 27, 47, 0.86));
  border-color: rgba(149, 178, 218, 0.16);
}

:root[data-theme="dark"] .document-body-paper {
  background:
    linear-gradient(90deg, rgba(255, 104, 104, 0.15) 0 1px, transparent 1px 100%) 30px 0 / 1px 100% no-repeat,
    #fffefb;
  color: #151515;
  border-color: rgba(149, 178, 218, 0.22);
}

:root[data-theme="dark"] .document-save-preview,
:root[data-theme="dark"] .my-document-thumb {
  background:
    linear-gradient(90deg, rgba(255, 104, 104, 0.18) 0 1px, transparent 1px 100%) 12px 0 / 1px 100% no-repeat,
    linear-gradient(180deg, #f8fbff 0%, #ddeaff 100%);
}

:root[data-theme="dark"] .account-login,
:root[data-theme="dark"] .sidebar-title,
:root[data-theme="dark"] .brand,
:root[data-theme="dark"] .topbar-title h1,
:root[data-theme="dark"] .start-card h2,
:root[data-theme="dark"] .settings-detail-panel h3,
:root[data-theme="dark"] .theme-setting-card b,
:root[data-theme="dark"] .document-save-label,
:root[data-theme="dark"] .document-body-title,
:root[data-theme="dark"] .document-editor-label,
:root[data-theme="dark"] .my-documents-layout h3,
:root[data-theme="dark"] .my-document-info b {
  color: #eef6ff;
}

:root[data-theme="dark"] .account-credits,
:root[data-theme="dark"] .brand-sub,
:root[data-theme="dark"] .history-sub,
:root[data-theme="dark"] .empty-history,
:root[data-theme="dark"] .topbar-title p,
:root[data-theme="dark"] .start-subtitle,
:root[data-theme="dark"] .settings-detail-note,
:root[data-theme="dark"] .theme-setting-card span,
:root[data-theme="dark"] .document-save-label small,
:root[data-theme="dark"] .document-message-notes,
:root[data-theme="dark"] .my-document-info small,
:root[data-theme="dark"] .attachment-meta,
:root[data-theme="dark"] .composer-meta,
:root[data-theme="dark"] .status {
  color: #9fb0c8;
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] select,
:root[data-theme="dark"] .search-chat,
:root[data-theme="dark"] .document-editor-title,
:root[data-theme="dark"] .document-editor-text,
:root[data-theme="dark"] .my-documents-form input,
:root[data-theme="dark"] .my-documents-form textarea,
:root[data-theme="dark"] .settings-menu-card .modal-form input {
  background: rgba(5, 13, 24, 0.72);
  border-color: rgba(149, 178, 218, 0.2);
  color: #eef6ff;
}

:root[data-theme="dark"] input::placeholder,
:root[data-theme="dark"] textarea::placeholder,
:root[data-theme="dark"] .settings-menu-card .modal-form input::placeholder {
  color: #72839d;
}

:root[data-theme="dark"] .settings-btn,
:root[data-theme="dark"] .new-chat,
:root[data-theme="dark"] .quick-new-chat-btn,
:root[data-theme="dark"] .menu-btn,
:root[data-theme="dark"] .attach-btn,
:root[data-theme="dark"] .voice-btn,
:root[data-theme="dark"] .topic-select,
:root[data-theme="dark"] .model-switch,
:root[data-theme="dark"] .document-save-btn--docx,
:root[data-theme="dark"] .document-save-btn--soft,
:root[data-theme="dark"] .document-body-action,
:root[data-theme="dark"] .document-inline-btn,
:root[data-theme="dark"] .document-editor-actions .document-editor-secondary,
:root[data-theme="dark"] .document-editor-downloads a,
:root[data-theme="dark"] .theme-toggle-btn[aria-pressed="true"] {
  background: linear-gradient(145deg, rgba(22, 45, 75, 0.98), rgba(13, 30, 52, 0.96));
  border-color: rgba(149, 178, 218, 0.2);
  color: #dcecff;
}

:root[data-theme="dark"] .model-btn,
:root[data-theme="dark"] .followup-chip {
  background: rgba(12, 27, 47, 0.86);
  border-color: rgba(149, 178, 218, 0.18);
  color: #dcecff;
}

:root[data-theme="dark"] .model-btn--active,
:root[data-theme="dark"] .send-btn,
:root[data-theme="dark"] .theme-toggle-btn,
:root[data-theme="dark"] .document-save-btn,
:root[data-theme="dark"] .document-body-action--primary,
:root[data-theme="dark"] .document-editor-actions button,
:root[data-theme="dark"] .my-documents-form button {
  background: linear-gradient(145deg, #2e7dd3, #75b7ff);
  color: #04101f;
}

:root[data-theme="dark"] .settings-menu-row {
  color: #eaf2ff;
}

:root[data-theme="dark"] .settings-menu-row:hover,
:root[data-theme="dark"] .settings-menu-row--active {
  background: rgba(117, 183, 255, 0.12);
}

:root[data-theme="dark"] .sidebar-backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.settings-menu-card .login-history {
  color: #566982;
}

.settings-menu-card .modal-status {
  color: #63738d;
  margin: 8px 2px 0;
}

.support-layout {
  min-width: 0;
  height: var(--app-height);
  padding: 22px;
  display: grid;
  place-items: center;
}

.support-layout[hidden] {
  display: none !important;
}

.support-panel {
  width: min(920px, 100%);
  height: min(760px, calc(var(--app-height) - 44px));
  border: 1px solid rgba(191, 207, 231, 0.92);
  border-radius: 28px;
  background:
    radial-gradient(circle at 12% 0%, rgba(64, 122, 194, 0.16), transparent 36%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(244, 249, 255, 0.93));
  box-shadow: var(--shadow-lg);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.support-head {
  padding: 22px;
  border-bottom: 1px solid rgba(203, 216, 235, 0.9);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.support-kicker,
.support-status {
  margin: 0;
  color: #63728a;
  font-size: 13px;
  font-weight: 800;
}

.support-head h2 {
  margin: 4px 0 6px;
  color: #11233c;
  font-family: Fraunces, Georgia, serif;
  font-size: clamp(28px, 4vw, 44px);
}

.support-back-btn,
.support-form button {
  border: 0;
  border-radius: 14px;
  background: linear-gradient(145deg, #174a86, #2d6daf);
  color: #fff;
  padding: 11px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(31, 82, 143, 0.22);
}

.support-messages {
  padding: 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.support-empty {
  margin: auto;
  color: #64738a;
  font-weight: 800;
}

.support-message {
  max-width: min(680px, 86%);
  border: 1px solid #d7e4f5;
  border-radius: 18px;
  background: #fff;
  padding: 13px 15px;
  box-shadow: 0 12px 28px rgba(41, 78, 128, 0.08);
}

.support-message--user {
  align-self: flex-end;
  background: linear-gradient(145deg, #174a86, #2d6daf);
  color: #fff;
}

.support-message--admin {
  align-self: flex-start;
}

.support-message p {
  margin: 7px 0;
  white-space: pre-wrap;
}

.support-message small {
  opacity: 0.72;
  font-size: 11px;
}

.support-form {
  padding: 18px 22px 22px;
  border-top: 1px solid rgba(203, 216, 235, 0.9);
  display: grid;
  gap: 10px;
}

.support-form input,
.support-form textarea {
  width: 100%;
  border: 1px solid #d0ddec;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.92);
  color: #14243c;
  font: inherit;
  padding: 12px 14px;
  outline: none;
  resize: vertical;
}

.support-form button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.install-banner-action {
  border: 0;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  color: #fff;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 10px 20px rgba(31, 79, 139, 0.22);
}

.install-banner-close {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(151, 170, 201, 0.42);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  color: #55708f;
  font-size: 20px;
  line-height: 1;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes blink {
  0%,
  80%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

@keyframes cursorBlink {
  0%,
  45% {
    opacity: 1;
  }
  46%,
  100% {
    opacity: 0;
  }
}

@keyframes voicePulse {
  from {
    opacity: 0.75;
    transform: scale(0.94);
  }
  to {
    opacity: 0;
    transform: scale(1.18);
  }
}

@media (max-width: 1080px) {
  .app {
    grid-template-columns: 1fr;
    height: var(--app-height);
    padding: 10px;
    gap: 0;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 15;
    border: 0;
    padding: 0;
    margin: 0;
    background: rgba(12, 24, 42, 0.42);
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

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

  .sidebar {
    display: grid;
    position: fixed;
    z-index: 20;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(360px, 88vw);
    border-radius: 0 22px 22px 0;
    padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
    background: linear-gradient(160deg, #fbfdff, #eef5ff);
    backdrop-filter: none;
    transform: translateX(calc(-100% - 20px));
    transition: transform 0.22s ease;
    overflow: hidden;
  }

  .history-item {
    background: #ffffff;
    border-color: rgba(160, 181, 214, 0.32);
  }

  .history-item--active {
    background: linear-gradient(145deg, #ffffff, #edf5ff);
  }

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

  .chat-layout {
    border-radius: 16px;
    height: calc(var(--app-height) - 20px);
  }

  .topbar {
    padding: 14px;
  }

  .topbar-row {
    align-items: center;
  }

  .topbar-actions {
    gap: 8px;
  }

  .topbar-title h1 {
    font-size: 21px;
  }

  .menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
  }

  .chat-stream,
  .composer,
  .sources {
    width: calc(100% - 20px);
  }
}

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

  .app {
    height: var(--app-height);
    min-height: 0;
    padding: 0;
  }

  .chat-layout {
    height: var(--app-height);
    min-height: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: rgba(250, 253, 255, 0.84);
  }

  .topbar {
    padding: max(12px, env(safe-area-inset-top)) 12px 10px;
  }

  .chat-layout.chat-layout--active .topbar {
    padding: max(9px, env(safe-area-inset-top)) 12px 8px;
  }

  .chat-layout.chat-layout--active .topbar-title h1 {
    font-size: 18px;
  }

  .chat-feed {
    padding: 14px 0 10px;
  }

  .chat-stream,
  .composer,
  .sources {
    width: calc(100% - 20px);
  }

  .message {
    font-size: 14px;
    border-radius: 14px;
    padding: 11px 12px;
    margin-bottom: 10px;
  }

  .message--user {
    max-width: 92%;
  }

  .followup-row {
    gap: 7px;
    margin-bottom: 12px;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .followup-row::-webkit-scrollbar {
    display: none;
  }

  .followup-chip {
    white-space: nowrap;
    min-height: 34px;
    padding: 7px 11px;
  }

  .suggest {
    min-height: 52px;
    padding: 10px;
    font-size: 13px;
  }

  .composer-wrap {
    padding: 9px 10px max(10px, env(safe-area-inset-bottom));
  }

  .install-banner {
    bottom: calc(106px + env(safe-area-inset-bottom));
    width: calc(100vw - 20px);
  }

  .modal {
    padding: 10px;
  }

  .modal-card {
    border-radius: 18px;
    padding: 18px;
  }

  .document-editor-card {
    max-height: calc(var(--app-height) - 20px);
    padding: 14px;
  }

  .document-editor-card h2 {
    font-size: 27px;
  }

  .document-editor-text {
    min-height: 46vh;
    padding: 12px;
    font-size: 13px;
  }

  .document-editor-paper {
    padding: 8px 8px 8px 16px;
    border-radius: 14px;
    background: #fff;
  }

  .document-editor-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .document-message-context {
    padding-right: 0;
  }

  .document-body-card {
    border-radius: 18px;
  }

  .document-body-head {
    display: grid;
    gap: 10px;
    padding: 12px;
  }

  .document-body-title b {
    white-space: normal;
  }

  .document-body-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
    width: 100%;
  }

  .document-body-action {
    width: 100%;
    min-width: 0;
    padding: 0 9px;
  }

  .document-body-paper {
    margin: 9px;
    padding: 20px 14px 20px 24px;
    font-size: 13px;
    line-height: 1.5;
    background:
      linear-gradient(90deg, rgba(208, 67, 67, 0.2) 0 1px, transparent 1px 100%) 16px 0 / 1px 100% no-repeat,
      #fffefb;
  }

  .document-save-panel {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
  }

  .document-save-actions {
    grid-column: 1 / -1;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .document-save-btn {
    width: 100%;
  }

  .document-link-group {
    display: flex;
    width: 100%;
    justify-content: flex-start;
    border-radius: 16px;
  }

  .my-documents-card {
    max-height: calc(var(--app-height) - 20px);
    padding: 14px;
  }

  .my-documents-layout {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .my-documents-list {
    max-height: 32vh;
  }

  .settings-menu-card {
    width: 100%;
    max-height: min(58vh, 520px);
    border-radius: 18px;
    padding: 12px;
  }

  .settings-menu-head {
    margin-bottom: 8px;
    padding-bottom: 10px;
  }

  .settings-menu-row {
    min-height: 40px;
    grid-template-columns: 22px minmax(0, 1fr) auto;
    gap: 10px;
    font-size: 13px;
    border-radius: 12px;
  }

  .settings-menu-icon {
    width: 21px;
    height: 21px;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .composer {
    border-radius: 14px;
    padding: 9px;
    gap: 8px;
  }

  .composer textarea {
    font-size: 16px;
    max-height: 132px;
  }

  .suggest-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin-bottom: 4px;
  }

  .chat-intro {
    align-content: center;
    gap: 9px;
    padding: 10px 0 8px;
  }

  .start-card {
    border-radius: 19px;
    padding: 20px 16px;
  }

  .start-card h2 {
    font-size: clamp(27px, 8.6vw, 38px);
  }

  .start-subtitle {
    font-size: 13px;
    line-height: 1.42;
    margin-top: 10px;
  }

  .tools-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 7px;
  }

  .model-switch {
    order: 1;
    grid-column: 1 / -1;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .model-btn {
    min-height: 34px;
    padding: 8px 10px;
  }

  .topic-select {
    order: 2;
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    min-height: 40px;
  }

  .topic-select select {
    min-width: 0;
    width: 100%;
  }

  .composer-meta {
    align-items: center;
  }

  .send-btn {
    order: 3;
    width: 100%;
    min-width: 0;
    min-height: 40px;
    padding: 10px 13px;
  }

  .voice-btn {
    order: 4;
    width: 42px;
    height: 40px;
  }

  .attach-btn {
    order: 5;
    width: 42px;
    height: 40px;
  }

  .tip {
    display: none;
  }

  .support-layout {
    padding: 0;
  }

  .support-panel {
    width: 100%;
    height: var(--app-height);
    border-radius: 0;
    border: 0;
  }

  .support-head {
    padding: max(14px, env(safe-area-inset-top)) 14px 14px;
    flex-direction: column;
  }

  .support-back-btn {
    width: 100%;
  }

  .support-messages,
  .support-form {
    padding: 14px;
  }

  .support-message {
    max-width: 92%;
  }
}

@media (max-width: 430px) {
  .topbar-title p {
    display: none;
  }

  .topbar-title h1 {
    font-size: 19px;
  }

  .quick-new-chat-btn {
    width: 36px;
  }

  .tools-row {
    grid-template-columns: minmax(0, 1fr) 42px 42px;
  }

  .voice-btn {
    width: 42px;
  }

  .send-btn {
    width: 100%;
  }

  .install-banner {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
    padding: 9px;
  }

  .install-banner-action {
    grid-column: 2 / 4;
    width: 100%;
  }

  .install-banner-close {
    grid-column: 3;
    grid-row: 1;
  }
}

@media (min-width: 1081px) {
  .menu-btn {
    display: none;
  }
}

/* Student AI distinct identity: academic SaaS, not legal glass UI */
:root {
  --bg: #f6f2ea;
  --bg-2: #edf4ef;
  --sidebar: #142527;
  --panel: rgba(255, 252, 246, 0.96);
  --line: rgba(34, 69, 68, 0.16);
  --line-soft: rgba(34, 69, 68, 0.09);
  --ink: #182527;
  --ink-soft: #65706c;
  --accent: #087866;
  --accent-2: #c9822b;
  --accent-soft: #e0f1ec;
  --user-a: #087866;
  --user-b: #125b60;
  --ok: #187a56;
  --radius-xl: 14px;
  --radius-lg: 10px;
  --radius-md: 8px;
  --shadow-lg: 0 24px 70px rgba(20, 37, 39, 0.14);
  --shadow-md: 0 12px 28px rgba(20, 37, 39, 0.1);
}

:root[data-theme="dark"] {
  --bg: #101716;
  --bg-2: #17201f;
  --sidebar: #0c1718;
  --panel: rgba(18, 30, 30, 0.96);
  --line: rgba(166, 219, 206, 0.18);
  --line-soft: rgba(166, 219, 206, 0.1);
  --ink: #eef7f3;
  --ink-soft: #a9b7b1;
  --accent: #64ceb5;
  --accent-2: #e5ad68;
  --accent-soft: rgba(100, 206, 181, 0.14);
  --user-a: #0c756a;
  --user-b: #104e55;
}

body {
  background:
    radial-gradient(circle at 20% 0%, rgba(8, 120, 102, 0.1), transparent 34%),
    radial-gradient(circle at 92% 18%, rgba(201, 130, 43, 0.14), transparent 28%),
    linear-gradient(135deg, #fbf7ee 0%, #f3f0e8 46%, #e9f4ef 100%);
}

:root[data-theme="dark"] body {
  background:
    radial-gradient(circle at 20% 0%, rgba(100, 206, 181, 0.12), transparent 34%),
    radial-gradient(circle at 92% 18%, rgba(229, 173, 104, 0.1), transparent 28%),
    linear-gradient(135deg, #0f1716 0%, #141d1c 52%, #10191d 100%);
}

.grain,
.ambient {
  display: none;
}

h1,
.brand,
.history-title,
.message h3,
.message h4,
.start-card h2 {
  font-family: "Manrope", "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.app {
  grid-template-columns: 286px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
}

.sidebar {
  border-radius: 14px;
  border-color: rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(20, 37, 39, 0.98), rgba(12, 27, 30, 0.97));
  box-shadow: 0 24px 70px rgba(9, 24, 27, 0.24);
}

.account-card,
.history-item,
.settings-btn,
.new-chat,
.search-chat,
.chat-action {
  border-color: rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.07);
  color: #f2fbf7;
  box-shadow: none;
}

.account-card,
.history-item,
.my-documents-btn,
.search-chat,
.new-chat,
.settings-btn {
  border-radius: 10px;
}

.account-login,
.sidebar-title,
.history-title,
.brand {
  color: #f2fbf7;
}

.account-credits,
.sidebar-label,
.history-sub,
.brand-sub,
.empty-history,
.search-chat::placeholder {
  color: rgba(226, 241, 236, 0.66);
}

.history-item--active {
  border-color: rgba(100, 206, 181, 0.42);
  background: linear-gradient(135deg, rgba(100, 206, 181, 0.16), rgba(201, 130, 43, 0.1));
}

.my-documents-btn {
  border-color: rgba(100, 206, 181, 0.28);
  background: linear-gradient(135deg, rgba(100, 206, 181, 0.16), rgba(201, 130, 43, 0.14));
  color: #f2fbf7;
  box-shadow: none;
}

.chat-layout {
  border-radius: 14px;
  background: rgba(255, 252, 246, 0.96);
  box-shadow: 0 24px 70px rgba(20, 37, 39, 0.14);
}

:root[data-theme="dark"] .chat-layout {
  background: rgba(18, 30, 30, 0.96);
}

.topbar,
.composer-wrap {
  background: rgba(255, 252, 246, 0.9);
}

:root[data-theme="dark"] .topbar,
:root[data-theme="dark"] .composer-wrap {
  background: rgba(18, 30, 30, 0.9);
}

.topbar-title h1 {
  color: #172d2d;
}

.topbar-title p,
.start-subtitle {
  color: #65706c;
}

.menu-btn,
.quick-new-chat-btn,
.model-btn,
.attach-btn,
.voice-btn,
.followup-chip,
.retry-btn {
  border-radius: 8px;
  border-color: rgba(8, 120, 102, 0.18);
  background: #fff9ec;
  color: #17423d;
}

.start-card {
  min-height: 340px;
  border-radius: 14px;
  border-color: rgba(8, 120, 102, 0.18);
  background:
    linear-gradient(135deg, rgba(255, 253, 247, 0.98) 0%, rgba(255, 248, 232, 0.94) 48%, rgba(229, 244, 238, 0.96) 100%);
  box-shadow: 0 22px 60px rgba(20, 37, 39, 0.12);
  text-align: left;
  padding-left: clamp(30px, 6vw, 72px);
}

.start-card::before {
  content: "AI";
  right: clamp(24px, 5vw, 58px);
  top: clamp(24px, 5vw, 54px);
  width: auto;
  height: auto;
  border-radius: 10px;
  background: #087866;
  color: #fffdf7;
  filter: none;
  padding: 12px 14px;
  font-size: clamp(22px, 3.4vw, 36px);
  font-weight: 950;
}

.start-card::after {
  content: "";
  position: absolute;
  right: clamp(30px, 8vw, 118px);
  bottom: 36px;
  width: min(250px, 30vw);
  height: 112px;
  border: 1px solid rgba(8, 120, 102, 0.18);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.28));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.36);
}

.start-eyebrow {
  color: #087866;
}

.start-card h2 {
  max-width: 700px;
  color: #142a2a;
  font-size: clamp(36px, 5.6vw, 64px);
  line-height: 1.03;
}

.start-subtitle {
  margin-left: 0;
}

.suggest {
  border-radius: 10px;
  border-color: rgba(8, 120, 102, 0.16);
  background: #fffaf0;
  color: #203b38;
  box-shadow: 0 10px 24px rgba(20, 37, 39, 0.07);
}

.suggest:nth-child(2) {
  background: #eaf7f2;
}

.suggest:nth-child(3) {
  background: #fff2e7;
}

.suggest:nth-child(4) {
  background: #f4f0ff;
}

.composer {
  border-radius: 12px;
  border-color: rgba(8, 120, 102, 0.2);
  background: #fffdf7;
  box-shadow: 0 14px 36px rgba(20, 37, 39, 0.11);
}

.send-btn {
  border-radius: 8px;
  background: linear-gradient(135deg, #087866, #125b60);
  box-shadow: 0 10px 22px rgba(8, 120, 102, 0.22);
}

.model-switch {
  border-radius: 8px;
  background: #f1eee2;
}

.model-btn--active {
  background: #172d2d;
  color: #fffdf7;
}

.topic-select {
  border-radius: 8px;
  background: #f6f1e3;
}

.message {
  border-radius: 10px;
  background: #fffdf7;
  box-shadow: 0 10px 26px rgba(20, 37, 39, 0.07);
}

.message--assistant {
  color: #1e2c2d;
}

.message--user {
  border-color: rgba(8, 120, 102, 0.34);
  background: linear-gradient(135deg, #087866, #125b60);
}

.message--document,
.document-body-card,
.document-save-panel {
  border-radius: 10px;
  border-color: rgba(8, 120, 102, 0.2);
  background: #fffdf7;
}

.message--document::before {
  background: linear-gradient(180deg, #087866, #c9822b);
}

.document-body-paper {
  border-radius: 8px;
  background: #fffef8;
}

.document-save-btn,
.document-body-action--primary {
  border-radius: 8px;
  background: linear-gradient(135deg, #087866, #125b60);
}

.document-save-btn--docx {
  background: #fff2e7;
  color: #7b3d17;
}

.document-save-btn--soft,
.document-body-action {
  border-radius: 8px;
  background: #fffaf0;
  color: #17423d;
}

.followup-chip {
  background: #eaf7f2;
  color: #17423d;
}

.modal-card,
.settings-menu-card,
.support-panel,
.install-banner {
  border-radius: 12px;
}

@media (max-width: 760px) {
  .app {
    padding: 8px;
    gap: 8px;
  }

  .start-card {
    min-height: 300px;
    padding: 24px;
  }

  .start-card::after {
    display: none;
  }

  .suggest-grid {
    grid-template-columns: 1fr;
  }
}

/* Layout stabilization after identity layer */
.chat-intro {
  align-content: start;
  gap: 10px;
  padding: 14px 0 10px;
}

.start-card {
  min-height: 260px;
  padding-top: clamp(24px, 3.2vw, 38px);
  padding-bottom: clamp(24px, 3.2vw, 38px);
}

.start-card h2 {
  font-size: clamp(32px, 4.8vw, 56px);
}

.suggest {
  min-height: 48px;
}

.composer {
  max-width: 100%;
}

@media (max-width: 1080px) {
  .app {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0 !important;
    padding: 0 !important;
  }

  .chat-layout {
    width: 100% !important;
    min-width: 0 !important;
    height: var(--app-height) !important;
    border-radius: 0 !important;
  }

  .sidebar {
    position: fixed;
    z-index: 40;
  }

  .chat-stream {
    width: min(100% - 20px, 760px);
  }

  .topbar {
    padding: max(10px, env(safe-area-inset-top)) 12px 10px;
  }

  .chat-feed {
    padding-top: 10px;
  }

  .start-card {
    min-height: 0;
    padding: 22px;
  }

  .start-card::before {
    top: 18px;
    right: 18px;
    font-size: 20px;
    padding: 8px 10px;
  }

  .start-card::after {
    display: none;
  }

  .start-card h2 {
    max-width: calc(100% - 56px);
    font-size: clamp(28px, 8vw, 40px);
    line-height: 1.08;
  }

  .start-subtitle {
    max-width: 100%;
    font-size: 14px;
  }

  .suggest-grid {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .composer-wrap {
    padding: 10px;
  }

  .composer {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .topbar-title h1 {
    font-size: 18px;
  }

  .menu-btn {
    max-width: 88px;
    white-space: nowrap;
  }

  .chat-stream {
    width: calc(100% - 16px);
  }

  .chat-intro {
    gap: 8px;
    padding-top: 8px;
  }

  .start-card {
    padding: 18px;
  }

  .start-card h2 {
    max-width: 100%;
    padding-right: 50px;
    font-size: clamp(26px, 7.4vw, 34px);
  }

  .start-subtitle {
    line-height: 1.45;
  }

  .suggest-grid {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .suggest {
    min-height: 44px;
    padding: 10px;
    font-size: 13px;
  }

  .tools-row {
    grid-template-columns: minmax(0, 1fr) 40px 40px !important;
    gap: 7px;
  }

  .model-switch,
  .topic-select {
    grid-column: 1 / -1;
    width: 100%;
  }

  .topic-select {
    min-width: 0;
  }

  .send-btn {
    grid-column: 1;
    width: 100%;
    min-width: 0;
  }

  .voice-btn,
  .attach-btn {
    width: 40px;
    height: 40px;
  }

  .composer-meta {
    gap: 6px;
  }

  .tip {
    display: none;
  }

  .install-banner {
    bottom: calc(224px + env(safe-area-inset-bottom));
    grid-template-columns: 36px minmax(0, 1fr) auto 32px;
    gap: 8px;
    width: calc(100vw - 20px);
    padding: 8px;
    border-radius: 14px;
  }

  .install-banner-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .install-banner-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .install-banner-text {
    display: none;
  }

  .install-banner-action {
    grid-column: auto;
    width: auto;
    min-height: 36px;
    padding: 0 12px;
    font-size: 12px;
  }

  .install-banner-close {
    grid-column: auto;
    grid-row: auto;
    width: 32px;
    height: 32px;
  }
}
