* { box-sizing: border-box; }

:root {
  --verde: #9baa24;
  --verde-oscuro: #74801b;
  --verde-muy-oscuro: #4d5613;
  --crema: #faf9f2;
  --texto: #2c2c1f;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--crema);
  color: var(--texto);
}

body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

header {
  background: linear-gradient(135deg, var(--verde-muy-oscuro), var(--verde-oscuro) 55%, var(--verde));
  color: white;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.marca {
  display: flex;
  align-items: center;
  gap: 12px;
}

header .logo {
  height: 38px;
  width: auto;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.25));
}

.titulos {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

header h1 {
  font-family: 'Poppins', 'Inter', sans-serif;
  font-size: 17px;
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.2px;
}

header .subtitulo {
  font-size: 11.5px;
  opacity: 0.85;
  font-weight: 400;
}

header button {
  background: rgba(255,255,255,0.18);
  border: none;
  color: white;
  font-size: 20px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

header button:hover {
  background: rgba(255,255,255,0.3);
}

main#chat {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background:
    radial-gradient(circle at 15% 0%, rgba(155,170,36,0.06), transparent 40%),
    var(--crema);
}

.msg {
  max-width: 85%;
  padding: 11px 15px;
  border-radius: 16px;
  line-height: 1.45;
  font-size: 15px;
  white-space: pre-wrap;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.msg.usuario {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--verde-oscuro), var(--verde));
  color: white;
  border-bottom-right-radius: 5px;
}

.msg.asistente {
  align-self: flex-start;
  background: white;
  color: var(--texto);
  border: 1px solid #ece8d8;
  border-bottom-left-radius: 5px;
}

.msg.error {
  align-self: center;
  background: #fdecea;
  color: #8a1f11;
  border: 1px solid #f5c6cb;
  font-size: 13px;
  border-radius: 12px;
}

.msg.cargando {
  align-self: flex-start;
  color: #8b8b6f;
  font-style: italic;
  background: transparent;
  box-shadow: none;
}

#estado-voz {
  text-align: center;
  font-size: 13px;
  color: var(--verde-oscuro);
  height: 18px;
  flex-shrink: 0;
  font-weight: 500;
}

footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: white;
  border-top: 1px solid #ece8d8;
  flex-shrink: 0;
}

footer input {
  flex: 1;
  border: 1px solid #ddd7bd;
  border-radius: 22px;
  padding: 11px 17px;
  font-size: 15px;
  outline: none;
  background: var(--crema);
  transition: border-color 0.15s ease;
}

footer input:focus {
  border-color: var(--verde);
}

footer button {
  border: none;
  background: linear-gradient(135deg, var(--verde-oscuro), var(--verde));
  color: white;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  font-size: 18px;
  flex-shrink: 0;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(116,128,27,0.35);
  transition: transform 0.1s ease;
}

footer button:active {
  transform: scale(0.94);
}

footer button#btn-mic.grabando {
  background: linear-gradient(135deg, #b23a2f, #d84f3e);
  animation: pulso 1s infinite;
}

@keyframes pulso {
  0% { box-shadow: 0 0 0 0 rgba(216,79,62,0.5); }
  70% { box-shadow: 0 0 0 12px rgba(216,79,62,0); }
  100% { box-shadow: 0 0 0 0 rgba(216,79,62,0); }
}
