:root {
  --ink: #20252f;
  --muted: #687284;
  --line: #d9e0ea;
  --page: #f4f6fa;
  --panel: #ffffff;
  --soft: #eef3f7;
  --teal: #178f88;
  --teal-dark: #0f6762;
  --blue: #3268d6;
  --amber: #bb7a14;
  --green: #3c9c65;
  --charcoal: #202734;
  --shadow: 0 18px 44px rgba(22, 31, 44, 0.09);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, #f8fafc 0%, var(--page) 100%);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

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

button {
  cursor: pointer;
}

.agent-shell {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 42px;
  overflow: hidden;
}

.history-pane {
  position: relative;
  min-width: 0;
  height: 100vh;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px;
  border-right: 1px solid var(--line);
  background: #ffffff;
  overflow: hidden;
}

.history-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.history-brand strong,
.history-brand span {
  display: block;
}

.history-brand strong {
  font-size: 17px;
}

.history-brand .brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.account-actions a {
  color: inherit;
  text-decoration: none;
  font-size: 12px;
  padding: 5px 7px;
  border-radius: 6px;
}

.history-brand span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.new-project {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--teal);
  border-radius: 8px;
  background: var(--teal);
  color: #ffffff;
  font-weight: 800;
}

.history-search input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  outline: none;
  color: var(--ink);
}

.history-search input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(23, 143, 136, 0.12);
}

