:root {
  color-scheme: light;
  --bg: #f7f7f8;
  --bg-soft: #ffffff;
  --panel: #ffffff;
  --panel-border: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --accent: #111827;
  --accent-strong: #1f2937;
  --danger: #dc2626;
  --shadow: 0 4px 20px rgba(17, 24, 39, 0.05);
  --radius: 20px;
  --radius-sm: 14px;
  --font-sans: "Inter", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
  margin: 0;
  background: #f7f7f8;
  color: var(--text);
  font-family: var(--font-sans);
}

body {
  min-height: 100vh;
}

button,
textarea {
  font: inherit;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 56px;
}

.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
  padding: 14px 18px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: rgba(8, 15, 31, 0.72);
  backdrop-filter: blur(18px);
}

.brand-mark {
  font-weight: 800;
  letter-spacing: 0.05em;
}

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

.nav-links a {
  color: var(--text);
  text-decoration: none;
  border: 1px solid rgba(153, 179, 255, 0.16);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
}

.hero {
  display: grid;
  grid-template-columns: 1.6fr 0.9fr;
  gap: 20px;
  align-items: stretch;
  margin-bottom: 20px;
}

.hero-copy,
.status-card,
.panel {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.hero-copy {
  border-radius: calc(var(--radius) + 8px);
  padding: 30px;
}

.hero.compact .hero-copy {
  padding-bottom: 24px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.3rem, 4vw, 4.3rem);
  line-height: 0.95;
  max-width: 10ch;
}

.lede {
  margin: 18px 0 0;
  max-width: 60ch;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.status-card {
  border-radius: calc(var(--radius) + 8px);
  padding: 26px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.status-card span {
  color: var(--muted);
  font-size: 0.92rem;
}

.status-card strong {
  font-size: 1.35rem;
}

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

.form-grid label {
  display: grid;
  gap: 8px;
}

.form-grid span,
.form-grid small {
  color: var(--muted);
}

.form-grid input,
.form-grid select {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(153, 179, 255, 0.18);
  background: rgba(5, 10, 25, 0.88);
  color: var(--text);
  padding: 12px 14px;
  outline: none;
}

.form-grid input:focus,
.form-grid select:focus {
  border-color: rgba(124, 240, 198, 0.42);
  box-shadow: 0 0 0 4px rgba(124, 240, 198, 0.08);
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
}

.form-actions button {
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #062017;
  font-weight: 700;
  cursor: pointer;
}

.skills-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
}

.skills-list-panel h2,
.skill-detail-panel h2 {
  margin-top: 0;
}

.skills-list {
  display: grid;
  gap: 10px;
}

.skills-list button {
  border: 1px solid rgba(153, 179, 255, 0.16);
  background: rgba(5, 10, 25, 0.8);
  color: var(--text);
  border-radius: 16px;
  padding: 14px;
  text-align: left;
  cursor: pointer;
  display: grid;
  gap: 4px;
}

.skills-list button.active {
  border-color: rgba(124, 240, 198, 0.42);
  background: rgba(124, 240, 198, 0.08);
}

.skills-list small,
.skill-detail-header code {
  color: var(--muted);
  font-size: 0.82rem;
  word-break: break-all;
}

.skill-detail-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.markdown-body {
  display: grid;
  gap: 14px;
  line-height: 1.7;
  overflow-x: auto;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  margin: 0;
}

.markdown-body p,
.markdown-body ul {
  margin: 0;
  color: var(--text);
}

.markdown-body ul {
  padding-left: 20px;
}

.markdown-body code {
  padding: 0.15rem 0.35rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.markdown-empty {
  color: var(--muted);
}

.panel {
  border-radius: calc(var(--radius) + 8px);
  padding: 18px;
}

.chat-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
}

.minimal-chat {
  width: min(980px, calc(100% - 28px));
  padding-top: 20px;
  padding-bottom: 20px;
}

.minimal-chat .top-nav {
  margin-bottom: 10px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  backdrop-filter: none;
  box-shadow: none;
}

.chat-panel {
  display: grid;
  grid-template-rows: 1fr auto auto;
  min-height: calc(100vh - 110px);
  padding: 14px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  box-shadow: none;
}

.nav-action {
  color: #111827;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  padding: 8px 12px;
  background: #ffffff;
  cursor: pointer;
}

.examples {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.examples button {
  border: 1px solid rgba(124, 240, 198, 0.24);
  background: rgba(124, 240, 198, 0.08);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.examples button:hover {
  transform: translateY(-1px);
  border-color: rgba(124, 240, 198, 0.42);
  background: rgba(124, 240, 198, 0.14);
}

.chat-log {
  display: grid;
  gap: 12px;
  padding: 6px 2px 16px;
  overflow: auto;
}

.empty-state {
  border: 1px dashed #d1d5db;
  border-radius: var(--radius);
  padding: 28px;
  color: #6b7280;
  background: #fafafa;
}

.empty-state h2 {
  margin: 0 0 8px;
  color: #111827;
}

.bubble {
  border-radius: 14px;
  padding: 12px 14px;
  border: 1px solid #e5e7eb;
  max-width: 92%;
}

.bubble header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  color: #6b7280;
  margin-bottom: 10px;
  font-size: 0.88rem;
}

.bubble p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.65;
  color: #111827;
}

.bubble.user {
  margin-left: auto;
  background: #f3f4f6;
}

.bubble.assistant {
  margin-right: auto;
  background: #ffffff;
}

.route-pill {
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  padding: 4px 8px;
  font-size: 0.76rem;
  color: #6b7280;
}

.file-chip-row {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  padding: 4px 9px;
  background: #ffffff;
  color: #374151;
  font-size: 13px;
  line-height: 1.4;
}

.workflow-card {
  margin-top: 12px;
  border: 1px solid rgba(153, 179, 255, 0.2);
  border-radius: 14px;
  background: rgba(9, 16, 34, 0.72);
  padding: 12px;
  display: grid;
  gap: 10px;
  overflow-x: hidden;
}

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

.workflow-status {
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 0.78rem;
  border: 1px solid rgba(153, 179, 255, 0.22);
  color: var(--muted);
}

.workflow-status-success {
  border-color: rgba(124, 240, 198, 0.35);
  color: var(--accent);
}

.workflow-status-partial_success {
  border-color: rgba(255, 219, 128, 0.36);
  color: #ffd57d;
}

.workflow-status-failed {
  border-color: rgba(255, 142, 142, 0.36);
  color: var(--danger);
}

.workflow-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.workflow-step p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.workflow-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.workflow-step {
  border: 1px solid rgba(153, 179, 255, 0.16);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  gap: 6px;
  max-width: 100%;
  overflow: hidden;
}

.workflow-step-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.86rem;
}

