@import url("/css/fonts.css?v=1");

:root {
  --bg: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-main: #ffffff;
  --ink: #0a0a0a;
  --ink-60: rgba(10, 10, 10, 0.6);
  --muted: #737373;
  --stroke: #e5e5e5;
  --stroke-10: rgba(0, 0, 0, 0.1);
  --hover: #f5f5f5;
  --card: #ffffff;
  --user-bubble: #ffffff;
  --ai-bubble: #f5f5f5;
  --ai-avatar: #030213;
  --ai-avatar-fg: #ffffff;
  --user-avatar: #ececf0;
  --chip: #eceef2;
  --chip-fg: #030213;
  --combo: #f3f3f5;
  --composer: #ffffff;
  --composer-stroke: #d9d9d9;
  --composer-placeholder: #4d4d4d;
  --pill-stroke: rgba(5, 5, 5, 0.1);
  --btn: #000000;
  --btn-fg: #fafafa;
  --send-bg: #D9D9D9;
  --send-fg: #3F3F3F;
  --send-blue: #3B82F6;
  --newchat-bg: #000000;
  --newchat-fg: #fafafa;
  --profile-avatar: #ececf0;
  /* ChatGPT-like soft float around the pill (visible under/around the box) */
  --shadow-composer:
    0 0 0 1px rgba(0, 0, 0, 0.04),
    0 2px 6px rgba(0, 0, 0, 0.06),
    0 8px 24px rgba(0, 0, 0, 0.1),
    0 16px 40px rgba(0, 0, 0, 0.06);
  /* Home empty: previous solid-card shadow */
  --shadow-composer-home: 0 8px 32px rgba(0, 0, 0, 0.07), 0 2px 8px rgba(0, 0, 0, 0.04);
  --overlay: rgba(0, 0, 0, 0.4);
  --danger: #c62828;
  --ok: #1b7f4e;
  --accent: #030213;
  --creating-bg: #f4f4f4;
  --creating-dot: #93c5fd;
  --sidebar-w: 279px;
  --top-h: 52px;
  --foot-h: 80px;
  --radius-composer: 32px;
  --radius-send: 20px;
  --radius-bubble: 22px;
  --font: "IRANSansX", Tahoma, "Segoe UI", sans-serif;
  --scrollbar-track: transparent;
  --scrollbar-thumb: rgba(0, 0, 0, 0.16);
  --scrollbar-thumb-hover: rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] {
  --bg: #171717;
  --bg-sidebar: #000000;
  --bg-main: #171717;
  --ink: #ffffff;
  --ink-60: rgba(255, 255, 255, 0.6);
  --muted: #a3a3a3;
  --stroke: #262626;
  --stroke-10: rgba(255, 255, 255, 0.1);
  --hover: #262626;
  --card: #1a1a1a;
  --user-bubble: #000000;
  --ai-bubble: #252525;
  --ai-avatar: #252525;
  --ai-avatar-fg: #ffffff;
  --user-avatar: #000000;
  --chip: #262626;
  --chip-fg: #ffffff;
  --combo: rgba(38, 38, 38, 0.3);
  --composer: #000000;
  --composer-stroke: rgba(217, 217, 217, 0.3);
  --composer-placeholder: #d4d4d4;
  --pill-stroke: rgba(217, 217, 217, 0.3);
  --creating-bg: #1f1f1f;
  --creating-dot: #60a5fa;
  --btn: #ffffff;
  --btn-fg: #000000;
  --send-bg: #D9D9D9;
  --send-fg: #3F3F3F;
  --send-blue: #3B82F6;
  --newchat-bg: #ffffff;
  --newchat-fg: #000000;
  --profile-avatar: #262626;
  --shadow-composer:
    0 0 0 1px rgba(255, 255, 255, 0.04),
    0 2px 8px rgba(0, 0, 0, 0.35),
    0 10px 28px rgba(0, 0, 0, 0.4),
    0 18px 48px rgba(0, 0, 0, 0.28);
  --shadow-composer-home: 0 10px 40px rgba(0, 0, 0, 0.35), 0 2px 10px rgba(0, 0, 0, 0.2);
  --overlay: rgba(0, 0, 0, 0.64);
  --scrollbar-track: transparent;
  --scrollbar-thumb: rgba(255, 255, 255, 0.14);
  --scrollbar-thumb-hover: rgba(255, 255, 255, 0.24);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-size-adjust: 100%;
  direction: rtl;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select, a, [role="button"] {
  font-family: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}
button { cursor: pointer; border: 0; background: none; }
button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--ink) 35%, transparent);
  outline-offset: 2px;
}
img { display: block; max-width: 100%; }
a { color: inherit; }

.messages,
.side-chats,
.sheet,
.models-pop,
.bubble .md pre {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}
.messages::-webkit-scrollbar,
.side-chats::-webkit-scrollbar,
.sheet::-webkit-scrollbar,
.models-pop::-webkit-scrollbar,
.bubble .md pre::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.messages::-webkit-scrollbar-track,
.side-chats::-webkit-scrollbar-track,
.sheet::-webkit-scrollbar-track,
.models-pop::-webkit-scrollbar-track,
.bubble .md pre::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}
.messages::-webkit-scrollbar-thumb,
.side-chats::-webkit-scrollbar-thumb,
.sheet::-webkit-scrollbar-thumb,
.models-pop::-webkit-scrollbar-thumb,
.bubble .md pre::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.messages::-webkit-scrollbar-thumb:hover,
.side-chats::-webkit-scrollbar-thumb:hover,
.sheet::-webkit-scrollbar-thumb:hover,
.models-pop::-webkit-scrollbar-thumb:hover,
.bubble .md pre::-webkit-scrollbar-thumb:hover {
  background-color: var(--scrollbar-thumb-hover);
}
.messages::-webkit-scrollbar-corner,
.side-chats::-webkit-scrollbar-corner {
  background: transparent;
}

.ico-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: inherit;
}
.ico-svg { display: block; flex: 0 0 auto; }
.btn-new .ico-svg { color: var(--newchat-fg); }
.send .ico-svg { color: var(--send-fg); }
.pill.on .ico-svg { color: inherit; }

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  background: var(--bg-main);
}

