:root {
  --tc-navy: #002060;
  --tc-lime: #bad839;
  --tc-blue: #0070c0;
  --tc-blue-hover: #005a99;
  --tc-gold: #ffc000;
  --tc-page: #ebf2f8;
  --tc-text: #262626;
  --tc-heading: #030213;
  --tc-white: #ffffff;
  --tc-border: rgb(0 0 0 / 10%);
  --tc-muted: #717182;
  --tc-hover: #e9ebef;
  --tc-disabled: #cbd5e1;
}

body {
  background: var(--tc-page);
}

/* Hide only Chainlit's own chrome, composer, and new-chat controls. */
#message-composer,
#chat-input,
#chat-submit,
.watermark,
#new-chat-button,
#new-chat-dialog,
button[aria-label*="New Chat" i],
button[title*="New Chat" i],
a[aria-label*="New Chat" i],
a[title*="New Chat" i],
[aria-label*="Create New Chat" i],
[title*="Create New Chat" i],
button[aria-label*="Toggle theme" i],
button[title*="Toggle theme" i] {
  display: none !important;
}

.step:has(.tc-page),
.message-content:has(.tc-page),
.inline-custom:has(.tc-page) {
  width: 100%;
}

.ai-message:has(.tc-page) {
  gap: 0 !important;
}

.ai-message:has(.tc-page) > .inline-block {
  display: none !important;
}

.tc-page {
  box-sizing: border-box;
  width: 100%;
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--tc-page);
  color: var(--tc-text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0;
}

.tc-page *,
.tc-page *::before,
.tc-page *::after {
  box-sizing: border-box;
}

.tc-shell {
  width: min(768px, 100%);
  height: min(600px, calc(100vh - 96px));
  min-height: 520px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--tc-white);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgb(0 0 0 / 10%);
}

.tc-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  background: var(--tc-navy);
  color: var(--tc-white);
}

.tc-topbar h1 {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 18px;
  line-height: 1.5;
  font-weight: 500;
  letter-spacing: 0;
}

.tc-brand-logo {
  width: clamp(118px, 19vw, 146px);
  height: auto;
  flex: 0 0 auto;
  display: block;
}

.tc-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.tc-topbar p {
  margin: 0;
  color: rgb(255 255 255 / 90%);
  font-size: 14px;
  line-height: 1.5;
  font-weight: 400;
}

.tc-intro {
  padding: 16px;
  border-bottom: 1px solid var(--tc-border);
  background: var(--tc-lime);
  color: var(--tc-heading);
}

.tc-intro h2 {
  margin: 0 0 4px;
  font-size: 16px;
  line-height: 1.5;
  font-weight: 500;
  letter-spacing: 0;
}

.tc-intro p {
  margin: 0;
  color: var(--tc-muted);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0;
}

.tc-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
}

.tc-progress {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 24px;
}

.tc-progress-bar {
  height: 8px;
  border-radius: 9999px;
  background: var(--tc-page);
}

.tc-progress-bar.is-active {
  background: var(--tc-blue);
}

.tc-question {
  margin-bottom: 16px;
}

.tc-question h2 {
  margin: 0 0 8px;
  color: var(--tc-heading);
  font-size: 16px;
  line-height: 1.5;
  font-weight: 500;
  letter-spacing: 0;
}

.tc-question p {
  margin: 0;
  color: var(--tc-muted);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0;
}

.tc-options {
  display: grid;
  gap: 8px;
}