.workflow-step-top code {
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.workflow-step-meta {
  display: flex;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

.workflow-step p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.workflow-step-warning {
  border-color: rgba(255, 219, 128, 0.28);
}

.workflow-step-error {
  border-color: rgba(255, 142, 142, 0.34);
}

.workflow-step-error p {
  color: #ffb5b5;
}

.workflow-step .workflow-step-error {
  color: var(--danger);
}

.artifacts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.artifact-card {
  display: grid;
  gap: 8px;
}

.artifact-preview {
  display: block;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(124, 240, 198, 0.24);
  background: rgba(124, 240, 198, 0.06);
}

.artifact-preview img {
  display: block;
  width: 100%;
  height: 140px;
  object-fit: cover;
}

.artifact-meta {
  display: grid;
  gap: 4px;
}

.artifact-meta strong {
  font-size: 0.92rem;
}

.artifact-meta span {
  color: var(--muted);
  font-size: 0.82rem;
  word-break: break-all;
}

.artifacts a,
.error-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 0.85rem;
}

.artifacts a {
  text-decoration: none;
  color: var(--text);
  border: 1px solid rgba(124, 240, 198, 0.28);
  background: rgba(124, 240, 198, 0.08);
}

.error-pill {
  margin-top: 12px;
  background: rgba(255, 142, 142, 0.12);
  color: var(--danger);
  border: 1px solid rgba(255, 142, 142, 0.2);
}

.composer {
  display: grid;
  gap: 12px;
}

.chat-composer {
  grid-template-columns: auto 1fr auto;
  align-items: end;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid #e5e7eb;
}

.hidden-file-input {
  display: none;
}

.upload-btn {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #374151;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.composer textarea {
  width: 100%;
  border-radius: 20px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  padding: 14px 16px;
  resize: vertical;
  min-height: 96px;
  outline: none;
}

.composer textarea:focus {
  border-color: #9ca3af;
  box-shadow: 0 0 0 4px rgba(107, 114, 128, 0.08);
}

.send-btn {
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  background: #111827;
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.send-btn:disabled,
.upload-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.composer-error {
  color: var(--danger);
  font-size: 0.88rem;
}

.composer-footnote {
  margin-top: 2px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: #6b7280;
  font-size: 0.78rem;
}

.chat-empty {
  text-align: center;
  max-width: 760px;
  margin: auto;
}

.chat-empty h2 {
  font-size: 1.7rem;
  margin-bottom: 12px;
}

.composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
}

.composer-actions button {
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #062017;
  font-weight: 700;
  cursor: pointer;
}

.composer-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.drop-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(17, 24, 39, 0.4);
  border: 2px dashed #111827;
  color: #111827;
  font-size: 1.2rem;
  z-index: 999;
}

