/* Elderly users read raw tool output as an error; the agent's own text already says what happened */
.agent-turn [data-testid="message-body"] > :has(.progress-text-wrapper),
.agent-turn [data-testid="message-body"] > :has(button[aria-label^="Transferred to"]) {
  display: none !important;
}

/* Hallmark · component: helper home (category cards + starter chips) · genre: editorial · theme: ECT navy (existing brand)
 * states: default · hover · focus · active · disabled
 * colours: every value is a token in :root below; rules reference tokens only
 */
:root {
  --ect-navy: #0b3d91;
  --ect-navy-tint: #eef2f9;
  --ect-ink: #1a1a1a;
  --ect-ink-soft: #4a4a4a;
  --ect-ink-on-dark: #f5f5f5;
  --ect-line: #c8ccd4;
  --ect-input-line: #8a909c;
  --ect-divider: #e5e7eb;
  --ect-paper: #ffffff;
  --ect-muted-paper: #f3f4f6;
  --ect-quiet-paper: #f5f6f8;
  --ect-wait-paper: #eef3fb;
  --ect-wait-line: #b9cbe8;
  --ect-progress-track: #d6e0f0;
  --ect-error: #b00020;
  --ect-focus: #f2a900;
  --ect-shadow: rgba(0, 0, 0, .08);
  --ect-overlay: rgba(0, 0, 0, .45);
  --ect-ease-out: cubic-bezier(.2, .8, .2, 1);
}

/* Every panel sets its own colour and background so it stays readable under html.dark */
.ect-h-home,
.ect-h-modal,
.ect-h-wait,
.ect-h-done {
  color: var(--ect-ink);
  font-size: 1.125rem;
  line-height: 1.6;
}

/* Home screen above the composer — kept short so LibreChat's own header stays on screen at 100% zoom */
.ect-h-home {
  max-width: 52rem;
  margin: 0 auto 1rem;
  padding: 0 1rem;
  background: transparent;
}

.ect-h-heading {
  margin: 0 0 0.75rem;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.35;
  color: inherit;
}

/* The home heading leads the screen; panel and dialog headings keep the base size */
.ect-h-home > .ect-h-heading {
  font-size: 1.875rem;
  line-height: 1.3;
}

.ect-h-heading:focus {
  outline: none;
}

html.dark .ect-h-home {
  color: var(--ect-ink-on-dark);
}

.ect-h-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.ect-h-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  min-height: 3rem;
  padding: 0.875rem 1.25rem;
  background: var(--ect-paper);
  color: var(--ect-ink);
  border: 1px solid var(--ect-line);
  border-radius: 12px;
  box-shadow: 0 1px 2px var(--ect-shadow);
  text-align: left;
  cursor: pointer;
}

.ect-h-card:hover {
  border-color: var(--ect-navy);
}

.ect-h-card:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.ect-h-card-title {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
}

.ect-h-card-desc {
  display: block;
  font-size: 1.0625rem;
  color: var(--ect-ink-soft);
}

.ect-h-back {
  margin: 0 0 1rem;
  padding: 0.75rem 1.25rem;
  min-height: 3rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--ect-navy);
  background: var(--ect-paper);
  border: 1px solid var(--ect-navy);
  border-radius: 8px;
  cursor: pointer;
}

.ect-h-card-wip {
  background: var(--ect-muted-paper);
  color: var(--ect-ink-soft);
}

.ect-h-wip {
  padding: 1.5rem;
  margin-bottom: 1rem;
  background: var(--ect-paper);
  color: var(--ect-ink);
  border: 1px solid var(--ect-line);
  border-radius: 12px;
}

/* Starter chips: one quiet row under the cards; a chip may open follow-up chips in place */
.ect-h-starters {
  margin-top: 1rem;
}

.ect-h-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ect-h-chip {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.5rem 1.125rem;
  font: inherit;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  color: var(--ect-navy);
  background: var(--ect-paper);
  border: 1px solid var(--ect-line);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 120ms var(--ect-ease-out), border-color 120ms var(--ect-ease-out), transform 80ms var(--ect-ease-out);
}

.ect-h-chip:hover {
  background: var(--ect-navy-tint);
  border-color: var(--ect-navy);
}

.ect-h-chip:active {
  transform: translateY(1px);
}

.ect-h-chip:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.ect-h-chip-quiet {
  color: var(--ect-ink-soft);
  font-weight: 500;
  border-style: dashed;
}

.ect-h-chip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.ect-h-chip-path {
  min-width: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ect-navy);
  overflow-wrap: anywhere;
}

.ect-h-chip-question {
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--ect-ink);
}

html.dark .ect-h-chip-question,
html.dark .ect-h-chip-path {
  color: var(--ect-ink-on-dark);
}

@media (prefers-reduced-motion: reduce) {
  .ect-h-chip {
    transition: none;
  }
}

/* Modal form */
.ect-h-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: var(--ect-overlay);
}

.ect-h-modal {
  width: 100%;
  max-width: 40rem;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
  background: var(--ect-paper);
  border-radius: 12px;
  box-shadow: 0 1px 2px var(--ect-shadow);
}

.ect-h-modal h2 {
  margin: 0 0 1.25rem;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ect-ink);
}

.ect-h-field {
  margin: 0 0 1.25rem;
}

.ect-h-label {
  display: block;
  margin: 0 0 0.375rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--ect-ink);
}

.ect-h-input {
  display: block;
  width: 100%;
  min-height: 3rem;
  padding: 0.5rem 0.75rem;
  box-sizing: border-box;
  font-size: 1.125rem;
  color: var(--ect-ink);
  background: var(--ect-paper);
  border: 1px solid var(--ect-input-line);
  border-radius: 8px;
}