.sidebar {
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg-sidebar);
  border-inline: 1px solid var(--stroke);
  min-width: 0;
  min-height: 0;
  max-height: 100dvh;
  overflow: hidden;
}
.side-head {
  height: var(--top-h);
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-bottom: 1px solid var(--stroke);
  flex-shrink: 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  line-height: 1;
  margin: 0;
}
.brand .mark {
  width: 20px;
  height: 20px;
  color: var(--ink);
}
.btn-new {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 34px;
  width: 100%;
  background: var(--newchat-bg);
  color: var(--newchat-fg);
  border-radius: 8px;
  font-weight: 600;
  font-size: 12px;
}
.side-actions {
  padding: 8px 10px 0;
  flex-shrink: 0;
}
.side-search {
  margin: 10px 10px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px;
  border-radius: 9px;
  background: var(--hover);
  color: var(--muted);
}
.side-search input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  min-width: 0;
  font-size: 13px;
}
.side-nav {
  padding: 8px 6px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 10px;
  border-radius: 9px;
  font-size: 13.5px;
  color: var(--ink);
  position: relative;
}
.side-link:hover, .side-link.on { background: var(--hover); }
.side-link .support-dot,
#supportDot.unread {
  position: absolute;
  top: 8px;
  inset-inline-start: 22px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #dc2626;
  border: 1.5px solid var(--bg-main, var(--bg));
  box-sizing: content-box;
  pointer-events: none;
  z-index: 1;
}
.list-row .support-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #dc2626;
  margin-inline-start: auto;
  flex-shrink: 0;
}

.side-link-subscribe,
.list-row-subscribe {
  color: #1d4ed8;
  font-weight: 700;
}

.side-link-subscribe b,
.list-row-subscribe b {
  font-weight: 700;
}

.side-link-subscribe .subscribe-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.side-link-subscribe .subscribe-ico .ico-svg,
.list-row-subscribe .subscribe-ico .ico-svg {
  color: #1d4ed8;
  stroke-width: 2.15;
  animation: subscribe-cup 2.2s ease-in-out infinite;
  transform-origin: 50% 80%;
}

.side-link-subscribe.is-active-sub,
.list-row-subscribe.is-active-sub {
  color: var(--ink);
  font-weight: 500;
}

.side-link-subscribe.is-active-sub b,
.list-row-subscribe.is-active-sub b {
  font-weight: 500;
}

.side-link-subscribe.is-active-sub .subscribe-ico .ico-svg,
.list-row-subscribe.is-active-sub .subscribe-ico .ico-svg {
  color: var(--ink);
  animation: none;
}

html[data-theme="dark"] .side-link-subscribe:not(.is-active-sub),
html[data-theme="dark"] .list-row-subscribe:not(.is-active-sub) {
  color: #60a5fa;
}

html[data-theme="dark"] .side-link-subscribe:not(.is-active-sub) .subscribe-ico .ico-svg,
html[data-theme="dark"] .list-row-subscribe:not(.is-active-sub) .subscribe-ico .ico-svg {
  color: #60a5fa;
}

html[data-theme="dark"] .side-link-subscribe.is-active-sub,
html[data-theme="dark"] .list-row-subscribe.is-active-sub,
html[data-theme="dark"] .side-link-subscribe.is-active-sub .subscribe-ico .ico-svg,
html[data-theme="dark"] .list-row-subscribe.is-active-sub .subscribe-ico .ico-svg {
  color: var(--ink);
}

.sheet-quota {
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  gap: 8px;
  margin: 12px 0 16px;
  padding: 14px 10px;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  background: var(--card);
}

.sheet-quota .side-quota-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.sheet-quota .side-quota-item b {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.sheet-quota .side-quota-item small {
  font-size: 11px;
  color: var(--muted);
}

.sheet-quota .side-quota-sep {
  width: 1px;
  align-self: stretch;
  background: var(--stroke);
  margin: 2px 0;
}

@keyframes subscribe-cup {
  0%,
  100% {
    transform: translateY(0) rotate(0deg) scale(1);
  }
  20% {
    transform: translateY(-1.5px) rotate(-6deg) scale(1.06);
  }
  40% {
    transform: translateY(0) rotate(5deg) scale(1.02);
  }
  60% {
    transform: translateY(-1px) rotate(-3deg) scale(1.05);
  }
  80% {
    transform: translateY(0) rotate(2deg) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .side-link-subscribe:not(.is-active-sub) .subscribe-ico .ico-svg,
  .list-row-subscribe:not(.is-active-sub) .subscribe-ico .ico-svg {
    animation: none;
  }
}
.side-chats {
  flex: 1;
  overflow: auto;
  padding: 8px 6px 12px;
}
.chat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 35px;
  padding: 0 7px;
  border-radius: 8.75px;
  font-size: 14px;
  color: var(--ink);
  width: 100%;
  text-align: start;
}
.chat-item:hover { background: var(--hover); }
.chat-item.on { background: var(--hover); }
.chat-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-item .more {
  margin-inline-start: auto;
  opacity: 0;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  font-size: 16px;
  line-height: 1;
}
.chat-item .chat-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-item .chat-busy {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  border: 2px solid color-mix(in srgb, var(--send-blue) 28%, transparent);
  border-top-color: var(--send-blue);
  border-radius: 50%;
  animation: chat-spin 0.7s linear infinite;
}
@keyframes chat-spin {
  to { transform: rotate(360deg); }
}
.chat-item:hover .more, .chat-item.on .more { opacity: 1; }
.chat-item.is-busy .more { opacity: 0.55; }
.side-foot {
  border-top: 1px solid var(--stroke);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 10px 8px max(18px, env(safe-area-inset-bottom, 18px));
  margin-top: auto;
  flex-shrink: 0;
}
.profile-row {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px 8px;
  border-radius: 12px;
  text-align: start;
}
.profile-row:hover { background: var(--hover); }
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--profile-avatar);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 600;
  flex: 0 0 auto;
  overflow: clip;
}
html[data-theme="dark"] .avatar.user { border: 1px solid #fff; }
.who { flex: 1; min-width: 0; display: block; }
.who b { display: block; font-size: 14px; font-weight: 600; line-height: 1.25; }
.who small { display: block; font-size: 12px; color: var(--ink-60); margin-top: 3px; line-height: 1.2; }

.plan-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1.3;
  vertical-align: middle;
}
.plan-pill-free {
  background: #f3f3f3;
  color: #8f8f8f;
}
.plan-pill-economy {
  background: #f3e8ff;
  color: #7c3aed;
}
.plan-pill-plus {
  background: #dbeafe;
  color: #1d4ed8;
}
.plan-pill-pro {
  background: #dcfce7;
  color: #15803d;
}
html[data-theme="dark"] .plan-pill-free {
  background: #2a2a2a;
  color: #9ca3af;
}
html[data-theme="dark"] .plan-pill-economy {
  background: #2e1065;
  color: #d8b4fe;
}
html[data-theme="dark"] .plan-pill-plus {
  background: #1e3a5f;
  color: #93c5fd;
}
html[data-theme="dark"] .plan-pill-pro {
  background: #14532d;
  color: #86efac;
}
.sheet-account .plan-pill {
  font-size: 11px;
}
.side-foot .icon-btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  opacity: 0.75;
}
.side-foot .icon-btn:hover { opacity: 1; background: var(--hover); }
.icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
}
@media (hover: hover) and (pointer: fine) {
  .icon-btn:hover { background: var(--hover); }
}
.icon-btn:active { background: var(--hover); }

