:root {
  --bg: #1f1f1f;
  --sidebar: #171717;
  --surface: #2c2c2c;
  --surface-2: #272727;
  --border: #363636;
  --text: #ececec;
  --muted: #a4a4a4;
  --accent: #10a37f;
  --danger: #ef6a6a;
  --ring: rgba(140, 140, 140, 0.35);
  --content-max: 860px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: radial-gradient(1200px 500px at 52% -120px, rgba(255, 255, 255, 0.06), transparent 60%), linear-gradient(#1f1f1f, #1d1d1d);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
}

body[data-theme="light"] {
  --bg: #f3f4f7;
  --sidebar: #eef0f4;
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --border: #dadde5;
  --text: #121317;
  --muted: #575f6b;
  --ring: rgba(100, 117, 146, 0.25);
  background: linear-gradient(#f4f6fa, #edf0f6);
}

body.high-contrast {
  --border: #8e8e8e;
  --muted: #d8d8d8;
  --ring: rgba(255, 255, 255, 0.45);
}

body[data-theme="light"].high-contrast {
  --border: #444;
  --muted: #222;
}

body[data-font="s"] {
  font-size: 14px;
}

body[data-font="m"] {
  font-size: 15px;
}

body[data-font="l"] {
  font-size: 16px;
}

.hidden {
  display: none !important;
}

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

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

input,
select,
textarea {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
}

textarea {
  resize: none;
}

button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, transform 120ms ease;
}

button.primary {
  border-color: transparent;
  background: var(--accent);
  color: #0b2b23;
  font-weight: 600;
}

button.ghost {
  background: transparent;
}

button.full {
  width: 100%;
}

button.tiny {
  padding: 6px 8px;
  font-size: 12px;
}

button.small {
  padding: 6px 10px;
  font-size: 13px;
}

button.icon-only {
  width: 32px;
  height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
}

button:active {
  transform: translateY(1px);
}

.auth-overlay,
.prefs-panel,
.palette {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(3px);
}

.auth-card,
.prefs-card,
.palette-card {
  width: min(460px, calc(100vw - 24px));
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  display: grid;
  gap: 10px;
}

.palette-card {
  width: min(620px, calc(100vw - 24px));
}

.reveal {
  animation: fade-up 170ms ease-out;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

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

.auth-card h2 {
  margin: 0;
}

.brand-auth {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-auth img {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

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

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

.auth-error {
  margin: 0;
  color: #ff9393;
  min-height: 18px;
}

.mobile-topbar {
  display: none;
  height: 52px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding: 0 10px;
  background: var(--surface-2);
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  padding: 0;
}

.sidebar-backdrop {
  position: fixed;
  inset: 52px 0 0 0;
  background: rgba(0, 0, 0, 0.48);
  z-index: 24;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

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

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 264px 1fr;
  overflow: hidden;
}

.app-shell.sidebar-compact {
  grid-template-columns: 78px 1fr;
}

.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 10px;
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  gap: 10px;
  overflow: hidden;
  min-height: 0;
}

.sidebar.compact {
  grid-template-rows: auto auto 0 1fr auto;
}

.sidebar.compact .menu-item,
.sidebar.compact .chat-group-title,
.sidebar.compact .chat-title-item,
.sidebar.compact .new-chat-cta,
.sidebar.compact .side-footer button,
.sidebar.compact .chat-search-wrap,
.sidebar.compact .chat-mini {
  font-size: 0;
}

.sidebar.compact .chat-delete,
.sidebar.compact .chat-item-actions {
  display: none;
}

.sidebar-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-dot {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--text);
  font-size: 13px;
}

.brand-mini-logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  object-fit: cover;
}

.new-chat-cta {
  width: 100%;
  border-radius: 12px;
  text-align: left;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-weight: 500;
}

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

.menu-item {
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 8px;
  border-radius: 8px;
}

.menu-item:hover {
  background: color-mix(in oklab, var(--surface) 65%, transparent);
}

.menu-item.active {
  background: color-mix(in oklab, var(--surface) 85%, transparent);
  border: 1px solid var(--border);
}

.chat-search-wrap {
  padding: 2px;
}

#chatSearchInput {
  width: 100%;
  height: 36px;
}

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

.chat-group {
  display: grid;
  gap: 5px;
}

