/* Spinning avatar while assistant is thinking */
.asteria-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.asteria-spinning {
  animation: asteria-spin 1.2s linear infinite !important;
}

@keyframes asteria-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Subtle pulse on streaming action text */
.asteria-action-pulse {
  animation: asteria-pulse 1s ease-in-out infinite !important;
}

@keyframes asteria-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* Hide feedback thumbs (useful / not useful buttons) */
.ai-message button.positive-feedback-off,
.ai-message button.negative-feedback-off,
.ai-message button[aria-label*="thumb"],
.ai-message button[aria-label*="Thumb"],
.ai-message button[aria-label*="feedback"],
.ai-message button[aria-label*="Feedback"],
.ai-message [data-testid*="feedback"],
.ai-message [data-testid*="thumb"],
.ai-message .step-icon-button:has(svg path[d*="M7 10v12"]),
.ai-message .step-icon-button:has(svg path[d*="M7 10"]),
.ai-message button:has(svg.lucide-thumbs-up),
.ai-message button:has(svg.lucide-thumbs-down),
.ai-message button:has(svg[class*="Thumb"]) {
  display: none !important;
}

/* Work / scheduled prompts */
:root {
  --asteria-work-bg: #0a0a0b;
  --asteria-work-card: #1a1a1f;
  --asteria-work-card-alt: #18181b;
  --asteria-work-border: #2a2a30;
  --asteria-work-text: #e4e4e7;
  --asteria-work-muted: #71717a;
  --asteria-work-subtle: #a1a1aa;
  --asteria-work-hover: rgba(255, 255, 255, 0.06);
  --asteria-work-hover-strong: rgba(255, 255, 255, 0.1);
  --asteria-work-primary: #6366f1;
  --asteria-work-primary-hover: #818cf8;
  --asteria-work-primary-soft: rgba(99, 102, 241, 0.16);
  --asteria-work-danger: #ef4444;
  --asteria-work-danger-soft: rgba(239, 68, 68, 0.12);
  --asteria-work-success: #22c55e;
  --asteria-work-overlay: rgba(0, 0, 0, 0.6);
  --asteria-work-sidebar-left: 256px;
  --asteria-scrollbar-track: rgba(255, 255, 255, 0.04);
  --asteria-scrollbar-thumb: rgba(161, 161, 170, 0.35);
  --asteria-scrollbar-thumb-hover: rgba(129, 140, 248, 0.7);
}

:root.light {
  --asteria-work-bg: #f4f4f5;
  --asteria-work-card: #ffffff;
  --asteria-work-card-alt: #fafafa;
  --asteria-work-border: #e4e4e7;
  --asteria-work-text: #18181b;
  --asteria-work-muted: #71717a;
  --asteria-work-subtle: #52525b;
  --asteria-work-hover: rgba(0, 0, 0, 0.05);
  --asteria-work-hover-strong: rgba(0, 0, 0, 0.09);
  --asteria-work-primary: #6366f1;
  --asteria-work-primary-hover: #4f46e5;
  --asteria-work-primary-soft: rgba(99, 102, 241, 0.12);
  --asteria-work-danger: #dc2626;
  --asteria-work-danger-soft: rgba(239, 68, 68, 0.1);
  --asteria-work-success: #16a34a;
  --asteria-work-overlay: rgba(0, 0, 0, 0.3);
  --asteria-scrollbar-track: rgba(0, 0, 0, 0.04);
  --asteria-scrollbar-thumb: rgba(113, 113, 122, 0.35);
  --asteria-scrollbar-thumb-hover: rgba(79, 70, 229, 0.65);
}

/* Consistent scrollbars across the Chainlit application. */
html,
body,
* {
  scrollbar-color: var(--asteria-scrollbar-thumb) var(--asteria-scrollbar-track);
  scrollbar-width: thin;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  border-radius: 999px;
  background: var(--asteria-scrollbar-track);
}

*::-webkit-scrollbar-thumb {
  min-height: 42px;
  border: 3px solid transparent;
  border-radius: 999px;
  background: var(--asteria-scrollbar-thumb);
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--asteria-scrollbar-thumb-hover);
  background-clip: padding-box;
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

.asteria-work-tabs {
  display: flex;
  gap: 4px;
  padding: 6px 8px;
}

