.planning-chat-panel {
  width: 360px;
  min-width: 280px;
  max-width: 50vw;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--rule);
  background: var(--bg-card);
}

.pcp-header {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--rule);
}

.pcp-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}

.pcp-header-actions {
  display: flex;
  gap: 4px;
}

.pcp-clear,
.pcp-fold {
  font-size: 11px;
  padding: 2px 8px;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  color: var(--ink-3);
  cursor: pointer;
}

.pcp-clear:hover,
.pcp-fold:hover {
  background: var(--bg-hover);
  color: var(--ink);
}

.pcp-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--rule);
  align-items: center;
}

.pcp-tab {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 11px;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  color: var(--ink-3);
  cursor: pointer;
  font-family: inherit;
}

.pcp-tab:hover {
  background: var(--bg-hover);
  color: var(--ink);
}

.pcp-tab--active {
  background: var(--bg-active);
  color: var(--ink);
  border-color: var(--accent);
}

.pcp-tab-rename {
  font-size: 11px;
  padding: 1px 4px;
  border: 1px solid var(--accent);
  background: var(--bg);
  color: var(--ink);
  outline: none;
  width: 120px;
}

.pcp-tab-unread {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.pcp-tab-pencil,
.pcp-tab-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-4);
  font-size: 11px;
  padding: 0 2px;
}

.pcp-tab-pencil:hover,
.pcp-tab-close:hover {
  color: var(--ink);
}

.pcp-tab-newwrap {
  position: relative;
  display: inline-flex;
  gap: 2px;
}

.pcp-tab-new,
.pcp-tab-archive-trigger {
  font-size: 14px;
  padding: 0 8px;
  background: transparent;
  border: 1px dashed var(--rule);
  border-radius: var(--r-sm);
  color: var(--ink-3);
  cursor: pointer;
  line-height: 1.5;
}

.pcp-tab-new:hover,
.pcp-tab-archive-trigger:hover {
  background: var(--bg-hover);
  color: var(--ink);
}

.pcp-archived-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 10;
  min-width: 180px;
}

.pcp-archived-menu-header {
  padding: 6px 10px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  border-bottom: 1px solid var(--rule);
}

.pcp-archived-menu-item {
  display: block;
  width: 100%;
  padding: 6px 10px;
  font-size: 12px;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--ink);
  cursor: pointer;
}

.pcp-archived-menu-item:hover {
  background: var(--bg-hover);
}

.pcp-messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pcp-empty {
  color: var(--ink-4);
  font-size: 12px;
  text-align: center;
  padding: 20px 10px;
}

.pcp-bubble {
  display: flex;
  gap: 8px;
  max-width: 100%;
  position: relative;
  font-size: 13px;
}

.pcp-bubble--reverted {
  opacity: 0.5;
  text-decoration: line-through;
  text-decoration-color: var(--ink-4);
}

.pcp-av {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: var(--bg-sunk);
  font-size: 10px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
  text-transform: lowercase;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.pcp-bubble--user .pcp-av {
  background: var(--tint-blue);
  color: var(--tint-blue-ink);
}

.pcp-bubble--assistant .pcp-av {
  background: color-mix(in oklab, var(--accent) 14%, var(--bg-card));
  color: var(--accent);
}

.pcp-bubble-body {
  flex: 1;
  min-width: 0;
}

.pcp-bubble-meta {
  display: flex;
  align-items: baseline;
  font-size: 10px;
  color: var(--ink-3);
  margin-bottom: 2px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.pcp-bubble-name {
  font-weight: 600;
}

.pcp-bubble-time {
  font-weight: 500;
  color: var(--ink-4);
}

.pcp-bubble-time::before {
  content: '·';
  margin: 0 4px;
}

.pcp-bubble-content {
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
}

.pcp-bubble--assistant .pcp-bubble-content {
  white-space: normal;
}

.pcp-bubble-content :deep(p) { margin: 0.4em 0; }
.pcp-bubble-content :deep(ul),
.pcp-bubble-content :deep(ol) { margin: 0.4em 0; padding-left: 1.2em; }
.pcp-bubble-content :deep(code) {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-sunk);
  padding: 0 3px;
  border-radius: 2px;
}
.pcp-bubble-content :deep(pre) {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-sunk);
  padding: 8px;
  border-radius: var(--r-sm);
  overflow-x: auto;
}
.pcp-bubble-content :deep(pre code) {
  background: transparent;
  padding: 0;
}

.pcp-bubble-error {
  background: #4d1f1f;
  color: #ffb4b4;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  font-size: 11px;
  margin-bottom: 4px;
}

.pcp-thinking {
  font-size: 14px;
  color: var(--ink-4);
  letter-spacing: 4px;
  display: inline-block;
}

.pcp-thinking span {
  animation: pcp-blink 1.4s infinite both;
}