.chat-group-title {
  color: var(--muted);
  font-size: 12px;
  padding: 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chat-item {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: center;
  border: 1px solid color-mix(in oklab, var(--border) 35%, transparent);
  border-radius: 10px;
  background: color-mix(in oklab, var(--surface) 35%, transparent);
  color: var(--text);
  text-align: left;
  padding: 8px 10px;
}

.chat-item:hover,
.chat-item.active {
  background: color-mix(in oklab, var(--surface) 92%, transparent);
  border-color: color-mix(in oklab, var(--border) 92%, transparent);
}

.chat-item:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px #595959, 0 0 0 3px var(--ring);
}

.chat-title-item {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.chat-item-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
}

.chat-item:hover .chat-item-actions,
.chat-item.active .chat-item-actions {
  opacity: 1;
}

.chat-mini,
.chat-delete {
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 6px;
}

.chat-mini:hover {
  color: var(--text);
  background: color-mix(in oklab, var(--surface) 70%, transparent);
}

.chat-delete {
  color: var(--danger);
}

.chat-list-empty {
  padding: 8px;
}

.side-footer {
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.chat-main {
  min-width: 0;
  min-height: 0;
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: linear-gradient(180deg, var(--bg) 0%, color-mix(in oklab, var(--bg) 90%, black 10%) 100%);
}

.chat-main.images-mode .composer-area {
  display: none;
}

.chat-main.images-mode .empty-shell {
  display: none;
}

.chat-main.images-mode .chat-layout {
  display: none;
}

.chat-main.info-collapsed .chat-layout {
  grid-template-columns: 1fr;
}

.chat-topbar {
  height: 56px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in oklab, var(--bg) 86%, transparent);
  backdrop-filter: blur(8px);
}

.chat-top-left,
.top-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.title-chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  background: var(--surface);
  font-weight: 500;
  letter-spacing: 0.01em;
}

.thinking-indicator {
  color: var(--muted);
  font-size: 13px;
}

.chat-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  min-height: 0;
}

.messages {
  min-width: 0;
  overflow: auto;
  padding: 24px clamp(14px, 6vw, 110px) 146px;
  scrollbar-gutter: stable;
  animation: fade-in 180ms ease;
}

.messages > .message-row {
  max-width: var(--content-max);
  margin-left: auto;
  margin-right: auto;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.info-panel {
  border-left: 1px solid var(--border);
  background: color-mix(in oklab, var(--surface-2) 95%, transparent);
  overflow: auto;
  padding: 12px;
}

.info-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.info-title {
  font-weight: 600;
}

.info-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}

.info-row span {
  color: var(--muted);
}

.info-block {
  display: grid;
  gap: 6px;
}

.info-text {
  font-size: 13px;
  color: var(--muted);
  max-height: 120px;
  overflow: auto;
  white-space: pre-wrap;
}

.empty-shell {
  position: absolute;
  inset: 56px 0 188px;
  display: grid;
  place-items: center;
  pointer-events: none;
  padding: 0 16px;
}

.empty-inner {
  display: grid;
  gap: 24px;
  justify-items: center;
  width: min(var(--content-max), 100%);
  transform: none;
}

.empty-state {
  color: color-mix(in oklab, var(--text) 92%, transparent);
  font-size: clamp(24px, 2.6vw, 54px);
  font-weight: 500;
  text-align: center;
  text-wrap: balance;
  line-height: 1.12;
  max-width: 18ch;
}

.empty-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  pointer-events: auto;
  max-width: min(760px, 100%);
  min-height: 40px;
}

.suggestion {
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
  white-space: nowrap;
  min-height: 36px;
}

.images-hub {
  min-height: 0;
  overflow: auto;
  padding: 22px clamp(14px, 6vw, 110px) 26px;
  display: grid;
  gap: 24px;
}

.images-hub h2 {
  margin: 0;
  font-size: 45px;
  font-weight: 550;
}

.images-genbar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  max-width: 780px;
}

.images-genbar input {
  height: 52px;
  border-radius: 14px;
}

#imagesSizeSelect {
  min-width: 108px;
  height: 52px;
  border-radius: 14px;
}

.images-status {
  margin-top: -8px;
}

.images-block {
  display: grid;
  gap: 12px;
  max-width: 900px;
}

.images-block h3 {
  margin: 0;
  font-size: 33px;
}

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

.images-nav {
  display: flex;
  gap: 8px;
}