.asteria-work-tab {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--asteria-work-muted);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.asteria-work-tab:hover {
  background: var(--asteria-work-hover);
  color: var(--asteria-work-text);
}

.asteria-work-tab-active {
  background: var(--asteria-work-primary-soft);
  color: var(--asteria-work-primary-hover);
}

.asteria-chat-scheduled-section {
  margin-top: 12px;
}

.asteria-chat-scheduled-heading {
  padding: 0 8px;
  height: 32px;
  display: flex;
  align-items: center;
  color: var(--asteria-work-subtle);
  font-size: 12px;
  font-weight: 500;
}

.asteria-chat-scheduled-list {
  padding: 0 8px;
}

.asteria-chat-prompt-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px;
  border-radius: 10px;
  color: var(--asteria-work-text);
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  overflow: hidden;
}

.asteria-chat-prompt-item:hover {
  background: var(--asteria-work-hover);
}

.asteria-chat-prompt-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asteria-work-overlay {
  position: fixed;
  top: 60px;
  left: var(--asteria-work-sidebar-left);
  right: 0;
  bottom: 0;
  z-index: 40;
  box-sizing: border-box;
  color: var(--asteria-work-text);
  background: var(--asteria-work-bg);
  color-scheme: dark;
}

:root.light .asteria-work-overlay,
:root.light #asteria-scheduled-modal {
  color-scheme: light;
}

.asteria-work-main {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: clamp(24px, 3vw, 32px) clamp(16px, 4vw, 48px);
  overflow-y: auto;
}

.asteria-work-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(100%, 1200px);
  margin: 0 auto 24px;
}

.asteria-work-header-copy {
  min-width: 0;
}

.asteria-work-header h2 {
  margin: 0;
  color: var(--asteria-work-text);
  font-size: clamp(20px, 2vw, 24px);
  font-weight: 700;
  line-height: 1.25;
}

.asteria-work-header p {
  margin: 4px 0 0;
  color: var(--asteria-work-muted);
  font-size: 14px;
}

.asteria-work-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.asteria-work-button:focus-visible,
.asteria-scheduled-input:focus-visible,
.asteria-scheduled-day:has(input:focus-visible) {
  outline: 2px solid var(--asteria-work-primary-hover);
  outline-offset: 2px;
}

.asteria-work-button-primary {
  background: var(--asteria-work-primary);
  color: #fff;
}

.asteria-work-button-primary:hover {
  background: var(--asteria-work-primary-hover);
}

.asteria-work-button-secondary {
  background: var(--asteria-work-hover);
  color: var(--asteria-work-subtle);
}

.asteria-work-button-secondary:hover {
  background: var(--asteria-work-hover-strong);
  color: var(--asteria-work-text);
}

.asteria-work-button-danger {
  background: var(--asteria-work-danger-soft);
  color: var(--asteria-work-danger);
}

.asteria-work-button-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

.asteria-work-button-ghost {
  background: transparent;
  color: var(--asteria-work-muted);
}

.asteria-work-button-ghost:hover {
  background: var(--asteria-work-hover);
  color: var(--asteria-work-text);
}

.asteria-scheduled-list {
  width: min(100%, 1200px);
  margin: 0 auto;
}

.asteria-scheduled-card {
  margin-bottom: 12px;
  padding: 20px;
  border: 1px solid var(--asteria-work-border);
  border-radius: 12px;
  background: var(--asteria-work-card);
}

.asteria-scheduled-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.asteria-scheduled-card-heading {
  min-width: 0;
}

.asteria-scheduled-card-title {
  overflow-wrap: anywhere;
  color: var(--asteria-work-text);
  font-size: 16px;
  font-weight: 700;
}

.asteria-scheduled-card-schedule {
  margin-top: 4px;
  color: var(--asteria-work-muted);
  font-size: 13px;
}

.asteria-scheduled-card-actions {
  display: flex;
  flex-shrink: 0;
  gap: 4px;
}

