/* Chat layout — a framed app window inside the page */
.app { position: relative; max-width: 1200px; margin: 0 auto; display: flex; height: min(820px, calc(100svh - 64px)); min-height: 560px; border: 1px solid var(--line); border-radius: 28px; overflow: hidden; background: var(--bg); box-shadow: 0 30px 80px rgba(20, 26, 51, .10); }

/* Sidebar */
.side { width: 288px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 20px; overflow-y: auto; }
.agent { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 6px 10px; border: 0; border-radius: 12px; background: transparent; cursor: pointer; text-align: left; }
.agent:hover, .agent[aria-current="true"] { background: var(--surface-2); }
.agent-ic { width: 34px; height: 34px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); display: grid; place-items: center; flex-shrink: 0; color: var(--brand); }
.agent-ic .i { width: 18px; height: 18px; }
.agent span:last-child { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.agent strong { font-size: 14px; font-weight: 600; }
.agent small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; font-size: 13px; color: var(--ink-2); cursor: pointer; text-align: left; }
.recent-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-item .i { width: 15px; height: 15px; color: var(--muted); }
.recent-item:hover, .recent-item[aria-current="true"] { background: var(--surface-2); color: var(--ink); }
.recent-item.mine .i { color: var(--brand); }
.avatar-img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; object-position: 50% 8%; background: var(--brand-tint); flex-shrink: 0; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand span:last-child, .who span:last-child { display: flex; flex-direction: column; line-height: 1.3; }
.brand strong { font-size: 15px; }
.brand small, .who small { font-size: 12px; color: var(--muted); }
.new-chat { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--bg); font-size: 14px; font-weight: 500; cursor: pointer; text-align: left; }
.new-chat:hover { background: var(--surface-2); }
.side-label { margin: 0; font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 12px 6px; }
.side-list { display: flex; flex-direction: column; gap: 2px; }
.side-item { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; border-radius: 10px; border: 0; background: transparent; font-size: 14px; cursor: pointer; text-align: left; width: 100%; }
.side-item .i { color: var(--muted); }
.side-item:hover, .side-item[aria-current="true"] { background: var(--surface-2); }
.side-item.recent { font-size: 13px; color: var(--ink-2); min-height: 36px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; line-height: 36px; }
.side-empty { font-size: 13px; color: var(--muted); padding: 4px 12px; margin: 0; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 16px 12px 4px; border-top: 1px solid var(--line); }
.who { display: flex; align-items: center; gap: 10px; }
.who strong { font-size: 14px; }
.side-links { display: flex; gap: 16px; font-size: 13px; font-weight: 500; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn .i { width: 22px; height: 22px; }
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .32); z-index: 20; }

/* Main column */
.main { flex: 1; min-width: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; --col: 760px; }
.top { height: 56px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 var(--gutter-r) 0 var(--gutter-l); border-bottom: 1px solid var(--line); }
.top-title { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.top-title #title { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { font-size: 12px; color: var(--ok); background: var(--ok-tint); padding: 3px 8px; border-radius: 980px; font-weight: 500; white-space: nowrap; }
.top-link { font-size: 13px; font-weight: 500; min-height: 44px; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.scroll { position: relative; flex: 1; overflow-y: auto; padding: 0 var(--gutter-r) 0 var(--gutter-l); scroll-behavior: smooth; }
.thread { max-width: 760px; margin: 0 auto; padding: 40px 0 24px; display: flex; flex-direction: column; gap: 28px; }

/* Empty state */
.welcome { display: flex; flex-direction: column; gap: 32px; padding-top: 2vh; }
.welcome-photo { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; object-position: 50% 8%; background: var(--brand-tint); display: block; box-shadow: 0 0 0 4px var(--brand-tint); }
.welcome h1 { margin: 14px 0 0; font-size: clamp(32px, 4.4vw, 44px); line-height: 1.1; font-weight: 700; letter-spacing: -0.03em; }
.welcome h1 span { display: block; color: var(--muted); font-weight: 600; }
.welcome p { margin: 12px 0 0; font-size: 16px; color: var(--muted); max-width: 560px; }
.starters { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 12px; }
.starter { display: flex; flex-direction: column; gap: 6px; padding: 18px; min-height: 96px; border-radius: 18px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; text-align: left; transition: box-shadow .2s, border-color .2s; }
.starter:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); box-shadow: 0 6px 20px rgba(22, 24, 29, .06); }
.starter .i { color: var(--brand); width: 20px; height: 20px; }
.starter strong { font-size: 15px; }
.starter span { font-size: 13px; color: var(--muted); line-height: 1.4; }

