.chat-page {
  --chat-bg: #151714;
  --chat-edge: #2b2e27;
  --chat-muted: #a0a498;
  min-height: 100dvh;
  background: var(--chat-bg);
  font-family: system-ui, sans-serif;
}
.chat-shell {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  min-height: 100dvh;
}
.chat-sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 17px 14px;
  background: #10120f;
  border-right: 1px solid var(--chat-edge);
  z-index: 2;
}
.chat-sidebar .brand {
  font-family: Manrope, system-ui, sans-serif;
  font-size: 19px;
  margin: 0 4px 23px;
}
.sidebar-action, .sidebar-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  font-size: 13px;
  text-align: left;
}
.sidebar-action {
  border-color: var(--chat-edge);
  background: #1a1d18;
}
.sidebar-link {
  color: var(--chat-muted);
}
.sidebar-action:hover, .sidebar-link:hover, .account-button:hover {
  background: #242721;
}
.chat-history {
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding: 13px 0 5px;
}
.chat-history h2 {
  margin: 0 9px 8px;
  color: var(--chat-muted);
  font-size: 12px;
  letter-spacing: 0;
}
.chat-history ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.chat-history li + li {
  margin-top: 3px;
}
.chat-choice {
  display: block;
  width: 100%;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #c4c8bd;
  font-size: 13px;
  text-align: left;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.chat-choice:hover {
  background: #1d2118;
}
.chat-choice[aria-current] {
  border-color: #343e2b;
  background: #22291c;
  color: var(--text);
}
.chat-choice:focus-visible {
  outline-offset: -2px;
}
.mobile-chats {
  display: none;
}
.chat-page svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.chat-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  isolation: isolate;
  position: relative;
}
.chat-backdrop {
  position: fixed;
  inset: 0 0 0 224px;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse at 70% 44%, #222d16 0%, var(--chat-bg) 75%);
}
.chat-backdrop canvas, .chat-backdrop::after {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.chat-backdrop::after {
  content: "";
  background:
    linear-gradient(0deg, var(--chat-bg) 0%, transparent 58%, #15171488 100%),
    linear-gradient(90deg, #151714b3, #15171452 65%, #15171433);
}
.chat-main:has(.has-messages) .chat-backdrop::after {
  background:
    linear-gradient(90deg, #151714eb, #151714cb 62%, #151714a6),
    linear-gradient(0deg, #151714, transparent 55%);
}
.chat-top {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 25px;
  color: #e0e3db;
}
.chat-title {
  font-size: 14px;
  font-weight: 650;
}
.chat-account {
  display: flex;
  align-items: center;
  gap: 13px;
}
.chat-quota {
  font-size: 12px;
  color: var(--chat-muted);
}
.account-button {
  background: transparent;
  border: 1px solid #373c31;
  border-radius: 7px;
  min-height: 34px;
  padding: 0 11px;
  font-size: 13px;
  font-weight: 600;
}
.chat-content {
  width: min(740px, calc(100% - 48px));
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-bottom: min(12vh, 100px);
}
.chat-intro {
  margin: 0 0 25px;
  text-align: center;
}
.chat-intro img {
  margin-bottom: 10px;
}
.chat-intro h1 {
  margin: 0;
  font-size: clamp(29px, 3.5vw, 42px);
  letter-spacing: -.035em;
  line-height: 1.15;
}
.chat-composer {
  padding: 13px 12px 10px;
  border: 1px solid #3b4034;
  background: #21241e;
  border-radius: 18px;
  box-shadow: 0 10px 28px #080a0740;
}
.chat-composer:focus-within {
  border-color: #677557;
}
.chat-composer textarea {
  display: block;
  width: 100%;
  min-height: 54px;
  max-height: 12rem;
  resize: vertical;
  margin: 0;
  padding: 5px 6px 8px;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 15px;
  line-height: 1.5;
}
.chat-composer textarea::placeholder {
  color: #a5aa9e;
}
.composer-toolbar, .composer-options, .composer-note {
  display: flex;
  align-items: center;
}
.composer-toolbar, .composer-note {
  justify-content: space-between;
  gap: 12px;
}
.composer-options {
  gap: 5px;
  flex-wrap: wrap;
}
.select-control {
  position: relative;
  display: flex;
  align-items: center;
  color: #c4c8be;
}
.select-control > svg {
  position: absolute;
  left: 8px;
  pointer-events: none;
}
.select-control > .chevron {
  left: auto;
  right: 6px;
  width: 13px;
}
.select-control select {
  appearance: none;
  min-height: 32px;
  padding: 0 23px 0 30px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: 500 12px system-ui, sans-serif;
  cursor: pointer;
}
.mode-select select { padding-left: 8px; }
.select-control select:hover {
  border-color: #444a3d;
  background: #282c24;
}
.send-button {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #161b0e;
}
.send-button svg {
  width: 19px;
  height: 19px;
  stroke-width: 2;
}
.send-button:hover {
  background: #d9ff96;
}
.send-button:disabled {
  opacity: 1;
  cursor: default;
  background: #3b4134;
  color: #a2a995;
}
.composer-note {
  padding: 7px 3px 0;
  color: var(--chat-muted);
  font-size: 11px;
  line-height: 1.45;
}
.composer-note .text-button {
  color: #bfc6b3;
}
.chat-notice {
  margin: 0 0 9px;
  color: #ffc39a;
  font-size: 13px;
}
.chat-content.has-messages {
  justify-content: flex-start;
  padding-bottom: 0;
}
.has-messages .composer-area {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  padding: 12px 0 14px;
  background: linear-gradient(transparent, var(--chat-bg) 20%);
}
.chat-thread {
  padding: 26px 0 22px;
}
.chat-turn {
  margin-bottom: 30px;
}
.user-message {
  width: fit-content;
  max-width: min(86%, 570px);
  margin: 0 0 21px auto;
  padding: 10px 14px;
  border-radius: 15px 15px 4px 15px;
  background: #252921;
}
.user-message, .answer-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.65;
}
.assistant-message {
  display: grid;
  grid-template-columns: 29px minmax(0, 1fr);
  gap: 10px;
}
.assistant-message img {
  margin-top: 1px;
}
.assistant-name {
  margin: 0 0 7px;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0;
}
.assistant-message .answer-text {
  margin: 0;
}
.answer-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 11px;
  margin-top: 7px;
  color: var(--chat-muted);
  font-size: 12px;
}
.answer-actions button {
  padding: 3px 0;
  border: 0;
  background: transparent;
  color: #c6cfbb;
  font-size: 12px;
}
.answer-actions button:hover {
  color: var(--accent);
}
.web-references {
  margin-top: 12px;
  color: var(--chat-muted);
  font-size: 12px;
}
.web-references p {
  margin: 0;
}
.web-references ul {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 14px;
  margin: 5px 0 0;
  padding: 0;
  list-style: none;
}
.web-references a {
  color: #c6cfbb;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.candidate-answer {
  border-top: 1px solid var(--chat-edge);
  margin-top: 12px;
  padding-top: 12px;
}
.candidate-answer h3 {
  margin-bottom: 4px;
  font-size: 13px;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}
 .response-settings-toggle { min-height: 40px; min-width: 0; padding: 8px 12px; border: 1px solid #41493a; border-radius: 8px; background: transparent; color: #dce2d2; font: inherit; font-size: 13px; }
.response-settings-dialog { width: min(420px, calc(100vw - 24px)); max-height: min(620px, calc(var(--visible-height, 100dvh) - 32px)); margin: auto; padding: 18px; overflow-y: auto; overscroll-behavior: contain; background: #20241c; border: 1px solid #41493a; border-radius: 18px; color: #e5eadc; box-shadow: 0 18px 60px #0008; }
.response-settings-dialog::backdrop { background: #080b07a8; }
.response-settings-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.response-settings-header h2 { margin: 0; font-size: 17px; letter-spacing: 0; }
.response-settings-header button, .sidebar-close { border: 0; background: transparent; color: #e5eadc; font-size: 28px; min-width: 44px; min-height: 44px; }
.settings-panel { min-width: 0; }
.settings-panel .composer-options { display: grid; gap: 10px; }
.settings-panel .select-control { min-width: 0; background: #2b3025; border-radius: 8px; }
.settings-panel select { min-width: 0; width: 100%; max-width: 100%; min-height: 44px; font-size: 16px; }
.settings-panel p { font-size: 13px; line-height: 1.5; color: #b5c3a5; overflow-wrap: anywhere; margin: 14px 4px 0; }
.chat-search { width: 100%; min-width: 0; border: 1px solid #343b30; border-radius: 7px; padding: 9px; background: #1a1d18; color: white; }
.chat-row { display: flex; align-items: center; gap: 2px; }
.chat-row .chat-choice { flex: 1; min-width: 0; }
.chat-menu { position: relative; }
.chat-menu summary { cursor: pointer; padding: 7px; list-style: none; }
.chat-menu[open] { z-index: 4; }
.chat-menu-actions { position: absolute; right: 0; top: 100%; display: grid; width: 140px; padding: 5px; border: 1px solid #3c4336; background: #20241c; border-radius: 8px; }
.chat-menu-actions button { background: transparent; border: 0; text-align: left; padding: 8px; color: #e3e6dd; }
.sidebar-toggle, .sidebar-close { display: none; }
.select-control[hidden] { display: none !important; }

.settings-dialog { width: min(560px, calc(100vw - 28px)); max-height: 85dvh; overflow: auto; background: #1b1f18; color: #f1f4e9; border: 1px solid #434d3a; border-radius: 15px; padding: 22px; }
.settings-dialog::backdrop { background: #000a; }
.settings-dialog button { margin: 5px; padding: 8px 12px; border-radius: 8px; border: 1px solid #4a553e; background: #293322; color: #eef7de; }
.settings-dialog img { max-width: 100%; max-height: 300px; object-fit: contain; }
.settings-dialog input { max-width: 100%; }

.attach-button { cursor: pointer; padding: 8px; font-size: 22px; color: #c4c8be; }

.chat-group { margin: 14px 9px 4px; color: #929b89; font-size: 11px; font-weight: 650; }

.sidebar-account { flex-direction: column; align-items: stretch; gap: 8px; border-top: 1px solid var(--chat-edge); padding-top: 14px; }
.sidebar-account .chat-quota { padding: 3px 8px; }
.sidebar-account .account-button { min-height: 42px; text-align: left; }
.sidebar-backdrop { position: fixed; inset: 0; z-index: 15; border: 0; background: #0009; }
.sidebar-backdrop[hidden] { display: none; }
.chat-content:not(.has-messages) { padding-bottom: 0; }
@media (max-width: 740px) {
  .chat-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(var(--visible-height, 100dvh), auto); }
  .chat-main { min-height: var(--visible-height, 100dvh); }
  .chat-sidebar { display: flex; position: fixed; top: 0; left: 0; flex-direction: column; align-items: stretch; width: min(310px, calc(100vw - 48px)); height: var(--visible-height, 100dvh); padding: max(17px, env(safe-area-inset-top)) 14px max(17px, env(safe-area-inset-bottom)); transform: translateX(-105%); visibility: hidden; z-index: 20; }
  .chat-sidebar.open { transform: translateX(0); visibility: visible; }
  .chat-sidebar .brand { margin: 0 42px 23px 4px; }
  .sidebar-close { display: block; position: absolute; top: max(8px, env(safe-area-inset-top)); right: 8px; }
  .sidebar-toggle { display: block; border: 0; color: white; background: transparent; min-width: 44px; min-height: 44px; font-size: 20px; }
  .chat-top { min-height: 54px; justify-content: flex-start; padding: env(safe-area-inset-top) 12px 0; }
  .chat-title { font-size: 13px; color: var(--chat-muted); }
  .mobile-chats { display: none !important; }
  .chat-backdrop { left: 0; }
  .chat-content { width: calc(100% - 28px); }
  .chat-content:not(.has-messages) { justify-content: center; padding-top: 9dvh; padding-bottom: 0; }
  .chat-intro h1 { font-size: clamp(26px, 7vw, 36px); }
  .chat-intro { margin-bottom: 22px; }
  .chat-composer textarea { font-size: 16px; }
  .composer-toolbar { gap: 8px; }
  .composer-area { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .composer-note { flex-wrap: wrap; gap: 5px 12px; }
  .composer-note #chat-hint { flex: 1; min-width: 160px; text-align: right; }
  .response-settings-dialog { position: fixed; inset: auto 0 max(env(safe-area-inset-bottom), var(--viewport-bottom, 0px)) 0; margin: 0 auto 8px; width: calc(100vw - 24px); max-height: calc(var(--visible-height, 100dvh) - 24px); border-radius: 20px; padding: 16px; }
  .chat-page.keyboard-open .chat-content:not(.has-messages) { padding-top: 0; }
  .chat-page.keyboard-open .chat-intro { display: none; }
}

.chat-page.sidebar-open { overflow: hidden; }

.generated-file {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  margin: 16px 0; padding: 16px; border: 1px solid #47513b;
  border-radius: 12px; background: #1d2319; min-width: 0;
}
.file-info { flex: 1; min-width: 0; display: grid; gap: 5px; }
.file-info strong { overflow-wrap: anywhere; font-size: 14px; }
.file-info span { color: var(--chat-muted); font-size: 12px; }
.file-download { padding: 8px 12px; border: 1px solid #596b44; border-radius: 8px; background: #2b381f; color: #e1efcf; cursor: pointer; }
.file-download:disabled { opacity: .6; cursor: wait; }
.file-download:focus-visible { outline: 2px solid #ceff86; outline-offset: 3px; }
.file-preview { flex-basis: 100%; min-width: 0; font-size: 12px; }
.file-preview summary { color: var(--chat-muted); cursor: pointer; }
.file-preview pre { max-height: 300px; overflow: auto; white-space: pre; padding: 12px; background: #12160f; border-radius: 6px; }

.sidebar-account .pro-link { color: #dcf7b5; border-color: #485b33; background: #25311c; margin-bottom: 8px; justify-content: center; }

.training-consent { display: flex; align-items: flex-start; gap: 10px; margin-top: 24px; font-weight: 600; }
.training-consent input { flex: none; margin-top: 4px; }

.compact-details { margin:16px 0; font-size:13px; overflow-wrap:anywhere; }
.compact-details > summary { cursor:pointer; color:var(--muted,#aaa); padding:8px 0; }
.model-option { display:flex; align-items:flex-start; gap:8px; padding:8px 0; font-size:12px; overflow-wrap:anywhere; }
.model-option input { flex-shrink:0; margin-top:3px; }
.memory-text { display:block; width:100%; min-height:120px; margin:12px 0; box-sizing:border-box; color:inherit; background:transparent; border:1px solid #555; border-radius:10px; padding:10px; }
.context-info { font-size:12px; color:#aaa; }
.website-dialog { width: min(1100px,96vw); max-width:96vw; height:85dvh; padding:12px; background:#161616; color:#eee; border:1px solid #555; border-radius:16px; }
.website-dialog[open] { display:flex; flex-direction:column; }
.website-dialog header { display:flex; justify-content:space-between; gap:12px; font-size:12px; padding-bottom:10px; }
.website-dialog iframe { flex:1; min-height:0; width:100%; border:0; background:white; }

@media (max-width:600px) { .generated-file .file-info { flex-basis:100%; } }