.asteria-scheduled-card-prompt {
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 8px;
  background: var(--asteria-work-bg);
  color: var(--asteria-work-subtle);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.asteria-scheduled-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.asteria-scheduled-status {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
}

.asteria-scheduled-status-active {
  color: var(--asteria-work-success);
}

.asteria-scheduled-status-paused,
.asteria-scheduled-card-last-run {
  color: var(--asteria-work-muted);
}

.asteria-scheduled-card-last-run {
  font-size: 12px;
  text-align: right;
}

.asteria-work-empty,
.asteria-work-status-message {
  color: var(--asteria-work-muted);
  text-align: center;
}

.asteria-work-empty {
  padding: 48px 24px;
  font-size: 14px;
}

.asteria-work-empty-title {
  margin-bottom: 8px;
  color: var(--asteria-work-text);
  font-size: 16px;
}

.asteria-work-empty p {
  margin: 0;
}

.asteria-work-status-message {
  font-size: 14px;
}

.asteria-work-status-error,
.asteria-exec-error-label,
.asteria-exec-status-error {
  color: var(--asteria-work-danger);
}

.asteria-sidebar-worklist {
  flex: 1;
  min-height: 0;
  padding: 8px;
  overflow-y: auto;
}

.asteria-work-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0;
}

.asteria-work-nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--asteria-work-muted);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.asteria-work-nav-btn:hover,
.asteria-work-nav-active {
  background: var(--asteria-work-primary-soft);
  color: var(--asteria-work-primary-hover);
}

.asteria-exec-view {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  --asteria-work-sidebar-left: 256px;
}

.asteria-exec-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  padding: 16px clamp(16px, 3vw, 32px);
  border-bottom: 1px solid var(--asteria-work-border);
}

.asteria-exec-heading {
  min-width: 0;
  flex: 1;
}

.asteria-exec-title {
  overflow: hidden;
  color: var(--asteria-work-text);
  font-size: 18px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asteria-exec-schedule {
  margin-top: 2px;
  color: var(--asteria-work-muted);
  font-size: 12px;
}

.asteria-exec-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.asteria-exec-sidebar {
  width: 240px;
  flex-shrink: 0;
  padding: 8px;
  overflow-y: auto;
  border-right: 1px solid var(--asteria-work-border);
}

.asteria-exec-item {
  margin-bottom: 4px;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
}

.asteria-exec-item:hover,
.asteria-exec-item-active {
  background: var(--asteria-work-primary-soft);
}

.asteria-exec-item-date {
  color: var(--asteria-work-text);
  font-size: 12px;
}

.asteria-exec-item-status {
  margin-top: 2px;
  font-size: 11px;
}

.asteria-exec-status-success {
  color: var(--asteria-work-success);
}

.asteria-work-empty-inline {
  margin: 0;
  padding: 12px;
  color: var(--asteria-work-muted);
  font-size: 13px;
}

.asteria-exec-content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: clamp(20px, 4vw, 32px) clamp(16px, 5vw, 48px);
}

.asteria-exec-conversation {
  width: min(100%, 800px);
  margin: 0 auto;
}

.asteria-exec-meta {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--asteria-work-border);
  color: var(--asteria-work-muted);
  font-size: 13px;
}

.asteria-exec-message {
  display: flex;
  gap: 16px;
  margin-bottom: 32px;
}

.asteria-exec-message-body {
  flex: 1;
  min-width: 0;
}

.asteria-exec-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
}

.asteria-exec-avatar-user {
  background: var(--asteria-work-primary);
  color: #fff;
}

.asteria-exec-avatar-assistant {
  border: 1px solid var(--asteria-work-border);
  background: var(--asteria-work-card-alt);
  color: var(--asteria-work-primary-hover);
}

.asteria-exec-label {
  margin-bottom: 6px;
  color: var(--asteria-work-subtle);
  font-size: 13px;
  font-weight: 600;
}

.asteria-exec-bubble {
  padding: 16px;
  border-radius: 12px;
  background: var(--asteria-work-card);
  color: var(--asteria-work-text);
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.asteria-work-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: var(--asteria-work-overlay);
  color: var(--asteria-work-text);
  color-scheme: dark;
}

.asteria-scheduled-modal {
  width: min(480px, 100%);
  max-height: min(90vh, 760px);
  overflow-y: auto;
  padding: clamp(16px, 4vw, 28px);
  border: 1px solid var(--asteria-work-border);
  border-radius: 16px;
  background: var(--asteria-work-card);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.3);
}

@media (min-width: 769px) {
  .asteria-scheduled-modal {
    width: min(720px, 100%);
    max-height: min(92vh, 860px);
  }
}

.asteria-scheduled-modal h3 {
  margin-bottom: 20px;
  color: var(--asteria-work-text);
  font-size: 18px;
  font-weight: 700;
}