.main {
  display: flex;
  flex-direction: column;
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: 100dvh;
  overflow: hidden;
  background: var(--bg-main);
}
.topbar {
  height: var(--top-h);
  min-height: var(--top-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border-bottom: 1px solid var(--stroke-10);
  flex-shrink: 0;
  position: relative;
  z-index: 25;
}
.top-model-wrap {
  position: relative;
  flex: 0 1 auto;
  z-index: 32;
}
html[data-theme="dark"] .topbar {
  background: var(--bg-main);
  border-bottom-color: #262626;
}
.menu-mobile { display: none; }
.chat-title {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: min(280px, 32vw);
  flex-shrink: 1;
}
.model-badge { display: none; }
.top-spacer { flex: 1; min-width: 8px; }
.topbar .combo.top-model {
  flex: 0 0 auto;
  width: max-content;
  max-width: min(360px, 48vw);
  height: 34px;
  border-radius: 999px;
  border-color: var(--pill-stroke);
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  padding-inline: 10px 12px;
  margin-inline-start: 2px;
}
html[data-theme="dark"] .topbar .combo.top-model { border-color: #404040; }
.topbar .combo.top-model .ico-svg { flex-shrink: 0; opacity: 0.85; }
.topbar .combo.top-model #modelTopLabel {
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
  max-width: none;
}
.topbar .icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}
.topbar .icon-btn .ico-wrap { width: 18px; height: 18px; }
#btnNotifs {
  position: relative;
}
#btnNotifs .unread {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2563eb;
  border: 1.5px solid var(--bg-main);
  box-sizing: content-box;
  pointer-events: none;
  z-index: 1;
}
.combo {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  min-width: 0;
  max-width: none;
  width: max-content;
  padding-inline: 10px;
  background: var(--combo);
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13px;
}
.combo.side-model {
  flex: 0 1 auto;
  max-width: min(148px, 46%);
  border-radius: 999px;
  border-color: var(--pill-stroke);
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  padding-inline: 8px 10px;
}
html[data-theme="dark"] .combo.side-model { border-color: #404040; }
.combo.side-model .ico-svg { flex-shrink: 0; opacity: 0.85; }
.combo #modelLabel {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
html[data-theme="dark"] .combo { border-color: #262626; }
.combo img.model-ic {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  object-fit: cover;
}
.model-ic-mini,
.model-pick-ic {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}
.list-row .model-pick-ic {
  width: 22px;
  height: 22px;
  border-radius: 6px;
}
#modelIcon:not([hidden]) + #modelIconFb { display: none; }

.messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 28px 8% 24px;
  -webkit-overflow-scrolling: touch;
}
.main:not(.is-empty) .messages {
  display: flex;
  flex-direction: column;
}
.main:not(.is-empty) .messages > .msg-row:first-child {
  margin-top: auto;
}
.chat-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.main.is-empty .chat-stage {
  justify-content: center;
  align-items: center;
}
.main:not(.is-empty) .messages {
  /* Room so last messages clear the floating composer + shadow */
  padding-bottom: 168px;
}
.msg-row {
  display: flex;
  gap: 14px;
  margin-bottom: 28px;
  align-items: flex-start;
}
.msg-row.assistant { justify-content: flex-end; }
.msg-row.user { justify-content: flex-start; }
.bubble-av {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: -0.02em;
  flex: 0 0 auto;
  margin-top: 4px;
}
.msg-row.assistant .bubble-av { background: var(--ai-avatar); color: var(--ai-avatar-fg); }
.msg-row.user .bubble-av { background: var(--user-avatar); color: var(--ink); }
.bubble {
  max-width: min(720px, 72%);
  border: 1px solid var(--stroke-10);
  border-radius: var(--radius-bubble);
  padding: 14px 14px 10px;
  font-size: 14px;
  line-height: 21px;
  word-break: break-word;
}
.msg-row.assistant .bubble {
  max-width: min(768px, 92%);
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 2px 0 0;
  box-shadow: none;
}
.msg-row.user .bubble {
  background: var(--user-bubble);
  width: fit-content;
  max-width: 100%;
  border-radius: 22px;
  padding: 8px 14px;
  line-height: 1.45;
}
html[data-theme="dark"] .msg-row.user .bubble {
  border-color: var(--stroke);
}
.msg-time {
  margin-top: 6px;
  font-size: 10.5px;
  line-height: 14px;
  opacity: 0.55;
}
.msg-row.user .msg-time {
  text-align: start;
  margin-top: 4px;
  padding-inline: 4px;
}
.bubble .md p { margin: 0 0 8px; }
.bubble .md p:last-child { margin: 0; }
.bubble .md pre {
  background: transparent;
  border-radius: 0;
  padding: 12px 14px;
  overflow: auto;
  font-size: 12.5px;
  direction: ltr;
  text-align: left;
  margin: 0;
}
.bubble .md .code-block {
  margin: 10px 0;
  border-radius: 12px;
  overflow: hidden;
  background: #f7f7f8;
  border: 1px solid rgba(0, 0, 0, 0.06);
  direction: ltr;
  text-align: left;
}
html[data-theme="dark"] .bubble .md .code-block {
  background: #1e1e1e;
  border-color: rgba(255, 255, 255, 0.08);
}
.bubble .md .code-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: #ececee;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
html[data-theme="dark"] .bubble .md .code-block-head {
  background: #2d2d2d;
  border-bottom-color: rgba(255, 255, 255, 0.06);
}
.bubble .md .code-lang {
  font-size: 12px;
  color: #6b7280;
  font-family: ui-monospace, Consolas, monospace;
}
html[data-theme="dark"] .bubble .md .code-lang { color: #a0a0a0; }
.bubble .md .code-copy {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #6b7280;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.bubble .md .code-copy:hover { background: rgba(0, 0, 0, 0.06); color: #111; }
html[data-theme="dark"] .bubble .md .code-copy { color: #a0a0a0; }
html[data-theme="dark"] .bubble .md .code-copy:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.bubble .md .code-block .tok-kw { color: #af00db; }
.bubble .md .code-block .tok-str { color: #098658; }
.bubble .md .code-block .tok-type { color: #267f99; }
.bubble .md .code-block .tok-num { color: #098658; }
.bubble .md .code-block .tok-cmt { color: #6a9955; }
html[data-theme="dark"] .bubble .md .code-block .tok-kw { color: #c586c0; }
html[data-theme="dark"] .bubble .md .code-block .tok-str { color: #ce9178; }
html[data-theme="dark"] .bubble .md .code-block .tok-type { color: #4ec9b0; }
html[data-theme="dark"] .bubble .md .code-block .tok-num { color: #b5cea8; }
html[data-theme="dark"] .bubble .md .code-block .tok-cmt { color: #6a9955; }
.bubble .md code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.92em;
}
.bubble .md :not(pre) > code {
  background: var(--hover);
  padding: 1px 5px;
  border-radius: 5px;
}
.bubble img.gen, .bubble img.att {
  max-width: 360px;
  border-radius: 12px;
  margin: 8px 0;
  cursor: zoom-in;
}
.msg-col {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
  max-width: min(720px, 86%);
}
.msg-row.assistant .msg-col { max-width: min(768px, 92%); }
.msg-row.user .msg-col { align-items: flex-start; }
.msg-row.user .msg-col .bubble { max-width: 100%; }
.msg-image {
  position: relative;
  width: fit-content;
  max-width: min(360px, 86vw);
  border-radius: 18px;
  overflow: hidden;
  background: var(--hover);
}
.msg-row.assistant .msg-image {
  align-self: auto;
}
.msg-row.assistant.msg-row--gen-image {
  width: 100%;
  justify-content: flex-end;
}
.msg-row.assistant.msg-row--gen-image .msg-col {
  flex: 1;
  width: 100%;
  max-width: 100%;
}
.msg-row.assistant.msg-row--gen-image .msg-image,
.msg-row.assistant.msg-row--gen-image .creating-image-box {
  margin-inline-start: auto;
  margin-inline-end: 0;
}
.msg-row.assistant.msg-row--gen-image .bubble {
  align-self: flex-start;
  max-width: min(768px, 100%);
}
.msg-image img {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  cursor: zoom-in;
  vertical-align: middle;
}
.msg-image-actions {
  position: absolute;
  inset-inline: 10px;
  bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}
.msg-image-actions button {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 0 12px;
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.msg-image-actions .msg-image-share {
  width: 32px;
  padding: 0;
}
.msg-image-actions button:hover { background: rgba(0, 0, 0, 0.72); }
.msg-image-actions .ico-svg { color: #fff; }
.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--hover);
  font-size: 13px;
  margin: 6px 0;
}
.sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.src {
  font-size: 11.5px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--hover);
  border: 1px solid var(--stroke);
  text-decoration: none;
  color: inherit;
}
.source-cite {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 6px 12px 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: #fff;
  color: var(--ink-60);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  max-width: min(280px, 100%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.source-cite:hover { background: #f7f7f8; color: var(--ink); }
html[data-theme="dark"] .source-cite {
  background: #262626;
  border-color: rgba(255, 255, 255, 0.12);
}
html[data-theme="dark"] .source-cite:hover { background: #333; }
.source-cite .cite-fav {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  object-fit: cover;
  flex: 0 0 auto;
  background: #fff;
}
.source-cite .cite-domain {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}
.source-cite .cite-more {
  font-weight: 600;
  opacity: 0.85;
  flex: 0 0 auto;
}
.search-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  width: 100%;
}
.search-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0 2px;
  max-width: min(520px, 92%);
}
.search-progress .search-status {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink);
}
.search-progress .search-detail {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  padding: 8px 12px;
  border-radius: 999px;
  background: #e8f0fe;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  font-size: 13px;
  font-weight: 500;
}
html[data-theme="dark"] .search-progress .search-detail {
  background: #1e3a5f;
  color: #fff;
  border-color: #3b82f6;
}
.search-progress .search-detail .ico-svg { color: inherit; flex: 0 0 auto; }
.search-progress .search-detail span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-worked {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  line-height: 1.3;
}
.search-worked:hover { color: var(--ink); }
.scroll-fab {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(148px + env(safe-area-inset-bottom, 0px));
  z-index: 6;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}
.scroll-fab:hover { background: var(--hover); }
.scroll-fab[hidden] { display: none !important; }
.main.is-empty .scroll-fab { display: none !important; }
html[data-theme="dark"] .scroll-fab {
  background: #262626;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}
.fb {
  display: flex;
  gap: 2px;
  margin-top: 6px;
  align-items: center;
}
.msg-row.user .fb { margin-top: 4px; }
.fb button {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  font-size: 14px;
  opacity: 0.5;
  display: inline-grid;
  place-items: center;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
}
.fb button:hover, .fb button.on { opacity: 1; background: var(--hover); color: var(--ink); }
.msg-row.is-dimmed { opacity: 0.45; pointer-events: none; }
.msg-edit-box {
  width: min(640px, 100%);
  background: #efefef;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 22px;
  padding: 14px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
html[data-theme="dark"] .msg-edit-box {
  background: #2a2a2a;
  border-color: rgba(255, 255, 255, 0.1);
}
.msg-edit-box textarea {
  width: 100%;
  min-height: 72px;
  max-height: 220px;
  resize: vertical;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  line-height: 1.5;
  padding: 0;
}
.msg-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.msg-edit-cancel,
.msg-edit-send {
  height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.msg-edit-cancel {
  background: #fff;
  color: #0a0a0a;
  border: 1px solid #0a0a0a;
}
html[data-theme="dark"] .msg-edit-cancel {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.55);
}
.msg-edit-send {
  background: #0a0a0a;
  color: #fff;
  border: 1px solid #0a0a0a;
}
html[data-theme="dark"] .msg-edit-send {
  background: #fff;
  color: #0a0a0a;
  border-color: #fff;
}
.thinking {
  display: flex;
  gap: 5px;
  padding: 6px 0 2px;
}
.thinking i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink);
  animation: bounce 1s infinite ease-in-out;
}
.thinking i:nth-child(2) { animation-delay: 0.15s; }
.thinking i:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.35; }
  40% { transform: translateY(-5px); opacity: 1; }
}

.creating-image-box {
  position: relative;
  width: min(280px, 72vw);
  aspect-ratio: 1;
  border-radius: 24px;
  background: var(--creating-bg);
  overflow: hidden;
  margin: 2px 0;
}
.msg-row.assistant.msg-row--gen-image .creating-image-box {
  margin-inline-start: auto;
  margin-inline-end: 0;
}
.creating-image-label {
  position: absolute;
  top: 14px;
  inset-inline-start: 16px;
  font-size: 13px;
  color: var(--muted);
  z-index: 1;
  pointer-events: none;
}
.creating-image-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.gallery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.gallery-head h3 { margin: 0; }
.gallery-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.gallery-actions .btn-text {
  border: 0;
  background: transparent;
  color: var(--send-blue);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 4px;
}
.gallery-actions .btn-icon {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: var(--hover);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.gallery-actions .btn-icon.on,
.gallery-actions .btn-icon:hover { background: var(--stroke); }
.gal-item {
  position: relative;
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
}
.gal-item img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
  border-radius: 12px;
}
.gal-check {
  position: absolute;
  top: 8px;
  inset-inline-start: 8px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 2px solid #fff;
  background: rgba(0, 0, 0, 0.25);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  display: none;
}
.gallery.selecting .gal-check { display: block; }
.gal-item.on .gal-check {
  background: var(--send-blue);
  border-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-size: 14px;
  background-repeat: no-repeat;
  background-position: center;
}
.gal-bar {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--stroke);
}
.gal-bar .btn {
  flex: 1;
}
.gal-bar .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.msg-row.upgrade-row .bubble-av {
  display: none;
}
.msg-row.upgrade-row .msg-col {
  max-width: min(640px, 100%);
}
.upgrade-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--stroke);
  border-radius: 20px;
  background: var(--card);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.upgrade-card-text {
  flex: 1;
  min-width: 0;
}
.upgrade-card-text b {
  display: block;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
}
.upgrade-card-text p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--muted);
}
.upgrade-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.upgrade-card-btn {
  height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--btn);
  color: var(--btn-fg);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.upgrade-card-btn:hover {
  opacity: 0.92;
}
.upgrade-card-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.upgrade-card-close:hover {
  background: var(--hover);
  color: var(--ink);
}
@media (max-width: 640px) {
  .upgrade-card {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .upgrade-card-actions {
    justify-content: space-between;
  }
  .upgrade-card-btn {
    flex: 1;
  }
}

.empty-hero {
  display: none;
  text-align: center;
  padding: 0 24px 16px;
  flex: 0 0 auto;
}
.main.is-empty .empty-hero {
  display: block;
}
.main.is-empty .messages { display: none; }
.main.is-empty .composer-wrap {
  padding: 0 20px calc(10px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  position: relative;
  background: transparent;
}
.main.is-empty .composer-wrap::before {
  display: none;
}
.main.is-empty .composer {
  width: min(580px, 100%);
  margin-inline: auto;
  padding: 14px 16px 12px;
  border-radius: var(--radius-composer);
  background: var(--composer);
  border: 1px solid var(--composer-stroke);
  box-shadow: var(--shadow-composer-home);
}
.main.is-empty .composer textarea {
  min-height: 22px;
  font-size: 15px;
  line-height: 1.4;
}
.main.is-empty .composer-bar {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.main.is-empty .composer-tools {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.main.is-empty .composer-tools::-webkit-scrollbar { display: none; }
.main.is-empty .composer-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}
.main.is-empty .pill {
  height: 30px;
  padding: 0 10px;
  font-size: 12.5px;
  flex-shrink: 0;
}
.main.is-empty .composer-actions .icon-btn,
.main.is-empty .composer-actions .attach-btn,
.main.is-empty .composer-actions .send {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  max-width: 32px;
  max-height: 32px;
  padding: 0;
  border-radius: 999px;
}
.empty-hero .mark { width: 40px; height: 40px; margin: 0 auto 10px; color: var(--ink); }
.empty-hero h2 { margin: 0; font-size: clamp(20px, 3.5vw, 26px); font-weight: 600; letter-spacing: -0.03em; }
.recents-label {
  font-size: 12px;
  color: var(--muted);
  padding: 10px 10px 4px;
}

.composer-wrap {
  padding: 0 24px calc(10px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  background: transparent;
}
.composer-disclaimer {
  margin: 10px 8px 0;
  max-width: min(640px, 100%);
  padding: 0 10px;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--muted);
  text-align: center;
  pointer-events: none;
}
/* Chat: float over messages — room in wrap so box-shadow is not clipped */
.main:not(.is-empty) .composer-wrap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  flex: none;
  padding: 28px 24px calc(12px + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
  background: transparent;
  overflow: visible;
  z-index: 3;
}
.main:not(.is-empty) .composer-wrap::before {
  content: none;
}
.composer {
  width: min(768px, 100%);
  background: var(--composer);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-composer);
  box-shadow: var(--shadow-composer);
  display: flex;
  flex-direction: column;
  padding: 12px 14px 10px;
  position: relative;
  z-index: 1;
}
.main:not(.is-empty) .composer {
  width: min(768px, calc(100% - 48px));
  pointer-events: auto;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: var(--shadow-composer);
}
html[data-theme="dark"] .main:not(.is-empty) .composer {
  background: var(--composer);
  border-color: rgba(255, 255, 255, 0.12);
}
.main:not(.is-empty) .models-pop {
  pointer-events: auto;
  z-index: 40;
}
.composer textarea {
  width: 100%;
  min-height: 26px;
  max-height: 180px;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  font-size: 16px;
  line-height: 1.45;
  letter-spacing: -0.1px;
}
.composer textarea::placeholder { color: var(--composer-placeholder); }
.composer-bar {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  width: 100%;
  min-width: 0;
}
.composer-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.composer-tools::-webkit-scrollbar { display: none; }
.composer-tools > .pill { flex-shrink: 0; }
.composer-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  margin-inline-start: 0;
}
.composer-actions .icon-btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--pill-stroke);
  font-size: 13px;
  letter-spacing: -0.1px;
  white-space: nowrap;
}
.pill.composer-model {
  max-width: min(280px, 62vw);
  width: max-content;
  flex: 0 0 auto;
  font-weight: 500;
}
.pill.composer-model #modelLabel {
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
  min-width: 0;
}
.pill.composer-model .ico-svg { flex-shrink: 0; opacity: 0.85; }
/* Think / misc: solid invert when on */
.pill.on:not(.tool) {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
html[data-theme="dark"] .pill.on:not(.tool) {
  background: #fff;
  color: #000;
  border-color: #fff;
}
/* Image / web / deep research — gray stroke idle, light-blue active */
button.pill.tool,
.pill.tool {
  background: #fff;
  color: #0a0a0a;
  border: 1px solid #c8c8c8;
  font-weight: 500;
}
button.pill.tool .ico-svg,
.pill.tool .ico-svg { color: #0a0a0a; opacity: 1; }
button.pill.tool.on,
button.pill.tool[aria-pressed="true"],
.pill.tool.on {
  background: #e8f0fe !important;
  color: #1d4ed8 !important;
  border-color: #93c5fd !important;
}
button.pill.tool.on .ico-svg,
button.pill.tool[aria-pressed="true"] .ico-svg,
.pill.tool.on .ico-svg {
  color: #1d4ed8 !important;
  opacity: 1;
}
html[data-theme="dark"] button.pill.tool,
html[data-theme="dark"] .pill.tool {
  background: transparent;
  color: #f5f5f5;
  border-color: rgba(217, 217, 217, 0.4);
}
html[data-theme="dark"] button.pill.tool .ico-svg,
html[data-theme="dark"] .pill.tool .ico-svg { color: #f5f5f5; }
html[data-theme="dark"] button.pill.tool.on,
html[data-theme="dark"] button.pill.tool[aria-pressed="true"],
html[data-theme="dark"] .pill.tool.on {
  background: #1e3a5f !important;
  color: #93c5fd !important;
  border-color: #3b82f6 !important;
}
html[data-theme="dark"] button.pill.tool.on .ico-svg,
html[data-theme="dark"] button.pill.tool[aria-pressed="true"] .ico-svg,
html[data-theme="dark"] .pill.tool.on .ico-svg {
  color: #93c5fd !important;
}

/* Active tool chip inside composer — unused; keep hidden */
.tool-chip-row { display: none !important; }
.tool-chip-row[hidden] { display: none !important; }
.attach-btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  border-radius: 999px;
  border: 1px solid var(--pill-stroke);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  padding: 0;
}
.attach-previews {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  align-items: center;
  padding: 0;
  min-width: 0;
}
.attach-previews:empty {
  display: none;
}
.att-preview {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--hover);
  border: 1px solid var(--stroke);
  flex: 0 0 auto;
  cursor: pointer;
}
.att-preview img { width: 100%; height: 100%; object-fit: cover; }
.att-preview.att-file {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 4px;
}
.att-preview.att-file .ico-svg { color: var(--ink); opacity: 0.7; }
.att-file-name {
  font-size: 9px;
  line-height: 1.1;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  padding: 0 2px;
}
.att-preview button {
  position: absolute;
  top: 2px;
  inset-inline-end: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #000;
  color: #fff;
  font-size: 11px;
  line-height: 18px;
}
.send {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  max-width: 32px;
  max-height: 32px;
  border-radius: 999px;
  background: var(--send-bg);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  padding: 0;
  transition: background 0.15s ease;
}
.send .ico-svg { width: 18px; height: 18px; color: var(--send-fg); transition: color 0.15s ease; }
.send.active {
  background: var(--send-blue);
  cursor: pointer;
}
.send.active .ico-svg { color: #fff; }
.send:disabled:not(.stop) { cursor: default; opacity: 1; }
.send.stop { background: var(--send-blue); }
.send.stop .ico-svg { color: #fff; }

.banner, .maint {
  margin: 12px 8%;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--hover);
  border: 1px solid var(--stroke);
  font-size: 13.5px;
  flex-shrink: 0;
}
.maint { background: #fff4e5; color: #7a4b00; display: flex; flex-direction: column; gap: 4px; }
.maint b { font-weight: 700; }
.maint.is-update { background: #e8f1ff; color: #1a4b8c; }
html[data-theme="dark"] .maint { background: #3a2a10; color: #ffcc80; }
html[data-theme="dark"] .maint.is-update { background: #1a2a44; color: #9ec1ff; }

.site-maint {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 12, 24, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  pointer-events: auto;
  touch-action: none;
}
.site-maint[hidden] { display: none !important; }
body.site-locked {
  overflow: hidden !important;
}
body.site-locked .app,
body.site-locked .overlay,
body.site-locked .aspect-pop {
  pointer-events: none !important;
  user-select: none !important;
}
.site-maint-card {
  width: min(440px, 100%);
  background: #fff;
  color: #111;
  border-radius: 20px;
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0,0,0,.28);
}
html[data-theme="dark"] .site-maint-card {
  background: #1c1c1e;
  color: #f5f5f5;
}
.site-maint-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
  background: #fff4e5;
  color: #7a4b00;
}
.site-maint.is-update .site-maint-badge {
  background: #e8f1ff;
  color: #1a4b8c;
}
html[data-theme="dark"] .site-maint-badge {
  background: #3a2a10;
  color: #ffcc80;
}
html[data-theme="dark"] .site-maint.is-update .site-maint-badge {
  background: #1a2a44;
  color: #9ec1ff;
}
.site-maint-card h1 {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.site-maint-card p {
  margin: 0;
  font-size: 15px;
  line-height: 1.7;
  opacity: .85;
}

.overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 24px;
}
.overlay.show { display: flex; }
.sheet {
  width: min(560px, 100%);
  max-height: min(86dvh, 820px);
  overflow: auto;
  background: var(--card);
  color: var(--ink);
  border-radius: 18px;
  border: 1px solid var(--stroke);
  padding: 26px 24px 24px;
}
.sheet.wide { width: min(860px, 100%); }
.sheet-nav {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.sheet-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 10px 0 6px;
  border-radius: 10px;
  align-self: flex-start;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  margin-inline-start: -6px;
  margin-top: -4px;
}
.sheet-back:hover { background: var(--hover); }
.sheet-back .ico-svg { transform: scaleX(-1); flex-shrink: 0; }
.sheet-nav-body .sub { margin-top: 0; }
.sheet-account {
  padding-top: 0;
}
.sheet-account > h3 {
  margin: 0 0 4px;
  font-size: 20px;
}
.sheet-account > .sub {
  margin: 0 0 20px;
}
.sheet h3 { margin: 0 0 6px; font-size: 20px; }
.sheet .sub { color: var(--muted); font-size: 13.5px; margin-bottom: 18px; }
.ticket-thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}
.ticket-msg {
  display: flex;
  max-width: min(300px, 88%);
}
.ticket-msg--user { align-self: flex-start; }
.ticket-msg--admin { align-self: flex-end; }
.ticket-msg-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  max-width: 100%;
}
.ticket-msg--user .ticket-msg-bubble {
  background: var(--user-bubble);
  border: 1px solid var(--stroke);
  border-top-right-radius: 6px;
}
.ticket-msg--user .ticket-msg-meta { color: var(--muted); }
.ticket-msg--user .ticket-msg-body { color: var(--ink); }
.ticket-msg--admin .ticket-msg-bubble {
  background: #e8f0fe;
  border-top-left-radius: 6px;
}
.ticket-msg--admin .ticket-msg-meta,
.ticket-msg--admin .ticket-msg-body { color: #1e3a8a; }
html[data-theme="dark"] .ticket-msg--admin .ticket-msg-bubble { background: #1e3a5f; }
html[data-theme="dark"] .ticket-msg--admin .ticket-msg-meta,
html[data-theme="dark"] .ticket-msg--admin .ticket-msg-body { color: #93c5fd; }
.ticket-msg-meta {
  font-size: 11px;
  font-weight: 500;
  margin-bottom: 4px;
}
.ticket-msg-body {
  font-size: 14.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.ticket-section-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin: 4px 0 10px;
}
.ticket-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 8px;
}
.ticket-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: start;
  padding: 14px 14px;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  background: var(--card);
  cursor: pointer;
}
.ticket-row:hover { background: var(--hover); }
.ticket-row-main { flex: 1; min-width: 0; }
.ticket-row-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ticket-row-date {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}
.ticket-row-side {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  max-width: 55%;
}
.ticket-row-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}
.ticket-row-num {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}
.ticket-chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.ticket-chip-topic {
  background: #e8f0fe;
  color: #1d4ed8;
}
.ticket-chip-status.is-open {
  background: #e8f0fe;
  color: #1d4ed8;
}
.ticket-chip-status.is-progress {
  background: #fff4e5;
  color: #c2410c;
}
.ticket-chip-status.is-waiting {
  background: #f3e8ff;
  color: #7c3aed;
}
.ticket-chip-status.is-closed {
  background: #f3f3f3;
  color: #8f8f8f;
}
.ticket-chip-read {
  background: #f3f3f3;
  color: var(--muted);
  font-size: 10px;
  padding: 0 8px;
}
.ticket-chip-read.is-unread {
  background: #fee2e2;
  color: #dc2626;
}
.ticket-unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #dc2626;
}
.ticket-detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}
html[data-theme="dark"] .ticket-chip-topic,
html[data-theme="dark"] .ticket-chip-status.is-open {
  background: #1e3a5f;
  color: #93c5fd;
}
html[data-theme="dark"] .ticket-chip-status.is-progress {
  background: #3b2610;
  color: #fdba74;
}
html[data-theme="dark"] .ticket-chip-status.is-waiting {
  background: #2e1065;
  color: #c4b5fd;
}
html[data-theme="dark"] .ticket-chip-status.is-closed,
html[data-theme="dark"] .ticket-chip-read {
  background: #2a2a2a;
  color: #a3a3a3;
}
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; margin-bottom: 6px; color: var(--muted); }
.field input, .field textarea, .field select {
  width: 100%;
  border: 1px solid var(--stroke);
  background: var(--bg);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 15px;
  outline: none;
}
.field textarea { min-height: 90px; resize: vertical; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
}
.btn.primary { background: var(--btn); color: var(--btn-fg); }
.btn.ghost { border: 1px solid var(--stroke); }
.btn.danger { background: var(--danger); color: #fff; }
.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--stroke);
  width: 100%;
  text-align: start;
  cursor: pointer;
  border-radius: 8px;
}
.list-row:hover { background: var(--hover); }
.list-row[role="button"]:active { opacity: 0.85; }
.list-row:last-child { border-bottom: 0; }
.list-row small { color: var(--muted); display: block; }
.list-row.on { background: var(--hover); }
.list-row.on b { font-weight: 700; }
.list-row .menu-cost.model-cost {
  margin-inline-start: auto;
  flex: 0 0 auto;
  min-width: auto;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--hover);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.archive-row {
  gap: 8px;
  cursor: default;
}
.archive-row .archive-open {
  flex: 1;
  min-width: 0;
  text-align: start;
  background: transparent;
  border: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.archive-row .archive-open span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.archive-row .archive-restore {
  flex: 0 0 auto;
  padding: 6px 12px;
  font-size: 12px;
  height: auto;
}
.list-row.on .menu-cost.model-cost {
  background: rgba(29, 78, 216, 0.12);
  color: #1d4ed8;
}
html[data-theme="dark"] .list-row.on .menu-cost.model-cost {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.list-row.locked { opacity: 0.62; }
.list-row.locked b { font-weight: 500; }
#autoRow { border-bottom: 1px solid var(--stroke); margin-bottom: 4px; padding-bottom: 2px; }
.model-auto-row { border-bottom: 0; }
.plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.plan-card {
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 16px;
  text-align: start;
}
.plan-card.on { border-color: var(--ink); }
.plan-card h4 { margin: 0 0 6px; }
.plan-card .price { font-size: 20px; font-weight: 700; margin: 8px 0; }
.plan-card ul { margin: 0; padding-inline-start: 18px; color: var(--muted); font-size: 13px; }
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13.5px;
  z-index: 320;
  display: none;
}
.toast.show { display: block; }
.menu-pop {
  position: fixed;
  z-index: 310;
  min-width: 200px;
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 6px;
  display: none;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
}
.menu-pop.show { display: block; }
.menu-pop button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: start;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  white-space: nowrap;
  color: var(--ink);
  background: transparent;
  border: 0;
  cursor: pointer;
}
.menu-pop button .menu-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  flex: 1;
  white-space: normal;
}
.menu-pop button .menu-copy b {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
}
.menu-pop button .menu-copy small {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}
.menu-pop button .menu-cost {
  margin-inline-start: auto;
  flex: 0 0 auto;
  min-width: 28px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--hover);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.menu-pop button.on .menu-cost {
  background: rgba(29, 78, 216, 0.12);
  color: #1d4ed8;
}
html[data-theme="dark"] .menu-pop button.on .menu-cost {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.menu-pop button .menu-ico {
  display: inline-flex;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  margin-top: 2px;
}
.menu-pop button .menu-ico .ico-svg { color: var(--ink); opacity: 0.85; }
.menu-pop button:hover { background: var(--hover); }
.menu-pop button.on {
  background: #e8f0fe;
  color: #1d4ed8;
}
.menu-pop button.on .menu-ico .ico-svg { color: #1d4ed8; }
html[data-theme="dark"] .menu-pop button.on {
  background: #1e3a5f;
  color: #fff;
}
html[data-theme="dark"] .menu-pop button.on .menu-ico .ico-svg { color: #fff; }
.active-tool {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 6px 10px;
  border-radius: 999px;
  background: #e8f0fe;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 500;
  width: fit-content;
  max-width: min(200px, 46vw);
  flex: 0 0 auto;
  white-space: nowrap;
}
.active-tool[hidden] { display: none !important; }
.active-tool-ico {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}
.active-tool-ico .ico-svg { color: #1d4ed8; }
#activeToolLabel {
  overflow: hidden;
  text-overflow: ellipsis;
}
.active-tool-clear {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 0;
  background: rgba(29, 78, 216, 0.12);
  color: #1d4ed8;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: grid;
  place-items: center;
  padding: 0;
  flex: 0 0 auto;
}
.active-tool-clear:hover { background: rgba(29, 78, 216, 0.22); }
html[data-theme="dark"] .active-tool {
  background: #1e3a5f;
  color: #fff;
}
html[data-theme="dark"] .active-tool-ico .ico-svg { color: #fff; }
html[data-theme="dark"] .active-tool-clear {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.viewer {
  position: fixed;
  inset: 0;
  background: #0a0a0a;
  display: none;
  z-index: 400;
  flex-direction: column;
  color: #fff;
}
.viewer.show { display: flex; }
.viewer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  flex-shrink: 0;
}
.viewer-close {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  display: grid;
  place-items: center;
}
.viewer-close:hover { background: rgba(255, 255, 255, 0.2); }
.viewer-share {
  height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  background: #fff;
  color: #0d0d0d;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
}
.viewer-share:hover { filter: brightness(0.96); }
.viewer-stage {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 8px 16px 0;
}
.viewer-stage img {
  max-width: min(920px, 94vw);
  max-height: calc(100dvh - 240px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
}
.viewer-tools {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  padding: 0 12px 28px;
  flex-shrink: 0;
}
.viewer-tool {
  flex: 1;
  max-width: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 0;
  color: #fff;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  padding: 8px;
}
.viewer-tool-ic {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  display: grid;
  place-items: center;
  color: #fff;
}
.viewer-tool:hover .viewer-tool-ic { background: rgba(255, 255, 255, 0.22); }
.viewer-tool .ico-svg { color: #fff; }
.aspect-pop {
  position: fixed;
  z-index: 450;
  min-width: 260px;
  max-width: min(320px, calc(100vw - 24px));
  background: #fff;
  color: #111;
  border-radius: 16px;
  padding: 10px 8px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  display: none;
}
.aspect-pop.show { display: block; }
.aspect-pop .aspect-title {
  font-size: 13px;
  font-weight: 600;
  color: #444;
  padding: 6px 12px 10px;
  line-height: 1.35;
}
.aspect-pop button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: start;
  padding: 11px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #111;
  cursor: pointer;
  font: inherit;
}
.aspect-pop button:hover,
.aspect-pop button:focus-visible {
  background: #f2f2f2;
  outline: none;
}
.aspect-pop .aspect-check {
  width: 18px;
  height: 18px;
  border: 1.5px solid #bbb;
  border-radius: 4px;
  flex: 0 0 auto;
}
.aspect-pop .aspect-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.aspect-pop .aspect-label b {
  font-weight: 600;
  font-size: 14px;
}
.aspect-pop .aspect-label small {
  color: #777;
  font-size: 12px;
}
html[data-theme="dark"] .aspect-pop {
  background: #1c1c1e;
  color: #f5f5f5;
}
html[data-theme="dark"] .aspect-pop .aspect-title { color: #bbb; }
html[data-theme="dark"] .aspect-pop button { color: #f5f5f5; }
html[data-theme="dark"] .aspect-pop button:hover,
html[data-theme="dark"] .aspect-pop button:focus-visible { background: #2c2c2e; }
html[data-theme="dark"] .aspect-pop .aspect-label small { color: #999; }
html[data-theme="dark"] .aspect-pop .aspect-check { border-color: #666; }
.models-pop {
  position: fixed;
  width: min(360px, calc(100vw - 32px));
  max-height: min(420px, calc(100dvh - 24px));
  overflow: auto;
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 8px;
  display: none;
  z-index: 80;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
}
.models-pop.show { display: block; }
.model-pop-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 4px;
  font-size: 14px;
  font-weight: 700;
}
.model-pop-back {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  flex-shrink: 0;
  color: var(--ink);
}
.model-pop-back:hover { background: var(--hover); }
.model-pop-back .ico-svg { transform: scaleX(-1); }
.list-row .row-chevron {
  margin-inline-start: auto;
  opacity: 0.45;
  display: inline-flex;
  transform: scaleX(-1);
}
.kind-row { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px; }
.kind-row button {
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  font-size: 12px;
}
.kind-row button.on { background: var(--ink); color: var(--bg); }

@media (min-width: 981px) {
  /* Site/desktop: align thread with centered composer — AI answers start mid-column (RTL) */
  .messages {
    padding-inline: max(24px, calc((100% - min(768px, calc(100% - 48px))) / 2));
  }
  .msg-row.assistant {
    justify-content: flex-start;
  }
  .msg-row.assistant .msg-col {
    max-width: min(768px, 100%);
  }
  .msg-row.assistant.msg-row--gen-image {
    justify-content: flex-end;
  }
}

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  /* Keep drawer above all main/composer UI (composer was painting over the menu). */
  .main {
    position: relative;
    z-index: 1;
    isolation: isolate;
  }
  .sidebar {
    position: fixed;
    inset: 0 0 0 auto;
    width: min(300px, 86vw);
    z-index: 210;
    transform: translateX(105%);
    transition: transform 0.2s ease;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.12);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-mobile { display: grid; }
  .top-model-wrap { display: none; }
  .chat-title { max-width: min(420px, 55vw); }
  .pill.composer-model { max-width: min(220px, 58vw); }
  .models-pop {
    width: min(280px, calc(100vw - 24px));
    max-height: min(320px, calc(100dvh - 24px));
    border-radius: 12px;
    padding: 6px;
    z-index: 40;
  }
  .models-pop .list-row {
    padding: 8px 10px;
    gap: 8px;
    font-size: 13px;
  }
  .models-pop .list-row small { font-size: 11px; }
  .models-pop .model-pop-head { font-size: 13px; padding: 4px 6px 2px; }
  .models-pop .kind-row { padding: 6px; gap: 4px; }
  .models-pop .kind-row button { height: 26px; padding: 0 8px; font-size: 11px; }
  .composer,
  .main.is-empty .composer { width: min(680px, calc(100% - 24px)); }
  .composer-tools { gap: 4px; }
  .pill { height: 30px; padding: 0 8px; font-size: 12px; }
  .attach-btn, .send { width: 32px; height: 32px; }
  .messages { padding: 20px 16px 16px; }
  .main:not(.is-empty) .messages { padding-bottom: 160px; }
  .main:not(.is-empty) .composer-wrap { padding: 24px 12px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .scroll-fab { bottom: calc(162px + env(safe-area-inset-bottom, 0px)); }
  .bubble { max-width: 86%; }
  .plan-grid { grid-template-columns: 1fr; }
  .scrim {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 200;
  }
  .scrim.show { display: block; }
  body.drawer-open {
    overflow: hidden;
    touch-action: none;
  }
}