/* Messages */
.msg { animation: rise .28s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg-user { display: flex; justify-content: flex-end; }
.bubble { max-width: 78%; background: var(--brand-tint); padding: 12px 18px; border-radius: 22px 22px 6px 22px; font-size: 16px; overflow-wrap: anywhere; }
.msg-bot { display: flex; gap: 14px; align-items: flex-start; }
.msg-bot .mark { margin-top: 2px; }
.answer { flex: 1; display: flex; flex-direction: column; gap: 16px; padding-top: 4px; }
.answer > p { margin: 0; font-size: 16px; line-height: 1.65; }
.follow { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }

.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.facts div { background: var(--bg); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.facts small { font-size: 12px; color: var(--muted); font-weight: 500; }
.facts strong { font-size: 14px; line-height: 1.4; }

.pcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr)); gap: 12px; }
.pcard { border: 1px solid var(--line); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; background: var(--bg); }
.pcard-top { height: 92px; display: grid; place-items: center; }
.pcard-top span { width: 44px; height: 44px; border-radius: 13px; background: var(--bg); display: grid; place-items: center; box-shadow: 0 4px 14px rgba(22, 24, 29, .08); }
.pcard-top .i { width: 22px; height: 22px; }
.pcard-body { padding: 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.pcard-body small { font-size: 12px; color: var(--muted); font-weight: 500; }
.pcard-body h3 { margin: 0; font-size: 17px; letter-spacing: -0.02em; }
.pcard-body p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.pcard-body a { margin-top: auto; padding-top: 6px; font-size: 13px; font-weight: 600; }
.tint-indigo { background: var(--tint-indigo); } .tint-green { background: var(--tint-green); } .tint-peach { background: var(--tint-peach); }

.tl { list-style: none; margin: 0; padding: 4px 0 0; }
.tl li { display: flex; gap: 16px; }
.tl-rail { display: flex; flex-direction: column; align-items: center; width: 12px; flex-shrink: 0; }
.tl-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--line-strong); margin-top: 5px; }
.tl li:first-child .tl-dot { background: var(--brand); box-shadow: 0 0 0 4px var(--brand-tint); }
.tl-line { flex: 1; width: 1px; background: var(--line); }
.tl li:last-child .tl-line { display: none; }
.tl-body { padding-bottom: 20px; display: flex; flex-direction: column; gap: 2px; }
.tl-body small { font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-body strong { font-size: 15px; }
.tl-body span { font-size: 13px; color: var(--muted); }

.skillset { display: flex; flex-direction: column; gap: 14px; }
.skillset h4 { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }

.filecard, .contact { border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; max-width: 480px; }
.filecard { display: flex; align-items: center; gap: 14px; }
.pdf { width: 44px; height: 52px; border-radius: 8px; background: var(--tint-peach); display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px; font-size: 10px; font-weight: 700; color: #c2410c; flex-shrink: 0; }
.filecard div { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.filecard strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filecard small { font-size: 12px; color: var(--muted); }
.contact { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.contact .row { display: flex; flex-wrap: wrap; gap: 8px; }
.contact .btn { min-height: 40px; font-size: 14px; padding: 0 16px; }
.contact .email-text { font-size: 13px; color: var(--muted); }

.typing { display: flex; gap: 14px; align-items: center; }
.dots { display: flex; gap: 5px; }
.dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1s infinite; }
.dots span:nth-child(2) { animation-delay: .15s; } .dots span:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: none; } 40% { opacity: 1; transform: translateY(-3px); } }

/* Composer */
.composer { flex-shrink: 0; padding: 12px var(--gutter-r) max(16px, env(safe-area-inset-bottom, 0px)) var(--gutter-l); }
.field { max-width: 760px; margin: 0 auto; display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line-strong); border-radius: 26px; padding: 6px 6px 6px 20px; box-shadow: var(--shadow); }
.field:focus-within { border-color: var(--brand); }
.field input { flex: 1; border: 0; outline: none; font: inherit; font-size: 16px; color: var(--ink); background: transparent; min-height: 44px; }
.field input::placeholder { color: var(--muted); }
#send { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; display: grid; place-items: center; cursor: pointer; flex-shrink: 0; }
#send:disabled { background: var(--line-strong); cursor: default; }
#send .i { width: 20px; height: 20px; stroke-width: 2; }
.hint { max-width: 760px; margin: 8px auto 0; font-size: 12px; color: var(--muted); text-align: center; }