.history-list {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: grid;
  gap: 4px;
  align-content: start;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.history-list::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.history-scrollbar {
  position: absolute;
  top: 0;
  right: 4px;
  height: 0;
  width: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
}

.history-scrollbar.visible {
  opacity: 1;
}

.history-scrollbar span {
  position: absolute;
  top: 0;
  right: 2px;
  width: 10px;
  min-height: 48px;
  border-radius: 999px;
  background: #d4d8df;
  transform: translateY(0);
  will-change: transform, height;
}

.history-group {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.history-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  padding: 8px 8px 8px 10px;
  text-align: left;
  cursor: pointer;
  position: relative;
}

.history-item:hover,
.history-item.active {
  border-color: transparent;
  background: #f5f7fa;
}

.conv-info {
  flex: 1;
  min-width: 0;
}

.history-item strong,
.history-item em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.history-item em {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

/* Work actions - hidden by default, shown on hover */
.conv-action {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: #8792a2;
  font-size: 13px;
  border-radius: 999px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
}

.history-item:hover .conv-action,
.history-item:focus-within .conv-action {
  opacity: 1;
}

.conv-rename:hover {
  background: #e7f3f0;
  color: var(--v26-teal-dark);
}

.conv-delete:hover {
  background: #eef1f5;
  color: #d43f3a;
}

@media (hover: none) {
  .conv-action {
    opacity: 1;
  }
}

.thumb {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 52% 34%, #f2d8b4 0 9px, transparent 10px),
    linear-gradient(135deg, #263341 0 46%, #178f88 47% 100%);
}

.thumb.box {
  background:
    radial-gradient(circle at 50% 38%, #e8edf5 0 10px, transparent 11px),
    linear-gradient(140deg, #bb7a14 0 42%, #263341 43% 100%);
}

.thumb.building {
  background:
    linear-gradient(90deg, transparent 0 24%, rgba(255, 255, 255, 0.5) 25% 30%, transparent 31%),
    linear-gradient(135deg, #3268d6 0 45%, #dce4ee 46% 100%);
}

.thumb.gear {
  background:
    radial-gradient(circle at center, #ffffff 0 7px, transparent 8px),
    repeating-conic-gradient(from 0deg, #687284 0 14deg, #dce4ee 15deg 28deg);
}

.history-footer {
  display: grid;
  gap: 8px;
  border-top: 1px solid #edf0f4;
  padding: 10px 2px 0;
  background: transparent;
}

.account-row {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.account-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.account-row strong {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.account-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.account-actions button {
  min-height: 30px;
  border: 1px solid #e3e7ee;
  border-radius: 8px;
  background: #ffffff;
  color: #5d6675;
  font-size: 12px;
  font-weight: 600;
}

.account-actions button:hover {
  border-color: #cfd7e3;
  background: #f7f9fc;
  color: var(--ink);
}

.chat-pane {
  min-width: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border-right: 1px solid var(--line);
  background: #ffffff;
  overflow: hidden;
}

.app-header {
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border-bottom: 1px solid #e8ecef;
  background: #ffffff;
}

.header-title {
  font-size: 17px;
  font-weight: 600;
  color: #333;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--charcoal);
  color: #ffffff;
  font-size: 22px;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 17px;
}

.brand span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.icon-button,
.tool-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
}

.conversation {
  padding: 24px 20px;
  overflow-y: auto;
  overflow-x: hidden;
  background: #ffffff;
  /* Hide scrollbar but keep scroll */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}
.conversation::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.conversation.empty {
  display: grid;
  place-items: center;
}

.conversation.empty::before {
  content: "小元在这里等你，描述想做的作品吧";
  color: #999;
  font-size: 14px;
}

.message {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  align-items: flex-start;
}

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

.avatar {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 6px;
  overflow: hidden;
  background: #e8ecef;
}
.message.user .avatar {
  cursor: pointer;
}
.message.user .avatar:hover {
  opacity: 0.8;
}

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

.bubble {
  max-width: min(580px, 78%);
  border-radius: 8px;
  padding: 12px 14px;
  background: #f5f5f5;
  border: 1px solid #e8ecef;
  position: relative;
  box-shadow: none;
}

/* AI bubble tail (left) */
.message.agent .bubble::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 12px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 8px solid #f5f5f5;
}
.message.agent .bubble::after {
  content: '';
  position: absolute;
  left: -9px;
  top: 12px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 8px solid #e8ecef;
}

.message.user .bubble {
  background: #95EC69;
  color: #000;
  border-color: #95EC69;
}

/* User bubble tail (left side, pointing left toward avatar) */
.message.user .bubble::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 12px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 8px solid #95EC69;
}

.bubble p {
  margin: 0;
  line-height: 1.7;
  font-size: 15px;
  word-break: break-word;
}

.typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 58px;
  min-height: 36px;
}

.typing-bubble em {
  color: #687284;
  font-size: 13px;
  font-style: normal;
  line-height: 1;
  margin-right: 4px;
  white-space: nowrap;
}

.typing-bubble span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #999;
  opacity: 0.5;
  animation: typingPulse 1s ease-in-out infinite;
}

.typing-bubble span:nth-of-type(2) {
  animation-delay: 0.15s;
}

.typing-bubble span:nth-of-type(3) {
  animation-delay: 0.3s;
}

.message-meta {
  display: block;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.66);
  font-size: 12px;
  font-weight: 700;
}

.message-images {
  display: grid;
  grid-template-columns: repeat(3, minmax(72px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.message-images img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.generated-images {
  grid-template-columns: minmax(160px, 260px);
}

.generated-images img {
  aspect-ratio: 1;
}

.message-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.message-actions button {
  min-height: 34px;
  border: 1px solid var(--teal);
  border-radius: 8px;
  background: rgba(23, 143, 136, 0.1);
  color: var(--teal-dark);
  padding: 0 12px;
  font-weight: 800;
}

.message-actions button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.next-step-actions {
  padding-top: 12px;
  border-top: 1px solid #e8ecef;
}

.next-step-actions button {
  min-width: 104px;
}

.model-task-card {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.model-task-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.model-task-head strong {
  font-size: 15px;
}

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

.model-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.model-progress-meta strong {
  color: var(--teal-dark);
  font-size: 13px;
}

.model-progress-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8ecef;
}

.model-progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
  transition: width 0.45s ease;
}

.compact-preview {
  height: 230px;
  margin-top: 0;
}

.model-preview-hidden {
  display: none !important;
}

.model-viewer-stage {
  overflow: hidden;
  min-height: 360px;
  border: 1px solid #dce4ea;
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fbfc 0%, #eef4f5 100%);
}

.model-viewer-stage model-viewer {
  display: block;
  width: 100%;
  height: 360px;
  --poster-color: transparent;
}

.model-task-failed {
  border-color: #efb9b9;
}

.model-task-failed [data-model-status] {
  color: #b42318;
}

.compact-preview .model {
  transform: translate(-50%, -55%) scale(0.72) rotateX(-12deg) rotateY(-26deg);
}

.model-task-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.model-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.model-result-actions button {
  min-height: 34px;
  border: 1px solid #d9e0ea;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 700;
}

.model-result-actions button:disabled,
.next-step-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.model-result-actions button:hover {
  border-color: var(--teal);
  color: var(--teal-dark);
}

.print-advice-card {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid #dfe7ed;
  border-radius: 8px;
  background: #fbfcfd;
}

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

.print-advice-head strong {
  font-size: 15px;
}

.print-advice-head span {
  border-radius: 999px;
  background: #e7f6f3;
  color: var(--teal-dark);
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

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

.print-advice-grid div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid #edf1f4;
}

.print-advice-grid span {
  color: var(--muted);
  font-size: 12px;
}

.print-advice-grid strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

.print-advice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.print-advice-actions button {
  min-height: 34px;
  border: 1px solid #d9e0ea;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 700;
}

.print-advice-actions button:hover {
  border-color: var(--teal);
  color: var(--teal-dark);
}

.service-ticket-card {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid #dfe7ed;
  border-radius: 8px;
  background: #ffffff;
}

.service-ticket-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.service-ticket-head div {
  display: grid;
  gap: 3px;
}

.service-ticket-head span {
  color: var(--muted);
  font-size: 12px;
}

.service-ticket-head strong {
  color: var(--ink);
  font-size: 15px;
}

.service-ticket-head em {
  border-radius: 999px;
  background: #e7f6f3;
  color: var(--teal-dark);
  padding: 3px 8px;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}

.service-ticket-body {
  display: grid;
  gap: 6px;
}

.service-ticket-body p {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.55;
}

.service-ticket-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.service-ticket-steps span {
  display: grid;
  min-height: 30px;
  place-items: center;
  border: 1px solid #edf1f4;
  border-radius: 8px;
  background: #f7f9fb;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.service-ticket-steps .done {
  border-color: #c7e8e1;
  background: #e7f6f3;
  color: var(--teal-dark);
}

.service-ticket-actions,
.quote-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.service-ticket-actions button,
.quote-preview-actions button {
  min-height: 34px;
  border: 1px solid #d9e0ea;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 700;
}

.service-ticket-actions button:hover,
.quote-preview-actions button:hover {
  border-color: var(--teal);
  color: var(--teal-dark);
}

.quote-preview-card {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid #dfe7ed;
  border-radius: 8px;
  background: #fbfcfd;
}

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

.quote-preview-head strong {
  font-size: 15px;
}

.quote-preview-head span {
  border-radius: 999px;
  background: #e7f6f3;
  color: var(--teal-dark);
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.quote-preview-card .quote-list {
  margin-top: 0;
}

.quote-preview-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.print-intent-card {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid #dfe7ed;
  border-radius: 8px;
  background: #ffffff;
}

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

.print-intent-head strong {
  font-size: 15px;
}

.print-intent-head span {
  border-radius: 999px;
  background: #e7f6f3;
  color: var(--teal-dark);
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.print-intent-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.print-intent-summary div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  border: 1px solid #edf1f4;
  border-radius: 8px;
  background: #fbfcfd;
}

.print-intent-summary span {
  color: var(--muted);
  font-size: 12px;
}

.print-intent-summary strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

.print-intent-next {
  display: grid;
  gap: 6px;
}

.print-intent-next p {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.55;
}

.print-intent-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.print-intent-steps span {
  display: grid;
  min-height: 30px;
  place-items: center;
  border: 1px solid #edf1f4;
  border-radius: 8px;
  background: #f7f9fb;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.print-intent-steps .done {
  border-color: #c7e8e1;
  background: #e7f6f3;
  color: var(--teal-dark);
}

.quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.quick-actions button,
.preview-actions button,
.quote-card button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 12px;
  font-weight: 700;
}

.agent-plan {
  display: grid;
  grid-template-columns: repeat(5, minmax(92px, 1fr));
  gap: 7px;
  margin-top: 14px;
}

.agent-plan span {
  min-height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.agent-plan .done {
  background: rgba(60, 156, 101, 0.13);
  color: var(--green);
}

.agent-plan .active {
  background: rgba(23, 143, 136, 0.13);
  color: var(--teal);
}

.composer {
  padding: 10px 16px 14px;
  border-top: 1px solid #e8ecef;
  background: #ffffff;
}

.composer-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f5f5f5;
  border-radius: 24px;
  padding: 6px 6px 6px 16px;
  min-height: 48px;
}

.composer-plus {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  font-size: 24px;
  font-weight: 300;
  color: #333;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
}
.composer-plus:hover { color: #000; }

.composer-bar textarea {
  flex: 1;
  min-height: 36px;
  max-height: 120px;
  resize: none;
  border: none;
  background: transparent;
  padding: 8px 0;
  outline: none;
  line-height: 1.5;
  font-size: 15px;
  color: #333;
}
.composer-bar textarea::placeholder {
  color: #999;
}

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

.composer-voice-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: #333;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s;
}
.composer-voice-btn:hover {
  background: #000;
}

.composer-toolbar,
.composer-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.composer-row {
  align-items: flex-end;
  display: none;
}

.language-select,
.model-select {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.language-select select,
.model-select select {
  height: 36px;
  min-width: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 9px;
  outline: none;
}

.language-select select:focus,
.model-select select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(23, 143, 136, 0.12);
}

.upload-hint {
  color: var(--muted);
  font-size: 12px;
}

.composer-row .tool-button {
  flex: 0 0 auto;
  width: 44px;
  min-width: 44px;
  height: 48px;
  padding: 0;
  font-size: 22px;
  font-weight: 500;
  line-height: 1;
}

.mic-button {
  font-size: 18px;
}

.attachment-tray {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.attachment {
  position: relative;
  width: 72px;
  height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--soft);
}

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

.attachment button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 999px;
  background: rgba(32, 37, 47, 0.78);
  color: #ffffff;
  font-size: 12px;
  line-height: 1;
}

.composer textarea {
  width: 100%;
  min-height: 36px;
  max-height: 120px;
  resize: none;
  border: none;
  border-radius: 0;
  padding: 8px 0;
  outline: none;
  line-height: 1.5;
  background: transparent;
  font-size: 15px;
}

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

.send-button,
.primary {
  min-height: 40px;
  border: 1px solid var(--teal);
  border-radius: 8px;
  background: var(--teal);
  color: #ffffff;
  padding: 0 18px;
  font-weight: 800;
}

.result-pane {
  min-width: 0;
  height: 100vh;
  overflow: auto;
  padding: 20px;
  display: grid;
  gap: 14px;
  align-content: start;
  background: var(--page);
}

.result-card,
.mini-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.result-card {
  padding: 18px;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 18px;
}

.status {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  background: rgba(23, 143, 136, 0.13);
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.preview-stage {
  position: relative;
  height: 360px;
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 35%, rgba(50, 104, 214, 0.14), transparent 30%),
    linear-gradient(180deg, #f7f9fc 0%, #e7ecf3 100%);
  perspective: 900px;
}

.grid-floor {
  position: absolute;
  inset: auto 0 0;
  height: 42%;
  background-image:
    linear-gradient(rgba(104, 114, 132, 0.17) 1px, transparent 1px),
    linear-gradient(90deg, rgba(104, 114, 132, 0.17) 1px, transparent 1px);
  background-size: 30px 30px;
  transform: rotateX(62deg) translateY(52px);
  transform-origin: bottom;
}

.model {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 210px;
  height: 250px;
  transform-style: preserve-3d;
  transform: translate(-50%, -53%) rotateX(-12deg) rotateY(-26deg);
  animation: spin 8s linear infinite;
}

.part {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  box-shadow: inset -16px -14px 28px rgba(0, 0, 0, 0.18), 0 18px 30px rgba(22, 31, 44, 0.15);
}

.head {
  top: 26px;
  width: 100px;
  height: 88px;
  border-radius: 44% 44% 38% 38%;
  background: #dce4ee;
}

.ear {
  top: -6px;
  width: 34px;
  height: 88px;
  border-radius: 50% 50% 42% 42%;
  background: #dce4ee;
  transform-origin: bottom center;
}

.ear-left {
  left: 70px;
  transform: rotate(-18deg);
}

.ear-right {
  left: 122px;
  transform: rotate(18deg);
}

.body {
  top: 116px;
  width: 132px;
  height: 104px;
  border-radius: 45% 45% 34% 34%;
  background: linear-gradient(140deg, #dce4ee, #b3c2d4);
}

.base {
  top: 216px;
  width: 176px;
  height: 34px;
  border-radius: 50%;
  background: #263341;
}

.label {
  position: absolute;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
}

.height {
  right: 22px;
  top: 44%;
}

.split {
  left: 22px;
  bottom: 22px;
}

.preview-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.preview-actions .primary {
  padding: 0 10px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.mini-card {
  padding: 14px;
}

.mini-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.mini-card strong {
  display: block;
  margin-top: 6px;
  font-size: 16px;
}

.timeline {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.timeline li {
  position: relative;
  padding-left: 24px;
  color: var(--muted);
  font-size: 14px;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: #ffffff;
}

.timeline .done,
.timeline .active {
  color: var(--ink);
  font-weight: 700;
}

.timeline .done::before {
  border-color: var(--green);
  background: var(--green);
}

.timeline .active::before {
  border-color: var(--teal);
  background: var(--teal);
}

.quote-list {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.quote-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.quote-list div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.quote-list strong {
  color: var(--ink);
}

.guidance-list {
  display: grid;
  gap: 10px;
  margin-top: 15px;
}

.guidance-list p {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 12px;
  color: var(--muted);
  line-height: 1.6;
  font-size: 13px;
}

.guidance-list strong {
  color: var(--ink);
}

@keyframes spin {
  from {
    transform: translate(-50%, -53%) rotateX(-12deg) rotateY(-26deg);
  }
  to {
    transform: translate(-50%, -53%) rotateX(-12deg) rotateY(334deg);
  }
}

@keyframes typingPulse {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  40% {
    transform: translateY(-4px);
    opacity: 0.85;
  }
}

@media (max-width: 980px) {
  .agent-shell {
    grid-template-columns: 1fr;
    height: 100vh;
    min-height: 0;
    overflow: hidden;
  }

  .history-pane {
    height: auto;
    min-height: 0;
    grid-template-rows: auto auto auto;
    overflow: hidden;
  }

  .history-list {
    grid-auto-flow: column;
    grid-auto-columns: minmax(230px, 1fr);
    overflow-x: auto;
    overflow-y: hidden;
  }

  .history-group,
  .history-footer {
    display: none;
  }

  .chat-pane {
    height: 100vh;
    border-right: 0;
  }

  .result-pane {
    height: auto;
  }
}

@media (max-width: 620px) {
  .app-header {
    height: auto;
    padding: 16px;
  }

  .conversation {
    padding: 18px 16px;
  }

  .bubble {
    max-width: 92%;
  }

  .agent-plan,
  .preview-actions,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .composer {
    padding: 12px 16px 16px;
  }

  .composer-toolbar,
  .composer-row {
    align-items: stretch;
    flex-direction: column;
  }

  .language-select,
  .language-select select,
  .model-select,
  .model-select select,
  .send-button {
    width: 100%;
  }

  .composer-row .tool-button {
    width: 100%;
  }

  .upload-hint {
    display: none;
  }

  .result-pane {
    padding: 14px;
  }
}

/* User avatar section in sidebar */
.user-avatar-area {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid #e8ecef;
}

.user-avatar-area .user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  border: 2px solid #e8ecef;
  transition: border-color 0.2s;
}

.user-avatar-area .user-avatar:hover {
  border-color: #178f88;
}

.user-avatar-area .user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-avatar-area .user-name {
  font-size: 14px;
  color: #333;
  font-weight: 600;
}

.avatar-change-hint {
  font-size: 12px;
  color: #999;
}

/* Avatar picker overlay */
.avatar-picker-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.45);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
.avatar-picker-overlay.show {
  display: flex;
}
.avatar-picker {
  background: #fff;
  border-radius: 12px;
  width: auto;
  max-height: 440px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.avatar-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #eee;
  font-size: 15px;
  font-weight: 600;
  color: #333;
}
.avatar-picker-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #888;
  padding: 0 2px;
  line-height: 1;
}
.avatar-picker-close:hover {
  color: #333;
}
.avatar-picker-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 14px;
  padding: 18px 20px;
  justify-content: center;
  overflow-y: auto;
  scrollbar-width: none;
}
.avatar-picker-grid::-webkit-scrollbar { display: none; }
.avatar-picker-item {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s, transform 0.15s;
  flex-shrink: 0;
}
.avatar-picker-item:hover {
  border-color: #95EC69;
  transform: scale(1.1);
}
.avatar-picker-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.avatar-picker-upload {
  background: #f5f5f5;
  border: 2px dashed #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.avatar-picker-upload:hover {
  border-color: #95EC69;
  background: #eefbf0;
}
.avatar-picker-upload span {
  font-size: 36px;
  color: #aaa;
  line-height: 1;
}

/* --------------------------------------------------------------------------
   V2.6 production baseline
   Keep the live workflow and task components, but make the working surface
   follow the approved V2.6 composition instead of the legacy chat layout.
   -------------------------------------------------------------------------- */
:root {
  --v26-page: #f3f6f5;
  --v26-panel: rgba(255, 255, 255, 0.94);
  --v26-ink: #18201f;
  --v26-muted: #74807e;
  --v26-line: #e5ebe8;
  --v26-teal: #167f76;
  --v26-teal-dark: #0d5f59;
  --v26-soft: #e7f3ef;
  --v26-shadow: 0 18px 48px rgba(35, 61, 57, 0.08);
}

html,
body {
  background: var(--v26-page);
  color: var(--v26-ink);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

.agent-shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  width: 100%;
  height: 100vh;
  min-height: 680px;
  overflow: hidden;
  background: var(--v26-page);
}

.history-pane {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  gap: 0;
  min-width: 0;
  padding: 20px 16px 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.9);
  border-right: 1px solid var(--v26-line);
  backdrop-filter: blur(18px);
}

.history-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px 18px;
  border: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  overflow: hidden;
  border: 1px solid rgba(22, 127, 118, 0.14);
  border-radius: 14px;
  background: #edf7f5;
  box-shadow: 0 8px 20px rgba(23, 33, 33, 0.12);
}

.history-brand strong {
  display: block;
  color: var(--v26-ink);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
}

.history-brand .brand-wordmark {
  display: block;
  width: 176px;
  max-width: 100%;
  height: auto;
}

.history-brand span {
  display: block;
  margin-top: 3px;
  color: #88928f;
  font-size: 12px;
  line-height: 1.35;
}

.new-project {
  width: 100%;
  min-height: 42px;
  padding: 10px 14px;
  border: 0;
  border-radius: 11px;
  color: #fff;
  background: var(--v26-teal);
  box-shadow: 0 9px 22px rgba(22, 127, 118, 0.18);
  font-size: 14px;
  font-weight: 700;
}

.new-project:hover {
  background: var(--v26-teal-dark);
  transform: translateY(-1px);
}

.history-search {
  margin: 12px 0 17px;
}

.history-search input {
  width: 100%;
  height: 38px;
  padding: 9px 12px;
  border: 1px solid var(--v26-line);
  border-radius: 10px;
  outline: 0;
  color: var(--v26-ink);
  background: #f8faf9;
  font-size: 13px;
}

.history-search input:focus {
  border-color: rgba(22, 127, 118, 0.45);
  box-shadow: 0 0 0 3px rgba(22, 127, 118, 0.08);
}

.history-list {
  min-height: 0;
  padding: 0;
  overflow: auto;
  scrollbar-width: none;
}

.history-list::-webkit-scrollbar {
  display: none;
}

.history-group-label {
  margin: 14px 8px 7px;
  color: #9aa29f;
  font-size: 11px;
  font-weight: 700;
}

.history-item {
  width: 100%;
  min-height: 53px;
  margin: 0 0 5px;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
}

.history-item:hover {
  background: #f4f7f6;
}

.history-item.active {
  color: var(--v26-teal-dark);
  background: var(--v26-soft);
}

.history-item strong {
  font-size: 13px;
  font-weight: 650;
}

.history-item span {
  margin-top: 4px;
  color: #929b98;
  font-size: 10px;
}

.history-scrollbar {
  display: none;
}

.history-footer {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  margin-top: 12px;
  padding: 12px 4px 2px;
  border-top: 1px solid var(--v26-line);
  background: transparent;
}

.account-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
}

.account-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #394441;
  background: #e9eeed;
  font-size: 16px;
}

.history-footer .account-avatar {
  color: #394441;
  font-size: 16px;
  font-weight: 400;
}

#footerUsername {
  display: block;
  color: var(--v26-ink);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

#userBalance {
  display: block;
  margin-top: 3px;
  color: var(--v26-muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
}

.account-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  white-space: nowrap;
}

.account-actions #redeemBtn,
.account-actions #bindBtn,
.account-actions #logoutBtn,
.account-actions #adminLink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: auto;
  padding: 4px 6px;
  border: 0;
  border-radius: 6px;
  color: #687471;
  background: transparent;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
}

