/* These styles are generated from project.scss. */

.classification-smoke-test {
  padding: 1rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  background: #f8fafc;
}

.email-label-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.email-label-filter,
.email-label-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
}

.email-label-filter {
  padding: 0.48rem 0.68rem;
  text-decoration: none;
}

.email-label-filter span {
  min-width: 1.35rem;
  padding: 0.2rem 0.38rem;
  border-radius: 999px;
  background: rgb(255 255 255 / 20%);
  text-align: center;
}

.email-label-filter:hover,
.email-label-filter.active {
  border-color: #111827;
  color: #fff;
}

.email-label-filter.active {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #111827;
}

.email-label-badge {
  margin-right: 0.25rem;
  padding: 0.32rem 0.52rem;
}

.email-label-job-search {
  background: #1d4ed8;
  color: #fff;
}

.email-label-newsletters {
  background: #7e22ce;
  color: #fff;
}

.email-label-travel {
  background: #15803d;
  color: #fff;
}

.email-label-shopping {
  background: #b45309;
  color: #fff;
}

.email-label-personal {
  background: #ffedd5;
  color: #9a3412;
}

.email-label-personal span {
  background: #fed7aa;
}

.email-label-personal.email-label-filter:hover,
.email-label-personal.email-label-filter.active {
  border-color: #9a3412;
  color: #9a3412;
}

.email-label-unlabeled {
  background: #4b5563;
  color: #fff;
}

.email-label-clear {
  color: #6c757d;
  font-size: 0.8rem;
}

.email-label-failed {
  background: #fee2e2;
  color: #b91c1c;
}

/* One dense row per message, sender first, like Gmail's inbox. */
.email-message-list {
  border: 1px solid #d8dee4;
  border-radius: 0.45rem;
  overflow: hidden;
}

.email-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.45rem 0.75rem;
  border: 0;
  border-bottom: 1px solid #eceff3;
  background: #f6f8fc;
  color: #3c4043;
  font-size: 0.875rem;
  line-height: 1.4;
  text-align: left;
}

.email-row:last-child {
  border-bottom: 0;
}

.email-row.is-unread {
  background: #fff;
  color: #111827;
  font-weight: 600;
}

.email-row:hover {
  position: relative;
  box-shadow: 0 1px 3px rgb(60 64 67 / 25%);
}

.email-row:focus-visible {
  outline: 2px solid #1d4ed8;
  outline-offset: -2px;
}

