/* ==================== MAIN CONTENT ==================== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--color-bg-primary);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  min-width: 0;
  position: relative;
  container-type: inline-size;
  padding-top: var(--title-bar-height);
  /* Space for title bar */
  transition: margin 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Removed: double-border effect - using single border only */

.main-header {
  padding: 0 20px;
  border-bottom: none;
  display: flex;
  align-items: center;
  gap: 12px;
  -webkit-app-region: drag;
  height: 28px;
  background: transparent;
  position: relative;
  z-index: 10;
  overflow: visible;
}

.main-header-back-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: 0 -4px 0 0;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  -webkit-app-region: no-drag;
  transition: color 0.15s, background 0.15s;
}
.main-header-back-btn:hover {
  color: var(--color-text);
  background: var(--color-bg-hover);
}

/* Parent thread pill button (sub-agent back navigation) */
.main-header-parent-thread-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  margin: 0 4px 0 0;
  border-radius: 9999px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-tertiary);
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  -webkit-app-region: no-drag;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.main-header-parent-thread-btn:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-hover);
  border-color: var(--color-border-light);
}
.theme-light .main-header-parent-thread-btn {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.12);
  color: var(--color-text-secondary);
}
.theme-light .main-header-parent-thread-btn:hover {
  background: rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 0, 0, 0.18);
  color: var(--color-text-primary);
}

.main-header-title {
  flex: 0 1 auto;
  min-width: 0;
  max-width: min(720px, calc(100cqw - 120px));
  font-size: 14px;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  -webkit-app-region: no-drag;
  cursor: default;
}

.main-header-title-group {
  flex: 1 1 auto;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.main-header-task-menu-container {
  position: relative;
  flex-shrink: 0;
  -webkit-app-region: no-drag;
}

.main-header-task-menu-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 0;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.main-header-task-menu-btn:hover,
.main-header-task-menu-btn:focus-visible,
.main-header-task-menu-btn.active {
  background: var(--color-bg-hover);
  color: var(--color-text);
  outline: none;
}

.main-header-task-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 1000;
  min-width: 220px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md, 8px);
  background: #1a1d23 !important;
  background-color: #1a1d23 !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  font-family: var(--font-ui);
  isolation: isolate;
  opacity: 1;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  -webkit-app-region: no-drag;
}

.main-header-task-menu-item {
  width: 100%;
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 6px 8px;
  border: 0;
  border-radius: var(--radius-sm, 6px);
  background: transparent;
  color: var(--color-text-secondary, #9ca3af);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-ui);
  text-align: left;
  cursor: pointer;
  transition:
    background 0.12s ease,
    color 0.12s ease;
}

.main-header-task-menu-item svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: currentColor;
}

.main-header-task-menu-item span {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
}

.main-header-task-menu-item:hover,
.main-header-task-menu-item:focus-visible {
  background: var(--color-bg-hover, rgba(255, 255, 255, 0.05));
  color: var(--color-text-primary, #e5e7eb);
  outline: none;
}

.main-header-task-menu-item:disabled {
  cursor: default;
  color: var(--color-text-muted);
  opacity: 0.52;
}

.main-header-task-menu-item:disabled:hover {
  background: transparent;
}

.main-header-task-menu-divider {
  display: none;
}

.theme-light .main-header-task-menu {
  background: #ffffff !important;
  background-color: #ffffff !important;
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.theme-light .main-header-task-menu-item {
  color: var(--color-text-secondary, #4b5563);
}

.theme-light .main-header-task-menu-item:hover,
.theme-light .main-header-task-menu-item:focus-visible {
  background: var(--color-bg-hover, rgba(0, 0, 0, 0.05));
  color: var(--color-text-primary, #111827);
}

.legal-intake-card {
  width: min(100%, 920px);
  margin: 14px auto 22px;
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.12));
  border-radius: 8px;
  background: var(--color-bg-secondary, rgba(255, 255, 255, 0.04));
  color: var(--color-text-primary);
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

.legal-intake-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--color-border, rgba(255, 255, 255, 0.1));
}

.legal-intake-card-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-size: 15px;
  font-weight: 650;
  color: var(--color-text-primary);
}

.legal-intake-command-pill {
  max-width: min(360px, 42vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.12));
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.legal-intake-dismiss {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
}

.legal-intake-dismiss:hover,
.legal-intake-dismiss:focus-visible {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
  outline: none;
}

.legal-intake-card-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding: 18px;
}

.legal-intake-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 8px;
  color: var(--color-text-primary);
  font-size: 13px;
  font-weight: 600;
}

.legal-intake-field-full {
  grid-column: 1 / -1;
}

.legal-intake-input,
.legal-intake-textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.12));
  border-radius: 8px;
  background: var(--color-bg-primary, rgba(0, 0, 0, 0.12));
  color: var(--color-text-primary);
  font: inherit;
  font-weight: 400;
  line-height: 1.45;
  padding: 10px 12px;
  resize: vertical;
}

.legal-intake-input {
  min-height: 40px;
}

.legal-intake-textarea {
  min-height: 76px;
}

.legal-intake-input:focus,
.legal-intake-textarea:focus {
  border-color: rgba(124, 92, 255, 0.75);
  outline: 2px solid rgba(124, 92, 255, 0.2);
  outline-offset: 0;
}

.legal-intake-input::placeholder,
.legal-intake-textarea::placeholder {
  color: var(--color-text-muted);
}

.legal-intake-type-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.legal-intake-type-option {
  min-height: 76px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.12));
  border-radius: 8px;
  background: transparent;
  color: var(--color-text-primary);
  text-align: left;
  cursor: pointer;
}

.legal-intake-type-option:hover,
.legal-intake-type-option:focus-visible,
.legal-intake-chip:hover,
.legal-intake-chip:focus-visible {
  border-color: rgba(124, 92, 255, 0.55);
  background: rgba(124, 92, 255, 0.08);
  outline: none;
}

.legal-intake-type-option.selected,
.legal-intake-chip.selected {
  border-color: rgba(124, 92, 255, 0.75);
  background: rgba(124, 92, 255, 0.14);
  color: var(--color-text-primary);
}

.legal-intake-type-title {
  font-size: 13px;
  font-weight: 650;
}

.legal-intake-type-description {
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.35;
}

.legal-intake-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.legal-intake-chip {
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.12));
  border-radius: 999px;
  background: transparent;
  color: var(--color-text-secondary);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.legal-intake-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid var(--color-border, rgba(255, 255, 255, 0.1));
}

.legal-intake-footer-note {
  color: var(--color-text-secondary);
  font-size: 12px;
}

.legal-intake-submit {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid rgba(124, 92, 255, 0.7);
  border-radius: 8px;
  background: rgba(124, 92, 255, 0.18);
  color: var(--color-text-primary);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.legal-intake-submit:hover,
.legal-intake-submit:focus-visible {
  background: rgba(124, 92, 255, 0.26);
  outline: none;
}

.legal-intake-submit:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.theme-light .legal-intake-card {
  background: #ffffff;
  border-color: rgba(17, 24, 39, 0.12);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.theme-light .legal-intake-input,
.theme-light .legal-intake-textarea {
  background: #f9fafb;
  border-color: rgba(17, 24, 39, 0.14);
}

.theme-light .legal-intake-type-option,
.theme-light .legal-intake-chip {
  border-color: rgba(17, 24, 39, 0.14);
}

.theme-light .legal-intake-command-pill {
  border-color: rgba(17, 24, 39, 0.14);
}

@media (max-width: 760px) {
  .legal-intake-card-body,
  .legal-intake-type-grid {
    grid-template-columns: 1fr;
  }

  .legal-intake-card-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .legal-intake-submit {
    width: 100%;
  }
}

.task-automation-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: rgba(0, 0, 0, 0.46);
  -webkit-app-region: no-drag;
}

.task-automation-modal {
  width: min(920px, calc(100vw - 64px));
  min-height: min(560px, calc(100vh - 64px));
  max-height: calc(100vh - 64px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: visible;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 22px;
  background: #17191f;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  color: var(--color-text-primary, #f3f4f6);
  font-family: var(--font-ui);
}

.task-automation-modal-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 28px 12px;
}

.task-automation-modal-header h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  font-weight: 500;
  letter-spacing: 0;
}

.task-automation-modal-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.task-automation-header-btn,
.task-automation-close-btn {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-text-primary, #f3f4f6);
  cursor: pointer;
  transition:
    background 0.14s ease,
    border-color 0.14s ease,
    color 0.14s ease;
}

.task-automation-header-btn {
  height: 36px;
  padding: 0 14px;
  border-radius: 13px;
  font-size: 14px;
  font-weight: 500;
}

.task-automation-header-btn.muted {
  border-color: transparent;
  background: transparent;
  color: var(--color-text-muted, #9ca3af);
}

.task-automation-close-btn {
  position: relative;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-color: transparent;
  border-radius: 999px;
  background: transparent;
  color: #d1d5db;
}

.task-automation-close-btn svg {
  display: none;
}

.task-automation-close-btn::before,
.task-automation-close-btn::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 15px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform-origin: center;
}

.task-automation-close-btn::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.task-automation-close-btn::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.task-automation-header-btn:hover:not(:disabled),
.task-automation-close-btn:hover:not(:disabled),
.task-automation-header-btn:focus-visible,
.task-automation-close-btn:focus-visible {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.16);
  outline: none;
}

.task-automation-modal-body {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 14px;
  padding: 10px 28px 18px;
}

.task-automation-custom-schedule {
  display: grid;
  gap: 7px;
  color: var(--color-text-muted, #9ca3af);
  font-size: 12px;
  font-weight: 500;
}

.task-automation-custom-schedule input {
  width: 100%;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--color-text-primary, #f3f4f6);
  padding: 0 12px;
  font-size: 14px;
  font-family: var(--font-ui);
}

.task-automation-prompt-input {
  width: 100%;
  min-height: 260px;
  resize: none;
  border: 0;
  outline: none;
  border-radius: 0;
  background: transparent;
  color: var(--color-text-primary, #f3f4f6);
  font-size: 18px;
  line-height: 1.45;
  font-family: var(--font-ui);
}

.task-automation-prompt-input::placeholder,
.task-automation-custom-schedule input::placeholder {
  color: var(--color-text-muted, #8f949e);
}

.task-automation-custom-schedule input:focus {
  border-color: rgba(var(--color-accent-rgb, 139, 92, 246), 0.55);
  outline: none;
  box-shadow: 0 0 0 3px rgba(var(--color-accent-rgb, 139, 92, 246), 0.14);
}

.task-automation-error {
  min-height: 26px;
  display: flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  font-size: 13px;
}

.task-automation-created-response {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid rgba(34, 197, 94, 0.28);
  border-radius: 8px;
  background: rgba(34, 197, 94, 0.12);
  color: var(--color-text-primary);
  font-size: 13px;
}

.task-automation-created-response div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.task-automation-created-response span {
  color: var(--color-text-secondary);
  overflow-wrap: anywhere;
}

.task-automation-created-response button {
  appearance: none;
  border: 1px solid rgba(34, 197, 94, 0.35);
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.16);
  color: var(--color-text-primary);
  padding: 6px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.task-automation-modal-footer {
  position: relative;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px 24px;
}

.task-automation-footer-controls,
.task-automation-footer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.task-automation-select-wrap {
  position: relative;
  min-width: 0;
}

.task-automation-name-pill {
  height: 38px;
  max-width: min(320px, 32vw);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-text-primary, #f3f4f6);
  padding: 0 12px;
  min-width: 180px;
}

.task-automation-name-pill input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: inherit;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-ui);
}

.task-automation-name-pill input::placeholder {
  color: var(--color-text-muted, #8f949e);
}

.task-automation-name-pill:focus-within {
  box-shadow: 0 0 0 3px rgba(var(--color-accent-rgb, 139, 92, 246), 0.14);
}

.task-automation-pill-control {
  height: 38px;
  max-width: 260px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-text-primary, #f3f4f6);
  padding: 0 14px;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-ui);
  cursor: pointer;
}

.task-automation-pill-control span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-automation-pill-control:hover:not(:disabled),
.task-automation-pill-control:focus-visible {
  background: rgba(255, 255, 255, 0.13);
  outline: none;
}

.task-automation-popover {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 1;
  width: 230px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  background: #1d2027;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.4);
}

.task-automation-popover.schedule {
  width: 220px;
}

.task-automation-popover-title {
  padding: 4px 8px 8px;
  color: var(--color-text-muted, #9ca3af);
  font-size: 13px;
  font-weight: 500;
}

.task-automation-popover-item {
  width: 100%;
  min-height: 38px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--color-text-primary, #f3f4f6);
  padding: 8px 10px;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-ui);
  text-align: left;
  cursor: pointer;
}

.task-automation-popover.schedule .task-automation-popover-item {
  grid-template-columns: minmax(0, 1fr) auto;
}

.task-automation-popover-item:hover:not(:disabled),
.task-automation-popover-item:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.task-automation-popover-item.selected {
  background: rgba(255, 255, 255, 0.08);
}

.task-automation-popover-item.disabled {
  cursor: default;
  opacity: 0.45;
}

.task-automation-popover-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-automation-secondary-btn,
.task-automation-save-btn {
  height: 38px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-ui);
  cursor: pointer;
}

.task-automation-secondary-btn {
  background: transparent;
  color: var(--color-text-muted, #9ca3af);
}

.task-automation-save-btn {
  min-width: 76px;
  background: var(--color-accent, #8b5cf6);
  color: white;
}

.task-automation-secondary-btn:hover:not(:disabled),
.task-automation-secondary-btn:focus-visible {
  color: var(--color-text-primary, #f3f4f6);
  outline: none;
}

.task-automation-save-btn:hover:not(:disabled),
.task-automation-save-btn:focus-visible {
  filter: brightness(1.06);
  outline: none;
}

.task-automation-header-btn:disabled,
.task-automation-close-btn:disabled,
.task-automation-pill-control:disabled,
.task-automation-secondary-btn:disabled,
.task-automation-save-btn:disabled {
  cursor: default;
  opacity: 0.55;
}

.task-automation-template-grid {
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding: 22px 28px 28px;
}

.task-automation-template-card {
  min-height: 128px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--color-text-primary, #f3f4f6);
  padding: 22px 24px;
  text-align: left;
  cursor: pointer;
  font-family: var(--font-ui);
}

.task-automation-template-card svg {
  color: var(--color-accent, #8b5cf6);
}

.task-automation-template-card span {
  font-size: 18px;
  line-height: 1.32;
  font-weight: 450;
}

.task-automation-template-card:hover,
.task-automation-template-card:focus-visible {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(var(--color-accent-rgb, 139, 92, 246), 0.35);
  outline: none;
}

.theme-light .task-automation-modal-backdrop {
  background: rgba(0, 0, 0, 0.22);
}

.theme-light .task-automation-modal,
.theme-light .task-automation-popover {
  border-color: rgba(0, 0, 0, 0.1);
  background: #ffffff;
  color: var(--color-text-primary, #111827);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.18);
}

.theme-light .task-automation-header-btn,
.theme-light .task-automation-close-btn,
.theme-light .task-automation-custom-schedule input {
  border-color: rgba(0, 0, 0, 0.1);
  background: rgba(0, 0, 0, 0.03);
  color: var(--color-text-primary, #111827);
}

.theme-light .task-automation-header-btn.muted,
.theme-light .task-automation-close-btn {
  background: transparent;
}

.theme-light .task-automation-close-btn {
  color: #374151;
}

.theme-light .task-automation-header-btn:hover:not(:disabled),
.theme-light .task-automation-close-btn:hover:not(:disabled),
.theme-light .task-automation-pill-control:hover:not(:disabled),
.theme-light .task-automation-popover-item:hover:not(:disabled),
.theme-light .task-automation-popover-item.selected,
.theme-light .task-automation-template-card:hover {
  background: rgba(0, 0, 0, 0.06);
}

.theme-light .task-automation-pill-control {
  background: rgba(0, 0, 0, 0.06);
  color: var(--color-text-primary, #111827);
}

.theme-light .task-automation-name-pill {
  background: rgba(0, 0, 0, 0.06);
  color: var(--color-text-primary, #111827);
}

.theme-light .task-automation-template-card {
  border-color: rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.7);
  color: var(--color-text-primary, #111827);
}

.theme-light .task-automation-error {
  background: rgba(239, 68, 68, 0.1);
  color: #b91c1c;
}

@media (max-width: 760px) {
  .task-automation-modal-backdrop {
    padding: 14px;
  }

  .task-automation-modal {
    width: calc(100vw - 28px);
    min-height: min(620px, calc(100vh - 28px));
    max-height: calc(100vh - 28px);
    border-radius: 18px;
  }

  .task-automation-modal-header,
  .task-automation-modal-body,
  .task-automation-modal-footer,
  .task-automation-template-grid {
    padding-left: 18px;
    padding-right: 18px;
  }

  .task-automation-modal-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .task-automation-modal-header-actions {
    align-self: stretch;
    justify-content: flex-end;
  }

  .task-automation-modal-footer,
  .task-automation-footer-controls,
  .task-automation-footer-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .task-automation-pill-control,
  .task-automation-name-pill,
  .task-automation-secondary-btn,
  .task-automation-save-btn {
    width: 100%;
    max-width: none;
    justify-content: center;
  }

  .task-automation-popover {
    width: min(260px, calc(100vw - 56px));
  }

  .task-automation-template-grid {
    grid-template-columns: 1fr;
  }
}

.main-header-actions {
  display: flex;
  gap: 8px;
  -webkit-app-region: no-drag;
}

.main-header-status {
  padding: 0 20px 8px;
  display: flex;
  align-items: center;
  min-height: 24px;
  gap: 8px;
}

/* ── Home Dashboard ─────────────────────────────────────────── */

.home-main-content {
  overflow: auto;
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--color-accent) 14%, transparent), transparent 28%),
    radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--color-success) 10%, transparent), transparent 24%),
    linear-gradient(180deg, color-mix(in srgb, var(--color-bg-primary) 94%, black 6%), var(--color-bg-primary));
}

.home-dashboard {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  max-width: 1100px;
  margin: 0 auto;
}

/* ── New Task Button ─────────────────────────────────────────── */

.home-new-task-section {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  margin-bottom: 24px;
}

.home-new-task-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  background: transparent;
  border: none;
  color: var(--color-text);
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 17px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: var(--radius-lg);
}

.home-new-task-btn:hover {
  opacity: 0.7;
}

.home-new-task-btn svg {
  color: var(--color-text);
  transition: transform 0.2s ease;
}

.home-new-task-btn:hover svg {
  transform: scale(1.1);
}

/* ── Section header ─────────────────────────────────────────── */

.home-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.home-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.home-section-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.home-section-link {
  padding: 0;
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s ease;
}

.home-section-link:hover {
  color: var(--color-text);
}

.home-section-link:disabled {
  color: var(--color-text-muted);
  cursor: default;
}

/* ── Task cards (Running Tasks) ────────────────────────────── */

.home-task-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.home-task-card {
  position: relative;
  overflow: hidden;
  width: 100%;
  min-height: 140px;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 20px;
  background: var(--color-bg-elevated);
  box-shadow: var(--shadow-sm);
  color: var(--color-text);
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
}

.home-task-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04), transparent 36%);
  pointer-events: none;
}

.home-task-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--color-accent) 30%, var(--color-border-light));
  box-shadow: var(--shadow-lg);
}

.home-task-card.tone-live {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--color-accent) 16%, transparent), transparent 62%),
    var(--color-bg-elevated);
}

.home-task-card.tone-queued {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--color-warning, #f59e0b) 14%, transparent), transparent 62%),
    var(--color-bg-elevated);
}

.home-task-card.tone-attention {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--color-error) 14%, transparent), transparent 62%),
    var(--color-bg-elevated);
}

.home-task-title {
  display: block;
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.home-task-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.home-task-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text-secondary);
  font-size: 13px;
}

.home-task-status svg {
  flex-shrink: 0;
}

.home-task-card.tone-live .home-task-status {
  color: var(--color-accent);
}

.home-task-card.tone-live .home-task-status svg {
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

.home-task-time {
  color: var(--color-text-muted);
  font-size: 12px;
  white-space: nowrap;
}

/* ── Automation strip ──────────────────────────────────────── */

.home-automation-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.home-auto-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  padding: 18px;
  background: var(--color-bg-elevated);
  box-shadow: var(--shadow-sm);
  color: var(--color-text);
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.home-auto-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--color-accent) 30%, var(--color-border-light));
  box-shadow: var(--shadow-md);
}

.home-auto-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--color-accent) 12%, transparent);
  color: var(--color-accent);
}

.home-auto-card-copy {
  min-width: 0;
}

.home-auto-card-copy strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-auto-card-copy span {
  display: block;
  margin-top: 3px;
  color: var(--color-text-muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Automation list ──────────────────────────────────────── */

.home-automation-list {
  --home-automation-row-height: 72px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
  height: calc((var(--home-automation-row-height) * 4) + (8px * 3));
  overflow-y: auto;
  padding-right: 6px;
}

.home-automation-panel {
  margin-top: 4px;
}

.home-automation-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: 600;
}

.home-automation-panel-footer {
  margin-top: 10px;
  color: var(--color-text-muted);
  font-size: 12px;
}

.home-automation-row {
  width: 100%;
  min-height: 96px;
  box-sizing: border-box;
  flex-shrink: 0;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 16px 18px;
  background: var(--color-bg-elevated);
  color: var(--color-text);
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 8px;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.home-automation-row:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--color-accent) 30%, var(--color-border-light));
  box-shadow: var(--shadow-md);
}

.home-automation-row.tone-live {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--color-accent) 4%, transparent), transparent 32%),
    var(--color-bg-elevated);
}

.home-automation-row-left {
  min-width: 0;
}

.home-automation-row-left strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-automation-row-left span {
  display: block;
  margin-top: 2px;
  color: var(--color-text-secondary);
  font-size: 12px;
}

.home-automation-row small {
  color: var(--color-text-muted);
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

.home-automation-mail-row {
  min-height: 96px;
}

.home-automation-mail-row-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.home-automation-mail-row-sender {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.home-automation-mail-row-sender strong {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.home-automation-row-time {
  color: var(--color-text-muted);
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

.home-automation-mail-row-subject {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-automation-mail-row-preview {
  color: var(--color-text-secondary);
  font-size: 13px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.home-automation-mail-row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.home-automation-mail-row-meta span {
  padding: 4px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-text) 12%, var(--color-bg-secondary));
  color: var(--color-text-secondary);
  font-size: 11px;
}

/* ── Companion inbox ─────────────────────────────────────── */

.home-automation-inbox {
  margin-top: 4px;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--color-accent) 4%, transparent), transparent 26%),
    var(--color-bg-elevated);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.home-automation-inbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--color-border-subtle);
}

.home-automation-inbox-header h3 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.home-automation-inbox-header p {
  margin-top: 4px;
  color: var(--color-text-muted);
  font-size: 12px;
  line-height: 1.4;
}

.home-automation-inbox-header .home-section-link {
  color: var(--color-text);
}

.home-automation-inbox-header .home-section-link:hover {
  color: var(--color-accent);
}

.home-automation-inbox-list {
  display: flex;
  flex-direction: column;
}

.home-automation-inbox-item {
  width: 100%;
  border: none;
  padding: 16px 24px;
  border-bottom: 1px solid var(--color-border-subtle);
  background: transparent;
  color: inherit;
  text-align: left;
  display: flex;
  align-items: flex-start;
  gap: 20px;
  transition:
    background-color 0.18s ease,
    transform 0.18s ease;
}

.home-automation-inbox-item:hover {
  background: color-mix(in srgb, var(--color-accent) 4%, transparent);
}

