/* ── Thinking indicator (inline bubble in message thread) ────────────────── */

.msg-thinking {
  align-self: flex-start;
  background: oklch(var(--p) / 8%);
  border-left: 3px solid oklch(var(--p) / 40%);
  border-bottom-left-radius: 3px;
  display: flex;
  gap: 6px;
  padding: 14px 18px;
  align-items: center;
}

.msg-thinking span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: oklch(var(--p) / 70%);
  animation: thinking-dot 1.4s ease-in-out infinite;
}

.msg-thinking span:nth-child(2) { animation-delay: 0.22s; }
.msg-thinking span:nth-child(3) { animation-delay: 0.44s; }

@keyframes thinking-dot {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.8); }
  40%            { opacity: 1;    transform: scale(1);   }
}

/* ── Thinking / reasoning block ────────────────────────────────────────────── */

#thinking-btn { position: relative; }

#thinking-btn.thinking-active {
  color: oklch(var(--p));
}

/* Plan 35.0 — graded effort dot indicator on the brain icon. */
#thinking-btn.thinking-active::after {
  content: '';
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: oklch(var(--p));
  box-shadow: 0 0 0 1px oklch(var(--b1));
}
#thinking-btn.thinking-low::after    { transform: scale(0.7); opacity: 0.7; }
#thinking-btn.thinking-medium::after { transform: scale(1.0); opacity: 0.85; }
#thinking-btn.thinking-high::after   { transform: scale(1.25); opacity: 1; background: oklch(var(--wa)); }

#thinking-btn:not(.thinking-capable) {
  display: none !important;
}

.msg-reasoning-block {
  align-self: flex-start;
  background: oklch(var(--b2) / 50%);
  border-left: 2px solid oklch(var(--wa) / 50%);
  padding: 0.3rem 0.7rem;
  font-size: 0.75rem;
  color: oklch(var(--bc) / 60%);
  max-width: 92%;
}

.msg-reasoning-block .trace-header {
  gap: 0.4rem;
}

.msg-reasoning-block .trace-arrow {
  margin-top: 0;
}

.msg-reasoning-block .trace-label {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.thinking-content {
  font-family: monospace;
  font-size: 0.72rem;
  opacity: 0.85;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0.35rem 0 0;
  padding: 0.35rem 0 0;
  border-top: 1px solid oklch(var(--bc) / 10%);
  max-height: 16rem;
  overflow-y: auto;
}

.thinking-pulse {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: oklch(var(--p));
  animation: thinking-pulse 1s ease-in-out infinite;
  flex-shrink: 0;
}

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

.model-response-section-label {
  font-size: 0.68rem;
  opacity: 0.45;
  padding: 0.3rem 0 0.1rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Model response diagnostic row ──────────────────────────────────────── */

.msg-model-response {
  align-self: flex-start;
  background: oklch(var(--b2) / 60%);
  border-left: 2px solid oklch(var(--su) / 40%);
  padding: 0.3rem 0.7rem;
  font-size: 0.75rem;
  color: oklch(var(--bc) / 55%);
  font-variant-numeric: tabular-nums;
  max-width: 92%;
}

.msg-model-response .trace-header {
  gap: 0.4rem;
}

.model-response-header-label { flex: 1; }

.model-response-summary { flex: 1; }

.model-response-detail {
  margin-top: 0.35rem;
  padding-top: 0.3rem;
  border-top: 1px solid oklch(var(--bc) / 10%);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.model-response-providers {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.model-response-provider {
  opacity: 0.55;
  font-family: monospace;
  font-size: 0.72rem;
}

.model-response-provider.winner {
  opacity: 0.85;
  color: oklch(var(--su));
}

.model-response-genid {
  font-family: monospace;
  font-size: 0.68rem;
  opacity: 0.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-response-raw {
  font-family: monospace;
  font-size: 0.72rem;
  opacity: 0.75;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  padding: 0.4rem 0 0;
  border-top: 1px solid oklch(var(--bc) / 8%);
  max-height: 20rem;
  overflow-y: auto;
}

/* ── Plan dialog (krill_plan — full-height bottom sheet) ─────────────────── */

#plan-dialog {
  position: fixed;
  inset: 0;
  background: var(--overlay-modal-bg);
  display: flex;
  align-items: flex-end;
  z-index: 100;
}

.plan-box {
  width: 100%;
  background: oklch(var(--b2));
  border-radius: var(--radius) var(--radius) 0 0;
  border-top: 1px solid oklch(var(--b3));
  padding: 1.25rem 1rem;
  padding-bottom: calc(1.25rem + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-height: 90vh;
  overflow-y: auto;
}

.plan-source-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: oklch(var(--su));
  opacity: 0.8;
}

.plan-title {
  font-size: 1rem;
  font-weight: 600;
  color: oklch(var(--bc));
  line-height: 1.3;
}

.plan-steps {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.plan-step-row {
  background: oklch(var(--b1));
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: opacity 0.15s;
}

.plan-step-row.plan-step-removed {
  opacity: 0.35;
  text-decoration: line-through;
}

.plan-step-display { display: flex; flex-direction: column; gap: 0.35rem; }

.plan-step-desc {
  font-size: 0.85rem;
  color: oklch(var(--bc));
  line-height: 1.4;
  margin: 0;
}

.plan-step-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.plan-step-files {
  font-size: 0.7rem;
  color: oklch(var(--bc) / 55%);
  font-family: monospace;
}

.plan-step-badge {
  font-size: 0.65rem;
  padding: 0.1rem 0.35rem;
  border-radius: 0.25rem;
  font-weight: 600;
}

.plan-step-irreversible {
  background: oklch(var(--er) / 15%);
  color: oklch(var(--er));
}

.plan-step-gated {
  background: oklch(var(--wa) / 15%);
  color: oklch(var(--wa));
}

.plan-step-auto-approved {
  background: oklch(var(--su) / 15%);
  color: oklch(var(--su));
}

.plan-step-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.2rem;
}

.plan-step-btn {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  background: oklch(var(--b3));
  border: none;
  cursor: pointer;
  color: oklch(var(--bc));
}

.plan-step-btn:hover { background: oklch(var(--b3) / 80%); }
.plan-step-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.plan-step-remove-btn { color: oklch(var(--er) / 70%); }
.plan-step-remove-btn:hover { color: oklch(var(--er)); }

.plan-step-edit {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.plan-step-edit-desc,
.plan-step-edit-files {
  background: oklch(var(--b2));
  border: 1px solid oklch(var(--b3));
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  color: oklch(var(--bc));
  width: 100%;
  font-family: inherit;
}

.plan-step-edit-desc { resize: vertical; }

.plan-step-edit-gated {
  font-size: 0.8rem;
  color: oklch(var(--bc) / 70%);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}

.plan-note-wrap { display: flex; flex-direction: column; gap: 0.3rem; }

.plan-note-label {
  font-size: 0.75rem;
  color: oklch(var(--bc) / 60%);
}

.plan-operator-note {
  background: oklch(var(--b1));
  border: 1px solid oklch(var(--b3));
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.6rem;
  font-size: 0.85rem;
  color: oklch(var(--bc));
  resize: vertical;
  width: 100%;
  font-family: inherit;
}

.plan-buttons {
  display: flex;
  gap: 0.6rem;
}

.plan-copy-btn {
  flex: 0 0 auto;
  align-self: center;
}