.email-row-sender {
  flex: 0 0 13rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-row-main {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-row-count {
  color: #6b7280;
  font-size: 0.78rem;
  font-weight: 400;
}

.email-row-snippet {
  color: #6b7280;
  font-weight: 400;
}

.email-row-date {
  flex: 0 0 auto;
  font-size: 0.8rem;
  white-space: nowrap;
}

.email-row .email-label-badge {
  margin-right: 0.35rem;
  padding: 0.12rem 0.45rem;
  font-size: 0.72rem;
}

/* Debug mode: facts and pipeline stages each get their own line under the
   sender/subject line, indented to line up with the subject. */
.email-row:has(.email-row-facts) {
  flex-wrap: wrap;
  row-gap: 0.2rem;
}

/* Keep sender, subject and date on one line; the subject truncates. */
.email-row:has(.email-row-facts) .email-row-main {
  flex: 1 1 0;
}

.email-row-facts,
.email-row-stage {
  display: flex;
  flex: 0 0 100%;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.5rem;
  padding-left: 13.75rem;
  font-size: 0.78rem;
  font-weight: 400;
}

.email-stage-name {
  flex: 0 0 6.5rem;
  color: #6b7280;
}

.email-stage-result {
  padding: 0 0.45rem;
  border-radius: 999px;
  background: #eceff3;
  font-weight: 600;
}

.email-stage-result.is-kept,
.email-stage-result.is-loop {
  background: #dbeafe;
  color: #1e40af;
}

.email-stage-result.is-invitation {
  background: #f3e8ff;
  color: #6b21a8;
}

.email-stage-result.is-removed {
  background: #fee2e2;
  color: #b91c1c;
}

.email-stage-result.is-drop {
  color: #6b7280;
}

.email-stage-result.is-context {
  background: #f3f4f6;
  color: #374151;
}

.email-stage-event {
  color: #067647;
  font-weight: 600;
}

.email-stage-why {
  color: #6b7280;
}

.email-stage-answers {
  display: flex;
  flex: 0 0 100%;
  flex-wrap: wrap;
  gap: 0.1rem 1rem;
  padding-left: 7rem;
  color: #3c4043;
}

.email-stage-answers code {
  color: #6b7280;
}

.email-focus-filter {
  background: #1e40af;
  color: #fff;
}

.email-not-focus-filter {
  background: #6b7280;
  color: #fff;
}

.email-rule-toggle {
  padding: 0.4rem 0.65rem;
  border: 1px dashed #98a2b3;
  border-radius: 0.4rem;
  color: #667085;
  font-family: var(--bs-font-monospace);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
}

.email-rule-toggle.active {
  border: 1px solid #b42318;
  background: #fef3f2;
  color: #b42318;
}

.email-outcome-rules {
  margin: 0.35rem 0;
  padding-left: 1.4rem;
}

.email-outcome-rules > li {
  margin-bottom: 0.35rem;
}

.email-rule-count {
  margin-left: 0.35rem;
  font-size: 0.8rem;
}

.email-rule-count.active {
  font-weight: 700;
}

.email-pass1-panel {
  padding: 0.75rem 1rem;
  border: 1px solid #d8dee4;
  border-radius: 0.45rem;
  background: #fff;
}

@media (max-width: 575.98px) {
  .email-row-facts,
  .email-row-stage,
  .email-stage-answers {
    order: 2;
    padding-left: 0;
  }
}

@media (max-width: 575.98px) {
  .email-row {
    flex-wrap: wrap;
    row-gap: 0.1rem;
  }

  .email-row-sender {
    flex: 1 1 0;
  }

  .email-row-main {
    flex-basis: 100%;
    order: 1;
  }
}

.conversation-message-toggle {
  background: #f8f9fa;
}

.conversation-message-toggle:hover,
.conversation-message-toggle[aria-expanded="true"] {
  background: #fff;
}

.conversation-toggle {
  display: inline-block;
  color: #6c757d;
  font-size: 1.5rem;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform 0.15s ease;
}

.conversation-message-toggle[aria-expanded="true"] .conversation-toggle {
  transform: rotate(90deg);
}

.email-body {
  overflow-wrap: anywhere;
}

/* Dashed marks text infiniteteammates derived, not the sender's own part. */
.email-extraction-toggle {
  border-style: dashed;
}

.email-extracted {
  padding: 0.75rem;
  border: 1px dashed #adb5bd;
  border-radius: 0.25rem;
}

.email-html-frame {
  display: block;
  width: 100%;
  min-height: 32rem;
  border: 1px solid #dee2e6;
  border-radius: 0.25rem;
  background: #fff;
}

/* The message modal opens at full height; the email renders into it. */
#email-message-modal .modal-dialog {
  height: 85vh;
}

#email-message-modal .modal-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

#email-message-modal .modal-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

#email-message-modal .email-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

#email-message-modal [data-email-content="rendered"]:not([hidden]) {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
}

#email-message-modal .email-html-frame {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
}

.alert-debug {
  color: black;
  background-color: white;
  border-color: #d6e9c6;
}

.alert-error {
  color: #b94a48;
  background-color: #f2dede;
  border-color: #eed3d7;
}

.chat-page {
  background: #fff;
}

.chat-page > .container,
.chat-page > div > .container {
  width: 100%;
  max-width: none;
  padding: 0;
}

.chat-layout {
  display: grid;
  min-height: calc(100dvh - 4.5rem);
  grid-template-columns: 17rem minmax(0, 1fr);
}

.chat-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: calc(100dvh - 4.5rem);
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
  border-right: 1px solid #dee2e6;
  background: #f8f9fa;
  overflow-y: auto;
}

.chat-new {
  width: 100%;
  text-align: left;
}