.minimal-chat .brand-mark {
  color: #111827;
  letter-spacing: 0.01em;
}

.minimal-chat .nav-links a {
  color: #374151;
  border: 1px solid #e5e7eb;
  background: #ffffff;
}

.gpt-like {
  background: #f7f7f8;
}

.gpt-like .gpt-top-nav {
  padding: 10px 12px;
}

.gpt-like .gpt-nav-links {
  gap: 6px;
}

.gpt-like .gpt-nav-links a,
.gpt-like .gpt-nav-links .nav-action {
  font-size: 0.82rem;
  padding: 6px 10px;
}

.gpt-like .gpt-chat-panel {
  padding: 0;
  border: none;
  background: transparent;
  min-height: calc(100vh - 86px);
}

.gpt-like .gpt-chat-log {
  padding: 12px 0 150px;
  gap: 16px;
}

.gpt-like .gpt-empty {
  min-height: calc(100vh - 280px);
}

.gpt-like .gpt-bubble {
  max-width: 760px;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
}

.gpt-like .gpt-bubble.assistant {
  margin-right: auto;
  background: #ffffff;
}

.gpt-like .gpt-bubble.user {
  margin-left: auto;
  background: #f3f4f6;
}

.gpt-like .gpt-route {
  margin-top: 8px;
  color: #9ca3af;
  font-size: 0.72rem;
}

.gpt-like .gpt-composer-wrap {
  position: sticky;
  bottom: 0;
  padding: 10px 0 12px;
  background: linear-gradient(
    to top,
    rgba(247, 247, 248, 1) 68%,
    rgba(247, 247, 248, 0.7) 84%,
    rgba(247, 247, 248, 0)
  );
}

.gpt-like .gpt-composer {
  border: 1px solid #d1d5db;
  border-radius: 16px;
  padding: 8px;
  background: #ffffff;
  gap: 8px;
  border-top: 1px solid #d1d5db;
}

.gpt-like .gpt-composer textarea {
  border: none;
  box-shadow: none;
  resize: none;
  min-height: 56px;
  padding: 8px 8px;
}

.gpt-like .gpt-composer textarea:focus {
  border: none;
  box-shadow: none;
}

.gpt-like .gpt-upload-btn {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
}

.gpt-like .gpt-send-btn {
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: #111827;
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .skills-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 20px, 1120px);
    padding-top: 20px;
  }

  .hero-copy,
  .status-card,
  .panel {
    border-radius: 18px;
  }

  .hero-copy {
    padding: 22px;
  }

  .panel {
    padding: 14px;
  }

  .top-nav {
    border-radius: 20px;
    align-items: start;
    flex-direction: column;
  }

  .chat-composer {
    grid-template-columns: 1fr;
  }

  .upload-btn,
  .send-btn {
    width: 100%;
  }

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

  .skill-detail-header {
    flex-direction: column;
  }
}

/* ChatGPT-like app shell */
.app-shell {
  height: 100vh;
  min-height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  background: #f7f7f8;
}