.account-actions #adminLink[hidden] {
  display: none !important;
}

.history-footer.is-admin #redeemBtn,
.history-footer.is-admin #bindBtn {
  display: none;
}

.history-footer.is-admin #footerUsername {
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-actions #redeemBtn:hover,
.account-actions #bindBtn:hover,
.account-actions #logoutBtn:hover,
.account-actions #adminLink:hover {
  border-color: transparent;
  color: var(--v26-teal-dark);
  background: #f0f3f2;
}

.chat-pane {
  display: grid;
  grid-template-rows: 58px minmax(0, 1fr) auto;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
  border: 0;
  background: transparent;
}

.app-header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 0 32px;
  border-bottom: 1px solid rgba(225, 231, 228, 0.88);
  background: rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(16px);
}

.project-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.project-title strong {
  overflow: hidden;
  color: var(--v26-ink);
  font-size: 15px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-title span {
  color: #909a97;
  font-size: 11px;
  white-space: nowrap;
}

.status-pill {
  padding: 6px 10px;
  border: 1px solid #d9ebe5;
  border-radius: 999px;
  color: var(--v26-teal-dark);
  background: #edf7f3;
  font-size: 11px;
  font-weight: 700;
}

.conversation {
  position: relative;
  display: block;
  min-height: 0;
  padding: 28px max(38px, calc((100% - 1080px) / 2)) 62px;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-behavior: smooth;
  background:
    linear-gradient(rgba(46, 91, 83, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(46, 91, 83, 0.028) 1px, transparent 1px),
    radial-gradient(circle at 82% 10%, rgba(143, 209, 184, 0.16), transparent 30%),
    linear-gradient(135deg, #f8faf9 0%, #f3f6f5 48%, #eef4f1 100%);
  background-size: 32px 32px, 32px 32px, auto, auto;
}

.conversation.empty::before {
  width: min(520px, 80%);
  color: #7f8a87;
  font-size: 14px;
  line-height: 1.8;
}

.message {
  position: relative;
  display: block;
  width: min(1080px, 100%);
  margin: 0 auto 22px;
}

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

.message .avatar {
  display: none !important;
}

.message .bubble {
  position: relative;
  width: auto;
  max-width: 760px;
  padding: 14px 17px;
  border: 1px solid rgba(227, 233, 230, 0.9);
  border-radius: 17px 17px 17px 5px;
  color: #28312f;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 30px rgba(44, 70, 65, 0.05);
  line-height: 1.75;
}

.message.user .bubble {
  max-width: 620px;
  border-color: rgba(181, 218, 204, 0.65);
  border-radius: 18px 18px 5px 18px;
  background: rgba(218, 243, 235, 0.92);
  box-shadow: 0 10px 26px rgba(39, 102, 88, 0.08);
}

.message .bubble::before,
.message .bubble::after {
  display: none !important;
}

.message .bubble p {
  margin: 0;
  white-space: pre-wrap;
}

.stage-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 2px 0 12px;
  color: #8a9491;
  font-size: 11px;
}

.stage-line::after {
  content: "";
  flex: 1 1 80px;
  height: 1px;
  background: linear-gradient(90deg, #dbe5e1, transparent);
}

.stage-line strong {
  color: #53605d;
  font-size: 12px;
}

.stage-dot {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid #cfe0da;
  border-radius: 50%;
  color: var(--v26-teal);
  background: #fff;
  box-shadow: 0 5px 15px rgba(41, 81, 73, 0.08);
  font-weight: 800;
}

.concept-result-message .bubble,
.model-result-message .bubble {
  width: 100%;
  max-width: none;
  padding: 0;
  border-radius: 18px;
  box-shadow: var(--v26-shadow);
}

.concept-result-message .bubble {
  display: grid;
  grid-template-columns: minmax(340px, 46%) minmax(0, 1fr);
  min-height: 360px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.96);
}

.concept-result-message .message-images {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-column: 1;
  grid-row: 1;
  gap: 0;
  width: 100%;
  min-height: 360px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 0;
  background: #eaf0ed;
}

.concept-result-message .message-images > * {
  height: 100%;
}

.concept-result-message .message-images img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 360px;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
  object-fit: cover;
}

.concept-copy {
  grid-column: 2;
  grid-row: 1;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: clamp(32px, 4vw, 58px);
}

.concept-eyebrow {
  margin: 0 0 10px;
  color: var(--v26-teal);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.concept-result-message h2 {
  margin: 0 0 12px;
  color: var(--v26-ink);
  font-size: clamp(24px, 2.25vw, 34px);
  font-weight: 750;
  line-height: 1.22;
  letter-spacing: -0.025em;
}

.concept-copy > p {
  margin: 0;
  max-width: 38em;
  color: #65716e;
  font-size: 14px;
  line-height: 1.7;
}

.concept-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 0;
}

.concept-chips span {
  padding: 6px 10px;
  border: 1px solid #dce9e4;
  border-radius: 999px;
  color: #5f6d69;
  background: #f5f9f7;
  font-size: 11px;
}

.concept-result-message .next-step-actions {
  display: flex;
  gap: 9px;
  margin: 28px 0 0;
  padding: 22px 0 0;
  border: 0;
  border-top: 1px solid #edf2f0;
}

.concept-result-message .next-step-actions button {
  min-height: 39px;
  padding: 10px 17px;
  border: 1px solid #cfe2dc;
  border-radius: 10px;
  color: var(--v26-teal-dark);
  background: #fff;
  font-size: 13px;
  font-weight: 700;
}

.concept-result-message .next-step-actions button:last-child {
  border-color: var(--v26-teal);
  color: #fff;
  background: var(--v26-teal);
  box-shadow: 0 8px 18px rgba(22, 127, 118, 0.18);
}

.model-result-message .bubble {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.model-result-message .bubble > p {
  display: none;
}

.model-task-card {
  width: 100%;
  max-width: none;
  overflow: hidden;
  border: 1px solid rgba(221, 229, 225, 0.92);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--v26-shadow);
}

.model-task-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--v26-line);
}

