:root {
  --primary-color: #075e54;
  --bubble-customer: #dcf8c6;
  --bubble-agent: #ffffff;
  --bg: #e5ddd5;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: #111;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.app-header {
  background: var(--primary-color);
  color: #fff;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex-shrink: 0;
}

.brand {
  font-weight: 600;
  font-size: 0.95rem;
}

.customer-name {
  font-size: 0.85rem;
  opacity: 0.9;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.divider {
  text-align: center;
  color: #555;
  font-size: 0.75rem;
  margin: 0.75rem 0;
}

.bubble {
  max-width: 78%;
  padding: 0.5rem 0.7rem;
  border-radius: 0.6rem;
  font-size: 0.92rem;
  line-height: 1.3;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
  word-wrap: break-word;
  white-space: pre-wrap;
}

.bubble.customer {
  align-self: flex-end;
  background: var(--bubble-customer);
  border-top-right-radius: 0;
}

.bubble.agent {
  align-self: flex-start;
  background: var(--bubble-agent);
  border-top-left-radius: 0;
}

.bubble .meta {
  display: block;
  font-size: 0.68rem;
  color: #667781;
  margin-top: 0.25rem;
  text-align: right;
}

.bubble.pending {
  opacity: 0.6;
}

.bubble.failed {
  border: 1px solid #c0392b;
}

.retry-btn {
  margin-top: 0.3rem;
  font-size: 0.75rem;
  background: none;
  border: 1px solid #c0392b;
  color: #c0392b;
  border-radius: 0.3rem;
  padding: 0.1rem 0.4rem;
  cursor: pointer;
}

.bubble img {
  max-width: 100%;
  border-radius: 0.4rem;
  display: block;
}

.bubble audio,
.bubble video {
  max-width: 100%;
}

.bubble a.file-link {
  color: var(--primary-color);
  font-weight: 600;
  text-decoration: underline;
}

.status-bar {
  text-align: center;
  padding: 0.4rem;
  font-size: 0.8rem;
  background: #fff3cd;
  color: #664d03;
}

.ended-banner {
  text-align: center;
  padding: 0.7rem 1rem;
  font-size: 0.85rem;
  background: #e2e3e5;
  color: #41464b;
  border-top: 1px solid #d3d6d8;
}

.composer {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem;
  background: #f0f0f0;
  flex-shrink: 0;
}

.icon-btn,
.send-btn {
  border: none;
  background: var(--primary-color);
  color: #fff;
  border-radius: 50%;
  width: 2.4rem;
  height: 2.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
}

.send-btn {
  border-radius: 1.2rem;
  width: auto;
  padding: 0 1rem;
  font-size: 0.9rem;
}

.text-input {
  flex: 1;
  border: none;
  border-radius: 1.2rem;
  padding: 0.6rem 1rem;
  font-size: 0.92rem;
}

.text-input:focus {
  outline: 2px solid var(--primary-color);
}

.icon-btn:disabled,
.send-btn:disabled,
.text-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.error-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  padding: 1.5rem;
  text-align: center;
  color: #444;
}
