/* Advisor chat markdown prose — scoped TNT-style rendering */
.th-advisor-prose,
.th-advisor-msg .tnt-markdown.tnt-prose {
  line-height: 1.62;
  max-width: 100%;
  word-break: break-word;
  overflow-wrap: anywhere;
  color: var(--th-text);
}

.th-advisor-prose > :first-child,
.th-advisor-msg .tnt-markdown.tnt-prose > :first-child {
  margin-top: 0 !important;
}

.th-advisor-prose > :last-child,
.th-advisor-msg .tnt-markdown.tnt-prose > :last-child {
  margin-bottom: 0 !important;
}

.th-advisor-prose p,
.th-advisor-prose .ai-paragraph,
.th-advisor-msg .tnt-prose p,
.th-advisor-msg .tnt-prose .ai-paragraph {
  margin: 0 0 1.1rem;
}

.th-advisor-prose .ai-paragraph + .ai-paragraph,
.th-advisor-msg .tnt-prose .ai-paragraph + .ai-paragraph {
  margin-top: 0.35rem;
}

.th-advisor-prose h1,
.th-advisor-prose h2,
.th-advisor-prose h3,
.th-advisor-prose h4,
.th-advisor-prose .ai-header,
.th-advisor-msg .tnt-prose h1,
.th-advisor-msg .tnt-prose h2,
.th-advisor-msg .tnt-prose h3,
.th-advisor-msg .tnt-prose .ai-header {
  margin: 0.75rem 0 0.4rem;
  line-height: 1.25;
  font-weight: 650;
  color: var(--th-text);
  font-size: 1rem;
}

.th-advisor-prose h2,
.th-advisor-msg .tnt-prose h2 {
  font-size: 1.05rem;
}

.th-advisor-prose ol,
.th-advisor-prose .ai-ordered-list,
.th-advisor-msg .tnt-prose ol,
.th-advisor-msg .tnt-prose .ai-ordered-list {
  margin: 0.55rem 0 1rem;
  padding-left: 1.65rem;
  list-style-position: outside;
}

.th-advisor-prose ul,
.th-advisor-prose .ai-unordered-list,
.th-advisor-msg .tnt-prose ul,
.th-advisor-msg .tnt-prose .ai-unordered-list {
  margin: 0.55rem 0 1rem;
  padding-left: 1.45rem;
}

.th-advisor-prose li,
.th-advisor-msg .tnt-prose li,
.th-advisor-prose .ai-list-item,
.th-advisor-msg .tnt-prose .ai-list-item {
  margin: 0.45rem 0;
  padding-left: 0.15rem;
  line-height: 1.5;
}

.th-advisor-prose .ai-action-list,
.th-advisor-msg .tnt-prose .ai-action-list {
  margin: 0.65rem 0 1.1rem;
  padding: 0.65rem 0.85rem 0.65rem 2rem;
  border: 1px solid rgba(0, 204, 255, 0.18);
  border-radius: 10px;
  background: rgba(0, 204, 255, 0.05);
}

.th-advisor-prose .ai-section-break,
.th-advisor-msg .tnt-prose .ai-section-break {
  margin-top: 1.15rem !important;
  padding-top: 0.15rem;
  border-top: 1px solid var(--th-border-soft);
}

.th-advisor-prose .ai-lead,
.th-advisor-msg .tnt-prose .ai-lead {
  font-size: 1.02rem;
  line-height: 1.58;
  color: var(--th-text);
}

.th-advisor-prose blockquote,
.th-advisor-prose .ai-blockquote,
.th-advisor-msg .tnt-prose blockquote {
  margin: 0.55rem 0;
  padding: 0.45rem 0.75rem;
  border-left: 3px solid var(--th-accent);
  background: rgba(0, 204, 255, 0.08);
  border-radius: 4px;
}

.th-advisor-prose a,
.th-advisor-msg .tnt-prose a {
  color: var(--th-accent);
  font-weight: 600;
}

