/* =====================================================================================================================
   Ask Trace as a chat workspace (Krystyna 2026-10-08, reviewer #43 + #44; her reference: a call-review screen with a
   details row, the conversation on the left and an insights panel on the right). Trace's colours and type, not hers.
   Window: .win.win--chat. Left: the kit's <tr-ask> shown as a conversation (question = the asker's bubble, answer =
   Trace's bubble, sources under it). Right: askchat.js builds "How it formed" (decision card, evidence, one card per
   step) and "Sources" from the story data. The Map view is untouched.
   ===================================================================================================================== */

/* ---------- details row (replaces the crumb; the Answer | Map switch stays on the right) ---------- */
.win--chat .win__bar { min-height: 78px; padding: 12px 16px 12px 26px; gap: 20px; }
.cm { display: flex; align-items: center; gap: 0 34px; margin: 0; min-width: 0; font-family: var(--inter); }
.cm > div { display: grid; flex: none; gap: 5px; }
.cm { overflow-x: auto; scrollbar-width: none; }
.cm::-webkit-scrollbar { display: none; }
.cm dt { font-size: 12px; line-height: 1; color: var(--muted); }
.cm dd { display: flex; align-items: center; gap: 7px; margin: 0; font-size: 14.5px; font-weight: 500; line-height: 26px; color: var(--ink); white-space: nowrap; }
.cm dd img { width: 22px; height: 22px; border-radius: 50%; }
.cm__chip { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 13px; font-weight: 500; line-height: 1; }
.cm__chip svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cm__chip--type { background: color-mix(in srgb, var(--lilac) 42%, var(--white)); color: var(--lilac-ink); }
.cm__chip--ok { background: #E7F4EC; color: #1F6A42; }
.win--chat .viewtabs { flex: none; margin-left: auto; }

/* ---------- two white panels on a pale ground ---------- */
.win--chat .win__view--ask { display: block; background: #F6F5F2; }
.chat2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); gap: 14px; height: 100%; min-height: 0; padding: 14px; }
.chat2__conv, .chat2__panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; border-radius: 16px; background: var(--white);
  box-shadow: 0 0 0 1px var(--hair), 0 1px 2px rgb(17 17 17 / .03); }
.chat2__h { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 12px; height: 56px; padding: 0 22px; border-bottom: 1px solid var(--hair); font-family: var(--inter); }
.chat2__h h3 { margin: 0; font-size: 16px; font-weight: 550; letter-spacing: -.01em; color: var(--ink); }
.chat2__time { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.chat2__time svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.win--chat .chat2__thread { flex: 1; min-height: 0; overflow: auto; scrollbar-width: thin; }
.chat2__input { display: flex; flex: none; align-items: center; gap: 8px; margin: 10px 14px 14px; padding: 6px 6px 6px 18px; border-radius: 999px; background: var(--white);
  box-shadow: 0 0 0 1px var(--hair), 0 1px 2px rgb(17 17 17 / .04); }
.chat2__input input { flex: 1; min-width: 0; border: 0; background: none; font: 14px/1.4 var(--inter); color: var(--ink); outline: none; }
.chat2__input input::placeholder { color: var(--muted); }
.chat2__input button { display: grid; flex: none; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--ink); color: var(--white); cursor: pointer; }
.chat2__input button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chat2__input:focus-within { box-shadow: 0 0 0 1.5px var(--accent), 0 1px 2px rgb(17 17 17 / .04); }

/* ---------- the conversation: the kit's ask, restyled ---------- */
.win.win--chat .win__ask tr-ask { --tr-scale: 1; padding: 22px 22px 8px; }
.win.win--chat .tr-ask__panel--plain { background: none; box-shadow: none; }
.win.win--chat .tr-ask__inner { display: block; padding: 0; }
/* the question: the asker's bubble on the right, typed in as before */
.win.win--chat .tr-ask__query { width: fit-content; max-width: 80%; min-height: 0; margin-left: auto; padding: 12px 16px; border-radius: 18px 18px 6px 18px;
  background: var(--ink); color: var(--white); box-shadow: none; }
.win.win--chat .tr-ask__query::after, .win.win--chat .tr-ask__query::before { display: none; }
.win.win--chat :is(.tr-ask__mark, .tr-ask__hint, .tr-ask__send, .tr-ask__bar) { display: none; }
.win.win--chat .tr-ask__q { color: inherit; font: 15px/1.45 var(--inter); letter-spacing: -.003em; }
/* who said it, under each message (askchat.js adds these) */
.chat2__who { display: flex; align-items: center; gap: 8px; margin: 8px 2px 0; font: 13px/1 var(--inter); color: var(--muted); }
.chat2__who b { font-weight: 550; color: var(--ink); }
.chat2__who img, .chat2__who .chat2__tm { width: 22px; height: 22px; border-radius: 50%; }
.chat2__tm { display: block; border-radius: 7px !important; }
.chat2__who--me { justify-content: flex-end; }
/* the answer: Trace's bubble on the left, sources as a card under it */
.win.win--chat .tr-ask__body { margin-top: 26px; }
.win.win--chat .tr-ask__status { margin: 0 0 8px 2px; padding: 0; border: 0; font: 12.5px/1.2 var(--inter); color: var(--muted); }
.win.win--chat .tr-ask__scope { display: none; }
.win.win--chat .tr-ask__answer { max-width: 92%; margin: 0; padding: 14px 16px; border-radius: 18px 18px 18px 6px; background: color-mix(in srgb, var(--blue) 16%, var(--white));
  font: 15px/1.55 var(--inter); color: var(--ink); }