.model-task-head strong {
  color: var(--v26-ink);
  font-size: 16px;
}

.model-task-head [data-model-status] {
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--v26-teal-dark);
  background: var(--v26-soft);
  font-size: 10px;
}

.model-progress-wrap {
  padding: 14px 22px 17px;
  border-bottom: 1px solid var(--v26-line);
}

.model-progress-track {
  height: 7px;
  border-radius: 999px;
  background: #e9efec;
}

.model-progress-track span {
  background: linear-gradient(90deg, #1b9588, #62b7a4);
}

.model-viewer-stage {
  min-height: 500px;
  margin: 0;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at 50% 43%, rgba(255, 255, 255, 0.95), rgba(231, 239, 235, 0.78) 48%, rgba(218, 229, 224, 0.88)),
    linear-gradient(135deg, #edf3f0, #dce8e3);
}

.model-viewer-stage model-viewer {
  width: 100%;
  height: 500px;
}

.model-task-actions {
  justify-content: flex-end;
  gap: 9px;
  padding: 17px 22px;
  border-top: 1px solid var(--v26-line);
}

.model-task-actions button,
.model-task-actions a {
  min-height: 38px;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
}

.model-task-actions a:last-child,
.model-task-actions button:last-child {
  color: #fff;
  background: var(--v26-teal);
}

.model-task-note {
  padding: 0 22px 17px;
  color: var(--v26-muted);
  font-size: 11px;
}

.composer {
  position: relative;
  z-index: 12;
  display: block;
  padding: 12px 28px 18px;
  border: 0;
  background: linear-gradient(180deg, rgba(243, 246, 245, 0), rgba(243, 246, 245, 0.96) 32%);
}

.attachment-tray {
  width: min(1120px, 100%);
  margin: 0 auto 8px;
}

.composer-bar {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: end;
  gap: 6px;
  width: min(1120px, 100%);
  min-height: 56px;
  margin: 0 auto;
  padding: 8px;
  border: 1px solid rgba(217, 226, 222, 0.95);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 16px 44px rgba(36, 66, 60, 0.1);
}

.composer-plus {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 11px;
  color: #75817e;
  background: #f1f4f3;
  font-size: 23px;
}

.composer textarea {
  align-self: center;
  min-height: 38px;
  max-height: 120px;
  padding: 9px 7px 7px;
  border: 0;
  outline: 0;
  color: var(--v26-ink);
  background: transparent;
  font-size: 13px;
  line-height: 1.55;
  resize: none;
}

.composer textarea::placeholder {
  color: #a0a8a5;
}

.composer-actions {
  display: flex;
  align-items: center;
}

.composer-voice-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: #222827;
  box-shadow: 0 7px 16px rgba(20, 30, 28, 0.2);
}