.tc-option {
  width: 100%;
  min-height: 0;
  display: grid;
  gap: 2px;
  padding: 12px;
  border: 1px solid var(--tc-border);
  border-radius: 8px;
  background: var(--tc-white);
  color: var(--tc-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.tc-option:hover {
  background: var(--tc-hover);
}

.tc-option:focus-visible {
  outline: 3px solid rgb(0 112 192 / 16%);
  outline-offset: 2px;
}

.tc-option.is-selected {
  border-color: var(--tc-blue);
  box-shadow: 0 0 0 3px rgb(0 112 192 / 10%);
}

.tc-option-title {
  color: var(--tc-text);
  font-size: 16px;
  line-height: 1.5;
  font-weight: 500;
}

.tc-option-description {
  color: var(--tc-muted);
  font-size: 14px;
  line-height: 1.5;
  font-weight: 400;
}

.tc-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-top: 1px solid var(--tc-border);
  background: var(--tc-white);
}

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

.tc-back,
.tc-skip,
.tc-next {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  padding: 8px 16px;
  font: inherit;
  font-size: 16px;
  line-height: 1.5;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: 0;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    opacity 160ms ease;
}

.tc-back {
  border: 1px solid var(--tc-border);
  background: transparent;
  color: var(--tc-text);
}

.tc-back:hover {
  background: var(--tc-hover);
}

.tc-back.is-hidden {
  visibility: hidden;
  pointer-events: none;
}

.tc-skip {
  border: 1px solid transparent;
  background: transparent;
  color: var(--tc-muted);
}

.tc-skip:hover {
  background: var(--tc-hover);
}

.tc-next {
  border: 1px solid var(--tc-blue);
  background: var(--tc-blue);
  color: var(--tc-white);
}

.tc-next:hover:not(:disabled) {
  border-color: var(--tc-blue-hover);
  background: var(--tc-blue-hover);
}

.tc-next:disabled {
  border-color: var(--tc-disabled);
  background: var(--tc-disabled);
  cursor: not-allowed;
  opacity: 0.5;
}

.tc-header-icon,
.tc-icon-button {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition:
    background 160ms ease,
    opacity 160ms ease;
}

.tc-header-icon:hover {
  background: rgb(255 255 255 / 10%);
}

.tc-chat-shell {
  display: flex;
  flex-direction: column;
}

.tc-chat-banner {
  padding: 8px 16px;
  border-bottom: 1px solid var(--tc-border);
  background: var(--tc-lime);
}

.tc-chat-banner p {
  margin: 0;
  color: var(--tc-text);
  font-size: 14px;
  line-height: 1.5;
}

.tc-chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
}

.tc-chat-message {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.tc-chat-message.is-user {
  flex-direction: row-reverse;
}

.tc-avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--tc-blue);
  color: var(--tc-white);
}

.tc-avatar.is-user {
  background: var(--tc-gold);
}

.tc-chat-bubble {
  flex: 1;
  max-width: 610px;
  white-space: pre-line;
  border: 1px solid var(--tc-border);
  border-radius: 8px;
  padding: 16px;
  background: var(--tc-white);
  color: var(--tc-text);
  font-size: 14px;
  line-height: 1.5;
}

.tc-chat-message.is-user .tc-chat-bubble {
  flex: 0 1 auto;
}

.tc-bedrock-note {
  margin: 8px 0 0 52px;
  color: var(--tc-muted);
  font-size: 13px;
  line-height: 1.5;
}

.tc-chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 16px;
  border-top: 1px solid var(--tc-border);
  background: var(--tc-white);
}

.tc-chat-input {
  min-height: 60px;
  max-height: 120px;
  flex: 1;
  resize: none;
  border: 1px solid var(--tc-border);
  border-radius: 8px;
  padding: 8px 12px;
  background: #f3f3f5;
  color: var(--tc-text);
  font: inherit;
  font-size: 16px;
  line-height: 1.5;
}

.tc-chat-input:focus {
  border-color: var(--tc-blue);
  outline: 3px solid rgb(0 112 192 / 10%);
}

.tc-icon-button {
  flex: 0 0 40px;
  border: 1px solid transparent;
}

.tc-icon-button.is-primary {
  background: var(--tc-blue);
  color: var(--tc-white);
}

.tc-icon-button.is-primary:hover:not(:disabled) {
  background: var(--tc-blue-hover);
}

.tc-icon-button:disabled {
  background: var(--tc-disabled);
  cursor: not-allowed;
  opacity: 0.5;
}

@media (max-width: 640px) {
  .tc-page {
    min-height: calc(100vh - 56px);
    padding: 0;
  }

  .tc-shell {
    width: 100%;
    height: calc(100vh - 56px);
    min-height: 0;
    border-radius: 0;
  }

  .tc-topbar,
  .tc-intro,
  .tc-content,
  .tc-footer,
  .tc-chat-banner,
  .tc-chat-messages,
  .tc-chat-input-area {
    padding-left: 16px;
    padding-right: 16px;
  }

  .tc-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .tc-back.is-hidden {
    display: none;
  }

  .tc-actions {
    width: 100%;
    justify-content: space-between;
  }
}
