:root {
  --bg: #e5ddd5;
  --header: #075e54;
  --user-bubble: #dcf8c6;
  --bot-bubble: #ffffff;
  --text: #111b21;
  --muted: #667781;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 720px;
  margin: 0 auto;
  background: #efeae2;
  box-shadow: 0 0 24px rgba(0,0,0,.08);
}

.header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--header);
  color: #fff;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #128c7e;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.header h1 { margin: 0; font-size: 1rem; }
.status { margin: 2px 0 0; font-size: .8rem; opacity: .85; }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px 8px;
  background:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,.25), transparent 35%),
    radial-gradient(circle at 80% 0%, rgba(255,255,255,.2), transparent 30%),
    #e5ddd5;
}

.bubble {
  max-width: 85%;
  margin-bottom: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 1px 1px rgba(0,0,0,.06);
  animation: fadeIn .2s ease;
}

.bubble.user {
  margin-left: auto;
  background: var(--user-bubble);
  border-top-right-radius: 0;
}

.bubble.assistant {
  margin-right: auto;
  background: var(--bot-bubble);
  border-top-left-radius: 0;
}

.time {
  display: block;
  margin-top: 4px;
  font-size: .68rem;
  color: var(--muted);
  text-align: right;
}

.composer {
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: #f0f2f5;
  border-top: 1px solid #d1d7db;
}

.pin-input {
  width: 100%;
  margin-bottom: 6px;
  padding: 8px 10px;
  border: 1px solid #d1d7db;
  border-radius: 8px;
  font-size: .9rem;
}

.composer-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

textarea {
  flex: 1;
  resize: none;
  max-height: 120px;
  padding: 10px 12px;
  border: none;
  border-radius: 20px;
  font: inherit;
}

button {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--header);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
}

button:disabled { opacity: .5; cursor: not-allowed; }

.hint {
  margin: 6px 4px 0;
  font-size: .72rem;
  color: var(--muted);
}

.typing {
  opacity: .7;
  font-style: italic;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