.only-mobile { display: none; }
@media (max-width: 820px) {
  .only-mobile { display: grid; }
  .app { height: calc(100svh - 32px); min-height: 520px; border-radius: 22px; }
  .side { position: absolute; z-index: 30; top: 0; bottom: 0; left: 0; width: min(300px, 86%); transform: translateX(-102%); transition: transform .25s ease; box-shadow: 0 0 40px rgba(0, 0, 0, .18); }
  .side:not(.open) { visibility: hidden; transition: transform .25s ease, visibility 0s .25s; }
  .side.open { transform: none; }
  .scrim { position: absolute; }
  .top { padding-left: 8px; padding-right: 16px; }
  .top-link { display: none; }
  .scroll, .composer { padding-left: 16px; padding-right: 16px; }
  .composer { padding-bottom: 12px; }
  .welcome { padding-top: 0; gap: 24px; }
  .bubble { max-width: 88%; }
  .thread { padding-top: 24px; }
}
@media (max-width: 440px) {
  .facts { grid-template-columns: minmax(0, 1fr); }
  .badge { display: none; }
  .msg-bot { gap: 10px; }
}

/* Role cards in chat */
.rolecards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 12px; }
.rolecard { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 16px; border-radius: 18px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; text-align: left; transition: border-color .2s, box-shadow .2s; }
.rolecard:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); box-shadow: 0 6px 20px rgba(22, 24, 29, .06); }
.rolecard strong { font-size: 15px; margin-top: 4px; }
.rolecard span:not(.agent-ic) { font-size: 13px; color: var(--muted); line-height: 1.45; }
.rolecard em { font-style: normal; font-size: 13px; font-weight: 600; color: var(--brand); margin-top: auto; padding-top: 4px; }

