.chat-page {
  height: 100%; max-width: 860px; margin: 0 auto; display: flex; flex-direction: column;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 14px 12px; border-bottom: 1px solid var(--line); }
.chat-head h1 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 20px; }
.chat-head .ghost { white-space: nowrap; flex: none; }
.chat-head .chat-title { min-width: 0; }
.welcome { display: flex; flex-direction: column; gap: 16px; padding-block: 8px 12px; }
.quick-hubs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 8px; }
.qh { display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 12px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); }
.qh:hover { border-color: var(--red); }
.qh b { display: block; font-size: 14px; }
.qh small { color: var(--muted); font-size: 12px; line-height: 1.4; display: block; }
.chat-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding-block: 16px; scroll-behavior: smooth; }

.chat-empty { margin: auto 0; display: flex; flex-direction: column; gap: 10px; padding-block: 20px; }
.chat-empty-title { margin: 0; font-family: var(--font-display); font-size: 22px; font-weight: 700; }
.chat-empty .muted { margin: 0; max-width: 60ch; }

.msg { display: flex; flex-direction: column; max-width: 88%; min-width: 0; }
.msg.user { align-self: flex-end; }
.msg.bot { align-self: flex-start; }
.bubble { padding: 12px 15px; border-radius: 18px; min-width: 0; overflow-wrap: anywhere; }
.user .bubble { background: linear-gradient(160deg, #2a0d14, #1a0a0e); border: 1px solid rgba(255, 43, 71, 0.45); border-bottom-right-radius: 6px; white-space: pre-wrap; }
.bot .bubble { background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 6px; display: flex; flex-direction: column; gap: 8px; animation: rise 0.3s ease-out; }
.bot .bubble > div { display: flex; flex-direction: column; gap: 8px; }
.bot .bubble p, .bot .bubble ul { margin: 0; }
.bot .bubble ul { padding-left: 20px; }
.bot .bubble li::marker { color: var(--red); }
.bot h4 { margin: 0; font-family: var(--font-display); font-size: 15px; font-weight: 700; }
.bot h5 { margin: 4px 0 0; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--red); font-weight: 500; }
.a-head { display: flex; flex-direction: column; gap: 2px; }
.lead-p { font-weight: 600; }
.bot details { border-top: 1px dashed var(--line-2); padding-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.bot summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600; }
.bot details[open] summary { margin-bottom: 6px; }
.meta { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 8px; }
.who { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.who-dot { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; background: #0b0a0d; border: 1px solid var(--red); color: var(--red); }
.who-tag { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line-2); }
.cmp { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 8px; }
.cmp-col { padding: 10px 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.cmp-col p { font-size: 13.5px; }
.ex-line { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }

.searching {
  align-self: flex-start; display: flex; align-items: center; gap: 8px; padding: 9px 13px; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--line); color: var(--muted); font-size: 13px; position: relative; overflow: hidden;
}
.searching > span { color: var(--red); display: grid; }
.scan { position: absolute; inset: auto 0 0 0; height: 2px; background: linear-gradient(90deg, transparent, var(--red), transparent); animation: scan 0.7s linear infinite; }
@keyframes scan { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }

.composer { padding-block: 10px 12px; border-top: 1px solid var(--line); }
.box { display: flex; align-items: flex-end; gap: 8px; padding: 6px 6px 6px 14px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line-2); transition: border-color 0.2s, box-shadow 0.2s; }
.box:focus-within { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.box textarea { flex: 1; min-width: 0; resize: none; border: 0; outline: none; background: transparent; padding: 10px 0; max-height: 140px; line-height: 1.45; font-size: 15px; }
.box textarea::placeholder { color: #6c6267; }
.composer-note { margin: 7px 0 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.composer-note > span { color: var(--red); display: grid; }
@media (max-width: 480px) { .msg { max-width: 96%; } }