.home-automation-inbox-item.selected {
  background: color-mix(in srgb, var(--color-accent) 7%, transparent);
}

.home-automation-inbox-item:last-child {
  border-bottom: none;
}

.home-automation-inbox-item-body {
  flex: 1;
  min-width: 0;
}

.home-automation-inbox-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.home-automation-inbox-item-sender {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.home-automation-inbox-item-sender strong,
.home-automation-inbox-item-sender-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-text);
}

.home-automation-inbox-item-sender-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-automation-inbox-item-subject {
  margin-top: 10px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.35;
  color: var(--color-text);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.home-automation-inbox-pill {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-accent) 14%, transparent);
  color: var(--color-accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-automation-inbox-time {
  color: var(--color-text-muted);
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

.home-automation-inbox-preview {
  margin-top: 6px;
  color: var(--color-text-secondary);
  font-size: 13px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

/* Meta tags as right column in list items */
.home-automation-inbox-item .home-automation-inbox-meta {
  flex-shrink: 0;
  margin-top: 0;
  align-self: flex-start;
  justify-content: flex-end;
}

.home-automation-inbox-reader {
  padding: 14px 18px;
  border-bottom: 1px solid var(--color-border-subtle);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--color-accent) 6%, transparent), transparent 36%),
    var(--color-bg-secondary);
}

.home-automation-inbox-reader-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.home-automation-inbox-reader-from {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.home-automation-inbox-reader-from strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
}

.home-automation-inbox-reader-from span {
  display: block;
  margin-top: 2px;
  color: var(--color-text-muted);
  font-size: 12px;
}

.home-automation-inbox-reader-subject {
  margin-top: 10px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--color-text);
  line-height: 1.35;
}

.home-automation-inbox-reader-body {
  margin-top: 8px;
  color: var(--color-text-secondary);
  font-size: 13px;
  line-height: 1.55;
  max-height: 208px;
  overflow: auto;
  padding-right: 6px;
}

.home-automation-inbox-reader-body > *:first-child {
  margin-top: 0;
}

.home-automation-inbox-reader-body > *:last-child {
  margin-bottom: 0;
}

.home-automation-inbox-reader-body p,
.home-automation-inbox-reader-body ul,
.home-automation-inbox-reader-body ol,
.home-automation-inbox-reader-body pre,
.home-automation-inbox-reader-body table,
.home-automation-inbox-reader-body blockquote,
.home-automation-inbox-reader-body h1,
.home-automation-inbox-reader-body h2,
.home-automation-inbox-reader-body h3,
.home-automation-inbox-reader-body h4 {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

.home-automation-inbox-reader-body h1,
.home-automation-inbox-reader-body h2,
.home-automation-inbox-reader-body h3,
.home-automation-inbox-reader-body h4 {
  font-size: 13px;
  line-height: 1.4;
}

.home-automation-inbox-reader-body table {
  font-size: 12px;
}

.home-automation-inbox-reader-box {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--color-border-subtle);
  background: var(--color-bg-elevated);
}

.home-automation-inbox-reader-box span {
  display: block;
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-automation-inbox-reader-box p {
  margin-top: 8px;
  color: var(--color-text);
  font-size: 13px;
  line-height: 1.55;
}

.home-automation-inbox-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-top: 10px;
  font-size: 11px;
}

.home-automation-inbox-meta span {
  padding: 4px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-text) 12%, var(--color-bg-secondary));
  color: var(--color-text-secondary);
}

.home-automation-inbox-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.home-automation-inbox-action {
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 8px 14px;
  background: var(--color-bg-secondary);
  color: var(--color-text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background-color 0.18s ease;
}

.home-automation-inbox-action:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--color-accent) 32%, var(--color-border));
  background: color-mix(in srgb, var(--color-accent) 10%, var(--color-bg-secondary));
}

.home-automation-inbox-action.primary {
  background: color-mix(in srgb, var(--color-accent) 18%, transparent);
  border-color: color-mix(in srgb, var(--color-accent) 28%, var(--color-border));
  color: var(--color-text);
}

.home-automation-inbox-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.home-automation-inbox-empty {
  padding: 18px 20px;
  color: var(--color-text-muted);
  font-size: 13px;
  line-height: 1.5;
}

/* ── File thumbnails ──────────────────────────────────────── */

.home-files-scroll {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--color-border-subtle) 60%, transparent) transparent;
}

.home-files-scroll::-webkit-scrollbar {
  height: 6px;
}

.home-files-scroll::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--color-border-subtle) 60%, transparent);
  border-radius: 3px;
}

.home-file-thumb {
  flex-shrink: 0;
  width: 180px;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  background: var(--color-bg-elevated);
  box-shadow: var(--shadow-sm);
  color: var(--color-text);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.home-file-thumb:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--color-accent) 30%, var(--color-border-light));
  box-shadow: var(--shadow-lg);
}

.home-file-thumb-preview {
  height: 100px;
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border-subtle);
  position: relative;
  overflow: hidden;
}

.home-file-thumb-preview-media {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0.08)),
    var(--color-bg-secondary);
}

.home-file-thumb-preview-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.home-file-thumb-preview-text,
.home-file-thumb-preview-fallback {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: var(--color-text-muted);
}

.home-file-thumb-preview-text {
  padding: 12px 14px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--color-accent) 8%, transparent), transparent 42%),
    var(--color-bg-secondary);
}

.home-file-thumb-preview-text p {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 11px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
}

.home-file-thumb-preview-fallback {
  align-items: center;
  gap: 8px;
}

.home-file-thumb-preview-fallback span {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.home-file-thumb-preview-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: rgba(248, 250, 252, 0.92);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  backdrop-filter: blur(10px);
}

.home-file-thumb-preview-skeleton {
  width: 72%;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg,
      color-mix(in srgb, var(--color-border-subtle) 85%, transparent),
      color-mix(in srgb, var(--color-border-light) 80%, transparent),
      color-mix(in srgb, var(--color-border-subtle) 85%, transparent));
  background-size: 200% 100%;
  animation: home-file-preview-pulse 1.4s ease-in-out infinite;
}

.home-file-thumb-preview-skeleton-short {
  width: 48%;
}

@keyframes home-file-preview-pulse {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

.home-file-thumb-label {
  padding: 12px 14px;
}

.home-file-thumb-label strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-file-thumb-label span {
  display: block;
  margin-top: 3px;
  color: var(--color-text-muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Empty state ──────────────────────────────────────────── */

.home-empty-state {
  min-height: 112px;
  border-radius: 18px;
  border: 1px dashed var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 18px;
  color: var(--color-text-muted);
  background: var(--color-bg-secondary);
  text-align: center;
}

.home-empty-wide {
  grid-column: 1 / -1;
}

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 980px) {
  .home-dashboard {
    padding: 18px;
    gap: 24px;
  }

  .home-task-grid {
    grid-template-columns: 1fr 1fr;
  }

  .home-automation-strip {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .home-task-grid {
    grid-template-columns: 1fr;
  }

  .home-automation-strip {
    grid-template-columns: 1fr;
  }

  .home-composer-bar {
    padding: 16px 18px;
    border-radius: 18px;
  }

  .home-file-thumb {
    width: 150px;
  }

  .home-automation-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Step Feedback Toggle (three dots button in header status) */
.step-feedback-toggle {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  opacity: 0.5;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
}

.step-feedback-toggle:hover {
  opacity: 1;
  color: var(--color-accent);
  background: rgba(255, 255, 255, 0.05);
}

/* Step Feedback Bar (expands below header status) */
.step-feedback-bar {
  padding: 8px 20px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--color-bg-secondary, rgba(0, 0, 0, 0.1));
  border-bottom: 1px solid var(--color-border-subtle, rgba(255, 255, 255, 0.06));
}

.step-feedback-bar-step {
  font-size: 11px;
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.step-feedback-bar-actions {
  display: flex;
  gap: 4px;
}

.step-feedback-bar-btn {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.2);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.step-feedback-bar-btn:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.4);
  border-color: var(--color-accent);
  color: var(--color-text);
}

.step-feedback-bar-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.step-feedback-bar-btn.stop:hover:not(:disabled) {
  border-color: var(--color-error);
  color: var(--color-error);
}

.step-feedback-bar-btn.skip:hover:not(:disabled) {
  border-color: var(--color-warning, #f0ad4e);
}

.step-feedback-bar-btn.send {
  background: var(--color-accent);
  color: var(--color-bg);
  border-color: var(--color-accent);
}

.step-feedback-bar-btn.send:hover:not(:disabled) {
  filter: brightness(1.1);
}

.step-feedback-bar-btn.send:disabled {
  background: rgba(0, 0, 0, 0.2);
  color: var(--color-text-muted);
  border-color: rgba(255, 255, 255, 0.08);
}

.step-feedback-bar-drift {
  display: flex;
  gap: 4px;
}

.step-feedback-bar-input {
  flex: 1;
  padding: 5px 10px;
  font-size: 11px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  color: var(--color-text);
  outline: none;
}

.step-feedback-bar-input:focus {
  border-color: var(--color-accent);
}

.step-feedback-bar-input::placeholder {
  color: var(--color-text-muted);
  opacity: 0.6;
}

/* Light theme overrides for step feedback bar */
.theme-light .step-feedback-bar {
  background: rgba(0, 0, 0, 0.02);
}

.theme-light .step-feedback-bar-btn {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(0, 0, 0, 0.1);
}

.theme-light .step-feedback-bar-input {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(0, 0, 0, 0.1);
}

.theme-light .step-feedback-toggle:hover {
  background: rgba(0, 0, 0, 0.05);
}

.theme-light .bubble-feedback-panel {
  background: rgba(0, 0, 0, 0.02);
}

.theme-light .bubble-feedback-btn {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(0, 0, 0, 0.1);
}

.theme-light .bubble-feedback-input {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(0, 0, 0, 0.1);
}

.theme-light .bubble-feedback-toggle:hover {
  background: rgba(0, 0, 0, 0.05);
}

.main-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 32px;
  scroll-behavior: smooth;
  position: relative;
  z-index: 1;
}

/* Scroll to bottom floating button */
.scroll-to-bottom-btn {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition:
    opacity 0.2s,
    transform 0.2s,
    background 0.15s;
  opacity: 0.85;
  animation: scroll-btn-fade-in 0.2s ease-out;
}

.scroll-to-bottom-btn:hover {
  opacity: 1;
  background: var(--color-bg-tertiary);
  transform: translateX(-50%) scale(1.08);
}

@keyframes scroll-btn-fade-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(8px);
  }

  to {
    opacity: 0.85;
    transform: translateX(-50%) translateY(0);
  }
}

/* Collaborative phase status indicator — sticky inside thoughts panel */
.collab-phase-status {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 4px;
  color: var(--color-text-muted);
  position: sticky;
  bottom: 0;
  background: var(--color-bg-secondary, #1a1a2e);
  z-index: 2;
  animation: collab-phase-fade-in 0.3s ease-out;
}

.collab-phase-spinner {
  animation: collab-phase-spin 0.8s linear infinite;
  flex-shrink: 0;
}

.collab-phase-label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

@keyframes collab-phase-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes collab-phase-fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.task-content {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  /* Ensure all children stay within this container */
  position: relative;
  isolation: isolate;
}

.task-section {
  margin-bottom: 24px;
}

.task-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.task-description {
  background: var(--color-bg-secondary);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  border: 1px solid var(--color-border-subtle);
}

.task-description p {
  color: var(--color-text-secondary);
  line-height: 1.6;
}

/* Chat-like message layout */
.chat-message {
  display: flex;
  margin-bottom: 16px;
}

.chat-message.user-message {
  flex-direction: column;
  align-items: flex-end;
}

.chat-message.assistant-message {
  flex-direction: column;
  align-items: flex-start;
}

.chat-inline-frames {
  width: min(680px, 85%);
  max-width: 100%;
}

.user-inline-frames {
  margin-top: 8px;
}

.timeline-inline-frames {
  margin: 8px 0 12px 40px;
}

.chat-bubble {
  max-width: 85%;
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  overflow: hidden;
  min-width: 0;
}

.chat-message.user-message .chat-bubble,
.chat-message.assistant-message .chat-bubble,
.chat-message.user-message .quoted-follow-up-reply {
  font-family:
    var(--font-google-sans,
      "Google Sans Flex", "Google Sans", "Helvetica Neue", Arial, sans-serif);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  font-variant-ligatures: none;
  font-variation-settings: "ROND" 0, "slnt" 0, "wdth" 92;
  letter-spacing: 0;
}

/* User bubble - right aligned, accent colored */
.chat-bubble.user-bubble {
  background: var(--color-accent-subtle);
  border: 1px solid var(--color-accent);
  border-bottom-right-radius: 4px;
  max-height: 220px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  padding: 8px 14px;
}

.theme-light .chat-bubble.user-bubble {
  background: var(--color-bg-sidebar);
}

.chat-bubble.user-bubble.expanded {
  max-height: none;
  cursor: default;
}

/* Gradient fade overlay when collapsed */
.chat-bubble.user-bubble:not(.expanded) .user-bubble-fade {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50px;
  background: linear-gradient(transparent, var(--color-accent-subtle));
  pointer-events: none;
}

.theme-light .chat-bubble.user-bubble:not(.expanded) .user-bubble-fade {
  background: linear-gradient(transparent, var(--color-bg-sidebar));
}

/* "Show more" button outside the bubble */
.user-bubble-expand-btn {
  background: none;
  border: none;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-accent);
  cursor: pointer;
  padding: 4px 0;
  margin-top: 2px;
  opacity: 0.85;
  transition: opacity 0.15s ease;
}

.user-bubble-expand-btn:hover {
  opacity: 1;
  text-decoration: underline;
}

.bubble-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--color-border-subtle);
}

.bubble-attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: 11px;
  max-width: 200px;
}

.bubble-attachment-chip svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.bubble-attachment-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-bubble.user-bubble p {
  color: var(--color-text);
  line-height: 1.5;
  font-size: 1em;
  margin: 4px 0;
}

/* Message copy button for user messages */
.message-copy-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  margin-top: 6px;
  margin-left: auto;
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition:
    color 0.15s ease,
    background 0.15s ease;
}

.message-copy-btn:hover {
  color: var(--color-text-secondary);
  background: var(--color-bg-hover);
}

.message-copy-btn.copied {
  color: var(--color-success);
}

.message-copy-btn svg {
  flex-shrink: 0;
}

/* Copy button alignment for assistant messages - left aligned */
.chat-message.assistant-message .message-copy-btn {
  margin-left: 0;
}

/* Message actions container */
.message-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.message-actions .message-copy-btn,
.message-actions .message-speak-btn,
.message-actions .message-quote-btn,
.message-actions .message-fork-btn,
.message-actions .message-feedback-btn {
  margin-top: 0;
  line-height: 1;
}

.chat-message.user-message .message-actions {
  justify-content: flex-end;
}

.chat-message.assistant-message .message-actions {
  justify-content: flex-start;
}

/* Speak button for assistant messages */
.message-speak-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition:
    color 0.15s ease,
    background 0.15s ease;
}

.message-speak-btn:hover {
  color: var(--color-accent);
  background: var(--color-bg-hover);
}

.message-speak-btn:disabled {
  cursor: default;
}

.message-quote-btn,
.message-fork-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition:
    color 0.15s ease,
    background 0.15s ease;
}

.message-quote-btn:hover,
.message-fork-btn:hover {
  color: var(--color-accent);
  background: var(--color-bg-hover);
}

.message-speak-btn.speaking {
  color: var(--color-accent);
}

.message-speak-btn.speaking svg {
  animation: pulse 1s ease-in-out infinite;
}

.session-lineage-footer {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  margin: 28px 0 10px;
  color: var(--color-text-muted);
}

.session-lineage-footer-rule {
  flex: 1 1 0;
  min-width: 32px;
  height: 1px;
  background: var(--color-border);
}

.session-lineage-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 30px;
  padding: 0 2px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-accent);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.session-lineage-link:hover {
  color: var(--color-accent-hover);
}

.session-lineage-link:focus-visible {
  outline: 2px solid var(--color-focus, var(--color-accent));
  outline-offset: 3px;
}

.session-lineage-link.static {
  color: var(--color-text-muted);
  cursor: default;
  text-decoration: none;
}

.quoted-assistant-inline {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--color-accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-accent) 20%, var(--color-border-subtle));
  color: var(--color-text-secondary);
  font-size: 12px;
  line-height: 1.4;
}

.quoted-assistant-inline-icon {
  flex-shrink: 0;
  color: var(--color-accent);
}

.quoted-assistant-inline-text {
  min-width: 0;
}

.quoted-follow-up-shell {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  width: min(100%, 960px);
}

.quoted-follow-up-context {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: min(100%, 880px);
  padding: 10px 14px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--color-bg-secondary) 94%, black 6%);
  border: 1px solid color-mix(in srgb, var(--color-border) 82%, transparent);
  color: var(--color-text-secondary);
  font-size: 13px;
  line-height: 1.45;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.quoted-follow-up-context-icon {
  flex-shrink: 0;
  color: var(--color-text-muted);
  font-size: 18px;
  line-height: 1;
}

.quoted-follow-up-context-text {
  min-width: 0;
  max-height: 112px;
  overflow: auto;
}

.quoted-follow-up-context-text.markdown-content > :first-child {
  margin-top: 0;
}

.quoted-follow-up-context-text.markdown-content > :last-child {
  margin-bottom: 0;
}

.quoted-follow-up-context-text.markdown-content :where(p, ul, ol, blockquote, pre) {
  margin-top: 2px;
  margin-bottom: 2px;
}

.quoted-follow-up-context-text.markdown-content table {
  margin: 4px 0;
  font-size: 11.5px;
}

.quoted-follow-up-context-text.markdown-content th,
.quoted-follow-up-context-text.markdown-content td {
  padding: 3px 6px;
}

.quoted-follow-up-reply {
  align-self: flex-end;
  max-width: min(72%, 420px);
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--color-accent);
  color: white;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--color-accent) 22%, transparent);
}

.quoted-follow-up-reply > :first-child {
  margin-top: 0;
}

.quoted-follow-up-reply > :last-child {
  margin-bottom: 0;
}

.quoted-follow-up-reply :where(p, ul, ol, blockquote, pre, code, strong, em, a) {
  color: inherit;
}

.quoted-follow-up-reply :where(p) {
  margin: 0;
  font-size: 1em;
  line-height: 1.5;
}

.quoted-follow-up-attachments {
  align-self: flex-end;
  max-width: min(72%, 420px);
  margin-top: -2px;
}

.theme-light .quoted-follow-up-context {
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(15, 23, 42, 0.1);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

/* Message-level thumbs feedback */
.message-feedback-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 5px;
  font-size: 13px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  opacity: 0.45;
  transition: opacity 0.15s ease, background 0.15s ease;
  line-height: 1;
}

.message-feedback-btn:hover {
  opacity: 1;
  background: var(--color-bg-hover);
}

.message-feedback-btn.active {
  opacity: 1;
}

.message-feedback-thumbdown-wrap {
  position: relative;
  display: inline-flex;
}

.message-feedback-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 200;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  min-width: 160px;
}

.message-feedback-reason {
  padding: 6px 10px;
  font-size: 12px;
  text-align: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--color-text-secondary);
  transition: background 0.1s ease, color 0.1s ease;
}

.message-feedback-reason:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.message-speak-btn svg {
  flex-shrink: 0;
}

/* Assistant bubble - full width to match action blocks (Progress update, Execution summary) */
.chat-bubble.assistant-bubble {
  max-width: 100%;
  align-self: stretch;
  background: var(--color-bg-glass);
  border: 1px solid var(--color-border-subtle);
  border-bottom-left-radius: 4px;
}

.chat-bubble-header {
  margin-bottom: 8px;
}

.chat-status {
  font-size: 12px;
  color: var(--color-success);
  font-weight: 500;
}

.chat-status.executing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-accent);
}

.chat-status.executing .spinner {
  animation: spin 1s linear infinite;
}

/* Bubble-level step feedback (next to copy/speak buttons) */
.bubble-feedback-toggle {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition:
    color 0.15s ease,
    background 0.15s ease;
}

.bubble-feedback-toggle:hover {
  color: var(--color-accent);
  background: var(--color-bg-hover);
}

.bubble-feedback-panel {
  margin-top: 6px;
  padding: 8px 10px;
  border-left: 2px solid var(--color-accent);
  background: var(--color-bg-secondary);
  border-radius: 0 6px 6px 0;
  max-width: 420px;
}

.bubble-feedback-step-label {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bubble-feedback-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.bubble-feedback-btn {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 4px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-primary);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s;
}

.bubble-feedback-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.bubble-feedback-btn.skip:hover:not(:disabled) {
  background: var(--color-warning, #f59e0b);
  color: #fff;
  border-color: var(--color-warning, #f59e0b);
}

.bubble-feedback-btn.retry:hover:not(:disabled) {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

.bubble-feedback-btn.stop:hover:not(:disabled) {
  background: var(--color-error, #ef4444);
  color: #fff;
  border-color: var(--color-error, #ef4444);
}

.bubble-feedback-btn.drift:hover:not(:disabled) {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

.bubble-feedback-input-row {
  display: flex;
  gap: 6px;
}

.bubble-feedback-input {
  flex: 1;
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  outline: none;
}

.bubble-feedback-input:focus {
  border-color: var(--color-accent);
}

.bubble-feedback-input::placeholder {
  color: var(--color-text-muted);
}

/* Streaming token counter */
.streaming-stats {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.agent-reasoning-panel {
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--color-accent) 22%, var(--color-border));
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--color-bg-secondary) 92%, var(--color-accent) 8%),
      color-mix(in srgb, var(--color-bg-secondary) 98%, transparent)
    );
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16);
}

.agent-reasoning-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.agent-reasoning-panel-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--color-text-secondary);
}

.agent-reasoning-step {
  min-width: 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-bg-primary) 80%, transparent);
  border: 1px solid var(--color-border-subtle);
  color: var(--color-text-muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 48%;
}

.agent-reasoning-follow-btn {
  margin-left: auto;
  border: 1px solid var(--color-border);
  background: color-mix(in srgb, var(--color-bg-primary) 88%, transparent);
  color: var(--color-text-secondary);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
}

.agent-reasoning-follow-btn:hover {
  border-color: color-mix(in srgb, var(--color-accent) 45%, var(--color-border));
  color: var(--color-text);
}

