* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #ece5dd;
  color: #1a1a1a;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.marca-kronos {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  background: #ffffff;
  border-bottom: 1px solid #e7e4dc;
  font-weight: 700;
  font-size: 14px;
  color: #1a1a1a;
  letter-spacing: 0.01em;
}

.marca-accent {
  color: #0f6e56;
}

.topbar {
  background: #075e54;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
}

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

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #25d366;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 18px;
}

.topbar h1 {
  font-size: 16px;
  margin: 0;
}

.topbar p {
  font-size: 12px;
  margin: 0;
  opacity: 0.85;
}

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

.badge {
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.btn-reset {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}

.btn-reset:hover {
  background: rgba(255, 255, 255, 0.1);
}

.negocio-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 20px;
  background: #f7f5f0;
  border-bottom: 1px solid #ddd;
}

.btn-negocio {
  background: white;
  border: 1px solid #ccc;
  color: #444;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
}

.btn-negocio.activo {
  background: #075e54;
  border-color: #075e54;
  color: white;
}

.ficha-campo.oculto {
  display: none;
}

.layout {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.chat-panel {
  flex: 1 1 60%;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.mensajes {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mensaje {
  max-width: 70%;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.4;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

.mensaje.user {
  align-self: flex-end;
  background: #dcf8c6;
  border-bottom-right-radius: 2px;
}

.mensaje.assistant {
  align-self: flex-start;
  background: white;
  border-bottom-left-radius: 2px;
}

.banner-escalado {
  background: #fdecea;
  color: #b3261e;
  text-align: center;
  padding: 8px;
  font-size: 13px;
}

.form-chat {
  display: flex;
  gap: 8px;
  padding: 12px;
  background: #f0f0f0;
}

.form-chat input {
  flex: 1;
  padding: 10px 14px;
  border: none;
  border-radius: 999px;
  font-size: 14px;
}

.form-chat input:focus {
  outline: 2px solid #25d366;
}

.form-chat button {
  background: #075e54;
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
}

.form-chat button:disabled {
  opacity: 0.5;
  cursor: default;
}

.ficha-panel {
  flex: 0 0 320px;
  background: white;
  padding: 20px;
  border-left: 1px solid #ddd;
  overflow-y: auto;
}

.ficha-panel h2 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #555;
  margin: 0 0 16px;
}

.ficha-campo {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 0;
  border-bottom: 1px solid #eee;
}

.ficha-label {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
}

.ficha-valor {
  font-size: 14px;
  font-weight: 500;
}

.badge-urgencia,
.badge-estado {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  width: fit-content;
}

.badge-urgencia.baja {
  background: #e6f4ea;
  color: #1e7e34;
}

.badge-urgencia.media {
  background: #fff4e5;
  color: #b25e00;
}

.badge-urgencia.alta {
  background: #fdecea;
  color: #b3261e;
}

.badge-estado.pendiente {
  background: #eee;
  color: #555;
}

.badge-estado.confirmado {
  background: #e6f4ea;
  color: #1e7e34;
}

.badge-estado.cancelado {
  background: #fdecea;
  color: #b3261e;
}

@media (max-width: 720px) {
  .layout {
    flex-direction: column;
  }
  .ficha-panel {
    flex: 0 0 auto;
    border-left: none;
    border-top: 1px solid #ddd;
  }
}