.node-rail {
  position: fixed;
  z-index: 30;
  top: 50%;
  right: 18px;
  display: flex;
  flex-direction: column;
  gap: var(--node-rail-gap, 13px);
  width: auto;
  height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  transform: translateY(-50%);
}

.node-rail a {
  position: relative;
  display: block;
  width: 22px;
  height: 3px;
  padding: 0;
  border: 0;
  background: transparent;
}

.node-rail a span {
  display: block;
  width: 11px;
  height: 1px;
  margin-left: auto;
  border-radius: 999px;
  background: #bdc9c5;
  transition: width 0.2s ease, background 0.2s ease;
}

.node-rail a:hover span,
.node-rail a.active span {
  width: 22px;
  height: 2px;
  background: var(--v26-teal);
}

.node-rail a::before {
  content: attr(data-node);
  position: absolute;
  top: 50%;
  right: 30px;
  width: max-content;
  padding: 5px 8px;
  border-radius: 7px;
  color: #fff;
  background: rgba(32, 44, 41, 0.82);
  font-size: 10px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(4px);
  transition: 0.18s ease;
}

.node-rail a:hover::before {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

@media (max-width: 900px) {
  .agent-shell {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .history-pane {
    padding: 16px 11px;
  }

  .history-brand {
    justify-content: center;
    padding: 0 0 15px;
  }

  .history-brand > div:last-child,
  .history-search,
  .history-list,
  .history-footer,
  .history-scrollbar {
    display: none;
  }

  .new-project {
    min-height: 46px;
    padding: 0;
    overflow: hidden;
    color: transparent;
    font-size: 0;
  }

  .new-project::after {
    content: "+";
    color: #fff;
    font-size: 22px;
  }

  .conversation {
    padding-inline: 24px;
  }

  .concept-result-message .bubble {
    grid-template-columns: 1fr;
  }

  .concept-result-message .message-images {
    grid-column: 1;
    grid-row: 1;
    min-height: 300px;
    max-height: 380px;
  }

  .concept-result-message .message-images img {
    min-height: 300px;
    max-height: 380px;
  }

  .concept-copy {
    grid-column: 1;
    grid-row: 2;
    padding: 28px;
  }

  .concept-eyebrow {
    margin-top: 0;
  }

  .node-rail {
    display: none;
  }
}

@media (max-width: 620px) {
  .agent-shell {
    grid-template-columns: 1fr;
    min-height: 100dvh;
  }

  .history-pane {
    display: none;
  }

  .chat-pane {
    height: 100dvh;
  }

  .app-header {
    padding: 0 16px;
  }

  .project-title span {
    display: none;
  }

  .conversation {
    padding: 20px 14px 42px;
  }

  .message {
    margin-bottom: 16px;
  }

  .message .bubble,
  .message.user .bubble {
    max-width: 92%;
  }

  .concept-result-message .bubble,
  .model-result-message .bubble {
    max-width: 100%;
  }

  .concept-copy {
    padding: 24px 20px;
  }

  .concept-result-message .next-step-actions {
    margin-top: 22px;
    padding-top: 18px;
  }

  .model-viewer-stage,
  .model-viewer-stage model-viewer {
    min-height: 360px;
    height: 360px;
  }

  .composer {
    padding: 10px 12px 12px;
  }
}

/* --------------------------------------------------------------------------
   2D Image Task Card (Task 17)
   -------------------------------------------------------------------------- */
.image-task-card {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

.image-task-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--v26-line);
}

.image-task-head strong {
  color: var(--v26-ink);
  font-size: 15px;
}

.image-task-head [data-image-status] {
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--v26-soft);
  color: var(--v26-teal-dark);
  font-size: 10px;
  font-weight: 700;
}

