/* Formal conversation surface. The app imports this alongside styles/index.css. */
.te-chat-capture-bar { display:none; }
html[data-chat-capture] .te-shell[data-page="chat"], html[data-chat-capture] .te-shell[data-page="chat"] .te-shell__content,
html[data-chat-capture] .te-chat,html[data-chat-capture] .te-chat-viewport { height:auto;min-height:0;overflow:visible; }
html[data-chat-capture] .te-chat-header,html[data-chat-capture] .te-chat-composer,html[data-chat-capture] .te-chat-notice,
html[data-chat-capture] .te-chat-jump,html[data-chat-capture] .te-shell__nav { display:none!important; }
html[data-chat-capture] .te-chat-capture-bar { display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 18px;font-size:.75rem;color:var(--te-muted); }
.te-chat {
  position: relative; display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0;
  height: 100%; overflow: hidden; isolation: isolate;
  background: radial-gradient(ellipse at 92% 0, var(--te-wash-gold), transparent 47%),
    radial-gradient(ellipse at 5% 85%, var(--te-wash-blue), transparent 56%);
}
.te-chat button, .te-chat textarea, .te-chat-action { -webkit-tap-highlight-color: transparent; }
.te-chat-header {
  display: flex; align-items: center; gap: 2px; flex: 0 0 auto; min-height: 48px;
  padding: max(5px, var(--te-safe-top)) 12px 3px; z-index: 1;
}
.te-chat-identity { flex: 1; display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.te-chat-identity h1 { font: 400 1.3rem/1.2 var(--te-font-display); letter-spacing: .14em; margin: 0; white-space: nowrap; }
.te-chat-presence { font-size: .7rem; color: var(--te-faint); letter-spacing: .02em; }
.te-chat-presence[data-active="true"]::before { content: ""; display: inline-block; width: 4px; height: 4px; margin-right: 6px; border-radius: 50%; background: var(--te-success); }
.te-chat-icon {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: var(--te-touch); min-width: var(--te-touch); height: var(--te-touch); min-height: var(--te-touch);
  padding: 12px; border: 0; border-radius: 50%; color: var(--te-muted); background: transparent; cursor: pointer;
  transition: background var(--te-duration), color var(--te-duration);
}
.te-chat-icon svg { width: 20px; height: 20px; flex: 0 0 auto; }
.te-chat-icon:active { background: var(--te-wash-blue); color: var(--te-accent-strong); }
.te-chat-icon:disabled { color: var(--te-faint); opacity: .48; cursor: default; }
.te-chat-notice { flex: 0 0 auto; padding: 6px 22px; color: var(--te-muted); font-size: .76rem; text-align: center; background: var(--te-glass-soft); }
.te-chat-viewport {
  flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior-y: contain; overflow-anchor: none;
  scrollbar-width: thin; scrollbar-color: var(--te-line) transparent;
  padding: 8px max(18px, calc((100% - 800px) / 2)) 18px; scroll-padding: 20px;
}
.te-chat-feed { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.te-chat-older, .te-chat-text-button { border: 0; background: transparent; color: var(--te-accent); cursor: pointer; min-height: var(--te-touch); padding: 8px 10px; font-size: .78rem; }
.te-chat-older { display: block; margin: 0 auto 16px; }
.te-chat-older:disabled { color: var(--te-faint); cursor: progress; }
.te-chat-history-state { font: .82rem/1.7 var(--te-font-body); color: var(--te-muted); padding: 32px 16px; text-align: center; }
.te-chat-message { position: relative; display: flex; flex-direction: column; align-items: flex-start; width: 100%; min-width: 0; padding-left: 46px; box-sizing: border-box; }
.te-chat-message[data-sender="fire"] { padding-left: 0; padding-right: 46px; }
.te-chat-avatar { position:absolute; left:0; top:20px; width:38px; height:38px; border:1px solid var(--te-line); border-radius:14px; background:var(--te-glass); color:var(--te-accent); cursor:pointer; overflow:hidden; font: 1rem var(--te-font-display); padding:0; }
.te-chat-avatar::after { content:''; position:absolute; inset:-3px; }
.te-chat-avatar img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.te-chat-avatar[hidden] { display:none!important; }
.te-chat-message[data-sender="fire"] .te-chat-avatar { left:auto;right:0; }
.te-chat-message[data-sender="fire"] { align-items: flex-end; }
.te-chat-message[data-compact="true"] { margin-top: -12px; }
.te-chat-message[data-compact="true"] .te-chat-message__meta { display: none; }
.te-chat-message__meta { display: flex; align-items: baseline; gap: 9px; color: var(--te-faint); margin: 0 3px 6px; font-size: .66rem; }
.te-chat-message__author { color: var(--te-muted); font: .76rem/1.4 var(--te-font-display); letter-spacing: .08em; }
.te-chat-message__meta time { font-variant-numeric: tabular-nums; opacity: .84; }
.te-chat-bubble {
  width: fit-content; max-width: min(100%, 39rem); min-width: 30px; padding: 10px 14px;
  border: 1px solid var(--te-line-bright); border-radius: 6px 19px 19px 19px;
  background: var(--te-glass); box-shadow: 0 3px 16px rgb(60 91 112 / 4%);
}
.te-chat-message[data-sender="fire"] .te-chat-bubble {
  border-radius: 19px 6px 19px 19px; border-color: var(--te-line);
  background: linear-gradient(130deg, var(--te-wash-blue), var(--te-wash-gold)), var(--te-glass);
}
.te-chat-message[data-pending="true"] .te-chat-bubble { border-style: dashed; }
.te-chat-message[data-tombstone="true"] .te-chat-bubble { border: none; box-shadow: none; background: transparent; padding: 4px 0; color: var(--te-faint); font-size: .78rem; }
.te-chat-message__text { font-size: .96rem; line-height: 1.73; white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; -webkit-user-select: text; }
.te-chat-link { color: var(--te-accent-strong); text-decoration-color: var(--te-line); text-underline-offset: 3px; }
.te-chat-reference { display: block; text-align: left; max-width: 100%; min-height: var(--te-touch); margin: -3px 0 6px; padding: 8px 10px; background: var(--te-wash-blue); border: 0; border-left: 2px solid var(--te-champagne); border-radius: 6px; color: var(--te-muted); font-size: .74rem; cursor: pointer; }
.te-chat-message__foot { display: flex; align-items: center; gap: 2px; min-height: 16px; max-width: 90%; margin-top: -3px; }
.te-chat-message__delivery { color: var(--te-muted); font-size: .69rem; line-height: 1.5; }
.te-chat-message__menu { margin: -14px 0; opacity: .52; padding: 14px; }
.te-chat-message__menu svg { width: 17px; height: 17px; }
.te-chat-activity { width: min(86%, 39rem); margin: 0 0 6px; color: var(--te-muted); }
.te-chat-activity__label { display: flex; align-items: center; min-height: var(--te-touch); cursor: pointer; list-style: none; width: fit-content; font-size: .69rem; letter-spacing: .035em; opacity: .83; }
.te-chat-activity__label::-webkit-details-marker { display: none; }
.te-chat-activity__label::before { content: "◇"; color: var(--te-champagne); margin-right: 7px; font-size: .75rem; }
.te-chat-activity__label::after { content: "⌄"; margin-left: 8px; transition: transform var(--te-duration); }
.te-chat-activity[open] .te-chat-activity__label::after { transform: rotate(180deg); }
.te-chat-activity[data-running="true"] .te-chat-activity__label::before { color: var(--te-accent); animation: te-chat-breathe 2s ease-in-out infinite; }
.te-chat-activity__body { border-left: 1px solid var(--te-champagne); padding: 0 12px 3px; margin: 0 0 10px 3px; }
.te-chat-activity__entry + .te-chat-activity__entry { border-top: 1px solid var(--te-line); margin-top: 12px; padding-top: 10px; }
.te-chat-activity__source { font-size: .64rem; color: var(--te-faint); letter-spacing: .06em; }
.te-chat-activity__entry p { white-space: pre-wrap; overflow-wrap: anywhere; font: .81rem/1.8 var(--te-font-body); margin: 6px 0 3px; }
.te-chat-activity__entry[data-kind="authored"] p { font-family: var(--te-font-display); color: var(--te-ink); }
.te-chat-activity-bar { display: flex; flex-wrap: wrap; align-items: start; gap: 0 18px; width: min(86%, 39rem); }
.te-chat-activity-bar > details { width: auto; max-width: 100%; margin-bottom: 0; }
.te-chat-activity-bar > details[open] { flex-basis: 100%; }
.te-chat-activity--tools .te-chat-activity__label {
  max-width: 100%; overflow-wrap: anywhere; line-height: 1.5; padding: 3px 0;
}
.te-chat-activity--feel {
  margin-top: 10px; border: 1px solid var(--te-line-bright); border-radius: 7px 15px 15px 7px;
  background: linear-gradient(115deg, var(--te-wash-gold), transparent), var(--te-glass-soft);
  box-shadow: 0 3px 18px rgb(60 91 112 / 3%);
}
.te-chat-activity--feel .te-chat-activity__label {
  width: 100%; padding: 9px 14px; min-height: 44px; color: var(--te-muted);
  font: italic .9rem/1.5 var(--te-font-display); box-sizing: border-box;
}
.te-chat-activity--feel .te-chat-activity__label::before { content: '“'; font: 1.7rem/1 var(--te-font-display); }
.te-chat-activity--feel .te-chat-activity__label::after { margin-left: auto; }
.te-chat-activity--feel .te-chat-activity__body { margin: 0 14px 12px; padding: 0 12px; }
.te-chat-activity__entry[data-kind="feel"] p { font: .94rem/1.95 var(--te-font-display); color: var(--te-ink); }
.te-chat-activity--feel time { display: block; text-align: right; padding-top: 8px; }
.te-chat-activity--aside .te-chat-activity__entry p { font-size: .84rem; }
.te-chat-orphan-activity { margin: 22px 0 0; border-left: 1px solid var(--te-line); padding: 6px 12px; font-size: .76rem; color: var(--te-muted); white-space: pre-wrap; }
.te-chat-media { display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.te-chat-message__text:not([hidden]) + .te-chat-media:not([hidden]) { margin-top: 10px; }
.te-chat-media__item { min-width: 0; }
.te-chat-media__image-link { display: block; }
.te-chat-media__image { display: block; max-width: 100%; max-height: 420px; border-radius: 11px; object-fit: contain; background: var(--te-wash-blue); }
.te-chat-media__audio { display: block; width: min(280px, 66vw); height: 42px; max-width: 100%; }
.te-chat-media__name, .te-chat-media__loading { display: block; color: var(--te-muted); font-size: .7rem; margin-top: 4px; }
.te-chat-media__file { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--te-ink); min-height: var(--te-touch); max-width: 100%; font-size: .82rem; }
.te-chat-media__file svg { width: 20px; height: 20px; flex: 0 0 auto; color: var(--te-champagne); }
.te-chat-media__file small { white-space: nowrap; color: var(--te-faint); }
.te-chat-jump { position: absolute; align-self: center; bottom: calc(var(--te-chat-compose-height, 78px) + 8px); z-index: 2; min-height: var(--te-touch); border: 1px solid var(--te-line-bright); border-radius: 30px; padding: 8px 17px; background: var(--te-glass); backdrop-filter: blur(var(--te-glass-blur)); box-shadow: var(--te-shadow); color: var(--te-accent-strong); font-size: .75rem; cursor: pointer; }
.te-chat-composer { flex: 0 0 auto; width: min(100%, 850px); align-self: center; margin: 0; padding: 7px 12px max(10px, var(--te-safe-bottom)); background: linear-gradient(transparent, var(--te-bg) 45%); }
.te-chat-input-row { display: flex; align-items: flex-end; gap: 1px; padding: 5px; border: 1px solid var(--te-line-bright); border-radius: 27px; background: var(--te-glass); backdrop-filter: blur(var(--te-glass-blur)); -webkit-backdrop-filter: blur(var(--te-glass-blur)); box-shadow: 0 -4px 28px rgb(59 91 112 / 4%), var(--te-shadow); }
.te-chat-input { display: block; flex: 1; min-width: 0; width: 100%; min-height: var(--te-touch); max-height: 152px; padding: 10px 4px; border: none; outline: none; resize: none; color: var(--te-ink); background: transparent; font: .95rem/1.55 var(--te-font-body); overflow-y: auto; }
.te-chat-input::placeholder { color: var(--te-faint); font-size: .88rem; }
.te-chat-input:focus-visible { outline-offset: -2px; border-radius: 8px; }
.te-chat-send { border-radius: 50%; background: var(--te-accent-strong); color: var(--te-bg); }
.te-chat-send:active { background: var(--te-accent); color: var(--te-bg); }
.te-chat-send:disabled { background: var(--te-wash-blue); color: var(--te-faint); opacity: 1; }
.te-chat-draft-reference { display: flex; align-items: center; justify-content: space-between; margin: 0 8px 5px; border-left: 2px solid var(--te-champagne); border-radius: 0 10px 10px 0; background: var(--te-glass-soft); }
.te-chat-attachment-tray { display: flex; gap: 7px; overflow-x: auto; padding: 2px 3px 8px; }
.te-chat-attachment { flex: 0 0 auto; display: flex; align-items: center; max-width: min(300px, 82vw); border: 1px solid var(--te-line); border-radius: 14px; background: var(--te-glass); padding-left: 10px; }
.te-chat-attachment > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .73rem; }
.te-chat-composer-hint { font-size: .7rem; color: var(--te-error); padding: 6px 10px 0; }
.te-chat-action { display: flex; justify-content: flex-start; gap: 14px; width: 100%; height: auto; min-height: 48px; border-radius: 12px; padding: 10px 12px; color: var(--te-ink); font-size: .9rem; }
.te-chat-action svg { color: var(--te-muted); }
.te-chat-action-error { color: var(--te-error); font-size: .8rem; }
.te-chat-pending-files { font-size: .72rem; color: var(--te-muted); margin-top: 5px; }
.te-chat-source-context { display: flex; flex-direction: column; gap: 16px; }
.te-chat-source-caption { font-size: .75rem; color: var(--te-faint); }
.te-chat-source-anchor { border-left: 2px solid var(--te-champagne); padding-left: 10px; }
@keyframes te-chat-breathe { 0%, 100% { opacity: .42; } 50% { opacity: 1; } }
@media (min-width: 760px) { .te-chat-header { padding-right: max(22px, calc((100% - 850px) / 2)); padding-left: max(22px, calc((100% - 850px) / 2)); } .te-chat-bubble { max-width: min(80%, 39rem); } }
@media (prefers-reduced-motion: reduce) { .te-chat *, .te-chat *::before, .te-chat *::after { animation: none !important; transition: none !important; } }
:root[data-te-motion="reduced"] .te-chat *, :root[data-te-motion="reduced"] .te-chat *::before, :root[data-te-motion="reduced"] .te-chat *::after { animation: none !important; transition: none !important; }