.style-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(150px, 1fr);
  gap: 10px;
  overflow: auto;
  padding-bottom: 4px;
}

.style-card {
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 8px;
  display: grid;
  gap: 8px;
  text-align: left;
}

.swatch {
  display: block;
  height: 112px;
  border-radius: 10px;
  border: 1px solid color-mix(in oklab, var(--border) 80%, transparent);
}

.sw1 { background: linear-gradient(135deg, #ea8f8f, #f8d66f, #7eb9ff); }
.sw2 { background: linear-gradient(135deg, #f6e4f1, #d5b4d9, #eecbc4); }
.sw3 { background: linear-gradient(135deg, #201400, #7d5811, #f0c56d); }
.sw4 { background: linear-gradient(135deg, #f8c868, #fbe594, #ffd06b); }
.sw5 { background: linear-gradient(135deg, #3f3f3f, #101010, #595959); }
.sw6 { background: linear-gradient(135deg, #8fc2ff, #d2e6ff, #f3f8ff); }

.images-ideas {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.idea-btn {
  text-align: left;
  border-radius: 12px;
  min-height: 56px;
}

.images-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
  max-width: 980px;
}

.generated-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
  display: grid;
}

.generated-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}

.generated-meta {
  font-size: 12px;
  color: var(--muted);
  padding: 8px;
  line-height: 1.35;
  min-height: 44px;
}

.generated-download {
  margin: 0 8px 8px;
  text-decoration: none;
  font-size: 12px;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  text-align: center;
}

.generated-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding-right: 8px;
  padding-bottom: 8px;
}

.generated-fav {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  padding: 0;
}

.message-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 20px;
  animation: fade-up 160ms ease-out;
}

.message-row[data-role="assistant"] .message {
  max-width: 100%;
}

.message-row[data-role="user"] .message {
  max-width: 78%;
}

.avatar {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 12px;
  border: 1px solid var(--border);
}

.avatar.assistant {
  background: #1e2a24;
  color: #8adcb8;
}

.avatar.user {
  background: #2d2a20;
  color: #f0cf8e;
}

.message {
  min-width: 0;
  line-height: 1.62;
}

.message h1,
.message h2,
.message h3 {
  line-height: 1.3;
  margin: 0 0 10px;
}

.message h1,
.message h2 {
  font-size: 1.9em;
}

.message h3 {
  font-size: 1.3em;
}

.message.message-pending {
  color: var(--muted);
  font-style: italic;
  animation: pulse 1s ease-in-out infinite;
}

.stream-cursor {
  display: inline-block;
  width: 7px;
  height: 1.15em;
  margin-left: 3px;
  border-radius: 1px;
  background: color-mix(in oklab, var(--text) 88%, transparent);
  vertical-align: text-bottom;
  animation: blink 1s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

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

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

.message ul,
.message ol {
  margin: 0 0 10px 20px;
}

.message a {
  color: #8ab4ff;
  text-decoration: none;
}

.message a:hover {
  text-decoration: underline;
}

.message code.inline {
  background: color-mix(in oklab, var(--surface) 95%, #000 5%);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 5px;
}

.callout {
  border-left: 3px solid var(--border);
  padding: 8px 10px;
  border-radius: 8px;
  margin: 8px 0 12px;
  background: color-mix(in oklab, var(--surface) 80%, transparent);
}

.callout.warning {
  border-left-color: #d5a93b;
}

.callout.note {
  border-left-color: #3f82e4;
}

.callout.tip {
  border-left-color: #10a37f;
}

.toc {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  margin: 0 0 12px;
  background: color-mix(in oklab, var(--surface) 86%, transparent);
}

.toc-title {
  font-weight: 600;
  margin-bottom: 6px;
}

.toc-item {
  display: block;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  padding: 3px 0;
}

.toc-item.lvl-2 {
  padding-left: 8px;
}

.toc-item.lvl-3 {
  padding-left: 16px;
}

.table-wrap {
  overflow-x: auto;
  margin: 8px 0 12px;
}

.message table {
  border-collapse: collapse;
  width: 100%;
}

.message th,
.message td {
  border: 1px solid var(--border);
  padding: 6px 8px;
}

.message th {
  background: color-mix(in oklab, var(--surface) 90%, black 10%);
}

.code-wrap {
  margin: 8px 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.code-head {
  height: 34px;
  background: color-mix(in oklab, var(--surface-2) 90%, #000 10%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

.copy-code-btn {
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  padding: 3px 8px;
  font-size: 12px;
}

.message pre {
  margin: 0;
  padding: 11px;
  overflow: auto;
  background: #111;
}

.message-actions {
  margin-top: 8px;
  display: flex;
  gap: 6px;
  align-items: center;
  opacity: 0;
  transition: opacity 140ms ease;
}

.message-row:hover .message-actions,
.message-row:focus-within .message-actions {
  opacity: 1;
}

.msg-action {
  font-size: 12px;
  border-radius: 7px;
  padding: 4px 8px;
  background: var(--surface);
}

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

.version-switcher {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 4px;
  font-size: 12px;
  color: var(--muted);
}

.inline-editor {
  margin-top: 8px;
  display: grid;
  gap: 6px;
}

.inline-editor textarea {
  width: 100%;
  min-height: 82px;
}

.inline-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.error-row .message {
  border-left: 2px solid var(--danger);
  padding-left: 10px;
}

.retry-last-btn {
  margin-top: 8px;
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 12px;
}

.composer-area {
  position: sticky;
  bottom: 0;
  z-index: 4;
  padding: 12px clamp(14px, 6vw, 110px) calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(31, 31, 31, 0) 0%, rgba(31, 31, 31, 0.92) 28%, rgba(31, 31, 31, 0.98) 100%);
  backdrop-filter: blur(3px);
}

.drop-zone {
  width: min(var(--content-max), 100%);
  margin: 0 auto 8px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 10px;
  text-align: center;
  color: var(--muted);
  background: color-mix(in oklab, var(--surface) 85%, transparent);
}

.composer-shell {
  border: 1px solid color-mix(in oklab, var(--border) 90%, transparent);
  border-radius: 20px;
  background: color-mix(in oklab, var(--surface) 95%, transparent);
  padding: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  width: min(var(--content-max), 100%);
  margin: 0 auto;
}

.composer-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

#modelSelect {
  appearance: none;
  -webkit-appearance: none;
  min-width: 150px;
  height: 34px;
  border-radius: 10px;
  background: var(--surface);
  border-color: var(--border);
  padding-right: 12px;
}

.tool-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--surface);
}

.tool-toggle input {
  width: 14px;
  height: 14px;
  margin: 0;
  padding: 0;
}

.chat-title-inline {
  margin-left: auto;
  height: 34px;
  width: min(230px, 34vw);
}

#prompt {
  width: 100%;
  border: 0;
  background: transparent;
  min-height: 28px;
  max-height: 220px;
  outline: none;
  padding: 8px;
  line-height: 1.45;
}

.system-prompt-inline {
  width: 100%;
  margin-top: 6px;
  border-radius: 12px;
  background: color-mix(in oklab, var(--surface-2) 92%, transparent);
}

.composer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid color-mix(in oklab, var(--border) 90%, transparent);
  padding: 8px 6px 2px;
}

.attach-btn {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--text);
}

#fileInput {
  display: none;
}

.muted {
  color: var(--muted);
  font-size: 12px;
  flex: 1;
  min-width: 0;
}

.files-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.file-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--surface);
}

.file-pill-x {
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 999px;
  padding: 0;
  line-height: 1;
  font-size: 12px;
}

.upload-progress {
  width: 90px;
  height: 6px;
}

.upload-progress::-webkit-progress-bar {
  background: color-mix(in oklab, var(--surface) 82%, transparent);
  border-radius: 999px;
}

.upload-progress::-webkit-progress-value {
  background: var(--accent);
  border-radius: 999px;
}

.mic-btn,
.send-btn {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  padding: 0;
}

.mic-btn {
  background: var(--surface);
  border: 1px solid var(--border);
}

.send-btn {
  background: #f3f3f3;
  color: #111;
  border: 0;
  font-weight: 600;
}

.send-btn:hover {
  background: #fff;
}

.send-btn:disabled,
.mic-btn:disabled,
.icon-btn:disabled,
.menu-item:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border-radius: 10px;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  animation: shimmer 1.1s infinite;
}

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.55;
  }

  50% {
    opacity: 1;
  }
}