.chat-sidebar {
  height: 100vh;
  overflow: hidden;
  border-right: 1px solid #e5e7eb;
  background: #f3f4f6;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.model-picker {
  position: relative;
}

.model-button {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #ffffff;
  color: #111827;
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  cursor: pointer;
}

.model-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 10px 26px rgba(17, 24, 39, 0.12);
  padding: 8px;
  display: grid;
  gap: 6px;
}

.model-menu-title {
  margin: 0;
  color: #6b7280;
  font-size: 0.78rem;
  padding: 4px 6px;
}

.model-option {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #ffffff;
  color: #111827;
  padding: 8px;
  text-align: left;
  display: grid;
  gap: 3px;
  cursor: pointer;
}

.model-option span {
  color: #6b7280;
  font-size: 0.74rem;
}

.model-settings-link {
  color: #374151;
  text-decoration: none;
  border-top: 1px solid #f3f4f6;
  padding: 8px 6px 4px;
  font-size: 0.82rem;
}

.new-chat-btn {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #ffffff;
  color: #111827;
  padding: 9px 12px;
  text-align: left;
  cursor: pointer;
}

.session-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 6px;
}

.session-list p {
  margin: 0;
  color: #6b7280;
  font-size: 0.8rem;
  padding: 4px 2px;
}