.chat-history {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.chat-history-item {
  padding: 0.6rem 0.7rem;
  border-radius: 0.5rem;
  color: #343a40;
  overflow: hidden;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-history-item:hover,
.chat-history-item.active {
  background: #e9ecef;
  color: #212529;
}

.chat-history-empty {
  color: #6c757d;
  font-size: 0.85rem;
}

.context-inspector {
  margin-top: auto;
  padding: 0.75rem;
  border: 1px solid #ced4da;
  border-radius: 0.5rem;
  background: #fff;
  font-size: 0.75rem;
}

.context-inspector > summary,
.context-system-prompt > summary {
  cursor: pointer;
  font-weight: 700;
}

.context-metrics {
  margin: 0.75rem 0;
}

.context-metrics div {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.context-metrics dt {
  color: #6c757d;
  font-weight: 400;
}

.context-metrics dd {
  margin: 0;
  text-align: right;
}

.context-composition {
  padding: 0.5rem;
  border-radius: 0.25rem;
  background: #f1f3f5;
  overflow-wrap: anywhere;
}

.context-system-prompt pre {
  margin: 0.5rem 0 0;
  font: inherit;
  white-space: pre-wrap;
}

.chat-shell {
  display: flex;
  min-height: calc(100dvh - 5rem);
  flex-direction: column;
}

.chat-transcript {
  width: 100%;
  max-width: 48rem;
  margin: 0 auto;
  padding: 2.5rem 0 8rem;
}

.chat-empty-state {
  padding-top: 18vh;
  color: #6c757d;
  text-align: center;
}

.chat-empty-state h1 {
  color: #212529;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
}

.chat-message {
  margin-bottom: 1.75rem;
}

.chat-message-label {
  margin-bottom: 0.35rem;
  color: #6c757d;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.chat-message-content {
  margin: 0;
  color: #212529;
  line-height: 1.65;
}

.chat-message-user .chat-message-content {
  width: fit-content;
  max-width: 85%;
  margin-left: auto;
  padding: 0.75rem 1rem;
  border-radius: 1.25rem;
  background: #f1f3f5;
  white-space: pre-wrap;
}

.chat-message-assistant .chat-message-content > :first-child {
  margin-top: 0;
}

.chat-message-assistant .chat-message-content > :last-child {
  margin-bottom: 0;
}

.chat-message-assistant h1,
.chat-message-assistant h2,
.chat-message-assistant h3 {
  margin: 1.5rem 0 0.65rem;
  line-height: 1.25;
}

.chat-message-assistant h1 {
  font-size: 1.5rem;
}

.chat-message-assistant h2 {
  font-size: 1.3rem;
}

.chat-message-assistant h3 {
  font-size: 1.1rem;
}

.chat-message-assistant p,
.chat-message-assistant ul,
.chat-message-assistant ol,
.chat-message-assistant blockquote,
.chat-message-assistant table {
  margin: 0 0 1rem;
}

.chat-message-assistant code {
  border-radius: 0.3rem;
  background: #f1f3f5;
  padding: 0.12rem 0.3rem;
  font-size: 0.9em;
}

.chat-message-assistant pre {
  max-height: 32rem;
  overflow: auto;
  margin: 0;
  background: #f3f4f6;
  padding: 0.85rem 1rem 1rem;
  color: #1f2937;
  line-height: 1.5;
}

.chat-message-assistant pre code {
  border-radius: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  font-size: 0.82rem;
  white-space: pre;
}

.chat-message-assistant .hljs-comment,
.chat-message-assistant .hljs-quote {
  color: #6a737d;
}

.chat-message-assistant .hljs-keyword,
.chat-message-assistant .hljs-selector-tag,
.chat-message-assistant .hljs-literal,
.chat-message-assistant .hljs-section,
.chat-message-assistant .hljs-link {
  color: #d73a49;
}

.chat-message-assistant .hljs-string,
.chat-message-assistant .hljs-attr,
.chat-message-assistant .hljs-addition {
  color: #032f62;
}

.chat-message-assistant .hljs-number,
.chat-message-assistant .hljs-regexp,
.chat-message-assistant .hljs-variable,
.chat-message-assistant .hljs-template-variable {
  color: #005cc5;
}

.chat-message-assistant .hljs-title,
.chat-message-assistant .hljs-name,
.chat-message-assistant .hljs-type,
.chat-message-assistant .hljs-built_in {
  color: #6f42c1;
}

.chat-message-assistant .hljs-meta {
  color: #b31d28;
}

.chat-code-block {
  max-width: 100%;
  overflow: hidden;
  margin: 0 0 1rem;
  border: 1px solid #d1d5db;
  border-radius: 0.6rem;
  background: #f3f4f6;
}

.chat-code-header {
  display: flex;
  min-height: 2.25rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.75rem;
  background: #e5e7eb;
  color: #374151;
  font-size: 0.72rem;
  line-height: 1;
}

.chat-code-copy {
  border: 0;
  background: transparent;
  padding: 0.3rem 0.4rem;
  color: #374151;
  font: inherit;
}

.chat-code-copy:hover,
.chat-code-copy:focus-visible {
  color: #111827;
  text-decoration: underline;
}

.chat-message-assistant blockquote {
  border-left: 0.25rem solid #ced4da;
  padding-left: 1rem;
  color: #495057;
}

.chat-message-assistant table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

.chat-message-assistant th,
.chat-message-assistant td {
  border: 1px solid #dee2e6;
  padding: 0.45rem 0.65rem;
  text-align: left;
}

.chat-message-user .chat-message-label {
  text-align: right;
}

.chat-cursor::after {
  display: inline-block;
  width: 0.5rem;
  height: 1rem;
  margin-left: 0.2rem;
  background: currentcolor;
  content: "";
  vertical-align: -0.1rem;
  animation: chat-blink 1s step-end infinite;
}

@keyframes chat-blink {
  50% {
    opacity: 0;
  }
}

.chat-composer-wrap {
  position: sticky;
  bottom: 0;
  width: 100%;
  max-width: 48rem;
  margin: auto auto 0;
  padding: 1rem 0 0.5rem;
  background: linear-gradient(transparent, #fff 25%);
}

.chat-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-rows: auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem;
  border: 1px solid #ced4da;
  border-radius: 1.5rem;
  background: #fff;
  box-shadow: 0 0.5rem 2rem rgb(0 0 0 / 8%);
}

.chat-input {
  grid-row: 1;
  grid-column: 1;
  width: 100%;
  min-height: 2.5rem;
  max-height: 14rem;
  min-width: 0;
  flex: 1;
  resize: none;
  overflow-y: hidden;
  border: 0;
  outline: 0;
  padding: 0.5rem 0.75rem;
  line-height: 1.5;
}

.chat-action {
  min-width: 4.5rem;
  flex-shrink: 0;
  border-radius: 1rem;
}

.chat-icon-action {
  grid-row: 1;
  grid-column: 2;
  width: 2.75rem;
  height: 2.75rem;
  flex: 0 0 2.75rem;
  padding: 0;
  border-radius: 50%;
  line-height: 1;
}

.chat-recording-state,
.chat-transcribing-state {
  grid-row: 1 / 3;
  grid-column: 1 / -1;
  min-height: 2.75rem;
  flex: 1;
  align-items: center;
  padding: 0 0.5rem;
}

.chat-recording-state:not([hidden]),
.chat-transcribing-state:not([hidden]) {
  display: flex;
}

.chat-sound-bars {
  display: flex;
  height: 2rem;
  align-items: center;
  gap: 0.18rem;
}

.chat-sound-bars span {
  width: 0.2rem;
  height: 0.2rem;
  border-radius: 999px;
  background: #212529;
  transition: height 80ms ease-out;
}

.chat-recording-time {
  margin-left: 0.75rem;
  color: #495057;
  font-variant-numeric: tabular-nums;
}

.chat-recording-action {
  width: 2.25rem;
  height: 2.25rem;
  margin-left: 0.5rem;
  padding: 0;
  border-radius: 50%;
  font-size: 1.2rem;
  line-height: 1;
}

.chat-recording-action:first-of-type {
  margin-left: auto;
}

.chat-transcribing-state {
  gap: 0.65rem;
  color: #495057;
  font-size: 1rem;
  font-weight: 600;
}

#chat-submit,
#chat-stop {
  grid-row: 1;
  grid-column: 3;
}

.chat-composer.is-multiline {
  grid-template-rows: auto auto;
  align-items: flex-end;
}

.chat-composer.is-multiline .chat-input {
  grid-row: 1;
  grid-column: 1 / -1;
}

.chat-composer.is-multiline .chat-icon-action,
.chat-composer.is-multiline #chat-submit,
.chat-composer.is-multiline #chat-stop {
  grid-row: 2;
}

.chat-status {
  min-height: 1.25rem;
  margin: 0.35rem 1rem 0;
  color: #6c757d;
  font-size: 0.8rem;
  text-align: center;
}

@media (width <= 767px) {
  .chat-layout {
    grid-template-columns: 1fr;
  }

  .chat-sidebar {
    position: static;
    height: auto;
    max-height: 14rem;
    border-right: 0;
    border-bottom: 1px solid #dee2e6;
  }

  .context-inspector {
    display: none;
  }

  .chat-transcript {
    padding-top: 1.5rem;
  }

  .chat-composer-wrap {
    padding-right: 0.25rem;
    padding-left: 0.25rem;
  }
}

/* Debug view: loops built by ③ Grouping. */
.email-loop-card {
  margin: 0.4rem 0;
  padding: 0.55rem 0.75rem;
  border: 1px solid #d8dee4;
  border-radius: 0.45rem;
  background: #fff;
  font-size: 0.85rem;
}

.email-loop-card.is-resurfaced {
  border-color: #067647;
  box-shadow: 0 0 0 1px #067647;
}

.email-loop-card:target {
  box-shadow: 0 0 0 2px #1d4ed8;
}

.email-loop-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.6rem;
  margin-bottom: 0.2rem;
}

.email-loop-headline {
  flex: 1 1 18rem;
}

.email-loop-meta {
  color: #6b7280;
  font-size: 0.78rem;
}

.email-loop-tag {
  padding: 0 0.45rem;
  border-radius: 999px;
  background: #ecfdf3;
  color: #067647;
  font-size: 0.75rem;
  font-weight: 600;
}

.email-loop-line {
  display: block;
  padding: 0.05rem 0.25rem;
  border-radius: 0.25rem;
  color: #3c4043;
  font-size: 0.8rem;
  text-decoration: none;
}

.email-loop-line:hover {
  background: #f1f5f9;
  color: #111827;
}