.pcp-thinking span:nth-child(2) { animation-delay: 0.2s; }
.pcp-thinking span:nth-child(3) { animation-delay: 0.4s; }

@keyframes pcp-blink {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}

.pcp-activity {
  margin-top: 6px;
  font-size: 11px;
}

.pcp-activity summary {
  cursor: pointer;
  color: var(--ink-3);
  user-select: none;
  padding: 2px 0;
}

.pcp-activity-log {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--bg-sunk);
  padding: 6px 8px;
  border-radius: var(--r-sm);
  max-height: 300px;
  overflow-y: auto;
  margin: 4px 0 0;
  color: var(--ink-2);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pcp-activity-row {
  display: grid;
  grid-template-columns: 14px auto 1fr;
  align-items: baseline;
  gap: 6px;
  line-height: 1.4;
  word-break: break-word;
}

.pcp-activity-icon {
  text-align: center;
}

.pcp-activity-label {
  color: var(--ink-3);
  text-transform: lowercase;
}

.pcp-activity-row--tool .pcp-activity-label { color: var(--accent); }
.pcp-activity-row--tool_result .pcp-activity-label { color: var(--ok); }
.pcp-activity-row--thinking .pcp-activity-label { color: var(--warn); font-style: italic; }

.pcp-activity-summary {
  white-space: pre-wrap;
}

.pcp-activity-detail {
  grid-column: 2 / 4;
  margin-top: 2px;
}

.pcp-activity-detail summary {
  cursor: pointer;
  color: var(--ink-4);
  font-size: 9px;
}

.pcp-activity-detail pre {
  margin: 4px 0 0;
  padding: 6px;
  background: var(--bg);
  border-radius: 3px;
  white-space: pre-wrap;
  font-size: 10px;
}

.pcp-system {
  font-size: 11px;
  color: var(--ink-3);
  background: var(--bg-sunk);
  padding: 6px 10px;
  border-radius: var(--r-sm);
  white-space: pre-wrap;
}

.pcp-interrupted {
  font-size: 10px;
  color: var(--ink-4);
  text-align: center;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 0;
}

.pcp-bubble-actions {
  position: absolute;
  top: 0;
  right: 0;
}

.pcp-undo {
  background: none;
  border: 1px solid var(--rule);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 12px;
  cursor: pointer;
  color: var(--ink-3);
}

.pcp-undo:hover:not(:disabled) {
  color: var(--accent);
  border-color: var(--accent);
}

.pcp-undo:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.pcp-queue {
  display: flex;
  gap: 4px;
  padding: 0 12px;
  flex-wrap: wrap;
}

.pcp-queue-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--bg-sunk);
  border: 1px dashed var(--rule);
  border-radius: var(--r-sm);
  font-size: 11px;
  max-width: 240px;
}

.pcp-queue-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: text;
}
.pcp-queue-edit {
  flex: 1;
  min-width: 0;
  background: var(--bg-input, #fff);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 1px 6px;
  font: inherit;
  font-size: 12px;
  color: var(--ink, inherit);
}

.pcp-queue-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-4);
  font-size: 12px;
  padding: 0 2px;
}

.pcp-composer {
  padding: 8px 12px 10px;
  border-top: 1px solid var(--rule);
}

.pcp-composer-input {
  position: relative;
}

.pcp-textarea {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 12px;
  padding: 8px 10px;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: var(--bg);
  color: var(--ink);
  resize: none;
  line-height: 1.4;
  box-sizing: border-box;
  max-height: 200px;
}

.pcp-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.pcp-dropdown {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 5;
}

.pcp-dropdown-item {
  display: flex;
  width: 100%;
  flex-direction: column;
  padding: 6px 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: var(--ink);
}

.pcp-dropdown-item:hover,
.pcp-dropdown-item--active {
  background: var(--bg-hover);
}

.pcp-dropdown-name {
  font-size: 12px;
  font-weight: 500;
}

.pcp-dropdown-desc {
  font-size: 10px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pcp-composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}

.pcp-composer-actions {
  display: flex;
  gap: 4px;
}

.pcp-composer-action {
  font-size: 12px;
  width: 24px;
  height: 24px;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  color: var(--ink-3);
  cursor: pointer;
}

.pcp-composer-action:hover {
  background: var(--bg-hover);
  color: var(--ink);
}

.pcp-composer-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pcp-send-hint {
  font-size: 10px;
  color: var(--ink-4);
}

.pcp-send-group {
  display: inline-flex;
}

.pcp-send,
.pcp-send-toggle {
  font-size: 13px;
  padding: 4px 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
}

.pcp-send {
  border-top-left-radius: var(--r-sm);
  border-bottom-left-radius: var(--r-sm);
}

.pcp-send-toggle {
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  padding: 4px 6px;
  border-top-right-radius: var(--r-sm);
  border-bottom-right-radius: var(--r-sm);
}

.pcp-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pcp-interrupt {
  background: var(--warn, #c87b1c);
}