/* ── Layout refinements: one shared centred column ── */
.chatbar { border-bottom: 1px solid var(--line); padding: 0 24px; background: color-mix(in srgb, var(--bg) 92%, transparent); }
.chatbar-in { max-width: var(--col); margin: 0 auto; height: 56px; display: flex; align-items: center; gap: 10px; }
.chatbar-title { flex: 0 1 auto; min-width: 0; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chatbar .badge { flex-shrink: 0; }
.chatbar-link { margin-left: auto; flex-shrink: 0; font-size: 13px; font-weight: 500; min-height: 44px; display: inline-flex; align-items: center; }
.scroll { padding: 0 24px; }
.thread { max-width: var(--col); }
.field, .hint { max-width: var(--col); }
.composer { padding: 12px 24px 16px; }

/* Calm scrollbars */
.side, .scroll { scrollbar-width: thin; scrollbar-color: transparent transparent; }
.side:hover, .scroll:hover { scrollbar-color: var(--line-strong) transparent; }
.side::-webkit-scrollbar, .scroll::-webkit-scrollbar { width: 8px; }
.side::-webkit-scrollbar-thumb, .scroll::-webkit-scrollbar-thumb { background: transparent; border-radius: 8px; }
.side:hover::-webkit-scrollbar-thumb, .scroll:hover::-webkit-scrollbar-thumb { background: var(--line-strong); }

/* Messages: consistent 32px avatar rail so text, cards and widgets share one left edge */
.msg-bot { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 14px; }
.msg-bot .answer { padding-top: 4px; }
.answer > p { font-size: 16px; line-height: 1.65; max-width: 68ch; }
.typing { display: grid; grid-template-columns: 32px auto; gap: 14px; }

/* Value-driven welcome */
.welcome { gap: 28px; padding-top: 3vh; }
.welcome-head { display: flex; align-items: center; gap: 16px; }
.welcome-head .welcome-photo { width: 56px; height: 56px; }
.welcome-kicker { font-size: 13px; line-height: 1.4; font-weight: 600; color: var(--ok); display: inline-flex; align-items: baseline; gap: 6px; }
.welcome-kicker::before { content: ""; flex-shrink: 0; width: 7px; height: 7px; border-radius: 50%; background: currentColor; transform: translateY(-1px); }
.welcome h1 { margin: 0; font-size: clamp(28px, 3.6vw, 40px); line-height: 1.12; letter-spacing: -0.03em; }
.welcome h1 span { display: inline; color: var(--muted); font-weight: 600; }
.welcome > p { margin: 0; font-size: 16px; color: var(--muted); max-width: 600px; }
.values { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.value { display: flex; flex-direction: column; gap: 8px; padding: 18px; border-radius: 20px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; text-align: left; transition: border-color .2s, box-shadow .2s, transform .2s; }
.value:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); box-shadow: 0 10px 28px rgba(20, 26, 51, .08); transform: translateY(-2px); }
.value .agent-ic { width: 36px; height: 36px; }
.value small { font-size: 12px; font-weight: 600; color: var(--brand); }
.value strong { font-size: 16px; line-height: 1.3; letter-spacing: -0.01em; }
.value span.v-proof { font-size: 13px; color: var(--muted); line-height: 1.45; }
.value em { margin-top: auto; padding-top: 6px; font-style: normal; font-size: 13px; font-weight: 600; color: var(--brand); }
.quick { display: flex; flex-wrap: wrap; gap: 8px; }
.quick-label { width: 100%; font-size: 12px; font-weight: 600; color: var(--muted); }
@media (max-width: 1100px) { .values { grid-template-columns: minmax(0, 1fr); } .value { flex-direction: row; flex-wrap: wrap; align-items: center; } .value .v-proof { flex-basis: 100%; } .value em { margin-left: auto; padding-top: 0; } }
@media (max-width: 820px) { .chatbar { padding: 0 12px; } .chatbar-link { display: none; } .scroll, .composer { padding-left: 16px; padding-right: 16px; } }

/* AI agents on the start screen */
.tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tools .quick-label { grid-column: 1 / -1; }
.tool { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 20px; border: 1px solid transparent; background: var(--brand-tint); color: var(--ink); cursor: pointer; text-align: left; transition: border-color .2s, transform .2s; }
.tool:hover { border-color: var(--brand); transform: translateY(-1px); }
.tool .agent-ic { width: 40px; height: 40px; flex-shrink: 0; background: var(--bg); color: var(--brand); }
.tool-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tool-txt strong { font-size: 16px; letter-spacing: -0.01em; }
.tool-txt strong i { font-style: normal; font-size: 10.5px; font-weight: 700; color: #fff; background: var(--brand); border-radius: 6px; padding: 2px 6px; margin-left: 4px; vertical-align: 2px; }
.tool-txt span { font-size: 13px; color: var(--muted); line-height: 1.4; }
.tool em { margin-left: auto; font-style: normal; font-weight: 600; color: var(--brand); }
@media (max-width: 700px) { .tools { grid-template-columns: minmax(0, 1fr); } }
