/* CORE Agent — Phase 3 */

.core-repository {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 120px);
}

.core-repo-body {
  flex: 1;
  min-height: 0;
}

.core-repo-layout {
  display: flex;
  align-items: stretch;
  position: relative;
  min-height: calc(100vh - 220px);
}

.core-repo-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  transition: width 300ms ease;
}

.core-repo-layout--collapsed .core-repo-main {
  width: 100%;
}

.core-agent-panel {
  width: 320px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid #1f1f1f;
  background: #0d0d0d;
  transition: width 300ms ease, opacity 300ms ease, transform 300ms ease;
  overflow: hidden;
}

.core-repo-layout--collapsed .core-agent-panel {
  width: 0;
  opacity: 0;
  pointer-events: none;
  border-left: 0;
}

.core-agent-collapse-toggle {
  position: absolute;
  top: 50%;
  right: 320px;
  z-index: 10;
  transform: translateY(-50%);
  width: 16px;
  height: 32px;
  padding: 0;
  border: 1px solid #1f1f1f;
  border-right: 0;
  border-radius: 2px 0 0 2px;
  background: #141414;
  color: #6b6b6b;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: right 300ms ease;
}

.core-repo-layout--collapsed .core-agent-collapse-toggle {
  right: 0;
  border-right: 1px solid #1f1f1f;
  border-radius: 2px 0 0 2px;
}

.core-agent-collapse-toggle:hover {
  color: #c9a96e;
}

/* Panel header */
.core-agent-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid #1f1f1f;
}

.core-agent-panel-title h2 {
  margin: 0 0 4px;
  font-family: "Cormorant Garamond", "Times New Roman", serif;
  font-size: 16px;
  font-weight: 400;
  color: #d4d4d4;
}

.core-agent-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: "Jost", "Inter", sans-serif;
  font-size: 10px;
  color: #c9a96e;
}

.core-agent-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c9a96e;
}

.core-agent-unread {
  padding: 2px 8px;
  border: 1px solid #c9a96e;
  border-radius: 2px;
  font-family: "Jost", "Inter", sans-serif;
  font-size: 10px;
  color: #c9a96e;
}

/* Feed */
.core-agent-feed {
  flex: 0 0 65%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 16px 0;
}

.core-agent-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-family: "Jost", "Inter", sans-serif;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: #6b6b6b;
}

.core-agent-clear {
  padding: 0;
  border: 0;
  background: transparent;
  color: #c9a96e;
  font-family: "Jost", "Inter", sans-serif;
  font-size: 10px;
  cursor: pointer;
}

.core-agent-obs-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 12px;
}

.core-agent-obs {
  padding: 12px;
  border: 1px solid #1a2030;
  border-radius: 2px;
  background: #0f1218;
  transition: opacity 300ms ease, border-color 0.2s ease;
}

.core-agent-obs.is-dismissing {
  opacity: 0;
}

.core-agent-obs:hover {
  border-color: #2a3040;
}

.core-agent-obs-head {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.core-agent-severity {
  width: 6px;
  height: 6px;
  margin-top: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.core-agent-severity--gap {
  background: #8b3a3a;
}

.core-agent-severity--attention {
  background: #c9a96e;
}

.core-agent-severity--advisory {
  background: #6b6b6b;
}

.core-agent-obs-text {
  margin: 0;
  font-family: "Jost", "Inter", sans-serif;
  font-size: 12px;
  line-height: 1.45;
  color: #d4d4d4;
}

.core-agent-obs-source {
  display: block;
  margin: 8px 0 0 14px;
  font-family: "Jost", "Inter", sans-serif;
  font-size: 10px;
  color: #6b6b6b;
}

.core-agent-obs-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding-left: 14px;
}

.core-agent-action-btn {
  padding: 6px 10px;
  border: 1px solid #1f1f1f;
  border-radius: 2px;
  background: #141414;
  color: #c9a96e;
  font-family: "Jost", "Inter", sans-serif;
  font-size: 10px;
  cursor: pointer;
}

.core-agent-action-btn:hover {
  border-color: #c9a96e;
}

.core-agent-empty {
  margin: 0;
  font-size: 11px;
  color: #6b6b6b;
}

.core-agent-divider {
  height: 1px;
  margin: 0 16px;
  background: #1f1f1f;
}

/* Activity log */
.core-agent-log {
  flex: 0 0 35%;
  min-height: 0;
  padding: 12px 16px 16px;
  overflow-y: auto;
}

.core-agent-log-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.core-agent-log-list li {
  font-family: "Jost", "Inter", sans-serif;
  font-size: 11px;
  color: #6b6b6b;
  line-height: 1.4;
}

.core-agent-log-time {
  color: #c9a96e;
}

/* Chat */
.core-agent-chat {
  margin-top: auto;
  border-top: 1px solid #1f1f1f;
}

.core-agent-chat-mode {
  margin: 0;
  padding: 8px 16px;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: #9a9a9a;
  background: #101010;
  border-top: 1px solid #1f1f1f;
}

.core-agent-msg-meta {
  margin-bottom: 6px;
}

.core-agent-source-tag {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border: 1px solid rgba(201, 169, 110, 0.4);
  border-radius: 999px;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #c9a96e;
}

.core-agent-source-tag.is-live {
  border-color: rgba(110, 180, 130, 0.5);
  color: #8ec9a0;
}

.core-agent-thread {
  max-height: 0;
  overflow-y: auto;
  background: #0d0d0d;
  border-top: 1px solid #1f1f1f;
  transition: max-height 200ms ease;
}

.core-agent-chat.is-open .core-agent-thread {
  max-height: 420px;
  border-left: 1px solid #1f1f1f;
  border-right: 1px solid #1f1f1f;
}

.core-agent-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 48px;
  padding: 0 16px;
  background: #141414;
  border-top: 1px solid #1f1f1f;
}

