/* Shared agent UI components.
   Keep page-level layout in project_detail.css, task_detail.css, or lp/index.css. */

.project-tabs {
  display: flex;
  gap: 32px;
  margin: 0 0 24px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.project-tab-button {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: #94a3b8;
  padding: 12px 4px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: -1px;
}

.project-tab-button:hover {
  color: #cbd5e1;
}

.project-tab-button.active,
.project-tab-button.is-active {
  background: transparent;
  color: #fff;
  border-bottom-color: #60a5fa;
}

.project-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(96, 165, 250, 0.22);
  color: #bfdbfe;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.project-tab-panel {
  display: none;
  padding: 8px 0 12px;
}

.project-tab-panel.active,
.project-tab-panel.is-active {
  display: block;
}

.project-tab-panel .chat-message {
  margin-bottom: 0;
}

.project-tab-empty {
  font-size: 13px;
  color: #94a3b8;
  padding: 8px 0;
}

.project-todo-section {
  margin: 0;
}

.project-todo-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.project-todo-filter {
  border: 1px solid rgba(96, 165, 250, 0.75);
  background: transparent;
  color: #bfdbfe;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.project-todo-filter.is-active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.project-todo-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.project-todo-empty {
  color: #94a3b8;
  font-size: 13px;
  padding: 6px 0;
}