.th-advisor-prose code,
.th-advisor-prose .ai-inline-code,
.th-advisor-msg .tnt-prose code {
  background: rgba(0, 0, 0, 0.35);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

.th-advisor-prose pre,
.th-advisor-msg .tnt-prose pre {
  margin: 0.5rem 0;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.35);
  overflow-x: auto;
  font-size: 0.9em;
}

.th-advisor-prose hr,
.th-advisor-msg .tnt-prose hr {
  border: none;
  border-top: 1px solid var(--th-border-soft);
  margin: 0.85rem 0;
}

.th-advisor-prose table,
.th-advisor-msg .tnt-prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.9em;
}

.th-advisor-prose th,
.th-advisor-prose td,
.th-advisor-msg .tnt-prose th,
.th-advisor-msg .tnt-prose td {
  border: 1px solid var(--th-border-soft);
  padding: 6px 8px;
}

.th-advisor-prose th,
.th-advisor-msg .tnt-prose th {
  background: rgba(255, 255, 255, 0.05);
}

.th-advisor-prose strong,
.th-advisor-msg .tnt-prose strong {
  color: var(--th-text);
}

/* Repair workflow strip — box → arrow → box */
.th-advisor-flow {
  margin: 0 0 1rem;
  padding: 0.85rem 0.75rem;
  border: 1px solid var(--th-border-soft);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
}

.th-advisor-flow-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--th-muted);
  margin-bottom: 0.65rem;
}

.th-advisor-flow-track {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.35rem 0.25rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.th-advisor-flow-step {
  flex: 1 1 8.5rem;
  min-width: 7.5rem;
  padding: 0.55rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--th-border-soft);
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.th-advisor-flow-step.is-active {
  border-color: var(--th-accent);
  box-shadow: 0 0 0 1px rgba(0, 204, 255, 0.25);
  background: rgba(0, 204, 255, 0.08);
}

.th-advisor-flow-step-num {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--th-accent);
}

.th-advisor-flow-step-label {
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--th-text);
}

.th-advisor-flow-arrow {
  align-self: center;
  color: var(--th-muted);
  font-size: 1rem;
  padding: 0 0.15rem;
}

.th-advisor-site-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.85rem 0 0.15rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--th-border-soft);
}

.th-advisor-site-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.42rem 0.72rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 204, 255, 0.24);
  background: rgba(0, 204, 255, 0.06);
  color: var(--th-accent);
  font-size: 0.8rem;
  font-weight: 650;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.th-advisor-site-link-icon {
  font-size: 0.72rem;
  opacity: 0.85;
}

.th-advisor-site-link-label {
  line-height: 1.2;
}

.th-advisor-site-link:hover {
  border-color: rgba(0, 204, 255, 0.45);
  background: rgba(0, 204, 255, 0.12);
  color: var(--th-text);
}

@media (max-width: 640px) {
  .th-advisor-flow-track {
    flex-direction: column;
  }
  .th-advisor-flow-arrow {
    transform: rotate(90deg);
    align-self: flex-start;
    margin-left: 0.75rem;
  }
}

/* Floating advisor panel is always narrow — stack workflow vertically */
.th-advisor-float-panel .th-advisor-flow-track,
.th-service-advisor--floating .th-advisor-flow-track {
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  overflow-x: visible;
}

.th-advisor-float-panel .th-advisor-flow-step,
.th-service-advisor--floating .th-advisor-flow-step {
  flex: none;
  min-width: 0;
  width: 100%;
}

.th-advisor-float-panel .th-advisor-flow-arrow,
.th-service-advisor--floating .th-advisor-flow-arrow {
  transform: rotate(90deg);
  align-self: center;
  margin-left: 0;
}

@media (min-width: 768px) {
  .th-advisor-float-panel .th-advisor-flow-step-label,
  .th-service-advisor--floating .th-advisor-flow-step-label {
    font-size: 0.88rem;
  }
}

.th-advisor-msg:has(.th-advisor-flow),
.th-advisor-msg.th-advisor-msg--has-flow {
  max-width: 100%;
}
