html.chat-page,
body.chat-page {
  height: 100%;
  overflow: hidden;
  user-select: none;
}

body.chat-page .app-wrapper {
  height: 100vh;
  overflow: hidden;
}

body.chat-page .main-container {
  min-height: 0;
  overflow: hidden;
}

body.chat-page header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  transform: none;
  opacity: 1;
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
  border: 0;
  padding: 12px 16px;
  pointer-events: none;
}

body.chat-page header .logo,
body.chat-page header .project-title {
  display: none;
}

body.chat-page header .profile-wrapper {
  pointer-events: auto;
}

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

.chat-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  background: #080808c4;
  padding: 14px 12px 18px;
}

.chat-sidebar-logo {
  display: block;
  padding: 6px 10px 10px;
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.chat-sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.chat-side-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-side-link {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #d2d2d7;
  text-decoration: none;
  font: 500 13px/1.35 var(--font-main);
  cursor: pointer;
}

.chat-side-link svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  opacity: 0.8;
}

.chat-side-link:hover,
.chat-side-link.active {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

button.chat-side-link {
  appearance: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
  transform: none;
}

button.chat-side-link:hover {
  transform: none;
  box-shadow: none;
}

.chat-new-btn {
  width: 100%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  margin: 2px 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: #f5f5f7;
  font: 600 13px/1 var(--font-main);
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.chat-new-btn svg {
  width: 15px;
  height: 15px;
}

.chat-new-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}

.chat-history-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 2px 8px 6px;
}

.chat-history {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-history-item {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-sizing: border-box;
  background: transparent;
  color: #d2d2d7;
  text-align: left;
  cursor: pointer;
  font: 500 13px/1.35 var(--font-main);
}

.chat-history-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  box-sizing: border-box;
}

.chat-history-item span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: start;
  unicode-bidi: isolate;
}

.chat-history-item:hover .chat-history-main,
.chat-history-item.active .chat-history-main {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.chat-history-item:hover,
.chat-history-item.active {
  color: #fff;
}

.chat-history-item .chat-del {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  align-self: center;
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  box-sizing: border-box;
  background: transparent;
  color: #86868b;
  cursor: pointer;
  opacity: 0;
  line-height: 0;
  font-size: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transform: none;
}

.chat-history-item .chat-del svg {
  display: block;
  width: 10px;
  height: 10px;
}

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

.chat-history-item .chat-del:hover {
  background: rgba(255, 71, 87, 0.16);
  color: #ff6b7a;
  transform: none;
  box-shadow: none;
  border-color: transparent;
}

.chat-del-confirm {
  display: none;
  width: 100%;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
  padding: 10px 9px 4px;
}

.chat-history-item.is-confirming {
  cursor: default;
  color: #fff;
}

.chat-history-item.is-confirming .chat-history-main,
.chat-history-item.is-confirming:hover .chat-history-main,
.chat-history-item.is-confirming.active .chat-history-main {
  background: rgba(255, 71, 87, 0.1);
  border-color: #ff4d5a;
  color: #fff;
}

.chat-history-item.is-confirming .chat-del {
  opacity: 1;
  color: #ff6b7a;
}

.chat-history-item.is-confirming .chat-del-confirm {
  display: flex;
}

.chat-del-confirm p {
  margin: 0;
  color: #d2d2d7;
  font: 500 12px/1.4 var(--font-main);
}

.chat-del-confirm-actions {
  display: flex;
  gap: 6px;
}

.chat-del-yes,
.chat-del-no {
  flex: 1;
  height: 28px;
  margin: 0;
  padding: 0 8px;
  border-radius: 8px;
  cursor: pointer;
  font: 600 12px/1 var(--font-main);
  box-shadow: none !important;
  backdrop-filter: none !important;
  transform: none !important;
}

.chat-del-yes {
  border: 0;
  background: rgba(255, 255, 255, 0.14) !important;
  color: #fff;
}

.chat-del-yes:hover {
  background: rgba(255, 255, 255, 0.22) !important;
}

.chat-del-no {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent !important;
  color: #a1a1a6;
}

.chat-del-no:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  color: #f5f5f7;
}

.chat-history-empty {
  padding: 18px 10px;
  color: #6e6e73;
  font-size: 13px;
}

.chat-main {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.chat-sidebar-toggle {
  display: none;
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 5;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  color: #fff;
  cursor: pointer;
  transform: none;
}

.chat-sidebar-toggle:hover,
.chat-sidebar-toggle:focus,
.chat-sidebar-toggle:focus-visible {
  background: transparent;
  border: none;
  box-shadow: none;
  outline: none;
  transform: none;
  color: #fff;
}

.chat-sidebar-toggle svg {
  width: 22px;
  height: 22px;
}

.chat-thread {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 24px 8px;
}

.chat-empty {
  max-width: 640px;
  margin: 12vh auto 0;
  text-align: center;
}

.chat-empty-mark {
  display: inline-flex;
  margin-bottom: 18px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #c7c7cc;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.chat-empty h1 {
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 500;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
}

.chat-empty p {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.55;
}

.chat-skills-panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 28px 28px 40px;
}