.asteria-scheduled-form-group {
  min-width: 0;
  margin-bottom: 16px;
}

.asteria-scheduled-form-group > label {
  display: block;
  margin-bottom: 6px;
  color: var(--asteria-work-muted);
  font-size: 13px;
  font-weight: 600;
}

.asteria-scheduled-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--asteria-work-border);
  border-radius: 8px;
  outline: none;
  background: var(--asteria-work-bg);
  color: var(--asteria-work-text);
  font-size: 14px;
  font-family: inherit;
  box-sizing: border-box;
}

.asteria-scheduled-input::placeholder {
  color: var(--asteria-work-muted);
}

.asteria-scheduled-input:focus {
  border-color: var(--asteria-work-primary);
}

textarea.asteria-scheduled-input {
  resize: vertical;
}

.asteria-scheduled-time-row {
  display: flex;
  gap: 12px;
}

.asteria-scheduled-time-row > .asteria-scheduled-form-group {
  flex: 1;
}

.asteria-scheduled-time-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.asteria-scheduled-time-label label {
  color: var(--asteria-work-muted);
  font-size: 13px;
  font-weight: 600;
}

.asteria-scheduled-time-label span {
  color: var(--asteria-work-muted);
  font-size: 12px;
}

.asteria-scheduled-times {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.asteria-scheduled-time-item {
  display: flex;
  gap: 8px;
}

.asteria-scheduled-time-item .asteria-scheduled-input {
  flex: 1;
  min-width: 0;
}

.asteria-scheduled-interval {
  display: flex;
  gap: 8px;
}

.asteria-scheduled-interval .asteria-scheduled-input {
  flex: 1;
  min-width: 0;
}

.asteria-scheduled-time-remove {
  flex-shrink: 0;
}

.asteria-scheduled-add-time {
  width: 100%;
  margin-top: 8px;
}

.asteria-scheduled-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.asteria-scheduled-day {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--asteria-work-hover);
  color: var(--asteria-work-subtle);
  font-size: 12px;
  cursor: pointer;
}

.asteria-scheduled-day input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.asteria-scheduled-day-active {
  border-color: var(--asteria-work-primary);
  background: var(--asteria-work-primary-soft);
  color: var(--asteria-work-primary-hover);
}

.asteria-scheduled-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--asteria-work-text);
  font-size: 14px;
  cursor: pointer;
}

.asteria-scheduled-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--asteria-work-primary);
}

.asteria-scheduled-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.asteria-scheduled-hidden {
  display: none !important;
}

@media (max-width: 768px) {
  [role="tooltip"],
  [data-radix-popper-content-wrapper]:has([role="tooltip"]) {
    display: none !important;
  }

  .asteria-work-overlay {
    top: 60px;
    left: 0;
  }

  .asteria-work-main {
    padding: 16px 16px 24px;
  }

  .asteria-work-header {
    align-items: stretch;
    flex-direction: column;
    margin-bottom: 20px;
  }

  .asteria-work-header .asteria-work-button-primary {
    width: 100%;
  }

  .asteria-scheduled-card {
    padding: 16px;
  }

  .asteria-scheduled-card-header {
    flex-direction: column;
    gap: 12px;
  }

  .asteria-scheduled-card-actions {
    width: 100%;
  }

  .asteria-scheduled-card-actions .asteria-work-button {
    flex: 1;
  }

  .asteria-scheduled-card-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .asteria-scheduled-card-last-run {
    text-align: left;
  }

  .asteria-exec-header {
    align-items: flex-start;
    padding: 16px;
  }

  .asteria-exec-body {
    flex-direction: column;
  }

  .asteria-exec-sidebar {
    display: flex;
    width: 100%;
    max-height: 150px;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--asteria-work-border);
  }

  .asteria-exec-item {
    min-width: 150px;
    margin-bottom: 0;
  }

  .asteria-exec-message {
    gap: 10px;
    margin-bottom: 24px;
  }

  .asteria-exec-content {
    padding: 20px 16px;
  }
}

@media (max-width: 480px) {
  .asteria-work-button {
    min-height: 40px;
  }

  .asteria-scheduled-time-row {
    flex-direction: column;
    gap: 0;
  }

  .asteria-scheduled-modal-actions {
    flex-direction: column-reverse;
  }

  .asteria-scheduled-modal-actions .asteria-work-button {
    width: 100%;
  }
}
