:root {
  --ink: #332338;
  --muted: #88708e;
  --line: #eadfea;
  --paper: #fbf8fb;
  --panel: #ffffff;
  --accent: #80498b;
  --accent-dark: #67386f;
}

* { box-sizing: border-box; }
html, body { width: 100%; min-width: 320px; height: 100%; overflow: hidden; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: "Poppins", sans-serif; }
button, textarea { font: inherit; }
button { cursor: pointer; }
.page-shell { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.topbar { flex: 0 0 76px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(18px, 5vw, 72px); border-bottom: 1px solid var(--line); background: var(--panel); }
.brand { color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; }
.brand em { color: var(--accent); font-style: normal; }
.brand-logo { display: block; width: 152px; height: auto; }
.brand-mark, .avatar { display: inline-grid; place-items: center; color: #fff; background: var(--accent); font-family: Georgia, serif; font-weight: 700; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px 9px 9px 2px; font-size: 20px; }
.topbar-actions { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 11px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #38a46d; box-shadow: 0 0 0 4px #e1f3e9; }
.back-button { margin-left: 20px; color: var(--accent); font-weight: 700; text-decoration: none; }
.back-button:hover { color: var(--accent-dark); }
.workspace { width: min(100%, 980px); min-height: 0; flex: 1; display: flex; align-items: stretch; margin: 0 auto; padding: 28px clamp(14px, 4vw, 40px); }
.chat-panel { width: 100%; min-height: 0; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: 0 18px 50px rgba(76, 43, 133, .08); }
.chat-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 25px 30px 22px; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 7px; color: var(--accent); font-size: 10px; letter-spacing: .18em; font-weight: 700; }
.website-button { display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 6px; color: #fff; background: var(--accent); font-size: clamp(13px, 1.8vw, 15px); font-weight: 700; text-decoration: none; transition: background .2s, transform .2s; }
.website-button:hover { background: var(--accent-dark); transform: translateY(-1px); }
.website-button span { font-size: 18px; line-height: 1; }
.clear-button { padding: 5px 0; color: var(--muted); background: none; border: 0; font-size: 11px; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.messages { flex: 1 1 auto; min-width: 0; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 34px 30px 22px; }
.message { display: flex; gap: 12px; max-width: 86%; min-width: 0; margin-bottom: 25px; }
.avatar { flex: 0 0 34px; width: 34px; height: 34px; border-radius: 10px 10px 10px 3px; font-size: 19px; }
.message-body { min-width: 0; overflow-wrap: anywhere; font-size: 14px; line-height: 1.65; }
.message-body p { margin: 0; }
.table-wrap { max-width: 100%; margin: 14px 0; overflow-x: auto; overflow-y: hidden; border: 1px solid #d8c8dc; border-radius: 8px; background: #fff; -webkit-overflow-scrolling: touch; }
.response-table { width: max-content; min-width: 100%; border-collapse: collapse; color: var(--ink); font-size: 12px; line-height: 1.5; }
.response-table th, .response-table td { padding: 10px 12px; border-right: 1px solid #e4dbe6; border-bottom: 1px solid #e4dbe6; text-align: left; vertical-align: top; }
.response-table th:last-child, .response-table td:last-child { border-right: 0; }
.response-table tr:last-child td { border-bottom: 0; }
.response-table th { color: #fff; background: var(--accent); font-weight: 700; white-space: nowrap; }
.response-table tbody tr:nth-child(even) { background: #faf6fb; }
.response-table tbody tr:hover { background: #f2eaf4; }
.message-name { margin-bottom: 5px !important; font-size: 11px; font-weight: 700; }
.message-name span { margin-left: 7px; color: #b3a9c1; font-weight: 400; }
.user-message { margin-left: auto; flex-direction: row-reverse; }
.user-message .message-body { padding: 11px 15px; color: #fff; background: var(--accent); border-radius: 16px 4px 16px 16px; }
.user-message .message-name { display: none; }
.chat-form { flex: 0 0 auto; z-index: 2; margin: 0 18px 18px; padding: 14px 16px 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, .98); box-shadow: 0 -8px 18px rgba(76, 43, 133, .06); }
.chat-form textarea { width: 100%; min-height: 30px; resize: none; border: 0; outline: 0; color: var(--ink); font-size: 14px; line-height: 1.5; }
.chat-form textarea::placeholder { color: #b7acbf; }
.composer-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.composer-note { color: #aa9db7; font-size: 10px; }
.send-button { padding: 10px 15px; border: 0; border-radius: 6px; color: #fff; background: var(--accent); font-size: 12px; font-weight: 700; white-space: nowrap; transition: background .2s, transform .2s; }
.send-button:hover { background: var(--accent-dark); transform: translateY(-1px); }
.send-button span { padding-left: 7px; font-size: 14px; }
.loading { color: var(--muted); font-style: italic; }
@media (max-width: 560px) {
  .topbar { flex-basis: 66px; }
  .brand { font-size: 15px; }
  .brand-logo { width: 128px; }
  .topbar-actions { font-size: 0; }
  .back-button { margin-left: 12px; font-size: 10px; }
  .workspace { padding: 0; }
  .chat-panel { min-height: 0; border: 0; border-radius: 0; box-shadow: none; }
  .chat-header { padding: 22px 18px 18px; }
  .messages { flex: 1 1 auto; max-height: none; padding: 26px 18px 16px; }
  .message { max-width: 92%; }
  .chat-form { margin: 0 12px 12px; }
  .composer-note { max-width: 190px; }
}