.chat-skeleton {
  height: 38px;
}

.msg-skeleton {
  height: 16px;
  margin-bottom: 8px;
}

.chat-main.empty-mode .messages {
  opacity: 0;
  pointer-events: none;
}

.chat-main.empty-mode .chat-layout {
  grid-template-columns: 1fr;
}

.chat-main.empty-mode .info-panel {
  display: none;
}

.chat-main.empty-mode .composer-area {
  position: absolute;
  left: 50%;
  bottom: clamp(26px, 4vh, 56px);
  transform: translateX(-50%);
  width: min(calc(var(--content-max) + 44px), calc(100% - 28px));
  padding: 0;
  background: transparent;
}

.chat-main.empty-mode .composer-shell {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.chat-main.empty-mode .chat-title-inline {
  display: none;
}

.prefs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.field-label {
  font-size: 13px;
  color: var(--muted);
}

.check-label {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
}

.palette-list {
  display: grid;
  gap: 6px;
  max-height: 320px;
  overflow: auto;
}

.palette-item {
  text-align: left;
  border-radius: 10px;
}

.palette-item.active,
.palette-item:hover {
  background: color-mix(in oklab, var(--surface) 90%, black 10%);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translate(-50%, 8px);
  z-index: 120;
  background: rgba(28, 28, 28, 0.95);
  color: #ececec;
  border: 1px solid #4b4b4b;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  opacity: 0;
  transition: opacity 140ms ease, transform 140ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
}

*::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: #474747;
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

@media (max-width: 1260px) {
  .chat-layout {
    grid-template-columns: 1fr;
  }

  .info-panel {
    display: none;
  }

  .chat-main.info-collapsed .chat-layout,
  .chat-main .chat-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .mobile-topbar {
    display: flex;
  }

  .app-shell {
    grid-template-columns: 1fr;
    height: calc(100vh - 52px);
    min-height: calc(100vh - 52px);
    height: calc(100dvh - 52px);
    min-height: calc(100dvh - 52px);
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 52px;
    bottom: 0;
    width: min(82vw, 300px);
    z-index: 30;
    transform: translateX(-103%);
    transition: transform 180ms ease;
  }

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

  .chat-topbar {
    display: none;
  }

  .messages,
  .composer-area,
  .images-hub {
    padding-left: 12px;
    padding-right: 12px;
  }

  .messages {
    padding-top: 12px;
    padding-bottom: 140px;
  }

  .empty-shell {
    inset: 0 0 240px;
    place-items: start center;
    padding: clamp(42px, 9vh, 96px) 12px 0;
  }

  .empty-state {
    font-size: clamp(17px, 7.2vw, 34px);
    max-width: 13ch;
    line-height: 1.16;
  }

  .empty-inner {
    gap: 12px;
    width: 100%;
    max-width: 100%;
  }

  .empty-suggestions {
    display: grid;
    grid-template-columns: 1fr;
    width: min(520px, 100%);
    gap: 8px;
  }

  .suggestion {
    width: 100%;
    white-space: normal;
    text-align: center;
    border-radius: 12px;
  }

  .chat-main.empty-mode .composer-area {
    position: fixed;
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    bottom: 0;
    z-index: 18;
    padding: 8px 12px calc(12px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(31, 31, 31, 0) 0%, rgba(31, 31, 31, 0.96) 28%, rgba(31, 31, 31, 1) 100%);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .chat-main.empty-mode .composer-shell {
    width: min(720px, 100%);
    margin: 0 auto;
  }

  .chat-main.empty-mode .chat-layout {
    display: none;
  }

  .chat-main.empty-mode .messages {
    display: none;
  }

  .composer-meta {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    flex-wrap: wrap;
    gap: 6px;
  }

  #modelSelect {
    width: 100%;
    min-width: 0;
    padding-left: 10px;
  }

  .chat-title-inline {
    grid-column: 1 / -1;
    margin-left: 0;
    width: 100%;
  }

  .chat-title-inline {
    display: none;
  }

  .message-row[data-role="user"] .message {
    max-width: 100%;
  }

  .images-hub {
    padding: 14px 12px calc(14px + env(safe-area-inset-bottom));
    gap: 16px;
  }

  .images-hub h2 {
    font-size: 32px;
  }

  .images-block h3 {
    font-size: 22px;
  }

  .images-ideas {
    grid-template-columns: 1fr;
  }

  .images-genbar input {
    height: 46px;
  }

  #imagesSizeSelect {
    height: 46px;
    min-width: 96px;
  }

  .composer-shell {
    border-radius: 18px;
  }
}
