@font-face {
  font-family: Poppins;
  src: url('./fonts/poppins-regular.woff2') format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Poppins;
  src: url('./fonts/poppins-bold.woff2') format('woff2');
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}
:root {
  font-family: Poppins, ui-sans-serif, system-ui, sans-serif;
  color: #2e2a39;
  background: #f7f6f8;
  font-synthesis: none;
  --ink: #2e2a39;
  --muted: #746e7b;
  --purple: #6d388b;
  --purple-deep: #54286e;
  --purple-wash: #f1eaf5;
  --line: #e9e5ec;
  --panel: #fff;
  --canvas: #f7f6f8;
}
* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .52; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid #b48fc8;
  outline-offset: 2px;
}
.shell { height: 100dvh; min-height: 520px; display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
.topbar {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 30px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 5px 24px #2e2a3908;
  z-index: 2;
}
.brand { display: flex; align-items: center; gap: 11px; white-space: nowrap; color: var(--ink); }
.brand-mark {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border: 1.5px solid var(--purple);
  border-radius: 11px;
  color: var(--purple);
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
  transform: rotate(-5deg);
}
.brand-wordmark { font-size: 17px; line-height: 1.05; letter-spacing: .18em; font-weight: 700; }
.brand small { display: block; margin-top: 5px; font-size: 9px; letter-spacing: .19em; font-weight: 400; color: var(--purple); }
.top-actions { display: flex; align-items: center; gap: 18px; min-width: 0; }
.studio { font-size: 12px; color: var(--muted); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mode { display: flex; align-items: center; gap: 3px; padding: 4px; border: 1px solid #e7d9ee; border-radius: 13px; background: #f8f4fa; white-space: nowrap; }
.mode button, .mode span { display: inline-block; padding: 8px 13px; border: 0; border-radius: 9px; background: none; color: #766b7b; font-size: 11px; font-weight: 700; }
.mode .active { background: var(--purple); color: #fff; box-shadow: 0 3px 8px #6d388b25; }
.ghost, .primary { border-radius: 11px; padding: 10px 15px; font-weight: 700; font-size: 12px; transition: background .15s ease, transform .15s ease, box-shadow .15s ease; }
.ghost { border: 1px solid #e5dfeb; background: #fff; color: var(--purple); }
.ghost:hover:not(:disabled) { background: #f6f0f9; border-color: #d6c3e1; }
.primary { border: 1px solid var(--purple); background: var(--purple); color: #fff; box-shadow: 0 6px 14px #6d388b22; }
.primary:hover:not(:disabled) { background: var(--purple-deep); transform: translateY(-1px); box-shadow: 0 8px 18px #6d388b30; }
.content { display: grid; grid-template-columns: minmax(300px, 360px) minmax(0, 1fr); min-height: 0; }
.sidebar { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--panel); }
.sidebar-intro { padding: 30px 24px 14px; }
.eyebrow { display: block; color: var(--purple); font-size: 10px; font-weight: 700; letter-spacing: .16em; }
.sidebar-heading { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.sidebar-heading h1 { margin: 0; font-size: 29px; letter-spacing: -.055em; line-height: 1.25; }
.conversation-count { display: inline-grid; place-items: center; min-width: 27px; height: 25px; padding: 0 7px; border-radius: 8px; background: var(--purple-wash); color: var(--purple); font-size: 11px; font-weight: 700; }
.sidebar-intro p { margin: 7px 0 0; color: #89818f; font-size: 11px; }
.search-wrap { position: relative; margin: 12px 20px 15px; }
.search-icon { position: absolute; left: 15px; top: 12px; width: 15px; height: 15px; border: 1.8px solid #9f93aa; border-radius: 50%; pointer-events: none; }
.search-icon::after { content: ''; position: absolute; right: -5px; bottom: -3px; width: 7px; height: 1.8px; border-radius: 2px; background: #9f93aa; transform: rotate(45deg); }
.search { width: 100%; height: 43px; padding: 0 13px 0 40px; border: 1px solid var(--line); border-radius: 12px; outline: none; background: #fbfafc; color: var(--ink); font-size: 12px; }
.search::placeholder { color: #a49aa9; }
.search:focus { border-color: #ba9cca; box-shadow: 0 0 0 3px #6d388b12; background: #fff; }
.list { overflow: auto; flex: 1; padding: 0 10px 18px; scrollbar-color: #d6c7de transparent; }
.row { display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; min-height: 76px; padding: 12px 13px; border: 1px solid transparent; border-radius: 13px; background: transparent; color: inherit; transition: background .15s ease, border-color .15s ease; }
.row + .row { margin-top: 2px; }
.row:hover { background: #faf7fb; }
.row.selected { background: #f3edf7; border-color: #e8dcee; }
.avatar { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 13px; background: linear-gradient(145deg, #eadcf2, #f7f1fa); color: var(--purple); font-size: 12px; font-weight: 700; }
.row.selected .avatar { background: var(--purple); color: #fff; }
.row-content { display: block; min-width: 0; flex: 1; }
.row-head, .row-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.row-name { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-time { flex: none; font-size: 10px; color: #9a91a0; white-space: nowrap; }
.row-bottom { margin-top: 6px; }
.row-preview { min-width: 0; font-size: 11px; color: #8a8290; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { display: grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--purple); color: #fff; font-size: 10px; font-weight: 700; }
.main { display: flex; min-width: 0; min-height: 0; flex-direction: column; background: radial-gradient(circle at 78% 12%, #fdfaff 0, transparent 30%), var(--canvas); }
.empty { margin: auto; max-width: 350px; padding: 32px; text-align: center; color: var(--muted); }
.empty-mark { display: grid; place-items: center; width: 70px; height: 70px; margin: 0 auto 21px; border: 1px solid #e2d2eb; border-radius: 21px; background: #f1e8f5; color: var(--purple); font-size: 31px; box-shadow: 0 12px 24px #6d388b10; }
.empty h2 { margin: 0 0 8px; color: var(--ink); font-size: 19px; letter-spacing: -.03em; }
.empty p { margin: 0; font-size: 12px; line-height: 1.7; }
.thread-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 76px; padding: 13px 26px; border-bottom: 1px solid var(--line); background: #fff; }
.thread-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.thread-avatar { width: 39px; height: 39px; border-radius: 12px; }
.thread-identity > div { min-width: 0; }
.thread-head h2 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; letter-spacing: -.02em; }
.thread-head small { display: block; margin-top: 3px; color: #908795; font-size: 10px; }
.channel-pill { padding: 5px 9px; border: 1px solid #e7dcef; border-radius: 7px; background: #f9f5fb; color: var(--purple); font-size: 9px; font-weight: 700; letter-spacing: .08em; }
.thread-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.knowledge-trigger { border: 1px solid #d9c7e5; border-radius: 10px; padding: 9px 12px; background: #f8f1fb; color: var(--purple); font-size: 10px; font-weight: 700; }
.knowledge-trigger:hover { background: #f0e3f6; }
.knowledge-backdrop { position: fixed; inset: 0; z-index: 12; background: #24152d77; backdrop-filter: blur(3px); }
.knowledge-panel { position: fixed; z-index: 13; top: 16px; right: 16px; bottom: 16px; width: min(500px, calc(100vw - 32px)); display: flex; flex-direction: column; overflow: hidden; border: 1px solid #eadcf0; border-radius: 22px; background: #fff; box-shadow: 0 28px 90px #26162f50; }
.knowledge-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 25px 28px 21px; border-bottom: 1px solid var(--line); background: radial-gradient(circle at 91% 13%, #eee0f4, transparent 34%), #fff; }
.knowledge-header h2 { margin: 6px 0 0; font-size: 24px; letter-spacing: -.05em; line-height: 1.2; }
.knowledge-close { width: 31px; height: 31px; border: 1px solid #eadfed; border-radius: 10px; background: #fff; color: var(--purple); }
.knowledge-body { flex: 1; min-height: 0; overflow: auto; padding: 24px 28px; scrollbar-color: #d6c7de transparent; }
.knowledge-intro { display: flex; align-items: flex-start; gap: 14px; color: var(--ink); font-size: 11px; line-height: 1.7; }
.knowledge-sparkle { display: grid; place-items: center; flex: none; width: 39px; height: 39px; border-radius: 12px; background: var(--purple-wash); color: var(--purple); font-size: 19px; }
.knowledge-draft-button { width: 100%; margin-top: 22px; padding: 14px; border: 1px solid #d7bce5; border-radius: 12px; background: linear-gradient(115deg, #6d388b, #9866ac); color: #fff; font-size: 12px; font-weight: 700; box-shadow: 0 8px 22px #6d388b2b; }
.knowledge-draft-button:hover:not(:disabled) { filter: brightness(1.06); }
.knowledge-section-head { display: flex; align-items: center; gap: 9px; margin: 27px 0 5px; color: var(--purple); font-size: 14px; font-weight: 700; letter-spacing: -.02em; }
.knowledge-section-head.customer { margin-top: 31px; color: #506d58; }
.knowledge-section-icon { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 8px; background: #f0e5f5; font-size: 12px; }
.knowledge-section-head.customer .knowledge-section-icon { background: #e7f2e9; }
.knowledge-hint { margin: 13px 0 22px; color: var(--muted); font-size: 10px; line-height: 1.7; }
.knowledge-card { margin: 0 0 14px; padding: 16px; border: 1px solid #e8ddec; border-radius: 15px; background: #fdfbfe; box-shadow: 0 4px 16px #4d245c08; }
.customer-card { border-color: #d8e8dc; background: #fbfefb; }
.customer-card .knowledge-card-head { color: #506d58; }
.knowledge-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; color: var(--purple); font-size: 9px; font-weight: 700; letter-spacing: .14em; }
.knowledge-remove { border: 0; background: none; color: #8e8193; font-size: 10px; letter-spacing: 0; }
.knowledge-label { display: block; margin: 12px 0 0; color: var(--ink); font-size: 10px; font-weight: 700; }
.knowledge-input, .knowledge-answer { display: block; width: 100%; margin-top: 7px; padding: 11px 12px; border: 1px solid #e3d9e8; border-radius: 10px; outline: none; background: #fff; color: var(--ink); font-size: 11px; font-weight: 400; line-height: 1.5; }
.knowledge-select { display: block; width: 100%; margin-top: 7px; padding: 10px 12px; border: 1px solid #d8e8dc; border-radius: 10px; background: #fff; color: var(--ink); font-size: 11px; }
.knowledge-input:focus, .knowledge-answer:focus { border-color: #ac82bf; box-shadow: 0 0 0 3px #6d388b12; }
.knowledge-answer { min-height: 86px; resize: vertical; }
.knowledge-evidence { margin: 12px 0 0; padding: 9px 11px; border-left: 2px solid #bf9bd1; background: #f5edf8; color: #6a5d70; font-size: 10px; line-height: 1.6; }
.knowledge-add { width: 100%; padding: 12px; border: 1px dashed #c9acd8; border-radius: 11px; background: #fbf7fd; color: var(--purple); font-size: 11px; font-weight: 700; }
.customer-add { border-color: #a9cbb0; background: #f4faf5; color: #506d58; }
.knowledge-known { margin-bottom: 16px; padding: 13px 15px; border: 1px solid #dbe9dd; border-radius: 12px; background: #f7fbf7; }
.knowledge-known-title { color: #506d58; font-size: 9px; font-weight: 700; letter-spacing: .12em; }
.knowledge-known-fact { margin-top: 8px; color: #435348; font-size: 10px; line-height: 1.5; }
.knowledge-known-fact::before { content: '•'; margin-right: 7px; color: #70a17a; }
.knowledge-results { margin-bottom: 16px; }
.knowledge-result { margin: 7px 0; padding: 10px 12px; border-radius: 10px; background: #f2f7f0; color: #3f6843; font-size: 10px; line-height: 1.5; }
.knowledge-result.duplicate { background: #f4f0f8; color: var(--purple); }
.knowledge-result.conflict { background: #fff4ed; color: #9b5731; }
.knowledge-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 28px; border-top: 1px solid var(--line); background: #fff; }
.knowledge-footer span { max-width: 180px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.knowledge-footer .primary { flex: none; }
.profile-save { flex: 1; border: 1px solid #638e6c; border-radius: 11px; padding: 10px 14px; background: #638e6c; color: #fff; font-size: 11px; font-weight: 700; }
.profile-save:hover:not(:disabled) { background: #527b5b; }
.knowledge-footer .primary { flex: 1; font-size: 11px; }
.messages { flex: 1; min-height: 0; overflow: auto; padding: 24px clamp(18px, 5vw, 68px); display: flex; flex-direction: column; gap: 13px; scrollbar-color: #d8cbdf transparent; }
.day-divider { align-self: center; margin: 5px 0 9px; padding: 6px 12px; border: 1px solid #ece7ef; border-radius: 999px; background: #fff; color: #938a99; font-size: 10px; font-weight: 700; }
.message { max-width: min(76%, 570px); align-self: flex-start; padding: 12px 15px; border: 1px solid #ebe6ee; border-radius: 17px 17px 17px 5px; background: #fff; box-shadow: 0 3px 14px #2e2a3908; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 1.6; }
.message.has-photo { width: min(350px, 76%); }
.message.outbound { align-self: flex-end; border-color: #e2d3eb; border-radius: 17px 17px 5px 17px; background: #ede3f3; }
.message-text { max-width: 100%; }
.message .meta { display: block; margin-top: 8px; color: #928899; font-size: 9px; line-height: 1.4; }
.message.outbound .meta { color: #766781; }
.photo-frame { position: relative; width: min(320px, 100%); height: 240px; margin-top: 8px; border: 1px solid #e5dfea; border-radius: 12px; background: #f4f0f6; overflow: hidden; }
.message .photo-frame:first-child { margin-top: 0; }
.photo-link { display: block; width: 100%; height: 100%; cursor: zoom-in; }
.chat-image { display: block; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .18s ease; }
.photo-status { position: absolute; inset: 0; display: grid; place-items: center; color: #897c90; font-size: 11px; pointer-events: none; }
.photo-frame.image-ready .chat-image { opacity: 1; }
.photo-frame.image-ready .photo-status { display: none; }
.photo-frame.image-error .photo-link { display: none; }
.composer-wrap { flex: none; max-height: 44%; overflow: auto; padding: 16px 26px 18px; border-top: 1px solid var(--line); background: #fff; box-shadow: 0 -8px 24px #2e2a3905; }
.suggestion { margin-bottom: 13px; padding: 13px 15px; border: 1px solid #e7daee; border-left: 3px solid var(--purple); border-radius: 11px; background: #faf7fc; }
.suggestion strong { color: var(--purple); font-size: 11px; }
.suggestion p { margin: 7px 0 10px; font-size: 11px; line-height: 1.6; }
.suggestion .actions { display: flex; gap: 7px; flex-wrap: wrap; }
.suggestion button { padding: 7px 11px; font-size: 10px; }
.composer { display: flex; align-items: flex-end; gap: 10px; }
.composer textarea { resize: vertical; min-height: 66px; max-height: 180px; flex: 1; padding: 12px 14px; border: 1px solid #e2dce7; border-radius: 12px; background: #fbfafc; color: var(--ink); font-size: 12px; line-height: 1.5; outline: none; }
.composer textarea:focus { border-color: #b695c8; box-shadow: 0 0 0 3px #6d388b12; background: #fff; }
.composer textarea::placeholder { color: #a49baa; }
.composer .primary { min-width: 76px; height: 42px; }
.notice { margin: 0 0 11px; color: var(--purple); font-size: 11px; line-height: 1.5; }
.hint { margin: 8px 0 0; color: #aaa1ad; font-size: 9px; }
.center { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 15% 12%, #eee3f5 0, transparent 31%), radial-gradient(circle at 90% 85%, #f1e7f7 0, transparent 36%), #faf9fb; }
.sign-card { width: min(100%, 485px); padding: 39px; border: 1px solid #e9e2ed; border-radius: 22px; background: #fff; box-shadow: 0 24px 70px #6d388b13; }
.sign-brand { margin-bottom: 38px; }
.sign-card h1 { margin: 9px 0 12px; color: var(--ink); font-size: 28px; line-height: 1.25; letter-spacing: -.045em; }
.sign-card p { margin: 0; color: #807786; font-size: 12px; line-height: 1.8; }
.sign-card .primary { width: 100%; margin-top: 24px; padding: 13px; }
.error { margin: 15px 0 0; padding: 10px 12px; border: 1px solid #eacbd1; border-radius: 10px; background: #fff4f5; color: #a33b50; font-size: 11px; }
.toast { position: fixed; bottom: 18px; left: 50%; z-index: 10; transform: translateX(-50%); max-width: min(90vw, 500px); padding: 11px 16px; border-radius: 11px; background: var(--ink); color: #fff; box-shadow: 0 8px 24px #2e2a3930; font-size: 11px; text-align: center; }
.loading { padding: 24px 15px; color: #9b91a0; font-size: 11px; text-align: center; }
.load-more { display: block; margin: 14px auto; }
.mobile-back { display: none; }
@media (max-width: 760px) {
  .topbar { min-height: 70px; padding: 10px 14px; gap: 7px; }
  .brand { gap: 7px; }
  .brand-mark { width: 29px; height: 29px; border-radius: 9px; font-size: 16px; }
  .brand-wordmark { font-size: 12px; letter-spacing: .1em; }
  .brand small { font-size: 7px; letter-spacing: .11em; }
  .studio { display: none; }
  .top-actions { gap: 6px; }
  .mode { padding: 3px; }
  .mode button, .mode span { padding: 6px 7px; font-size: 9px; }
  .topbar .ghost { padding: 7px 8px; font-size: 9px; }
  .content { display: block; min-height: 0; }
  .sidebar, .main { height: 100%; }
  .sidebar { border-right: 0; }
  .shell.thread-open .sidebar { display: none; }
  .shell:not(.thread-open) .main { display: none; }
  .mobile-back { display: inline-block; padding: 7px 9px; font-size: 10px; }
  .thread-head { min-height: 65px; padding: 10px 13px; gap: 8px; }
  .thread-avatar { width: 34px; height: 34px; }
  .thread-head h2 { font-size: 12px; }
  .thread-head small { font-size: 9px; }
  .thread-actions { gap: 5px; }
  .thread-actions .channel-pill { display: none; }
  .knowledge-trigger { padding: 8px; font-size: 9px; }
  .knowledge-panel { inset: 0; width: 100%; border: 0; border-radius: 0; }
  .knowledge-header, .knowledge-body { padding-left: 18px; padding-right: 18px; }
  .knowledge-footer { padding: 13px 18px; }
  .knowledge-footer span { display: none; }
  .knowledge-footer .primary, .knowledge-footer .profile-save { width: 50%; padding: 11px 8px; font-size: 10px; }
  .messages { padding: 16px; gap: 11px; }
  .message { max-width: 89%; font-size: 11px; }
  .message.has-photo { width: min(350px, 89%); }
  .photo-frame { height: 210px; }
  .composer-wrap { padding: 11px 13px; max-height: 48%; }
  .composer textarea { min-height: 60px; }
  .hint { display: none; }
}
@media (max-width: 390px) {
  .mode button, .mode span { padding: 5px 6px; font-size: 8px; }
  .brand-wordmark { font-size: 10px; }
  .topbar .ghost { font-size: 8px; padding: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