.session-item {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #ffffff;
  color: #374151;
  text-align: left;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 0.84rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-item.active {
  border-color: #d1d5db;
  color: #111827;
  font-weight: 600;
}

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

.sidebar-bottom a {
  color: #374151;
  text-decoration: none;
  font-size: 13px;
  line-height: 1.5;
  display: block;
}

.sidebar-bottom small {
  color: #6b7280;
  font-size: 13px;
  line-height: 1.5;
  display: block;
}

/* Hide any floating avatar/icon that might block Settings */
.sidebar-avatar,
.user-avatar,
.profile-avatar,
.floating-avatar,
.avatar-n,
[class*="avatar"],
[class*="profile"] {
  display: none !important;
}

.chat-main {
  height: 100vh;
  min-height: 0;
  display: grid;
  grid-template-rows: 48px minmax(0, 1fr) auto;
  background: #f7f7f8;
  overflow: hidden;
}

.chat-main-header {
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  font-weight: 600;
  color: #111827;
}

.chat-main .chat-log {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
}

/* Hide scrollbar but keep functionality */
.chat-main .chat-log::-webkit-scrollbar,
.messages-inner::-webkit-scrollbar {
  display: none;
}

.chat-main .chat-log,
.messages-inner {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.messages-inner {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 24px 0 150px;
}

.chat-empty-state {
  margin: auto;
  text-align: center;
  color: #6b7280;
  padding-top: 80px;
}

.chat-empty-state h2 {
  color: #111827;
  margin: 0 0 8px;
  font-size: 1.8rem;
}

.chat-empty-state p {
  margin: 0;
}

.message-row {
  display: flex;
  width: 100%;
  margin: 16px 0;
}

.message-row.user {
  justify-content: flex-end;
}

.message-row.assistant {
  justify-content: flex-start;
}

/* User bubble - ChatGPT style */
.user-bubble {
  display: inline-block;
  width: auto;
  max-width: min(72%, 680px);
  background: #ececec;
  color: #111827;
  border-radius: 18px;
  padding: 10px 14px;
  line-height: 1.55;
}

.user-bubble p {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.user-bubble .file-chip-row {
  margin-top: 8px;
}

/* Assistant message - subtle background like ChatGPT */
.assistant-message {
  max-width: 760px;
  width: 100%;
  background: #fafafa;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px 14px;
  color: #111827;
  line-height: 1.75;
}

.assistant-message p {
  margin: 0 0 10px;
}

.assistant-message-live {
  display: grid;
  gap: 12px;
}

.qc-live-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.qc-live-badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(15, 23, 42, 0.08);
  color: #334155;
  font-size: 12px;
}

.progress-card {
  display: grid;
  gap: 8px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.progress-bar > div {
  height: 100%;
  background: #111827;
  transition: width 0.3s ease;
}

.assistant-stack {
  width: 100%;
  max-width: 760px;
  display: grid;
  gap: 10px;
}

.qc-live-stack {
  position: relative;
  height: 150px;
  margin: 18px 0 8px;
  isolation: isolate;
}

.qc-live-card {
  position: absolute;
  left: 0;
  right: 0;
  min-height: 96px;
  border-radius: 22px;
  padding: 20px 22px;
  background: rgba(17, 24, 39, 0.94);
  color: #ffffff;
  box-shadow:
    0 20px 45px rgba(15, 23, 42, 0.22),
    0 8px 24px rgba(15, 23, 42, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  transition:
    transform 480ms cubic-bezier(0.2, 0.9, 0.2, 1),
    opacity 480ms ease,
    filter 480ms ease,
    background 480ms ease;
  will-change: transform, opacity, filter;
}

.qc-live-card[data-index="0"] {
  transform: translateY(0) scale(1);
  opacity: 1;
  z-index: 4;
  filter: blur(0);
  animation: qcCardIn 260ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.qc-live-card[data-index="1"] {
  transform: translateY(30px) scale(0.972);
  opacity: 0.28;
  z-index: 3;
  filter: blur(1px);
  background: rgba(17, 24, 39, 0.56);
}

.qc-live-card[data-index="2"] {
  transform: translateY(56px) scale(0.945);
  opacity: 0.14;
  z-index: 2;
  filter: blur(2px);
  background: rgba(17, 24, 39, 0.38);
}

.qc-live-card[data-index="3"] {
  transform: translateY(78px) scale(0.92);
  opacity: 0.06;
  z-index: 1;
  filter: blur(3px);
  background: rgba(17, 24, 39, 0.24);
}

.qc-live-card-title {
  font-size: 16px;
  font-weight: 750;
  line-height: 1.35;
  letter-spacing: -0.01em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.qc-live-card-detail {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.68);
  max-height: 42px;
  overflow: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.qc-live-card-footer {
  margin-top: 12px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.48);
}

@keyframes qcCardIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.975);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.artifact-message-card {
  position: relative;
  width: 100%;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
}

.artifact-image-link {
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: zoom-in;
}

.artifact-image-link img {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  background: #ffffff;
}

.artifact-file-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  border-bottom: 1px solid #e5e7eb;
  color: #111827;
  background: #ffffff;
  font-weight: 600;
}

.artifact-file-icon {
  font-size: 20px;
}

.artifact-card-footer {
  padding: 10px 12px;
  display: grid;
  gap: 8px;
}

.artifact-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  word-break: break-all;
}

.artifact-card-path {
  font-size: 12px;
  color: #6b7280;
  word-break: break-all;
}

.artifact-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.artifact-card-actions button {
  border: 1px solid #d1d5db;
  border-radius: 999px;
  background: #ffffff;
  color: #111827;
  padding: 6px 12px;
  font-size: 14px;
  cursor: pointer;
}

.artifact-card-actions button:hover {
  background: #f3f4f6;
}

.copy-toast {
  position: absolute;
  right: 18px;
  bottom: 18px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #111827;
  color: #ffffff;
  font-size: 12px;
  box-shadow: 0 6px 18px rgba(17, 24, 39, 0.18);
}

.pending-text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dot-wave {
  display: inline-flex;
  gap: 4px;
}

.dot-wave i {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: #6b7280;
  animation: dot-wave 1.2s infinite ease-in-out;
}

.dot-wave i:nth-child(2) {
  animation-delay: 0.15s;
}

.dot-wave i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes dot-wave {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: scale(0.9);
  }
  40% {
    opacity: 1;
    transform: scale(1);
  }
}

.route-meta {
  margin-top: 6px;
  color: #9ca3af;
  font-size: 0.72rem;
}

.composer-shell {
  flex-shrink: 0;
  width: min(920px, calc(100% - 48px));
  margin: 0 auto 18px;
  padding: 12px 0 20px;
  background: linear-gradient(
    to top,
    rgba(247, 247, 248, 1) 72%,
    rgba(247, 247, 248, 0.78) 88%,
    rgba(247, 247, 248, 0)
  );
}

.chat-composer {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid #d1d5db;
  border-radius: 24px;
  background: #ffffff;
  padding: 10px;
}

.hidden-file-input {
  display: none;
}

.composer-input-row {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.upload-btn {
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat-composer textarea {
  width: 100%;
  min-height: 40px;
  max-height: 160px;
  padding: 8px 6px;
  border: none;
  outline: none;
  resize: none;
  overflow: hidden;
  background: transparent;
  color: #111827;
  font-size: 16px;
  font: inherit;
  line-height: 1.5;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.chat-composer textarea::-webkit-scrollbar {
  display: none;
}

.chat-composer textarea:focus {
  border: none;
  box-shadow: none;
}

.send-btn {
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  border-radius: 999px;
  border: none;
  background: #111827;
  color: #ffffff;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
}

.send-btn:disabled,
.upload-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.composer-error {
  margin: 8px 0 0;
  color: #dc2626;
  font-size: 0.84rem;
}

.markdown-body table {
  width: max-content;
  max-width: 100%;
  border-collapse: collapse;
  display: block;
  overflow-x: auto;
  white-space: nowrap;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid #e5e7eb;
  padding: 8px 10px;
  text-align: left;
}

.markdown-body th {
  background: #f9fafb;
  font-weight: 700;
}

.markdown-image {
  max-width: min(100%, 720px);
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  margin-top: 6px;
}

.drop-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(17, 24, 39, 0.26);
  color: #111827;
  border: 2px dashed #111827;
  font-size: 1.2rem;
  z-index: 999;
}

.attachment-preview-row {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 4px 2px 4px;
  margin: 0;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  background: #ffffff;
  padding: 6px 10px;
  color: #111827;
  font-size: 14px;
}

.attachment-chip-name {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.attachment-chip-kind {
  color: #9ca3af;
  font-size: 13px;
}

.attachment-chip-status {
  color: #9ca3af;
  font-size: 13px;
}

.attachment-chip-status.failed {
  color: #dc2626;
}

.attachment-chip-remove {
  border: none;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0;
}

.attachment-card {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #ffffff;
  padding: 6px 10px;
  font-size: 13px;
}

.msg-attach-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.msg-attach-card {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #ffffff;
  padding: 6px 10px;
  font-size: 13px;
}

.msg-attach-name {
  font-weight: 500;
  color: #111827;
}

.msg-attach-kind {
  color: #6b7280;
  font-size: 12px;
}

@media (max-width: 1024px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .chat-sidebar {
    display: none;
  }

  .chat-main {
    height: 100vh;
  }
}

.settings-shell {
  min-height: 100vh;
  background: #f7f7f8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.settings-card {
  width: min(520px, 100%);
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.06);
}

.settings-header {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.settings-back {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  cursor: pointer;
}

.settings-header h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 650;
}

.settings-header p {
  margin: 4px 0 0;
  color: #6b7280;
  font-size: 14px;
}

.settings-form {
  display: grid;
  gap: 14px;
}

.settings-form label {
  display: grid;
  gap: 6px;
  color: #374151;
  font-size: 14px;
}

.settings-form input,
.settings-form select {
  height: 42px;
  border-radius: 12px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  padding: 0 12px;
  outline: none;
}

.settings-form input:focus,
.settings-form select:focus {
  border-color: #9ca3af;
  box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.12);
}

.settings-submit {
  height: 42px;
  border: none;
  border-radius: 999px;
  background: #111827;
  color: #ffffff;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
}

.settings-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.settings-message {
  margin: 0;
  color: #dc2626;
  font-size: 13px;
}

.settings-detect-btn {
  height: 38px;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  background: #ffffff;
  color: #374151;
  font-size: 14px;
  cursor: pointer;
}

.settings-detect-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.settings-ollama-empty {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #6b7280;
  font-size: 13px;
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(153, 179, 255, 0.16);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.lang-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(153, 179, 255, 0.3);
}

.sidebar-bottom .lang-toggle {
  width: 100%;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #374151;
  font-size: 13px;
  padding: 6px 10px;
  height: auto;
}

.sidebar-bottom .lang-toggle:hover {
  background: #f3f4f6;
}
