/* ===================================================================
   Wall-E Session — Chat UI, Agent Badges, Tool Cards
   =================================================================== */

/* --- Agent color accents in session list --- */
.session-item[data-agent="walle"] {
  border-left: 3px solid #f59e0b;
  background: #1e1a0e;
}
.session-item[data-agent="walle"].active {
  box-shadow: 0 0 0 1px rgba(245,158,11,0.3);
}
.session-item[data-agent="claude"] {
  border-left: 3px solid #c084fc;
}
.session-item[data-agent="claude-desktop"] {
  border-left: 3px solid #d97757;
}
.session-item[data-agent="codex"] {
  border-left: 3px solid #22c55e;
}
.session-item[data-agent="gemini"] {
  border-left: 3px solid #3b82f6;
}
.session-item[data-agent="shell"] {
  border-left: 3px solid #6b7280;
}

/* --- Agent badges --- */
.agent-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
  vertical-align: middle;
  line-height: 1.4;
  white-space: nowrap;
}
.agent-badge.walle {
  background: rgba(245,158,11,0.18);
  color: #f59e0b;
}
.agent-badge.claude {
  background: rgba(192,132,252,0.18);
  color: #c084fc;
}
.agent-badge.claude-desktop {
  background: rgba(217,119,87,0.18);
  color: #d97757;
}
.agent-badge.codex {
  background: rgba(34,197,94,0.18);
  color: #22c55e;
}
.agent-badge.gemini {
  background: rgba(59,130,246,0.18);
  color: #3b82f6;
}
.agent-badge.shell {
  background: rgba(107,114,128,0.18);
  color: #6b7280;
}