textarea.ect-h-input {
  min-height: 7rem;
  resize: vertical;
}

.ect-h-input[aria-invalid="true"] {
  border: 2px solid var(--ect-error);
}

.ect-h-example {
  margin: 0.375rem 0 0;
  font-size: 1.125rem;
  color: var(--ect-ink-soft);
}

.ect-h-error {
  margin: 0.375rem 0 0;
  font-weight: 600;
  color: var(--ect-error);
}

.ect-h-error:empty {
  display: none;
}

.ect-h-summary {
  margin: 0 0 1.25rem;
  font-size: 1.125rem;
  color: var(--ect-ink-soft);
}

.ect-h-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* Buttons */
.ect-h-btn {
  min-height: 3rem;
  min-width: 2.75rem;
  padding: 0.75rem 1.5rem;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.3;
  border: 1px solid var(--ect-navy);
  border-radius: 8px;
  cursor: pointer;
}

.ect-h-btn-primary {
  background: var(--ect-navy);
  color: var(--ect-paper);
}

.ect-h-btn-secondary {
  background: var(--ect-paper);
  color: var(--ect-navy);
}

.ect-h-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* Visible focus on every interactive element of ours, for keyboard users.
   Gold alone is under 3:1 on white (WCAG 1.4.11), so a navy ring sits inside it. */
.ect-h-card:focus-visible,
.ect-h-btn:focus-visible,
.ect-h-input:focus-visible,
.ect-h-back:focus-visible,
.ect-h-chip:focus-visible,
.ect-h-option input:focus-visible,
.ect-h-sent summary:focus-visible {
  outline: 3px solid var(--ect-focus);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--ect-navy);
}

/* Waiting banner */
.ect-h-wait {
  max-width: 48rem;
  margin: 0 auto 0.75rem;
  padding: 1rem 1.5rem;
  background: var(--ect-wait-paper);
  border: 1px solid var(--ect-wait-line);
  border-radius: 12px;
}

.ect-h-wait-text {
  margin: 0 0 0.75rem;
  font-size: 1.125rem;
  color: var(--ect-ink);
}

.ect-h-progress {
  height: 0.75rem;
  overflow: hidden;
  background: var(--ect-progress-track);
  border-radius: 999px;
}

.ect-h-progress-bar {
  height: 100%;
  background: var(--ect-navy);
  border-radius: 999px;
  transition: width 1s linear;
}

/* Blocks input while a job runs so a second request cannot be sent */
.ect-h-locked {
  pointer-events: none;
  opacity: .5;
}

/* The stop button lives inside the locked composer; the spec keeps it usable */
.ect-h-locked [data-testid="stop-generation-button"] {
  pointer-events: auto;
}

/* Done panel */
.ect-h-done {
  max-width: 48rem;
  margin: 1rem auto;
  padding: 1.25rem 1.5rem;
  background: var(--ect-paper);
  border: 1px solid var(--ect-line);
  border-radius: 12px;
  box-shadow: 0 1px 2px var(--ect-shadow);
}

/* Result buttons sit under the heading, read left to right, unlike the modal's right-aligned pair */
.ect-h-done .ect-h-actions {
  justify-content: flex-start;
}

.ect-h-done .ect-h-btn {
  margin: 0 0.75rem 0.75rem 0;
}

.ect-h-check {
  margin: 0.25rem 0 0.75rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--ect-ink);
}

.ect-h-sent summary {
  min-height: 2.75rem;
  display: flex;
  align-items: center;
  font-size: 1.125rem;
  color: var(--ect-navy);
  cursor: pointer;
}

/* display:flex drops the native disclosure triangle; without a marker nothing says it opens */
.ect-h-sent summary::after {
  content: '+';
  margin-left: 0.5rem;
  font-weight: 700;
}

.ect-h-sent[open] summary::after {
  content: '\2212';
}

/* ect-inject.css forces monospace on every pre; Thai in monospace is hard to read */
.ect-h-sent pre {
  margin: 0.5rem 0 0;
  padding: 0.75rem 1rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-family: "Sarabun", sans-serif !important;
  font-size: 1.125rem;
  color: var(--ect-ink);
  background: var(--ect-quiet-paper);
  border-radius: 8px;
}

/* Toast */
.ect-h-toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 10000;
  max-width: calc(100vw - 2rem);
  transform: translateX(-50%);
  padding: 1rem 1.5rem;
  font-size: 1.125rem;
  color: var(--ect-paper);
  background: var(--ect-ink);
  border-radius: 12px;
}

@media (max-width: 40rem) {
  .ect-h-cards {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Classes above set display, which would otherwise override the hidden attribute */
.ect-h-home [hidden],
.ect-h-modal [hidden],
.ect-h-done [hidden] {
  display: none !important;
}

/* Choice fields: large radio rows, one tap target per option */
.ect-h-choice {
  margin: 0 0 1.25rem;
  padding: 0;
  border: 0;
}

.ect-h-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ect-h-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0.5rem 1rem;
  font-size: 1.125rem;
  background: var(--ect-paper);
  border: 1px solid var(--ect-line);
  border-radius: 8px;
  cursor: pointer;
}

.ect-h-option.is-checked {
  border-color: var(--ect-navy);
  background: var(--ect-navy-tint);
  font-weight: 600;
}

.ect-h-option input {
  width: 1.25rem;
  height: 1.25rem;
}

.ect-h-other {
  margin-top: 0.5rem;
}

.ect-h-preview-text {
  font-family: inherit;
  white-space: pre-wrap;
}

.ect-h-handoff {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--ect-divider);
}

.ect-h-handoff-title {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
}

.ect-h-revise {
  margin-top: 1rem;
}

.ect-h-revise .ect-h-btn {
  margin-top: 0.75rem;
}