.project-todo-card,
.project-chat-card,
.decision-card {
  position: relative;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.decision-card {
  padding-right: 58px;
  margin-bottom: 12px;
}

.project-todo-card.is-resolved,
.project-chat-card.is-resolved,
.decision-card.is-resolved {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.project-todo-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.project-todo-breadcrumbs {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  line-height: 1.6;
}

.project-todo-breadcrumb-link {
  color: #94a3b8;
  font-size: 12px;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.project-todo-breadcrumb-link:hover {
  color: #64748b;
  text-decoration: underline;
}

.project-todo-breadcrumb-separator {
  color: #cbd5e1;
  font-size: 12px;
}

.project-todo-task {
  display: inline-flex;
  max-width: 100%;
  color: #2563eb;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  margin-bottom: 0;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-todo-card-tools {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.project-todo-open-task {
  width: 30px;
  height: 30px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #ffffff;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  text-decoration: none;
  transition: border-color 0.16s ease, color 0.16s ease, background-color 0.16s ease;
}

.project-todo-open-task:hover {
  border-color: #2563eb;
  color: #2563eb;
  background: #eff6ff;
}

.project-todo-card-tools .thread-open-button {
  position: static;
  top: auto;
  right: auto;
  min-width: 30px;
  height: 30px;
}

.project-todo-card-title,
.project-chat-card-title,
.decision-card-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 6px;
}

.project-todo-card-insight,
.project-chat-card-insight,
.decision-card-insight {
  font-size: 13px;
  line-height: 1.55;
  color: #475569;
  margin-bottom: 12px;
}

.project-todo-card-insight.markdown-body h1,
.project-todo-card-insight.markdown-body h2,
.project-todo-card-insight.markdown-body h3,
.project-todo-card-insight.markdown-body h4,
.decision-card-insight.markdown-body h1,
.decision-card-insight.markdown-body h2,
.decision-card-insight.markdown-body h3,
.decision-card-insight.markdown-body h4 {
  margin-top: 14px;
  margin-bottom: 8px;
}

.decision-card-insight.markdown-body h1 { font-size: 1.25em; }
.decision-card-insight.markdown-body h2 { font-size: 1.15em; }
.decision-card-insight.markdown-body h3 { font-size: 1.05em; }

.project-todo-card-insight.markdown-body p,
.project-todo-card-insight.markdown-body ul,
.project-todo-card-insight.markdown-body ol,
.decision-card-insight.markdown-body p,
.decision-card-insight.markdown-body ul,
.decision-card-insight.markdown-body ol {
  margin-bottom: 10px;
}

.project-todo-actions,
.project-chat-card-actions,
.decision-card-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.project-todo-action,
.project-chat-card-action,
.decision-card-action {
  width: auto;
  max-width: 100%;
  border: 1px solid #2563eb;
  background: #2563eb;
  color: #ffffff;
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.project-todo-action:hover:not(:disabled),
.project-chat-card-action:hover:not(:disabled),
.decision-card-action:hover:not(:disabled) {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.project-todo-action:disabled,
.project-chat-card-action:disabled,
.decision-card-action:disabled {
  cursor: default;
  background: #e2e8f0;
  border-color: #cbd5e1;
  color: #64748b;
}

.decision-card-processing {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
  margin-top: 2px;
}

.chat-message {
  position: relative;
  margin-bottom: 12px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #e6f1ff;
  color: #222;
  margin-left: 50px;
}

.chat-message.ai {
  background: #f7f7f9;
  color: #222;
  margin-left: 0;
  margin-right: 50px;
}

.chat-message.loading {
  opacity: 0.7;
  font-style: italic;
}

.chat-message-header {
  font-size: 12px;
  color: #777;
  margin-bottom: 4px;
}

.chat-message.ai .chat-message-header {
  color: #777;
}

.chat-message-content {
  white-space: normal;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.chat-panel-body > .chat-message[data-message-id],
.chat-panel-body > .project-chat-card[data-message-id],
.chat-panel-body > .decision-card[data-message-id] {
  padding-right: 48px;
}

.thread-open-button {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 28px;
  height: 28px;
  border: 1px solid #dbe3ef;
  border-radius: 999px;
  background: #ffffff;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0 5px;
  cursor: pointer;
  z-index: 2;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.thread-open-button:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #2563eb;
}

.thread-count {
  color: #94a3b8;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.chat-compose-form,
.thread-chat-form {
  position: relative;
  margin: 0;
}

.chat-compose-box {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

.chat-textarea {
  width: 100%;
  height: 64px;
  min-height: 64px;
  max-height: 128px;
  font-size: 14px;
  padding: 12px 16px;
  border: 0;
  border-radius: 0;
  background: #ffffff;
  color: #1e293b;
  resize: none;
  box-sizing: border-box;
}

.chat-textarea:focus {
  outline: none;
}

.chat-compose-box:focus-within {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.chat-textarea::placeholder {
  color: #888888;
}

.chat-compose-tools {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 6px 8px;
  box-sizing: border-box;
}

.btn-send-icon {
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.btn-send-icon:hover {
  opacity: 1;
  color: #3b82f6;
}

.btn-send-icon:disabled {
  cursor: default;
  opacity: 0.35;
  color: #94a3b8;
}

.chat-message.ontology-form-message {
  background: transparent !important;
  border: none;
  box-shadow: none;
  padding: 0;
  margin-top: 16px;
  margin-right: 0;
}

.ontology-form-message .ontology-intro-text,
#project-ontology-tab-body .ontology-intro-text {
  color: #cbd5e1;
  margin: 0 0 32px 0;
  line-height: 1.8;
  font-size: 14px;
}

.ontology-form-message .ontology-section-block,
#project-ontology-tab-body .ontology-section-block {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 32px;
}

.ontology-form-message .ontology-section-title,
#project-ontology-tab-body .ontology-section-title {
  color: #1e293b;
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 20px 0;
}

.ontology-form-message .ontology-field-block,
#project-ontology-tab-body .ontology-field-block {
  margin-bottom: 24px;
}

.ontology-form-message .ontology-field-label,
#project-ontology-tab-body .ontology-field-label {
  display: block;
  color: #334155;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
}

.ontology-form-message .ontology-field-textarea,
#project-ontology-tab-body .ontology-field-textarea {
  width: 100%;
  min-height: 100px;
  font-size: 14px;
  line-height: 1.7;
  padding: 14px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  resize: vertical;
  background: #ffffff;
  color: #0f172a;
  box-sizing: border-box;
  transition: all 0.2s ease;
  overflow-y: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.ontology-form-message .ontology-field-textarea:focus,
#project-ontology-tab-body .ontology-field-textarea:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
  outline: none;
}

.ontology-form-message .ontology-field-description,
#project-ontology-tab-body .ontology-field-description {
  color: #64748b;
  font-size: 12px;
  margin-top: 8px;
  line-height: 1.5;
}

.ontology-form-message .ontology-form-actions,
#project-ontology-tab-body .ontology-form-actions {
  text-align: right;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}

.ontology-form-message form {
  margin: 0;
}

.task-draft-message {
  border: 1px solid #e3e6f0;
  background-color: #f8f9fc;
  border-radius: 8px;
  padding: 10px 12px;
}

.task-draft-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 8px;
  font-size: 13px;
  color: #444;
}

