:root {
  font-family: "Segoe UI", sans-serif;
  color: #252a28;
  background: #f3f2ee;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --muted: #909591;
  --line: #ededea;
  --green: #416e5b;
  --green-dark: #315443;
  --green-light: #e8f0eb;
  --coral: #e66f62;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button, input, textarea { font: inherit; }
button { color: inherit; }

.app-shell {
  width: min(1120px, calc(100% - 64px));
  height: min(780px, calc(100vh - 64px));
  min-height: 560px;
  margin: 32px auto;
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  overflow: hidden;
  background: #fff;
  border: 1px solid #eeede8;
  border-radius: 20px;
  box-shadow: 0 22px 80px #37352d12;
}

.sidebar { min-width: 0; display: flex; flex-direction: column; padding: 27px 20px 16px; border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: #2c463a; font: 800 19px "Segoe UI", sans-serif; letter-spacing: -.6px; }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 11px; background: var(--green); }
.brand-mark svg { width: 24px; fill: none; stroke: white; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.sidebar-heading { display: flex; justify-content: space-between; align-items: center; margin: 39px 0 15px; }
.sidebar-heading h1 { margin: 0; font: 700 14px "Segoe UI", sans-serif; }
.icon-button { width: 38px; height: 38px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 12px; background: transparent; cursor: pointer; color: #6d756f; transition: background .16s, color .16s; }
.icon-button:hover { background: #f2f4f1; color: var(--green-dark); }
.icon-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.new-chat-button { background: #f0f4f0; color: var(--green); }
.search-box { display: flex; height: 42px; align-items: center; gap: 9px; padding: 0 12px; border: 1px solid #efefec; border-radius: 10px; background: #fbfbfa; color: #929993; }
.search-box svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.search-box input { width: 100%; min-width: 0; padding: 0; outline: none; border: 0; background: transparent; color: #39413b; font-size: 12px; }
.search-box input::placeholder { color: #a2a7a3; }
.conversation-list { flex: 1; overflow-y: auto; margin: 15px -8px 12px; }
.conversation { width: 100%; display: flex; align-items: center; gap: 11px; padding: 11px 9px; border: 0; border-radius: 12px; background: transparent; text-align: left; cursor: pointer; }
.conversation.active { background: #f1f5f1; }
.avatar { position: relative; display: grid; width: 42px; height: 42px; flex: none; place-items: center; border-radius: 15px; color: #44644f; background: #e9eee5; font: 700 15px "Segoe UI", sans-serif; }
.avatar-sara { background: #f0e5d9; color: #9b6e4c; }
.avatar-self { width: 39px; height: 39px; border-radius: 14px; background: #e6eee8; }
.conversation-copy { min-width: 0; flex: 1; }
.conversation-copy strong, .conversation-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-copy strong { margin-bottom: 4px; font: 600 12px "Segoe UI", sans-serif; }
.conversation-copy span { color: #939a95; font-size: 11px; }
.conversation-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; }
.conversation-time { color: #a2a7a3; font-size: 10px; }
.unread-dot, .status-dot, .online-indicator { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--coral); }
.unread-dot { width: 8px; height: 8px; }
.profile-card { display: flex; align-items: center; gap: 10px; padding: 15px 3px 2px; border-top: 1px solid var(--line); }
.profile-copy { display: flex; flex: 1; flex-direction: column; gap: 3px; }
.profile-copy strong { font: 600 11px "Segoe UI", sans-serif; }
.profile-copy span { color: var(--muted); font-size: 10px; }
.online-indicator { background: #76a789; box-shadow: 0 0 0 3px #edf4ef; }

.chat-panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #fff; }
.chat-header { height: 77px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 30px; border-bottom: 1px solid var(--line); }
.chat-person { display: flex; align-items: center; gap: 11px; }
.chat-person-copy h2 { margin: 0 0 4px; font: 700 13px "Segoe UI", sans-serif; }
.chat-person-copy p { display: flex; align-items: center; gap: 6px; margin: 0; color: #939a95; font-size: 10px; }
.status-dot { width: 6px; height: 6px; background: #76a789; }
.header-actions { display: flex; gap: 4px; }
.notification-button { position: relative; }
.notification-button.has-unread::after { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border: 2px solid white; border-radius: 50%; background: var(--coral); content: ""; }
.demo-notice { display: flex; align-items: center; gap: 10px; margin: 18px 30px 4px; padding: 10px 12px; border: 1px solid #edf1ec; border-radius: 11px; background: #fafbf9; }
.demo-notice-icon { display: grid; width: 28px; height: 28px; flex: none; place-items: center; border-radius: 9px; background: #eaf1eb; color: var(--green); font-size: 15px; }
.demo-notice > span:nth-child(2) { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 2px; }
.demo-notice strong { font: 600 10px "Segoe UI", sans-serif; }
.demo-notice > span:nth-child(2) span { color: #909891; font-size: 9px; }
.demo-receive-button { flex: none; padding: 7px 9px; border: 0; border-radius: 8px; background: #edf3ee; color: var(--green-dark); font-size: 9px; font-weight: 600; cursor: pointer; }
.demo-receive-button:hover { background: #e0ebe2; }
.messages { min-height: 0; flex: 1; overflow: auto; padding: 22px 30px 25px; }
.day-divider { display: flex; align-items: center; gap: 12px; margin: 3px 0 24px; color: #a1a7a2; font-size: 9px; }
.day-divider::before, .day-divider::after { height: 1px; flex: 1; background: #f0f0ed; content: ""; }
.message-row { display: flex; align-items: flex-end; gap: 8px; margin: 13px 0; }
.message-row.mine { justify-content: flex-end; }
.message-avatar { width: 27px; height: 27px; display: grid; flex: none; place-items: center; border-radius: 10px; background: #f0e5d9; color: #9b6e4c; font: 700 10px "Segoe UI", sans-serif; }
.message-stack { max-width: min(75%, 390px); }
.message-bubble { padding: 11px 14px; border-radius: 4px 15px 15px 15px; background: #f4f5f2; color: #414742; font-size: 12px; line-height: 1.65; overflow-wrap: anywhere; white-space: pre-wrap; }
.mine .message-bubble { border-radius: 15px 4px 15px 15px; background: var(--green); color: white; }
.message-time { margin: 5px 3px 0; color: #a1a7a2; font-size: 9px; }
.mine .message-time { text-align: right; }
.message-audio { display: block; width: min(270px, 65vw); height: 38px; }
.message-bubble:has(.message-audio) { padding: 9px 12px; }
.empty-state { display: grid; height: 100%; min-height: 150px; place-content: center; text-align: center; }
.empty-state span { color: #b3bab4; font-size: 26px; }
.empty-state strong { margin-top: 10px; font: 600 12px "Segoe UI", sans-serif; }
.empty-state p { color: #9ca39d; font-size: 11px; }

.composer { flex: none; padding: 0 30px 17px; }
.composer-inner { padding: 12px 13px 10px; border: 1px solid #e8ebe6; border-radius: 13px; background: #fff; box-shadow: 0 5px 18px #303a2f08; }
.composer textarea { display: block; width: 100%; min-height: 38px; max-height: 115px; resize: none; padding: 4px 2px; border: 0; outline: none; color: #343b36; font-size: 12px; line-height: 1.55; }
.composer textarea::placeholder { color: #a8ada9; }
.composer-tools { display: flex; align-items: center; justify-content: space-between; }
.word-count { color: #a0a6a1; font-size: 9px; }
.word-count.over-limit { color: #c95046; }
.composer-actions { display: flex; align-items: center; gap: 7px; }
.record-button { width: 34px; height: 34px; border: 1px solid #ecefea; border-radius: 10px; }
.record-button.recording { color: #cb554b; background: #fff1ef; animation: pulse 1.2s infinite; }
.send-button { height: 34px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 0; border-radius: 10px; background: var(--green); color: white; font-size: 10px; font-weight: 600; cursor: pointer; }
.send-button:hover { background: var(--green-dark); }
.send-button:disabled { opacity: .45; cursor: not-allowed; }
.send-button svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.composer-status { min-height: 13px; margin: 6px 3px 0; color: #9da49e; font-size: 9px; }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px #fde5e1; } }

@media (max-width: 760px) {
  .app-shell { width: 100%; height: 100dvh; min-height: 480px; margin: 0; grid-template-columns: minmax(0, 1fr); border: 0; border-radius: 0; }
  .sidebar { display: none; }
  .chat-header { height: 68px; padding: 0 17px; }
  .demo-notice { margin: 12px 16px 0; }
  .messages { padding: 17px 16px 20px; }
  .composer { padding: 0 15px max(12px, env(safe-area-inset-bottom)); }
}
@media (max-width: 390px) {
  .demo-notice { gap: 7px; padding: 8px; }
  .demo-notice > span:nth-child(2) span { font-size: 8px; }
  .demo-receive-button { padding: 7px; font-size: 8px; }
  .more-button { display: none; }
}

[hidden] { display: none !important; }
.auth-panel { width: 100%; min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(100%, 390px); padding: 30px; border: 1px solid #eeede8; border-radius: 20px; background: #fff; box-shadow: 0 22px 80px #37352d12; }
.auth-brand { margin-bottom: 28px; }
.auth-card h1 { margin: 0 0 7px; color: #2c463a; font: 700 21px "Segoe UI", sans-serif; }
.auth-card > p { margin: 0 0 22px; color: #818983; font-size: 12px; line-height: 1.6; }
.auth-label { display: block; margin: 15px 0 6px; color: #454c47; font-size: 11px; font-weight: 600; }
.auth-input { width: 100%; height: 42px; padding: 0 11px; border: 1px solid #e8ebe6; border-radius: 9px; outline: none; background: #fbfbfa; color: #343b36; font-size: 12px; }
.auth-input:focus { border-color: #76927f; box-shadow: 0 0 0 3px #eaf1eb; }
.auth-submit { width: 100%; height: 42px; justify-content: center; margin-top: 20px; }
.auth-status { min-height: 17px; margin: 11px 0 0 !important; color: #a84b42 !important; font-size: 11px !important; }
.auth-toggle { display: block; margin: 8px auto 0; padding: 6px; border: 0; background: transparent; color: var(--green-dark); font-size: 11px; cursor: pointer; }
.logout-button { padding: 6px 8px; border: 0; border-radius: 7px; background: transparent; color: #7c847e; font-size: 10px; cursor: pointer; }
.logout-button:hover { background: #f2f4f1; color: var(--green-dark); }
.conversation-empty { padding: 13px 12px; color: #8e9690; font-size: 11px; line-height: 1.6; }
.send-button:disabled { opacity: .45; cursor: not-allowed; }