/* --- Wall-E session container --- */
.walle-session {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background: var(--bg, #1a1b26);
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
}
.walle-session:not(.active) {
  display: none;
}

/* --- Session header (Sprint 2: merged with toolbar; single chrome row) --- */
.walle-session-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: var(--bg-card, #24283b);
  border-bottom: 1px solid var(--border, #3b4261);
  flex-shrink: 0;
  min-height: 44px;
}
/* Overflow menu trigger (rare actions like Copy Command live here now). */
.walle-header-overflow {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--fg-dim, #565f89);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px 8px;
  height: 28px;
  font-family: inherit;
}
.walle-header-overflow:hover,
.walle-header-overflow:focus-visible {
  background: rgba(255,255,255,0.05);
  color: var(--fg, #c0caf5);
  border-color: var(--border, #3b4261);
  outline: none;
}
.walle-header-overflow-menu {
  background: var(--bg-card, #24283b);
  border: 1px solid var(--border, #3b4261);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  min-width: 180px;
  padding: 4px;
}
.walle-header-overflow-item {
  display: block;
  width: 100%;
  background: transparent;
  border: 0;
  color: var(--fg, #c0caf5);
  text-align: left;
  padding: 6px 10px;
  border-radius: 4px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.walle-header-overflow-item:hover,
.walle-header-overflow-item:focus-visible {
  background: rgba(122, 162, 247, 0.12);
  outline: none;
}
.walle-header-review {
  height: 28px;
  padding: 0 12px;
  font-size: 12px;
}
.walle-session-header .walle-icon {
  font-size: 22px;
  line-height: 1;
}
.walle-session-header .session-info {
  flex: 1;
  min-width: 0;
}
.walle-session-header .session-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--fg, #c0caf5);
}
.walle-session-header .session-meta {
  font-size: 11px;
  color: var(--fg-dim, #565f89);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.walle-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}
.walle-session-header .model-select {
  background: var(--bg, #1a1b26);
  color: var(--fg, #c0caf5);
  border: 1px solid var(--border, #3b4261);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  max-width: 180px;
}
.walle-model-picker-btn {
  display: inline-grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-width: 168px;
  max-width: 260px;
  height: 30px;
  padding: 3px 8px;
  background: var(--bg, #1a1b26);
  color: var(--fg, #c0caf5);
  border: 1px solid var(--border, #3b4261);
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  font-size: 12px;
}
.walle-model-picker-btn.toolbar {
  margin-left: auto;
  min-width: 220px;
}
.walle-model-picker-btn:hover,
.walle-model-picker-btn:focus-visible {
  border-color: #7aa2f7;
  outline: none;
  box-shadow: 0 0 0 1px rgba(122,162,247,0.25);
}
.walle-model-picker-provider {
  color: #7aa2f7;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
  white-space: nowrap;
}
.walle-model-picker-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.walle-model-picker-arrow {
  color: var(--fg-dim, #565f89);
  font-size: 14px;
  line-height: 1;
}
.walle-stat-badge {
  font-size: 11px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  color: var(--fg-dim, #565f89);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border, #3b4261);
  border-radius: 4px;
  padding: 3px 8px;
  white-space: nowrap;
}
.walle-stat-badge.cost {
  color: #e0af68;
}

.walle-model-popover {
  position: fixed;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  max-height: min(620px, calc(100vh - 24px));
  background: #181b28;
  color: var(--fg, #c0caf5);
  border: 1px solid #3b4261;
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.45);
  overflow: hidden;
}
.walle-model-search {
  flex: 0 0 auto;
  margin: 10px;
  height: 34px;
  padding: 6px 10px;
  background: #11131d;
  color: var(--fg, #c0caf5);
  border: 1px solid #3b4261;
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
  outline: none;
}
.walle-model-search:focus {
  border-color: #7aa2f7;
  box-shadow: 0 0 0 1px rgba(122,162,247,0.25);
}
.walle-model-list {
  overflow-y: auto;
  padding: 0 8px 8px;
}
.walle-model-section-title {
  padding: 9px 6px 5px;
  color: #8f98c7;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}
.walle-model-row {
  width: 100%;
  min-height: 34px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  background: transparent;
  color: var(--fg, #c0caf5);
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  font: inherit;
}
.walle-model-row:hover,
.walle-model-row:focus-visible,
.walle-model-row.selected {
  background: rgba(122,162,247,0.12);
  border-color: rgba(122,162,247,0.35);
  outline: none;
}
.walle-model-row-main {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}
.walle-model-row-tags {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.walle-model-tag {
  flex: 0 0 auto;
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255,255,255,0.06);
  color: #a9b1d6;
  font-size: 10px;
  font-weight: 600;
}
.walle-model-tag.accent {
  background: rgba(34,197,94,0.14);
  color: #22c55e;
}
.walle-model-tag.muted {
  background: rgba(224,175,104,0.12);
  color: #e0af68;
}
.walle-model-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-top: 1px solid #2f354f;
  background: rgba(255,255,255,0.02);
}
.walle-model-source-note {
  min-width: 0;
  color: #8f98c7;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.walle-model-legacy-toggle {
  flex: 0 0 auto;
  background: transparent;
  color: #8f98c7;
  border: 1px solid #3b4261;
  border-radius: 5px;
  padding: 4px 8px;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}
.walle-model-legacy-toggle:hover {
  color: var(--fg, #c0caf5);
  border-color: #7aa2f7;
}
.walle-model-empty {
  padding: 18px 8px;
  color: var(--fg-dim, #565f89);
  font-size: 12px;
  text-align: center;
}

/* --- Chat messages area --- */
.walle-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  outline: none; /* no focus ring — keyboard events redirect to input */
}

.walle-composer-resize {
  flex: 0 0 12px;
  height: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card, #24283b);
  border-top: 1px solid var(--border, #3b4261);
  cursor: row-resize;
  touch-action: none;
  user-select: none;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.walle-composer-resize-grip {
  width: 54px;
  height: 3px;
  border-radius: 999px;
  background: rgba(122,162,247,0.28);
  box-shadow: 0 0 0 1px rgba(122,162,247,0.08);
  opacity: 0.68;
  transition: width 0.12s ease, background 0.12s ease, opacity 0.12s ease, box-shadow 0.12s ease;
}
.walle-composer-resize:hover,
.walle-composer-resize:focus-visible,
.walle-composer-resize.dragging {
  background: color-mix(in srgb, var(--bg-card, #24283b) 82%, #7aa2f7);
  border-top-color: rgba(122,162,247,0.6);
  outline: none;
}
.walle-composer-resize:hover .walle-composer-resize-grip,
.walle-composer-resize:focus-visible .walle-composer-resize-grip,
.walle-composer-resize.dragging .walle-composer-resize-grip {
  width: 74px;
  background: rgba(122,162,247,0.76);
  box-shadow: 0 0 0 2px rgba(122,162,247,0.14);
  opacity: 1;
}
body.walle-composer-resizing {
  cursor: row-resize;
  user-select: none;
}

/* Sprint 3: empty-state — shown only when a session opens with zero
   messages. Three example chips that prefill the input on click. */
.walle-empty-state {
  margin: auto;
  padding: 24px 16px;
  text-align: center;
  user-select: none;
}
.walle-empty-headline {
  font-size: 13px;
  color: var(--fg-dim, #565f89);
  margin-bottom: 12px;
}
.walle-empty-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.walle-empty-chip {
  background: var(--bg-card, #24283b);
  border: 1px solid var(--border, #3b4261);
  color: var(--fg, #c0caf5);
  border-radius: 999px;
  padding: 6px 14px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.12s ease;
}
.walle-empty-chip:hover,
.walle-empty-chip:focus-visible {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.5);
  color: var(--fg, #c0caf5);
  outline: none;
}

.walle-history-loading-state {
  margin: auto;
  width: min(420px, calc(100% - 32px));
  padding: 22px 22px 20px;
  border: 1px solid rgba(122,162,247,0.26);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(36,40,59,0.92), rgba(26,27,38,0.86)),
    var(--bg-card, #24283b);
  box-shadow: 0 18px 46px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.03);
  text-align: left;
  user-select: none;
}
.walle-history-loading-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 12px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid rgba(122,162,247,0.28);
  background: rgba(122,162,247,0.10);
  color: #9ab5ff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.walle-history-loading-spinner {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid rgba(154,181,255,0.25);
  border-top-color: #9ab5ff;
  animation: walle-history-spin 0.85s linear infinite;
}
.walle-history-loading-title {
  color: var(--fg, #c0caf5);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 6px;
}
.walle-history-loading-copy {
  color: var(--fg-muted, #8f98c7);
  font-size: 13px;
  line-height: 1.45;
}
.walle-history-loading-skeleton {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}
.walle-history-loading-line {
  display: block;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(122,162,247,0.08), rgba(122,162,247,0.22), rgba(122,162,247,0.08));
  background-size: 180% 100%;
  animation: walle-history-sheen 1.4s ease-in-out infinite;
}
.walle-history-loading-line:nth-child(1) { width: 88%; }
.walle-history-loading-line:nth-child(2) { width: 68%; animation-delay: 0.12s; }
.walle-history-loading-line:nth-child(3) { width: 78%; animation-delay: 0.24s; }

@keyframes walle-history-spin {
  to { transform: rotate(360deg); }
}
@keyframes walle-history-sheen {
  0% { background-position: 130% 0; }
  100% { background-position: -60% 0; }
}

.walle-msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  max-width: 100%;
  padding: 6px 10px 6px 8px;
  border-radius: 6px;
  border-left: 2px solid transparent;
  transition: background 0.12s ease;
}
/* Subtle role differentiation: assistant gets a small bg lift + amber rail
   so it visually anchors as the agent's reply. User stays transparent. */
.walle-msg[data-walle-role="assistant"] {
  background: rgba(245, 158, 11, 0.04);
  border-left-color: rgba(245, 158, 11, 0.5);
}
.walle-msg[data-walle-role="user"] {
  background: transparent;
  border-left-color: transparent;
}

/* Date divider — sits between messages on day boundaries. Slack/Discord style. */
.walle-date-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 8px 0 4px;
  position: relative;
  user-select: none;
}
.walle-date-divider::before,
.walle-date-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border, #3b4261);
  opacity: 0.5;
}
.walle-date-divider span {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--fg-dim, #565f89);
  background: transparent;
  padding: 0 12px;
}
.walle-msg-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.walle-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  color: #fff;
}
.walle-msg-avatar.user {
  background: #4a9eff;
}
.walle-msg-avatar.assistant {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}
.walle-msg-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--fg, #c0caf5);
}
.walle-msg-time {
  font-size: 11px;
  color: var(--fg-dim, #565f89);
}
.walle-msg-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 4px;
  opacity: 0;
  transition: opacity 120ms ease;
}
.walle-msg:hover .walle-msg-actions,
.walle-msg:focus-within .walle-msg-actions {
  opacity: 1;
}
.walle-msg-action,
.walle-branch-btn {
  height: 22px;
  border: 1px solid rgba(122,162,247,0.28);
  border-radius: 4px;
  background: rgba(26,27,38,0.72);
  color: var(--accent, #7aa2f7);
  font-size: 11px;
  font-weight: 600;
  line-height: 20px;
  padding: 0 7px;
  cursor: pointer;
}
.walle-msg-action:hover,
.walle-msg-action:focus-visible,
.walle-branch-btn:hover,
.walle-branch-btn:focus-visible {
  border-color: rgba(122,162,247,0.68);
  background: rgba(65,72,104,0.78);
  color: var(--fg, #c0caf5);
  outline: none;
}
.walle-msg-action.danger {
  color: var(--red, #f7768e);
  border-color: rgba(247,118,142,0.28);
}
.walle-msg-action.danger:hover,
.walle-msg-action.danger:focus-visible {
  border-color: rgba(247,118,142,0.7);
}
.walle-branch-nav {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-right: 2px;
}
.walle-branch-btn {
  width: 22px;
  padding: 0;
}
.walle-branch-btn:disabled {
  opacity: 0.42;
  cursor: default;
}
.walle-branch-label {
  min-width: 32px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-dim, #565f89);
}
.walle-msg-model {
  font-size: 10px;
  background: rgba(167,139,250,0.15);
  color: #a78bfa;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 500;
}
.walle-msg-body {
  font-size: 13px;
  line-height: 1.55;
  color: var(--fg, #c0caf5);
  overflow-wrap: break-word;
  word-break: break-word;
  flex: 1;
  min-width: 0;
  user-select: text;
  cursor: text;
}
.walle-msg-body p { margin: 0 0 8px; }
.walle-msg-body p:last-child { margin-bottom: 0; }
.walle-msg-body hr {
  border: 0;
  height: 1px;
  margin: 10px 0;
  background: linear-gradient(90deg, rgba(86,95,137,0), rgba(86,95,137,0.48), rgba(86,95,137,0));
}
.walle-msg-body hr:first-child { margin-top: 6px; }
.walle-msg-body hr:last-child { margin-bottom: 6px; }
.walle-copy-block {
  position: relative;
  margin: 8px 0;
}
.walle-msg-body pre {
  background: var(--bg, #1a1b26);
  border: 1px solid var(--border, #3b4261);
  border-radius: 6px;
  padding: 10px 12px;
  overflow-x: auto;
  font-size: 12px;
  margin: 8px 0;
}
.walle-copy-block pre {
  margin: 0;
  padding-right: 68px;
  min-height: 28px;
}
.walle-copy-btn {
  position: absolute;
  top: 7px;
  right: 7px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(122,162,247,0.35);
  border-radius: 4px;
  background: rgba(26,27,38,0.92);
  color: #7aa2f7;
  font-size: 11px;
  font-weight: 600;
  line-height: 22px;
  cursor: pointer;
  z-index: 1;
}
.walle-copy-btn:hover {
  border-color: rgba(122,162,247,0.75);
  background: rgba(41,46,66,0.96);
  color: #c0caf5;
}
.walle-copy-btn:disabled {
  cursor: default;
  opacity: 0.78;
}
.walle-msg-body code {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.9em;
  background: rgba(255,255,255,0.06);
  padding: 1px 4px;
  border-radius: 3px;
}
.walle-msg-body pre code {
  background: none;
  padding: 0;
}
.walle-msg-body table {
  border-collapse: collapse;
  margin: 8px 0;
  font-size: 12px;
  width: 100%;
}
.walle-msg-body th,
.walle-msg-body td {
  border: 1px solid var(--border, #3b4261);
  padding: 4px 8px;
  text-align: left;
}
.walle-msg-body th {
  background: rgba(255,255,255,0.04);
  font-weight: 600;
}
.walle-msg-body ul,
.walle-msg-body ol {
  margin: 4px 0 8px 18px;
}
.walle-msg-body li {
  margin-bottom: 2px;
}
.walle-msg-body blockquote {
  border-left: 3px solid var(--border, #3b4261);
  padding-left: 10px;
  margin: 6px 0;
  color: var(--fg-dim, #565f89);
}
.walle-edit-card {
  border: 1px solid rgba(122,162,247,0.34);
  background: rgba(26,27,38,0.56);
  border-radius: 6px;
  padding: 8px;
}
.walle-edit-input {
  width: 100%;
  min-height: 86px;
  resize: vertical;
  border: 1px solid var(--border, #3b4261);
  border-radius: 5px;
  background: rgba(15,17,26,0.78);
  color: var(--fg, #c0caf5);
  font: inherit;
  line-height: 1.5;
  padding: 8px 10px;
  outline: none;
}
.walle-edit-input:focus {
  border-color: var(--accent, #7aa2f7);
  box-shadow: 0 0 0 2px rgba(122,162,247,0.18);
}
.walle-edit-hint {
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.35;
  color: var(--fg-dim, #565f89);
}
.walle-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

/* --- Tool cards (Sprint 2: per-tool left-rail color for fast scannability) --- */
.walle-tool-card {
  background: var(--bg, #1a1b26);
  border: 1px solid var(--border, #3b4261);
  border-left: 2px solid #565f89;
  border-radius: 6px;
  margin: 6px 0;
  overflow: hidden;
}
/* Color the left rail by tool kind so a stack of 9 tool calls is scannable. */
.walle-tool-card[data-tool-name="run_shell"],
.walle-tool-card[data-tool-name="shell"],
.walle-tool-card[data-tool-name="bash"] { border-left-color: #a78bfa; }
.walle-tool-card[data-tool-name="read_file"],
.walle-tool-card[data-tool-name="glob"],
.walle-tool-card[data-tool-name="list_directory"],
.walle-tool-card[data-tool-name="ls"] { border-left-color: #7aa2f7; }
.walle-tool-card[data-tool-name="grep_files"],
.walle-tool-card[data-tool-name="grep"] { border-left-color: #7dcfff; }
.walle-tool-card[data-tool-name="edit_file"],
.walle-tool-card[data-tool-name="write_file"],
.walle-tool-card[data-tool-name="edit"],
.walle-tool-card[data-tool-name="write"] { border-left-color: #9ece6a; }
.walle-tool-card[data-tool-name="think"] { border-left-color: #e0af68; }
.walle-tool-card[data-tool-name="search_memories"] { border-left-color: #bb9af7; }
.walle-tool-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.walle-tool-header:hover,
.walle-tool-header:focus-visible {
  background: rgba(255,255,255,0.03);
  outline: none;
}
.walle-tool-arrow {
  font-size: 10px;
  color: var(--fg-dim, #565f89);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.walle-tool-card[data-expanded="true"] .walle-tool-arrow {
  transform: rotate(90deg);
}
.walle-tool-name {
  font-weight: 600;
  font-size: 12px;
  color: #a78bfa;
}
.walle-tool-summary {
  font-size: 12px;
  color: var(--fg, #c0caf5);
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.walle-tool-summary:empty {
  display: none;
}
/* Right-aligned duration chip — tertiary, dim, just enough signal. */
.walle-tool-duration {
  font-size: 10px;
  color: var(--fg-dim, #565f89);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  margin-left: auto;
}
.walle-tool-status {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  flex-shrink: 0;
}
.walle-tool-status.done {
  background: rgba(34,197,94,0.15);
  color: #22c55e;
}
.walle-tool-status.working {
  background: rgba(245,158,11,0.15);
  color: #f59e0b;
}
.walle-tool-status.error {
  background: rgba(247,118,142,0.15);
  color: #f7768e;
}
.walle-tool-output,
.walle-tool-detail {
  display: none;
  padding: 8px 10px;
  border-top: 1px solid var(--border, #3b4261);
  background: linear-gradient(180deg, rgba(22,22,30,0.96), rgba(18,19,28,0.98));
  font-size: 12px;
  line-height: 1.45;
  color: var(--fg, #c0caf5);
}
.walle-tool-output:empty { display: none !important; }
.walle-tool-card[data-expanded="true"] .walle-tool-output,
.walle-tool-card[data-expanded="true"] > .walle-tool-detail,
.walle-live-activity-item[open] > .walle-tool-detail {
  display: block;
}
.walle-tool-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 7px;
}
.walle-tool-detail-chip {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 1px 7px;
  border: 1px solid rgba(122,162,247,0.18);
  border-radius: 999px;
  background: rgba(122,162,247,0.08);
  color: var(--fg-dim, #565f89);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.walle-tool-detail-chip.name {
  color: #a78bfa;
}
.walle-tool-detail-chip.done {
  border-color: rgba(158,206,106,0.28);
  background: rgba(158,206,106,0.10);
  color: #9ece6a;
}
.walle-tool-detail-chip.working {
  border-color: rgba(224,175,104,0.32);
  background: rgba(224,175,104,0.12);
  color: #e0af68;
}
.walle-tool-detail-chip.error {
  border-color: rgba(247,118,142,0.34);
  background: rgba(247,118,142,0.12);
  color: #f7768e;
}
.walle-tool-detail-summary {
  margin: 2px 0 8px;
  color: var(--fg, #c0caf5);
  font-size: 12px;
}
.walle-tool-detail-section {
  margin-top: 8px;
}
.walle-tool-detail-label {
  margin-bottom: 4px;
  color: var(--fg-dim, #565f89);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.walle-tool-detail-pre {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(122,162,247,0.18);
  border-radius: 7px;
  background:
    linear-gradient(180deg, rgba(15,17,26,0.95), rgba(12,14,22,0.96)),
    radial-gradient(circle at 0 0, rgba(122,162,247,0.12), transparent 34%);
  color: var(--fg, #c0caf5);
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
  max-height: 260px;
}
.walle-tool-detail-pre.output {
  max-height: 320px;
}
.walle-tool-detail-empty {
  color: var(--fg-dim, #565f89);
  font-size: 12px;
}

.walle-live-activity {
  margin: 10px 0 8px;
  padding: 8px 10px;
  border: 1px solid var(--border, #3b4261);
  border-left: 2px solid #e0af68;
  border-radius: 6px;
  background: rgba(36, 40, 59, 0.52);
}
.walle-live-activity-header {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.walle-live-activity-title {
  color: #c0caf5;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.walle-live-activity-summary {
  color: var(--fg-dim, #565f89);
  font-size: 12px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.walle-live-activity-list {
  display: grid;
  gap: 5px;
  margin-top: 7px;
}
.walle-live-activity-item {
  display: block;
}
.walle-live-activity-item > summary {
  list-style: none;
}
.walle-live-activity-item > summary::-webkit-details-marker {
  display: none;
}
.walle-live-activity-row {
  display: grid;
  grid-template-columns: 12px 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 22px;
  border-radius: 5px;
  cursor: pointer;
  padding: 1px 2px;
}
.walle-live-activity-row:hover,
.walle-live-activity-row:focus-visible,
.walle-live-activity-item[open] > .walle-live-activity-row {
  background: rgba(255,255,255,0.035);
  outline: none;
}
.walle-live-activity-arrow {
  color: var(--fg-dim, #565f89);
  font-size: 9px;
  transition: transform 0.16s ease;
}
.walle-live-activity-item[open] .walle-live-activity-arrow {
  transform: rotate(90deg);
}
.walle-live-activity-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #e0af68;
  box-shadow: 0 0 0 3px rgba(224, 175, 104, 0.12);
}
.walle-live-activity-row.done .walle-live-activity-dot {
  background: #9ece6a;
  box-shadow: 0 0 0 3px rgba(158, 206, 106, 0.12);
}
.walle-live-activity-row.error .walle-live-activity-dot {
  background: #f7768e;
  box-shadow: 0 0 0 3px rgba(247, 118, 142, 0.13);
}
.walle-live-activity-main {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
}
.walle-live-activity-name {
  color: #c0caf5;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.walle-live-activity-text {
  color: var(--fg, #c0caf5);
  font-size: 12px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.walle-live-activity-text:empty {
  display: none;
}
.walle-live-activity-meta,
.walle-live-activity-more {
  color: var(--fg-dim, #565f89);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.walle-live-activity-row.working .walle-live-activity-meta {
  color: #e0af68;
}
.walle-live-activity-row.error .walle-live-activity-meta {
  color: #f7768e;
}
.walle-live-activity-hidden {
  display: grid;
  gap: 5px;
}
.walle-live-activity-hidden[hidden] {
  display: none !important;
}
.walle-live-activity-more {
  width: max-content;
  max-width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 2px 7px;
  background: rgba(122,162,247,0.08);
  color: var(--fg-dim, #565f89);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.walle-live-activity-more:hover,
.walle-live-activity-more:focus-visible {
  background: rgba(122,162,247,0.16);
  color: var(--fg, #c0caf5);
  outline: none;
}
.walle-live-activity-detail {
  margin: 3px 0 5px 20px;
  border: 1px solid rgba(122,162,247,0.16);
  border-radius: 8px;
}

.walle-tool-group {
  background: var(--bg, #1a1b26);
  border: 1px solid var(--border, #3b4261);
  border-radius: 6px;
  margin: 6px 0;
  overflow: hidden;
}
.walle-tool-group-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.walle-tool-group-header:hover,
.walle-tool-group-header:focus-visible {
  background: rgba(255,255,255,0.035);
  outline: none;
}
.walle-tool-group-arrow {
  font-size: 10px;
  color: var(--fg-dim, #565f89);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.walle-tool-group[data-expanded="true"] .walle-tool-group-arrow {
  transform: rotate(90deg);
}
.walle-tool-group-title {
  color: #c0caf5;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.walle-tool-group-summary {
  color: var(--fg-dim, #565f89);
  font-size: 11px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.walle-tool-group-status {
  background: rgba(34,197,94,0.15);
  color: #22c55e;
  border-radius: 3px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
.walle-tool-group-status.error {
  background: rgba(247,118,142,0.15);
  color: #f7768e;
}
.walle-tool-group-body {
  display: none;
  border-top: 1px solid var(--border, #3b4261);
  padding: 6px 8px 8px;
}
.walle-tool-group[data-expanded="true"] .walle-tool-group-body {
  display: block;
}
.walle-tool-group-body .walle-tool-card {
  margin: 4px 0;
}

/* Spinner for in-progress tool calls */
.walle-tool-status.working::after {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border: 1.5px solid rgba(245,158,11,0.3);
  border-top-color: #f59e0b;
  border-radius: 50%;
  margin-left: 4px;
  vertical-align: middle;
  animation: walle-spin 0.8s linear infinite;
}
@keyframes walle-spin {
  to { transform: rotate(360deg); }
}

/* --- Input bar --- */
.walle-input-bar {
  display: flex;
  gap: 8px;
  padding: 10px 16px 12px;
  background: var(--bg-card, #24283b);
  border-top: 0;
  flex-shrink: 0;
  align-items: flex-end;
}
.walle-input-stack {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.walle-composer-attachments {
  display: flex;
}
.walle-queue-preview {
  display: none;
}
.walle-workbar-slot {
  flex: 0 0 auto;
  padding: 0 16px;
  background:
    linear-gradient(180deg, rgba(15,19,36,0), rgba(15,19,36,0.26)),
    var(--bg, #1a1b26);
}
.walle-workbar {
  margin: 0 0 8px;
  border: 1px solid rgba(122,162,247,0.24);
  border-radius: 14px;
  background:
    radial-gradient(circle at 18px 10px, rgba(245,158,11,0.18), transparent 140px),
    linear-gradient(135deg, rgba(22,28,49,0.96), rgba(19,22,38,0.94));
  box-shadow: 0 12px 32px rgba(0,0,0,0.24), inset 0 1px 0 rgba(255,255,255,0.04);
  color: var(--fg, #c0caf5);
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
}
.walle-workbar.expanded {
  grid-template-columns: 1fr auto;
}
.walle-workbar-rail {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}
.walle-workbar-kicker {
  color: #f6c177;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.14em;
}
.walle-work-chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border: 1px solid rgba(122,162,247,0.22);
  border-radius: 999px;
  background: rgba(122,162,247,0.09);
  color: #b9c8ff;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.walle-work-chip.active { color: #bbf7d0; border-color: rgba(34,197,94,0.34); background: rgba(34,197,94,0.12); }
.walle-work-chip.shell { color: #fde68a; border-color: rgba(245,158,11,0.34); background: rgba(245,158,11,0.11); }
.walle-work-chip.agent { color: #a5f3fc; border-color: rgba(34,211,238,0.30); background: rgba(34,211,238,0.10); }
.walle-work-chip.tool { color: #bfdbfe; border-color: rgba(96,165,250,0.30); background: rgba(96,165,250,0.10); }
.walle-work-chip.skill { color: #ddd6fe; border-color: rgba(167,139,250,0.30); background: rgba(167,139,250,0.10); }
.walle-work-chip.queued { color: #fed7aa; border-color: rgba(251,146,60,0.30); background: rgba(251,146,60,0.10); }
.walle-work-chip.done,
.walle-work-chip.isolated {
  color: var(--fg-dim, #7f849c);
  border-color: rgba(127,132,156,0.22);
  background: rgba(127,132,156,0.08);
}
.walle-workbar-summary {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--fg, #c0caf5);
  font-size: 12px;
  font-weight: 650;
}
.walle-workbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-self: end;
}
.walle-workbar-actions button,
.walle-work-row-actions button {
  height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(122,162,247,0.34);
  border-radius: 9px;
  background: rgba(122,162,247,0.12);
  color: var(--fg, #c0caf5);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}
.walle-workbar-actions button:hover,
.walle-workbar-actions button:focus-visible,
.walle-work-row-actions button:hover,
.walle-work-row-actions button:focus-visible {
  border-color: rgba(122,162,247,0.72);
  outline: none;
}
.walle-workbar-actions button.danger,
.walle-workbar-stop,
.walle-work-row-actions button.danger {
  border-color: rgba(247,118,142,0.38);
  background: rgba(247,118,142,0.12);
  color: #fecdd3;
}
.walle-work-drawer {
  grid-column: 1 / -1;
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px solid rgba(122,162,247,0.16);
}
.walle-work-drawer-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.walle-work-drawer-head strong {
  font-size: 12px;
  letter-spacing: 0.02em;
}
.walle-work-drawer-head span {
  color: var(--fg-dim, #565f89);
  font-size: 11px;
}
.walle-work-group {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}
.walle-work-group-title {
  color: #f6c177;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.walle-work-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 9px;
  border: 1px solid rgba(122,162,247,0.14);
  border-radius: 11px;
  background: rgba(12,15,29,0.42);
}
.walle-work-row.completed {
  opacity: 0.72;
}
.walle-work-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #a3e635;
  box-shadow: 0 0 0 4px rgba(163,230,53,0.08);
}
.walle-work-row.failed .walle-work-dot,
.walle-work-row.cancelled .walle-work-dot,
.walle-work-row.stopped .walle-work-dot {
  background: #f7768e;
  box-shadow: 0 0 0 4px rgba(247,118,142,0.10);
}
.walle-work-row.completed .walle-work-dot {
  background: #7aa2f7;
  box-shadow: 0 0 0 4px rgba(122,162,247,0.08);
}
.walle-work-row-body {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.walle-work-row-title,
.walle-work-row-preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.walle-work-row-title {
  font-size: 12px;
  font-weight: 800;
}
.walle-work-row-meta,
.walle-work-row-preview,
.walle-work-empty {
  color: var(--fg-dim, #7f849c);
  font-size: 11px;
}
.walle-work-focus {
  outline: 2px solid rgba(245,158,11,0.75);
  outline-offset: 3px;
}
.walle-queued-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid rgba(245,158,11,0.34);
  border-left: 3px solid #f59e0b;
  border-radius: 8px;
  background: rgba(245,158,11,0.08);
}
.walle-queued-body {
  min-width: 0;
}
.walle-queued-label {
  color: #fbbf24;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}
.walle-queued-title {
  margin-top: 2px;
  color: var(--fg, #c0caf5);
  font-size: 12px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.walle-queued-reason {
  margin-top: 2px;
  color: var(--fg-dim, #565f89);
  font-size: 11px;
  line-height: 1.35;
}
.walle-queued-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.walle-queued-actions button {
  height: 26px;
  padding: 0 9px;
  border: 1px solid rgba(122,162,247,0.34);
  border-radius: 7px;
  background: rgba(122,162,247,0.10);
  color: var(--fg, #c0caf5);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.walle-queued-actions button:hover,
.walle-queued-actions button:focus-visible {
  border-color: rgba(122,162,247,0.70);
  outline: none;
}
.walle-queued-actions button.danger {
  border-color: rgba(247,118,142,0.34);
  background: rgba(247,118,142,0.10);
  color: #fca5a5;
}

/* ── Inline queued-prompt bubbles (pinned to the bottom of the message list) ── */
.walle-pending-queue {
  order: 9999; /* flex column → always render last, even while Wall-E streams */
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 2px;
}
.walle-pending-queue::before {
  content: "";
  display: block;
  border-top: 1px dashed var(--border, #3b4261);
  opacity: 0.6;
  margin: 2px 8px 0;
}
.walle-msg-pending {
  opacity: 0.74;
  border-left: 2px dashed rgba(122, 162, 247, 0.55);
  background: rgba(122, 162, 247, 0.05);
}
.walle-msg-pending.sending {
  opacity: 0.9;
  border-left-style: solid;
}
.walle-msg-pending[draggable="true"] { cursor: grab; }
.walle-msg-pending.dragging {
  opacity: 0.4;
  cursor: grabbing;
  border-left-color: #7aa2f7;
}
.walle-pending-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #7aa2f7;
  background: rgba(122, 162, 247, 0.12);
  border-radius: 999px;
  padding: 1px 7px;
  margin-left: 6px;
}
.walle-pending-actions {
  margin-left: auto;
  display: inline-flex;
  gap: 4px;
}
.walle-pending-action {
  border: 1px solid var(--border, #3b4261);
  background: transparent;
  color: var(--text-dim, #a9b1d6);
  border-radius: 5px;
  width: 22px;
  height: 20px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.walle-pending-action:hover,
.walle-pending-action:focus-visible {
  border-color: #7aa2f7;
  color: #c0caf5;
  outline: none;
}
.walle-pending-action.danger:hover,
.walle-pending-action.danger:focus-visible {
  border-color: rgba(247, 118, 142, 0.6);
  color: #fca5a5;
}
.walle-pending-content {
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Thin one-line queue status above the composer (replaces the yellow card) ── */
.walle-queue-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px;
  border: 1px solid rgba(122, 162, 247, 0.28);
  background: rgba(122, 162, 247, 0.07);
  border-radius: 7px;
  font-size: 12px;
  color: var(--text-dim, #a9b1d6);
}
.walle-queue-status.waiting {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.08);
  color: #fcd34d;
}
.walle-queue-status-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.walle-queue-status-actions {
  display: inline-flex;
  gap: 6px;
  flex: 0 0 auto;
}
.walle-queue-status-btn {
  border: 1px solid var(--border, #3b4261);
  background: rgba(122, 162, 247, 0.10);
  color: #c0caf5;
  border-radius: 5px;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.walle-queue-status-btn:hover,
.walle-queue-status-btn:focus-visible {
  border-color: #7aa2f7;
  outline: none;
}
.walle-queue-status-btn.danger {
  border-color: rgba(247, 118, 142, 0.34);
  background: rgba(247, 118, 142, 0.10);
  color: #fca5a5;
}
.walle-composer-shell {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(122,162,247,0.06), rgba(15,19,36,0.06)),
    var(--bg, #1a1b26);
  border: 1px solid var(--border, #3b4261);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.035);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.walle-composer-shell:focus-within {
  border-color: rgba(245,158,11,0.88);
  box-shadow:
    0 0 0 1px rgba(245,158,11,0.18),
    0 10px 28px rgba(0,0,0,0.18),
    inset 0 1px 0 rgba(255,255,255,0.04);
}
.walle-md-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(59,66,97,0.78);
  background: rgba(36,40,59,0.78);
  overflow-x: auto;
  scrollbar-width: thin;
}
.walle-md-toolbar-group {
  display: flex;
  align-items: center;
  gap: 3px;
  padding-right: 6px;
  margin-right: 2px;
  border-right: 1px solid rgba(86,95,137,0.35);
}
.walle-md-toolbar-group:last-child {
  border-right: 0;
  margin-left: auto;
  padding-right: 0;
}
.walle-md-btn {
  height: 26px;
  min-width: 28px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--fg-dim, #565f89);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s, transform 0.12s;
}
.walle-md-btn:hover,
.walle-md-btn:focus-visible {
  background: rgba(122,162,247,0.14);
  border-color: rgba(122,162,247,0.36);
  color: var(--fg, #c0caf5);
  outline: none;
}
.walle-md-btn:active {
  transform: translateY(1px);
}
.walle-md-btn.active,
.walle-md-btn[aria-pressed="true"] {
  background: rgba(245,158,11,0.18);
  border-color: rgba(245,158,11,0.48);
  color: #fbbf24;
}
.walle-attachment-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2px 0 8px;
}
.walle-attachment-strip.composer {
  margin: 0;
}
.walle-attachment-thumb {
  position: relative;
  width: 54px;
  height: 54px;
  padding: 0;
  border: 1px solid var(--border, #3b4261);
  border-radius: 6px;
  background: var(--bg, #1a1b26);
  overflow: hidden;
  cursor: zoom-in;
}
.walle-attachment-thumb:hover,
.walle-attachment-thumb:focus-visible {
  border-color: #7aa2f7;
  outline: none;
  box-shadow: 0 0 0 1px rgba(122,162,247,0.25);
}
.walle-attachment-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.walle-attachment-thumb--pending {
  cursor: progress;
  display: flex;
  align-items: center;
  justify-content: center;
}
.walle-attachment-thumb--pending:hover,
.walle-attachment-thumb--pending:focus-visible {
  border-color: var(--border, #3b4261);
  box-shadow: none;
}
.walle-attachment-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(122, 162, 247, 0.25);
  border-top-color: #7aa2f7;
  animation: walle-attachment-spin 0.7s linear infinite;
}
@keyframes walle-attachment-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .walle-attachment-spinner { animation-duration: 1.6s; }
}
.walle-attachment-token {
  position: absolute;
  left: 3px;
  right: 3px;
  bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 4px;
  padding: 1px 3px;
  background: rgba(10, 14, 28, 0.74);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 13px;
  pointer-events: none;
}
.walle-attachment-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(247,118,142,0.95);
  color: #fff;
  font-size: 13px;
  line-height: 15px;
  font-weight: 700;
  cursor: pointer;
}
.walle-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  background: transparent;
  color: var(--fg, #c0caf5);
  border: 0;
  border-radius: 0;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  min-height: 44px;
  max-height: min(38vh, 260px);
  line-height: 1.45;
  outline: none;
  overflow-y: hidden;
  white-space: pre-wrap;
  word-break: break-word;
}
.walle-input:focus {
  outline: none;
}
.walle-input::placeholder {
  color: var(--fg-dim, #565f89);
}
.walle-input.is-scrollable {
  overflow-y: auto;
}
.walle-md-preview {
  border-top: 1px solid rgba(59,66,97,0.78);
  padding: 10px 12px 12px;
  max-height: min(34vh, 220px);
  overflow: auto;
  background: rgba(15,19,36,0.58);
  color: var(--fg, #c0caf5);
  font-size: 13px;
  line-height: 1.5;
}
.walle-md-preview.open {
  display: block;
}
.walle-md-preview-empty {
  color: var(--fg-dim, #565f89);
  font-style: italic;
}
.walle-md-preview > :first-child {
  margin-top: 0;
}
.walle-md-preview > :last-child {
  margin-bottom: 0;
}
.walle-md-preview pre {
  background: rgba(0,0,0,0.24);
  border: 1px solid rgba(86,95,137,0.35);
  border-radius: 8px;
  padding: 10px;
  overflow: auto;
}
.walle-md-preview code {
  background: rgba(122,162,247,0.12);
  border-radius: 4px;
  padding: 1px 4px;
}
.walle-md-preview pre code {
  background: transparent;
  padding: 0;
}
.walle-attach-btn {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border, #3b4261);
  border-radius: 8px;
  background: var(--bg, #1a1b26);
  color: var(--fg, #c0caf5);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.walle-attach-btn:hover,
.walle-attach-btn:focus-visible {
  border-color: #7aa2f7;
  outline: none;
}
.walle-attach-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.walle-send-btn {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.walle-send-btn:hover {
  opacity: 0.9;
}
.walle-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.walle-input-hints {
  font-size: 10px;
  color: var(--fg-dim, #565f89);
  padding: 0 16px 6px;
  background: var(--bg-card, #24283b);
  flex-shrink: 0;
}

@media (max-width: 720px) {
  .walle-input-bar {
    gap: 6px;
    padding: 8px 10px 10px;
  }
  .walle-md-toolbar {
    padding: 5px 6px;
  }
  .walle-md-btn {
    height: 30px;
    min-width: 34px;
    padding: 0 9px;
  }
  .walle-input {
    font-size: 16px;
    min-height: 48px;
    max-height: 32vh;
  }
  .walle-workbar-slot {
    padding: 0 10px;
  }
  .walle-workbar {
    grid-template-columns: 1fr auto;
    gap: 8px;
  }
  .walle-workbar-summary {
    grid-column: 1 / -1;
    white-space: normal;
  }
  .walle-work-row {
    grid-template-columns: 10px minmax(0, 1fr);
  }
  .walle-work-row-actions {
    grid-column: 2;
  }
  .walle-send-btn {
    min-height: 40px;
    padding: 8px 13px;
  }
}
.walle-msg-body img {
  max-width: min(560px, 100%);
  max-height: 360px;
  border: 1px solid var(--border, #3b4261);
  border-radius: 6px;
  cursor: zoom-in;
}
.walle-image-viewer {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(5, 8, 15, 0.88);
  cursor: zoom-out;
}
.walle-image-viewer img {
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0,0,0,0.55);
  cursor: default;
}

/* --- Thinking indicator --- */
.walle-thinking {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
  color: var(--fg-dim, #565f89);
  font-size: 13px;
}
.walle-thinking-dots span {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #f59e0b;
  border-radius: 50%;
  animation: walle-dot-bounce 1.4s ease-in-out infinite;
}
.walle-thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.walle-thinking-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes walle-dot-bounce {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* --- Error notice --- */
.walle-error-notice {
  background: rgba(247,118,142,0.12);
  border: 1px solid rgba(247,118,142,0.3);
  border-radius: 6px;
  padding: 8px 12px;
  color: #f7768e;
  font-size: 13px;
  margin: 6px 0;
}
.walle-error-notice.provider {
  border-left: 3px solid #f7768e;
  color: #f2c0c8;
}
.walle-error-title {
  color: #fff;
  font-weight: 700;
  margin-bottom: 3px;
}
.walle-error-body {
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.walle-error-details {
  margin-top: 6px;
  color: #d7dde8;
}
.walle-error-details summary {
  cursor: pointer;
  color: #9fb0c8;
}
.walle-error-details pre {
  margin: 6px 0 0;
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: #cbd5e1;
  font-size: 11px;
  line-height: 1.4;
}
.walle-error-actions {
  margin-top: 8px;
}
.walle-session-action-btn {
  padding: 5px 12px;
  border-radius: 5px;
  border: 1px solid var(--border, #414868);
  background: var(--bg-light, #24283b);
  color: var(--fg, #c0caf5);
  cursor: pointer;
  font-size: 12px;
}
.walle-session-action-btn.primary {
  background: var(--accent, #7aa2f7);
  border-color: var(--accent, #7aa2f7);
  color: #111827;
  font-weight: 700;
}

/* Permission Request Card */
.walle-perm-card {
  margin: 8px 48px 8px 48px;
  padding: 12px 14px;
  border: 1px solid #f59e0b44;
  border-left: 3px solid #f59e0b;
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg-light) 90%, #f59e0b 10%);
}
.walle-perm-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #f59e0b;
}
.walle-perm-detail {
  font-size: 12px;
  color: var(--fg-dim);
  margin-bottom: 4px;
  font-family: 'SF Mono', 'Menlo', monospace;
}
.walle-perm-detail code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
}
.walle-perm-reason {
  font-size: 11px;
  color: var(--fg-dim);
  margin-bottom: 10px;
}
.walle-perm-actions {
  display: flex;
  gap: 8px;
}
.walle-perm-actions button {
  padding: 5px 12px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.walle-perm-actions button:hover {
  border-color: var(--fg-dim);
}
.walle-perm-actions .perm-allow-once {
  background: #22c55e22;
  border-color: #22c55e44;
  color: #22c55e;
}
.walle-perm-actions .perm-allow-once:hover {
  background: #22c55e33;
}
.walle-perm-actions .perm-allow-always {
  background: #3b82f622;
  border-color: #3b82f644;
  color: #3b82f6;
}
.walle-perm-actions .perm-allow-always:hover {
  background: #3b82f633;
}
.walle-perm-actions .perm-deny {
  background: #ef444422;
  border-color: #ef444444;
  color: #ef4444;
}
.walle-perm-actions .perm-deny:hover {
  background: #ef444433;
}
.walle-perm-card.resolved {
  opacity: 0.6;
  pointer-events: none;
}
.walle-perm-card.resolved .walle-perm-actions {
  display: none;
}
.walle-perm-card.resolved::after {
  content: attr(data-resolved);
  display: block;
  font-size: 11px;
  font-weight: 500;
  margin-top: 6px;
}
.walle-perm-card.resolved.perm-approved::after {
  color: #22c55e;
}
.walle-perm-card.resolved.perm-denied::after {
  color: #ef4444;
}

/* Light theme for Wall-E chat/session chrome. Terminal sessions now resolve
   through the shared xterm theme contract; these selectors cover Wall-E's DOM
   chat UI. */
html[data-theme="light"] .session-item[data-agent="walle"] {
  background: #fff8e7;
}
html[data-theme="light"] .session-item[data-agent="walle"].active {
  box-shadow: 0 0 0 1px rgba(154,103,0,0.28);
}
html[data-theme="light"] .agent-badge.walle {
  background: rgba(154,103,0,0.12);
  color: #8a5700;
}
html[data-theme="light"] .walle-session,
html[data-theme="light"] .walle-messages {
  background: var(--bg);
}
html[data-theme="light"] .walle-session-header,
html[data-theme="light"] .walle-input-bar,
html[data-theme="light"] .walle-input-hints,
html[data-theme="light"] .walle-md-toolbar,
html[data-theme="light"] .walle-composer-resize {
  background: var(--bg-card);
}
html[data-theme="light"] .walle-composer-resize-grip {
  background: rgba(37,99,235,0.22);
  box-shadow: 0 0 0 1px rgba(37,99,235,0.08);
}
html[data-theme="light"] .walle-composer-resize:hover,
html[data-theme="light"] .walle-composer-resize:focus-visible,
html[data-theme="light"] .walle-composer-resize.dragging {
  background: color-mix(in srgb, var(--bg-card) 86%, #2563eb);
  border-top-color: rgba(37,99,235,0.45);
}
html[data-theme="light"] .walle-composer-resize:hover .walle-composer-resize-grip,
html[data-theme="light"] .walle-composer-resize:focus-visible .walle-composer-resize-grip,
html[data-theme="light"] .walle-composer-resize.dragging .walle-composer-resize-grip {
  background: rgba(37,99,235,0.58);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.12);
}
html[data-theme="light"] .walle-composer-shell {
  background: var(--bg-input);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.72);
}
html[data-theme="light"] .walle-composer-shell:focus-within {
  border-color: rgba(154,103,0,0.55);
  box-shadow:
    0 0 0 2px rgba(154,103,0,0.08),
    0 8px 22px rgba(34,49,73,0.08),
    inset 0 1px 0 rgba(255,255,255,0.72);
}
html[data-theme="light"] .walle-queued-card {
  background: rgba(146,64,14,0.06);
  border-color: rgba(146,64,14,0.22);
  border-left-color: #b45309;
}
html[data-theme="light"] .walle-workbar-slot {
  background: var(--bg);
}
html[data-theme="light"] .walle-workbar {
  background:
    radial-gradient(circle at 18px 10px, rgba(180,83,9,0.10), transparent 150px),
    linear-gradient(135deg, rgba(255,255,255,0.96), rgba(246,248,252,0.94));
  border-color: rgba(59,102,224,0.20);
  box-shadow: 0 12px 28px rgba(34,49,73,0.10), inset 0 1px 0 rgba(255,255,255,0.9);
}
html[data-theme="light"] .walle-workbar-kicker,
html[data-theme="light"] .walle-work-group-title {
  color: #92400e;
}
html[data-theme="light"] .walle-work-chip {
  background: rgba(59,102,224,0.06);
  color: #334155;
}
html[data-theme="light"] .walle-work-chip.active { color: #166534; background: rgba(22,163,74,0.08); border-color: rgba(22,163,74,0.22); }
html[data-theme="light"] .walle-work-chip.shell { color: #92400e; background: rgba(180,83,9,0.08); border-color: rgba(180,83,9,0.22); }
html[data-theme="light"] .walle-work-chip.done,
html[data-theme="light"] .walle-work-chip.isolated {
  color: #64748b;
  background: rgba(100,116,139,0.06);
}
html[data-theme="light"] .walle-work-row {
  background: rgba(255,255,255,0.66);
  border-color: rgba(59,102,224,0.14);
}
html[data-theme="light"] .walle-workbar-actions button,
html[data-theme="light"] .walle-work-row-actions button {
  background: rgba(59,102,224,0.08);
  color: var(--accent);
}
html[data-theme="light"] .walle-workbar-actions button.danger,
html[data-theme="light"] .walle-workbar-stop,
html[data-theme="light"] .walle-work-row-actions button.danger {
  background: rgba(185,28,28,0.08);
  color: var(--red);
}
html[data-theme="light"] .walle-queued-label {
  color: #92400e;
}
html[data-theme="light"] .walle-queued-actions button {
  background: rgba(59,102,224,0.08);
  color: var(--accent);
}
html[data-theme="light"] .walle-queued-actions button.danger {
  background: rgba(185,28,28,0.08);
  color: var(--red);
}
html[data-theme="light"] .walle-md-toolbar {
  border-bottom-color: var(--border);
}
html[data-theme="light"] .walle-header-overflow:hover,
html[data-theme="light"] .walle-header-overflow:focus-visible,
html[data-theme="light"] .walle-header-overflow-item:hover,
html[data-theme="light"] .walle-header-overflow-item:focus-visible,
html[data-theme="light"] .walle-tool-header:hover,
html[data-theme="light"] .walle-empty-chip:hover,
html[data-theme="light"] .walle-empty-chip:focus-visible {
  background: var(--bg-hover);
}
html[data-theme="light"] .walle-header-overflow-menu,
html[data-theme="light"] .walle-model-picker-menu,
html[data-theme="light"] .walle-tool-card,
html[data-theme="light"] .walle-tool-group,
html[data-theme="light"] .walle-empty-chip,
html[data-theme="light"] .walle-history-loading-state,
html[data-theme="light"] .walle-input,
html[data-theme="light"] .walle-edit-card,
html[data-theme="light"] .walle-session-header .model-select,
html[data-theme="light"] .walle-model-picker-btn {
  background: var(--bg-card);
}
html[data-theme="light"] .walle-history-loading-state {
  border-color: rgba(37,99,235,0.18);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.94), rgba(246,248,252,0.92)),
    var(--bg-card);
  box-shadow: 0 18px 38px rgba(34,49,73,0.10), inset 0 1px 0 rgba(255,255,255,0.9);
}
html[data-theme="light"] .walle-history-loading-badge {
  border-color: rgba(37,99,235,0.22);
  background: rgba(37,99,235,0.07);
  color: #2454c6;
}
html[data-theme="light"] .walle-history-loading-spinner {
  border-color: rgba(37,99,235,0.18);
  border-top-color: #2563eb;
}
html[data-theme="light"] .walle-history-loading-copy {
  color: var(--fg-muted);
}
html[data-theme="light"] .walle-history-loading-line {
  background: linear-gradient(90deg, rgba(37,99,235,0.06), rgba(37,99,235,0.18), rgba(37,99,235,0.06));
  background-size: 180% 100%;
}
html[data-theme="light"] .walle-edit-input {
  background: var(--bg-input);
  color: var(--fg);
}
html[data-theme="light"] .walle-msg-action,
html[data-theme="light"] .walle-branch-btn {
  background: rgba(255,255,255,0.88);
  color: var(--accent);
}
html[data-theme="light"] .walle-msg-action:hover,
html[data-theme="light"] .walle-msg-action:focus-visible,
html[data-theme="light"] .walle-branch-btn:hover,
html[data-theme="light"] .walle-branch-btn:focus-visible {
  background: var(--bg-hover);
  color: var(--fg);
}
html[data-theme="light"] .walle-msg[data-walle-role="assistant"] {
  background: rgba(146,64,14,0.045);
  border-left-color: rgba(146,64,14,0.28);
}
html[data-theme="light"] .walle-msg-body code {
  background: var(--code-bg);
}
html[data-theme="light"] .walle-msg-body pre,
html[data-theme="light"] .walle-tool-output,
html[data-theme="light"] .walle-tool-detail,
html[data-theme="light"] .walle-tool-group-body,
html[data-theme="light"] .walle-perm-detail code {
  background: #f1f3f6;
  border: 1px solid rgba(15,23,42,0.06);
}
html[data-theme="light"] .walle-tool-detail-pre {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.96), rgba(248,250,252,0.98)),
    radial-gradient(circle at 0 0, rgba(37,99,235,0.08), transparent 34%);
  border-color: rgba(15,23,42,0.10);
  color: #1e293b;
}
html[data-theme="light"] .walle-live-activity-row:hover,
html[data-theme="light"] .walle-live-activity-row:focus-visible,
html[data-theme="light"] .walle-live-activity-item[open] > .walle-live-activity-row {
  background: rgba(15,23,42,0.045);
}
html[data-theme="light"] .walle-live-activity-more {
  background: rgba(37,99,235,0.08);
}
html[data-theme="light"] .walle-live-activity-more:hover,
html[data-theme="light"] .walle-live-activity-more:focus-visible {
  background: rgba(37,99,235,0.14);
  color: var(--fg);
}
html[data-theme="light"] .walle-msg-body th {
  background: var(--bg-lighter);
}
html[data-theme="light"] .walle-copy-btn {
  background: rgba(255,255,255,0.94);
  color: var(--accent);
}
html[data-theme="light"] .walle-copy-btn:hover {
  background: var(--accent);
  color: var(--accent-fg);
}
html[data-theme="light"] .walle-error-notice.provider {
  color: #7f1d1d;
}
html[data-theme="light"] .walle-error-title {
  color: #7f1d1d;
}
html[data-theme="light"] .walle-error-details,
html[data-theme="light"] .walle-error-details summary,
html[data-theme="light"] .walle-error-details pre {
  color: #334155;
}
html[data-theme="light"] .walle-image-viewer {
  background: var(--overlay-bg);
}
