.assistant-layout {
  display: grid;
  grid-template-columns: 220px minmax(420px, 1fr) 300px;
  gap: 14px;
  min-height: calc(100vh - 126px);
}

.assistant-layout > .panel,
.assistant-status .panel {
  margin: 0;
}

.assistant-conversations,
.assistant-workspace,
.assistant-status {
  min-width: 0;
}

.assistant-conversations,
.assistant-workspace {
  display: flex;
  flex-direction: column;
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 6px;
  font-weight: 700;
}

.assistant-conversation-list,
.assistant-task-list {
  display: grid;
  gap: 8px;
  overflow: auto;
}

.assistant-conversation {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 10px;
  text-align: left;
}

.assistant-conversation strong,
.assistant-conversation span {
  display: block;
}

.assistant-conversation span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 5px;
}

.assistant-conversation.active {
  background: #eaf3ee;
  border-color: #78a98d;
}

.assistant-modebar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.assistant-modebar button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 0 10px;
}

.assistant-modebar button.active {
  background: #174f78;
  border-color: #174f78;
  color: #fff;
}

.assistant-messages {
  flex: 1;
  min-height: 320px;
  max-height: calc(100vh - 360px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 4px;
}

.assistant-message {
  width: min(84%, 760px);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 12px;
  line-height: 1.45;
}

.assistant-message.is-user {
  margin-left: auto;
  background: #f2f7fb;
  border-color: #c8dbe8;
}

.assistant-message.is-assistant {
  margin-right: auto;
}

.assistant-message header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.assistant-message header strong {
  color: var(--text);
}

.assistant-message-text {
  overflow-wrap: anywhere;
}

.assistant-attachments {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 9px;
}

.assistant-attachments span {
  border: 1px solid var(--line);
  background: #f7f8fa;
  border-radius: 5px;
  padding: 4px 7px;
  font-size: 12px;
}

.assistant-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.assistant-composer textarea {
  min-height: 92px;
  resize: vertical;
}

.assistant-composer-footer {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-top: 9px;
}

.assistant-files {
  position: relative;
}

.assistant-files summary {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 0 10px;
  cursor: pointer;
}

.assistant-file-list {
  position: absolute;
  left: 0;
  bottom: 44px;
  z-index: 10;
  width: min(420px, 78vw);
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(28, 39, 49, .14);
  padding: 8px;
}

.assistant-file-list label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid #edf0f2;
}

.assistant-file-list label:last-child {
  border-bottom: 0;
}

.assistant-file-list label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assistant-file-list small {
  color: var(--muted);
}

.assistant-status {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.assistant-task-panel {
  min-height: 0;
}

.assistant-task {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 10px;
}

.assistant-task-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}

.assistant-task-head .badge {
  white-space: normal;
  text-align: center;
}

.assistant-task p {
  margin: 8px 0;
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.btn-link {
  border: 0;
  background: transparent;
  color: #9b2c2c;
  padding: 6px 0 0;
  font-weight: 700;
}

@media (max-width: 1240px) {
  .assistant-layout {
    grid-template-columns: 200px minmax(380px, 1fr);
  }

  .assistant-status {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 820px) {
  .assistant-layout {
    display: block;
  }

  .assistant-conversations,
  .assistant-workspace,
  .assistant-status .panel {
    margin-bottom: 12px;
  }

  .assistant-conversation-list {
    max-height: 180px;
  }

  .assistant-messages {
    max-height: none;
    min-height: 360px;
  }

  .assistant-message {
    width: 94%;
  }

  .assistant-composer-footer,
  .assistant-status {
    display: grid;
    grid-template-columns: 1fr;
  }

  .assistant-composer-footer .btn {
    width: 100%;
  }
}