.chat-main.is-skills .chat-thread,
.chat-main.is-skills .chat-composer-wrap {
  display: none;
}

.chat-skills-head {
  max-width: 920px;
  margin: 0 auto 22px;
}

.chat-skills-head h1 {
  font-size: clamp(26px, 3.4vw, 36px);
  font-weight: 550;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.chat-skills-head p {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.55;
  max-width: 520px;
}

.chat-skills-grid {
  max-width: 920px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.chat-skill-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-height: 148px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.07);
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.chat-skill-card:hover {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.055);
  transform: none;
  box-shadow: none;
}

.chat-skill-card,
.chat-skill-edit,
.chat-skill-ghost,
.chat-skill-save,
.chat-skill-danger {
  appearance: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.chat-skill-card.is-create {
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.22);
  background: transparent;
  justify-content: center;
  align-items: center;
  color: #d2d2d7;
}

.chat-skill-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 18px;
}

.chat-skill-card h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.chat-skill-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.chat-skill-owner {
  margin-top: auto;
  font-size: 11px;
  color: #8e8e93;
}

.chat-skill-edit {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #c7c7cc;
  cursor: pointer;
}

.chat-skill-edit:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.chat-skill-edit svg {
  width: 14px;
  height: 14px;
}

.chat-skill-editor {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
}

.chat-skill-editor[hidden] { display: none; }

.chat-skill-editor-card {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 24px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(22, 22, 26, 0.98);
}

.chat-skill-editor-card h2 {
  margin-bottom: 6px;
  font-size: 20px;
  font-weight: 600;
}

.chat-skill-editor-card > p {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 16px;
}

.chat-skill-editor-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  color: #d2d2d7;
  font-size: 12px;
  font-weight: 600;
}

.chat-skill-editor-card input,
.chat-skill-editor-card textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font: 400 14px/1.45 var(--font-main);
  padding: 10px 12px;
}

.chat-skill-editor-card textarea {
  min-height: 180px;
  resize: vertical;
}

.chat-skill-editor-error {
  color: #ff8a8a;
  font-size: 12px;
  margin: 0 0 10px;
}

.chat-skill-editor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.chat-skill-editor-spacer { flex: 1; }

.chat-skill-ghost,
.chat-skill-save,
.chat-skill-danger {
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: #f5f5f7;
  font: 600 13px/1 var(--font-main);
  cursor: pointer;
}

.chat-skill-save {
  background: #f5f5f7;
  color: #111;
  border-color: transparent;
}

.chat-skill-danger {
  color: #ff8a8a;
  border-color: rgba(255, 138, 138, 0.28);
}

.chat-messages {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-bottom: 18px;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 100%;
  user-select: text;
}

.chat-msg.user {
  align-items: flex-end;
}

.chat-msg.assistant {
  align-items: flex-start;
}

.chat-bubble {
  min-width: 0;
  max-width: 100%;
  color: #ececf1;
  font-size: 15.5px;
  line-height: 1.7;
  unicode-bidi: isolate;
  text-align: start;
}

.chat-msg.user .chat-bubble {
  max-width: min(100%, 560px);
  padding: 10px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-msg.assistant .chat-bubble {
  width: 100%;
}

.chat-bubble[dir="rtl"] {
  direction: rtl;
}

.chat-bubble[dir="ltr"] {
  direction: ltr;
}

.chat-bubble p { margin: 0 0 0.8em; }
.chat-bubble p:last-child { margin-bottom: 0; }
.chat-bubble ul, .chat-bubble ol {
  margin: 0 0 0.8em;
  padding-inline-start: 1.3em;
}
.chat-bubble code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  padding: 0.12em 0.35em;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
}
.chat-bubble pre {
  margin: 0 0 0.8em;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  overflow-x: auto;
  direction: ltr;
  unicode-bidi: isolate;
  text-align: left;
}
.chat-bubble pre code {
  padding: 0;
  background: none;
}
.chat-bubble a { color: #7dc4ff; }

.chat-msg-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.chat-msg.user .chat-msg-actions { justify-content: flex-end; }
.chat-msg.assistant .chat-msg-actions { justify-content: flex-start; }

.chat-msg-model {
  margin-inline-start: 8px;
  color: #6e6e73;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(280px, 52vw);
  user-select: text;
}

.chat-act {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #6e6e73;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.chat-act svg {
  width: 15px;
  height: 15px;
}

.chat-act:hover {
  color: #d2d2d7;
  background: rgba(255, 255, 255, 0.06);
}

.chat-act.is-copied {
  color: #7ddea5;
}

.chat-edit-card {
  width: min(100%, 560px);
  padding: 10px 10px 8px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-edit-input {
  display: block;
  width: 100%;
  min-height: 72px;
  max-height: 240px;
  margin: 0;
  padding: 4px 6px 10px;
  border: 0 !important;
  outline: 0 !important;
  resize: vertical;
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  color: #f5f5f7;
  font: 400 15.5px/1.5 var(--font-main);
  text-align: start;
  unicode-bidi: isolate;
}

.chat-edit-input:focus,
.chat-edit-input:focus-visible {
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  background-color: transparent !important;
}

.chat-edit-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.chat-edit-card .chat-model-btn {
  min-width: 0;
}

.chat-msg-meta {
  margin-top: 6px;
  color: #6e6e73;
  font-size: 11px;
}

.chat-typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding-top: 4px;
}

.chat-typing-label {
  margin-inline-end: 8px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #8e8e93;
  background: linear-gradient(
    105deg,
    #6e6e73 0%,
    #6e6e73 38%,
    #f5f5f7 50%,
    #6e6e73 62%,
    #6e6e73 100%
  );
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: chat-think-shine 1.7s ease-in-out infinite;
}

.chat-typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8e8e93;
  animation: chat-dot 1s infinite ease-in-out;
}