.image-task-head .image-status-failed [data-image-status],
.image-task-card.image-task-failed [data-image-status] {
  background: #fde8e6;
  color: #b42318;
}

.image-task-head .image-status-succeeded [data-image-status],
.image-task-card.image-task-succeeded [data-image-status] {
  background: #e0f4e8;
  color: var(--green);
}

.image-progress-wrap {
  padding: 12px 18px 14px;
  border-bottom: 1px solid var(--v26-line);
}

.image-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--v26-muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.image-progress-meta strong {
  color: var(--v26-teal-dark);
  font-size: 11px;
  font-weight: 600;
}

.image-progress-bar {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9efec;
}

.image-progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1b9588, #62b7a4);
  transition: width 0.45s ease;
}

/* Indeterminate progress animation (no fake numbers) */
.image-progress-bar.indeterminate {
  position: relative;
}

.image-progress-bar.indeterminate span {
  width: 30% !important;
  animation: imageProgressIndeterminate 1.4s ease-in-out infinite;
}

@keyframes imageProgressIndeterminate {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(380%); }
}

.image-task-note {
  padding: 0 18px 14px;
  color: var(--v26-muted);
  font-size: 11px;
  line-height: 1.6;
  margin: 0;
}

.image-task-meta-row,
.model-task-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 18px 14px;
}