.win.win--chat .tr-ask__sources { max-width: 92%; margin: 10px 0 0; padding: 10px 12px 8px; border-radius: 14px; box-shadow: 0 0 0 1px var(--hair); }
.win.win--chat .tr-ask__trail, .win.win--chat .tr-ask__cta { display: none; }

/* ---------- right panel: How it formed | Sources ---------- */
.chat2__panel .chat2__h { padding: 0 12px; }
.fp__tabs { display: flex; gap: 4px; }
.fp__tabs button { height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: none; font: 500 14px/1 var(--inter); color: var(--graphite); cursor: pointer; }
.fp__tabs button:hover { background: rgb(17 17 17 / .05); }
.fp__tabs button[aria-selected=true] { background: var(--ink); color: var(--white); }
.fp__body { flex: 1; min-height: 0; overflow: auto; padding: 14px; scrollbar-width: thin; font-family: var(--inter); }
.fp__body[hidden] { display: none; }
.fp__insight { padding: 16px 18px 18px; border-radius: 14px; background: color-mix(in srgb, var(--lilac) 36%, var(--white)); }
.fp__ih { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 15px; font-weight: 600; color: var(--ink); }
.fp__mk { display: block; width: 28px; height: 28px; }
.fp__mk img { display: block; width: 28px; height: 28px; border-radius: 8px; }
.fp__it { margin: 12px 0 0; font-size: 16px; line-height: 1.45; color: var(--ink); text-wrap: pretty; }
.fp__is { margin: 8px 0 0; font-size: 12.5px; color: var(--graphite); }
.fp__score { display: flex; align-items: center; justify-content: space-between; margin: 14px 2px 12px; font-size: 15px; font-weight: 550; color: var(--ink); }
.fp__sv { display: inline-flex; align-items: center; gap: 10px; padding: 5px 10px 5px 12px; border-radius: 999px; background: #F3F2EF; font-size: 13.5px; font-weight: 500; }
.fp__sv b { font-size: 15px; font-weight: 650; }
.fp__dots { display: inline-flex; gap: 4px; }
.fp__dots i { width: 9px; height: 9px; border-radius: 50%; background: #3FA46A; }
.fp__dots i.is-off { background: none; box-shadow: inset 0 0 0 1.5px #A9D5B9; }
.fp__steps { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.fp__card { border-radius: 14px; box-shadow: 0 0 0 1px var(--hair); background: var(--white); }
.fp__ch { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 10px; width: 100%; padding: 12px 14px; border: 0; background: none; text-align: left; font: inherit; cursor: pointer; border-radius: 14px; }
.fp__ch:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.fp__d { grid-column: 1 / -1; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.fp__t { font-size: 14.5px; line-height: 1.38; color: var(--ink); text-wrap: pretty; }
.fp__chev { align-self: start; width: 18px; height: 18px; margin-top: 1px; color: var(--muted); transition: transform 220ms var(--ease-out); }
.fp__card.is-open .fp__chev { transform: rotate(180deg); }
.fp__chips { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.fp__chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px; background: #F3F2EF; font-size: 12.5px; color: var(--graphite); }
.fp__chip .tr-icon, .fp__chip svg { width: 13px; height: 13px; }
.fp__chip[data-k] { background: color-mix(in srgb, var(--k) 26%, var(--white)); color: var(--ink); }
.fp__chip--ok { background: #E7F4EC; color: #1F6A42; }
.fp__chip--ok svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fp__more { display: none; margin: 0 14px; padding: 10px 0 14px; border-top: 1px solid var(--hair); font-size: 13.5px; line-height: 1.5; color: var(--graphite); }
.fp__card.is-open .fp__more { display: block; }
.fp__more q { color: var(--ink); }
.fp__more p { margin: 0; }
.fp__more p + p { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.fp__src { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.fp__src li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 14px; box-shadow: 0 0 0 1px var(--hair); font-size: 14px; }
.fp__src .fp__n { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: color-mix(in srgb, var(--k) 38%, var(--white)); font-size: 12px; font-weight: 600; }
.fp__src b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp__src span { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.fp__src small { grid-column: 2 / -1; font-size: 12.5px; color: var(--muted); }

/* ---------- smaller screens: the panels stack, the details row scrolls sideways ---------- */
@media (max-width: 1199px) {
  .chat2 { grid-template-columns: minmax(0, 1fr); height: auto; }
  .win--chat .chat2__thread { max-height: none; }
  .chat2__panel .fp__body { max-height: none; }
}
@media (max-width: 899px) {
  .win--chat .win__bar { padding: 12px 14px; }
  .cm { flex: 1 1 100%; order: 2; gap: 0 24px; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 2px 14px; }
  .cm::-webkit-scrollbar { display: none; }
  .chat2 { padding: 8px; gap: 8px; }
  .win.win--chat .win__ask tr-ask { padding: 16px 14px 6px; }
  .win.win--chat .tr-ask__query { max-width: 90%; }
  .win.win--chat :is(.tr-ask__answer, .tr-ask__sources) { max-width: 100%; }
  .chat2__h { padding: 0 16px; }
}

/* bottom corners (owner 2026-10-09): the frame is .win::before (radius 14px); the filled views inside it were square
   at the bottom and covered the frame's curve */
.win--chat .win__view--ask { border-radius: 0 0 14px 14px; }
.win--chat .win__view--map .win__map { border-bottom-left-radius: 14px; }
@media (max-width: 1199px) { .win--chat .win__view--map .win__map { border-bottom-left-radius: 0; } }
@media (max-width: 899px) { .win--chat .win__view--map .win__map { border-radius: 0 0 14px 14px; } }