.chat-typing i:nth-of-type(1) { animation-delay: 0s; }
.chat-typing i:nth-of-type(2) { animation-delay: 0.15s; }
.chat-typing i:nth-of-type(3) { animation-delay: 0.3s; }

@keyframes chat-think-shine {
  0% { background-position: 120% 0; }
  100% { background-position: -20% 0; }
}

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

.chat-msg.is-typing-out .chat-bubble::after {
  content: '▍';
  display: inline;
  margin-inline-start: 1px;
  color: #8e8e93;
  animation: chat-caret 0.9s step-end infinite;
}

@keyframes chat-caret {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.chat-composer-wrap {
  flex: 0 0 auto;
  padding: 0 20px 28px;
}

.chat-composer {
  position: relative;
  max-width: 760px;
  margin: 0 auto;
  padding: 8px;
  cursor: text;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(18, 18, 18, 0.72);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 12px 40px rgba(0, 0, 0, 0.35);
  transition: border-color 0.35s ease, box-shadow 0.35s ease;
  overflow: visible;
}

.chat-composer:focus-within {
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 12px 40px rgba(0, 0, 0, 0.35);
}

.chat-composer-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.chat-composer-input,
.chat-composer-input:hover,
.chat-composer-input:focus,
.chat-composer-input:focus-visible,
.chat-composer-input:active {
  flex: 1;
  width: auto;
  min-width: 0;
  min-height: 24px;
  max-height: 180px;
  height: 24px;
  padding: 0 4px;
  margin: 0;
  border: 0 !important;
  outline: 0 !important;
  resize: none;
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  caret-color: #f5f5f7;
  color: #f5f5f7;
  font: 400 15.5px/24px var(--font-main);
  text-align: start;
  user-select: text;
  overflow-x: hidden;
  overflow-y: hidden;
  -webkit-appearance: none;
  appearance: none;
}

.chat-composer-input::placeholder {
  color: #6e6e73;
}

.chat-composer-input::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.chat-composer.is-multiline .chat-composer-input::-webkit-scrollbar {
  width: 8px;
}

.chat-composer-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.chat-plus-btn,
.chat-expand-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #8e8e93;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.chat-plus-btn svg,
.chat-expand-btn svg {
  width: 18px;
  height: 18px;
}

.chat-plus-btn:hover,
.chat-expand-btn:hover {
  color: #f5f5f7;
  background: rgba(255, 255, 255, 0.08);
}

.chat-expand-btn {
  display: none;
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 2;
}

.chat-expand-btn[hidden] {
  display: none !important;
}

.chat-collapse-icon {
  display: none;
}

.chat-model-btn.smp-trigger {
  max-width: none;
  height: 36px;
  padding: 0 6px 0 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #f5f5f7;
  font: 500 13px/1 var(--font-main);
  cursor: pointer;
  gap: 6px;
  box-shadow: none;
}

.chat-model-btn .smp-trigger-name {
  max-width: 9.5em;
}

.chat-model-btn svg {
  width: 12px;
  height: 12px;
  opacity: 0.55;
}

.chat-model-btn:hover {
  background: transparent;
  color: #fff;
}

.chat-credit-inline {
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: #8e8e93;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1;
}

.chat-send-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: transparent;
  color: #6e6e73;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.22s ease, color 0.22s ease, border-color 0.22s ease, transform 0.22s ease;
}