.agent-reasoning-stream {
  max-height: 132px;
  overflow-y: auto;
  padding-right: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.agent-reasoning-stream.is-streaming {
  mask-image: linear-gradient(180deg, #000 0%, #000 88%, transparent 100%);
}

.agent-reasoning-stream-text,
.agent-reasoning-update {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.55;
  color: var(--color-text);
}

.agent-reasoning-stream-text {
  padding-bottom: 2px;
}

.agent-reasoning-update {
  padding-left: 10px;
  border-left: 2px solid color-mix(in srgb, var(--color-accent) 26%, transparent);
  color: var(--color-text-secondary);
}

.streaming-separator {
  color: var(--color-text-muted);
  margin: 0 1px;
}

.streaming-token-up {
  color: var(--color-text-muted);
  font-size: 11px;
}

.streaming-token-down {
  color: var(--color-accent);
  font-size: 11px;
  font-weight: 600;
}

.streaming-elapsed {
  color: var(--color-text-muted);
  font-size: 11px;
}

.header-continuation-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: color-mix(in srgb, var(--color-bg-secondary) 70%, transparent);
  color: var(--color-text-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.header-continuation-chip-sep {
  color: var(--color-text-muted);
  opacity: 0.7;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.chat-message .chat-bubble-content.markdown-content {
  color: var(--color-text);
  font-family:
    var(--font-google-sans,
      "Google Sans Flex", "Google Sans", "Helvetica Neue", Arial, sans-serif);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  overflow-wrap: break-word;
  word-break: break-word;
  min-width: 0;
}

.chat-bubble-content p {
  margin-bottom: 8px;
}

.chat-bubble-content p:last-child {
  margin-bottom: 0;
}

.chat-bubble-content h1 {
  font-size: 1.35em;
  font-weight: 500;
  margin: 16px 0 8px;
  line-height: 1.25;
}

.chat-bubble-content h1:first-child {
  margin-top: 0;
}

.chat-bubble-content h2 {
  font-size: 1.2em;
  font-weight: 500;
  margin: 14px 0 7px;
  line-height: 1.28;
}

.chat-bubble-content h3 {
  font-size: 1.08em;
  font-weight: 500;
  margin: 12px 0 5px;
  line-height: 1.3;
}

.chat-bubble-content h4,
.chat-bubble-content h5,
.chat-bubble-content h6 {
  font-size: 0.95em;
  font-weight: 500;
  margin: 10px 0 4px;
  line-height: 1.3;
}

.chat-bubble-content pre {
  background: var(--color-bg-input);
  border-radius: var(--radius-sm);
  padding: 10px;
  overflow-x: auto;
  margin: 8px 0;
}

.chat-bubble-content code {
  background: var(--color-bg-input);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}

.chat-bubble-content pre code {
  background: none;
  padding: 0;
}

.chat-bubble-content ul,
.chat-bubble-content ol {
  margin: 4px 0;
  padding-left: 20px;
  list-style-position: outside;
}

.chat-bubble-content ul {
  list-style-type: disc;
}

.chat-bubble-content ol {
  list-style-type: decimal;
}

.chat-bubble-content li {
  margin: 2px 0;
  display: list-item;
}

/* Collaborative Thoughts panel */
.collaborative-thoughts-panel {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 12px;
  gap: 8px;
}

.thoughts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 8px 0;
  border-bottom: 1px solid var(--color-border, #333);
}

.thoughts-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary, #e5e5e5);
}

.thoughts-close-btn {
  background: none;
  border: none;
  color: var(--color-text-secondary, #999);
  cursor: pointer;
  font-size: 18px;
  padding: 0 4px;
  line-height: 1;
}

.thoughts-close-btn:hover {
  color: var(--color-text-primary, #e5e5e5);
}

.team-announcement {
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border, #333);
}

.team-announcement-text {
  font-size: 13px;
  color: var(--color-text-secondary, #999);
  margin-bottom: 10px;
}

.team-members-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.team-member-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--color-bg-primary, #0f0f23);
  border: 1px solid var(--color-border, #333);
  font-size: 13px;
}

.team-member-leader {
  border-width: 2px;
}

.team-member-icon {
  font-size: 16px;
  line-height: 1;
}

.team-member-name {
  font-weight: 600;
}

.leader-badge {
  background: var(--color-accent, #6366f1);
  color: white;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.phase-indicator {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 8px 0;
}

.phase-step-wrapper {
  display: flex;
  align-items: center;
}

.phase-step {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0.4;
}

.phase-step.phase-active {
  opacity: 1;
}

.phase-step.phase-completed {
  opacity: 0.7;
}

.phase-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-text-secondary, #666);
}

.phase-active .phase-dot {
  background: var(--color-accent, #6366f1);
  box-shadow: 0 0 6px var(--color-accent, #6366f1);
}

.phase-completed .phase-dot {
  background: #22c55e;
}

.phase-label {
  font-size: 11px;
  color: var(--color-text-secondary, #999);
}

.phase-active .phase-label {
  color: var(--color-accent, #6366f1);
  font-weight: 600;
}

.phase-connector {
  width: 20px;
  height: 1px;
  background: var(--color-border, #333);
  margin: 0 4px;
}

.phase-connector-active {
  background: #22c55e;
}

.thoughts-stream {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.thoughts-empty {
  text-align: center;
  padding: 24px;
  color: var(--color-text-muted, #666);
  font-size: 13px;
}

.stream-agent-header-inline {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 5px;
}

.stream-agent-icon {
  font-size: 14px;
  line-height: 1;
  opacity: 0.85;
}

.stream-agent-name-inline {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  opacity: 0.9;
}

.stream-thought {
  border-left: 3px solid #6366f1;
  padding: 8px 12px;
  background: var(--color-bg-secondary, #1a1a2e);
  border-radius: 0 8px 8px 0;
  margin-bottom: 4px;
  margin-left: 4px;
}

.stream-thought.thought-streaming {
  opacity: 0.8;
  border-right: 1px dashed var(--color-border, #333);
}

.streaming-thoughts-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.streaming-thought-entry {
  margin-bottom: 4px;
}

.streaming-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--color-text-secondary, #999);
  font-style: italic;
}

.streaming-spinner {
  animation: spin 1s linear infinite;
  flex-shrink: 0;
  color: var(--color-text-secondary, #999);
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.collaborative-thoughts-panel .thought-content {
  word-break: break-word;
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-text-primary, #e5e5e5);
}

.collaborative-thoughts-panel .thought-content p {
  margin: 0 0 8px 0;
}

.collaborative-thoughts-panel .thought-content p:last-child {
  margin-bottom: 0;
}

.collaborative-thoughts-panel .thought-content h1,
.collaborative-thoughts-panel .thought-content h2,
.collaborative-thoughts-panel .thought-content h3,
.collaborative-thoughts-panel .thought-content h4 {
  margin: 12px 0 6px 0;
  font-size: inherit;
  font-weight: 700;
}

.collaborative-thoughts-panel .thought-content h2 {
  font-size: 1.1em;
}

.collaborative-thoughts-panel .thought-content h3 {
  font-size: 1.05em;
}

.collaborative-thoughts-panel .thought-content ul,
.collaborative-thoughts-panel .thought-content ol {
  margin: 4px 0;
  padding-left: 20px;
}

.collaborative-thoughts-panel .thought-content li {
  margin: 2px 0;
}

.collaborative-thoughts-panel .thought-content code {
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 0.9em;
}

.collaborative-thoughts-panel .thought-content pre {
  background: rgba(0, 0, 0, 0.3);
  padding: 8px 12px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 8px 0;
}

.collaborative-thoughts-panel .thought-content pre code {
  background: none;
  padding: 0;
}

.collaborative-thoughts-panel .thought-content strong {
  font-weight: 700;
  color: var(--color-text-primary, #f0f0f0);
}

.collaborative-thoughts-panel .thought-content blockquote {
  border-left: 3px solid var(--color-border, #444);
  padding-left: 12px;
  margin: 8px 0;
  color: var(--color-text-secondary, #aaa);
}

.collaborative-thoughts-panel .thought-content table {
  border-collapse: collapse;
  margin: 8px 0;
  width: 100%;
}

.collaborative-thoughts-panel .thought-content th,
.collaborative-thoughts-panel .thought-content td {
  border: 1px solid var(--color-border, #333);
  padding: 4px 8px;
  text-align: left;
  font-size: 12px;
}

.collaborative-thoughts-panel .thought-content th {
  background: rgba(255, 255, 255, 0.04);
  font-weight: 600;
}

.collaborative-thoughts-panel .thought-content a {
  color: var(--color-accent, #6366f1);
  text-decoration: underline;
}

.thought-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.thought-time {
  font-size: 10px;
  color: var(--color-text-muted, #555);
}

.thought-expand-btn {
  background: none;
  border: none;
  color: var(--color-accent, #6366f1);
  cursor: pointer;
  font-size: 11px;
  padding: 0;
}

.thought-expand-btn:hover {
  text-decoration: underline;
}

/* Collaborative Agent Lines — extension of input box, inside same container, no separate frames */
.input-container-with-agents .collaborative-agent-lines {
  padding: 10px 16px 8px;
}

.collaborative-agent-lines {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.collab-lines-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.collab-lines-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-muted);
}

.collab-lines-summary {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.collab-lines-hint {
  font-size: 11px;
  color: var(--color-text-muted);
}

.collab-lines-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.collab-agent-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  background: transparent;
}

.collab-agent-line:hover {
  background: transparent;
}

.collab-agent-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  margin-right: 6px;
  color: var(--color-text-muted);
}

.collab-agent-status-text {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  min-width: 0;
}

.collab-agent-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  color: var(--color-text-secondary);
}

.collab-agent-state {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 82px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

.collab-agent-state-completed {
  color: color-mix(in srgb, var(--color-success, #10b981) 78%, var(--color-text-secondary));
}

.collab-agent-state-failed {
  color: color-mix(in srgb, var(--color-danger, #ef4444) 82%, var(--color-text-secondary));
}

.collab-agent-state-warning {
  color: color-mix(in srgb, var(--color-warning, #f59e0b) 72%, var(--color-text-secondary));
}

.collab-agent-state-running {
  color: color-mix(in srgb, var(--color-warning, #f59e0b) 70%, var(--color-text-secondary));
}

.collab-agent-state-pending {
  color: var(--color-text-muted);
}

.collab-agent-open-btn {
  flex-shrink: 0;
  padding: 3px 8px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.collab-agent-open-btn:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

.collab-agent-open-disabled {
  font-size: 11px;
  color: var(--color-text-muted);
  padding: 0 8px;
}

.collab-agent-open-empty {
  width: 44px;
  height: 1px;
}

.collab-lines-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 6px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--color-text-muted);
}

.collab-wrap-up-inline-btn {
  margin-left: auto;
  padding: 3px 8px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--color-warning, #f59e0b);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.collab-wrap-up-inline-btn:hover:not(:disabled) {
  background: rgba(245, 158, 11, 0.12);
}

.collab-wrap-up-inline-btn.active,
.collab-wrap-up-inline-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Collaborative Summary Panel — chronological timeline */
.collaborative-summary-panel {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-family: var(--font-ui);
}

.collab-summary-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  margin: 0;
  border: none;
  background: transparent;
  color: var(--color-text-primary);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.collab-summary-heading:hover {
  color: var(--color-text-secondary);
}

.collab-summary-chevron {
  flex-shrink: 0;
  color: var(--color-text-muted);
  transition: transform 0.2s ease;
}

.collab-summary-chevron.expanded {
  transform: rotate(0deg);
}

.collab-summary-chevron:not(.expanded) {
  transform: rotate(-90deg);
}

.collab-summary-done-badge {
  flex-shrink: 0;
  color: var(--color-success, #10b981);
}

.collab-summary-heading-text {
  flex: 1;
}

.collab-summary-timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-left: 4px;
}

.collab-timeline-strategic {
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text-secondary);
  font-family: var(--font-ui);
}

.collab-timeline-spawn-header {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-top: 4px;
  font-family: var(--font-ui);
}

.collab-timeline-spawn {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--color-text-secondary);
  padding-left: 12px;
  font-family: var(--font-ui);
}

.collab-timeline-spawn-icon {
  flex-shrink: 0;
  color: var(--color-accent, #8b5cf6);
}

.collab-timeline-spawn-name {
  font-weight: 500;
  color: var(--color-accent, #8b5cf6);
  cursor: pointer;
}

.collab-timeline-spawn-name:hover {
  text-decoration: underline;
}

.collab-timeline-spawn-desc {
  color: var(--color-text-muted);
}

.collab-timeline-spawn-name.collab-timeline-spawn-synthesis {
  cursor: default;
}

.collab-timeline-spawn-name.collab-timeline-spawn-synthesis:hover {
  text-decoration: none;
}

/* Inline markdown in spawn descriptions — headings render as bold, not block */
.collab-timeline-spawn-desc .markdown-inline h1,
.collab-timeline-spawn-desc .markdown-inline h2,
.collab-timeline-spawn-desc .markdown-inline h3,
.collab-timeline-spawn-desc .markdown-inline h4,
.collab-timeline-spawn-desc .markdown-inline h5,
.collab-timeline-spawn-desc .markdown-inline h6 {
  display: inline;
  font-size: inherit;
  font-weight: 600;
  margin: 0;
}

.collab-timeline-spawn-desc .markdown-inline p {
  display: inline;
  margin: 0;
}

.collab-summary-synthesis-output {
  margin-top: 12px;
  padding: 16px;
  background: var(--color-bg-tertiary, rgba(255, 255, 255, 0.04));
  border-radius: 10px;
  border-left: 4px solid var(--color-success, #10b981);
}

.collab-summary-synthesis-heading {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-success, #10b981);
  margin-bottom: 10px;
}

.collab-summary-synthesis-content {
  font-size: 14px;
  line-height: 1.6;
  color: var(--color-text-secondary);
  font-family: var(--font-ui);
}

.collab-summary-synthesis-content p {
  margin: 0 0 8px;
}

.collab-summary-synthesis-content p:last-child {
  margin-bottom: 0;
}

.collab-timeline-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.collab-timeline-status svg {
  flex-shrink: 0;
}

.collab-timeline-status-done {
  color: var(--color-success, #10b981);
  font-weight: 500;
}

.collab-timeline-thought {
  display: block;
  padding: 8px 14px;
  background: var(--color-bg-tertiary, rgba(255, 255, 255, 0.03));
  border-radius: 0 8px 8px 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-text-secondary);
  font-family: var(--font-ui);
}

.collab-timeline-thought.collab-timeline-thought-error {
  background: rgba(239, 68, 68, 0.08);
}

.collab-timeline-thought-agent {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 4px;
  opacity: 0.85;
}

.collab-timeline-thought-content.markdown-content {
  font-family: var(--font-ui);
}

.collab-timeline-thought-content.markdown-content p {
  margin: 0 0 4px;
}

.collab-timeline-thought-content.markdown-content p:last-child {
  margin-bottom: 0;
}

.collab-summary-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--color-bg-tertiary, rgba(255, 255, 255, 0.03));
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
}

.collab-summary-status.collab-summary-status-active {
  background: rgba(139, 92, 246, 0.08);
  color: var(--color-accent, #8b5cf6);
}

.collab-summary-status svg {
  flex-shrink: 0;
}

.collab-summary-wrap-up-btn {
  margin-left: auto;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(245, 158, 11, 0.4);
  background: linear-gradient(180deg, rgba(217, 119, 6, 0.25) 0%, rgba(180, 83, 9, 0.2) 100%);
  color: var(--color-warning, #fbbf24);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.collab-summary-wrap-up-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(217, 119, 6, 0.35) 0%, rgba(180, 83, 9, 0.3) 100%);
  border-color: rgba(245, 158, 11, 0.6);
}

.collab-summary-wrap-up-btn.active,
.collab-summary-wrap-up-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.collab-summary-spinner {
  animation: collab-phase-spin 0.8s linear infinite;
}

/* Collaborative Thoughts in main content area */
.collaborative-thoughts-main {
  margin: 16px 0;
  border-radius: 12px;
  background: var(--color-bg-secondary, #1a1a2e);
  border: 1px solid var(--color-border, #333);
  overflow: hidden;
  font-family: var(--font-ui);
}

.collaborative-thoughts-main .collaborative-thoughts-panel {
  max-height: none;
  padding: 16px 20px;
}

.collaborative-thoughts-main .agent-thought-section {
  padding: 12px 16px;
}

.collaborative-thoughts-main .thought-bubble {
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.6;
}

/* Dispatched Agents Panel - reuses collaborative thoughts styling */
.dispatched-agents-panel {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 12px;
  gap: 8px;
}

.collaborative-thoughts-main .dispatched-agents-panel {
  max-height: none;
  padding: 16px 20px;
}

.dispatched-agent-status {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-text-muted, #888);
  text-transform: capitalize;
}

.dispatched-agent-status.status-executing,
.dispatched-agent-status.status-planning,
.dispatched-agent-status.status-interrupted {
  background: color-mix(in srgb, var(--color-accent) 20%, transparent);
  color: var(--color-accent);
}

.dispatched-agent-status.status-completed {
  background: var(--color-success-subtle, rgba(34, 197, 94, 0.15));
  color: var(--color-success, #4ade80);
}

.dispatched-agent-status.status-failed {
  background: color-mix(in srgb, #ef4444 20%, transparent);
  color: #ef4444;
}

.dispatched-agent-status.status-cancelled {
  background: color-mix(in srgb, #9ca3af 20%, transparent);
  color: #9ca3af;
}

.dispatched-agents-panel .step-event {
  font-size: 12px;
  color: var(--color-text-secondary, #999);
  font-style: italic;
  margin: 0;
}

.dispatched-agents-panel .step-event.step-completed {
  color: var(--color-success, #4ade80);
}

.dispatched-agents-panel .step-event.step-failed {
  color: #ef4444;
}

.dispatched-agents-panel .step-event.step-progress {
  color: var(--color-text-secondary, #999);
  font-style: italic;
}

.dispatched-agents-panel .step-icon {
  display: inline-block;
  vertical-align: middle;
  margin-right: 4px;
  position: relative;
  top: -1px;
}

.dispatched-agents-panel .step-icon-progress {
  color: var(--color-text-muted, #888);
}

.dispatched-agents-panel .step-icon-completed {
  color: var(--color-success, #4ade80);
}

.dispatched-agents-panel .step-icon-failed {
  color: #ef4444;
}

.dispatched-agents-panel .step-icon-started {
  color: var(--color-text-secondary, #999);
}

.dispatched-agents-panel .stream-thought.stream-thought-compact {
  padding: 4px 10px;
  margin-bottom: 2px;
}

.dispatched-agents-panel .thought-bubble.thought-bubble-compact-event {
  padding: 0;
  font-size: 12px;
  line-height: 1.35;
}

.dispatched-agents-panel .stream-event-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
}

.dispatched-agents-panel .stream-event-main {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 4px;
}

.dispatched-agents-panel .stream-event-main .step-icon {
  flex-shrink: 0;
  margin-right: 0;
  top: 1px;
}

.dispatched-agents-panel .stream-event-main .step-event {
  min-width: 0;
  margin: 0;
  line-height: 1.35;
  word-break: break-word;
}

.dispatched-agents-panel .stream-event-time {
  white-space: nowrap;
  align-self: flex-start;
  margin-top: 1px;
}

@media (max-width: 640px) {
  .dispatched-agents-panel .stream-thought.stream-thought-compact {
    padding: 3px 8px;
    margin-left: 2px;
  }

  .dispatched-agents-panel .stream-event-row {
    gap: 8px;
  }

  .dispatched-agents-panel .stream-event-main .step-event {
    font-size: 11.5px;
  }

  .dispatched-agents-panel .stream-event-time {
    font-size: 9px;
  }
}

/* ============================================
   CLI Agent Frame — Perplexity Computer-style
   per-agent dedicated cards
   ============================================ */

.cli-agent-frame {
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.08));
  border-radius: 12px;
  background: var(--color-bg-secondary, rgba(255, 255, 255, 0.03));
  overflow: hidden;
  margin: 8px 0;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.cli-agent-frame-executing {
  border-color: var(--color-accent, #06b6d4);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.1);
}

.cli-agent-frame-completed {
  border-color: var(--color-success, #4ade80);
}

.cli-agent-frame-failed {
  border-color: #ef4444;
}

.cli-agent-frame-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: inherit;
  font: inherit;
  gap: 8px;
}

.cli-agent-frame-header:hover {
  background: var(--color-bg-hover, rgba(255, 255, 255, 0.04));
}

.cli-agent-frame-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.cli-agent-frame-header-left > svg {
  flex-shrink: 0;
  color: var(--color-text-muted, #888);
}

.cli-agent-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cli-agent-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-primary, #e5e5e5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cli-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}

.cli-agent-frame-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.cli-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.cli-status-executing {
  color: var(--color-accent, #06b6d4);
  background: rgba(6, 182, 212, 0.12);
}

.cli-status-completed {
  color: var(--color-success, #4ade80);
  background: rgba(74, 222, 128, 0.12);
}

.cli-status-failed {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
}

.cli-status-pending {
  color: var(--color-text-muted, #888);
  background: rgba(136, 136, 136, 0.1);
}

.cli-status-spinner {
  animation: spin 1s linear infinite;
}

.cli-agent-time {
  font-size: 11px;
  color: var(--color-text-muted, #888);
  white-space: nowrap;
}

.cli-agent-duration {
  font-size: 11px;
  color: var(--color-text-secondary, #999);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Body: event list */
.cli-agent-frame-body {
  padding: 4px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-top: 1px solid var(--color-border, rgba(255, 255, 255, 0.06));
}

.cli-event-row {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: start;
  gap: 6px;
  padding: 3px 0;
  font-size: 12px;
  line-height: 1.4;
  font-family: var(--font-mono, "SF Mono", "Fira Code", "Cascadia Code", monospace);
}

.cli-event-empty {
  color: var(--color-text-muted, #888);
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cli-event-icon {
  flex-shrink: 0;
  margin-top: 2px;
}

.cli-event-icon-play {
  color: var(--color-text-secondary, #999);
}

.cli-event-icon-check {
  color: var(--color-success, #4ade80);
}

.cli-event-icon-x {
  color: #ef4444;
}

.cli-event-icon-loader {
  color: var(--color-text-muted, #888);
  animation: spin 1s linear infinite;
}

.cli-event-icon-terminal {
  color: var(--color-accent, #06b6d4);
}

.cli-event-icon-message {
  color: var(--color-text-muted, #888);
}

.cli-event-label {
  color: var(--color-text-secondary, #bbb);
  min-width: 0;
  word-break: break-word;
}

.cli-event-error .cli-event-label {
  color: #ef4444;
}

.cli-event-success .cli-event-label {
  color: var(--color-success, #4ade80);
}

.cli-event-time {
  font-size: 10px;
  color: var(--color-text-muted, #666);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Responsive */
@media (max-width: 640px) {
  .cli-agent-frame-header {
    padding: 8px 10px;
  }
  .cli-agent-title {
    font-size: 12px;
  }
  .cli-event-row {
    font-size: 11px;
  }
  .cli-event-time {
    display: none;
  }
}

/* Conversation Flow - contains all chat messages and events */
.conversation-flow {
  display: flex;
  flex-direction: column;
  gap: 6px;
  contain: layout style;
}

.timeline-history-control {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  margin-bottom: 6px;
}

.timeline-history-error {
  color: var(--color-text-muted);
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}

/* Timeline Controls */
.timeline-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin-top: 8px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-border-subtle);
}

.timeline-controls-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.timeline-controls-label {
  color: var(--color-text-muted);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}

.timeline-controls-label.with-duration {
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}

.timeline-controls-label-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.timeline-controls-label-button:hover {
  color: var(--color-text);
}

.timeline-controls-label-chevron {
  font-size: 12px;
  line-height: 1;
}

.timeline-controls-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.timeline-controls .verbose-switch-label,
.timeline-controls .replay-entry-btn {
  color: var(--color-text-muted);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}

.timeline-controls .goal-mode-switch-track {
  width: 26px;
  height: 16px;
}

.timeline-controls .goal-mode-switch-thumb {
  width: 10px;
  height: 10px;
}

.timeline-controls .goal-mode-switch-track.on .goal-mode-switch-thumb {
  left: 12px;
}

.timeline-controls .replay-entry-btn svg {
  width: 12px;
  height: 12px;
}

/* Timeline Section - Steps (smaller & dimmer) */
.timeline-section {
  margin-top: 24px;
}

/* Verbose on/off toggle switch */
.verbose-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  margin: 0;
  min-width: 0;
  line-height: 1;
  justify-content: flex-start;
  overflow: visible;
  cursor: pointer;
  user-select: none;
  color: var(--text-secondary);
}

.verbose-switch:focus-visible .goal-mode-switch-track {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

.verbose-switch-label {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.verbose-switch:hover .verbose-switch-label {
  color: var(--text-primary);
}

.verbose-switch .goal-mode-toggle-switch-content {
  width: auto;
  justify-content: flex-start;
}

/* Verbose toggle button (code previews etc.) */
.verbose-toggle-btn {
  display: flex;
  align-items: center;
  padding: 4px 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.verbose-toggle-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-color-strong);
}

.verbose-toggle-btn.active {
  background: var(--accent-color);
  color: var(--bg-primary);
  border-color: var(--accent-color);
}

.verbose-toggle-btn.active:hover {
  background: var(--accent-color-hover);
  border-color: var(--accent-color-hover);
}

.timeline-events {
  margin-top: 12px;
  opacity: 0.75;
}

.timeline-event {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 2px 0;
}

/* Muted events - for summaries like blocked tool calls */
/* Compact "Done" for task_completed with no outputs in summary mode */
.timeline-event.completion-compact {
  min-height: auto;
  padding: 2px 0;
}

.completion-compact-content {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 0;
}

.completion-compact-label {
  font-size: 12px;
  color: var(--color-text-secondary);
  font-weight: 500;
}

.timeline-event.completion-compact .event-time-muted {
  font-size: 11px;
  color: var(--color-text-muted);
  font-family: var(--font-ui);
  font-weight: 400;
}

.timeline-event.timeline-event-muted {
  opacity: 0.6;
  padding: 6px 0;
}

.timeline-event-muted .event-title {
  font-size: 11px;
  font-style: italic;
  color: var(--text-secondary);
}

/* Active step event - highlighted to show it's currently running */
.timeline-event.timeline-event-active-step {
  opacity: 1;
}

/* Step feedback toggle (three dots) next to timestamp */
.timeline-step-feedback-toggle {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 1px 4px;
  border-radius: 3px;
  opacity: 0.5;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  vertical-align: middle;
}

.timeline-step-feedback-toggle:hover {
  opacity: 1;
  color: var(--color-accent);
  background: rgba(255, 255, 255, 0.05);
}

/* Step feedback panel inside timeline event */
.timeline-step-feedback-panel {
  margin: 6px 0 4px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.timeline-step-feedback-actions {
  display: flex;
  gap: 4px;
}

.timeline-step-feedback-btn {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.2);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-ui, inherit);
}

.timeline-step-feedback-btn:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.4);
  border-color: var(--color-accent);
  color: var(--color-text);
}

.timeline-step-feedback-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.timeline-step-feedback-btn.stop:hover:not(:disabled) {
  border-color: var(--color-error);
  color: var(--color-error);
}

.timeline-step-feedback-btn.skip:hover:not(:disabled) {
  border-color: var(--color-warning, #f0ad4e);
}

.timeline-step-feedback-btn.send {
  background: var(--color-accent);
  color: var(--color-bg);
  border-color: var(--color-accent);
}

.timeline-step-feedback-btn.send:hover:not(:disabled) {
  filter: brightness(1.1);
}

.timeline-step-feedback-btn.send:disabled {
  background: rgba(0, 0, 0, 0.2);
  color: var(--color-text-muted);
  border-color: rgba(255, 255, 255, 0.08);
}

.timeline-step-feedback-drift {
  display: flex;
  gap: 4px;
}

.timeline-step-feedback-input {
  flex: 1;
  padding: 5px 10px;
  font-size: 11px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  color: var(--color-text);
  outline: none;
  font-family: var(--font-ui, inherit);
}

.timeline-step-feedback-input:focus {
  border-color: var(--color-accent);
}

.timeline-step-feedback-input::placeholder {
  color: var(--color-text-muted);
  opacity: 0.6;
}

/* Light theme overrides for timeline step feedback */
.theme-light .timeline-step-feedback-panel {
  background: rgba(0, 0, 0, 0.03);
}

.theme-light .timeline-step-feedback-btn {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(0, 0, 0, 0.1);
}

.theme-light .timeline-step-feedback-input {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(0, 0, 0, 0.1);
}

.theme-light .timeline-step-feedback-toggle:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* User message events - chat bubble on the right */
.timeline-event.user-message-event {
  display: flex;
  justify-content: flex-end;
  padding: 8px 0;
}

.user-message-bubble {
  max-width: 70%;
  background: var(--color-accent);
  color: #fff;
  border-radius: 16px 16px 4px 16px;
  padding: 6px 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.theme-light .user-message-bubble {
  background: var(--color-bg-sidebar);
  color: var(--color-text);
}

.user-message-content {
  font-size: 13px;
  line-height: 1.4;
  word-break: break-word;
}

.user-message-time {
  font-size: 10px;
  opacity: 0.7;
  text-align: right;
  margin-top: 4px;
}

.event-indicator {
  --timeline-indicator-size: 16px;
  position: relative;
  display: none;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  width: var(--timeline-indicator-size);
  min-height: 20px;
}

.event-connector {
  display: none;
  position: absolute;
  left: 50%;
  width: 1px;
  transform: translateX(-50%);
  background: var(--color-border-subtle);
  pointer-events: none;
}

.event-connector-above {
  top: 0;
  height: calc(50% - (var(--timeline-indicator-size) / 2));
}

.event-connector-below {
  bottom: 0;
  height: calc(50% - (var(--timeline-indicator-size) / 2));
}

.event-indicator-icon {
  width: var(--timeline-indicator-size);
  height: var(--timeline-indicator-size);
  border-radius: 6px;
  border: 1px solid var(--color-border-subtle);
  background: var(--color-bg-secondary);
  color: var(--color-text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.event-indicator-icon.tone-neutral {
  color: var(--color-text-muted);
}

.event-indicator-icon.tone-active {
  color: var(--color-accent);
  border-color: var(--color-accent-subtle);
  background: var(--color-accent-subtle);
}

.event-indicator-icon.tone-success {
  color: var(--color-success);
  border-color: var(--color-success-subtle);
  background: var(--color-success-subtle);
}

.event-indicator-icon.tone-warning {
  color: var(--color-warning);
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.12);
}

.event-indicator-icon.tone-error {
  color: var(--color-error);
  border-color: var(--color-error-subtle);
  background: var(--color-error-subtle);
}

.event-indicator-icon.spin>svg {
  animation: timeline-indicator-spin 1s linear infinite;
}

.event-indicator-icon>svg {
  width: 12px;
  height: 12px;
}

.event-branch-stub {
  display: none;
  position: absolute;
  top: 50%;
  left: calc(50% + (var(--timeline-indicator-size) / 2));
  width: 8px;
  height: 1px;
  transform: translateY(-50%);
  background: var(--color-border-subtle);
  pointer-events: none;
}

.parallel-group-feed-details {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.parallel-group-feed-single {
  display: block;
  min-width: 0;
}

.parallel-group-feed-single-lane {
  padding-left: 0;
}

.parallel-group-feed-lane {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding-left: 12px;
  min-height: 18px;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.parallel-group-feed-lane-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  flex-shrink: 0;
  background: var(--color-text-muted);
}

.parallel-group-feed-lane-dot.tone-active {
  background: var(--color-accent);
}

.parallel-group-feed-lane-dot.tone-success {
  background: var(--color-success);
}

.parallel-group-feed-lane-dot.tone-error {
  background: var(--color-error);
}

.parallel-group-feed-lane-title {
  min-width: 0;
  font-size: 11px;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.parallel-group-feed-lane-time {
  font-size: 10px;
  color: var(--color-text-muted);
  font-family: var(--font-ui);
  font-weight: 400;
  flex-shrink: 0;
  opacity: 0.55;
  min-width: 65px;
  text-align: right;
  margin-left: auto;
}

.parallel-group-feed-image-frame {
  position: relative;
  width: min(504px, calc(100% - 25px));
  aspect-ratio: 1;
  margin: 10px 0 4px 25px;
  border-radius: 18px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(140% 110% at 0% 0%, color-mix(in srgb, var(--color-accent) 9%, transparent), transparent 55%),
    radial-gradient(140% 110% at 100% 100%, color-mix(in srgb, var(--color-accent) 7%, transparent), transparent 55%),
    color-mix(in srgb, var(--color-bg-secondary) 92%, var(--color-bg-primary));
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--color-border-subtle) 55%, transparent),
    inset 0 1px 0 color-mix(in srgb, #ffffff 5%, transparent),
    0 1px 2px color-mix(in srgb, #000000 8%, transparent);
}

.parallel-group-feed-image-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 2;
  box-shadow: inset 0 0 24px color-mix(in srgb, var(--color-accent) 16%, transparent);
  animation: parallel-image-frame-breath 3.2s ease-in-out infinite;
}

.parallel-group-feed-image-frame-core {
  position: absolute;
  inset: -30%;
  z-index: 0;
  background:
    radial-gradient(closest-side at 28% 30%, color-mix(in srgb, var(--color-accent) 80%, #6366f1) 0%, transparent 62%),
    radial-gradient(closest-side at 76% 34%, #ec4899 0%, transparent 60%),
    radial-gradient(closest-side at 72% 76%, #8b5cf6 0%, transparent 60%),
    radial-gradient(closest-side at 22% 78%, #06b6d4 0%, transparent 60%);
  filter: blur(26px) saturate(1.1);
  opacity: 0.55;
  animation: parallel-image-frame-aurora 8s ease-in-out infinite alternate;
}

.parallel-group-feed-image-frame-sheen {
  position: absolute;
  top: -12%;
  bottom: -12%;
  left: 0;
  width: 55%;
  z-index: 1;
  pointer-events: none;
  transform: translateX(-220%) rotate(14deg);
  background: linear-gradient(
    90deg,
    transparent 0%,
    color-mix(in srgb, #ffffff 22%, transparent) 50%,
    transparent 100%
  );
  animation: parallel-image-frame-sheen 3s cubic-bezier(0.45, 0, 0.2, 1) infinite;
}

@keyframes timeline-indicator-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes parallel-image-frame-aurora {
  0% {
    transform: translate3d(-2%, -2%, 0) rotate(0deg) scale(1);
    opacity: 0.45;
  }

  50% {
    transform: translate3d(3%, 4%, 0) rotate(40deg) scale(1.08);
    opacity: 0.7;
  }

  100% {
    transform: translate3d(2%, -3%, 0) rotate(85deg) scale(1.04);
    opacity: 0.55;
  }
}

@keyframes parallel-image-frame-sheen {
  0%,
  18% {
    transform: translateX(-220%) rotate(14deg);
  }

  82%,
  100% {
    transform: translateX(420%) rotate(14deg);
  }
}

@keyframes parallel-image-frame-breath {
  0%,
  100% {
    opacity: 0.65;
  }

  50% {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .event-indicator-icon.spin>svg {
    animation: none;
  }

  .parallel-group-feed-image-frame::before,
  .parallel-group-feed-image-frame-core,
  .parallel-group-feed-image-frame-sheen {
    animation: none;
  }
}

.event-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-text-muted);
}

.event-dot.success {
  background: var(--color-success);
}

.event-dot.active {
  background: var(--color-accent);
}

.event-dot.error {
  background: var(--color-error);
}

.event-dot.cancelled {
  background: var(--color-warning, #f59e0b);
}

.event-details.cancelled {
  color: var(--color-warning, #f59e0b);
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
}

.event-details.context-summary {
  color: var(--color-text-secondary);
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.25);
}

.context-summary-header {
  font-style: italic;
  margin-bottom: 8px;
  color: var(--color-text-muted);
  font-size: 11px;
}

.context-summary-body {
  white-space: pre-wrap;
  font-size: 12px;
  line-height: 1.5;
}

.context-summary-preamble {
  margin-bottom: 8px;
  color: var(--color-text-muted);
  font-size: 12px;
}

.context-summary-section {
  margin-bottom: 4px;
}

.context-summary-section>summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
  color: var(--color-text-primary);
  padding: 4px 0;
  list-style: disclosure-closed;
}

.context-summary-section[open]>summary {
  list-style: disclosure-open;
  margin-bottom: 4px;
}

.context-summary-section-content {
  padding-left: 12px;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  color: var(--color-text-secondary);
}

.context-summary-stats {
  font-size: 10px;
  color: var(--color-text-muted);
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px solid rgba(99, 102, 241, 0.15);
}

.event-line {
  flex: 1;
  width: 2px;
  background: var(--color-border-subtle);
}

.event-content {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  padding-top: 0;
}

.event-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.step-feed-card .event-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.event-header.expandable {
  cursor: pointer;
  padding: 4px 8px 4px 4px;
  margin: -4px -8px -4px -4px;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease;
}

.event-header.expandable:hover {
  background: var(--color-bg-hover);
}

.event-header-left {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.step-feed-card .event-header-left {
  align-items: flex-start;
}

.event-expand-icon {
  flex-shrink: 0;
  color: var(--color-text-muted);
  transition: transform 0.2s ease;
}

.event-header.expanded .event-expand-icon {
  transform: rotate(90deg);
}

.event-title {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--color-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.step-feed-card .event-title {
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.45;
}

.event-title > * {
  min-width: 0;
}

.step-feed-card .event-title > *,
.step-feed-card .event-title > p,
.step-feed-card .event-title li {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.step-feed-card .event-details {
  margin-top: 4px;
  padding: 4px 0;
}

.step-feed-card .event-details-file-preview,
.step-feed-card .event-details-code-preview {
  margin-top: 2px;
  padding: 0;
}

.step-feed-card .inline-document-preview {
  border: 0;
  background: transparent;
}

.step-feed-card .inline-document-header {
  display: none;
}

.step-feed-card .inline-document-markdown,
.step-feed-card .inline-document-content {
  padding: 0;
  background: transparent;
}

.step-feed-card .inline-document-markdown.markdown-content pre {
  margin: 0;
  padding: 6px 8px;
  border-radius: 6px;
}

.step-feed-card .edit-diff-preview {
  padding: 2px 0;
}

.event-title > p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-title> :first-child {
  margin-top: 0;
}

.event-title> :last-child {
  margin-bottom: 0;
}

.event-title ol,
.event-title ul {
  margin: 4px 0 0;
  padding-left: 0;
  list-style-position: inside;
}

.event-title li {
  margin: 2px 0;
}

.event-title code {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  font-weight: 600;
  background: transparent;
  color: inherit;
  padding: 0;
  border-radius: 0;
}

/* Animated "Thinking..." ellipsis (Codex/Claude Code style) */
.thinking-title .thinking-ellipsis span {
  opacity: 0.4;
  animation: thinkDot 1.2s ease-in-out infinite;
}
.thinking-title .thinking-ellipsis span:nth-child(1) {
  animation-delay: 0s;
}
.thinking-title .thinking-ellipsis span:nth-child(2) {
  animation-delay: 0.15s;
}
.thinking-title .thinking-ellipsis span:nth-child(3) {
  animation-delay: 0.3s;
}

/* Action block (collapsible tool/step group between assistant messages) */
.action-block {
  border: none;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}

.action-block-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  width: 100%;
  padding: 4px 4px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-muted);
  text-align: left;
  transition: opacity 0.15s ease;
  position: relative;
  opacity: 1;
}

.action-block-header:hover {
  opacity: 1;
  background: transparent;
}

.action-block-header svg {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  color: var(--color-text-muted);
}

.action-block-kind-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: var(--color-text-muted);
  opacity: 0.86;
}

.action-block-kind-icon svg {
  width: 16px;
  height: 16px;
  color: currentColor;
}

.action-block-header:hover .action-block-kind-icon {
  color: var(--color-text-secondary);
  opacity: 1;
}

.action-block-summary {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-block-meta {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-muted);
}

/* Expanded: no middle “last step” flex filler — pin stats to the right like collapsed */
.action-block.expanded .action-block-meta {
  margin-left: auto;
}

.action-block-count {
  flex-shrink: 0;
}

.action-block-stats {
  flex-shrink: 0;
}

.action-block-stats-sep {
  margin: 0 4px;
  opacity: 0.7;
}

.action-block-content {
  padding: 0 8px 6px;
  border-top: none;
}

.action-block-indicator .action-block-dot {
  display: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-text-muted);
  flex-shrink: 0;
}

.action-block.active .action-block-dot {
  background: var(--color-accent);
}

.action-block-body {
  flex: 1;
  min-width: 0;
}

.action-block-events {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-left: 8px;
  margin-top: 2px;
}

.action-block-events > .step-feed-card {
  padding: 2px 0;
}

.action-block-events .event-header.expandable {
  padding: 2px 6px 2px 2px;
  margin: -2px -6px -2px -2px;
}

.action-block-events .event-details {
  margin-top: 4px;
  padding: 6px 0;
}

.action-block-events .event-details-file-preview,
.action-block-events .event-details-code-preview {
  padding: 0;
}

.action-block-events > .command-output-container {
  margin-left: -4px;
  margin-right: 4px;
  margin-bottom: 4px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.action-block-last-step-label {
  flex: 1 1 0;
  min-width: 0;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  opacity: 0.7;
}

.action-block-show-all-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  margin: 0 auto 8px;
  padding: 3px 10px;
  font-size: 11px;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  text-align: center;
  opacity: 0.6;
  transition: opacity 0.15s, background 0.15s;
}

.action-block-show-all-btn:hover {
  opacity: 1;
  background: var(--color-bg-tertiary, rgba(255, 255, 255, 0.06));
  color: var(--color-text);
}

.action-block-show-less-btn {
  margin-top: 4px;
}

.timeline-step-child-groups {
  margin-top: 8px;
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

@keyframes thinkDot {
  0%,
  70%,
  100% {
    opacity: 0.4;
  }
  35% {
    opacity: 1;
  }
}

.event-time {
  font-size: 10px;
  color: var(--color-text-muted);
  font-family: var(--font-ui);
  font-weight: 400;
  flex-shrink: 0;
  opacity: 0.55;
  min-width: 65px;
  text-align: right;
}

.step-feed-card .event-time {
  align-self: start;
}

.event-details {
  margin-top: 8px;
  padding: 12px 4px;
  background: transparent;
  border-radius: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-text-secondary);
  border: none;
}

.step-feed-card .event-details {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: anywhere;
}

.event-details.event-details-failure {
  padding: 7px 10px 7px 12px;
  border: 1px solid color-mix(in srgb, var(--color-error) 24%, transparent);
  border-left-width: 3px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--color-error) 8%, transparent);
  color: color-mix(in srgb, var(--color-error) 76%, var(--color-text));
  font-family: var(--font-ui);
  font-size: 12px;
  line-height: 1.45;
}

.step-feed-card .event-details.event-details-failure {
  margin-top: 6px;
  padding: 7px 10px 7px 12px;
}

.theme-light .event-details.event-details-failure {
  background: color-mix(in srgb, var(--color-error) 7%, #ffffff);
  color: color-mix(in srgb, var(--color-error) 70%, #3f3f46);
}

.event-details pre {
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Plan checklist (execution plan steps) */
.plan-checklist {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.plan-checklist-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 6px 0;
}

.plan-checklist-circle {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--color-text-tertiary, #888);
  margin-top: 1px;
}

.plan-checklist-text {
  flex: 1;
  font-size: 12.5px;
  color: var(--color-text-secondary);
  line-height: 1.4;
}

.evidence-event-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.evidence-event-details-title {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 0;
  font-weight: 600;
  font-size: 12px;
  line-height: 1.3;
  background: var(--color-bg-secondary);
}

.evidence-event-details-scroll {
  max-height: calc((18px * 5) + (4px * 4));
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
}

.evidence-event-details-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.evidence-event-details-item+.evidence-event-details-item {
  margin-top: 4px;
}

.evidence-event-details-item {
  min-width: 0;
}

.evidence-event-link {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  font-size: 12px;
  line-height: 1.35;
  min-height: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-decoration: none;
}

.evidence-event-link:hover {
  text-decoration: underline;
}

.evidence-event-link-static {
  color: var(--color-text-secondary);
}

.evidence-event-favicon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  border-radius: 3px;
  background: var(--color-bg-tertiary);
  color: var(--color-text-muted);
  font-size: 8px;
  font-weight: 700;
  line-height: 1;
}

.evidence-event-domain {
  flex: 0 0 auto;
  max-width: 160px;
  overflow: hidden;
  color: var(--color-text-secondary);
  font-weight: 600;
  text-overflow: ellipsis;
}

.evidence-event-link-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: inherit;
  text-overflow: ellipsis;
}

.event-details.assistant-message {
  font-family: var(--font-ui);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg-secondary);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.event-details.assistant-message .message-actions {
  align-self: flex-start;
  margin-top: 4px;
}

.event-details.assistant-message .message-copy-btn,
.event-details.assistant-message .message-speak-btn {
  margin-top: 0;
}

.completion-output-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.completion-output-header {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  color: var(--color-success);
}

.completion-output-subtitle {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--color-text-secondary);
}

.completion-output-primary {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--color-text-secondary);
}

.completion-output-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.completion-output-btn {
  border: 1px solid var(--color-success);
  background: rgba(34, 197, 94, 0.1);
  color: var(--color-success);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 11px;
  font-family: var(--font-ui);
  cursor: pointer;
}

.completion-output-btn.secondary {
  border-color: var(--color-border);
  background: var(--color-bg-secondary);
  color: var(--color-text-secondary);
}

.completion-output-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.event-details.event-details-file-preview {
  font-family: var(--font-ui);
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 0;
  min-width: 0;
  overflow: hidden;
}

.assistant-artifact-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  font-family: var(--font-ui);
}

.assistant-artifact-cards .spreadsheet-artifact-card,
.assistant-artifact-cards .document-artifact-card,
.assistant-artifact-cards .presentation-artifact-card,
.assistant-artifact-cards .web-artifact-card {
  max-width: 100%;
}

.conversation-artifact-stack {
  margin: 4px 0 14px;
}

.conversation-artifact-stack-show-more {
  display: inline-flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--color-border-subtle, var(--color-border));
  border-radius: 8px;
  background: var(--color-bg-primary);
  color: var(--color-text-muted);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
}

.conversation-artifact-stack-show-more:hover {
  background: var(--color-bg-hover);
  color: var(--color-text);
}

.inline-image-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.inline-image-preview-loading,
.inline-image-preview-error {
  font-size: 12px;
  color: var(--color-text-muted);
}

.inline-image-preview-error {
  color: var(--color-error);
}

.inline-image-preview-frame {
  position: relative;
  width: fit-content;
  max-width: 100%;
}

.inline-image-preview-button {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  align-self: flex-start;
}

.inline-image-preview-image {
  display: block;
  max-width: min(720px, 100%);
  max-height: 520px;
  width: auto;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-bg-primary);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.inline-image-preview-button:hover .inline-image-preview-image {
  border-color: var(--color-border-light);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
}

.inline-image-preview-download-button {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.74);
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(10px);
  text-decoration: none;
  transition:
    background-color 0.16s ease,
    border-color 0.16s ease,
    transform 0.16s ease;
}

.inline-image-preview-download-button:hover,
.inline-image-preview-download-button:focus-visible {
  border-color: rgba(255, 255, 255, 0.82);
  background: rgba(17, 24, 39, 0.88);
  transform: translateY(-1px);
}

.inline-image-preview-download-button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.inline-image-preview-meta {
  font-size: 11px;
  color: var(--color-text-muted);
}

.markdown-image-preview {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 12px 0;
}

.markdown-image-preview-placeholder,
.markdown-image-preview-error {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg-primary);
  color: var(--color-text-muted);
  font-size: 12px;
}

.markdown-image-preview-error {
  color: var(--color-error);
  border-color: rgba(248, 113, 113, 0.28);
  background: var(--color-error-subtle);
}

.markdown-image-preview-button {
  display: block;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg-primary);
  cursor: zoom-in;
  overflow: hidden;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
}

.markdown-image-preview-button:hover {
  border-color: var(--color-border-light);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
}

.markdown-image-preview-img {
  display: block;
  max-width: min(360px, 100%);
  max-height: 220px;
  width: auto;
  height: auto;
  object-fit: contain;
  background: var(--color-bg-primary);
}

.markdown-image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10020;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
}

.markdown-image-lightbox-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: min(92vw, 1200px);
  max-height: 90vh;
}

.markdown-image-lightbox-img {
  display: block;
  max-width: min(92vw, 1200px);
  max-height: calc(90vh - 48px);
  object-fit: contain;
  border-radius: 8px;
  background: var(--color-bg-primary);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.markdown-image-lightbox-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-bg-primary);
  color: var(--color-text);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.markdown-image-lightbox-close:hover {
  background: var(--color-bg-hover);
}

.markdown-image-lightbox-caption {
  max-width: min(92vw, 900px);
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
  overflow-wrap: anywhere;
}

.inline-video-preview {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  max-width: 100%;
  background: var(--color-bg-secondary);
}

.inline-video-loading,
.inline-video-error {
  padding: 16px;
  font-size: 12px;
  color: var(--color-text-muted);
}

.inline-video-error {
  color: var(--color-error);
}

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

.inline-video-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.inline-video-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #7c3aed;
  color: #fff;
}

.inline-video-name-wrap {
  min-width: 0;
}

.inline-video-filename {
  font-size: 13px;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inline-video-subtitle {
  margin-top: 1px;
  font-size: 11px;
  color: var(--color-text-muted);
}

.inline-video-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.inline-video-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
}

.inline-video-action-btn:hover {
  background: var(--color-bg-tertiary);
  color: var(--color-text);
}

.inline-video-player-wrap {
  padding: 12px;
}

.inline-video-player {
  display: block;
  width: min(100%, 720px);
  max-width: 100%;
  max-height: 520px;
  background: #000;
  border-radius: 8px;
}

.assistant-video-embed {
  margin: 12px 0;
}

.assistant-html-embed {
  margin: 12px 0;
}

.assistant-rich-frame-embed {
  margin: 8px 0 14px;
}

.chat-message.assistant-message:has(.assistant-html-embed) .chat-bubble.assistant-bubble {
  width: min(100%, 1180px);
}

.chat-message.assistant-message:has(.assistant-rich-frame-embed) .chat-bubble.assistant-bubble {
  width: min(100%, 1180px);
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  overflow: visible;
}

.chat-message.assistant-message:has(.assistant-html-embed) .chat-bubble-content {
  word-break: normal;
}

.chat-message.assistant-message:has(.assistant-rich-frame-embed) .chat-bubble-content {
  word-break: normal;
}

.assistant-video-error {
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.08);
  color: var(--color-error);
  font-size: 12px;
}

.assistant-html-error {
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.08);
  color: var(--color-error);
  font-size: 12px;
}

.completion-output-preview {
  margin-bottom: 12px;
}

.inline-html-preview {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--color-bg-secondary);
}

.inline-html-loading,
.inline-html-error {
  padding: 16px;
  font-size: 12px;
  color: var(--color-text-muted);
}

.inline-html-error {
  color: var(--color-error);
}

.inline-html-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  background: color-mix(in srgb, var(--color-bg-secondary) 86%, var(--color-bg-primary) 14%);
}

.inline-html-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.inline-html-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
  flex-shrink: 0;
}

.inline-html-name-wrap {
  min-width: 0;
}

.inline-html-filename {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inline-html-subtitle {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.inline-html-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.inline-html-action-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--color-accent) 42%, var(--color-border));
  background: color-mix(in srgb, var(--color-accent) 12%, transparent);
  color: var(--color-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
}

.inline-html-action-btn svg {
  display: block;
  flex-shrink: 0;
  color: inherit;
}

.inline-html-action-btn:hover {
  background: color-mix(in srgb, var(--color-accent) 18%, transparent);
  border-color: color-mix(in srgb, var(--color-accent) 62%, var(--color-border));
  color: var(--color-accent-dark);
}

.inline-html-frame-wrap {
  padding: 12px;
}

.inline-html-frame {
  display: block;
  width: 100%;
  min-height: 520px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: white;
}

.inline-html-preview-frame {
  --inline-html-frame-height: clamp(360px, 56vh, 720px);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.inline-html-preview-frame .inline-html-frame-wrap {
  padding: 0;
  height: var(--inline-html-frame-height);
  aspect-ratio: var(--inline-html-frame-aspect-ratio, auto);
  background: transparent;
}

.inline-html-preview-frame .inline-html-frame {
  min-height: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.inline-html-preview-embedded .inline-html-frame {
  min-height: clamp(560px, 72vh, 860px);
}

.inline-html-preview-frame.inline-html-preview-embedded .inline-html-frame {
  min-height: 100%;
}

.inline-html-preview-source .inline-html-frame {
  min-height: clamp(620px, 78vh, 960px);
}

@media (max-width: 760px) {
  .assistant-html-embed {
    margin: 10px -4px;
  }

  .assistant-rich-frame-embed {
    margin: 10px -4px;
  }

  .inline-html-frame-wrap {
    padding: 8px;
  }

  .inline-html-preview-frame {
    border-radius: 0;
  }

  .inline-html-preview-frame .inline-html-frame-wrap {
    padding: 0;
    height: var(--inline-html-frame-height);
    max-height: 72vh;
  }

  .inline-html-preview-embedded .inline-html-frame,
  .inline-html-preview-source .inline-html-frame {
    min-height: 70vh;
  }

  .inline-html-preview-frame.inline-html-preview-embedded .inline-html-frame,
  .inline-html-preview-frame.inline-html-preview-source .inline-html-frame {
    min-height: 100%;
  }
}

/* Spreadsheet artifact cards */
.spreadsheet-artifact-card {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 68px;
  padding: 10px 24px;
  border: 1px solid var(--color-border-subtle, var(--color-border));
  border-radius: 12px;
  background: var(--color-bg-primary);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.spreadsheet-artifact-icon,
.spreadsheet-viewer-file-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: linear-gradient(180deg, #24a148 0%, #15803d 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
}

.spreadsheet-artifact-file {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
  padding: 0 0 0 2px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.spreadsheet-artifact-name {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: var(--color-text);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spreadsheet-artifact-meta {
  display: block;
  max-width: 100%;
  margin-top: 0;
  overflow: hidden;
  color: var(--color-text-muted);
  font-size: 12px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spreadsheet-artifact-actions {
  position: relative;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-bg-primary);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.spreadsheet-artifact-open,
.spreadsheet-artifact-menu-btn {
  display: inline-flex;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
}

.spreadsheet-artifact-open {
  gap: 7px;
  padding: 0 7px 0 12px;
  font-size: 14px;
  font-weight: 600;
}

.spreadsheet-artifact-menu-btn {
  width: 26px;
  border-radius: 0 12px 12px 0;
  color: var(--color-text-muted);
}

.spreadsheet-artifact-chevron-down {
  display: block;
  width: 14px;
  height: 14px;
  margin-right: 1px;
  flex: 0 0 14px;
}

.spreadsheet-artifact-open:hover,
.spreadsheet-artifact-menu-btn:hover,
.spreadsheet-artifact-menu-btn[aria-expanded="true"] {
  color: var(--color-accent, var(--color-text));
  background: var(--color-bg-hover);
}

.spreadsheet-artifact-menu {
  z-index: 80;
  width: 230px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-bg-primary);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
}

.spreadsheet-artifact-menu button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  font-size: 14px;
  text-align: left;
}

.spreadsheet-artifact-menu button:hover {
  background: var(--color-bg-hover);
}

.spreadsheet-artifact-menu-separator {
  height: 1px;
  margin: 8px 0;
  background: var(--color-border-subtle);
}

.spreadsheet-artifact-app-icon {
  display: inline-flex;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}

.spreadsheet-artifact-app-icon.excel {
  background: #15803d;
}

.spreadsheet-artifact-app-icon.numbers {
  background: #6ee65f;
}

.spreadsheet-artifact-app-icon.outlook {
  background: #4f8df7;
}

.spreadsheet-artifact-app-icon.finder {
  background: #58a6ff;
}

/* Document artifact cards */
.document-artifact-card {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 68px;
  padding: 10px 24px;
  border: 1px solid var(--color-border-subtle, var(--color-border));
  border-radius: 12px;
  background: var(--color-bg-primary);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.document-artifact-icon,
.document-viewer-file-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
}

.document-artifact-file {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 0 0 0 2px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.document-artifact-name,
.document-artifact-meta {
  display: block;
  max-width: 100%;
  margin-left: -2px;
  padding-left: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-artifact-name {
  color: var(--color-text);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.3;
}

.document-artifact-meta {
  color: var(--color-text-muted);
  font-size: 12px;
  line-height: 1.2;
}

.document-artifact-actions {
  position: relative;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-bg-primary);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.document-artifact-open,
.document-artifact-menu-btn {
  display: inline-flex;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
}

.document-artifact-open {
  gap: 7px;
  padding: 0 7px 0 12px;
  font-size: 14px;
  font-weight: 600;
}

.document-artifact-menu-btn {
  width: 26px;
  border-radius: 0 12px 12px 0;
  color: var(--color-text-muted);
}

.document-artifact-chevron-down {
  display: block;
  width: 14px;
  height: 14px;
  margin-right: 1px;
  flex: 0 0 14px;
}

.document-artifact-open:hover,
.document-artifact-menu-btn:hover,
.document-artifact-menu-btn[aria-expanded="true"] {
  color: var(--color-accent, var(--color-text));
  background: var(--color-bg-hover);
}

.document-artifact-menu {
  z-index: 80;
  width: 250px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-bg-primary);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
}

.document-artifact-menu button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  font-size: 14px;
  text-align: left;
}

.document-artifact-menu button:hover {
  background: var(--color-bg-hover);
}

.document-artifact-menu-separator {
  height: 1px;
  margin: 8px 0;
  background: var(--color-border-subtle);
}

.document-artifact-app-icon {
  display: inline-flex;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}

.document-artifact-app-icon.word { background: #2563eb; }
.document-artifact-app-icon.pages { background: #f59e0b; }
.document-artifact-app-icon.textedit { background: #64748b; }
.document-artifact-app-icon.finder { background: #58a6ff; }

/* Presentation artifact cards */
.presentation-artifact-card {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 68px;
  padding: 10px 24px;
  border: 1px solid var(--color-border-subtle, var(--color-border));
  border-radius: 12px;
  background: var(--color-bg-primary);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.presentation-artifact-icon,
.presentation-viewer-file-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: linear-gradient(180deg, #f97316 0%, #c2410c 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
}

.presentation-artifact-file {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 0 0 0 2px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.presentation-artifact-name,
.presentation-artifact-meta {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.presentation-artifact-name {
  color: var(--color-text);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.3;
}

.presentation-artifact-meta {
  color: var(--color-text-muted);
  font-size: 12px;
  line-height: 1.2;
}

.presentation-artifact-actions {
  position: relative;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-bg-primary);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.presentation-artifact-open,
.presentation-artifact-menu-btn {
  display: inline-flex;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
}

.presentation-artifact-open {
  gap: 7px;
  padding: 0 7px 0 12px;
  font-size: 14px;
  font-weight: 600;
}

.presentation-artifact-menu-btn {
  width: 26px;
  border-radius: 0 12px 12px 0;
  color: var(--color-text-muted);
}

.presentation-artifact-chevron-down {
  display: block;
  width: 14px;
  height: 14px;
  margin-right: 1px;
  flex: 0 0 14px;
}

.presentation-artifact-open:hover,
.presentation-artifact-menu-btn:hover,
.presentation-artifact-menu-btn[aria-expanded="true"] {
  color: var(--color-accent, var(--color-text));
  background: var(--color-bg-hover);
}

.presentation-artifact-menu {
  z-index: 80;
  width: 270px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-bg-primary);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
}

.presentation-artifact-menu button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  font-size: 14px;
  text-align: left;
}

.presentation-artifact-menu button:hover {
  background: var(--color-bg-hover);
}

.presentation-artifact-menu-separator {
  height: 1px;
  margin: 8px 0;
  background: var(--color-border-subtle);
}

.presentation-artifact-app-icon {
  display: inline-flex;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}

.presentation-artifact-app-icon.powerpoint { background: #c2410c; }
.presentation-artifact-app-icon.keynote { background: #3b82f6; }
.presentation-artifact-app-icon.libreoffice { background: #64748b; }
.presentation-artifact-app-icon.preview { background: #8b5cf6; }
.presentation-artifact-app-icon.finder { background: #58a6ff; }

/* Web page artifact cards */
.web-artifact-card {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 68px;
  padding: 10px 24px;
  border: 1px solid var(--color-border-subtle, var(--color-border));
  border-radius: 12px;
  background: var(--color-bg-primary);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.web-artifact-icon,
.web-viewer-file-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: linear-gradient(180deg, #0ea5e9 0%, #0369a1 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
}

.web-artifact-file {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 0 0 0 2px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.web-artifact-name,
.web-artifact-meta {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.web-artifact-name {
  color: var(--color-text);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.3;
}

.web-artifact-meta {
  color: var(--color-text-muted);
  font-size: 12px;
  line-height: 1.2;
}

.web-artifact-actions {
  position: relative;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-bg-primary);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.web-artifact-open,
.web-artifact-menu-btn {
  display: inline-flex;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
}

.web-artifact-open {
  gap: 7px;
  padding: 0 7px 0 12px;
  font-size: 14px;
  font-weight: 600;
}

.web-artifact-menu-btn {
  width: 26px;
  border-radius: 0 12px 12px 0;
  color: var(--color-text-muted);
}

.web-artifact-chevron-down {
  display: block;
  width: 14px;
  height: 14px;
  margin-right: 1px;
  flex: 0 0 14px;
}

.web-artifact-open:hover,
.web-artifact-menu-btn:hover,
.web-artifact-menu-btn[aria-expanded="true"] {
  color: var(--color-accent, var(--color-text));
  background: var(--color-bg-hover);
}

.web-artifact-menu {
  z-index: 80;
  width: 240px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-bg-primary);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
}

.web-artifact-menu button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  font-size: 14px;
  text-align: left;
}

.web-artifact-menu button:hover {
  background: var(--color-bg-hover);
}

.web-artifact-menu-separator {
  height: 1px;
  margin: 8px 0;
  background: var(--color-border-subtle);
}

.web-artifact-app-icon {
  display: inline-flex;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}

.web-artifact-app-icon.browser { background: #0284c7; }
.web-artifact-app-icon.copy { background: #64748b; }
.web-artifact-app-icon.finder { background: #58a6ff; }

@container (max-width: 560px) {
  .spreadsheet-artifact-card,
  .document-artifact-card,
  .presentation-artifact-card,
  .web-artifact-card {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 10px;
    min-height: 0;
    padding: 12px 14px;
  }

  .spreadsheet-artifact-icon,
  .document-artifact-icon,
  .presentation-artifact-icon,
  .web-artifact-icon {
    width: 32px;
    height: 32px;
  }

  .spreadsheet-artifact-file,
  .document-artifact-file,
  .presentation-artifact-file,
  .web-artifact-file {
    align-self: center;
  }

  .spreadsheet-artifact-name,
  .document-artifact-name,
  .presentation-artifact-name,
  .web-artifact-name {
    font-size: 13px;
  }

  .spreadsheet-artifact-meta,
  .document-artifact-meta,
  .presentation-artifact-meta,
  .web-artifact-meta {
    display: none;
  }

  .spreadsheet-artifact-actions,
  .document-artifact-actions,
  .presentation-artifact-actions,
  .web-artifact-actions {
    grid-column: 2;
    justify-self: start;
    max-width: 100%;
  }

  .spreadsheet-artifact-open,
  .document-artifact-open,
  .presentation-artifact-open,
  .web-artifact-open {
    height: 34px;
    padding: 0 12px;
    font-size: 13px;
  }

  .spreadsheet-artifact-menu-btn,
  .document-artifact-menu-btn,
  .presentation-artifact-menu-btn,
  .web-artifact-menu-btn {
    height: 34px;
  }
}

/* Inline Spreadsheet Preview (legacy compact table fallback) */
.inline-spreadsheet-preview {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  max-width: 100%;
  background: var(--color-bg-secondary);
}

.inline-spreadsheet-loading,
.inline-spreadsheet-error {
  padding: 16px;
  font-size: 12px;
  color: var(--color-text-muted);
}

.inline-spreadsheet-error {
  color: var(--color-error);
}

.inline-spreadsheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
}

.inline-spreadsheet-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  min-width: 0;
}

.inline-spreadsheet-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #1d6f42;
  color: #fff;
}

.inline-spreadsheet-filename {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.inline-spreadsheet-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.inline-spreadsheet-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
}

.inline-spreadsheet-action-btn:hover {
  background: var(--color-bg-tertiary);
  color: var(--color-text);
}

.inline-spreadsheet-table-wrapper {
  overflow-x: auto;
  max-height: 480px;
  overflow-y: auto;
}

.inline-spreadsheet-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
  table-layout: auto;
}

.inline-spreadsheet-table th,
.inline-spreadsheet-table td {
  padding: 4px 10px;
  border: 1px solid var(--color-border);
  text-align: left;
  white-space: nowrap;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inline-spreadsheet-corner {
  background: var(--color-bg-tertiary);
  width: 36px;
  min-width: 36px;
  position: sticky;
  left: 0;
  z-index: 2;
}

.inline-spreadsheet-col-header {
  background: var(--color-bg-tertiary);
  color: var(--color-text-muted);
  font-weight: 500;
  text-align: center;
  font-size: 11px;
  padding: 3px 10px;
  position: sticky;
  top: 0;
  z-index: 1;
}

.inline-spreadsheet-row-number {
  background: var(--color-bg-tertiary);
  color: var(--color-text-muted);
  font-size: 11px;
  text-align: center;
  font-weight: 400;
  width: 36px;
  min-width: 36px;
  position: sticky;
  left: 0;
  z-index: 1;
}

.inline-spreadsheet-header-row .inline-spreadsheet-row-number {
  z-index: 3;
  position: sticky;
  top: 0;
  left: 0;
}

.inline-spreadsheet-data-header {
  background: var(--color-bg-tertiary);
  font-weight: 600;
  color: var(--color-text);
  position: sticky;
  top: 0;
  z-index: 1;
}

.inline-spreadsheet-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.inline-spreadsheet-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

.theme-light .inline-spreadsheet-table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.02);
}

.theme-light .inline-spreadsheet-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.04);
}

.inline-spreadsheet-truncated {
  padding: 6px 12px;
  font-size: 11px;
  color: var(--color-text-muted);
  text-align: center;
  border-top: 1px solid var(--color-border);
}

.inline-spreadsheet-tabs {
  display: flex;
  gap: 0;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-tertiary);
  overflow-x: auto;
}

.inline-spreadsheet-tab {
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
  background: transparent;
  border: none;
  border-right: 1px solid var(--color-border);
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.15s,
    color 0.15s;
}

.inline-spreadsheet-tab:hover {
  background: var(--color-bg-secondary);
  color: var(--color-text);
}

.inline-spreadsheet-tab.active {
  color: var(--color-text);
  background: var(--color-bg-secondary);
  border-bottom: 2px solid var(--color-accent, #1d6f42);
}

/* Inline presentation preview */
.inline-presentation-preview {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  box-sizing: border-box;
  background: var(--color-bg-secondary);
  color: var(--color-text);
  text-align: left;
  cursor: pointer;
}

.inline-presentation-preview:hover {
  border-color: rgba(99, 102, 241, 0.55);
}

.inline-presentation-loading,
.inline-presentation-error {
  padding: 16px;
  font-size: 12px;
  color: var(--color-text-muted);
}

.inline-presentation-error {
  color: var(--color-error);
}

.inline-presentation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border);
}

.inline-presentation-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.inline-presentation-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 6px;
  background: #b45309;
  color: #fff;
}

.inline-presentation-name-wrap {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.inline-presentation-filename {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
}

.inline-presentation-subtitle {
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--color-text-muted);
}

.inline-presentation-body {
  padding: 12px;
  background: var(--color-bg-primary);
}

.inline-presentation-body img {
  display: block;
  width: 100%;
  max-height: 480px;
  object-fit: contain;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: #fff;
}

.inline-presentation-body pre {
  margin: 0;
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
  color: var(--color-text-secondary);
}

/* Inline document preview (PDF / DOCX / Markdown / Text) */
.inline-document-preview {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  background: var(--color-bg-secondary);
}


.inline-document-loading,
.inline-document-error {
  padding: 16px;
  font-size: 12px;
  color: var(--color-text-muted);
}

.inline-document-error {
  color: var(--color-error);
}

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

.inline-document-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.inline-document-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: #fff;
}

.inline-document-icon-pdf {
  background: #c62828;
}

.inline-document-icon-docx {
  background: #1565c0;
}

.inline-document-icon-markdown,
.inline-document-icon-latex,
.inline-document-icon-text,
.inline-document-icon-code {
  background: #546e7a;
}

.latex-artifact-workbench {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--color-bg-secondary);
}

.latex-artifact-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
}

.latex-artifact-title-block {
  min-width: 0;
}

.latex-artifact-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.latex-artifact-subtitle {
  margin-top: 2px;
  font-size: 11px;
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.latex-artifact-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.latex-artifact-action {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 5px 8px;
  background: var(--color-bg-primary);
  color: var(--color-text);
  font-size: 12px;
  cursor: pointer;
}

.latex-artifact-action.secondary {
  color: var(--color-text-secondary);
}

.latex-artifact-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 8px 0;
  background: var(--color-bg-primary);
  border-bottom: 1px solid var(--color-border);
}

.latex-artifact-tab {
  border: 0;
  border-radius: 6px 6px 0 0;
  padding: 7px 10px;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 12px;
  cursor: pointer;
}

.latex-artifact-tab.active {
  background: var(--color-bg-secondary);
  color: var(--color-text);
  font-weight: 600;
}

.latex-artifact-summary {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.latex-artifact-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--color-text-secondary);
}

.latex-artifact-summary-row button {
  border: 0;
  padding: 0;
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: transparent;
  color: var(--color-accent);
  cursor: pointer;
}

.latex-artifact-summary-row strong {
  color: var(--color-text);
}

.latex-artifact-source,
.latex-artifact-pdf {
  padding: 12px;
  background: var(--color-bg-primary);
}

.latex-artifact-source-code {
  margin: 0;
  max-height: 360px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
  color: var(--color-text-secondary);
  white-space: pre;
}

.latex-artifact-loading,
.latex-artifact-error {
  padding: 10px 0;
  font-size: 12px;
  color: var(--color-text-muted);
}

.latex-artifact-error {
  color: var(--color-error);
}

.latex-artifact-pdf {
  max-height: 560px;
  overflow: auto;
}

.latex-artifact-pdf-toolbar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: -12px -12px 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-secondary);
  color: var(--color-text-secondary);
  font-size: 12px;
}

.latex-artifact-pdf-toolbar button {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 4px 8px;
  background: var(--color-bg-primary);
  color: var(--color-text);
  font-size: 12px;
  cursor: pointer;
}

.latex-artifact-pdf-toolbar button:disabled {
  cursor: default;
  opacity: 0.45;
}

.latex-artifact-pdf-toolbar strong {
  font-weight: 600;
  color: var(--color-text-muted);
}

.latex-artifact-pdf .pdf-document-surface {
  align-items: flex-start;
  transform: scale(0.72);
  transform-origin: top left;
  width: 138%;
}

.inline-document-name-wrap {
  min-width: 0;
}

.inline-document-filename {
  font-size: 13px;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inline-document-subtitle {
  margin-top: 1px;
  font-size: 11px;
  color: var(--color-text-muted);
}

.inline-document-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.inline-document-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
}

.inline-document-action-btn:hover {
  background: var(--color-bg-tertiary);
  color: var(--color-text);
}

.inline-document-thumbnail-button {
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

.inline-document-thumbnail-wrap {
  padding: 12px;
  background: var(--color-bg-primary);
  border-top: 1px solid var(--color-border);
}

.inline-document-thumbnail-image {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

.inline-document-content {
  margin: 0;
  padding: 12px;
  max-height: 320px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
  color: var(--color-text-secondary);
  background: var(--color-bg-primary);
  white-space: pre-wrap;
  word-break: break-word;
}

.inline-document-markdown {
  padding: 12px;
  width: 100%;
  max-height: 320px;
  overflow: auto;
  min-width: 0;
  box-sizing: border-box;
  background: var(--color-bg-primary);
}

.inline-document-markdown> :first-child {
  margin-top: 0;
}

.inline-document-markdown> :last-child {
  margin-bottom: 0;
}

.inline-document-truncated {
  padding: 6px 12px;
  font-size: 11px;
  color: var(--color-text-muted);
  text-align: center;
  border-top: 1px solid var(--color-border);
}

.markdown-content {
  min-width: 0;
}

/* Markdown content styling */
.markdown-content h1 {
  font-size: 1.5em;
  font-weight: 600;
  margin: 16px 0 8px 0;
  color: var(--color-text);
}

.markdown-content h2 {
  font-size: 1.3em;
  font-weight: 600;
  margin: 14px 0 8px 0;
  color: var(--color-text);
}

.markdown-content h3 {
  font-size: 1.1em;
  font-weight: 600;
  margin: 12px 0 6px 0;
  color: var(--color-text);
}

.markdown-heading-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  transform: translateY(1px);
}

.inline-emoji-icon {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin: 0 2px;
  line-height: 1;
}

.inline-emoji-icon svg {
  display: block;
}

.markdown-content p {
  margin: 8px 0;
}

.markdown-content strong {
  font-weight: 600;
  color: var(--color-text);
}

.markdown-content em {
  font-style: italic;
}

.markdown-content ul,
.markdown-content ol {
  margin: 8px 0;
  padding-left: 24px;
}

.markdown-content li {
  margin: 4px 0;
}

.markdown-content code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-bg-secondary);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--color-accent);
}

.markdown-content pre {
  background: #1e1e2e;
  border-radius: var(--radius-md);
  padding: 12px;
  margin: 8px 0;
  overflow-x: auto;
}

.markdown-content pre code {
  background: none;
  padding: 0;
  color: #cdd6f4;
}

.theme-light .markdown-content pre {
  background: #f5f5f7;
}

.theme-light .markdown-content pre code {
  color: #383a42;
}

.assistant-command-excerpt {
  width: 100%;
  max-width: 100%;
  margin: 8px 0;
  overflow: hidden;
  border: 1px solid var(--color-border-subtle);
  border-radius: 8px;
  background: var(--color-bg-secondary);
  box-sizing: border-box;
}

.assistant-command-excerpt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--color-border-subtle);
  color: var(--color-text-secondary);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
}

.assistant-command-excerpt-hint {
  flex-shrink: 0;
  color: var(--color-text-muted);
  font-weight: 500;
}

.assistant-command-excerpt-scroll {
  max-height: 180px;
  overflow: auto;
  scrollbar-gutter: stable;
}

.assistant-command-excerpt pre,
.markdown-content .assistant-command-excerpt pre {
  margin: 0;
  padding: 10px;
  background: transparent;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.assistant-command-excerpt code,
.markdown-content .assistant-command-excerpt code {
  display: block;
  padding: 0;
  background: transparent;
  border-radius: 0;
  color: var(--color-text-secondary);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.45;
}

.event-details-command-error {
  padding: 0;
  background: transparent;
  border: none;
  font-family: var(--font-ui);
}

/* Mermaid diagram rendering */
.mermaid-diagram {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 16px 12px;
  background: #1e1e2e;
  border-radius: var(--radius-md);
  margin: 8px 0;
  overflow-x: auto;
}

.mermaid-diagram svg,
.mermaid-diagram img,
.mermaid-diagram-image {
  max-width: 100%;
  height: auto;
}

/* Ensure text/labels in Mermaid SVGs are visible (fallback for theme quirks) */
.mermaid-diagram svg text,
.mermaid-diagram svg .nodeLabel,
.mermaid-diagram svg .edgeLabel,
.mermaid-diagram svg .label {
  fill: #e8e8e8 !important;
}

.theme-light .mermaid-diagram {
  background: #f5f5f7;
}

.theme-light .mermaid-diagram svg text,
.theme-light .mermaid-diagram svg .nodeLabel,
.theme-light .mermaid-diagram svg .edgeLabel,
.theme-light .mermaid-diagram svg .label {
  fill: #333333 !important;
}

.mermaid-loading {
  color: var(--color-text-secondary, #888);
  font-size: 0.85em;
  font-style: italic;
  padding: 12px;
}

.mermaid-error {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: #f87171;
  font-size: 0.85em;
  margin: 8px 0;
}

.diagram-event-details {
  padding: 4px 0;
}

/* Code block with copy button */
.code-block-wrapper {
  position: relative;
  margin: 8px 0;
  background: #1e1e2e;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.code-block-wrapper code {
  display: block;
  padding: 12px;
  white-space: pre;
  max-height: min(380px, 52vh);
  overflow-x: auto;
  overflow-y: auto;
  background: none;
  color: #cdd6f4;
}

.code-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  background: #181825;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* Syntax highlighting tokens (dark - default) */
.code-block-wrapper .hljs {
  color: #cdd6f4;
}

.code-block-wrapper .hljs-keyword,
.code-block-wrapper .hljs-selector-tag,
.code-block-wrapper .hljs-built_in,
.code-block-wrapper .hljs-name {
  color: #cba6f7;
}

.code-block-wrapper .hljs-string,
.code-block-wrapper .hljs-addition {
  color: #a6e3a1;
}

.code-block-wrapper .hljs-number,
.code-block-wrapper .hljs-literal,
.code-block-wrapper .hljs-type {
  color: #fab387;
}

.code-block-wrapper .hljs-comment,
.code-block-wrapper .hljs-quote {
  color: #6c7086;
  font-style: italic;
}

.code-block-wrapper .hljs-attr,
.code-block-wrapper .hljs-attribute {
  color: #89b4fa;
}

.code-block-wrapper .hljs-property {
  color: #89dceb;
}

.code-block-wrapper .hljs-title,
.code-block-wrapper .hljs-title\.function_,
.code-block-wrapper .hljs-section {
  color: #89b4fa;
}

.code-block-wrapper .hljs-variable,
.code-block-wrapper .hljs-template-variable {
  color: #f38ba8;
}

.code-block-wrapper .hljs-params {
  color: #cdd6f4;
}

.code-block-wrapper .hljs-deletion {
  color: #f38ba8;
}

.code-block-wrapper .hljs-regexp,
.code-block-wrapper .hljs-selector-class,
.code-block-wrapper .hljs-selector-id {
  color: #f9e2af;
}

.code-block-wrapper .hljs-meta,
.code-block-wrapper .hljs-meta .hljs-keyword {
  color: #fab387;
}

.code-block-wrapper .hljs-symbol,
.code-block-wrapper .hljs-bullet,
.code-block-wrapper .hljs-link {
  color: #94e2d5;
}

.code-block-wrapper .hljs-punctuation,
.code-block-wrapper .hljs-tag {
  color: #94e2d5;
}

/* Light theme syntax highlighting overrides */
.theme-light .code-block-wrapper {
  background: #f5f5f7;
}

.theme-light .code-block-wrapper code {
  color: #383a42;
}

.theme-light .code-block-header {
  background: #e8e8ec;
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.theme-light .code-block-wrapper .hljs {
  color: #383a42;
}

.theme-light .code-block-wrapper .hljs-keyword,
.theme-light .code-block-wrapper .hljs-selector-tag,
.theme-light .code-block-wrapper .hljs-built_in,
.theme-light .code-block-wrapper .hljs-name {
  color: #a626a4;
}

.theme-light .code-block-wrapper .hljs-string,
.theme-light .code-block-wrapper .hljs-addition {
  color: #50a14f;
}

.theme-light .code-block-wrapper .hljs-number,
.theme-light .code-block-wrapper .hljs-literal,
.theme-light .code-block-wrapper .hljs-type {
  color: #986801;
}

.theme-light .code-block-wrapper .hljs-comment,
.theme-light .code-block-wrapper .hljs-quote {
  color: #a0a1a7;
  font-style: italic;
}

.theme-light .code-block-wrapper .hljs-attr,
.theme-light .code-block-wrapper .hljs-attribute {
  color: #4078f2;
}

.theme-light .code-block-wrapper .hljs-property {
  color: #0184bc;
}

.theme-light .code-block-wrapper .hljs-title,
.theme-light .code-block-wrapper .hljs-title\.function_,
.theme-light .code-block-wrapper .hljs-section {
  color: #4078f2;
}

.theme-light .code-block-wrapper .hljs-variable,
.theme-light .code-block-wrapper .hljs-template-variable {
  color: #e45649;
}

.theme-light .code-block-wrapper .hljs-deletion {
  color: #e45649;
}

.theme-light .code-block-wrapper .hljs-regexp,
.theme-light .code-block-wrapper .hljs-selector-class,
.theme-light .code-block-wrapper .hljs-selector-id {
  color: #986801;
}

.theme-light .code-block-wrapper .hljs-meta,
.theme-light .code-block-wrapper .hljs-meta .hljs-keyword {
  color: #986801;
}

.theme-light .code-block-wrapper .hljs-symbol,
.theme-light .code-block-wrapper .hljs-bullet,
.theme-light .code-block-wrapper .hljs-link {
  color: #0184bc;
}

.theme-light .code-block-wrapper .hljs-punctuation,
.theme-light .code-block-wrapper .hljs-tag {
  color: #0184bc;
}

.code-block-language {
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.code-block-copy {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.45);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.code-block-copy:hover {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.code-block-copy.copied {
  color: var(--color-success);
  border-color: var(--color-success);
}

/* Light theme code block header overrides */
.theme-light .code-block-language {
  color: rgba(0, 0, 0, 0.45);
}

.theme-light .code-block-copy {
  color: rgba(0, 0, 0, 0.45);
  border-color: rgba(0, 0, 0, 0.12);
}

.theme-light .code-block-copy:hover {
  color: rgba(0, 0, 0, 0.8);
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.2);
}

.code-block-copy svg {
  flex-shrink: 0;
}

.markdown-content blockquote {
  border-left: 3px solid var(--color-accent);
  margin: 8px 0;
  padding-left: 12px;
  color: var(--color-text-secondary);
}

.markdown-content a {
  color: var(--color-accent);
  text-decoration: none;
  word-break: normal;
  overflow-wrap: break-word;
}

.markdown-content a:hover {
  text-decoration: underline;
}

.markdown-content a.x-social-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  vertical-align: -2px;
  word-break: normal;
  overflow-wrap: anywhere;
}

.markdown-content a.x-social-link:hover {
  text-decoration: none;
}

.x-social-link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  border-radius: 4px;
  background: #050505;
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.x-social-link-label {
  min-width: 0;
}

.markdown-content a.x-social-link:hover .x-social-link-label {
  text-decoration: underline;
}

.markdown-content hr {
  border: none;
  border-top: 1px solid var(--color-border-subtle);
  margin: 16px 0;
}

/* Markdown tables */
.markdown-table-wrapper {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.markdown-table-wrapper>table {
  min-width: 100%;
  width: max-content;
}

.markdown-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13px;
}

.markdown-content .markdown-table-wrapper > table {
  width: max-content;
}

.markdown-content thead {
  background: var(--color-bg-secondary);
}

.markdown-content th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--color-text);
  border-bottom: 2px solid var(--color-border);
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
}

.markdown-content td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border-subtle);
  color: var(--color-text-secondary);
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
}

.markdown-content tr:hover {
  background: var(--color-bg-hover);
}

.markdown-content tbody tr:last-child td {
  border-bottom: none;
}

/* Scrollable event details for large outputs */
.event-details-scrollable {
  max-height: 300px;
  overflow-y: auto;
  overflow-x: hidden;
}

.event-details-scrollable pre {
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  word-break: break-all;
}

/* Code preview in file events */
.event-details-code-preview {
  padding: 0;
  overflow: hidden;
  background: #1e1e2e;
  border-radius: var(--radius-md);
}

.code-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  background: #181825;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11px;
}

.code-preview-language {
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
  font-weight: 500;
  letter-spacing: 0.5px;
  font-size: 10px;
}

.code-preview-path {
  color: #cdd6f4;
  font-family: var(--font-mono);
}

.code-preview-truncated {
  color: rgba(255, 255, 255, 0.45);
  font-size: 10px;
  font-style: italic;
  padding: 4px 12px 6px;
}

.code-preview-content {
  margin: 0;
  padding: 10px 12px;
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: #cdd6f4;
  max-height: 400px;
  overflow-y: auto;
  background: transparent;
}

.code-preview-content code {
  font-family: var(--font-mono);
  font-size: 11px;
  background: transparent;
}

.code-preview-content code.hljs {
  color: #cdd6f4;
}

/* Reuse the same syntax token colors for code previews */
.code-preview-content .hljs-keyword,
.code-preview-content .hljs-selector-tag,
.code-preview-content .hljs-built_in,
.code-preview-content .hljs-name {
  color: #cba6f7;
}

.code-preview-content .hljs-string,
.code-preview-content .hljs-addition {
  color: #a6e3a1;
}

.code-preview-content .hljs-number,
.code-preview-content .hljs-literal,
.code-preview-content .hljs-type {
  color: #fab387;
}

.code-preview-content .hljs-comment,
.code-preview-content .hljs-quote {
  color: #6c7086;
  font-style: italic;
}

.code-preview-content .hljs-attr,
.code-preview-content .hljs-attribute {
  color: #89b4fa;
}

.code-preview-content .hljs-property {
  color: #89dceb;
}

.code-preview-content .hljs-title,
.code-preview-content .hljs-section {
  color: #89b4fa;
}

.code-preview-content .hljs-variable,
.code-preview-content .hljs-template-variable {
  color: #f38ba8;
}

.code-preview-content .hljs-deletion {
  color: #f38ba8;
}

.code-preview-content .hljs-regexp,
.code-preview-content .hljs-selector-class,
.code-preview-content .hljs-selector-id {
  color: #f9e2af;
}

.code-preview-content .hljs-meta,
.code-preview-content .hljs-meta .hljs-keyword {
  color: #fab387;
}

.code-preview-content .hljs-symbol,
.code-preview-content .hljs-bullet,
.code-preview-content .hljs-link {
  color: #94e2d5;
}

.code-preview-content .hljs-punctuation,
.code-preview-content .hljs-tag {
  color: #94e2d5;
}

.code-preview-content .hljs-params {
  color: #cdd6f4;
}

.jsonl-preview {
  max-height: 420px;
  overflow: auto;
  background: #202033;
}

.jsonl-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.jsonl-preview-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: #cdd6f4;
  font-size: 12px;
  font-weight: 600;
}

.jsonl-preview-kicker,
.jsonl-preview-note {
  color: rgba(205, 214, 244, 0.56);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.jsonl-preview-note {
  flex-shrink: 0;
  font-style: normal;
}

.jsonl-preview-rows {
  display: grid;
}

.jsonl-preview-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
}

.jsonl-preview-row:last-child {
  border-bottom: 0;
}

.jsonl-preview-line {
  padding: 11px 10px;
  color: rgba(205, 214, 244, 0.38);
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: right;
  background: rgba(0, 0, 0, 0.12);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.jsonl-preview-row-body {
  min-width: 0;
  padding: 9px 12px 10px;
}

.jsonl-preview-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 20px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.jsonl-preview-level {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(137, 180, 250, 0.14);
  color: #89b4fa;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.jsonl-preview-level[data-tone="error"] {
  background: rgba(243, 139, 168, 0.15);
  color: #f38ba8;
}

.jsonl-preview-level[data-tone="warning"] {
  background: rgba(250, 179, 135, 0.16);
  color: #fab387;
}

.jsonl-preview-level[data-tone="muted"] {
  background: rgba(205, 214, 244, 0.1);
  color: rgba(205, 214, 244, 0.64);
}

.jsonl-preview-time,
.jsonl-preview-component {
  min-width: 0;
  color: rgba(205, 214, 244, 0.52);
  font-size: 11px;
  line-height: 1.3;
}

.jsonl-preview-component {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.jsonl-preview-message {
  color: #cdd6f4;
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.jsonl-preview-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.jsonl-preview-field {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
  max-width: 100%;
  padding: 4px 7px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.035);
  color: rgba(205, 214, 244, 0.52);
  font-size: 11px;
}

.jsonl-preview-field strong {
  min-width: 0;
  color: rgba(205, 214, 244, 0.82);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.jsonl-preview-field-more {
  color: rgba(205, 214, 244, 0.52);
}

/* Light theme code preview overrides */
.theme-light .event-details-code-preview {
  background: #f5f5f7;
}

.theme-light .code-preview-header {
  background: #e8e8ec;
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.theme-light .code-preview-language {
  color: rgba(0, 0, 0, 0.45);
}

.theme-light .code-preview-truncated {
  color: rgba(0, 0, 0, 0.45);
}

.theme-light .code-preview-content {
  color: #383a42;
}

.theme-light .code-preview-content code.hljs {
  color: #383a42;
}

.theme-light .code-preview-content .hljs-keyword,
.theme-light .code-preview-content .hljs-selector-tag,
.theme-light .code-preview-content .hljs-built_in,
.theme-light .code-preview-content .hljs-name {
  color: #a626a4;
}

.theme-light .code-preview-content .hljs-string,
.theme-light .code-preview-content .hljs-addition {
  color: #50a14f;
}

.theme-light .code-preview-content .hljs-number,
.theme-light .code-preview-content .hljs-literal,
.theme-light .code-preview-content .hljs-type {
  color: #986801;
}

.theme-light .code-preview-content .hljs-comment,
.theme-light .code-preview-content .hljs-quote {
  color: #a0a1a7;
  font-style: italic;
}

.theme-light .code-preview-content .hljs-attr,
.theme-light .code-preview-content .hljs-attribute {
  color: #4078f2;
}

.theme-light .code-preview-content .hljs-property {
  color: #0184bc;
}

.theme-light .code-preview-content .hljs-title,
.theme-light .code-preview-content .hljs-section {
  color: #4078f2;
}

.theme-light .code-preview-content .hljs-variable,
.theme-light .code-preview-content .hljs-template-variable {
  color: #e45649;
}

.theme-light .code-preview-content .hljs-deletion {
  color: #e45649;
}

.theme-light .code-preview-content .hljs-regexp,
.theme-light .code-preview-content .hljs-selector-class,
.theme-light .code-preview-content .hljs-selector-id {
  color: #986801;
}

.theme-light .code-preview-content .hljs-meta,
.theme-light .code-preview-content .hljs-meta .hljs-keyword {
  color: #986801;
}

.theme-light .code-preview-content .hljs-symbol,
.theme-light .code-preview-content .hljs-bullet,
.theme-light .code-preview-content .hljs-link {
  color: #0184bc;
}

.theme-light .code-preview-content .hljs-punctuation,
.theme-light .code-preview-content .hljs-tag {
  color: #0184bc;
}

.theme-light .jsonl-preview {
  background: #f7f7f9;
}

.theme-light .jsonl-preview-header {
  border-bottom-color: rgba(0, 0, 0, 0.07);
}

.theme-light .jsonl-preview-title {
  color: #24262f;
}

.theme-light .jsonl-preview-kicker,
.theme-light .jsonl-preview-note {
  color: rgba(36, 38, 47, 0.48);
}

.theme-light .jsonl-preview-row {
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

.theme-light .jsonl-preview-line {
  color: rgba(36, 38, 47, 0.38);
  background: rgba(0, 0, 0, 0.025);
  border-right-color: rgba(0, 0, 0, 0.055);
}

.theme-light .jsonl-preview-level {
  background: rgba(64, 120, 242, 0.11);
  color: #315fbc;
}

.theme-light .jsonl-preview-level[data-tone="error"] {
  background: rgba(228, 86, 73, 0.12);
  color: #b23a31;
}

.theme-light .jsonl-preview-level[data-tone="warning"] {
  background: rgba(152, 104, 1, 0.12);
  color: #7a5200;
}

.theme-light .jsonl-preview-level[data-tone="muted"] {
  background: rgba(36, 38, 47, 0.07);
  color: rgba(36, 38, 47, 0.58);
}

.theme-light .jsonl-preview-time,
.theme-light .jsonl-preview-component {
  color: rgba(36, 38, 47, 0.52);
}

.theme-light .jsonl-preview-message {
  color: #24262f;
}

.theme-light .jsonl-preview-field {
  border-color: rgba(0, 0, 0, 0.07);
  background: rgba(255, 255, 255, 0.7);
  color: rgba(36, 38, 47, 0.52);
}

.theme-light .jsonl-preview-field strong {
  color: rgba(36, 38, 47, 0.82);
}

/* Diff-style edit preview */
.edit-diff-preview {
  padding: 8px 12px;
}

.diff-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 2px 4px;
  border-radius: 3px;
  margin-bottom: 2px;
}

.diff-line pre {
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  flex: 1;
}

.diff-line code {
  font-family: var(--font-mono);
  font-size: 11px;
}

.diff-removed {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
}

.diff-added {
  background: rgba(52, 211, 153, 0.1);
  color: #34d399;
}

.diff-marker {
  font-weight: bold;
  font-family: var(--font-mono);
  flex-shrink: 0;
  width: 14px;
  text-align: center;
  user-select: none;
}

/* Event title metadata (line count, size) */
.event-title-meta {
  color: var(--color-text-muted, #888);
  font-size: 0.9em;
  margin-left: 4px;
}

/* File References */
.file-list {
  margin-top: 16px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-pink);
  border: 1px solid var(--color-border-subtle);
}

.file-item-number {
  color: var(--color-text-muted);
  font-size: 11px;
  min-width: 20px;
}

/* Main Footer / Input Area */
.main-footer {
  padding: 16px 24px;
  position: relative;
}

.main-footer::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  height: 48px;
  background: linear-gradient(to bottom, transparent, var(--color-bg-primary));
  pointer-events: none;
  z-index: 2;
}

.input-container {
  max-width: 800px;
  margin: 0 auto;
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  transition:
    border-color 0.25s ease,
    box-shadow 0.25s ease;
}

.input-container:focus-within {
  border-color: var(--color-accent);
  box-shadow:
    0 0 0 3px var(--color-accent-subtle),
    0 2px 12px rgba(0, 0, 0, 0.1);
}

.input-container.drag-over {
  outline: 1px dashed var(--color-border);
  background: var(--color-bg-hover);
}

.input-row {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  gap: 12px;
}

/* Plain text below message box: workspace path + mode */
.input-status-text {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 800px;
  margin: 8px auto 0;
  padding: 0 4px;
  gap: 12px;
}

.input-status-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.input-status-workspace {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.15s ease;
}

.input-status-workspace:hover {
  color: var(--color-text);
}

.input-status-shell {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.15s ease;
}

.input-status-shell:hover {
  color: var(--color-text);
}

.input-status-shell svg {
  display: none;
}

.input-status-shell.enabled {
  color: var(--color-text);
}

.input-status-shell .goal-mode-switch-track {
  width: 20px;
  height: 12px;
}

.input-status-shell .goal-mode-switch-thumb {
  width: 8px;
  height: 8px;
  top: 1px;
  left: 1px;
}

.input-status-shell .goal-mode-switch-track.on .goal-mode-switch-thumb {
  left: 9px;
}

.input-status-workspace-path {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.input-status-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.input-status-mode-wrap,
.input-status-domain-wrap {
  position: relative;
}

.input-status-mode {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.15s ease;
}

.input-status-mode:hover {
  color: var(--color-text);
}

.input-status-mode-dropdown {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  min-width: 120px;
  padding: 4px;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 100;
}

.input-status-mode-option {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: 12px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.input-status-mode-option:hover,
.input-status-mode-option:focus-visible {
  background: var(--color-bg-hover);
  color: var(--color-text);
  outline: none;
}

.input-status-mode-option.active {
  color: var(--color-accent);
}

.input-status-domain {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.15s ease;
}

.input-status-domain:hover {
  color: var(--color-text);
}

.input-status-domain-dropdown {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  min-width: 120px;
  padding: 4px;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 100;
}

.input-status-domain-option {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: 12px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.input-status-domain-option:hover,
.input-status-domain-option:focus-visible {
  background: var(--color-bg-hover);
  color: var(--color-text);
  outline: none;
}

.input-status-domain-option.active {
  color: var(--color-accent);
}

.input-status-skills {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.15s ease;
}

.input-status-skills:hover {
  color: var(--color-text);
}

.input-status-skills.active {
  color: var(--color-accent);
}

/* Welcome input toolbar - below message box */
.welcome-input-status {
  margin-top: 8px;
  padding-top: 0;
}

.input-field {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--color-text);
  font-size: 14px;
  outline: none;
}

.input-container .input-field,
.input-container .input-textarea {
  background: transparent;
}

.welcome-input-container .welcome-input,
.welcome-input-container .input-textarea,
.cli-input-container .cli-input,
.cli-input-container .input-textarea {
  background: transparent;
}

.input-field::placeholder {
  color: var(--color-text-muted);
}

/* Auto-expanding textarea styles */
.input-textarea {
  resize: none;
  min-height: 24px;
  max-height: 200px;
  overflow-y: auto;
  line-height: 1.5;
  padding: 8px 0;
  font-family: inherit;
  align-self: center;
  will-change: height;
}

.prompt-composer-input {
  width: 100%;
  min-width: 0;
  border: none;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
}

.prompt-composer-input:empty::before {
  content: attr(data-placeholder);
  color: var(--color-text-muted);
  pointer-events: none;
}

.integration-mention-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 180px;
  margin: 0 2px;
  padding: 1px 6px 1px 3px;
  border: 1px solid color-mix(in srgb, var(--color-accent, #6366f1) 22%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--color-accent, #6366f1) 10%, var(--color-bg-elevated));
  color: var(--color-accent, #6366f1);
  line-height: 1.35;
  vertical-align: baseline;
  user-select: none;
  white-space: nowrap;
}

.integration-mention-chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.composer-link-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: min(260px, 100%);
  margin: 0 2px;
  padding: 1px 7px 1px 4px;
  border-radius: 8px;
  color: var(--color-accent, #2563eb);
  line-height: 1.35;
  vertical-align: baseline;
  user-select: none;
  white-space: nowrap;
}

.composer-link-favicon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  border-radius: 4px;
}

.composer-link-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.integration-mention-message-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.integration-mention-message-chip {
  max-width: min(180px, 100%);
  user-select: text;
  transform: translateY(-1px);
}

.integration-mention-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(15, 23, 42, 0.08);
  font-weight: 700;
  line-height: 1;
}

.integration-mention-icon-svg {
  width: 72%;
  height: 72%;
  display: block;
  overflow: visible;
}

.integration-mention-icon-xs {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  font-size: 9px;
}

.integration-mention-icon-sm {
  width: 22px;
  height: 22px;
  border-radius: 8px;
  font-size: 11px;
}

.input-textarea::-webkit-scrollbar {
  width: 6px;
}

.input-textarea::-webkit-scrollbar-track {
  background: transparent;
}

.input-textarea::-webkit-scrollbar-thumb {
  background: var(--color-border-subtle);
  border-radius: 3px;
}

.input-textarea::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

.input-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.attachment-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.attachment-btn svg {
  stroke: currentColor;
  flex-shrink: 0;
}

.attachment-btn-left {
  flex: 0 0 auto;
  margin-right: 2px;
}

.attachment-btn:hover {
  background: var(--color-bg-hover);
  color: var(--color-text);
}

.attachment-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.input-add-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.input-add-btn:hover {
  border-color: var(--color-text-muted);
  color: var(--color-text);
}

.attachment-panel {
  width: 100%;
  max-width: 800px;
  margin: 0 auto 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.attachment-error {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: var(--color-text);
  font-size: 12px;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.attachment-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: 12px;
  max-width: 260px;
}

.attachment-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.attachment-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}

.attachment-size {
  color: var(--color-text-muted);
  font-size: 11px;
}

.attachment-remove {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.attachment-remove:hover {
  color: var(--color-text);
}

.attachment-remove:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.model-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border-subtle);
  color: var(--color-text-secondary);
  font-size: 12px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.model-selector:hover {
  background: var(--color-bg-hover);
  color: var(--color-text);
}

.model-selector .chevron-up {
  transform: rotate(180deg);
}

.model-selector-icon,
.model-dropdown-chevron {
  flex-shrink: 0;
}

.model-selector-effort {
  color: var(--color-text-muted);
  font-size: 11px;
  padding-left: 2px;
}

/* Voice Input Button */
.voice-input-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  overflow: hidden;
}

.voice-input-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.voice-input-btn:hover:not(:disabled) {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: var(--color-accent-subtle);
}

.voice-input-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.voice-input-btn.recording {
  border-color: var(--color-error);
  color: var(--color-error);
  background: var(--color-error-subtle);
  animation: voice-pulse 1.5s ease-in-out infinite;
}

.voice-input-btn.processing {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: var(--color-accent-subtle);
}

.voice-recording-indicator {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--color-error);
  transition: width 0.1s ease;
}

.voice-processing-spin {
  animation: spin 1s linear infinite;
}

@keyframes voice-pulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.4);
  }

  50% {
    box-shadow: 0 0 0 8px rgba(248, 113, 113, 0);
  }
}

/* Talk Mode Button */
.talk-mode-btn.active {
  border-color: var(--color-success, #22c55e);
  color: var(--color-success, #22c55e);
  background: rgba(34, 197, 94, 0.1);
}

.talk-mode-btn.active.listening {
  border-color: var(--color-success, #22c55e);
  color: var(--color-success, #22c55e);
  animation: talk-mode-pulse 1.5s ease-in-out infinite;
}

.talk-mode-btn.active.speaking {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: var(--color-accent-subtle);
  animation: talk-mode-pulse-accent 2s ease-in-out infinite;
}

.talk-mode-btn.active.processing {
  border-color: var(--color-warning, #eab308);
  color: var(--color-warning, #eab308);
  background: rgba(234, 179, 8, 0.1);
}

@keyframes talk-mode-pulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
  }

  50% {
    box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);
  }
}

@keyframes talk-mode-pulse-accent {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.3);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(99, 102, 241, 0);
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* Voice Not Configured Banner */
.voice-not-configured-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 10px;
  background: var(--color-warning-subtle, rgba(250, 204, 21, 0.1));
  border: 1px solid var(--color-warning, #facc15);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: 13px;
}

.voice-not-configured-banner svg {
  flex-shrink: 0;
  color: var(--color-warning, #facc15);
}

.voice-not-configured-banner span {
  flex: 1;
}

.voice-settings-link {
  background: var(--color-accent);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
  white-space: nowrap;
}

.voice-settings-link:hover {
  background: var(--color-accent-hover);
}

.voice-banner-close {
  background: transparent;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.voice-banner-close:hover {
  background: var(--color-bg-hover);
  color: var(--color-text);
}

/* Light theme overrides for voice banner */
.theme-light .voice-not-configured-banner {
  background: rgba(250, 204, 21, 0.15);
  border-color: #d97706;
}

.theme-light .voice-not-configured-banner svg {
  color: #d97706;
}

/* Welcome screen voice button */
.welcome-voice-btn {
  margin-left: 8px;
  flex-shrink: 0;
}

.cli-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.model-dropdown-container {
  position: relative;
}

.model-dropdown-container.align-right {
  display: inline-flex;
}

.model-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: min(340px, calc(100vw - 28px));
  min-width: min(300px, calc(100vw - 28px));
  max-height: min(520px, calc(100dvh - 220px));
  z-index: 1000;
  animation: dropdownFadeIn 0.15s ease;
  overflow: visible;
}

.model-dropdown-panel {
  max-height: inherit;
  display: flex;
  flex-direction: column;
  background: var(--color-bg-elevated);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  overflow: hidden;
}

.model-dropdown-section {
  padding-bottom: 4px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--color-border-subtle);
}

.model-dropdown-section-label {
  padding: 5px 10px 3px;
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 500;
}

.model-dropdown-provider-label {
  margin-top: -2px;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.model-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 8px 11px;
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  font-size: 13px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  text-align: left;
}

.model-dropdown-item.compact {
  padding: 6px 10px;
}

.model-dropdown-item:hover {
  background: var(--color-bg-hover);
}

.model-dropdown-item:hover .model-dropdown-item-name {
  color: var(--color-text);
}

.model-dropdown-item.selected {
  background: var(--color-accent-subtle);
}

.model-dropdown-item.selected .model-dropdown-item-name {
  color: var(--color-accent);
}

.model-dropdown-item.selected:hover {
  background: var(--color-accent-subtle);
}

.model-dropdown-item svg {
  color: var(--color-accent);
  flex-shrink: 0;
}

.model-dropdown-item-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.model-dropdown-item-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
}

.model-dropdown-item-desc {
  font-size: 11px;
  color: var(--color-text-muted);
}

.model-dropdown-item.highlighted {
  background: var(--color-bg-hover);
}

.model-dropdown-item.highlighted .model-dropdown-item-name {
  color: var(--color-text);
}

.model-dropdown-item.selected.highlighted {
  background: var(--color-accent-subtle);
}

.model-dropdown-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  margin: -6px -6px 4px -6px;
}

.visual-oblivion .model-dropdown-search {
  background: var(--color-bg-primary);
  border-bottom-color: var(--color-border);
}

.model-dropdown-search svg {
  flex-shrink: 0;
  opacity: 0.5;
}

.model-dropdown-search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--color-text);
  font-size: 13px;
}

.model-dropdown-search input::placeholder {
  color: var(--color-text-muted);
}

.model-dropdown-list {
  max-height: clamp(112px, 18dvh, 150px);
  flex: 0 1 auto;
  overflow-y: auto;
}

.model-dropdown-other-providers {
  position: relative;
  overflow: visible;
}

.model-dropdown-provider-list {
  max-height: clamp(112px, 20dvh, 155px);
  flex: 0 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
}

.model-dropdown-provider-row {
  position: relative;
}

.model-dropdown-submenu {
  position: absolute;
  left: calc(100% + 8px);
  top: auto;
  bottom: 0;
  width: 320px;
  max-height: min(340px, calc(100dvh - 160px));
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-elevated);
  box-shadow: var(--shadow-lg);
  z-index: 1001;
}

.model-dropdown.align-right .model-dropdown-submenu {
  left: auto;
  right: calc(100% + 8px);
}

.model-dropdown-footer {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--color-border-subtle);
}

.model-dropdown-provider-btn {
  width: 100%;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-subtle);
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.model-dropdown-provider-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-text);
  background: var(--color-bg-hover);
}

.model-dropdown-no-results {
  padding: 16px 12px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 13px;
}

@media (max-height: 760px) {
  .model-dropdown {
    max-height: min(460px, calc(100dvh - 180px));
  }

  .model-dropdown-list,
  .model-dropdown-provider-list {
    max-height: 122px;
  }

  .model-dropdown-submenu {
    max-height: min(300px, calc(100dvh - 140px));
  }

  .model-dropdown-item-desc {
    display: none;
  }
}

.model-selector.open {
  background: var(--color-bg-hover);
  border-color: var(--color-accent);
  color: var(--color-text);
}

.send-btn {
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, var(--color-accent-hover) 0%, var(--color-accent) 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #1a1a1a;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
  box-shadow:
    var(--shadow-sm),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
}

.send-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 100%);
  pointer-events: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.send-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, var(--color-accent-hover) 0%, var(--color-accent) 100%);
  transform: translateY(-1px);
  box-shadow:
    var(--shadow-md),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.send-btn:active:not(:disabled) {
  transform: translateY(0);
}

.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.send-btn svg {
  stroke: #1a1a1a;
  flex-shrink: 0;
}

.send-btn span {
  color: #1a1a1a;
  font-weight: 600;
}

/* Queue state - wider button with text */
.send-btn-queue {
  min-width: 80px;
  padding: 0 16px;
}

/* Stop button - rounded square style */
.stop-btn-spinner {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(220, 53, 69, 0.3);
  background: rgba(220, 53, 69, 0.08);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.stop-btn-spinner:hover {
  background: rgba(220, 53, 69, 0.15);
  border-color: rgba(220, 53, 69, 0.5);
  transform: scale(1.05);
}

.stop-btn-spinner:active {
  transform: scale(0.95);
}

.stop-btn-spinner .stop-icon {
  width: 18px;
  height: 18px;
  color: #dc3545;
  z-index: 1;
}

.stop-btn-spinner .stop-icon rect {
  rx: 3;
  ry: 3;
}

.stop-btn-spinner:hover .stop-icon {
  color: #c82333;
}

/* Simple stop button in input area with spinner */
.stop-btn-simple {
  position: relative;
  padding: 6px 8px;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(220, 53, 69, 0.15);
  color: #dc3545;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.stop-btn-simple::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 3px solid rgba(220, 53, 69, 0.3);
}

.stop-btn-simple::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: #dc3545;
  border-right-color: #dc3545;
  animation: spin 0.8s linear infinite;
  filter: drop-shadow(0 0 2px rgba(220, 53, 69, 0.5));
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.stop-btn-simple:hover {
  background: rgba(220, 53, 69, 0.25);
}

.stop-btn-simple:hover::after {
  filter: drop-shadow(0 0 4px rgba(220, 53, 69, 0.7));
}

.stop-btn-simple:active {
  transform: scale(0.95);
}

.stop-btn-simple svg {
  stroke: #dc3545;
  z-index: 1;
}

/* Wrap-up + stop button container */
.task-control-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Wrap-up button — amber themed, sits next to stop button */
.wrap-up-btn {
  position: relative;
  padding: 6px 8px;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.wrap-up-btn::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 3px solid rgba(245, 158, 11, 0.3);
}

.wrap-up-btn::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: #f59e0b;
  border-right-color: #f59e0b;
  animation: spin 0.8s linear infinite;
  filter: drop-shadow(0 0 2px rgba(245, 158, 11, 0.5));
}

.wrap-up-btn:hover {
  background: rgba(245, 158, 11, 0.25);
}

.wrap-up-btn:hover::after {
  filter: drop-shadow(0 0 4px rgba(245, 158, 11, 0.7));
}

.wrap-up-btn:active {
  transform: scale(0.95);
}

.wrap-up-btn svg {
  stroke: #f59e0b;
  fill: none;
  z-index: 1;
}

/* Collaborative wrap-up inline button */
.collab-wrap-up-btn {
  margin-left: 8px;
  padding: 2px 10px;
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.collab-wrap-up-btn:hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.6);
}

/* Wrap-up active states — after clicking */
.wrap-up-btn.wrap-up-active {
  background: rgba(34, 197, 94, 0.15);
  cursor: default;
}

.wrap-up-btn.wrap-up-active::before {
  border-color: rgba(34, 197, 94, 0.3);
}

.wrap-up-btn.wrap-up-active::after {
  border-top-color: #22c55e;
  border-right-color: #22c55e;
  filter: drop-shadow(0 0 2px rgba(34, 197, 94, 0.5));
}

.wrap-up-btn.wrap-up-active svg {
  stroke: #22c55e;
}

.collab-wrap-up-btn.collab-wrap-up-active {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.4);
  color: #22c55e;
  cursor: default;
}

/* Disclaimer moved outside input container */
.input-disclaimer {
  text-align: center;
  padding: 10px 16px 0;
  font-size: 10px;
  color: var(--color-text-muted);
  opacity: 0.7;
  max-width: 800px;
  margin: 0 auto;
}

/* Footer disclaimer - outside input box at bottom of screen */
.footer-disclaimer {
  text-align: center;
  padding: 8px 16px 12px;
  font-size: 10px;
  color: var(--color-text-muted);
  opacity: 0.7;
}

/* ==========================================
   Global CLI App Styles
   ========================================== */

/* Make main content area match CLI style */
.main-content {
  background: rgba(0, 0, 0, 0.2);
}

.main-header {
  font-family: var(--font-mono);
  background: transparent;
  border-bottom: none;
  overflow: visible;
}

.main-header-title {
  flex: 0 1 auto;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: auto;
  min-width: 0;
  -webkit-app-region: no-drag;
}

/* CLI Style for Task View */
.task-content {
  font-family: var(--font-mono);
}

.task-description {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  background: rgba(0, 0, 0, 0.2);
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-subtle);
}

/* Timeline CLI Styles */
.timeline-section {
  font-family: var(--font-mono);
}

.timeline-event {
  font-family: var(--font-mono);
}

.event-title {
  font-size: 12px;
}

.event-time {
  font-size: 10px;
  font-family: var(--font-ui);
  font-weight: 400;
}

.event-details {
  font-family: var(--font-mono);
  font-size: 11px;
  background: transparent;
  border: none;
}

.event-details pre {
  font-family: var(--font-mono);
  font-size: 11px;
}

/* Main Footer CLI Style */
.main-footer {
  background: transparent;
  border-top: none;
}

.input-container {
  font-family: var(--font-mono);
  background: var(--color-bg-primary);
}

.input-field {
  font-family: var(--font-mono);
}

.input-disclaimer {
  font-family: var(--font-mono);
  font-size: 10px;
}

/* Send Button CLI Style */
.send-btn {
  font-family: var(--font-mono);
}

/* Clickable File Paths - underline on hover only */
.clickable-file-path {
  cursor: pointer;
  text-decoration: none;
  transition:
    color 0.15s ease,
    text-decoration-color 0.15s ease;
}

.clickable-file-path:hover {
  color: var(--color-accent);
  text-decoration: underline;
  text-decoration-style: solid;
  text-decoration-color: var(--color-accent);
  text-underline-offset: 2px;
}

.clickable-file-path:active {
  color: var(--color-accent-hover);
}

/* AI Disclosure Styling */
.cli-line-disclosure {
  margin: 4px 0;
  padding: 4px 8px;
  background: rgba(251, 191, 36, 0.08);
  border-left: 2px solid var(--color-warning);
  border-radius: 2px;
}

.cli-text-muted {
  color: var(--color-text-muted);
  font-size: 12px;
}

/* ==================== TASK SURFACE MODALS AND COMPOSER ==================== */
/* ==================== REMOTE FILE PICKER ==================== */
.remote-file-picker-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.remote-file-picker {
  background: var(--color-bg-elevated);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 480px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--color-border);
}

.remote-file-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border-subtle);
}

.remote-file-picker-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
  margin: 0;
}

.remote-file-picker-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.remote-file-picker-close:hover {
  color: var(--color-text);
}

.remote-file-picker-workspace-select {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border-subtle);
  font-size: 13px;
}

.remote-file-picker-workspace-select label {
  color: var(--color-text-muted);
  font-weight: 500;
}

.remote-file-picker-workspace-select select {
  flex: 1;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  color: var(--color-text);
  font-size: 13px;
  cursor: pointer;
}

.remote-file-picker-workspace-select select:focus {
  outline: none;
  border-color: var(--color-accent);
}

.remote-file-picker-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 10px 20px;
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border-subtle);
  font-size: 13px;
}

.remote-file-picker-breadcrumb-item {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
}

.remote-file-picker-breadcrumb-item:hover {
  color: var(--color-accent);
  background: var(--color-accent-subtle);
}

.remote-file-picker-breadcrumb-sep {
  display: flex;
  align-items: center;
  color: var(--color-text-muted);
}

.remote-file-picker-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  min-height: 200px;
}

.remote-file-picker-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px;
  color: var(--color-text-muted);
}

.remote-file-picker-loading .spin {
  animation: spin 1s linear infinite;
}

.remote-file-picker-error {
  padding: 24px;
  color: var(--color-error);
  text-align: center;
}

.remote-file-picker-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.remote-file-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 0.15s, color 0.15s;
}

.remote-file-picker-row:hover {
  background: var(--color-bg-hover);
  color: var(--color-text);
}

.remote-file-picker-row.selected {
  background: var(--color-accent-subtle);
  color: var(--color-accent);
}

.remote-file-picker-row-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.remote-file-picker-row-size {
  font-size: 12px;
  color: var(--color-text-muted);
}

.remote-file-picker-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--color-border-subtle);
  background: var(--color-bg-secondary);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.remote-file-picker-selected-count {
  font-size: 13px;
  color: var(--color-text-muted);
}

.remote-file-picker-actions {
  display: flex;
  gap: 10px;
}

.remote-file-picker-btn {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.remote-file-picker-btn.secondary {
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
}

.remote-file-picker-btn.secondary:hover {
  background: var(--color-bg-hover);
  color: var(--color-text);
}

.remote-file-picker-btn.primary {
  background: var(--color-accent);
  border: none;
  color: #0f172a;
}

.remote-file-picker-btn.primary:hover:not(:disabled) {
  background: var(--color-accent-hover);
}

.remote-file-picker-btn.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.approval-actions .button-primary,
.approval-actions .button-secondary {
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  min-width: 100px;
}

.approval-danger .approval-actions .button-primary {
  background: linear-gradient(180deg, #f87171 0%, #ef4444 100%);
}

/* ==================== SCROLLBAR ==================== */
/* Refined scrollbars - thin and subtle */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  transition: background 0.2s ease;
}

*:hover> ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Keep the main/right-panel boundary clean until the main view is scrolling. */
.main-body {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

.main-body::-webkit-scrollbar-thumb {
  background: transparent;
}

.main-body.is-scrolling {
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.main-body.is-scrolling::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
}

.main-body.is-scrolling::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

.theme-light .main-body {
  scrollbar-color: transparent transparent;
}

.theme-light .main-body::-webkit-scrollbar-thumb {
  background: transparent;
}

.theme-light .main-body.is-scrolling {
  scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

.theme-light .main-body.is-scrolling::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
}

.theme-light .main-body.is-scrolling::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

/* Scrollbar inside sidebar */
.sidebar ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.04);
}

.sidebar:hover ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
}

/* ==================== LOADING SPINNER ==================== */
.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==================== WELCOME VIEW ==================== */
.welcome-view {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.welcome-content {
  max-width: 640px;
  width: 100%;
}

/* CLI Style Welcome */
.welcome-content.cli-style {
  font-family: var(--font-mono);
}

/* Welcome Logo */
.welcome-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.welcome-logo-img {
  width: 80px;
  height: auto;
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.4));
}

.welcome-logo-img.welcome-brand-wordmark {
  width: auto;
  max-width: min(94vw, 700px);
  height: auto;
  max-height: 118px;
  object-fit: contain;
}

.cli-header {
  text-align: center;
  margin-bottom: 20px;
}

.ascii-art {
  font-size: 10px;
  line-height: 1.2;
  color: var(--color-accent);
  margin: 0;
  white-space: pre;
  text-shadow: 0 0 10px var(--color-accent-subtle);
}

.cli-version {
  margin-top: 12px;
  font-size: 12px;
  color: var(--color-text-muted);
}

.cli-tag {
  display: inline-block;
  padding: 2px 6px;
  background: var(--color-accent-subtle);
  color: var(--color-accent);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  margin-left: 6px;
}

.cli-info {
  margin-bottom: 16px;
  padding: 0 16px;
}

.cli-line {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 13px;
}

.cli-line:last-child {
  margin-bottom: 0;
}

.cli-prompt {
  color: var(--color-accent);
  font-weight: 600;
  flex-shrink: 0;
}

.cli-text {
  color: var(--color-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cli-commands {
  margin-bottom: 24px;
}

.cli-commands-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border-subtle);
}

.cli-commands-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.cli-command {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.cli-command:hover {
  background: rgba(0, 0, 0, 0.35);
  border-color: var(--color-accent);
  transform: translateY(-1px);
}

.cli-command:hover .cli-cmd-prefix {
  color: var(--color-accent);
}

.cli-command:hover .cli-cmd-text {
  color: var(--color-text);
}

.cli-cmd-prefix {
  font-size: 10px;
  font-weight: 600;
  color: var(--color-text-muted);
  opacity: 0.6;
}

.cli-cmd-text {
  font-size: 13px;
  color: var(--color-text-secondary);
}

/* Quick Start Grid */
.quick-start-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

@media (max-width: 900px) {
  .quick-start-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .quick-start-grid {
    grid-template-columns: 1fr;
  }
}

.quick-start-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.quick-start-card:hover {
  background: rgba(0, 0, 0, 0.4);
  border-color: var(--color-border);
  transform: translateY(-2px);
}

.quick-start-icon {
  font-size: 28px;
  line-height: 1;
  margin-bottom: 4px;
  color: var(--color-text-secondary);
}

.quick-start-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.quick-start-desc {
  font-size: 12px;
  color: var(--color-text-muted);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.vault-browser-panel {
  margin-bottom: 22px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--color-border-subtle, rgba(255, 255, 255, 0.08));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--color-accent, #22d3ee) 6%, transparent), transparent 56%),
    color-mix(in srgb, var(--color-bg-elevated, rgba(255, 255, 255, 0.04)) 88%, transparent);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.vault-browser-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.vault-browser-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent, #22d3ee);
}

.vault-browser-heading {
  margin: 6px 0 8px;
  font-size: 20px;
  line-height: 1.1;
  color: var(--color-text-primary, #f8fafc);
}

.vault-browser-copy {
  margin: 0;
  max-width: 700px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-text-muted, #94a3b8);
}

.vault-browser-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.vault-browser-action {
  padding: 9px 12px;
  border: 1px solid color-mix(in srgb, var(--color-accent, #22d3ee) 32%, var(--color-border-subtle, rgba(255, 255, 255, 0.08)));
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-accent, #22d3ee) 10%, transparent);
  color: var(--color-text-primary, #f8fafc);
  cursor: pointer;
  transition:
    transform 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}

.vault-browser-action:hover {
  transform: translateY(-1px);
  border-color: var(--color-accent, #22d3ee);
  background: color-mix(in srgb, var(--color-accent, #22d3ee) 16%, transparent);
}

.vault-browser-action-secondary {
  background: transparent;
}

.vault-browser-loading,
.vault-browser-empty-state {
  padding: 12px 0 4px;
}

.vault-browser-empty-title {
  margin-bottom: 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-primary, #f8fafc);
}

.vault-browser-empty-copy,
.vault-browser-loading,
.vault-browser-empty {
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-text-muted, #94a3b8);
}

.vault-browser-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.vault-browser-stat {
  padding: 12px 14px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--color-bg-elevated, rgba(255, 255, 255, 0.04)) 92%, transparent);
  border: 1px solid var(--color-border-subtle, rgba(255, 255, 255, 0.06));
}

.vault-browser-stat-value {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text-primary, #f8fafc);
}

.vault-browser-stat-label {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--color-text-muted, #94a3b8);
}

.vault-browser-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.vault-browser-group {
  min-width: 0;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--color-border-subtle, rgba(255, 255, 255, 0.06));
  background: color-mix(in srgb, var(--color-bg-elevated, rgba(255, 255, 255, 0.04)) 94%, transparent);
}

.vault-browser-group-title {
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-secondary, #cbd5e1);
}

.vault-browser-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vault-browser-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: color-mix(in srgb, var(--color-bg-surface, rgba(255, 255, 255, 0.03)) 92%, transparent);
  color: inherit;
  cursor: pointer;
  text-align: left;
  transition:
    transform 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}

.vault-browser-item:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--color-accent, #22d3ee) 32%, transparent);
  background: color-mix(in srgb, var(--color-accent, #22d3ee) 8%, transparent);
}

.vault-browser-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-primary, #f8fafc);
}

.vault-browser-item-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  color: var(--color-text-muted, #94a3b8);
}

.vault-browser-item-path {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .vault-browser-header {
    flex-direction: column;
  }

  .vault-browser-actions {
    justify-content: flex-start;
  }

  .vault-browser-stats,
  .vault-browser-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .vault-browser-stats,
  .vault-browser-groups {
    grid-template-columns: 1fr;
  }

  .vault-browser-item-meta {
    flex-direction: column;
    gap: 3px;
  }
}

/* Typewriter placeholder inside the CLI input */
.cli-rotating-placeholder {
  position: absolute;
  left: 0;
  top: 50%;
  display: inline-flex;
  align-items: center;
  pointer-events: none;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 8px);
  padding-right: 4px;
  border-right: 1px solid currentColor;
  transform: translateY(-50%);
  animation: placeholder-caret-blink 1s step-end infinite;
}

/* CLI Input Styles */
.cli-input-container {
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.cli-input-wrapper {
  display: flex;
  align-items: center;
  padding: 6px 16px;
  gap: 10px;
  position: relative;
}

.mention-autocomplete-wrapper {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}

.mention-autocomplete-wrapper:focus-within~.cli-cursor {
  opacity: 1;
}

.cli-input-prompt {
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.cli-input {
  flex: 1;
  padding: 0 !important;
  font-family: var(--font-mono) !important;
}

.cli-input-container .welcome-input {
  min-height: 38px;
}

/* ── Active Mode Badge (footer indicator) ── */
.active-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 12px;
  border: 1px solid var(--color-accent, #6366f1);
  background: color-mix(in srgb, var(--color-accent, #6366f1) 15%, transparent);
  color: var(--color-accent, #6366f1);
  font-size: 11px;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: background 0.12s ease;
  white-space: nowrap;
  animation: dropdownFadeIn 0.15s ease;
}

.active-mode-badge:hover {
  background: color-mix(in srgb, var(--color-accent, #6366f1) 25%, transparent);
}

/* ── Mode Suggestion Bar ── */
.mode-suggestion-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  margin-bottom: 4px;
  animation: dropdownFadeIn 0.15s ease;
}

.mode-suggestion-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 16px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  color: var(--color-text);
  font-size: 12px;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
  white-space: nowrap;
}

.mode-suggestion-pill:hover {
  background: var(--color-accent, #6366f1);
  color: #fff;
  border-color: var(--color-accent, #6366f1);
}

.mode-suggestion-dismiss {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 2px;
  margin-left: auto;
  border-radius: 4px;
  transition: color 0.12s ease;
}

.mode-suggestion-dismiss:hover {
  color: var(--color-text);
}

.mention-autocomplete-dropdown {
  --mention-option-row-height: 58px;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  width: min(720px, calc(100vw - 64px));
  max-width: min(720px, calc(100vw - 64px));
  max-height: min(
    calc((var(--mention-option-row-height) * 8) + 76px),
    calc(100vh - 180px)
  );
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  overflow-y: hidden;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  z-index: 1000;
  animation: dropdownFadeIn 0.15s ease;
}

.mention-autocomplete-section+.mention-autocomplete-section {
  margin-top: 8px;
}

.mention-autocomplete-section-label {
  padding: 5px 8px 4px;
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
}

.mention-autocomplete-section-list {
  max-height: calc(var(--mention-option-row-height) * 4);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}

.mention-autocomplete-section-list::-webkit-scrollbar {
  width: 6px;
}

.mention-autocomplete-section-list::-webkit-scrollbar-track {
  background: transparent;
}

.mention-autocomplete-section-list::-webkit-scrollbar-thumb {
  background: var(--color-border-subtle);
  border-radius: 999px;
}

.mention-autocomplete-item {
  min-height: var(--mention-option-row-height);
  width: 100%;
  border: none;
  background: transparent;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  color: var(--color-text);
  font-size: 12px;
  transition: background 0.12s ease;
}

.mention-autocomplete-item:hover,
.mention-autocomplete-item.selected {
  background: var(--color-bg-hover);
}

.mention-autocomplete-icon {
  width: 22px;
  height: 22px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  flex-shrink: 0;
}

.mention-autocomplete-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
  text-align: left;
  min-width: 0;
  flex: 1;
}

.mention-autocomplete-name {
  font-weight: 600;
  display: block;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.mention-autocomplete-desc {
  font-size: 10px;
  color: var(--color-text-secondary);
  display: block;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Slash command autocomplete (reuses mention styles) */
.slash-autocomplete-dropdown {
  max-height: 300px;
  overflow-y: auto;
}

.slash-command-icon {
  background-color: var(--color-bg-hover) !important;
  font-size: 14px;
  color: var(--color-text) !important;
}

.cli-cursor {
  width: 8px;
  height: 18px;
  background: var(--color-accent);
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  pointer-events: none;
}

.cli-cursor.active {
  animation: blink 1s step-end infinite;
}

.visual-warm .cli-cursor,
.visual-oblivion .cli-cursor {
  width: 1px;
  height: 1.55em;
  background: var(--color-text);
}

/* Hidden span used to measure placeholder text width */
.cli-placeholder-measure {
  position: absolute;
  visibility: hidden;
  height: 0;
  overflow: hidden;
  white-space: pre;
  font-family: var(--font-mono) !important;
  font-size: 14px;
}

.cli-input:focus~.cli-cursor {
  opacity: 1;
}

.cli-input.input-textarea-empty-placeholder {
  caret-color: transparent;
}

@keyframes blink {

  0%,
  50% {
    opacity: 1;
  }

  51%,
  100% {
    opacity: 0;
  }
}

@keyframes placeholder-caret-blink {
  0%,
  50% {
    border-color: currentColor;
  }

  51%,
  100% {
    border-color: transparent;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cli-rotating-placeholder {
    animation: none;
    border-right-color: transparent;
  }
}

/* CLI Input Footer */
.cli-input-container .welcome-input-footer {
  background: transparent;
  border-top: none;
}

.cli-input-container .folder-selector {
  font-family: var(--font-mono);
  background: transparent;
  border-color: var(--color-border-subtle);
}

.cli-input-container .folder-selector:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.cli-input-container .model-selector {
  font-family: var(--font-mono);
  background: transparent;
  border-color: var(--color-border-subtle);
}

.cli-input-container .model-selector:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.cli-input-container .lets-go-btn {
  font-family: var(--font-mono);
  background: var(--color-accent);
  border: none;
  box-shadow: 0 0 10px var(--color-accent-subtle);
}

.cli-input-container .lets-go-btn::before {
  display: none;
}

.cli-input-container .lets-go-btn:hover:not(:disabled) {
  box-shadow: 0 0 20px var(--color-accent-subtle);
}

/* Welcome Input */
.welcome-input-container {
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-subtle);
  border-radius: 20px;
  padding: 5px 6px;
  transition:
    border-color 0.25s ease,
    box-shadow 0.25s ease;
}

.welcome-input-container:focus-within {
  border-color: var(--color-border);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.welcome-input-container.drag-over {
  outline: 1px dashed var(--color-border);
  background: var(--color-bg-hover);
}

.welcome-input {
  width: 100%;
  padding: 18px 20px 12px;
  background: transparent;
  border: none;
  color: var(--color-text);
  font-size: 14px;
  outline: none;
  min-height: 56px;
}

.welcome-input::placeholder {
  color: var(--color-text-muted);
}

.welcome-input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 10px;
  border-top: none;
}

.input-left-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.permission-dropdown-container {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.permission-access-btn {
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 8px 0 4px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-secondary);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.permission-access-btn:hover,
.permission-access-btn[aria-expanded="true"] {
  background: var(--color-bg-hover);
  color: var(--color-text);
}

.permission-access-btn.full {
  color: #e64a00;
}

.permission-access-btn.full:hover,
.permission-access-btn.full[aria-expanded="true"] {
  color: #e64a00;
  background: rgba(230, 74, 0, 0.08);
}

.permission-access-btn svg {
  flex-shrink: 0;
}

.cli-input-container .attachment-btn,
.cli-input-container .permission-access-btn,
.cli-input-container .model-selector,
.cli-input-container .voice-input-btn,
.cli-input-container .model-label-subtle {
  border: none;
  background: transparent;
  box-shadow: none;
}

.cli-input-container .attachment-btn,
.cli-input-container .voice-input-btn {
  width: 36px;
  height: 36px;
  border-radius: 0;
  color: var(--color-text-muted);
}

.cli-input-container .attachment-btn svg {
  width: 18px;
  height: 18px;
}

.cli-input-container .attachment-btn:hover,
.cli-input-container .voice-input-btn:hover:not(:disabled) {
  background: transparent;
  color: var(--color-text);
}

.input-container .attachment-btn,
.input-container .voice-input-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--color-text-muted);
}

.input-container .attachment-btn svg {
  width: 18px;
  height: 18px;
}

.input-container .attachment-btn:hover,
.input-container .voice-input-btn:hover:not(:disabled) {
  background: transparent;
  color: var(--color-text);
}

.input-container .lets-go-btn {
  font-family: var(--font-mono);
  background: var(--color-accent);
  border: none;
  box-shadow: 0 0 10px var(--color-accent-subtle);
}

.input-container .lets-go-btn::before {
  display: none;
}

.input-container .lets-go-btn:hover:not(:disabled) {
  box-shadow: 0 0 20px var(--color-accent-subtle);
}

.cli-input-container .permission-access-btn:hover,
.cli-input-container .permission-access-btn[aria-expanded="true"],
.cli-input-container .model-selector:hover,
.cli-input-container .model-label-subtle:hover {
  background: transparent;
  color: var(--color-text);
}

.cli-input-container .permission-access-btn.full:hover,
.cli-input-container .permission-access-btn.full[aria-expanded="true"] {
  background: transparent;
  color: #e64a00;
}

.permission-access-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 120;
  min-width: 210px;
  padding: 5px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-elevated);
  box-shadow: var(--shadow-lg);
}

.permission-access-option {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  padding: 7px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-secondary);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.permission-access-option span {
  flex: 0 1 auto;
  text-align: left;
}

.permission-access-option:hover,
.permission-access-option.active {
  background: var(--color-bg-hover);
  color: var(--color-text);
}

.permission-access-option.danger {
  color: #e64a00;
}

.permission-access-option.danger:hover,
.permission-access-option.danger.active {
  background: rgba(230, 74, 0, 0.08);
  color: #e64a00;
}

.permission-access-option svg {
  flex-shrink: 0;
}

.input-right-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.folder-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.folder-selector:hover {
  background: var(--color-bg-hover);
  color: var(--color-text);
}

.folder-selector .chevron-up {
  transform: rotate(180deg);
}

/* Workspace dropdown container */
.workspace-dropdown-container {
  position: relative;
}

.input-row > .workspace-dropdown-container:empty {
  display: none;
}

.workspace-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  min-width: 280px;
  max-width: 360px;
  background: #1a1d23;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  z-index: 100;
  overflow: hidden;
}

.theme-light .workspace-dropdown {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(0, 0, 0, 0.05);
}

.workspace-dropdown-header {
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.theme-light .workspace-dropdown-header {
  background: rgba(0, 0, 0, 0.03);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.workspace-dropdown-list {
  max-height: 320px;
  overflow-y: auto;
  padding: 4px 0;
  overscroll-behavior: contain;
}

.workspace-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
  color: var(--color-text-secondary);
}

.workspace-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.theme-light .workspace-dropdown-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

.workspace-dropdown-item.active {
  background: rgba(var(--accent-rgb), 0.1);
}

.workspace-dropdown-item.active:hover {
  background: rgba(var(--accent-rgb), 0.15);
}

.workspace-dropdown-item svg {
  flex-shrink: 0;
  color: var(--color-text-muted);
}

.workspace-dropdown-item.active svg {
  color: var(--color-accent);
}

.workspace-dropdown-item .check-icon {
  margin-left: auto;
  color: var(--color-accent);
}

.workspace-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.workspace-item-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workspace-item-path {
  font-size: 11px;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workspace-dropdown-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 4px 0;
}

.theme-light .workspace-dropdown-divider {
  background: rgba(0, 0, 0, 0.08);
}

.workspace-dropdown-item.new-folder {
  color: var(--color-accent);
  padding: 12px 14px;
}

.workspace-dropdown-item.new-folder svg {
  color: var(--color-accent);
}

.workspace-dropdown-item.new-folder:hover {
  background: rgba(var(--accent-rgb), 0.1);
}

/* Shell toggle button */
.shell-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}

.shell-toggle:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
  border-color: var(--color-border-strong, var(--color-border));
}

.shell-toggle.enabled {
  color: var(--color-text-primary);
}

.shell-toggle.enabled:hover {
  color: var(--color-text-primary);
}

.shell-toggle-inline {
  padding: 4px 8px;
  font-size: 11px;
}

.shell-toggle svg {
  display: none;
  opacity: 0.7;
}

.shell-toggle.enabled svg {
  opacity: 1;
}

.shell-toggle .goal-mode-switch-track {
  margin-left: 2px;
}

/* Input below actions - for shell toggle in conversation view */
.input-below-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  margin-left: 12px;
  margin-bottom: 8px;
}

@container (max-width: 900px) {
  .density-focused .input-actions .model-dropdown-container-label .model-dropdown {
    right: -48px;
    width: min(340px, calc(100cqw - 96px));
    min-width: min(280px, calc(100cqw - 96px));
  }
}

@container (max-width: 700px) {
  .density-focused .input-actions .model-dropdown-container-label .model-dropdown {
    right: -48px;
    width: min(320px, calc(100cqw - 56px));
    min-width: min(280px, calc(100cqw - 56px));
  }

  .density-focused .input-actions .model-label-subtle {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    padding: 0;
    justify-content: center;
  }

  .density-focused .input-actions .model-label-subtle .model-label-icon {
    display: block;
  }

  .density-focused .input-actions .model-label-subtle .model-label-text,
  .density-focused .input-actions .model-label-subtle .model-selector-effort,
  .density-focused .input-actions .model-label-subtle .model-dropdown-chevron {
    display: none;
  }
}

@container (max-width: 560px) {
  .main-body {
    padding-right: 20px;
    padding-left: 20px;
  }

  .main-footer {
    padding-right: 16px;
    padding-left: 16px;
  }

  .input-container {
    width: 100%;
    max-width: none;
  }

  .input-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 8px 10px;
  }

  .mention-autocomplete-wrapper {
    flex: 1 1 auto;
    min-width: 0;
  }

  .input-container .input-field,
  .input-container .input-textarea {
    min-width: 0;
    width: 100%;
  }

  .input-actions {
    flex: 0 0 auto;
    gap: 6px;
    min-width: 0;
  }

  .input-actions .model-selector {
    max-width: 76px;
  }

  .input-actions .model-selector span,
  .input-actions .model-label-subtle {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .input-container .attachment-btn,
  .input-container .voice-input-btn,
  .input-container .lets-go-btn.lets-go-btn-sm {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    padding: 0;
  }

  .input-below-actions,
  .input-status-text {
    width: 100%;
    max-width: none;
  }

  .input-below-actions {
    margin-right: 10px;
    margin-left: 10px;
    gap: 6px;
  }

  .input-below-actions .folder-selector span,
  .input-status-workspace-path {
    max-width: 110px;
  }

  .keyboard-hint,
  .footer-disclaimer {
    display: none;
  }
}

/* Keyboard shortcut hint */
.keyboard-hint {
  margin-left: auto;
  font-size: 11px;
  color: var(--color-text-muted);
  opacity: 0.6;
  user-select: none;
}

.keyboard-hint kbd {
  display: inline-block;
  padding: 1px 5px;
  font-size: 10px;
  font-family: inherit;
  line-height: 1.4;
  color: var(--color-text-muted);
  background: var(--color-bg-glass);
  border: 1px solid var(--color-border-subtle);
  border-radius: 3px;
}

.lets-go-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  min-width: 140px;
  min-height: 44px;
  background: linear-gradient(180deg, var(--color-accent-hover) 0%, var(--color-accent) 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  color: #1a1a1a;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow:
    var(--shadow-sm),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
}

.lets-go-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 100%);
  pointer-events: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.lets-go-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, var(--color-accent-hover) 0%, var(--color-accent) 100%);
  transform: translateY(-1px);
  box-shadow:
    var(--shadow-md),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.lets-go-btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow:
    var(--shadow-sm),
    inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.lets-go-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.lets-go-btn span {
  color: #1a1a1a;
  font-weight: 600;
}

.lets-go-btn svg {
  stroke: #1a1a1a;
  flex-shrink: 0;
}

/* Smaller variant of Let's Start button */
.lets-go-btn.lets-go-btn-sm {
  padding: 8px 12px;
  min-width: auto;
  min-height: 36px;
  gap: 0;
}

.lets-go-btn.lets-go-btn-sm span {
  display: none;
}

/* ==================== SKILLS MENU ==================== */
.skills-menu-container {
  position: relative;
}

.skills-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.2s ease;
}

.skills-menu-btn:hover {
  background: var(--color-bg-hover);
  color: var(--color-text);
  border-color: var(--color-border-hover);
}

.skills-menu-btn.active {
  background: var(--color-accent);
  color: #1a1a1a;
  border-color: var(--color-accent);
}

.skills-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  min-width: 280px;
  max-width: 320px;
  background: #1a1d23;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  z-index: 100;
  overflow: hidden;
}

.theme-light .skills-dropdown {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(0, 0, 0, 0.05);
}

.skills-dropdown-header {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.theme-light .skills-dropdown-header {
  background: rgba(0, 0, 0, 0.03);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.skills-dropdown-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.skills-dropdown-search svg {
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.skills-dropdown-search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 13px;
  color: var(--color-text);
  padding: 4px 0;
}

.skills-dropdown-search input::placeholder {
  color: var(--color-text-muted);
}

.theme-light .skills-dropdown-search {
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.skills-dropdown-list {
  max-height: 300px;
  overflow-y: auto;
  padding: 4px 0;
}

.skills-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 16px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
}

.skills-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.theme-light .skills-dropdown-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

.skills-dropdown-item:not(:last-child) {
  border-bottom: none;
}

.skills-dropdown-icon {
  font-size: 20px;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
}

.theme-light .skills-dropdown-icon {
  background: rgba(0, 0, 0, 0.05);
}

.skills-dropdown-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.skills-dropdown-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
}

.skills-dropdown-desc {
  font-size: 11px;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.skills-dropdown-empty {
  padding: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.skills-dropdown-footer {
  padding: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.theme-light .skills-dropdown-footer {
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.skills-dropdown-create {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.skills-dropdown-create:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.theme-light .skills-dropdown-create {
  background: rgba(0, 0, 0, 0.02);
  border: 1px dashed rgba(0, 0, 0, 0.15);
}

.theme-light .skills-dropdown-create:hover {
  background: rgba(0, 0, 0, 0.05);
}

.skills-dropdown-create svg {
  flex-shrink: 0;
}