.image-task-meta-row span,
.model-task-meta-row span {
  padding: 3px 7px;
  border-radius: 6px;
  background: #f5f9f7;
  color: var(--v26-muted);
  font-size: 10px;
  font-weight: 600;
}

.image-task-retry {
  display: flex;
  padding: 0 18px 16px;
}

.image-task-retry button {
  min-height: 36px;
  padding: 8px 14px;
  border: 1px solid var(--v26-teal);
  border-radius: 10px;
  color: #fff;
  background: var(--v26-teal);
  font-size: 12px;
  font-weight: 700;
}

.image-task-retry button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.image-task-card.image-task-failed {
  border: 1px solid #efb9b9;
}

.image-task-card.image-task-failed .image-progress-bar span {
  background: #d43f3a;
}

/* Scroll margin for node rail positioning */
.conversation > .message,
.conversation > .image-task-message,
.conversation > .model-result-message {
  scroll-margin-top: 80px;
}

#composer {
  scroll-margin-top: 80px;
}

.stage-task-no {
  color: #96a19e;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.015em;
  white-space: nowrap;
}

.model-confirmation-card {
  display: grid;
  gap: 14px;
  margin-bottom: 12px;
  padding: 16px;
  border: 1px solid #cfe5df;
  border-radius: 14px;
  background: #f7fbfa;
}

.model-confirmation-source img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
}

.model-confirmation-card p {
  margin: 0;
  color: var(--v26-muted);
  line-height: 1.65;
}

.model-confirmation-actions,
.image-operation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.model-confirmation-actions button {
  min-width: 148px;
  min-height: 39px;
  padding: 10px 17px;
  border: 1px solid #cfe2dc;
  border-radius: 10px;
  color: var(--v26-teal-dark);
  background: #fff;
  font-size: 13px;
  font-weight: 700;
}

.model-confirmation-actions button:last-child {
  border-color: var(--v26-teal);
  color: #fff;
  background: var(--v26-teal);
  box-shadow: 0 8px 18px rgba(22, 127, 118, 0.18);
}

.model-confirmation-actions button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