.chat-send-btn svg {
  width: 16px;
  height: 16px;
}

.chat-send-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.28);
  transform: scale(1.06);
}

.chat-send-btn.is-ready {
  background: #f5f5f7;
  color: #111;
  border-color: #f5f5f7;
}

.chat-send-btn.is-ready:hover {
  background: #fff;
  color: #111;
  transform: scale(1.08);
}

.chat-send-btn:disabled {
  cursor: default;
  transform: none;
}

.chat-composer.is-multiline {
  padding: 10px 10px 8px;
}

.chat-composer.is-multiline .chat-composer-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas:
    "input input input"
    "plus . actions";
  align-items: center;
  column-gap: 4px;
  row-gap: 2px;
}

.chat-composer.is-multiline .chat-composer-input {
  grid-area: input;
  width: 100%;
  padding: 8px 40px 10px 8px;
  line-height: 1.45;
}

.chat-composer.is-multiline .chat-plus-btn {
  grid-area: plus;
}

.chat-composer.is-multiline .chat-composer-actions {
  grid-area: actions;
}

.chat-composer.is-multiline .chat-expand-btn {
  display: grid;
}

.chat-composer.is-expanded .chat-expand-icon {
  display: none;
}

.chat-composer.is-expanded .chat-collapse-icon {
  display: block;
}

.chat-composer.is-expanded .chat-composer-input {
  min-height: min(52vh, 420px);
  max-height: min(62vh, 560px);
}

.chat-attach-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 10px;
}

.chat-attach-row[hidden] {
  display: none !important;
}

.chat-attach-thumb {
  position: relative;
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
}

.chat-attach-row .chat-attach-thumb {
  overflow: visible;
}

.chat-attach-row .chat-attach-thumb img,
.chat-attach-row .chat-attach-icon {
  border-radius: 10px;
}

.chat-attach-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-attach-icon {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: #d2d2d7;
}

.chat-attach-icon svg {
  width: 22px;
  height: 22px;
}

.chat-attach-thumb.is-uploading {
  opacity: 0.55;
}

.chat-attach-remove {
  position: absolute;
  top: -5px;
  right: -5px;
  z-index: 2;
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(8, 8, 8, 0.86);
  color: #f5f5f7;
  opacity: 1;
  cursor: pointer;
  line-height: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transform: none;
}

.chat-attach-remove svg {
  display: block;
  width: 8px;
  height: 8px;
}

.chat-attach-remove:hover {
  background: rgba(255, 71, 87, 0.9);
  color: #fff;
  transform: none;
  box-shadow: none;
}

.chat-composer.has-files:not(.is-expanded) .chat-composer-input {
  min-height: 48px;
}

.chat-msg-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.chat-msg-files .chat-attach-thumb {
  width: 44px;
  height: 44px;
  flex-basis: 44px;
}

.chat-msg.user .chat-msg-files .chat-attach-thumb {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
}

.chat-composer-error {
  max-width: 760px;
  margin: 0 auto 8px;
  text-align: center;
  color: #ff4d5a;
  font-size: 13px;
  font-weight: 550;
  line-height: 1.4;
  opacity: 1;
  transition: opacity 0.4s ease;
}

.chat-composer-error[hidden] {
  display: none !important;
}

.chat-composer-error.is-fading {
  opacity: 0;
}

.chat-composer.is-drop-target {
  border-color: rgba(255, 255, 255, 0.38);
}

.chat-composer-status {
  max-width: 760px;
  min-height: 0;
  margin: 6px auto 0;
  text-align: center;
  color: #8e8e93;
  font-size: 12px;
}

.chat-composer-status:empty {
  display: none;
}

.chat-signin {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
}

.chat-signin[hidden] { display: none; }

.chat-signin-card {
  width: min(420px, calc(100vw - 32px));
  padding: 28px 26px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(22, 22, 26, 0.96);
  text-align: center;
}

.chat-signin-card h2 {
  margin-bottom: 8px;
  font-weight: 600;
}

.chat-signin-card p {
  color: var(--text-muted);
  margin-bottom: 18px;
}

.chat-signin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 160px;
  height: 42px;
  padding: 0 18px;
  border: none;
  border-radius: 12px;
  background: #f5f5f7;
  color: #111;
  text-decoration: none;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 860px) {
  .chat-shell { grid-template-columns: 1fr; }
  .chat-sidebar {
    position: absolute;
    inset: 0 auto 0 0;
    width: min(280px, 86vw);
    z-index: 20;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    background: #080808c4;
    box-shadow: 18px 0 40px rgba(0, 0, 0, 0.35);
  }
  body.chat-sidebar-open .chat-sidebar { transform: none; }
  .chat-sidebar-toggle { display: grid; place-items: center; }
  .chat-thread,
  .chat-skills-panel { padding-top: 56px; }
}