.core-agent-mark {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border: 1.5px solid #c9a96e;
  transform: rotate(45deg);
}

.core-agent-input {
  flex: 1;
  min-width: 0;
  padding: 8px 0;
  border: 0;
  background: #0d0d0d;
  color: #d4d4d4;
  font-family: "Jost", "Inter", sans-serif;
  font-size: 13px;
}

.core-agent-input:focus {
  outline: none;
}

.core-agent-input::placeholder {
  color: #6b6b6b;
}

.core-agent-shortcut {
  flex-shrink: 0;
  font-family: "Jost", "Inter", sans-serif;
  font-size: 10px;
  color: #6b6b6b;
}

/* Messages */
.core-agent-msg {
  padding: 12px 16px;
}

.core-agent-msg--user {
  display: flex;
  justify-content: flex-end;
}

.core-agent-msg--user p {
  max-width: 70%;
  margin: 0;
  padding: 10px 14px;
  border: 1px solid #1f1f1f;
  border-radius: 2px;
  background: #141414;
  font-family: "Jost", "Inter", sans-serif;
  font-size: 13px;
  color: #d4d4d4;
}

.core-agent-msg--agent {
  max-width: 85%;
}

.core-agent-msg--agent > p {
  margin: 0 0 8px;
  padding: 10px 14px;
  border: 1px solid #1a2030;
  border-radius: 2px;
  background: #0f1218;
  font-family: "Jost", "Inter", sans-serif;
  font-size: 13px;
  color: #d4d4d4;
  line-height: 1.45;
  white-space: pre-line;
}

.core-agent-followup {
  margin: 8px 0 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  font-size: 12px !important;
  color: #6b6b6b !important;
}

.core-agent-msg-table {
  width: 100%;
  margin-top: 8px;
  border-collapse: collapse;
}

.core-agent-msg-table th {
  padding: 6px 8px;
  border-bottom: 1px solid #1f1f1f;
  font-family: "Jost", "Inter", sans-serif;
  font-size: 10px;
  font-weight: 400;
  text-transform: uppercase;
  text-align: left;
  color: #6b6b6b;
}

.core-agent-msg-table td {
  padding: 8px;
  border-bottom: 1px solid #1f1f1f;
  font-family: "Jost", "Inter", sans-serif;
  font-size: 12px;
  color: #d4d4d4;
}

.core-agent-draft {
  margin-top: 8px;
  padding: 12px;
  border: 1px solid #1a2030;
  border-radius: 2px;
  background: #0f1218;
}

.core-agent-draft-statement {
  margin: 0 0 8px;
  font-size: 12px;
  color: #d4d4d4;
}

.core-agent-draft-tags {
  margin: 8px 0;
}

.core-agent-draft-controls {
  margin: 8px 0;
  padding-left: 16px;
  font-size: 11px;
  color: #6b6b6b;
}

.core-agent-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.core-agent-inline-btn {
  padding: 6px 10px;
  border: 1px solid #c9a96e;
  border-radius: 2px;
  background: #141414;
  color: #c9a96e;
  font-family: "Jost", "Inter", sans-serif;
  font-size: 11px;
  cursor: pointer;
}

.core-agent-typing-dots {
  display: inline-flex;
  gap: 4px;
  padding: 10px 14px;
  border: 1px solid #1a2030;
  border-radius: 2px;
  background: #0f1218;
}

.agent-typing-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #c9a96e;
}

/* Header status */
.core-agent-header-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 8px;
  font-family: "Jost", "Inter", sans-serif;
  font-size: 11px;
  color: #c9a96e;
}

@keyframes agent-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

@keyframes agent-typing {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}

.agent-pulse {
  animation: agent-pulse 2s ease-in-out infinite;
}

.agent-typing-dot:nth-child(1) {
  animation: agent-typing 1.2s 0s infinite;
}

.agent-typing-dot:nth-child(2) {
  animation: agent-typing 1.2s 0.4s infinite;
}

.agent-typing-dot:nth-child(3) {
  animation: agent-typing 1.2s 0.8s infinite;
}

@media (max-width: 1280px) {
  .core-agent-panel {
    width: 280px;
  }

  .core-agent-collapse-toggle {
    right: 280px;
  }
}