.task-draft-status {
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 10px;
  background: #e8eefc;
  color: #2f4aa2;
}

.task-draft-tree {
  list-style: none;
  padding-left: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
}

.task-draft-item {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 36px;
  position: relative;
}

.task-draft-node {
  display: flex;
  flex-direction: column;
  width: 280px;
  min-width: 280px;
  z-index: 2;
  position: relative;
  background: #ffffff;
  border: 1px solid #e4e8f3;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.task-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}

.task-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  background: #f9fafb;
  padding: 6px 12px;
  border-top: 1px solid #f3f4f6;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
}

.task-draft-title {
  flex: 1;
  font-size: 13px;
}

.task-draft-tree.project-mode {
  gap: 30px;
}

.task-draft-tree.project-mode .task-draft-node {
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
  overflow: visible;
}

.task-draft-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  min-height: 116px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  color: #fff;
  text-decoration: none;
  transition: all 0.2s;
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
  position: relative;
}

.task-draft-card:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
  box-shadow: 0 8px 15px rgba(0,0,0,0.1);
}

.task-draft-card .task-card-header {
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  padding: 14px 14px 8px;
}

.task-card-status-badge {
  position: static;
  flex: 0 0 auto;
  max-width: 96px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  padding: 3px 8px;
  border-radius: 12px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 10;
}

.task-draft-tree.project-mode .task-draft-title {
  flex: 1 1 auto;
  min-width: 0;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
  text-align: left;
  overflow-wrap: anywhere;
  word-break: normal;
}

.task-draft-tree.project-mode .task-draft-title span {
  display: block;
}

.task-card-meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  box-sizing: border-box;
  padding: 0 14px 14px;
}

.task-card-meta-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.task-card-meta-label {
  color: rgba(226, 232, 240, 0.7);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
}

.task-card-meta-value {
  color: rgba(255, 255, 255, 0.86);
  font-size: 12px;
  line-height: 1.35;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wait-confirm-actions {
  margin-top: 8px;
  display: flex;
  gap: 10px;
}

.btn-approve,
.btn-request-changes {
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}

.btn-approve {
  background-color: #2e7d32;
}

.btn-request-changes {
  background-color: #f59e0b;
}

.mcp-tool-card {
  border-radius: 12px;
  padding: 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: block;
  color: inherit;
  margin-top: 8px;
  margin-bottom: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.mcp-tool-card.jira {
  background: rgba(38, 132, 255, 0.05);
  border: 1px solid rgba(38, 132, 255, 0.2);
}

.mcp-tool-card.jira:hover {
  background: rgba(38, 132, 255, 0.1);
  box-shadow: 0 6px 20px rgba(38, 132, 255, 0.15);
}

.mcp-tool-card.slack {
  background: rgba(224, 30, 90, 0.05);
  border: 1px solid rgba(224, 30, 90, 0.2);
}

.mcp-tool-card.slack:hover {
  background: rgba(224, 30, 90, 0.1);
  box-shadow: 0 6px 20px rgba(224, 30, 90, 0.15);
}

.mcp-tool-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
}

.mcp-tool-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.mcp-tool-title {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 8px;
  line-height: 1.4;
}

.mcp-tool-details {
  display: flex;
  flex-direction: row;
  gap: 16px;
  font-size: 12px;
  color: #475569;
}

.mcp-tool-detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mcp-tool-detail-label {
  font-size: 11px;
  color: #94a3b8;
}

.mcp-tool-detail-value {
  font-weight: 500;
  color: #334155;
}
